@authhero/widget 0.2.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/authhero-widget/authhero-widget.esm.js +1 -0
  2. package/dist/authhero-widget/index.esm.js +1 -0
  3. package/dist/authhero-widget/p-2e93c814.entry.js +1 -0
  4. package/dist/authhero-widget/p-539fc666.entry.js +1 -0
  5. package/dist/authhero-widget/p-DQuL1Twl.js +1 -0
  6. package/dist/authhero-widget/p-Doiemx6o.js +2 -0
  7. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  8. package/dist/cjs/authhero-node.cjs.entry.js +255 -0
  9. package/dist/cjs/authhero-widget.cjs.entry.js +577 -0
  10. package/dist/cjs/authhero-widget.cjs.js +25 -0
  11. package/dist/cjs/index-D0xitTOL.js +3788 -0
  12. package/dist/cjs/index.cjs.js +8123 -0
  13. package/dist/cjs/loader.cjs.js +13 -0
  14. package/dist/collection/collection-manifest.json +13 -0
  15. package/dist/collection/components/authhero-node/authhero-node.css +298 -0
  16. package/dist/collection/components/authhero-node/authhero-node.js +360 -0
  17. package/dist/collection/components/authhero-widget/authhero-widget.css +186 -0
  18. package/dist/collection/components/authhero-widget/authhero-widget.js +628 -0
  19. package/dist/collection/index.js +2 -0
  20. package/dist/collection/server/index.js +453 -0
  21. package/dist/collection/themes/index.js +71 -0
  22. package/dist/collection/types/components.js +8 -0
  23. package/dist/collection/utils/branding.js +248 -0
  24. package/dist/components/authhero-node.d.ts +11 -0
  25. package/dist/components/authhero-node.js +1 -0
  26. package/dist/components/authhero-widget.d.ts +11 -0
  27. package/dist/components/authhero-widget.js +1 -0
  28. package/dist/components/index.d.ts +35 -0
  29. package/dist/components/index.js +1 -0
  30. package/dist/components/p-086EZrPM.js +1 -0
  31. package/dist/components/p-DS6y_iDJ.js +1 -0
  32. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  33. package/dist/esm/authhero-node.entry.js +253 -0
  34. package/dist/esm/authhero-widget.entry.js +575 -0
  35. package/dist/esm/authhero-widget.js +21 -0
  36. package/dist/esm/index-Doiemx6o.js +3780 -0
  37. package/dist/esm/index.js +8122 -0
  38. package/dist/esm/loader.js +11 -0
  39. package/dist/index.cjs.js +1 -0
  40. package/dist/index.js +1 -0
  41. package/dist/types/components/authhero-node/authhero-node.d.ts +72 -0
  42. package/dist/types/components/authhero-widget/authhero-widget.d.ts +172 -0
  43. package/dist/types/components.d.ts +215 -0
  44. package/dist/types/index.d.ts +1 -0
  45. package/dist/types/server/index.d.ts +85 -0
  46. package/dist/types/stencil-public-runtime.d.ts +1839 -0
  47. package/dist/types/themes/index.d.ts +40 -0
  48. package/dist/types/types/components.d.ts +8 -0
  49. package/dist/types/utils/branding.d.ts +119 -0
  50. package/hydrate/index.d.ts +287 -0
  51. package/hydrate/index.js +23729 -0
  52. package/hydrate/index.mjs +23719 -0
  53. package/hydrate/package.json +12 -0
  54. package/loader/cdn.js +1 -0
  55. package/loader/index.cjs.js +1 -0
  56. package/loader/index.d.ts +24 -0
  57. package/loader/index.es2017.js +1 -0
  58. package/loader/index.js +2 -0
  59. package/package.json +1 -1
@@ -0,0 +1,3788 @@
1
+ 'use strict';
2
+
3
+ const NAMESPACE = 'authhero-widget';
4
+ const BUILD = /* authhero-widget */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, state: true, updatable: true};
5
+
6
+ /*
7
+ Stencil Client Platform v4.41.0 | MIT Licensed | https://stenciljs.com
8
+ */
9
+ var __create = Object.create;
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __getProtoOf = Object.getPrototypeOf;
14
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
15
+ var __typeError = (msg) => {
16
+ throw TypeError(msg);
17
+ };
18
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19
+ var __commonJS = (cb, mod) => function __require() {
20
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
21
+ };
22
+ var __export = (target, all) => {
23
+ for (var name in all)
24
+ __defProp(target, name, { get: all[name], enumerable: true });
25
+ };
26
+ var __copyProps = (to, from, except, desc) => {
27
+ if (from && typeof from === "object" || typeof from === "function") {
28
+ for (let key of __getOwnPropNames(from))
29
+ if (!__hasOwnProp.call(to, key) && key !== except)
30
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
31
+ }
32
+ return to;
33
+ };
34
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
35
+ // If the importer is in node compatibility mode or this is not an ESM
36
+ // file that has been converted to a CommonJS file using a Babel-
37
+ // compatible transform (i.e. "__esModule" has not been set), then set
38
+ // "default" to the CommonJS "module.exports" for node compatibility.
39
+ __defProp(target, "default", { value: mod, enumerable: true }) ,
40
+ mod
41
+ ));
42
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
43
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
44
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
45
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
46
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
47
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
48
+
49
+ // node_modules/balanced-match/index.js
50
+ var require_balanced_match = __commonJS({
51
+ "node_modules/balanced-match/index.js"(exports, module) {
52
+ module.exports = balanced;
53
+ function balanced(a, b, str) {
54
+ if (a instanceof RegExp) a = maybeMatch(a, str);
55
+ if (b instanceof RegExp) b = maybeMatch(b, str);
56
+ var r = range(a, b, str);
57
+ return r && {
58
+ start: r[0],
59
+ end: r[1],
60
+ pre: str.slice(0, r[0]),
61
+ body: str.slice(r[0] + a.length, r[1]),
62
+ post: str.slice(r[1] + b.length)
63
+ };
64
+ }
65
+ function maybeMatch(reg, str) {
66
+ var m = str.match(reg);
67
+ return m ? m[0] : null;
68
+ }
69
+ balanced.range = range;
70
+ function range(a, b, str) {
71
+ var begs, beg, left, right, result;
72
+ var ai = str.indexOf(a);
73
+ var bi = str.indexOf(b, ai + 1);
74
+ var i2 = ai;
75
+ if (ai >= 0 && bi > 0) {
76
+ if (a === b) {
77
+ return [ai, bi];
78
+ }
79
+ begs = [];
80
+ left = str.length;
81
+ while (i2 >= 0 && !result) {
82
+ if (i2 == ai) {
83
+ begs.push(i2);
84
+ ai = str.indexOf(a, i2 + 1);
85
+ } else if (begs.length == 1) {
86
+ result = [begs.pop(), bi];
87
+ } else {
88
+ beg = begs.pop();
89
+ if (beg < left) {
90
+ left = beg;
91
+ right = bi;
92
+ }
93
+ bi = str.indexOf(b, i2 + 1);
94
+ }
95
+ i2 = ai < bi && ai >= 0 ? ai : bi;
96
+ }
97
+ if (begs.length) {
98
+ result = [left, right];
99
+ }
100
+ }
101
+ return result;
102
+ }
103
+ }
104
+ });
105
+
106
+ // node_modules/brace-expansion/index.js
107
+ var require_brace_expansion = __commonJS({
108
+ "node_modules/brace-expansion/index.js"(exports, module) {
109
+ var balanced = require_balanced_match();
110
+ module.exports = expandTop;
111
+ var escSlash = "\0SLASH" + Math.random() + "\0";
112
+ var escOpen = "\0OPEN" + Math.random() + "\0";
113
+ var escClose = "\0CLOSE" + Math.random() + "\0";
114
+ var escComma = "\0COMMA" + Math.random() + "\0";
115
+ var escPeriod = "\0PERIOD" + Math.random() + "\0";
116
+ function numeric(str) {
117
+ return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
118
+ }
119
+ function escapeBraces(str) {
120
+ return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
121
+ }
122
+ function unescapeBraces(str) {
123
+ return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
124
+ }
125
+ function parseCommaParts(str) {
126
+ if (!str)
127
+ return [""];
128
+ var parts = [];
129
+ var m = balanced("{", "}", str);
130
+ if (!m)
131
+ return str.split(",");
132
+ var pre = m.pre;
133
+ var body = m.body;
134
+ var post = m.post;
135
+ var p = pre.split(",");
136
+ p[p.length - 1] += "{" + body + "}";
137
+ var postParts = parseCommaParts(post);
138
+ if (post.length) {
139
+ p[p.length - 1] += postParts.shift();
140
+ p.push.apply(p, postParts);
141
+ }
142
+ parts.push.apply(parts, p);
143
+ return parts;
144
+ }
145
+ function expandTop(str) {
146
+ if (!str)
147
+ return [];
148
+ if (str.substr(0, 2) === "{}") {
149
+ str = "\\{\\}" + str.substr(2);
150
+ }
151
+ return expand2(escapeBraces(str), true).map(unescapeBraces);
152
+ }
153
+ function embrace(str) {
154
+ return "{" + str + "}";
155
+ }
156
+ function isPadded(el) {
157
+ return /^-?0\d/.test(el);
158
+ }
159
+ function lte(i2, y) {
160
+ return i2 <= y;
161
+ }
162
+ function gte(i2, y) {
163
+ return i2 >= y;
164
+ }
165
+ function expand2(str, isTop) {
166
+ var expansions = [];
167
+ var m = balanced("{", "}", str);
168
+ if (!m) return [str];
169
+ var pre = m.pre;
170
+ var post = m.post.length ? expand2(m.post, false) : [""];
171
+ if (/\$$/.test(m.pre)) {
172
+ for (var k = 0; k < post.length; k++) {
173
+ var expansion = pre + "{" + m.body + "}" + post[k];
174
+ expansions.push(expansion);
175
+ }
176
+ } else {
177
+ var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
178
+ var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
179
+ var isSequence = isNumericSequence || isAlphaSequence;
180
+ var isOptions = m.body.indexOf(",") >= 0;
181
+ if (!isSequence && !isOptions) {
182
+ if (m.post.match(/,(?!,).*\}/)) {
183
+ str = m.pre + "{" + m.body + escClose + m.post;
184
+ return expand2(str);
185
+ }
186
+ return [str];
187
+ }
188
+ var n;
189
+ if (isSequence) {
190
+ n = m.body.split(/\.\./);
191
+ } else {
192
+ n = parseCommaParts(m.body);
193
+ if (n.length === 1) {
194
+ n = expand2(n[0], false).map(embrace);
195
+ if (n.length === 1) {
196
+ return post.map(function(p) {
197
+ return m.pre + n[0] + p;
198
+ });
199
+ }
200
+ }
201
+ }
202
+ var N;
203
+ if (isSequence) {
204
+ var x = numeric(n[0]);
205
+ var y = numeric(n[1]);
206
+ var width = Math.max(n[0].length, n[1].length);
207
+ var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
208
+ var test = lte;
209
+ var reverse = y < x;
210
+ if (reverse) {
211
+ incr *= -1;
212
+ test = gte;
213
+ }
214
+ var pad = n.some(isPadded);
215
+ N = [];
216
+ for (var i2 = x; test(i2, y); i2 += incr) {
217
+ var c;
218
+ if (isAlphaSequence) {
219
+ c = String.fromCharCode(i2);
220
+ if (c === "\\")
221
+ c = "";
222
+ } else {
223
+ c = String(i2);
224
+ if (pad) {
225
+ var need = width - c.length;
226
+ if (need > 0) {
227
+ var z = new Array(need + 1).join("0");
228
+ if (i2 < 0)
229
+ c = "-" + z + c.slice(1);
230
+ else
231
+ c = z + c;
232
+ }
233
+ }
234
+ }
235
+ N.push(c);
236
+ }
237
+ } else {
238
+ N = [];
239
+ for (var j = 0; j < n.length; j++) {
240
+ N.push.apply(N, expand2(n[j], false));
241
+ }
242
+ }
243
+ for (var j = 0; j < N.length; j++) {
244
+ for (var k = 0; k < post.length; k++) {
245
+ var expansion = pre + N[j] + post[k];
246
+ if (!isTop || isSequence || expansion)
247
+ expansions.push(expansion);
248
+ }
249
+ }
250
+ }
251
+ return expansions;
252
+ }
253
+ }
254
+ });
255
+ var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
256
+ PrimitiveType2["Undefined"] = "undefined";
257
+ PrimitiveType2["Null"] = "null";
258
+ PrimitiveType2["String"] = "string";
259
+ PrimitiveType2["Number"] = "number";
260
+ PrimitiveType2["SpecialNumber"] = "number";
261
+ PrimitiveType2["Boolean"] = "boolean";
262
+ PrimitiveType2["BigInt"] = "bigint";
263
+ return PrimitiveType2;
264
+ })(PrimitiveType || {});
265
+ var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
266
+ NonPrimitiveType2["Array"] = "array";
267
+ NonPrimitiveType2["Date"] = "date";
268
+ NonPrimitiveType2["Map"] = "map";
269
+ NonPrimitiveType2["Object"] = "object";
270
+ NonPrimitiveType2["RegularExpression"] = "regexp";
271
+ NonPrimitiveType2["Set"] = "set";
272
+ NonPrimitiveType2["Channel"] = "channel";
273
+ NonPrimitiveType2["Symbol"] = "symbol";
274
+ return NonPrimitiveType2;
275
+ })(NonPrimitiveType || {});
276
+ var TYPE_CONSTANT = "type";
277
+ var VALUE_CONSTANT = "value";
278
+ var SERIALIZED_PREFIX = "serialized:";
279
+ var reWireGetterSetter = (instance, hostRef) => {
280
+ var _a;
281
+ const cmpMeta = hostRef.$cmpMeta$;
282
+ const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
283
+ members.map(([memberName, [memberFlags]]) => {
284
+ if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
285
+ const ogValue = instance[memberName];
286
+ const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName) || Object.getOwnPropertyDescriptor(instance, memberName);
287
+ if (ogDescriptor) {
288
+ Object.defineProperty(instance, memberName, {
289
+ get() {
290
+ return ogDescriptor.get.call(this);
291
+ },
292
+ set(newValue) {
293
+ ogDescriptor.set.call(this, newValue);
294
+ },
295
+ configurable: true,
296
+ enumerable: true
297
+ });
298
+ }
299
+ instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue;
300
+ }
301
+ });
302
+ };
303
+ function getPropertyDescriptor(obj, memberName) {
304
+ while (obj) {
305
+ const desc = Object.getOwnPropertyDescriptor(obj, memberName);
306
+ if (desc == null ? void 0 : desc.get) return desc;
307
+ obj = Object.getPrototypeOf(obj);
308
+ }
309
+ return void 0;
310
+ }
311
+
312
+ // src/client/client-host-ref.ts
313
+ var getHostRef = (ref) => {
314
+ if (ref.__stencil__getHostRef) {
315
+ return ref.__stencil__getHostRef();
316
+ }
317
+ return void 0;
318
+ };
319
+ var registerInstance = (lazyInstance, hostRef) => {
320
+ if (!hostRef) return;
321
+ lazyInstance.__stencil__getHostRef = () => hostRef;
322
+ hostRef.$lazyInstance$ = lazyInstance;
323
+ if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.state)) {
324
+ reWireGetterSetter(lazyInstance, hostRef);
325
+ }
326
+ };
327
+ var registerHost = (hostElement, cmpMeta) => {
328
+ const hostRef = {
329
+ $flags$: 0,
330
+ $hostElement$: hostElement,
331
+ $cmpMeta$: cmpMeta,
332
+ $instanceValues$: /* @__PURE__ */ new Map(),
333
+ $serializerValues$: /* @__PURE__ */ new Map()
334
+ };
335
+ {
336
+ hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
337
+ hostElement["s-p"] = [];
338
+ hostElement["s-rc"] = [];
339
+ }
340
+ {
341
+ hostRef.$fetchedCbList$ = [];
342
+ }
343
+ const ref = hostRef;
344
+ hostElement.__stencil__getHostRef = () => ref;
345
+ return ref;
346
+ };
347
+ var isMemberInElement = (elm, memberName) => memberName in elm;
348
+ var consoleError = (e, el) => (0, console.error)(e, el);
349
+
350
+ // src/client/client-load-module.ts
351
+ var cmpModules = /* @__PURE__ */ new Map();
352
+ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
353
+ const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
354
+ const bundleId = cmpMeta.$lazyBundleId$;
355
+ if (!bundleId) {
356
+ return void 0;
357
+ }
358
+ const module = cmpModules.get(bundleId) ;
359
+ if (module) {
360
+ return module[exportName];
361
+ }
362
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
363
+ return import(
364
+ /* @vite-ignore */
365
+ /* webpackInclude: /\.entry\.js$/ */
366
+ /* webpackExclude: /\.system\.entry\.js$/ */
367
+ /* webpackMode: "lazy" */
368
+ `./${bundleId}.entry.js${""}`
369
+ ).then(
370
+ (importedModule) => {
371
+ {
372
+ cmpModules.set(bundleId, importedModule);
373
+ }
374
+ return importedModule[exportName];
375
+ },
376
+ (e) => {
377
+ consoleError(e, hostRef.$hostElement$);
378
+ }
379
+ );
380
+ };
381
+
382
+ // src/client/client-style.ts
383
+ var styles = /* @__PURE__ */ new Map();
384
+
385
+ // src/runtime/runtime-constants.ts
386
+ var CONTENT_REF_ID = "r";
387
+ var ORG_LOCATION_ID = "o";
388
+ var SLOT_NODE_ID = "s";
389
+ var TEXT_NODE_ID = "t";
390
+ var COMMENT_NODE_ID = "c";
391
+ var HYDRATE_ID = "s-id";
392
+ var HYDRATED_STYLE_ID = "sty-id";
393
+ var HYDRATE_CHILD_ID = "c-id";
394
+ var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
395
+ var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
396
+ var win = typeof window !== "undefined" ? window : {};
397
+ var plt = {
398
+ $flags$: 0,
399
+ $resourcesUrl$: "",
400
+ jmp: (h2) => h2(),
401
+ raf: (h2) => requestAnimationFrame(h2),
402
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
403
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
404
+ ce: (eventName, opts) => new CustomEvent(eventName, opts)
405
+ };
406
+ var promiseResolve = (v) => Promise.resolve(v);
407
+ var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
408
+ try {
409
+ if (!win.document.adoptedStyleSheets) {
410
+ return false;
411
+ }
412
+ new CSSStyleSheet();
413
+ return typeof new CSSStyleSheet().replaceSync === "function";
414
+ } catch (e) {
415
+ }
416
+ return false;
417
+ })() ;
418
+ var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
419
+ var queuePending = false;
420
+ var queueDomReads = [];
421
+ var queueDomWrites = [];
422
+ var queueTask = (queue, write) => (cb) => {
423
+ queue.push(cb);
424
+ if (!queuePending) {
425
+ queuePending = true;
426
+ if (write && plt.$flags$ & 4 /* queueSync */) {
427
+ nextTick(flush);
428
+ } else {
429
+ plt.raf(flush);
430
+ }
431
+ }
432
+ };
433
+ var consume = (queue) => {
434
+ for (let i2 = 0; i2 < queue.length; i2++) {
435
+ try {
436
+ queue[i2](performance.now());
437
+ } catch (e) {
438
+ consoleError(e);
439
+ }
440
+ }
441
+ queue.length = 0;
442
+ };
443
+ var flush = () => {
444
+ consume(queueDomReads);
445
+ {
446
+ consume(queueDomWrites);
447
+ if (queuePending = queueDomReads.length > 0) {
448
+ plt.raf(flush);
449
+ }
450
+ }
451
+ };
452
+ var nextTick = (cb) => promiseResolve().then(cb);
453
+ var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
454
+ var isComplexType = (o) => {
455
+ o = typeof o;
456
+ return o === "object" || o === "function";
457
+ };
458
+
459
+ // node_modules/minimatch/dist/esm/index.js
460
+ var import_brace_expansion = __toESM(require_brace_expansion());
461
+
462
+ // node_modules/minimatch/dist/esm/assert-valid-pattern.js
463
+ var MAX_PATTERN_LENGTH = 1024 * 64;
464
+ var assertValidPattern = (pattern) => {
465
+ if (typeof pattern !== "string") {
466
+ throw new TypeError("invalid pattern");
467
+ }
468
+ if (pattern.length > MAX_PATTERN_LENGTH) {
469
+ throw new TypeError("pattern is too long");
470
+ }
471
+ };
472
+
473
+ // node_modules/minimatch/dist/esm/brace-expressions.js
474
+ var posixClasses = {
475
+ "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
476
+ "[:alpha:]": ["\\p{L}\\p{Nl}", true],
477
+ "[:ascii:]": ["\\x00-\\x7f", false],
478
+ "[:blank:]": ["\\p{Zs}\\t", true],
479
+ "[:cntrl:]": ["\\p{Cc}", true],
480
+ "[:digit:]": ["\\p{Nd}", true],
481
+ "[:graph:]": ["\\p{Z}\\p{C}", true, true],
482
+ "[:lower:]": ["\\p{Ll}", true],
483
+ "[:print:]": ["\\p{C}", true],
484
+ "[:punct:]": ["\\p{P}", true],
485
+ "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
486
+ "[:upper:]": ["\\p{Lu}", true],
487
+ "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
488
+ "[:xdigit:]": ["A-Fa-f0-9", false]
489
+ };
490
+ var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
491
+ var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
492
+ var rangesToString = (ranges) => ranges.join("");
493
+ var parseClass = (glob, position) => {
494
+ const pos = position;
495
+ if (glob.charAt(pos) !== "[") {
496
+ throw new Error("not in a brace expression");
497
+ }
498
+ const ranges = [];
499
+ const negs = [];
500
+ let i2 = pos + 1;
501
+ let sawStart = false;
502
+ let uflag = false;
503
+ let escaping = false;
504
+ let negate = false;
505
+ let endPos = pos;
506
+ let rangeStart = "";
507
+ WHILE: while (i2 < glob.length) {
508
+ const c = glob.charAt(i2);
509
+ if ((c === "!" || c === "^") && i2 === pos + 1) {
510
+ negate = true;
511
+ i2++;
512
+ continue;
513
+ }
514
+ if (c === "]" && sawStart && !escaping) {
515
+ endPos = i2 + 1;
516
+ break;
517
+ }
518
+ sawStart = true;
519
+ if (c === "\\") {
520
+ if (!escaping) {
521
+ escaping = true;
522
+ i2++;
523
+ continue;
524
+ }
525
+ }
526
+ if (c === "[" && !escaping) {
527
+ for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
528
+ if (glob.startsWith(cls, i2)) {
529
+ if (rangeStart) {
530
+ return ["$.", false, glob.length - pos, true];
531
+ }
532
+ i2 += cls.length;
533
+ if (neg)
534
+ negs.push(unip);
535
+ else
536
+ ranges.push(unip);
537
+ uflag = uflag || u;
538
+ continue WHILE;
539
+ }
540
+ }
541
+ }
542
+ escaping = false;
543
+ if (rangeStart) {
544
+ if (c > rangeStart) {
545
+ ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
546
+ } else if (c === rangeStart) {
547
+ ranges.push(braceEscape(c));
548
+ }
549
+ rangeStart = "";
550
+ i2++;
551
+ continue;
552
+ }
553
+ if (glob.startsWith("-]", i2 + 1)) {
554
+ ranges.push(braceEscape(c + "-"));
555
+ i2 += 2;
556
+ continue;
557
+ }
558
+ if (glob.startsWith("-", i2 + 1)) {
559
+ rangeStart = c;
560
+ i2 += 2;
561
+ continue;
562
+ }
563
+ ranges.push(braceEscape(c));
564
+ i2++;
565
+ }
566
+ if (endPos < i2) {
567
+ return ["", false, 0, false];
568
+ }
569
+ if (!ranges.length && !negs.length) {
570
+ return ["$.", false, glob.length - pos, true];
571
+ }
572
+ if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
573
+ const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
574
+ return [regexpEscape(r), false, endPos - pos, false];
575
+ }
576
+ const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
577
+ const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
578
+ const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
579
+ return [comb, uflag, endPos - pos, true];
580
+ };
581
+
582
+ // node_modules/minimatch/dist/esm/unescape.js
583
+ var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
584
+ return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
585
+ };
586
+
587
+ // node_modules/minimatch/dist/esm/ast.js
588
+ var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
589
+ var isExtglobType = (c) => types.has(c);
590
+ var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
591
+ var startNoDot = "(?!\\.)";
592
+ var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
593
+ var justDots = /* @__PURE__ */ new Set(["..", "."]);
594
+ var reSpecials = new Set("().*{}+?[]^$\\!");
595
+ var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
596
+ var qmark = "[^/]";
597
+ var star = qmark + "*?";
598
+ var starNoEmpty = qmark + "+?";
599
+ var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn;
600
+ var _AST = class _AST {
601
+ constructor(type, parent, options = {}) {
602
+ __privateAdd(this, _AST_instances);
603
+ __publicField(this, "type");
604
+ __privateAdd(this, _root);
605
+ __privateAdd(this, _hasMagic);
606
+ __privateAdd(this, _uflag, false);
607
+ __privateAdd(this, _parts, []);
608
+ __privateAdd(this, _parent);
609
+ __privateAdd(this, _parentIndex);
610
+ __privateAdd(this, _negs);
611
+ __privateAdd(this, _filledNegs, false);
612
+ __privateAdd(this, _options);
613
+ __privateAdd(this, _toString);
614
+ // set to true if it's an extglob with no children
615
+ // (which really means one child of '')
616
+ __privateAdd(this, _emptyExt, false);
617
+ this.type = type;
618
+ if (type)
619
+ __privateSet(this, _hasMagic, true);
620
+ __privateSet(this, _parent, parent);
621
+ __privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
622
+ __privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
623
+ __privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
624
+ if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
625
+ __privateGet(this, _negs).push(this);
626
+ __privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
627
+ }
628
+ get hasMagic() {
629
+ if (__privateGet(this, _hasMagic) !== void 0)
630
+ return __privateGet(this, _hasMagic);
631
+ for (const p of __privateGet(this, _parts)) {
632
+ if (typeof p === "string")
633
+ continue;
634
+ if (p.type || p.hasMagic)
635
+ return __privateSet(this, _hasMagic, true);
636
+ }
637
+ return __privateGet(this, _hasMagic);
638
+ }
639
+ // reconstructs the pattern
640
+ toString() {
641
+ if (__privateGet(this, _toString) !== void 0)
642
+ return __privateGet(this, _toString);
643
+ if (!this.type) {
644
+ return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
645
+ } else {
646
+ return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
647
+ }
648
+ }
649
+ push(...parts) {
650
+ for (const p of parts) {
651
+ if (p === "")
652
+ continue;
653
+ if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
654
+ throw new Error("invalid part: " + p);
655
+ }
656
+ __privateGet(this, _parts).push(p);
657
+ }
658
+ }
659
+ toJSON() {
660
+ var _a;
661
+ const ret = this.type === null ? __privateGet(this, _parts).slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...__privateGet(this, _parts).map((p) => p.toJSON())];
662
+ if (this.isStart() && !this.type)
663
+ ret.unshift([]);
664
+ if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")) {
665
+ ret.push({});
666
+ }
667
+ return ret;
668
+ }
669
+ isStart() {
670
+ var _a;
671
+ if (__privateGet(this, _root) === this)
672
+ return true;
673
+ if (!((_a = __privateGet(this, _parent)) == null ? void 0 : _a.isStart()))
674
+ return false;
675
+ if (__privateGet(this, _parentIndex) === 0)
676
+ return true;
677
+ const p = __privateGet(this, _parent);
678
+ for (let i2 = 0; i2 < __privateGet(this, _parentIndex); i2++) {
679
+ const pp = __privateGet(p, _parts)[i2];
680
+ if (!(pp instanceof _AST && pp.type === "!")) {
681
+ return false;
682
+ }
683
+ }
684
+ return true;
685
+ }
686
+ isEnd() {
687
+ var _a, _b, _c;
688
+ if (__privateGet(this, _root) === this)
689
+ return true;
690
+ if (((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")
691
+ return true;
692
+ if (!((_b = __privateGet(this, _parent)) == null ? void 0 : _b.isEnd()))
693
+ return false;
694
+ if (!this.type)
695
+ return (_c = __privateGet(this, _parent)) == null ? void 0 : _c.isEnd();
696
+ const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
697
+ return __privateGet(this, _parentIndex) === pl - 1;
698
+ }
699
+ copyIn(part) {
700
+ if (typeof part === "string")
701
+ this.push(part);
702
+ else
703
+ this.push(part.clone(this));
704
+ }
705
+ clone(parent) {
706
+ const c = new _AST(this.type, parent);
707
+ for (const p of __privateGet(this, _parts)) {
708
+ c.copyIn(p);
709
+ }
710
+ return c;
711
+ }
712
+ static fromGlob(pattern, options = {}) {
713
+ var _a;
714
+ const ast = new _AST(null, void 0, options);
715
+ __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, pattern, ast, 0, options);
716
+ return ast;
717
+ }
718
+ // returns the regular expression if there's magic, or the unescaped
719
+ // string if not.
720
+ toMMPattern() {
721
+ if (this !== __privateGet(this, _root))
722
+ return __privateGet(this, _root).toMMPattern();
723
+ const glob = this.toString();
724
+ const [re, body, hasMagic, uflag] = this.toRegExpSource();
725
+ const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
726
+ if (!anyMagic) {
727
+ return body;
728
+ }
729
+ const flags = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
730
+ return Object.assign(new RegExp(`^${re}$`, flags), {
731
+ _src: re,
732
+ _glob: glob
733
+ });
734
+ }
735
+ get options() {
736
+ return __privateGet(this, _options);
737
+ }
738
+ // returns the string match, the regexp source, whether there's magic
739
+ // in the regexp (so a regular expression is required) and whether or
740
+ // not the uflag is needed for the regular expression (for posix classes)
741
+ // TODO: instead of injecting the start/end at this point, just return
742
+ // the BODY of the regexp, along with the start/end portions suitable
743
+ // for binding the start/end in either a joined full-path makeRe context
744
+ // (where we bind to (^|/), or a standalone matchPart context (where
745
+ // we bind to ^, and not /). Otherwise slashes get duped!
746
+ //
747
+ // In part-matching mode, the start is:
748
+ // - if not isStart: nothing
749
+ // - if traversal possible, but not allowed: ^(?!\.\.?$)
750
+ // - if dots allowed or not possible: ^
751
+ // - if dots possible and not allowed: ^(?!\.)
752
+ // end is:
753
+ // - if not isEnd(): nothing
754
+ // - else: $
755
+ //
756
+ // In full-path matching mode, we put the slash at the START of the
757
+ // pattern, so start is:
758
+ // - if first pattern: same as part-matching mode
759
+ // - if not isStart(): nothing
760
+ // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
761
+ // - if dots allowed or not possible: /
762
+ // - if dots possible and not allowed: /(?!\.)
763
+ // end is:
764
+ // - if last pattern, same as part-matching mode
765
+ // - else nothing
766
+ //
767
+ // Always put the (?:$|/) on negated tails, though, because that has to be
768
+ // there to bind the end of the negated pattern portion, and it's easier to
769
+ // just stick it in now rather than try to inject it later in the middle of
770
+ // the pattern.
771
+ //
772
+ // We can just always return the same end, and leave it up to the caller
773
+ // to know whether it's going to be used joined or in parts.
774
+ // And, if the start is adjusted slightly, can do the same there:
775
+ // - if not isStart: nothing
776
+ // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
777
+ // - if dots allowed or not possible: (?:/|^)
778
+ // - if dots possible and not allowed: (?:/|^)(?!\.)
779
+ //
780
+ // But it's better to have a simpler binding without a conditional, for
781
+ // performance, so probably better to return both start options.
782
+ //
783
+ // Then the caller just ignores the end if it's not the first pattern,
784
+ // and the start always gets applied.
785
+ //
786
+ // But that's always going to be $ if it's the ending pattern, or nothing,
787
+ // so the caller can just attach $ at the end of the pattern when building.
788
+ //
789
+ // So the todo is:
790
+ // - better detect what kind of start is needed
791
+ // - return both flavors of starting pattern
792
+ // - attach $ at the end of the pattern when creating the actual RegExp
793
+ //
794
+ // Ah, but wait, no, that all only applies to the root when the first pattern
795
+ // is not an extglob. If the first pattern IS an extglob, then we need all
796
+ // that dot prevention biz to live in the extglob portions, because eg
797
+ // +(*|.x*) can match .xy but not .yx.
798
+ //
799
+ // So, return the two flavors if it's #root and the first child is not an
800
+ // AST, otherwise leave it to the child AST to handle it, and there,
801
+ // use the (?:^|/) style of start binding.
802
+ //
803
+ // Even simplified further:
804
+ // - Since the start for a join is eg /(?!\.) and the start for a part
805
+ // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
806
+ // or start or whatever) and prepend ^ or / at the Regexp construction.
807
+ toRegExpSource(allowDot) {
808
+ var _a;
809
+ const dot = allowDot != null ? allowDot : !!__privateGet(this, _options).dot;
810
+ if (__privateGet(this, _root) === this)
811
+ __privateMethod(this, _AST_instances, fillNegs_fn).call(this);
812
+ if (!this.type) {
813
+ const noEmpty = this.isStart() && this.isEnd();
814
+ const src = __privateGet(this, _parts).map((p) => {
815
+ var _a2;
816
+ const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a2 = _AST, _AST_static, parseGlob_fn).call(_a2, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
817
+ __privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
818
+ __privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
819
+ return re;
820
+ }).join("");
821
+ let start2 = "";
822
+ if (this.isStart()) {
823
+ if (typeof __privateGet(this, _parts)[0] === "string") {
824
+ const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
825
+ if (!dotTravAllowed) {
826
+ const aps = addPatternStart;
827
+ const needNoTrav = (
828
+ // dots are allowed, and the pattern starts with [ or .
829
+ dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
830
+ src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
831
+ src.startsWith("\\.\\.") && aps.has(src.charAt(4))
832
+ );
833
+ const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
834
+ start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
835
+ }
836
+ }
837
+ }
838
+ let end = "";
839
+ if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!") {
840
+ end = "(?:$|\\/)";
841
+ }
842
+ const final2 = start2 + src + end;
843
+ return [
844
+ final2,
845
+ unescape(src),
846
+ __privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
847
+ __privateGet(this, _uflag)
848
+ ];
849
+ }
850
+ const repeated = this.type === "*" || this.type === "+";
851
+ const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
852
+ let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
853
+ if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
854
+ const s = this.toString();
855
+ __privateSet(this, _parts, [s]);
856
+ this.type = null;
857
+ __privateSet(this, _hasMagic, void 0);
858
+ return [s, unescape(this.toString()), false, false];
859
+ }
860
+ let bodyDotAllowed = !repeated || allowDot || dot || false ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
861
+ if (bodyDotAllowed === body) {
862
+ bodyDotAllowed = "";
863
+ }
864
+ if (bodyDotAllowed) {
865
+ body = `(?:${body})(?:${bodyDotAllowed})*?`;
866
+ }
867
+ let final = "";
868
+ if (this.type === "!" && __privateGet(this, _emptyExt)) {
869
+ final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
870
+ } else {
871
+ const close = this.type === "!" ? (
872
+ // !() must match something,but !(x) can match ''
873
+ "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
874
+ ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
875
+ final = start + body + close;
876
+ }
877
+ return [
878
+ final,
879
+ unescape(body),
880
+ __privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
881
+ __privateGet(this, _uflag)
882
+ ];
883
+ }
884
+ };
885
+ _root = new WeakMap();
886
+ _hasMagic = new WeakMap();
887
+ _uflag = new WeakMap();
888
+ _parts = new WeakMap();
889
+ _parent = new WeakMap();
890
+ _parentIndex = new WeakMap();
891
+ _negs = new WeakMap();
892
+ _filledNegs = new WeakMap();
893
+ _options = new WeakMap();
894
+ _toString = new WeakMap();
895
+ _emptyExt = new WeakMap();
896
+ _AST_instances = new WeakSet();
897
+ fillNegs_fn = function() {
898
+ if (this !== __privateGet(this, _root))
899
+ throw new Error("should only call on root");
900
+ if (__privateGet(this, _filledNegs))
901
+ return this;
902
+ this.toString();
903
+ __privateSet(this, _filledNegs, true);
904
+ let n;
905
+ while (n = __privateGet(this, _negs).pop()) {
906
+ if (n.type !== "!")
907
+ continue;
908
+ let p = n;
909
+ let pp = __privateGet(p, _parent);
910
+ while (pp) {
911
+ for (let i2 = __privateGet(p, _parentIndex) + 1; !pp.type && i2 < __privateGet(pp, _parts).length; i2++) {
912
+ for (const part of __privateGet(n, _parts)) {
913
+ if (typeof part === "string") {
914
+ throw new Error("string part in extglob AST??");
915
+ }
916
+ part.copyIn(__privateGet(pp, _parts)[i2]);
917
+ }
918
+ }
919
+ p = pp;
920
+ pp = __privateGet(p, _parent);
921
+ }
922
+ }
923
+ return this;
924
+ };
925
+ _AST_static = new WeakSet();
926
+ parseAST_fn = function(str, ast, pos, opt) {
927
+ var _a, _b;
928
+ let escaping = false;
929
+ let inBrace = false;
930
+ let braceStart = -1;
931
+ let braceNeg = false;
932
+ if (ast.type === null) {
933
+ let i3 = pos;
934
+ let acc2 = "";
935
+ while (i3 < str.length) {
936
+ const c = str.charAt(i3++);
937
+ if (escaping || c === "\\") {
938
+ escaping = !escaping;
939
+ acc2 += c;
940
+ continue;
941
+ }
942
+ if (inBrace) {
943
+ if (i3 === braceStart + 1) {
944
+ if (c === "^" || c === "!") {
945
+ braceNeg = true;
946
+ }
947
+ } else if (c === "]" && !(i3 === braceStart + 2 && braceNeg)) {
948
+ inBrace = false;
949
+ }
950
+ acc2 += c;
951
+ continue;
952
+ } else if (c === "[") {
953
+ inBrace = true;
954
+ braceStart = i3;
955
+ braceNeg = false;
956
+ acc2 += c;
957
+ continue;
958
+ }
959
+ if (!opt.noext && isExtglobType(c) && str.charAt(i3) === "(") {
960
+ ast.push(acc2);
961
+ acc2 = "";
962
+ const ext2 = new _AST(c, ast);
963
+ i3 = __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, str, ext2, i3, opt);
964
+ ast.push(ext2);
965
+ continue;
966
+ }
967
+ acc2 += c;
968
+ }
969
+ ast.push(acc2);
970
+ return i3;
971
+ }
972
+ let i2 = pos + 1;
973
+ let part = new _AST(null, ast);
974
+ const parts = [];
975
+ let acc = "";
976
+ while (i2 < str.length) {
977
+ const c = str.charAt(i2++);
978
+ if (escaping || c === "\\") {
979
+ escaping = !escaping;
980
+ acc += c;
981
+ continue;
982
+ }
983
+ if (inBrace) {
984
+ if (i2 === braceStart + 1) {
985
+ if (c === "^" || c === "!") {
986
+ braceNeg = true;
987
+ }
988
+ } else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
989
+ inBrace = false;
990
+ }
991
+ acc += c;
992
+ continue;
993
+ } else if (c === "[") {
994
+ inBrace = true;
995
+ braceStart = i2;
996
+ braceNeg = false;
997
+ acc += c;
998
+ continue;
999
+ }
1000
+ if (isExtglobType(c) && str.charAt(i2) === "(") {
1001
+ part.push(acc);
1002
+ acc = "";
1003
+ const ext2 = new _AST(c, part);
1004
+ part.push(ext2);
1005
+ i2 = __privateMethod(_b = _AST, _AST_static, parseAST_fn).call(_b, str, ext2, i2, opt);
1006
+ continue;
1007
+ }
1008
+ if (c === "|") {
1009
+ part.push(acc);
1010
+ acc = "";
1011
+ parts.push(part);
1012
+ part = new _AST(null, ast);
1013
+ continue;
1014
+ }
1015
+ if (c === ")") {
1016
+ if (acc === "" && __privateGet(ast, _parts).length === 0) {
1017
+ __privateSet(ast, _emptyExt, true);
1018
+ }
1019
+ part.push(acc);
1020
+ acc = "";
1021
+ ast.push(...parts, part);
1022
+ return i2;
1023
+ }
1024
+ acc += c;
1025
+ }
1026
+ ast.type = null;
1027
+ __privateSet(ast, _hasMagic, void 0);
1028
+ __privateSet(ast, _parts, [str.substring(pos - 1)]);
1029
+ return i2;
1030
+ };
1031
+ partsToRegExp_fn = function(dot) {
1032
+ return __privateGet(this, _parts).map((p) => {
1033
+ if (typeof p === "string") {
1034
+ throw new Error("string type in extglob ast??");
1035
+ }
1036
+ const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
1037
+ __privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
1038
+ return re;
1039
+ }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
1040
+ };
1041
+ parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
1042
+ let escaping = false;
1043
+ let re = "";
1044
+ let uflag = false;
1045
+ for (let i2 = 0; i2 < glob.length; i2++) {
1046
+ const c = glob.charAt(i2);
1047
+ if (escaping) {
1048
+ escaping = false;
1049
+ re += (reSpecials.has(c) ? "\\" : "") + c;
1050
+ continue;
1051
+ }
1052
+ if (c === "\\") {
1053
+ if (i2 === glob.length - 1) {
1054
+ re += "\\\\";
1055
+ } else {
1056
+ escaping = true;
1057
+ }
1058
+ continue;
1059
+ }
1060
+ if (c === "[") {
1061
+ const [src, needUflag, consumed, magic] = parseClass(glob, i2);
1062
+ if (consumed) {
1063
+ re += src;
1064
+ uflag = uflag || needUflag;
1065
+ i2 += consumed - 1;
1066
+ hasMagic = hasMagic || magic;
1067
+ continue;
1068
+ }
1069
+ }
1070
+ if (c === "*") {
1071
+ if (noEmpty && glob === "*")
1072
+ re += starNoEmpty;
1073
+ else
1074
+ re += star;
1075
+ hasMagic = true;
1076
+ continue;
1077
+ }
1078
+ if (c === "?") {
1079
+ re += qmark;
1080
+ hasMagic = true;
1081
+ continue;
1082
+ }
1083
+ re += regExpEscape(c);
1084
+ }
1085
+ return [re, unescape(glob), !!hasMagic, uflag];
1086
+ };
1087
+ __privateAdd(_AST, _AST_static);
1088
+ var AST = _AST;
1089
+
1090
+ // node_modules/minimatch/dist/esm/escape.js
1091
+ var escape = (s, { windowsPathsNoEscape = false } = {}) => {
1092
+ return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
1093
+ };
1094
+
1095
+ // node_modules/minimatch/dist/esm/index.js
1096
+ var minimatch = (p, pattern, options = {}) => {
1097
+ assertValidPattern(pattern);
1098
+ if (!options.nocomment && pattern.charAt(0) === "#") {
1099
+ return false;
1100
+ }
1101
+ return new Minimatch(pattern, options).match(p);
1102
+ };
1103
+ var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
1104
+ var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
1105
+ var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
1106
+ var starDotExtTestNocase = (ext2) => {
1107
+ ext2 = ext2.toLowerCase();
1108
+ return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
1109
+ };
1110
+ var starDotExtTestNocaseDot = (ext2) => {
1111
+ ext2 = ext2.toLowerCase();
1112
+ return (f) => f.toLowerCase().endsWith(ext2);
1113
+ };
1114
+ var starDotStarRE = /^\*+\.\*+$/;
1115
+ var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
1116
+ var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
1117
+ var dotStarRE = /^\.\*+$/;
1118
+ var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
1119
+ var starRE = /^\*+$/;
1120
+ var starTest = (f) => f.length !== 0 && !f.startsWith(".");
1121
+ var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
1122
+ var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
1123
+ var qmarksTestNocase = ([$0, ext2 = ""]) => {
1124
+ const noext = qmarksTestNoExt([$0]);
1125
+ if (!ext2)
1126
+ return noext;
1127
+ ext2 = ext2.toLowerCase();
1128
+ return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
1129
+ };
1130
+ var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
1131
+ const noext = qmarksTestNoExtDot([$0]);
1132
+ if (!ext2)
1133
+ return noext;
1134
+ ext2 = ext2.toLowerCase();
1135
+ return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
1136
+ };
1137
+ var qmarksTestDot = ([$0, ext2 = ""]) => {
1138
+ const noext = qmarksTestNoExtDot([$0]);
1139
+ return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
1140
+ };
1141
+ var qmarksTest = ([$0, ext2 = ""]) => {
1142
+ const noext = qmarksTestNoExt([$0]);
1143
+ return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
1144
+ };
1145
+ var qmarksTestNoExt = ([$0]) => {
1146
+ const len = $0.length;
1147
+ return (f) => f.length === len && !f.startsWith(".");
1148
+ };
1149
+ var qmarksTestNoExtDot = ([$0]) => {
1150
+ const len = $0.length;
1151
+ return (f) => f.length === len && f !== "." && f !== "..";
1152
+ };
1153
+ var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
1154
+ var path = {
1155
+ win32: { sep: "\\" },
1156
+ posix: { sep: "/" }
1157
+ };
1158
+ var sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
1159
+ minimatch.sep = sep;
1160
+ var GLOBSTAR = Symbol("globstar **");
1161
+ minimatch.GLOBSTAR = GLOBSTAR;
1162
+ var qmark2 = "[^/]";
1163
+ var star2 = qmark2 + "*?";
1164
+ var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
1165
+ var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
1166
+ var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
1167
+ minimatch.filter = filter;
1168
+ var ext = (a, b = {}) => Object.assign({}, a, b);
1169
+ var defaults = (def) => {
1170
+ if (!def || typeof def !== "object" || !Object.keys(def).length) {
1171
+ return minimatch;
1172
+ }
1173
+ const orig = minimatch;
1174
+ const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
1175
+ return Object.assign(m, {
1176
+ Minimatch: class Minimatch extends orig.Minimatch {
1177
+ constructor(pattern, options = {}) {
1178
+ super(pattern, ext(def, options));
1179
+ }
1180
+ static defaults(options) {
1181
+ return orig.defaults(ext(def, options)).Minimatch;
1182
+ }
1183
+ },
1184
+ AST: class AST extends orig.AST {
1185
+ /* c8 ignore start */
1186
+ constructor(type, parent, options = {}) {
1187
+ super(type, parent, ext(def, options));
1188
+ }
1189
+ /* c8 ignore stop */
1190
+ static fromGlob(pattern, options = {}) {
1191
+ return orig.AST.fromGlob(pattern, ext(def, options));
1192
+ }
1193
+ },
1194
+ unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
1195
+ escape: (s, options = {}) => orig.escape(s, ext(def, options)),
1196
+ filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
1197
+ defaults: (options) => orig.defaults(ext(def, options)),
1198
+ makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
1199
+ braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
1200
+ match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
1201
+ sep: orig.sep,
1202
+ GLOBSTAR
1203
+ });
1204
+ };
1205
+ minimatch.defaults = defaults;
1206
+ var braceExpand = (pattern, options = {}) => {
1207
+ assertValidPattern(pattern);
1208
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
1209
+ return [pattern];
1210
+ }
1211
+ return (0, import_brace_expansion.default)(pattern);
1212
+ };
1213
+ minimatch.braceExpand = braceExpand;
1214
+ var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
1215
+ minimatch.makeRe = makeRe;
1216
+ var match = (list, pattern, options = {}) => {
1217
+ const mm = new Minimatch(pattern, options);
1218
+ list = list.filter((f) => mm.match(f));
1219
+ if (mm.options.nonull && !list.length) {
1220
+ list.push(pattern);
1221
+ }
1222
+ return list;
1223
+ };
1224
+ minimatch.match = match;
1225
+ var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
1226
+ var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1227
+ var Minimatch = class {
1228
+ options;
1229
+ set;
1230
+ pattern;
1231
+ windowsPathsNoEscape;
1232
+ nonegate;
1233
+ negate;
1234
+ comment;
1235
+ empty;
1236
+ preserveMultipleSlashes;
1237
+ partial;
1238
+ globSet;
1239
+ globParts;
1240
+ nocase;
1241
+ isWindows;
1242
+ platform;
1243
+ windowsNoMagicRoot;
1244
+ regexp;
1245
+ constructor(pattern, options = {}) {
1246
+ assertValidPattern(pattern);
1247
+ options = options || {};
1248
+ this.options = options;
1249
+ this.pattern = pattern;
1250
+ this.platform = options.platform || defaultPlatform;
1251
+ this.isWindows = this.platform === "win32";
1252
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
1253
+ if (this.windowsPathsNoEscape) {
1254
+ this.pattern = this.pattern.replace(/\\/g, "/");
1255
+ }
1256
+ this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
1257
+ this.regexp = null;
1258
+ this.negate = false;
1259
+ this.nonegate = !!options.nonegate;
1260
+ this.comment = false;
1261
+ this.empty = false;
1262
+ this.partial = !!options.partial;
1263
+ this.nocase = !!this.options.nocase;
1264
+ this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
1265
+ this.globSet = [];
1266
+ this.globParts = [];
1267
+ this.set = [];
1268
+ this.make();
1269
+ }
1270
+ hasMagic() {
1271
+ if (this.options.magicalBraces && this.set.length > 1) {
1272
+ return true;
1273
+ }
1274
+ for (const pattern of this.set) {
1275
+ for (const part of pattern) {
1276
+ if (typeof part !== "string")
1277
+ return true;
1278
+ }
1279
+ }
1280
+ return false;
1281
+ }
1282
+ debug(..._) {
1283
+ }
1284
+ make() {
1285
+ const pattern = this.pattern;
1286
+ const options = this.options;
1287
+ if (!options.nocomment && pattern.charAt(0) === "#") {
1288
+ this.comment = true;
1289
+ return;
1290
+ }
1291
+ if (!pattern) {
1292
+ this.empty = true;
1293
+ return;
1294
+ }
1295
+ this.parseNegate();
1296
+ this.globSet = [...new Set(this.braceExpand())];
1297
+ if (options.debug) {
1298
+ this.debug = (...args) => console.error(...args);
1299
+ }
1300
+ this.debug(this.pattern, this.globSet);
1301
+ const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
1302
+ this.globParts = this.preprocess(rawGlobParts);
1303
+ this.debug(this.pattern, this.globParts);
1304
+ let set = this.globParts.map((s, _, __) => {
1305
+ if (this.isWindows && this.windowsNoMagicRoot) {
1306
+ const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
1307
+ const isDrive = /^[a-z]:/i.test(s[0]);
1308
+ if (isUNC) {
1309
+ return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
1310
+ } else if (isDrive) {
1311
+ return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
1312
+ }
1313
+ }
1314
+ return s.map((ss) => this.parse(ss));
1315
+ });
1316
+ this.debug(this.pattern, set);
1317
+ this.set = set.filter((s) => s.indexOf(false) === -1);
1318
+ if (this.isWindows) {
1319
+ for (let i2 = 0; i2 < this.set.length; i2++) {
1320
+ const p = this.set[i2];
1321
+ if (p[0] === "" && p[1] === "" && this.globParts[i2][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
1322
+ p[2] = "?";
1323
+ }
1324
+ }
1325
+ }
1326
+ this.debug(this.pattern, this.set);
1327
+ }
1328
+ // various transforms to equivalent pattern sets that are
1329
+ // faster to process in a filesystem walk. The goal is to
1330
+ // eliminate what we can, and push all ** patterns as far
1331
+ // to the right as possible, even if it increases the number
1332
+ // of patterns that we have to process.
1333
+ preprocess(globParts) {
1334
+ if (this.options.noglobstar) {
1335
+ for (let i2 = 0; i2 < globParts.length; i2++) {
1336
+ for (let j = 0; j < globParts[i2].length; j++) {
1337
+ if (globParts[i2][j] === "**") {
1338
+ globParts[i2][j] = "*";
1339
+ }
1340
+ }
1341
+ }
1342
+ }
1343
+ const { optimizationLevel = 1 } = this.options;
1344
+ if (optimizationLevel >= 2) {
1345
+ globParts = this.firstPhasePreProcess(globParts);
1346
+ globParts = this.secondPhasePreProcess(globParts);
1347
+ } else if (optimizationLevel >= 1) {
1348
+ globParts = this.levelOneOptimize(globParts);
1349
+ } else {
1350
+ globParts = this.adjascentGlobstarOptimize(globParts);
1351
+ }
1352
+ return globParts;
1353
+ }
1354
+ // just get rid of adjascent ** portions
1355
+ adjascentGlobstarOptimize(globParts) {
1356
+ return globParts.map((parts) => {
1357
+ let gs = -1;
1358
+ while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
1359
+ let i2 = gs;
1360
+ while (parts[i2 + 1] === "**") {
1361
+ i2++;
1362
+ }
1363
+ if (i2 !== gs) {
1364
+ parts.splice(gs, i2 - gs);
1365
+ }
1366
+ }
1367
+ return parts;
1368
+ });
1369
+ }
1370
+ // get rid of adjascent ** and resolve .. portions
1371
+ levelOneOptimize(globParts) {
1372
+ return globParts.map((parts) => {
1373
+ parts = parts.reduce((set, part) => {
1374
+ const prev = set[set.length - 1];
1375
+ if (part === "**" && prev === "**") {
1376
+ return set;
1377
+ }
1378
+ if (part === "..") {
1379
+ if (prev && prev !== ".." && prev !== "." && prev !== "**") {
1380
+ set.pop();
1381
+ return set;
1382
+ }
1383
+ }
1384
+ set.push(part);
1385
+ return set;
1386
+ }, []);
1387
+ return parts.length === 0 ? [""] : parts;
1388
+ });
1389
+ }
1390
+ levelTwoFileOptimize(parts) {
1391
+ if (!Array.isArray(parts)) {
1392
+ parts = this.slashSplit(parts);
1393
+ }
1394
+ let didSomething = false;
1395
+ do {
1396
+ didSomething = false;
1397
+ if (!this.preserveMultipleSlashes) {
1398
+ for (let i2 = 1; i2 < parts.length - 1; i2++) {
1399
+ const p = parts[i2];
1400
+ if (i2 === 1 && p === "" && parts[0] === "")
1401
+ continue;
1402
+ if (p === "." || p === "") {
1403
+ didSomething = true;
1404
+ parts.splice(i2, 1);
1405
+ i2--;
1406
+ }
1407
+ }
1408
+ if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
1409
+ didSomething = true;
1410
+ parts.pop();
1411
+ }
1412
+ }
1413
+ let dd = 0;
1414
+ while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
1415
+ const p = parts[dd - 1];
1416
+ if (p && p !== "." && p !== ".." && p !== "**") {
1417
+ didSomething = true;
1418
+ parts.splice(dd - 1, 2);
1419
+ dd -= 2;
1420
+ }
1421
+ }
1422
+ } while (didSomething);
1423
+ return parts.length === 0 ? [""] : parts;
1424
+ }
1425
+ // First phase: single-pattern processing
1426
+ // <pre> is 1 or more portions
1427
+ // <rest> is 1 or more portions
1428
+ // <p> is any portion other than ., .., '', or **
1429
+ // <e> is . or ''
1430
+ //
1431
+ // **/.. is *brutal* for filesystem walking performance, because
1432
+ // it effectively resets the recursive walk each time it occurs,
1433
+ // and ** cannot be reduced out by a .. pattern part like a regexp
1434
+ // or most strings (other than .., ., and '') can be.
1435
+ //
1436
+ // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
1437
+ // <pre>/<e>/<rest> -> <pre>/<rest>
1438
+ // <pre>/<p>/../<rest> -> <pre>/<rest>
1439
+ // **/**/<rest> -> **/<rest>
1440
+ //
1441
+ // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
1442
+ // this WOULD be allowed if ** did follow symlinks, or * didn't
1443
+ firstPhasePreProcess(globParts) {
1444
+ let didSomething = false;
1445
+ do {
1446
+ didSomething = false;
1447
+ for (let parts of globParts) {
1448
+ let gs = -1;
1449
+ while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
1450
+ let gss = gs;
1451
+ while (parts[gss + 1] === "**") {
1452
+ gss++;
1453
+ }
1454
+ if (gss > gs) {
1455
+ parts.splice(gs + 1, gss - gs);
1456
+ }
1457
+ let next = parts[gs + 1];
1458
+ const p = parts[gs + 2];
1459
+ const p2 = parts[gs + 3];
1460
+ if (next !== "..")
1461
+ continue;
1462
+ if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
1463
+ continue;
1464
+ }
1465
+ didSomething = true;
1466
+ parts.splice(gs, 1);
1467
+ const other = parts.slice(0);
1468
+ other[gs] = "**";
1469
+ globParts.push(other);
1470
+ gs--;
1471
+ }
1472
+ if (!this.preserveMultipleSlashes) {
1473
+ for (let i2 = 1; i2 < parts.length - 1; i2++) {
1474
+ const p = parts[i2];
1475
+ if (i2 === 1 && p === "" && parts[0] === "")
1476
+ continue;
1477
+ if (p === "." || p === "") {
1478
+ didSomething = true;
1479
+ parts.splice(i2, 1);
1480
+ i2--;
1481
+ }
1482
+ }
1483
+ if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
1484
+ didSomething = true;
1485
+ parts.pop();
1486
+ }
1487
+ }
1488
+ let dd = 0;
1489
+ while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
1490
+ const p = parts[dd - 1];
1491
+ if (p && p !== "." && p !== ".." && p !== "**") {
1492
+ didSomething = true;
1493
+ const needDot = dd === 1 && parts[dd + 1] === "**";
1494
+ const splin = needDot ? ["."] : [];
1495
+ parts.splice(dd - 1, 2, ...splin);
1496
+ if (parts.length === 0)
1497
+ parts.push("");
1498
+ dd -= 2;
1499
+ }
1500
+ }
1501
+ }
1502
+ } while (didSomething);
1503
+ return globParts;
1504
+ }
1505
+ // second phase: multi-pattern dedupes
1506
+ // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
1507
+ // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
1508
+ // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
1509
+ //
1510
+ // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
1511
+ // ^-- not valid because ** doens't follow symlinks
1512
+ secondPhasePreProcess(globParts) {
1513
+ for (let i2 = 0; i2 < globParts.length - 1; i2++) {
1514
+ for (let j = i2 + 1; j < globParts.length; j++) {
1515
+ const matched = this.partsMatch(globParts[i2], globParts[j], !this.preserveMultipleSlashes);
1516
+ if (!matched)
1517
+ continue;
1518
+ globParts[i2] = matched;
1519
+ globParts[j] = [];
1520
+ }
1521
+ }
1522
+ return globParts.filter((gs) => gs.length);
1523
+ }
1524
+ partsMatch(a, b, emptyGSMatch = false) {
1525
+ let ai = 0;
1526
+ let bi = 0;
1527
+ let result = [];
1528
+ let which = "";
1529
+ while (ai < a.length && bi < b.length) {
1530
+ if (a[ai] === b[bi]) {
1531
+ result.push(which === "b" ? b[bi] : a[ai]);
1532
+ ai++;
1533
+ bi++;
1534
+ } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
1535
+ result.push(a[ai]);
1536
+ ai++;
1537
+ } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
1538
+ result.push(b[bi]);
1539
+ bi++;
1540
+ } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
1541
+ if (which === "b")
1542
+ return false;
1543
+ which = "a";
1544
+ result.push(a[ai]);
1545
+ ai++;
1546
+ bi++;
1547
+ } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
1548
+ if (which === "a")
1549
+ return false;
1550
+ which = "b";
1551
+ result.push(b[bi]);
1552
+ ai++;
1553
+ bi++;
1554
+ } else {
1555
+ return false;
1556
+ }
1557
+ }
1558
+ return a.length === b.length && result;
1559
+ }
1560
+ parseNegate() {
1561
+ if (this.nonegate)
1562
+ return;
1563
+ const pattern = this.pattern;
1564
+ let negate = false;
1565
+ let negateOffset = 0;
1566
+ for (let i2 = 0; i2 < pattern.length && pattern.charAt(i2) === "!"; i2++) {
1567
+ negate = !negate;
1568
+ negateOffset++;
1569
+ }
1570
+ if (negateOffset)
1571
+ this.pattern = pattern.slice(negateOffset);
1572
+ this.negate = negate;
1573
+ }
1574
+ // set partial to true to test if, for example,
1575
+ // "/a/b" matches the start of "/*/b/*/d"
1576
+ // Partial means, if you run out of file before you run
1577
+ // out of pattern, then that's fine, as long as all
1578
+ // the parts match.
1579
+ matchOne(file, pattern, partial = false) {
1580
+ const options = this.options;
1581
+ if (this.isWindows) {
1582
+ const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
1583
+ const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
1584
+ const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
1585
+ const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
1586
+ const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
1587
+ const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
1588
+ if (typeof fdi === "number" && typeof pdi === "number") {
1589
+ const [fd, pd] = [file[fdi], pattern[pdi]];
1590
+ if (fd.toLowerCase() === pd.toLowerCase()) {
1591
+ pattern[pdi] = fd;
1592
+ if (pdi > fdi) {
1593
+ pattern = pattern.slice(pdi);
1594
+ } else if (fdi > pdi) {
1595
+ file = file.slice(fdi);
1596
+ }
1597
+ }
1598
+ }
1599
+ }
1600
+ const { optimizationLevel = 1 } = this.options;
1601
+ if (optimizationLevel >= 2) {
1602
+ file = this.levelTwoFileOptimize(file);
1603
+ }
1604
+ this.debug("matchOne", this, { file, pattern });
1605
+ this.debug("matchOne", file.length, pattern.length);
1606
+ for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
1607
+ this.debug("matchOne loop");
1608
+ var p = pattern[pi];
1609
+ var f = file[fi];
1610
+ this.debug(pattern, p, f);
1611
+ if (p === false) {
1612
+ return false;
1613
+ }
1614
+ if (p === GLOBSTAR) {
1615
+ this.debug("GLOBSTAR", [pattern, p, f]);
1616
+ var fr = fi;
1617
+ var pr = pi + 1;
1618
+ if (pr === pl) {
1619
+ this.debug("** at the end");
1620
+ for (; fi < fl; fi++) {
1621
+ if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
1622
+ return false;
1623
+ }
1624
+ return true;
1625
+ }
1626
+ while (fr < fl) {
1627
+ var swallowee = file[fr];
1628
+ this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
1629
+ if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
1630
+ this.debug("globstar found match!", fr, fl, swallowee);
1631
+ return true;
1632
+ } else {
1633
+ if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
1634
+ this.debug("dot detected!", file, fr, pattern, pr);
1635
+ break;
1636
+ }
1637
+ this.debug("globstar swallow a segment, and continue");
1638
+ fr++;
1639
+ }
1640
+ }
1641
+ if (partial) {
1642
+ this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
1643
+ if (fr === fl) {
1644
+ return true;
1645
+ }
1646
+ }
1647
+ return false;
1648
+ }
1649
+ let hit;
1650
+ if (typeof p === "string") {
1651
+ hit = f === p;
1652
+ this.debug("string match", p, f, hit);
1653
+ } else {
1654
+ hit = p.test(f);
1655
+ this.debug("pattern match", p, f, hit);
1656
+ }
1657
+ if (!hit)
1658
+ return false;
1659
+ }
1660
+ if (fi === fl && pi === pl) {
1661
+ return true;
1662
+ } else if (fi === fl) {
1663
+ return partial;
1664
+ } else if (pi === pl) {
1665
+ return fi === fl - 1 && file[fi] === "";
1666
+ } else {
1667
+ throw new Error("wtf?");
1668
+ }
1669
+ }
1670
+ braceExpand() {
1671
+ return braceExpand(this.pattern, this.options);
1672
+ }
1673
+ parse(pattern) {
1674
+ assertValidPattern(pattern);
1675
+ const options = this.options;
1676
+ if (pattern === "**")
1677
+ return GLOBSTAR;
1678
+ if (pattern === "")
1679
+ return "";
1680
+ let m;
1681
+ let fastTest = null;
1682
+ if (m = pattern.match(starRE)) {
1683
+ fastTest = options.dot ? starTestDot : starTest;
1684
+ } else if (m = pattern.match(starDotExtRE)) {
1685
+ fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
1686
+ } else if (m = pattern.match(qmarksRE)) {
1687
+ fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
1688
+ } else if (m = pattern.match(starDotStarRE)) {
1689
+ fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
1690
+ } else if (m = pattern.match(dotStarRE)) {
1691
+ fastTest = dotStarTest;
1692
+ }
1693
+ const re = AST.fromGlob(pattern, this.options).toMMPattern();
1694
+ if (fastTest && typeof re === "object") {
1695
+ Reflect.defineProperty(re, "test", { value: fastTest });
1696
+ }
1697
+ return re;
1698
+ }
1699
+ makeRe() {
1700
+ if (this.regexp || this.regexp === false)
1701
+ return this.regexp;
1702
+ const set = this.set;
1703
+ if (!set.length) {
1704
+ this.regexp = false;
1705
+ return this.regexp;
1706
+ }
1707
+ const options = this.options;
1708
+ const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
1709
+ const flags = new Set(options.nocase ? ["i"] : []);
1710
+ let re = set.map((pattern) => {
1711
+ const pp = pattern.map((p) => {
1712
+ if (p instanceof RegExp) {
1713
+ for (const f of p.flags.split(""))
1714
+ flags.add(f);
1715
+ }
1716
+ return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
1717
+ });
1718
+ pp.forEach((p, i2) => {
1719
+ const next = pp[i2 + 1];
1720
+ const prev = pp[i2 - 1];
1721
+ if (p !== GLOBSTAR || prev === GLOBSTAR) {
1722
+ return;
1723
+ }
1724
+ if (prev === void 0) {
1725
+ if (next !== void 0 && next !== GLOBSTAR) {
1726
+ pp[i2 + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
1727
+ } else {
1728
+ pp[i2] = twoStar;
1729
+ }
1730
+ } else if (next === void 0) {
1731
+ pp[i2 - 1] = prev + "(?:\\/|" + twoStar + ")?";
1732
+ } else if (next !== GLOBSTAR) {
1733
+ pp[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
1734
+ pp[i2 + 1] = GLOBSTAR;
1735
+ }
1736
+ });
1737
+ return pp.filter((p) => p !== GLOBSTAR).join("/");
1738
+ }).join("|");
1739
+ const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
1740
+ re = "^" + open + re + close + "$";
1741
+ if (this.negate)
1742
+ re = "^(?!" + re + ").+$";
1743
+ try {
1744
+ this.regexp = new RegExp(re, [...flags].join(""));
1745
+ } catch (ex) {
1746
+ this.regexp = false;
1747
+ }
1748
+ return this.regexp;
1749
+ }
1750
+ slashSplit(p) {
1751
+ if (this.preserveMultipleSlashes) {
1752
+ return p.split("/");
1753
+ } else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
1754
+ return ["", ...p.split(/\/+/)];
1755
+ } else {
1756
+ return p.split(/\/+/);
1757
+ }
1758
+ }
1759
+ match(f, partial = this.partial) {
1760
+ this.debug("match", f, this.pattern);
1761
+ if (this.comment) {
1762
+ return false;
1763
+ }
1764
+ if (this.empty) {
1765
+ return f === "";
1766
+ }
1767
+ if (f === "/" && partial) {
1768
+ return true;
1769
+ }
1770
+ const options = this.options;
1771
+ if (this.isWindows) {
1772
+ f = f.split("\\").join("/");
1773
+ }
1774
+ const ff = this.slashSplit(f);
1775
+ this.debug(this.pattern, "split", ff);
1776
+ const set = this.set;
1777
+ this.debug(this.pattern, "set", set);
1778
+ let filename = ff[ff.length - 1];
1779
+ if (!filename) {
1780
+ for (let i2 = ff.length - 2; !filename && i2 >= 0; i2--) {
1781
+ filename = ff[i2];
1782
+ }
1783
+ }
1784
+ for (let i2 = 0; i2 < set.length; i2++) {
1785
+ const pattern = set[i2];
1786
+ let file = ff;
1787
+ if (options.matchBase && pattern.length === 1) {
1788
+ file = [filename];
1789
+ }
1790
+ const hit = this.matchOne(file, pattern, partial);
1791
+ if (hit) {
1792
+ if (options.flipNegate) {
1793
+ return true;
1794
+ }
1795
+ return !this.negate;
1796
+ }
1797
+ }
1798
+ if (options.flipNegate) {
1799
+ return false;
1800
+ }
1801
+ return this.negate;
1802
+ }
1803
+ static defaults(def) {
1804
+ return minimatch.defaults(def).Minimatch;
1805
+ }
1806
+ };
1807
+ minimatch.AST = AST;
1808
+ minimatch.Minimatch = Minimatch;
1809
+ minimatch.escape = escape;
1810
+ minimatch.unescape = unescape;
1811
+
1812
+ // src/utils/query-nonce-meta-tag-content.ts
1813
+ function queryNonceMetaTagContent(doc) {
1814
+ var _a, _b, _c;
1815
+ return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
1816
+ }
1817
+
1818
+ // src/utils/regular-expression.ts
1819
+ var escapeRegExpSpecialCharacters = (text) => {
1820
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1821
+ };
1822
+
1823
+ // src/utils/remote-value.ts
1824
+ var RemoteValue = class _RemoteValue {
1825
+ /**
1826
+ * Deserializes a LocalValue serialized object back to its original JavaScript representation
1827
+ *
1828
+ * @param serialized The serialized LocalValue object
1829
+ * @returns The original JavaScript value/object
1830
+ */
1831
+ static fromLocalValue(serialized) {
1832
+ const type = serialized[TYPE_CONSTANT];
1833
+ const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
1834
+ switch (type) {
1835
+ case "string" /* String */:
1836
+ return value;
1837
+ case "boolean" /* Boolean */:
1838
+ return value;
1839
+ case "bigint" /* BigInt */:
1840
+ return BigInt(value);
1841
+ case "undefined" /* Undefined */:
1842
+ return void 0;
1843
+ case "null" /* Null */:
1844
+ return null;
1845
+ case "number" /* Number */:
1846
+ if (value === "NaN") return NaN;
1847
+ if (value === "-0") return -0;
1848
+ if (value === "Infinity") return Infinity;
1849
+ if (value === "-Infinity") return -Infinity;
1850
+ return value;
1851
+ case "array" /* Array */:
1852
+ return value.map((item) => _RemoteValue.fromLocalValue(item));
1853
+ case "date" /* Date */:
1854
+ return new Date(value);
1855
+ case "map" /* Map */:
1856
+ const map2 = /* @__PURE__ */ new Map();
1857
+ for (const [key, val] of value) {
1858
+ const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
1859
+ const deserializedValue = _RemoteValue.fromLocalValue(val);
1860
+ map2.set(deserializedKey, deserializedValue);
1861
+ }
1862
+ return map2;
1863
+ case "object" /* Object */:
1864
+ const obj = {};
1865
+ for (const [key, val] of value) {
1866
+ obj[key] = _RemoteValue.fromLocalValue(val);
1867
+ }
1868
+ return obj;
1869
+ case "regexp" /* RegularExpression */:
1870
+ const { pattern, flags } = value;
1871
+ return new RegExp(pattern, flags);
1872
+ case "set" /* Set */:
1873
+ const set = /* @__PURE__ */ new Set();
1874
+ for (const item of value) {
1875
+ set.add(_RemoteValue.fromLocalValue(item));
1876
+ }
1877
+ return set;
1878
+ case "symbol" /* Symbol */:
1879
+ return Symbol(value);
1880
+ default:
1881
+ throw new Error(`Unsupported type: ${type}`);
1882
+ }
1883
+ }
1884
+ /**
1885
+ * Utility method to deserialize multiple LocalValues at once
1886
+ *
1887
+ * @param serializedValues Array of serialized LocalValue objects
1888
+ * @returns Array of deserialized JavaScript values
1889
+ */
1890
+ static fromLocalValueArray(serializedValues) {
1891
+ return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
1892
+ }
1893
+ /**
1894
+ * Verifies if the given object matches the structure of a serialized LocalValue
1895
+ *
1896
+ * @param obj Object to verify
1897
+ * @returns boolean indicating if the object has LocalValue structure
1898
+ */
1899
+ static isLocalValueObject(obj) {
1900
+ if (typeof obj !== "object" || obj === null) {
1901
+ return false;
1902
+ }
1903
+ if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
1904
+ return false;
1905
+ }
1906
+ const type = obj[TYPE_CONSTANT];
1907
+ const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
1908
+ if (!hasTypeProperty) {
1909
+ return false;
1910
+ }
1911
+ if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
1912
+ return obj.hasOwnProperty(VALUE_CONSTANT);
1913
+ }
1914
+ return true;
1915
+ }
1916
+ };
1917
+
1918
+ // src/utils/result.ts
1919
+ var result_exports = {};
1920
+ __export(result_exports, {
1921
+ err: () => err,
1922
+ map: () => map,
1923
+ ok: () => ok,
1924
+ unwrap: () => unwrap,
1925
+ unwrapErr: () => unwrapErr
1926
+ });
1927
+ var ok = (value) => ({
1928
+ isOk: true,
1929
+ isErr: false,
1930
+ value
1931
+ });
1932
+ var err = (value) => ({
1933
+ isOk: false,
1934
+ isErr: true,
1935
+ value
1936
+ });
1937
+ function map(result, fn) {
1938
+ if (result.isOk) {
1939
+ const val = fn(result.value);
1940
+ if (val instanceof Promise) {
1941
+ return val.then((newVal) => ok(newVal));
1942
+ } else {
1943
+ return ok(val);
1944
+ }
1945
+ }
1946
+ if (result.isErr) {
1947
+ const value = result.value;
1948
+ return err(value);
1949
+ }
1950
+ throw "should never get here";
1951
+ }
1952
+ var unwrap = (result) => {
1953
+ if (result.isOk) {
1954
+ return result.value;
1955
+ } else {
1956
+ throw result.value;
1957
+ }
1958
+ };
1959
+ var unwrapErr = (result) => {
1960
+ if (result.isErr) {
1961
+ return result.value;
1962
+ } else {
1963
+ throw result.value;
1964
+ }
1965
+ };
1966
+
1967
+ // src/utils/serialize.ts
1968
+ function deserializeProperty(value) {
1969
+ if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
1970
+ return value;
1971
+ }
1972
+ return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
1973
+ }
1974
+
1975
+ // src/utils/style.ts
1976
+ function createStyleSheetIfNeededAndSupported(styles2) {
1977
+ return void 0;
1978
+ }
1979
+
1980
+ // src/utils/shadow-root.ts
1981
+ var globalStyleSheet;
1982
+ function createShadowRoot(cmpMeta) {
1983
+ var _a;
1984
+ const opts = { mode: "open" };
1985
+ const shadowRoot = this.attachShadow(opts);
1986
+ if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported()) != null ? _a : null;
1987
+ if (globalStyleSheet) {
1988
+ if (supportsMutableAdoptedStyleSheets) {
1989
+ shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
1990
+ } else {
1991
+ shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
1992
+ }
1993
+ }
1994
+ }
1995
+ var getSlottedChildNodes = (childNodes) => {
1996
+ const result = [];
1997
+ for (let i2 = 0; i2 < childNodes.length; i2++) {
1998
+ const slottedNode = childNodes[i2]["s-nr"] || void 0;
1999
+ if (slottedNode && slottedNode.isConnected) {
2000
+ result.push(slottedNode);
2001
+ }
2002
+ }
2003
+ return result;
2004
+ };
2005
+ function getHostSlotNodes(childNodes, hostName, slotName) {
2006
+ let i2 = 0;
2007
+ let slottedNodes = [];
2008
+ let childNode;
2009
+ for (; i2 < childNodes.length; i2++) {
2010
+ childNode = childNodes[i2];
2011
+ if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
2012
+ slottedNodes.push(childNode);
2013
+ if (typeof slotName !== "undefined") return slottedNodes;
2014
+ }
2015
+ slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
2016
+ }
2017
+ return slottedNodes;
2018
+ }
2019
+ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
2020
+ if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
2021
+ return;
2022
+ }
2023
+ const slottedNodeLocation = document.createTextNode("");
2024
+ slottedNodeLocation["s-nr"] = newChild;
2025
+ if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
2026
+ const parent = slotNode["s-cr"].parentNode;
2027
+ const appendMethod = internalCall(parent, "appendChild");
2028
+ if (typeof position !== "undefined") {
2029
+ slottedNodeLocation["s-oo"] = position;
2030
+ const childNodes = internalCall(parent, "childNodes");
2031
+ const slotRelocateNodes = [slottedNodeLocation];
2032
+ childNodes.forEach((n) => {
2033
+ if (n["s-nr"]) slotRelocateNodes.push(n);
2034
+ });
2035
+ slotRelocateNodes.sort((a, b) => {
2036
+ if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
2037
+ else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
2038
+ return 0;
2039
+ });
2040
+ slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
2041
+ } else {
2042
+ appendMethod.call(parent, slottedNodeLocation);
2043
+ }
2044
+ newChild["s-ol"] = slottedNodeLocation;
2045
+ newChild["s-sh"] = slotNode["s-hn"];
2046
+ };
2047
+ var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
2048
+ function patchSlotNode(node) {
2049
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
2050
+ const assignedFactory = (elementsOnly) => (function(opts) {
2051
+ const toReturn = [];
2052
+ const slotName = this["s-sn"];
2053
+ if (opts == null ? void 0 : opts.flatten) {
2054
+ console.error(`
2055
+ Flattening is not supported for Stencil non-shadow slots.
2056
+ You can use \`.childNodes\` to nested slot fallback content.
2057
+ If you have a particular use case, please open an issue on the Stencil repo.
2058
+ `);
2059
+ }
2060
+ const parent = this["s-cr"].parentElement;
2061
+ const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
2062
+ slottedNodes.forEach((n) => {
2063
+ if (slotName === getSlotName(n)) {
2064
+ toReturn.push(n);
2065
+ }
2066
+ });
2067
+ if (elementsOnly) {
2068
+ return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
2069
+ }
2070
+ return toReturn;
2071
+ }).bind(node);
2072
+ node.assignedElements = assignedFactory(true);
2073
+ node.assignedNodes = assignedFactory(false);
2074
+ }
2075
+ function dispatchSlotChangeEvent(elm) {
2076
+ elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
2077
+ }
2078
+ function findSlotFromSlottedNode(slottedNode, parentHost) {
2079
+ var _a;
2080
+ parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
2081
+ if (!parentHost) return { slotNode: null, slotName: "" };
2082
+ const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
2083
+ const childNodes = internalCall(parentHost, "childNodes");
2084
+ const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
2085
+ return { slotNode, slotName };
2086
+ }
2087
+ function internalCall(node, method) {
2088
+ if ("__" + method in node) {
2089
+ const toReturn = node["__" + method];
2090
+ if (typeof toReturn !== "function") return toReturn;
2091
+ return toReturn.bind(node);
2092
+ } else {
2093
+ if (typeof node[method] !== "function") return node[method];
2094
+ return node[method].bind(node);
2095
+ }
2096
+ }
2097
+ var createTime = (fnName, tagName = "") => {
2098
+ {
2099
+ return () => {
2100
+ return;
2101
+ };
2102
+ }
2103
+ };
2104
+ var uniqueTime = (key, measureText) => {
2105
+ {
2106
+ return () => {
2107
+ return;
2108
+ };
2109
+ }
2110
+ };
2111
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
2112
+ var registerStyle = (scopeId2, cssText, allowCS) => {
2113
+ let style = styles.get(scopeId2);
2114
+ if (supportsConstructableStylesheets && allowCS) {
2115
+ style = style || new CSSStyleSheet();
2116
+ if (typeof style === "string") {
2117
+ style = cssText;
2118
+ } else {
2119
+ style.replaceSync(cssText);
2120
+ }
2121
+ } else {
2122
+ style = cssText;
2123
+ }
2124
+ styles.set(scopeId2, style);
2125
+ };
2126
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
2127
+ var _a, _b, _c;
2128
+ const scopeId2 = getScopeId(cmpMeta);
2129
+ const style = styles.get(scopeId2);
2130
+ if (!win.document) {
2131
+ return scopeId2;
2132
+ }
2133
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
2134
+ if (style) {
2135
+ if (typeof style === "string") {
2136
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
2137
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
2138
+ let styleElm;
2139
+ if (!appliedStyles) {
2140
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
2141
+ }
2142
+ const existingStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
2143
+ if (existingStyleElm) {
2144
+ existingStyleElm.innerHTML = style;
2145
+ } else if (!appliedStyles.has(scopeId2)) {
2146
+ styleElm = win.document.createElement("style");
2147
+ styleElm.innerHTML = style;
2148
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
2149
+ if (nonce != null) {
2150
+ styleElm.setAttribute("nonce", nonce);
2151
+ }
2152
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
2153
+ if (styleContainerNode.nodeName === "HEAD") {
2154
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
2155
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
2156
+ styleContainerNode.insertBefore(
2157
+ styleElm,
2158
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
2159
+ );
2160
+ } else if ("host" in styleContainerNode) {
2161
+ if (supportsConstructableStylesheets) {
2162
+ const currentWindow = (_b = styleContainerNode.defaultView) != null ? _b : styleContainerNode.ownerDocument.defaultView;
2163
+ const stylesheet = new currentWindow.CSSStyleSheet();
2164
+ stylesheet.replaceSync(style);
2165
+ if (supportsMutableAdoptedStyleSheets) {
2166
+ styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
2167
+ } else {
2168
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
2169
+ }
2170
+ } else {
2171
+ const existingStyleContainer = styleContainerNode.querySelector("style");
2172
+ if (existingStyleContainer) {
2173
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
2174
+ } else {
2175
+ styleContainerNode.prepend(styleElm);
2176
+ }
2177
+ }
2178
+ } else {
2179
+ styleContainerNode.append(styleElm);
2180
+ }
2181
+ }
2182
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2183
+ styleContainerNode.insertBefore(styleElm, null);
2184
+ }
2185
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
2186
+ styleElm.innerHTML += SLOT_FB_CSS;
2187
+ }
2188
+ if (appliedStyles) {
2189
+ appliedStyles.add(scopeId2);
2190
+ }
2191
+ }
2192
+ } else {
2193
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
2194
+ if (!appliedStyles) {
2195
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
2196
+ }
2197
+ if (!appliedStyles.has(scopeId2)) {
2198
+ const currentWindow = (_c = styleContainerNode.defaultView) != null ? _c : styleContainerNode.ownerDocument.defaultView;
2199
+ let stylesheet;
2200
+ if (style.constructor === currentWindow.CSSStyleSheet) {
2201
+ stylesheet = style;
2202
+ } else {
2203
+ stylesheet = new currentWindow.CSSStyleSheet();
2204
+ for (let i2 = 0; i2 < style.cssRules.length; i2++) {
2205
+ stylesheet.insertRule(style.cssRules[i2].cssText, i2);
2206
+ }
2207
+ }
2208
+ if (supportsMutableAdoptedStyleSheets) {
2209
+ styleContainerNode.adoptedStyleSheets.push(stylesheet);
2210
+ } else {
2211
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
2212
+ }
2213
+ appliedStyles.add(scopeId2);
2214
+ }
2215
+ }
2216
+ }
2217
+ return scopeId2;
2218
+ };
2219
+ var attachStyles = (hostRef) => {
2220
+ const cmpMeta = hostRef.$cmpMeta$;
2221
+ const elm = hostRef.$hostElement$;
2222
+ const flags = cmpMeta.$flags$;
2223
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
2224
+ const scopeId2 = addStyle(
2225
+ elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
2226
+ cmpMeta);
2227
+ if (flags & 10 /* needsScopedEncapsulation */) {
2228
+ elm["s-sc"] = scopeId2;
2229
+ elm.classList.add(scopeId2 + "-h");
2230
+ }
2231
+ endAttachStyles();
2232
+ };
2233
+ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
2234
+ var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
2235
+ var hydrateScopedToShadow = () => {
2236
+ if (!win.document) {
2237
+ return;
2238
+ }
2239
+ const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2240
+ let i2 = 0;
2241
+ for (; i2 < styles2.length; i2++) {
2242
+ registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
2243
+ }
2244
+ };
2245
+ var h = (nodeName, vnodeData, ...children) => {
2246
+ if (typeof nodeName === "string") {
2247
+ nodeName = transformTag(nodeName);
2248
+ }
2249
+ let child = null;
2250
+ let key = null;
2251
+ let simple = false;
2252
+ let lastSimple = false;
2253
+ const vNodeChildren = [];
2254
+ const walk = (c) => {
2255
+ for (let i2 = 0; i2 < c.length; i2++) {
2256
+ child = c[i2];
2257
+ if (Array.isArray(child)) {
2258
+ walk(child);
2259
+ } else if (child != null && typeof child !== "boolean") {
2260
+ if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
2261
+ child = String(child);
2262
+ }
2263
+ if (simple && lastSimple) {
2264
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
2265
+ } else {
2266
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
2267
+ }
2268
+ lastSimple = simple;
2269
+ }
2270
+ }
2271
+ };
2272
+ walk(children);
2273
+ if (vnodeData) {
2274
+ if (vnodeData.key) {
2275
+ key = vnodeData.key;
2276
+ }
2277
+ {
2278
+ const classData = vnodeData.className || vnodeData.class;
2279
+ if (classData) {
2280
+ vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
2281
+ }
2282
+ }
2283
+ }
2284
+ const vnode = newVNode(nodeName, null);
2285
+ vnode.$attrs$ = vnodeData;
2286
+ if (vNodeChildren.length > 0) {
2287
+ vnode.$children$ = vNodeChildren;
2288
+ }
2289
+ {
2290
+ vnode.$key$ = key;
2291
+ }
2292
+ return vnode;
2293
+ };
2294
+ var newVNode = (tag, text) => {
2295
+ const vnode = {
2296
+ $flags$: 0,
2297
+ $tag$: tag,
2298
+ $text$: text,
2299
+ $elm$: null,
2300
+ $children$: null
2301
+ };
2302
+ {
2303
+ vnode.$attrs$ = null;
2304
+ }
2305
+ {
2306
+ vnode.$key$ = null;
2307
+ }
2308
+ return vnode;
2309
+ };
2310
+ var Host = {};
2311
+ var isHost = (node) => node && node.$tag$ === Host;
2312
+
2313
+ // src/runtime/client-hydrate.ts
2314
+ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
2315
+ var _a, _b, _c, _d;
2316
+ const endHydrate = createTime("hydrateClient", tagName);
2317
+ const shadowRoot = hostElm.shadowRoot;
2318
+ const childRenderNodes = [];
2319
+ const slotNodes = [];
2320
+ const slottedNodes = [];
2321
+ const shadowRootNodes = shadowRoot ? [] : null;
2322
+ const vnode = newVNode(tagName, null);
2323
+ vnode.$elm$ = hostElm;
2324
+ if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
2325
+ initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
2326
+ }
2327
+ hostElm[HYDRATE_ID] = hostId;
2328
+ hostElm.removeAttribute(HYDRATE_ID);
2329
+ hostRef.$vnode$ = clientHydrate(
2330
+ vnode,
2331
+ childRenderNodes,
2332
+ slotNodes,
2333
+ shadowRootNodes,
2334
+ hostElm,
2335
+ hostElm,
2336
+ hostId,
2337
+ slottedNodes
2338
+ );
2339
+ let crIndex = 0;
2340
+ const crLength = childRenderNodes.length;
2341
+ let childRenderNode;
2342
+ for (crIndex; crIndex < crLength; crIndex++) {
2343
+ childRenderNode = childRenderNodes[crIndex];
2344
+ const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
2345
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
2346
+ const node = childRenderNode.$elm$;
2347
+ if (!shadowRoot) {
2348
+ node["s-hn"] = transformTag(tagName).toUpperCase();
2349
+ if (childRenderNode.$tag$ === "slot") {
2350
+ node["s-cr"] = hostElm["s-cr"];
2351
+ }
2352
+ } else if (((_a = childRenderNode.$tag$) == null ? void 0 : _a.toString().includes("-")) && childRenderNode.$tag$ !== "slot-fb" && !childRenderNode.$elm$.shadowRoot) {
2353
+ const cmpMeta = getHostRef(childRenderNode.$elm$);
2354
+ if (cmpMeta) {
2355
+ const scopeId3 = getScopeId(
2356
+ cmpMeta.$cmpMeta$);
2357
+ const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
2358
+ if (styleSheet) {
2359
+ hostElm.shadowRoot.append(styleSheet.cloneNode(true));
2360
+ }
2361
+ }
2362
+ }
2363
+ if (childRenderNode.$tag$ === "slot") {
2364
+ childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
2365
+ if (childRenderNode.$children$) {
2366
+ childRenderNode.$flags$ |= 2 /* isSlotFallback */;
2367
+ if (!childRenderNode.$elm$.childNodes.length) {
2368
+ childRenderNode.$children$.forEach((c) => {
2369
+ childRenderNode.$elm$.appendChild(c.$elm$);
2370
+ });
2371
+ }
2372
+ } else {
2373
+ childRenderNode.$flags$ |= 1 /* isSlotReference */;
2374
+ }
2375
+ }
2376
+ if (orgLocationNode && orgLocationNode.isConnected) {
2377
+ if (orgLocationNode.parentElement.shadowRoot && orgLocationNode["s-en"] === "") {
2378
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
2379
+ }
2380
+ orgLocationNode.parentNode.removeChild(orgLocationNode);
2381
+ if (!shadowRoot) {
2382
+ node["s-oo"] = parseInt(childRenderNode.$nodeId$);
2383
+ }
2384
+ }
2385
+ if (orgLocationNode && !orgLocationNode["s-id"]) {
2386
+ plt.$orgLocNodes$.delete(orgLocationId);
2387
+ }
2388
+ }
2389
+ const hosts = [];
2390
+ const snLen = slottedNodes.length;
2391
+ let snIndex = 0;
2392
+ let slotGroup;
2393
+ let snGroupIdx;
2394
+ let snGroupLen;
2395
+ let slottedItem;
2396
+ let currentPos = 0;
2397
+ for (snIndex; snIndex < snLen; snIndex++) {
2398
+ slotGroup = slottedNodes[snIndex];
2399
+ if (!slotGroup || !slotGroup.length) continue;
2400
+ snGroupLen = slotGroup.length;
2401
+ snGroupIdx = 0;
2402
+ for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
2403
+ slottedItem = slotGroup[snGroupIdx];
2404
+ if (!hosts[slottedItem.hostId]) {
2405
+ hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
2406
+ }
2407
+ if (!hosts[slottedItem.hostId]) continue;
2408
+ const hostEle = hosts[slottedItem.hostId];
2409
+ if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
2410
+ hostEle.insertBefore(slottedItem.node, (_c = (_b = slotGroup[snGroupIdx - 1]) == null ? void 0 : _b.node) == null ? void 0 : _c.nextSibling);
2411
+ }
2412
+ if (!hostEle.shadowRoot || !shadowRoot) {
2413
+ if (!slottedItem.slot["s-cr"]) {
2414
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
2415
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
2416
+ slottedItem.slot["s-cr"] = hostEle;
2417
+ } else {
2418
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
2419
+ }
2420
+ }
2421
+ addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"] || currentPos);
2422
+ if (((_d = slottedItem.node.parentElement) == null ? void 0 : _d.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) {
2423
+ slottedItem.node.removeAttribute("slot");
2424
+ }
2425
+ }
2426
+ currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
2427
+ }
2428
+ }
2429
+ if (shadowRoot) {
2430
+ let rnIdex = 0;
2431
+ const rnLen = shadowRootNodes.length;
2432
+ if (rnLen) {
2433
+ for (rnIdex; rnIdex < rnLen; rnIdex++) {
2434
+ const node = shadowRootNodes[rnIdex];
2435
+ if (node) {
2436
+ shadowRoot.appendChild(node);
2437
+ }
2438
+ }
2439
+ Array.from(hostElm.childNodes).forEach((node) => {
2440
+ if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
2441
+ if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
2442
+ node.removeAttribute("hidden");
2443
+ } else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue) {
2444
+ node.parentNode.removeChild(node);
2445
+ }
2446
+ }
2447
+ });
2448
+ }
2449
+ }
2450
+ hostRef.$hostElement$ = hostElm;
2451
+ endHydrate();
2452
+ };
2453
+ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
2454
+ let childNodeType;
2455
+ let childIdSplt;
2456
+ let childVNode;
2457
+ let i2;
2458
+ if (node.nodeType === 1 /* ElementNode */) {
2459
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
2460
+ if (childNodeType) {
2461
+ childIdSplt = childNodeType.split(".");
2462
+ if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
2463
+ childVNode = createSimpleVNode({
2464
+ $flags$: 0,
2465
+ $hostId$: childIdSplt[0],
2466
+ $nodeId$: childIdSplt[1],
2467
+ $depth$: childIdSplt[2],
2468
+ $index$: childIdSplt[3],
2469
+ $tag$: node.tagName.toLowerCase(),
2470
+ $elm$: node,
2471
+ // If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
2472
+ // won't try to reconcile them. Classes set on the node will be blown away.
2473
+ $attrs$: { class: node.className || "" }
2474
+ });
2475
+ childRenderNodes.push(childVNode);
2476
+ node.removeAttribute(HYDRATE_CHILD_ID);
2477
+ if (!parentVNode.$children$) {
2478
+ parentVNode.$children$ = [];
2479
+ }
2480
+ const slotName = childVNode.$elm$.getAttribute("s-sn");
2481
+ if (typeof slotName === "string") {
2482
+ if (childVNode.$tag$ === "slot-fb") {
2483
+ addSlot(
2484
+ slotName,
2485
+ childIdSplt[2],
2486
+ childVNode,
2487
+ node,
2488
+ parentVNode,
2489
+ childRenderNodes,
2490
+ slotNodes,
2491
+ shadowRootNodes,
2492
+ slottedNodes
2493
+ );
2494
+ }
2495
+ childVNode.$elm$["s-sn"] = slotName;
2496
+ childVNode.$elm$.removeAttribute("s-sn");
2497
+ }
2498
+ if (childVNode.$index$ !== void 0) {
2499
+ parentVNode.$children$[childVNode.$index$] = childVNode;
2500
+ }
2501
+ parentVNode = childVNode;
2502
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
2503
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
2504
+ }
2505
+ }
2506
+ }
2507
+ if (node.shadowRoot) {
2508
+ for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
2509
+ clientHydrate(
2510
+ parentVNode,
2511
+ childRenderNodes,
2512
+ slotNodes,
2513
+ shadowRootNodes,
2514
+ hostElm,
2515
+ node.shadowRoot.childNodes[i2],
2516
+ hostId,
2517
+ slottedNodes
2518
+ );
2519
+ }
2520
+ }
2521
+ const nonShadowNodes = node.__childNodes || node.childNodes;
2522
+ for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
2523
+ clientHydrate(
2524
+ parentVNode,
2525
+ childRenderNodes,
2526
+ slotNodes,
2527
+ shadowRootNodes,
2528
+ hostElm,
2529
+ nonShadowNodes[i2],
2530
+ hostId,
2531
+ slottedNodes
2532
+ );
2533
+ }
2534
+ } else if (node.nodeType === 8 /* CommentNode */) {
2535
+ childIdSplt = node.nodeValue.split(".");
2536
+ if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
2537
+ childNodeType = childIdSplt[0];
2538
+ childVNode = createSimpleVNode({
2539
+ $hostId$: childIdSplt[1],
2540
+ $nodeId$: childIdSplt[2],
2541
+ $depth$: childIdSplt[3],
2542
+ $index$: childIdSplt[4] || "0",
2543
+ $elm$: node,
2544
+ $attrs$: null,
2545
+ $children$: null,
2546
+ $key$: null,
2547
+ $name$: null,
2548
+ $tag$: null,
2549
+ $text$: null
2550
+ });
2551
+ if (childNodeType === TEXT_NODE_ID) {
2552
+ childVNode.$elm$ = findCorrespondingNode(node, 3 /* TextNode */);
2553
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
2554
+ childVNode.$text$ = childVNode.$elm$.textContent;
2555
+ childRenderNodes.push(childVNode);
2556
+ node.remove();
2557
+ if (hostId === childVNode.$hostId$) {
2558
+ if (!parentVNode.$children$) {
2559
+ parentVNode.$children$ = [];
2560
+ }
2561
+ parentVNode.$children$[childVNode.$index$] = childVNode;
2562
+ }
2563
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
2564
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
2565
+ }
2566
+ }
2567
+ } else if (childNodeType === COMMENT_NODE_ID) {
2568
+ childVNode.$elm$ = findCorrespondingNode(node, 8 /* CommentNode */);
2569
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
2570
+ childRenderNodes.push(childVNode);
2571
+ node.remove();
2572
+ }
2573
+ } else if (childVNode.$hostId$ === hostId) {
2574
+ if (childNodeType === SLOT_NODE_ID) {
2575
+ const slotName = node["s-sn"] = childIdSplt[5] || "";
2576
+ addSlot(
2577
+ slotName,
2578
+ childIdSplt[2],
2579
+ childVNode,
2580
+ node,
2581
+ parentVNode,
2582
+ childRenderNodes,
2583
+ slotNodes,
2584
+ shadowRootNodes,
2585
+ slottedNodes
2586
+ );
2587
+ } else if (childNodeType === CONTENT_REF_ID) {
2588
+ if (shadowRootNodes) {
2589
+ node.remove();
2590
+ }
2591
+ }
2592
+ }
2593
+ }
2594
+ } else if (parentVNode && parentVNode.$tag$ === "style") {
2595
+ const vnode = newVNode(null, node.textContent);
2596
+ vnode.$elm$ = node;
2597
+ vnode.$index$ = "0";
2598
+ parentVNode.$children$ = [vnode];
2599
+ }
2600
+ return parentVNode;
2601
+ };
2602
+ var initializeDocumentHydrate = (node, orgLocNodes) => {
2603
+ if (node.nodeType === 1 /* ElementNode */) {
2604
+ const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
2605
+ if (componentId) {
2606
+ orgLocNodes.set(componentId, node);
2607
+ }
2608
+ let i2 = 0;
2609
+ if (node.shadowRoot) {
2610
+ for (; i2 < node.shadowRoot.childNodes.length; i2++) {
2611
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
2612
+ }
2613
+ }
2614
+ const nonShadowNodes = node.__childNodes || node.childNodes;
2615
+ for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
2616
+ initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
2617
+ }
2618
+ } else if (node.nodeType === 8 /* CommentNode */) {
2619
+ const childIdSplt = node.nodeValue.split(".");
2620
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
2621
+ orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
2622
+ node.nodeValue = "";
2623
+ node["s-en"] = childIdSplt[3];
2624
+ }
2625
+ }
2626
+ };
2627
+ var createSimpleVNode = (vnode) => {
2628
+ const defaultVNode = {
2629
+ $flags$: 0,
2630
+ $hostId$: null,
2631
+ $nodeId$: null,
2632
+ $depth$: null,
2633
+ $index$: "0",
2634
+ $elm$: null,
2635
+ $attrs$: null,
2636
+ $children$: null,
2637
+ $key$: null,
2638
+ $name$: null,
2639
+ $tag$: null,
2640
+ $text$: null
2641
+ };
2642
+ return { ...defaultVNode, ...vnode };
2643
+ };
2644
+ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
2645
+ node["s-sr"] = true;
2646
+ childVNode.$name$ = slotName || null;
2647
+ childVNode.$tag$ = "slot";
2648
+ const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
2649
+ if (shadowRootNodes && win.document) {
2650
+ const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
2651
+ if (childVNode.$name$) {
2652
+ childVNode.$elm$.setAttribute("name", slotName);
2653
+ }
2654
+ if (parentVNode.$elm$.shadowRoot && parentNodeId && parentNodeId !== childVNode.$hostId$) {
2655
+ internalCall(parentVNode.$elm$, "insertBefore")(slot, internalCall(parentVNode.$elm$, "children")[0]);
2656
+ } else {
2657
+ internalCall(internalCall(node, "parentNode"), "insertBefore")(slot, node);
2658
+ }
2659
+ addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
2660
+ node.remove();
2661
+ if (childVNode.$depth$ === "0") {
2662
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
2663
+ }
2664
+ } else {
2665
+ const slot = childVNode.$elm$;
2666
+ const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
2667
+ addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
2668
+ patchSlotNode(node);
2669
+ if (shouldMove) {
2670
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
2671
+ }
2672
+ }
2673
+ childRenderNodes.push(childVNode);
2674
+ slotNodes.push(childVNode);
2675
+ if (!parentVNode.$children$) {
2676
+ parentVNode.$children$ = [];
2677
+ }
2678
+ parentVNode.$children$[childVNode.$index$] = childVNode;
2679
+ }
2680
+ var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
2681
+ var _a, _b;
2682
+ let slottedNode = slotNode.nextSibling;
2683
+ slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
2684
+ if (!slottedNode || ((_a = slottedNode.nodeValue) == null ? void 0 : _a.startsWith(SLOT_NODE_ID + "."))) return;
2685
+ do {
2686
+ if (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (!slottedNode["getAttribute"] || !slottedNode.getAttribute("slot")) && (slottedNode.nodeType === 8 /* CommentNode */ || slottedNode.nodeType === 3 /* TextNode */))) {
2687
+ slottedNode["s-sn"] = slotName;
2688
+ slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
2689
+ }
2690
+ slottedNode = slottedNode == null ? void 0 : slottedNode.nextSibling;
2691
+ } while (slottedNode && !((_b = slottedNode.nodeValue) == null ? void 0 : _b.startsWith(SLOT_NODE_ID + ".")));
2692
+ };
2693
+ var findCorrespondingNode = (node, type) => {
2694
+ let sibling = node;
2695
+ do {
2696
+ sibling = sibling.nextSibling;
2697
+ } while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
2698
+ return sibling;
2699
+ };
2700
+ var createSupportsRuleRe = (selector) => {
2701
+ const safeSelector2 = escapeRegExpSpecialCharacters(selector);
2702
+ return new RegExp(
2703
+ // First capture group: match any context before the selector that's not inside @supports selector()
2704
+ // Using negative lookahead to avoid matching inside @supports selector(...) condition
2705
+ `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
2706
+ "g"
2707
+ );
2708
+ };
2709
+ createSupportsRuleRe("::slotted");
2710
+ createSupportsRuleRe(":host");
2711
+ createSupportsRuleRe(":host-context");
2712
+ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2713
+ if (typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2714
+ propValue = deserializeProperty(propValue);
2715
+ return propValue;
2716
+ }
2717
+ if (propValue != null && !isComplexType(propValue)) {
2718
+ if (propType & 4 /* Boolean */) {
2719
+ {
2720
+ return propValue === "false" ? false : propValue === "" || !!propValue;
2721
+ }
2722
+ }
2723
+ if (propType & 1 /* String */) {
2724
+ return String(propValue);
2725
+ }
2726
+ return propValue;
2727
+ }
2728
+ return propValue;
2729
+ };
2730
+ var getElement = (ref) => {
2731
+ var _a;
2732
+ return (_a = getHostRef(ref)) == null ? void 0 : _a.$hostElement$ ;
2733
+ };
2734
+
2735
+ // src/runtime/event-emitter.ts
2736
+ var createEvent = (ref, name, flags) => {
2737
+ const elm = getElement(ref);
2738
+ return {
2739
+ emit: (detail) => {
2740
+ return emitEvent(elm, name, {
2741
+ bubbles: true,
2742
+ composed: true,
2743
+ cancelable: true,
2744
+ detail
2745
+ });
2746
+ }
2747
+ };
2748
+ };
2749
+ var emitEvent = (elm, name, opts) => {
2750
+ const ev = plt.ce(name, opts);
2751
+ elm.dispatchEvent(ev);
2752
+ return ev;
2753
+ };
2754
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
2755
+ if (oldValue === newValue) {
2756
+ return;
2757
+ }
2758
+ let isProp = isMemberInElement(elm, memberName);
2759
+ let ln = memberName.toLowerCase();
2760
+ if (memberName === "class") {
2761
+ const classList = elm.classList;
2762
+ const oldClasses = parseClassList(oldValue);
2763
+ let newClasses = parseClassList(newValue);
2764
+ if ((elm["s-si"] || elm["s-sc"]) && initialRender) {
2765
+ const scopeId2 = elm["s-sc"] || elm["s-si"];
2766
+ newClasses.push(scopeId2);
2767
+ oldClasses.forEach((c) => {
2768
+ if (c.startsWith(scopeId2)) newClasses.push(c);
2769
+ });
2770
+ newClasses = [...new Set(newClasses)].filter((c) => c);
2771
+ classList.add(...newClasses);
2772
+ } else {
2773
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
2774
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
2775
+ }
2776
+ } else if (memberName === "key") ; else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
2777
+ if (memberName[2] === "-") {
2778
+ memberName = memberName.slice(3);
2779
+ } else if (isMemberInElement(win, ln)) {
2780
+ memberName = ln.slice(2);
2781
+ } else {
2782
+ memberName = ln[2] + memberName.slice(3);
2783
+ }
2784
+ if (oldValue || newValue) {
2785
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
2786
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
2787
+ if (oldValue) {
2788
+ plt.rel(elm, memberName, oldValue, capture);
2789
+ }
2790
+ if (newValue) {
2791
+ plt.ael(elm, memberName, newValue, capture);
2792
+ }
2793
+ }
2794
+ } else {
2795
+ const isComplex = isComplexType(newValue);
2796
+ if ((isProp || isComplex && newValue !== null) && true) {
2797
+ try {
2798
+ if (!elm.tagName.includes("-")) {
2799
+ const n = newValue == null ? "" : newValue;
2800
+ if (memberName === "list") {
2801
+ isProp = false;
2802
+ } else if (oldValue == null || elm[memberName] != n) {
2803
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
2804
+ elm[memberName] = n;
2805
+ } else {
2806
+ elm.setAttribute(memberName, n);
2807
+ }
2808
+ }
2809
+ } else if (elm[memberName] !== newValue) {
2810
+ elm[memberName] = newValue;
2811
+ }
2812
+ } catch (e) {
2813
+ }
2814
+ }
2815
+ if (newValue == null || newValue === false) {
2816
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
2817
+ {
2818
+ elm.removeAttribute(memberName);
2819
+ }
2820
+ }
2821
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
2822
+ newValue = newValue === true ? "" : newValue;
2823
+ {
2824
+ elm.setAttribute(memberName, newValue);
2825
+ }
2826
+ }
2827
+ }
2828
+ };
2829
+ var parseClassListRegex = /\s/;
2830
+ var parseClassList = (value) => {
2831
+ if (typeof value === "object" && value && "baseVal" in value) {
2832
+ value = value.baseVal;
2833
+ }
2834
+ if (!value || typeof value !== "string") {
2835
+ return [];
2836
+ }
2837
+ return value.split(parseClassListRegex);
2838
+ };
2839
+ var CAPTURE_EVENT_SUFFIX = "Capture";
2840
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
2841
+
2842
+ // src/runtime/vdom/update-element.ts
2843
+ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
2844
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
2845
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
2846
+ const newVnodeAttrs = newVnode.$attrs$ || {};
2847
+ {
2848
+ for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
2849
+ if (!(memberName in newVnodeAttrs)) {
2850
+ setAccessor(
2851
+ elm,
2852
+ memberName,
2853
+ oldVnodeAttrs[memberName],
2854
+ void 0,
2855
+ isSvgMode2,
2856
+ newVnode.$flags$,
2857
+ isInitialRender
2858
+ );
2859
+ }
2860
+ }
2861
+ }
2862
+ for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
2863
+ setAccessor(
2864
+ elm,
2865
+ memberName,
2866
+ oldVnodeAttrs[memberName],
2867
+ newVnodeAttrs[memberName],
2868
+ isSvgMode2,
2869
+ newVnode.$flags$,
2870
+ isInitialRender
2871
+ );
2872
+ }
2873
+ };
2874
+ function sortedAttrNames(attrNames) {
2875
+ return attrNames.includes("ref") ? (
2876
+ // we need to sort these to ensure that `'ref'` is the last attr
2877
+ [...attrNames.filter((attr) => attr !== "ref"), "ref"]
2878
+ ) : (
2879
+ // no need to sort, return the original array
2880
+ attrNames
2881
+ );
2882
+ }
2883
+ var hostTagName;
2884
+ var isSvgMode = false;
2885
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2886
+ const newVNode2 = newParentVNode.$children$[childIndex];
2887
+ let i2 = 0;
2888
+ let elm;
2889
+ let childNode;
2890
+ if (newVNode2.$text$ !== null) {
2891
+ elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
2892
+ } else {
2893
+ if (!win.document) {
2894
+ throw new Error(
2895
+ "You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
2896
+ );
2897
+ }
2898
+ elm = newVNode2.$elm$ = win.document.createElement(
2899
+ newVNode2.$tag$
2900
+ );
2901
+ {
2902
+ updateElement(null, newVNode2, isSvgMode);
2903
+ }
2904
+ if (newVNode2.$children$) {
2905
+ const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
2906
+ for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
2907
+ childNode = createElm(oldParentVNode, newVNode2, i2);
2908
+ if (childNode) {
2909
+ appendTarget.appendChild(childNode);
2910
+ }
2911
+ }
2912
+ }
2913
+ }
2914
+ elm["s-hn"] = hostTagName;
2915
+ return elm;
2916
+ };
2917
+ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
2918
+ let containerElm = parentElm;
2919
+ let childNode;
2920
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
2921
+ containerElm = containerElm.shadowRoot;
2922
+ }
2923
+ if (parentVNode.$tag$ === "template") {
2924
+ containerElm = containerElm.content;
2925
+ }
2926
+ for (; startIdx <= endIdx; ++startIdx) {
2927
+ if (vnodes[startIdx]) {
2928
+ childNode = createElm(null, parentVNode, startIdx);
2929
+ if (childNode) {
2930
+ vnodes[startIdx].$elm$ = childNode;
2931
+ insertBefore(containerElm, childNode, before);
2932
+ }
2933
+ }
2934
+ }
2935
+ };
2936
+ var removeVnodes = (vnodes, startIdx, endIdx) => {
2937
+ for (let index = startIdx; index <= endIdx; ++index) {
2938
+ const vnode = vnodes[index];
2939
+ if (vnode) {
2940
+ const elm = vnode.$elm$;
2941
+ if (elm) {
2942
+ elm.remove();
2943
+ }
2944
+ }
2945
+ }
2946
+ };
2947
+ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
2948
+ let oldStartIdx = 0;
2949
+ let newStartIdx = 0;
2950
+ let idxInOld = 0;
2951
+ let i2 = 0;
2952
+ let oldEndIdx = oldCh.length - 1;
2953
+ let oldStartVnode = oldCh[0];
2954
+ let oldEndVnode = oldCh[oldEndIdx];
2955
+ let newEndIdx = newCh.length - 1;
2956
+ let newStartVnode = newCh[0];
2957
+ let newEndVnode = newCh[newEndIdx];
2958
+ let node;
2959
+ let elmToMove;
2960
+ const containerElm = newVNode2.$tag$ === "template" ? parentElm.content : parentElm;
2961
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
2962
+ if (oldStartVnode == null) {
2963
+ oldStartVnode = oldCh[++oldStartIdx];
2964
+ } else if (oldEndVnode == null) {
2965
+ oldEndVnode = oldCh[--oldEndIdx];
2966
+ } else if (newStartVnode == null) {
2967
+ newStartVnode = newCh[++newStartIdx];
2968
+ } else if (newEndVnode == null) {
2969
+ newEndVnode = newCh[--newEndIdx];
2970
+ } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
2971
+ patch(oldStartVnode, newStartVnode, isInitialRender);
2972
+ oldStartVnode = oldCh[++oldStartIdx];
2973
+ newStartVnode = newCh[++newStartIdx];
2974
+ } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
2975
+ patch(oldEndVnode, newEndVnode, isInitialRender);
2976
+ oldEndVnode = oldCh[--oldEndIdx];
2977
+ newEndVnode = newCh[--newEndIdx];
2978
+ } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
2979
+ patch(oldStartVnode, newEndVnode, isInitialRender);
2980
+ insertBefore(containerElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
2981
+ oldStartVnode = oldCh[++oldStartIdx];
2982
+ newEndVnode = newCh[--newEndIdx];
2983
+ } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
2984
+ patch(oldEndVnode, newStartVnode, isInitialRender);
2985
+ insertBefore(containerElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
2986
+ oldEndVnode = oldCh[--oldEndIdx];
2987
+ newStartVnode = newCh[++newStartIdx];
2988
+ } else {
2989
+ idxInOld = -1;
2990
+ {
2991
+ for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
2992
+ if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
2993
+ idxInOld = i2;
2994
+ break;
2995
+ }
2996
+ }
2997
+ }
2998
+ if (idxInOld >= 0) {
2999
+ elmToMove = oldCh[idxInOld];
3000
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
3001
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
3002
+ } else {
3003
+ patch(elmToMove, newStartVnode, isInitialRender);
3004
+ oldCh[idxInOld] = void 0;
3005
+ node = elmToMove.$elm$;
3006
+ }
3007
+ newStartVnode = newCh[++newStartIdx];
3008
+ } else {
3009
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
3010
+ newStartVnode = newCh[++newStartIdx];
3011
+ }
3012
+ if (node) {
3013
+ {
3014
+ insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
3015
+ }
3016
+ }
3017
+ }
3018
+ }
3019
+ if (oldStartIdx > oldEndIdx) {
3020
+ addVnodes(
3021
+ parentElm,
3022
+ newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
3023
+ newVNode2,
3024
+ newCh,
3025
+ newStartIdx,
3026
+ newEndIdx
3027
+ );
3028
+ } else if (newStartIdx > newEndIdx) {
3029
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
3030
+ }
3031
+ };
3032
+ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
3033
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
3034
+ if (!isInitialRender) {
3035
+ return leftVNode.$key$ === rightVNode.$key$;
3036
+ }
3037
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
3038
+ leftVNode.$key$ = rightVNode.$key$;
3039
+ }
3040
+ return true;
3041
+ }
3042
+ return false;
3043
+ };
3044
+ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
3045
+ const elm = newVNode2.$elm$ = oldVNode.$elm$;
3046
+ const oldChildren = oldVNode.$children$;
3047
+ const newChildren = newVNode2.$children$;
3048
+ const text = newVNode2.$text$;
3049
+ if (text === null) {
3050
+ {
3051
+ updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
3052
+ }
3053
+ if (oldChildren !== null && newChildren !== null) {
3054
+ updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
3055
+ } else if (newChildren !== null) {
3056
+ if (oldVNode.$text$ !== null) {
3057
+ elm.textContent = "";
3058
+ }
3059
+ addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
3060
+ } else if (
3061
+ // don't do this on initial render as it can cause non-hydrated content to be removed
3062
+ !isInitialRender && BUILD.updatable && oldChildren !== null
3063
+ ) {
3064
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
3065
+ } else if (isInitialRender && BUILD.updatable && oldChildren !== null && newChildren === null) {
3066
+ newVNode2.$children$ = oldChildren;
3067
+ }
3068
+ } else if (oldVNode.$text$ !== text) {
3069
+ elm.data = text;
3070
+ }
3071
+ };
3072
+ var insertBefore = (parent, newNode, reference, isInitialLoad) => {
3073
+ if (typeof newNode["s-sn"] === "string") {
3074
+ parent.insertBefore(newNode, reference);
3075
+ const { slotNode } = findSlotFromSlottedNode(newNode);
3076
+ if (slotNode && true) dispatchSlotChangeEvent(slotNode);
3077
+ return newNode;
3078
+ }
3079
+ if (parent.__insertBefore) {
3080
+ return parent.__insertBefore(newNode, reference);
3081
+ } else {
3082
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
3083
+ }
3084
+ };
3085
+ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
3086
+ const hostElm = hostRef.$hostElement$;
3087
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
3088
+ const isHostElement = isHost(renderFnResults);
3089
+ const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
3090
+ hostTagName = hostElm.tagName;
3091
+ if (isInitialLoad && rootVnode.$attrs$) {
3092
+ for (const key of Object.keys(rootVnode.$attrs$)) {
3093
+ if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
3094
+ rootVnode.$attrs$[key] = hostElm[key];
3095
+ }
3096
+ }
3097
+ }
3098
+ rootVnode.$tag$ = null;
3099
+ rootVnode.$flags$ |= 4 /* isHost */;
3100
+ hostRef.$vnode$ = rootVnode;
3101
+ rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
3102
+ patch(oldVNode, rootVnode, isInitialLoad);
3103
+ };
3104
+
3105
+ // src/runtime/update-component.ts
3106
+ var attachToAncestor = (hostRef, ancestorComponent) => {
3107
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
3108
+ const index = ancestorComponent["s-p"].push(
3109
+ new Promise(
3110
+ (r) => hostRef.$onRenderResolve$ = () => {
3111
+ ancestorComponent["s-p"].splice(index - 1, 1);
3112
+ r();
3113
+ }
3114
+ )
3115
+ );
3116
+ }
3117
+ };
3118
+ var scheduleUpdate = (hostRef, isInitialLoad) => {
3119
+ {
3120
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
3121
+ }
3122
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
3123
+ hostRef.$flags$ |= 512 /* needsRerender */;
3124
+ return;
3125
+ }
3126
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
3127
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
3128
+ if (isInitialLoad) {
3129
+ queueMicrotask(() => {
3130
+ dispatch();
3131
+ });
3132
+ return;
3133
+ }
3134
+ return writeTask(dispatch) ;
3135
+ };
3136
+ var dispatchHooks = (hostRef, isInitialLoad) => {
3137
+ const elm = hostRef.$hostElement$;
3138
+ const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
3139
+ const instance = hostRef.$lazyInstance$ ;
3140
+ if (!instance) {
3141
+ throw new Error(
3142
+ `Can't render component <${elm.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`
3143
+ );
3144
+ }
3145
+ let maybePromise;
3146
+ if (isInitialLoad) {
3147
+ {
3148
+ if (hostRef.$fetchedCbList$.length) {
3149
+ hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
3150
+ }
3151
+ }
3152
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
3153
+ } else {
3154
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
3155
+ }
3156
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
3157
+ endSchedule();
3158
+ return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
3159
+ };
3160
+ var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => {
3161
+ console.error(err2);
3162
+ fn();
3163
+ }) : fn();
3164
+ var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
3165
+ var updateComponent = async (hostRef, instance, isInitialLoad) => {
3166
+ var _a;
3167
+ const elm = hostRef.$hostElement$;
3168
+ const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
3169
+ const rc = elm["s-rc"];
3170
+ if (isInitialLoad) {
3171
+ attachStyles(hostRef);
3172
+ }
3173
+ const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
3174
+ {
3175
+ callRender(hostRef, instance, elm, isInitialLoad);
3176
+ }
3177
+ if (rc) {
3178
+ rc.map((cb) => cb());
3179
+ elm["s-rc"] = void 0;
3180
+ }
3181
+ endRender();
3182
+ endUpdate();
3183
+ {
3184
+ const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
3185
+ const postUpdate = () => postUpdateComponent(hostRef);
3186
+ if (childrenPromises.length === 0) {
3187
+ postUpdate();
3188
+ } else {
3189
+ Promise.all(childrenPromises).then(postUpdate);
3190
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
3191
+ childrenPromises.length = 0;
3192
+ }
3193
+ }
3194
+ };
3195
+ var callRender = (hostRef, instance, elm, isInitialLoad) => {
3196
+ try {
3197
+ instance = instance.render() ;
3198
+ {
3199
+ hostRef.$flags$ &= -17 /* isQueuedForUpdate */;
3200
+ }
3201
+ {
3202
+ hostRef.$flags$ |= 2 /* hasRendered */;
3203
+ }
3204
+ {
3205
+ {
3206
+ {
3207
+ renderVdom(hostRef, instance, isInitialLoad);
3208
+ }
3209
+ }
3210
+ }
3211
+ } catch (e) {
3212
+ consoleError(e, hostRef.$hostElement$);
3213
+ }
3214
+ return null;
3215
+ };
3216
+ var postUpdateComponent = (hostRef) => {
3217
+ const tagName = hostRef.$cmpMeta$.$tagName$;
3218
+ const elm = hostRef.$hostElement$;
3219
+ const endPostUpdate = createTime("postUpdate", tagName);
3220
+ const instance = hostRef.$lazyInstance$ ;
3221
+ const ancestorComponent = hostRef.$ancestorComponent$;
3222
+ safeCall(instance, "componentDidRender", void 0, elm);
3223
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
3224
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
3225
+ {
3226
+ addHydratedFlag(elm);
3227
+ }
3228
+ safeCall(instance, "componentDidLoad", void 0, elm);
3229
+ endPostUpdate();
3230
+ {
3231
+ hostRef.$onReadyResolve$(elm);
3232
+ if (!ancestorComponent) {
3233
+ appDidLoad();
3234
+ }
3235
+ }
3236
+ } else {
3237
+ safeCall(instance, "componentDidUpdate", void 0, elm);
3238
+ endPostUpdate();
3239
+ }
3240
+ {
3241
+ if (hostRef.$onRenderResolve$) {
3242
+ hostRef.$onRenderResolve$();
3243
+ hostRef.$onRenderResolve$ = void 0;
3244
+ }
3245
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
3246
+ nextTick(() => scheduleUpdate(hostRef, false));
3247
+ }
3248
+ hostRef.$flags$ &= -517;
3249
+ }
3250
+ };
3251
+ var appDidLoad = (who) => {
3252
+ var _a;
3253
+ nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
3254
+ {
3255
+ if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) {
3256
+ plt.$orgLocNodes$.clear();
3257
+ }
3258
+ }
3259
+ };
3260
+ var safeCall = (instance, method, arg, elm) => {
3261
+ if (instance && instance[method]) {
3262
+ try {
3263
+ return instance[method](arg);
3264
+ } catch (e) {
3265
+ consoleError(e, elm);
3266
+ }
3267
+ }
3268
+ return void 0;
3269
+ };
3270
+ var addHydratedFlag = (elm) => {
3271
+ var _a;
3272
+ return elm.classList.add((_a = BUILD.hydratedSelectorName) != null ? _a : "hydrated") ;
3273
+ };
3274
+
3275
+ // src/runtime/set-value.ts
3276
+ var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
3277
+ var setValue = (ref, propName, newVal, cmpMeta) => {
3278
+ const hostRef = getHostRef(ref);
3279
+ if (!hostRef) {
3280
+ return;
3281
+ }
3282
+ if (!hostRef) {
3283
+ throw new Error(
3284
+ `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`
3285
+ );
3286
+ }
3287
+ const elm = hostRef.$hostElement$ ;
3288
+ const oldVal = hostRef.$instanceValues$.get(propName);
3289
+ const flags = hostRef.$flags$;
3290
+ const instance = hostRef.$lazyInstance$ ;
3291
+ newVal = parsePropertyValue(
3292
+ newVal,
3293
+ cmpMeta.$members$[propName][0]);
3294
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
3295
+ const didValueChange = newVal !== oldVal && !areBothNaN;
3296
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
3297
+ hostRef.$instanceValues$.set(propName, newVal);
3298
+ if (cmpMeta.$watchers$) {
3299
+ const watchMethods = cmpMeta.$watchers$[propName];
3300
+ if (watchMethods) {
3301
+ watchMethods.map((watcher) => {
3302
+ try {
3303
+ const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
3304
+ if (flags & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */) {
3305
+ if (!instance) {
3306
+ hostRef.$fetchedCbList$.push(() => {
3307
+ hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
3308
+ });
3309
+ } else {
3310
+ instance[watchMethodName](newVal, oldVal, propName);
3311
+ }
3312
+ }
3313
+ } catch (e) {
3314
+ consoleError(e, elm);
3315
+ }
3316
+ });
3317
+ }
3318
+ }
3319
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
3320
+ if (instance.componentShouldUpdate) {
3321
+ if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
3322
+ return;
3323
+ }
3324
+ }
3325
+ scheduleUpdate(hostRef, false);
3326
+ }
3327
+ }
3328
+ };
3329
+
3330
+ // src/runtime/proxy-component.ts
3331
+ var proxyComponent = (Cstr, cmpMeta, flags) => {
3332
+ var _a, _b;
3333
+ const prototype = Cstr.prototype;
3334
+ if (cmpMeta.$members$ || BUILD.propChangeCallback) {
3335
+ {
3336
+ if (Cstr.watchers && !cmpMeta.$watchers$) {
3337
+ cmpMeta.$watchers$ = Cstr.watchers;
3338
+ }
3339
+ if (Cstr.deserializers && !cmpMeta.$deserializers$) {
3340
+ cmpMeta.$deserializers$ = Cstr.deserializers;
3341
+ }
3342
+ if (Cstr.serializers && !cmpMeta.$serializers$) {
3343
+ cmpMeta.$serializers$ = Cstr.serializers;
3344
+ }
3345
+ }
3346
+ const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
3347
+ members.map(([memberName, [memberFlags]]) => {
3348
+ if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
3349
+ const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
3350
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
3351
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
3352
+ if (flags & 1 /* isElementConstructor */ || !origGetter) {
3353
+ Object.defineProperty(prototype, memberName, {
3354
+ get() {
3355
+ {
3356
+ if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
3357
+ return getValue(this, memberName);
3358
+ }
3359
+ const ref = getHostRef(this);
3360
+ const instance = ref ? ref.$lazyInstance$ : prototype;
3361
+ if (!instance) return;
3362
+ return instance[memberName];
3363
+ }
3364
+ },
3365
+ configurable: true,
3366
+ enumerable: true
3367
+ });
3368
+ }
3369
+ Object.defineProperty(prototype, memberName, {
3370
+ set(newValue) {
3371
+ const ref = getHostRef(this);
3372
+ if (!ref) {
3373
+ return;
3374
+ }
3375
+ if (origSetter) {
3376
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
3377
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
3378
+ newValue = ref.$instanceValues$.get(memberName);
3379
+ }
3380
+ origSetter.apply(this, [
3381
+ parsePropertyValue(
3382
+ newValue,
3383
+ memberFlags)
3384
+ ]);
3385
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
3386
+ setValue(this, memberName, newValue, cmpMeta);
3387
+ return;
3388
+ }
3389
+ {
3390
+ if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
3391
+ setValue(this, memberName, newValue, cmpMeta);
3392
+ if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
3393
+ ref.$fetchedCbList$.push(() => {
3394
+ if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
3395
+ ref.$lazyInstance$[memberName] = newValue;
3396
+ }
3397
+ });
3398
+ }
3399
+ return;
3400
+ }
3401
+ const setterSetVal = () => {
3402
+ const currentValue = ref.$lazyInstance$[memberName];
3403
+ if (!ref.$instanceValues$.get(memberName) && currentValue) {
3404
+ ref.$instanceValues$.set(memberName, currentValue);
3405
+ }
3406
+ ref.$lazyInstance$[memberName] = parsePropertyValue(
3407
+ newValue,
3408
+ memberFlags);
3409
+ setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
3410
+ };
3411
+ if (ref.$lazyInstance$) {
3412
+ setterSetVal();
3413
+ } else {
3414
+ ref.$fetchedCbList$.push(() => {
3415
+ setterSetVal();
3416
+ });
3417
+ }
3418
+ }
3419
+ }
3420
+ });
3421
+ }
3422
+ });
3423
+ if ((flags & 1 /* isElementConstructor */)) {
3424
+ const attrNameToPropName = /* @__PURE__ */ new Map();
3425
+ prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
3426
+ plt.jmp(() => {
3427
+ var _a2;
3428
+ const propName = attrNameToPropName.get(attrName);
3429
+ const hostRef = getHostRef(this);
3430
+ if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
3431
+ newValue = this[propName];
3432
+ delete this[propName];
3433
+ }
3434
+ if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
3435
+ this[propName] == newValue) {
3436
+ return;
3437
+ } else if (propName == null) {
3438
+ const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
3439
+ if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && newValue !== oldValue) {
3440
+ const instance = hostRef.$lazyInstance$ ;
3441
+ const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
3442
+ entry == null ? void 0 : entry.forEach((watcher) => {
3443
+ const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
3444
+ if (instance[watchMethodName] != null && (flags2 & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */)) {
3445
+ instance[watchMethodName].call(instance, newValue, oldValue, attrName);
3446
+ }
3447
+ });
3448
+ }
3449
+ return;
3450
+ }
3451
+ const propFlags = members.find(([m]) => m === propName);
3452
+ if (propFlags && propFlags[1][0] & 4 /* Boolean */) {
3453
+ newValue = newValue === null || newValue === "false" ? false : true;
3454
+ }
3455
+ const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
3456
+ if (newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
3457
+ this[propName] = newValue;
3458
+ }
3459
+ });
3460
+ };
3461
+ Cstr.observedAttributes = Array.from(
3462
+ /* @__PURE__ */ new Set([
3463
+ ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
3464
+ ...members.filter(([_, m]) => m[0] & 31 /* HasAttribute */).map(([propName, m]) => {
3465
+ const attrName = m[1] || propName;
3466
+ attrNameToPropName.set(attrName, propName);
3467
+ return attrName;
3468
+ })
3469
+ ])
3470
+ );
3471
+ }
3472
+ }
3473
+ return Cstr;
3474
+ };
3475
+
3476
+ // src/runtime/initialize-component.ts
3477
+ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
3478
+ let Cstr;
3479
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
3480
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
3481
+ const bundleId = cmpMeta.$lazyBundleId$;
3482
+ if (bundleId) {
3483
+ const CstrImport = loadModule(cmpMeta, hostRef);
3484
+ if (CstrImport && "then" in CstrImport) {
3485
+ const endLoad = uniqueTime();
3486
+ Cstr = await CstrImport;
3487
+ endLoad();
3488
+ } else {
3489
+ Cstr = CstrImport;
3490
+ }
3491
+ if (!Cstr) {
3492
+ throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
3493
+ }
3494
+ if (!Cstr.isProxied) {
3495
+ {
3496
+ cmpMeta.$watchers$ = Cstr.watchers;
3497
+ cmpMeta.$serializers$ = Cstr.serializers;
3498
+ cmpMeta.$deserializers$ = Cstr.deserializers;
3499
+ }
3500
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
3501
+ Cstr.isProxied = true;
3502
+ }
3503
+ const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
3504
+ {
3505
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
3506
+ }
3507
+ try {
3508
+ new Cstr(hostRef);
3509
+ } catch (e) {
3510
+ consoleError(e, elm);
3511
+ }
3512
+ {
3513
+ hostRef.$flags$ &= -9 /* isConstructingInstance */;
3514
+ }
3515
+ {
3516
+ hostRef.$flags$ |= 128 /* isWatchReady */;
3517
+ }
3518
+ endNewInstance();
3519
+ {
3520
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
3521
+ }
3522
+ } else {
3523
+ Cstr = elm.constructor;
3524
+ const cmpTag = elm.localName;
3525
+ customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
3526
+ }
3527
+ if (Cstr && Cstr.style) {
3528
+ let style;
3529
+ if (typeof Cstr.style === "string") {
3530
+ style = Cstr.style;
3531
+ }
3532
+ const scopeId2 = getScopeId(cmpMeta);
3533
+ if (!styles.has(scopeId2) || BUILD.hotModuleReplacement) {
3534
+ const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
3535
+ registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
3536
+ endRegisterStyles();
3537
+ }
3538
+ }
3539
+ }
3540
+ const ancestorComponent = hostRef.$ancestorComponent$;
3541
+ const schedule = () => scheduleUpdate(hostRef, true);
3542
+ if (ancestorComponent && ancestorComponent["s-rc"]) {
3543
+ ancestorComponent["s-rc"].push(schedule);
3544
+ } else {
3545
+ schedule();
3546
+ }
3547
+ };
3548
+ var fireConnectedCallback = (instance, elm) => {
3549
+ {
3550
+ safeCall(instance, "connectedCallback", void 0, elm);
3551
+ }
3552
+ };
3553
+
3554
+ // src/runtime/connected-callback.ts
3555
+ var connectedCallback = (elm) => {
3556
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
3557
+ const hostRef = getHostRef(elm);
3558
+ if (!hostRef) {
3559
+ return;
3560
+ }
3561
+ const cmpMeta = hostRef.$cmpMeta$;
3562
+ const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
3563
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
3564
+ hostRef.$flags$ |= 1 /* hasConnected */;
3565
+ let hostId;
3566
+ {
3567
+ hostId = elm.getAttribute(HYDRATE_ID);
3568
+ if (hostId) {
3569
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
3570
+ const scopeId2 = addStyle(elm.shadowRoot, cmpMeta);
3571
+ elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
3572
+ }
3573
+ initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
3574
+ }
3575
+ }
3576
+ {
3577
+ let ancestorComponent = elm;
3578
+ while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
3579
+ if (ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
3580
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
3581
+ break;
3582
+ }
3583
+ }
3584
+ }
3585
+ if (cmpMeta.$members$) {
3586
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
3587
+ if (memberFlags & 31 /* Prop */ && memberName in elm && elm[memberName] !== Object.prototype[memberName]) {
3588
+ const value = elm[memberName];
3589
+ delete elm[memberName];
3590
+ elm[memberName] = value;
3591
+ }
3592
+ });
3593
+ }
3594
+ {
3595
+ initializeComponent(elm, hostRef, cmpMeta);
3596
+ }
3597
+ } else {
3598
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
3599
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
3600
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
3601
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
3602
+ }
3603
+ }
3604
+ endConnected();
3605
+ }
3606
+ };
3607
+ var disconnectInstance = (instance, elm) => {
3608
+ {
3609
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
3610
+ }
3611
+ };
3612
+ var disconnectedCallback = async (elm) => {
3613
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
3614
+ const hostRef = getHostRef(elm);
3615
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
3616
+ disconnectInstance(hostRef.$lazyInstance$, elm);
3617
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
3618
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
3619
+ }
3620
+ }
3621
+ if (rootAppliedStyles.has(elm)) {
3622
+ rootAppliedStyles.delete(elm);
3623
+ }
3624
+ if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
3625
+ rootAppliedStyles.delete(elm.shadowRoot);
3626
+ }
3627
+ };
3628
+
3629
+ // src/runtime/bootstrap-lazy.ts
3630
+ var bootstrapLazy = (lazyBundles, options = {}) => {
3631
+ var _a;
3632
+ if (!win.document) {
3633
+ console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
3634
+ return;
3635
+ }
3636
+ const endBootstrap = createTime();
3637
+ const cmpTags = [];
3638
+ const exclude = options.exclude || [];
3639
+ const customElements2 = win.customElements;
3640
+ const head = win.document.head;
3641
+ const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
3642
+ const dataStyles = /* @__PURE__ */ win.document.createElement("style");
3643
+ const deferredConnectedCallbacks = [];
3644
+ let appLoadFallback;
3645
+ let isBootstrapping = true;
3646
+ Object.assign(plt, options);
3647
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
3648
+ {
3649
+ plt.$flags$ |= 2 /* appLoaded */;
3650
+ }
3651
+ {
3652
+ hydrateScopedToShadow();
3653
+ }
3654
+ let hasSlotRelocation = false;
3655
+ lazyBundles.map((lazyBundle) => {
3656
+ lazyBundle[1].map((compactMeta) => {
3657
+ var _a2, _b, _c;
3658
+ const cmpMeta = {
3659
+ $flags$: compactMeta[0],
3660
+ $tagName$: compactMeta[1],
3661
+ $members$: compactMeta[2],
3662
+ $listeners$: compactMeta[3]
3663
+ };
3664
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
3665
+ hasSlotRelocation = true;
3666
+ }
3667
+ {
3668
+ cmpMeta.$members$ = compactMeta[2];
3669
+ }
3670
+ {
3671
+ cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
3672
+ cmpMeta.$serializers$ = (_b = compactMeta[5]) != null ? _b : {};
3673
+ cmpMeta.$deserializers$ = (_c = compactMeta[6]) != null ? _c : {};
3674
+ }
3675
+ const tagName = transformTag(cmpMeta.$tagName$);
3676
+ const HostElement = class extends HTMLElement {
3677
+ ["s-p"];
3678
+ ["s-rc"];
3679
+ hasRegisteredEventListeners = false;
3680
+ // StencilLazyHost
3681
+ constructor(self) {
3682
+ super(self);
3683
+ self = this;
3684
+ registerHost(self, cmpMeta);
3685
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
3686
+ {
3687
+ if (!self.shadowRoot) {
3688
+ createShadowRoot.call(self, cmpMeta);
3689
+ } else {
3690
+ if (self.shadowRoot.mode !== "open") {
3691
+ throw new Error(
3692
+ `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${self.shadowRoot.mode} but Stencil only supports open shadow roots.`
3693
+ );
3694
+ }
3695
+ }
3696
+ }
3697
+ }
3698
+ }
3699
+ connectedCallback() {
3700
+ const hostRef = getHostRef(this);
3701
+ if (!hostRef) {
3702
+ return;
3703
+ }
3704
+ if (!this.hasRegisteredEventListeners) {
3705
+ this.hasRegisteredEventListeners = true;
3706
+ }
3707
+ if (appLoadFallback) {
3708
+ clearTimeout(appLoadFallback);
3709
+ appLoadFallback = null;
3710
+ }
3711
+ if (isBootstrapping) {
3712
+ deferredConnectedCallbacks.push(this);
3713
+ } else {
3714
+ plt.jmp(() => connectedCallback(this));
3715
+ }
3716
+ }
3717
+ disconnectedCallback() {
3718
+ plt.jmp(() => disconnectedCallback(this));
3719
+ plt.raf(() => {
3720
+ var _a3;
3721
+ const hostRef = getHostRef(this);
3722
+ if (!hostRef) {
3723
+ return;
3724
+ }
3725
+ const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
3726
+ if (i2 > -1) {
3727
+ deferredConnectedCallbacks.splice(i2, 1);
3728
+ }
3729
+ if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
3730
+ delete hostRef.$vnode$.$elm$;
3731
+ }
3732
+ });
3733
+ }
3734
+ componentOnReady() {
3735
+ var _a3;
3736
+ return (_a3 = getHostRef(this)) == null ? void 0 : _a3.$onReadyPromise$;
3737
+ }
3738
+ };
3739
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
3740
+ if (!exclude.includes(tagName) && !customElements2.get(tagName)) {
3741
+ cmpTags.push(tagName);
3742
+ customElements2.define(
3743
+ tagName,
3744
+ proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)
3745
+ );
3746
+ }
3747
+ });
3748
+ });
3749
+ if (cmpTags.length > 0) {
3750
+ if (hasSlotRelocation) {
3751
+ dataStyles.textContent += SLOT_FB_CSS;
3752
+ }
3753
+ {
3754
+ dataStyles.textContent += cmpTags.sort() + HYDRATED_CSS;
3755
+ }
3756
+ if (dataStyles.innerHTML.length) {
3757
+ dataStyles.setAttribute("data-styles", "");
3758
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
3759
+ if (nonce != null) {
3760
+ dataStyles.setAttribute("nonce", nonce);
3761
+ }
3762
+ head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
3763
+ }
3764
+ }
3765
+ isBootstrapping = false;
3766
+ if (deferredConnectedCallbacks.length) {
3767
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
3768
+ } else {
3769
+ {
3770
+ plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30));
3771
+ }
3772
+ }
3773
+ endBootstrap();
3774
+ };
3775
+
3776
+ // src/runtime/nonce.ts
3777
+ var setNonce = (nonce) => plt.$nonce$ = nonce;
3778
+ function transformTag(tag) {
3779
+ return tag;
3780
+ }
3781
+
3782
+ exports.bootstrapLazy = bootstrapLazy;
3783
+ exports.createEvent = createEvent;
3784
+ exports.getElement = getElement;
3785
+ exports.h = h;
3786
+ exports.promiseResolve = promiseResolve;
3787
+ exports.registerInstance = registerInstance;
3788
+ exports.setNonce = setNonce;