@stencil/core 4.41.1-dev.1768453716.5fd0ceb → 4.41.1-dev.1768540084.3de7ba6

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.
@@ -1,253 +1,6 @@
1
1
  /*
2
- Stencil Client Platform v4.41.1-dev.1768453716.5fd0ceb | MIT Licensed | https://stenciljs.com
2
+ Stencil Client Platform v4.41.1-dev.1768540084.3de7ba6 | MIT Licensed | https://stenciljs.com
3
3
  */
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __typeError = (msg) => {
11
- throw TypeError(msg);
12
- };
13
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
- var __commonJS = (cb, mod) => function __require() {
15
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
- };
17
- var __export = (target, all) => {
18
- for (var name in all)
19
- __defProp(target, name, { get: all[name], enumerable: true });
20
- };
21
- var __copyProps = (to, from, except, desc) => {
22
- if (from && typeof from === "object" || typeof from === "function") {
23
- for (let key of __getOwnPropNames(from))
24
- if (!__hasOwnProp.call(to, key) && key !== except)
25
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
26
- }
27
- return to;
28
- };
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
38
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
39
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
40
- 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);
41
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
42
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
43
-
44
- // node_modules/balanced-match/index.js
45
- var require_balanced_match = __commonJS({
46
- "node_modules/balanced-match/index.js"(exports, module) {
47
- "use strict";
48
- module.exports = balanced;
49
- function balanced(a, b, str) {
50
- if (a instanceof RegExp) a = maybeMatch(a, str);
51
- if (b instanceof RegExp) b = maybeMatch(b, str);
52
- var r = range(a, b, str);
53
- return r && {
54
- start: r[0],
55
- end: r[1],
56
- pre: str.slice(0, r[0]),
57
- body: str.slice(r[0] + a.length, r[1]),
58
- post: str.slice(r[1] + b.length)
59
- };
60
- }
61
- function maybeMatch(reg, str) {
62
- var m = str.match(reg);
63
- return m ? m[0] : null;
64
- }
65
- balanced.range = range;
66
- function range(a, b, str) {
67
- var begs, beg, left, right, result;
68
- var ai = str.indexOf(a);
69
- var bi = str.indexOf(b, ai + 1);
70
- var i2 = ai;
71
- if (ai >= 0 && bi > 0) {
72
- if (a === b) {
73
- return [ai, bi];
74
- }
75
- begs = [];
76
- left = str.length;
77
- while (i2 >= 0 && !result) {
78
- if (i2 == ai) {
79
- begs.push(i2);
80
- ai = str.indexOf(a, i2 + 1);
81
- } else if (begs.length == 1) {
82
- result = [begs.pop(), bi];
83
- } else {
84
- beg = begs.pop();
85
- if (beg < left) {
86
- left = beg;
87
- right = bi;
88
- }
89
- bi = str.indexOf(b, i2 + 1);
90
- }
91
- i2 = ai < bi && ai >= 0 ? ai : bi;
92
- }
93
- if (begs.length) {
94
- result = [left, right];
95
- }
96
- }
97
- return result;
98
- }
99
- }
100
- });
101
-
102
- // node_modules/brace-expansion/index.js
103
- var require_brace_expansion = __commonJS({
104
- "node_modules/brace-expansion/index.js"(exports, module) {
105
- var balanced = require_balanced_match();
106
- module.exports = expandTop;
107
- var escSlash = "\0SLASH" + Math.random() + "\0";
108
- var escOpen = "\0OPEN" + Math.random() + "\0";
109
- var escClose = "\0CLOSE" + Math.random() + "\0";
110
- var escComma = "\0COMMA" + Math.random() + "\0";
111
- var escPeriod = "\0PERIOD" + Math.random() + "\0";
112
- function numeric(str) {
113
- return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
114
- }
115
- function escapeBraces(str) {
116
- return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
117
- }
118
- function unescapeBraces(str) {
119
- return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
120
- }
121
- function parseCommaParts(str) {
122
- if (!str)
123
- return [""];
124
- var parts = [];
125
- var m = balanced("{", "}", str);
126
- if (!m)
127
- return str.split(",");
128
- var pre = m.pre;
129
- var body = m.body;
130
- var post = m.post;
131
- var p = pre.split(",");
132
- p[p.length - 1] += "{" + body + "}";
133
- var postParts = parseCommaParts(post);
134
- if (post.length) {
135
- p[p.length - 1] += postParts.shift();
136
- p.push.apply(p, postParts);
137
- }
138
- parts.push.apply(parts, p);
139
- return parts;
140
- }
141
- function expandTop(str) {
142
- if (!str)
143
- return [];
144
- if (str.substr(0, 2) === "{}") {
145
- str = "\\{\\}" + str.substr(2);
146
- }
147
- return expand2(escapeBraces(str), true).map(unescapeBraces);
148
- }
149
- function embrace(str) {
150
- return "{" + str + "}";
151
- }
152
- function isPadded(el) {
153
- return /^-?0\d/.test(el);
154
- }
155
- function lte(i2, y) {
156
- return i2 <= y;
157
- }
158
- function gte(i2, y) {
159
- return i2 >= y;
160
- }
161
- function expand2(str, isTop) {
162
- var expansions = [];
163
- var m = balanced("{", "}", str);
164
- if (!m) return [str];
165
- var pre = m.pre;
166
- var post = m.post.length ? expand2(m.post, false) : [""];
167
- if (/\$$/.test(m.pre)) {
168
- for (var k = 0; k < post.length; k++) {
169
- var expansion = pre + "{" + m.body + "}" + post[k];
170
- expansions.push(expansion);
171
- }
172
- } else {
173
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
174
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
175
- var isSequence = isNumericSequence || isAlphaSequence;
176
- var isOptions = m.body.indexOf(",") >= 0;
177
- if (!isSequence && !isOptions) {
178
- if (m.post.match(/,(?!,).*\}/)) {
179
- str = m.pre + "{" + m.body + escClose + m.post;
180
- return expand2(str);
181
- }
182
- return [str];
183
- }
184
- var n;
185
- if (isSequence) {
186
- n = m.body.split(/\.\./);
187
- } else {
188
- n = parseCommaParts(m.body);
189
- if (n.length === 1) {
190
- n = expand2(n[0], false).map(embrace);
191
- if (n.length === 1) {
192
- return post.map(function(p) {
193
- return m.pre + n[0] + p;
194
- });
195
- }
196
- }
197
- }
198
- var N;
199
- if (isSequence) {
200
- var x = numeric(n[0]);
201
- var y = numeric(n[1]);
202
- var width = Math.max(n[0].length, n[1].length);
203
- var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
204
- var test = lte;
205
- var reverse = y < x;
206
- if (reverse) {
207
- incr *= -1;
208
- test = gte;
209
- }
210
- var pad = n.some(isPadded);
211
- N = [];
212
- for (var i2 = x; test(i2, y); i2 += incr) {
213
- var c;
214
- if (isAlphaSequence) {
215
- c = String.fromCharCode(i2);
216
- if (c === "\\")
217
- c = "";
218
- } else {
219
- c = String(i2);
220
- if (pad) {
221
- var need = width - c.length;
222
- if (need > 0) {
223
- var z = new Array(need + 1).join("0");
224
- if (i2 < 0)
225
- c = "-" + z + c.slice(1);
226
- else
227
- c = z + c;
228
- }
229
- }
230
- }
231
- N.push(c);
232
- }
233
- } else {
234
- N = [];
235
- for (var j = 0; j < n.length; j++) {
236
- N.push.apply(N, expand2(n[j], false));
237
- }
238
- }
239
- for (var j = 0; j < N.length; j++) {
240
- for (var k = 0; k < post.length; k++) {
241
- var expansion = pre + N[j] + post[k];
242
- if (!isTop || isSequence || expansion)
243
- expansions.push(expansion);
244
- }
245
- }
246
- }
247
- return expansions;
248
- }
249
- }
250
- });
251
4
 
252
5
  // src/client/client-build.ts
253
6
  import { BUILD } from "@stencil/core/internal/app-data";
@@ -584,1538 +337,15 @@ var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
584
337
  import { BUILD as BUILD31, Env, NAMESPACE as NAMESPACE2 } from "@stencil/core/internal/app-data";
585
338
 
586
339
  // src/runtime/asset-path.ts
587
- var getAssetPath = (path2) => {
588
- const assetUrl = new URL(path2, plt.$resourcesUrl$);
340
+ var getAssetPath = (path) => {
341
+ const assetUrl = new URL(path, plt.$resourcesUrl$);
589
342
  return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
590
343
  };
591
- var setAssetPath = (path2) => plt.$resourcesUrl$ = path2;
344
+ var setAssetPath = (path) => plt.$resourcesUrl$ = path;
592
345
 
593
346
  // src/runtime/bootstrap-custom-element.ts
594
347
  import { BUILD as BUILD27 } from "@stencil/core/internal/app-data";
595
348
 
596
- // src/utils/helpers.ts
597
- var isDef = (v) => v != null && v !== void 0;
598
- var isComplexType = (o) => {
599
- o = typeof o;
600
- return o === "object" || o === "function";
601
- };
602
-
603
- // node_modules/minimatch/dist/esm/index.js
604
- var import_brace_expansion = __toESM(require_brace_expansion(), 1);
605
-
606
- // node_modules/minimatch/dist/esm/assert-valid-pattern.js
607
- var MAX_PATTERN_LENGTH = 1024 * 64;
608
- var assertValidPattern = (pattern) => {
609
- if (typeof pattern !== "string") {
610
- throw new TypeError("invalid pattern");
611
- }
612
- if (pattern.length > MAX_PATTERN_LENGTH) {
613
- throw new TypeError("pattern is too long");
614
- }
615
- };
616
-
617
- // node_modules/minimatch/dist/esm/brace-expressions.js
618
- var posixClasses = {
619
- "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
620
- "[:alpha:]": ["\\p{L}\\p{Nl}", true],
621
- "[:ascii:]": ["\\x00-\\x7f", false],
622
- "[:blank:]": ["\\p{Zs}\\t", true],
623
- "[:cntrl:]": ["\\p{Cc}", true],
624
- "[:digit:]": ["\\p{Nd}", true],
625
- "[:graph:]": ["\\p{Z}\\p{C}", true, true],
626
- "[:lower:]": ["\\p{Ll}", true],
627
- "[:print:]": ["\\p{C}", true],
628
- "[:punct:]": ["\\p{P}", true],
629
- "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
630
- "[:upper:]": ["\\p{Lu}", true],
631
- "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
632
- "[:xdigit:]": ["A-Fa-f0-9", false]
633
- };
634
- var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
635
- var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
636
- var rangesToString = (ranges) => ranges.join("");
637
- var parseClass = (glob, position) => {
638
- const pos = position;
639
- if (glob.charAt(pos) !== "[") {
640
- throw new Error("not in a brace expression");
641
- }
642
- const ranges = [];
643
- const negs = [];
644
- let i2 = pos + 1;
645
- let sawStart = false;
646
- let uflag = false;
647
- let escaping = false;
648
- let negate = false;
649
- let endPos = pos;
650
- let rangeStart = "";
651
- WHILE: while (i2 < glob.length) {
652
- const c = glob.charAt(i2);
653
- if ((c === "!" || c === "^") && i2 === pos + 1) {
654
- negate = true;
655
- i2++;
656
- continue;
657
- }
658
- if (c === "]" && sawStart && !escaping) {
659
- endPos = i2 + 1;
660
- break;
661
- }
662
- sawStart = true;
663
- if (c === "\\") {
664
- if (!escaping) {
665
- escaping = true;
666
- i2++;
667
- continue;
668
- }
669
- }
670
- if (c === "[" && !escaping) {
671
- for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
672
- if (glob.startsWith(cls, i2)) {
673
- if (rangeStart) {
674
- return ["$.", false, glob.length - pos, true];
675
- }
676
- i2 += cls.length;
677
- if (neg)
678
- negs.push(unip);
679
- else
680
- ranges.push(unip);
681
- uflag = uflag || u;
682
- continue WHILE;
683
- }
684
- }
685
- }
686
- escaping = false;
687
- if (rangeStart) {
688
- if (c > rangeStart) {
689
- ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
690
- } else if (c === rangeStart) {
691
- ranges.push(braceEscape(c));
692
- }
693
- rangeStart = "";
694
- i2++;
695
- continue;
696
- }
697
- if (glob.startsWith("-]", i2 + 1)) {
698
- ranges.push(braceEscape(c + "-"));
699
- i2 += 2;
700
- continue;
701
- }
702
- if (glob.startsWith("-", i2 + 1)) {
703
- rangeStart = c;
704
- i2 += 2;
705
- continue;
706
- }
707
- ranges.push(braceEscape(c));
708
- i2++;
709
- }
710
- if (endPos < i2) {
711
- return ["", false, 0, false];
712
- }
713
- if (!ranges.length && !negs.length) {
714
- return ["$.", false, glob.length - pos, true];
715
- }
716
- if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
717
- const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
718
- return [regexpEscape(r), false, endPos - pos, false];
719
- }
720
- const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
721
- const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
722
- const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
723
- return [comb, uflag, endPos - pos, true];
724
- };
725
-
726
- // node_modules/minimatch/dist/esm/unescape.js
727
- var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
728
- return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
729
- };
730
-
731
- // node_modules/minimatch/dist/esm/ast.js
732
- var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
733
- var isExtglobType = (c) => types.has(c);
734
- var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
735
- var startNoDot = "(?!\\.)";
736
- var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
737
- var justDots = /* @__PURE__ */ new Set(["..", "."]);
738
- var reSpecials = new Set("().*{}+?[]^$\\!");
739
- var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
740
- var qmark = "[^/]";
741
- var star = qmark + "*?";
742
- var starNoEmpty = qmark + "+?";
743
- var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn;
744
- var _AST = class _AST {
745
- constructor(type, parent, options = {}) {
746
- __privateAdd(this, _AST_instances);
747
- __publicField(this, "type");
748
- __privateAdd(this, _root);
749
- __privateAdd(this, _hasMagic);
750
- __privateAdd(this, _uflag, false);
751
- __privateAdd(this, _parts, []);
752
- __privateAdd(this, _parent);
753
- __privateAdd(this, _parentIndex);
754
- __privateAdd(this, _negs);
755
- __privateAdd(this, _filledNegs, false);
756
- __privateAdd(this, _options);
757
- __privateAdd(this, _toString);
758
- // set to true if it's an extglob with no children
759
- // (which really means one child of '')
760
- __privateAdd(this, _emptyExt, false);
761
- this.type = type;
762
- if (type)
763
- __privateSet(this, _hasMagic, true);
764
- __privateSet(this, _parent, parent);
765
- __privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
766
- __privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
767
- __privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
768
- if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
769
- __privateGet(this, _negs).push(this);
770
- __privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
771
- }
772
- get hasMagic() {
773
- if (__privateGet(this, _hasMagic) !== void 0)
774
- return __privateGet(this, _hasMagic);
775
- for (const p of __privateGet(this, _parts)) {
776
- if (typeof p === "string")
777
- continue;
778
- if (p.type || p.hasMagic)
779
- return __privateSet(this, _hasMagic, true);
780
- }
781
- return __privateGet(this, _hasMagic);
782
- }
783
- // reconstructs the pattern
784
- toString() {
785
- if (__privateGet(this, _toString) !== void 0)
786
- return __privateGet(this, _toString);
787
- if (!this.type) {
788
- return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
789
- } else {
790
- return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
791
- }
792
- }
793
- push(...parts) {
794
- for (const p of parts) {
795
- if (p === "")
796
- continue;
797
- if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
798
- throw new Error("invalid part: " + p);
799
- }
800
- __privateGet(this, _parts).push(p);
801
- }
802
- }
803
- toJSON() {
804
- var _a;
805
- 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())];
806
- if (this.isStart() && !this.type)
807
- ret.unshift([]);
808
- if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")) {
809
- ret.push({});
810
- }
811
- return ret;
812
- }
813
- isStart() {
814
- var _a;
815
- if (__privateGet(this, _root) === this)
816
- return true;
817
- if (!((_a = __privateGet(this, _parent)) == null ? void 0 : _a.isStart()))
818
- return false;
819
- if (__privateGet(this, _parentIndex) === 0)
820
- return true;
821
- const p = __privateGet(this, _parent);
822
- for (let i2 = 0; i2 < __privateGet(this, _parentIndex); i2++) {
823
- const pp = __privateGet(p, _parts)[i2];
824
- if (!(pp instanceof _AST && pp.type === "!")) {
825
- return false;
826
- }
827
- }
828
- return true;
829
- }
830
- isEnd() {
831
- var _a, _b, _c;
832
- if (__privateGet(this, _root) === this)
833
- return true;
834
- if (((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")
835
- return true;
836
- if (!((_b = __privateGet(this, _parent)) == null ? void 0 : _b.isEnd()))
837
- return false;
838
- if (!this.type)
839
- return (_c = __privateGet(this, _parent)) == null ? void 0 : _c.isEnd();
840
- const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
841
- return __privateGet(this, _parentIndex) === pl - 1;
842
- }
843
- copyIn(part) {
844
- if (typeof part === "string")
845
- this.push(part);
846
- else
847
- this.push(part.clone(this));
848
- }
849
- clone(parent) {
850
- const c = new _AST(this.type, parent);
851
- for (const p of __privateGet(this, _parts)) {
852
- c.copyIn(p);
853
- }
854
- return c;
855
- }
856
- static fromGlob(pattern, options = {}) {
857
- var _a;
858
- const ast = new _AST(null, void 0, options);
859
- __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, pattern, ast, 0, options);
860
- return ast;
861
- }
862
- // returns the regular expression if there's magic, or the unescaped
863
- // string if not.
864
- toMMPattern() {
865
- if (this !== __privateGet(this, _root))
866
- return __privateGet(this, _root).toMMPattern();
867
- const glob = this.toString();
868
- const [re, body, hasMagic, uflag] = this.toRegExpSource();
869
- const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
870
- if (!anyMagic) {
871
- return body;
872
- }
873
- const flags = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
874
- return Object.assign(new RegExp(`^${re}$`, flags), {
875
- _src: re,
876
- _glob: glob
877
- });
878
- }
879
- get options() {
880
- return __privateGet(this, _options);
881
- }
882
- // returns the string match, the regexp source, whether there's magic
883
- // in the regexp (so a regular expression is required) and whether or
884
- // not the uflag is needed for the regular expression (for posix classes)
885
- // TODO: instead of injecting the start/end at this point, just return
886
- // the BODY of the regexp, along with the start/end portions suitable
887
- // for binding the start/end in either a joined full-path makeRe context
888
- // (where we bind to (^|/), or a standalone matchPart context (where
889
- // we bind to ^, and not /). Otherwise slashes get duped!
890
- //
891
- // In part-matching mode, the start is:
892
- // - if not isStart: nothing
893
- // - if traversal possible, but not allowed: ^(?!\.\.?$)
894
- // - if dots allowed or not possible: ^
895
- // - if dots possible and not allowed: ^(?!\.)
896
- // end is:
897
- // - if not isEnd(): nothing
898
- // - else: $
899
- //
900
- // In full-path matching mode, we put the slash at the START of the
901
- // pattern, so start is:
902
- // - if first pattern: same as part-matching mode
903
- // - if not isStart(): nothing
904
- // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
905
- // - if dots allowed or not possible: /
906
- // - if dots possible and not allowed: /(?!\.)
907
- // end is:
908
- // - if last pattern, same as part-matching mode
909
- // - else nothing
910
- //
911
- // Always put the (?:$|/) on negated tails, though, because that has to be
912
- // there to bind the end of the negated pattern portion, and it's easier to
913
- // just stick it in now rather than try to inject it later in the middle of
914
- // the pattern.
915
- //
916
- // We can just always return the same end, and leave it up to the caller
917
- // to know whether it's going to be used joined or in parts.
918
- // And, if the start is adjusted slightly, can do the same there:
919
- // - if not isStart: nothing
920
- // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
921
- // - if dots allowed or not possible: (?:/|^)
922
- // - if dots possible and not allowed: (?:/|^)(?!\.)
923
- //
924
- // But it's better to have a simpler binding without a conditional, for
925
- // performance, so probably better to return both start options.
926
- //
927
- // Then the caller just ignores the end if it's not the first pattern,
928
- // and the start always gets applied.
929
- //
930
- // But that's always going to be $ if it's the ending pattern, or nothing,
931
- // so the caller can just attach $ at the end of the pattern when building.
932
- //
933
- // So the todo is:
934
- // - better detect what kind of start is needed
935
- // - return both flavors of starting pattern
936
- // - attach $ at the end of the pattern when creating the actual RegExp
937
- //
938
- // Ah, but wait, no, that all only applies to the root when the first pattern
939
- // is not an extglob. If the first pattern IS an extglob, then we need all
940
- // that dot prevention biz to live in the extglob portions, because eg
941
- // +(*|.x*) can match .xy but not .yx.
942
- //
943
- // So, return the two flavors if it's #root and the first child is not an
944
- // AST, otherwise leave it to the child AST to handle it, and there,
945
- // use the (?:^|/) style of start binding.
946
- //
947
- // Even simplified further:
948
- // - Since the start for a join is eg /(?!\.) and the start for a part
949
- // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
950
- // or start or whatever) and prepend ^ or / at the Regexp construction.
951
- toRegExpSource(allowDot) {
952
- var _a;
953
- const dot = allowDot != null ? allowDot : !!__privateGet(this, _options).dot;
954
- if (__privateGet(this, _root) === this)
955
- __privateMethod(this, _AST_instances, fillNegs_fn).call(this);
956
- if (!this.type) {
957
- const noEmpty = this.isStart() && this.isEnd();
958
- const src = __privateGet(this, _parts).map((p) => {
959
- var _a2;
960
- const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a2 = _AST, _AST_static, parseGlob_fn).call(_a2, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
961
- __privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
962
- __privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
963
- return re;
964
- }).join("");
965
- let start2 = "";
966
- if (this.isStart()) {
967
- if (typeof __privateGet(this, _parts)[0] === "string") {
968
- const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
969
- if (!dotTravAllowed) {
970
- const aps = addPatternStart;
971
- const needNoTrav = (
972
- // dots are allowed, and the pattern starts with [ or .
973
- dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
974
- src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
975
- src.startsWith("\\.\\.") && aps.has(src.charAt(4))
976
- );
977
- const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
978
- start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
979
- }
980
- }
981
- }
982
- let end = "";
983
- if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!") {
984
- end = "(?:$|\\/)";
985
- }
986
- const final2 = start2 + src + end;
987
- return [
988
- final2,
989
- unescape(src),
990
- __privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
991
- __privateGet(this, _uflag)
992
- ];
993
- }
994
- const repeated = this.type === "*" || this.type === "+";
995
- const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
996
- let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
997
- if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
998
- const s = this.toString();
999
- __privateSet(this, _parts, [s]);
1000
- this.type = null;
1001
- __privateSet(this, _hasMagic, void 0);
1002
- return [s, unescape(this.toString()), false, false];
1003
- }
1004
- let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
1005
- if (bodyDotAllowed === body) {
1006
- bodyDotAllowed = "";
1007
- }
1008
- if (bodyDotAllowed) {
1009
- body = `(?:${body})(?:${bodyDotAllowed})*?`;
1010
- }
1011
- let final = "";
1012
- if (this.type === "!" && __privateGet(this, _emptyExt)) {
1013
- final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
1014
- } else {
1015
- const close = this.type === "!" ? (
1016
- // !() must match something,but !(x) can match ''
1017
- "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
1018
- ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
1019
- final = start + body + close;
1020
- }
1021
- return [
1022
- final,
1023
- unescape(body),
1024
- __privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
1025
- __privateGet(this, _uflag)
1026
- ];
1027
- }
1028
- };
1029
- _root = new WeakMap();
1030
- _hasMagic = new WeakMap();
1031
- _uflag = new WeakMap();
1032
- _parts = new WeakMap();
1033
- _parent = new WeakMap();
1034
- _parentIndex = new WeakMap();
1035
- _negs = new WeakMap();
1036
- _filledNegs = new WeakMap();
1037
- _options = new WeakMap();
1038
- _toString = new WeakMap();
1039
- _emptyExt = new WeakMap();
1040
- _AST_instances = new WeakSet();
1041
- fillNegs_fn = function() {
1042
- if (this !== __privateGet(this, _root))
1043
- throw new Error("should only call on root");
1044
- if (__privateGet(this, _filledNegs))
1045
- return this;
1046
- this.toString();
1047
- __privateSet(this, _filledNegs, true);
1048
- let n;
1049
- while (n = __privateGet(this, _negs).pop()) {
1050
- if (n.type !== "!")
1051
- continue;
1052
- let p = n;
1053
- let pp = __privateGet(p, _parent);
1054
- while (pp) {
1055
- for (let i2 = __privateGet(p, _parentIndex) + 1; !pp.type && i2 < __privateGet(pp, _parts).length; i2++) {
1056
- for (const part of __privateGet(n, _parts)) {
1057
- if (typeof part === "string") {
1058
- throw new Error("string part in extglob AST??");
1059
- }
1060
- part.copyIn(__privateGet(pp, _parts)[i2]);
1061
- }
1062
- }
1063
- p = pp;
1064
- pp = __privateGet(p, _parent);
1065
- }
1066
- }
1067
- return this;
1068
- };
1069
- _AST_static = new WeakSet();
1070
- parseAST_fn = function(str, ast, pos, opt) {
1071
- var _a, _b;
1072
- let escaping = false;
1073
- let inBrace = false;
1074
- let braceStart = -1;
1075
- let braceNeg = false;
1076
- if (ast.type === null) {
1077
- let i3 = pos;
1078
- let acc2 = "";
1079
- while (i3 < str.length) {
1080
- const c = str.charAt(i3++);
1081
- if (escaping || c === "\\") {
1082
- escaping = !escaping;
1083
- acc2 += c;
1084
- continue;
1085
- }
1086
- if (inBrace) {
1087
- if (i3 === braceStart + 1) {
1088
- if (c === "^" || c === "!") {
1089
- braceNeg = true;
1090
- }
1091
- } else if (c === "]" && !(i3 === braceStart + 2 && braceNeg)) {
1092
- inBrace = false;
1093
- }
1094
- acc2 += c;
1095
- continue;
1096
- } else if (c === "[") {
1097
- inBrace = true;
1098
- braceStart = i3;
1099
- braceNeg = false;
1100
- acc2 += c;
1101
- continue;
1102
- }
1103
- if (!opt.noext && isExtglobType(c) && str.charAt(i3) === "(") {
1104
- ast.push(acc2);
1105
- acc2 = "";
1106
- const ext2 = new _AST(c, ast);
1107
- i3 = __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, str, ext2, i3, opt);
1108
- ast.push(ext2);
1109
- continue;
1110
- }
1111
- acc2 += c;
1112
- }
1113
- ast.push(acc2);
1114
- return i3;
1115
- }
1116
- let i2 = pos + 1;
1117
- let part = new _AST(null, ast);
1118
- const parts = [];
1119
- let acc = "";
1120
- while (i2 < str.length) {
1121
- const c = str.charAt(i2++);
1122
- if (escaping || c === "\\") {
1123
- escaping = !escaping;
1124
- acc += c;
1125
- continue;
1126
- }
1127
- if (inBrace) {
1128
- if (i2 === braceStart + 1) {
1129
- if (c === "^" || c === "!") {
1130
- braceNeg = true;
1131
- }
1132
- } else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
1133
- inBrace = false;
1134
- }
1135
- acc += c;
1136
- continue;
1137
- } else if (c === "[") {
1138
- inBrace = true;
1139
- braceStart = i2;
1140
- braceNeg = false;
1141
- acc += c;
1142
- continue;
1143
- }
1144
- if (isExtglobType(c) && str.charAt(i2) === "(") {
1145
- part.push(acc);
1146
- acc = "";
1147
- const ext2 = new _AST(c, part);
1148
- part.push(ext2);
1149
- i2 = __privateMethod(_b = _AST, _AST_static, parseAST_fn).call(_b, str, ext2, i2, opt);
1150
- continue;
1151
- }
1152
- if (c === "|") {
1153
- part.push(acc);
1154
- acc = "";
1155
- parts.push(part);
1156
- part = new _AST(null, ast);
1157
- continue;
1158
- }
1159
- if (c === ")") {
1160
- if (acc === "" && __privateGet(ast, _parts).length === 0) {
1161
- __privateSet(ast, _emptyExt, true);
1162
- }
1163
- part.push(acc);
1164
- acc = "";
1165
- ast.push(...parts, part);
1166
- return i2;
1167
- }
1168
- acc += c;
1169
- }
1170
- ast.type = null;
1171
- __privateSet(ast, _hasMagic, void 0);
1172
- __privateSet(ast, _parts, [str.substring(pos - 1)]);
1173
- return i2;
1174
- };
1175
- partsToRegExp_fn = function(dot) {
1176
- return __privateGet(this, _parts).map((p) => {
1177
- if (typeof p === "string") {
1178
- throw new Error("string type in extglob ast??");
1179
- }
1180
- const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
1181
- __privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
1182
- return re;
1183
- }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
1184
- };
1185
- parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
1186
- let escaping = false;
1187
- let re = "";
1188
- let uflag = false;
1189
- for (let i2 = 0; i2 < glob.length; i2++) {
1190
- const c = glob.charAt(i2);
1191
- if (escaping) {
1192
- escaping = false;
1193
- re += (reSpecials.has(c) ? "\\" : "") + c;
1194
- continue;
1195
- }
1196
- if (c === "\\") {
1197
- if (i2 === glob.length - 1) {
1198
- re += "\\\\";
1199
- } else {
1200
- escaping = true;
1201
- }
1202
- continue;
1203
- }
1204
- if (c === "[") {
1205
- const [src, needUflag, consumed, magic] = parseClass(glob, i2);
1206
- if (consumed) {
1207
- re += src;
1208
- uflag = uflag || needUflag;
1209
- i2 += consumed - 1;
1210
- hasMagic = hasMagic || magic;
1211
- continue;
1212
- }
1213
- }
1214
- if (c === "*") {
1215
- if (noEmpty && glob === "*")
1216
- re += starNoEmpty;
1217
- else
1218
- re += star;
1219
- hasMagic = true;
1220
- continue;
1221
- }
1222
- if (c === "?") {
1223
- re += qmark;
1224
- hasMagic = true;
1225
- continue;
1226
- }
1227
- re += regExpEscape(c);
1228
- }
1229
- return [re, unescape(glob), !!hasMagic, uflag];
1230
- };
1231
- __privateAdd(_AST, _AST_static);
1232
- var AST = _AST;
1233
-
1234
- // node_modules/minimatch/dist/esm/escape.js
1235
- var escape = (s, { windowsPathsNoEscape = false } = {}) => {
1236
- return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
1237
- };
1238
-
1239
- // node_modules/minimatch/dist/esm/index.js
1240
- var minimatch = (p, pattern, options = {}) => {
1241
- assertValidPattern(pattern);
1242
- if (!options.nocomment && pattern.charAt(0) === "#") {
1243
- return false;
1244
- }
1245
- return new Minimatch(pattern, options).match(p);
1246
- };
1247
- var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
1248
- var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
1249
- var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
1250
- var starDotExtTestNocase = (ext2) => {
1251
- ext2 = ext2.toLowerCase();
1252
- return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
1253
- };
1254
- var starDotExtTestNocaseDot = (ext2) => {
1255
- ext2 = ext2.toLowerCase();
1256
- return (f) => f.toLowerCase().endsWith(ext2);
1257
- };
1258
- var starDotStarRE = /^\*+\.\*+$/;
1259
- var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
1260
- var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
1261
- var dotStarRE = /^\.\*+$/;
1262
- var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
1263
- var starRE = /^\*+$/;
1264
- var starTest = (f) => f.length !== 0 && !f.startsWith(".");
1265
- var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
1266
- var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
1267
- var qmarksTestNocase = ([$0, ext2 = ""]) => {
1268
- const noext = qmarksTestNoExt([$0]);
1269
- if (!ext2)
1270
- return noext;
1271
- ext2 = ext2.toLowerCase();
1272
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
1273
- };
1274
- var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
1275
- const noext = qmarksTestNoExtDot([$0]);
1276
- if (!ext2)
1277
- return noext;
1278
- ext2 = ext2.toLowerCase();
1279
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
1280
- };
1281
- var qmarksTestDot = ([$0, ext2 = ""]) => {
1282
- const noext = qmarksTestNoExtDot([$0]);
1283
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
1284
- };
1285
- var qmarksTest = ([$0, ext2 = ""]) => {
1286
- const noext = qmarksTestNoExt([$0]);
1287
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
1288
- };
1289
- var qmarksTestNoExt = ([$0]) => {
1290
- const len = $0.length;
1291
- return (f) => f.length === len && !f.startsWith(".");
1292
- };
1293
- var qmarksTestNoExtDot = ([$0]) => {
1294
- const len = $0.length;
1295
- return (f) => f.length === len && f !== "." && f !== "..";
1296
- };
1297
- var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
1298
- var path = {
1299
- win32: { sep: "\\" },
1300
- posix: { sep: "/" }
1301
- };
1302
- var sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
1303
- minimatch.sep = sep;
1304
- var GLOBSTAR = Symbol("globstar **");
1305
- minimatch.GLOBSTAR = GLOBSTAR;
1306
- var qmark2 = "[^/]";
1307
- var star2 = qmark2 + "*?";
1308
- var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
1309
- var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
1310
- var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
1311
- minimatch.filter = filter;
1312
- var ext = (a, b = {}) => Object.assign({}, a, b);
1313
- var defaults = (def) => {
1314
- if (!def || typeof def !== "object" || !Object.keys(def).length) {
1315
- return minimatch;
1316
- }
1317
- const orig = minimatch;
1318
- const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
1319
- return Object.assign(m, {
1320
- Minimatch: class Minimatch extends orig.Minimatch {
1321
- constructor(pattern, options = {}) {
1322
- super(pattern, ext(def, options));
1323
- }
1324
- static defaults(options) {
1325
- return orig.defaults(ext(def, options)).Minimatch;
1326
- }
1327
- },
1328
- AST: class AST extends orig.AST {
1329
- /* c8 ignore start */
1330
- constructor(type, parent, options = {}) {
1331
- super(type, parent, ext(def, options));
1332
- }
1333
- /* c8 ignore stop */
1334
- static fromGlob(pattern, options = {}) {
1335
- return orig.AST.fromGlob(pattern, ext(def, options));
1336
- }
1337
- },
1338
- unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
1339
- escape: (s, options = {}) => orig.escape(s, ext(def, options)),
1340
- filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
1341
- defaults: (options) => orig.defaults(ext(def, options)),
1342
- makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
1343
- braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
1344
- match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
1345
- sep: orig.sep,
1346
- GLOBSTAR
1347
- });
1348
- };
1349
- minimatch.defaults = defaults;
1350
- var braceExpand = (pattern, options = {}) => {
1351
- assertValidPattern(pattern);
1352
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
1353
- return [pattern];
1354
- }
1355
- return (0, import_brace_expansion.default)(pattern);
1356
- };
1357
- minimatch.braceExpand = braceExpand;
1358
- var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
1359
- minimatch.makeRe = makeRe;
1360
- var match = (list, pattern, options = {}) => {
1361
- const mm = new Minimatch(pattern, options);
1362
- list = list.filter((f) => mm.match(f));
1363
- if (mm.options.nonull && !list.length) {
1364
- list.push(pattern);
1365
- }
1366
- return list;
1367
- };
1368
- minimatch.match = match;
1369
- var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
1370
- var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1371
- var Minimatch = class {
1372
- options;
1373
- set;
1374
- pattern;
1375
- windowsPathsNoEscape;
1376
- nonegate;
1377
- negate;
1378
- comment;
1379
- empty;
1380
- preserveMultipleSlashes;
1381
- partial;
1382
- globSet;
1383
- globParts;
1384
- nocase;
1385
- isWindows;
1386
- platform;
1387
- windowsNoMagicRoot;
1388
- regexp;
1389
- constructor(pattern, options = {}) {
1390
- assertValidPattern(pattern);
1391
- options = options || {};
1392
- this.options = options;
1393
- this.pattern = pattern;
1394
- this.platform = options.platform || defaultPlatform;
1395
- this.isWindows = this.platform === "win32";
1396
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
1397
- if (this.windowsPathsNoEscape) {
1398
- this.pattern = this.pattern.replace(/\\/g, "/");
1399
- }
1400
- this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
1401
- this.regexp = null;
1402
- this.negate = false;
1403
- this.nonegate = !!options.nonegate;
1404
- this.comment = false;
1405
- this.empty = false;
1406
- this.partial = !!options.partial;
1407
- this.nocase = !!this.options.nocase;
1408
- this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
1409
- this.globSet = [];
1410
- this.globParts = [];
1411
- this.set = [];
1412
- this.make();
1413
- }
1414
- hasMagic() {
1415
- if (this.options.magicalBraces && this.set.length > 1) {
1416
- return true;
1417
- }
1418
- for (const pattern of this.set) {
1419
- for (const part of pattern) {
1420
- if (typeof part !== "string")
1421
- return true;
1422
- }
1423
- }
1424
- return false;
1425
- }
1426
- debug(..._) {
1427
- }
1428
- make() {
1429
- const pattern = this.pattern;
1430
- const options = this.options;
1431
- if (!options.nocomment && pattern.charAt(0) === "#") {
1432
- this.comment = true;
1433
- return;
1434
- }
1435
- if (!pattern) {
1436
- this.empty = true;
1437
- return;
1438
- }
1439
- this.parseNegate();
1440
- this.globSet = [...new Set(this.braceExpand())];
1441
- if (options.debug) {
1442
- this.debug = (...args) => console.error(...args);
1443
- }
1444
- this.debug(this.pattern, this.globSet);
1445
- const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
1446
- this.globParts = this.preprocess(rawGlobParts);
1447
- this.debug(this.pattern, this.globParts);
1448
- let set = this.globParts.map((s, _, __) => {
1449
- if (this.isWindows && this.windowsNoMagicRoot) {
1450
- const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
1451
- const isDrive = /^[a-z]:/i.test(s[0]);
1452
- if (isUNC) {
1453
- return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
1454
- } else if (isDrive) {
1455
- return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
1456
- }
1457
- }
1458
- return s.map((ss) => this.parse(ss));
1459
- });
1460
- this.debug(this.pattern, set);
1461
- this.set = set.filter((s) => s.indexOf(false) === -1);
1462
- if (this.isWindows) {
1463
- for (let i2 = 0; i2 < this.set.length; i2++) {
1464
- const p = this.set[i2];
1465
- if (p[0] === "" && p[1] === "" && this.globParts[i2][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
1466
- p[2] = "?";
1467
- }
1468
- }
1469
- }
1470
- this.debug(this.pattern, this.set);
1471
- }
1472
- // various transforms to equivalent pattern sets that are
1473
- // faster to process in a filesystem walk. The goal is to
1474
- // eliminate what we can, and push all ** patterns as far
1475
- // to the right as possible, even if it increases the number
1476
- // of patterns that we have to process.
1477
- preprocess(globParts) {
1478
- if (this.options.noglobstar) {
1479
- for (let i2 = 0; i2 < globParts.length; i2++) {
1480
- for (let j = 0; j < globParts[i2].length; j++) {
1481
- if (globParts[i2][j] === "**") {
1482
- globParts[i2][j] = "*";
1483
- }
1484
- }
1485
- }
1486
- }
1487
- const { optimizationLevel = 1 } = this.options;
1488
- if (optimizationLevel >= 2) {
1489
- globParts = this.firstPhasePreProcess(globParts);
1490
- globParts = this.secondPhasePreProcess(globParts);
1491
- } else if (optimizationLevel >= 1) {
1492
- globParts = this.levelOneOptimize(globParts);
1493
- } else {
1494
- globParts = this.adjascentGlobstarOptimize(globParts);
1495
- }
1496
- return globParts;
1497
- }
1498
- // just get rid of adjascent ** portions
1499
- adjascentGlobstarOptimize(globParts) {
1500
- return globParts.map((parts) => {
1501
- let gs = -1;
1502
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
1503
- let i2 = gs;
1504
- while (parts[i2 + 1] === "**") {
1505
- i2++;
1506
- }
1507
- if (i2 !== gs) {
1508
- parts.splice(gs, i2 - gs);
1509
- }
1510
- }
1511
- return parts;
1512
- });
1513
- }
1514
- // get rid of adjascent ** and resolve .. portions
1515
- levelOneOptimize(globParts) {
1516
- return globParts.map((parts) => {
1517
- parts = parts.reduce((set, part) => {
1518
- const prev = set[set.length - 1];
1519
- if (part === "**" && prev === "**") {
1520
- return set;
1521
- }
1522
- if (part === "..") {
1523
- if (prev && prev !== ".." && prev !== "." && prev !== "**") {
1524
- set.pop();
1525
- return set;
1526
- }
1527
- }
1528
- set.push(part);
1529
- return set;
1530
- }, []);
1531
- return parts.length === 0 ? [""] : parts;
1532
- });
1533
- }
1534
- levelTwoFileOptimize(parts) {
1535
- if (!Array.isArray(parts)) {
1536
- parts = this.slashSplit(parts);
1537
- }
1538
- let didSomething = false;
1539
- do {
1540
- didSomething = false;
1541
- if (!this.preserveMultipleSlashes) {
1542
- for (let i2 = 1; i2 < parts.length - 1; i2++) {
1543
- const p = parts[i2];
1544
- if (i2 === 1 && p === "" && parts[0] === "")
1545
- continue;
1546
- if (p === "." || p === "") {
1547
- didSomething = true;
1548
- parts.splice(i2, 1);
1549
- i2--;
1550
- }
1551
- }
1552
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
1553
- didSomething = true;
1554
- parts.pop();
1555
- }
1556
- }
1557
- let dd = 0;
1558
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
1559
- const p = parts[dd - 1];
1560
- if (p && p !== "." && p !== ".." && p !== "**") {
1561
- didSomething = true;
1562
- parts.splice(dd - 1, 2);
1563
- dd -= 2;
1564
- }
1565
- }
1566
- } while (didSomething);
1567
- return parts.length === 0 ? [""] : parts;
1568
- }
1569
- // First phase: single-pattern processing
1570
- // <pre> is 1 or more portions
1571
- // <rest> is 1 or more portions
1572
- // <p> is any portion other than ., .., '', or **
1573
- // <e> is . or ''
1574
- //
1575
- // **/.. is *brutal* for filesystem walking performance, because
1576
- // it effectively resets the recursive walk each time it occurs,
1577
- // and ** cannot be reduced out by a .. pattern part like a regexp
1578
- // or most strings (other than .., ., and '') can be.
1579
- //
1580
- // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
1581
- // <pre>/<e>/<rest> -> <pre>/<rest>
1582
- // <pre>/<p>/../<rest> -> <pre>/<rest>
1583
- // **/**/<rest> -> **/<rest>
1584
- //
1585
- // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
1586
- // this WOULD be allowed if ** did follow symlinks, or * didn't
1587
- firstPhasePreProcess(globParts) {
1588
- let didSomething = false;
1589
- do {
1590
- didSomething = false;
1591
- for (let parts of globParts) {
1592
- let gs = -1;
1593
- while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
1594
- let gss = gs;
1595
- while (parts[gss + 1] === "**") {
1596
- gss++;
1597
- }
1598
- if (gss > gs) {
1599
- parts.splice(gs + 1, gss - gs);
1600
- }
1601
- let next = parts[gs + 1];
1602
- const p = parts[gs + 2];
1603
- const p2 = parts[gs + 3];
1604
- if (next !== "..")
1605
- continue;
1606
- if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
1607
- continue;
1608
- }
1609
- didSomething = true;
1610
- parts.splice(gs, 1);
1611
- const other = parts.slice(0);
1612
- other[gs] = "**";
1613
- globParts.push(other);
1614
- gs--;
1615
- }
1616
- if (!this.preserveMultipleSlashes) {
1617
- for (let i2 = 1; i2 < parts.length - 1; i2++) {
1618
- const p = parts[i2];
1619
- if (i2 === 1 && p === "" && parts[0] === "")
1620
- continue;
1621
- if (p === "." || p === "") {
1622
- didSomething = true;
1623
- parts.splice(i2, 1);
1624
- i2--;
1625
- }
1626
- }
1627
- if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
1628
- didSomething = true;
1629
- parts.pop();
1630
- }
1631
- }
1632
- let dd = 0;
1633
- while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
1634
- const p = parts[dd - 1];
1635
- if (p && p !== "." && p !== ".." && p !== "**") {
1636
- didSomething = true;
1637
- const needDot = dd === 1 && parts[dd + 1] === "**";
1638
- const splin = needDot ? ["."] : [];
1639
- parts.splice(dd - 1, 2, ...splin);
1640
- if (parts.length === 0)
1641
- parts.push("");
1642
- dd -= 2;
1643
- }
1644
- }
1645
- }
1646
- } while (didSomething);
1647
- return globParts;
1648
- }
1649
- // second phase: multi-pattern dedupes
1650
- // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
1651
- // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
1652
- // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
1653
- //
1654
- // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
1655
- // ^-- not valid because ** doens't follow symlinks
1656
- secondPhasePreProcess(globParts) {
1657
- for (let i2 = 0; i2 < globParts.length - 1; i2++) {
1658
- for (let j = i2 + 1; j < globParts.length; j++) {
1659
- const matched = this.partsMatch(globParts[i2], globParts[j], !this.preserveMultipleSlashes);
1660
- if (!matched)
1661
- continue;
1662
- globParts[i2] = matched;
1663
- globParts[j] = [];
1664
- }
1665
- }
1666
- return globParts.filter((gs) => gs.length);
1667
- }
1668
- partsMatch(a, b, emptyGSMatch = false) {
1669
- let ai = 0;
1670
- let bi = 0;
1671
- let result = [];
1672
- let which = "";
1673
- while (ai < a.length && bi < b.length) {
1674
- if (a[ai] === b[bi]) {
1675
- result.push(which === "b" ? b[bi] : a[ai]);
1676
- ai++;
1677
- bi++;
1678
- } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
1679
- result.push(a[ai]);
1680
- ai++;
1681
- } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
1682
- result.push(b[bi]);
1683
- bi++;
1684
- } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
1685
- if (which === "b")
1686
- return false;
1687
- which = "a";
1688
- result.push(a[ai]);
1689
- ai++;
1690
- bi++;
1691
- } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
1692
- if (which === "a")
1693
- return false;
1694
- which = "b";
1695
- result.push(b[bi]);
1696
- ai++;
1697
- bi++;
1698
- } else {
1699
- return false;
1700
- }
1701
- }
1702
- return a.length === b.length && result;
1703
- }
1704
- parseNegate() {
1705
- if (this.nonegate)
1706
- return;
1707
- const pattern = this.pattern;
1708
- let negate = false;
1709
- let negateOffset = 0;
1710
- for (let i2 = 0; i2 < pattern.length && pattern.charAt(i2) === "!"; i2++) {
1711
- negate = !negate;
1712
- negateOffset++;
1713
- }
1714
- if (negateOffset)
1715
- this.pattern = pattern.slice(negateOffset);
1716
- this.negate = negate;
1717
- }
1718
- // set partial to true to test if, for example,
1719
- // "/a/b" matches the start of "/*/b/*/d"
1720
- // Partial means, if you run out of file before you run
1721
- // out of pattern, then that's fine, as long as all
1722
- // the parts match.
1723
- matchOne(file, pattern, partial = false) {
1724
- const options = this.options;
1725
- if (this.isWindows) {
1726
- const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
1727
- const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
1728
- const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
1729
- const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
1730
- const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
1731
- const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
1732
- if (typeof fdi === "number" && typeof pdi === "number") {
1733
- const [fd, pd] = [file[fdi], pattern[pdi]];
1734
- if (fd.toLowerCase() === pd.toLowerCase()) {
1735
- pattern[pdi] = fd;
1736
- if (pdi > fdi) {
1737
- pattern = pattern.slice(pdi);
1738
- } else if (fdi > pdi) {
1739
- file = file.slice(fdi);
1740
- }
1741
- }
1742
- }
1743
- }
1744
- const { optimizationLevel = 1 } = this.options;
1745
- if (optimizationLevel >= 2) {
1746
- file = this.levelTwoFileOptimize(file);
1747
- }
1748
- this.debug("matchOne", this, { file, pattern });
1749
- this.debug("matchOne", file.length, pattern.length);
1750
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
1751
- this.debug("matchOne loop");
1752
- var p = pattern[pi];
1753
- var f = file[fi];
1754
- this.debug(pattern, p, f);
1755
- if (p === false) {
1756
- return false;
1757
- }
1758
- if (p === GLOBSTAR) {
1759
- this.debug("GLOBSTAR", [pattern, p, f]);
1760
- var fr = fi;
1761
- var pr = pi + 1;
1762
- if (pr === pl) {
1763
- this.debug("** at the end");
1764
- for (; fi < fl; fi++) {
1765
- if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
1766
- return false;
1767
- }
1768
- return true;
1769
- }
1770
- while (fr < fl) {
1771
- var swallowee = file[fr];
1772
- this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
1773
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
1774
- this.debug("globstar found match!", fr, fl, swallowee);
1775
- return true;
1776
- } else {
1777
- if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
1778
- this.debug("dot detected!", file, fr, pattern, pr);
1779
- break;
1780
- }
1781
- this.debug("globstar swallow a segment, and continue");
1782
- fr++;
1783
- }
1784
- }
1785
- if (partial) {
1786
- this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
1787
- if (fr === fl) {
1788
- return true;
1789
- }
1790
- }
1791
- return false;
1792
- }
1793
- let hit;
1794
- if (typeof p === "string") {
1795
- hit = f === p;
1796
- this.debug("string match", p, f, hit);
1797
- } else {
1798
- hit = p.test(f);
1799
- this.debug("pattern match", p, f, hit);
1800
- }
1801
- if (!hit)
1802
- return false;
1803
- }
1804
- if (fi === fl && pi === pl) {
1805
- return true;
1806
- } else if (fi === fl) {
1807
- return partial;
1808
- } else if (pi === pl) {
1809
- return fi === fl - 1 && file[fi] === "";
1810
- } else {
1811
- throw new Error("wtf?");
1812
- }
1813
- }
1814
- braceExpand() {
1815
- return braceExpand(this.pattern, this.options);
1816
- }
1817
- parse(pattern) {
1818
- assertValidPattern(pattern);
1819
- const options = this.options;
1820
- if (pattern === "**")
1821
- return GLOBSTAR;
1822
- if (pattern === "")
1823
- return "";
1824
- let m;
1825
- let fastTest = null;
1826
- if (m = pattern.match(starRE)) {
1827
- fastTest = options.dot ? starTestDot : starTest;
1828
- } else if (m = pattern.match(starDotExtRE)) {
1829
- fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
1830
- } else if (m = pattern.match(qmarksRE)) {
1831
- fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
1832
- } else if (m = pattern.match(starDotStarRE)) {
1833
- fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
1834
- } else if (m = pattern.match(dotStarRE)) {
1835
- fastTest = dotStarTest;
1836
- }
1837
- const re = AST.fromGlob(pattern, this.options).toMMPattern();
1838
- if (fastTest && typeof re === "object") {
1839
- Reflect.defineProperty(re, "test", { value: fastTest });
1840
- }
1841
- return re;
1842
- }
1843
- makeRe() {
1844
- if (this.regexp || this.regexp === false)
1845
- return this.regexp;
1846
- const set = this.set;
1847
- if (!set.length) {
1848
- this.regexp = false;
1849
- return this.regexp;
1850
- }
1851
- const options = this.options;
1852
- const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
1853
- const flags = new Set(options.nocase ? ["i"] : []);
1854
- let re = set.map((pattern) => {
1855
- const pp = pattern.map((p) => {
1856
- if (p instanceof RegExp) {
1857
- for (const f of p.flags.split(""))
1858
- flags.add(f);
1859
- }
1860
- return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
1861
- });
1862
- pp.forEach((p, i2) => {
1863
- const next = pp[i2 + 1];
1864
- const prev = pp[i2 - 1];
1865
- if (p !== GLOBSTAR || prev === GLOBSTAR) {
1866
- return;
1867
- }
1868
- if (prev === void 0) {
1869
- if (next !== void 0 && next !== GLOBSTAR) {
1870
- pp[i2 + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
1871
- } else {
1872
- pp[i2] = twoStar;
1873
- }
1874
- } else if (next === void 0) {
1875
- pp[i2 - 1] = prev + "(?:\\/|" + twoStar + ")?";
1876
- } else if (next !== GLOBSTAR) {
1877
- pp[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
1878
- pp[i2 + 1] = GLOBSTAR;
1879
- }
1880
- });
1881
- return pp.filter((p) => p !== GLOBSTAR).join("/");
1882
- }).join("|");
1883
- const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
1884
- re = "^" + open + re + close + "$";
1885
- if (this.negate)
1886
- re = "^(?!" + re + ").+$";
1887
- try {
1888
- this.regexp = new RegExp(re, [...flags].join(""));
1889
- } catch (ex) {
1890
- this.regexp = false;
1891
- }
1892
- return this.regexp;
1893
- }
1894
- slashSplit(p) {
1895
- if (this.preserveMultipleSlashes) {
1896
- return p.split("/");
1897
- } else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
1898
- return ["", ...p.split(/\/+/)];
1899
- } else {
1900
- return p.split(/\/+/);
1901
- }
1902
- }
1903
- match(f, partial = this.partial) {
1904
- this.debug("match", f, this.pattern);
1905
- if (this.comment) {
1906
- return false;
1907
- }
1908
- if (this.empty) {
1909
- return f === "";
1910
- }
1911
- if (f === "/" && partial) {
1912
- return true;
1913
- }
1914
- const options = this.options;
1915
- if (this.isWindows) {
1916
- f = f.split("\\").join("/");
1917
- }
1918
- const ff = this.slashSplit(f);
1919
- this.debug(this.pattern, "split", ff);
1920
- const set = this.set;
1921
- this.debug(this.pattern, "set", set);
1922
- let filename = ff[ff.length - 1];
1923
- if (!filename) {
1924
- for (let i2 = ff.length - 2; !filename && i2 >= 0; i2--) {
1925
- filename = ff[i2];
1926
- }
1927
- }
1928
- for (let i2 = 0; i2 < set.length; i2++) {
1929
- const pattern = set[i2];
1930
- let file = ff;
1931
- if (options.matchBase && pattern.length === 1) {
1932
- file = [filename];
1933
- }
1934
- const hit = this.matchOne(file, pattern, partial);
1935
- if (hit) {
1936
- if (options.flipNegate) {
1937
- return true;
1938
- }
1939
- return !this.negate;
1940
- }
1941
- }
1942
- if (options.flipNegate) {
1943
- return false;
1944
- }
1945
- return this.negate;
1946
- }
1947
- static defaults(def) {
1948
- return minimatch.defaults(def).Minimatch;
1949
- }
1950
- };
1951
- minimatch.AST = AST;
1952
- minimatch.Minimatch = Minimatch;
1953
- minimatch.escape = escape;
1954
- minimatch.unescape = unescape;
1955
-
1956
- // src/utils/query-nonce-meta-tag-content.ts
1957
- function queryNonceMetaTagContent(doc) {
1958
- var _a, _b, _c;
1959
- 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;
1960
- }
1961
-
1962
- // src/utils/regular-expression.ts
1963
- var escapeRegExpSpecialCharacters = (text) => {
1964
- return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1965
- };
1966
-
1967
- // src/utils/remote-value.ts
1968
- var RemoteValue = class _RemoteValue {
1969
- /**
1970
- * Deserializes a LocalValue serialized object back to its original JavaScript representation
1971
- *
1972
- * @param serialized The serialized LocalValue object
1973
- * @returns The original JavaScript value/object
1974
- */
1975
- static fromLocalValue(serialized) {
1976
- const type = serialized[TYPE_CONSTANT];
1977
- const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
1978
- switch (type) {
1979
- case "string" /* String */:
1980
- return value;
1981
- case "boolean" /* Boolean */:
1982
- return value;
1983
- case "bigint" /* BigInt */:
1984
- return BigInt(value);
1985
- case "undefined" /* Undefined */:
1986
- return void 0;
1987
- case "null" /* Null */:
1988
- return null;
1989
- case "number" /* Number */:
1990
- if (value === "NaN") return NaN;
1991
- if (value === "-0") return -0;
1992
- if (value === "Infinity") return Infinity;
1993
- if (value === "-Infinity") return -Infinity;
1994
- return value;
1995
- case "array" /* Array */:
1996
- return value.map((item) => _RemoteValue.fromLocalValue(item));
1997
- case "date" /* Date */:
1998
- return new Date(value);
1999
- case "map" /* Map */:
2000
- const map2 = /* @__PURE__ */ new Map();
2001
- for (const [key, val] of value) {
2002
- const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
2003
- const deserializedValue = _RemoteValue.fromLocalValue(val);
2004
- map2.set(deserializedKey, deserializedValue);
2005
- }
2006
- return map2;
2007
- case "object" /* Object */:
2008
- const obj = {};
2009
- for (const [key, val] of value) {
2010
- obj[key] = _RemoteValue.fromLocalValue(val);
2011
- }
2012
- return obj;
2013
- case "regexp" /* RegularExpression */:
2014
- const { pattern, flags } = value;
2015
- return new RegExp(pattern, flags);
2016
- case "set" /* Set */:
2017
- const set = /* @__PURE__ */ new Set();
2018
- for (const item of value) {
2019
- set.add(_RemoteValue.fromLocalValue(item));
2020
- }
2021
- return set;
2022
- case "symbol" /* Symbol */:
2023
- return Symbol(value);
2024
- default:
2025
- throw new Error(`Unsupported type: ${type}`);
2026
- }
2027
- }
2028
- /**
2029
- * Utility method to deserialize multiple LocalValues at once
2030
- *
2031
- * @param serializedValues Array of serialized LocalValue objects
2032
- * @returns Array of deserialized JavaScript values
2033
- */
2034
- static fromLocalValueArray(serializedValues) {
2035
- return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
2036
- }
2037
- /**
2038
- * Verifies if the given object matches the structure of a serialized LocalValue
2039
- *
2040
- * @param obj Object to verify
2041
- * @returns boolean indicating if the object has LocalValue structure
2042
- */
2043
- static isLocalValueObject(obj) {
2044
- if (typeof obj !== "object" || obj === null) {
2045
- return false;
2046
- }
2047
- if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
2048
- return false;
2049
- }
2050
- const type = obj[TYPE_CONSTANT];
2051
- const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
2052
- if (!hasTypeProperty) {
2053
- return false;
2054
- }
2055
- if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
2056
- return obj.hasOwnProperty(VALUE_CONSTANT);
2057
- }
2058
- return true;
2059
- }
2060
- };
2061
-
2062
- // src/utils/result.ts
2063
- var result_exports = {};
2064
- __export(result_exports, {
2065
- err: () => err,
2066
- map: () => map,
2067
- ok: () => ok,
2068
- unwrap: () => unwrap,
2069
- unwrapErr: () => unwrapErr
2070
- });
2071
- var ok = (value) => ({
2072
- isOk: true,
2073
- isErr: false,
2074
- value
2075
- });
2076
- var err = (value) => ({
2077
- isOk: false,
2078
- isErr: true,
2079
- value
2080
- });
2081
- function map(result, fn) {
2082
- if (result.isOk) {
2083
- const val = fn(result.value);
2084
- if (val instanceof Promise) {
2085
- return val.then((newVal) => ok(newVal));
2086
- } else {
2087
- return ok(val);
2088
- }
2089
- }
2090
- if (result.isErr) {
2091
- const value = result.value;
2092
- return err(value);
2093
- }
2094
- throw "should never get here";
2095
- }
2096
- var unwrap = (result) => {
2097
- if (result.isOk) {
2098
- return result.value;
2099
- } else {
2100
- throw result.value;
2101
- }
2102
- };
2103
- var unwrapErr = (result) => {
2104
- if (result.isErr) {
2105
- return result.value;
2106
- } else {
2107
- throw result.value;
2108
- }
2109
- };
2110
-
2111
- // src/utils/serialize.ts
2112
- function deserializeProperty(value) {
2113
- if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
2114
- return value;
2115
- }
2116
- return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
2117
- }
2118
-
2119
349
  // src/utils/shadow-root.ts
2120
350
  import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
2121
351
  import { globalStyles } from "@stencil/core/internal/app-globals";
@@ -2161,20 +391,6 @@ function createShadowRoot(cmpMeta) {
2161
391
  }
2162
392
  }
2163
393
 
2164
- // src/utils/util.ts
2165
- var lowerPathParam = (fn) => (p) => fn(p.toLowerCase());
2166
- var isDtsFile = lowerPathParam((p) => p.endsWith(".d.ts") || p.endsWith(".d.mts") || p.endsWith(".d.cts"));
2167
- var isTsFile = lowerPathParam(
2168
- (p) => !isDtsFile(p) && (p.endsWith(".ts") || p.endsWith(".mts") || p.endsWith(".cts"))
2169
- );
2170
- var isTsxFile = lowerPathParam(
2171
- (p) => p.endsWith(".tsx") || p.endsWith(".mtsx") || p.endsWith(".ctsx")
2172
- );
2173
- var isJsxFile = lowerPathParam(
2174
- (p) => p.endsWith(".jsx") || p.endsWith(".mjsx") || p.endsWith(".cjsx")
2175
- );
2176
- var isJsFile = lowerPathParam((p) => p.endsWith(".js") || p.endsWith(".mjs") || p.endsWith(".cjs"));
2177
-
2178
394
  // src/runtime/connected-callback.ts
2179
395
  import { BUILD as BUILD25 } from "@stencil/core/internal/app-data";
2180
396
 
@@ -2801,6 +1017,14 @@ var installDevTools = () => {
2801
1017
 
2802
1018
  // src/runtime/styles.ts
2803
1019
  import { BUILD as BUILD12 } from "@stencil/core/internal/app-data";
1020
+
1021
+ // src/utils/query-nonce-meta-tag-content.ts
1022
+ function queryNonceMetaTagContent(doc) {
1023
+ var _a, _b, _c;
1024
+ 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;
1025
+ }
1026
+
1027
+ // src/runtime/styles.ts
2804
1028
  var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
2805
1029
  var registerStyle = (scopeId2, cssText, allowCS) => {
2806
1030
  let style = styles.get(scopeId2);
@@ -2943,6 +1167,15 @@ var hydrateScopedToShadow = () => {
2943
1167
 
2944
1168
  // src/runtime/vdom/h.ts
2945
1169
  import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
1170
+
1171
+ // src/utils/helpers.ts
1172
+ var isDef = (v) => v != null && v !== void 0;
1173
+ var isComplexType = (o) => {
1174
+ o = typeof o;
1175
+ return o === "object" || o === "function";
1176
+ };
1177
+
1178
+ // src/runtime/vdom/h.ts
2946
1179
  var h = (nodeName, vnodeData, ...children) => {
2947
1180
  if (typeof nodeName === "string") {
2948
1181
  nodeName = transformTag(nodeName);
@@ -3507,6 +1740,11 @@ var findCorrespondingNode = (node, type) => {
3507
1740
  // src/runtime/initialize-component.ts
3508
1741
  import { BUILD as BUILD24 } from "@stencil/core/internal/app-data";
3509
1742
 
1743
+ // src/utils/regular-expression.ts
1744
+ var escapeRegExpSpecialCharacters = (text) => {
1745
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1746
+ };
1747
+
3510
1748
  // src/utils/shadow-css.ts
3511
1749
  /**
3512
1750
  * @license
@@ -3572,9 +1810,6 @@ var createSupportsRuleRe = (selector) => {
3572
1810
  "g"
3573
1811
  );
3574
1812
  };
3575
- var _colonSlottedRe = createSupportsRuleRe("::slotted");
3576
- var _colonHostRe = createSupportsRuleRe(":host");
3577
- var _colonHostContextRe = createSupportsRuleRe(":host-context");
3578
1813
  var _commentRe = /\/\*\s*[\s\S]*?\*\//g;
3579
1814
  var stripComments = (input) => {
3580
1815
  return input.replace(_commentRe, "");
@@ -3652,6 +1887,9 @@ var insertPolyfillHostInCssText = (cssText) => {
3652
1887
  supportsBlocks.push(selectorContent);
3653
1888
  return `@supports selector(${placeholder})`;
3654
1889
  });
1890
+ const _colonSlottedRe = createSupportsRuleRe("::slotted");
1891
+ const _colonHostRe = createSupportsRuleRe(":host");
1892
+ const _colonHostContextRe = createSupportsRuleRe(":host-context");
3655
1893
  cssText = cssText.replace(_colonHostContextRe, `$1${_polyfillHostContext}`).replace(_colonHostRe, `$1${_polyfillHost}`).replace(_colonSlottedRe, `$1${_polyfillSlotted}`);
3656
1894
  supportsBlocks.forEach((originalSelector, index) => {
3657
1895
  cssText = cssText.replace(`__supports_${index}__`, originalSelector);
@@ -3775,16 +2013,16 @@ var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
3775
2013
  let scopedSelector = "";
3776
2014
  let startIndex = 0;
3777
2015
  let res;
3778
- const sep2 = /( |>|\+|~(?!=))(?=(?:[^()]*\([^()]*\))*[^()]*$)\s*/g;
2016
+ const sep = /( |>|\+|~(?!=))(?=(?:[^()]*\([^()]*\))*[^()]*$)\s*/g;
3779
2017
  const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
3780
2018
  let shouldScope = !hasHost;
3781
- while ((res = sep2.exec(selector)) !== null) {
2019
+ while ((res = sep.exec(selector)) !== null) {
3782
2020
  const separator = res[1];
3783
2021
  const part2 = selector.slice(startIndex, res.index).trim();
3784
2022
  shouldScope = shouldScope || part2.indexOf(_polyfillHostNoCombinator) > -1;
3785
2023
  const scopedPart = shouldScope ? _scopeSelectorPart(part2) : part2;
3786
2024
  scopedSelector += `${scopedPart} ${separator} `;
3787
- startIndex = sep2.lastIndex;
2025
+ startIndex = sep.lastIndex;
3788
2026
  }
3789
2027
  const part = selector.substring(startIndex);
3790
2028
  shouldScope = !part.match(_safePartRe) && (shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1);
@@ -3929,6 +2167,111 @@ import { BUILD as BUILD22 } from "@stencil/core/internal/app-data";
3929
2167
 
3930
2168
  // src/runtime/parse-property-value.ts
3931
2169
  import { BUILD as BUILD15 } from "@stencil/core/internal/app-data";
2170
+
2171
+ // src/utils/remote-value.ts
2172
+ var RemoteValue = class _RemoteValue {
2173
+ /**
2174
+ * Deserializes a LocalValue serialized object back to its original JavaScript representation
2175
+ *
2176
+ * @param serialized The serialized LocalValue object
2177
+ * @returns The original JavaScript value/object
2178
+ */
2179
+ static fromLocalValue(serialized) {
2180
+ const type = serialized[TYPE_CONSTANT];
2181
+ const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
2182
+ switch (type) {
2183
+ case "string" /* String */:
2184
+ return value;
2185
+ case "boolean" /* Boolean */:
2186
+ return value;
2187
+ case "bigint" /* BigInt */:
2188
+ return BigInt(value);
2189
+ case "undefined" /* Undefined */:
2190
+ return void 0;
2191
+ case "null" /* Null */:
2192
+ return null;
2193
+ case "number" /* Number */:
2194
+ if (value === "NaN") return NaN;
2195
+ if (value === "-0") return -0;
2196
+ if (value === "Infinity") return Infinity;
2197
+ if (value === "-Infinity") return -Infinity;
2198
+ return value;
2199
+ case "array" /* Array */:
2200
+ return value.map((item) => _RemoteValue.fromLocalValue(item));
2201
+ case "date" /* Date */:
2202
+ return new Date(value);
2203
+ case "map" /* Map */:
2204
+ const map = /* @__PURE__ */ new Map();
2205
+ for (const [key, val] of value) {
2206
+ const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
2207
+ const deserializedValue = _RemoteValue.fromLocalValue(val);
2208
+ map.set(deserializedKey, deserializedValue);
2209
+ }
2210
+ return map;
2211
+ case "object" /* Object */:
2212
+ const obj = {};
2213
+ for (const [key, val] of value) {
2214
+ obj[key] = _RemoteValue.fromLocalValue(val);
2215
+ }
2216
+ return obj;
2217
+ case "regexp" /* RegularExpression */:
2218
+ const { pattern, flags } = value;
2219
+ return new RegExp(pattern, flags);
2220
+ case "set" /* Set */:
2221
+ const set = /* @__PURE__ */ new Set();
2222
+ for (const item of value) {
2223
+ set.add(_RemoteValue.fromLocalValue(item));
2224
+ }
2225
+ return set;
2226
+ case "symbol" /* Symbol */:
2227
+ return Symbol(value);
2228
+ default:
2229
+ throw new Error(`Unsupported type: ${type}`);
2230
+ }
2231
+ }
2232
+ /**
2233
+ * Utility method to deserialize multiple LocalValues at once
2234
+ *
2235
+ * @param serializedValues Array of serialized LocalValue objects
2236
+ * @returns Array of deserialized JavaScript values
2237
+ */
2238
+ static fromLocalValueArray(serializedValues) {
2239
+ return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
2240
+ }
2241
+ /**
2242
+ * Verifies if the given object matches the structure of a serialized LocalValue
2243
+ *
2244
+ * @param obj Object to verify
2245
+ * @returns boolean indicating if the object has LocalValue structure
2246
+ */
2247
+ static isLocalValueObject(obj) {
2248
+ if (typeof obj !== "object" || obj === null) {
2249
+ return false;
2250
+ }
2251
+ if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
2252
+ return false;
2253
+ }
2254
+ const type = obj[TYPE_CONSTANT];
2255
+ const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
2256
+ if (!hasTypeProperty) {
2257
+ return false;
2258
+ }
2259
+ if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
2260
+ return obj.hasOwnProperty(VALUE_CONSTANT);
2261
+ }
2262
+ return true;
2263
+ }
2264
+ };
2265
+
2266
+ // src/utils/serialize.ts
2267
+ function deserializeProperty(value) {
2268
+ if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
2269
+ return value;
2270
+ }
2271
+ return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
2272
+ }
2273
+
2274
+ // src/runtime/parse-property-value.ts
3932
2275
  var parsePropertyValue = (propValue, propType, isFormAssociated) => {
3933
2276
  if ((BUILD15.hydrateClientSide || BUILD15.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
3934
2277
  propValue = deserializeProperty(propValue);
@@ -4211,9 +2554,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
4211
2554
  isSvgMode = newVNode2.$tag$ === "svg";
4212
2555
  }
4213
2556
  if (!win.document) {
4214
- throw new Error(
4215
- "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."
4216
- );
2557
+ throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
4217
2558
  }
4218
2559
  elm = newVNode2.$elm$ = BUILD20.svg ? win.document.createElementNS(
4219
2560
  isSvgMode ? SVG_NS : HTML_NS,
@@ -4565,16 +2906,18 @@ var nullifyVNodeRefs = (vNode) => {
4565
2906
  }
4566
2907
  };
4567
2908
  var insertBefore = (parent, newNode, reference, isInitialLoad) => {
4568
- if (BUILD20.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) {
4569
- addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
4570
- } else if (typeof newNode["s-sn"] === "string") {
4571
- if (BUILD20.experimentalSlotFixes && parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
4572
- patchParentNode(newNode);
2909
+ if (BUILD20.slotRelocation) {
2910
+ if (BUILD20.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) {
2911
+ addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
2912
+ } else if (typeof newNode["s-sn"] === "string") {
2913
+ if (BUILD20.experimentalSlotFixes && parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
2914
+ patchParentNode(newNode);
2915
+ }
2916
+ parent.insertBefore(newNode, reference);
2917
+ const { slotNode } = findSlotFromSlottedNode(newNode);
2918
+ if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);
2919
+ return newNode;
4573
2920
  }
4574
- parent.insertBefore(newNode, reference);
4575
- const { slotNode } = findSlotFromSlottedNode(newNode);
4576
- if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);
4577
- return newNode;
4578
2921
  }
4579
2922
  if (parent.__insertBefore) {
4580
2923
  return parent.__insertBefore(newNode, reference);
@@ -4833,8 +3176,8 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
4833
3176
  endSchedule();
4834
3177
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
4835
3178
  };
4836
- var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => {
4837
- console.error(err2);
3179
+ var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err) => {
3180
+ console.error(err);
4838
3181
  fn();
4839
3182
  }) : fn();
4840
3183
  var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
@@ -5902,7 +4245,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
5902
4245
  });
5903
4246
  });
5904
4247
  if (cmpTags.length > 0) {
5905
- if (hasSlotRelocation) {
4248
+ if (BUILD28.slotRelocation && hasSlotRelocation) {
5906
4249
  dataStyles.textContent += SLOT_FB_CSS;
5907
4250
  }
5908
4251
  if (BUILD28.invisiblePrehydration && (BUILD28.hydratedClass || BUILD28.hydratedAttribute)) {