@stencil/core
Version:
A Compiler for Web Components and Progressive Web Apps
1,448 lines (1,422 loc) • 229 kB
JavaScript
/*
Stencil Client Platform v4.41.0 | MIT Licensed | https://stenciljs.com
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __typeError = (msg) => {
throw TypeError(msg);
};
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
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);
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
// node_modules/balanced-match/index.js
var require_balanced_match = __commonJS({
"node_modules/balanced-match/index.js"(exports, module) {
"use strict";
module.exports = balanced;
function balanced(a, b, str) {
if (a instanceof RegExp) a = maybeMatch(a, str);
if (b instanceof RegExp) b = maybeMatch(b, str);
var r = range(a, b, str);
return r && {
start: r[0],
end: r[1],
pre: str.slice(0, r[0]),
body: str.slice(r[0] + a.length, r[1]),
post: str.slice(r[1] + b.length)
};
}
function maybeMatch(reg, str) {
var m = str.match(reg);
return m ? m[0] : null;
}
balanced.range = range;
function range(a, b, str) {
var begs, beg, left, right, result;
var ai = str.indexOf(a);
var bi = str.indexOf(b, ai + 1);
var i2 = ai;
if (ai >= 0 && bi > 0) {
if (a === b) {
return [ai, bi];
}
begs = [];
left = str.length;
while (i2 >= 0 && !result) {
if (i2 == ai) {
begs.push(i2);
ai = str.indexOf(a, i2 + 1);
} else if (begs.length == 1) {
result = [begs.pop(), bi];
} else {
beg = begs.pop();
if (beg < left) {
left = beg;
right = bi;
}
bi = str.indexOf(b, i2 + 1);
}
i2 = ai < bi && ai >= 0 ? ai : bi;
}
if (begs.length) {
result = [left, right];
}
}
return result;
}
}
});
// node_modules/brace-expansion/index.js
var require_brace_expansion = __commonJS({
"node_modules/brace-expansion/index.js"(exports, module) {
var balanced = require_balanced_match();
module.exports = expandTop;
var escSlash = "\0SLASH" + Math.random() + "\0";
var escOpen = "\0OPEN" + Math.random() + "\0";
var escClose = "\0CLOSE" + Math.random() + "\0";
var escComma = "\0COMMA" + Math.random() + "\0";
var escPeriod = "\0PERIOD" + Math.random() + "\0";
function numeric(str) {
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
}
function escapeBraces(str) {
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
}
function unescapeBraces(str) {
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
}
function parseCommaParts(str) {
if (!str)
return [""];
var parts = [];
var m = balanced("{", "}", str);
if (!m)
return str.split(",");
var pre = m.pre;
var body = m.body;
var post = m.post;
var p = pre.split(",");
p[p.length - 1] += "{" + body + "}";
var postParts = parseCommaParts(post);
if (post.length) {
p[p.length - 1] += postParts.shift();
p.push.apply(p, postParts);
}
parts.push.apply(parts, p);
return parts;
}
function expandTop(str) {
if (!str)
return [];
if (str.substr(0, 2) === "{}") {
str = "\\{\\}" + str.substr(2);
}
return expand2(escapeBraces(str), true).map(unescapeBraces);
}
function embrace(str) {
return "{" + str + "}";
}
function isPadded(el) {
return /^-?0\d/.test(el);
}
function lte(i2, y) {
return i2 <= y;
}
function gte(i2, y) {
return i2 >= y;
}
function expand2(str, isTop) {
var expansions = [];
var m = balanced("{", "}", str);
if (!m) return [str];
var pre = m.pre;
var post = m.post.length ? expand2(m.post, false) : [""];
if (/\$$/.test(m.pre)) {
for (var k = 0; k < post.length; k++) {
var expansion = pre + "{" + m.body + "}" + post[k];
expansions.push(expansion);
}
} else {
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
var isSequence = isNumericSequence || isAlphaSequence;
var isOptions = m.body.indexOf(",") >= 0;
if (!isSequence && !isOptions) {
if (m.post.match(/,(?!,).*\}/)) {
str = m.pre + "{" + m.body + escClose + m.post;
return expand2(str);
}
return [str];
}
var n;
if (isSequence) {
n = m.body.split(/\.\./);
} else {
n = parseCommaParts(m.body);
if (n.length === 1) {
n = expand2(n[0], false).map(embrace);
if (n.length === 1) {
return post.map(function(p) {
return m.pre + n[0] + p;
});
}
}
}
var N;
if (isSequence) {
var x = numeric(n[0]);
var y = numeric(n[1]);
var width = Math.max(n[0].length, n[1].length);
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
var test = lte;
var reverse = y < x;
if (reverse) {
incr *= -1;
test = gte;
}
var pad = n.some(isPadded);
N = [];
for (var i2 = x; test(i2, y); i2 += incr) {
var c;
if (isAlphaSequence) {
c = String.fromCharCode(i2);
if (c === "\\")
c = "";
} else {
c = String(i2);
if (pad) {
var need = width - c.length;
if (need > 0) {
var z = new Array(need + 1).join("0");
if (i2 < 0)
c = "-" + z + c.slice(1);
else
c = z + c;
}
}
}
N.push(c);
}
} else {
N = [];
for (var j = 0; j < n.length; j++) {
N.push.apply(N, expand2(n[j], false));
}
}
for (var j = 0; j < N.length; j++) {
for (var k = 0; k < post.length; k++) {
var expansion = pre + N[j] + post[k];
if (!isTop || isSequence || expansion)
expansions.push(expansion);
}
}
}
return expansions;
}
}
});
// src/client/client-build.ts
import { BUILD } from "@stencil/core/internal/app-data";
var Build = {
isDev: BUILD.isDev ? true : false,
isBrowser: true,
isServer: false,
isTesting: BUILD.isTesting ? true : false
};
// src/client/client-host-ref.ts
import { BUILD as BUILD3 } from "@stencil/core/internal/app-data";
// src/utils/constants.ts
var SVG_NS = "http://www.w3.org/2000/svg";
var HTML_NS = "http://www.w3.org/1999/xhtml";
var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
PrimitiveType2["Undefined"] = "undefined";
PrimitiveType2["Null"] = "null";
PrimitiveType2["String"] = "string";
PrimitiveType2["Number"] = "number";
PrimitiveType2["SpecialNumber"] = "number";
PrimitiveType2["Boolean"] = "boolean";
PrimitiveType2["BigInt"] = "bigint";
return PrimitiveType2;
})(PrimitiveType || {});
var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
NonPrimitiveType2["Array"] = "array";
NonPrimitiveType2["Date"] = "date";
NonPrimitiveType2["Map"] = "map";
NonPrimitiveType2["Object"] = "object";
NonPrimitiveType2["RegularExpression"] = "regexp";
NonPrimitiveType2["Set"] = "set";
NonPrimitiveType2["Channel"] = "channel";
NonPrimitiveType2["Symbol"] = "symbol";
return NonPrimitiveType2;
})(NonPrimitiveType || {});
var TYPE_CONSTANT = "type";
var VALUE_CONSTANT = "value";
var SERIALIZED_PREFIX = "serialized:";
// src/utils/es2022-rewire-class-members.ts
import { BUILD as BUILD2 } from "@stencil/core/internal/app-data";
var reWireGetterSetter = (instance, hostRef) => {
var _a;
const cmpMeta = hostRef.$cmpMeta$;
const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
members.map(([memberName, [memberFlags]]) => {
if ((BUILD2.state || BUILD2.prop) && (memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
const ogValue = instance[memberName];
const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName) || Object.getOwnPropertyDescriptor(instance, memberName);
if (ogDescriptor) {
Object.defineProperty(instance, memberName, {
get() {
return ogDescriptor.get.call(this);
},
set(newValue) {
ogDescriptor.set.call(this, newValue);
},
configurable: true,
enumerable: true
});
}
instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue;
}
});
};
function getPropertyDescriptor(obj, memberName) {
while (obj) {
const desc = Object.getOwnPropertyDescriptor(obj, memberName);
if (desc == null ? void 0 : desc.get) return desc;
obj = Object.getPrototypeOf(obj);
}
return void 0;
}
// src/client/client-host-ref.ts
var getHostRef = (ref) => {
if (ref.__stencil__getHostRef) {
return ref.__stencil__getHostRef();
}
return void 0;
};
var registerInstance = (lazyInstance, hostRef) => {
if (!hostRef) return;
lazyInstance.__stencil__getHostRef = () => hostRef;
hostRef.$lazyInstance$ = lazyInstance;
if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD3.state || BUILD3.prop)) {
reWireGetterSetter(lazyInstance, hostRef);
}
};
var registerHost = (hostElement, cmpMeta) => {
const hostRef = {
$flags$: 0,
$hostElement$: hostElement,
$cmpMeta$: cmpMeta,
$instanceValues$: /* @__PURE__ */ new Map(),
$serializerValues$: /* @__PURE__ */ new Map()
};
if (BUILD3.isDev) {
hostRef.$renderCount$ = 0;
}
if (BUILD3.method && BUILD3.lazyLoad) {
hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
}
if (BUILD3.asyncLoading) {
hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
hostElement["s-p"] = [];
hostElement["s-rc"] = [];
}
if (BUILD3.lazyLoad) {
hostRef.$fetchedCbList$ = [];
}
const ref = hostRef;
hostElement.__stencil__getHostRef = () => ref;
if (!BUILD3.lazyLoad && cmpMeta.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD3.state || BUILD3.prop)) {
reWireGetterSetter(hostElement, hostRef);
}
return ref;
};
var isMemberInElement = (elm, memberName) => memberName in elm;
// src/client/client-load-module.ts
import { BUILD as BUILD5 } from "@stencil/core/internal/app-data";
// src/client/client-log.ts
import { BUILD as BUILD4 } from "@stencil/core/internal/app-data";
var customError;
var consoleError = (e, el) => (customError || console.error)(e, el);
var STENCIL_DEV_MODE = BUILD4.isTesting ? ["STENCIL:"] : [
"%cstencil",
"color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
];
var consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
var consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
var consoleDevInfo = (...m) => console.info(...STENCIL_DEV_MODE, ...m);
var setErrorHandler = (handler) => customError = handler;
// src/client/client-load-module.ts
var cmpModules = /* @__PURE__ */ new Map();
var MODULE_IMPORT_PREFIX = "./";
var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
const bundleId = cmpMeta.$lazyBundleId$;
if (BUILD5.isDev && typeof bundleId !== "string") {
consoleDevError(
`Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`
);
return void 0;
} else if (!bundleId) {
return void 0;
}
const module = !BUILD5.hotModuleReplacement ? cmpModules.get(bundleId) : false;
if (module) {
return module[exportName];
}
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
return import(
/* @vite-ignore */
/* webpackInclude: /\.entry\.js$/ */
/* webpackExclude: /\.system\.entry\.js$/ */
/* webpackMode: "lazy" */
`./${bundleId}.entry.js${BUILD5.hotModuleReplacement && hmrVersionId ? "?s-hmr=" + hmrVersionId : ""}`
).then(
(importedModule) => {
if (!BUILD5.hotModuleReplacement) {
cmpModules.set(bundleId, importedModule);
}
return importedModule[exportName];
},
(e) => {
consoleError(e, hostRef.$hostElement$);
}
);
};
// src/client/client-style.ts
var styles = /* @__PURE__ */ new Map();
var modeResolutionChain = [];
var setScopedSSR = (_opts) => {
};
var needsScopedSSR = () => false;
// src/client/client-task-queue.ts
import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
// src/runtime/runtime-constants.ts
var CONTENT_REF_ID = "r";
var ORG_LOCATION_ID = "o";
var SLOT_NODE_ID = "s";
var TEXT_NODE_ID = "t";
var COMMENT_NODE_ID = "c";
var HYDRATE_ID = "s-id";
var HYDRATED_STYLE_ID = "sty-id";
var HYDRATE_CHILD_ID = "c-id";
var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
var STENCIL_DOC_DATA = "_stencilDocData";
var DEFAULT_DOC_DATA = {
hostIds: 0,
rootLevelIds: 0,
staticComponents: /* @__PURE__ */ new Set()
};
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
var XLINK_NS = "http://www.w3.org/1999/xlink";
var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
"formAssociatedCallback",
"formResetCallback",
"formDisabledCallback",
"formStateRestoreCallback"
];
// src/client/client-window.ts
import { BUILD as BUILD6 } from "@stencil/core/internal/app-data";
var win = typeof window !== "undefined" ? window : {};
var H = win.HTMLElement || class {
};
var plt = {
$flags$: 0,
$resourcesUrl$: "",
jmp: (h2) => h2(),
raf: (h2) => requestAnimationFrame(h2),
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
ce: (eventName, opts) => new CustomEvent(eventName, opts)
};
var setPlatformHelpers = (helpers) => {
Object.assign(plt, helpers);
};
var supportsShadow = BUILD6.shadowDom;
var supportsListenerOptions = /* @__PURE__ */ (() => {
var _a;
let supportsListenerOptions2 = false;
try {
(_a = win.document) == null ? void 0 : _a.addEventListener(
"e",
null,
Object.defineProperty({}, "passive", {
get() {
supportsListenerOptions2 = true;
}
})
);
} catch (e) {
}
return supportsListenerOptions2;
})();
var promiseResolve = (v) => Promise.resolve(v);
var supportsConstructableStylesheets = BUILD6.constructableCSS ? /* @__PURE__ */ (() => {
try {
if (!win.document.adoptedStyleSheets) {
return false;
}
new CSSStyleSheet();
return typeof new CSSStyleSheet().replaceSync === "function";
} catch (e) {
}
return false;
})() : false;
var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
// src/client/client-task-queue.ts
var queueCongestion = 0;
var queuePending = false;
var queueDomReads = [];
var queueDomWrites = [];
var queueDomWritesLow = [];
var queueTask = (queue, write) => (cb) => {
queue.push(cb);
if (!queuePending) {
queuePending = true;
if (write && plt.$flags$ & 4 /* queueSync */) {
nextTick(flush);
} else {
plt.raf(flush);
}
}
};
var consume = (queue) => {
for (let i2 = 0; i2 < queue.length; i2++) {
try {
queue[i2](performance.now());
} catch (e) {
consoleError(e);
}
}
queue.length = 0;
};
var consumeTimeout = (queue, timeout) => {
let i2 = 0;
let ts = 0;
while (i2 < queue.length && (ts = performance.now()) < timeout) {
try {
queue[i2++](ts);
} catch (e) {
consoleError(e);
}
}
if (i2 === queue.length) {
queue.length = 0;
} else if (i2 !== 0) {
queue.splice(0, i2);
}
};
var flush = () => {
if (BUILD7.asyncQueue) {
queueCongestion++;
}
consume(queueDomReads);
if (BUILD7.asyncQueue) {
const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */ ? performance.now() + 14 * Math.ceil(queueCongestion * (1 / 10)) : Infinity;
consumeTimeout(queueDomWrites, timeout);
consumeTimeout(queueDomWritesLow, timeout);
if (queueDomWrites.length > 0) {
queueDomWritesLow.push(...queueDomWrites);
queueDomWrites.length = 0;
}
if (queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0) {
plt.raf(flush);
} else {
queueCongestion = 0;
}
} else {
consume(queueDomWrites);
if (queuePending = queueDomReads.length > 0) {
plt.raf(flush);
}
}
};
var nextTick = (cb) => promiseResolve().then(cb);
var readTask = /* @__PURE__ */ queueTask(queueDomReads, false);
var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
// src/client/index.ts
import { BUILD as BUILD31, Env, NAMESPACE as NAMESPACE2 } from "@stencil/core/internal/app-data";
// src/runtime/asset-path.ts
var getAssetPath = (path2) => {
const assetUrl = new URL(path2, plt.$resourcesUrl$);
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
};
var setAssetPath = (path2) => plt.$resourcesUrl$ = path2;
// src/runtime/bootstrap-custom-element.ts
import { BUILD as BUILD27 } from "@stencil/core/internal/app-data";
// src/utils/helpers.ts
var isDef = (v) => v != null && v !== void 0;
var isComplexType = (o) => {
o = typeof o;
return o === "object" || o === "function";
};
// node_modules/minimatch/dist/esm/index.js
var import_brace_expansion = __toESM(require_brace_expansion(), 1);
// node_modules/minimatch/dist/esm/assert-valid-pattern.js
var MAX_PATTERN_LENGTH = 1024 * 64;
var assertValidPattern = (pattern) => {
if (typeof pattern !== "string") {
throw new TypeError("invalid pattern");
}
if (pattern.length > MAX_PATTERN_LENGTH) {
throw new TypeError("pattern is too long");
}
};
// node_modules/minimatch/dist/esm/brace-expressions.js
var posixClasses = {
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
"[:ascii:]": ["\\x00-\\x7f", false],
"[:blank:]": ["\\p{Zs}\\t", true],
"[:cntrl:]": ["\\p{Cc}", true],
"[:digit:]": ["\\p{Nd}", true],
"[:graph:]": ["\\p{Z}\\p{C}", true, true],
"[:lower:]": ["\\p{Ll}", true],
"[:print:]": ["\\p{C}", true],
"[:punct:]": ["\\p{P}", true],
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
"[:upper:]": ["\\p{Lu}", true],
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
"[:xdigit:]": ["A-Fa-f0-9", false]
};
var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
var rangesToString = (ranges) => ranges.join("");
var parseClass = (glob, position) => {
const pos = position;
if (glob.charAt(pos) !== "[") {
throw new Error("not in a brace expression");
}
const ranges = [];
const negs = [];
let i2 = pos + 1;
let sawStart = false;
let uflag = false;
let escaping = false;
let negate = false;
let endPos = pos;
let rangeStart = "";
WHILE: while (i2 < glob.length) {
const c = glob.charAt(i2);
if ((c === "!" || c === "^") && i2 === pos + 1) {
negate = true;
i2++;
continue;
}
if (c === "]" && sawStart && !escaping) {
endPos = i2 + 1;
break;
}
sawStart = true;
if (c === "\\") {
if (!escaping) {
escaping = true;
i2++;
continue;
}
}
if (c === "[" && !escaping) {
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
if (glob.startsWith(cls, i2)) {
if (rangeStart) {
return ["$.", false, glob.length - pos, true];
}
i2 += cls.length;
if (neg)
negs.push(unip);
else
ranges.push(unip);
uflag = uflag || u;
continue WHILE;
}
}
}
escaping = false;
if (rangeStart) {
if (c > rangeStart) {
ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
} else if (c === rangeStart) {
ranges.push(braceEscape(c));
}
rangeStart = "";
i2++;
continue;
}
if (glob.startsWith("-]", i2 + 1)) {
ranges.push(braceEscape(c + "-"));
i2 += 2;
continue;
}
if (glob.startsWith("-", i2 + 1)) {
rangeStart = c;
i2 += 2;
continue;
}
ranges.push(braceEscape(c));
i2++;
}
if (endPos < i2) {
return ["", false, 0, false];
}
if (!ranges.length && !negs.length) {
return ["$.", false, glob.length - pos, true];
}
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
return [regexpEscape(r), false, endPos - pos, false];
}
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
return [comb, uflag, endPos - pos, true];
};
// node_modules/minimatch/dist/esm/unescape.js
var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
};
// node_modules/minimatch/dist/esm/ast.js
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
var isExtglobType = (c) => types.has(c);
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
var startNoDot = "(?!\\.)";
var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
var justDots = /* @__PURE__ */ new Set(["..", "."]);
var reSpecials = new Set("().*{}+?[]^$\\!");
var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
var qmark = "[^/]";
var star = qmark + "*?";
var starNoEmpty = qmark + "+?";
var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn;
var _AST = class _AST {
constructor(type, parent, options = {}) {
__privateAdd(this, _AST_instances);
__publicField(this, "type");
__privateAdd(this, _root);
__privateAdd(this, _hasMagic);
__privateAdd(this, _uflag, false);
__privateAdd(this, _parts, []);
__privateAdd(this, _parent);
__privateAdd(this, _parentIndex);
__privateAdd(this, _negs);
__privateAdd(this, _filledNegs, false);
__privateAdd(this, _options);
__privateAdd(this, _toString);
// set to true if it's an extglob with no children
// (which really means one child of '')
__privateAdd(this, _emptyExt, false);
this.type = type;
if (type)
__privateSet(this, _hasMagic, true);
__privateSet(this, _parent, parent);
__privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
__privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
__privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
__privateGet(this, _negs).push(this);
__privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
}
get hasMagic() {
if (__privateGet(this, _hasMagic) !== void 0)
return __privateGet(this, _hasMagic);
for (const p of __privateGet(this, _parts)) {
if (typeof p === "string")
continue;
if (p.type || p.hasMagic)
return __privateSet(this, _hasMagic, true);
}
return __privateGet(this, _hasMagic);
}
// reconstructs the pattern
toString() {
if (__privateGet(this, _toString) !== void 0)
return __privateGet(this, _toString);
if (!this.type) {
return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
} else {
return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
}
}
push(...parts) {
for (const p of parts) {
if (p === "")
continue;
if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
throw new Error("invalid part: " + p);
}
__privateGet(this, _parts).push(p);
}
}
toJSON() {
var _a;
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())];
if (this.isStart() && !this.type)
ret.unshift([]);
if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")) {
ret.push({});
}
return ret;
}
isStart() {
var _a;
if (__privateGet(this, _root) === this)
return true;
if (!((_a = __privateGet(this, _parent)) == null ? void 0 : _a.isStart()))
return false;
if (__privateGet(this, _parentIndex) === 0)
return true;
const p = __privateGet(this, _parent);
for (let i2 = 0; i2 < __privateGet(this, _parentIndex); i2++) {
const pp = __privateGet(p, _parts)[i2];
if (!(pp instanceof _AST && pp.type === "!")) {
return false;
}
}
return true;
}
isEnd() {
var _a, _b, _c;
if (__privateGet(this, _root) === this)
return true;
if (((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")
return true;
if (!((_b = __privateGet(this, _parent)) == null ? void 0 : _b.isEnd()))
return false;
if (!this.type)
return (_c = __privateGet(this, _parent)) == null ? void 0 : _c.isEnd();
const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
return __privateGet(this, _parentIndex) === pl - 1;
}
copyIn(part) {
if (typeof part === "string")
this.push(part);
else
this.push(part.clone(this));
}
clone(parent) {
const c = new _AST(this.type, parent);
for (const p of __privateGet(this, _parts)) {
c.copyIn(p);
}
return c;
}
static fromGlob(pattern, options = {}) {
var _a;
const ast = new _AST(null, void 0, options);
__privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, pattern, ast, 0, options);
return ast;
}
// returns the regular expression if there's magic, or the unescaped
// string if not.
toMMPattern() {
if (this !== __privateGet(this, _root))
return __privateGet(this, _root).toMMPattern();
const glob = this.toString();
const [re, body, hasMagic, uflag] = this.toRegExpSource();
const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
if (!anyMagic) {
return body;
}
const flags = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
return Object.assign(new RegExp(`^${re}$`, flags), {
_src: re,
_glob: glob
});
}
get options() {
return __privateGet(this, _options);
}
// returns the string match, the regexp source, whether there's magic
// in the regexp (so a regular expression is required) and whether or
// not the uflag is needed for the regular expression (for posix classes)
// TODO: instead of injecting the start/end at this point, just return
// the BODY of the regexp, along with the start/end portions suitable
// for binding the start/end in either a joined full-path makeRe context
// (where we bind to (^|/), or a standalone matchPart context (where
// we bind to ^, and not /). Otherwise slashes get duped!
//
// In part-matching mode, the start is:
// - if not isStart: nothing
// - if traversal possible, but not allowed: ^(?!\.\.?$)
// - if dots allowed or not possible: ^
// - if dots possible and not allowed: ^(?!\.)
// end is:
// - if not isEnd(): nothing
// - else: $
//
// In full-path matching mode, we put the slash at the START of the
// pattern, so start is:
// - if first pattern: same as part-matching mode
// - if not isStart(): nothing
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
// - if dots allowed or not possible: /
// - if dots possible and not allowed: /(?!\.)
// end is:
// - if last pattern, same as part-matching mode
// - else nothing
//
// Always put the (?:$|/) on negated tails, though, because that has to be
// there to bind the end of the negated pattern portion, and it's easier to
// just stick it in now rather than try to inject it later in the middle of
// the pattern.
//
// We can just always return the same end, and leave it up to the caller
// to know whether it's going to be used joined or in parts.
// And, if the start is adjusted slightly, can do the same there:
// - if not isStart: nothing
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
// - if dots allowed or not possible: (?:/|^)
// - if dots possible and not allowed: (?:/|^)(?!\.)
//
// But it's better to have a simpler binding without a conditional, for
// performance, so probably better to return both start options.
//
// Then the caller just ignores the end if it's not the first pattern,
// and the start always gets applied.
//
// But that's always going to be $ if it's the ending pattern, or nothing,
// so the caller can just attach $ at the end of the pattern when building.
//
// So the todo is:
// - better detect what kind of start is needed
// - return both flavors of starting pattern
// - attach $ at the end of the pattern when creating the actual RegExp
//
// Ah, but wait, no, that all only applies to the root when the first pattern
// is not an extglob. If the first pattern IS an extglob, then we need all
// that dot prevention biz to live in the extglob portions, because eg
// +(*|.x*) can match .xy but not .yx.
//
// So, return the two flavors if it's #root and the first child is not an
// AST, otherwise leave it to the child AST to handle it, and there,
// use the (?:^|/) style of start binding.
//
// Even simplified further:
// - Since the start for a join is eg /(?!\.) and the start for a part
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
// or start or whatever) and prepend ^ or / at the Regexp construction.
toRegExpSource(allowDot) {
var _a;
const dot = allowDot != null ? allowDot : !!__privateGet(this, _options).dot;
if (__privateGet(this, _root) === this)
__privateMethod(this, _AST_instances, fillNegs_fn).call(this);
if (!this.type) {
const noEmpty = this.isStart() && this.isEnd();
const src = __privateGet(this, _parts).map((p) => {
var _a2;
const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a2 = _AST, _AST_static, parseGlob_fn).call(_a2, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
__privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
return re;
}).join("");
let start2 = "";
if (this.isStart()) {
if (typeof __privateGet(this, _parts)[0] === "string") {
const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
if (!dotTravAllowed) {
const aps = addPatternStart;
const needNoTrav = (
// dots are allowed, and the pattern starts with [ or .
dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
src.startsWith("\\.\\.") && aps.has(src.charAt(4))
);
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
}
}
}
let end = "";
if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!") {
end = "(?:$|\\/)";
}
const final2 = start2 + src + end;
return [
final2,
unescape(src),
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
__privateGet(this, _uflag)
];
}
const repeated = this.type === "*" || this.type === "+";
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
const s = this.toString();
__privateSet(this, _parts, [s]);
this.type = null;
__privateSet(this, _hasMagic, void 0);
return [s, unescape(this.toString()), false, false];
}
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
if (bodyDotAllowed === body) {
bodyDotAllowed = "";
}
if (bodyDotAllowed) {
body = `(?:${body})(?:${bodyDotAllowed})*?`;
}
let final = "";
if (this.type === "!" && __privateGet(this, _emptyExt)) {
final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
} else {
const close = this.type === "!" ? (
// !() must match something,but !(x) can match ''
"))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
final = start + body + close;
}
return [
final,
unescape(body),
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
__privateGet(this, _uflag)
];
}
};
_root = new WeakMap();
_hasMagic = new WeakMap();
_uflag = new WeakMap();
_parts = new WeakMap();
_parent = new WeakMap();
_parentIndex = new WeakMap();
_negs = new WeakMap();
_filledNegs = new WeakMap();
_options = new WeakMap();
_toString = new WeakMap();
_emptyExt = new WeakMap();
_AST_instances = new WeakSet();
fillNegs_fn = function() {
if (this !== __privateGet(this, _root))
throw new Error("should only call on root");
if (__privateGet(this, _filledNegs))
return this;
this.toString();
__privateSet(this, _filledNegs, true);
let n;
while (n = __privateGet(this, _negs).pop()) {
if (n.type !== "!")
continue;
let p = n;
let pp = __privateGet(p, _parent);
while (pp) {
for (let i2 = __privateGet(p, _parentIndex) + 1; !pp.type && i2 < __privateGet(pp, _parts).length; i2++) {
for (const part of __privateGet(n, _parts)) {
if (typeof part === "string") {
throw new Error("string part in extglob AST??");
}
part.copyIn(__privateGet(pp, _parts)[i2]);
}
}
p = pp;
pp = __privateGet(p, _parent);
}
}
return this;
};
_AST_static = new WeakSet();
parseAST_fn = function(str, ast, pos, opt) {
var _a, _b;
let escaping = false;
let inBrace = false;
let braceStart = -1;
let braceNeg = false;
if (ast.type === null) {
let i3 = pos;
let acc2 = "";
while (i3 < str.length) {
const c = str.charAt(i3++);
if (escaping || c === "\\") {
escaping = !escaping;
acc2 += c;
continue;
}
if (inBrace) {
if (i3 === braceStart + 1) {
if (c === "^" || c === "!") {
braceNeg = true;
}
} else if (c === "]" && !(i3 === braceStart + 2 && braceNeg)) {
inBrace = false;
}
acc2 += c;
continue;
} else if (c === "[") {
inBrace = true;
braceStart = i3;
braceNeg = false;
acc2 += c;
continue;
}
if (!opt.noext && isExtglobType(c) && str.charAt(i3) === "(") {
ast.push(acc2);
acc2 = "";
const ext2 = new _AST(c, ast);
i3 = __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, str, ext2, i3, opt);
ast.push(ext2);
continue;
}
acc2 += c;
}
ast.push(acc2);
return i3;
}
let i2 = pos + 1;
let part = new _AST(null, ast);
const parts = [];
let acc = "";
while (i2 < str.length) {
const c = str.charAt(i2++);
if (escaping || c === "\\") {
escaping = !escaping;
acc += c;
continue;
}
if (inBrace) {
if (i2 === braceStart + 1) {
if (c === "^" || c === "!") {
braceNeg = true;
}
} else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
inBrace = false;
}
acc += c;
continue;
} else if (c === "[") {
inBrace = true;
braceStart = i2;
braceNeg = false;
acc += c;
continue;
}
if (isExtglobType(c) && str.charAt(i2) === "(") {
part.push(acc);
acc = "";
const ext2 = new _AST(c, part);
part.push(ext2);
i2 = __privateMethod(_b = _AST, _AST_static, parseAST_fn).call(_b, str, ext2, i2, opt);
continue;
}
if (c === "|") {
part.push(acc);
acc = "";
parts.push(part);
part = new _AST(null, ast);
continue;
}
if (c === ")") {
if (acc === "" && __privateGet(ast, _parts).length === 0) {
__privateSet(ast, _emptyExt, true);
}
part.push(acc);
acc = "";
ast.push(...parts, part);
return i2;
}
acc += c;
}
ast.type = null;
__privateSet(ast, _hasMagic, void 0);
__privateSet(ast, _parts, [str.substring(pos - 1)]);
return i2;
};
partsToRegExp_fn = function(dot) {
return __privateGet(this, _parts).map((p) => {
if (typeof p === "string") {
throw new Error("string type in extglob ast??");
}
const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
return re;
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
};
parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
let escaping = false;
let re = "";
let uflag = false;
for (let i2 = 0; i2 < glob.length; i2++) {
const c = glob.charAt(i2);
if (escaping) {
escaping = false;
re += (reSpecials.has(c) ? "\\" : "") + c;
continue;
}
if (c === "\\") {
if (i2 === glob.length - 1) {
re += "\\\\";
} else {
escaping = true;
}
continue;
}
if (c === "[") {
const [src, needUflag, consumed, magic] = parseClass(glob, i2);
if (consumed) {
re += src;
uflag = uflag || needUflag;
i2 += consumed - 1;
hasMagic = hasMagic || magic;
continue;
}
}
if (c === "*") {
if (noEmpty && glob === "*")
re += starNoEmpty;
else
re += star;
hasMagic = true;
continue;
}
if (c === "?") {
re += qmark;
hasMagic = true;
continue;
}
re += regExpEscape(c);
}
return [re, unescape(glob), !!hasMagic, uflag];
};
__privateAdd(_AST, _AST_static);
var AST = _AST;
// node_modules/minimatch/dist/esm/escape.js
var escape = (s, { windowsPathsNoEscape = false } = {}) => {
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
};
// node_modules/minimatch/dist/esm/index.js
var minimatch = (p, pattern, options = {}) => {
assertValidPattern(pattern);
if (!options.nocomment && pattern.charAt(0) === "#") {
return false;
}
return new Minimatch(pattern, options).match(p);
};
var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
var starDotExtTestNocase = (ext2) => {
ext2 = ext2.toLowerCase();
return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
};
var starDotExtTestNocaseDot = (ext2) => {
ext2 = ext2.toLowerCase();
return (f) => f.toLowerCase().endsWith(ext2);
};
var starDotStarRE = /^\*+\.\*+$/;
var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
var dotStarRE = /^\.\*+$/;
var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
var starRE = /^\*+$/;
var starTest = (f) => f.length !== 0 && !f.startsWith(".");
var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
var qmarksTestNocase = ([$0, ext2 = ""]) => {
const noext = qmarksTestNoExt([$0]);
if (!ext2)
return noext;
ext2 = ext2.toLowerCase();
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
};
var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
const noext = qmarksTestNoExtDot([$0]);
if (!ext2)
return noext;
ext2 = ext2.toLowerCase();
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
};
var qmarksTestDot = ([$0, ext2 = ""]) => {
const noext = qmarksTestNoExtDot([$0]);
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
};
var qmarksTest = ([$0, ext2 = ""]) => {
const noext = qmarksTestNoExt([$0]);
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
};
var qmarksTestNoExt = ([$0]) => {
const len = $0.length;
return (f) => f.length === len && !f.startsWith(".");
};
var qmarksTestNoExtDot = ([$0]) => {
const len = $0.length;
return (f) => f.length === len && f !== "." && f !== "..";
};
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
var path = {
win32: { sep: "\\" },
posix: { sep: "/" }
};
var sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
minimatch.sep = sep;
var GLOBSTAR = Symbol("globstar **");
minimatch.GLOBSTAR = GLOBSTAR;
var qmark2 = "[^/]";
var star2 = qmark2 + "*?";
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
minimatch.filter = filter;
var ext = (a, b = {}) => Object.assign({}, a, b);
var defaults = (def) => {
if (!def || typeof def !== "object" || !Object.keys(def).length) {
return minimatch;
}
const orig = minimatch;
const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
return Object.assign(m, {
Minimatch: class Minimatch extends orig.Minimatch {
constructor(pattern, options = {}) {
super(pattern, ext(def, options));
}
static defaults(options) {
return orig.defaults(ext(def, options)).Minimatch;
}
},
AST: class AST extends orig.AST {
/* c8 ignore start */
constructor(type, parent, options = {}) {
super(type, parent, ext(def, options));
}
/* c8 ignore stop */
static fromGlob(pattern, options = {}) {
return orig.AST.fromGlob(pattern, ext(def, options));
}
},
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
defaults: (options) => orig.defaults(ext(def, options)),
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
sep: orig.sep,
GLOBSTAR
});
};
minimatch.defaults = defaults;
var braceExpand = (pattern, options = {}) => {
assertValidPattern(pattern);
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
return [pattern];
}
return (0, import_brace_expansion.default)(pattern);
};
minimatch.braceExpand = braceExpand;
var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
minimatch.makeRe = makeRe;
var match = (list, pattern, options = {}) => {
const mm = new Minimatch(pattern, options);
list = list.filter((f) => mm.match(f));
if (mm.options.nonull && !list.length) {
list.push(pattern);
}
return list;
};
minimatch.match = match;
var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
var Minimatch = class {
options;
set;
pattern;
windowsPathsNoEscape;
nonegate;
negate;
comment;
empty;
preserveMultipleSlashes;
partial;
globSet;
globParts;
nocase;
isWindows;
platform;
windowsNoMagicRoot;
regexp;
constructor(pattern, options = {}) {
assertValidPattern(pattern);
options = options || {};
this.options = options;
this.pattern = pattern;
this.platform = options.platform || defaultPlatform;
this.isWindows = this.platform === "win32";
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
if (this.windowsPathsNoEscape) {
this.pattern = this.pattern.replace(/\\/g, "/");
}
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
this.regexp = null;
this.negate = false;
this.nonegate = !!options.nonegate;
this.comment = false;
this.empty = false;
this.partial = !!options.partial;
this.nocase = !!this.options.nocase;
this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
this.globSet = [];
this.globParts = [];
this.set = [];
this.make();
}
hasMagic() {
if (this.options.magicalBraces && this.set.length > 1) {
return true;
}
for (const pattern of this.set) {
for (const part of pattern) {
if (typeof part !== "string")
return true;
}
}
return false;
}
debug(..._) {
}
make() {
const pattern = this.pattern;
const options = this.options;
if (!options.nocomment && pattern.charAt(0) === "#") {
this.comment = true;
return;
}
if (!pattern) {
this.empty = true;
return;
}
this.parseNegate();
this.globSet = [...new Set(this.braceExpand())];
if (options.debug) {
this.debug = (...args) => console.error(...args);
}
this.debug(this.pattern, this.globSet);
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
this.globParts = this.preprocess(rawGlobParts);
this.debug(this.pattern, this.globParts);
let set = this.g