Created
July 19, 2025 23:50
-
-
Save ryon341/94267755c1b83a10e2c4413da9457ffc to your computer and use it in GitHub Desktop.
Batch upload via PowerShell script (Batch 34 of 51)
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
composes: ... from 'B' | |
* Rule | |
* composes: ... from 'A' | |
* composes: ... from 'A' | |
* composes: ... from 'C' | |
* | |
* Results in: | |
* | |
* graph: { | |
* G: [], | |
* A: [], | |
* B: ['A'], | |
* C: ['A'], | |
* } | |
*/ | |
function addImportToGraph(importId, parentId, graph, visited) { | |
const siblingsId = parentId + "_" + "siblings"; | |
const visitedId = parentId + "_" + importId; | |
if (visited[visitedId] !== VISITED_MARKER) { | |
if (!Array.isArray(visited[siblingsId])) { | |
visited[siblingsId] = []; | |
} | |
const siblings = visited[siblingsId]; | |
if (Array.isArray(graph[importId])) { | |
graph[importId] = graph[importId].concat(siblings); | |
} else { | |
graph[importId] = siblings.slice(); | |
} | |
visited[visitedId] = VISITED_MARKER; | |
siblings.push(importId); | |
} | |
} | |
src$3.exports = (options = {}) => { | |
let importIndex = 0; | |
const createImportedName = | |
typeof options.createImportedName !== "function" | |
? (importName /*, path*/) => | |
`i__imported_${importName.replace(/\W/g, "_")}_${importIndex++}` | |
: options.createImportedName; | |
const failOnWrongOrder = options.failOnWrongOrder; | |
return { | |
postcssPlugin: "postcss-modules-extract-imports", | |
prepare() { | |
const graph = {}; | |
const visited = {}; | |
const existingImports = {}; | |
const importDecls = {}; | |
const imports = {}; | |
return { | |
Once(root, postcss) { | |
// Check the existing imports order and save refs | |
root.walkRules((rule) => { | |
const matches = icssImport.exec(rule.selector); | |
if (matches) { | |
const [, /*match*/ doubleQuotePath, singleQuotePath] = matches; | |
const importPath = doubleQuotePath || singleQuotePath; | |
addImportToGraph(importPath, "root", graph, visited); | |
existingImports[importPath] = rule; | |
} | |
}); | |
root.walkDecls(/^composes$/, (declaration) => { | |
const multiple = declaration.value.split(","); | |
const values = []; | |
multiple.forEach((value) => { | |
const matches = value.trim().match(matchImports); | |
if (!matches) { | |
values.push(value); | |
return; | |
} | |
let tmpSymbols; | |
let [ | |
, | |
/*match*/ symbols, | |
doubleQuotePath, | |
singleQuotePath, | |
global, | |
] = matches; | |
if (global) { | |
// Composing globals simply means changing these classes to wrap them in global(name) | |
tmpSymbols = symbols.split(/\s+/).map((s) => `global(${s})`); | |
} else { | |
const importPath = doubleQuotePath || singleQuotePath; | |
let parent = declaration.parent; | |
let parentIndexes = ""; | |
while (parent.type !== "root") { | |
parentIndexes = | |
parent.parent.index(parent) + "_" + parentIndexes; | |
parent = parent.parent; | |
} | |
const { selector } = declaration.parent; | |
const parentRule = `_${parentIndexes}${selector}`; | |
addImportToGraph(importPath, parentRule, graph, visited); | |
importDecls[importPath] = declaration; | |
imports[importPath] = imports[importPath] || {}; | |
tmpSymbols = symbols.split(/\s+/).map((s) => { | |
if (!imports[importPath][s]) { | |
imports[importPath][s] = createImportedName(s, importPath); | |
} | |
return imports[importPath][s]; | |
}); | |
} | |
values.push(tmpSymbols.join(" ")); | |
}); | |
declaration.value = values.join(", "); | |
}); | |
const importsOrder = topologicalSort(graph, failOnWrongOrder); | |
if (importsOrder instanceof Error) { | |
const importPath = importsOrder.nodes.find((importPath) => | |
// eslint-disable-next-line no-prototype-builtins | |
importDecls.hasOwnProperty(importPath) | |
); | |
const decl = importDecls[importPath]; | |
throw decl.error( | |
"Failed to resolve order of composed modules " + | |
importsOrder.nodes | |
.map((importPath) => "`" + importPath + "`") | |
.join(", ") + | |
".", | |
{ | |
plugin: "postcss-modules-extract-imports", | |
word: "composes", | |
} | |
); | |
} | |
let lastImportRule; | |
importsOrder.forEach((path) => { | |
const importedSymbols = imports[path]; | |
let rule = existingImports[path]; | |
if (!rule && importedSymbols) { | |
rule = postcss.rule({ | |
selector: `:import("${path}")`, | |
raws: { after: "\n" }, | |
}); | |
if (lastImportRule) { | |
root.insertAfter(lastImportRule, rule); | |
} else { | |
root.prepend(rule); | |
} | |
} | |
lastImportRule = rule; | |
if (!importedSymbols) { | |
return; | |
} | |
Object.keys(importedSymbols).forEach((importedSymbol) => { | |
rule.append( | |
postcss.decl({ | |
value: importedSymbol, | |
prop: importedSymbols[importedSymbol], | |
raws: { before: "\n " }, | |
}) | |
); | |
}); | |
}); | |
}, | |
}; | |
}, | |
}; | |
}; | |
src$3.exports.postcss = true; | |
return src$3.exports; | |
} | |
var wasmHash = {exports: {}}; | |
/* | |
MIT License http://www.opensource.org/licenses/mit-license.php | |
Author Tobias Koppers @sokra | |
*/ | |
var hasRequiredWasmHash; | |
function requireWasmHash () { | |
if (hasRequiredWasmHash) return wasmHash.exports; | |
hasRequiredWasmHash = 1; | |
// 65536 is the size of a wasm memory page | |
// 64 is the maximum chunk size for every possible wasm hash implementation | |
// 4 is the maximum number of bytes per char for string encoding (max is utf-8) | |
// ~3 makes sure that it's always a block of 4 chars, so avoid partially encoded bytes for base64 | |
const MAX_SHORT_STRING = Math.floor((65536 - 64) / 4) & ~3; | |
class WasmHash { | |
/** | |
* @param {WebAssembly.Instance} instance wasm instance | |
* @param {WebAssembly.Instance[]} instancesPool pool of instances | |
* @param {number} chunkSize size of data chunks passed to wasm | |
* @param {number} digestSize size of digest returned by wasm | |
*/ | |
constructor(instance, instancesPool, chunkSize, digestSize) { | |
const exports = /** @type {any} */ (instance.exports); | |
exports.init(); | |
this.exports = exports; | |
this.mem = Buffer.from(exports.memory.buffer, 0, 65536); | |
this.buffered = 0; | |
this.instancesPool = instancesPool; | |
this.chunkSize = chunkSize; | |
this.digestSize = digestSize; | |
} | |
reset() { | |
this.buffered = 0; | |
this.exports.init(); | |
} | |
/** | |
* @param {Buffer | string} data data | |
* @param {BufferEncoding=} encoding encoding | |
* @returns {this} itself | |
*/ | |
update(data, encoding) { | |
if (typeof data === "string") { | |
while (data.length > MAX_SHORT_STRING) { | |
this._updateWithShortString(data.slice(0, MAX_SHORT_STRING), encoding); | |
data = data.slice(MAX_SHORT_STRING); | |
} | |
this._updateWithShortString(data, encoding); | |
return this; | |
} | |
this._updateWithBuffer(data); | |
return this; | |
} | |
/** | |
* @param {string} data data | |
* @param {BufferEncoding=} encoding encoding | |
* @returns {void} | |
*/ | |
_updateWithShortString(data, encoding) { | |
const { exports, buffered, mem, chunkSize } = this; | |
let endPos; | |
if (data.length < 70) { | |
if (!encoding || encoding === "utf-8" || encoding === "utf8") { | |
endPos = buffered; | |
for (let i = 0; i < data.length; i++) { | |
const cc = data.charCodeAt(i); | |
if (cc < 0x80) { | |
mem[endPos++] = cc; | |
} else if (cc < 0x800) { | |
mem[endPos] = (cc >> 6) | 0xc0; | |
mem[endPos + 1] = (cc & 0x3f) | 0x80; | |
endPos += 2; | |
} else { | |
// bail-out for weird chars | |
endPos += mem.write(data.slice(i), endPos, encoding); | |
break; | |
} | |
} | |
} else if (encoding === "latin1") { | |
endPos = buffered; | |
for (let i = 0; i < data.length; i++) { | |
const cc = data.charCodeAt(i); | |
mem[endPos++] = cc; | |
} | |
} else { | |
endPos = buffered + mem.write(data, buffered, encoding); | |
} | |
} else { | |
endPos = buffered + mem.write(data, buffered, encoding); | |
} | |
if (endPos < chunkSize) { | |
this.buffered = endPos; | |
} else { | |
const l = endPos & ~(this.chunkSize - 1); | |
exports.update(l); | |
const newBuffered = endPos - l; | |
this.buffered = newBuffered; | |
if (newBuffered > 0) { | |
mem.copyWithin(0, l, endPos); | |
} | |
} | |
} | |
/** | |
* @param {Buffer} data data | |
* @returns {void} | |
*/ | |
_updateWithBuffer(data) { | |
const { exports, buffered, mem } = this; | |
const length = data.length; | |
if (buffered + length < this.chunkSize) { | |
data.copy(mem, buffered, 0, length); | |
this.buffered += length; | |
} else { | |
const l = (buffered + length) & ~(this.chunkSize - 1); | |
if (l > 65536) { | |
let i = 65536 - buffered; | |
data.copy(mem, buffered, 0, i); | |
exports.update(65536); | |
const stop = l - buffered - 65536; | |
while (i < stop) { | |
data.copy(mem, 0, i, i + 65536); | |
exports.update(65536); | |
i += 65536; | |
} | |
data.copy(mem, 0, i, l - buffered); | |
exports.update(l - buffered - i); | |
} else { | |
data.copy(mem, buffered, 0, l - buffered); | |
exports.update(l); | |
} | |
const newBuffered = length + buffered - l; | |
this.buffered = newBuffered; | |
if (newBuffered > 0) { | |
data.copy(mem, 0, length - newBuffered, length); | |
} | |
} | |
} | |
digest(type) { | |
const { exports, buffered, mem, digestSize } = this; | |
exports.final(buffered); | |
this.instancesPool.push(this); | |
const hex = mem.toString("latin1", 0, digestSize); | |
if (type === "hex") { | |
return hex; | |
} | |
if (type === "binary" || !type) { | |
return Buffer.from(hex, "hex"); | |
} | |
return Buffer.from(hex, "hex").toString(type); | |
} | |
} | |
const create = (wasmModule, instancesPool, chunkSize, digestSize) => { | |
if (instancesPool.length > 0) { | |
const old = instancesPool.pop(); | |
old.reset(); | |
return old; | |
} else { | |
return new WasmHash( | |
new WebAssembly.Instance(wasmModule), | |
instancesPool, | |
chunkSize, | |
digestSize | |
); | |
} | |
}; | |
wasmHash.exports = create; | |
wasmHash.exports.MAX_SHORT_STRING = MAX_SHORT_STRING; | |
return wasmHash.exports; | |
} | |
/* | |
MIT License http://www.opensource.org/licenses/mit-license.php | |
Author Tobias Koppers @sokra | |
*/ | |
var xxhash64_1; | |
var hasRequiredXxhash64; | |
function requireXxhash64 () { | |
if (hasRequiredXxhash64) return xxhash64_1; | |
hasRequiredXxhash64 = 1; | |
const create = /*@__PURE__*/ requireWasmHash(); | |
//#region wasm code: xxhash64 (../../../assembly/hash/xxhash64.asm.ts) --initialMemory 1 | |
const xxhash64 = new WebAssembly.Module( | |
Buffer.from( | |
// 1173 bytes | |
"AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrUIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAAgAUEgaiIBSw0ACyACJAAgAyQBIAQkAiAFJAMLqwYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEACfyACIAE1AgBCh5Wvr5i23puef36FQheJQs/W077Sx6vZQn5C+fPd8Zn2masWfCECIAFBBGoLIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAiACQh2IhUL5893xmfaZqxZ+IgIgAkIgiIUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL", | |
"base64" | |
) | |
); | |
//#endregion | |
xxhash64_1 = create.bind(null, xxhash64, [], 32, 16); | |
return xxhash64_1; | |
} | |
var BatchedHash_1; | |
var hasRequiredBatchedHash; | |
function requireBatchedHash () { | |
if (hasRequiredBatchedHash) return BatchedHash_1; | |
hasRequiredBatchedHash = 1; | |
const MAX_SHORT_STRING = /*@__PURE__*/ requireWasmHash().MAX_SHORT_STRING; | |
class BatchedHash { | |
constructor(hash) { | |
this.string = undefined; | |
this.encoding = undefined; | |
this.hash = hash; | |
} | |
/** | |
* Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | |
* @param {string|Buffer} data data | |
* @param {string=} inputEncoding data encoding | |
* @returns {this} updated hash | |
*/ | |
update(data, inputEncoding) { | |
if (this.string !== undefined) { | |
if ( | |
typeof data === "string" && | |
inputEncoding === this.encoding && | |
this.string.length + data.length < MAX_SHORT_STRING | |
) { | |
this.string += data; | |
return this; | |
} | |
this.hash.update(this.string, this.encoding); | |
this.string = undefined; | |
} | |
if (typeof data === "string") { | |
if ( | |
data.length < MAX_SHORT_STRING && | |
// base64 encoding is not valid since it may contain padding chars | |
(!inputEncoding || !inputEncoding.startsWith("ba")) | |
) { | |
this.string = data; | |
this.encoding = inputEncoding; | |
} else { | |
this.hash.update(data, inputEncoding); | |
} | |
} else { | |
this.hash.update(data); | |
} | |
return this; | |
} | |
/** | |
* Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | |
* @param {string=} encoding encoding of the return value | |
* @returns {string|Buffer} digest | |
*/ | |
digest(encoding) { | |
if (this.string !== undefined) { | |
this.hash.update(this.string, this.encoding); | |
} | |
return this.hash.digest(encoding); | |
} | |
} | |
BatchedHash_1 = BatchedHash; | |
return BatchedHash_1; | |
} | |
/* | |
MIT License http://www.opensource.org/licenses/mit-license.php | |
Author Tobias Koppers @sokra | |
*/ | |
var md4_1; | |
var hasRequiredMd4; | |
function requireMd4 () { | |
if (hasRequiredMd4) return md4_1; | |
hasRequiredMd4 = 1; | |
const create = /*@__PURE__*/ requireWasmHash(); | |
//#region wasm code: md4 (../../../assembly/hash/md4.asm.ts) --initialMemory 1 | |
const md4 = new WebAssembly.Module( | |
Buffer.from( | |
// 2150 bytes | |
"AGFzbQEAAAABCAJgAX8AYAAAAwUEAQAAAAUDAQABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwciBARpbml0AAAGdXBkYXRlAAIFZmluYWwAAwZtZW1vcnkCAAqFEAQmAEGBxpS6BiQBQYnXtv5+JAJB/rnrxXkkA0H2qMmBASQEQQAkAAvMCgEYfyMBIQojAiEGIwMhByMEIQgDQCAAIAVLBEAgBSgCCCINIAcgBiAFKAIEIgsgCCAHIAUoAgAiDCAKIAggBiAHIAhzcXNqakEDdyIDIAYgB3Nxc2pqQQd3IgEgAyAGc3FzampBC3chAiAFKAIUIg8gASACIAUoAhAiCSADIAEgBSgCDCIOIAYgAyACIAEgA3Nxc2pqQRN3IgQgASACc3FzampBA3ciAyACIARzcXNqakEHdyEBIAUoAiAiEiADIAEgBSgCHCIRIAQgAyAFKAIYIhAgAiAEIAEgAyAEc3FzampBC3ciAiABIANzcXNqakETdyIEIAEgAnNxc2pqQQN3IQMgBSgCLCIVIAQgAyAFKAIoIhQgAiAEIAUoAiQiEyABIAIgAyACIARzcXNqakEHdyIBIAMgBHNxc2pqQQt3IgIgASADc3FzampBE3chBCAPIBAgCSAVIBQgEyAFKAI4IhYgAiAEIAUoAjQiFyABIAIgBSgCMCIYIAMgASAEIAEgAnNxc2pqQQN3IgEgAiAEc3FzampBB3ciAiABIARzcXNqakELdyIDIAkgAiAMIAEgBSgCPCIJIAQgASADIAEgAnNxc2pqQRN3IgEgAiADcnEgAiADcXJqakGZ84nUBWpBA3ciAiABIANycSABIANxcmpqQZnzidQFakEFdyIEIAEgAnJxIAEgAnFyaiASakGZ84nUBWpBCXciAyAPIAQgCyACIBggASADIAIgBHJxIAIgBHFyampBmfOJ1AVqQQ13IgEgAyAEcnEgAyAEcXJqakGZ84nUBWpBA3ciAiABIANycSABIANxcmpqQZnzidQFakEFdyIEIAEgAnJxIAEgAnFyampBmfOJ1AVqQQl3IgMgECAEIAIgFyABIAMgAiAEcnEgAiAEcXJqakGZ84nUBWpBDXciASADIARycSADIARxcmogDWpBmfOJ1AVqQQN3IgIgASADcnEgASADcXJqakGZ84nUBWpBBXciBCABIAJycSABIAJxcmpqQZnzidQFakEJdyIDIBEgBCAOIAIgFiABIAMgAiAEcnEgAiAEcXJqakGZ84nUBWpBDXciASADIARycSADIARxcmpqQZnzidQFakEDdyICIAEgA3JxIAEgA3FyampBmfOJ1AVqQQV3IgQgASACcnEgASACcXJqakGZ84nUBWpBCXciAyAMIAIgAyAJIAEgAyACIARycSACIARxcmpqQZnzidQFakENdyIBcyAEc2pqQaHX5/YGakEDdyICIAQgASACcyADc2ogEmpBodfn9gZqQQl3IgRzIAFzampBodfn9gZqQQt3IgMgAiADIBggASADIARzIAJzampBodfn9gZqQQ93IgFzIARzaiANakGh1+f2BmpBA3ciAiAUIAQgASACcyADc2pqQaHX5/YGakEJdyIEcyABc2pqQaHX5/YGakELdyIDIAsgAiADIBYgASADIARzIAJzampBodfn9gZqQQ93IgFzIARzampBodfn9gZqQQN3IgIgEyAEIAEgAnMgA3NqakGh1+f2BmpBCXciBHMgAXNqakGh1+f2BmpBC3chAyAKIA4gAiADIBcgASADIARzIAJzampBodfn9gZqQQ93IgFzIARzampBodfn9gZqQQN3IgJqIQogBiAJIAEgESADIAIgFSAEIAEgAnMgA3NqakGh1+f2BmpBCXciBHMgAXNqakGh1+f2BmpBC3ciAyAEcyACc2pqQaHX5/YGakEPd2ohBiADIAdqIQcgBCAIaiEIIAVBQGshBQwBCwsgCiQBIAYkAiAHJAMgCCQECw0AIAAQASMAIABqJAAL/wQCA38BfiMAIABqrUIDhiEEIABByABqQUBxIgJBCGshAyAAIgFBAWohACABQYABOgAAA0AgACACSUEAIABBB3EbBEAgAEEAOgAAIABBAWohAAwBCwsDQCAAIAJJBEAgAEIANwMAIABBCGohAAwBCwsgAyAENwMAIAIQAUEAIwGtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEIIwKtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEQIwOtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEYIwStIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAAs=", | |
"base64" | |
) | |
); | |
//#endregion | |
md4_1 = create.bind(null, md4, [], 64, 32); | |
return md4_1; | |
} | |
var BulkUpdateDecorator_1; | |
var hasRequiredBulkUpdateDecorator; | |
function requireBulkUpdateDecorator () { | |
if (hasRequiredBulkUpdateDecorator) return BulkUpdateDecorator_1; | |
hasRequiredBulkUpdateDecorator = 1; | |
const BULK_SIZE = 2000; | |
// We are using an object instead of a Map as this will stay static during the runtime | |
// so access to it can be optimized by v8 | |
const digestCaches = {}; | |
class BulkUpdateDecorator { | |
/** | |
* @param {Hash | function(): Hash} hashOrFactory function to create a hash | |
* @param {string=} hashKey key for caching | |
*/ | |
constructor(hashOrFactory, hashKey) { | |
this.hashKey = hashKey; | |
if (typeof hashOrFactory === "function") { | |
this.hashFactory = hashOrFactory; | |
this.hash = undefined; | |
} else { | |
this.hashFactory = undefined; | |
this.hash = hashOrFactory; | |
} | |
this.buffer = ""; | |
} | |
/** | |
* Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} | |
* @param {string|Buffer} data data | |
* @param {string=} inputEncoding data encoding | |
* @returns {this} updated hash | |
*/ | |
update(data, inputEncoding) { | |
if ( | |
inputEncoding !== undefined || | |
typeof data !== "string" || | |
data.length > BULK_SIZE | |
) { | |
if (this.hash === undefined) { | |
this.hash = this.hashFactory(); | |
} | |
if (this.buffer.length > 0) { | |
this.hash.update(this.buffer); | |
this.buffer = ""; | |
} | |
this.hash.update(data, inputEncoding); | |
} else { | |
this.buffer += data; | |
if (this.buffer.length > BULK_SIZE) { | |
if (this.hash === undefined) { | |
this.hash = this.hashFactory(); | |
} | |
this.hash.update(this.buffer); | |
this.buffer = ""; | |
} | |
} | |
return this; | |
} | |
/** | |
* Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} | |
* @param {string=} encoding encoding of the return value | |
* @returns {string|Buffer} digest | |
*/ | |
digest(encoding) { | |
let digestCache; | |
const buffer = this.buffer; | |
if (this.hash === undefined) { | |
// short data for hash, we can use caching | |
const cacheKey = `${this.hashKey}-${encoding}`; | |
digestCache = digestCaches[cacheKey]; | |
if (digestCache === undefined) { | |
digestCache = digestCaches[cacheKey] = new Map(); | |
} | |
const cacheEntry = digestCache.get(buffer); | |
if (cacheEntry !== undefined) { | |
return cacheEntry; | |
} | |
this.hash = this.hashFactory(); | |
} | |
if (buffer.length > 0) { | |
this.hash.update(buffer); | |
} | |
const digestResult = this.hash.digest(encoding); | |
if (digestCache !== undefined) { | |
digestCache.set(buffer, digestResult); | |
} | |
return digestResult; | |
} | |
} | |
BulkUpdateDecorator_1 = BulkUpdateDecorator; | |
return BulkUpdateDecorator_1; | |
} | |
var getHashDigest_1; | |
var hasRequiredGetHashDigest; | |
function requireGetHashDigest () { | |
if (hasRequiredGetHashDigest) return getHashDigest_1; | |
hasRequiredGetHashDigest = 1; | |
const baseEncodeTables = { | |
26: "abcdefghijklmnopqrstuvwxyz", | |
32: "123456789abcdefghjkmnpqrstuvwxyz", // no 0lio | |
36: "0123456789abcdefghijklmnopqrstuvwxyz", | |
49: "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ", // no lIO | |
52: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", | |
58: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ", // no 0lIO | |
62: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", | |
64: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_", | |
}; | |
/** | |
* @param {Uint32Array} uint32Array Treated as a long base-0x100000000 number, little endian | |
* @param {number} divisor The divisor | |
* @return {number} Modulo (remainder) of the division | |
*/ | |
function divmod32(uint32Array, divisor) { | |
let carry = 0; | |
for (let i = uint32Array.length - 1; i >= 0; i--) { | |
const value = carry * 0x100000000 + uint32Array[i]; | |
carry = value % divisor; | |
uint32Array[i] = Math.floor(value / divisor); | |
} | |
return carry; | |
} | |
function encodeBufferToBase(buffer, base, length) { | |
const encodeTable = baseEncodeTables[base]; | |
if (!encodeTable) { | |
throw new Error("Unknown encoding base" + base); | |
} | |
// Input bits are only enough to generate this many characters | |
const limit = Math.ceil((buffer.length * 8) / Math.log2(base)); | |
length = Math.min(length, limit); | |
// Most of the crypto digests (if not all) has length a multiple of 4 bytes. | |
// Fewer numbers in the array means faster math. | |
const uint32Array = new Uint32Array(Math.ceil(buffer.length / 4)); | |
// Make sure the input buffer data is copied and is not mutated by reference. | |
// divmod32() would corrupt the BulkUpdateDecorator cache otherwise. | |
buffer.copy(Buffer.from(uint32Array.buffer)); | |
let output = ""; | |
for (let i = 0; i < length; i++) { | |
output = encodeTable[divmod32(uint32Array, base)] + output; | |
} | |
return output; | |
} | |
let crypto = undefined; | |
let createXXHash64 = undefined; | |
let createMd4 = undefined; | |
let BatchedHash = undefined; | |
let BulkUpdateDecorator = undefined; | |
function getHashDigest(buffer, algorithm, digestType, maxLength) { | |
algorithm = algorithm || "xxhash64"; | |
maxLength = maxLength || 9999; | |
let hash; | |
if (algorithm === "xxhash64") { | |
if (createXXHash64 === undefined) { | |
createXXHash64 = /*@__PURE__*/ requireXxhash64(); | |
if (BatchedHash === undefined) { | |
BatchedHash = /*@__PURE__*/ requireBatchedHash(); | |
} | |
} | |
hash = new BatchedHash(createXXHash64()); | |
} else if (algorithm === "md4") { | |
if (createMd4 === undefined) { | |
createMd4 = /*@__PURE__*/ requireMd4(); | |
if (BatchedHash === undefined) { | |
BatchedHash = /*@__PURE__*/ requireBatchedHash(); | |
} | |
} | |
hash = new BatchedHash(createMd4()); | |
} else if (algorithm === "native-md4") { | |
if (typeof crypto === "undefined") { | |
crypto = require("crypto"); | |
if (BulkUpdateDecorator === undefined) { | |
BulkUpdateDecorator = /*@__PURE__*/ requireBulkUpdateDecorator(); | |
} | |
} | |
hash = new BulkUpdateDecorator(() => crypto.createHash("md4"), "md4"); | |
} else { | |
if (typeof crypto === "undefined") { | |
crypto = require("crypto"); | |
if (BulkUpdateDecorator === undefined) { | |
BulkUpdateDecorator = /*@__PURE__*/ requireBulkUpdateDecorator(); | |
} | |
} | |
hash = new BulkUpdateDecorator( | |
() => crypto.createHash(algorithm), | |
algorithm | |
); | |
} | |
hash.update(buffer); | |
if ( | |
digestType === "base26" || | |
digestType === "base32" || | |
digestType === "base36" || | |
digestType === "base49" || | |
digestType === "base52" || | |
digestType === "base58" || | |
digestType === "base62" || | |
digestType === "base64safe" | |
) { | |
return encodeBufferToBase( | |
hash.digest(), | |
digestType === "base64safe" ? 64 : digestType.substr(4), | |
maxLength | |
); | |
} | |
return hash.digest(digestType || "hex").substr(0, maxLength); | |
} | |
getHashDigest_1 = getHashDigest; | |
return getHashDigest_1; | |
} | |
var interpolateName_1; | |
var hasRequiredInterpolateName; | |
function requireInterpolateName () { | |
if (hasRequiredInterpolateName) return interpolateName_1; | |
hasRequiredInterpolateName = 1; | |
const path = path$1; | |
const getHashDigest = /*@__PURE__*/ requireGetHashDigest(); | |
function interpolateName(loaderContext, name, options = {}) { | |
let filename; | |
const hasQuery = | |
loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1; | |
if (typeof name === "function") { | |
filename = name( | |
loaderContext.resourcePath, | |
hasQuery ? loaderContext.resourceQuery : undefined | |
); | |
} else { | |
filename = name || "[hash].[ext]"; | |
} | |
const context = options.context; | |
const content = options.content; | |
const regExp = options.regExp; | |
let ext = "bin"; | |
let basename = "file"; | |
let directory = ""; | |
let folder = ""; | |
let query = ""; | |
if (loaderContext.resourcePath) { | |
const parsed = path.parse(loaderContext.resourcePath); | |
let resourcePath = loaderContext.resourcePath; | |
if (parsed.ext) { | |
ext = parsed.ext.substr(1); | |
} | |
if (parsed.dir) { | |
basename = parsed.name; | |
resourcePath = parsed.dir + path.sep; | |
} | |
if (typeof context !== "undefined") { | |
directory = path | |
.relative(context, resourcePath + "_") | |
.replace(/\\/g, "/") | |
.replace(/\.\.(\/)?/g, "_$1"); | |
directory = directory.substr(0, directory.length - 1); | |
} else { | |
directory = resourcePath.replace(/\\/g, "/").replace(/\.\.(\/)?/g, "_$1"); | |
} | |
if (directory.length <= 1) { | |
directory = ""; | |
} else { | |
// directory.length > 1 | |
folder = path.basename(directory); | |
} | |
} | |
if (loaderContext.resourceQuery && loaderContext.resourceQuery.length > 1) { | |
query = loaderContext.resourceQuery; | |
const hashIdx = query.indexOf("#"); | |
if (hashIdx >= 0) { | |
query = query.substr(0, hashIdx); | |
} | |
} | |
let url = filename; | |
if (content) { | |
// Match hash template | |
url = url | |
// `hash` and `contenthash` are same in `loader-utils` context | |
// let's keep `hash` for backward compatibility | |
.replace( | |
/\[(?:([^[:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*(?:safe)?))?(?::(\d+))?\]/gi, | |
(all, hashType, digestType, maxLength) => | |
getHashDigest(content, hashType, digestType, parseInt(maxLength, 10)) | |
); | |
} | |
url = url | |
.replace(/\[ext\]/gi, () => ext) | |
.replace(/\[name\]/gi, () => basename) | |
.replace(/\[path\]/gi, () => directory) | |
.replace(/\[folder\]/gi, () => folder) | |
.replace(/\[query\]/gi, () => query); | |
if (regExp && loaderContext.resourcePath) { | |
const match = loaderContext.resourcePath.match(new RegExp(regExp)); | |
match && | |
match.forEach((matched, i) => { | |
url = url.replace(new RegExp("\\[" + i + "\\]", "ig"), matched); | |
}); | |
} | |
if ( | |
typeof loaderContext.options === "object" && | |
typeof loaderContext.options.customInterpolateName === "function" | |
) { | |
url = loaderContext.options.customInterpolateName.call( | |
loaderContext, | |
url, | |
name, | |
options | |
); | |
} | |
return url; | |
} | |
interpolateName_1 = interpolateName; | |
return interpolateName_1; | |
} | |
var genericNames; | |
var hasRequiredGenericNames; | |
function requireGenericNames () { | |
if (hasRequiredGenericNames) return genericNames; | |
hasRequiredGenericNames = 1; | |
var interpolateName = /*@__PURE__*/ requireInterpolateName(); | |
var path = path$1; | |
/** | |
* @param {string} pattern | |
* @param {object} options | |
* @param {string} options.context | |
* @param {string} options.hashPrefix | |
* @return {function} | |
*/ | |
genericNames = function createGenerator(pattern, options) { | |
options = options || {}; | |
var context = | |
options && typeof options.context === "string" | |
? options.context | |
: process.cwd(); | |
var hashPrefix = | |
options && typeof options.hashPrefix === "string" ? options.hashPrefix : ""; | |
/** | |
* @param {string} localName Usually a class name | |
* @param {string} filepath Absolute path | |
* @return {string} | |
*/ | |
return function generate(localName, filepath) { | |
var name = pattern.replace(/\[local\]/gi, localName); | |
var loaderContext = { | |
resourcePath: filepath, | |
}; | |
var loaderOptions = { | |
content: | |
hashPrefix + | |
path.relative(context, filepath).replace(/\\/g, "/") + | |
"\x00" + | |
localName, | |
context: context, | |
}; | |
var genericName = interpolateName(loaderContext, name, loaderOptions); | |
return genericName | |
.replace(new RegExp("[^a-zA-Z0-9\\-_\u00A0-\uFFFF]", "g"), "-") | |
.replace(/^((-?[0-9])|--)/, "_$1"); | |
}; | |
}; | |
return genericNames; | |
} | |
var src$2 = {exports: {}}; | |
var dist = {exports: {}}; | |
var processor = {exports: {}}; | |
var parser = {exports: {}}; | |
var root = {exports: {}}; | |
var container = {exports: {}}; | |
var node = {exports: {}}; | |
var util = {}; | |
var unesc = {exports: {}}; | |
var hasRequiredUnesc; | |
function requireUnesc () { | |
if (hasRequiredUnesc) return unesc.exports; | |
hasRequiredUnesc = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = unesc; | |
// Many thanks for this post which made this migration much easier. | |
// https://mathiasbynens.be/notes/css-escapes | |
/** | |
* | |
* @param {string} str | |
* @returns {[string, number]|undefined} | |
*/ | |
function gobbleHex(str) { | |
var lower = str.toLowerCase(); | |
var hex = ''; | |
var spaceTerminated = false; | |
for (var i = 0; i < 6 && lower[i] !== undefined; i++) { | |
var code = lower.charCodeAt(i); | |
// check to see if we are dealing with a valid hex char [a-f|0-9] | |
var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57; | |
// https://drafts.csswg.org/css-syntax/#consume-escaped-code-point | |
spaceTerminated = code === 32; | |
if (!valid) { | |
break; | |
} | |
hex += lower[i]; | |
} | |
if (hex.length === 0) { | |
return undefined; | |
} | |
var codePoint = parseInt(hex, 16); | |
var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF; | |
// Add special case for | |
// "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point" | |
// https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point | |
if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) { | |
return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)]; | |
} | |
return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)]; | |
} | |
var CONTAINS_ESCAPE = /\\/; | |
function unesc(str) { | |
var needToProcess = CONTAINS_ESCAPE.test(str); | |
if (!needToProcess) { | |
return str; | |
} | |
var ret = ""; | |
for (var i = 0; i < str.length; i++) { | |
if (str[i] === "\\") { | |
var gobbled = gobbleHex(str.slice(i + 1, i + 7)); | |
if (gobbled !== undefined) { | |
ret += gobbled[0]; | |
i += gobbled[1]; | |
continue; | |
} | |
// Retain a pair of \\ if double escaped `\\\\` | |
// https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e | |
if (str[i + 1] === "\\") { | |
ret += "\\"; | |
i++; | |
continue; | |
} | |
// if \\ is at the end of the string retain it | |
// https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb | |
if (str.length === i + 1) { | |
ret += str[i]; | |
} | |
continue; | |
} | |
ret += str[i]; | |
} | |
return ret; | |
} | |
module.exports = exports.default; | |
} (unesc, unesc.exports)); | |
return unesc.exports; | |
} | |
var getProp = {exports: {}}; | |
var hasRequiredGetProp; | |
function requireGetProp () { | |
if (hasRequiredGetProp) return getProp.exports; | |
hasRequiredGetProp = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = getProp; | |
function getProp(obj) { | |
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | |
props[_key - 1] = arguments[_key]; | |
} | |
while (props.length > 0) { | |
var prop = props.shift(); | |
if (!obj[prop]) { | |
return undefined; | |
} | |
obj = obj[prop]; | |
} | |
return obj; | |
} | |
module.exports = exports.default; | |
} (getProp, getProp.exports)); | |
return getProp.exports; | |
} | |
var ensureObject = {exports: {}}; | |
var hasRequiredEnsureObject; | |
function requireEnsureObject () { | |
if (hasRequiredEnsureObject) return ensureObject.exports; | |
hasRequiredEnsureObject = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = ensureObject; | |
function ensureObject(obj) { | |
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | |
props[_key - 1] = arguments[_key]; | |
} | |
while (props.length > 0) { | |
var prop = props.shift(); | |
if (!obj[prop]) { | |
obj[prop] = {}; | |
} | |
obj = obj[prop]; | |
} | |
} | |
module.exports = exports.default; | |
} (ensureObject, ensureObject.exports)); | |
return ensureObject.exports; | |
} | |
var stripComments = {exports: {}}; | |
var hasRequiredStripComments; | |
function requireStripComments () { | |
if (hasRequiredStripComments) return stripComments.exports; | |
hasRequiredStripComments = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = stripComments; | |
function stripComments(str) { | |
var s = ""; | |
var commentStart = str.indexOf("/*"); | |
var lastEnd = 0; | |
while (commentStart >= 0) { | |
s = s + str.slice(lastEnd, commentStart); | |
var commentEnd = str.indexOf("*/", commentStart + 2); | |
if (commentEnd < 0) { | |
return s; | |
} | |
lastEnd = commentEnd + 2; | |
commentStart = str.indexOf("/*", lastEnd); | |
} | |
s = s + str.slice(lastEnd); | |
return s; | |
} | |
module.exports = exports.default; | |
} (stripComments, stripComments.exports)); | |
return stripComments.exports; | |
} | |
var hasRequiredUtil; | |
function requireUtil () { | |
if (hasRequiredUtil) return util; | |
hasRequiredUtil = 1; | |
util.__esModule = true; | |
util.unesc = util.stripComments = util.getProp = util.ensureObject = void 0; | |
var _unesc = _interopRequireDefault(/*@__PURE__*/ requireUnesc()); | |
util.unesc = _unesc["default"]; | |
var _getProp = _interopRequireDefault(/*@__PURE__*/ requireGetProp()); | |
util.getProp = _getProp["default"]; | |
var _ensureObject = _interopRequireDefault(/*@__PURE__*/ requireEnsureObject()); | |
util.ensureObject = _ensureObject["default"]; | |
var _stripComments = _interopRequireDefault(/*@__PURE__*/ requireStripComments()); | |
util.stripComments = _stripComments["default"]; | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
return util; | |
} | |
var hasRequiredNode; | |
function requireNode () { | |
if (hasRequiredNode) return node.exports; | |
hasRequiredNode = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _util = /*@__PURE__*/ requireUtil(); | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
var cloneNode = function cloneNode(obj, parent) { | |
if (typeof obj !== 'object' || obj === null) { | |
return obj; | |
} | |
var cloned = new obj.constructor(); | |
for (var i in obj) { | |
if (!obj.hasOwnProperty(i)) { | |
continue; | |
} | |
var value = obj[i]; | |
var type = typeof value; | |
if (i === 'parent' && type === 'object') { | |
if (parent) { | |
cloned[i] = parent; | |
} | |
} else if (value instanceof Array) { | |
cloned[i] = value.map(function (j) { | |
return cloneNode(j, cloned); | |
}); | |
} else { | |
cloned[i] = cloneNode(value, cloned); | |
} | |
} | |
return cloned; | |
}; | |
var Node = /*#__PURE__*/function () { | |
function Node(opts) { | |
if (opts === void 0) { | |
opts = {}; | |
} | |
Object.assign(this, opts); | |
this.spaces = this.spaces || {}; | |
this.spaces.before = this.spaces.before || ''; | |
this.spaces.after = this.spaces.after || ''; | |
} | |
var _proto = Node.prototype; | |
_proto.remove = function remove() { | |
if (this.parent) { | |
this.parent.removeChild(this); | |
} | |
this.parent = undefined; | |
return this; | |
}; | |
_proto.replaceWith = function replaceWith() { | |
if (this.parent) { | |
for (var index in arguments) { | |
this.parent.insertBefore(this, arguments[index]); | |
} | |
this.remove(); | |
} | |
return this; | |
}; | |
_proto.next = function next() { | |
return this.parent.at(this.parent.index(this) + 1); | |
}; | |
_proto.prev = function prev() { | |
return this.parent.at(this.parent.index(this) - 1); | |
}; | |
_proto.clone = function clone(overrides) { | |
if (overrides === void 0) { | |
overrides = {}; | |
} | |
var cloned = cloneNode(this); | |
for (var name in overrides) { | |
cloned[name] = overrides[name]; | |
} | |
return cloned; | |
} | |
/** | |
* Some non-standard syntax doesn't follow normal escaping rules for css. | |
* This allows non standard syntax to be appended to an existing property | |
* by specifying the escaped value. By specifying the escaped value, | |
* illegal characters are allowed to be directly inserted into css output. | |
* @param {string} name the property to set | |
* @param {any} value the unescaped value of the property | |
* @param {string} valueEscaped optional. the escaped value of the property. | |
*/; | |
_proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) { | |
if (!this.raws) { | |
this.raws = {}; | |
} | |
var originalValue = this[name]; | |
var originalEscaped = this.raws[name]; | |
this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first. | |
if (originalEscaped || valueEscaped !== value) { | |
this.raws[name] = (originalEscaped || originalValue) + valueEscaped; | |
} else { | |
delete this.raws[name]; // delete any escaped value that was created by the setter. | |
} | |
} | |
/** | |
* Some non-standard syntax doesn't follow normal escaping rules for css. | |
* This allows the escaped value to be specified directly, allowing illegal | |
* characters to be directly inserted into css output. | |
* @param {string} name the property to set | |
* @param {any} value the unescaped value of the property | |
* @param {string} valueEscaped the escaped value of the property. | |
*/; | |
_proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) { | |
if (!this.raws) { | |
this.raws = {}; | |
} | |
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first. | |
this.raws[name] = valueEscaped; | |
} | |
/** | |
* When you want a value to passed through to CSS directly. This method | |
* deletes the corresponding raw value causing the stringifier to fallback | |
* to the unescaped value. | |
* @param {string} name the property to set. | |
* @param {any} value The value that is both escaped and unescaped. | |
*/; | |
_proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) { | |
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first. | |
if (this.raws) { | |
delete this.raws[name]; | |
} | |
} | |
/** | |
* | |
* @param {number} line The number (starting with 1) | |
* @param {number} column The column number (starting with 1) | |
*/; | |
_proto.isAtPosition = function isAtPosition(line, column) { | |
if (this.source && this.source.start && this.source.end) { | |
if (this.source.start.line > line) { | |
return false; | |
} | |
if (this.source.end.line < line) { | |
return false; | |
} | |
if (this.source.start.line === line && this.source.start.column > column) { | |
return false; | |
} | |
if (this.source.end.line === line && this.source.end.column < column) { | |
return false; | |
} | |
return true; | |
} | |
return undefined; | |
}; | |
_proto.stringifyProperty = function stringifyProperty(name) { | |
return this.raws && this.raws[name] || this[name]; | |
}; | |
_proto.valueToString = function valueToString() { | |
return String(this.stringifyProperty("value")); | |
}; | |
_proto.toString = function toString() { | |
return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join(''); | |
}; | |
_createClass(Node, [{ | |
key: "rawSpaceBefore", | |
get: function get() { | |
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before; | |
if (rawSpace === undefined) { | |
rawSpace = this.spaces && this.spaces.before; | |
} | |
return rawSpace || ""; | |
}, | |
set: function set(raw) { | |
(0, _util.ensureObject)(this, "raws", "spaces"); | |
this.raws.spaces.before = raw; | |
} | |
}, { | |
key: "rawSpaceAfter", | |
get: function get() { | |
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after; | |
if (rawSpace === undefined) { | |
rawSpace = this.spaces.after; | |
} | |
return rawSpace || ""; | |
}, | |
set: function set(raw) { | |
(0, _util.ensureObject)(this, "raws", "spaces"); | |
this.raws.spaces.after = raw; | |
} | |
}]); | |
return Node; | |
}(); | |
exports["default"] = Node; | |
module.exports = exports.default; | |
} (node, node.exports)); | |
return node.exports; | |
} | |
var types$1 = {}; | |
var hasRequiredTypes; | |
function requireTypes () { | |
if (hasRequiredTypes) return types$1; | |
hasRequiredTypes = 1; | |
types$1.__esModule = true; | |
types$1.UNIVERSAL = types$1.TAG = types$1.STRING = types$1.SELECTOR = types$1.ROOT = types$1.PSEUDO = types$1.NESTING = types$1.ID = types$1.COMMENT = types$1.COMBINATOR = types$1.CLASS = types$1.ATTRIBUTE = void 0; | |
var TAG = 'tag'; | |
types$1.TAG = TAG; | |
var STRING = 'string'; | |
types$1.STRING = STRING; | |
var SELECTOR = 'selector'; | |
types$1.SELECTOR = SELECTOR; | |
var ROOT = 'root'; | |
types$1.ROOT = ROOT; | |
var PSEUDO = 'pseudo'; | |
types$1.PSEUDO = PSEUDO; | |
var NESTING = 'nesting'; | |
types$1.NESTING = NESTING; | |
var ID = 'id'; | |
types$1.ID = ID; | |
var COMMENT = 'comment'; | |
types$1.COMMENT = COMMENT; | |
var COMBINATOR = 'combinator'; | |
types$1.COMBINATOR = COMBINATOR; | |
var CLASS = 'class'; | |
types$1.CLASS = CLASS; | |
var ATTRIBUTE = 'attribute'; | |
types$1.ATTRIBUTE = ATTRIBUTE; | |
var UNIVERSAL = 'universal'; | |
types$1.UNIVERSAL = UNIVERSAL; | |
return types$1; | |
} | |
var hasRequiredContainer; | |
function requireContainer () { | |
if (hasRequiredContainer) return container.exports; | |
hasRequiredContainer = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _node = _interopRequireDefault(/*@__PURE__*/ requireNode()); | |
var types = _interopRequireWildcard(/*@__PURE__*/ requireTypes()); | |
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | |
function _interopRequireWildcard(obj, nodeInterop) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike) { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | |
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
var Container = /*#__PURE__*/function (_Node) { | |
_inheritsLoose(Container, _Node); | |
function Container(opts) { | |
var _this; | |
_this = _Node.call(this, opts) || this; | |
if (!_this.nodes) { | |
_this.nodes = []; | |
} | |
return _this; | |
} | |
var _proto = Container.prototype; | |
_proto.append = function append(selector) { | |
selector.parent = this; | |
this.nodes.push(selector); | |
return this; | |
}; | |
_proto.prepend = function prepend(selector) { | |
selector.parent = this; | |
this.nodes.unshift(selector); | |
return this; | |
}; | |
_proto.at = function at(index) { | |
return this.nodes[index]; | |
}; | |
_proto.index = function index(child) { | |
if (typeof child === 'number') { | |
return child; | |
} | |
return this.nodes.indexOf(child); | |
}; | |
_proto.removeChild = function removeChild(child) { | |
child = this.index(child); | |
this.at(child).parent = undefined; | |
this.nodes.splice(child, 1); | |
var index; | |
for (var id in this.indexes) { | |
index = this.indexes[id]; | |
if (index >= child) { | |
this.indexes[id] = index - 1; | |
} | |
} | |
return this; | |
}; | |
_proto.removeAll = function removeAll() { | |
for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) { | |
var node = _step.value; | |
node.parent = undefined; | |
} | |
this.nodes = []; | |
return this; | |
}; | |
_proto.empty = function empty() { | |
return this.removeAll(); | |
}; | |
_proto.insertAfter = function insertAfter(oldNode, newNode) { | |
newNode.parent = this; | |
var oldIndex = this.index(oldNode); | |
this.nodes.splice(oldIndex + 1, 0, newNode); | |
newNode.parent = this; | |
var index; | |
for (var id in this.indexes) { | |
index = this.indexes[id]; | |
if (oldIndex <= index) { | |
this.indexes[id] = index + 1; | |
} | |
} | |
return this; | |
}; | |
_proto.insertBefore = function insertBefore(oldNode, newNode) { | |
newNode.parent = this; | |
var oldIndex = this.index(oldNode); | |
this.nodes.splice(oldIndex, 0, newNode); | |
newNode.parent = this; | |
var index; | |
for (var id in this.indexes) { | |
index = this.indexes[id]; | |
if (index <= oldIndex) { | |
this.indexes[id] = index + 1; | |
} | |
} | |
return this; | |
}; | |
_proto._findChildAtPosition = function _findChildAtPosition(line, col) { | |
var found = undefined; | |
this.each(function (node) { | |
if (node.atPosition) { | |
var foundChild = node.atPosition(line, col); | |
if (foundChild) { | |
found = foundChild; | |
return false; | |
} | |
} else if (node.isAtPosition(line, col)) { | |
found = node; | |
return false; | |
} | |
}); | |
return found; | |
} | |
/** | |
* Return the most specific node at the line and column number given. | |
* The source location is based on the original parsed location, locations aren't | |
* updated as selector nodes are mutated. | |
* | |
* Note that this location is relative to the location of the first character | |
* of the selector, and not the location of the selector in the overall document | |
* when used in conjunction with postcss. | |
* | |
* If not found, returns undefined. | |
* @param {number} line The line number of the node to find. (1-based index) | |
* @param {number} col The column number of the node to find. (1-based index) | |
*/; | |
_proto.atPosition = function atPosition(line, col) { | |
if (this.isAtPosition(line, col)) { | |
return this._findChildAtPosition(line, col) || this; | |
} else { | |
return undefined; | |
} | |
}; | |
_proto._inferEndPosition = function _inferEndPosition() { | |
if (this.last && this.last.source && this.last.source.end) { | |
this.source = this.source || {}; | |
this.source.end = this.source.end || {}; | |
Object.assign(this.source.end, this.last.source.end); | |
} | |
}; | |
_proto.each = function each(callback) { | |
if (!this.lastEach) { | |
this.lastEach = 0; | |
} | |
if (!this.indexes) { | |
this.indexes = {}; | |
} | |
this.lastEach++; | |
var id = this.lastEach; | |
this.indexes[id] = 0; | |
if (!this.length) { | |
return undefined; | |
} | |
var index, result; | |
while (this.indexes[id] < this.length) { | |
index = this.indexes[id]; | |
result = callback(this.at(index), index); | |
if (result === false) { | |
break; | |
} | |
this.indexes[id] += 1; | |
} | |
delete this.indexes[id]; | |
if (result === false) { | |
return false; | |
} | |
}; | |
_proto.walk = function walk(callback) { | |
return this.each(function (node, i) { | |
var result = callback(node, i); | |
if (result !== false && node.length) { | |
result = node.walk(callback); | |
} | |
if (result === false) { | |
return false; | |
} | |
}); | |
}; | |
_proto.walkAttributes = function walkAttributes(callback) { | |
var _this2 = this; | |
return this.walk(function (selector) { | |
if (selector.type === types.ATTRIBUTE) { | |
return callback.call(_this2, selector); | |
} | |
}); | |
}; | |
_proto.walkClasses = function walkClasses(callback) { | |
var _this3 = this; | |
return this.walk(function (selector) { | |
if (selector.type === types.CLASS) { | |
return callback.call(_this3, selector); | |
} | |
}); | |
}; | |
_proto.walkCombinators = function walkCombinators(callback) { | |
var _this4 = this; | |
return this.walk(function (selector) { | |
if (selector.type === types.COMBINATOR) { | |
return callback.call(_this4, selector); | |
} | |
}); | |
}; | |
_proto.walkComments = function walkComments(callback) { | |
var _this5 = this; | |
return this.walk(function (selector) { | |
if (selector.type === types.COMMENT) { | |
return callback.call(_this5, selector); | |
} | |
}); | |
}; | |
_proto.walkIds = function walkIds(callback) { | |
var _this6 = this; | |
return this.walk(function (selector) { | |
if (selector.type === types.ID) { | |
return callback.call(_this6, selector); | |
} | |
}); | |
}; | |
_proto.walkNesting = function walkNesting(callback) { | |
var _this7 = this; | |
return this.walk(function (selector) { | |
if (selector.type === types.NESTING) { | |
return callback.call(_this7, selector); | |
} | |
}); | |
}; | |
_proto.walkPseudos = function walkPseudos(callback) { | |
var _this8 = this; | |
return this.walk(function (selector) { | |
if (selector.type === types.PSEUDO) { | |
return callback.call(_this8, selector); | |
} | |
}); | |
}; | |
_proto.walkTags = function walkTags(callback) { | |
var _this9 = this; | |
return this.walk(function (selector) { | |
if (selector.type === types.TAG) { | |
return callback.call(_this9, selector); | |
} | |
}); | |
}; | |
_proto.walkUniversals = function walkUniversals(callback) { | |
var _this10 = this; | |
return this.walk(function (selector) { | |
if (selector.type === types.UNIVERSAL) { | |
return callback.call(_this10, selector); | |
} | |
}); | |
}; | |
_proto.split = function split(callback) { | |
var _this11 = this; | |
var current = []; | |
return this.reduce(function (memo, node, index) { | |
var split = callback.call(_this11, node); | |
current.push(node); | |
if (split) { | |
memo.push(current); | |
current = []; | |
} else if (index === _this11.length - 1) { | |
memo.push(current); | |
} | |
return memo; | |
}, []); | |
}; | |
_proto.map = function map(callback) { | |
return this.nodes.map(callback); | |
}; | |
_proto.reduce = function reduce(callback, memo) { | |
return this.nodes.reduce(callback, memo); | |
}; | |
_proto.every = function every(callback) { | |
return this.nodes.every(callback); | |
}; | |
_proto.some = function some(callback) { | |
return this.nodes.some(callback); | |
}; | |
_proto.filter = function filter(callback) { | |
return this.nodes.filter(callback); | |
}; | |
_proto.sort = function sort(callback) { | |
return this.nodes.sort(callback); | |
}; | |
_proto.toString = function toString() { | |
return this.map(String).join(''); | |
}; | |
_createClass(Container, [{ | |
key: "first", | |
get: function get() { | |
return this.at(0); | |
} | |
}, { | |
key: "last", | |
get: function get() { | |
return this.at(this.length - 1); | |
} | |
}, { | |
key: "length", | |
get: function get() { | |
return this.nodes.length; | |
} | |
}]); | |
return Container; | |
}(_node["default"]); | |
exports["default"] = Container; | |
module.exports = exports.default; | |
} (container, container.exports)); | |
return container.exports; | |
} | |
var hasRequiredRoot; | |
function requireRoot () { | |
if (hasRequiredRoot) return root.exports; | |
hasRequiredRoot = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _container = _interopRequireDefault(/*@__PURE__*/ requireContainer()); | |
var _types = /*@__PURE__*/ requireTypes(); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
var Root = /*#__PURE__*/function (_Container) { | |
_inheritsLoose(Root, _Container); | |
function Root(opts) { | |
var _this; | |
_this = _Container.call(this, opts) || this; | |
_this.type = _types.ROOT; | |
return _this; | |
} | |
var _proto = Root.prototype; | |
_proto.toString = function toString() { | |
var str = this.reduce(function (memo, selector) { | |
memo.push(String(selector)); | |
return memo; | |
}, []).join(','); | |
return this.trailingComma ? str + ',' : str; | |
}; | |
_proto.error = function error(message, options) { | |
if (this._error) { | |
return this._error(message, options); | |
} else { | |
return new Error(message); | |
} | |
}; | |
_createClass(Root, [{ | |
key: "errorGenerator", | |
set: function set(handler) { | |
this._error = handler; | |
} | |
}]); | |
return Root; | |
}(_container["default"]); | |
exports["default"] = Root; | |
module.exports = exports.default; | |
} (root, root.exports)); | |
return root.exports; | |
} | |
var selector = {exports: {}}; | |
var hasRequiredSelector; | |
function requireSelector () { | |
if (hasRequiredSelector) return selector.exports; | |
hasRequiredSelector = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _container = _interopRequireDefault(/*@__PURE__*/ requireContainer()); | |
var _types = /*@__PURE__*/ requireTypes(); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
var Selector = /*#__PURE__*/function (_Container) { | |
_inheritsLoose(Selector, _Container); | |
function Selector(opts) { | |
var _this; | |
_this = _Container.call(this, opts) || this; | |
_this.type = _types.SELECTOR; | |
return _this; | |
} | |
return Selector; | |
}(_container["default"]); | |
exports["default"] = Selector; | |
module.exports = exports.default; | |
} (selector, selector.exports)); | |
return selector.exports; | |
} | |
var className = {exports: {}}; | |
var hasRequiredClassName; | |
function requireClassName () { | |
if (hasRequiredClassName) return className.exports; | |
hasRequiredClassName = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _cssesc = _interopRequireDefault(/*@__PURE__*/ requireCssesc()); | |
var _util = /*@__PURE__*/ requireUtil(); | |
var _node = _interopRequireDefault(/*@__PURE__*/ requireNode()); | |
var _types = /*@__PURE__*/ requireTypes(); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
var ClassName = /*#__PURE__*/function (_Node) { | |
_inheritsLoose(ClassName, _Node); | |
function ClassName(opts) { | |
var _this; | |
_this = _Node.call(this, opts) || this; | |
_this.type = _types.CLASS; | |
_this._constructed = true; | |
return _this; | |
} | |
var _proto = ClassName.prototype; | |
_proto.valueToString = function valueToString() { | |
return '.' + _Node.prototype.valueToString.call(this); | |
}; | |
_createClass(ClassName, [{ | |
key: "value", | |
get: function get() { | |
return this._value; | |
}, | |
set: function set(v) { | |
if (this._constructed) { | |
var escaped = (0, _cssesc["default"])(v, { | |
isIdentifier: true | |
}); | |
if (escaped !== v) { | |
(0, _util.ensureObject)(this, "raws"); | |
this.raws.value = escaped; | |
} else if (this.raws) { | |
delete this.raws.value; | |
} | |
} | |
this._value = v; | |
} | |
}]); | |
return ClassName; | |
}(_node["default"]); | |
exports["default"] = ClassName; | |
module.exports = exports.default; | |
} (className, className.exports)); | |
return className.exports; | |
} | |
var comment = {exports: {}}; | |
var hasRequiredComment; | |
function requireComment () { | |
if (hasRequiredComment) return comment.exports; | |
hasRequiredComment = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _node = _interopRequireDefault(/*@__PURE__*/ requireNode()); | |
var _types = /*@__PURE__*/ requireTypes(); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
var Comment = /*#__PURE__*/function (_Node) { | |
_inheritsLoose(Comment, _Node); | |
function Comment(opts) { | |
var _this; | |
_this = _Node.call(this, opts) || this; | |
_this.type = _types.COMMENT; | |
return _this; | |
} | |
return Comment; | |
}(_node["default"]); | |
exports["default"] = Comment; | |
module.exports = exports.default; | |
} (comment, comment.exports)); | |
return comment.exports; | |
} | |
var id = {exports: {}}; | |
var hasRequiredId; | |
function requireId () { | |
if (hasRequiredId) return id.exports; | |
hasRequiredId = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _node = _interopRequireDefault(/*@__PURE__*/ requireNode()); | |
var _types = /*@__PURE__*/ requireTypes(); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
var ID = /*#__PURE__*/function (_Node) { | |
_inheritsLoose(ID, _Node); | |
function ID(opts) { | |
var _this; | |
_this = _Node.call(this, opts) || this; | |
_this.type = _types.ID; | |
return _this; | |
} | |
var _proto = ID.prototype; | |
_proto.valueToString = function valueToString() { | |
return '#' + _Node.prototype.valueToString.call(this); | |
}; | |
return ID; | |
}(_node["default"]); | |
exports["default"] = ID; | |
module.exports = exports.default; | |
} (id, id.exports)); | |
return id.exports; | |
} | |
var tag = {exports: {}}; | |
var namespace = {exports: {}}; | |
var hasRequiredNamespace; | |
function requireNamespace () { | |
if (hasRequiredNamespace) return namespace.exports; | |
hasRequiredNamespace = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _cssesc = _interopRequireDefault(/*@__PURE__*/ requireCssesc()); | |
var _util = /*@__PURE__*/ requireUtil(); | |
var _node = _interopRequireDefault(/*@__PURE__*/ requireNode()); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
var Namespace = /*#__PURE__*/function (_Node) { | |
_inheritsLoose(Namespace, _Node); | |
function Namespace() { | |
return _Node.apply(this, arguments) || this; | |
} | |
var _proto = Namespace.prototype; | |
_proto.qualifiedName = function qualifiedName(value) { | |
if (this.namespace) { | |
return this.namespaceString + "|" + value; | |
} else { | |
return value; | |
} | |
}; | |
_proto.valueToString = function valueToString() { | |
return this.qualifiedName(_Node.prototype.valueToString.call(this)); | |
}; | |
_createClass(Namespace, [{ | |
key: "namespace", | |
get: function get() { | |
return this._namespace; | |
}, | |
set: function set(namespace) { | |
if (namespace === true || namespace === "*" || namespace === "&") { | |
this._namespace = namespace; | |
if (this.raws) { | |
delete this.raws.namespace; | |
} | |
return; | |
} | |
var escaped = (0, _cssesc["default"])(namespace, { | |
isIdentifier: true | |
}); | |
this._namespace = namespace; | |
if (escaped !== namespace) { | |
(0, _util.ensureObject)(this, "raws"); | |
this.raws.namespace = escaped; | |
} else if (this.raws) { | |
delete this.raws.namespace; | |
} | |
} | |
}, { | |
key: "ns", | |
get: function get() { | |
return this._namespace; | |
}, | |
set: function set(namespace) { | |
this.namespace = namespace; | |
} | |
}, { | |
key: "namespaceString", | |
get: function get() { | |
if (this.namespace) { | |
var ns = this.stringifyProperty("namespace"); | |
if (ns === true) { | |
return ''; | |
} else { | |
return ns; | |
} | |
} else { | |
return ''; | |
} | |
} | |
}]); | |
return Namespace; | |
}(_node["default"]); | |
exports["default"] = Namespace; | |
module.exports = exports.default; | |
} (namespace, namespace.exports)); | |
return namespace.exports; | |
} | |
var hasRequiredTag; | |
function requireTag () { | |
if (hasRequiredTag) return tag.exports; | |
hasRequiredTag = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _namespace = _interopRequireDefault(/*@__PURE__*/ requireNamespace()); | |
var _types = /*@__PURE__*/ requireTypes(); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
var Tag = /*#__PURE__*/function (_Namespace) { | |
_inheritsLoose(Tag, _Namespace); | |
function Tag(opts) { | |
var _this; | |
_this = _Namespace.call(this, opts) || this; | |
_this.type = _types.TAG; | |
return _this; | |
} | |
return Tag; | |
}(_namespace["default"]); | |
exports["default"] = Tag; | |
module.exports = exports.default; | |
} (tag, tag.exports)); | |
return tag.exports; | |
} | |
var string = {exports: {}}; | |
var hasRequiredString; | |
function requireString () { | |
if (hasRequiredString) return string.exports; | |
hasRequiredString = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _node = _interopRequireDefault(/*@__PURE__*/ requireNode()); | |
var _types = /*@__PURE__*/ requireTypes(); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
var String = /*#__PURE__*/function (_Node) { | |
_inheritsLoose(String, _Node); | |
function String(opts) { | |
var _this; | |
_this = _Node.call(this, opts) || this; | |
_this.type = _types.STRING; | |
return _this; | |
} | |
return String; | |
}(_node["default"]); | |
exports["default"] = String; | |
module.exports = exports.default; | |
} (string, string.exports)); | |
return string.exports; | |
} | |
var pseudo = {exports: {}}; | |
var hasRequiredPseudo; | |
function requirePseudo () { | |
if (hasRequiredPseudo) return pseudo.exports; | |
hasRequiredPseudo = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _container = _interopRequireDefault(/*@__PURE__*/ requireContainer()); | |
var _types = /*@__PURE__*/ requireTypes(); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
var Pseudo = /*#__PURE__*/function (_Container) { | |
_inheritsLoose(Pseudo, _Container); | |
function Pseudo(opts) { | |
var _this; | |
_this = _Container.call(this, opts) || this; | |
_this.type = _types.PSEUDO; | |
return _this; | |
} | |
var _proto = Pseudo.prototype; | |
_proto.toString = function toString() { | |
var params = this.length ? '(' + this.map(String).join(',') + ')' : ''; | |
return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join(''); | |
}; | |
return Pseudo; | |
}(_container["default"]); | |
exports["default"] = Pseudo; | |
module.exports = exports.default; | |
} (pseudo, pseudo.exports)); | |
return pseudo.exports; | |
} | |
var attribute = {}; | |
var hasRequiredAttribute; | |
function requireAttribute () { | |
if (hasRequiredAttribute) return attribute; | |
hasRequiredAttribute = 1; | |
(function (exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
exports.unescapeValue = unescapeValue; | |
var _cssesc = _interopRequireDefault(/*@__PURE__*/ requireCssesc()); | |
var _unesc = _interopRequireDefault(/*@__PURE__*/ requireUnesc()); | |
var _namespace = _interopRequireDefault(/*@__PURE__*/ requireNamespace()); | |
var _types = /*@__PURE__*/ requireTypes(); | |
var _CSSESC_QUOTE_OPTIONS; | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
var deprecate = /*@__PURE__*/ requireNode$1(); | |
var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/; | |
var warnOfDeprecatedValueAssignment = deprecate(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead."); | |
var warnOfDeprecatedQuotedAssignment = deprecate(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead."); | |
var warnOfDeprecatedConstructor = deprecate(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now."); | |
function unescapeValue(value) { | |
var deprecatedUsage = false; | |
var quoteMark = null; | |
var unescaped = value; | |
var m = unescaped.match(WRAPPED_IN_QUOTES); | |
if (m) { | |
quoteMark = m[1]; | |
unescaped = m[2]; | |
} | |
unescaped = (0, _unesc["default"])(unescaped); | |
if (unescaped !== value) { | |
deprecatedUsage = true; | |
} | |
return { | |
deprecatedUsage: deprecatedUsage, | |
unescaped: unescaped, | |
quoteMark: quoteMark | |
}; | |
} | |
function handleDeprecatedContructorOpts(opts) { | |
if (opts.quoteMark !== undefined) { | |
return opts; | |
} | |
if (opts.value === undefined) { | |
return opts; | |
} | |
warnOfDeprecatedConstructor(); | |
var _unescapeValue = unescapeValue(opts.value), | |
quoteMark = _unescapeValue.quoteMark, | |
unescaped = _unescapeValue.unescaped; | |
if (!opts.raws) { | |
opts.raws = {}; | |
} | |
if (opts.raws.value === undefined) { | |
opts.raws.value = opts.value; | |
} | |
opts.value = unescaped; | |
opts.quoteMark = quoteMark; | |
return opts; | |
} | |
var Attribute = /*#__PURE__*/function (_Namespace) { | |
_inheritsLoose(Attribute, _Namespace); | |
function Attribute(opts) { | |
var _this; | |
if (opts === void 0) { | |
opts = {}; | |
} | |
_this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this; | |
_this.type = _types.ATTRIBUTE; | |
_this.raws = _this.raws || {}; | |
Object.defineProperty(_this.raws, 'unquoted', { | |
get: deprecate(function () { | |
return _this.value; | |
}, "attr.raws.unquoted is deprecated. Call attr.value instead."), | |
set: deprecate(function () { | |
return _this.value; | |
}, "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.") | |
}); | |
_this._constructed = true; | |
return _this; | |
} | |
/** | |
* Returns the Attribute's value quoted such that it would be legal to use | |
* in the value of a css file. The original value's quotation setting | |
* used for stringification is left unchanged. See `setValue(value, options)` | |
* if you want to control the quote settings of a new value for the attribute. | |
* | |
* You can also change the quotation used for the current value by setting quoteMark. | |
* | |
* Options: | |
* * quoteMark {'"' | "'" | null} - Use this value to quote the value. If this | |
* option is not set, the original value for quoteMark will be used. If | |
* indeterminate, a double quote is used. The legal values are: | |
* * `null` - the value will be unquoted and characters will be escaped as necessary. | |
* * `'` - the value will be quoted with a single quote and single quotes are escaped. | |
* * `"` - the value will be quoted with a double quote and double quotes are escaped. | |
* * preferCurrentQuoteMark {boolean} - if true, prefer the source quote mark | |
* over the quoteMark option value. | |
* * smart {boolean} - if true, will select a quote mark based on the value | |
* and the other options specified here. See the `smartQuoteMark()` | |
* method. | |
**/ | |
var _proto = Attribute.prototype; | |
_proto.getQuotedValue = function getQuotedValue(options) { | |
if (options === void 0) { | |
options = {}; | |
} | |
var quoteMark = this._determineQuoteMark(options); | |
var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark]; | |
var escaped = (0, _cssesc["default"])(this._value, cssescopts); | |
return escaped; | |
}; | |
_proto._determineQuoteMark = function _determineQuoteMark(options) { | |
return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options); | |
} | |
/** | |
* Set the unescaped value with the specified quotation options. The value | |
* provided must not include any wrapping quote marks -- those quotes will | |
* be interpreted as part of the value and escaped accordingly. | |
*/; | |
_proto.setValue = function setValue(value, options) { | |
if (options === void 0) { | |
options = {}; | |
} | |
this._value = value; | |
this._quoteMark = this._determineQuoteMark(options); | |
this._syncRawValue(); | |
} | |
/** | |
* Intelligently select a quoteMark value based on the value's contents. If | |
* the value is a legal CSS ident, it will not be quoted. Otherwise a quote | |
* mark will be picked that minimizes the number of escapes. | |
* | |
* If there's no clear winner, the quote mark from these options is used, | |
* then the source quote mark (this is inverted if `preferCurrentQuoteMark` is | |
* true). If the quoteMark is unspecified, a double quote is used. | |
* | |
* @param options This takes the quoteMark and preferCurrentQuoteMark options | |
* from the quoteValue method. | |
*/; | |
_proto.smartQuoteMark = function smartQuoteMark(options) { | |
var v = this.value; | |
var numSingleQuotes = v.replace(/[^']/g, '').length; | |
var numDoubleQuotes = v.replace(/[^"]/g, '').length; | |
if (numSingleQuotes + numDoubleQuotes === 0) { | |
var escaped = (0, _cssesc["default"])(v, { | |
isIdentifier: true | |
}); | |
if (escaped === v) { | |
return Attribute.NO_QUOTE; | |
} else { | |
var pref = this.preferredQuoteMark(options); | |
if (pref === Attribute.NO_QUOTE) { | |
// pick a quote mark that isn't none and see if it's smaller | |
var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE; | |
var opts = CSSESC_QUOTE_OPTIONS[quote]; | |
var quoteValue = (0, _cssesc["default"])(v, opts); | |
if (quoteValue.length < escaped.length) { | |
return quote; | |
} | |
} | |
return pref; | |
} | |
} else if (numDoubleQuotes === numSingleQuotes) { | |
return this.preferredQuoteMark(options); | |
} else if (numDoubleQuotes < numSingleQuotes) { | |
return Attribute.DOUBLE_QUOTE; | |
} else { | |
return Attribute.SINGLE_QUOTE; | |
} | |
} | |
/** | |
* Selects the preferred quote mark based on the options and the current quote mark value. | |
* If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)` | |
* instead. | |
*/; | |
_proto.preferredQuoteMark = function preferredQuoteMark(options) { | |
var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark; | |
if (quoteMark === undefined) { | |
quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark; | |
} | |
if (quoteMark === undefined) { | |
quoteMark = Attribute.DOUBLE_QUOTE; | |
} | |
return quoteMark; | |
}; | |
_proto._syncRawValue = function _syncRawValue() { | |
var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]); | |
if (rawValue === this._value) { | |
if (this.raws) { | |
delete this.raws.value; | |
} | |
} else { | |
this.raws.value = rawValue; | |
} | |
}; | |
_proto._handleEscapes = function _handleEscapes(prop, value) { | |
if (this._constructed) { | |
var escaped = (0, _cssesc["default"])(value, { | |
isIdentifier: true | |
}); | |
if (escaped !== value) { | |
this.raws[prop] = escaped; | |
} else { | |
delete this.raws[prop]; | |
} | |
} | |
}; | |
_proto._spacesFor = function _spacesFor(name) { | |
var attrSpaces = { | |
before: '', | |
after: '' | |
}; | |
var spaces = this.spaces[name] || {}; | |
var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {}; | |
return Object.assign(attrSpaces, spaces, rawSpaces); | |
}; | |
_proto._stringFor = function _stringFor(name, spaceName, concat) { | |
if (spaceName === void 0) { | |
spaceName = name; | |
} | |
if (concat === void 0) { | |
concat = defaultAttrConcat; | |
} | |
var attrSpaces = this._spacesFor(spaceName); | |
return concat(this.stringifyProperty(name), attrSpaces); | |
} | |
/** | |
* returns the offset of the attribute part specified relative to the | |
* start of the node of the output string. | |
* | |
* * "ns" - alias for "namespace" | |
* * "namespace" - the namespace if it exists. | |
* * "attribute" - the attribute name | |
* * "attributeNS" - the start of the attribute or its namespace | |
* * "operator" - the match operator of the attribute | |
* * "value" - The value (string or identifier) | |
* * "insensitive" - the case insensitivity flag; | |
* @param part One of the possible values inside an attribute. | |
* @returns -1 if the name is invalid or the value doesn't exist in this attribute. | |
*/; | |
_proto.offsetOf = function offsetOf(name) { | |
var count = 1; | |
var attributeSpaces = this._spacesFor("attribute"); | |
count += attributeSpaces.before.length; | |
if (name === "namespace" || name === "ns") { | |
return this.namespace ? count : -1; | |
} | |
if (name === "attributeNS") { | |
return count; | |
} | |
count += this.namespaceString.length; | |
if (this.namespace) { | |
count += 1; | |
} | |
if (name === "attribute") { | |
return count; | |
} | |
count += this.stringifyProperty("attribute").length; | |
count += attributeSpaces.after.length; | |
var operatorSpaces = this._spacesFor("operator"); | |
count += operatorSpaces.before.length; | |
var operator = this.stringifyProperty("operator"); | |
if (name === "operator") { | |
return operator ? count : -1; | |
} | |
count += operator.length; | |
count += operatorSpaces.after.length; | |
var valueSpaces = this._spacesFor("value"); | |
count += valueSpaces.before.length; | |
var value = this.stringifyProperty("value"); | |
if (name === "value") { | |
return value ? count : -1; | |
} | |
count += value.length; | |
count += valueSpaces.after.length; | |
var insensitiveSpaces = this._spacesFor("insensitive"); | |
count += insensitiveSpaces.before.length; | |
if (name === "insensitive") { | |
return this.insensitive ? count : -1; | |
} | |
return -1; | |
}; | |
_proto.toString = function toString() { | |
var _this2 = this; | |
var selector = [this.rawSpaceBefore, '[']; | |
selector.push(this._stringFor('qualifiedAttribute', 'attribute')); | |
if (this.operator && (this.value || this.value === '')) { | |
selector.push(this._stringFor('operator')); | |
selector.push(this._stringFor('value')); | |
selector.push(this._stringFor('insensitiveFlag', 'insensitive', function (attrValue, attrSpaces) { | |
if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) { | |
attrSpaces.before = " "; | |
} | |
return defaultAttrConcat(attrValue, attrSpaces); | |
})); | |
} | |
selector.push(']'); | |
selector.push(this.rawSpaceAfter); | |
return selector.join(''); | |
}; | |
_createClass(Attribute, [{ | |
key: "quoted", | |
get: function get() { | |
var qm = this.quoteMark; | |
return qm === "'" || qm === '"'; | |
}, | |
set: function set(value) { | |
warnOfDeprecatedQuotedAssignment(); | |
} | |
/** | |
* returns a single (`'`) or double (`"`) quote character if the value is quoted. | |
* returns `null` if the value is not quoted. | |
* returns `undefined` if the quotation state is unknown (this can happen when | |
* the attribute is constructed without specifying a quote mark.) | |
*/ | |
}, { | |
key: "quoteMark", | |
get: function get() { | |
return this._quoteMark; | |
} | |
/** | |
* Set the quote mark to be used by this attribute's value. | |
* If the quote mark changes, the raw (escaped) value at `attr.raws.value` of the attribute | |
* value is updated accordingly. | |
* | |
* @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted. | |
*/, | |
set: function set(quoteMark) { | |
if (!this._constructed) { | |
this._quoteMark = quoteMark; | |
return; | |
} | |
if (this._quoteMark !== quoteMark) { | |
this._quoteMark = quoteMark; | |
this._syncRawValue(); | |
} | |
} | |
}, { | |
key: "qualifiedAttribute", | |
get: function get() { | |
return this.qualifiedName(this.raws.attribute || this.attribute); | |
} | |
}, { | |
key: "insensitiveFlag", | |
get: function get() { | |
return this.insensitive ? 'i' : ''; | |
} | |
}, { | |
key: "value", | |
get: function get() { | |
return this._value; | |
}, | |
set: | |
/** | |
* Before 3.0, the value had to be set to an escaped value including any wrapped | |
* quote marks. In 3.0, the semantics of `Attribute.value` changed so that the value | |
* is unescaped during parsing and any quote marks are removed. | |
* | |
* Because the ambiguity of this semantic change, if you set `attr.value = newValue`, | |
* a deprecation warning is raised when the new value contains any characters that would | |
* require escaping (including if it contains wrapped quotes). | |
* | |
* Instead, you should call `attr.setValue(newValue, opts)` and pass options that describe | |
* how the new value is quoted. | |
*/ | |
function set(v) { | |
if (this._constructed) { | |
var _unescapeValue2 = unescapeValue(v), | |
deprecatedUsage = _unescapeValue2.deprecatedUsage, | |
unescaped = _unescapeValue2.unescaped, | |
quoteMark = _unescapeValue2.quoteMark; | |
if (deprecatedUsage) { | |
warnOfDeprecatedValueAssignment(); | |
} | |
if (unescaped === this._value && quoteMark === this._quoteMark) { | |
return; | |
} | |
this._value = unescaped; | |
this._quoteMark = quoteMark; | |
this._syncRawValue(); | |
} else { | |
this._value = v; | |
} | |
} | |
}, { | |
key: "insensitive", | |
get: function get() { | |
return this._insensitive; | |
} | |
/** | |
* Set the case insensitive flag. | |
* If the case insensitive flag changes, the raw (escaped) value at `attr.raws.insensitiveFlag` | |
* of the attribute is updated accordingly. | |
* | |
* @param {true | false} insensitive true if the attribute should match case-insensitively. | |
*/, | |
set: function set(insensitive) { | |
if (!insensitive) { | |
this._insensitive = false; | |
// "i" and "I" can be used in "this.raws.insensitiveFlag" to store the original notation. | |
// When setting `attr.insensitive = false` both should be erased to ensure correct serialization. | |
if (this.raws && (this.raws.insensitiveFlag === 'I' || this.raws.insensitiveFlag === 'i')) { | |
this.raws.insensitiveFlag = undefined; | |
} | |
} | |
this._insensitive = insensitive; | |
} | |
}, { | |
key: "attribute", | |
get: function get() { | |
return this._attribute; | |
}, | |
set: function set(name) { | |
this._handleEscapes("attribute", name); | |
this._attribute = name; | |
} | |
}]); | |
return Attribute; | |
}(_namespace["default"]); | |
exports["default"] = Attribute; | |
Attribute.NO_QUOTE = null; | |
Attribute.SINGLE_QUOTE = "'"; | |
Attribute.DOUBLE_QUOTE = '"'; | |
var CSSESC_QUOTE_OPTIONS = (_CSSESC_QUOTE_OPTIONS = { | |
"'": { | |
quotes: 'single', | |
wrap: true | |
}, | |
'"': { | |
quotes: 'double', | |
wrap: true | |
} | |
}, _CSSESC_QUOTE_OPTIONS[null] = { | |
isIdentifier: true | |
}, _CSSESC_QUOTE_OPTIONS); | |
function defaultAttrConcat(attrValue, attrSpaces) { | |
return "" + attrSpaces.before + attrValue + attrSpaces.after; | |
} | |
} (attribute)); | |
return attribute; | |
} | |
var universal = {exports: {}}; | |
var hasRequiredUniversal; | |
function requireUniversal () { | |
if (hasRequiredUniversal) return universal.exports; | |
hasRequiredUniversal = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _namespace = _interopRequireDefault(/*@__PURE__*/ requireNamespace()); | |
var _types = /*@__PURE__*/ requireTypes(); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
var Universal = /*#__PURE__*/function (_Namespace) { | |
_inheritsLoose(Universal, _Namespace); | |
function Universal(opts) { | |
var _this; | |
_this = _Namespace.call(this, opts) || this; | |
_this.type = _types.UNIVERSAL; | |
_this.value = '*'; | |
return _this; | |
} | |
return Universal; | |
}(_namespace["default"]); | |
exports["default"] = Universal; | |
module.exports = exports.default; | |
} (universal, universal.exports)); | |
return universal.exports; | |
} | |
var combinator = {exports: {}}; | |
var hasRequiredCombinator; | |
function requireCombinator () { | |
if (hasRequiredCombinator) return combinator.exports; | |
hasRequiredCombinator = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _node = _interopRequireDefault(/*@__PURE__*/ requireNode()); | |
var _types = /*@__PURE__*/ requireTypes(); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
var Combinator = /*#__PURE__*/function (_Node) { | |
_inheritsLoose(Combinator, _Node); | |
function Combinator(opts) { | |
var _this; | |
_this = _Node.call(this, opts) || this; | |
_this.type = _types.COMBINATOR; | |
return _this; | |
} | |
return Combinator; | |
}(_node["default"]); | |
exports["default"] = Combinator; | |
module.exports = exports.default; | |
} (combinator, combinator.exports)); | |
return combinator.exports; | |
} | |
var nesting = {exports: {}}; | |
var hasRequiredNesting; | |
function requireNesting () { | |
if (hasRequiredNesting) return nesting.exports; | |
hasRequiredNesting = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _node = _interopRequireDefault(/*@__PURE__*/ requireNode()); | |
var _types = /*@__PURE__*/ requireTypes(); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } | |
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | |
var Nesting = /*#__PURE__*/function (_Node) { | |
_inheritsLoose(Nesting, _Node); | |
function Nesting(opts) { | |
var _this; | |
_this = _Node.call(this, opts) || this; | |
_this.type = _types.NESTING; | |
_this.value = '&'; | |
return _this; | |
} | |
return Nesting; | |
}(_node["default"]); | |
exports["default"] = Nesting; | |
module.exports = exports.default; | |
} (nesting, nesting.exports)); | |
return nesting.exports; | |
} | |
var sortAscending = {exports: {}}; | |
var hasRequiredSortAscending; | |
function requireSortAscending () { | |
if (hasRequiredSortAscending) return sortAscending.exports; | |
hasRequiredSortAscending = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = sortAscending; | |
function sortAscending(list) { | |
return list.sort(function (a, b) { | |
return a - b; | |
}); | |
} | |
module.exports = exports.default; | |
} (sortAscending, sortAscending.exports)); | |
return sortAscending.exports; | |
} | |
var tokenize = {}; | |
var tokenTypes = {}; | |
var hasRequiredTokenTypes; | |
function requireTokenTypes () { | |
if (hasRequiredTokenTypes) return tokenTypes; | |
hasRequiredTokenTypes = 1; | |
tokenTypes.__esModule = true; | |
tokenTypes.word = tokenTypes.tilde = tokenTypes.tab = tokenTypes.str = tokenTypes.space = tokenTypes.slash = tokenTypes.singleQuote = tokenTypes.semicolon = tokenTypes.plus = tokenTypes.pipe = tokenTypes.openSquare = tokenTypes.openParenthesis = tokenTypes.newline = tokenTypes.greaterThan = tokenTypes.feed = tokenTypes.equals = tokenTypes.doubleQuote = tokenTypes.dollar = tokenTypes.cr = tokenTypes.comment = tokenTypes.comma = tokenTypes.combinator = tokenTypes.colon = tokenTypes.closeSquare = tokenTypes.closeParenthesis = tokenTypes.caret = tokenTypes.bang = tokenTypes.backslash = tokenTypes.at = tokenTypes.asterisk = tokenTypes.ampersand = void 0; | |
var ampersand = 38; // `&`.charCodeAt(0); | |
tokenTypes.ampersand = ampersand; | |
var asterisk = 42; // `*`.charCodeAt(0); | |
tokenTypes.asterisk = asterisk; | |
var at = 64; // `@`.charCodeAt(0); | |
tokenTypes.at = at; | |
var comma = 44; // `,`.charCodeAt(0); | |
tokenTypes.comma = comma; | |
var colon = 58; // `:`.charCodeAt(0); | |
tokenTypes.colon = colon; | |
var semicolon = 59; // `;`.charCodeAt(0); | |
tokenTypes.semicolon = semicolon; | |
var openParenthesis = 40; // `(`.charCodeAt(0); | |
tokenTypes.openParenthesis = openParenthesis; | |
var closeParenthesis = 41; // `)`.charCodeAt(0); | |
tokenTypes.closeParenthesis = closeParenthesis; | |
var openSquare = 91; // `[`.charCodeAt(0); | |
tokenTypes.openSquare = openSquare; | |
var closeSquare = 93; // `]`.charCodeAt(0); | |
tokenTypes.closeSquare = closeSquare; | |
var dollar = 36; // `$`.charCodeAt(0); | |
tokenTypes.dollar = dollar; | |
var tilde = 126; // `~`.charCodeAt(0); | |
tokenTypes.tilde = tilde; | |
var caret = 94; // `^`.charCodeAt(0); | |
tokenTypes.caret = caret; | |
var plus = 43; // `+`.charCodeAt(0); | |
tokenTypes.plus = plus; | |
var equals = 61; // `=`.charCodeAt(0); | |
tokenTypes.equals = equals; | |
var pipe = 124; // `|`.charCodeAt(0); | |
tokenTypes.pipe = pipe; | |
var greaterThan = 62; // `>`.charCodeAt(0); | |
tokenTypes.greaterThan = greaterThan; | |
var space = 32; // ` `.charCodeAt(0); | |
tokenTypes.space = space; | |
var singleQuote = 39; // `'`.charCodeAt(0); | |
tokenTypes.singleQuote = singleQuote; | |
var doubleQuote = 34; // `"`.charCodeAt(0); | |
tokenTypes.doubleQuote = doubleQuote; | |
var slash = 47; // `/`.charCodeAt(0); | |
tokenTypes.slash = slash; | |
var bang = 33; // `!`.charCodeAt(0); | |
tokenTypes.bang = bang; | |
var backslash = 92; // '\\'.charCodeAt(0); | |
tokenTypes.backslash = backslash; | |
var cr = 13; // '\r'.charCodeAt(0); | |
tokenTypes.cr = cr; | |
var feed = 12; // '\f'.charCodeAt(0); | |
tokenTypes.feed = feed; | |
var newline = 10; // '\n'.charCodeAt(0); | |
tokenTypes.newline = newline; | |
var tab = 9; // '\t'.charCodeAt(0); | |
// Expose aliases primarily for readability. | |
tokenTypes.tab = tab; | |
var str = singleQuote; | |
// No good single character representation! | |
tokenTypes.str = str; | |
var comment = -1; | |
tokenTypes.comment = comment; | |
var word = -2; | |
tokenTypes.word = word; | |
var combinator = -3; | |
tokenTypes.combinator = combinator; | |
return tokenTypes; | |
} | |
var hasRequiredTokenize; | |
function requireTokenize () { | |
if (hasRequiredTokenize) return tokenize; | |
hasRequiredTokenize = 1; | |
(function (exports) { | |
exports.__esModule = true; | |
exports.FIELDS = void 0; | |
exports["default"] = tokenize; | |
var t = _interopRequireWildcard(/*@__PURE__*/ requireTokenTypes()); | |
var _unescapable, _wordDelimiters; | |
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | |
function _interopRequireWildcard(obj, nodeInterop) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | |
var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable); | |
var wordDelimiters = (_wordDelimiters = {}, _wordDelimiters[t.space] = true, _wordDelimiters[t.tab] = true, _wordDelimiters[t.newline] = true, _wordDelimiters[t.cr] = true, _wordDelimiters[t.feed] = true, _wordDelimiters[t.ampersand] = true, _wordDelimiters[t.asterisk] = true, _wordDelimiters[t.bang] = true, _wordDelimiters[t.comma] = true, _wordDelimiters[t.colon] = true, _wordDelimiters[t.semicolon] = true, _wordDelimiters[t.openParenthesis] = true, _wordDelimiters[t.closeParenthesis] = true, _wordDelimiters[t.openSquare] = true, _wordDelimiters[t.closeSquare] = true, _wordDelimiters[t.singleQuote] = true, _wordDelimiters[t.doubleQuote] = true, _wordDelimiters[t.plus] = true, _wordDelimiters[t.pipe] = true, _wordDelimiters[t.tilde] = true, _wordDelimiters[t.greaterThan] = true, _wordDelimiters[t.equals] = true, _wordDelimiters[t.dollar] = true, _wordDelimiters[t.caret] = true, _wordDelimiters[t.slash] = true, _wordDelimiters); | |
var hex = {}; | |
var hexChars = "0123456789abcdefABCDEF"; | |
for (var i = 0; i < hexChars.length; i++) { | |
hex[hexChars.charCodeAt(i)] = true; | |
} | |
/** | |
* Returns the last index of the bar css word | |
* @param {string} css The string in which the word begins | |
* @param {number} start The index into the string where word's first letter occurs | |
*/ | |
function consumeWord(css, start) { | |
var next = start; | |
var code; | |
do { | |
code = css.charCodeAt(next); | |
if (wordDelimiters[code]) { | |
return next - 1; | |
} else if (code === t.backslash) { | |
next = consumeEscape(css, next) + 1; | |
} else { | |
// All other characters are part of the word | |
next++; | |
} | |
} while (next < css.length); | |
return next - 1; | |
} | |
/** | |
* Returns the last index of the escape sequence | |
* @param {string} css The string in which the sequence begins | |
* @param {number} start The index into the string where escape character (`\`) occurs. | |
*/ | |
function consumeEscape(css, start) { | |
var next = start; | |
var code = css.charCodeAt(next + 1); | |
if (unescapable[code]) ; else if (hex[code]) { | |
var hexDigits = 0; | |
// consume up to 6 hex chars | |
do { | |
next++; | |
hexDigits++; | |
code = css.charCodeAt(next + 1); | |
} while (hex[code] && hexDigits < 6); | |
// if fewer than 6 hex chars, a trailing space ends the escape | |
if (hexDigits < 6 && code === t.space) { | |
next++; | |
} | |
} else { | |
// the next char is part of the current word | |
next++; | |
} | |
return next; | |
} | |
var FIELDS = { | |
TYPE: 0, | |
START_LINE: 1, | |
START_COL: 2, | |
END_LINE: 3, | |
END_COL: 4, | |
START_POS: 5, | |
END_POS: 6 | |
}; | |
exports.FIELDS = FIELDS; | |
function tokenize(input) { | |
var tokens = []; | |
var css = input.css.valueOf(); | |
var _css = css, | |
length = _css.length; | |
var offset = -1; | |
var line = 1; | |
var start = 0; | |
var end = 0; | |
var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType; | |
function unclosed(what, fix) { | |
if (input.safe) { | |
// fyi: this is never set to true. | |
css += fix; | |
next = css.length - 1; | |
} else { | |
throw input.error('Unclosed ' + what, line, start - offset, start); | |
} | |
} | |
while (start < length) { | |
code = css.charCodeAt(start); | |
if (code === t.newline) { | |
offset = start; | |
line += 1; | |
} | |
switch (code) { | |
case t.space: | |
case t.tab: | |
case t.newline: | |
case t.cr: | |
case t.feed: | |
next = start; | |
do { | |
next += 1; | |
code = css.charCodeAt(next); | |
if (code === t.newline) { | |
offset = next; | |
line += 1; | |
} | |
} while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed); | |
tokenType = t.space; | |
endLine = line; | |
endColumn = next - offset - 1; | |
end = next; | |
break; | |
case t.plus: | |
case t.greaterThan: | |
case t.tilde: | |
case t.pipe: | |
next = start; | |
do { | |
next += 1; | |
code = css.charCodeAt(next); | |
} while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe); | |
tokenType = t.combinator; | |
endLine = line; | |
endColumn = start - offset; | |
end = next; | |
break; | |
// Consume these characters as single tokens. | |
case t.asterisk: | |
case t.ampersand: | |
case t.bang: | |
case t.comma: | |
case t.equals: | |
case t.dollar: | |
case t.caret: | |
case t.openSquare: | |
case t.closeSquare: | |
case t.colon: | |
case t.semicolon: | |
case t.openParenthesis: | |
case t.closeParenthesis: | |
next = start; | |
tokenType = code; | |
endLine = line; | |
endColumn = start - offset; | |
end = next + 1; | |
break; | |
case t.singleQuote: | |
case t.doubleQuote: | |
quote = code === t.singleQuote ? "'" : '"'; | |
next = start; | |
do { | |
escaped = false; | |
next = css.indexOf(quote, next + 1); | |
if (next === -1) { | |
unclosed('quote', quote); | |
} | |
escapePos = next; | |
while (css.charCodeAt(escapePos - 1) === t.backslash) { | |
escapePos -= 1; | |
escaped = !escaped; | |
} | |
} while (escaped); | |
tokenType = t.str; | |
endLine = line; | |
endColumn = start - offset; | |
end = next + 1; | |
break; | |
default: | |
if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) { | |
next = css.indexOf('*/', start + 2) + 1; | |
if (next === 0) { | |
unclosed('comment', '*/'); | |
} | |
content = css.slice(start, next + 1); | |
lines = content.split('\n'); | |
last = lines.length - 1; | |
if (last > 0) { | |
nextLine = line + last; | |
nextOffset = next - lines[last].length; | |
} else { | |
nextLine = line; | |
nextOffset = offset; | |
} | |
tokenType = t.comment; | |
line = nextLine; | |
endLine = nextLine; | |
endColumn = next - nextOffset; | |
} else if (code === t.slash) { | |
next = start; | |
tokenType = code; | |
endLine = line; | |
endColumn = start - offset; | |
end = next + 1; | |
} else { | |
next = consumeWord(css, start); | |
tokenType = t.word; | |
endLine = line; | |
endColumn = next - offset; | |
} | |
end = next + 1; | |
break; | |
} | |
// Ensure that the token structure remains consistent | |
tokens.push([tokenType, | |
// [0] Token type | |
line, | |
// [1] Starting line | |
start - offset, | |
// [2] Starting column | |
endLine, | |
// [3] Ending line | |
endColumn, | |
// [4] Ending column | |
start, | |
// [5] Start position / Source index | |
end // [6] End position | |
]); | |
// Reset offset for the next token | |
if (nextOffset) { | |
offset = nextOffset; | |
nextOffset = null; | |
} | |
start = end; | |
} | |
return tokens; | |
} | |
} (tokenize)); | |
return tokenize; | |
} | |
var hasRequiredParser; | |
function requireParser () { | |
if (hasRequiredParser) return parser.exports; | |
hasRequiredParser = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _root = _interopRequireDefault(/*@__PURE__*/ requireRoot()); | |
var _selector = _interopRequireDefault(/*@__PURE__*/ requireSelector()); | |
var _className = _interopRequireDefault(/*@__PURE__*/ requireClassName()); | |
var _comment = _interopRequireDefault(/*@__PURE__*/ requireComment()); | |
var _id = _interopRequireDefault(/*@__PURE__*/ requireId()); | |
var _tag = _interopRequireDefault(/*@__PURE__*/ requireTag()); | |
var _string = _interopRequireDefault(/*@__PURE__*/ requireString()); | |
var _pseudo = _interopRequireDefault(/*@__PURE__*/ requirePseudo()); | |
var _attribute = _interopRequireWildcard(/*@__PURE__*/ requireAttribute()); | |
var _universal = _interopRequireDefault(/*@__PURE__*/ requireUniversal()); | |
var _combinator = _interopRequireDefault(/*@__PURE__*/ requireCombinator()); | |
var _nesting = _interopRequireDefault(/*@__PURE__*/ requireNesting()); | |
var _sortAscending = _interopRequireDefault(/*@__PURE__*/ requireSortAscending()); | |
var _tokenize = _interopRequireWildcard(/*@__PURE__*/ requireTokenize()); | |
var tokens = _interopRequireWildcard(/*@__PURE__*/ requireTokenTypes()); | |
var types = _interopRequireWildcard(/*@__PURE__*/ requireTypes()); | |
var _util = /*@__PURE__*/ requireUtil(); | |
var _WHITESPACE_TOKENS, _Object$assign; | |
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | |
function _interopRequireWildcard(obj, nodeInterop) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
var WHITESPACE_TOKENS = (_WHITESPACE_TOKENS = {}, _WHITESPACE_TOKENS[tokens.space] = true, _WHITESPACE_TOKENS[tokens.cr] = true, _WHITESPACE_TOKENS[tokens.feed] = true, _WHITESPACE_TOKENS[tokens.newline] = true, _WHITESPACE_TOKENS[tokens.tab] = true, _WHITESPACE_TOKENS); | |
var WHITESPACE_EQUIV_TOKENS = Object.assign({}, WHITESPACE_TOKENS, (_Object$assign = {}, _Object$assign[tokens.comment] = true, _Object$assign)); | |
function tokenStart(token) { | |
return { | |
line: token[_tokenize.FIELDS.START_LINE], | |
column: token[_tokenize.FIELDS.START_COL] | |
}; | |
} | |
function tokenEnd(token) { | |
return { | |
line: token[_tokenize.FIELDS.END_LINE], | |
column: token[_tokenize.FIELDS.END_COL] | |
}; | |
} | |
function getSource(startLine, startColumn, endLine, endColumn) { | |
return { | |
start: { | |
line: startLine, | |
column: startColumn | |
}, | |
end: { | |
line: endLine, | |
column: endColumn | |
} | |
}; | |
} | |
function getTokenSource(token) { | |
return getSource(token[_tokenize.FIELDS.START_LINE], token[_tokenize.FIELDS.START_COL], token[_tokenize.FIELDS.END_LINE], token[_tokenize.FIELDS.END_COL]); | |
} | |
function getTokenSourceSpan(startToken, endToken) { | |
if (!startToken) { | |
return undefined; | |
} | |
return getSource(startToken[_tokenize.FIELDS.START_LINE], startToken[_tokenize.FIELDS.START_COL], endToken[_tokenize.FIELDS.END_LINE], endToken[_tokenize.FIELDS.END_COL]); | |
} | |
function unescapeProp(node, prop) { | |
var value = node[prop]; | |
if (typeof value !== "string") { | |
return; | |
} | |
if (value.indexOf("\\") !== -1) { | |
(0, _util.ensureObject)(node, 'raws'); | |
node[prop] = (0, _util.unesc)(value); | |
if (node.raws[prop] === undefined) { | |
node.raws[prop] = value; | |
} | |
} | |
return node; | |
} | |
function indexesOf(array, item) { | |
var i = -1; | |
var indexes = []; | |
while ((i = array.indexOf(item, i + 1)) !== -1) { | |
indexes.push(i); | |
} | |
return indexes; | |
} | |
function uniqs() { | |
var list = Array.prototype.concat.apply([], arguments); | |
return list.filter(function (item, i) { | |
return i === list.indexOf(item); | |
}); | |
} | |
var Parser = /*#__PURE__*/function () { | |
function Parser(rule, options) { | |
if (options === void 0) { | |
options = {}; | |
} | |
this.rule = rule; | |
this.options = Object.assign({ | |
lossy: false, | |
safe: false | |
}, options); | |
this.position = 0; | |
this.css = typeof this.rule === 'string' ? this.rule : this.rule.selector; | |
this.tokens = (0, _tokenize["default"])({ | |
css: this.css, | |
error: this._errorGenerator(), | |
safe: this.options.safe | |
}); | |
var rootSource = getTokenSourceSpan(this.tokens[0], this.tokens[this.tokens.length - 1]); | |
this.root = new _root["default"]({ | |
source: rootSource | |
}); | |
this.root.errorGenerator = this._errorGenerator(); | |
var selector = new _selector["default"]({ | |
source: { | |
start: { | |
line: 1, | |
column: 1 | |
} | |
}, | |
sourceIndex: 0 | |
}); | |
this.root.append(selector); | |
this.current = selector; | |
this.loop(); | |
} | |
var _proto = Parser.prototype; | |
_proto._errorGenerator = function _errorGenerator() { | |
var _this = this; | |
return function (message, errorOptions) { | |
if (typeof _this.rule === 'string') { | |
return new Error(message); | |
} | |
return _this.rule.error(message, errorOptions); | |
}; | |
}; | |
_proto.attribute = function attribute() { | |
var attr = []; | |
var startingToken = this.currToken; | |
this.position++; | |
while (this.position < this.tokens.length && this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) { | |
attr.push(this.currToken); | |
this.position++; | |
} | |
if (this.currToken[_tokenize.FIELDS.TYPE] !== tokens.closeSquare) { | |
return this.expected('closing square bracket', this.currToken[_tokenize.FIELDS.START_POS]); | |
} | |
var len = attr.length; | |
var node = { | |
source: getSource(startingToken[1], startingToken[2], this.currToken[3], this.currToken[4]), | |
sourceIndex: startingToken[_tokenize.FIELDS.START_POS] | |
}; | |
if (len === 1 && !~[tokens.word].indexOf(attr[0][_tokenize.FIELDS.TYPE])) { | |
return this.expected('attribute', attr[0][_tokenize.FIELDS.START_POS]); | |
} | |
var pos = 0; | |
var spaceBefore = ''; | |
var commentBefore = ''; | |
var lastAdded = null; | |
var spaceAfterMeaningfulToken = false; | |
while (pos < len) { | |
var token = attr[pos]; | |
var content = this.content(token); | |
var next = attr[pos + 1]; | |
switch (token[_tokenize.FIELDS.TYPE]) { | |
case tokens.space: | |
// if ( | |
// len === 1 || | |
// pos === 0 && this.content(next) === '|' | |
// ) { | |
// return this.expected('attribute', token[TOKEN.START_POS], content); | |
// } | |
spaceAfterMeaningfulToken = true; | |
if (this.options.lossy) { | |
break; | |
} | |
if (lastAdded) { | |
(0, _util.ensureObject)(node, 'spaces', lastAdded); | |
var prevContent = node.spaces[lastAdded].after || ''; | |
node.spaces[lastAdded].after = prevContent + content; | |
var existingComment = (0, _util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || null; | |
if (existingComment) { | |
node.raws.spaces[lastAdded].after = existingComment + content; | |
} | |
} else { | |
spaceBefore = spaceBefore + content; | |
commentBefore = commentBefore + content; | |
} | |
break; | |
case tokens.asterisk: | |
if (next[_tokenize.FIELDS.TYPE] === tokens.equals) { | |
node.operator = content; | |
lastAdded = 'operator'; | |
} else if ((!node.namespace || lastAdded === "namespace" && !spaceAfterMeaningfulToken) && next) { | |
if (spaceBefore) { | |
(0, _util.ensureObject)(node, 'spaces', 'attribute'); | |
node.spaces.attribute.before = spaceBefore; | |
spaceBefore = ''; | |
} | |
if (commentBefore) { | |
(0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute'); | |
node.raws.spaces.attribute.before = spaceBefore; | |
commentBefore = ''; | |
} | |
node.namespace = (node.namespace || "") + content; | |
var rawValue = (0, _util.getProp)(node, 'raws', 'namespace') || null; | |
if (rawValue) { | |
node.raws.namespace += content; | |
} | |
lastAdded = 'namespace'; | |
} | |
spaceAfterMeaningfulToken = false; | |
break; | |
case tokens.dollar: | |
if (lastAdded === "value") { | |
var oldRawValue = (0, _util.getProp)(node, 'raws', 'value'); | |
node.value += "$"; | |
if (oldRawValue) { | |
node.raws.value = oldRawValue + "$"; | |
} | |
break; | |
} | |
// Falls through | |
case tokens.caret: | |
if (next[_tokenize.FIELDS.TYPE] === tokens.equals) { | |
node.operator = content; | |
lastAdded = 'operator'; | |
} | |
spaceAfterMeaningfulToken = false; | |
break; | |
case tokens.combinator: | |
if (content === '~' && next[_tokenize.FIELDS.TYPE] === tokens.equals) { | |
node.operator = content; | |
lastAdded = 'operator'; | |
} | |
if (content !== '|') { | |
spaceAfterMeaningfulToken = false; | |
break; | |
} | |
if (next[_tokenize.FIELDS.TYPE] === tokens.equals) { | |
node.operator = content; | |
lastAdded = 'operator'; | |
} else if (!node.namespace && !node.attribute) { | |
node.namespace = true; | |
} | |
spaceAfterMeaningfulToken = false; | |
break; | |
case tokens.word: | |
if (next && this.content(next) === '|' && attr[pos + 2] && attr[pos + 2][_tokenize.FIELDS.TYPE] !== tokens.equals && | |
// this look-ahead probably fails with comment nodes involved. | |
!node.operator && !node.namespace) { | |
node.namespace = content; | |
lastAdded = 'namespace'; | |
} else if (!node.attribute || lastAdded === "attribute" && !spaceAfterMeaningfulToken) { | |
if (spaceBefore) { | |
(0, _util.ensureObject)(node, 'spaces', 'attribute'); | |
node.spaces.attribute.before = spaceBefore; | |
spaceBefore = ''; | |
} | |
if (commentBefore) { | |
(0, _util.ensureObject)(node, 'raws', 'spaces', 'attribute'); | |
node.raws.spaces.attribute.before = commentBefore; | |
commentBefore = ''; | |
} | |
node.attribute = (node.attribute || "") + content; | |
var _rawValue = (0, _util.getProp)(node, 'raws', 'attribute') || null; | |
if (_rawValue) { | |
node.raws.attribute += content; | |
} | |
lastAdded = 'attribute'; | |
} else if (!node.value && node.value !== "" || lastAdded === "value" && !(spaceAfterMeaningfulToken || node.quoteMark)) { | |
var _unescaped = (0, _util.unesc)(content); | |
var _oldRawValue = (0, _util.getProp)(node, 'raws', 'value') || ''; | |
var oldValue = node.value || ''; | |
node.value = oldValue + _unescaped; | |
node.quoteMark = null; | |
if (_unescaped !== content || _oldRawValue) { | |
(0, _util.ensureObject)(node, 'raws'); | |
node.raws.value = (_oldRawValue || oldValue) + content; | |
} | |
lastAdded = 'value'; | |
} else { | |
var insensitive = content === 'i' || content === "I"; | |
if ((node.value || node.value === '') && (node.quoteMark || spaceAfterMeaningfulToken)) { | |
node.insensitive = insensitive; | |
if (!insensitive || content === "I") { | |
(0, _util.ensureObject)(node, 'raws'); | |
node.raws.insensitiveFlag = content; | |
} | |
lastAdded = 'insensitive'; | |
if (spaceBefore) { | |
(0, _util.ensureObject)(node, 'spaces', 'insensitive'); | |
node.spaces.insensitive.before = spaceBefore; | |
spaceBefore = ''; | |
} | |
if (commentBefore) { | |
(0, _util.ensureObject)(node, 'raws', 'spaces', 'insensitive'); | |
node.raws.spaces.insensitive.before = commentBefore; | |
commentBefore = ''; | |
} | |
} else if (node.value || node.value === '') { | |
lastAdded = 'value'; | |
node.value += content; | |
if (node.raws.value) { | |
node.raws.value += content; | |
} | |
} | |
} | |
spaceAfterMeaningfulToken = false; | |
break; | |
case tokens.str: | |
if (!node.attribute || !node.operator) { | |
return this.error("Expected an attribute followed by an operator preceding the string.", { | |
index: token[_tokenize.FIELDS.START_POS] | |
}); | |
} | |
var _unescapeValue = (0, _attribute.unescapeValue)(content), | |
unescaped = _unescapeValue.unescaped, | |
quoteMark = _unescapeValue.quoteMark; | |
node.value = unescaped; | |
node.quoteMark = quoteMark; | |
lastAdded = 'value'; | |
(0, _util.ensureObject)(node, 'raws'); | |
node.raws.value = content; | |
spaceAfterMeaningfulToken = false; | |
break; | |
case tokens.equals: | |
if (!node.attribute) { | |
return this.expected('attribute', token[_tokenize.FIELDS.START_POS], content); | |
} | |
if (node.value) { | |
return this.error('Unexpected "=" found; an operator was already defined.', { | |
index: token[_tokenize.FIELDS.START_POS] | |
}); | |
} | |
node.operator = node.operator ? node.operator + content : content; | |
lastAdded = 'operator'; | |
spaceAfterMeaningfulToken = false; | |
break; | |
case tokens.comment: | |
if (lastAdded) { | |
if (spaceAfterMeaningfulToken || next && next[_tokenize.FIELDS.TYPE] === tokens.space || lastAdded === 'insensitive') { | |
var lastComment = (0, _util.getProp)(node, 'spaces', lastAdded, 'after') || ''; | |
var rawLastComment = (0, _util.getProp)(node, 'raws', 'spaces', lastAdded, 'after') || lastComment; | |
(0, _util.ensureObject)(node, 'raws', 'spaces', lastAdded); | |
node.raws.spaces[lastAdded].after = rawLastComment + content; | |
} else { | |
var lastValue = node[lastAdded] || ''; | |
var rawLastValue = (0, _util.getProp)(node, 'raws', lastAdded) || lastValue; | |
(0, _util.ensureObject)(node, 'raws'); | |
node.raws[lastAdded] = rawLastValue + content; | |
} | |
} else { | |
commentBefore = commentBefore + content; | |
} | |
break; | |
default: | |
return this.error("Unexpected \"" + content + "\" found.", { | |
index: token[_tokenize.FIELDS.START_POS] | |
}); | |
} | |
pos++; | |
} | |
unescapeProp(node, "attribute"); | |
unescapeProp(node, "namespace"); | |
this.newNode(new _attribute["default"](node)); | |
this.position++; | |
} | |
/** | |
* return a node containing meaningless garbage up to (but not including) the specified token position. | |
* if the token position is negative, all remaining tokens are consumed. | |
* | |
* This returns an array containing a single string node if all whitespace, | |
* otherwise an array of comment nodes with space before and after. | |
* | |
* These tokens are not added to the current selector, the caller can add them or use them to amend | |
* a previous node's space metadata. | |
* | |
* In lossy mode, this returns only comments. | |
*/; | |
_proto.parseWhitespaceEquivalentTokens = function parseWhitespaceEquivalentTokens(stopPosition) { | |
if (stopPosition < 0) { | |
stopPosition = this.tokens.length; | |
} | |
var startPosition = this.position; | |
var nodes = []; | |
var space = ""; | |
var lastComment = undefined; | |
do { | |
if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) { | |
if (!this.options.lossy) { | |
space += this.content(); | |
} | |
} else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.comment) { | |
var spaces = {}; | |
if (space) { | |
spaces.before = space; | |
space = ""; | |
} | |
lastComment = new _comment["default"]({ | |
value: this.content(), | |
source: getTokenSource(this.currToken), | |
sourceIndex: this.currToken[_tokenize.FIELDS.START_POS], | |
spaces: spaces | |
}); | |
nodes.push(lastComment); | |
} | |
} while (++this.position < stopPosition); | |
if (space) { | |
if (lastComment) { | |
lastComment.spaces.after = space; | |
} else if (!this.options.lossy) { | |
var firstToken = this.tokens[startPosition]; | |
var lastToken = this.tokens[this.position - 1]; | |
nodes.push(new _string["default"]({ | |
value: '', | |
source: getSource(firstToken[_tokenize.FIELDS.START_LINE], firstToken[_tokenize.FIELDS.START_COL], lastToken[_tokenize.FIELDS.END_LINE], lastToken[_tokenize.FIELDS.END_COL]), | |
sourceIndex: firstToken[_tokenize.FIELDS.START_POS], | |
spaces: { | |
before: space, | |
after: '' | |
} | |
})); | |
} | |
} | |
return nodes; | |
} | |
/** | |
* | |
* @param {*} nodes | |
*/; | |
_proto.convertWhitespaceNodesToSpace = function convertWhitespaceNodesToSpace(nodes, requiredSpace) { | |
var _this2 = this; | |
if (requiredSpace === void 0) { | |
requiredSpace = false; | |
} | |
var space = ""; | |
var rawSpace = ""; | |
nodes.forEach(function (n) { | |
var spaceBefore = _this2.lossySpace(n.spaces.before, requiredSpace); | |
var rawSpaceBefore = _this2.lossySpace(n.rawSpaceBefore, requiredSpace); | |
space += spaceBefore + _this2.lossySpace(n.spaces.after, requiredSpace && spaceBefore.length === 0); | |
rawSpace += spaceBefore + n.value + _this2.lossySpace(n.rawSpaceAfter, requiredSpace && rawSpaceBefore.length === 0); | |
}); | |
if (rawSpace === space) { | |
rawSpace = undefined; | |
} | |
var result = { | |
space: space, | |
rawSpace: rawSpace | |
}; | |
return result; | |
}; | |
_proto.isNamedCombinator = function isNamedCombinator(position) { | |
if (position === void 0) { | |
position = this.position; | |
} | |
return this.tokens[position + 0] && this.tokens[position + 0][_tokenize.FIELDS.TYPE] === tokens.slash && this.tokens[position + 1] && this.tokens[position + 1][_tokenize.FIELDS.TYPE] === tokens.word && this.tokens[position + 2] && this.tokens[position + 2][_tokenize.FIELDS.TYPE] === tokens.slash; | |
}; | |
_proto.namedCombinator = function namedCombinator() { | |
if (this.isNamedCombinator()) { | |
var nameRaw = this.content(this.tokens[this.position + 1]); | |
var name = (0, _util.unesc)(nameRaw).toLowerCase(); | |
var raws = {}; | |
if (name !== nameRaw) { | |
raws.value = "/" + nameRaw + "/"; | |
} | |
var node = new _combinator["default"]({ | |
value: "/" + name + "/", | |
source: getSource(this.currToken[_tokenize.FIELDS.START_LINE], this.currToken[_tokenize.FIELDS.START_COL], this.tokens[this.position + 2][_tokenize.FIELDS.END_LINE], this.tokens[this.position + 2][_tokenize.FIELDS.END_COL]), | |
sourceIndex: this.currToken[_tokenize.FIELDS.START_POS], | |
raws: raws | |
}); | |
this.position = this.position + 3; | |
return node; | |
} else { | |
this.unexpected(); | |
} | |
}; | |
_proto.combinator = function combinator() { | |
var _this3 = this; | |
if (this.content() === '|') { | |
return this.namespace(); | |
} | |
// We need to decide between a space that's a descendant combinator and meaningless whitespace at the end of a selector. | |
var nextSigTokenPos = this.locateNextMeaningfulToken(this.position); | |
if (nextSigTokenPos < 0 || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.comma || this.tokens[nextSigTokenPos][_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) { | |
var nodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos); | |
if (nodes.length > 0) { | |
var last = this.current.last; | |
if (last) { | |
var _this$convertWhitespa = this.convertWhitespaceNodesToSpace(nodes), | |
space = _this$convertWhitespa.space, | |
rawSpace = _this$convertWhitespa.rawSpace; | |
if (rawSpace !== undefined) { | |
last.rawSpaceAfter += rawSpace; | |
} | |
last.spaces.after += space; | |
} else { | |
nodes.forEach(function (n) { | |
return _this3.newNode(n); | |
}); | |
} | |
} | |
return; | |
} | |
var firstToken = this.currToken; | |
var spaceOrDescendantSelectorNodes = undefined; | |
if (nextSigTokenPos > this.position) { | |
spaceOrDescendantSelectorNodes = this.parseWhitespaceEquivalentTokens(nextSigTokenPos); | |
} | |
var node; | |
if (this.isNamedCombinator()) { | |
node = this.namedCombinator(); | |
} else if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.combinator) { | |
node = new _combinator["default"]({ | |
value: this.content(), | |
source: getTokenSource(this.currToken), | |
sourceIndex: this.currToken[_tokenize.FIELDS.START_POS] | |
}); | |
this.position++; | |
} else if (WHITESPACE_TOKENS[this.currToken[_tokenize.FIELDS.TYPE]]) ; else if (!spaceOrDescendantSelectorNodes) { | |
this.unexpected(); | |
} | |
if (node) { | |
if (spaceOrDescendantSelectorNodes) { | |
var _this$convertWhitespa2 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes), | |
_space = _this$convertWhitespa2.space, | |
_rawSpace = _this$convertWhitespa2.rawSpace; | |
node.spaces.before = _space; | |
node.rawSpaceBefore = _rawSpace; | |
} | |
} else { | |
// descendant combinator | |
var _this$convertWhitespa3 = this.convertWhitespaceNodesToSpace(spaceOrDescendantSelectorNodes, true), | |
_space2 = _this$convertWhitespa3.space, | |
_rawSpace2 = _this$convertWhitespa3.rawSpace; | |
if (!_rawSpace2) { | |
_rawSpace2 = _space2; | |
} | |
var spaces = {}; | |
var raws = { | |
spaces: {} | |
}; | |
if (_space2.endsWith(' ') && _rawSpace2.endsWith(' ')) { | |
spaces.before = _space2.slice(0, _space2.length - 1); | |
raws.spaces.before = _rawSpace2.slice(0, _rawSpace2.length - 1); | |
} else if (_space2.startsWith(' ') && _rawSpace2.startsWith(' ')) { | |
spaces.after = _space2.slice(1); | |
raws.spaces.after = _rawSpace2.slice(1); | |
} else { | |
raws.value = _rawSpace2; | |
} | |
node = new _combinator["default"]({ | |
value: ' ', | |
source: getTokenSourceSpan(firstToken, this.tokens[this.position - 1]), | |
sourceIndex: firstToken[_tokenize.FIELDS.START_POS], | |
spaces: spaces, | |
raws: raws | |
}); | |
} | |
if (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.space) { | |
node.spaces.after = this.optionalSpace(this.content()); | |
this.position++; | |
} | |
return this.newNode(node); | |
}; | |
_proto.comma = function comma() { | |
if (this.position === this.tokens.length - 1) { | |
this.root.trailingComma = true; | |
this.position++; | |
return; | |
} | |
this.current._inferEndPosition(); | |
var selector = new _selector["default"]({ | |
source: { | |
start: tokenStart(this.tokens[this.position + 1]) | |
}, | |
sourceIndex: this.tokens[this.position + 1][_tokenize.FIELDS.START_POS] | |
}); | |
this.current.parent.append(selector); | |
this.current = selector; | |
this.position++; | |
}; | |
_proto.comment = function comment() { | |
var current = this.currToken; | |
this.newNode(new _comment["default"]({ | |
value: this.content(), | |
source: getTokenSource(current), | |
sourceIndex: current[_tokenize.FIELDS.START_POS] | |
})); | |
this.position++; | |
}; | |
_proto.error = function error(message, opts) { | |
throw this.root.error(message, opts); | |
}; | |
_proto.missingBackslash = function missingBackslash() { | |
return this.error('Expected a backslash preceding the semicolon.', { | |
index: this.currToken[_tokenize.FIELDS.START_POS] | |
}); | |
}; | |
_proto.missingParenthesis = function missingParenthesis() { | |
return this.expected('opening parenthesis', this.currToken[_tokenize.FIELDS.START_POS]); | |
}; | |
_proto.missingSquareBracket = function missingSquareBracket() { | |
return this.expected('opening square bracket', this.currToken[_tokenize.FIELDS.START_POS]); | |
}; | |
_proto.unexpected = function unexpected() { | |
return this.error("Unexpected '" + this.content() + "'. Escaping special characters with \\ may help.", this.currToken[_tokenize.FIELDS.START_POS]); | |
}; | |
_proto.unexpectedPipe = function unexpectedPipe() { | |
return this.error("Unexpected '|'.", this.currToken[_tokenize.FIELDS.START_POS]); | |
}; | |
_proto.namespace = function namespace() { | |
var before = this.prevToken && this.content(this.prevToken) || true; | |
if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.word) { | |
this.position++; | |
return this.word(before); | |
} else if (this.nextToken[_tokenize.FIELDS.TYPE] === tokens.asterisk) { | |
this.position++; | |
return this.universal(before); | |
} | |
this.unexpectedPipe(); | |
}; | |
_proto.nesting = function nesting() { | |
if (this.nextToken) { | |
var nextContent = this.content(this.nextToken); | |
if (nextContent === "|") { | |
this.position++; | |
return; | |
} | |
} | |
var current = this.currToken; | |
this.newNode(new _nesting["default"]({ | |
value: this.content(), | |
source: getTokenSource(current), | |
sourceIndex: current[_tokenize.FIELDS.START_POS] | |
})); | |
this.position++; | |
}; | |
_proto.parentheses = function parentheses() { | |
var last = this.current.last; | |
var unbalanced = 1; | |
this.position++; | |
if (last && last.type === types.PSEUDO) { | |
var selector = new _selector["default"]({ | |
source: { | |
start: tokenStart(this.tokens[this.position]) | |
}, | |
sourceIndex: this.tokens[this.position][_tokenize.FIELDS.START_POS] | |
}); | |
var cache = this.current; | |
last.append(selector); | |
this.current = selector; | |
while (this.position < this.tokens.length && unbalanced) { | |
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) { | |
unbalanced++; | |
} | |
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) { | |
unbalanced--; | |
} | |
if (unbalanced) { | |
this.parse(); | |
} else { | |
this.current.source.end = tokenEnd(this.currToken); | |
this.current.parent.source.end = tokenEnd(this.currToken); | |
this.position++; | |
} | |
} | |
this.current = cache; | |
} else { | |
// I think this case should be an error. It's used to implement a basic parse of media queries | |
// but I don't think it's a good idea. | |
var parenStart = this.currToken; | |
var parenValue = "("; | |
var parenEnd; | |
while (this.position < this.tokens.length && unbalanced) { | |
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) { | |
unbalanced++; | |
} | |
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) { | |
unbalanced--; | |
} | |
parenEnd = this.currToken; | |
parenValue += this.parseParenthesisToken(this.currToken); | |
this.position++; | |
} | |
if (last) { | |
last.appendToPropertyAndEscape("value", parenValue, parenValue); | |
} else { | |
this.newNode(new _string["default"]({ | |
value: parenValue, | |
source: getSource(parenStart[_tokenize.FIELDS.START_LINE], parenStart[_tokenize.FIELDS.START_COL], parenEnd[_tokenize.FIELDS.END_LINE], parenEnd[_tokenize.FIELDS.END_COL]), | |
sourceIndex: parenStart[_tokenize.FIELDS.START_POS] | |
})); | |
} | |
} | |
if (unbalanced) { | |
return this.expected('closing parenthesis', this.currToken[_tokenize.FIELDS.START_POS]); | |
} | |
}; | |
_proto.pseudo = function pseudo() { | |
var _this4 = this; | |
var pseudoStr = ''; | |
var startingToken = this.currToken; | |
while (this.currToken && this.currToken[_tokenize.FIELDS.TYPE] === tokens.colon) { | |
pseudoStr += this.content(); | |
this.position++; | |
} | |
if (!this.currToken) { | |
return this.expected(['pseudo-class', 'pseudo-element'], this.position - 1); | |
} | |
if (this.currToken[_tokenize.FIELDS.TYPE] === tokens.word) { | |
this.splitWord(false, function (first, length) { | |
pseudoStr += first; | |
_this4.newNode(new _pseudo["default"]({ | |
value: pseudoStr, | |
source: getTokenSourceSpan(startingToken, _this4.currToken), | |
sourceIndex: startingToken[_tokenize.FIELDS.START_POS] | |
})); | |
if (length > 1 && _this4.nextToken && _this4.nextToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis) { | |
_this4.error('Misplaced parenthesis.', { | |
index: _this4.nextToken[_tokenize.FIELDS.START_POS] | |
}); | |
} | |
}); | |
} else { | |
return this.expected(['pseudo-class', 'pseudo-element'], this.currToken[_tokenize.FIELDS.START_POS]); | |
} | |
}; | |
_proto.space = function space() { | |
var content = this.content(); | |
// Handle space before and after the selector | |
if (this.position === 0 || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.prevToken[_tokenize.FIELDS.TYPE] === tokens.openParenthesis || this.current.nodes.every(function (node) { | |
return node.type === 'comment'; | |
})) { | |
this.spaces = this.optionalSpace(content); | |
this.position++; | |
} else if (this.position === this.tokens.length - 1 || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.comma || this.nextToken[_tokenize.FIELDS.TYPE] === tokens.closeParenthesis) { | |
this.current.last.spaces.after = this.optionalSpace(content); | |
this.position++; | |
} else { | |
this.combinator(); | |
} | |
}; | |
_proto.string = function string() { | |
var current = this.currToken; | |
this.newNode(new _string["default"]({ | |
value: this.content(), | |
source: getTokenSource(current), | |
sourceIndex: current[_tokenize.FIELDS.START_POS] | |
})); | |
this.position++; | |
}; | |
_proto.universal = function universal(namespace) { | |
var nextToken = this.nextToken; | |
if (nextToken && this.content(nextToken) === '|') { | |
this.position++; | |
return this.namespace(); | |
} | |
var current = this.currToken; | |
this.newNode(new _universal["default"]({ | |
value: this.content(), | |
source: getTokenSource(current), | |
sourceIndex: current[_tokenize.FIELDS.START_POS] | |
}), namespace); | |
this.position++; | |
}; | |
_proto.splitWord = function splitWord(namespace, firstCallback) { | |
var _this5 = this; | |
var nextToken = this.nextToken; | |
var word = this.content(); | |
while (nextToken && ~[tokens.dollar, tokens.caret, tokens.equals, tokens.word].indexOf(nextToken[_tokenize.FIELDS.TYPE])) { | |
this.position++; | |
var current = this.content(); | |
word += current; | |
if (current.lastIndexOf('\\') === current.length - 1) { | |
var next = this.nextToken; | |
if (next && next[_tokenize.FIELDS.TYPE] === tokens.space) { | |
word += this.requiredSpace(this.content(next)); | |
this.position++; | |
} | |
} | |
nextToken = this.nextToken; | |
} | |
var hasClass = indexesOf(word, '.').filter(function (i) { | |
// Allow escaped dot within class name | |
var escapedDot = word[i - 1] === '\\'; | |
// Allow decimal numbers percent in @keyframes | |
var isKeyframesPercent = /^\d+\.\d+%$/.test(word); | |
return !escapedDot && !isKeyframesPercent; | |
}); | |
var hasId = indexesOf(word, '#').filter(function (i) { | |
return word[i - 1] !== '\\'; | |
}); | |
// Eliminate Sass interpolations from the list of id indexes | |
var interpolations = indexesOf(word, '#{'); | |
if (interpolations.length) { | |
hasId = hasId.filter(function (hashIndex) { | |
return !~interpolations.indexOf(hashIndex); | |
}); | |
} | |
var indices = (0, _sortAscending["default"])(uniqs([0].concat(hasClass, hasId))); | |
indices.forEach(function (ind, i) { | |
var index = indices[i + 1] || word.length; | |
var value = word.slice(ind, index); | |
if (i === 0 && firstCallback) { | |
return firstCallback.call(_this5, value, indices.length); | |
} | |
var node; | |
var current = _this5.currToken; | |
var sourceIndex = current[_tokenize.FIELDS.START_POS] + indices[i]; | |
var source = getSource(current[1], current[2] + ind, current[3], current[2] + (index - 1)); | |
if (~hasClass.indexOf(ind)) { | |
var classNameOpts = { | |
value: value.slice(1), | |
source: source, | |
sourceIndex: sourceIndex | |
}; | |
node = new _className["default"](unescapeProp(classNameOpts, "value")); | |
} else if (~hasId.indexOf(ind)) { | |
var idOpts = { | |
value: value.slice(1), | |
source: source, | |
sourceIndex: sourceIndex | |
}; | |
node = new _id["default"](unescapeProp(idOpts, "value")); | |
} else { | |
var tagOpts = { | |
value: value, | |
source: source, | |
sourceIndex: sourceIndex | |
}; | |
unescapeProp(tagOpts, "value"); | |
node = new _tag["default"](tagOpts); | |
} | |
_this5.newNode(node, namespace); | |
// Ensure that the namespace is used only once | |
namespace = null; | |
}); | |
this.position++; | |
}; | |
_proto.word = function word(namespace) { | |
var nextToken = this.nextToken; | |
if (nextToken && this.content(nextToken) === '|') { | |
this.position++; | |
return this.namespace(); | |
} | |
return this.splitWord(namespace); | |
}; | |
_proto.loop = function loop() { | |
while (this.position < this.tokens.length) { | |
this.parse(true); | |
} | |
this.current._inferEndPosition(); | |
return this.root; | |
}; | |
_proto.parse = function parse(throwOnParenthesis) { | |
switch (this.currToken[_tokenize.FIELDS.TYPE]) { | |
case tokens.space: | |
this.space(); | |
break; | |
case tokens.comment: | |
this.comment(); | |
break; | |
case tokens.openParenthesis: | |
this.parentheses(); | |
break; | |
case tokens.closeParenthesis: | |
if (throwOnParenthesis) { | |
this.missingParenthesis(); | |
} | |
break; | |
case tokens.openSquare: | |
this.attribute(); | |
break; | |
case tokens.dollar: | |
case tokens.caret: | |
case tokens.equals: | |
case tokens.word: | |
this.word(); | |
break; | |
case tokens.colon: | |
this.pseudo(); | |
break; | |
case tokens.comma: | |
this.comma(); | |
break; | |
case tokens.asterisk: | |
this.universal(); | |
break; | |
case tokens.ampersand: | |
this.nesting(); | |
break; | |
case tokens.slash: | |
case tokens.combinator: | |
this.combinator(); | |
break; | |
case tokens.str: | |
this.string(); | |
break; | |
// These cases throw; no break needed. | |
case tokens.closeSquare: | |
this.missingSquareBracket(); | |
case tokens.semicolon: | |
this.missingBackslash(); | |
default: | |
this.unexpected(); | |
} | |
} | |
/** | |
* Helpers | |
*/; | |
_proto.expected = function expected(description, index, found) { | |
if (Array.isArray(description)) { | |
var last = description.pop(); | |
description = description.join(', ') + " or " + last; | |
} | |
var an = /^[aeiou]/.test(description[0]) ? 'an' : 'a'; | |
if (!found) { | |
return this.error("Expected " + an + " " + description + ".", { | |
index: index | |
}); | |
} | |
return this.error("Expected " + an + " " + description + ", found \"" + found + "\" instead.", { | |
index: index | |
}); | |
}; | |
_proto.requiredSpace = function requiredSpace(space) { | |
return this.options.lossy ? ' ' : space; | |
}; | |
_proto.optionalSpace = function optionalSpace(space) { | |
return this.options.lossy ? '' : space; | |
}; | |
_proto.lossySpace = function lossySpace(space, required) { | |
if (this.options.lossy) { | |
return required ? ' ' : ''; | |
} else { | |
return space; | |
} | |
}; | |
_proto.parseParenthesisToken = function parseParenthesisToken(token) { | |
var content = this.content(token); | |
if (token[_tokenize.FIELDS.TYPE] === tokens.space) { | |
return this.requiredSpace(content); | |
} else { | |
return content; | |
} | |
}; | |
_proto.newNode = function newNode(node, namespace) { | |
if (namespace) { | |
if (/^ +$/.test(namespace)) { | |
if (!this.options.lossy) { | |
this.spaces = (this.spaces || '') + namespace; | |
} | |
namespace = true; | |
} | |
node.namespace = namespace; | |
unescapeProp(node, "namespace"); | |
} | |
if (this.spaces) { | |
node.spaces.before = this.spaces; | |
this.spaces = ''; | |
} | |
return this.current.append(node); | |
}; | |
_proto.content = function content(token) { | |
if (token === void 0) { | |
token = this.currToken; | |
} | |
return this.css.slice(token[_tokenize.FIELDS.START_POS], token[_tokenize.FIELDS.END_POS]); | |
}; | |
/** | |
* returns the index of the next non-whitespace, non-comment token. | |
* returns -1 if no meaningful token is found. | |
*/ | |
_proto.locateNextMeaningfulToken = function locateNextMeaningfulToken(startPosition) { | |
if (startPosition === void 0) { | |
startPosition = this.position + 1; | |
} | |
var searchPosition = startPosition; | |
while (searchPosition < this.tokens.length) { | |
if (WHITESPACE_EQUIV_TOKENS[this.tokens[searchPosition][_tokenize.FIELDS.TYPE]]) { | |
searchPosition++; | |
continue; | |
} else { | |
return searchPosition; | |
} | |
} | |
return -1; | |
}; | |
_createClass(Parser, [{ | |
key: "currToken", | |
get: function get() { | |
return this.tokens[this.position]; | |
} | |
}, { | |
key: "nextToken", | |
get: function get() { | |
return this.tokens[this.position + 1]; | |
} | |
}, { | |
key: "prevToken", | |
get: function get() { | |
return this.tokens[this.position - 1]; | |
} | |
}]); | |
return Parser; | |
}(); | |
exports["default"] = Parser; | |
module.exports = exports.default; | |
} (parser, parser.exports)); | |
return parser.exports; | |
} | |
var hasRequiredProcessor; | |
function requireProcessor () { | |
if (hasRequiredProcessor) return processor.exports; | |
hasRequiredProcessor = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _parser = _interopRequireDefault(/*@__PURE__*/ requireParser()); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
var Processor = /*#__PURE__*/function () { | |
function Processor(func, options) { | |
this.func = func || function noop() {}; | |
this.funcRes = null; | |
this.options = options; | |
} | |
var _proto = Processor.prototype; | |
_proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) { | |
if (options === void 0) { | |
options = {}; | |
} | |
var merged = Object.assign({}, this.options, options); | |
if (merged.updateSelector === false) { | |
return false; | |
} else { | |
return typeof rule !== "string"; | |
} | |
}; | |
_proto._isLossy = function _isLossy(options) { | |
if (options === void 0) { | |
options = {}; | |
} | |
var merged = Object.assign({}, this.options, options); | |
if (merged.lossless === false) { | |
return true; | |
} else { | |
return false; | |
} | |
}; | |
_proto._root = function _root(rule, options) { | |
if (options === void 0) { | |
options = {}; | |
} | |
var parser = new _parser["default"](rule, this._parseOptions(options)); | |
return parser.root; | |
}; | |
_proto._parseOptions = function _parseOptions(options) { | |
return { | |
lossy: this._isLossy(options) | |
}; | |
}; | |
_proto._run = function _run(rule, options) { | |
var _this = this; | |
if (options === void 0) { | |
options = {}; | |
} | |
return new Promise(function (resolve, reject) { | |
try { | |
var root = _this._root(rule, options); | |
Promise.resolve(_this.func(root)).then(function (transform) { | |
var string = undefined; | |
if (_this._shouldUpdateSelector(rule, options)) { | |
string = root.toString(); | |
rule.selector = string; | |
} | |
return { | |
transform: transform, | |
root: root, | |
string: string | |
}; | |
}).then(resolve, reject); | |
} catch (e) { | |
reject(e); | |
return; | |
} | |
}); | |
}; | |
_proto._runSync = function _runSync(rule, options) { | |
if (options === void 0) { | |
options = {}; | |
} | |
var root = this._root(rule, options); | |
var transform = this.func(root); | |
if (transform && typeof transform.then === "function") { | |
throw new Error("Selector processor returned a promise to a synchronous call."); | |
} | |
var string = undefined; | |
if (options.updateSelector && typeof rule !== "string") { | |
string = root.toString(); | |
rule.selector = string; | |
} | |
return { | |
transform: transform, | |
root: root, | |
string: string | |
}; | |
} | |
/** | |
* Process rule into a selector AST. | |
* | |
* @param rule {postcss.Rule | string} The css selector to be processed | |
* @param options The options for processing | |
* @returns {Promise<parser.Root>} The AST of the selector after processing it. | |
*/; | |
_proto.ast = function ast(rule, options) { | |
return this._run(rule, options).then(function (result) { | |
return result.root; | |
}); | |
} | |
/** | |
* Process rule into a selector AST synchronously. | |
* | |
* @param rule {postcss.Rule | string} The css selector to be processed | |
* @param options The options for processing | |
* @returns {parser.Root} The AST of the selector after processing it. | |
*/; | |
_proto.astSync = function astSync(rule, options) { | |
return this._runSync(rule, options).root; | |
} | |
/** | |
* Process a selector into a transformed value asynchronously | |
* | |
* @param rule {postcss.Rule | string} The css selector to be processed | |
* @param options The options for processing | |
* @returns {Promise<any>} The value returned by the processor. | |
*/; | |
_proto.transform = function transform(rule, options) { | |
return this._run(rule, options).then(function (result) { | |
return result.transform; | |
}); | |
} | |
/** | |
* Process a selector into a transformed value synchronously. | |
* | |
* @param rule {postcss.Rule | string} The css selector to be processed | |
* @param options The options for processing | |
* @returns {any} The value returned by the processor. | |
*/; | |
_proto.transformSync = function transformSync(rule, options) { | |
return this._runSync(rule, options).transform; | |
} | |
/** | |
* Process a selector into a new selector string asynchronously. | |
* | |
* @param rule {postcss.Rule | string} The css selector to be processed | |
* @param options The options for processing | |
* @returns {string} the selector after processing. | |
*/; | |
_proto.process = function process(rule, options) { | |
return this._run(rule, options).then(function (result) { | |
return result.string || result.root.toString(); | |
}); | |
} | |
/** | |
* Process a selector into a new selector string synchronously. | |
* | |
* @param rule {postcss.Rule | string} The css selector to be processed | |
* @param options The options for processing | |
* @returns {string} the selector after processing. | |
*/; | |
_proto.processSync = function processSync(rule, options) { | |
var result = this._runSync(rule, options); | |
return result.string || result.root.toString(); | |
}; | |
return Processor; | |
}(); | |
exports["default"] = Processor; | |
module.exports = exports.default; | |
} (processor, processor.exports)); | |
return processor.exports; | |
} | |
var selectors = {}; | |
var constructors = {}; | |
var hasRequiredConstructors; | |
function requireConstructors () { | |
if (hasRequiredConstructors) return constructors; | |
hasRequiredConstructors = 1; | |
constructors.__esModule = true; | |
constructors.universal = constructors.tag = constructors.string = constructors.selector = constructors.root = constructors.pseudo = constructors.nesting = constructors.id = constructors.comment = constructors.combinator = constructors.className = constructors.attribute = void 0; | |
var _attribute = _interopRequireDefault(/*@__PURE__*/ requireAttribute()); | |
var _className = _interopRequireDefault(/*@__PURE__*/ requireClassName()); | |
var _combinator = _interopRequireDefault(/*@__PURE__*/ requireCombinator()); | |
var _comment = _interopRequireDefault(/*@__PURE__*/ requireComment()); | |
var _id = _interopRequireDefault(/*@__PURE__*/ requireId()); | |
var _nesting = _interopRequireDefault(/*@__PURE__*/ requireNesting()); | |
var _pseudo = _interopRequireDefault(/*@__PURE__*/ requirePseudo()); | |
var _root = _interopRequireDefault(/*@__PURE__*/ requireRoot()); | |
var _selector = _interopRequireDefault(/*@__PURE__*/ requireSelector()); | |
var _string = _interopRequireDefault(/*@__PURE__*/ requireString()); | |
var _tag = _interopRequireDefault(/*@__PURE__*/ requireTag()); | |
var _universal = _interopRequireDefault(/*@__PURE__*/ requireUniversal()); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
var attribute = function attribute(opts) { | |
return new _attribute["default"](opts); | |
}; | |
constructors.attribute = attribute; | |
var className = function className(opts) { | |
return new _className["default"](opts); | |
}; | |
constructors.className = className; | |
var combinator = function combinator(opts) { | |
return new _combinator["default"](opts); | |
}; | |
constructors.combinator = combinator; | |
var comment = function comment(opts) { | |
return new _comment["default"](opts); | |
}; | |
constructors.comment = comment; | |
var id = function id(opts) { | |
return new _id["default"](opts); | |
}; | |
constructors.id = id; | |
var nesting = function nesting(opts) { | |
return new _nesting["default"](opts); | |
}; | |
constructors.nesting = nesting; | |
var pseudo = function pseudo(opts) { | |
return new _pseudo["default"](opts); | |
}; | |
constructors.pseudo = pseudo; | |
var root = function root(opts) { | |
return new _root["default"](opts); | |
}; | |
constructors.root = root; | |
var selector = function selector(opts) { | |
return new _selector["default"](opts); | |
}; | |
constructors.selector = selector; | |
var string = function string(opts) { | |
return new _string["default"](opts); | |
}; | |
constructors.string = string; | |
var tag = function tag(opts) { | |
return new _tag["default"](opts); | |
}; | |
constructors.tag = tag; | |
var universal = function universal(opts) { | |
return new _universal["default"](opts); | |
}; | |
constructors.universal = universal; | |
return constructors; | |
} | |
var guards = {}; | |
var hasRequiredGuards; | |
function requireGuards () { | |
if (hasRequiredGuards) return guards; | |
hasRequiredGuards = 1; | |
guards.__esModule = true; | |
guards.isComment = guards.isCombinator = guards.isClassName = guards.isAttribute = void 0; | |
guards.isContainer = isContainer; | |
guards.isIdentifier = void 0; | |
guards.isNamespace = isNamespace; | |
guards.isNesting = void 0; | |
guards.isNode = isNode; | |
guards.isPseudo = void 0; | |
guards.isPseudoClass = isPseudoClass; | |
guards.isPseudoElement = isPseudoElement; | |
guards.isUniversal = guards.isTag = guards.isString = guards.isSelector = guards.isRoot = void 0; | |
var _types = /*@__PURE__*/ requireTypes(); | |
var _IS_TYPE; | |
var IS_TYPE = (_IS_TYPE = {}, _IS_TYPE[_types.ATTRIBUTE] = true, _IS_TYPE[_types.CLASS] = true, _IS_TYPE[_types.COMBINATOR] = true, _IS_TYPE[_types.COMMENT] = true, _IS_TYPE[_types.ID] = true, _IS_TYPE[_types.NESTING] = true, _IS_TYPE[_types.PSEUDO] = true, _IS_TYPE[_types.ROOT] = true, _IS_TYPE[_types.SELECTOR] = true, _IS_TYPE[_types.STRING] = true, _IS_TYPE[_types.TAG] = true, _IS_TYPE[_types.UNIVERSAL] = true, _IS_TYPE); | |
function isNode(node) { | |
return typeof node === "object" && IS_TYPE[node.type]; | |
} | |
function isNodeType(type, node) { | |
return isNode(node) && node.type === type; | |
} | |
var isAttribute = isNodeType.bind(null, _types.ATTRIBUTE); | |
guards.isAttribute = isAttribute; | |
var isClassName = isNodeType.bind(null, _types.CLASS); | |
guards.isClassName = isClassName; | |
var isCombinator = isNodeType.bind(null, _types.COMBINATOR); | |
guards.isCombinator = isCombinator; | |
var isComment = isNodeType.bind(null, _types.COMMENT); | |
guards.isComment = isComment; | |
var isIdentifier = isNodeType.bind(null, _types.ID); | |
guards.isIdentifier = isIdentifier; | |
var isNesting = isNodeType.bind(null, _types.NESTING); | |
guards.isNesting = isNesting; | |
var isPseudo = isNodeType.bind(null, _types.PSEUDO); | |
guards.isPseudo = isPseudo; | |
var isRoot = isNodeType.bind(null, _types.ROOT); | |
guards.isRoot = isRoot; | |
var isSelector = isNodeType.bind(null, _types.SELECTOR); | |
guards.isSelector = isSelector; | |
var isString = isNodeType.bind(null, _types.STRING); | |
guards.isString = isString; | |
var isTag = isNodeType.bind(null, _types.TAG); | |
guards.isTag = isTag; | |
var isUniversal = isNodeType.bind(null, _types.UNIVERSAL); | |
guards.isUniversal = isUniversal; | |
function isPseudoElement(node) { | |
return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value.toLowerCase() === ":before" || node.value.toLowerCase() === ":after" || node.value.toLowerCase() === ":first-letter" || node.value.toLowerCase() === ":first-line"); | |
} | |
function isPseudoClass(node) { | |
return isPseudo(node) && !isPseudoElement(node); | |
} | |
function isContainer(node) { | |
return !!(isNode(node) && node.walk); | |
} | |
function isNamespace(node) { | |
return isAttribute(node) || isTag(node); | |
} | |
return guards; | |
} | |
var hasRequiredSelectors; | |
function requireSelectors () { | |
if (hasRequiredSelectors) return selectors; | |
hasRequiredSelectors = 1; | |
(function (exports) { | |
exports.__esModule = true; | |
var _types = /*@__PURE__*/ requireTypes(); | |
Object.keys(_types).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (key in exports && exports[key] === _types[key]) return; | |
exports[key] = _types[key]; | |
}); | |
var _constructors = /*@__PURE__*/ requireConstructors(); | |
Object.keys(_constructors).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (key in exports && exports[key] === _constructors[key]) return; | |
exports[key] = _constructors[key]; | |
}); | |
var _guards = /*@__PURE__*/ requireGuards(); | |
Object.keys(_guards).forEach(function (key) { | |
if (key === "default" || key === "__esModule") return; | |
if (key in exports && exports[key] === _guards[key]) return; | |
exports[key] = _guards[key]; | |
}); | |
} (selectors)); | |
return selectors; | |
} | |
var hasRequiredDist; | |
function requireDist () { | |
if (hasRequiredDist) return dist.exports; | |
hasRequiredDist = 1; | |
(function (module, exports) { | |
exports.__esModule = true; | |
exports["default"] = void 0; | |
var _processor = _interopRequireDefault(/*@__PURE__*/ requireProcessor()); | |
var selectors = _interopRequireWildcard(/*@__PURE__*/ requireSelectors()); | |
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | |
function _interopRequireWildcard(obj, nodeInterop) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | |
var parser = function parser(processor) { | |
return new _processor["default"](processor); | |
}; | |
Object.assign(parser, selectors); | |
delete parser.__esModule; | |
var _default = parser; | |
exports["default"] = _default; | |
module.exports = exports.default; | |
} (dist, dist.exports)); | |
return dist.exports; | |
} | |
var parse; | |
var hasRequiredParse; | |
function requireParse () { | |
if (hasRequiredParse) return parse; | |
hasRequiredParse = 1; | |
var openParentheses = "(".charCodeAt(0); | |
var closeParentheses = ")".charCodeAt(0); | |
var singleQuote = "'".charCodeAt(0); | |
var doubleQuote = '"'.charCodeAt(0); | |
var backslash = "\\".charCodeAt(0); | |
var slash = "/".charCodeAt(0); | |
var comma = ",".charCodeAt(0); | |
var colon = ":".charCodeAt(0); | |
var star = "*".charCodeAt(0); | |
var uLower = "u".charCodeAt(0); | |
var uUpper = "U".charCodeAt(0); | |
var plus = "+".charCodeAt(0); | |
var isUnicodeRange = /^[a-f0-9?-]+$/i; | |
parse = function(input) { | |
var tokens = []; | |
var value = input; | |
var next, | |
quote, | |
prev, | |
token, | |
escape, | |
escapePos, | |
whitespacePos, | |
parenthesesOpenPos; | |
var pos = 0; | |
var code = value.charCodeAt(pos); | |
var max = value.length; | |
var stack = [{ nodes: tokens }]; | |
var balanced = 0; | |
var parent; | |
var name = ""; | |
var before = ""; | |
var after = ""; | |
while (pos < max) { | |
// Whitespaces | |
if (code <= 32) { | |
next = pos; | |
do { | |
next += 1; | |
code = value.charCodeAt(next); | |
} while (code <= 32); | |
token = value.slice(pos, next); | |
prev = tokens[tokens.length - 1]; | |
if (code === closeParentheses && balanced) { | |
after = token; | |
} else if (prev && prev.type === "div") { | |
prev.after = token; | |
prev.sourceEndIndex += token.length; | |
} else if ( | |
code === comma || | |
code === colon || | |
(code === slash && | |
value.charCodeAt(next + 1) !== star && | |
(!parent || | |
(parent && parent.type === "function" && parent.value !== "calc"))) | |
) { | |
before = token; | |
} else { | |
tokens.push({ | |
type: "space", | |
sourceIndex: pos, | |
sourceEndIndex: next, | |
value: token | |
}); | |
} | |
pos = next; | |
// Quotes | |
} else if (code === singleQuote || code === doubleQuote) { | |
next = pos; | |
quote = code === singleQuote ? "'" : '"'; | |
token = { | |
type: "string", | |
sourceIndex: pos, | |
quote: quote | |
}; | |
do { | |
escape = false; | |
next = value.indexOf(quote, next + 1); | |
if (~next) { | |
escapePos = next; | |
while (value.charCodeAt(escapePos - 1) === backslash) { | |
escapePos -= 1; | |
escape = !escape; | |
} | |
} else { | |
value += quote; | |
next = value.length - 1; | |
token.unclosed = true; | |
} | |
} while (escape); | |
token.value = value.slice(pos + 1, next); | |
token.sourceEndIndex = token.unclosed ? next : next + 1; | |
tokens.push(token); | |
pos = next + 1; | |
code = value.charCodeAt(pos); | |
// Comments | |
} else if (code === slash && value.charCodeAt(pos + 1) === star) { | |
next = value.indexOf("*/", pos); | |
token = { | |
type: "comment", | |
sourceIndex: pos, | |
sourceEndIndex: next + 2 | |
}; | |
if (next === -1) { | |
token.unclosed = true; | |
next = value.length; | |
token.sourceEndIndex = next; | |
} | |
token.value = value.slice(pos + 2, next); | |
tokens.push(token); | |
pos = next + 2; | |
code = value.charCodeAt(pos); | |
// Operation within calc | |
} else if ( | |
(code === slash || code === star) && | |
parent && | |
parent.type === "function" && | |
parent.value === "calc" | |
) { | |
token = value[pos]; | |
tokens.push({ | |
type: "word", | |
sourceIndex: pos - before.length, | |
sourceEndIndex: pos + token.length, | |
value: token | |
}); | |
pos += 1; | |
code = value.charCodeAt(pos); | |
// Dividers | |
} else if (code === slash || code === comma || code === colon) { | |
token = value[pos]; | |
tokens.push({ | |
type: "div", | |
sourceIndex: pos - before.length, | |
sourceEndIndex: pos + token.length, | |
value: token, | |
before: before, | |
after: "" | |
}); | |
before = ""; | |
pos += 1; | |
code = value.charCodeAt(pos); | |
// Open parentheses | |
} else if (openParentheses === code) { | |
// Whitespaces after open parentheses | |
next = pos; | |
do { | |
next += 1; | |
code = value.charCodeAt(next); | |
} while (code <= 32); | |
parenthesesOpenPos = pos; | |
token = { | |
type: "function", | |
sourceIndex: pos - name.length, | |
value: name, | |
before: value.slice(parenthesesOpenPos + 1, next) | |
}; | |
pos = next; | |
if (name === "url" && code !== singleQuote && code !== doubleQuote) { | |
next -= 1; | |
do { | |
escape = false; | |
next = value.indexOf(")", next + 1); | |
if (~next) { | |
escapePos = next; | |
while (value.charCodeAt(escapePos - 1) === backslash) { | |
escapePos -= 1; | |
escape = !escape; | |
} | |
} else { | |
value += ")"; | |
next = value.length - 1; | |
token.unclosed = true; | |
} | |
} while (escape); | |
// Whitespaces before closed | |
whitespacePos = next; | |
do { | |
whitespacePos -= 1; | |
code = value.charCodeAt(whitespacePos); | |
} while (code <= 32); | |
if (parenthesesOpenPos < whitespacePos) { | |
if (pos !== whitespacePos + 1) { | |
token.nodes = [ | |
{ | |
type: "word", | |
sourceIndex: pos, | |
sourceEndIndex: whitespacePos + 1, | |
value: value.slice(pos, whitespacePos + 1) | |
} | |
]; | |
} else { | |
token.nodes = []; | |
} | |
if (token.unclosed && whitespacePos + 1 !== next) { | |
token.after = ""; | |
token.nodes.push({ | |
type: "space", | |
sourceIndex: whitespacePos + 1, | |
sourceEndIndex: next, | |
value: value.slice(whitespacePos + 1, next) | |
}); | |
} else { | |
token.after = value.slice(whitespacePos + 1, next); | |
token.sourceEndIndex = next; | |
} | |
} else { | |
token.after = ""; | |
token.nodes = []; | |
} | |
pos = next + 1; | |
token.sourceEndIndex = token.unclosed ? next : pos; | |
code = value.charCodeAt(pos); | |
tokens.push(token); | |
} else { | |
balanced += 1; | |
token.after = ""; | |
token.sourceEndIndex = pos + 1; | |
tokens.push(token); | |
stack.push(token); | |
tokens = token.nodes = []; | |
parent = token; | |
} | |
name = ""; | |
// Close parentheses | |
} else if (closeParentheses === code && balanced) { | |
pos += 1; | |
code = value.charCodeAt(pos); | |
parent.after = after; | |
parent.sourceEndIndex += after.length; | |
after = ""; | |
balanced -= 1; | |
stack[stack.length - 1].sourceEndIndex = pos; | |
stack.pop(); | |
parent = stack[balanced]; | |
tokens = parent.nodes; | |
// Words | |
} else { | |
next = pos; | |
do { | |
if (code === backslash) { | |
next += 1; | |
} | |
next += 1; | |
code = value.charCodeAt(next); | |
} while ( | |
next < max && | |
!( | |
code <= 32 || | |
code === singleQuote || | |
code === doubleQuote || | |
code === comma || | |
code === colon || | |
code === slash || | |
code === openParentheses || | |
(code === star && | |
parent && | |
parent.type === "function" && | |
parent.value === "calc") || | |
(code === slash && | |
parent.type === "function" && | |
parent.value === "calc") || | |
(code === closeParentheses && balanced) | |
) | |
); | |
token = value.slice(pos, next); | |
if (openParentheses === code) { | |
name = token; | |
} else if ( | |
(uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) && | |
plus === token.charCodeAt(1) && | |
isUnicodeRange.test(token.slice(2)) | |
) { | |
tokens.push({ | |
type: "unicode-range", | |
sourceIndex: pos, | |
sourceEndIndex: next, | |
value: token | |
}); | |
} else { | |
tokens.push({ | |
type: "word", | |
sourceIndex: pos, | |
sourceEndIndex: next, | |
value: token | |
}); | |
} | |
pos = next; | |
} | |
} | |
for (pos = stack.length - 1; pos; pos -= 1) { | |
stack[pos].unclosed = true; | |
stack[pos].sourceEndIndex = value.length; | |
} | |
return stack[0].nodes; | |
}; | |
return parse; | |
} | |
var walk$1; | |
var hasRequiredWalk; | |
function requireWalk () { | |
if (hasRequiredWalk) return walk$1; | |
hasRequiredWalk = 1; | |
walk$1 = function walk(nodes, cb, bubble) { | |
var i, max, node, result; | |
for (i = 0, max = nodes.length; i < max; i += 1) { | |
node = nodes[i]; | |
if (!bubble) { | |
result = cb(node, i, nodes); | |
} | |
if ( | |
result !== false && | |
node.type === "function" && | |
Array.isArray(node.nodes) | |
) { | |
walk(node.nodes, cb, bubble); | |
} | |
if (bubble) { | |
cb(node, i, nodes); | |
} | |
} | |
}; | |
return walk$1; | |
} | |
var stringify_1; | |
var hasRequiredStringify; | |
function requireStringify () { | |
if (hasRequiredStringify) return stringify_1; | |
hasRequiredStringify = 1; | |
function stringifyNode(node, custom) { | |
var type = node.type; | |
var value = node.value; | |
var buf; | |
var customResult; | |
if (custom && (customResult = custom(node)) !== undefined) { | |
return customResult; | |
} else if (type === "word" || type === "space") { | |
return value; | |
} else if (type === "string") { | |
buf = node.quote || ""; | |
return buf + value + (node.unclosed ? "" : buf); | |
} else if (type === "comment") { | |
return "/*" + value + (node.unclosed ? "" : "*/"); | |
} else if (type === "div") { | |
return (node.before || "") + value + (node.after || ""); | |
} else if (Array.isArray(node.nodes)) { | |
buf = stringify(node.nodes, custom); | |
if (type !== "function") { | |
return buf; | |
} | |
return ( | |
value + | |
"(" + | |
(node.before || "") + | |
buf + | |
(node.after || "") + | |
(node.unclosed ? "" : ")") | |
); | |
} | |
return value; | |
} | |
function stringify(nodes, custom) { | |
var result, i; | |
if (Array.isArray(nodes)) { | |
result = ""; | |
for (i = nodes.length - 1; ~i; i -= 1) { | |
result = stringifyNode(nodes[i], custom) + result; | |
} | |
return result; | |
} | |
return stringifyNode(nodes, custom); | |
} | |
stringify_1 = stringify; | |
return stringify_1; | |
} | |
var unit; | |
var hasRequiredUnit; | |
function requireUnit () { | |
if (hasRequiredUnit) return unit; | |
hasRequiredUnit = 1; | |
var minus = "-".charCodeAt(0); | |
var plus = "+".charCodeAt(0); | |
var dot = ".".charCodeAt(0); | |
var exp = "e".charCodeAt(0); | |
var EXP = "E".charCodeAt(0); | |
// Check if three code points would start a number | |
// https://www.w3.org/TR/css-syntax-3/#starts-with-a-number | |
function likeNumber(value) { | |
var code = value.charCodeAt(0); | |
var nextCode; | |
if (code === plus || code === minus) { | |
nextCode = value.charCodeAt(1); | |
if (nextCode >= 48 && nextCode <= 57) { | |
return true; | |
} | |
var nextNextCode = value.charCodeAt(2); | |
if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) { | |
return true; | |
} | |
return false; | |
} | |
if (code === dot) { | |
nextCode = value.charCodeAt(1); | |
if (nextCode >= 48 && nextCode <= 57) { | |
return true; | |
} | |
return false; | |
} | |
if (code >= 48 && code <= 57) { | |
return true; | |
} | |
return false; | |
} | |
// Consume a number | |
// https://www.w3.org/TR/css-syntax-3/#consume-number | |
unit = function(value) { | |
var pos = 0; | |
var length = value.length; | |
var code; | |
var nextCode; | |
var nextNextCode; | |
if (length === 0 || !likeNumber(value)) { | |
return false; | |
} | |
code = value.charCodeAt(pos); | |
if (code === plus || code === minus) { | |
pos++; | |
} | |
while (pos < length) { | |
code = value.charCodeAt(pos); | |
if (code < 48 || code > 57) { | |
break; | |
} | |
pos += 1; | |
} | |
code = value.charCodeAt(pos); | |
nextCode = value.charCodeAt(pos + 1); | |
if (code === dot && nextCode >= 48 && nextCode <= 57) { | |
pos += 2; | |
while (pos < length) { | |
code = value.charCodeAt(pos); | |
if (code < 48 || code > 57) { | |
break; | |
} | |
pos += 1; | |
} | |
} | |
code = value.charCodeAt(pos); | |
nextCode = value.charCodeAt(pos + 1); | |
nextNextCode = value.charCodeAt(pos + 2); | |
if ( | |
(code === exp || code === EXP) && | |
((nextCode >= 48 && nextCode <= 57) || | |
((nextCode === plus || nextCode === minus) && | |
nextNextCode >= 48 && | |
nextNextCode <= 57)) | |
) { | |
pos += nextCode === plus || nextCode === minus ? 3 : 2; | |
while (pos < length) { | |
code = value.charCodeAt(pos); | |
if (code < 48 || code > 57) { | |
break; | |
} | |
pos += 1; | |
} | |
} | |
return { | |
number: value.slice(0, pos), | |
unit: value.slice(pos) | |
}; | |
}; | |
return unit; | |
} | |
var lib; | |
var hasRequiredLib; | |
function requireLib () { | |
if (hasRequiredLib) return lib; | |
hasRequiredLib = 1; | |
var parse = /*@__PURE__*/ requireParse(); | |
var walk = /*@__PURE__*/ requireWalk(); | |
var stringify = /*@__PURE__*/ requireStringify(); | |
function ValueParser(value) { | |
if (this instanceof ValueParser) { | |
this.nodes = parse(value); | |
return this; | |
} | |
return new ValueParser(value); | |
} | |
ValueParser.prototype.toString = function() { | |
return Array.isArray(this.nodes) ? stringify(this.nodes) : ""; | |
}; | |
ValueParser.prototype.walk = function(cb, bubble) { | |
walk(this.nodes, cb, bubble); | |
return this; | |
}; | |
ValueParser.unit = /*@__PURE__*/ requireUnit(); | |
ValueParser.walk = walk; | |
ValueParser.stringify = stringify; | |
lib = ValueParser; | |
return lib; | |
} | |
var hasRequiredSrc$2; | |
function requireSrc$2 () { | |
if (hasRequiredSrc$2) return src$2.exports; | |
hasRequiredSrc$2 = 1; | |
const selectorParser = /*@__PURE__*/ requireDist(); | |
const valueParser = /*@__PURE__*/ requireLib(); | |
const { extractICSS } = /*@__PURE__*/ requireSrc$4(); | |
const isSpacing = (node) => node.type === "combinator" && node.value === " "; | |
function normalizeNodeArray(nodes) { | |
const array = []; | |
nodes.forEach((x) => { | |
if (Array.isArray(x)) { | |
normalizeNodeArray(x).forEach((item) => { | |
array.push(item); | |
}); | |
} else if (x) { | |
array.push(x); | |
} | |
}); | |
if (array.length > 0 && isSpacing(array[array.length - 1])) { | |
array.pop(); | |
} | |
return array; | |
} | |
function localizeNode(rule, mode, localAliasMap) { | |
const transform = (node, context) => { | |
if (context.ignoreNextSpacing && !isSpacing(node)) { | |
throw new Error("Missing whitespace after " + context.ignoreNextSpacing); | |
} | |
if (context.enforceNoSpacing && isSpacing(node)) { | |
throw new Error("Missing whitespace before " + context.enforceNoSpacing); | |
} | |
let newNodes; | |
switch (node.type) { | |
case "root": { | |
let resultingGlobal; | |
context.hasPureGlobals = false; | |
newNodes = node.nodes.map((n) => { | |
const nContext = { | |
global: context.global, | |
lastWasSpacing: true, | |
hasLocals: false, | |
explicit: false, | |
}; | |
n = transform(n, nContext); | |
if (typeof resultingGlobal === "undefined") { | |
resultingGlobal = nContext.global; | |
} else if (resultingGlobal !== nContext.global) { | |
throw new Error( | |
'Inconsistent rule global/local result in rule "' + | |
node + | |
'" (multiple selectors must result in the same mode for the rule)' | |
); | |
} | |
if (!nContext.hasLocals) { | |
context.hasPureGlobals = true; | |
} | |
return n; | |
}); | |
context.global = resultingGlobal; | |
node.nodes = normalizeNodeArray(newNodes); | |
break; | |
} | |
case "selector": { | |
newNodes = node.map((childNode) => transform(childNode, context)); | |
node = node.clone(); | |
node.nodes = normalizeNodeArray(newNodes); | |
break; | |
} | |
case "combinator": { | |
if (isSpacing(node)) { | |
if (context.ignoreNextSpacing) { | |
context.ignoreNextSpacing = false; | |
context.lastWasSpacing = false; | |
context.enforceNoSpacing = false; | |
return null; | |
} | |
context.lastWasSpacing = true; | |
return node; | |
} | |
break; | |
} | |
case "pseudo": { | |
let childContext; | |
const isNested = !!node.length; | |
const isScoped = node.value === ":local" || node.value === ":global"; | |
const isImportExport = | |
node.value === ":import" || node.value === ":export"; | |
if (isImportExport) { | |
context.hasLocals = true; | |
// :local(.foo) | |
} else if (isNested) { | |
if (isScoped) { | |
if (node.nodes.length === 0) { | |
throw new Error(`${node.value}() can't be empty`); | |
} | |
if (context.inside) { | |
throw new Error( | |
`A ${node.value} is not allowed inside of a ${context.inside}(...)` | |
); | |
} | |
childContext = { | |
global: node.value === ":global", | |
inside: node.value, | |
hasLocals: false, | |
explicit: true, | |
}; | |
newNodes = node | |
.map((childNode) => transform(childNode, childContext)) | |
.reduce((acc, next) => acc.concat(next.nodes), []); | |
if (newNodes.length) { | |
const { before, after } = node.spaces; | |
const first = newNodes[0]; | |
const last = newNodes[newNodes.length - 1]; | |
first.spaces = { before, after: first.spaces.after }; | |
last.spaces = { before: last.spaces.before, after }; | |
} | |
node = newNodes; | |
break; | |
} else { | |
childContext = { | |
global: context.global, | |
inside: context.inside, | |
lastWasSpacing: true, | |
hasLocals: false, | |
explicit: context.explicit, | |
}; | |
newNodes = node.map((childNode) => { | |
const newContext = { | |
...childContext, | |
enforceNoSpacing: false, | |
}; | |
const result = transform(childNode, newContext); | |
childContext.global = newContext.global; | |
childContext.hasLocals = newContext.hasLocals; | |
return result; | |
}); | |
node = node.clone(); | |
node.nodes = normalizeNodeArray(newNodes); | |
if (childContext.hasLocals) { | |
context.hasLocals = true; | |
} | |
} | |
break; | |
//:local .foo .bar | |
} else if (isScoped) { | |
if (context.inside) { | |
throw new Error( | |
`A ${node.value} is not allowed inside of a ${context.inside}(...)` | |
); | |
} | |
const addBackSpacing = !!node.spaces.before; | |
context.ignoreNextSpacing = context.lastWasSpacing | |
? node.value | |
: false; | |
context.enforceNoSpacing = context.lastWasSpacing | |
? false | |
: node.value; | |
context.global = node.value === ":global"; | |
context.explicit = true; | |
// because this node has spacing that is lost when we remove it | |
// we make up for it by adding an extra combinator in since adding | |
// spacing on the parent selector doesn't work | |
return addBackSpacing | |
? selectorParser.combinator({ value: " " }) | |
: null; | |
} | |
break; | |
} | |
case "id": | |
case "class": { | |
if (!node.value) { | |
throw new Error("Invalid class or id selector syntax"); | |
} | |
if (context.global) { | |
break; | |
} | |
const isImportedValue = localAliasMap.has(node.value); | |
const isImportedWithExplicitScope = isImportedValue && context.explicit; | |
if (!isImportedValue || isImportedWithExplicitScope) { | |
const innerNode = node.clone(); | |
innerNode.spaces = { before: "", after: "" }; | |
node = selectorParser.pseudo({ | |
value: ":local", | |
nodes: [innerNode], | |
spaces: node.spaces, | |
}); | |
context.hasLocals = true; | |
} | |
break; | |
} | |
case "nesting": { | |
if (node.value === "&") { | |
context.hasLocals = true; | |
} | |
} | |
} | |
context.lastWasSpacing = false; | |
context.ignoreNextSpacing = false; | |
context.enforceNoSpacing = false; | |
return node; | |
}; | |
const rootContext = { | |
global: mode === "global", | |
hasPureGlobals: false, | |
}; | |
rootContext.selector = selectorParser((root) => { | |
transform(root, rootContext); | |
}).processSync(rule, { updateSelector: false, lossless: true }); | |
return rootContext; | |
} | |
function localizeDeclNode(node, context) { | |
switch (node.type) { | |
case "word": | |
if (context.localizeNextItem) { | |
if (!context.localAliasMap.has(node.value)) { | |
node.value = ":local(" + node.value + ")"; | |
context.localizeNextItem = false; | |
} | |
} | |
break; | |
case "function": | |
if ( | |
context.options && | |
context.options.rewriteUrl && | |
node.value.toLowerCase() === "url" | |
) { | |
node.nodes.map((nestedNode) => { | |
if (nestedNode.type !== "string" && nestedNode.type !== "word") { | |
return; | |
} | |
let newUrl = context.options.rewriteUrl( | |
context.global, | |
nestedNode.value | |
); | |
switch (nestedNode.type) { | |
case "string": | |
if (nestedNode.quote === "'") { | |
newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/'/g, "\\'"); | |
} | |
if (nestedNode.quote === '"') { | |
newUrl = newUrl.replace(/(\\)/g, "\\$1").replace(/"/g, '\\"'); | |
} | |
break; | |
case "word": | |
newUrl = newUrl.replace(/("|'|\)|\\)/g, "\\$1"); | |
break; | |
} | |
nestedNode.value = newUrl; | |
}); | |
} | |
break; | |
} | |
return node; | |
} | |
// `none` is special value, other is global values | |
const specialKeywords = [ | |
"none", | |
"inherit", | |
"initial", | |
"revert", | |
"revert-layer", | |
"unset", | |
]; | |
function localizeDeclarationValues(localize, declaration, context) { | |
const valueNodes = valueParser(declaration.value); | |
valueNodes.walk((node, index, nodes) => { | |
if ( | |
node.type === "function" && | |
(node.value.toLowerCase() === "var" || node.value.toLowerCase() === "env") | |
) { | |
return false; | |
} | |
if ( | |
node.type === "word" && | |
specialKeywords.includes(node.value.toLowerCase()) | |
) { | |
return; | |
} | |
const subContext = { | |
options: context.options, | |
global: context.global, | |
localizeNextItem: localize && !context.global, | |
localAliasMap: context.localAliasMap, | |
}; | |
nodes[index] = localizeDeclNode(node, subContext); | |
}); | |
declaration.value = valueNodes.toString(); | |
} | |
function localizeDeclaration(declaration, context) { | |
const isAnimation = /animation$/i.test(declaration.prop); | |
if (isAnimation) { | |
// letter | |
// An uppercase letter or a lowercase letter. | |
// | |
// ident-start code point | |
// A letter, a non-ASCII code point, or U+005F LOW LINE (_). | |
// | |
// ident code point | |
// An ident-start code point, a digit, or U+002D HYPHEN-MINUS (-). | |
// We don't validate `hex digits`, because we don't need it, it is work of linters. | |
const validIdent = | |
/^-?([a-z\u0080-\uFFFF_]|(\\[^\r\n\f])|-(?![0-9]))((\\[^\r\n\f])|[a-z\u0080-\uFFFF_0-9-])*$/i; | |
/* | |
The spec defines some keywords that you can use to describe properties such as the timing | |
function. These are still valid animation names, so as long as there is a property that accepts | |
a keyword, it is given priority. Only when all the properties that can take a keyword are | |
exhausted can the animation name be set to the keyword. I.e. | |
animation: infinite infinite; | |
The animation will repeat an infinite number of times from the first argument, and will have an | |
animation name of infinite from the second. | |
*/ | |
const animationKeywords = { | |
// animation-direction | |
$normal: 1, | |
$reverse: 1, | |
$alternate: 1, | |
"$alternate-reverse": 1, | |
// animation-fill-mode | |
$forwards: 1, | |
$backwards: 1, | |
$both: 1, | |
// animation-iteration-count | |
$infinite: 1, | |
// animation-play-state | |
$paused: 1, | |
$running: 1, | |
// animation-timing-function | |
$ease: 1, | |
"$ease-in": 1, | |
"$ease-out": 1, | |
"$ease-in-out": 1, | |
$linear: 1, | |
"$step-end": 1, | |
"$step-start": 1, | |
// Special | |
$none: Infinity, // No matter how many times you write none, it will never be an animation name | |
// Global values | |
$initial: Infinity, | |
$inherit: Infinity, | |
$unset: Infinity, | |
$revert: Infinity, | |
"$revert-layer": Infinity, | |
}; | |
let parsedAnimationKeywords = {}; | |
const valueNodes = valueParser(declaration.value).walk((node) => { | |
// If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh. | |
if (node.type === "div") { | |
parsedAnimationKeywords = {}; | |
return; | |
} | |
// Do not handle nested functions | |
else if (node.type === "function") { | |
return false; | |
} | |
// Ignore all except word | |
else if (node.type !== "word") { | |
return; | |
} | |
const value = node.type === "word" ? node.value.toLowerCase() : null; | |
let shouldParseAnimationName = false; | |
if (value && validIdent.test(value)) { | |
if ("$" + value in animationKeywords) { | |
parsedAnimationKeywords["$" + value] = | |
"$" + value in parsedAnimationKeywords | |
? parsedAnimationKeywords["$" + value] + 1 | |
: 0; | |
shouldParseAnimationName = | |
parsedAnimationKeywords["$" + value] >= | |
animationKeywords["$" + value]; | |
} else { | |
shouldParseAnimationName = true; | |
} | |
} | |
const subContext = { | |
options: context.options, | |
global: context.global, | |
localizeNextItem: shouldParseAnimationName && !context.global, | |
localAliasMap: context.localAliasMap, | |
}; | |
return localizeDeclNode(node, subContext); | |
}); | |
declaration.value = valueNodes.toString(); | |
return; | |
} | |
const isAnimationName = /animation(-name)?$/i.test(declaration.prop); | |
if (isAnimationName) { | |
return localizeDeclarationValues(true, declaration, context); | |
} | |
const hasUrl = /url\(/i.test(declaration.value); | |
if (hasUrl) { | |
return localizeDeclarationValues(false, declaration, context); | |
} | |
} | |
src$2.exports = (options = {}) => { | |
if ( | |
options && | |
options.mode && | |
options.mode !== "global" && | |
options.mode !== "local" && | |
options.mode !== "pure" | |
) { | |
throw new Error( | |
'options.mode must be either "global", "local" or "pure" (default "local")' | |
); | |
} | |
const pureMode = options && options.mode === "pure"; | |
const globalMode = options && options.mode === "global"; | |
return { | |
postcssPlugin: "postcss-modules-local-by-default", | |
prepare() { | |
const localAliasMap = new Map(); | |
return { | |
Once(root) { | |
const { icssImports } = extractICSS(root, false); | |
Object.keys(icssImports).forEach((key) => { | |
Object.keys(icssImports[key]).forEach((prop) => { | |
localAliasMap.set(prop, icssImports[key][prop]); | |
}); | |
}); | |
root.walkAtRules((atRule) => { | |
if (/keyframes$/i.test(atRule.name)) { | |
const globalMatch = /^\s*:global\s*\((.+)\)\s*$/.exec( | |
atRule.params | |
); | |
const localMatch = /^\s*:local\s*\((.+)\)\s*$/.exec( | |
atRule.params | |
); | |
let globalKeyframes = globalMode; | |
if (globalMatch) { | |
if (pureMode) { | |
throw atRule.error( | |
"@keyframes :global(...) is not allowed in pure mode" | |
); | |
} | |
atRule.params = globalMatch[1]; | |
globalKeyframes = true; | |
} else if (localMatch) { | |
atRule.params = localMatch[0]; | |
globalKeyframes = false; | |
} else if ( | |
atRule.params && | |
!globalMode && | |
!localAliasMap.has(atRule.params) | |
) { | |
atRule.params = ":local(" + atRule.params + ")"; | |
} | |
atRule.walkDecls((declaration) => { | |
localizeDeclaration(declaration, { | |
localAliasMap, | |
options: options, | |
global: globalKeyframes, | |
}); | |
}); | |
} else if (/scope$/i.test(atRule.name)) { | |
if (atRule.params) { | |
atRule.params = atRule.params | |
.split("to") | |
.map((item) => { | |
const selector = item.trim().slice(1, -1).trim(); | |
const context = localizeNode( | |
selector, | |
options.mode, | |
localAliasMap | |
); | |
context.options = options; | |
context.localAliasMap = localAliasMap; | |
if (pureMode && context.hasPureGlobals) { | |
throw atRule.error( | |
'Selector in at-rule"' + | |
selector + | |
'" is not pure ' + | |
"(pure selectors must contain at least one local class or id)" | |
); | |
} | |
return `(${context.selector})`; | |
}) | |
.join(" to "); | |
} | |
atRule.nodes.forEach((declaration) => { | |
if (declaration.type === "decl") { | |
localizeDeclaration(declaration, { | |
localAliasMap, | |
options: options, | |
global: globalMode, | |
}); | |
} | |
}); | |
} else if (atRule.nodes) { | |
atRule.nodes.forEach((declaration) => { | |
if (declaration.type === "decl") { | |
localizeDeclaration(declaration, { | |
localAliasMap, | |
options: options, | |
global: globalMode, | |
}); | |
} | |
}); | |
} | |
}); | |
root.walkRules((rule) => { | |
if ( | |
rule.parent && | |
rule.parent.type === "atrule" && | |
/keyframes$/i.test(rule.parent.name) | |
) { | |
// ignore keyframe rules | |
return; | |
} | |
const context = localizeNode(rule, options.mode, localAliasMap); | |
context.options = options; | |
context.localAliasMap = localAliasMap; | |
if (pureMode && context.hasPureGlobals) { | |
throw rule.error( | |
'Selector "' + | |
rule.selector + | |
'" is not pure ' + | |
"(pure selectors must contain at least one local class or id)" | |
); | |
} | |
rule.selector = context.selector; | |
// Less-syntax mixins parse as rules with no nodes | |
if (rule.nodes) { | |
rule.nodes.forEach((declaration) => | |
localizeDeclaration(declaration, context) | |
); | |
} | |
}); | |
}, | |
}; | |
}, | |
}; | |
}; | |
src$2.exports.postcss = true; | |
return src$2.exports; | |
} | |
var src$1; | |
var hasRequiredSrc$1; | |
function requireSrc$1 () { | |
if (hasRequiredSrc$1) return src$1; | |
hasRequiredSrc$1 = 1; | |
const selectorParser = /*@__PURE__*/ requireDist(); | |
const hasOwnProperty = Object.prototype.hasOwnProperty; | |
function isNestedRule(rule) { | |
if (!rule.parent || rule.parent.type === "root") { | |
return false; | |
} | |
if (rule.parent.type === "rule") { | |
return true; | |
} | |
return isNestedRule(rule.parent); | |
} | |
function getSingleLocalNamesForComposes(root, rule) { | |
if (isNestedRule(rule)) { | |
throw new Error(`composition is not allowed in nested rule \n\n${rule}`); | |
} | |
return root.nodes.map((node) => { | |
if (node.type !== "selector" || node.nodes.length !== 1) { | |
throw new Error( | |
`composition is only allowed when selector is single :local class name not in "${root}"` | |
); | |
} | |
node = node.nodes[0]; | |
if ( | |
node.type !== "pseudo" || | |
node.value !== ":local" || | |
node.nodes.length !== 1 | |
) { | |
throw new Error( | |
'composition is only allowed when selector is single :local class name not in "' + | |
root + | |
'", "' + | |
node + | |
'" is weird' | |
); | |
} | |
node = node.first; | |
if (node.type !== "selector" || node.length !== 1) { | |
throw new Error( | |
'composition is only allowed when selector is single :local class name not in "' + | |
root + | |
'", "' + | |
node + | |
'" is weird' | |
); | |
} | |
node = node.first; | |
if (node.type !== "class") { | |
// 'id' is not possible, because you can't compose ids | |
throw new Error( | |
'composition is only allowed when selector is single :local class name not in "' + | |
root + | |
'", "' + | |
node + | |
'" is weird' | |
); | |
} | |
return node.value; | |
}); | |
} | |
const whitespace = "[\\x20\\t\\r\\n\\f]"; | |
const unescapeRegExp = new RegExp( | |
"\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", | |
"ig" | |
); | |
function unescape(str) { | |
return str.replace(unescapeRegExp, (_, escaped, escapedWhitespace) => { | |
const high = "0x" + escaped - 0x10000; | |
// NaN means non-codepoint | |
// Workaround erroneous numeric interpretation of +"0x" | |
return high !== high || escapedWhitespace | |
? escaped | |
: high < 0 | |
? // BMP codepoint | |
String.fromCharCode(high + 0x10000) | |
: // Supplemental Plane codepoint (surrogate pair) | |
String.fromCharCode((high >> 10) | 0xd800, (high & 0x3ff) | 0xdc00); | |
}); | |
} | |
const plugin = (options = {}) => { | |
const generateScopedName = | |
(options && options.generateScopedName) || plugin.generateScopedName; | |
const generateExportEntry = | |
(options && options.generateExportEntry) || plugin.generateExportEntry; | |
const exportGlobals = options && options.exportGlobals; | |
return { | |
postcssPlugin: "postcss-modules-scope", | |
Once(root, { rule }) { | |
const exports = Object.create(null); | |
function exportScopedName(name, rawName, node) { | |
const scopedName = generateScopedName( | |
rawName ? rawName : name, | |
root.source.input.from, | |
root.source.input.css, | |
node | |
); | |
const exportEntry = generateExportEntry( | |
rawName ? rawName : name, | |
scopedName, | |
root.source.input.from, | |
root.source.input.css, | |
node | |
); | |
const { key, value } = exportEntry; | |
exports[key] = exports[key] || []; | |
if (exports[key].indexOf(value) < 0) { | |
exports[key].push(value); | |
} | |
return scopedName; | |
} | |
function localizeNode(node) { | |
switch (node.type) { | |
case "selector": | |
node.nodes = node.map((item) => localizeNode(item)); | |
return node; | |
case "class": | |
return selectorParser.className({ | |
value: exportScopedName( | |
node.value, | |
node.raws && node.raws.value ? node.raws.value : null, | |
node | |
), | |
}); | |
case "id": { | |
return selectorParser.id({ | |
value: exportScopedName( | |
node.value, | |
node.raws && node.raws.value ? node.raws.value : null, | |
node | |
), | |
}); | |
} | |
case "attribute": { | |
if (node.attribute === "class" && node.operator === "=") { | |
return selectorParser.attribute({ | |
attribute: node.attribute, | |
operator: node.operator, | |
quoteMark: "'", | |
value: exportScopedName(node.value, null, null), | |
}); | |
} | |
} | |
} | |
throw new Error( | |
`${node.type} ("${node}") is not allowed in a :local block` | |
); | |
} | |
function traverseNode(node) { | |
switch (node.type) { | |
case "pseudo": | |
if (node.value === ":local") { | |
if (node.nodes.length !== 1) { | |
throw new Error('Unexpected comma (",") in :local block'); | |
} | |
const selector = localizeNode(node.first); | |
// move the spaces that were around the pseudo selector to the first | |
// non-container node | |
selector.first.spaces = node.spaces; | |
const nextNode = node.next(); | |
if ( | |
nextNode && | |
nextNode.type === "combinator" && | |
nextNode.value === " " && | |
/\\[A-F0-9]{1,6}$/.test(selector.last.value) | |
) { | |
selector.last.spaces.after = " "; | |
} | |
node.replaceWith(selector); | |
return; | |
} | |
/* falls through */ | |
case "root": | |
case "selector": { | |
node.each((item) => traverseNode(item)); | |
break; | |
} | |
case "id": | |
case "class": | |
if (exportGlobals) { | |
exports[node.value] = [node.value]; | |
} | |
break; | |
} | |
return node; | |
} | |
// Find any :import and remember imported names | |
const importedNames = {}; | |
root.walkRules(/^:import\(.+\)$/, (rule) => { | |
rule.walkDecls((decl) => { | |
importedNames[decl.prop] = true; | |
}); | |
}); | |
// Find any :local selectors | |
root.walkRules((rule) => { | |
let parsedSelector = selectorParser().astSync(rule); | |
rule.selector = traverseNode(parsedSelector.clone()).toString(); | |
rule.walkDecls(/^(composes|compose-with)$/i, (decl) => { | |
const localNames = getSingleLocalNamesForComposes( | |
parsedSelector, | |
decl.parent | |
); | |
const multiple = decl.value.split(","); | |
multiple.forEach((value) => { | |
const classes = value.trim().split(/\s+/); | |
classes.forEach((className) => { | |
const global = /^global\(([^)]+)\)$/.exec(className); | |
if (global) { | |
localNames.forEach((exportedName) => { | |
exports[exportedName].push(global[1]); | |
}); | |
} else if (hasOwnProperty.call(importedNames, className)) { | |
localNames.forEach((exportedName) => { | |
exports[exportedName].push(className); | |
}); | |
} else if (hasOwnProperty.call(exports, className)) { | |
localNames.forEach((exportedName) => { | |
exports[className].forEach((item) => { | |
exports[exportedName].push(item); | |
}); | |
}); | |
} else { | |
throw decl.error( | |
`referenced class name "${className}" in ${decl.prop} not found` | |
); | |
} | |
}); | |
}); | |
decl.remove(); | |
}); | |
// Find any :local values | |
rule.walkDecls((decl) => { | |
if (!/:local\s*\((.+?)\)/.test(decl.value)) { | |
return; | |
} | |
let tokens = decl.value.split(/(,|'[^']*'|"[^"]*")/); | |
tokens = tokens.map((token, idx) => { | |
if (idx === 0 || tokens[idx - 1] === ",") { | |
let result = token; | |
const localMatch = /:local\s*\((.+?)\)/.exec(token); | |
if (localMatch) { | |
const input = localMatch.input; | |
const matchPattern = localMatch[0]; | |
const matchVal = localMatch[1]; | |
const newVal = exportScopedName(matchVal); | |
result = input.replace(matchPattern, newVal); | |
} else { | |
return token; | |
} | |
return result; | |
} else { | |
return token; | |
} | |
}); | |
decl.value = tokens.join(""); | |
}); | |
}); | |
// Find any :local keyframes | |
root.walkAtRules(/keyframes$/i, (atRule) => { | |
const localMatch = /^\s*:local\s*\((.+?)\)\s*$/.exec(atRule.params); | |
if (!localMatch) { | |
return; | |
} | |
atRule.params = exportScopedName(localMatch[1]); | |
}); | |
root.walkAtRules(/scope$/i, (atRule) => { | |
if (atRule.params) { | |
atRule.params = atRule.params | |
.split("to") | |
.map((item) => { | |
const selector = item.trim().slice(1, -1).trim(); | |
const localMatch = /^\s*:local\s*\((.+?)\)\s*$/.exec(selector); | |
if (!localMatch) { | |
return `(${selector})`; | |
} | |
let parsedSelector = selectorParser().astSync(selector); | |
return `(${traverseNode(parsedSelector).toString()})`; | |
}) | |
.join(" to "); | |
} | |
}); | |
// If we found any :locals, insert an :export rule | |
const exportedNames = Object.keys(exports); | |
if (exportedNames.length > 0) { | |
const exportRule = rule({ selector: ":export" }); | |
exportedNames.forEach((exportedName) => | |
exportRule.append({ | |
prop: exportedName, | |
value: exports[exportedName].join(" "), | |
raws: { before: "\n " }, | |
}) | |
); | |
root.append(exportRule); | |
} | |
}, | |
}; | |
}; | |
plugin.postcss = true; | |
plugin.generateScopedName = function (name, path) { | |
const sanitisedPath = path | |
.replace(/\.[^./\\]+$/, "") | |
.replace(/[\W_]+/g, "_") | |
.replace(/^_|_$/g, ""); | |
return `_${sanitisedPath}__${name}`.trim(); | |
}; | |
plugin.generateExportEntry = function (name, scopedName) { | |
return { | |
key: unescape(name), | |
value: unescape(scopedName), | |
}; | |
}; | |
src$1 = plugin; | |
return src$1; | |
} | |
var stringHash; | |
var hasRequiredStringHash; | |
function requireStringHash () { | |
if (hasRequiredStringHash) return stringHash; | |
hasRequiredStringHash = 1; | |
function hash(str) { | |
var hash = 5381, | |
i = str.length; | |
while(i) { | |
hash = (hash * 33) ^ str.charCodeAt(--i); | |
} | |
/* JavaScript does bitwise operations (like XOR, above) on 32-bit signed | |
* integers. Since we want the results to be always positive, convert the | |
* signed int to an unsigned by doing an unsigned bitshift. */ | |
return hash >>> 0; | |
} | |
stringHash = hash; | |
return stringHash; | |
} | |
var src = {exports: {}}; | |
var hasRequiredSrc; | |
function requireSrc () { | |
if (hasRequiredSrc) return src.exports; | |
hasRequiredSrc = 1; | |
const ICSSUtils = /*@__PURE__*/ requireSrc$4(); | |
const matchImports = /^(.+?|\([\s\S]+?\))\s+from\s+("[^"]*"|'[^']*'|[\w-]+)$/; | |
const matchValueDefinition = /(?:\s+|^)([\w-]+):?(.*?)$/; | |
const matchImport = /^([\w-]+)(?:\s+as\s+([\w-]+))?/; | |
src.exports = (options) => { | |
let importIndex = 0; | |
const createImportedName = | |
(options && options.createImportedName) || | |
((importName /*, path*/) => | |
`i__const_${importName.replace(/\W/g, "_")}_${importIndex++}`); | |
return { | |
postcssPlugin: "postcss-modules-values", | |
prepare(result) { | |
const importAliases = []; | |
const definitions = {}; | |
return { | |
Once(root, postcss) { | |
root.walkAtRules(/value/i, (atRule) => { | |
const matches = atRule.params.match(matchImports); | |
if (matches) { | |
let [, /*match*/ aliases, path] = matches; | |
// We can use constants for path names | |
if (definitions[path]) { | |
path = definitions[path]; | |
} | |
const imports = aliases | |
.replace(/^\(\s*([\s\S]+)\s*\)$/, "$1") | |
.split(/\s*,\s*/) | |
.map((alias) => { | |
const tokens = matchImport.exec(alias); | |
if (tokens) { | |
const [, /*match*/ theirName, myName = theirName] = tokens; | |
const importedName = createImportedName(myName); | |
definitions[myName] = importedName; | |
return { theirName, importedName }; | |
} else { | |
throw new Error(`@import statement "${alias}" is invalid!`); | |
} | |
}); | |
importAliases.push({ path, imports }); | |
atRule.remove(); | |
return; | |
} | |
if (atRule.params.indexOf("@value") !== -1) { | |
result.warn("Invalid value definition: " + atRule.params); | |
} | |
let [, key, value] = `${atRule.params}${atRule.raws.between}`.match( | |
matchValueDefinition | |
); | |
const normalizedValue = value.replace(/\/\*((?!\*\/).*?)\*\//g, ""); | |
if (normalizedValue.length === 0) { | |
result.warn("Invalid value definition: " + atRule.params); | |
atRule.remove(); | |
return; | |
} | |
let isOnlySpace = /^\s+$/.test(normalizedValue); | |
if (!isOnlySpace) { | |
value = value.trim(); | |
} | |
// Add to the definitions, knowing that values can refer to each other | |
definitions[key] = ICSSUtils.replaceValueSymbols( | |
value, | |
definitions | |
); | |
atRule.remove(); | |
}); | |
/* If we have no definitions, don't continue */ | |
if (!Object.keys(definitions).length) { | |
return; | |
} | |
/* Perform replacements */ | |
ICSSUtils.replaceSymbols(root, definitions); | |
/* We want to export anything defined by now, but don't add it to the CSS yet or it well get picked up by the replacement stuff */ | |
const exportDeclarations = Object.keys(definitions).map((key) => | |
postcss.decl({ | |
value: definitions[key], | |
prop: key, | |
raws: { before: "\n " }, | |
}) | |
); | |
/* Add export rules if any */ | |
if (exportDeclarations.length > 0) { | |
const exportRule = postcss.rule({ | |
selector: ":export", | |
raws: { after: "\n" }, | |
}); | |
exportRule.append(exportDeclarations); | |
root.prepend(exportRule); | |
} | |
/* Add import rules */ | |
importAliases.reverse().forEach(({ path, imports }) => { | |
const importRule = postcss.rule({ | |
selector: `:import(${path})`, | |
raws: { after: "\n" }, | |
}); | |
imports.forEach(({ theirName, importedName }) => { | |
importRule.append({ | |
value: theirName, | |
prop: importedName, | |
raws: { before: "\n " }, | |
}); | |
}); | |
root.prepend(importRule); | |
}); | |
}, | |
}; | |
}, | |
}; | |
}; | |
src.exports.postcss = true; | |
return src.exports; | |
} | |
var hasRequiredScoping; | |
function requireScoping () { | |
if (hasRequiredScoping) return scoping; | |
hasRequiredScoping = 1; | |
Object.defineProperty(scoping, "__esModule", { | |
value: true | |
}); | |
scoping.behaviours = void 0; | |
scoping.getDefaultPlugins = getDefaultPlugins; | |
scoping.getDefaultScopeBehaviour = getDefaultScopeBehaviour; | |
scoping.getScopedNameGenerator = getScopedNameGenerator; | |
var _postcssModulesExtractImports = _interopRequireDefault(/*@__PURE__*/ requireSrc$3()); | |
var _genericNames = _interopRequireDefault(/*@__PURE__*/ requireGenericNames()); | |
var _postcssModulesLocalByDefault = _interopRequireDefault(/*@__PURE__*/ requireSrc$2()); | |
var _postcssModulesScope = _interopRequireDefault(/*@__PURE__*/ requireSrc$1()); | |
var _stringHash = _interopRequireDefault(/*@__PURE__*/ requireStringHash()); | |
var _postcssModulesValues = _interopRequireDefault(/*@__PURE__*/ requireSrc()); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
const behaviours = { | |
LOCAL: "local", | |
GLOBAL: "global" | |
}; | |
scoping.behaviours = behaviours; | |
function getDefaultPlugins({ | |
behaviour, | |
generateScopedName, | |
exportGlobals | |
}) { | |
const scope = (0, _postcssModulesScope.default)({ | |
generateScopedName, | |
exportGlobals | |
}); | |
const plugins = { | |
[behaviours.LOCAL]: [_postcssModulesValues.default, (0, _postcssModulesLocalByDefault.default)({ | |
mode: "local" | |
}), _postcssModulesExtractImports.default, scope], | |
[behaviours.GLOBAL]: [_postcssModulesValues.default, (0, _postcssModulesLocalByDefault.default)({ | |
mode: "global" | |
}), _postcssModulesExtractImports.default, scope] | |
}; | |
return plugins[behaviour]; | |
} | |
function isValidBehaviour(behaviour) { | |
return Object.keys(behaviours).map(key => behaviours[key]).indexOf(behaviour) > -1; | |
} | |
function getDefaultScopeBehaviour(scopeBehaviour) { | |
return scopeBehaviour && isValidBehaviour(scopeBehaviour) ? scopeBehaviour : behaviours.LOCAL; | |
} | |
function generateScopedNameDefault(name, filename, css) { | |
const i = css.indexOf(`.${name}`); | |
const lineNumber = css.substr(0, i).split(/[\r\n]/).length; | |
const hash = (0, _stringHash.default)(css).toString(36).substr(0, 5); | |
return `_${name}_${hash}_${lineNumber}`; | |
} | |
function getScopedNameGenerator(generateScopedName, hashPrefix) { | |
const scopedNameGenerator = generateScopedName || generateScopedNameDefault; | |
if (typeof scopedNameGenerator === "function") { | |
return scopedNameGenerator; | |
} | |
return (0, _genericNames.default)(scopedNameGenerator, { | |
context: process.cwd(), | |
hashPrefix: hashPrefix | |
}); | |
} | |
return scoping; | |
} | |
var hasRequiredPluginFactory; | |
function requirePluginFactory () { | |
if (hasRequiredPluginFactory) return pluginFactory; | |
hasRequiredPluginFactory = 1; | |
Object.defineProperty(pluginFactory, "__esModule", { | |
value: true | |
}); | |
pluginFactory.makePlugin = makePlugin; | |
var _postcss = _interopRequireDefault(require$$0$1); | |
var _unquote = _interopRequireDefault(/*@__PURE__*/ requireUnquote()); | |
var _Parser = _interopRequireDefault(/*@__PURE__*/ requireParser$1()); | |
var _saveJSON = _interopRequireDefault(/*@__PURE__*/ requireSaveJSON()); | |
var _localsConvention = /*@__PURE__*/ requireLocalsConvention(); | |
var _FileSystemLoader = _interopRequireDefault(/*@__PURE__*/ requireFileSystemLoader()); | |
var _scoping = /*@__PURE__*/ requireScoping(); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
const PLUGIN_NAME = "postcss-modules"; | |
function isGlobalModule(globalModules, inputFile) { | |
return globalModules.some(regex => inputFile.match(regex)); | |
} | |
function getDefaultPluginsList(opts, inputFile) { | |
const globalModulesList = opts.globalModulePaths || null; | |
const exportGlobals = opts.exportGlobals || false; | |
const defaultBehaviour = (0, _scoping.getDefaultScopeBehaviour)(opts.scopeBehaviour); | |
const generateScopedName = (0, _scoping.getScopedNameGenerator)(opts.generateScopedName, opts.hashPrefix); | |
if (globalModulesList && isGlobalModule(globalModulesList, inputFile)) { | |
return (0, _scoping.getDefaultPlugins)({ | |
behaviour: _scoping.behaviours.GLOBAL, | |
generateScopedName, | |
exportGlobals | |
}); | |
} | |
return (0, _scoping.getDefaultPlugins)({ | |
behaviour: defaultBehaviour, | |
generateScopedName, | |
exportGlobals | |
}); | |
} | |
function getLoader(opts, plugins) { | |
const root = typeof opts.root === "undefined" ? "/" : opts.root; | |
return typeof opts.Loader === "function" ? new opts.Loader(root, plugins, opts.resolve) : new _FileSystemLoader.default(root, plugins, opts.resolve); | |
} | |
function isOurPlugin(plugin) { | |
return plugin.postcssPlugin === PLUGIN_NAME; | |
} | |
function makePlugin(opts) { | |
return { | |
postcssPlugin: PLUGIN_NAME, | |
async OnceExit(css, { | |
result | |
}) { | |
const getJSON = opts.getJSON || _saveJSON.default; | |
const inputFile = css.source.input.file; | |
const pluginList = getDefaultPluginsList(opts, inputFile); | |
const resultPluginIndex = result.processor.plugins.findIndex(plugin => isOurPlugin(plugin)); | |
if (resultPluginIndex === -1) { | |
throw new Error("Plugin missing from options."); | |
} | |
const earlierPlugins = result.processor.plugins.slice(0, resultPluginIndex); | |
const loaderPlugins = [...earlierPlugins, ...pluginList]; | |
const loader = getLoader(opts, loaderPlugins); | |
const fetcher = async (file, relativeTo, depTrace) => { | |
const unquoteFile = (0, _unquote.default)(file); | |
return loader.fetch.call(loader, unquoteFile, relativeTo, depTrace); | |
}; | |
const parser = new _Parser.default(fetcher); | |
await (0, _postcss.default)([...pluginList, parser.plugin()]).process(css, { | |
from: inputFile | |
}); | |
const out = loader.finalSource; | |
if (out) css.prepend(out); | |
if (opts.localsConvention) { | |
const reducer = (0, _localsConvention.makeLocalsConventionReducer)(opts.localsConvention, inputFile); | |
parser.exportTokens = Object.entries(parser.exportTokens).reduce(reducer, {}); | |
} | |
result.messages.push({ | |
type: "export", | |
plugin: "postcss-modules", | |
exportTokens: parser.exportTokens | |
}); // getJSON may return a promise | |
return getJSON(css.source.input.file, parser.exportTokens, result.opts.to); | |
} | |
}; | |
} | |
return pluginFactory; | |
} | |
var hasRequiredBuild; | |
function requireBuild () { | |
if (hasRequiredBuild) return build.exports; | |
hasRequiredBuild = 1; | |
var _fs = require$$0; | |
var _fs2 = /*@__PURE__*/ requireFs(); | |
var _pluginFactory = /*@__PURE__*/ requirePluginFactory(); | |
(0, _fs2.setFileSystem)({ | |
readFile: _fs.readFile, | |
writeFile: _fs.writeFile | |
}); | |
build.exports = (opts = {}) => (0, _pluginFactory.makePlugin)(opts); | |
build.exports.postcss = true; | |
return build.exports; | |
} | |
var buildExports = /*@__PURE__*/ requireBuild(); | |
var postcssModules = /*@__PURE__*/getDefaultExportFromCjs(buildExports); | |
function compileStyle(options) { | |
return doCompileStyle({ | |
...options, | |
isAsync: false | |
}); | |
} | |
function compileStyleAsync(options) { | |
return doCompileStyle({ | |
...options, | |
isAsync: true | |
}); | |
} | |
function doCompileStyle(options) { | |
const { | |
filename, | |
id, | |
scoped = false, | |
trim = true, | |
isProd = false, | |
modules = false, | |
modulesOptions = {}, | |
preprocessLang, | |
postcssOptions, | |
postcssPlugins | |
} = options; | |
const preprocessor = preprocessLang && processors[preprocessLang]; | |
const preProcessedSource = preprocessor && preprocess(options, preprocessor); | |
const map = preProcessedSource ? preProcessedSource.map : options.inMap || options.map; | |
const source = preProcessedSource ? preProcessedSource.code : options.source; | |
const shortId = id.replace(/^data-v-/, ""); | |
const longId = `data-v-${shortId}`; | |
const plugins = (postcssPlugins || []).slice(); | |
plugins.unshift(cssVarsPlugin({ id: shortId, isProd })); | |
if (trim) { | |
plugins.push(trimPlugin()); | |
} | |
if (scoped) { | |
plugins.push(scopedPlugin(longId)); | |
} | |
let cssModules; | |
if (modules) { | |
if (!options.isAsync) { | |
throw new Error( | |
"[@vue/compiler-sfc] `modules` option can only be used with compileStyleAsync()." | |
); | |
} | |
plugins.push( | |
postcssModules({ | |
...modulesOptions, | |
getJSON: (_cssFileName, json) => { | |
cssModules = json; | |
} | |
}) | |
); | |
} | |
const postCSSOptions = { | |
...postcssOptions, | |
to: filename, | |
from: filename | |
}; | |
if (map) { | |
postCSSOptions.map = { | |
inline: false, | |
annotation: false, | |
prev: map | |
}; | |
} | |
let result; | |
let code; | |
let outMap; | |
const dependencies = new Set( | |
preProcessedSource ? preProcessedSource.dependencies : [] | |
); | |
dependencies.delete(filename); | |
const errors = []; | |
if (preProcessedSource && preProcessedSource.errors.length) { | |
errors.push(...preProcessedSource.errors); | |
} | |
const recordPlainCssDependencies = (messages) => { | |
messages.forEach((msg) => { | |
if (msg.type === "dependency") { | |
dependencies.add(msg.file); | |
} | |
}); | |
return dependencies; | |
}; | |
try { | |
result = require$$0$1(plugins).process(source, postCSSOptions); | |
if (options.isAsync) { | |
return result.then((result2) => ({ | |
code: result2.css || "", | |
map: result2.map && result2.map.toJSON(), | |
errors, | |
modules: cssModules, | |
rawResult: result2, | |
dependencies: recordPlainCssDependencies(result2.messages) | |
})).catch((error) => ({ | |
code: "", | |
map: void 0, | |
errors: [...errors, error], | |
rawResult: void 0, | |
dependencies | |
})); | |
} | |
recordPlainCssDependencies(result.messages); | |
code = result.css; | |
outMap = result.map; | |
} catch (e) { | |
errors.push(e); | |
} | |
return { | |
code: code || ``, | |
map: outMap && outMap.toJSON(), | |
errors, | |
rawResult: result, | |
dependencies | |
}; | |
} | |
function preprocess(options, preprocessor) { | |
return preprocessor( | |
options.source, | |
options.inMap || options.map, | |
{ | |
filename: options.filename, | |
...options.preprocessOptions | |
}, | |
options.preprocessCustomRequire | |
); | |
} | |
const UNKNOWN_TYPE = "Unknown"; | |
function resolveObjectKey(node, computed) { | |
switch (node.type) { | |
case "StringLiteral": | |
case "NumericLiteral": | |
return String(node.value); | |
case "Identifier": | |
if (!computed) return node.name; | |
} | |
return void 0; | |
} | |
function concatStrings(strs) { | |
return strs.filter((s) => !!s).join(", "); | |
} | |
function isLiteralNode(node) { | |
return node.type.endsWith("Literal"); | |
} | |
function isCallOf(node, test) { | |
return !!(node && test && node.type === "CallExpression" && node.callee.type === "Identifier" && (typeof test === "string" ? node.callee.name === test : test(node.callee.name))); | |
} | |
function toRuntimeTypeString(types) { | |
return types.length > 1 ? `[${types.join(", ")}]` : types[0]; | |
} | |
function getImportedName(specifier) { | |
if (specifier.type === "ImportSpecifier") | |
return specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value; | |
else if (specifier.type === "ImportNamespaceSpecifier") return "*"; | |
return "default"; | |
} | |
function getId(node) { | |
return node.type === "Identifier" ? node.name : node.type === "StringLiteral" ? node.value : null; | |
} | |
const identity = (str) => str; | |
const fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g; | |
const toLowerCase = (str) => str.toLowerCase(); | |
function toFileNameLowerCase(x) { | |
return fileNameLowerCaseRegExp.test(x) ? x.replace(fileNameLowerCaseRegExp, toLowerCase) : x; | |
} | |
function createGetCanonicalFileName(useCaseSensitiveFileNames) { | |
return useCaseSensitiveFileNames ? identity : toFileNameLowerCase; | |
} | |
const normalize = (path$1.posix || path$1).normalize; | |
const windowsSlashRE = /\\/g; | |
function normalizePath(p) { | |
return normalize(p.replace(windowsSlashRE, "/")); | |
} | |
const joinPaths = (path$1.posix || path$1).join; | |
const propNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~\-]/; | |
function getEscapedPropName(key) { | |
return propNameEscapeSymbolsRE.test(key) ? JSON.stringify(key) : key; | |
} | |
function analyzeScriptBindings(ast) { | |
for (const node of ast) { | |
if (node.type === "ExportDefaultDeclaration" && node.declaration.type === "ObjectExpression") { | |
return analyzeBindingsFromOptions(node.declaration); | |
} | |
} | |
return {}; | |
} | |
function analyzeBindingsFromOptions(node) { | |
const bindings = {}; | |
Object.defineProperty(bindings, "__isScriptSetup", { | |
enumerable: false, | |
value: false | |
}); | |
for (const property of node.properties) { | |
if (property.type === "ObjectProperty" && !property.computed && property.key.type === "Identifier") { | |
if (property.key.name === "props") { | |
for (const key of getObjectOrArrayExpressionKeys(property.value)) { | |
bindings[key] = "props"; | |
} | |
} else if (property.key.name === "inject") { | |
for (const key of getObjectOrArrayExpressionKeys(property.value)) { | |
bindings[key] = "options"; | |
} | |
} else if (property.value.type === "ObjectExpression" && (property.key.name === "computed" || property.key.name === "methods")) { | |
for (const key of getObjectExpressionKeys(property.value)) { | |
bindings[key] = "options"; | |
} | |
} | |
} else if (property.type === "ObjectMethod" && property.key.type === "Identifier" && (property.key.name === "setup" || property.key.name === "data")) { | |
for (const bodyItem of property.body.body) { | |
if (bodyItem.type === "ReturnStatement" && bodyItem.argument && bodyItem.argument.type === "ObjectExpression") { | |
for (const key of getObjectExpressionKeys(bodyItem.argument)) { | |
bindings[key] = property.key.name === "setup" ? "setup-maybe-ref" : "data"; | |
} | |
} | |
} | |
} | |
} | |
return bindings; | |
} | |
function getObjectExpressionKeys(node) { | |
const keys = []; | |
for (const prop of node.properties) { | |
if (prop.type === "SpreadElement") continue; | |
const key = resolveObjectKey(prop.key, prop.computed); | |
if (key) keys.push(String(key)); | |
} | |
return keys; | |
} | |
function getArrayExpressionKeys(node) { | |
const keys = []; | |
for (const element of node.elements) { | |
if (element && element.type === "StringLiteral") { | |
keys.push(element.value); | |
} | |
} | |
return keys; | |
} | |
function getObjectOrArrayExpressionKeys(value) { | |
if (value.type === "ArrayExpression") { | |
return getArrayExpressionKeys(value); | |
} | |
if (value.type === "ObjectExpression") { | |
return getObjectExpressionKeys(value); | |
} | |
return []; | |
} | |
var _a, _b; | |
class ScriptCompileContext { | |
constructor(descriptor, options) { | |
this.descriptor = descriptor; | |
this.options = options; | |
this.isCE = false; | |
this.source = this.descriptor.source; | |
this.filename = this.descriptor.filename; | |
this.s = new MagicString(this.source); | |
this.startOffset = (_a = this.descriptor.scriptSetup) == null ? void 0 : _a.loc.start.offset; | |
this.endOffset = (_b = this.descriptor.scriptSetup) == null ? void 0 : _b.loc.end.offset; | |
this.userImports = /* @__PURE__ */ Object.create(null); | |
// macros presence check | |
this.hasDefinePropsCall = false; | |
this.hasDefineEmitCall = false; | |
this.hasDefineExposeCall = false; | |
this.hasDefaultExportName = false; | |
this.hasDefaultExportRender = false; | |
this.hasDefineOptionsCall = false; | |
this.hasDefineSlotsCall = false; | |
this.hasDefineModelCall = false; | |
this.propsDestructuredBindings = /* @__PURE__ */ Object.create(null); | |
// defineModel | |
this.modelDecls = /* @__PURE__ */ Object.create(null); | |
// codegen | |
this.bindingMetadata = {}; | |
this.helperImports = /* @__PURE__ */ new Set(); | |
const { script, scriptSetup } = descriptor; | |
const scriptLang = script && script.lang; | |
const scriptSetupLang = scriptSetup && scriptSetup.lang; | |
this.isJS = scriptLang === "js" || scriptLang === "jsx" || scriptSetupLang === "js" || scriptSetupLang === "jsx"; | |
this.isTS = scriptLang === "ts" || scriptLang === "tsx" || scriptSetupLang === "ts" || scriptSetupLang === "tsx"; | |
const customElement = options.customElement; | |
const filename = this.descriptor.filename; | |
if (customElement) { | |
this.isCE = typeof customElement === "boolean" ? customElement : customElement(filename); | |
} | |
const plugins = resolveParserPlugins( | |
scriptLang || scriptSetupLang, | |
options.babelParserPlugins | |
); | |
function parse(input, offset) { | |
try { | |
return parser$2.parse(input, { | |
plugins, | |
sourceType: "module" | |
}).program; | |
} catch (e) { | |
e.message = `[vue/compiler-sfc] ${e.message} | |
${descriptor.filename} | |
${shared.generateCodeFrame( | |
descriptor.source, | |
e.pos + offset, | |
e.pos + offset + 1 | |
)}`; | |
throw e; | |
} | |
} | |
this.scriptAst = descriptor.script && parse(descriptor.script.content, descriptor.script.loc.start.offset); | |
this.scriptSetupAst = descriptor.scriptSetup && parse(descriptor.scriptSetup.content, this.startOffset); | |
} | |
helper(key) { | |
this.helperImports.add(key); | |
return `_${key}`; | |
} | |
getString(node, scriptSetup = true) { | |
const block = scriptSetup ? this.descriptor.scriptSetup : this.descriptor.script; | |
return block.content.slice(node.start, node.end); | |
} | |
warn(msg, node, scope) { | |
warn(generateError(msg, node, this, scope)); | |
} | |
error(msg, node, scope) { | |
throw new Error( | |
`[@vue/compiler-sfc] ${generateError(msg, node, this, scope)}` | |
); | |
} | |
} | |
function generateError(msg, node, ctx, scope) { | |
const offset = scope ? scope.offset : ctx.startOffset; | |
return `${msg} | |
${(scope || ctx.descriptor).filename} | |
${shared.generateCodeFrame( | |
(scope || ctx.descriptor).source, | |
node.start + offset, | |
node.end + offset | |
)}`; | |
} | |
function resolveParserPlugins(lang, userPlugins, dts = false) { | |
const plugins = []; | |
if (!userPlugins || !userPlugins.some( | |
(p) => p === "importAssertions" || p === "importAttributes" || shared.isArray(p) && p[0] === "importAttributes" | |
)) { | |
plugins.push("importAttributes"); | |
} | |
if (lang === "jsx" || lang === "tsx" || lang === "mtsx") { | |
plugins.push("jsx"); | |
} else if (userPlugins) { | |
userPlugins = userPlugins.filter((p) => p !== "jsx"); | |
} | |
if (lang === "ts" || lang === "mts" || lang === "tsx" || lang === "mtsx") { | |
plugins.push(["typescript", { dts }], "explicitResourceManagement"); | |
if (!userPlugins || !userPlugins.includes("decorators")) { | |
plugins.push("decorators-legacy"); | |
} | |
} | |
if (userPlugins) { | |
plugins.push(...userPlugins); | |
} | |
return plugins; | |
} | |
function rewriteDefault(input, as, parserPlugins) { | |
const ast = parser$2.parse(input, { | |
sourceType: "module", | |
plugins: resolveParserPlugins("js", parserPlugins) | |
}).program.body; | |
const s = new MagicString(input); | |
rewriteDefaultAST(ast, s, as); | |
return s.toString(); | |
} | |
function rewriteDefaultAST(ast, s, as) { | |
if (!hasDefaultExport(ast)) { | |
s.append(` | |
const ${as} = {}`); | |
return; | |
} | |
ast.forEach((node) => { | |
if (node.type === "ExportDefaultDeclaration") { | |
if (node.declaration.type === "ClassDeclaration" && node.declaration.id) { | |
let start = node.declaration.decorators && node.declaration.decorators.length > 0 ? node.declaration.decorators[node.declaration.decorators.length - 1].end : node.start; | |
s.overwrite(start, node.declaration.id.start, ` class `); | |
s.append(` | |
const ${as} = ${node.declaration.id.name}`); | |
} else { | |
s.overwrite(node.start, node.declaration.start, `const ${as} = `); | |
} | |
} else if (node.type === "ExportNamedDeclaration") { | |
for (const specifier of node.specifiers) { | |
if (specifier.type === "ExportSpecifier" && specifier.exported.type === "Identifier" && specifier.exported.name === "default") { | |
if (node.source) { | |
if (specifier.local.name === "default") { | |
s.prepend( | |
`import { default as __VUE_DEFAULT__ } from '${node.source.value}' | |
` | |
); | |
const end2 = specifierEnd(s, specifier.local.end, node.end); | |
s.remove(specifier.start, end2); | |
s.append(` | |
const ${as} = __VUE_DEFAULT__`); | |
continue; | |
} else { | |
s.prepend( | |
`import { ${s.slice( | |
specifier.local.start, | |
specifier.local.end | |
)} as __VUE_DEFAULT__ } from '${node.source.value}' | |
` | |
); | |
const end2 = specifierEnd(s, specifier.exported.end, node.end); | |
s.remove(specifier.start, end2); | |
s.append(` | |
const ${as} = __VUE_DEFAULT__`); | |
continue; | |
} | |
} | |
const end = specifierEnd(s, specifier.end, node.end); | |
s.remove(specifier.start, end); | |
s.append(` | |
const ${as} = ${specifier.local.name}`); | |
} | |
} | |
} | |
}); | |
} | |
function hasDefaultExport(ast) { | |
for (const stmt of ast) { | |
if (stmt.type === "ExportDefaultDeclaration") { | |
return true; | |
} else if (stmt.type === "ExportNamedDeclaration" && stmt.specifiers.some( | |
(spec) => spec.exported.name === "default" | |
)) { | |
return true; | |
} | |
} | |
return false; | |
} | |
function specifierEnd(s, end, nodeEnd) { | |
let hasCommas = false; | |
let oldEnd = end; | |
while (end < nodeEnd) { | |
if (/\s/.test(s.slice(end, end + 1))) { | |
end++; | |
} else if (s.slice(end, end + 1) === ",") { | |
end++; | |
hasCommas = true; | |
break; | |
} else if (s.slice(end, end + 1) === "}") { | |
break; | |
} | |
} | |
return hasCommas ? end : oldEnd; | |
} | |
const normalScriptDefaultVar = `__default__`; | |
function processNormalScript(ctx, scopeId) { | |
var _a; | |
const script = ctx.descriptor.script; | |
if (script.lang && !ctx.isJS && !ctx.isTS) { | |
return script; | |
} | |
try { | |
let content = script.content; | |
let map = script.map; | |
const scriptAst = ctx.scriptAst; | |
const bindings = analyzeScriptBindings(scriptAst.body); | |
const { cssVars } = ctx.descriptor; | |
const { genDefaultAs, isProd } = ctx.options; | |
if (cssVars.length || genDefaultAs) { | |
const defaultVar = genDefaultAs || normalScriptDefaultVar; | |
const s = new MagicString(content); | |
rewriteDefaultAST(scriptAst.body, s, defaultVar); | |
content = s.toString(); | |
if (cssVars.length && !((_a = ctx.options.templateOptions) == null ? void 0 : _a.ssr)) { | |
content += genNormalScriptCssVarsCode( | |
cssVars, | |
bindings, | |
scopeId, | |
!!isProd, | |
defaultVar | |
); | |
} | |
if (!genDefaultAs) { | |
content += ` | |
export default ${defaultVar}`; | |
} | |
} | |
return { | |
...script, | |
content, | |
map, | |
bindings, | |
scriptAst: scriptAst.body | |
}; | |
} catch (e) { | |
return script; | |
} | |
} | |
var balancedMatch; | |
var hasRequiredBalancedMatch; | |
function requireBalancedMatch () { | |
if (hasRequiredBalancedMatch) return balancedMatch; | |
hasRequiredBalancedMatch = 1; | |
balancedMatch = 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 i = ai; | |
if (ai >= 0 && bi > 0) { | |
if(a===b) { | |
return [ai, bi]; | |
} | |
begs = []; | |
left = str.length; | |
while (i >= 0 && !result) { | |
if (i == ai) { | |
begs.push(i); | |
ai = str.indexOf(a, i + 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, i + 1); | |
} | |
i = ai < bi && ai >= 0 ? ai : bi; | |
} | |
if (begs.length) { | |
result = [ left, right ]; | |
} | |
} | |
return result; | |
} | |
return balancedMatch; | |
} | |
var braceExpansion; | |
var hasRequiredBraceExpansion; | |
function requireBraceExpansion () { | |
if (hasRequiredBraceExpansion) return braceExpansion; | |
hasRequiredBraceExpansion = 1; | |
var balanced = /*@__PURE__*/ requireBalancedMatch(); | |
braceExpansion = 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('.'); | |
} | |
// Basically just str.split(","), but handling cases | |
// where we have nested braced sections, which should be | |
// treated as individual members, like {a,{b,c},d} | |
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 []; | |
// I don't know why Bash 4.3 does this, but it does. | |
// Anything starting with {} will have the first two bytes preserved | |
// but *only* at the top level, so {},a}b will not expand to anything, | |
// but a{},b}c will be expanded to [a}c,abc]. | |
// One could argue that this is a bug in Bash, but since the goal of | |
// this module is to match Bash's rules, we escape a leading {} | |
if (str.substr(0, 2) === '{}') { | |
str = '\\{\\}' + str.substr(2); | |
} | |
return expand(escapeBraces(str), true).map(unescapeBraces); | |
} | |
function embrace(str) { | |
return '{' + str + '}'; | |
} | |
function isPadded(el) { | |
return /^-?0\d/.test(el); | |
} | |
function lte(i, y) { | |
return i <= y; | |
} | |
function gte(i, y) { | |
return i >= y; | |
} | |
function expand(str, isTop) { | |
var expansions = []; | |
var m = balanced('{', '}', str); | |
if (!m) return [str]; | |
// no need to expand pre, since it is guaranteed to be free of brace-sets | |
var pre = m.pre; | |
var post = m.post.length | |
? expand(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) { | |
// {a},b} | |
if (m.post.match(/,.*\}/)) { | |
str = m.pre + '{' + m.body + escClose + m.post; | |
return expand(str); | |
} | |
return [str]; | |
} | |
var n; | |
if (isSequence) { | |
n = m.body.split(/\.\./); | |
} else { | |
n = parseCommaParts(m.body); | |
if (n.length === 1) { | |
// x{{a,b}}y ==> x{a}y x{b}y | |
n = expand(n[0], false).map(embrace); | |
if (n.length === 1) { | |
return post.map(function(p) { | |
return m.pre + n[0] + p; | |
}); | |
} | |
} | |
} | |
// at this point, n is the parts, and we know it's not a comma set | |
// with a single entry. | |
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 i = x; test(i, y); i += incr) { | |
var c; | |
if (isAlphaSequence) { | |
c = String.fromCharCode(i); | |
if (c === '\\') | |
c = ''; | |
} else { | |
c = String(i); | |
if (pad) { | |
var need = width - c.length; | |
if (need > 0) { | |
var z = new Array(need + 1).join('0'); | |
if (i < 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, expand(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; | |
} | |
return braceExpansion; | |
} | |
var braceExpansionExports = /*@__PURE__*/ requireBraceExpansion(); | |
var expand = /*@__PURE__*/getDefaultExportFromCjs(braceExpansionExports); | |
const MAX_PATTERN_LENGTH = 1024 * 64; | |
const assertValidPattern = (pattern) => { | |
if (typeof pattern !== 'string') { | |
throw new TypeError('invalid pattern'); | |
} | |
if (pattern.length > MAX_PATTERN_LENGTH) { | |
throw new TypeError('pattern is too long'); | |
} | |
}; | |
// translate the various posix character classes into unicode properties | |
// this works across all unicode locales | |
// { <posix class>: [<translation>, /u flag required, negated] | |
const posixClasses = { | |
'[:alnum:]': ['\\p{L}\\p{Nl}\\p{Nd}', true], | |
'[:alpha:]': ['\\p{L}\\p{Nl}', true], | |
'[:ascii:]': ['\\x' + '00-\\x' + '7f', 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], | |
}; | |
// only need to escape a few things inside of brace expressions | |
// escapes: [ \ ] - | |
const braceEscape = (s) => s.replace(/[[\]\\-]/g, '\\$&'); | |
// escape all regexp magic characters | |
const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); | |
// everything has already been escaped, we just have to join | |
const rangesToString = (ranges) => ranges.join(''); | |
// takes a glob string at a posix brace expression, and returns | |
// an equivalent regular expression source, and boolean indicating | |
// whether the /u flag needs to be applied, and the number of chars | |
// consumed to parse the character class. | |
// This also removes out of order ranges, and returns ($.) if the | |
// entire class just no good. | |
const parseClass = (glob, position) => { | |
const pos = position; | |
/* c8 ignore start */ | |
if (glob.charAt(pos) !== '[') { | |
throw new Error('not in a brace expression'); | |
} | |
/* c8 ignore stop */ | |
const ranges = []; | |
const negs = []; | |
let i = pos + 1; | |
let sawStart = false; | |
let uflag = false; | |
let escaping = false; | |
let negate = false; | |
let endPos = pos; | |
let rangeStart = ''; | |
WHILE: while (i < glob.length) { | |
const c = glob.charAt(i); | |
if ((c === '!' || c === '^') && i === pos + 1) { | |
negate = true; | |
i++; | |
continue; | |
} | |
if (c === ']' && sawStart && !escaping) { | |
endPos = i + 1; | |
break; | |
} | |
sawStart = true; | |
if (c === '\\') { | |
if (!escaping) { | |
escaping = true; | |
i++; | |
continue; | |
} | |
// escaped \ char, fall through and treat like normal char | |
} | |
if (c === '[' && !escaping) { | |
// either a posix class, a collation equivalent, or just a [ | |
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) { | |
if (glob.startsWith(cls, i)) { | |
// invalid, [a-[] is fine, but not [a-[:alpha]] | |
if (rangeStart) { | |
return ['$.', false, glob.length - pos, true]; | |
} | |
i += cls.length; | |
if (neg) | |
negs.push(unip); | |
else | |
ranges.push(unip); | |
uflag = uflag || u; | |
continue WHILE; | |
} | |
} | |
} | |
// now it's just a normal character, effectively | |
escaping = false; | |
if (rangeStart) { | |
// throw this range away if it's not valid, but others | |
// can still match. | |
if (c > rangeStart) { | |
ranges.push(braceEscape(rangeStart) + '-' + braceEscape(c)); | |
} | |
else if (c === rangeStart) { | |
ranges.push(braceEscape(c)); | |
} | |
rangeStart = ''; | |
i++; | |
continue; | |
} | |
// now might be the start of a range. | |
// can be either c-d or c-] or c<more...>] or c] at this point | |
if (glob.startsWith('-]', i + 1)) { | |
ranges.push(braceEscape(c + '-')); | |
i += 2; | |
continue; | |
} | |
if (glob.startsWith('-', i + 1)) { | |
rangeStart = c; | |
i += 2; | |
continue; | |
} | |
// not the start of a range, just a single character | |
ranges.push(braceEscape(c)); | |
i++; | |
} | |
if (endPos < i) { | |
// didn't see the end of the class, not a valid class, | |
// but might still be valid as a literal match. | |
return ['', false, 0, false]; | |
} | |
// if we got no ranges and no negates, then we have a range that | |
// cannot possibly match anything, and that poisons the whole glob | |
if (!ranges.length && !negs.length) { | |
return ['$.', false, glob.length - pos, true]; | |
} | |
// if we got one positive range, and it's a single character, then that's | |
// not actually a magic pattern, it's just that one literal character. | |
// we should not treat that as "magic", we should just return the literal | |
// character. [_] is a perfectly valid way to escape glob magic chars. | |
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]; | |
}; | |
/** | |
* Un-escape a string that has been escaped with {@link escape}. | |
* | |
* If the {@link windowsPathsNoEscape} option is used, then square-brace | |
* escapes are removed, but not backslash escapes. For example, it will turn | |
* the string `'[*]'` into `*`, but it will not turn `'\\*'` into `'*'`, | |
* becuase `\` is a path separator in `windowsPathsNoEscape` mode. | |
* | |
* When `windowsPathsNoEscape` is not set, then both brace escapes and | |
* backslash escapes are removed. | |
* | |
* Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped | |
* or unescaped. | |
*/ | |
const unescape = (s, { windowsPathsNoEscape = false, } = {}) => { | |
return windowsPathsNoEscape | |
? s.replace(/\[([^\/\\])\]/g, '$1') | |
: s.replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2').replace(/\\([^\/])/g, '$1'); | |
}; | |
// parse a single path portion | |
const types = new Set(['!', '?', '+', '*', '@']); | |
const isExtglobType = (c) => types.has(c); | |
// Patterns that get prepended to bind to the start of either the | |
// entire string, or just a single path portion, to prevent dots | |
// and/or traversal patterns, when needed. | |
// Exts don't need the ^ or / bit, because the root binds that already. | |
const startNoTraversal = '(?!(?:^|/)\\.\\.?(?:$|/))'; | |
const startNoDot = '(?!\\.)'; | |
// characters that indicate a start of pattern needs the "no dots" bit, | |
// because a dot *might* be matched. ( is not in the list, because in | |
// the case of a child extglob, it will handle the prevention itself. | |
const addPatternStart = new Set(['[', '.']); | |
// cases where traversal is A-OK, no dot prevention needed | |
const justDots = new Set(['..', '.']); | |
const reSpecials = new Set('().*{}+?[]^$\\!'); | |
const regExpEscape$1 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); | |
// any single thing other than / | |
const qmark$1 = '[^/]'; | |
// * => any number of characters | |
const star$1 = qmark$1 + '*?'; | |
// use + when we need to ensure that *something* matches, because the * is | |
// the only thing in the path portion. | |
const starNoEmpty = qmark$1 + '+?'; | |
// remove the \ chars that we added if we end up doing a nonmagic compare | |
// const deslash = (s: string) => s.replace(/\\(.)/g, '$1') | |
class AST { | |
type; | |
#root; | |
#hasMagic; | |
#uflag = false; | |
#parts = []; | |
#parent; | |
#parentIndex; | |
#negs; | |
#filledNegs = false; | |
#options; | |
#toString; | |
// set to true if it's an extglob with no children | |
// (which really means one child of '') | |
#emptyExt = false; | |
constructor(type, parent, options = {}) { | |
this.type = type; | |
// extglobs are inherently magical | |
if (type) | |
this.#hasMagic = true; | |
this.#parent = parent; | |
this.#root = this.#parent ? this.#parent.#root : this; | |
this.#options = this.#root === this ? options : this.#root.#options; | |
this.#negs = this.#root === this ? [] : this.#root.#negs; | |
if (type === '!' && !this.#root.#filledNegs) | |
this.#negs.push(this); | |
this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0; | |
} | |
get hasMagic() { | |
/* c8 ignore start */ | |
if (this.#hasMagic !== undefined) | |
return this.#hasMagic; | |
/* c8 ignore stop */ | |
for (const p of this.#parts) { | |
if (typeof p === 'string') | |
continue; | |
if (p.type || p.hasMagic) | |
return (this.#hasMagic = true); | |
} | |
// note: will be undefined until we generate the regexp src and find out | |
return this.#hasMagic; | |
} | |
// reconstructs the pattern | |
toString() { | |
if (this.#toString !== undefined) | |
return this.#toString; | |
if (!this.type) { | |
return (this.#toString = this.#parts.map(p => String(p)).join('')); | |
} | |
else { | |
return (this.#toString = | |
this.type + '(' + this.#parts.map(p => String(p)).join('|') + ')'); | |
} | |
} | |
#fillNegs() { | |
/* c8 ignore start */ | |
if (this !== this.#root) | |
throw new Error('should only call on root'); | |
if (this.#filledNegs) | |
return this; | |
/* c8 ignore stop */ | |
// call toString() once to fill this out | |
this.toString(); | |
this.#filledNegs = true; | |
let n; | |
while ((n = this.#negs.pop())) { | |
if (n.type !== '!') | |
continue; | |
// walk up the tree, appending everthing that comes AFTER parentIndex | |
let p = n; | |
let pp = p.#parent; | |
while (pp) { | |
for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) { | |
for (const part of n.#parts) { | |
/* c8 ignore start */ | |
if (typeof part === 'string') { | |
throw new Error('string part in extglob AST??'); | |
} | |
/* c8 ignore stop */ | |
part.copyIn(pp.#parts[i]); | |
} | |
} | |
p = pp; | |
pp = p.#parent; | |
} | |
} | |
return this; | |
} | |
push(...parts) { | |
for (const p of parts) { | |
if (p === '') | |
continue; | |
/* c8 ignore start */ | |
if (typeof p !== 'string' && !(p instanceof AST && p.#parent === this)) { | |
throw new Error('invalid part: ' + p); | |
} | |
/* c8 ignore stop */ | |
this.#parts.push(p); | |
} | |
} | |
toJSON() { | |
const ret = this.type === null | |
? this.#parts.slice().map(p => (typeof p === 'string' ? p : p.toJSON())) | |
: [this.type, ...this.#parts.map(p => p.toJSON())]; | |
if (this.isStart() && !this.type) | |
ret.unshift([]); | |
if (this.isEnd() && | |
(this === this.#root || | |
(this.#root.#filledNegs && this.#parent?.type === '!'))) { | |
ret.push({}); | |
} | |
return ret; | |
} | |
isStart() { | |
if (this.#root === this) | |
return true; | |
// if (this.type) return !!this.#parent?.isStart() | |
if (!this.#parent?.isStart()) | |
return false; | |
if (this.#parentIndex === 0) | |
return true; | |
// if everything AHEAD of this is a negation, then it's still the "start" | |
const p = this.#parent; | |
for (let i = 0; i < this.#parentIndex; i++) { | |
const pp = p.#parts[i]; | |
if (!(pp instanceof AST && pp.type === '!')) { | |
return false; | |
} | |
} | |
return true; | |
} | |
isEnd() { | |
if (this.#root === this) | |
return true; | |
if (this.#parent?.type === '!') | |
return true; | |
if (!this.#parent?.isEnd()) | |
return false; | |
if (!this.type) | |
return this.#parent?.isEnd(); | |
// if not root, it'll always have a parent | |
/* c8 ignore start */ | |
const pl = this.#parent ? this.#parent.#parts.length : 0; | |
/* c8 ignore stop */ | |
return 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 this.#parts) { | |
c.copyIn(p); | |
} | |
return c; | |
} | |
static #parseAST(str, ast, pos, opt) { | |
let escaping = false; | |
let inBrace = false; | |
let braceStart = -1; | |
let braceNeg = false; | |
if (ast.type === null) { | |
// outside of a extglob, append until we find a start | |
let i = pos; | |
let acc = ''; | |
while (i < str.length) { | |
const c = str.charAt(i++); | |
// still accumulate escapes at this point, but we do ignore | |
// starts that are escaped | |
if (escaping || c === '\\') { | |
escaping = !escaping; | |
acc += c; | |
continue; | |
} | |
if (inBrace) { | |
if (i === braceStart + 1) { | |
if (c === '^' || c === '!') { | |
braceNeg = true; | |
} | |
} | |
else if (c === ']' && !(i === braceStart + 2 && braceNeg)) { | |
inBrace = false; | |
} | |
acc += c; | |
continue; | |
} | |
else if (c === '[') { | |
inBrace = true; | |
braceStart = i; | |
braceNeg = false; | |
acc += c; | |
continue; | |
} | |
if (!opt.noext && isExtglobType(c) && str.charAt(i) === '(') { | |
ast.push(acc); | |
acc = ''; | |
const ext = new AST(c, ast); | |
i = AST.#parseAST(str, ext, i, opt); | |
ast.push(ext); | |
continue; | |
} | |
acc += c; | |
} | |
ast.push(acc); | |
return i; | |
} | |
// some kind of extglob, pos is at the ( | |
// find the next | or ) | |
let i = pos + 1; | |
let part = new AST(null, ast); | |
const parts = []; | |
let acc = ''; | |
while (i < str.length) { | |
const c = str.charAt(i++); | |
// still accumulate escapes at this point, but we do ignore | |
// starts that are escaped | |
if (escaping || c === '\\') { | |
escaping = !escaping; | |
acc += c; | |
continue; | |
} | |
if (inBrace) { | |
if (i === braceStart + 1) { | |
if (c === '^' || c === '!') { | |
braceNeg = true; | |
} | |
} | |
else if (c === ']' && !(i === braceStart + 2 && braceNeg)) { | |
inBrace = false; | |
} | |
acc += c; | |
continue; | |
} | |
else if (c === '[') { | |
inBrace = true; | |
braceStart = i; | |
braceNeg = false; | |
acc += c; | |
continue; | |
} | |
if (isExtglobType(c) && str.charAt(i) === '(') { | |
part.push(acc); | |
acc = ''; | |
const ext = new AST(c, part); | |
part.push(ext); | |
i = AST.#parseAST(str, ext, i, opt); | |
continue; | |
} | |
if (c === '|') { | |
part.push(acc); | |
acc = ''; | |
parts.push(part); | |
part = new AST(null, ast); | |
continue; | |
} | |
if (c === ')') { | |
if (acc === '' && ast.#parts.length === 0) { | |
ast.#emptyExt = true; | |
} | |
part.push(acc); | |
acc = ''; | |
ast.push(...parts, part); | |
return i; | |
} | |
acc += c; | |
} | |
// unfinished extglob | |
// if we got here, it was a malformed extglob! not an extglob, but | |
// maybe something else in there. | |
ast.type = null; | |
ast.#hasMagic = undefined; | |
ast.#parts = [str.substring(pos - 1)]; | |
return i; | |
} | |
static fromGlob(pattern, options = {}) { | |
const ast = new AST(null, undefined, options); | |
AST.#parseAST(pattern, ast, 0, options); | |
return ast; | |
} | |
// returns the regular expression if there's magic, or the unescaped | |
// string if not. | |
toMMPattern() { | |
// should only be called on root | |
/* c8 ignore start */ | |
if (this !== this.#root) | |
return this.#root.toMMPattern(); | |
/* c8 ignore stop */ | |
const glob = this.toString(); | |
const [re, body, hasMagic, uflag] = this.toRegExpSource(); | |
// if we're in nocase mode, and not nocaseMagicOnly, then we do | |
// still need a regular expression if we have to case-insensitively | |
// match capital/lowercase characters. | |
const anyMagic = hasMagic || | |
this.#hasMagic || | |
(this.#options.nocase && | |
!this.#options.nocaseMagicOnly && | |
glob.toUpperCase() !== glob.toLowerCase()); | |
if (!anyMagic) { | |
return body; | |
} | |
const flags = (this.#options.nocase ? 'i' : '') + (uflag ? 'u' : ''); | |
return Object.assign(new RegExp(`^${re}$`, flags), { | |
_src: re, | |
_glob: glob, | |
}); | |
} | |
get options() { | |
return 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) { | |
const dot = allowDot ?? !!this.#options.dot; | |
if (this.#root === this) | |
this.#fillNegs(); | |
if (!this.type) { | |
const noEmpty = this.isStart() && this.isEnd(); | |
const src = this.#parts | |
.map(p => { | |
const [re, _, hasMagic, uflag] = typeof p === 'string' | |
? AST.#parseGlob(p, this.#hasMagic, noEmpty) | |
: p.toRegExpSource(allowDot); | |
this.#hasMagic = this.#hasMagic || hasMagic; | |
this.#uflag = this.#uflag || uflag; | |
return re; | |
}) | |
.join(''); | |
let start = ''; | |
if (this.isStart()) { | |
if (typeof this.#parts[0] === 'string') { | |
// this is the string that will match the start of the pattern, | |
// so we need to protect against dots and such. | |
// '.' and '..' cannot match unless the pattern is that exactly, | |
// even if it starts with . or dot:true is set. | |
const dotTravAllowed = this.#parts.length === 1 && justDots.has(this.#parts[0]); | |
if (!dotTravAllowed) { | |
const aps = addPatternStart; | |
// check if we have a possibility of matching . or .., | |
// and prevent that. | |
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))); | |
// no need to prevent dots if it can't match a dot, or if a | |
// sub-pattern will be preventing it anyway. | |
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0)); | |
start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : ''; | |
} | |
} | |
} | |
// append the "end of path portion" pattern to negation tails | |
let end = ''; | |
if (this.isEnd() && | |
this.#root.#filledNegs && | |
this.#parent?.type === '!') { | |
end = '(?:$|\\/)'; | |
} | |
const final = start + src + end; | |
return [ | |
final, | |
unescape(src), | |
(this.#hasMagic = !!this.#hasMagic), | |
this.#uflag, | |
]; | |
} | |
// We need to calculate the body *twice* if it's a repeat pattern | |
// at the start, once in nodot mode, then again in dot mode, so a | |
// pattern like *(?) can match 'x.y' | |
const repeated = this.type === '*' || this.type === '+'; | |
// some kind of extglob | |
const start = this.type === '!' ? '(?:(?!(?:' : '(?:'; | |
let body = this.#partsToRegExp(dot); | |
if (this.isStart() && this.isEnd() && !body && this.type !== '!') { | |
// invalid extglob, has to at least be *something* present, if it's | |
// the entire path portion. | |
const s = this.toString(); | |
this.#parts = [s]; | |
this.type = null; | |
this.#hasMagic = undefined; | |
return [s, unescape(this.toString()), false, false]; | |
} | |
// XXX abstract out this map method | |
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot | |
? '' | |
: this.#partsToRegExp(true); | |
if (bodyDotAllowed === body) { | |
bodyDotAllowed = ''; | |
} | |
if (bodyDotAllowed) { | |
body = `(?:${body})(?:${bodyDotAllowed})*?`; | |
} | |
// an empty !() is exactly equivalent to a starNoEmpty | |
let final = ''; | |
if (this.type === '!' && 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$1 + | |
')' | |
: this.type === '@' | |
? ')' | |
: this.type === '?' | |
? ')?' | |
: this.type === '+' && bodyDotAllowed | |
? ')' | |
: this.type === '*' && bodyDotAllowed | |
? `)?` | |
: `)${this.type}`; | |
final = start + body + close; | |
} | |
return [ | |
final, | |
unescape(body), | |
(this.#hasMagic = !!this.#hasMagic), | |
this.#uflag, | |
]; | |
} | |
#partsToRegExp(dot) { | |
return this.#parts | |
.map(p => { | |
// extglob ASTs should only contain parent ASTs | |
/* c8 ignore start */ | |
if (typeof p === 'string') { | |
throw new Error('string type in extglob ast??'); | |
} | |
/* c8 ignore stop */ | |
// can ignore hasMagic, because extglobs are already always magic | |
const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot); | |
this.#uflag = this.#uflag || uflag; | |
return re; | |
}) | |
.filter(p => !(this.isStart() && this.isEnd()) || !!p) | |
.join('|'); | |
} | |
static #parseGlob(glob, hasMagic, noEmpty = false) { | |
let escaping = false; | |
let re = ''; | |
let uflag = false; | |
for (let i = 0; i < glob.length; i++) { | |
const c = glob.charAt(i); | |
if (escaping) { | |
escaping = false; | |
re += (reSpecials.has(c) ? '\\' : '') + c; | |
continue; | |
} | |
if (c === '\\') { | |
if (i === glob.length - 1) { | |
re += '\\\\'; | |
} | |
else { | |
escaping = true; | |
} | |
continue; | |
} | |
if (c === '[') { | |
const [src, needUflag, consumed, magic] = parseClass(glob, i); | |
if (consumed) { | |
re += src; | |
uflag = uflag || needUflag; | |
i += consumed - 1; | |
hasMagic = hasMagic || magic; | |
continue; | |
} | |
} | |
if (c === '*') { | |
if (noEmpty && glob === '*') | |
re += starNoEmpty; | |
else | |
re += star$1; | |
hasMagic = true; | |
continue; | |
} | |
if (c === '?') { | |
re += qmark$1; | |
hasMagic = true; | |
continue; | |
} | |
re += regExpEscape$1(c); | |
} | |
return [re, unescape(glob), !!hasMagic, uflag]; | |
} | |
} | |
/** | |
* Escape all magic characters in a glob pattern. | |
* | |
* If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape} | |
* option is used, then characters are escaped by wrapping in `[]`, because | |
* a magic character wrapped in a character class can only be satisfied by | |
* that exact character. In this mode, `\` is _not_ escaped, because it is | |
* not interpreted as a magic character, but instead as a path separator. | |
*/ | |
const escape = (s, { windowsPathsNoEscape = false, } = {}) => { | |
// don't need to escape +@! because we escape the parens | |
// that make those magic, and escaping ! as [!] isn't valid, | |
// because [!]] is a valid glob class meaning not ']'. | |
return windowsPathsNoEscape | |
? s.replace(/[?*()[\]]/g, '[$&]') | |
: s.replace(/[?*()[\]\\]/g, '\\$&'); | |
}; | |
const minimatch = (p, pattern, options = {}) => { | |
assertValidPattern(pattern); | |
// shortcut: comments match nothing. | |
if (!options.nocomment && pattern.charAt(0) === '#') { | |
return false; | |
} | |
return new Minimatch(pattern, options).match(p); | |
}; | |
// Optimized checking for the most common glob patterns. | |
const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/; | |
const starDotExtTest = (ext) => (f) => !f.startsWith('.') && f.endsWith(ext); | |
const starDotExtTestDot = (ext) => (f) => f.endsWith(ext); | |
const starDotExtTestNocase = (ext) => { | |
ext = ext.toLowerCase(); | |
return (f) => !f.startsWith('.') && f.toLowerCase().endsWith(ext); | |
}; | |
const starDotExtTestNocaseDot = (ext) => { | |
ext = ext.toLowerCase(); | |
return (f) => f.toLowerCase().endsWith(ext); | |
}; | |
const starDotStarRE = /^\*+\.\*+$/; | |
const starDotStarTest = (f) => !f.startsWith('.') && f.includes('.'); | |
const starDotStarTestDot = (f) => f !== '.' && f !== '..' && f.includes('.'); | |
const dotStarRE = /^\.\*+$/; | |
const dotStarTest = (f) => f !== '.' && f !== '..' && f.startsWith('.'); | |
const starRE = /^\*+$/; | |
const starTest = (f) => f.length !== 0 && !f.startsWith('.'); | |
const starTestDot = (f) => f.length !== 0 && f !== '.' && f !== '..'; | |
const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/; | |
const qmarksTestNocase = ([$0, ext = '']) => { | |
const noext = qmarksTestNoExt([$0]); | |
if (!ext) | |
return noext; | |
ext = ext.toLowerCase(); | |
return (f) => noext(f) && f.toLowerCase().endsWith(ext); | |
}; | |
const qmarksTestNocaseDot = ([$0, ext = '']) => { | |
const noext = qmarksTestNoExtDot([$0]); | |
if (!ext) | |
return noext; | |
ext = ext.toLowerCase(); | |
return (f) => noext(f) && f.toLowerCase().endsWith(ext); | |
}; | |
const qmarksTestDot = ([$0, ext = '']) => { | |
const noext = qmarksTestNoExtDot([$0]); | |
return !ext ? noext : (f) => noext(f) && f.endsWith(ext); | |
}; | |
const qmarksTest = ([$0, ext = '']) => { | |
const noext = qmarksTestNoExt([$0]); | |
return !ext ? noext : (f) => noext(f) && f.endsWith(ext); | |
}; | |
const qmarksTestNoExt = ([$0]) => { | |
const len = $0.length; | |
return (f) => f.length === len && !f.startsWith('.'); | |
}; | |
const qmarksTestNoExtDot = ([$0]) => { | |
const len = $0.length; | |
return (f) => f.length === len && f !== '.' && f !== '..'; | |
}; | |
/* c8 ignore start */ | |
const defaultPlatform = (typeof process === 'object' && process | |
? (typeof process.env === 'object' && | |
process.env && | |
process.env.__MINIMATCH_TESTING_PLATFORM__) || | |
process.platform | |
: 'posix'); | |
const path = { | |
win32: { sep: '\\' }, | |
posix: { sep: '/' }, | |
}; | |
/* c8 ignore stop */ | |
const sep = defaultPlatform === 'win32' ? path.win32.sep : path.posix.sep; | |
minimatch.sep = sep; | |
const GLOBSTAR = Symbol('globstar **'); | |
minimatch.GLOBSTAR = GLOBSTAR; | |
// any single thing other than / | |
// don't need to escape / when using new RegExp() | |
const qmark = '[^/]'; | |
// * => any number of characters | |
const star = qmark + '*?'; | |
// ** when dots are allowed. Anything goes, except .. and . | |
// not (^ or / followed by one or two dots followed by $ or /), | |
// followed by anything, any number of times. | |
const twoStarDot = '(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?'; | |
// not a ^ or / followed by a dot, | |
// followed by anything, any number of times. | |
const twoStarNoDot = '(?:(?!(?:\\/|^)\\.).)*?'; | |
const filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options); | |
minimatch.filter = filter; | |
const ext = (a, b = {}) => Object.assign({}, a, b); | |
const 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: GLOBSTAR, | |
}); | |
}; | |
minimatch.defaults = defaults; | |
// Brace expansion: | |
// a{b,c}d -> abd acd | |
// a{b,}c -> abc ac | |
// a{0..3}d -> a0d a1d a2d a3d | |
// a{b,c{d,e}f}g -> abg acdfg acefg | |
// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg | |
// | |
// Invalid sets are not expanded. | |
// a{2..}b -> a{2..}b | |
// a{b}c -> a{b}c | |
const braceExpand = (pattern, options = {}) => { | |
assertValidPattern(pattern); | |
// Thanks to Yeting Li <https://github.com/yetingli> for | |
// improving this regexp to avoid a ReDOS vulnerability. | |
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { | |
// shortcut. no need to expand. | |
return [pattern]; | |
} | |
return expand(pattern); | |
}; | |
minimatch.braceExpand = braceExpand; | |
// parse a component of the expanded set. | |
// At this point, no pattern may contain "/" in it | |
// so we're going to return a 2d array, where each entry is the full | |
// pattern, split on '/', and then turned into a regular expression. | |
// A regexp is made at the end which joins each array with an | |
// escaped /, and another full one which joins each regexp with |. | |
// | |
// Following the lead of Bash 4.1, note that "**" only has special meaning | |
// when it is the *only* thing in a path portion. Otherwise, any series | |
// of * is equivalent to a single *. Globstar behavior is enabled by | |
// default, and can be disabled by setting options.noglobstar. | |
const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe(); | |
minimatch.makeRe = makeRe; | |
const 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; | |
// replace stuff like \* with * | |
const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/; | |
const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); | |
class Minimatch { | |
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 !== undefined | |
? options.windowsNoMagicRoot | |
: !!(this.isWindows && this.nocase); | |
this.globSet = []; | |
this.globParts = []; | |
this.set = []; | |
// make the set of regexps etc. | |
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; | |
// empty patterns and comments match nothing. | |
if (!options.nocomment && pattern.charAt(0) === '#') { | |
this.comment = true; | |
return; | |
} | |
if (!pattern) { | |
this.empty = true; | |
return; | |
} | |
// step 1: figure out negation, etc. | |
this.parseNegate(); | |
// step 2: expand braces | |
this.globSet = [...new Set(this.braceExpand())]; | |
if (options.debug) { | |
this.debug = (...args) => console.error(...args); | |
} | |
this.debug(this.pattern, this.globSet); | |
// step 3: now we have a set, so turn each one into a series of | |
// path-portion matching patterns. | |
// These will be regexps, except in the case of "**", which is | |
// set to the GLOBSTAR object for globstar behavior, | |
// and will not contain any / characters | |
// | |
// First, we preprocess to make the glob pattern sets a bit simpler | |
// and deduped. There are some perf-killing patterns that can cause | |
// problems with a glob walk, but we can simplify them down a bit. | |
const rawGlobParts = this.globSet.map(s => this.slashSplit(s)); | |
this.globParts = this.preprocess(rawGlobParts); | |
this.debug(this.pattern, this.globParts); | |
// glob --> regexps | |
let set = this.globParts.map((s, _, __) => { | |
if (this.isWindows && this.windowsNoMagicRoot) { | |
// check if it's a drive or unc path. | |
const isUNC = s[0] === '' && | |
s[1] === '' && | |
(s[2] === '?' || !globMagic.test(s[2])) && | |
!globMagic.test(s[3]); | |
const isDrive = /^[a-z]:/i.test(s[0]); | |
if (isUNC) { | |
return [...s.slice(0, 4), ...s.slice(4).map(ss => this.parse(ss))]; | |
} | |
else if (isDrive) { | |
return [s[0], ...s.slice(1).map(ss => this.parse(ss))]; | |
} | |
} | |
return s.map(ss => this.parse(ss)); | |
}); | |
this.debug(this.pattern, set); | |
// filter out everything that didn't compile properly. | |
this.set = set.filter(s => s.indexOf(false) === -1); | |
// do not treat the ? in UNC paths as magic | |
if (this.isWindows) { | |
for (let i = 0; i < this.set.length; i++) { | |
const p = this.set[i]; | |
if (p[0] === '' && | |
p[1] === '' && | |
this.globParts[i][2] === '?' && | |
typeof p[3] === 'string' && | |
/^[a-z]:$/i.test(p[3])) { | |
p[2] = '?'; | |
} | |
} | |
} | |
this.debug(this.pattern, this.set); | |
} | |
// various transforms to equivalent pattern sets that are | |
// faster to process in a filesystem walk. The goal is to | |
// eliminate what we can, and push all ** patterns as far | |
// to the right as possible, even if it increases the number | |
// of patterns that we have to process. | |
preprocess(globParts) { | |
// if we're not in globstar mode, then turn all ** into * | |
if (this.options.noglobstar) { | |
for (let i = 0; i < globParts.length; i++) { | |
for (let j = 0; j < globParts[i].length; j++) { | |
if (globParts[i][j] === '**') { | |
globParts[i][j] = '*'; | |
} | |
} | |
} | |
} | |
const { optimizationLevel = 1 } = this.options; | |
if (optimizationLevel >= 2) { | |
// aggressive optimization for the purpose of fs walking | |
globParts = this.firstPhasePreProcess(globParts); | |
globParts = this.secondPhasePreProcess(globParts); | |
} | |
else if (optimizationLevel >= 1) { | |
// just basic optimizations to remove some .. parts | |
globParts = this.levelOneOptimize(globParts); | |
} | |
else { | |
// just collapse multiple ** portions into one | |
globParts = this.adjascentGlobstarOptimize(globParts); | |
} | |
return globParts; | |
} | |
// just get rid of adjascent ** portions | |
adjascentGlobstarOptimize(globParts) { | |
return globParts.map(parts => { | |
let gs = -1; | |
while (-1 !== (gs = parts.indexOf('**', gs + 1))) { | |
let i = gs; | |
while (parts[i + 1] === '**') { | |
i++; | |
} | |
if (i !== gs) { | |
parts.splice(gs, i - gs); | |
} | |
} | |
return parts; | |
}); | |
} | |
// get rid of adjascent ** and resolve .. portions | |
levelOneOptimize(globParts) { | |
return globParts.map(parts => { | |
parts = parts.reduce((set, part) => { | |
const prev = set[set.length - 1]; | |
if (part === '**' && prev === '**') { | |
return set; | |
} | |
if (part === '..') { | |
if (prev && prev !== '..' && prev !== '.' && prev !== '**') { | |
set.pop(); | |
return set; | |
} | |
} | |
set.push(part); | |
return set; | |
}, []); | |
return parts.length === 0 ? [''] : parts; | |
}); | |
} | |
levelTwoFileOptimize(parts) { | |
if (!Array.isArray(parts)) { | |
parts = this.slashSplit(parts); | |
} | |
let didSomething = false; | |
do { | |
didSomething = false; | |
// <pre>/<e>/<rest> -> <pre>/<rest> | |
if (!this.preserveMultipleSlashes) { | |
for (let i = 1; i < parts.length - 1; i++) { | |
const p = parts[i]; | |
// don't squeeze out UNC patterns | |
if (i === 1 && p === '' && parts[0] === '') | |
continue; | |
if (p === '.' || p === '') { | |
didSomething = true; | |
parts.splice(i, 1); | |
i--; | |
} | |
} | |
if (parts[0] === '.' && | |
parts.length === 2 && | |
(parts[1] === '.' || parts[1] === '')) { | |
didSomething = true; | |
parts.pop(); | |
} | |
} | |
// <pre>/<p>/../<rest> -> <pre>/<rest> | |
let dd = 0; | |
while (-1 !== (dd = parts.indexOf('..', dd + 1))) { | |
const p = parts[dd - 1]; | |
if (p && p !== '.' && p !== '..' && p !== '**') { | |
didSomething = true; | |
parts.splice(dd - 1, 2); | |
dd -= 2; | |
} | |
} | |
} while (didSomething); | |
return parts.length === 0 ? [''] : parts; | |
} | |
// First phase: single-pattern processing | |
// <pre> is 1 or more portions | |
// <rest> is 1 or more portions | |
// <p> is any portion other than ., .., '', or ** | |
// <e> is . or '' | |
// | |
// **/.. is *brutal* for filesystem walking performance, because | |
// it effectively resets the recursive walk each time it occurs, | |
// and ** cannot be reduced out by a .. pattern part like a regexp | |
// or most strings (other than .., ., and '') can be. | |
// | |
// <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>} | |
// <pre>/<e>/<rest> -> <pre>/<rest> | |
// <pre>/<p>/../<rest> -> <pre>/<rest> | |
// **/**/<rest> -> **/<rest> | |
// | |
// **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow | |
// this WOULD be allowed if ** did follow symlinks, or * didn't | |
firstPhasePreProcess(globParts) { | |
let didSomething = false; | |
do { | |
didSomething = false; | |
// <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>} | |
for (let parts of globParts) { | |
let gs = -1; | |
while (-1 !== (gs = parts.indexOf('**', gs + 1))) { | |
let gss = gs; | |
while (parts[gss + 1] === '**') { | |
// <pre>/**/**/<rest> -> <pre>/**/<rest> | |
gss++; | |
} | |
// eg, if gs is 2 and gss is 4, that means we have 3 ** | |
// parts, and can remove 2 of them. | |
if (gss > gs) { | |
parts.splice(gs + 1, gss - gs); | |
} | |
let next = parts[gs + 1]; | |
const p = parts[gs + 2]; | |
const p2 = parts[gs + 3]; | |
if (next !== '..') | |
continue; | |
if (!p || | |
p === '.' || | |
p === '..' || | |
!p2 || | |
p2 === '.' || | |
p2 === '..') { | |
continue; | |
} | |
didSomething = true; | |
// edit parts in place, and push the new one | |
parts.splice(gs, 1); | |
const other = parts.slice(0); | |
other[gs] = '**'; | |
globParts.push(other); | |
gs--; | |
} | |
// <pre>/<e>/<rest> -> <pre>/<rest> | |
if (!this.preserveMultipleSlashes) { | |
for (let i = 1; i < parts.length - 1; i++) { | |
const p = parts[i]; | |
// don't squeeze out UNC patterns | |
if (i === 1 && p === '' && parts[0] === '') | |
continue; | |
if (p === '.' || p === '') { | |
didSomething = true; | |
parts.splice(i, 1); | |
i--; | |
} | |
} | |
if (parts[0] === '.' && | |
parts.length === 2 && | |
(parts[1] === '.' || parts[1] === '')) { | |
didSomething = true; | |
parts.pop(); | |
} | |
} | |
// <pre>/<p>/../<rest> -> <pre>/<rest> | |
let dd = 0; | |
while (-1 !== (dd = parts.indexOf('..', dd + 1))) { | |
const p = parts[dd - 1]; | |
if (p && p !== '.' && p !== '..' && p !== '**') { | |
didSomething = true; | |
const needDot = dd === 1 && parts[dd + 1] === '**'; | |
const splin = needDot ? ['.'] : []; | |
parts.splice(dd - 1, 2, ...splin); | |
if (parts.length === 0) | |
parts.push(''); | |
dd -= 2; | |
} | |
} | |
} | |
} while (didSomething); | |
return globParts; | |
} | |
// second phase: multi-pattern dedupes | |
// {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest> | |
// {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest> | |
// {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest> | |
// | |
// {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest> | |
// ^-- not valid because ** doens't follow symlinks | |
secondPhasePreProcess(globParts) { | |
for (let i = 0; i < globParts.length - 1; i++) { | |
for (let j = i + 1; j < globParts.length; j++) { | |
const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes); | |
if (matched) { | |
globParts[i] = []; | |
globParts[j] = matched; | |
break; | |
} | |
} | |
} | |
return globParts.filter(gs => gs.length); | |
} | |
partsMatch(a, b, emptyGSMatch = false) { | |
let ai = 0; | |
let bi = 0; | |
let result = []; | |
let which = ''; | |
while (ai < a.length && bi < b.length) { | |
if (a[ai] === b[bi]) { | |
result.push(which === 'b' ? b[bi] : a[ai]); | |
ai++; | |
bi++; | |
} | |
else if (emptyGSMatch && a[ai] === '**' && b[bi] === a[ai + 1]) { | |
result.push(a[ai]); | |
ai++; | |
} | |
else if (emptyGSMatch && b[bi] === '**' && a[ai] === b[bi + 1]) { | |
result.push(b[bi]); | |
bi++; | |
} | |
else if (a[ai] === '*' && | |
b[bi] && | |
(this.options.dot || !b[bi].startsWith('.')) && | |
b[bi] !== '**') { | |
if (which === 'b') | |
return false; | |
which = 'a'; | |
result.push(a[ai]); | |
ai++; | |
bi++; | |
} | |
else if (b[bi] === '*' && | |
a[ai] && | |
(this.options.dot || !a[ai].startsWith('.')) && | |
a[ai] !== '**') { | |
if (which === 'a') | |
return false; | |
which = 'b'; | |
result.push(b[bi]); | |
ai++; | |
bi++; | |
} | |
else { | |
return false; | |
} | |
} | |
// if we fall out of the loop, it means they two are identical | |
// as long as their lengths match | |
return a.length === b.length && result; | |
} | |
parseNegate() { | |
if (this.nonegate) | |
return; | |
const pattern = this.pattern; | |
let negate = false; | |
let negateOffset = 0; | |
for (let i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) { | |
negate = !negate; | |
negateOffset++; | |
} | |
if (negateOffset) | |
this.pattern = pattern.slice(negateOffset); | |
this.negate = negate; | |
} | |
// set partial to true to test if, for example, | |
// "/a/b" matches the start of "/*/b/*/d" | |
// Partial means, if you run out of file before you run | |
// out of pattern, then that's fine, as long as all | |
// the parts match. | |
matchOne(file, pattern, partial = false) { | |
const options = this.options; | |
// UNC paths like //?/X:/... can match X:/... and vice versa | |
// Drive letters in absolute drive or unc paths are always compared | |
// case-insensitively. | |
if (this.isWindows) { | |
const fileDrive = typeof file[0] === 'string' && /^[a-z]:$/i.test(file[0]); | |
const fileUNC = !fileDrive && | |
file[0] === '' && | |
file[1] === '' && | |
file[2] === '?' && | |
/^[a-z]:$/i.test(file[3]); | |
const patternDrive = typeof pattern[0] === 'string' && /^[a-z]:$/i.test(pattern[0]); | |
const patternUNC = !patternDrive && | |
pattern[0] === '' && | |
pattern[1] === '' && | |
pattern[2] === '?' && | |
typeof pattern[3] === 'string' && | |
/^[a-z]:$/i.test(pattern[3]); | |
const fdi = fileUNC ? 3 : fileDrive ? 0 : undefined; | |
const pdi = patternUNC ? 3 : patternDrive ? 0 : undefined; | |
if (typeof fdi === 'number' && typeof pdi === 'number') { | |
const [fd, pd] = [file[fdi], pattern[pdi]]; | |
if (fd.toLowerCase() === pd.toLowerCase()) { | |
pattern[pdi] = fd; | |
if (pdi > fdi) { | |
pattern = pattern.slice(pdi); | |
} | |
else if (fdi > pdi) { | |
file = file.slice(fdi); | |
} | |
} | |
} | |
} | |
// resolve and reduce . and .. portions in the file as well. | |
// dont' need to do the second phase, because it's only one string[] | |
const { optimizationLevel = 1 } = this.options; | |
if (optimizationLevel >= 2) { | |
file = this.levelTwoFileOptimize(file); | |
} | |
this.debug('matchOne', this, { file, pattern }); | |
this.debug('matchOne', file.length, pattern.length); | |
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) { | |
this.debug('matchOne loop'); | |
var p = pattern[pi]; | |
var f = file[fi]; | |
this.debug(pattern, p, f); | |
// should be impossible. | |
// some invalid regexp stuff in the set. | |
/* c8 ignore start */ | |
if (p === false) { | |
return false; | |
} | |
/* c8 ignore stop */ | |
if (p === GLOBSTAR) { | |
this.debug('GLOBSTAR', [pattern, p, f]); | |
// "**" | |
// a/**/b/**/c would match the following: | |
// a/b/x/y/z/c | |
// a/x/y/z/b/c | |
// a/b/x/b/x/c | |
// a/b/c | |
// To do this, take the rest of the pattern after | |
// the **, and see if it would match the file remainder. | |
// If so, return success. | |
// If not, the ** "swallows" a segment, and try again. | |
// This is recursively awful. | |
// | |
// a/**/b/**/c matching a/b/x/y/z/c | |
// - a matches a | |
// - doublestar | |
// - matchOne(b/x/y/z/c, b/**/c) | |
// - b matches b | |
// - doublestar | |
// - matchOne(x/y/z/c, c) -> no | |
// - matchOne(y/z/c, c) -> no | |
// - matchOne(z/c, c) -> no | |
// - matchOne(c, c) yes, hit | |
var fr = fi; | |
var pr = pi + 1; | |
if (pr === pl) { | |
this.debug('** at the end'); | |
// a ** at the end will just swallow the rest. | |
// We have found a match. | |
// however, it will not swallow /.x, unless | |
// options.dot is set. | |
// . and .. are *never* matched by **, for explosively | |
// exponential reasons. | |
for (; fi < fl; fi++) { | |
if (file[fi] === '.' || | |
file[fi] === '..' || | |
(!options.dot && file[fi].charAt(0) === '.')) | |
return false; | |
} | |
return true; | |
} | |
// ok, let's see if we can swallow whatever we can. | |
while (fr < fl) { | |
var swallowee = file[fr]; | |
this.debug('\nglobstar while', file, fr, pattern, pr, swallowee); | |
// XXX remove this slice. Just pass the start index. | |
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { | |
this.debug('globstar found match!', fr, fl, swallowee); | |
// found a match. | |
return true; | |
} | |
else { | |
// can't swallow "." or ".." ever. | |
// can only swallow ".foo" when explicitly asked. | |
if (swallowee === '.' || | |
swallowee === '..' || | |
(!options.dot && swallowee.charAt(0) === '.')) { | |
this.debug('dot detected!', file, fr, pattern, pr); | |
break; | |
} | |
// ** swallows a segment, and continue. | |
this.debug('globstar swallow a segment, and continue'); | |
fr++; | |
} | |
} | |
// no match was found. | |
// However, in partial mode, we can't say this is necessarily over. | |
/* c8 ignore start */ | |
if (partial) { | |
// ran out of file | |
this.debug('\n>>> no match, partial?', file, fr, pattern, pr); | |
if (fr === fl) { | |
return true; | |
} | |
} | |
/* c8 ignore stop */ | |
return false; | |
} | |
// something other than ** | |
// non-magic patterns just have to match exactly | |
// patterns with magic have been turned into regexps. | |
let hit; | |
if (typeof p === 'string') { | |
hit = f === p; | |
this.debug('string match', p, f, hit); | |
} | |
else { | |
hit = p.test(f); | |
this.debug('pattern match', p, f, hit); | |
} | |
if (!hit) | |
return false; | |
} | |
// Note: ending in / means that we'll get a final "" | |
// at the end of the pattern. This can only match a | |
// corresponding "" at the end of the file. | |
// If the file ends in /, then it can only match a | |
// a pattern that ends in /, unless the pattern just | |
// doesn't have any more for it. But, a/b/ should *not* | |
// match "a/b/*", even though "" matches against the | |
// [^/]*? pattern, except in partial mode, where it might | |
// simply not be reached yet. | |
// However, a/b/ should still satisfy a/* | |
// now either we fell off the end of the pattern, or we're done. | |
if (fi === fl && pi === pl) { | |
// ran out of pattern and filename at the same time. | |
// an exact hit! | |
return true; | |
} | |
else if (fi === fl) { | |
// ran out of file, but still had pattern left. | |
// this is ok if we're doing the match as part of | |
// a glob fs traversal. | |
return partial; | |
} | |
else if (pi === pl) { | |
// ran out of pattern, still have file left. | |
// this is only acceptable if we're on the very last | |
// empty segment of a file with a trailing slash. | |
// a/* should match a/b/ | |
return fi === fl - 1 && file[fi] === ''; | |
/* c8 ignore start */ | |
} | |
else { | |
// should be unreachable. | |
throw new Error('wtf?'); | |
} | |
/* c8 ignore stop */ | |
} | |
braceExpand() { | |
return braceExpand(this.pattern, this.options); | |
} | |
parse(pattern) { | |
assertValidPattern(pattern); | |
const options = this.options; | |
// shortcuts | |
if (pattern === '**') | |
return GLOBSTAR; | |
if (pattern === '') | |
return ''; | |
// far and away, the most common glob pattern parts are | |
// *, *.*, and *.<ext> Add a fast check method for those. | |
let m; | |
let fastTest = null; | |
if ((m = pattern.match(starRE))) { | |
fastTest = options.dot ? starTestDot : starTest; | |
} | |
else if ((m = pattern.match(starDotExtRE))) { | |
fastTest = (options.nocase | |
? options.dot | |
? starDotExtTestNocaseDot | |
: starDotExtTestNocase | |
: options.dot | |
? starDotExtTestDot | |
: starDotExtTest)(m[1]); | |
} | |
else if ((m = pattern.match(qmarksRE))) { | |
fastTest = (options.nocase | |
? options.dot | |
? qmarksTestNocaseDot | |
: qmarksTestNocase | |
: options.dot | |
? qmarksTestDot | |
: qmarksTest)(m); | |
} | |
else if ((m = pattern.match(starDotStarRE))) { | |
fastTest = options.dot ? starDotStarTestDot : starDotStarTest; | |
} | |
else if ((m = pattern.match(dotStarRE))) { | |
fastTest = dotStarTest; | |
} | |
const re = AST.fromGlob(pattern, this.options).toMMPattern(); | |
if (fastTest && typeof re === 'object') { | |
// Avoids overriding in frozen environments | |
Reflect.defineProperty(re, 'test', { value: fastTest }); | |
} | |
return re; | |
} | |
makeRe() { | |
if (this.regexp || this.regexp === false) | |
return this.regexp; | |
// at this point, this.set is a 2d array of partial | |
// pattern strings, or "**". | |
// | |
// It's better to use .match(). This function shouldn't | |
// be used, really, but it's pretty convenient sometimes, | |
// when you just want to work with a regex. | |
const set = this.set; | |
if (!set.length) { | |
this.regexp = false; | |
return this.regexp; | |
} | |
const options = this.options; | |
const twoStar = options.noglobstar | |
? star | |
: options.dot | |
? twoStarDot | |
: twoStarNoDot; | |
const flags = new Set(options.nocase ? ['i'] : []); | |
// regexpify non-globstar patterns | |
// if ** is only item, then we just do one twoStar | |
// if ** is first, and there are more, prepend (\/|twoStar\/)? to next | |
// if ** is last, append (\/twoStar|) to previous | |
// if ** is in the middle, append (\/|\/twoStar\/) to previous | |
// then filter out GLOBSTAR symbols | |
let re = set | |
.map(pattern => { | |
const pp = pattern.map(p => { | |
if (p instanceof RegExp) { | |
for (const f of p.flags.split('')) | |
flags.add(f); | |
} | |
return typeof p === 'string' | |
? regExpEscape(p) | |
: p === GLOBSTAR | |
? GLOBSTAR | |
: p._src; | |
}); | |
pp.forEach((p, i) => { | |
const next = pp[i + 1]; | |
const prev = pp[i - 1]; | |
if (p !== GLOBSTAR || prev === GLOBSTAR) { | |
return; | |
} | |
if (prev === undefined) { | |
if (next !== undefined && next !== GLOBSTAR) { | |
pp[i + 1] = '(?:\\/|' + twoStar + '\\/)?' + next; | |
} | |
else { | |
pp[i] = twoStar; | |
} | |
} | |
else if (next === undefined) { | |
pp[i - 1] = prev + '(?:\\/|' + twoStar + ')?'; | |
} | |
else if (next !== GLOBSTAR) { | |
pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + '\\/)' + next; | |
pp[i + 1] = GLOBSTAR; | |
} | |
}); | |
return pp.filter(p => p !== GLOBSTAR).join('/'); | |
}) | |
.join('|'); | |
// need to wrap in parens if we had more than one thing with |, | |
// otherwise only the first will be anchored to ^ and the last to $ | |
const [open, close] = set.length > 1 ? ['(?:', ')'] : ['', '']; | |
// must match entire pattern | |
// ending in a * or ** will make it less strict. | |
re = '^' + open + re + close + '$'; | |
// can match anything, as long as it's not this. | |
if (this.negate) | |
re = '^(?!' + re + ').+$'; | |
try { | |
this.regexp = new RegExp(re, [...flags].join('')); | |
/* c8 ignore start */ | |
} | |
catch (ex) { | |
// should be impossible | |
this.regexp = false; | |
} | |
/* c8 ignore stop */ | |
return this.regexp; | |
} | |
slashSplit(p) { | |
// if p starts with // on windows, we preserve that | |
// so that UNC paths aren't broken. Otherwise, any number of | |
// / characters are coalesced into one, unless | |
// preserveMultipleSlashes is set to true. | |
if (this.preserveMultipleSlashes) { | |
return p.split('/'); | |
} | |
else if (this.isWindows && /^\/\/[^\/]+/.test(p)) { | |
// add an extra '' for the one we lose | |
return ['', ...p.split(/\/+/)]; | |
} | |
else { | |
return p.split(/\/+/); | |
} | |
} | |
match(f, partial = this.partial) { | |
this.debug('match', f, this.pattern); | |
// short-circuit in the case of busted things. | |
// comments, etc. | |
if (this.comment) { | |
return false; | |
} | |
if (this.empty) { | |
return f === ''; | |
} | |
if (f === '/' && partial) { | |
return true; | |
} | |
const options = this.options; | |
// windows: need to use /, not \ | |
if (this.isWindows) { | |
f = f.split('\\').join('/'); | |
} | |
// treat the test path as a set of pathparts. | |
const ff = this.slashSplit(f); | |
this.debug(this.pattern, 'split', ff); | |
// just ONE of the pattern sets in this.set needs to match | |
// in order for it to be valid. If negating, then just one | |
// match means that we have failed. | |
// Either way, return on the first hit. | |
const set = this.set; | |
this.debug(this.pattern, 'set', set); | |
// Find the basename of the path by looking for the last non-empty segment | |
let filename = ff[ff.length - 1]; | |
if (!filename) { | |
for (let i = ff.length - 2; !filename && i >= 0; i--) { | |
filename = ff[i]; | |
} | |
} | |
for (let i = 0; i < set.length; i++) { | |
const pattern = set[i]; | |
let file = ff; | |
if (options.matchBase && pattern.length === 1) { | |
file = [filename]; | |
} | |
const hit = this.matchOne(file, pattern, partial); | |
if (hit) { | |
if (options.flipNegate) { | |
return true; | |
} | |
return !this.negate; | |
} | |
} | |
// didn't get any hits. this is success if it's a negative | |
// pattern, failure otherwise. | |
if (options.flipNegate) { | |
return false; | |
} | |
return this.negate; | |
} | |
static defaults(def) { | |
return minimatch.defaults(def).Minimatch; | |
} | |
} | |
/* c8 ignore stop */ | |
minimatch.AST = AST; | |
minimatch.Minimatch = Minimatch; | |
minimatch.escape = escape; | |
minimatch.unescape = unescape; | |
class TypeScope { | |
constructor(filename, source, offset = 0, imports = /* @__PURE__ */ Object.create(null), types = /* @__PURE__ */ Object.create(null), declares = /* @__PURE__ */ Object.create(null)) { | |
this.filename = filename; | |
this.source = source; | |
this.offset = offset; | |
this.imports = imports; | |
this.types = types; | |
this.declares = declares; | |
this.isGenericScope = false; | |
this.resolvedImportSources = /* @__PURE__ */ Object.create(null); | |
this.exportedTypes = /* @__PURE__ */ Object.create(null); | |
this.exportedDeclares = /* @__PURE__ */ Object.create(null); | |
} | |
} | |
function resolveTypeElements(ctx, node, scope, typeParameters) { | |
const canCache = !typeParameters; | |
if (canCache && node._resolvedElements) { | |
return node._resolvedElements; | |
} | |
const resolved = innerResolveTypeElements( | |
ctx, | |
node, | |
node._ownerScope || scope || ctxToScope(ctx), | |
typeParameters | |
); | |
return canCache ? node._resolvedElements = resolved : resolved; | |
} | |
function innerResolveTypeElements(ctx, node, scope, typeParameters) { | |
var _a, _b; | |
if (node.leadingComments && node.leadingComments.some((c) => c.value.includes("@vue-ignore"))) { | |
return { props: {} }; | |
} | |
switch (node.type) { | |
case "TSTypeLiteral": | |
return typeElementsToMap(ctx, node.members, scope, typeParameters); | |
case "TSInterfaceDeclaration": | |
return resolveInterfaceMembers(ctx, node, scope, typeParameters); | |
case "TSTypeAliasDeclaration": | |
case "TSTypeAnnotation": | |
case "TSParenthesizedType": | |
return resolveTypeElements( | |
ctx, | |
node.typeAnnotation, | |
scope, | |
typeParameters | |
); | |
case "TSFunctionType": { | |
return { props: {}, calls: [node] }; | |
} | |
case "TSUnionType": | |
case "TSIntersectionType": | |
return mergeElements( | |
node.types.map((t) => resolveTypeElements(ctx, t, scope, typeParameters)), | |
node.type | |
); | |
case "TSMappedType": | |
return resolveMappedType(ctx, node, scope, typeParameters); | |
case "TSIndexedAccessType": { | |
const types = resolveIndexType(ctx, node, scope); | |
return mergeElements( | |
types.map((t) => resolveTypeElements(ctx, t, t._ownerScope)), | |
"TSUnionType" | |
); | |
} | |
case "TSExpressionWithTypeArguments": | |
// referenced by interface extends | |
case "TSTypeReference": { | |
const typeName = getReferenceName(node); | |
if ((typeName === "ExtractPropTypes" || typeName === "ExtractPublicPropTypes") && node.typeParameters && ((_a = scope.imports[typeName]) == null ? void 0 : _a.source) === "vue") { | |
return resolveExtractPropTypes( | |
resolveTypeElements( | |
ctx, | |
node.typeParameters.params[0], | |
scope, | |
typeParameters | |
), | |
scope | |
); | |
} | |
const resolved = resolveTypeReference(ctx, node, scope); | |
if (resolved) { | |
let typeParams; | |
if ((resolved.type === "TSTypeAliasDeclaration" || resolved.type === "TSInterfaceDeclaration") && resolved.typeParameters && node.typeParameters) { | |
typeParams = /* @__PURE__ */ Object.create(null); | |
resolved.typeParameters.params.forEach((p, i) => { | |
let param = typeParameters && typeParameters[p.name]; | |
if (!param) param = node.typeParameters.params[i]; | |
typeParams[p.name] = param; | |
}); | |
} | |
return resolveTypeElements( | |
ctx, | |
resolved, | |
resolved._ownerScope, | |
typeParams | |
); | |
} else { | |
if (typeof typeName === "string") { | |
if (typeParameters && typeParameters[typeName]) { | |
return resolveTypeElements( | |
ctx, | |
typeParameters[typeName], | |
scope, | |
typeParameters | |
); | |
} | |
if ( | |
// @ts-expect-error | |
SupportedBuiltinsSet.has(typeName) | |
) { | |
return resolveBuiltin( | |
ctx, | |
node, | |
typeName, | |
scope, | |
typeParameters | |
); | |
} else if (typeName === "ReturnType" && node.typeParameters) { | |
const ret = resolveReturnType( | |
ctx, | |
node.typeParameters.params[0], | |
scope | |
); | |
if (ret) { | |
return resolveTypeElements(ctx, ret, scope); | |
} | |
} | |
} | |
return ctx.error( | |
`Unresolvable type reference or unsupported built-in utility type`, | |
node, | |
scope | |
); | |
} | |
} | |
case "TSImportType": { | |
if (getId(node.argument) === "vue" && ((_b = node.qualifier) == null ? void 0 : _b.type) === "Identifier" && node.qualifier.name === "ExtractPropTypes" && node.typeParameters) { | |
return resolveExtractPropTypes( | |
resolveTypeElements(ctx, node.typeParameters.params[0], scope), | |
scope | |
); | |
} | |
const sourceScope = importSourceToScope( | |
ctx, | |
node.argument, | |
scope, | |
node.argument.value | |
); | |
const resolved = resolveTypeReference(ctx, node, sourceScope); | |
if (resolved) { | |
return resolveTypeElements(ctx, resolved, resolved._ownerScope); | |
} | |
break; | |
} | |
case "TSTypeQuery": | |
{ | |
const resolved = resolveTypeReference(ctx, node, scope); | |
if (resolved) { | |
return resolveTypeElements(ctx, resolved, resolved._ownerScope); | |
} | |
} | |
break; | |
} | |
return ctx.error(`Unresolvable type: ${node.type}`, node, scope); | |
} | |
function typeElementsToMap(ctx, elements, scope = ctxToScope(ctx), typeParameters) { | |
const res = { props: {} }; | |
for (const e of elements) { | |
if (e.type === "TSPropertySignature" || e.type === "TSMethodSignature") { | |
if (typeParameters) { | |
scope = createChildScope(scope); | |
scope.isGenericScope = true; | |
Object.assign(scope.types, typeParameters); | |
} | |
e._ownerScope = scope; | |
const name = getId(e.key); | |
if (name && !e.computed) { | |
res.props[name] = e; | |
} else if (e.key.type === "TemplateLiteral") { | |
for (const key of resolveTemplateKeys(ctx, e.key, scope)) { | |
res.props[key] = e; | |
} | |
} else { | |
ctx.error( | |
`Unsupported computed key in type referenced by a macro`, | |
e.key, | |
scope | |
); | |
} | |
} else if (e.type === "TSCallSignatureDeclaration") { | |
(res.calls || (res.calls = [])).push(e); | |
} | |
} | |
return res; | |
} | |
function mergeElements(maps, type) { | |
if (maps.length === 1) return maps[0]; | |
const res = { props: {} }; | |
const { props: baseProps } = res; | |
for (const { props, calls } of maps) { | |
for (const key in props) { | |
if (!shared.hasOwn(baseProps, key)) { | |
baseProps[key] = props[key]; | |
} else { | |
baseProps[key] = createProperty( | |
baseProps[key].key, | |
{ | |
type, | |
// @ts-expect-error | |
types: [baseProps[key], props[key]] | |
}, | |
baseProps[key]._ownerScope, | |
baseProps[key].optional || props[key].optional | |
); | |
} | |
} | |
if (calls) { | |
(res.calls || (res.calls = [])).push(...calls); | |
} | |
} | |
return res; | |
} | |
function createProperty(key, typeAnnotation, scope, optional) { | |
return { | |
type: "TSPropertySignature", | |
key, | |
kind: "get", | |
optional, | |
typeAnnotation: { | |
type: "TSTypeAnnotation", | |
typeAnnotation | |
}, | |
_ownerScope: scope | |
}; | |
} | |
function resolveInterfaceMembers(ctx, node, scope, typeParameters) { | |
const base = typeElementsToMap( | |
ctx, | |
node.body.body, | |
node._ownerScope, | |
typeParameters | |
); | |
if (node.extends) { | |
for (const ext of node.extends) { | |
try { | |
const { props, calls } = resolveTypeElements(ctx, ext, scope); | |
for (const key in props) { | |
if (!shared.hasOwn(base.props, key)) { | |
base.props[key] = props[key]; | |
} | |
} | |
if (calls) { | |
; | |
(base.calls || (base.calls = [])).push(...calls); | |
} | |
} catch (e) { | |
ctx.error( | |
`Failed to resolve extends base type. | |
If this previously worked in 3.2, you can instruct the compiler to ignore this extend by adding /* @vue-ignore */ before it, for example: | |
interface Props extends /* @vue-ignore */ Base {} | |
Note: both in 3.2 or with the ignore, the properties in the base type are treated as fallthrough attrs at runtime.`, | |
ext, | |
scope | |
); | |
} | |
} | |
} | |
return base; | |
} | |
function resolveMappedType(ctx, node, scope, typeParameters) { | |
const res = { props: {} }; | |
let keys; | |
if (node.nameType) { | |
const { name, constraint } = node.typeParameter; | |
scope = createChildScope(scope); | |
Object.assign(scope.types, { ...typeParameters, [name]: constraint }); | |
keys = resolveStringType(ctx, node.nameType, scope); | |
} else { | |
keys = resolveStringType(ctx, node.typeParameter.constraint, scope); | |
} | |
for (const key of keys) { | |
res.props[key] = createProperty( | |
{ | |
type: "Identifier", | |
name: key | |
}, | |
node.typeAnnotation, | |
scope, | |
!!node.optional | |
); | |
} | |
return res; | |
} | |
function resolveIndexType(ctx, node, scope) { | |
var _a, _b; | |
if (node.indexType.type === "TSNumberKeyword") { | |
return resolveArrayElementType(ctx, node.objectType, scope); | |
} | |
const { indexType, objectType } = node; | |
const types = []; | |
let keys; | |
let resolved; | |
if (indexType.type === "TSStringKeyword") { | |
resolved = resolveTypeElements(ctx, objectType, scope); | |
keys = Object.keys(resolved.props); | |
} else { | |
keys = resolveStringType(ctx, indexType, scope); | |
resolved = resolveTypeElements(ctx, objectType, scope); | |
} | |
for (const key of keys) { | |
const targetType = (_b = (_a = resolved.props[key]) == null ? void 0 : _a.typeAnnotation) == null ? void 0 : _b.typeAnnotation; | |
if (targetType) { | |
targetType._ownerScope = resolved.props[key]._ownerScope; | |
types.push(targetType); | |
} | |
} | |
return types; | |
} | |
function resolveArrayElementType(ctx, node, scope) { | |
if (node.type === "TSArrayType") { | |
return [node.elementType]; | |
} | |
if (node.type === "TSTupleType") { | |
return node.elementTypes.map( | |
(t) => t.type === "TSNamedTupleMember" ? t.elementType : t | |
); | |
} | |
if (node.type === "TSTypeReference") { | |
if (getReferenceName(node) === "Array" && node.typeParameters) { | |
return node.typeParameters.params; | |
} else { | |
const resolved = resolveTypeReference(ctx, node, scope); | |
if (resolved) { | |
return resolveArrayElementType(ctx, resolved, scope); | |
} | |
} | |
} | |
return ctx.error( | |
"Failed to resolve element type from target type", | |
node, | |
scope | |
); | |
} | |
function resolveStringType(ctx, node, scope) { | |
switch (node.type) { | |
case "StringLiteral": | |
return [node.value]; | |
case "TSLiteralType": | |
return resolveStringType(ctx, node.literal, scope); | |
case "TSUnionType": | |
return node.types.map((t) => resolveStringType(ctx, t, scope)).flat(); | |
case "TemplateLiteral": { | |
return resolveTemplateKeys(ctx, node, scope); | |
} | |
case "TSTypeReference": { | |
const resolved = resolveTypeReference(ctx, node, scope); | |
if (resolved) { | |
return resolveStringType(ctx, resolved, scope); | |
} | |
if (node.typeName.type === "Identifier") { | |
const getParam = (index = 0) => resolveStringType(ctx, node.typeParameters.params[index], scope); | |
switch (node.typeName.name) { | |
case "Extract": | |
return getParam(1); | |
case "Exclude": { | |
const excluded = getParam(1); | |
return getParam().filter((s) => !excluded.includes(s)); | |
} | |
case "Uppercase": | |
return getParam().map((s) => s.toUpperCase()); | |
case "Lowercase": | |
return getParam().map((s) => s.toLowerCase()); | |
case "Capitalize": | |
return getParam().map(shared.capitalize); | |
case "Uncapitalize": | |
return getParam().map((s) => s[0].toLowerCase() + s.slice(1)); | |
default: | |
ctx.error( | |
"Unsupported type when resolving index type", | |
node.typeName, | |
scope | |
); | |
} | |
} | |
} | |
} | |
return ctx.error("Failed to resolve index type into finite keys", node, scope); | |
} | |
function resolveTemplateKeys(ctx, node, scope) { | |
if (!node.expressions.length) { | |
return [node.quasis[0].value.raw]; | |
} | |
const res = []; | |
const e = node.expressions[0]; | |
const q = node.quasis[0]; | |
const leading = q ? q.value.raw : ``; | |
const resolved = resolveStringType(ctx, e, scope); | |
const restResolved = resolveTemplateKeys( | |
ctx, | |
{ | |
...node, | |
expressions: node.expressions.slice(1), | |
quasis: q ? node.quasis.slice(1) : node.quasis | |
}, | |
scope | |
); | |
for (const r of resolved) { | |
for (const rr of restResolved) { | |
res.push(leading + r + rr); | |
} | |
} | |
return res; | |
} | |
const SupportedBuiltinsSet = /* @__PURE__ */ new Set([ | |
"Partial", | |
"Required", | |
"Readonly", | |
"Pick", | |
"Omit" | |
]); | |
function resolveBuiltin(ctx, node, name, scope, typeParameters) { | |
const t = resolveTypeElements( | |
ctx, | |
node.typeParameters.params[0], | |
scope, | |
typeParameters | |
); | |
switch (name) { | |
case "Partial": { | |
const res2 = { props: {}, calls: t.calls }; | |
Object.keys(t.props).forEach((key) => { | |
res2.props[key] = { ...t.props[key], optional: true }; | |
}); | |
return res2; | |
} | |
case "Required": { | |
const res2 = { props: {}, calls: t.calls }; | |
Object.keys(t.props).forEach((key) => { | |
res2.props[key] = { ...t.props[key], optional: false }; | |
}); | |
return res2; | |
} | |
case "Readonly": | |
return t; | |
case "Pick": { | |
const picked = resolveStringType( | |
ctx, | |
node.typeParameters.params[1], | |
scope | |
); | |
const res2 = { props: {}, calls: t.calls }; | |
for (const key of picked) { | |
res2.props[key] = t.props[key]; | |
} | |
return res2; | |
} | |
case "Omit": | |
const omitted = resolveStringType( | |
ctx, | |
node.typeParameters.params[1], | |
scope | |
); | |
const res = { props: {}, calls: t.calls }; | |
for (const key in t.props) { | |
if (!omitted.includes(key)) { | |
res.props[key] = t.props[key]; | |
} | |
} | |
return res; | |
} | |
} | |
function resolveTypeReference(ctx, node, scope, name, onlyExported = false) { | |
const canCache = !(scope == null ? void 0 : scope.isGenericScope); | |
if (canCache && node._resolvedReference) { | |
return node._resolvedReference; | |
} | |
const resolved = innerResolveTypeReference( | |
ctx, | |
scope || ctxToScope(ctx), | |
name || getReferenceName(node), | |
node, | |
onlyExported | |
); | |
return canCache ? node._resolvedReference = resolved : resolved; | |
} | |
function innerResolveTypeReference(ctx, scope, name, node, onlyExported) { | |
if (typeof name === "string") { | |
if (scope.imports[name]) { | |
return resolveTypeFromImport(ctx, node, name, scope); | |
} else { | |
const lookupSource = node.type === "TSTypeQuery" ? onlyExported ? scope.exportedDeclares : scope.declares : onlyExported ? scope.exportedTypes : scope.types; | |
if (lookupSource[name]) { | |
return lookupSource[name]; | |
} else { | |
const globalScopes = resolveGlobalScope(ctx); | |
if (globalScopes) { | |
for (const s of globalScopes) { | |
const src = node.type === "TSTypeQuery" ? s.declares : s.types; | |
if (src[name]) { | |
(ctx.deps || (ctx.deps = /* @__PURE__ */ new Set())).add(s.filename); | |
return src[name]; | |
} | |
} | |
} | |
} | |
} | |
} else { | |
let ns = innerResolveTypeReference(ctx, scope, name[0], node, onlyExported); | |
if (ns) { | |
if (ns.type !== "TSModuleDeclaration") { | |
ns = ns._ns; | |
} | |
if (ns) { | |
const childScope = moduleDeclToScope(ctx, ns, ns._ownerScope || scope); | |
return innerResolveTypeReference( | |
ctx, | |
childScope, | |
name.length > 2 ? name.slice(1) : name[name.length - 1], | |
node, | |
!ns.declare | |
); | |
} | |
} | |
} | |
} | |
function getReferenceName(node) { | |
const ref = node.type === "TSTypeReference" ? node.typeName : node.type === "TSExpressionWithTypeArguments" ? node.expression : node.type === "TSImportType" ? node.qualifier : node.exprName; | |
if ((ref == null ? void 0 : ref.type) === "Identifier") { | |
return ref.name; | |
} else if ((ref == null ? void 0 : ref.type) === "TSQualifiedName") { | |
return qualifiedNameToPath(ref); | |
} else { | |
return "default"; | |
} | |
} | |
function qualifiedNameToPath(node) { | |
if (node.type === "Identifier") { | |
return [node.name]; | |
} else { | |
return [...qualifiedNameToPath(node.left), node.right.name]; | |
} | |
} | |
function resolveGlobalScope(ctx) { | |
if (ctx.options.globalTypeFiles) { | |
const fs = resolveFS(ctx); | |
if (!fs) { | |
throw new Error("[vue/compiler-sfc] globalTypeFiles requires fs access."); | |
} | |
return ctx.options.globalTypeFiles.map( | |
(file) => fileToScope(ctx, normalizePath(file), true) | |
); | |
} | |
} | |
let ts; | |
let loadTS; | |
function registerTS(_loadTS) { | |
loadTS = () => { | |
try { | |
return _loadTS(); | |
} catch (err) { | |
if (typeof err.message === "string" && err.message.includes("Cannot find module")) { | |
throw new Error( | |
'Failed to load TypeScript, which is required for resolving imported types. Please make sure "typescript" is installed as a project dependency.' | |
); | |
} else { | |
throw new Error( | |
"Failed to load TypeScript for resolving imported types." | |
); | |
} | |
} | |
}; | |
} | |
function resolveFS(ctx) { | |
if (ctx.fs) { | |
return ctx.fs; | |
} | |
if (!ts && loadTS) { | |
ts = loadTS(); | |
} | |
const fs = ctx.options.fs || (ts == null ? void 0 : ts.sys); | |
if (!fs) { | |
return; | |
} | |
return ctx.fs = { | |
fileExists(file) { | |
if (file.endsWith(".vue.ts")) { | |
file = file.replace(/\.ts$/, ""); | |
} | |
return fs.fileExists(file); | |
}, | |
readFile(file) { | |
if (file.endsWith(".vue.ts")) { | |
file = file.replace(/\.ts$/, ""); | |
} | |
return fs.readFile(file); | |
}, | |
realpath: fs.realpath | |
}; | |
} | |
function resolveTypeFromImport(ctx, node, name, scope) { | |
const { source, imported } = scope.imports[name]; | |
const sourceScope = importSourceToScope(ctx, node, scope, source); | |
return resolveTypeReference(ctx, node, sourceScope, imported, true); | |
} | |
function importSourceToScope(ctx, node, scope, source) { | |
let fs; | |
try { | |
fs = resolveFS(ctx); | |
} catch (err) { | |
return ctx.error(err.message, node, scope); | |
} | |
if (!fs) { | |
return ctx.error( | |
`No fs option provided to \`compileScript\` in non-Node environment. File system access is required for resolving imported types.`, | |
node, | |
scope | |
); | |
} | |
let resolved = scope.resolvedImportSources[source]; | |
if (!resolved) { | |
if (source.startsWith("..")) { | |
const osSpecificJoinFn = process__namespace.platform === "win32" ? path$1.join : joinPaths; | |
const filename = osSpecificJoinFn(path$1.dirname(scope.filename), source); | |
resolved = resolveExt(filename, fs); | |
} else if (source[0] === ".") { | |
const filename = joinPaths(path$1.dirname(scope.filename), source); | |
resolved = resolveExt(filename, fs); | |
} else { | |
if (!ts) { | |
if (loadTS) ts = loadTS(); | |
if (!ts) { | |
return ctx.error( | |
`Failed to resolve import source ${JSON.stringify(source)}. typescript is required as a peer dep for vue in order to support resolving types from module imports.`, | |
node, | |
scope | |
); | |
} | |
} | |
resolved = resolveWithTS(scope.filename, source, ts, fs); | |
} | |
if (resolved) { | |
resolved = scope.resolvedImportSources[source] = normalizePath(resolved); | |
} | |
} | |
if (resolved) { | |
(ctx.deps || (ctx.deps = /* @__PURE__ */ new Set())).add(resolved); | |
return fileToScope(ctx, resolved); | |
} else { | |
return ctx.error( | |
`Failed to resolve import source ${JSON.stringify(source)}.`, | |
node, | |
scope | |
); | |
} | |
} | |
function resolveExt(filename, fs) { | |
filename = filename.replace(/\.js$/, ""); | |
const tryResolve = (filename2) => { | |
if (fs.fileExists(filename2)) return filename2; | |
}; | |
return tryResolve(filename) || tryResolve(filename + `.ts`) || tryResolve(filename + `.tsx`) || tryResolve(filename + `.d.ts`) || tryResolve(joinPaths(filename, `index.ts`)) || tryResolve(joinPaths(filename, `index.tsx`)) || tryResolve(joinPaths(filename, `index.d.ts`)); | |
} | |
const tsConfigCache = createCache(); | |
const tsConfigRefMap = /* @__PURE__ */ new Map(); | |
function resolveWithTS(containingFile, source, ts2, fs) { | |
var _a, _b; | |
const configPath = ts2.findConfigFile(containingFile, fs.fileExists); | |
let tsCompilerOptions; | |
let tsResolveCache; | |
if (configPath) { | |
let configs; | |
const normalizedConfigPath = normalizePath(configPath); | |
const cached = tsConfigCache.get(normalizedConfigPath); | |
if (!cached) { | |
configs = loadTSConfig(configPath, ts2, fs).map((config) => ({ config })); | |
tsConfigCache.set(normalizedConfigPath, configs); | |
} else { | |
configs = cached; | |
} | |
let matchedConfig; | |
if (configs.length === 1) { | |
matchedConfig = configs[0]; | |
} else { | |
for (const c of configs) { | |
const base = normalizePath( | |
c.config.options.pathsBasePath || path$1.dirname(c.config.options.configFilePath) | |
); | |
const included = (_a = c.config.raw) == null ? void 0 : _a.include; | |
const excluded = (_b = c.config.raw) == null ? void 0 : _b.exclude; | |
if (!included && (!base || containingFile.startsWith(base)) || (included == null ? void 0 : included.some((p) => minimatch(containingFile, joinPaths(base, p))))) { | |
if (excluded && excluded.some((p) => minimatch(containingFile, joinPaths(base, p)))) { | |
continue; | |
} | |
matchedConfig = c; | |
break; | |
} | |
} | |
if (!matchedConfig) { | |
matchedConfig = configs[configs.length - 1]; | |
} | |
} | |
tsCompilerOptions = matchedConfig.config.options; | |
tsResolveCache = matchedConfig.cache || (matchedConfig.cache = ts2.createModuleResolutionCache( | |
process__namespace.cwd(), | |
createGetCanonicalFileName(ts2.sys.useCaseSensitiveFileNames), | |
tsCompilerOptions | |
)); | |
} else { | |
tsCompilerOptions = {}; | |
} | |
const res = ts2.resolveModuleName( | |
source, | |
containingFile, | |
tsCompilerOptions, | |
fs, | |
tsResolveCache | |
); | |
if (res.resolvedModule) { | |
let filename = res.resolvedModule.resolvedFileName; | |
if (filename.endsWith(".vue.ts")) { | |
filename = filename.replace(/\.ts$/, ""); | |
} | |
return fs.realpath ? fs.realpath(filename) : filename; | |
} | |
} | |
function loadTSConfig(configPath, ts2, fs, visited = /* @__PURE__ */ new Set()) { | |
const parseConfigHost = ts2.sys; | |
const config = ts2.parseJsonConfigFileContent( | |
ts2.readConfigFile(configPath, fs.readFile).config, | |
parseConfigHost, | |
path$1.dirname(configPath), | |
void 0, | |
configPath | |
); | |
const res = [config]; | |
visited.add(configPath); | |
if (config.projectReferences) { | |
for (const ref of config.projectReferences) { | |
const refPath = ts2.resolveProjectReferencePath(ref); | |
if (visited.has(refPath) || !fs.fileExists(refPath)) { | |
continue; | |
} | |
tsConfigRefMap.set(refPath, configPath); | |
res.unshift(...loadTSConfig(refPath, ts2, fs, visited)); | |
} | |
} | |
return res; | |
} | |
const fileToScopeCache = createCache(); | |
function invalidateTypeCache(filename) { | |
filename = normalizePath(filename); | |
fileToScopeCache.delete(filename); | |
tsConfigCache.delete(filename); | |
const affectedConfig = tsConfigRefMap.get(filename); | |
if (affectedConfig) tsConfigCache.delete(affectedConfig); | |
} | |
function fileToScope(ctx, filename, asGlobal = false) { | |
const cached = fileToScopeCache.get(filename); | |
if (cached) { | |
return cached; | |
} | |
const fs = resolveFS(ctx); | |
const source = fs.readFile(filename) || ""; | |
const body = parseFile(filename, source, ctx.options.babelParserPlugins); | |
const scope = new TypeScope(filename, source, 0, recordImports(body)); | |
recordTypes(ctx, body, scope, asGlobal); | |
fileToScopeCache.set(filename, scope); | |
return scope; | |
} | |
function parseFile(filename, content, parserPlugins) { | |
const ext = path$1.extname(filename); | |
if (ext === ".ts" || ext === ".mts" || ext === ".tsx" || ext === ".mtsx") { | |
return parser$2.parse(content, { | |
plugins: resolveParserPlugins( | |
ext.slice(1), | |
parserPlugins, | |
/\.d\.m?ts$/.test(filename) | |
), | |
sourceType: "module" | |
}).program.body; | |
} else if (ext === ".vue") { | |
const { | |
descriptor: { script, scriptSetup } | |
} = parse$1(content); | |
if (!script && !scriptSetup) { | |
return []; | |
} | |
const scriptOffset = script ? script.loc.start.offset : Infinity; | |
const scriptSetupOffset = scriptSetup ? scriptSetup.loc.start.offset : Infinity; | |
const firstBlock = scriptOffset < scriptSetupOffset ? script : scriptSetup; | |
const secondBlock = scriptOffset < scriptSetupOffset ? scriptSetup : script; | |
let scriptContent = " ".repeat(Math.min(scriptOffset, scriptSetupOffset)) + firstBlock.content; | |
if (secondBlock) { | |
scriptContent += " ".repeat(secondBlock.loc.start.offset - script.loc.end.offset) + secondBlock.content; | |
} | |
const lang = (script == null ? void 0 : script.lang) || (scriptSetup == null ? void 0 : scriptSetup.lang); | |
return parser$2.parse(scriptContent, { | |
plugins: resolveParserPlugins(lang, parserPlugins), | |
sourceType: "module" | |
}).program.body; | |
} | |
return []; | |
} | |
function ctxToScope(ctx) { | |
if (ctx.scope) { | |
return ctx.scope; | |
} | |
const body = "ast" in ctx ? ctx.ast : ctx.scriptAst ? [...ctx.scriptAst.body, ...ctx.scriptSetupAst.body] : ctx.scriptSetupAst.body; | |
const scope = new TypeScope( | |
ctx.filename, | |
ctx.source, | |
"startOffset" in ctx ? ctx.startOffset : 0, | |
"userImports" in ctx ? Object.create(ctx.userImports) : recordImports(body) | |
); | |
recordTypes(ctx, body, scope); | |
return ctx.scope = scope; | |
} | |
function moduleDeclToScope(ctx, node, parentScope) { | |
if (node._resolvedChildScope) { | |
return node._resolvedChildScope; | |
} | |
const scope = createChildScope(parentScope); | |
if (node.body.type === "TSModuleDeclaration") { | |
const decl = node.body; | |
decl._ownerScope = scope; | |
const id = getId(decl.id); | |
scope.types[id] = scope.exportedTypes[id] = decl; | |
} else { | |
recordTypes(ctx, node.body.body, scope); | |
} | |
return node._resolvedChildScope = scope; | |
} | |
function createChildScope(parentScope) { | |
return new TypeScope( | |
parentScope.filename, | |
parentScope.source, | |
parentScope.offset, | |
Object.create(parentScope.imports), | |
Object.create(parentScope.types), | |
Object.create(parentScope.declares) | |
); | |
} | |
const importExportRE = /^Import|^Export/; | |
function recordTypes(ctx, body, scope, asGlobal = false) { | |
const { types, declares, exportedTypes, exportedDeclares, imports } = scope; | |
const isAmbient = asGlobal ? !body.some((s) => importExportRE.test(s.type)) : false; | |
for (const stmt of body) { | |
if (asGlobal) { | |
if (isAmbient) { | |
if (stmt.declare) { | |
recordType(stmt, types, declares); | |
} | |
} else if (stmt.type === "TSModuleDeclaration" && stmt.global) { | |
for (const s of stmt.body.body) { | |
recordType(s, types, declares); | |
} | |
} | |
} else { | |
recordType(stmt, types, declares); | |
} | |
} | |
if (!asGlobal) { | |
for (const stmt of body) { | |
if (stmt.type === "ExportNamedDeclaration") { | |
if (stmt.declaration) { | |
recordType(stmt.declaration, types, declares); | |
recordType(stmt.declaration, exportedTypes, exportedDeclares); | |
} else { | |
for (const spec of stmt.specifiers) { | |
if (spec.type === "ExportSpecifier") { | |
const local = spec.local.name; | |
const exported = getId(spec.exported); | |
if (stmt.source) { | |
imports[exported] = { | |
source: stmt.source.value, | |
imported: local | |
}; | |
exportedTypes[exported] = { | |
type: "TSTypeReference", | |
typeName: { | |
type: "Identifier", | |
name: local | |
}, | |
_ownerScope: scope | |
}; | |
} else if (types[local]) { | |
exportedTypes[exported] = types[local]; | |
} | |
} | |
} | |
} | |
} else if (stmt.type === "ExportAllDeclaration") { | |
const sourceScope = importSourceToScope( | |
ctx, | |
stmt.source, | |
scope, | |
stmt.source.value | |
); | |
Object.assign(scope.exportedTypes, sourceScope.exportedTypes); | |
} else if (stmt.type === "ExportDefaultDeclaration" && stmt.declaration) { | |
if (stmt.declaration.type !== "Identifier") { | |
recordType(stmt.declaration, types, declares, "default"); | |
recordType( | |
stmt.declaration, | |
exportedTypes, | |
exportedDeclares, | |
"default" | |
); | |
} else if (types[stmt.declaration.name]) { | |
exportedTypes["default"] = types[stmt.declaration.name]; | |
} | |
} | |
} | |
} | |
for (const key of Object.keys(types)) { | |
const node = types[key]; | |
node._ownerScope = scope; | |
if (node._ns) node._ns._ownerScope = scope; | |
} | |
for (const key of Object.keys(declares)) { | |
declares[key]._ownerScope = scope; | |
} | |
} | |
function recordType(node, types, declares, overwriteId) { | |
switch (node.type) { | |
case "TSInterfaceDeclaration": | |
case "TSEnumDeclaration": | |
case "TSModuleDeclaration": { | |
const id = overwriteId || getId(node.id); | |
let existing = types[id]; | |
if (existing) { | |
if (node.type === "TSModuleDeclaration") { | |
if (existing.type === "TSModuleDeclaration") { | |
mergeNamespaces(existing, node); | |
} else { | |
attachNamespace(existing, node); | |
} | |
break; | |
} | |
if (existing.type === "TSModuleDeclaration") { | |
types[id] = node; | |
attachNamespace(node, existing); | |
break; | |
} | |
if (existing.type !== node.type) { | |
break; | |
} | |
if (node.type === "TSInterfaceDeclaration") { | |
existing.body.body.push(...node.body.body); | |
} else { | |
existing.members.push(...node.members); | |
} | |
} else { | |
types[id] = node; | |
} | |
break; | |
} | |
case "ClassDeclaration": | |
if (overwriteId || node.id) types[overwriteId || getId(node.id)] = node; | |
break; | |
case "TSTypeAliasDeclaration": | |
types[node.id.name] = node.typeParameters ? node : node.typeAnnotation; | |
break; | |
case "TSDeclareFunction": | |
if (node.id) declares[node.id.name] = node; | |
break; | |
case "VariableDeclaration": { | |
if (node.declare) { | |
for (const decl of node.declarations) { | |
if (decl.id.type === "Identifier" && decl.id.typeAnnotation) { | |
declares[decl.id.name] = decl.id.typeAnnotation.typeAnnotation; | |
} | |
} | |
} | |
break; | |
} | |
} | |
} | |
function mergeNamespaces(to, from) { | |
const toBody = to.body; | |
const fromBody = from.body; | |
if (toBody.type === "TSModuleDeclaration") { | |
if (fromBody.type === "TSModuleDeclaration") { | |
mergeNamespaces(toBody, fromBody); | |
} else { | |
fromBody.body.push({ | |
type: "ExportNamedDeclaration", | |
declaration: toBody, | |
exportKind: "type", | |
specifiers: [] | |
}); | |
} | |
} else if (fromBody.type === "TSModuleDeclaration") { | |
toBody.body.push({ | |
type: "ExportNamedDeclaration", | |
declaration: fromBody, | |
exportKind: "type", | |
specifiers: [] | |
}); | |
} else { | |
toBody.body.push(...fromBody.body); | |
} | |
} | |
function attachNamespace(to, ns) { | |
if (!to._ns) { | |
to._ns = ns; | |
} else { | |
mergeNamespaces(to._ns, ns); | |
} | |
} | |
function recordImports(body) { | |
const imports = /* @__PURE__ */ Object.create(null); | |
for (const s of body) { | |
recordImport(s, imports); | |
} | |
return imports; | |
} | |
function recordImport(node, imports) { | |
if (node.type !== "ImportDeclaration") { | |
return; | |
} | |
for (const s of node.specifiers) { | |
imports[s.local.name] = { | |
imported: getImportedName(s), | |
source: node.source.value | |
}; | |
} | |
} | |
function inferRuntimeType(ctx, node, scope = node._ownerScope || ctxToScope(ctx), isKeyOf = false) { | |
try { | |
switch (node.type) { | |
case "TSStringKeyword": | |
return ["String"]; | |
case "TSNumberKeyword": | |
return ["Number"]; | |
case "TSBooleanKeyword": | |
return ["Boolean"]; | |
case "TSObjectKeyword": | |
return ["Object"]; | |
case "TSNullKeyword": | |
return ["null"]; | |
case "TSTypeLiteral": | |
case "TSInterfaceDeclaration": { | |
const types = /* @__PURE__ */ new Set(); | |
const members = node.type === "TSTypeLiteral" ? node.members : node.body.body; | |
for (const m of members) { | |
if (isKeyOf) { | |
if (m.type === "TSPropertySignature" && m.key.type === "NumericLiteral") { | |
types.add("Number"); | |
} else if (m.type === "TSIndexSignature") { | |
const annotation = m.parameters[0].typeAnnotation; | |
if (annotation && annotation.type !== "Noop") { | |
const type = inferRuntimeType( | |
ctx, | |
annotation.typeAnnotation, | |
scope | |
)[0]; | |
if (type === UNKNOWN_TYPE) return [UNKNOWN_TYPE]; | |
types.add(type); | |
} | |
} else { | |
types.add("String"); | |
} | |
} else if (m.type === "TSCallSignatureDeclaration" || m.type === "TSConstructSignatureDeclaration") { | |
types.add("Function"); | |
} else { | |
types.add("Object"); | |
} | |
} | |
return types.size ? Array.from(types) : [isKeyOf ? UNKNOWN_TYPE : "Object"]; | |
} | |
case "TSPropertySignature": | |
if (node.typeAnnotation) { | |
return inferRuntimeType( | |
ctx, | |
node.typeAnnotation.typeAnnotation, | |
scope | |
); | |
} | |
break; | |
case "TSMethodSignature": | |
case "TSFunctionType": | |
return ["Function"]; | |
case "TSArrayType": | |
case "TSTupleType": | |
return ["Array"]; | |
case "TSLiteralType": | |
switch (node.literal.type) { | |
case "StringLiteral": | |
return ["String"]; | |
case "BooleanLiteral": | |
return ["Boolean"]; | |
case "NumericLiteral": | |
case "BigIntLiteral": | |
return ["Number"]; | |
default: | |
return [UNKNOWN_TYPE]; | |
} | |
case "TSTypeReference": { | |
const resolved = resolveTypeReference(ctx, node, scope); | |
if (resolved) { | |
return inferRuntimeType(ctx, resolved, resolved._ownerScope, isKeyOf); | |
} | |
if (node.typeName.type === "Identifier") { | |
if (isKeyOf) { | |
switch (node.typeName.name) { | |
case "String": | |
case "Array": | |
case "ArrayLike": | |
case "Parameters": | |
case "ConstructorParameters": | |
case "ReadonlyArray": | |
return ["String", "Number"]; | |
// TS built-in utility types | |
case "Record": | |
case "Partial": | |
case "Required": | |
case "Readonly": | |
if (node.typeParameters && node.typeParameters.params[0]) { | |
return inferRuntimeType( | |
ctx, | |
node.typeParameters.params[0], | |
scope, | |
true | |
); | |
} | |
break; | |
case "Pick": | |
case "Extract": | |
if (node.typeParameters && node.typeParameters.params[1]) { | |
return inferRuntimeType( | |
ctx, | |
node.typeParameters.params[1], | |
scope | |
); | |
} | |
break; | |
case "Function": | |
case "Object": | |
case "Set": | |
case "Map": | |
case "WeakSet": | |
case "WeakMap": | |
case "Date": | |
case "Promise": | |
case "Error": | |
case "Uppercase": | |
case "Lowercase": | |
case "Capitalize": | |
case "Uncapitalize": | |
case "ReadonlyMap": | |
case "ReadonlySet": | |
return ["String"]; | |
} | |
} else { | |
switch (node.typeName.name) { | |
case "Array": | |
case "Function": | |
case "Object": | |
case "Set": | |
case "Map": | |
case "WeakSet": | |
case "WeakMap": | |
case "Date": | |
case "Promise": | |
case "Error": | |
return [node.typeName.name]; | |
// TS built-in utility types | |
// https://www.typescriptlang.org/docs/handbook/utility-types.html | |
case "Partial": | |
case "Required": | |
case "Readonly": | |
case "Record": | |
case "Pick": | |
case "Omit": | |
case "InstanceType": | |
return ["Object"]; | |
case "Uppercase": | |
case "Lowercase": | |
case "Capitalize": | |
case "Uncapitalize": | |
return ["String"]; | |
case "Parameters": | |
case "ConstructorParameters": | |
case "ReadonlyArray": | |
return ["Array"]; | |
case "ReadonlyMap": | |
return ["Map"]; | |
case "ReadonlySet": | |
return ["Set"]; | |
case "NonNullable": | |
if (node.typeParameters && node.typeParameters.params[0]) { | |
return inferRuntimeType( | |
ctx, | |
node.typeParameters.params[0], | |
scope | |
).filter((t) => t !== "null"); | |
} | |
break; | |
case "Extract": | |
if (node.typeParameters && node.typeParameters.params[1]) { | |
return inferRuntimeType( | |
ctx, | |
node.typeParameters.params[1], | |
scope | |
); | |
} | |
break; | |
case "Exclude": | |
case "OmitThisParameter": | |
if (node.typeParameters && node.typeParameters.params[0]) { | |
return inferRuntimeType( | |
ctx, | |
node.typeParameters.params[0], | |
scope | |
); | |
} | |
break; | |
} | |
} | |
} | |
break; | |
} | |
case "TSParenthesizedType": | |
return inferRuntimeType(ctx, node.typeAnnotation, scope); | |
case "TSUnionType": | |
return flattenTypes(ctx, node.types, scope, isKeyOf); | |
case "TSIntersectionType": { | |
return flattenTypes(ctx, node.types, scope, isKeyOf).filter( | |
(t) => t !== UNKNOWN_TYPE | |
); | |
} | |
case "TSEnumDeclaration": | |
return inferEnumType(node); | |
case "TSSymbolKeyword": | |
return ["Symbol"]; | |
case "TSIndexedAccessType": { | |
const types = resolveIndexType(ctx, node, scope); | |
return flattenTypes(ctx, types, scope, isKeyOf); | |
} | |
case "ClassDeclaration": | |
return ["Object"]; | |
case "TSImportType": { | |
const sourceScope = importSourceToScope( | |
ctx, | |
node.argument, | |
scope, | |
node.argument.value | |
); | |
const resolved = resolveTypeReference(ctx, node, sourceScope); | |
if (resolved) { | |
return inferRuntimeType(ctx, resolved, resolved._ownerScope); | |
} | |
break; | |
} | |
case "TSTypeQuery": { | |
const id = node.exprName; | |
if (id.type === "Identifier") { | |
const matched = scope.declares[id.name]; | |
if (matched) { | |
return inferRuntimeType(ctx, matched, matched._ownerScope, isKeyOf); | |
} | |
} | |
break; | |
} | |
// e.g. readonly | |
case "TSTypeOperator": { | |
return inferRuntimeType( | |
ctx, | |
node.typeAnnotation, | |
scope, | |
node.operator === "keyof" | |
); | |
} | |
case "TSAnyKeyword": { | |
if (isKeyOf) { | |
return ["String", "Number", "Symbol"]; | |
} | |
break; | |
} | |
} | |
} catch (e) { | |
} | |
return [UNKNOWN_TYPE]; | |
} | |
function flattenTypes(ctx, types, scope, isKeyOf = false) { | |
if (types.length === 1) { | |
return inferRuntimeType(ctx, types[0], scope, isKeyOf); | |
} | |
return [ | |
...new Set( | |
[].concat( | |
...types.map((t) => inferRuntimeType(ctx, t, scope, isKeyOf)) | |
) | |
) | |
]; | |
} | |
function inferEnumType(node) { | |
const types = /* @__PURE__ */ new Set(); | |
for (const m of node.members) { | |
if (m.initializer) { | |
switch (m.initializer.type) { | |
case "StringLiteral": | |
types.add("String"); | |
break; | |
case "NumericLiteral": | |
types.add("Number"); | |
break; | |
} | |
} | |
} | |
return types.size ? [...types] : ["Number"]; | |
} | |
function resolveExtractPropTypes({ props }, scope) { | |
const res = { props: {} }; | |
for (const key in props) { | |
const raw = props[key]; | |
res.props[key] = reverseInferType( | |
raw.key, | |
raw.typeAnnotation.typeAnnotation, | |
scope | |
); | |
} | |
return res; | |
} | |
function reverseInferType(key, node, scope, optional = true, checkObjectSyntax = true) { | |
if (checkObjectSyntax && node.type === "TSTypeLiteral") { | |
const typeType = findStaticPropertyType(node, "type"); | |
if (typeType) { | |
const requiredType = findStaticPropertyType(node, "required"); | |
const optional2 = requiredType && requiredType.type === "TSLiteralType" && requiredType.literal.type === "BooleanLiteral" ? !requiredType.literal.value : true; | |
return reverseInferType(key, typeType, scope, optional2, false); | |
} | |
} else if (node.type === "TSTypeReference" && node.typeName.type === "Identifier") { | |
if (node.typeName.name.endsWith("Constructor")) { | |
return createProperty( | |
key, | |
ctorToType(node.typeName.name), | |
scope, | |
optional | |
); | |
} else if (node.typeName.name === "PropType" && node.typeParameters) { | |
return createProperty(key, node.typeParameters.params[0], scope, optional); | |
} | |
} | |
if ((node.type === "TSTypeReference" || node.type === "TSImportType") && node.typeParameters) { | |
for (const t of node.typeParameters.params) { | |
const inferred = reverseInferType(key, t, scope, optional); | |
if (inferred) return inferred; | |
} | |
} | |
return createProperty(key, { type: `TSNullKeyword` }, scope, optional); | |
} | |
function ctorToType(ctorType) { | |
const ctor = ctorType.slice(0, -11); | |
switch (ctor) { | |
case "String": | |
case "Number": | |
case "Boolean": | |
return { type: `TS${ctor}Keyword` }; | |
case "Array": | |
case "Function": | |
case "Object": | |
case "Set": | |
case "Map": | |
case "WeakSet": | |
case "WeakMap": | |
case "Date": | |
case "Promise": | |
return { | |
type: "TSTypeReference", | |
typeName: { type: "Identifier", name: ctor } | |
}; | |
} | |
return { type: `TSNullKeyword` }; | |
} | |
function findStaticPropertyType(node, key) { | |
const prop = node.members.find( | |
(m) => m.type === "TSPropertySignature" && !m.computed && getId(m.key) === key && m.typeAnnotation | |
); | |
return prop && prop.typeAnnotation.typeAnnotation; | |
} | |
function resolveReturnType(ctx, arg, scope) { | |
var _a; | |
let resolved = arg; | |
if (arg.type === "TSTypeReference" || arg.type === "TSTypeQuery" || arg.type === "TSImportType") { | |
resolved = resolveTypeReference(ctx, arg, scope); | |
} | |
if (!resolved) return; | |
if (resolved.type === "TSFunctionType") { | |
return (_a = resolved.typeAnnotation) == null ? void 0 : _a.typeAnnotation; | |
} | |
if (resolved.type === "TSDeclareFunction") { | |
return resolved.returnType; | |
} | |
} | |
function resolveUnionType(ctx, node, scope) { | |
if (node.type === "TSTypeReference") { | |
const resolved = resolveTypeReference(ctx, node, scope); | |
if (resolved) node = resolved; | |
} | |
let types; | |
if (node.type === "TSUnionType") { | |
types = node.types.flatMap((node2) => resolveUnionType(ctx, node2, scope)); | |
} else { | |
types = [node]; | |
} | |
return types; | |
} | |
const DEFINE_MODEL = "defineModel"; | |
function processDefineModel(ctx, node, declId) { | |
if (!isCallOf(node, DEFINE_MODEL)) { | |
return false; | |
} | |
ctx.hasDefineModelCall = true; | |
const type = node.typeParameters && node.typeParameters.params[0] || void 0; | |
let modelName; | |
let options; | |
const arg0 = node.arguments[0] && CompilerDOM.unwrapTSNode(node.arguments[0]); | |
const hasName = arg0 && arg0.type === "StringLiteral"; | |
if (hasName) { | |
modelName = arg0.value; | |
options = node.arguments[1]; | |
} else { | |
modelName = "modelValue"; | |
options = arg0; | |
} | |
if (ctx.modelDecls[modelName]) { | |
ctx.error(`duplicate model name ${JSON.stringify(modelName)}`, node); | |
} | |
let optionsString = options && ctx.getString(options); | |
let optionsRemoved = !options; | |
const runtimeOptionNodes = []; | |
if (options && options.type === "ObjectExpression" && !options.properties.some((p) => p.type === "SpreadElement" || p.computed)) { | |
let removed = 0; | |
for (let i = options.properties.length - 1; i >= 0; i--) { | |
const p = options.properties[i]; | |
const next = options.properties[i + 1]; | |
const start = p.start; | |
const end = next ? next.start : options.end - 1; | |
if ((p.type === "ObjectProperty" || p.type === "ObjectMethod") && (p.key.type === "Identifier" && (p.key.name === "get" || p.key.name === "set") || p.key.type === "StringLiteral" && (p.key.value === "get" || p.key.value === "set"))) { | |
optionsString = optionsString.slice(0, start - options.start) + optionsString.slice(end - options.start); | |
} else { | |
removed++; | |
ctx.s.remove(ctx.startOffset + start, ctx.startOffset + end); | |
runtimeOptionNodes.push(p); | |
} | |
} | |
if (removed === options.properties.length) { | |
optionsRemoved = true; | |
ctx.s.remove( | |
ctx.startOffset + (hasName ? arg0.end : options.start), | |
ctx.startOffset + options.end | |
); | |
} | |
} | |
ctx.modelDecls[modelName] = { | |
type, | |
options: optionsString, | |
runtimeOptionNodes, | |
identifier: declId && declId.type === "Identifier" ? declId.name : void 0 | |
}; | |
ctx.bindingMetadata[modelName] = "props"; | |
ctx.s.overwrite( | |
ctx.startOffset + node.callee.start, | |
ctx.startOffset + node.callee.end, | |
ctx.helper("useModel") | |
); | |
ctx.s.appendLeft( | |
ctx.startOffset + (node.arguments.length ? node.arguments[0].start : node.end - 1), | |
`__props, ` + (hasName ? `` : `${JSON.stringify(modelName)}${optionsRemoved ? `` : `, `}`) | |
); | |
return true; | |
} | |
function genModelProps(ctx) { | |
if (!ctx.hasDefineModelCall) return; | |
const isProd = !!ctx.options.isProd; | |
let modelPropsDecl = ""; | |
for (const [name, { type, options: runtimeOptions }] of Object.entries( | |
ctx.modelDecls | |
)) { | |
let skipCheck = false; | |
let codegenOptions = ``; | |
let runtimeTypes = type && inferRuntimeType(ctx, type); | |
if (runtimeTypes) { | |
const hasBoolean = runtimeTypes.includes("Boolean"); | |
const hasFunction = runtimeTypes.includes("Function"); | |
const hasUnknownType = runtimeTypes.includes(UNKNOWN_TYPE); | |
if (hasUnknownType) { | |
if (hasBoolean || hasFunction) { | |
runtimeTypes = runtimeTypes.filter((t) => t !== UNKNOWN_TYPE); | |
skipCheck = true; | |
} else { | |
runtimeTypes = ["null"]; | |
} | |
} | |
if (!isProd) { | |
codegenOptions = `type: ${toRuntimeTypeString(runtimeTypes)}` + (skipCheck ? ", skipCheck: true" : ""); | |
} else if (hasBoolean || runtimeOptions && hasFunction) { | |
codegenOptions = `type: ${toRuntimeTypeString(runtimeTypes)}`; | |
} else ; | |
} | |
let decl; | |
if (codegenOptions && runtimeOptions) { | |
decl = ctx.isTS ? `{ ${codegenOptions}, ...${runtimeOptions} }` : `Object.assign({ ${codegenOptions} }, ${runtimeOptions})`; | |
} else if (codegenOptions) { | |
decl = `{ ${codegenOptions} }`; | |
} else if (runtimeOptions) { | |
decl = runtimeOptions; | |
} else { | |
decl = `{}`; | |
} | |
modelPropsDecl += ` | |
${JSON.stringify(name)}: ${decl},`; | |
const modifierPropName = JSON.stringify( | |
name === "modelValue" ? `modelModifiers` : `${name}Modifiers` | |
); | |
modelPropsDecl += ` | |
${modifierPropName}: {},`; | |
} | |
return `{${modelPropsDecl} | |
}`; | |
} | |
const DEFINE_PROPS = "defineProps"; | |
const WITH_DEFAULTS = "withDefaults"; | |
function processDefineProps(ctx, node, declId, isWithDefaults = false) { | |
if (!isCallOf(node, DEFINE_PROPS)) { | |
return processWithDefaults(ctx, node, declId); | |
} | |
if (ctx.hasDefinePropsCall) { | |
ctx.error(`duplicate ${DEFINE_PROPS}() call`, node); | |
} | |
ctx.hasDefinePropsCall = true; | |
ctx.propsRuntimeDecl = node.arguments[0]; | |
if (ctx.propsRuntimeDecl) { | |
for (const key of getObjectOrArrayExpressionKeys(ctx.propsRuntimeDecl)) { | |
if (!(key in ctx.bindingMetadata)) { | |
ctx.bindingMetadata[key] = "props"; | |
} | |
} | |
} | |
if (node.typeParameters) { | |
if (ctx.propsRuntimeDecl) { | |
ctx.error( | |
`${DEFINE_PROPS}() cannot accept both type and non-type arguments at the same time. Use one or the other.`, | |
node | |
); | |
} | |
ctx.propsTypeDecl = node.typeParameters.params[0]; | |
} | |
if (!isWithDefaults && declId && declId.type === "ObjectPattern") { | |
processPropsDestructure(ctx, declId); | |
} | |
ctx.propsCall = node; | |
ctx.propsDecl = declId; | |
return true; | |
} | |
function processWithDefaults(ctx, node, declId) { | |
if (!isCallOf(node, WITH_DEFAULTS)) { | |
return false; | |
} | |
if (!processDefineProps( | |
ctx, | |
node.arguments[0], | |
declId, | |
true | |
)) { | |
ctx.error( | |
`${WITH_DEFAULTS}' first argument must be a ${DEFINE_PROPS} call.`, | |
node.arguments[0] || node | |
); | |
} | |
if (ctx.propsRuntimeDecl) { | |
ctx.error( | |
`${WITH_DEFAULTS} can only be used with type-based ${DEFINE_PROPS} declaration.`, | |
node | |
); | |
} | |
if (declId && declId.type === "ObjectPattern") { | |
ctx.warn( | |
`${WITH_DEFAULTS}() is unnecessary when using destructure with ${DEFINE_PROPS}(). | |
Reactive destructure will be disabled when using withDefaults(). | |
Prefer using destructure default values, e.g. const { foo = 1 } = defineProps(...). `, | |
node.callee | |
); | |
} | |
ctx.propsRuntimeDefaults = node.arguments[1]; | |
if (!ctx.propsRuntimeDefaults) { | |
ctx.error(`The 2nd argument of ${WITH_DEFAULTS} is required.`, node); | |
} | |
ctx.propsCall = node; | |
return true; | |
} | |
function genRuntimeProps(ctx) { | |
let propsDecls; | |
if (ctx.propsRuntimeDecl) { | |
propsDecls = ctx.getString(ctx.propsRuntimeDecl).trim(); | |
if (ctx.propsDestructureDecl) { | |
const defaults = []; | |
for (const key in ctx.propsDestructuredBindings) { | |
const d = genDestructuredDefaultValue(ctx, key); | |
const finalKey = getEscapedPropName(key); | |
if (d) | |
defaults.push( | |
`${finalKey}: ${d.valueString}${d.needSkipFactory ? `, __skip_${finalKey}: true` : ``}` | |
); | |
} | |
if (defaults.length) { | |
propsDecls = `/*@__PURE__*/${ctx.helper( | |
`mergeDefaults` | |
)}(${propsDecls}, { | |
${defaults.join(",\n ")} | |
})`; | |
} | |
} | |
} else if (ctx.propsTypeDecl) { | |
propsDecls = extractRuntimeProps(ctx); | |
} | |
const modelsDecls = genModelProps(ctx); | |
if (propsDecls && modelsDecls) { | |
return `/*@__PURE__*/${ctx.helper( | |
"mergeModels" | |
)}(${propsDecls}, ${modelsDecls})`; | |
} else { | |
return modelsDecls || propsDecls; | |
} | |
} | |
function extractRuntimeProps(ctx) { | |
const props = resolveRuntimePropsFromType(ctx, ctx.propsTypeDecl); | |
if (!props.length) { | |
return; | |
} | |
const propStrings = []; | |
const hasStaticDefaults = hasStaticWithDefaults(ctx); | |
for (const prop of props) { | |
propStrings.push(genRuntimePropFromType(ctx, prop, hasStaticDefaults)); | |
if ("bindingMetadata" in ctx && !(prop.key in ctx.bindingMetadata)) { | |
ctx.bindingMetadata[prop.key] = "props"; | |
} | |
} | |
let propsDecls = `{ | |
${propStrings.join(",\n ")} | |
}`; | |
if (ctx.propsRuntimeDefaults && !hasStaticDefaults) { | |
propsDecls = `/*@__PURE__*/${ctx.helper( | |
"mergeDefaults" | |
)}(${propsDecls}, ${ctx.getString(ctx.propsRuntimeDefaults)})`; | |
} | |
return propsDecls; | |
} | |
function resolveRuntimePropsFromType(ctx, node) { | |
const props = []; | |
const elements = resolveTypeElements(ctx, node); | |
for (const key in elements.props) { | |
const e = elements.props[key]; | |
let type = inferRuntimeType(ctx, e); | |
let skipCheck = false; | |
if (type.includes(UNKNOWN_TYPE)) { | |
if (type.includes("Boolean") || type.includes("Function")) { | |
type = type.filter((t) => t !== UNKNOWN_TYPE); | |
skipCheck = true; | |
} else { | |
type = ["null"]; | |
} | |
} | |
props.push({ | |
key, | |
required: !e.optional, | |
type: type || [`null`], | |
skipCheck | |
}); | |
} | |
return props; | |
} | |
function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStaticDefaults) { | |
let defaultString; | |
const destructured = genDestructuredDefaultValue(ctx, key, type); | |
if (destructured) { | |
defaultString = `default: ${destructured.valueString}${destructured.needSkipFactory ? `, skipFactory: true` : ``}`; | |
} else if (hasStaticDefaults) { | |
const prop = ctx.propsRuntimeDefaults.properties.find( | |
(node) => { | |
if (node.type === "SpreadElement") return false; | |
return resolveObjectKey(node.key, node.computed) === key; | |
} | |
); | |
if (prop) { | |
if (prop.type === "ObjectProperty") { | |
defaultString = `default: ${ctx.getString(prop.value)}`; | |
} else { | |
defaultString = `${prop.async ? "async " : ""}${prop.kind !== "method" ? `${prop.kind} ` : ""}default() ${ctx.getString(prop.body)}`; | |
} | |
} | |
} | |
const finalKey = getEscapedPropName(key); | |
if (!ctx.options.isProd) { | |
return `${finalKey}: { ${concatStrings([ | |
`type: ${toRuntimeTypeString(type)}`, | |
`required: ${required}`, | |
skipCheck && "skipCheck: true", | |
defaultString | |
])} }`; | |
} else if (type.some( | |
(el) => el === "Boolean" || (!hasStaticDefaults || defaultString) && el === "Function" | |
)) { | |
return `${finalKey}: { ${concatStrings([ | |
`type: ${toRuntimeTypeString(type)}`, | |
defaultString | |
])} }`; | |
} else { | |
if (ctx.isCE) { | |
if (defaultString) { | |
return `${finalKey}: ${`{ ${defaultString}, type: ${toRuntimeTypeString( | |
type | |
)} }`}`; | |
} else { | |
return `${finalKey}: {type: ${toRuntimeTypeString(type)}}`; | |
} | |
} | |
return `${finalKey}: ${defaultString ? `{ ${defaultString} }` : `{}`}`; | |
} | |
} | |
function hasStaticWithDefaults(ctx) { | |
return !!(ctx.propsRuntimeDefaults && ctx.propsRuntimeDefaults.type === "ObjectExpression" && ctx.propsRuntimeDefaults.properties.every( | |
(node) => node.type !== "SpreadElement" && (!node.computed || node.key.type.endsWith("Literal")) | |
)); | |
} | |
function genDestructuredDefaultValue(ctx, key, inferredType) { | |
const destructured = ctx.propsDestructuredBindings[key]; | |
const defaultVal = destructured && destructured.default; | |
if (defaultVal) { | |
const value = ctx.getString(defaultVal); | |
const unwrapped = CompilerDOM.unwrapTSNode(defaultVal); | |
if (inferredType && inferredType.length && !inferredType.includes("null")) { | |
const valueType = inferValueType(unwrapped); | |
if (valueType && !inferredType.includes(valueType)) { | |
ctx.error( | |
`Default value of prop "${key}" does not match declared type.`, | |
unwrapped | |
); | |
} | |
} | |
const needSkipFactory = !inferredType && (CompilerDOM.isFunctionType(unwrapped) || unwrapped.type === "Identifier"); | |
const needFactoryWrap = !needSkipFactory && !isLiteralNode(unwrapped) && !(inferredType == null ? void 0 : inferredType.includes("Function")); | |
return { | |
valueString: needFactoryWrap ? `() => (${value})` : value, | |
needSkipFactory | |
}; | |
} | |
} | |
function inferValueType(node) { | |
switch (node.type) { | |
case "StringLiteral": | |
return "String"; | |
case "NumericLiteral": | |
return "Number"; | |
case "BooleanLiteral": | |
return "Boolean"; | |
case "ObjectExpression": | |
return "Object"; | |
case "ArrayExpression": | |
return "Array"; | |
case "FunctionExpression": | |
case "ArrowFunctionExpression": | |
return "Function"; | |
} | |
} | |
function processPropsDestructure(ctx, declId) { | |
if (ctx.options.propsDestructure === "error") { | |
ctx.error(`Props destructure is explicitly prohibited via config.`, declId); | |
} else if (ctx.options.propsDestructure === false) { | |
return; | |
} | |
ctx.propsDestructureDecl = declId; | |
const registerBinding = (key, local, defaultValue) => { | |
ctx.propsDestructuredBindings[key] = { local, default: defaultValue }; | |
if (local !== key) { | |
ctx.bindingMetadata[local] = "props-aliased"; | |
(ctx.bindingMetadata.__propsAliases || (ctx.bindingMetadata.__propsAliases = {}))[local] = key; | |
} | |
}; | |
for (const prop of declId.properties) { | |
if (prop.type === "ObjectProperty") { | |
const propKey = resolveObjectKey(prop.key, prop.computed); | |
if (!propKey) { | |
ctx.error( | |
`${DEFINE_PROPS}() destructure cannot use computed key.`, | |
prop.key | |
); | |
} | |
if (prop.value.type === "AssignmentPattern") { | |
const { left, right } = prop.value; | |
if (left.type !== "Identifier") { | |
ctx.error( | |
`${DEFINE_PROPS}() destructure does not support nested patterns.`, | |
left | |
); | |
} | |
registerBinding(propKey, left.name, right); | |
} else if (prop.value.type === "Identifier") { | |
registerBinding(propKey, prop.value.name); | |
} else { | |
ctx.error( | |
`${DEFINE_PROPS}() destructure does not support nested patterns.`, | |
prop.value | |
); | |
} | |
} else { | |
ctx.propsDestructureRestId = prop.argument.name; | |
ctx.bindingMetadata[ctx.propsDestructureRestId] = "setup-reactive-const"; | |
} | |
} | |
} | |
function transformDestructuredProps(ctx, vueImportAliases) { | |
if (ctx.options.propsDestructure === false) { | |
return; | |
} | |
const rootScope = /* @__PURE__ */ Object.create(null); | |
const scopeStack = [rootScope]; | |
let currentScope = rootScope; | |
const excludedIds = /* @__PURE__ */ new WeakSet(); | |
const parentStack = []; | |
const propsLocalToPublicMap = /* @__PURE__ */ Object.create(null); | |
for (const key in ctx.propsDestructuredBindings) { | |
const { local } = ctx.propsDestructuredBindings[key]; | |
rootScope[local] = true; | |
propsLocalToPublicMap[local] = key; | |
} | |
function pushScope() { | |
scopeStack.push(currentScope = Object.create(currentScope)); | |
} | |
function popScope() { | |
scopeStack.pop(); | |
currentScope = scopeStack[scopeStack.length - 1] || null; | |
} | |
function registerLocalBinding(id) { | |
excludedIds.add(id); | |
if (currentScope) { | |
currentScope[id.name] = false; | |
} else { | |
ctx.error( | |
"registerBinding called without active scope, something is wrong.", | |
id | |
); | |
} | |
} | |
function walkScope(node, isRoot = false) { | |
for (const stmt of node.body) { | |
if (stmt.type === "VariableDeclaration") { | |
walkVariableDeclaration(stmt, isRoot); | |
} else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") { | |
if (stmt.declare || !stmt.id) continue; | |
registerLocalBinding(stmt.id); | |
} else if ((stmt.type === "ForOfStatement" || stmt.type === "ForInStatement") && stmt.left.type === "VariableDeclaration") { | |
walkVariableDeclaration(stmt.left); | |
} else if (stmt.type === "ExportNamedDeclaration" && stmt.declaration && stmt.declaration.type === "VariableDeclaration") { | |
walkVariableDeclaration(stmt.declaration, isRoot); | |
} else if (stmt.type === "LabeledStatement" && stmt.body.type === "VariableDeclaration") { | |
walkVariableDeclaration(stmt.body, isRoot); | |
} | |
} | |
} | |
function walkVariableDeclaration(stmt, isRoot = false) { | |
if (stmt.declare) { | |
return; | |
} | |
for (const decl of stmt.declarations) { | |
const isDefineProps = isRoot && decl.init && isCallOf(CompilerDOM.unwrapTSNode(decl.init), "defineProps"); | |
for (const id of CompilerDOM.extractIdentifiers(decl.id)) { | |
if (isDefineProps) { | |
excludedIds.add(id); | |
} else { | |
registerLocalBinding(id); | |
} | |
} | |
} | |
} | |
function rewriteId(id, parent, parentStack2) { | |
if (parent.type === "AssignmentExpression" && id === parent.left || parent.type === "UpdateExpression") { | |
ctx.error(`Cannot assign to destructured props as they are readonly.`, id); | |
} | |
if (CompilerDOM.isStaticProperty(parent) && parent.shorthand) { | |
if (!parent.inPattern || CompilerDOM.isInDestructureAssignment(parent, parentStack2)) { | |
ctx.s.appendLeft( | |
id.end + ctx.startOffset, | |
`: ${shared.genPropsAccessExp(propsLocalToPublicMap[id.name])}` | |
); | |
} | |
} else { | |
ctx.s.overwrite( | |
id.start + ctx.startOffset, | |
id.end + ctx.startOffset, | |
shared.genPropsAccessExp(propsLocalToPublicMap[id.name]) | |
); | |
} | |
} | |
function checkUsage(node, method, alias = method) { | |
if (isCallOf(node, alias)) { | |
const arg = CompilerDOM.unwrapTSNode(node.arguments[0]); | |
if (arg.type === "Identifier" && currentScope[arg.name]) { | |
ctx.error( | |
`"${arg.name}" is a destructured prop and should not be passed directly to ${method}(). Pass a getter () => ${arg.name} instead.`, | |
arg | |
); | |
} | |
} | |
} | |
const ast = ctx.scriptSetupAst; | |
walkScope(ast, true); | |
estreeWalker.walk(ast, { | |
enter(node, parent) { | |
parent && parentStack.push(parent); | |
if (parent && parent.type.startsWith("TS") && !CompilerDOM.TS_NODE_TYPES.includes(parent.type)) { | |
return this.skip(); | |
} | |
checkUsage(node, "watch", vueImportAliases.watch); | |
checkUsage(node, "toRef", vueImportAliases.toRef); | |
if (CompilerDOM.isFunctionType(node)) { | |
pushScope(); | |
CompilerDOM.walkFunctionParams(node, registerLocalBinding); | |
if (node.body.type === "BlockStatement") { | |
walkScope(node.body); | |
} | |
return; | |
} | |
if (node.type === "CatchClause") { | |
pushScope(); | |
if (node.param && node.param.type === "Identifier") { | |
registerLocalBinding(node.param); | |
} | |
walkScope(node.body); | |
return; | |
} | |
if (node.type === "BlockStatement" && !CompilerDOM.isFunctionType(parent)) { | |
pushScope(); | |
walkScope(node); | |
return; | |
} | |
if (node.type === "Identifier") { | |
if (CompilerDOM.isReferencedIdentifier(node, parent, parentStack) && !excludedIds.has(node)) { | |
if (currentScope[node.name]) { | |
rewriteId(node, parent, parentStack); | |
} | |
} | |
} | |
}, | |
leave(node, parent) { | |
parent && parentStack.pop(); | |
if (node.type === "BlockStatement" && !CompilerDOM.isFunctionType(parent) || CompilerDOM.isFunctionType(node)) { | |
popScope(); | |
} | |
} | |
}); | |
} | |
const DEFINE_EMITS = "defineEmits"; | |
function processDefineEmits(ctx, node, declId) { | |
if (!isCallOf(node, DEFINE_EMITS)) { | |
return false; | |
} | |
if (ctx.hasDefineEmitCall) { | |
ctx.error(`duplicate ${DEFINE_EMITS}() call`, node); | |
} | |
ctx.hasDefineEmitCall = true; | |
ctx.emitsRuntimeDecl = node.arguments[0]; | |
if (node.typeParameters) { | |
if (ctx.emitsRuntimeDecl) { | |
ctx.error( | |
`${DEFINE_EMITS}() cannot accept both type and non-type arguments at the same time. Use one or the other.`, | |
node | |
); | |
} | |
ctx.emitsTypeDecl = node.typeParameters.params[0]; | |
} | |
ctx.emitDecl = declId; | |
return true; | |
} | |
function genRuntimeEmits(ctx) { | |
let emitsDecl = ""; | |
if (ctx.emitsRuntimeDecl) { | |
emitsDecl = ctx.getString(ctx.emitsRuntimeDecl).trim(); | |
} else if (ctx.emitsTypeDecl) { | |
const typeDeclaredEmits = extractRuntimeEmits(ctx); | |
emitsDecl = typeDeclaredEmits.size ? `[${Array.from(typeDeclaredEmits).map((k) => JSON.stringify(k)).join(", ")}]` : ``; | |
} | |
if (ctx.hasDefineModelCall) { | |
let modelEmitsDecl = `[${Object.keys(ctx.modelDecls).map((n) => JSON.stringify(`update:${n}`)).join(", ")}]`; | |
emitsDecl = emitsDecl ? `/*@__PURE__*/${ctx.helper( | |
"mergeModels" | |
)}(${emitsDecl}, ${modelEmitsDecl})` : modelEmitsDecl; | |
} | |
return emitsDecl; | |
} | |
function extractRuntimeEmits(ctx) { | |
const emits = /* @__PURE__ */ new Set(); | |
const node = ctx.emitsTypeDecl; | |
if (node.type === "TSFunctionType") { | |
extractEventNames(ctx, node.parameters[0], emits); | |
return emits; | |
} | |
const { props, calls } = resolveTypeElements(ctx, node); | |
let hasProperty = false; | |
for (const key in props) { | |
emits.add(key); | |
hasProperty = true; | |
} | |
if (calls) { | |
if (hasProperty) { | |
ctx.error( | |
`defineEmits() type cannot mixed call signature and property syntax.`, | |
node | |
); | |
} | |
for (const call of calls) { | |
extractEventNames(ctx, call.parameters[0], emits); | |
} | |
} | |
return emits; | |
} | |
function extractEventNames(ctx, eventName, emits) { | |
if (eventName.type === "Identifier" && eventName.typeAnnotation && eventName.typeAnnotation.type === "TSTypeAnnotation") { | |
const types = resolveUnionType(ctx, eventName.typeAnnotation.typeAnnotation); | |
for (const type of types) { | |
if (type.type === "TSLiteralType") { | |
if (type.literal.type !== "UnaryExpression" && type.literal.type !== "TemplateLiteral") { | |
emits.add(String(type.literal.value)); | |
} | |
} | |
} | |
} | |
} | |
const DEFINE_EXPOSE = "defineExpose"; | |
function processDefineExpose(ctx, node) { | |
if (isCallOf(node, DEFINE_EXPOSE)) { | |
if (ctx.hasDefineExposeCall) { | |
ctx.error(`duplicate ${DEFINE_EXPOSE}() call`, node); | |
} | |
ctx.hasDefineExposeCall = true; | |
return true; | |
} | |
return false; | |
} | |
const DEFINE_SLOTS = "defineSlots"; | |
function processDefineSlots(ctx, node, declId) { | |
if (!isCallOf(node, DEFINE_SLOTS)) { | |
return false; | |
} | |
if (ctx.hasDefineSlotsCall) { | |
ctx.error(`duplicate ${DEFINE_SLOTS}() call`, node); | |
} | |
ctx.hasDefineSlotsCall = true; | |
if (node.arguments.length > 0) { | |
ctx.error(`${DEFINE_SLOTS}() cannot accept arguments`, node); | |
} | |
if (declId) { | |
ctx.s.overwrite( | |
ctx.startOffset + node.start, | |
ctx.startOffset + node.end, | |
`${ctx.helper("useSlots")}()` | |
); | |
} | |
return true; | |
} | |
const DEFINE_OPTIONS = "defineOptions"; | |
function processDefineOptions(ctx, node) { | |
if (!isCallOf(node, DEFINE_OPTIONS)) { | |
return false; | |
} | |
if (ctx.hasDefineOptionsCall) { | |
ctx.error(`duplicate ${DEFINE_OPTIONS}() call`, node); | |
} | |
if (node.typeParameters) { | |
ctx.error(`${DEFINE_OPTIONS}() cannot accept type arguments`, node); | |
} | |
if (!node.arguments[0]) return true; | |
ctx.hasDefineOptionsCall = true; | |
ctx.optionsRuntimeDecl = CompilerDOM.unwrapTSNode(node.arguments[0]); | |
let propsOption = void 0; | |
let emitsOption = void 0; | |
let exposeOption = void 0; | |
let slotsOption = void 0; | |
if (ctx.optionsRuntimeDecl.type === "ObjectExpression") { | |
for (const prop of ctx.optionsRuntimeDecl.properties) { | |
if ((prop.type === "ObjectProperty" || prop.type === "ObjectMethod") && prop.key.type === "Identifier") { | |
switch (prop.key.name) { | |
case "props": | |
propsOption = prop; | |
break; | |
case "emits": | |
emitsOption = prop; | |
break; | |
case "expose": | |
exposeOption = prop; | |
break; | |
case "slots": | |
slotsOption = prop; | |
break; | |
} | |
} | |
} | |
} | |
if (propsOption) { | |
ctx.error( | |
`${DEFINE_OPTIONS}() cannot be used to declare props. Use ${DEFINE_PROPS}() instead.`, | |
propsOption | |
); | |
} | |
if (emitsOption) { | |
ctx.error( | |
`${DEFINE_OPTIONS}() cannot be used to declare emits. Use ${DEFINE_EMITS}() instead.`, | |
emitsOption | |
); | |
} | |
if (exposeOption) { | |
ctx.error( | |
`${DEFINE_OPTIONS}() cannot be used to declare expose. Use ${DEFINE_EXPOSE}() instead.`, | |
exposeOption | |
); | |
} | |
if (slotsOption) { | |
ctx.error( | |
`${DEFINE_OPTIONS}() cannot be used to declare slots. Use ${DEFINE_SLOTS}() instead.`, | |
slotsOption | |
); | |
} | |
return true; | |
} | |
function processAwait(ctx, node, needSemi, isStatement) { | |
const argumentStart = node.argument.extra && node.argument.extra.parenthesized ? node.argument.extra.parenStart : node.argument.start; | |
const startOffset = ctx.startOffset; | |
const argumentStr = ctx.descriptor.source.slice( | |
argumentStart + startOffset, | |
node.argument.end + startOffset | |
); | |
const containsNestedAwait = /\bawait\b/.test(argumentStr); | |
ctx.s.overwrite( | |
node.start + startOffset, | |
argumentStart + startOffset, | |
`${needSemi ? `;` : ``}( | |
([__temp,__restore] = ${ctx.helper( | |
`withAsyncContext` | |
)}(${containsNestedAwait ? `async ` : ``}() => ` | |
); | |
ctx.s.appendLeft( | |
node.end + startOffset, | |
`)), | |
${isStatement ? `` : `__temp = `}await __temp, | |
__restore()${isStatement ? `` : `, | |
__temp`} | |
)` | |
); | |
} | |
const MACROS = [ | |
DEFINE_PROPS, | |
DEFINE_EMITS, | |
DEFINE_EXPOSE, | |
DEFINE_OPTIONS, | |
DEFINE_SLOTS, | |
DEFINE_MODEL, | |
WITH_DEFAULTS | |
]; | |
function compileScript(sfc, options) { | |
var _a, _b, _c; | |
if (!options.id) { | |
warnOnce( | |
`compileScript now requires passing the \`id\` option. | |
Upgrade your vite or vue-loader version for compatibility with the latest experimental proposals.` | |
); | |
} | |
const ctx = new ScriptCompileContext(sfc, options); | |
const { script, scriptSetup, source, filename } = sfc; | |
const hoistStatic = options.hoistStatic !== false && !script; | |
const scopeId = options.id ? options.id.replace(/^data-v-/, "") : ""; | |
const scriptLang = script && script.lang; | |
const scriptSetupLang = scriptSetup && scriptSetup.lang; | |
if (!scriptSetup) { | |
if (!script) { | |
throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`); | |
} | |
return processNormalScript(ctx, scopeId); | |
} | |
if (script && scriptLang !== scriptSetupLang) { | |
throw new Error( | |
`[@vue/compiler-sfc] <script> and <script setup> must have the same language type.` | |
); | |
} | |
if (scriptSetupLang && !ctx.isJS && !ctx.isTS) { | |
return scriptSetup; | |
} | |
const scriptBindings = /* @__PURE__ */ Object.create(null); | |
const setupBindings = /* @__PURE__ */ Object.create(null); | |
let defaultExport; | |
let hasAwait = false; | |
let hasInlinedSsrRenderFn = false; | |
const startOffset = ctx.startOffset; | |
const endOffset = ctx.endOffset; | |
const scriptStartOffset = script && script.loc.start.offset; | |
const scriptEndOffset = script && script.loc.end.offset; | |
function hoistNode(node) { | |
const start = node.start + startOffset; | |
let end = node.end + startOffset; | |
if (node.trailingComments && node.trailingComments.length > 0) { | |
const lastCommentNode = node.trailingComments[node.trailingComments.length - 1]; | |
end = lastCommentNode.end + startOffset; | |
} | |
while (end <= source.length) { | |
if (!/\s/.test(source.charAt(end))) { | |
break; | |
} | |
end++; | |
} | |
ctx.s.move(start, end, 0); | |
} | |
function registerUserImport(source2, local, imported, isType, isFromSetup, needTemplateUsageCheck) { | |
let isUsedInTemplate = needTemplateUsageCheck; | |
if (needTemplateUsageCheck && ctx.isTS && sfc.template && !sfc.template.src && !sfc.template.lang) { | |
isUsedInTemplate = isImportUsed(local, sfc); | |
} | |
ctx.userImports[local] = { | |
isType, | |
imported, | |
local, | |
source: source2, | |
isFromSetup, | |
isUsedInTemplate | |
}; | |
} | |
function checkInvalidScopeReference(node, method) { | |
if (!node) return; | |
CompilerDOM.walkIdentifiers(node, (id) => { | |
const binding = setupBindings[id.name]; | |
if (binding && binding !== "literal-const") { | |
ctx.error( | |
`\`${method}()\` in <script setup> cannot reference locally declared variables because it will be hoisted outside of the setup() function. If your component options require initialization in the module scope, use a separate normal <script> to export the options instead.`, | |
id | |
); | |
} | |
}); | |
} | |
const scriptAst = ctx.scriptAst; | |
const scriptSetupAst = ctx.scriptSetupAst; | |
if (scriptAst) { | |
for (const node of scriptAst.body) { | |
if (node.type === "ImportDeclaration") { | |
for (const specifier of node.specifiers) { | |
const imported = getImportedName(specifier); | |
registerUserImport( | |
node.source.value, | |
specifier.local.name, | |
imported, | |
node.importKind === "type" || specifier.type === "ImportSpecifier" && specifier.importKind === "type", | |
false, | |
!options.inlineTemplate | |
); | |
} | |
} | |
} | |
} | |
for (const node of scriptSetupAst.body) { | |
if (node.type === "ImportDeclaration") { | |
hoistNode(node); | |
let removed = 0; | |
const removeSpecifier = (i) => { | |
const removeLeft = i > removed; | |
removed++; | |
const current = node.specifiers[i]; | |
const next = node.specifiers[i + 1]; | |
ctx.s.remove( | |
removeLeft ? node.specifiers[i - 1].end + startOffset : current.start + startOffset, | |
next && !removeLeft ? next.start + startOffset : current.end + startOffset | |
); | |
}; | |
for (let i = 0; i < node.specifiers.length; i++) { | |
const specifier = node.specifiers[i]; | |
const local = specifier.local.name; | |
const imported = getImportedName(specifier); | |
const source2 = node.source.value; | |
const existing = ctx.userImports[local]; | |
if (source2 === "vue" && MACROS.includes(imported)) { | |
if (local === imported) { | |
warnOnce( | |
`\`${imported}\` is a compiler macro and no longer needs to be imported.` | |
); | |
} else { | |
ctx.error( | |
`\`${imported}\` is a compiler macro and cannot be aliased to a different name.`, | |
specifier | |
); | |
} | |
removeSpecifier(i); | |
} else if (existing) { | |
if (existing.source === source2 && existing.imported === imported) { | |
removeSpecifier(i); | |
} else { | |
ctx.error( | |
`different imports aliased to same local name.`, | |
specifier | |
); | |
} | |
} else { | |
registerUserImport( | |
source2, | |
local, | |
imported, | |
node.importKind === "type" || specifier.type === "ImportSpecifier" && specifier.importKind === "type", | |
true, | |
!options.inlineTemplate | |
); | |
} | |
} | |
if (node.specifiers.length && removed === node.specifiers.length) { | |
ctx.s.remove(node.start + startOffset, node.end + startOffset); | |
} | |
} | |
} | |
const vueImportAliases = {}; | |
for (const key in ctx.userImports) { | |
const { source: source2, imported, local } = ctx.userImports[key]; | |
if (source2 === "vue") vueImportAliases[imported] = local; | |
} | |
if (script && scriptAst) { | |
for (const node of scriptAst.body) { | |
if (node.type === "ExportDefaultDeclaration") { | |
defaultExport = node; | |
let optionProperties; | |
if (defaultExport.declaration.type === "ObjectExpression") { | |
optionProperties = defaultExport.declaration.properties; | |
} else if (defaultExport.declaration.type === "CallExpression" && defaultExport.declaration.arguments[0] && defaultExport.declaration.arguments[0].type === "ObjectExpression") { | |
optionProperties = defaultExport.declaration.arguments[0].properties; | |
} | |
if (optionProperties) { | |
for (const p of optionProperties) { | |
if (p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "name") { | |
ctx.hasDefaultExportName = true; | |
} | |
if ((p.type === "ObjectMethod" || p.type === "ObjectProperty") && p.key.type === "Identifier" && p.key.name === "render") { | |
ctx.hasDefaultExportRender = true; | |
} | |
} | |
} | |
const start = node.start + scriptStartOffset; | |
const end = node.declaration.start + scriptStartOffset; | |
ctx.s.overwrite(start, end, `const ${normalScriptDefaultVar} = `); | |
} else if (node.type === "ExportNamedDeclaration") { | |
const defaultSpecifier = node.specifiers.find( | |
(s) => s.exported.type === "Identifier" && s.exported.name === "default" | |
); | |
if (defaultSpecifier) { | |
defaultExport = node; | |
if (node.specifiers.length > 1) { | |
ctx.s.remove( | |
defaultSpecifier.start + scriptStartOffset, | |
defaultSpecifier.end + scriptStartOffset | |
); | |
} else { | |
ctx.s.remove( | |
node.start + scriptStartOffset, | |
node.end + scriptStartOffset | |
); | |
} | |
if (node.source) { | |
ctx.s.prepend( | |
`import { ${defaultSpecifier.local.name} as ${normalScriptDefaultVar} } from '${node.source.value}' | |
` | |
); | |
} else { | |
ctx.s.appendLeft( | |
scriptEndOffset, | |
` | |
const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name} | |
` | |
); | |
} | |
} | |
if (node.declaration) { | |
walkDeclaration( | |
"script", | |
node.declaration, | |
scriptBindings, | |
vueImportAliases, | |
hoistStatic | |
); | |
} | |
} else if ((node.type === "VariableDeclaration" || node.type === "FunctionDeclaration" || node.type === "ClassDeclaration" || node.type === "TSEnumDeclaration") && !node.declare) { | |
walkDeclaration( | |
"script", | |
node, | |
scriptBindings, | |
vueImportAliases, | |
hoistStatic | |
); | |
} | |
} | |
if (scriptStartOffset > startOffset) { | |
if (!/\n$/.test(script.content.trim())) { | |
ctx.s.appendLeft(scriptEndOffset, ` | |
`); | |
} | |
ctx.s.move(scriptStartOffset, scriptEndOffset, 0); | |
} | |
} | |
for (const node of scriptSetupAst.body) { | |
if (node.type === "ExpressionStatement") { | |
const expr = CompilerDOM.unwrapTSNode(node.expression); | |
if (processDefineProps(ctx, expr) || processDefineEmits(ctx, expr) || processDefineOptions(ctx, expr) || processDefineSlots(ctx, expr)) { | |
ctx.s.remove(node.start + startOffset, node.end + startOffset); | |
} else if (processDefineExpose(ctx, expr)) { | |
const callee = expr.callee; | |
ctx.s.overwrite( | |
callee.start + startOffset, | |
callee.end + startOffset, | |
"__expose" | |
); | |
} else { | |
processDefineModel(ctx, expr); | |
} | |
} | |
if (node.type === "VariableDeclaration" && !node.declare) { | |
const total = node.declarations.length; | |
let left = total; | |
let lastNonRemoved; | |
for (let i = 0; i < total; i++) { | |
const decl = node.declarations[i]; | |
const init = decl.init && CompilerDOM.unwrapTSNode(decl.init); | |
if (init) { | |
if (processDefineOptions(ctx, init)) { | |
ctx.error( | |
`${DEFINE_OPTIONS}() has no returning value, it cannot be assigned.`, | |
node | |
); | |
} | |
const isDefineProps = processDefineProps(ctx, init, decl.id); | |
if (ctx.propsDestructureRestId) { | |
setupBindings[ctx.propsDestructureRestId] = "setup-reactive-const"; | |
} | |
const isDefineEmits = !isDefineProps && processDefineEmits(ctx, init, decl.id); | |
!isDefineEmits && (processDefineSlots(ctx, init, decl.id) || processDefineModel(ctx, init, decl.id)); | |
if (isDefineProps && !ctx.propsDestructureRestId && ctx.propsDestructureDecl) { | |
if (left === 1) { | |
ctx.s.remove(node.start + startOffset, node.end + startOffset); | |
} else { | |
let start = decl.start + startOffset; | |
let end = decl.end + startOffset; | |
if (i === total - 1) { | |
start = node.declarations[lastNonRemoved].end + startOffset; | |
} else { | |
end = node.declarations[i + 1].start + startOffset; | |
} | |
ctx.s.remove(start, end); | |
left--; | |
} | |
} else if (isDefineEmits) { | |
ctx.s.overwrite( | |
startOffset + init.start, | |
startOffset + init.end, | |
"__emit" | |
); | |
} else { | |
lastNonRemoved = i; | |
} | |
} | |
} | |
} | |
let isAllLiteral = false; | |
if ((node.type === "VariableDeclaration" || node.type === "FunctionDeclaration" || node.type === "ClassDeclaration" || node.type === "TSEnumDeclaration") && !node.declare) { | |
isAllLiteral = walkDeclaration( | |
"scriptSetup", | |
node, | |
setupBindings, | |
vueImportAliases, | |
hoistStatic, | |
!!ctx.propsDestructureDecl | |
); | |
} | |
if (hoistStatic && isAllLiteral) { | |
hoistNode(node); | |
} | |
if (node.type === "VariableDeclaration" && !node.declare || node.type.endsWith("Statement")) { | |
const scope = [scriptSetupAst.body]; | |
estreeWalker.walk(node, { | |
enter(child, parent) { | |
if (CompilerDOM.isFunctionType(child)) { | |
this.skip(); | |
} | |
if (child.type === "BlockStatement") { | |
scope.push(child.body); | |
} | |
if (child.type === "AwaitExpression") { | |
hasAwait = true; | |
const currentScope = scope[scope.length - 1]; | |
const needsSemi = currentScope.some((n, i) => { | |
return (scope.length === 1 || i > 0) && n.type === "ExpressionStatement" && n.start === child.start; | |
}); | |
processAwait( | |
ctx, | |
child, | |
needsSemi, | |
parent.type === "ExpressionStatement" | |
); | |
} | |
}, | |
exit(node2) { | |
if (node2.type === "BlockStatement") scope.pop(); | |
} | |
}); | |
} | |
if (node.type === "ExportNamedDeclaration" && node.exportKind !== "type" || node.type === "ExportAllDeclaration" || node.type === "ExportDefaultDeclaration") { | |
ctx.error( | |
`<script setup> cannot contain ES module exports. If you are using a previous version of <script setup>, please consult the updated RFC at https://github.com/vuejs/rfcs/pull/227.`, | |
node | |
); | |
} | |
if (ctx.isTS) { | |
if (node.type.startsWith("TS") || node.type === "ExportNamedDeclaration" && node.exportKind === "type" || node.type === "VariableDeclaration" && node.declare) { | |
if (node.type !== "TSEnumDeclaration") { | |
hoistNode(node); | |
} | |
} | |
} | |
} | |
if (ctx.propsDestructureDecl) { | |
transformDestructuredProps(ctx, vueImportAliases); | |
} | |
checkInvalidScopeReference(ctx.propsRuntimeDecl, DEFINE_PROPS); | |
checkInvalidScopeReference(ctx.propsRuntimeDefaults, DEFINE_PROPS); | |
checkInvalidScopeReference(ctx.propsDestructureDecl, DEFINE_PROPS); | |
checkInvalidScopeReference(ctx.emitsRuntimeDecl, DEFINE_EMITS); | |
checkInvalidScopeReference(ctx.optionsRuntimeDecl, DEFINE_OPTIONS); | |
for (const { runtimeOptionNodes } of Object.values(ctx.modelDecls)) { | |
for (const node of runtimeOptionNodes) { | |
checkInvalidScopeReference(node, DEFINE_MODEL); | |
} | |
} | |
if (script) { | |
if (startOffset < scriptStartOffset) { | |
ctx.s.remove(0, startOffset); | |
ctx.s.remove(endOffset, scriptStartOffset); | |
ctx.s.remove(scriptEndOffset, source.length); | |
} else { | |
ctx.s.remove(0, scriptStartOffset); | |
ctx.s.remove(scriptEndOffset, startOffset); | |
ctx.s.remove(endOffset, source.length); | |
} | |
} else { | |
ctx.s.remove(0, startOffset); | |
ctx.s.remove(endOffset, source.length); | |
} | |
if (scriptAst) { | |
Object.assign(ctx.bindingMetadata, analyzeScriptBindings(scriptAst.body)); | |
} | |
for (const [key, { isType, imported, source: source2 }] of Object.entries( | |
ctx.userImports | |
)) { | |
if (isType) continue; | |
ctx.bindingMetadata[key] = imported === "*" || imported === "default" && source2.endsWith(".vue") || source2 === "vue" ? "setup-const" : "setup-maybe-ref"; | |
} | |
for (const key in scriptBindings) { | |
ctx.bindingMetadata[key] = scriptBindings[key]; | |
} | |
for (const key in setupBindings) { | |
ctx.bindingMetadata[key] = setupBindings[key]; | |
} | |
if (sfc.cssVars.length && // no need to do this when targeting SSR | |
!((_a = options.templateOptions) == null ? void 0 : _a.ssr)) { | |
ctx.helperImports.add(CSS_VARS_HELPER); | |
ctx.helperImports.add("unref"); | |
ctx.s.prependLeft( | |
startOffset, | |
` | |
${genCssVarsCode( | |
sfc.cssVars, | |
ctx.bindingMetadata, | |
scopeId, | |
!!options.isProd | |
)} | |
` | |
); | |
} | |
let args = `__props`; | |
if (ctx.propsTypeDecl) { | |
args += `: any`; | |
} | |
if (ctx.propsDecl) { | |
if (ctx.propsDestructureRestId) { | |
ctx.s.overwrite( | |
startOffset + ctx.propsCall.start, | |
startOffset + ctx.propsCall.end, | |
`${ctx.helper(`createPropsRestProxy`)}(__props, ${JSON.stringify( | |
Object.keys(ctx.propsDestructuredBindings) | |
)})` | |
); | |
ctx.s.overwrite( | |
startOffset + ctx.propsDestructureDecl.start, | |
startOffset + ctx.propsDestructureDecl.end, | |
ctx.propsDestructureRestId | |
); | |
} else if (!ctx.propsDestructureDecl) { | |
ctx.s.overwrite( | |
startOffset + ctx.propsCall.start, | |
startOffset + ctx.propsCall.end, | |
"__props" | |
); | |
} | |
} | |
if (hasAwait) { | |
const any = ctx.isTS ? `: any` : ``; | |
ctx.s.prependLeft(startOffset, ` | |
let __temp${any}, __restore${any} | |
`); | |
} | |
const destructureElements = ctx.hasDefineExposeCall || !options.inlineTemplate ? [`expose: __expose`] : []; | |
if (ctx.emitDecl) { | |
destructureElements.push(`emit: __emit`); | |
} | |
if (destructureElements.length) { | |
args += `, { ${destructureElements.join(", ")} }`; | |
} | |
let returned; | |
if (!options.inlineTemplate || !sfc.template && ctx.hasDefaultExportRender) { | |
const allBindings = { | |
...scriptBindings, | |
...setupBindings | |
}; | |
for (const key in ctx.userImports) { | |
if (!ctx.userImports[key].isType && ctx.userImports[key].isUsedInTemplate) { | |
allBindings[key] = true; | |
} | |
} | |
returned = `{ `; | |
for (const key in allBindings) { | |
if (allBindings[key] === true && ctx.userImports[key].source !== "vue" && !ctx.userImports[key].source.endsWith(".vue")) { | |
returned += `get ${key}() { return ${key} }, `; | |
} else if (ctx.bindingMetadata[key] === "setup-let") { | |
const setArg = key === "v" ? `_v` : `v`; | |
returned += `get ${key}() { return ${key} }, set ${key}(${setArg}) { ${key} = ${setArg} }, `; | |
} else { | |
returned += `${key}, `; | |
} | |
} | |
returned = returned.replace(/, $/, "") + ` }`; | |
} else { | |
if (sfc.template && !sfc.template.src) { | |
if (options.templateOptions && options.templateOptions.ssr) { | |
hasInlinedSsrRenderFn = true; | |
} | |
const { code, ast, preamble, tips, errors } = compileTemplate({ | |
filename, | |
ast: sfc.template.ast, | |
source: sfc.template.content, | |
inMap: sfc.template.map, | |
...options.templateOptions, | |
id: scopeId, | |
scoped: sfc.styles.some((s) => s.scoped), | |
isProd: options.isProd, | |
ssrCssVars: sfc.cssVars, | |
compilerOptions: { | |
...options.templateOptions && options.templateOptions.compilerOptions, | |
inline: true, | |
isTS: ctx.isTS, | |
bindingMetadata: ctx.bindingMetadata | |
} | |
}); | |
if (tips.length) { | |
tips.forEach(warnOnce); | |
} | |
const err = errors[0]; | |
if (typeof err === "string") { | |
throw new Error(err); | |
} else if (err) { | |
if (err.loc) { | |
err.message += ` | |
` + sfc.filename + "\n" + shared.generateCodeFrame( | |
source, | |
err.loc.start.offset, | |
err.loc.end.offset | |
) + ` | |
`; | |
} | |
throw err; | |
} | |
if (preamble) { | |
ctx.s.prepend(preamble); | |
} | |
if (ast && ast.helpers.has(CompilerDOM.UNREF)) { | |
ctx.helperImports.delete("unref"); | |
} | |
returned = code; | |
} else { | |
returned = `() => {}`; | |
} | |
} | |
if (!options.inlineTemplate && true) { | |
ctx.s.appendRight( | |
endOffset, | |
` | |
const __returned__ = ${returned} | |
Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true }) | |
return __returned__ | |
} | |
` | |
); | |
} else { | |
ctx.s.appendRight(endOffset, ` | |
return ${returned} | |
} | |
`); | |
} | |
const genDefaultAs = options.genDefaultAs ? `const ${options.genDefaultAs} =` : `export default`; | |
let runtimeOptions = ``; | |
if (!ctx.hasDefaultExportName && filename && filename !== DEFAULT_FILENAME) { | |
const match = filename.match(/([^/\\]+)\.\w+$/); | |
if (match) { | |
runtimeOptions += ` | |
__name: '${match[1]}',`; | |
} | |
} | |
if (hasInlinedSsrRenderFn) { | |
runtimeOptions += ` | |
__ssrInlineRender: true,`; | |
} | |
const propsDecl = genRuntimeProps(ctx); | |
if (propsDecl) runtimeOptions += ` | |
props: ${propsDecl},`; | |
const emitsDecl = genRuntimeEmits(ctx); | |
if (emitsDecl) runtimeOptions += ` | |
emits: ${emitsDecl},`; | |
let definedOptions = ""; | |
if (ctx.optionsRuntimeDecl) { | |
definedOptions = scriptSetup.content.slice(ctx.optionsRuntimeDecl.start, ctx.optionsRuntimeDecl.end).trim(); | |
} | |
const exposeCall = ctx.hasDefineExposeCall || options.inlineTemplate ? `` : ` __expose(); | |
`; | |
if (ctx.isTS) { | |
const def = (defaultExport ? ` | |
...${normalScriptDefaultVar},` : ``) + (definedOptions ? ` | |
...${definedOptions},` : ""); | |
ctx.s.prependLeft( | |
startOffset, | |
` | |
${genDefaultAs} /*@__PURE__*/${ctx.helper( | |
`defineComponent` | |
)}({${def}${runtimeOptions} | |
${hasAwait ? `async ` : ``}setup(${args}) { | |
${exposeCall}` | |
); | |
ctx.s.appendRight(endOffset, `})`); | |
} else { | |
if (defaultExport || definedOptions) { | |
ctx.s.prependLeft( | |
startOffset, | |
` | |
${genDefaultAs} /*@__PURE__*/Object.assign(${defaultExport ? `${normalScriptDefaultVar}, ` : ""}${definedOptions ? `${definedOptions}, ` : ""}{${runtimeOptions} | |
${hasAwait ? `async ` : ``}setup(${args}) { | |
${exposeCall}` | |
); | |
ctx.s.appendRight(endOffset, `})`); | |
} else { | |
ctx.s.prependLeft( | |
startOffset, | |
` | |
${genDefaultAs} {${runtimeOptions} | |
${hasAwait ? `async ` : ``}setup(${args}) { | |
${exposeCall}` | |
); | |
ctx.s.appendRight(endOffset, `}`); | |
} | |
} | |
if (ctx.helperImports.size > 0) { | |
const runtimeModuleName = (_c = (_b = options.templateOptions) == null ? void 0 : _b.compilerOptions) == null ? void 0 : _c.runtimeModuleName; | |
const importSrc = runtimeModuleName ? JSON.stringify(runtimeModuleName) : `'vue'`; | |
ctx.s.prepend( | |
`import { ${[...ctx.helperImports].map((h) => `${h} as _${h}`).join(", ")} } from ${importSrc} | |
` | |
); | |
} | |
return { | |
...scriptSetup, | |
bindings: ctx.bindingMetadata, | |
imports: ctx.userImports, | |
content: ctx.s.toString(), | |
map: options.sourceMap !== false ? ctx.s.generateMap({ | |
source: filename, | |
hires: true, | |
includeContent: true | |
}) : void 0, | |
scriptAst: scriptAst == null ? void 0 : scriptAst.body, | |
scriptSetupAst: scriptSetupAst == null ? void 0 : scriptSetupAst.body, | |
deps: ctx.deps ? [...ctx.deps] : void 0 | |
}; | |
} | |
function registerBinding(bindings, node, type) { | |
bindings[node.name] = type; | |
} | |
function walkDeclaration(from, node, bindings, userImportAliases, hoistStatic, isPropsDestructureEnabled = false) { | |
let isAllLiteral = false; | |
if (node.type === "VariableDeclaration") { | |
const isConst = node.kind === "const"; | |
isAllLiteral = isConst && node.declarations.every( | |
(decl) => decl.id.type === "Identifier" && isStaticNode(decl.init) | |
); | |
for (const { id, init: _init } of node.declarations) { | |
const init = _init && CompilerDOM.unwrapTSNode(_init); | |
const isConstMacroCall = isConst && isCallOf( | |
init, | |
(c) => c === DEFINE_PROPS || c === DEFINE_EMITS || c === WITH_DEFAULTS || c === DEFINE_SLOTS | |
); | |
if (id.type === "Identifier") { | |
let bindingType; | |
const userReactiveBinding = userImportAliases["reactive"]; | |
if ((hoistStatic || from === "script") && (isAllLiteral || isConst && isStaticNode(init))) { | |
bindingType = "literal-const"; | |
} else if (isCallOf(init, userReactiveBinding)) { | |
bindingType = isConst ? "setup-reactive-const" : "setup-let"; | |
} else if ( | |
// if a declaration is a const literal, we can mark it so that | |
// the generated render fn code doesn't need to unref() it | |
isConstMacroCall || isConst && canNeverBeRef(init, userReactiveBinding) | |
) { | |
bindingType = isCallOf(init, DEFINE_PROPS) ? "setup-reactive-const" : "setup-const"; | |
} else if (isConst) { | |
if (isCallOf( | |
init, | |
(m) => m === userImportAliases["ref"] || m === userImportAliases["computed"] || m === userImportAliases["shallowRef"] || m === userImportAliases["customRef"] || m === userImportAliases["toRef"] || m === DEFINE_MODEL | |
)) { | |
bindingType = "setup-ref"; | |
} else { | |
bindingType = "setup-maybe-ref"; | |
} | |
} else { | |
bindingType = "setup-let"; | |
} | |
registerBinding(bindings, id, bindingType); | |
} else { | |
if (isCallOf(init, DEFINE_PROPS) && isPropsDestructureEnabled) { | |
continue; | |
} | |
if (id.type === "ObjectPattern") { | |
walkObjectPattern(id, bindings, isConst, isConstMacroCall); | |
} else if (id.type === "ArrayPattern") { | |
walkArrayPattern(id, bindings, isConst, isConstMacroCall); | |
} | |
} | |
} | |
} else if (node.type === "TSEnumDeclaration") { | |
isAllLiteral = node.members.every( | |
(member) => !member.initializer || isStaticNode(member.initializer) | |
); | |
bindings[node.id.name] = isAllLiteral ? "literal-const" : "setup-const"; | |
} else if (node.type === "FunctionDeclaration" || node.type === "ClassDeclaration") { | |
bindings[node.id.name] = "setup-const"; | |
} | |
return isAllLiteral; | |
} | |
function walkObjectPattern(node, bindings, isConst, isDefineCall = false) { | |
for (const p of node.properties) { | |
if (p.type === "ObjectProperty") { | |
if (p.key.type === "Identifier" && p.key === p.value) { | |
const type = isDefineCall ? "setup-const" : isConst ? "setup-maybe-ref" : "setup-let"; | |
registerBinding(bindings, p.key, type); | |
} else { | |
walkPattern(p.value, bindings, isConst, isDefineCall); | |
} | |
} else { | |
const type = isConst ? "setup-const" : "setup-let"; | |
registerBinding(bindings, p.argument, type); | |
} | |
} | |
} | |
function walkArrayPattern(node, bindings, isConst, isDefineCall = false) { | |
for (const e of node.elements) { | |
e && walkPattern(e, bindings, isConst, isDefineCall); | |
} | |
} | |
function walkPattern(node, bindings, isConst, isDefineCall = false) { | |
if (node.type === "Identifier") { | |
const type = isDefineCall ? "setup-const" : isConst ? "setup-maybe-ref" : "setup-let"; | |
registerBinding(bindings, node, type); | |
} else if (node.type === "RestElement") { | |
const type = isConst ? "setup-const" : "setup-let"; | |
registerBinding(bindings, node.argument, type); | |
} else if (node.type === "ObjectPattern") { | |
walkObjectPattern(node, bindings, isConst); | |
} else if (node.type === "ArrayPattern") { | |
walkArrayPattern(node, bindings, isConst); | |
} else if (node.type === "AssignmentPattern") { | |
if (node.left.type === "Identifier") { | |
const type = isDefineCall ? "setup-const" : isConst ? "setup-maybe-ref" : "setup-let"; | |
registerBinding(bindings, node.left, type); | |
} else { | |
walkPattern(node.left, bindings, isConst); | |
} | |
} | |
} | |
function canNeverBeRef(node, userReactiveImport) { | |
if (isCallOf(node, userReactiveImport)) { | |
return true; | |
} | |
switch (node.type) { | |
case "UnaryExpression": | |
case "BinaryExpression": | |
case "ArrayExpression": | |
case "ObjectExpression": | |
case "FunctionExpression": | |
case "ArrowFunctionExpression": | |
case "UpdateExpression": | |
case "ClassExpression": | |
case "TaggedTemplateExpression": | |
return true; | |
case "SequenceExpression": | |
return canNeverBeRef( | |
node.expressions[node.expressions.length - 1], | |
userReactiveImport | |
); | |
default: | |
if (isLiteralNode(node)) { | |
return true; | |
} | |
return false; | |
} | |
} | |
function isStaticNode(node) { | |
node = CompilerDOM.unwrapTSNode(node); | |
switch (node.type) { | |
case "UnaryExpression": | |
return isStaticNode(node.argument); | |
case "LogicalExpression": | |
// 1 > 2 | |
case "BinaryExpression": | |
return isStaticNode(node.left) && isStaticNode(node.right); | |
case "ConditionalExpression": { | |
return isStaticNode(node.test) && isStaticNode(node.consequent) && isStaticNode(node.alternate); | |
} | |
case "SequenceExpression": | |
// (1, 2) | |
case "TemplateLiteral": | |
return node.expressions.every((expr) => isStaticNode(expr)); | |
case "ParenthesizedExpression": | |
return isStaticNode(node.expression); | |
case "StringLiteral": | |
case "NumericLiteral": | |
case "BooleanLiteral": | |
case "NullLiteral": | |
case "BigIntLiteral": | |
return true; | |
} | |
return false; | |
} | |
const version = "3.5.13"; | |
const parseCache = parseCache$1; | |
const errorMessages = { | |
...CompilerDOM.errorMessages, | |
...CompilerDOM.DOMErrorMessages | |
}; | |
const walk = estreeWalker.walk; | |
const shouldTransformRef = () => false; | |
exports.extractIdentifiers = compilerCore.extractIdentifiers; | |
exports.generateCodeFrame = compilerCore.generateCodeFrame; | |
exports.isInDestructureAssignment = compilerCore.isInDestructureAssignment; | |
exports.isStaticProperty = compilerCore.isStaticProperty; | |
exports.walkIdentifiers = compilerCore.walkIdentifiers; | |
exports.MagicString = MagicString; | |
exports.babelParse = parser$2.parse; | |
exports.compileScript = compileScript; | |
exports.compileStyle = compileStyle; | |
exports.compileStyleAsync = compileStyleAsync; | |
exports.compileTemplate = compileTemplate; | |
exports.errorMessages = errorMessages; | |
exports.extractRuntimeEmits = extractRuntimeEmits; | |
exports.extractRuntimeProps = extractRuntimeProps; | |
exports.inferRuntimeType = inferRuntimeType; | |
exports.invalidateTypeCache = invalidateTypeCache; | |
exports.parse = parse$1; | |
exports.parseCache = parseCache; | |
exports.registerTS = registerTS; | |
exports.resolveTypeElements = resolveTypeElements; | |
exports.rewriteDefault = rewriteDefault; | |
exports.rewriteDefaultAST = rewriteDefaultAST; | |
exports.shouldTransformRef = shouldTransformRef; | |
exports.version = version; | |
exports.walk = walk; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts === | |
import * as _babel_types from '@babel/types'; | |
import { Statement, Expression, TSType, Node, Program, CallExpression, ObjectPattern, TSModuleDeclaration, TSPropertySignature, TSMethodSignature, TSCallSignatureDeclaration, TSFunctionType } from '@babel/types'; | |
import { RootNode, CompilerOptions, CodegenResult, ParserOptions, CompilerError, RawSourceMap, SourceLocation, BindingMetadata as BindingMetadata$1 } from '@vue/compiler-core'; | |
export { BindingMetadata, CompilerError, CompilerOptions, extractIdentifiers, generateCodeFrame, isInDestructureAssignment, isStaticProperty, walkIdentifiers } from '@vue/compiler-core'; | |
import { ParserPlugin } from '@babel/parser'; | |
export { parse as babelParse } from '@babel/parser'; | |
import { Result, LazyResult } from 'postcss'; | |
import MagicString from 'magic-string'; | |
export { default as MagicString } from 'magic-string'; | |
import TS from 'typescript'; | |
export interface AssetURLTagConfig { | |
[name: string]: string[]; | |
} | |
export interface AssetURLOptions { | |
/** | |
* If base is provided, instead of transforming relative asset urls into | |
* imports, they will be directly rewritten to absolute urls. | |
*/ | |
base?: string | null; | |
/** | |
* If true, also processes absolute urls. | |
*/ | |
includeAbsolute?: boolean; | |
tags?: AssetURLTagConfig; | |
} | |
export interface TemplateCompiler { | |
compile(source: string | RootNode, options: CompilerOptions): CodegenResult; | |
parse(template: string, options: ParserOptions): RootNode; | |
} | |
export interface SFCTemplateCompileResults { | |
code: string; | |
ast?: RootNode; | |
preamble?: string; | |
source: string; | |
tips: string[]; | |
errors: (string | CompilerError)[]; | |
map?: RawSourceMap; | |
} | |
export interface SFCTemplateCompileOptions { | |
source: string; | |
ast?: RootNode; | |
filename: string; | |
id: string; | |
scoped?: boolean; | |
slotted?: boolean; | |
isProd?: boolean; | |
ssr?: boolean; | |
ssrCssVars?: string[]; | |
inMap?: RawSourceMap; | |
compiler?: TemplateCompiler; | |
compilerOptions?: CompilerOptions; | |
preprocessLang?: string; | |
preprocessOptions?: any; | |
/** | |
* In some cases, compiler-sfc may not be inside the project root (e.g. when | |
* linked or globally installed). In such cases a custom `require` can be | |
* passed to correctly resolve the preprocessors. | |
*/ | |
preprocessCustomRequire?: (id: string) => any; | |
/** | |
* Configure what tags/attributes to transform into asset url imports, | |
* or disable the transform altogether with `false`. | |
*/ | |
transformAssetUrls?: AssetURLOptions | AssetURLTagConfig | boolean; | |
} | |
export declare function compileTemplate(options: SFCTemplateCompileOptions): SFCTemplateCompileResults; | |
export interface SFCScriptCompileOptions { | |
/** | |
* Scope ID for prefixing injected CSS variables. | |
* This must be consistent with the `id` passed to `compileStyle`. | |
*/ | |
id: string; | |
/** | |
* Production mode. Used to determine whether to generate hashed CSS variables | |
*/ | |
isProd?: boolean; | |
/** | |
* Enable/disable source map. Defaults to true. | |
*/ | |
sourceMap?: boolean; | |
/** | |
* https://babeljs.io/docs/en/babel-parser#plugins | |
*/ | |
babelParserPlugins?: ParserPlugin[]; | |
/** | |
* A list of files to parse for global types to be made available for type | |
* resolving in SFC macros. The list must be fully resolved file system paths. | |
*/ | |
globalTypeFiles?: string[]; | |
/** | |
* Compile the template and inline the resulting render function | |
* directly inside setup(). | |
* - Only affects `<script setup>` | |
* - This should only be used in production because it prevents the template | |
* from being hot-reloaded separately from component state. | |
*/ | |
inlineTemplate?: boolean; | |
/** | |
* Generate the final component as a variable instead of default export. | |
* This is useful in e.g. @vitejs/plugin-vue where the script needs to be | |
* placed inside the main module. | |
*/ | |
genDefaultAs?: string; | |
/** | |
* Options for template compilation when inlining. Note these are options that | |
* would normally be passed to `compiler-sfc`'s own `compileTemplate()`, not | |
* options passed to `compiler-dom`. | |
*/ | |
templateOptions?: Partial<SFCTemplateCompileOptions>; | |
/** | |
* Hoist <script setup> static constants. | |
* - Only enables when one `<script setup>` exists. | |
* @default true | |
*/ | |
hoistStatic?: boolean; | |
/** | |
* Set to `false` to disable reactive destructure for `defineProps` (pre-3.5 | |
* behavior), or set to `'error'` to throw hard error on props destructures. | |
* @default true | |
*/ | |
propsDestructure?: boolean | 'error'; | |
/** | |
* File system access methods to be used when resolving types | |
* imported in SFC macros. Defaults to ts.sys in Node.js, can be overwritten | |
* to use a virtual file system for use in browsers (e.g. in REPLs) | |
*/ | |
fs?: { | |
fileExists(file: string): boolean; | |
readFile(file: string): string | undefined; | |
realpath?(file: string): string; | |
}; | |
/** | |
* Transform Vue SFCs into custom elements. | |
*/ | |
customElement?: boolean | ((filename: string) => boolean); | |
} | |
interface ImportBinding { | |
isType: boolean; | |
imported: string; | |
local: string; | |
source: string; | |
isFromSetup: boolean; | |
isUsedInTemplate: boolean; | |
} | |
/** | |
* Compile `<script setup>` | |
* It requires the whole SFC descriptor because we need to handle and merge | |
* normal `<script>` + `<script setup>` if both are present. | |
*/ | |
export declare function compileScript(sfc: SFCDescriptor, options: SFCScriptCompileOptions): SFCScriptBlock; | |
export interface SFCParseOptions { | |
filename?: string; | |
sourceMap?: boolean; | |
sourceRoot?: string; | |
pad?: boolean | 'line' | 'space'; | |
ignoreEmpty?: boolean; | |
compiler?: TemplateCompiler; | |
templateParseOptions?: ParserOptions; | |
} | |
export interface SFCBlock { | |
type: string; | |
content: string; | |
attrs: Record<string, string | true>; | |
loc: SourceLocation; | |
map?: RawSourceMap; | |
lang?: string; | |
src?: string; | |
} | |
export interface SFCTemplateBlock extends SFCBlock { | |
type: 'template'; | |
ast?: RootNode; | |
} | |
export interface SFCScriptBlock extends SFCBlock { | |
type: 'script'; | |
setup?: string | boolean; | |
bindings?: BindingMetadata$1; | |
imports?: Record<string, ImportBinding>; | |
scriptAst?: _babel_types.Statement[]; | |
scriptSetupAst?: _babel_types.Statement[]; | |
warnings?: string[]; | |
/** | |
* Fully resolved dependency file paths (unix slashes) with imported types | |
* used in macros, used for HMR cache busting in @vitejs/plugin-vue and | |
* vue-loader. | |
*/ | |
deps?: string[]; | |
} | |
export interface SFCStyleBlock extends SFCBlock { | |
type: 'style'; | |
scoped?: boolean; | |
module?: string | boolean; | |
} | |
export interface SFCDescriptor { | |
filename: string; | |
source: string; | |
template: SFCTemplateBlock | null; | |
script: SFCScriptBlock | null; | |
scriptSetup: SFCScriptBlock | null; | |
styles: SFCStyleBlock[]; | |
customBlocks: SFCBlock[]; | |
cssVars: string[]; | |
/** | |
* whether the SFC uses :slotted() modifier. | |
* this is used as a compiler optimization hint. | |
*/ | |
slotted: boolean; | |
/** | |
* compare with an existing descriptor to determine whether HMR should perform | |
* a reload vs. re-render. | |
* | |
* Note: this comparison assumes the prev/next script are already identical, | |
* and only checks the special case where <script setup lang="ts"> unused import | |
* pruning result changes due to template changes. | |
*/ | |
shouldForceReload: (prevImports: Record<string, ImportBinding>) => boolean; | |
} | |
export interface SFCParseResult { | |
descriptor: SFCDescriptor; | |
errors: (CompilerError | SyntaxError)[]; | |
} | |
export declare function parse(source: string, options?: SFCParseOptions): SFCParseResult; | |
type PreprocessLang = 'less' | 'sass' | 'scss' | 'styl' | 'stylus'; | |
export interface SFCStyleCompileOptions { | |
source: string; | |
filename: string; | |
id: string; | |
scoped?: boolean; | |
trim?: boolean; | |
isProd?: boolean; | |
inMap?: RawSourceMap; | |
preprocessLang?: PreprocessLang; | |
preprocessOptions?: any; | |
preprocessCustomRequire?: (id: string) => any; | |
postcssOptions?: any; | |
postcssPlugins?: any[]; | |
/** | |
* @deprecated use `inMap` instead. | |
*/ | |
map?: RawSourceMap; | |
} | |
/** | |
* Aligns with postcss-modules | |
* https://github.com/css-modules/postcss-modules | |
*/ | |
interface CSSModulesOptions { | |
scopeBehaviour?: 'global' | 'local'; | |
generateScopedName?: string | ((name: string, filename: string, css: string) => string); | |
hashPrefix?: string; | |
localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly'; | |
exportGlobals?: boolean; | |
globalModulePaths?: RegExp[]; | |
} | |
export interface SFCAsyncStyleCompileOptions extends SFCStyleCompileOptions { | |
isAsync?: boolean; | |
modules?: boolean; | |
modulesOptions?: CSSModulesOptions; | |
} | |
export interface SFCStyleCompileResults { | |
code: string; | |
map: RawSourceMap | undefined; | |
rawResult: Result | LazyResult | undefined; | |
errors: Error[]; | |
modules?: Record<string, string>; | |
dependencies: Set<string>; | |
} | |
export declare function compileStyle(options: SFCStyleCompileOptions): SFCStyleCompileResults; | |
export declare function compileStyleAsync(options: SFCAsyncStyleCompileOptions): Promise<SFCStyleCompileResults>; | |
export declare function rewriteDefault(input: string, as: string, parserPlugins?: ParserPlugin[]): string; | |
/** | |
* Utility for rewriting `export default` in a script block into a variable | |
* declaration so that we can inject things into it | |
*/ | |
export declare function rewriteDefaultAST(ast: Statement[], s: MagicString, as: string): void; | |
type PropsDestructureBindings = Record<string, // public prop key | |
{ | |
local: string; | |
default?: Expression; | |
}>; | |
export declare function extractRuntimeProps(ctx: TypeResolveContext): string | undefined; | |
interface ModelDecl { | |
type: TSType | undefined; | |
options: string | undefined; | |
identifier: string | undefined; | |
runtimeOptionNodes: Node[]; | |
} | |
declare enum BindingTypes { | |
/** | |
* returned from data() | |
*/ | |
DATA = "data", | |
/** | |
* declared as a prop | |
*/ | |
PROPS = "props", | |
/** | |
* a local alias of a `<script setup>` destructured prop. | |
* the original is stored in __propsAliases of the bindingMetadata object. | |
*/ | |
PROPS_ALIASED = "props-aliased", | |
/** | |
* a let binding (may or may not be a ref) | |
*/ | |
SETUP_LET = "setup-let", | |
/** | |
* a const binding that can never be a ref. | |
* these bindings don't need `unref()` calls when processed in inlined | |
* template expressions. | |
*/ | |
SETUP_CONST = "setup-const", | |
/** | |
* a const binding that does not need `unref()`, but may be mutated. | |
*/ | |
SETUP_REACTIVE_CONST = "setup-reactive-const", | |
/** | |
* a const binding that may be a ref. | |
*/ | |
SETUP_MAYBE_REF = "setup-maybe-ref", | |
/** | |
* bindings that are guaranteed to be refs | |
*/ | |
SETUP_REF = "setup-ref", | |
/** | |
* declared by other options, e.g. computed, inject | |
*/ | |
OPTIONS = "options", | |
/** | |
* a literal constant, e.g. 'foo', 1, true | |
*/ | |
LITERAL_CONST = "literal-const" | |
} | |
type BindingMetadata = { | |
[key: string]: BindingTypes | undefined; | |
} & { | |
__isScriptSetup?: boolean; | |
__propsAliases?: Record<string, string>; | |
}; | |
export declare class ScriptCompileContext { | |
descriptor: SFCDescriptor; | |
options: Partial<SFCScriptCompileOptions>; | |
isJS: boolean; | |
isTS: boolean; | |
isCE: boolean; | |
scriptAst: Program | null; | |
scriptSetupAst: Program | null; | |
source: string; | |
filename: string; | |
s: MagicString; | |
startOffset: number | undefined; | |
endOffset: number | undefined; | |
scope?: TypeScope; | |
globalScopes?: TypeScope[]; | |
userImports: Record<string, ImportBinding>; | |
hasDefinePropsCall: boolean; | |
hasDefineEmitCall: boolean; | |
hasDefineExposeCall: boolean; | |
hasDefaultExportName: boolean; | |
hasDefaultExportRender: boolean; | |
hasDefineOptionsCall: boolean; | |
hasDefineSlotsCall: boolean; | |
hasDefineModelCall: boolean; | |
propsCall: CallExpression | undefined; | |
propsDecl: Node | undefined; | |
propsRuntimeDecl: Node | undefined; | |
propsTypeDecl: Node | undefined; | |
propsDestructureDecl: ObjectPattern | undefined; | |
propsDestructuredBindings: PropsDestructureBindings; | |
propsDestructureRestId: string | undefined; | |
propsRuntimeDefaults: Node | undefined; | |
emitsRuntimeDecl: Node | undefined; | |
emitsTypeDecl: Node | undefined; | |
emitDecl: Node | undefined; | |
modelDecls: Record<string, ModelDecl>; | |
optionsRuntimeDecl: Node | undefined; | |
bindingMetadata: BindingMetadata; | |
helperImports: Set<string>; | |
helper(key: string): string; | |
/** | |
* to be exposed on compiled script block for HMR cache busting | |
*/ | |
deps?: Set<string>; | |
/** | |
* cache for resolved fs | |
*/ | |
fs?: NonNullable<SFCScriptCompileOptions['fs']>; | |
constructor(descriptor: SFCDescriptor, options: Partial<SFCScriptCompileOptions>); | |
getString(node: Node, scriptSetup?: boolean): string; | |
warn(msg: string, node: Node, scope?: TypeScope): void; | |
error(msg: string, node: Node, scope?: TypeScope): never; | |
} | |
export type SimpleTypeResolveOptions = Partial<Pick<SFCScriptCompileOptions, 'globalTypeFiles' | 'fs' | 'babelParserPlugins' | 'isProd'>>; | |
/** | |
* TypeResolveContext is compatible with ScriptCompileContext | |
* but also allows a simpler version of it with minimal required properties | |
* when resolveType needs to be used in a non-SFC context, e.g. in a babel | |
* plugin. The simplest context can be just: | |
* ```ts | |
* const ctx: SimpleTypeResolveContext = { | |
* filename: '...', | |
* source: '...', | |
* options: {}, | |
* error() {}, | |
* ast: [] | |
* } | |
* ``` | |
*/ | |
export type SimpleTypeResolveContext = Pick<ScriptCompileContext, 'source' | 'filename' | 'error' | 'helper' | 'getString' | 'propsTypeDecl' | 'propsRuntimeDefaults' | 'propsDestructuredBindings' | 'emitsTypeDecl' | 'isCE'> & Partial<Pick<ScriptCompileContext, 'scope' | 'globalScopes' | 'deps' | 'fs'>> & { | |
ast: Statement[]; | |
options: SimpleTypeResolveOptions; | |
}; | |
export type TypeResolveContext = ScriptCompileContext | SimpleTypeResolveContext; | |
type Import = Pick<ImportBinding, 'source' | 'imported'>; | |
interface WithScope { | |
_ownerScope: TypeScope; | |
} | |
type ScopeTypeNode = Node & WithScope & { | |
_ns?: TSModuleDeclaration & WithScope; | |
}; | |
declare class TypeScope { | |
filename: string; | |
source: string; | |
offset: number; | |
imports: Record<string, Import>; | |
types: Record<string, ScopeTypeNode>; | |
declares: Record<string, ScopeTypeNode>; | |
constructor(filename: string, source: string, offset?: number, imports?: Record<string, Import>, types?: Record<string, ScopeTypeNode>, declares?: Record<string, ScopeTypeNode>); | |
isGenericScope: boolean; | |
resolvedImportSources: Record<string, string>; | |
exportedTypes: Record<string, ScopeTypeNode>; | |
exportedDeclares: Record<string, ScopeTypeNode>; | |
} | |
interface MaybeWithScope { | |
_ownerScope?: TypeScope; | |
} | |
interface ResolvedElements { | |
props: Record<string, (TSPropertySignature | TSMethodSignature) & { | |
_ownerScope: TypeScope; | |
}>; | |
calls?: (TSCallSignatureDeclaration | TSFunctionType)[]; | |
} | |
/** | |
* Resolve arbitrary type node to a list of type elements that can be then | |
* mapped to runtime props or emits. | |
*/ | |
export declare function resolveTypeElements(ctx: TypeResolveContext, node: Node & MaybeWithScope & { | |
_resolvedElements?: ResolvedElements; | |
}, scope?: TypeScope, typeParameters?: Record<string, Node>): ResolvedElements; | |
/** | |
* @private | |
*/ | |
export declare function registerTS(_loadTS: () => typeof TS): void; | |
/** | |
* @private | |
*/ | |
export declare function invalidateTypeCache(filename: string): void; | |
export declare function inferRuntimeType(ctx: TypeResolveContext, node: Node & MaybeWithScope, scope?: TypeScope, isKeyOf?: boolean): string[]; | |
export declare function extractRuntimeEmits(ctx: TypeResolveContext): Set<string>; | |
export declare const version: string; | |
export declare const parseCache: Map<string, SFCParseResult>; | |
export declare const errorMessages: Record<number, string>; | |
export declare const walk: any; | |
/** | |
* @deprecated this is preserved to avoid breaking vite-plugin-vue < 5.0 | |
* with reactivityTransform: true. The desired behavior should be silently | |
* ignoring the option instead of breaking. | |
*/ | |
export declare const shouldTransformRef: () => boolean; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/reactivity/node_modules/@vue/shared/index.js === | |
'use strict' | |
if (process.env.NODE_ENV === 'production') { | |
module.exports = require('./dist/shared.cjs.prod.js') | |
} else { | |
module.exports = require('./dist/shared.cjs.js') | |
} | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/reactivity/node_modules/@vue/shared/dist/shared.esm-bundler.js === | |
/** | |
* @vue/shared v3.4.35 | |
* (c) 2018-present Yuxi (Evan) You and Vue contributors | |
* @license MIT | |
**/ | |
/*! #__NO_SIDE_EFFECTS__ */ | |
// @__NO_SIDE_EFFECTS__ | |
function makeMap(str, expectsLowerCase) { | |
const set = new Set(str.split(",")); | |
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val); | |
} | |
const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {}; | |
const EMPTY_ARR = !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : []; | |
const NOOP = () => { | |
}; | |
const NO = () => false; | |
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter | |
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); | |
const isModelListener = (key) => key.startsWith("onUpdate:"); | |
const extend = Object.assign; | |
const remove = (arr, el) => { | |
const i = arr.indexOf(el); | |
if (i > -1) { | |
arr.splice(i, 1); | |
} | |
}; | |
const hasOwnProperty = Object.prototype.hasOwnProperty; | |
const hasOwn = (val, key) => hasOwnProperty.call(val, key); | |
const isArray = Array.isArray; | |
const isMap = (val) => toTypeString(val) === "[object Map]"; | |
const isSet = (val) => toTypeString(val) === "[object Set]"; | |
const isDate = (val) => toTypeString(val) === "[object Date]"; | |
const isRegExp = (val) => toTypeString(val) === "[object RegExp]"; | |
const isFunction = (val) => typeof val === "function"; | |
const isString = (val) => typeof val === "string"; | |
const isSymbol = (val) => typeof val === "symbol"; | |
const isObject = (val) => val !== null && typeof val === "object"; | |
const isPromise = (val) => { | |
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); | |
}; | |
const objectToString = Object.prototype.toString; | |
const toTypeString = (value) => objectToString.call(value); | |
const toRawType = (value) => { | |
return toTypeString(value).slice(8, -1); | |
}; | |
const isPlainObject = (val) => toTypeString(val) === "[object Object]"; | |
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; | |
const isReservedProp = /* @__PURE__ */ makeMap( | |
// the leading comma is intentional so empty string "" is also included | |
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" | |
); | |
const isBuiltInDirective = /* @__PURE__ */ makeMap( | |
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo" | |
); | |
const cacheStringFunction = (fn) => { | |
const cache = /* @__PURE__ */ Object.create(null); | |
return (str) => { | |
const hit = cache[str]; | |
return hit || (cache[str] = fn(str)); | |
}; | |
}; | |
const camelizeRE = /-(\w)/g; | |
const camelize = cacheStringFunction((str) => { | |
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); | |
}); | |
const hyphenateRE = /\B([A-Z])/g; | |
const hyphenate = cacheStringFunction( | |
(str) => str.replace(hyphenateRE, "-$1").toLowerCase() | |
); | |
const capitalize = cacheStringFunction((str) => { | |
return str.charAt(0).toUpperCase() + str.slice(1); | |
}); | |
const toHandlerKey = cacheStringFunction((str) => { | |
const s = str ? `on${capitalize(str)}` : ``; | |
return s; | |
}); | |
const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | |
const invokeArrayFns = (fns, ...arg) => { | |
for (let i = 0; i < fns.length; i++) { | |
fns[i](...arg); | |
} | |
}; | |
const def = (obj, key, value, writable = false) => { | |
Object.defineProperty(obj, key, { | |
configurable: true, | |
enumerable: false, | |
writable, | |
value | |
}); | |
}; | |
const looseToNumber = (val) => { | |
const n = parseFloat(val); | |
return isNaN(n) ? val : n; | |
}; | |
const toNumber = (val) => { | |
const n = isString(val) ? Number(val) : NaN; | |
return isNaN(n) ? val : n; | |
}; | |
let _globalThis; | |
const getGlobalThis = () => { | |
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); | |
}; | |
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/; | |
function genPropsAccessExp(name) { | |
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`; | |
} | |
const PatchFlags = { | |
"TEXT": 1, | |
"1": "TEXT", | |
"CLASS": 2, | |
"2": "CLASS", | |
"STYLE": 4, | |
"4": "STYLE", | |
"PROPS": 8, | |
"8": "PROPS", | |
"FULL_PROPS": 16, | |
"16": "FULL_PROPS", | |
"NEED_HYDRATION": 32, | |
"32": "NEED_HYDRATION", | |
"STABLE_FRAGMENT": 64, | |
"64": "STABLE_FRAGMENT", | |
"KEYED_FRAGMENT": 128, | |
"128": "KEYED_FRAGMENT", | |
"UNKEYED_FRAGMENT": 256, | |
"256": "UNKEYED_FRAGMENT", | |
"NEED_PATCH": 512, | |
"512": "NEED_PATCH", | |
"DYNAMIC_SLOTS": 1024, | |
"1024": "DYNAMIC_SLOTS", | |
"DEV_ROOT_FRAGMENT": 2048, | |
"2048": "DEV_ROOT_FRAGMENT", | |
"HOISTED": -1, | |
"-1": "HOISTED", | |
"BAIL": -2, | |
"-2": "BAIL" | |
}; | |
const PatchFlagNames = { | |
[1]: `TEXT`, | |
[2]: `CLASS`, | |
[4]: `STYLE`, | |
[8]: `PROPS`, | |
[16]: `FULL_PROPS`, | |
[32]: `NEED_HYDRATION`, | |
[64]: `STABLE_FRAGMENT`, | |
[128]: `KEYED_FRAGMENT`, | |
[256]: `UNKEYED_FRAGMENT`, | |
[512]: `NEED_PATCH`, | |
[1024]: `DYNAMIC_SLOTS`, | |
[2048]: `DEV_ROOT_FRAGMENT`, | |
[-1]: `HOISTED`, | |
[-2]: `BAIL` | |
}; | |
const ShapeFlags = { | |
"ELEMENT": 1, | |
"1": "ELEMENT", | |
"FUNCTIONAL_COMPONENT": 2, | |
"2": "FUNCTIONAL_COMPONENT", | |
"STATEFUL_COMPONENT": 4, | |
"4": "STATEFUL_COMPONENT", | |
"TEXT_CHILDREN": 8, | |
"8": "TEXT_CHILDREN", | |
"ARRAY_CHILDREN": 16, | |
"16": "ARRAY_CHILDREN", | |
"SLOTS_CHILDREN": 32, | |
"32": "SLOTS_CHILDREN", | |
"TELEPORT": 64, | |
"64": "TELEPORT", | |
"SUSPENSE": 128, | |
"128": "SUSPENSE", | |
"COMPONENT_SHOULD_KEEP_ALIVE": 256, | |
"256": "COMPONENT_SHOULD_KEEP_ALIVE", | |
"COMPONENT_KEPT_ALIVE": 512, | |
"512": "COMPONENT_KEPT_ALIVE", | |
"COMPONENT": 6, | |
"6": "COMPONENT" | |
}; | |
const SlotFlags = { | |
"STABLE": 1, | |
"1": "STABLE", | |
"DYNAMIC": 2, | |
"2": "DYNAMIC", | |
"FORWARDED": 3, | |
"3": "FORWARDED" | |
}; | |
const slotFlagsText = { | |
[1]: "STABLE", | |
[2]: "DYNAMIC", | |
[3]: "FORWARDED" | |
}; | |
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error"; | |
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); | |
const isGloballyWhitelisted = isGloballyAllowed; | |
const range = 2; | |
function generateCodeFrame(source, start = 0, end = source.length) { | |
start = Math.max(0, Math.min(start, source.length)); | |
end = Math.max(0, Math.min(end, source.length)); | |
if (start > end) return ""; | |
let lines = source.split(/(\r?\n)/); | |
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); | |
lines = lines.filter((_, idx) => idx % 2 === 0); | |
let count = 0; | |
const res = []; | |
for (let i = 0; i < lines.length; i++) { | |
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); | |
if (count >= start) { | |
for (let j = i - range; j <= i + range || end > count; j++) { | |
if (j < 0 || j >= lines.length) continue; | |
const line = j + 1; | |
res.push( | |
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` | |
); | |
const lineLength = lines[j].length; | |
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; | |
if (j === i) { | |
const pad = start - (count - (lineLength + newLineSeqLength)); | |
const length = Math.max( | |
1, | |
end > count ? lineLength - pad : end - start | |
); | |
res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); | |
} else if (j > i) { | |
if (end > count) { | |
const length = Math.max(Math.min(end - count, lineLength), 1); | |
res.push(` | ` + "^".repeat(length)); | |
} | |
count += lineLength + newLineSeqLength; | |
} | |
} | |
break; | |
} | |
} | |
return res.join("\n"); | |
} | |
function normalizeStyle(value) { | |
if (isArray(value)) { | |
const res = {}; | |
for (let i = 0; i < value.length; i++) { | |
const item = value[i]; | |
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); | |
if (normalized) { | |
for (const key in normalized) { | |
res[key] = normalized[key]; | |
} | |
} | |
} | |
return res; | |
} else if (isString(value) || isObject(value)) { | |
return value; | |
} | |
} | |
const listDelimiterRE = /;(?![^(]*\))/g; | |
const propertyDelimiterRE = /:([^]+)/; | |
const styleCommentRE = /\/\*[^]*?\*\//g; | |
function parseStringStyle(cssText) { | |
const ret = {}; | |
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { | |
if (item) { | |
const tmp = item.split(propertyDelimiterRE); | |
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | |
} | |
}); | |
return ret; | |
} | |
function stringifyStyle(styles) { | |
let ret = ""; | |
if (!styles || isString(styles)) { | |
return ret; | |
} | |
for (const key in styles) { | |
const value = styles[key]; | |
if (isString(value) || typeof value === "number") { | |
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | |
ret += `${normalizedKey}:${value};`; | |
} | |
} | |
return ret; | |
} | |
function normalizeClass(value) { | |
let res = ""; | |
if (isString(value)) { | |
res = value; | |
} else if (isArray(value)) { | |
for (let i = 0; i < value.length; i++) { | |
const normalized = normalizeClass(value[i]); | |
if (normalized) { | |
res += normalized + " "; | |
} | |
} | |
} else if (isObject(value)) { | |
for (const name in value) { | |
if (value[name]) { | |
res += name + " "; | |
} | |
} | |
} | |
return res.trim(); | |
} | |
function normalizeProps(props) { | |
if (!props) return null; | |
let { class: klass, style } = props; | |
if (klass && !isString(klass)) { | |
props.class = normalizeClass(klass); | |
} | |
if (style) { | |
props.style = normalizeStyle(style); | |
} | |
return props; | |
} | |
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot"; | |
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view"; | |
const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics"; | |
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr"; | |
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); | |
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); | |
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); | |
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); | |
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; | |
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); | |
const isBooleanAttr = /* @__PURE__ */ makeMap( | |
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected` | |
); | |
function includeBooleanAttr(value) { | |
return !!value || value === ""; | |
} | |
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/; | |
const attrValidationCache = {}; | |
function isSSRSafeAttrName(name) { | |
if (attrValidationCache.hasOwnProperty(name)) { | |
return attrValidationCache[name]; | |
} | |
const isUnsafe = unsafeAttrCharRE.test(name); | |
if (isUnsafe) { | |
console.error(`unsafe attribute name: ${name}`); | |
} | |
return attrValidationCache[name] = !isUnsafe; | |
} | |
const propsToAttrMap = { | |
acceptCharset: "accept-charset", | |
className: "class", | |
htmlFor: "for", | |
httpEquiv: "http-equiv" | |
}; | |
const isKnownHtmlAttr = /* @__PURE__ */ makeMap( | |
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap` | |
); | |
const isKnownSvgAttr = /* @__PURE__ */ makeMap( | |
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` | |
); | |
function isRenderableAttrValue(value) { | |
if (value == null) { | |
return false; | |
} | |
const type = typeof value; | |
return type === "string" || type === "number" || type === "boolean"; | |
} | |
const escapeRE = /["'&<>]/; | |
function escapeHtml(string) { | |
const str = "" + string; | |
const match = escapeRE.exec(str); | |
if (!match) { | |
return str; | |
} | |
let html = ""; | |
let escaped; | |
let index; | |
let lastIndex = 0; | |
for (index = match.index; index < str.length; index++) { | |
switch (str.charCodeAt(index)) { | |
case 34: | |
escaped = """; | |
break; | |
case 38: | |
escaped = "&"; | |
break; | |
case 39: | |
escaped = "'"; | |
break; | |
case 60: | |
escaped = "<"; | |
break; | |
case 62: | |
escaped = ">"; | |
break; | |
default: | |
continue; | |
} | |
if (lastIndex !== index) { | |
html += str.slice(lastIndex, index); | |
} | |
lastIndex = index + 1; | |
html += escaped; | |
} | |
return lastIndex !== index ? html + str.slice(lastIndex, index) : html; | |
} | |
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g; | |
function escapeHtmlComment(src) { | |
return src.replace(commentStripRE, ""); | |
} | |
function looseCompareArrays(a, b) { | |
if (a.length !== b.length) return false; | |
let equal = true; | |
for (let i = 0; equal && i < a.length; i++) { | |
equal = looseEqual(a[i], b[i]); | |
} | |
return equal; | |
} | |
function looseEqual(a, b) { | |
if (a === b) return true; | |
let aValidType = isDate(a); | |
let bValidType = isDate(b); | |
if (aValidType || bValidType) { | |
return aValidType && bValidType ? a.getTime() === b.getTime() : false; | |
} | |
aValidType = isSymbol(a); | |
bValidType = isSymbol(b); | |
if (aValidType || bValidType) { | |
return a === b; | |
} | |
aValidType = isArray(a); | |
bValidType = isArray(b); | |
if (aValidType || bValidType) { | |
return aValidType && bValidType ? looseCompareArrays(a, b) : false; | |
} | |
aValidType = isObject(a); | |
bValidType = isObject(b); | |
if (aValidType || bValidType) { | |
if (!aValidType || !bValidType) { | |
return false; | |
} | |
const aKeysCount = Object.keys(a).length; | |
const bKeysCount = Object.keys(b).length; | |
if (aKeysCount !== bKeysCount) { | |
return false; | |
} | |
for (const key in a) { | |
const aHasKey = a.hasOwnProperty(key); | |
const bHasKey = b.hasOwnProperty(key); | |
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { | |
return false; | |
} | |
} | |
} | |
return String(a) === String(b); | |
} | |
function looseIndexOf(arr, val) { | |
return arr.findIndex((item) => looseEqual(item, val)); | |
} | |
const isRef = (val) => { | |
return !!(val && val.__v_isRef === true); | |
}; | |
const toDisplayString = (val) => { | |
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val); | |
}; | |
const replacer = (_key, val) => { | |
if (isRef(val)) { | |
return replacer(_key, val.value); | |
} else if (isMap(val)) { | |
return { | |
[`Map(${val.size})`]: [...val.entries()].reduce( | |
(entries, [key, val2], i) => { | |
entries[stringifySymbol(key, i) + " =>"] = val2; | |
return entries; | |
}, | |
{} | |
) | |
}; | |
} else if (isSet(val)) { | |
return { | |
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) | |
}; | |
} else if (isSymbol(val)) { | |
return stringifySymbol(val); | |
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { | |
return String(val); | |
} | |
return val; | |
}; | |
const stringifySymbol = (v, i = "") => { | |
var _a; | |
return ( | |
// Symbol.description in es2019+ so we need to cast here to pass | |
// the lib: es2016 check | |
isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v | |
); | |
}; | |
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString }; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/reactivity/node_modules/@vue/shared/dist/shared.d.ts === | |
/** | |
* Make a map and return a function for checking if a key | |
* is in that map. | |
* IMPORTANT: all calls of this function must be prefixed with | |
* \/\*#\_\_PURE\_\_\*\/ | |
* So that rollup can tree-shake them if necessary. | |
*/ | |
/*! #__NO_SIDE_EFFECTS__ */ | |
export declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean; | |
export declare const EMPTY_OBJ: { | |
readonly [key: string]: any; | |
}; | |
export declare const EMPTY_ARR: readonly never[]; | |
export declare const NOOP: () => void; | |
/** | |
* Always return false. | |
*/ | |
export declare const NO: () => boolean; | |
export declare const isOn: (key: string) => boolean; | |
export declare const isModelListener: (key: string) => boolean; | |
export declare const extend: { | |
<T extends {}, U>(target: T, source: U): T & U; | |
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V; | |
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W; | |
(target: object, ...sources: any[]): any; | |
}; | |
export declare const remove: <T>(arr: T[], el: T) => void; | |
export declare const hasOwn: (val: object, key: string | symbol) => key is never; | |
export declare const isArray: (arg: any) => arg is any[]; | |
export declare const isMap: (val: unknown) => val is Map<any, any>; | |
export declare const isSet: (val: unknown) => val is Set<any>; | |
export declare const isDate: (val: unknown) => val is Date; | |
export declare const isRegExp: (val: unknown) => val is RegExp; | |
export declare const isFunction: (val: unknown) => val is Function; | |
export declare const isString: (val: unknown) => val is string; | |
export declare const isSymbol: (val: unknown) => val is symbol; | |
export declare const isObject: (val: unknown) => val is Record<any, any>; | |
export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>; | |
export declare const objectToString: () => string; | |
export declare const toTypeString: (value: unknown) => string; | |
export declare const toRawType: (value: unknown) => string; | |
export declare const isPlainObject: (val: unknown) => val is object; | |
export declare const isIntegerKey: (key: unknown) => boolean; | |
export declare const isReservedProp: (key: string) => boolean; | |
export declare const isBuiltInDirective: (key: string) => boolean; | |
/** | |
* @private | |
*/ | |
export declare const camelize: (str: string) => string; | |
/** | |
* @private | |
*/ | |
export declare const hyphenate: (str: string) => string; | |
/** | |
* @private | |
*/ | |
export declare const capitalize: <T extends string>(str: T) => Capitalize<T>; | |
/** | |
* @private | |
*/ | |
export declare const toHandlerKey: <T extends string>(str: T) => T extends "" ? "" : `on${Capitalize<T>}`; | |
export declare const hasChanged: (value: any, oldValue: any) => boolean; | |
export declare const invokeArrayFns: (fns: Function[], ...arg: any[]) => void; | |
export declare const def: (obj: object, key: string | symbol, value: any, writable?: boolean) => void; | |
/** | |
* "123-foo" will be parsed to 123 | |
* This is used for the .number modifier in v-model | |
*/ | |
export declare const looseToNumber: (val: any) => any; | |
/** | |
* Only concerns number-like strings | |
* "123-foo" will be returned as-is | |
*/ | |
export declare const toNumber: (val: any) => any; | |
export declare const getGlobalThis: () => any; | |
export declare function genPropsAccessExp(name: string): string; | |
/** | |
* Patch flags are optimization hints generated by the compiler. | |
* when a block with dynamicChildren is encountered during diff, the algorithm | |
* enters "optimized mode". In this mode, we know that the vdom is produced by | |
* a render function generated by the compiler, so the algorithm only needs to | |
* handle updates explicitly marked by these patch flags. | |
* | |
* Patch flags can be combined using the | bitwise operator and can be checked | |
* using the & operator, e.g. | |
* | |
* ```js | |
* const flag = TEXT | CLASS | |
* if (flag & TEXT) { ... } | |
* ``` | |
* | |
* Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the | |
* flags are handled during diff. | |
*/ | |
export declare enum PatchFlags { | |
/** | |
* Indicates an element with dynamic textContent (children fast path) | |
*/ | |
TEXT = 1, | |
/** | |
* Indicates an element with dynamic class binding. | |
*/ | |
CLASS = 2, | |
/** | |
* Indicates an element with dynamic style | |
* The compiler pre-compiles static string styles into static objects | |
* + detects and hoists inline static objects | |
* e.g. `style="color: red"` and `:style="{ color: 'red' }"` both get hoisted | |
* as: | |
* ```js | |
* const style = { color: 'red' } | |
* render() { return e('div', { style }) } | |
* ``` | |
*/ | |
STYLE = 4, | |
/** | |
* Indicates an element that has non-class/style dynamic props. | |
* Can also be on a component that has any dynamic props (includes | |
* class/style). when this flag is present, the vnode also has a dynamicProps | |
* array that contains the keys of the props that may change so the runtime | |
* can diff them faster (without having to worry about removed props) | |
*/ | |
PROPS = 8, | |
/** | |
* Indicates an element with props with dynamic keys. When keys change, a full | |
* diff is always needed to remove the old key. This flag is mutually | |
* exclusive with CLASS, STYLE and PROPS. | |
*/ | |
FULL_PROPS = 16, | |
/** | |
* Indicates an element that requires props hydration | |
* (but not necessarily patching) | |
* e.g. event listeners & v-bind with prop modifier | |
*/ | |
NEED_HYDRATION = 32, | |
/** | |
* Indicates a fragment whose children order doesn't change. | |
*/ | |
STABLE_FRAGMENT = 64, | |
/** | |
* Indicates a fragment with keyed or partially keyed children | |
*/ | |
KEYED_FRAGMENT = 128, | |
/** | |
* Indicates a fragment with unkeyed children. | |
*/ | |
UNKEYED_FRAGMENT = 256, | |
/** | |
* Indicates an element that only needs non-props patching, e.g. ref or | |
* directives (onVnodeXXX hooks). since every patched vnode checks for refs | |
* and onVnodeXXX hooks, it simply marks the vnode so that a parent block | |
* will track it. | |
*/ | |
NEED_PATCH = 512, | |
/** | |
* Indicates a component with dynamic slots (e.g. slot that references a v-for | |
* iterated value, or dynamic slot names). | |
* Components with this flag are always force updated. | |
*/ | |
DYNAMIC_SLOTS = 1024, | |
/** | |
* Indicates a fragment that was created only because the user has placed | |
* comments at the root level of a template. This is a dev-only flag since | |
* comments are stripped in production. | |
*/ | |
DEV_ROOT_FRAGMENT = 2048, | |
/** | |
* SPECIAL FLAGS ------------------------------------------------------------- | |
* Special flags are negative integers. They are never matched against using | |
* bitwise operators (bitwise matching should only happen in branches where | |
* patchFlag > 0), and are mutually exclusive. When checking for a special | |
* flag, simply check patchFlag === FLAG. | |
*/ | |
/** | |
* Indicates a hoisted static vnode. This is a hint for hydration to skip | |
* the entire sub tree since static content never needs to be updated. | |
*/ | |
HOISTED = -1, | |
/** | |
* A special flag that indicates that the diffing algorithm should bail out | |
* of optimized mode. For example, on block fragments created by renderSlot() | |
* when encountering non-compiler generated slots (i.e. manually written | |
* render functions, which should always be fully diffed) | |
* OR manually cloneVNodes | |
*/ | |
BAIL = -2 | |
} | |
/** | |
* dev only flag -> name mapping | |
*/ | |
export declare const PatchFlagNames: Record<PatchFlags, string>; | |
export declare enum ShapeFlags { | |
ELEMENT = 1, | |
FUNCTIONAL_COMPONENT = 2, | |
STATEFUL_COMPONENT = 4, | |
TEXT_CHILDREN = 8, | |
ARRAY_CHILDREN = 16, | |
SLOTS_CHILDREN = 32, | |
TELEPORT = 64, | |
SUSPENSE = 128, | |
COMPONENT_SHOULD_KEEP_ALIVE = 256, | |
COMPONENT_KEPT_ALIVE = 512, | |
COMPONENT = 6 | |
} | |
export declare enum SlotFlags { | |
/** | |
* Stable slots that only reference slot props or context state. The slot | |
* can fully capture its own dependencies so when passed down the parent won't | |
* need to force the child to update. | |
*/ | |
STABLE = 1, | |
/** | |
* Slots that reference scope variables (v-for or an outer slot prop), or | |
* has conditional structure (v-if, v-for). The parent will need to force | |
* the child to update because the slot does not fully capture its dependencies. | |
*/ | |
DYNAMIC = 2, | |
/** | |
* `<slot/>` being forwarded into a child component. Whether the parent needs | |
* to update the child is dependent on what kind of slots the parent itself | |
* received. This has to be refined at runtime, when the child's vnode | |
* is being created (in `normalizeChildren`) | |
*/ | |
FORWARDED = 3 | |
} | |
/** | |
* Dev only | |
*/ | |
export declare const slotFlagsText: { | |
1: string; | |
2: string; | |
3: string; | |
}; | |
export declare const isGloballyAllowed: (key: string) => boolean; | |
/** @deprecated use `isGloballyAllowed` instead */ | |
export declare const isGloballyWhitelisted: (key: string) => boolean; | |
export declare function generateCodeFrame(source: string, start?: number, end?: number): string; | |
export type NormalizedStyle = Record<string, string | number>; | |
export declare function normalizeStyle(value: unknown): NormalizedStyle | string | undefined; | |
export declare function parseStringStyle(cssText: string): NormalizedStyle; | |
export declare function stringifyStyle(styles: NormalizedStyle | string | undefined): string; | |
export declare function normalizeClass(value: unknown): string; | |
export declare function normalizeProps(props: Record<string, any> | null): Record<string, any> | null; | |
/** | |
* Compiler only. | |
* Do NOT use in runtime code paths unless behind `__DEV__` flag. | |
*/ | |
export declare const isHTMLTag: (key: string) => boolean; | |
/** | |
* Compiler only. | |
* Do NOT use in runtime code paths unless behind `__DEV__` flag. | |
*/ | |
export declare const isSVGTag: (key: string) => boolean; | |
/** | |
* Compiler only. | |
* Do NOT use in runtime code paths unless behind `__DEV__` flag. | |
*/ | |
export declare const isMathMLTag: (key: string) => boolean; | |
/** | |
* Compiler only. | |
* Do NOT use in runtime code paths unless behind `__DEV__` flag. | |
*/ | |
export declare const isVoidTag: (key: string) => boolean; | |
export declare const isSpecialBooleanAttr: (key: string) => boolean; | |
/** | |
* The full list is needed during SSR to produce the correct initial markup. | |
*/ | |
export declare const isBooleanAttr: (key: string) => boolean; | |
/** | |
* Boolean attributes should be included if the value is truthy or ''. | |
* e.g. `<select multiple>` compiles to `{ multiple: '' }` | |
*/ | |
export declare function includeBooleanAttr(value: unknown): boolean; | |
export declare function isSSRSafeAttrName(name: string): boolean; | |
export declare const propsToAttrMap: Record<string, string | undefined>; | |
/** | |
* Known attributes, this is used for stringification of runtime static nodes | |
* so that we don't stringify bindings that cannot be set from HTML. | |
* Don't also forget to allow `data-*` and `aria-*`! | |
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes | |
*/ | |
export declare const isKnownHtmlAttr: (key: string) => boolean; | |
/** | |
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute | |
*/ | |
export declare const isKnownSvgAttr: (key: string) => boolean; | |
/** | |
* Shared between server-renderer and runtime-core hydration logic | |
*/ | |
export declare function isRenderableAttrValue(value: unknown): boolean; | |
export declare function escapeHtml(string: unknown): string; | |
export declare function escapeHtmlComment(src: string): string; | |
export declare function looseEqual(a: any, b: any): boolean; | |
export declare function looseIndexOf(arr: any[], val: any): number; | |
/** | |
* For converting {{ interpolation }} values to displayed strings. | |
* @private | |
*/ | |
export declare const toDisplayString: (val: unknown) => string; | |
export type Prettify<T> = { | |
[K in keyof T]: T[K]; | |
} & {}; | |
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; | |
export type LooseRequired<T> = { | |
[P in keyof (T & Required<T>)]: T[P]; | |
}; | |
export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N; | |
export type Awaited<T> = T extends null | undefined ? T : T extends object & { | |
then(onfulfilled: infer F, ...args: infer _): any; | |
} ? F extends (value: infer V, ...args: infer _) => any ? Awaited<V> : never : T; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/reactivity/node_modules/@vue/shared/dist/shared.cjs.prod.js === | |
/** | |
* @vue/shared v3.4.35 | |
* (c) 2018-present Yuxi (Evan) You and Vue contributors | |
* @license MIT | |
**/ | |
'use strict'; | |
Object.defineProperty(exports, '__esModule', { value: true }); | |
/*! #__NO_SIDE_EFFECTS__ */ | |
// @__NO_SIDE_EFFECTS__ | |
function makeMap(str, expectsLowerCase) { | |
const set = new Set(str.split(",")); | |
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val); | |
} | |
const EMPTY_OBJ = {}; | |
const EMPTY_ARR = []; | |
const NOOP = () => { | |
}; | |
const NO = () => false; | |
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter | |
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); | |
const isModelListener = (key) => key.startsWith("onUpdate:"); | |
const extend = Object.assign; | |
const remove = (arr, el) => { | |
const i = arr.indexOf(el); | |
if (i > -1) { | |
arr.splice(i, 1); | |
} | |
}; | |
const hasOwnProperty = Object.prototype.hasOwnProperty; | |
const hasOwn = (val, key) => hasOwnProperty.call(val, key); | |
const isArray = Array.isArray; | |
const isMap = (val) => toTypeString(val) === "[object Map]"; | |
const isSet = (val) => toTypeString(val) === "[object Set]"; | |
const isDate = (val) => toTypeString(val) === "[object Date]"; | |
const isRegExp = (val) => toTypeString(val) === "[object RegExp]"; | |
const isFunction = (val) => typeof val === "function"; | |
const isString = (val) => typeof val === "string"; | |
const isSymbol = (val) => typeof val === "symbol"; | |
const isObject = (val) => val !== null && typeof val === "object"; | |
const isPromise = (val) => { | |
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); | |
}; | |
const objectToString = Object.prototype.toString; | |
const toTypeString = (value) => objectToString.call(value); | |
const toRawType = (value) => { | |
return toTypeString(value).slice(8, -1); | |
}; | |
const isPlainObject = (val) => toTypeString(val) === "[object Object]"; | |
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; | |
const isReservedProp = /* @__PURE__ */ makeMap( | |
// the leading comma is intentional so empty string "" is also included | |
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" | |
); | |
const isBuiltInDirective = /* @__PURE__ */ makeMap( | |
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo" | |
); | |
const cacheStringFunction = (fn) => { | |
const cache = /* @__PURE__ */ Object.create(null); | |
return (str) => { | |
const hit = cache[str]; | |
return hit || (cache[str] = fn(str)); | |
}; | |
}; | |
const camelizeRE = /-(\w)/g; | |
const camelize = cacheStringFunction((str) => { | |
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); | |
}); | |
const hyphenateRE = /\B([A-Z])/g; | |
const hyphenate = cacheStringFunction( | |
(str) => str.replace(hyphenateRE, "-$1").toLowerCase() | |
); | |
const capitalize = cacheStringFunction((str) => { | |
return str.charAt(0).toUpperCase() + str.slice(1); | |
}); | |
const toHandlerKey = cacheStringFunction((str) => { | |
const s = str ? `on${capitalize(str)}` : ``; | |
return s; | |
}); | |
const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | |
const invokeArrayFns = (fns, ...arg) => { | |
for (let i = 0; i < fns.length; i++) { | |
fns[i](...arg); | |
} | |
}; | |
const def = (obj, key, value, writable = false) => { | |
Object.defineProperty(obj, key, { | |
configurable: true, | |
enumerable: false, | |
writable, | |
value | |
}); | |
}; | |
const looseToNumber = (val) => { | |
const n = parseFloat(val); | |
return isNaN(n) ? val : n; | |
}; | |
const toNumber = (val) => { | |
const n = isString(val) ? Number(val) : NaN; | |
return isNaN(n) ? val : n; | |
}; | |
let _globalThis; | |
const getGlobalThis = () => { | |
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); | |
}; | |
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/; | |
function genPropsAccessExp(name) { | |
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`; | |
} | |
const PatchFlags = { | |
"TEXT": 1, | |
"1": "TEXT", | |
"CLASS": 2, | |
"2": "CLASS", | |
"STYLE": 4, | |
"4": "STYLE", | |
"PROPS": 8, | |
"8": "PROPS", | |
"FULL_PROPS": 16, | |
"16": "FULL_PROPS", | |
"NEED_HYDRATION": 32, | |
"32": "NEED_HYDRATION", | |
"STABLE_FRAGMENT": 64, | |
"64": "STABLE_FRAGMENT", | |
"KEYED_FRAGMENT": 128, | |
"128": "KEYED_FRAGMENT", | |
"UNKEYED_FRAGMENT": 256, | |
"256": "UNKEYED_FRAGMENT", | |
"NEED_PATCH": 512, | |
"512": "NEED_PATCH", | |
"DYNAMIC_SLOTS": 1024, | |
"1024": "DYNAMIC_SLOTS", | |
"DEV_ROOT_FRAGMENT": 2048, | |
"2048": "DEV_ROOT_FRAGMENT", | |
"HOISTED": -1, | |
"-1": "HOISTED", | |
"BAIL": -2, | |
"-2": "BAIL" | |
}; | |
const PatchFlagNames = { | |
[1]: `TEXT`, | |
[2]: `CLASS`, | |
[4]: `STYLE`, | |
[8]: `PROPS`, | |
[16]: `FULL_PROPS`, | |
[32]: `NEED_HYDRATION`, | |
[64]: `STABLE_FRAGMENT`, | |
[128]: `KEYED_FRAGMENT`, | |
[256]: `UNKEYED_FRAGMENT`, | |
[512]: `NEED_PATCH`, | |
[1024]: `DYNAMIC_SLOTS`, | |
[2048]: `DEV_ROOT_FRAGMENT`, | |
[-1]: `HOISTED`, | |
[-2]: `BAIL` | |
}; | |
const ShapeFlags = { | |
"ELEMENT": 1, | |
"1": "ELEMENT", | |
"FUNCTIONAL_COMPONENT": 2, | |
"2": "FUNCTIONAL_COMPONENT", | |
"STATEFUL_COMPONENT": 4, | |
"4": "STATEFUL_COMPONENT", | |
"TEXT_CHILDREN": 8, | |
"8": "TEXT_CHILDREN", | |
"ARRAY_CHILDREN": 16, | |
"16": "ARRAY_CHILDREN", | |
"SLOTS_CHILDREN": 32, | |
"32": "SLOTS_CHILDREN", | |
"TELEPORT": 64, | |
"64": "TELEPORT", | |
"SUSPENSE": 128, | |
"128": "SUSPENSE", | |
"COMPONENT_SHOULD_KEEP_ALIVE": 256, | |
"256": "COMPONENT_SHOULD_KEEP_ALIVE", | |
"COMPONENT_KEPT_ALIVE": 512, | |
"512": "COMPONENT_KEPT_ALIVE", | |
"COMPONENT": 6, | |
"6": "COMPONENT" | |
}; | |
const SlotFlags = { | |
"STABLE": 1, | |
"1": "STABLE", | |
"DYNAMIC": 2, | |
"2": "DYNAMIC", | |
"FORWARDED": 3, | |
"3": "FORWARDED" | |
}; | |
const slotFlagsText = { | |
[1]: "STABLE", | |
[2]: "DYNAMIC", | |
[3]: "FORWARDED" | |
}; | |
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error"; | |
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); | |
const isGloballyWhitelisted = isGloballyAllowed; | |
const range = 2; | |
function generateCodeFrame(source, start = 0, end = source.length) { | |
start = Math.max(0, Math.min(start, source.length)); | |
end = Math.max(0, Math.min(end, source.length)); | |
if (start > end) return ""; | |
let lines = source.split(/(\r?\n)/); | |
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); | |
lines = lines.filter((_, idx) => idx % 2 === 0); | |
let count = 0; | |
const res = []; | |
for (let i = 0; i < lines.length; i++) { | |
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); | |
if (count >= start) { | |
for (let j = i - range; j <= i + range || end > count; j++) { | |
if (j < 0 || j >= lines.length) continue; | |
const line = j + 1; | |
res.push( | |
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` | |
); | |
const lineLength = lines[j].length; | |
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; | |
if (j === i) { | |
const pad = start - (count - (lineLength + newLineSeqLength)); | |
const length = Math.max( | |
1, | |
end > count ? lineLength - pad : end - start | |
); | |
res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); | |
} else if (j > i) { | |
if (end > count) { | |
const length = Math.max(Math.min(end - count, lineLength), 1); | |
res.push(` | ` + "^".repeat(length)); | |
} | |
count += lineLength + newLineSeqLength; | |
} | |
} | |
break; | |
} | |
} | |
return res.join("\n"); | |
} | |
function normalizeStyle(value) { | |
if (isArray(value)) { | |
const res = {}; | |
for (let i = 0; i < value.length; i++) { | |
const item = value[i]; | |
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); | |
if (normalized) { | |
for (const key in normalized) { | |
res[key] = normalized[key]; | |
} | |
} | |
} | |
return res; | |
} else if (isString(value) || isObject(value)) { | |
return value; | |
} | |
} | |
const listDelimiterRE = /;(?![^(]*\))/g; | |
const propertyDelimiterRE = /:([^]+)/; | |
const styleCommentRE = /\/\*[^]*?\*\//g; | |
function parseStringStyle(cssText) { | |
const ret = {}; | |
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { | |
if (item) { | |
const tmp = item.split(propertyDelimiterRE); | |
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | |
} | |
}); | |
return ret; | |
} | |
function stringifyStyle(styles) { | |
let ret = ""; | |
if (!styles || isString(styles)) { | |
return ret; | |
} | |
for (const key in styles) { | |
const value = styles[key]; | |
if (isString(value) || typeof value === "number") { | |
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | |
ret += `${normalizedKey}:${value};`; | |
} | |
} | |
return ret; | |
} | |
function normalizeClass(value) { | |
let res = ""; | |
if (isString(value)) { | |
res = value; | |
} else if (isArray(value)) { | |
for (let i = 0; i < value.length; i++) { | |
const normalized = normalizeClass(value[i]); | |
if (normalized) { | |
res += normalized + " "; | |
} | |
} | |
} else if (isObject(value)) { | |
for (const name in value) { | |
if (value[name]) { | |
res += name + " "; | |
} | |
} | |
} | |
return res.trim(); | |
} | |
function normalizeProps(props) { | |
if (!props) return null; | |
let { class: klass, style } = props; | |
if (klass && !isString(klass)) { | |
props.class = normalizeClass(klass); | |
} | |
if (style) { | |
props.style = normalizeStyle(style); | |
} | |
return props; | |
} | |
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot"; | |
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view"; | |
const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics"; | |
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr"; | |
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); | |
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); | |
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); | |
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); | |
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; | |
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); | |
const isBooleanAttr = /* @__PURE__ */ makeMap( | |
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected` | |
); | |
function includeBooleanAttr(value) { | |
return !!value || value === ""; | |
} | |
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/; | |
const attrValidationCache = {}; | |
function isSSRSafeAttrName(name) { | |
if (attrValidationCache.hasOwnProperty(name)) { | |
return attrValidationCache[name]; | |
} | |
const isUnsafe = unsafeAttrCharRE.test(name); | |
if (isUnsafe) { | |
console.error(`unsafe attribute name: ${name}`); | |
} | |
return attrValidationCache[name] = !isUnsafe; | |
} | |
const propsToAttrMap = { | |
acceptCharset: "accept-charset", | |
className: "class", | |
htmlFor: "for", | |
httpEquiv: "http-equiv" | |
}; | |
const isKnownHtmlAttr = /* @__PURE__ */ makeMap( | |
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap` | |
); | |
const isKnownSvgAttr = /* @__PURE__ */ makeMap( | |
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` | |
); | |
function isRenderableAttrValue(value) { | |
if (value == null) { | |
return false; | |
} | |
const type = typeof value; | |
return type === "string" || type === "number" || type === "boolean"; | |
} | |
const escapeRE = /["'&<>]/; | |
function escapeHtml(string) { | |
const str = "" + string; | |
const match = escapeRE.exec(str); | |
if (!match) { | |
return str; | |
} | |
let html = ""; | |
let escaped; | |
let index; | |
let lastIndex = 0; | |
for (index = match.index; index < str.length; index++) { | |
switch (str.charCodeAt(index)) { | |
case 34: | |
escaped = """; | |
break; | |
case 38: | |
escaped = "&"; | |
break; | |
case 39: | |
escaped = "'"; | |
break; | |
case 60: | |
escaped = "<"; | |
break; | |
case 62: | |
escaped = ">"; | |
break; | |
default: | |
continue; | |
} | |
if (lastIndex !== index) { | |
html += str.slice(lastIndex, index); | |
} | |
lastIndex = index + 1; | |
html += escaped; | |
} | |
return lastIndex !== index ? html + str.slice(lastIndex, index) : html; | |
} | |
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g; | |
function escapeHtmlComment(src) { | |
return src.replace(commentStripRE, ""); | |
} | |
function looseCompareArrays(a, b) { | |
if (a.length !== b.length) return false; | |
let equal = true; | |
for (let i = 0; equal && i < a.length; i++) { | |
equal = looseEqual(a[i], b[i]); | |
} | |
return equal; | |
} | |
function looseEqual(a, b) { | |
if (a === b) return true; | |
let aValidType = isDate(a); | |
let bValidType = isDate(b); | |
if (aValidType || bValidType) { | |
return aValidType && bValidType ? a.getTime() === b.getTime() : false; | |
} | |
aValidType = isSymbol(a); | |
bValidType = isSymbol(b); | |
if (aValidType || bValidType) { | |
return a === b; | |
} | |
aValidType = isArray(a); | |
bValidType = isArray(b); | |
if (aValidType || bValidType) { | |
return aValidType && bValidType ? looseCompareArrays(a, b) : false; | |
} | |
aValidType = isObject(a); | |
bValidType = isObject(b); | |
if (aValidType || bValidType) { | |
if (!aValidType || !bValidType) { | |
return false; | |
} | |
const aKeysCount = Object.keys(a).length; | |
const bKeysCount = Object.keys(b).length; | |
if (aKeysCount !== bKeysCount) { | |
return false; | |
} | |
for (const key in a) { | |
const aHasKey = a.hasOwnProperty(key); | |
const bHasKey = b.hasOwnProperty(key); | |
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { | |
return false; | |
} | |
} | |
} | |
return String(a) === String(b); | |
} | |
function looseIndexOf(arr, val) { | |
return arr.findIndex((item) => looseEqual(item, val)); | |
} | |
const isRef = (val) => { | |
return !!(val && val.__v_isRef === true); | |
}; | |
const toDisplayString = (val) => { | |
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val); | |
}; | |
const replacer = (_key, val) => { | |
if (isRef(val)) { | |
return replacer(_key, val.value); | |
} else if (isMap(val)) { | |
return { | |
[`Map(${val.size})`]: [...val.entries()].reduce( | |
(entries, [key, val2], i) => { | |
entries[stringifySymbol(key, i) + " =>"] = val2; | |
return entries; | |
}, | |
{} | |
) | |
}; | |
} else if (isSet(val)) { | |
return { | |
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) | |
}; | |
} else if (isSymbol(val)) { | |
return stringifySymbol(val); | |
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { | |
return String(val); | |
} | |
return val; | |
}; | |
const stringifySymbol = (v, i = "") => { | |
var _a; | |
return ( | |
// Symbol.description in es2019+ so we need to cast here to pass | |
// the lib: es2016 check | |
isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v | |
); | |
}; | |
exports.EMPTY_ARR = EMPTY_ARR; | |
exports.EMPTY_OBJ = EMPTY_OBJ; | |
exports.NO = NO; | |
exports.NOOP = NOOP; | |
exports.PatchFlagNames = PatchFlagNames; | |
exports.PatchFlags = PatchFlags; | |
exports.ShapeFlags = ShapeFlags; | |
exports.SlotFlags = SlotFlags; | |
exports.camelize = camelize; | |
exports.capitalize = capitalize; | |
exports.def = def; | |
exports.escapeHtml = escapeHtml; | |
exports.escapeHtmlComment = escapeHtmlComment; | |
exports.extend = extend; | |
exports.genPropsAccessExp = genPropsAccessExp; | |
exports.generateCodeFrame = generateCodeFrame; | |
exports.getGlobalThis = getGlobalThis; | |
exports.hasChanged = hasChanged; | |
exports.hasOwn = hasOwn; | |
exports.hyphenate = hyphenate; | |
exports.includeBooleanAttr = includeBooleanAttr; | |
exports.invokeArrayFns = invokeArrayFns; | |
exports.isArray = isArray; | |
exports.isBooleanAttr = isBooleanAttr; | |
exports.isBuiltInDirective = isBuiltInDirective; | |
exports.isDate = isDate; | |
exports.isFunction = isFunction; | |
exports.isGloballyAllowed = isGloballyAllowed; | |
exports.isGloballyWhitelisted = isGloballyWhitelisted; | |
exports.isHTMLTag = isHTMLTag; | |
exports.isIntegerKey = isIntegerKey; | |
exports.isKnownHtmlAttr = isKnownHtmlAttr; | |
exports.isKnownSvgAttr = isKnownSvgAttr; | |
exports.isMap = isMap; | |
exports.isMathMLTag = isMathMLTag; | |
exports.isModelListener = isModelListener; | |
exports.isObject = isObject; | |
exports.isOn = isOn; | |
exports.isPlainObject = isPlainObject; | |
exports.isPromise = isPromise; | |
exports.isRegExp = isRegExp; | |
exports.isRenderableAttrValue = isRenderableAttrValue; | |
exports.isReservedProp = isReservedProp; | |
exports.isSSRSafeAttrName = isSSRSafeAttrName; | |
exports.isSVGTag = isSVGTag; | |
exports.isSet = isSet; | |
exports.isSpecialBooleanAttr = isSpecialBooleanAttr; | |
exports.isString = isString; | |
exports.isSymbol = isSymbol; | |
exports.isVoidTag = isVoidTag; | |
exports.looseEqual = looseEqual; | |
exports.looseIndexOf = looseIndexOf; | |
exports.looseToNumber = looseToNumber; | |
exports.makeMap = makeMap; | |
exports.normalizeClass = normalizeClass; | |
exports.normalizeProps = normalizeProps; | |
exports.normalizeStyle = normalizeStyle; | |
exports.objectToString = objectToString; | |
exports.parseStringStyle = parseStringStyle; | |
exports.propsToAttrMap = propsToAttrMap; | |
exports.remove = remove; | |
exports.slotFlagsText = slotFlagsText; | |
exports.stringifyStyle = stringifyStyle; | |
exports.toDisplayString = toDisplayString; | |
exports.toHandlerKey = toHandlerKey; | |
exports.toNumber = toNumber; | |
exports.toRawType = toRawType; | |
exports.toTypeString = toTypeString; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/reactivity/node_modules/@vue/shared/dist/shared.cjs.js === | |
/** | |
* @vue/shared v3.4.35 | |
* (c) 2018-present Yuxi (Evan) You and Vue contributors | |
* @license MIT | |
**/ | |
'use strict'; | |
Object.defineProperty(exports, '__esModule', { value: true }); | |
/*! #__NO_SIDE_EFFECTS__ */ | |
// @__NO_SIDE_EFFECTS__ | |
function makeMap(str, expectsLowerCase) { | |
const set = new Set(str.split(",")); | |
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val); | |
} | |
const EMPTY_OBJ = Object.freeze({}) ; | |
const EMPTY_ARR = Object.freeze([]) ; | |
const NOOP = () => { | |
}; | |
const NO = () => false; | |
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter | |
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); | |
const isModelListener = (key) => key.startsWith("onUpdate:"); | |
const extend = Object.assign; | |
const remove = (arr, el) => { | |
const i = arr.indexOf(el); | |
if (i > -1) { | |
arr.splice(i, 1); | |
} | |
}; | |
const hasOwnProperty = Object.prototype.hasOwnProperty; | |
const hasOwn = (val, key) => hasOwnProperty.call(val, key); | |
const isArray = Array.isArray; | |
const isMap = (val) => toTypeString(val) === "[object Map]"; | |
const isSet = (val) => toTypeString(val) === "[object Set]"; | |
const isDate = (val) => toTypeString(val) === "[object Date]"; | |
const isRegExp = (val) => toTypeString(val) === "[object RegExp]"; | |
const isFunction = (val) => typeof val === "function"; | |
const isString = (val) => typeof val === "string"; | |
const isSymbol = (val) => typeof val === "symbol"; | |
const isObject = (val) => val !== null && typeof val === "object"; | |
const isPromise = (val) => { | |
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); | |
}; | |
const objectToString = Object.prototype.toString; | |
const toTypeString = (value) => objectToString.call(value); | |
const toRawType = (value) => { | |
return toTypeString(value).slice(8, -1); | |
}; | |
const isPlainObject = (val) => toTypeString(val) === "[object Object]"; | |
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; | |
const isReservedProp = /* @__PURE__ */ makeMap( | |
// the leading comma is intentional so empty string "" is also included | |
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" | |
); | |
const isBuiltInDirective = /* @__PURE__ */ makeMap( | |
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo" | |
); | |
const cacheStringFunction = (fn) => { | |
const cache = /* @__PURE__ */ Object.create(null); | |
return (str) => { | |
const hit = cache[str]; | |
return hit || (cache[str] = fn(str)); | |
}; | |
}; | |
const camelizeRE = /-(\w)/g; | |
const camelize = cacheStringFunction((str) => { | |
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); | |
}); | |
const hyphenateRE = /\B([A-Z])/g; | |
const hyphenate = cacheStringFunction( | |
(str) => str.replace(hyphenateRE, "-$1").toLowerCase() | |
); | |
const capitalize = cacheStringFunction((str) => { | |
return str.charAt(0).toUpperCase() + str.slice(1); | |
}); | |
const toHandlerKey = cacheStringFunction((str) => { | |
const s = str ? `on${capitalize(str)}` : ``; | |
return s; | |
}); | |
const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | |
const invokeArrayFns = (fns, ...arg) => { | |
for (let i = 0; i < fns.length; i++) { | |
fns[i](...arg); | |
} | |
}; | |
const def = (obj, key, value, writable = false) => { | |
Object.defineProperty(obj, key, { | |
configurable: true, | |
enumerable: false, | |
writable, | |
value | |
}); | |
}; | |
const looseToNumber = (val) => { | |
const n = parseFloat(val); | |
return isNaN(n) ? val : n; | |
}; | |
const toNumber = (val) => { | |
const n = isString(val) ? Number(val) : NaN; | |
return isNaN(n) ? val : n; | |
}; | |
let _globalThis; | |
const getGlobalThis = () => { | |
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); | |
}; | |
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/; | |
function genPropsAccessExp(name) { | |
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`; | |
} | |
const PatchFlags = { | |
"TEXT": 1, | |
"1": "TEXT", | |
"CLASS": 2, | |
"2": "CLASS", | |
"STYLE": 4, | |
"4": "STYLE", | |
"PROPS": 8, | |
"8": "PROPS", | |
"FULL_PROPS": 16, | |
"16": "FULL_PROPS", | |
"NEED_HYDRATION": 32, | |
"32": "NEED_HYDRATION", | |
"STABLE_FRAGMENT": 64, | |
"64": "STABLE_FRAGMENT", | |
"KEYED_FRAGMENT": 128, | |
"128": "KEYED_FRAGMENT", | |
"UNKEYED_FRAGMENT": 256, | |
"256": "UNKEYED_FRAGMENT", | |
"NEED_PATCH": 512, | |
"512": "NEED_PATCH", | |
"DYNAMIC_SLOTS": 1024, | |
"1024": "DYNAMIC_SLOTS", | |
"DEV_ROOT_FRAGMENT": 2048, | |
"2048": "DEV_ROOT_FRAGMENT", | |
"HOISTED": -1, | |
"-1": "HOISTED", | |
"BAIL": -2, | |
"-2": "BAIL" | |
}; | |
const PatchFlagNames = { | |
[1]: `TEXT`, | |
[2]: `CLASS`, | |
[4]: `STYLE`, | |
[8]: `PROPS`, | |
[16]: `FULL_PROPS`, | |
[32]: `NEED_HYDRATION`, | |
[64]: `STABLE_FRAGMENT`, | |
[128]: `KEYED_FRAGMENT`, | |
[256]: `UNKEYED_FRAGMENT`, | |
[512]: `NEED_PATCH`, | |
[1024]: `DYNAMIC_SLOTS`, | |
[2048]: `DEV_ROOT_FRAGMENT`, | |
[-1]: `HOISTED`, | |
[-2]: `BAIL` | |
}; | |
const ShapeFlags = { | |
"ELEMENT": 1, | |
"1": "ELEMENT", | |
"FUNCTIONAL_COMPONENT": 2, | |
"2": "FUNCTIONAL_COMPONENT", | |
"STATEFUL_COMPONENT": 4, | |
"4": "STATEFUL_COMPONENT", | |
"TEXT_CHILDREN": 8, | |
"8": "TEXT_CHILDREN", | |
"ARRAY_CHILDREN": 16, | |
"16": "ARRAY_CHILDREN", | |
"SLOTS_CHILDREN": 32, | |
"32": "SLOTS_CHILDREN", | |
"TELEPORT": 64, | |
"64": "TELEPORT", | |
"SUSPENSE": 128, | |
"128": "SUSPENSE", | |
"COMPONENT_SHOULD_KEEP_ALIVE": 256, | |
"256": "COMPONENT_SHOULD_KEEP_ALIVE", | |
"COMPONENT_KEPT_ALIVE": 512, | |
"512": "COMPONENT_KEPT_ALIVE", | |
"COMPONENT": 6, | |
"6": "COMPONENT" | |
}; | |
const SlotFlags = { | |
"STABLE": 1, | |
"1": "STABLE", | |
"DYNAMIC": 2, | |
"2": "DYNAMIC", | |
"FORWARDED": 3, | |
"3": "FORWARDED" | |
}; | |
const slotFlagsText = { | |
[1]: "STABLE", | |
[2]: "DYNAMIC", | |
[3]: "FORWARDED" | |
}; | |
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error"; | |
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); | |
const isGloballyWhitelisted = isGloballyAllowed; | |
const range = 2; | |
function generateCodeFrame(source, start = 0, end = source.length) { | |
start = Math.max(0, Math.min(start, source.length)); | |
end = Math.max(0, Math.min(end, source.length)); | |
if (start > end) return ""; | |
let lines = source.split(/(\r?\n)/); | |
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); | |
lines = lines.filter((_, idx) => idx % 2 === 0); | |
let count = 0; | |
const res = []; | |
for (let i = 0; i < lines.length; i++) { | |
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); | |
if (count >= start) { | |
for (let j = i - range; j <= i + range || end > count; j++) { | |
if (j < 0 || j >= lines.length) continue; | |
const line = j + 1; | |
res.push( | |
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` | |
); | |
const lineLength = lines[j].length; | |
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; | |
if (j === i) { | |
const pad = start - (count - (lineLength + newLineSeqLength)); | |
const length = Math.max( | |
1, | |
end > count ? lineLength - pad : end - start | |
); | |
res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); | |
} else if (j > i) { | |
if (end > count) { | |
const length = Math.max(Math.min(end - count, lineLength), 1); | |
res.push(` | ` + "^".repeat(length)); | |
} | |
count += lineLength + newLineSeqLength; | |
} | |
} | |
break; | |
} | |
} | |
return res.join("\n"); | |
} | |
function normalizeStyle(value) { | |
if (isArray(value)) { | |
const res = {}; | |
for (let i = 0; i < value.length; i++) { | |
const item = value[i]; | |
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); | |
if (normalized) { | |
for (const key in normalized) { | |
res[key] = normalized[key]; | |
} | |
} | |
} | |
return res; | |
} else if (isString(value) || isObject(value)) { | |
return value; | |
} | |
} | |
const listDelimiterRE = /;(?![^(]*\))/g; | |
const propertyDelimiterRE = /:([^]+)/; | |
const styleCommentRE = /\/\*[^]*?\*\//g; | |
function parseStringStyle(cssText) { | |
const ret = {}; | |
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { | |
if (item) { | |
const tmp = item.split(propertyDelimiterRE); | |
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | |
} | |
}); | |
return ret; | |
} | |
function stringifyStyle(styles) { | |
let ret = ""; | |
if (!styles || isString(styles)) { | |
return ret; | |
} | |
for (const key in styles) { | |
const value = styles[key]; | |
if (isString(value) || typeof value === "number") { | |
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | |
ret += `${normalizedKey}:${value};`; | |
} | |
} | |
return ret; | |
} | |
function normalizeClass(value) { | |
let res = ""; | |
if (isString(value)) { | |
res = value; | |
} else if (isArray(value)) { | |
for (let i = 0; i < value.length; i++) { | |
const normalized = normalizeClass(value[i]); | |
if (normalized) { | |
res += normalized + " "; | |
} | |
} | |
} else if (isObject(value)) { | |
for (const name in value) { | |
if (value[name]) { | |
res += name + " "; | |
} | |
} | |
} | |
return res.trim(); | |
} | |
function normalizeProps(props) { | |
if (!props) return null; | |
let { class: klass, style } = props; | |
if (klass && !isString(klass)) { | |
props.class = normalizeClass(klass); | |
} | |
if (style) { | |
props.style = normalizeStyle(style); | |
} | |
return props; | |
} | |
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot"; | |
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view"; | |
const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics"; | |
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr"; | |
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); | |
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); | |
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); | |
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); | |
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; | |
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); | |
const isBooleanAttr = /* @__PURE__ */ makeMap( | |
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected` | |
); | |
function includeBooleanAttr(value) { | |
return !!value || value === ""; | |
} | |
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/; | |
const attrValidationCache = {}; | |
function isSSRSafeAttrName(name) { | |
if (attrValidationCache.hasOwnProperty(name)) { | |
return attrValidationCache[name]; | |
} | |
const isUnsafe = unsafeAttrCharRE.test(name); | |
if (isUnsafe) { | |
console.error(`unsafe attribute name: ${name}`); | |
} | |
return attrValidationCache[name] = !isUnsafe; | |
} | |
const propsToAttrMap = { | |
acceptCharset: "accept-charset", | |
className: "class", | |
htmlFor: "for", | |
httpEquiv: "http-equiv" | |
}; | |
const isKnownHtmlAttr = /* @__PURE__ */ makeMap( | |
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap` | |
); | |
const isKnownSvgAttr = /* @__PURE__ */ makeMap( | |
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` | |
); | |
function isRenderableAttrValue(value) { | |
if (value == null) { | |
return false; | |
} | |
const type = typeof value; | |
return type === "string" || type === "number" || type === "boolean"; | |
} | |
const escapeRE = /["'&<>]/; | |
function escapeHtml(string) { | |
const str = "" + string; | |
const match = escapeRE.exec(str); | |
if (!match) { | |
return str; | |
} | |
let html = ""; | |
let escaped; | |
let index; | |
let lastIndex = 0; | |
for (index = match.index; index < str.length; index++) { | |
switch (str.charCodeAt(index)) { | |
case 34: | |
escaped = """; | |
break; | |
case 38: | |
escaped = "&"; | |
break; | |
case 39: | |
escaped = "'"; | |
break; | |
case 60: | |
escaped = "<"; | |
break; | |
case 62: | |
escaped = ">"; | |
break; | |
default: | |
continue; | |
} | |
if (lastIndex !== index) { | |
html += str.slice(lastIndex, index); | |
} | |
lastIndex = index + 1; | |
html += escaped; | |
} | |
return lastIndex !== index ? html + str.slice(lastIndex, index) : html; | |
} | |
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g; | |
function escapeHtmlComment(src) { | |
return src.replace(commentStripRE, ""); | |
} | |
function looseCompareArrays(a, b) { | |
if (a.length !== b.length) return false; | |
let equal = true; | |
for (let i = 0; equal && i < a.length; i++) { | |
equal = looseEqual(a[i], b[i]); | |
} | |
return equal; | |
} | |
function looseEqual(a, b) { | |
if (a === b) return true; | |
let aValidType = isDate(a); | |
let bValidType = isDate(b); | |
if (aValidType || bValidType) { | |
return aValidType && bValidType ? a.getTime() === b.getTime() : false; | |
} | |
aValidType = isSymbol(a); | |
bValidType = isSymbol(b); | |
if (aValidType || bValidType) { | |
return a === b; | |
} | |
aValidType = isArray(a); | |
bValidType = isArray(b); | |
if (aValidType || bValidType) { | |
return aValidType && bValidType ? looseCompareArrays(a, b) : false; | |
} | |
aValidType = isObject(a); | |
bValidType = isObject(b); | |
if (aValidType || bValidType) { | |
if (!aValidType || !bValidType) { | |
return false; | |
} | |
const aKeysCount = Object.keys(a).length; | |
const bKeysCount = Object.keys(b).length; | |
if (aKeysCount !== bKeysCount) { | |
return false; | |
} | |
for (const key in a) { | |
const aHasKey = a.hasOwnProperty(key); | |
const bHasKey = b.hasOwnProperty(key); | |
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { | |
return false; | |
} | |
} | |
} | |
return String(a) === String(b); | |
} | |
function looseIndexOf(arr, val) { | |
return arr.findIndex((item) => looseEqual(item, val)); | |
} | |
const isRef = (val) => { | |
return !!(val && val.__v_isRef === true); | |
}; | |
const toDisplayString = (val) => { | |
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val); | |
}; | |
const replacer = (_key, val) => { | |
if (isRef(val)) { | |
return replacer(_key, val.value); | |
} else if (isMap(val)) { | |
return { | |
[`Map(${val.size})`]: [...val.entries()].reduce( | |
(entries, [key, val2], i) => { | |
entries[stringifySymbol(key, i) + " =>"] = val2; | |
return entries; | |
}, | |
{} | |
) | |
}; | |
} else if (isSet(val)) { | |
return { | |
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) | |
}; | |
} else if (isSymbol(val)) { | |
return stringifySymbol(val); | |
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { | |
return String(val); | |
} | |
return val; | |
}; | |
const stringifySymbol = (v, i = "") => { | |
var _a; | |
return ( | |
// Symbol.description in es2019+ so we need to cast here to pass | |
// the lib: es2016 check | |
isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v | |
); | |
}; | |
exports.EMPTY_ARR = EMPTY_ARR; | |
exports.EMPTY_OBJ = EMPTY_OBJ; | |
exports.NO = NO; | |
exports.NOOP = NOOP; | |
exports.PatchFlagNames = PatchFlagNames; | |
exports.PatchFlags = PatchFlags; | |
exports.ShapeFlags = ShapeFlags; | |
exports.SlotFlags = SlotFlags; | |
exports.camelize = camelize; | |
exports.capitalize = capitalize; | |
exports.def = def; | |
exports.escapeHtml = escapeHtml; | |
exports.escapeHtmlComment = escapeHtmlComment; | |
exports.extend = extend; | |
exports.genPropsAccessExp = genPropsAccessExp; | |
exports.generateCodeFrame = generateCodeFrame; | |
exports.getGlobalThis = getGlobalThis; | |
exports.hasChanged = hasChanged; | |
exports.hasOwn = hasOwn; | |
exports.hyphenate = hyphenate; | |
exports.includeBooleanAttr = includeBooleanAttr; | |
exports.invokeArrayFns = invokeArrayFns; | |
exports.isArray = isArray; | |
exports.isBooleanAttr = isBooleanAttr; | |
exports.isBuiltInDirective = isBuiltInDirective; | |
exports.isDate = isDate; | |
exports.isFunction = isFunction; | |
exports.isGloballyAllowed = isGloballyAllowed; | |
exports.isGloballyWhitelisted = isGloballyWhitelisted; | |
exports.isHTMLTag = isHTMLTag; | |
exports.isIntegerKey = isIntegerKey; | |
exports.isKnownHtmlAttr = isKnownHtmlAttr; | |
exports.isKnownSvgAttr = isKnownSvgAttr; | |
exports.isMap = isMap; | |
exports.isMathMLTag = isMathMLTag; | |
exports.isModelListener = isModelListener; | |
exports.isObject = isObject; | |
exports.isOn = isOn; | |
exports.isPlainObject = isPlainObject; | |
exports.isPromise = isPromise; | |
exports.isRegExp = isRegExp; | |
exports.isRenderableAttrValue = isRenderableAttrValue; | |
exports.isReservedProp = isReservedProp; | |
exports.isSSRSafeAttrName = isSSRSafeAttrName; | |
exports.isSVGTag = isSVGTag; | |
exports.isSet = isSet; | |
exports.isSpecialBooleanAttr = isSpecialBooleanAttr; | |
exports.isString = isString; | |
exports.isSymbol = isSymbol; | |
exports.isVoidTag = isVoidTag; | |
exports.looseEqual = looseEqual; | |
exports.looseIndexOf = looseIndexOf; | |
exports.looseToNumber = looseToNumber; | |
exports.makeMap = makeMap; | |
exports.normalizeClass = normalizeClass; | |
exports.normalizeProps = normalizeProps; | |
exports.normalizeStyle = normalizeStyle; | |
exports.objectToString = objectToString; | |
exports.parseStringStyle = parseStringStyle; | |
exports.propsToAttrMap = propsToAttrMap; | |
exports.remove = remove; | |
exports.slotFlagsText = slotFlagsText; | |
exports.stringifyStyle = stringifyStyle; | |
exports.toDisplayString = toDisplayString; | |
exports.toHandlerKey = toHandlerKey; | |
exports.toNumber = toNumber; | |
exports.toRawType = toRawType; | |
exports.toTypeString = toTypeString; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/reactivity/index.js === | |
'use strict' | |
if (process.env.NODE_ENV === 'production') { | |
module.exports = require('./dist/reactivity.cjs.prod.js') | |
} else { | |
module.exports = require('./dist/reactivity.cjs.js') | |
} | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/reactivity/dist/reactivity.esm-browser.prod.js === | |
/** | |
* @vue/reactivity v3.4.35 | |
* (c) 2018-present Yuxi (Evan) You and Vue contributors | |
* @license MIT | |
**//*! #__NO_SIDE_EFFECTS__ */let e,t;let s=()=>{},i=Object.assign,r=Object.prototype.hasOwnProperty,n=(e,t)=>r.call(e,t),l=Array.isArray,u=e=>"[object Map]"===_(e),c=e=>"function"==typeof e,a=e=>"string"==typeof e,h=e=>"symbol"==typeof e,o=e=>null!==e&&"object"==typeof e,f=Object.prototype.toString,_=e=>f.call(e),d=e=>_(e).slice(8,-1),p=e=>a(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,v=(e,t)=>!Object.is(e,t),g=(e,t,s,i=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:i,value:s})};class y{constructor(t=!1){this.detached=t,this._active=!0,this.effects=[],this.cleanups=[],this.parent=e,!t&&e&&(this.index=(e.scopes||(e.scopes=[])).push(this)-1)}get active(){return this._active}run(t){if(this._active){let s=e;try{return e=this,t()}finally{e=s}}}on(){e=this}off(){e=this.parent}stop(e){if(this._active){let t,s;for(t=0,s=this.effects.length;t<s;t++)this.effects[t].stop();for(t=0,s=this.cleanups.length;t<s;t++)this.cleanups[t]();if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].stop(!0);if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0,this._active=!1}}}function w(e){return new y(e)}function R(t,s=e){s&&s.active&&s.effects.push(t)}function S(){return e}function b(t){e&&e.cleanups.push(t)}class k{constructor(e,t,s,i){this.fn=e,this.trigger=t,this.scheduler=s,this.active=!0,this.deps=[],this._dirtyLevel=4,this._trackId=0,this._runnings=0,this._shouldSchedule=!1,this._depsLength=0,R(this,i)}get dirty(){if(2===this._dirtyLevel||3===this._dirtyLevel){this._dirtyLevel=1,T();for(let e=0;e<this._depsLength;e++){let t=this.deps[e];if(t.computed&&(t.computed.value,this._dirtyLevel>=4))break}1===this._dirtyLevel&&(this._dirtyLevel=0),M()}return this._dirtyLevel>=4}set dirty(e){this._dirtyLevel=e?4:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let e=x,s=t;try{return x=!0,t=this,this._runnings++,L(this),this.fn()}finally{E(this),this._runnings--,t=s,x=e}}stop(){this.active&&(L(this),E(this),this.onStop&&this.onStop(),this.active=!1)}}function L(e){e._trackId++,e._depsLength=0}function E(e){if(e.deps.length>e._depsLength){for(let t=e._depsLength;t<e.deps.length;t++)O(e.deps[t],e);e.deps.length=e._depsLength}}function O(e,t){let s=e.get(t);void 0!==s&&t._trackId!==s&&(e.delete(t),0===e.size&&e.cleanup())}function m(e,t){e.effect instanceof k&&(e=e.effect.fn);let r=new k(e,s,()=>{r.dirty&&r.run()});t&&(i(r,t),t.scope&&R(r,t.scope)),t&&t.lazy||r.run();let n=r.run.bind(r);return n.effect=r,n}function j(e){e.effect.stop()}let x=!0,I=0,P=[];function T(){P.push(x),x=!1}function A(){P.push(x),x=!0}function M(){let e=P.pop();x=void 0===e||e}function V(){I++}function W(){for(I--;!I&&N.length;)N.shift()()}function z(e,t,s){if(t.get(e)!==e._trackId){t.set(e,e._trackId);let s=e.deps[e._depsLength];s!==t?(s&&O(s,e),e.deps[e._depsLength++]=t):e._depsLength++}}let N=[];function D(e,t,s){for(let s of(V(),e.keys())){let i;s._dirtyLevel<t&&(null!=i?i:i=e.get(s)===s._trackId)&&(s._shouldSchedule||(s._shouldSchedule=0===s._dirtyLevel),s._dirtyLevel=t),s._shouldSchedule&&(null!=i?i:i=e.get(s)===s._trackId)&&(s.trigger(),(!s._runnings||s.allowRecurse)&&2!==s._dirtyLevel&&(s._shouldSchedule=!1,s.scheduler&&N.push(s.scheduler)))}W()}let C=(e,t)=>{let s=new Map;return s.cleanup=e,s.computed=t,s},K=new WeakMap,H=Symbol(""),Y=Symbol("");function F(e,s,i){if(x&&t){let s=K.get(e);s||K.set(e,s=new Map);let r=s.get(i);r||s.set(i,r=C(()=>s.delete(i))),z(t,r)}}function G(e,t,s,i,r,n){let c=K.get(e);if(!c)return;let a=[];if("clear"===t)a=[...c.values()];else if("length"===s&&l(e)){let e=Number(i);c.forEach((t,s)=>{("length"===s||!h(s)&&s>=e)&&a.push(t)})}else switch(void 0!==s&&a.push(c.get(s)),t){case"add":l(e)?p(s)&&a.push(c.get("length")):(a.push(c.get(H)),u(e)&&a.push(c.get(Y)));break;case"delete":!l(e)&&(a.push(c.get(H)),u(e)&&a.push(c.get(Y)));break;case"set":u(e)&&a.push(c.get(H))}for(let e of(V(),a))e&&D(e,4);W()}let q=function(e,t){let s=new Set(e.split(","));return e=>s.has(e)}("__proto__,__v_isRef,__isVue"),B=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(h)),J=function(){let e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...e){let s=ez(this);for(let e=0,t=this.length;e<t;e++)F(s,"get",e+"");let i=s[t](...e);return -1===i||!1===i?s[t](...e.map(ez)):i}}),["push","pop","shift","unshift","splice"].forEach(t=>{e[t]=function(...e){T(),V();let s=ez(this)[t].apply(this,e);return W(),M(),s}}),e}();function Q(e){h(e)||(e=String(e));let t=ez(this);return F(t,"has",e),t.hasOwnProperty(e)}class U{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,s){let i=this._isReadonly,r=this._isShallow;if("__v_isReactive"===t)return!i;if("__v_isReadonly"===t)return i;if("__v_isShallow"===t)return r;if("__v_raw"===t)return s===(i?r?em:eO:r?eE:eL).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(s)?e:void 0;let u=l(e);if(!i){if(u&&n(J,t))return Reflect.get(J,t,s);if("hasOwnProperty"===t)return Q}let c=Reflect.get(e,t,s);return(h(t)?B.has(t):q(t))?c:(i||F(e,"get",t),r)?c:eG(c)?u&&p(t)?c:c.value:o(c)?i?eI(c):ej(c):c}}class X extends U{constructor(e=!1){super(!1,e)}set(e,t,s,i){let r=e[t];if(!this._isShallow){let t=eM(r);if(eV(s)||eM(s)||(r=ez(r),s=ez(s)),!l(e)&&eG(r)&&!eG(s))return!t&&(r.value=s,!0)}let u=l(e)&&p(t)?Number(t)<e.length:n(e,t),c=Reflect.set(e,t,s,i);return e===ez(i)&&(u?v(s,r)&&G(e,"set",t,s):G(e,"add",t,s)),c}deleteProperty(e,t){let s=n(e,t);e[t];let i=Reflect.deleteProperty(e,t);return i&&s&&G(e,"delete",t,void 0),i}has(e,t){let s=Reflect.has(e,t);return h(t)&&B.has(t)||F(e,"has",t),s}ownKeys(e){return F(e,"iterate",l(e)?"length":H),Reflect.ownKeys(e)}}class Z extends U{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}let $=new X,ee=new Z,et=new X(!0),es=new Z(!0),ei=e=>e,er=e=>Reflect.getPrototypeOf(e);function en(e,t,s=!1,i=!1){let r=ez(e=e.__v_raw),n=ez(t);s||(v(t,n)&&F(r,"get",t),F(r,"get",n));let{has:l}=er(r),u=i?ei:s?eC:eD;return l.call(r,t)?u(e.get(t)):l.call(r,n)?u(e.get(n)):void(e!==r&&e.get(t))}function el(e,t=!1){let s=this.__v_raw,i=ez(s),r=ez(e);return t||(v(e,r)&&F(i,"has",e),F(i,"has",r)),e===r?s.has(e):s.has(e)||s.has(r)}function eu(e,t=!1){return e=e.__v_raw,t||F(ez(e),"iterate",H),Reflect.get(e,"size",e)}function ec(e,t=!1){t||eV(e)||eM(e)||(e=ez(e));let s=ez(this);return er(s).has.call(s,e)||(s.add(e),G(s,"add",e,e)),this}function ea(e,t,s=!1){s||eV(t)||eM(t)||(t=ez(t));let i=ez(this),{has:r,get:n}=er(i),l=r.call(i,e);l||(e=ez(e),l=r.call(i,e));let u=n.call(i,e);return i.set(e,t),l?v(t,u)&&G(i,"set",e,t):G(i,"add",e,t),this}function eh(e){let t=ez(this),{has:s,get:i}=er(t),r=s.call(t,e);r||(e=ez(e),r=s.call(t,e)),i&&i.call(t,e);let n=t.delete(e);return r&&G(t,"delete",e,void 0),n}function eo(){let e=ez(this),t=0!==e.size,s=e.clear();return t&&G(e,"clear",void 0,void 0),s}function ef(e,t){return function(s,i){let r=this,n=r.__v_raw,l=ez(n),u=t?ei:e?eC:eD;return e||F(l,"iterate",H),n.forEach((e,t)=>s.call(i,u(e),u(t),r))}}function e_(e,t,s){return function(...i){let r=this.__v_raw,n=ez(r),l=u(n),c="entries"===e||e===Symbol.iterator&&l,a=r[e](...i),h=s?ei:t?eC:eD;return t||F(n,"iterate","keys"===e&&l?Y:H),{next(){let{value:e,done:t}=a.next();return t?{value:e,done:t}:{value:c?[h(e[0]),h(e[1])]:h(e),done:t}},[Symbol.iterator](){return this}}}}function ed(e){return function(...t){return"delete"!==e&&("clear"===e?void 0:this)}}let[ep,ev,eg,ey]=function(){let e={get(e){return en(this,e)},get size(){return eu(this)},has:el,add:ec,set:ea,delete:eh,clear:eo,forEach:ef(!1,!1)},t={get(e){return en(this,e,!1,!0)},get size(){return eu(this)},has:el,add(e){return ec.call(this,e,!0)},set(e,t){return ea.call(this,e,t,!0)},delete:eh,clear:eo,forEach:ef(!1,!0)},s={get(e){return en(this,e,!0)},get size(){return eu(this,!0)},has(e){return el.call(this,e,!0)},add:ed("add"),set:ed("set"),delete:ed("delete"),clear:ed("clear"),forEach:ef(!0,!1)},i={get(e){return en(this,e,!0,!0)},get size(){return eu(this,!0)},has(e){return el.call(this,e,!0)},add:ed("add"),set:ed("set"),delete:ed("delete"),clear:ed("clear"),forEach:ef(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{e[r]=e_(r,!1,!1),s[r]=e_(r,!0,!1),t[r]=e_(r,!1,!0),i[r]=e_(r,!0,!0)}),[e,s,t,i]}();function ew(e,t){let s=t?e?ey:eg:e?ev:ep;return(t,i,r)=>"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(n(s,i)&&i in t?s:t,i,r)}let eR={get:ew(!1,!1)},eS={get:ew(!1,!0)},eb={get:ew(!0,!1)},ek={get:ew(!0,!0)},eL=new WeakMap,eE=new WeakMap,eO=new WeakMap,em=new WeakMap;function ej(e){return eM(e)?e:eT(e,!1,$,eR,eL)}function ex(e){return eT(e,!1,et,eS,eE)}function eI(e){return eT(e,!0,ee,eb,eO)}function eP(e){return eT(e,!0,es,ek,em)}function eT(e,t,s,i,r){if(!o(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let n=r.get(e);if(n)return n;let l=e.__v_skip||!Object.isExtensible(e)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(d(e));if(0===l)return e;let u=new Proxy(e,2===l?i:s);return r.set(e,u),u}function eA(e){return eM(e)?eA(e.__v_raw):!!(e&&e.__v_isReactive)}function eM(e){return!!(e&&e.__v_isReadonly)}function eV(e){return!!(e&&e.__v_isShallow)}function eW(e){return!!e&&!!e.__v_raw}function ez(e){let t=e&&e.__v_raw;return t?ez(t):e}function eN(e){return Object.isExtensible(e)&&g(e,"__v_skip",!0),e}let eD=e=>o(e)?ej(e):e,eC=e=>o(e)?eI(e):e;class eK{constructor(e,t,s,i){this.getter=e,this._setter=t,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new k(()=>e(this._value),()=>eF(this,2===this.effect._dirtyLevel?2:3)),this.effect.computed=this,this.effect.active=this._cacheable=!i,this.__v_isReadonly=s}get value(){let e=ez(this);return(!e._cacheable||e.effect.dirty)&&v(e._value,e._value=e.effect.run())&&eF(e,4),eY(e),e.effect._dirtyLevel>=2&&eF(e,2),e._value}set value(e){this._setter(e)}get _dirty(){return this.effect.dirty}set _dirty(e){this.effect.dirty=e}}function eH(e,t,i=!1){let r,n;let l=c(e);return l?(r=e,n=s):(r=e.get,n=e.set),new eK(r,n,l||!n,i)}function eY(e){var s;x&&t&&(e=ez(e),z(t,null!=(s=e.dep)?s:e.dep=C(()=>e.dep=void 0,e instanceof eK?e:void 0)))}function eF(e,t=4,s,i){let r=(e=ez(e)).dep;r&&D(r,t)}function eG(e){return!!(e&&!0===e.__v_isRef)}function eq(e){return eJ(e,!1)}function eB(e){return eJ(e,!0)}function eJ(e,t){return eG(e)?e:new eQ(e,t)}class eQ{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:ez(e),this._value=t?e:eD(e)}get value(){return eY(this),this._value}set value(e){let t=this.__v_isShallow||eV(e)||eM(e);v(e=t?e:ez(e),this._rawValue)&&(this._rawValue,this._rawValue=e,this._value=t?e:eD(e),eF(this,4))}}function eU(e){eF(e,4)}function eX(e){return eG(e)?e.value:e}function eZ(e){return c(e)?e():eX(e)}let e$={get:(e,t,s)=>eX(Reflect.get(e,t,s)),set:(e,t,s,i)=>{let r=e[t];return eG(r)&&!eG(s)?(r.value=s,!0):Reflect.set(e,t,s,i)}};function e0(e){return eA(e)?e:new Proxy(e,e$)}class e1{constructor(e){this.dep=void 0,this.__v_isRef=!0;let{get:t,set:s}=e(()=>eY(this),()=>eF(this));this._get=t,this._set=s}get value(){return this._get()}set value(e){this._set(e)}}function e4(e){return new e1(e)}function e2(e){let t=l(e)?Array(e.length):{};for(let s in e)t[s]=e6(e,s);return t}class e3{constructor(e,t,s){this._object=e,this._key=t,this._defaultValue=s,this.__v_isRef=!0}get value(){let e=this._object[this._key];return void 0===e?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return function(e,t){let s=K.get(e);return s&&s.get(t)}(ez(this._object),this._key)}}class e8{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function e5(e,t,s){return eG(e)?e:c(e)?new e8(e):o(e)&&arguments.length>1?e6(e,t,s):eq(e)}function e6(e,t,s){let i=e[t];return eG(i)?i:new e3(e,t,s)}let e7=eH,e9={GET:"get",HAS:"has",ITERATE:"iterate"},te={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},tt={SKIP:"__v_skip",IS_REACTIVE:"__v_isReactive",IS_READONLY:"__v_isReadonly",IS_SHALLOW:"__v_isShallow",RAW:"__v_raw"};export{y as EffectScope,H as ITERATE_KEY,k as ReactiveEffect,tt as ReactiveFlags,e9 as TrackOpTypes,te as TriggerOpTypes,eH as computed,e4 as customRef,e7 as deferredComputed,m as effect,w as effectScope,A as enableTracking,S as getCurrentScope,eW as isProxy,eA as isReactive,eM as isReadonly,eG as isRef,eV as isShallow,eN as markRaw,b as onScopeDispose,V as pauseScheduling,T as pauseTracking,e0 as proxyRefs,ej as reactive,eI as readonly,eq as ref,W as resetScheduling,M as resetTracking,ex as shallowReactive,eP as shallowReadonly,eB as shallowRef,j as stop,ez as toRaw,e5 as toRef,e2 as toRefs,eZ as toValue,F as track,G as trigger,eU as triggerRef,eX as unref}; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js === | |
/** | |
* @vue/reactivity v3.4.35 | |
* (c) 2018-present Yuxi (Evan) You and Vue contributors | |
* @license MIT | |
**/ | |
'use strict'; | |
Object.defineProperty(exports, '__esModule', { value: true }); | |
var shared = require('@vue/shared'); | |
let activeEffectScope; | |
class EffectScope { | |
constructor(detached = false) { | |
this.detached = detached; | |
/** | |
* @internal | |
*/ | |
this._active = true; | |
/** | |
* @internal | |
*/ | |
this.effects = []; | |
/** | |
* @internal | |
*/ | |
this.cleanups = []; | |
this.parent = activeEffectScope; | |
if (!detached && activeEffectScope) { | |
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( | |
this | |
) - 1; | |
} | |
} | |
get active() { | |
return this._active; | |
} | |
run(fn) { | |
if (this._active) { | |
const currentEffectScope = activeEffectScope; | |
try { | |
activeEffectScope = this; | |
return fn(); | |
} finally { | |
activeEffectScope = currentEffectScope; | |
} | |
} | |
} | |
/** | |
* This should only be called on non-detached scopes | |
* @internal | |
*/ | |
on() { | |
activeEffectScope = this; | |
} | |
/** | |
* This should only be called on non-detached scopes | |
* @internal | |
*/ | |
off() { | |
activeEffectScope = this.parent; | |
} | |
stop(fromParent) { | |
if (this._active) { | |
let i, l; | |
for (i = 0, l = this.effects.length; i < l; i++) { | |
this.effects[i].stop(); | |
} | |
for (i = 0, l = this.cleanups.length; i < l; i++) { | |
this.cleanups[i](); | |
} | |
if (this.scopes) { | |
for (i = 0, l = this.scopes.length; i < l; i++) { | |
this.scopes[i].stop(true); | |
} | |
} | |
if (!this.detached && this.parent && !fromParent) { | |
const last = this.parent.scopes.pop(); | |
if (last && last !== this) { | |
this.parent.scopes[this.index] = last; | |
last.index = this.index; | |
} | |
} | |
this.parent = void 0; | |
this._active = false; | |
} | |
} | |
} | |
function effectScope(detached) { | |
return new EffectScope(detached); | |
} | |
function recordEffectScope(effect, scope = activeEffectScope) { | |
if (scope && scope.active) { | |
scope.effects.push(effect); | |
} | |
} | |
function getCurrentScope() { | |
return activeEffectScope; | |
} | |
function onScopeDispose(fn) { | |
if (activeEffectScope) { | |
activeEffectScope.cleanups.push(fn); | |
} | |
} | |
let activeEffect; | |
class ReactiveEffect { | |
constructor(fn, trigger, scheduler, scope) { | |
this.fn = fn; | |
this.trigger = trigger; | |
this.scheduler = scheduler; | |
this.active = true; | |
this.deps = []; | |
/** | |
* @internal | |
*/ | |
this._dirtyLevel = 4; | |
/** | |
* @internal | |
*/ | |
this._trackId = 0; | |
/** | |
* @internal | |
*/ | |
this._runnings = 0; | |
/** | |
* @internal | |
*/ | |
this._shouldSchedule = false; | |
/** | |
* @internal | |
*/ | |
this._depsLength = 0; | |
recordEffectScope(this, scope); | |
} | |
get dirty() { | |
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) { | |
this._dirtyLevel = 1; | |
pauseTracking(); | |
for (let i = 0; i < this._depsLength; i++) { | |
const dep = this.deps[i]; | |
if (dep.computed) { | |
triggerComputed(dep.computed); | |
if (this._dirtyLevel >= 4) { | |
break; | |
} | |
} | |
} | |
if (this._dirtyLevel === 1) { | |
this._dirtyLevel = 0; | |
} | |
resetTracking(); | |
} | |
return this._dirtyLevel >= 4; | |
} | |
set dirty(v) { | |
this._dirtyLevel = v ? 4 : 0; | |
} | |
run() { | |
this._dirtyLevel = 0; | |
if (!this.active) { | |
return this.fn(); | |
} | |
let lastShouldTrack = shouldTrack; | |
let lastEffect = activeEffect; | |
try { | |
shouldTrack = true; | |
activeEffect = this; | |
this._runnings++; | |
preCleanupEffect(this); | |
return this.fn(); | |
} finally { | |
postCleanupEffect(this); | |
this._runnings--; | |
activeEffect = lastEffect; | |
shouldTrack = lastShouldTrack; | |
} | |
} | |
stop() { | |
if (this.active) { | |
preCleanupEffect(this); | |
postCleanupEffect(this); | |
this.onStop && this.onStop(); | |
this.active = false; | |
} | |
} | |
} | |
function triggerComputed(computed) { | |
return computed.value; | |
} | |
function preCleanupEffect(effect2) { | |
effect2._trackId++; | |
effect2._depsLength = 0; | |
} | |
function postCleanupEffect(effect2) { | |
if (effect2.deps.length > effect2._depsLength) { | |
for (let i = effect2._depsLength; i < effect2.deps.length; i++) { | |
cleanupDepEffect(effect2.deps[i], effect2); | |
} | |
effect2.deps.length = effect2._depsLength; | |
} | |
} | |
function cleanupDepEffect(dep, effect2) { | |
const trackId = dep.get(effect2); | |
if (trackId !== void 0 && effect2._trackId !== trackId) { | |
dep.delete(effect2); | |
if (dep.size === 0) { | |
dep.cleanup(); | |
} | |
} | |
} | |
function effect(fn, options) { | |
if (fn.effect instanceof ReactiveEffect) { | |
fn = fn.effect.fn; | |
} | |
const _effect = new ReactiveEffect(fn, shared.NOOP, () => { | |
if (_effect.dirty) { | |
_effect.run(); | |
} | |
}); | |
if (options) { | |
shared.extend(_effect, options); | |
if (options.scope) recordEffectScope(_effect, options.scope); | |
} | |
if (!options || !options.lazy) { | |
_effect.run(); | |
} | |
const runner = _effect.run.bind(_effect); | |
runner.effect = _effect; | |
return runner; | |
} | |
function stop(runner) { | |
runner.effect.stop(); | |
} | |
let shouldTrack = true; | |
let pauseScheduleStack = 0; | |
const trackStack = []; | |
function pauseTracking() { | |
trackStack.push(shouldTrack); | |
shouldTrack = false; | |
} | |
function enableTracking() { | |
trackStack.push(shouldTrack); | |
shouldTrack = true; | |
} | |
function resetTracking() { | |
const last = trackStack.pop(); | |
shouldTrack = last === void 0 ? true : last; | |
} | |
function pauseScheduling() { | |
pauseScheduleStack++; | |
} | |
function resetScheduling() { | |
pauseScheduleStack--; | |
while (!pauseScheduleStack && queueEffectSchedulers.length) { | |
queueEffectSchedulers.shift()(); | |
} | |
} | |
function trackEffect(effect2, dep, debuggerEventExtraInfo) { | |
if (dep.get(effect2) !== effect2._trackId) { | |
dep.set(effect2, effect2._trackId); | |
const oldDep = effect2.deps[effect2._depsLength]; | |
if (oldDep !== dep) { | |
if (oldDep) { | |
cleanupDepEffect(oldDep, effect2); | |
} | |
effect2.deps[effect2._depsLength++] = dep; | |
} else { | |
effect2._depsLength++; | |
} | |
} | |
} | |
const queueEffectSchedulers = []; | |
function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) { | |
pauseScheduling(); | |
for (const effect2 of dep.keys()) { | |
let tracking; | |
if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) { | |
effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0); | |
effect2._dirtyLevel = dirtyLevel; | |
} | |
if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) { | |
effect2.trigger(); | |
if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) { | |
effect2._shouldSchedule = false; | |
if (effect2.scheduler) { | |
queueEffectSchedulers.push(effect2.scheduler); | |
} | |
} | |
} | |
} | |
resetScheduling(); | |
} | |
const createDep = (cleanup, computed) => { | |
const dep = /* @__PURE__ */ new Map(); | |
dep.cleanup = cleanup; | |
dep.computed = computed; | |
return dep; | |
}; | |
const targetMap = /* @__PURE__ */ new WeakMap(); | |
const ITERATE_KEY = Symbol(""); | |
const MAP_KEY_ITERATE_KEY = Symbol(""); | |
function track(target, type, key) { | |
if (shouldTrack && activeEffect) { | |
let depsMap = targetMap.get(target); | |
if (!depsMap) { | |
targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); | |
} | |
let dep = depsMap.get(key); | |
if (!dep) { | |
depsMap.set(key, dep = createDep(() => depsMap.delete(key))); | |
} | |
trackEffect( | |
activeEffect, | |
dep); | |
} | |
} | |
function trigger(target, type, key, newValue, oldValue, oldTarget) { | |
const depsMap = targetMap.get(target); | |
if (!depsMap) { | |
return; | |
} | |
let deps = []; | |
if (type === "clear") { | |
deps = [...depsMap.values()]; | |
} else if (key === "length" && shared.isArray(target)) { | |
const newLength = Number(newValue); | |
depsMap.forEach((dep, key2) => { | |
if (key2 === "length" || !shared.isSymbol(key2) && key2 >= newLength) { | |
deps.push(dep); | |
} | |
}); | |
} else { | |
if (key !== void 0) { | |
deps.push(depsMap.get(key)); | |
} | |
switch (type) { | |
case "add": | |
if (!shared.isArray(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
if (shared.isMap(target)) { | |
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); | |
} | |
} else if (shared.isIntegerKey(key)) { | |
deps.push(depsMap.get("length")); | |
} | |
break; | |
case "delete": | |
if (!shared.isArray(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
if (shared.isMap(target)) { | |
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); | |
} | |
} | |
break; | |
case "set": | |
if (shared.isMap(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
} | |
break; | |
} | |
} | |
pauseScheduling(); | |
for (const dep of deps) { | |
if (dep) { | |
triggerEffects( | |
dep, | |
4); | |
} | |
} | |
resetScheduling(); | |
} | |
function getDepFromReactive(object, key) { | |
const depsMap = targetMap.get(object); | |
return depsMap && depsMap.get(key); | |
} | |
const isNonTrackableKeys = /* @__PURE__ */ shared.makeMap(`__proto__,__v_isRef,__isVue`); | |
const builtInSymbols = new Set( | |
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(shared.isSymbol) | |
); | |
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations(); | |
function createArrayInstrumentations() { | |
const instrumentations = {}; | |
["includes", "indexOf", "lastIndexOf"].forEach((key) => { | |
instrumentations[key] = function(...args) { | |
const arr = toRaw(this); | |
for (let i = 0, l = this.length; i < l; i++) { | |
track(arr, "get", i + ""); | |
} | |
const res = arr[key](...args); | |
if (res === -1 || res === false) { | |
return arr[key](...args.map(toRaw)); | |
} else { | |
return res; | |
} | |
}; | |
}); | |
["push", "pop", "shift", "unshift", "splice"].forEach((key) => { | |
instrumentations[key] = function(...args) { | |
pauseTracking(); | |
pauseScheduling(); | |
const res = toRaw(this)[key].apply(this, args); | |
resetScheduling(); | |
resetTracking(); | |
return res; | |
}; | |
}); | |
return instrumentations; | |
} | |
function hasOwnProperty(key) { | |
if (!shared.isSymbol(key)) key = String(key); | |
const obj = toRaw(this); | |
track(obj, "has", key); | |
return obj.hasOwnProperty(key); | |
} | |
class BaseReactiveHandler { | |
constructor(_isReadonly = false, _isShallow = false) { | |
this._isReadonly = _isReadonly; | |
this._isShallow = _isShallow; | |
} | |
get(target, key, receiver) { | |
const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow; | |
if (key === "__v_isReactive") { | |
return !isReadonly2; | |
} else if (key === "__v_isReadonly") { | |
return isReadonly2; | |
} else if (key === "__v_isShallow") { | |
return isShallow2; | |
} else if (key === "__v_raw") { | |
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype | |
// this means the reciever is a user proxy of the reactive proxy | |
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) { | |
return target; | |
} | |
return; | |
} | |
const targetIsArray = shared.isArray(target); | |
if (!isReadonly2) { | |
if (targetIsArray && shared.hasOwn(arrayInstrumentations, key)) { | |
return Reflect.get(arrayInstrumentations, key, receiver); | |
} | |
if (key === "hasOwnProperty") { | |
return hasOwnProperty; | |
} | |
} | |
const res = Reflect.get(target, key, receiver); | |
if (shared.isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { | |
return res; | |
} | |
if (!isReadonly2) { | |
track(target, "get", key); | |
} | |
if (isShallow2) { | |
return res; | |
} | |
if (isRef(res)) { | |
return targetIsArray && shared.isIntegerKey(key) ? res : res.value; | |
} | |
if (shared.isObject(res)) { | |
return isReadonly2 ? readonly(res) : reactive(res); | |
} | |
return res; | |
} | |
} | |
class MutableReactiveHandler extends BaseReactiveHandler { | |
constructor(isShallow2 = false) { | |
super(false, isShallow2); | |
} | |
set(target, key, value, receiver) { | |
let oldValue = target[key]; | |
if (!this._isShallow) { | |
const isOldValueReadonly = isReadonly(oldValue); | |
if (!isShallow(value) && !isReadonly(value)) { | |
oldValue = toRaw(oldValue); | |
value = toRaw(value); | |
} | |
if (!shared.isArray(target) && isRef(oldValue) && !isRef(value)) { | |
if (isOldValueReadonly) { | |
return false; | |
} else { | |
oldValue.value = value; | |
return true; | |
} | |
} | |
} | |
const hadKey = shared.isArray(target) && shared.isIntegerKey(key) ? Number(key) < target.length : shared.hasOwn(target, key); | |
const result = Reflect.set(target, key, value, receiver); | |
if (target === toRaw(receiver)) { | |
if (!hadKey) { | |
trigger(target, "add", key, value); | |
} else if (shared.hasChanged(value, oldValue)) { | |
trigger(target, "set", key, value); | |
} | |
} | |
return result; | |
} | |
deleteProperty(target, key) { | |
const hadKey = shared.hasOwn(target, key); | |
target[key]; | |
const result = Reflect.deleteProperty(target, key); | |
if (result && hadKey) { | |
trigger(target, "delete", key, void 0); | |
} | |
return result; | |
} | |
has(target, key) { | |
const result = Reflect.has(target, key); | |
if (!shared.isSymbol(key) || !builtInSymbols.has(key)) { | |
track(target, "has", key); | |
} | |
return result; | |
} | |
ownKeys(target) { | |
track( | |
target, | |
"iterate", | |
shared.isArray(target) ? "length" : ITERATE_KEY | |
); | |
return Reflect.ownKeys(target); | |
} | |
} | |
class ReadonlyReactiveHandler extends BaseReactiveHandler { | |
constructor(isShallow2 = false) { | |
super(true, isShallow2); | |
} | |
set(target, key) { | |
return true; | |
} | |
deleteProperty(target, key) { | |
return true; | |
} | |
} | |
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler(); | |
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(); | |
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler( | |
true | |
); | |
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true); | |
const toShallow = (value) => value; | |
const getProto = (v) => Reflect.getPrototypeOf(v); | |
function get(target, key, isReadonly2 = false, isShallow2 = false) { | |
target = target["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const rawKey = toRaw(key); | |
if (!isReadonly2) { | |
if (shared.hasChanged(key, rawKey)) { | |
track(rawTarget, "get", key); | |
} | |
track(rawTarget, "get", rawKey); | |
} | |
const { has: has2 } = getProto(rawTarget); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
if (has2.call(rawTarget, key)) { | |
return wrap(target.get(key)); | |
} else if (has2.call(rawTarget, rawKey)) { | |
return wrap(target.get(rawKey)); | |
} else if (target !== rawTarget) { | |
target.get(key); | |
} | |
} | |
function has(key, isReadonly2 = false) { | |
const target = this["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const rawKey = toRaw(key); | |
if (!isReadonly2) { | |
if (shared.hasChanged(key, rawKey)) { | |
track(rawTarget, "has", key); | |
} | |
track(rawTarget, "has", rawKey); | |
} | |
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); | |
} | |
function size(target, isReadonly2 = false) { | |
target = target["__v_raw"]; | |
!isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY); | |
return Reflect.get(target, "size", target); | |
} | |
function add(value, _isShallow = false) { | |
if (!_isShallow && !isShallow(value) && !isReadonly(value)) { | |
value = toRaw(value); | |
} | |
const target = toRaw(this); | |
const proto = getProto(target); | |
const hadKey = proto.has.call(target, value); | |
if (!hadKey) { | |
target.add(value); | |
trigger(target, "add", value, value); | |
} | |
return this; | |
} | |
function set(key, value, _isShallow = false) { | |
if (!_isShallow && !isShallow(value) && !isReadonly(value)) { | |
value = toRaw(value); | |
} | |
const target = toRaw(this); | |
const { has: has2, get: get2 } = getProto(target); | |
let hadKey = has2.call(target, key); | |
if (!hadKey) { | |
key = toRaw(key); | |
hadKey = has2.call(target, key); | |
} | |
const oldValue = get2.call(target, key); | |
target.set(key, value); | |
if (!hadKey) { | |
trigger(target, "add", key, value); | |
} else if (shared.hasChanged(value, oldValue)) { | |
trigger(target, "set", key, value); | |
} | |
return this; | |
} | |
function deleteEntry(key) { | |
const target = toRaw(this); | |
const { has: has2, get: get2 } = getProto(target); | |
let hadKey = has2.call(target, key); | |
if (!hadKey) { | |
key = toRaw(key); | |
hadKey = has2.call(target, key); | |
} | |
get2 ? get2.call(target, key) : void 0; | |
const result = target.delete(key); | |
if (hadKey) { | |
trigger(target, "delete", key, void 0); | |
} | |
return result; | |
} | |
function clear() { | |
const target = toRaw(this); | |
const hadItems = target.size !== 0; | |
const result = target.clear(); | |
if (hadItems) { | |
trigger(target, "clear", void 0, void 0); | |
} | |
return result; | |
} | |
function createForEach(isReadonly2, isShallow2) { | |
return function forEach(callback, thisArg) { | |
const observed = this; | |
const target = observed["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
!isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY); | |
return target.forEach((value, key) => { | |
return callback.call(thisArg, wrap(value), wrap(key), observed); | |
}); | |
}; | |
} | |
function createIterableMethod(method, isReadonly2, isShallow2) { | |
return function(...args) { | |
const target = this["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const targetIsMap = shared.isMap(rawTarget); | |
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; | |
const isKeyOnly = method === "keys" && targetIsMap; | |
const innerIterator = target[method](...args); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
!isReadonly2 && track( | |
rawTarget, | |
"iterate", | |
isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY | |
); | |
return { | |
// iterator protocol | |
next() { | |
const { value, done } = innerIterator.next(); | |
return done ? { value, done } : { | |
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), | |
done | |
}; | |
}, | |
// iterable protocol | |
[Symbol.iterator]() { | |
return this; | |
} | |
}; | |
}; | |
} | |
function createReadonlyMethod(type) { | |
return function(...args) { | |
return type === "delete" ? false : type === "clear" ? void 0 : this; | |
}; | |
} | |
function createInstrumentations() { | |
const mutableInstrumentations2 = { | |
get(key) { | |
return get(this, key); | |
}, | |
get size() { | |
return size(this); | |
}, | |
has, | |
add, | |
set, | |
delete: deleteEntry, | |
clear, | |
forEach: createForEach(false, false) | |
}; | |
const shallowInstrumentations2 = { | |
get(key) { | |
return get(this, key, false, true); | |
}, | |
get size() { | |
return size(this); | |
}, | |
has, | |
add(value) { | |
return add.call(this, value, true); | |
}, | |
set(key, value) { | |
return set.call(this, key, value, true); | |
}, | |
delete: deleteEntry, | |
clear, | |
forEach: createForEach(false, true) | |
}; | |
const readonlyInstrumentations2 = { | |
get(key) { | |
return get(this, key, true); | |
}, | |
get size() { | |
return size(this, true); | |
}, | |
has(key) { | |
return has.call(this, key, true); | |
}, | |
add: createReadonlyMethod("add"), | |
set: createReadonlyMethod("set"), | |
delete: createReadonlyMethod("delete"), | |
clear: createReadonlyMethod("clear"), | |
forEach: createForEach(true, false) | |
}; | |
const shallowReadonlyInstrumentations2 = { | |
get(key) { | |
return get(this, key, true, true); | |
}, | |
get size() { | |
return size(this, true); | |
}, | |
has(key) { | |
return has.call(this, key, true); | |
}, | |
add: createReadonlyMethod("add"), | |
set: createReadonlyMethod("set"), | |
delete: createReadonlyMethod("delete"), | |
clear: createReadonlyMethod("clear"), | |
forEach: createForEach(true, true) | |
}; | |
const iteratorMethods = [ | |
"keys", | |
"values", | |
"entries", | |
Symbol.iterator | |
]; | |
iteratorMethods.forEach((method) => { | |
mutableInstrumentations2[method] = createIterableMethod(method, false, false); | |
readonlyInstrumentations2[method] = createIterableMethod(method, true, false); | |
shallowInstrumentations2[method] = createIterableMethod(method, false, true); | |
shallowReadonlyInstrumentations2[method] = createIterableMethod( | |
method, | |
true, | |
true | |
); | |
}); | |
return [ | |
mutableInstrumentations2, | |
readonlyInstrumentations2, | |
shallowInstrumentations2, | |
shallowReadonlyInstrumentations2 | |
]; | |
} | |
const [ | |
mutableInstrumentations, | |
readonlyInstrumentations, | |
shallowInstrumentations, | |
shallowReadonlyInstrumentations | |
] = /* @__PURE__ */ createInstrumentations(); | |
function createInstrumentationGetter(isReadonly2, shallow) { | |
const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations; | |
return (target, key, receiver) => { | |
if (key === "__v_isReactive") { | |
return !isReadonly2; | |
} else if (key === "__v_isReadonly") { | |
return isReadonly2; | |
} else if (key === "__v_raw") { | |
return target; | |
} | |
return Reflect.get( | |
shared.hasOwn(instrumentations, key) && key in target ? instrumentations : target, | |
key, | |
receiver | |
); | |
}; | |
} | |
const mutableCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(false, false) | |
}; | |
const shallowCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(false, true) | |
}; | |
const readonlyCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(true, false) | |
}; | |
const shallowReadonlyCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(true, true) | |
}; | |
const reactiveMap = /* @__PURE__ */ new WeakMap(); | |
const shallowReactiveMap = /* @__PURE__ */ new WeakMap(); | |
const readonlyMap = /* @__PURE__ */ new WeakMap(); | |
const shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); | |
function targetTypeMap(rawType) { | |
switch (rawType) { | |
case "Object": | |
case "Array": | |
return 1 /* COMMON */; | |
case "Map": | |
case "Set": | |
case "WeakMap": | |
case "WeakSet": | |
return 2 /* COLLECTION */; | |
default: | |
return 0 /* INVALID */; | |
} | |
} | |
function getTargetType(value) { | |
return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(shared.toRawType(value)); | |
} | |
function reactive(target) { | |
if (isReadonly(target)) { | |
return target; | |
} | |
return createReactiveObject( | |
target, | |
false, | |
mutableHandlers, | |
mutableCollectionHandlers, | |
reactiveMap | |
); | |
} | |
function shallowReactive(target) { | |
return createReactiveObject( | |
target, | |
false, | |
shallowReactiveHandlers, | |
shallowCollectionHandlers, | |
shallowReactiveMap | |
); | |
} | |
function readonly(target) { | |
return createReactiveObject( | |
target, | |
true, | |
readonlyHandlers, | |
readonlyCollectionHandlers, | |
readonlyMap | |
); | |
} | |
function shallowReadonly(target) { | |
return createReactiveObject( | |
target, | |
true, | |
shallowReadonlyHandlers, | |
shallowReadonlyCollectionHandlers, | |
shallowReadonlyMap | |
); | |
} | |
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { | |
if (!shared.isObject(target)) { | |
return target; | |
} | |
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { | |
return target; | |
} | |
const existingProxy = proxyMap.get(target); | |
if (existingProxy) { | |
return existingProxy; | |
} | |
const targetType = getTargetType(target); | |
if (targetType === 0 /* INVALID */) { | |
return target; | |
} | |
const proxy = new Proxy( | |
target, | |
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers | |
); | |
proxyMap.set(target, proxy); | |
return proxy; | |
} | |
function isReactive(value) { | |
if (isReadonly(value)) { | |
return isReactive(value["__v_raw"]); | |
} | |
return !!(value && value["__v_isReactive"]); | |
} | |
function isReadonly(value) { | |
return !!(value && value["__v_isReadonly"]); | |
} | |
function isShallow(value) { | |
return !!(value && value["__v_isShallow"]); | |
} | |
function isProxy(value) { | |
return value ? !!value["__v_raw"] : false; | |
} | |
function toRaw(observed) { | |
const raw = observed && observed["__v_raw"]; | |
return raw ? toRaw(raw) : observed; | |
} | |
function markRaw(value) { | |
if (Object.isExtensible(value)) { | |
shared.def(value, "__v_skip", true); | |
} | |
return value; | |
} | |
const toReactive = (value) => shared.isObject(value) ? reactive(value) : value; | |
const toReadonly = (value) => shared.isObject(value) ? readonly(value) : value; | |
class ComputedRefImpl { | |
constructor(getter, _setter, isReadonly, isSSR) { | |
this.getter = getter; | |
this._setter = _setter; | |
this.dep = void 0; | |
this.__v_isRef = true; | |
this["__v_isReadonly"] = false; | |
this.effect = new ReactiveEffect( | |
() => getter(this._value), | |
() => triggerRefValue( | |
this, | |
this.effect._dirtyLevel === 2 ? 2 : 3 | |
) | |
); | |
this.effect.computed = this; | |
this.effect.active = this._cacheable = !isSSR; | |
this["__v_isReadonly"] = isReadonly; | |
} | |
get value() { | |
const self = toRaw(this); | |
if ((!self._cacheable || self.effect.dirty) && shared.hasChanged(self._value, self._value = self.effect.run())) { | |
triggerRefValue(self, 4); | |
} | |
trackRefValue(self); | |
if (self.effect._dirtyLevel >= 2) { | |
triggerRefValue(self, 2); | |
} | |
return self._value; | |
} | |
set value(newValue) { | |
this._setter(newValue); | |
} | |
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x | |
get _dirty() { | |
return this.effect.dirty; | |
} | |
set _dirty(v) { | |
this.effect.dirty = v; | |
} | |
// #endregion | |
} | |
function computed(getterOrOptions, debugOptions, isSSR = false) { | |
let getter; | |
let setter; | |
const onlyGetter = shared.isFunction(getterOrOptions); | |
if (onlyGetter) { | |
getter = getterOrOptions; | |
setter = shared.NOOP; | |
} else { | |
getter = getterOrOptions.get; | |
setter = getterOrOptions.set; | |
} | |
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR); | |
return cRef; | |
} | |
function trackRefValue(ref2) { | |
var _a; | |
if (shouldTrack && activeEffect) { | |
ref2 = toRaw(ref2); | |
trackEffect( | |
activeEffect, | |
(_a = ref2.dep) != null ? _a : ref2.dep = createDep( | |
() => ref2.dep = void 0, | |
ref2 instanceof ComputedRefImpl ? ref2 : void 0 | |
)); | |
} | |
} | |
function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) { | |
ref2 = toRaw(ref2); | |
const dep = ref2.dep; | |
if (dep) { | |
triggerEffects( | |
dep, | |
dirtyLevel); | |
} | |
} | |
function isRef(r) { | |
return !!(r && r.__v_isRef === true); | |
} | |
function ref(value) { | |
return createRef(value, false); | |
} | |
function shallowRef(value) { | |
return createRef(value, true); | |
} | |
function createRef(rawValue, shallow) { | |
if (isRef(rawValue)) { | |
return rawValue; | |
} | |
return new RefImpl(rawValue, shallow); | |
} | |
class RefImpl { | |
constructor(value, __v_isShallow) { | |
this.__v_isShallow = __v_isShallow; | |
this.dep = void 0; | |
this.__v_isRef = true; | |
this._rawValue = __v_isShallow ? value : toRaw(value); | |
this._value = __v_isShallow ? value : toReactive(value); | |
} | |
get value() { | |
trackRefValue(this); | |
return this._value; | |
} | |
set value(newVal) { | |
const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal); | |
newVal = useDirectValue ? newVal : toRaw(newVal); | |
if (shared.hasChanged(newVal, this._rawValue)) { | |
this._rawValue; | |
this._rawValue = newVal; | |
this._value = useDirectValue ? newVal : toReactive(newVal); | |
triggerRefValue(this, 4); | |
} | |
} | |
} | |
function triggerRef(ref2) { | |
triggerRefValue(ref2, 4); | |
} | |
function unref(ref2) { | |
return isRef(ref2) ? ref2.value : ref2; | |
} | |
function toValue(source) { | |
return shared.isFunction(source) ? source() : unref(source); | |
} | |
const shallowUnwrapHandlers = { | |
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)), | |
set: (target, key, value, receiver) => { | |
const oldValue = target[key]; | |
if (isRef(oldValue) && !isRef(value)) { | |
oldValue.value = value; | |
return true; | |
} else { | |
return Reflect.set(target, key, value, receiver); | |
} | |
} | |
}; | |
function proxyRefs(objectWithRefs) { | |
return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers); | |
} | |
class CustomRefImpl { | |
constructor(factory) { | |
this.dep = void 0; | |
this.__v_isRef = true; | |
const { get, set } = factory( | |
() => trackRefValue(this), | |
() => triggerRefValue(this) | |
); | |
this._get = get; | |
this._set = set; | |
} | |
get value() { | |
return this._get(); | |
} | |
set value(newVal) { | |
this._set(newVal); | |
} | |
} | |
function customRef(factory) { | |
return new CustomRefImpl(factory); | |
} | |
function toRefs(object) { | |
const ret = shared.isArray(object) ? new Array(object.length) : {}; | |
for (const key in object) { | |
ret[key] = propertyToRef(object, key); | |
} | |
return ret; | |
} | |
class ObjectRefImpl { | |
constructor(_object, _key, _defaultValue) { | |
this._object = _object; | |
this._key = _key; | |
this._defaultValue = _defaultValue; | |
this.__v_isRef = true; | |
} | |
get value() { | |
const val = this._object[this._key]; | |
return val === void 0 ? this._defaultValue : val; | |
} | |
set value(newVal) { | |
this._object[this._key] = newVal; | |
} | |
get dep() { | |
return getDepFromReactive(toRaw(this._object), this._key); | |
} | |
} | |
class GetterRefImpl { | |
constructor(_getter) { | |
this._getter = _getter; | |
this.__v_isRef = true; | |
this.__v_isReadonly = true; | |
} | |
get value() { | |
return this._getter(); | |
} | |
} | |
function toRef(source, key, defaultValue) { | |
if (isRef(source)) { | |
return source; | |
} else if (shared.isFunction(source)) { | |
return new GetterRefImpl(source); | |
} else if (shared.isObject(source) && arguments.length > 1) { | |
return propertyToRef(source, key, defaultValue); | |
} else { | |
return ref(source); | |
} | |
} | |
function propertyToRef(source, key, defaultValue) { | |
const val = source[key]; | |
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue); | |
} | |
const deferredComputed = computed; | |
const TrackOpTypes = { | |
"GET": "get", | |
"HAS": "has", | |
"ITERATE": "iterate" | |
}; | |
const TriggerOpTypes = { | |
"SET": "set", | |
"ADD": "add", | |
"DELETE": "delete", | |
"CLEAR": "clear" | |
}; | |
const ReactiveFlags = { | |
"SKIP": "__v_skip", | |
"IS_REACTIVE": "__v_isReactive", | |
"IS_READONLY": "__v_isReadonly", | |
"IS_SHALLOW": "__v_isShallow", | |
"RAW": "__v_raw" | |
}; | |
exports.EffectScope = EffectScope; | |
exports.ITERATE_KEY = ITERATE_KEY; | |
exports.ReactiveEffect = ReactiveEffect; | |
exports.ReactiveFlags = ReactiveFlags; | |
exports.TrackOpTypes = TrackOpTypes; | |
exports.TriggerOpTypes = TriggerOpTypes; | |
exports.computed = computed; | |
exports.customRef = customRef; | |
exports.deferredComputed = deferredComputed; | |
exports.effect = effect; | |
exports.effectScope = effectScope; | |
exports.enableTracking = enableTracking; | |
exports.getCurrentScope = getCurrentScope; | |
exports.isProxy = isProxy; | |
exports.isReactive = isReactive; | |
exports.isReadonly = isReadonly; | |
exports.isRef = isRef; | |
exports.isShallow = isShallow; | |
exports.markRaw = markRaw; | |
exports.onScopeDispose = onScopeDispose; | |
exports.pauseScheduling = pauseScheduling; | |
exports.pauseTracking = pauseTracking; | |
exports.proxyRefs = proxyRefs; | |
exports.reactive = reactive; | |
exports.readonly = readonly; | |
exports.ref = ref; | |
exports.resetScheduling = resetScheduling; | |
exports.resetTracking = resetTracking; | |
exports.shallowReactive = shallowReactive; | |
exports.shallowReadonly = shallowReadonly; | |
exports.shallowRef = shallowRef; | |
exports.stop = stop; | |
exports.toRaw = toRaw; | |
exports.toRef = toRef; | |
exports.toRefs = toRefs; | |
exports.toValue = toValue; | |
exports.track = track; | |
exports.trigger = trigger; | |
exports.triggerRef = triggerRef; | |
exports.unref = unref; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js === | |
/** | |
* @vue/reactivity v3.4.35 | |
* (c) 2018-present Yuxi (Evan) You and Vue contributors | |
* @license MIT | |
**/ | |
import { NOOP, extend, isArray, isSymbol, isMap, isIntegerKey, hasOwn, hasChanged, isObject, makeMap, capitalize, toRawType, def, isFunction } from '@vue/shared'; | |
function warn(msg, ...args) { | |
console.warn(`[Vue warn] ${msg}`, ...args); | |
} | |
let activeEffectScope; | |
class EffectScope { | |
constructor(detached = false) { | |
this.detached = detached; | |
/** | |
* @internal | |
*/ | |
this._active = true; | |
/** | |
* @internal | |
*/ | |
this.effects = []; | |
/** | |
* @internal | |
*/ | |
this.cleanups = []; | |
this.parent = activeEffectScope; | |
if (!detached && activeEffectScope) { | |
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( | |
this | |
) - 1; | |
} | |
} | |
get active() { | |
return this._active; | |
} | |
run(fn) { | |
if (this._active) { | |
const currentEffectScope = activeEffectScope; | |
try { | |
activeEffectScope = this; | |
return fn(); | |
} finally { | |
activeEffectScope = currentEffectScope; | |
} | |
} else if (!!(process.env.NODE_ENV !== "production")) { | |
warn(`cannot run an inactive effect scope.`); | |
} | |
} | |
/** | |
* This should only be called on non-detached scopes | |
* @internal | |
*/ | |
on() { | |
activeEffectScope = this; | |
} | |
/** | |
* This should only be called on non-detached scopes | |
* @internal | |
*/ | |
off() { | |
activeEffectScope = this.parent; | |
} | |
stop(fromParent) { | |
if (this._active) { | |
let i, l; | |
for (i = 0, l = this.effects.length; i < l; i++) { | |
this.effects[i].stop(); | |
} | |
for (i = 0, l = this.cleanups.length; i < l; i++) { | |
this.cleanups[i](); | |
} | |
if (this.scopes) { | |
for (i = 0, l = this.scopes.length; i < l; i++) { | |
this.scopes[i].stop(true); | |
} | |
} | |
if (!this.detached && this.parent && !fromParent) { | |
const last = this.parent.scopes.pop(); | |
if (last && last !== this) { | |
this.parent.scopes[this.index] = last; | |
last.index = this.index; | |
} | |
} | |
this.parent = void 0; | |
this._active = false; | |
} | |
} | |
} | |
function effectScope(detached) { | |
return new EffectScope(detached); | |
} | |
function recordEffectScope(effect, scope = activeEffectScope) { | |
if (scope && scope.active) { | |
scope.effects.push(effect); | |
} | |
} | |
function getCurrentScope() { | |
return activeEffectScope; | |
} | |
function onScopeDispose(fn) { | |
if (activeEffectScope) { | |
activeEffectScope.cleanups.push(fn); | |
} else if (!!(process.env.NODE_ENV !== "production")) { | |
warn( | |
`onScopeDispose() is called when there is no active effect scope to be associated with.` | |
); | |
} | |
} | |
let activeEffect; | |
class ReactiveEffect { | |
constructor(fn, trigger, scheduler, scope) { | |
this.fn = fn; | |
this.trigger = trigger; | |
this.scheduler = scheduler; | |
this.active = true; | |
this.deps = []; | |
/** | |
* @internal | |
*/ | |
this._dirtyLevel = 4; | |
/** | |
* @internal | |
*/ | |
this._trackId = 0; | |
/** | |
* @internal | |
*/ | |
this._runnings = 0; | |
/** | |
* @internal | |
*/ | |
this._shouldSchedule = false; | |
/** | |
* @internal | |
*/ | |
this._depsLength = 0; | |
recordEffectScope(this, scope); | |
} | |
get dirty() { | |
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) { | |
this._dirtyLevel = 1; | |
pauseTracking(); | |
for (let i = 0; i < this._depsLength; i++) { | |
const dep = this.deps[i]; | |
if (dep.computed) { | |
triggerComputed(dep.computed); | |
if (this._dirtyLevel >= 4) { | |
break; | |
} | |
} | |
} | |
if (this._dirtyLevel === 1) { | |
this._dirtyLevel = 0; | |
} | |
resetTracking(); | |
} | |
return this._dirtyLevel >= 4; | |
} | |
set dirty(v) { | |
this._dirtyLevel = v ? 4 : 0; | |
} | |
run() { | |
this._dirtyLevel = 0; | |
if (!this.active) { | |
return this.fn(); | |
} | |
let lastShouldTrack = shouldTrack; | |
let lastEffect = activeEffect; | |
try { | |
shouldTrack = true; | |
activeEffect = this; | |
this._runnings++; | |
preCleanupEffect(this); | |
return this.fn(); | |
} finally { | |
postCleanupEffect(this); | |
this._runnings--; | |
activeEffect = lastEffect; | |
shouldTrack = lastShouldTrack; | |
} | |
} | |
stop() { | |
if (this.active) { | |
preCleanupEffect(this); | |
postCleanupEffect(this); | |
this.onStop && this.onStop(); | |
this.active = false; | |
} | |
} | |
} | |
function triggerComputed(computed) { | |
return computed.value; | |
} | |
function preCleanupEffect(effect2) { | |
effect2._trackId++; | |
effect2._depsLength = 0; | |
} | |
function postCleanupEffect(effect2) { | |
if (effect2.deps.length > effect2._depsLength) { | |
for (let i = effect2._depsLength; i < effect2.deps.length; i++) { | |
cleanupDepEffect(effect2.deps[i], effect2); | |
} | |
effect2.deps.length = effect2._depsLength; | |
} | |
} | |
function cleanupDepEffect(dep, effect2) { | |
const trackId = dep.get(effect2); | |
if (trackId !== void 0 && effect2._trackId !== trackId) { | |
dep.delete(effect2); | |
if (dep.size === 0) { | |
dep.cleanup(); | |
} | |
} | |
} | |
function effect(fn, options) { | |
if (fn.effect instanceof ReactiveEffect) { | |
fn = fn.effect.fn; | |
} | |
const _effect = new ReactiveEffect(fn, NOOP, () => { | |
if (_effect.dirty) { | |
_effect.run(); | |
} | |
}); | |
if (options) { | |
extend(_effect, options); | |
if (options.scope) recordEffectScope(_effect, options.scope); | |
} | |
if (!options || !options.lazy) { | |
_effect.run(); | |
} | |
const runner = _effect.run.bind(_effect); | |
runner.effect = _effect; | |
return runner; | |
} | |
function stop(runner) { | |
runner.effect.stop(); | |
} | |
let shouldTrack = true; | |
let pauseScheduleStack = 0; | |
const trackStack = []; | |
function pauseTracking() { | |
trackStack.push(shouldTrack); | |
shouldTrack = false; | |
} | |
function enableTracking() { | |
trackStack.push(shouldTrack); | |
shouldTrack = true; | |
} | |
function resetTracking() { | |
const last = trackStack.pop(); | |
shouldTrack = last === void 0 ? true : last; | |
} | |
function pauseScheduling() { | |
pauseScheduleStack++; | |
} | |
function resetScheduling() { | |
pauseScheduleStack--; | |
while (!pauseScheduleStack && queueEffectSchedulers.length) { | |
queueEffectSchedulers.shift()(); | |
} | |
} | |
function trackEffect(effect2, dep, debuggerEventExtraInfo) { | |
var _a; | |
if (dep.get(effect2) !== effect2._trackId) { | |
dep.set(effect2, effect2._trackId); | |
const oldDep = effect2.deps[effect2._depsLength]; | |
if (oldDep !== dep) { | |
if (oldDep) { | |
cleanupDepEffect(oldDep, effect2); | |
} | |
effect2.deps[effect2._depsLength++] = dep; | |
} else { | |
effect2._depsLength++; | |
} | |
if (!!(process.env.NODE_ENV !== "production")) { | |
(_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo)); | |
} | |
} | |
} | |
const queueEffectSchedulers = []; | |
function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) { | |
var _a; | |
pauseScheduling(); | |
for (const effect2 of dep.keys()) { | |
let tracking; | |
if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) { | |
effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0); | |
effect2._dirtyLevel = dirtyLevel; | |
} | |
if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) { | |
if (!!(process.env.NODE_ENV !== "production")) { | |
(_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo)); | |
} | |
effect2.trigger(); | |
if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) { | |
effect2._shouldSchedule = false; | |
if (effect2.scheduler) { | |
queueEffectSchedulers.push(effect2.scheduler); | |
} | |
} | |
} | |
} | |
resetScheduling(); | |
} | |
const createDep = (cleanup, computed) => { | |
const dep = /* @__PURE__ */ new Map(); | |
dep.cleanup = cleanup; | |
dep.computed = computed; | |
return dep; | |
}; | |
const targetMap = /* @__PURE__ */ new WeakMap(); | |
const ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "iterate" : ""); | |
const MAP_KEY_ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Map key iterate" : ""); | |
function track(target, type, key) { | |
if (shouldTrack && activeEffect) { | |
let depsMap = targetMap.get(target); | |
if (!depsMap) { | |
targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); | |
} | |
let dep = depsMap.get(key); | |
if (!dep) { | |
depsMap.set(key, dep = createDep(() => depsMap.delete(key))); | |
} | |
trackEffect( | |
activeEffect, | |
dep, | |
!!(process.env.NODE_ENV !== "production") ? { | |
target, | |
type, | |
key | |
} : void 0 | |
); | |
} | |
} | |
function trigger(target, type, key, newValue, oldValue, oldTarget) { | |
const depsMap = targetMap.get(target); | |
if (!depsMap) { | |
return; | |
} | |
let deps = []; | |
if (type === "clear") { | |
deps = [...depsMap.values()]; | |
} else if (key === "length" && isArray(target)) { | |
const newLength = Number(newValue); | |
depsMap.forEach((dep, key2) => { | |
if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) { | |
deps.push(dep); | |
} | |
}); | |
} else { | |
if (key !== void 0) { | |
deps.push(depsMap.get(key)); | |
} | |
switch (type) { | |
case "add": | |
if (!isArray(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
if (isMap(target)) { | |
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); | |
} | |
} else if (isIntegerKey(key)) { | |
deps.push(depsMap.get("length")); | |
} | |
break; | |
case "delete": | |
if (!isArray(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
if (isMap(target)) { | |
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); | |
} | |
} | |
break; | |
case "set": | |
if (isMap(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
} | |
break; | |
} | |
} | |
pauseScheduling(); | |
for (const dep of deps) { | |
if (dep) { | |
triggerEffects( | |
dep, | |
4, | |
!!(process.env.NODE_ENV !== "production") ? { | |
target, | |
type, | |
key, | |
newValue, | |
oldValue, | |
oldTarget | |
} : void 0 | |
); | |
} | |
} | |
resetScheduling(); | |
} | |
function getDepFromReactive(object, key) { | |
const depsMap = targetMap.get(object); | |
return depsMap && depsMap.get(key); | |
} | |
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); | |
const builtInSymbols = new Set( | |
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol) | |
); | |
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations(); | |
function createArrayInstrumentations() { | |
const instrumentations = {}; | |
["includes", "indexOf", "lastIndexOf"].forEach((key) => { | |
instrumentations[key] = function(...args) { | |
const arr = toRaw(this); | |
for (let i = 0, l = this.length; i < l; i++) { | |
track(arr, "get", i + ""); | |
} | |
const res = arr[key](...args); | |
if (res === -1 || res === false) { | |
return arr[key](...args.map(toRaw)); | |
} else { | |
return res; | |
} | |
}; | |
}); | |
["push", "pop", "shift", "unshift", "splice"].forEach((key) => { | |
instrumentations[key] = function(...args) { | |
pauseTracking(); | |
pauseScheduling(); | |
const res = toRaw(this)[key].apply(this, args); | |
resetScheduling(); | |
resetTracking(); | |
return res; | |
}; | |
}); | |
return instrumentations; | |
} | |
function hasOwnProperty(key) { | |
if (!isSymbol(key)) key = String(key); | |
const obj = toRaw(this); | |
track(obj, "has", key); | |
return obj.hasOwnProperty(key); | |
} | |
class BaseReactiveHandler { | |
constructor(_isReadonly = false, _isShallow = false) { | |
this._isReadonly = _isReadonly; | |
this._isShallow = _isShallow; | |
} | |
get(target, key, receiver) { | |
const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow; | |
if (key === "__v_isReactive") { | |
return !isReadonly2; | |
} else if (key === "__v_isReadonly") { | |
return isReadonly2; | |
} else if (key === "__v_isShallow") { | |
return isShallow2; | |
} else if (key === "__v_raw") { | |
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype | |
// this means the reciever is a user proxy of the reactive proxy | |
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) { | |
return target; | |
} | |
return; | |
} | |
const targetIsArray = isArray(target); | |
if (!isReadonly2) { | |
if (targetIsArray && hasOwn(arrayInstrumentations, key)) { | |
return Reflect.get(arrayInstrumentations, key, receiver); | |
} | |
if (key === "hasOwnProperty") { | |
return hasOwnProperty; | |
} | |
} | |
const res = Reflect.get(target, key, receiver); | |
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { | |
return res; | |
} | |
if (!isReadonly2) { | |
track(target, "get", key); | |
} | |
if (isShallow2) { | |
return res; | |
} | |
if (isRef(res)) { | |
return targetIsArray && isIntegerKey(key) ? res : res.value; | |
} | |
if (isObject(res)) { | |
return isReadonly2 ? readonly(res) : reactive(res); | |
} | |
return res; | |
} | |
} | |
class MutableReactiveHandler extends BaseReactiveHandler { | |
constructor(isShallow2 = false) { | |
super(false, isShallow2); | |
} | |
set(target, key, value, receiver) { | |
let oldValue = target[key]; | |
if (!this._isShallow) { | |
const isOldValueReadonly = isReadonly(oldValue); | |
if (!isShallow(value) && !isReadonly(value)) { | |
oldValue = toRaw(oldValue); | |
value = toRaw(value); | |
} | |
if (!isArray(target) && isRef(oldValue) && !isRef(value)) { | |
if (isOldValueReadonly) { | |
return false; | |
} else { | |
oldValue.value = value; | |
return true; | |
} | |
} | |
} | |
const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key); | |
const result = Reflect.set(target, key, value, receiver); | |
if (target === toRaw(receiver)) { | |
if (!hadKey) { | |
trigger(target, "add", key, value); | |
} else if (hasChanged(value, oldValue)) { | |
trigger(target, "set", key, value, oldValue); | |
} | |
} | |
return result; | |
} | |
deleteProperty(target, key) { | |
const hadKey = hasOwn(target, key); | |
const oldValue = target[key]; | |
const result = Reflect.deleteProperty(target, key); | |
if (result && hadKey) { | |
trigger(target, "delete", key, void 0, oldValue); | |
} | |
return result; | |
} | |
has(target, key) { | |
const result = Reflect.has(target, key); | |
if (!isSymbol(key) || !builtInSymbols.has(key)) { | |
track(target, "has", key); | |
} | |
return result; | |
} | |
ownKeys(target) { | |
track( | |
target, | |
"iterate", | |
isArray(target) ? "length" : ITERATE_KEY | |
); | |
return Reflect.ownKeys(target); | |
} | |
} | |
class ReadonlyReactiveHandler extends BaseReactiveHandler { | |
constructor(isShallow2 = false) { | |
super(true, isShallow2); | |
} | |
set(target, key) { | |
if (!!(process.env.NODE_ENV !== "production")) { | |
warn( | |
`Set operation on key "${String(key)}" failed: target is readonly.`, | |
target | |
); | |
} | |
return true; | |
} | |
deleteProperty(target, key) { | |
if (!!(process.env.NODE_ENV !== "production")) { | |
warn( | |
`Delete operation on key "${String(key)}" failed: target is readonly.`, | |
target | |
); | |
} | |
return true; | |
} | |
} | |
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler(); | |
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(); | |
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler( | |
true | |
); | |
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true); | |
const toShallow = (value) => value; | |
const getProto = (v) => Reflect.getPrototypeOf(v); | |
function get(target, key, isReadonly2 = false, isShallow2 = false) { | |
target = target["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const rawKey = toRaw(key); | |
if (!isReadonly2) { | |
if (hasChanged(key, rawKey)) { | |
track(rawTarget, "get", key); | |
} | |
track(rawTarget, "get", rawKey); | |
} | |
const { has: has2 } = getProto(rawTarget); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
if (has2.call(rawTarget, key)) { | |
return wrap(target.get(key)); | |
} else if (has2.call(rawTarget, rawKey)) { | |
return wrap(target.get(rawKey)); | |
} else if (target !== rawTarget) { | |
target.get(key); | |
} | |
} | |
function has(key, isReadonly2 = false) { | |
const target = this["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const rawKey = toRaw(key); | |
if (!isReadonly2) { | |
if (hasChanged(key, rawKey)) { | |
track(rawTarget, "has", key); | |
} | |
track(rawTarget, "has", rawKey); | |
} | |
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); | |
} | |
function size(target, isReadonly2 = false) { | |
target = target["__v_raw"]; | |
!isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY); | |
return Reflect.get(target, "size", target); | |
} | |
function add(value, _isShallow = false) { | |
if (!_isShallow && !isShallow(value) && !isReadonly(value)) { | |
value = toRaw(value); | |
} | |
const target = toRaw(this); | |
const proto = getProto(target); | |
const hadKey = proto.has.call(target, value); | |
if (!hadKey) { | |
target.add(value); | |
trigger(target, "add", value, value); | |
} | |
return this; | |
} | |
function set(key, value, _isShallow = false) { | |
if (!_isShallow && !isShallow(value) && !isReadonly(value)) { | |
value = toRaw(value); | |
} | |
const target = toRaw(this); | |
const { has: has2, get: get2 } = getProto(target); | |
let hadKey = has2.call(target, key); | |
if (!hadKey) { | |
key = toRaw(key); | |
hadKey = has2.call(target, key); | |
} else if (!!(process.env.NODE_ENV !== "production")) { | |
checkIdentityKeys(target, has2, key); | |
} | |
const oldValue = get2.call(target, key); | |
target.set(key, value); | |
if (!hadKey) { | |
trigger(target, "add", key, value); | |
} else if (hasChanged(value, oldValue)) { | |
trigger(target, "set", key, value, oldValue); | |
} | |
return this; | |
} | |
function deleteEntry(key) { | |
const target = toRaw(this); | |
const { has: has2, get: get2 } = getProto(target); | |
let hadKey = has2.call(target, key); | |
if (!hadKey) { | |
key = toRaw(key); | |
hadKey = has2.call(target, key); | |
} else if (!!(process.env.NODE_ENV !== "production")) { | |
checkIdentityKeys(target, has2, key); | |
} | |
const oldValue = get2 ? get2.call(target, key) : void 0; | |
const result = target.delete(key); | |
if (hadKey) { | |
trigger(target, "delete", key, void 0, oldValue); | |
} | |
return result; | |
} | |
function clear() { | |
const target = toRaw(this); | |
const hadItems = target.size !== 0; | |
const oldTarget = !!(process.env.NODE_ENV !== "production") ? isMap(target) ? new Map(target) : new Set(target) : void 0; | |
const result = target.clear(); | |
if (hadItems) { | |
trigger(target, "clear", void 0, void 0, oldTarget); | |
} | |
return result; | |
} | |
function createForEach(isReadonly2, isShallow2) { | |
return function forEach(callback, thisArg) { | |
const observed = this; | |
const target = observed["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
!isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY); | |
return target.forEach((value, key) => { | |
return callback.call(thisArg, wrap(value), wrap(key), observed); | |
}); | |
}; | |
} | |
function createIterableMethod(method, isReadonly2, isShallow2) { | |
return function(...args) { | |
const target = this["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const targetIsMap = isMap(rawTarget); | |
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; | |
const isKeyOnly = method === "keys" && targetIsMap; | |
const innerIterator = target[method](...args); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
!isReadonly2 && track( | |
rawTarget, | |
"iterate", | |
isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY | |
); | |
return { | |
// iterator protocol | |
next() { | |
const { value, done } = innerIterator.next(); | |
return done ? { value, done } : { | |
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), | |
done | |
}; | |
}, | |
// iterable protocol | |
[Symbol.iterator]() { | |
return this; | |
} | |
}; | |
}; | |
} | |
function createReadonlyMethod(type) { | |
return function(...args) { | |
if (!!(process.env.NODE_ENV !== "production")) { | |
const key = args[0] ? `on key "${args[0]}" ` : ``; | |
warn( | |
`${capitalize(type)} operation ${key}failed: target is readonly.`, | |
toRaw(this) | |
); | |
} | |
return type === "delete" ? false : type === "clear" ? void 0 : this; | |
}; | |
} | |
function createInstrumentations() { | |
const mutableInstrumentations2 = { | |
get(key) { | |
return get(this, key); | |
}, | |
get size() { | |
return size(this); | |
}, | |
has, | |
add, | |
set, | |
delete: deleteEntry, | |
clear, | |
forEach: createForEach(false, false) | |
}; | |
const shallowInstrumentations2 = { | |
get(key) { | |
return get(this, key, false, true); | |
}, | |
get size() { | |
return size(this); | |
}, | |
has, | |
add(value) { | |
return add.call(this, value, true); | |
}, | |
set(key, value) { | |
return set.call(this, key, value, true); | |
}, | |
delete: deleteEntry, | |
clear, | |
forEach: createForEach(false, true) | |
}; | |
const readonlyInstrumentations2 = { | |
get(key) { | |
return get(this, key, true); | |
}, | |
get size() { | |
return size(this, true); | |
}, | |
has(key) { | |
return has.call(this, key, true); | |
}, | |
add: createReadonlyMethod("add"), | |
set: createReadonlyMethod("set"), | |
delete: createReadonlyMethod("delete"), | |
clear: createReadonlyMethod("clear"), | |
forEach: createForEach(true, false) | |
}; | |
const shallowReadonlyInstrumentations2 = { | |
get(key) { | |
return get(this, key, true, true); | |
}, | |
get size() { | |
return size(this, true); | |
}, | |
has(key) { | |
return has.call(this, key, true); | |
}, | |
add: createReadonlyMethod("add"), | |
set: createReadonlyMethod("set"), | |
delete: createReadonlyMethod("delete"), | |
clear: createReadonlyMethod("clear"), | |
forEach: createForEach(true, true) | |
}; | |
const iteratorMethods = [ | |
"keys", | |
"values", | |
"entries", | |
Symbol.iterator | |
]; | |
iteratorMethods.forEach((method) => { | |
mutableInstrumentations2[method] = createIterableMethod(method, false, false); | |
readonlyInstrumentations2[method] = createIterableMethod(method, true, false); | |
shallowInstrumentations2[method] = createIterableMethod(method, false, true); | |
shallowReadonlyInstrumentations2[method] = createIterableMethod( | |
method, | |
true, | |
true | |
); | |
}); | |
return [ | |
mutableInstrumentations2, | |
readonlyInstrumentations2, | |
shallowInstrumentations2, | |
shallowReadonlyInstrumentations2 | |
]; | |
} | |
const [ | |
mutableInstrumentations, | |
readonlyInstrumentations, | |
shallowInstrumentations, | |
shallowReadonlyInstrumentations | |
] = /* @__PURE__ */ createInstrumentations(); | |
function createInstrumentationGetter(isReadonly2, shallow) { | |
const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations; | |
return (target, key, receiver) => { | |
if (key === "__v_isReactive") { | |
return !isReadonly2; | |
} else if (key === "__v_isReadonly") { | |
return isReadonly2; | |
} else if (key === "__v_raw") { | |
return target; | |
} | |
return Reflect.get( | |
hasOwn(instrumentations, key) && key in target ? instrumentations : target, | |
key, | |
receiver | |
); | |
}; | |
} | |
const mutableCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(false, false) | |
}; | |
const shallowCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(false, true) | |
}; | |
const readonlyCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(true, false) | |
}; | |
const shallowReadonlyCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(true, true) | |
}; | |
function checkIdentityKeys(target, has2, key) { | |
const rawKey = toRaw(key); | |
if (rawKey !== key && has2.call(target, rawKey)) { | |
const type = toRawType(target); | |
warn( | |
`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.` | |
); | |
} | |
} | |
const reactiveMap = /* @__PURE__ */ new WeakMap(); | |
const shallowReactiveMap = /* @__PURE__ */ new WeakMap(); | |
const readonlyMap = /* @__PURE__ */ new WeakMap(); | |
const shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); | |
function targetTypeMap(rawType) { | |
switch (rawType) { | |
case "Object": | |
case "Array": | |
return 1 /* COMMON */; | |
case "Map": | |
case "Set": | |
case "WeakMap": | |
case "WeakSet": | |
return 2 /* COLLECTION */; | |
default: | |
return 0 /* INVALID */; | |
} | |
} | |
function getTargetType(value) { | |
return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value)); | |
} | |
function reactive(target) { | |
if (isReadonly(target)) { | |
return target; | |
} | |
return createReactiveObject( | |
target, | |
false, | |
mutableHandlers, | |
mutableCollectionHandlers, | |
reactiveMap | |
); | |
} | |
function shallowReactive(target) { | |
return createReactiveObject( | |
target, | |
false, | |
shallowReactiveHandlers, | |
shallowCollectionHandlers, | |
shallowReactiveMap | |
); | |
} | |
function readonly(target) { | |
return createReactiveObject( | |
target, | |
true, | |
readonlyHandlers, | |
readonlyCollectionHandlers, | |
readonlyMap | |
); | |
} | |
function shallowReadonly(target) { | |
return createReactiveObject( | |
target, | |
true, | |
shallowReadonlyHandlers, | |
shallowReadonlyCollectionHandlers, | |
shallowReadonlyMap | |
); | |
} | |
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { | |
if (!isObject(target)) { | |
if (!!(process.env.NODE_ENV !== "production")) { | |
warn( | |
`value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String( | |
target | |
)}` | |
); | |
} | |
return target; | |
} | |
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { | |
return target; | |
} | |
const existingProxy = proxyMap.get(target); | |
if (existingProxy) { | |
return existingProxy; | |
} | |
const targetType = getTargetType(target); | |
if (targetType === 0 /* INVALID */) { | |
return target; | |
} | |
const proxy = new Proxy( | |
target, | |
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers | |
); | |
proxyMap.set(target, proxy); | |
return proxy; | |
} | |
function isReactive(value) { | |
if (isReadonly(value)) { | |
return isReactive(value["__v_raw"]); | |
} | |
return !!(value && value["__v_isReactive"]); | |
} | |
function isReadonly(value) { | |
return !!(value && value["__v_isReadonly"]); | |
} | |
function isShallow(value) { | |
return !!(value && value["__v_isShallow"]); | |
} | |
function isProxy(value) { | |
return value ? !!value["__v_raw"] : false; | |
} | |
function toRaw(observed) { | |
const raw = observed && observed["__v_raw"]; | |
return raw ? toRaw(raw) : observed; | |
} | |
function markRaw(value) { | |
if (Object.isExtensible(value)) { | |
def(value, "__v_skip", true); | |
} | |
return value; | |
} | |
const toReactive = (value) => isObject(value) ? reactive(value) : value; | |
const toReadonly = (value) => isObject(value) ? readonly(value) : value; | |
const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`; | |
class ComputedRefImpl { | |
constructor(getter, _setter, isReadonly, isSSR) { | |
this.getter = getter; | |
this._setter = _setter; | |
this.dep = void 0; | |
this.__v_isRef = true; | |
this["__v_isReadonly"] = false; | |
this.effect = new ReactiveEffect( | |
() => getter(this._value), | |
() => triggerRefValue( | |
this, | |
this.effect._dirtyLevel === 2 ? 2 : 3 | |
) | |
); | |
this.effect.computed = this; | |
this.effect.active = this._cacheable = !isSSR; | |
this["__v_isReadonly"] = isReadonly; | |
} | |
get value() { | |
const self = toRaw(this); | |
if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) { | |
triggerRefValue(self, 4); | |
} | |
trackRefValue(self); | |
if (self.effect._dirtyLevel >= 2) { | |
if (!!(process.env.NODE_ENV !== "production") && this._warnRecursive) { | |
warn(COMPUTED_SIDE_EFFECT_WARN, ` | |
getter: `, this.getter); | |
} | |
triggerRefValue(self, 2); | |
} | |
return self._value; | |
} | |
set value(newValue) { | |
this._setter(newValue); | |
} | |
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x | |
get _dirty() { | |
return this.effect.dirty; | |
} | |
set _dirty(v) { | |
this.effect.dirty = v; | |
} | |
// #endregion | |
} | |
function computed(getterOrOptions, debugOptions, isSSR = false) { | |
let getter; | |
let setter; | |
const onlyGetter = isFunction(getterOrOptions); | |
if (onlyGetter) { | |
getter = getterOrOptions; | |
setter = !!(process.env.NODE_ENV !== "production") ? () => { | |
warn("Write operation failed: computed value is readonly"); | |
} : NOOP; | |
} else { | |
getter = getterOrOptions.get; | |
setter = getterOrOptions.set; | |
} | |
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR); | |
if (!!(process.env.NODE_ENV !== "production") && debugOptions && !isSSR) { | |
cRef.effect.onTrack = debugOptions.onTrack; | |
cRef.effect.onTrigger = debugOptions.onTrigger; | |
} | |
return cRef; | |
} | |
function trackRefValue(ref2) { | |
var _a; | |
if (shouldTrack && activeEffect) { | |
ref2 = toRaw(ref2); | |
trackEffect( | |
activeEffect, | |
(_a = ref2.dep) != null ? _a : ref2.dep = createDep( | |
() => ref2.dep = void 0, | |
ref2 instanceof ComputedRefImpl ? ref2 : void 0 | |
), | |
!!(process.env.NODE_ENV !== "production") ? { | |
target: ref2, | |
type: "get", | |
key: "value" | |
} : void 0 | |
); | |
} | |
} | |
function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) { | |
ref2 = toRaw(ref2); | |
const dep = ref2.dep; | |
if (dep) { | |
triggerEffects( | |
dep, | |
dirtyLevel, | |
!!(process.env.NODE_ENV !== "production") ? { | |
target: ref2, | |
type: "set", | |
key: "value", | |
newValue: newVal, | |
oldValue: oldVal | |
} : void 0 | |
); | |
} | |
} | |
function isRef(r) { | |
return !!(r && r.__v_isRef === true); | |
} | |
function ref(value) { | |
return createRef(value, false); | |
} | |
function shallowRef(value) { | |
return createRef(value, true); | |
} | |
function createRef(rawValue, shallow) { | |
if (isRef(rawValue)) { | |
return rawValue; | |
} | |
return new RefImpl(rawValue, shallow); | |
} | |
class RefImpl { | |
constructor(value, __v_isShallow) { | |
this.__v_isShallow = __v_isShallow; | |
this.dep = void 0; | |
this.__v_isRef = true; | |
this._rawValue = __v_isShallow ? value : toRaw(value); | |
this._value = __v_isShallow ? value : toReactive(value); | |
} | |
get value() { | |
trackRefValue(this); | |
return this._value; | |
} | |
set value(newVal) { | |
const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal); | |
newVal = useDirectValue ? newVal : toRaw(newVal); | |
if (hasChanged(newVal, this._rawValue)) { | |
const oldVal = this._rawValue; | |
this._rawValue = newVal; | |
this._value = useDirectValue ? newVal : toReactive(newVal); | |
triggerRefValue(this, 4, newVal, oldVal); | |
} | |
} | |
} | |
function triggerRef(ref2) { | |
triggerRefValue(ref2, 4, !!(process.env.NODE_ENV !== "production") ? ref2.value : void 0); | |
} | |
function unref(ref2) { | |
return isRef(ref2) ? ref2.value : ref2; | |
} | |
function toValue(source) { | |
return isFunction(source) ? source() : unref(source); | |
} | |
const shallowUnwrapHandlers = { | |
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)), | |
set: (target, key, value, receiver) => { | |
const oldValue = target[key]; | |
if (isRef(oldValue) && !isRef(value)) { | |
oldValue.value = value; | |
return true; | |
} else { | |
return Reflect.set(target, key, value, receiver); | |
} | |
} | |
}; | |
function proxyRefs(objectWithRefs) { | |
return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers); | |
} | |
class CustomRefImpl { | |
constructor(factory) { | |
this.dep = void 0; | |
this.__v_isRef = true; | |
const { get, set } = factory( | |
() => trackRefValue(this), | |
() => triggerRefValue(this) | |
); | |
this._get = get; | |
this._set = set; | |
} | |
get value() { | |
return this._get(); | |
} | |
set value(newVal) { | |
this._set(newVal); | |
} | |
} | |
function customRef(factory) { | |
return new CustomRefImpl(factory); | |
} | |
function toRefs(object) { | |
if (!!(process.env.NODE_ENV !== "production") && !isProxy(object)) { | |
warn(`toRefs() expects a reactive object but received a plain one.`); | |
} | |
const ret = isArray(object) ? new Array(object.length) : {}; | |
for (const key in object) { | |
ret[key] = propertyToRef(object, key); | |
} | |
return ret; | |
} | |
class ObjectRefImpl { | |
constructor(_object, _key, _defaultValue) { | |
this._object = _object; | |
this._key = _key; | |
this._defaultValue = _defaultValue; | |
this.__v_isRef = true; | |
} | |
get value() { | |
const val = this._object[this._key]; | |
return val === void 0 ? this._defaultValue : val; | |
} | |
set value(newVal) { | |
this._object[this._key] = newVal; | |
} | |
get dep() { | |
return getDepFromReactive(toRaw(this._object), this._key); | |
} | |
} | |
class GetterRefImpl { | |
constructor(_getter) { | |
this._getter = _getter; | |
this.__v_isRef = true; | |
this.__v_isReadonly = true; | |
} | |
get value() { | |
return this._getter(); | |
} | |
} | |
function toRef(source, key, defaultValue) { | |
if (isRef(source)) { | |
return source; | |
} else if (isFunction(source)) { | |
return new GetterRefImpl(source); | |
} else if (isObject(source) && arguments.length > 1) { | |
return propertyToRef(source, key, defaultValue); | |
} else { | |
return ref(source); | |
} | |
} | |
function propertyToRef(source, key, defaultValue) { | |
const val = source[key]; | |
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue); | |
} | |
const deferredComputed = computed; | |
const TrackOpTypes = { | |
"GET": "get", | |
"HAS": "has", | |
"ITERATE": "iterate" | |
}; | |
const TriggerOpTypes = { | |
"SET": "set", | |
"ADD": "add", | |
"DELETE": "delete", | |
"CLEAR": "clear" | |
}; | |
const ReactiveFlags = { | |
"SKIP": "__v_skip", | |
"IS_REACTIVE": "__v_isReactive", | |
"IS_READONLY": "__v_isReadonly", | |
"IS_SHALLOW": "__v_isShallow", | |
"RAW": "__v_raw" | |
}; | |
export { EffectScope, ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, computed, customRef, deferredComputed, effect, effectScope, enableTracking, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, pauseScheduling, pauseTracking, proxyRefs, reactive, readonly, ref, resetScheduling, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, track, trigger, triggerRef, unref }; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/reactivity/dist/reactivity.global.prod.js === | |
/** | |
* @vue/reactivity v3.4.35 | |
* (c) 2018-present Yuxi (Evan) You and Vue contributors | |
* @license MIT | |
**/var VueReactivity=function(e){"use strict";let t,s;let i=()=>{},r=Object.assign,n=Object.prototype.hasOwnProperty,l=(e,t)=>n.call(e,t),u=Array.isArray,c=e=>"[object Map]"===d(e),a=e=>"function"==typeof e,h=e=>"string"==typeof e,o=e=>"symbol"==typeof e,f=e=>null!==e&&"object"==typeof e,_=Object.prototype.toString,d=e=>_.call(e),p=e=>d(e).slice(8,-1),v=e=>h(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,g=(e,t)=>!Object.is(e,t),y=(e,t,s,i=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:i,value:s})};class w{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=t,!e&&t&&(this.index=(t.scopes||(t.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){let s=t;try{return t=this,e()}finally{t=s}}}on(){t=this}off(){t=this.parent}stop(e){if(this._active){let t,s;for(t=0,s=this.effects.length;t<s;t++)this.effects[t].stop();for(t=0,s=this.cleanups.length;t<s;t++)this.cleanups[t]();if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].stop(!0);if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0,this._active=!1}}}function R(e,s=t){s&&s.active&&s.effects.push(e)}class S{constructor(e,t,s,i){this.fn=e,this.trigger=t,this.scheduler=s,this.active=!0,this.deps=[],this._dirtyLevel=4,this._trackId=0,this._runnings=0,this._shouldSchedule=!1,this._depsLength=0,R(this,i)}get dirty(){if(2===this._dirtyLevel||3===this._dirtyLevel){this._dirtyLevel=1,j();for(let e=0;e<this._depsLength;e++){let t=this.deps[e];if(t.computed&&(t.computed.value,this._dirtyLevel>=4))break}1===this._dirtyLevel&&(this._dirtyLevel=0),x()}return this._dirtyLevel>=4}set dirty(e){this._dirtyLevel=e?4:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let e=E,t=s;try{return E=!0,s=this,this._runnings++,b(this),this.fn()}finally{k(this),this._runnings--,s=t,E=e}}stop(){this.active&&(b(this),k(this),this.onStop&&this.onStop(),this.active=!1)}}function b(e){e._trackId++,e._depsLength=0}function k(e){if(e.deps.length>e._depsLength){for(let t=e._depsLength;t<e.deps.length;t++)L(e.deps[t],e);e.deps.length=e._depsLength}}function L(e,t){let s=e.get(t);void 0!==s&&t._trackId!==s&&(e.delete(t),0===e.size&&e.cleanup())}let E=!0,O=0,m=[];function j(){m.push(E),E=!1}function x(){let e=m.pop();E=void 0===e||e}function I(){O++}function P(){for(O--;!O&&A.length;)A.shift()()}function T(e,t,s){if(t.get(e)!==e._trackId){t.set(e,e._trackId);let s=e.deps[e._depsLength];s!==t?(s&&L(s,e),e.deps[e._depsLength++]=t):e._depsLength++}}let A=[];function M(e,t,s){for(let s of(I(),e.keys())){let i;s._dirtyLevel<t&&(null!=i?i:i=e.get(s)===s._trackId)&&(s._shouldSchedule||(s._shouldSchedule=0===s._dirtyLevel),s._dirtyLevel=t),s._shouldSchedule&&(null!=i?i:i=e.get(s)===s._trackId)&&(s.trigger(),(!s._runnings||s.allowRecurse)&&2!==s._dirtyLevel&&(s._shouldSchedule=!1,s.scheduler&&A.push(s.scheduler)))}P()}let V=(e,t)=>{let s=new Map;return s.cleanup=e,s.computed=t,s},W=new WeakMap,z=Symbol(""),N=Symbol("");function D(e,t,i){if(E&&s){let t=W.get(e);t||W.set(e,t=new Map);let r=t.get(i);r||t.set(i,r=V(()=>t.delete(i))),T(s,r)}}function C(e,t,s,i,r,n){let l=W.get(e);if(!l)return;let a=[];if("clear"===t)a=[...l.values()];else if("length"===s&&u(e)){let e=Number(i);l.forEach((t,s)=>{("length"===s||!o(s)&&s>=e)&&a.push(t)})}else switch(void 0!==s&&a.push(l.get(s)),t){case"add":u(e)?v(s)&&a.push(l.get("length")):(a.push(l.get(z)),c(e)&&a.push(l.get(N)));break;case"delete":!u(e)&&(a.push(l.get(z)),c(e)&&a.push(l.get(N)));break;case"set":c(e)&&a.push(l.get(z))}for(let e of(I(),a))e&&M(e,4);P()}let K=/*! #__NO_SIDE_EFFECTS__ */function(e,t){let s=new Set(e.split(","));return e=>s.has(e)}("__proto__,__v_isRef,__isVue"),H=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(o)),Y=function(){let e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...e){let s=ex(this);for(let e=0,t=this.length;e<t;e++)D(s,"get",e+"");let i=s[t](...e);return -1===i||!1===i?s[t](...e.map(ex)):i}}),["push","pop","shift","unshift","splice"].forEach(t=>{e[t]=function(...e){j(),I();let s=ex(this)[t].apply(this,e);return P(),x(),s}}),e}();function F(e){o(e)||(e=String(e));let t=ex(this);return D(t,"has",e),t.hasOwnProperty(e)}class G{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,s){let i=this._isReadonly,r=this._isShallow;if("__v_isReactive"===t)return!i;if("__v_isReadonly"===t)return i;if("__v_isShallow"===t)return r;if("__v_raw"===t)return s===(i?r?eb:eS:r?eR:ew).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(s)?e:void 0;let n=u(e);if(!i){if(n&&l(Y,t))return Reflect.get(Y,t,s);if("hasOwnProperty"===t)return F}let c=Reflect.get(e,t,s);return(o(t)?H.has(t):K(t))?c:(i||D(e,"get",t),r)?c:eW(c)?n&&v(t)?c:c.value:f(c)?i?eL(c):ek(c):c}}class q extends G{constructor(e=!1){super(!1,e)}set(e,t,s,i){let r=e[t];if(!this._isShallow){let t=em(r);if(ej(s)||em(s)||(r=ex(r),s=ex(s)),!u(e)&&eW(r)&&!eW(s))return!t&&(r.value=s,!0)}let n=u(e)&&v(t)?Number(t)<e.length:l(e,t),c=Reflect.set(e,t,s,i);return e===ex(i)&&(n?g(s,r)&&C(e,"set",t,s):C(e,"add",t,s)),c}deleteProperty(e,t){let s=l(e,t);e[t];let i=Reflect.deleteProperty(e,t);return i&&s&&C(e,"delete",t,void 0),i}has(e,t){let s=Reflect.has(e,t);return o(t)&&H.has(t)||D(e,"has",t),s}ownKeys(e){return D(e,"iterate",u(e)?"length":z),Reflect.ownKeys(e)}}class B extends G{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}let J=new q,Q=new B,U=new q(!0),X=new B(!0),Z=e=>e,$=e=>Reflect.getPrototypeOf(e);function ee(e,t,s=!1,i=!1){let r=ex(e=e.__v_raw),n=ex(t);s||(g(t,n)&&D(r,"get",t),D(r,"get",n));let{has:l}=$(r),u=i?Z:s?eP:eI;return l.call(r,t)?u(e.get(t)):l.call(r,n)?u(e.get(n)):void(e!==r&&e.get(t))}function et(e,t=!1){let s=this.__v_raw,i=ex(s),r=ex(e);return t||(g(e,r)&&D(i,"has",e),D(i,"has",r)),e===r?s.has(e):s.has(e)||s.has(r)}function es(e,t=!1){return e=e.__v_raw,t||D(ex(e),"iterate",z),Reflect.get(e,"size",e)}function ei(e,t=!1){t||ej(e)||em(e)||(e=ex(e));let s=ex(this);return $(s).has.call(s,e)||(s.add(e),C(s,"add",e,e)),this}function er(e,t,s=!1){s||ej(t)||em(t)||(t=ex(t));let i=ex(this),{has:r,get:n}=$(i),l=r.call(i,e);l||(e=ex(e),l=r.call(i,e));let u=n.call(i,e);return i.set(e,t),l?g(t,u)&&C(i,"set",e,t):C(i,"add",e,t),this}function en(e){let t=ex(this),{has:s,get:i}=$(t),r=s.call(t,e);r||(e=ex(e),r=s.call(t,e)),i&&i.call(t,e);let n=t.delete(e);return r&&C(t,"delete",e,void 0),n}function el(){let e=ex(this),t=0!==e.size,s=e.clear();return t&&C(e,"clear",void 0,void 0),s}function eu(e,t){return function(s,i){let r=this,n=r.__v_raw,l=ex(n),u=t?Z:e?eP:eI;return e||D(l,"iterate",z),n.forEach((e,t)=>s.call(i,u(e),u(t),r))}}function ec(e,t,s){return function(...i){let r=this.__v_raw,n=ex(r),l=c(n),u="entries"===e||e===Symbol.iterator&&l,a=r[e](...i),h=s?Z:t?eP:eI;return t||D(n,"iterate","keys"===e&&l?N:z),{next(){let{value:e,done:t}=a.next();return t?{value:e,done:t}:{value:u?[h(e[0]),h(e[1])]:h(e),done:t}},[Symbol.iterator](){return this}}}}function ea(e){return function(...t){return"delete"!==e&&("clear"===e?void 0:this)}}let[eh,eo,ef,e_]=function(){let e={get(e){return ee(this,e)},get size(){return es(this)},has:et,add:ei,set:er,delete:en,clear:el,forEach:eu(!1,!1)},t={get(e){return ee(this,e,!1,!0)},get size(){return es(this)},has:et,add(e){return ei.call(this,e,!0)},set(e,t){return er.call(this,e,t,!0)},delete:en,clear:el,forEach:eu(!1,!0)},s={get(e){return ee(this,e,!0)},get size(){return es(this,!0)},has(e){return et.call(this,e,!0)},add:ea("add"),set:ea("set"),delete:ea("delete"),clear:ea("clear"),forEach:eu(!0,!1)},i={get(e){return ee(this,e,!0,!0)},get size(){return es(this,!0)},has(e){return et.call(this,e,!0)},add:ea("add"),set:ea("set"),delete:ea("delete"),clear:ea("clear"),forEach:eu(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{e[r]=ec(r,!1,!1),s[r]=ec(r,!0,!1),t[r]=ec(r,!1,!0),i[r]=ec(r,!0,!0)}),[e,s,t,i]}();function ed(e,t){let s=t?e?e_:ef:e?eo:eh;return(t,i,r)=>"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(l(s,i)&&i in t?s:t,i,r)}let ep={get:ed(!1,!1)},ev={get:ed(!1,!0)},eg={get:ed(!0,!1)},ey={get:ed(!0,!0)},ew=new WeakMap,eR=new WeakMap,eS=new WeakMap,eb=new WeakMap;function ek(e){return em(e)?e:eE(e,!1,J,ep,ew)}function eL(e){return eE(e,!0,Q,eg,eS)}function eE(e,t,s,i,r){if(!f(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let n=r.get(e);if(n)return n;let l=e.__v_skip||!Object.isExtensible(e)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(p(e));if(0===l)return e;let u=new Proxy(e,2===l?i:s);return r.set(e,u),u}function eO(e){return em(e)?eO(e.__v_raw):!!(e&&e.__v_isReactive)}function em(e){return!!(e&&e.__v_isReadonly)}function ej(e){return!!(e&&e.__v_isShallow)}function ex(e){let t=e&&e.__v_raw;return t?ex(t):e}let eI=e=>f(e)?ek(e):e,eP=e=>f(e)?eL(e):e;class eT{constructor(e,t,s,i){this.getter=e,this._setter=t,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new S(()=>e(this._value),()=>eV(this,2===this.effect._dirtyLevel?2:3)),this.effect.computed=this,this.effect.active=this._cacheable=!i,this.__v_isReadonly=s}get value(){let e=ex(this);return(!e._cacheable||e.effect.dirty)&&g(e._value,e._value=e.effect.run())&&eV(e,4),eM(e),e.effect._dirtyLevel>=2&&eV(e,2),e._value}set value(e){this._setter(e)}get _dirty(){return this.effect.dirty}set _dirty(e){this.effect.dirty=e}}function eA(e,t,s=!1){let r,n;let l=a(e);return l?(r=e,n=i):(r=e.get,n=e.set),new eT(r,n,l||!n,s)}function eM(e){var t;E&&s&&(e=ex(e),T(s,null!=(t=e.dep)?t:e.dep=V(()=>e.dep=void 0,e instanceof eT?e:void 0)))}function eV(e,t=4,s,i){let r=(e=ex(e)).dep;r&&M(r,t)}function eW(e){return!!(e&&!0===e.__v_isRef)}function ez(e){return eN(e,!1)}function eN(e,t){return eW(e)?e:new eD(e,t)}class eD{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:ex(e),this._value=t?e:eI(e)}get value(){return eM(this),this._value}set value(e){let t=this.__v_isShallow||ej(e)||em(e);g(e=t?e:ex(e),this._rawValue)&&(this._rawValue,this._rawValue=e,this._value=t?e:eI(e),eV(this,4))}}function eC(e){return eW(e)?e.value:e}let eK={get:(e,t,s)=>eC(Reflect.get(e,t,s)),set:(e,t,s,i)=>{let r=e[t];return eW(r)&&!eW(s)?(r.value=s,!0):Reflect.set(e,t,s,i)}};class eH{constructor(e){this.dep=void 0,this.__v_isRef=!0;let{get:t,set:s}=e(()=>eM(this),()=>eV(this));this._get=t,this._set=s}get value(){return this._get()}set value(e){this._set(e)}}class eY{constructor(e,t,s){this._object=e,this._key=t,this._defaultValue=s,this.__v_isRef=!0}get value(){let e=this._object[this._key];return void 0===e?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return function(e,t){let s=W.get(e);return s&&s.get(t)}(ex(this._object),this._key)}}class eF{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function eG(e,t,s){let i=e[t];return eW(i)?i:new eY(e,t,s)}return e.EffectScope=w,e.ITERATE_KEY=z,e.ReactiveEffect=S,e.ReactiveFlags={SKIP:"__v_skip",IS_REACTIVE:"__v_isReactive",IS_READONLY:"__v_isReadonly",IS_SHALLOW:"__v_isShallow",RAW:"__v_raw"},e.TrackOpTypes={GET:"get",HAS:"has",ITERATE:"iterate"},e.TriggerOpTypes={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},e.computed=eA,e.customRef=function(e){return new eH(e)},e.deferredComputed=eA,e.effect=function(e,t){e.effect instanceof S&&(e=e.effect.fn);let s=new S(e,i,()=>{s.dirty&&s.run()});t&&(r(s,t),t.scope&&R(s,t.scope)),t&&t.lazy||s.run();let n=s.run.bind(s);return n.effect=s,n},e.effectScope=function(e){return new w(e)},e.enableTracking=function(){m.push(E),E=!0},e.getCurrentScope=function(){return t},e.isProxy=function(e){return!!e&&!!e.__v_raw},e.isReactive=eO,e.isReadonly=em,e.isRef=eW,e.isShallow=ej,e.markRaw=function(e){return Object.isExtensible(e)&&y(e,"__v_skip",!0),e},e.onScopeDispose=function(e){t&&t.cleanups.push(e)},e.pauseScheduling=I,e.pauseTracking=j,e.proxyRefs=function(e){return eO(e)?e:new Proxy(e,eK)},e.reactive=ek,e.readonly=eL,e.ref=ez,e.resetScheduling=P,e.resetTracking=x,e.shallowReactive=function(e){return eE(e,!1,U,ev,eR)},e.shallowReadonly=function(e){return eE(e,!0,X,ey,eb)},e.shallowRef=function(e){return eN(e,!0)},e.stop=function(e){e.effect.stop()},e.toRaw=ex,e.toRef=function(e,t,s){return eW(e)?e:a(e)?new eF(e):f(e)&&arguments.length>1?eG(e,t,s):ez(e)},e.toRefs=function(e){let t=u(e)?Array(e.length):{};for(let s in e)t[s]=eG(e,s);return t},e.toValue=function(e){return a(e)?e():eC(e)},e.track=D,e.trigger=C,e.triggerRef=function(e){eV(e,4)},e.unref=eC,e}({}); | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/reactivity/dist/reactivity.cjs.js === | |
/** | |
* @vue/reactivity v3.4.35 | |
* (c) 2018-present Yuxi (Evan) You and Vue contributors | |
* @license MIT | |
**/ | |
'use strict'; | |
Object.defineProperty(exports, '__esModule', { value: true }); | |
var shared = require('@vue/shared'); | |
function warn(msg, ...args) { | |
console.warn(`[Vue warn] ${msg}`, ...args); | |
} | |
let activeEffectScope; | |
class EffectScope { | |
constructor(detached = false) { | |
this.detached = detached; | |
/** | |
* @internal | |
*/ | |
this._active = true; | |
/** | |
* @internal | |
*/ | |
this.effects = []; | |
/** | |
* @internal | |
*/ | |
this.cleanups = []; | |
this.parent = activeEffectScope; | |
if (!detached && activeEffectScope) { | |
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( | |
this | |
) - 1; | |
} | |
} | |
get active() { | |
return this._active; | |
} | |
run(fn) { | |
if (this._active) { | |
const currentEffectScope = activeEffectScope; | |
try { | |
activeEffectScope = this; | |
return fn(); | |
} finally { | |
activeEffectScope = currentEffectScope; | |
} | |
} else { | |
warn(`cannot run an inactive effect scope.`); | |
} | |
} | |
/** | |
* This should only be called on non-detached scopes | |
* @internal | |
*/ | |
on() { | |
activeEffectScope = this; | |
} | |
/** | |
* This should only be called on non-detached scopes | |
* @internal | |
*/ | |
off() { | |
activeEffectScope = this.parent; | |
} | |
stop(fromParent) { | |
if (this._active) { | |
let i, l; | |
for (i = 0, l = this.effects.length; i < l; i++) { | |
this.effects[i].stop(); | |
} | |
for (i = 0, l = this.cleanups.length; i < l; i++) { | |
this.cleanups[i](); | |
} | |
if (this.scopes) { | |
for (i = 0, l = this.scopes.length; i < l; i++) { | |
this.scopes[i].stop(true); | |
} | |
} | |
if (!this.detached && this.parent && !fromParent) { | |
const last = this.parent.scopes.pop(); | |
if (last && last !== this) { | |
this.parent.scopes[this.index] = last; | |
last.index = this.index; | |
} | |
} | |
this.parent = void 0; | |
this._active = false; | |
} | |
} | |
} | |
function effectScope(detached) { | |
return new EffectScope(detached); | |
} | |
function recordEffectScope(effect, scope = activeEffectScope) { | |
if (scope && scope.active) { | |
scope.effects.push(effect); | |
} | |
} | |
function getCurrentScope() { | |
return activeEffectScope; | |
} | |
function onScopeDispose(fn) { | |
if (activeEffectScope) { | |
activeEffectScope.cleanups.push(fn); | |
} else { | |
warn( | |
`onScopeDispose() is called when there is no active effect scope to be associated with.` | |
); | |
} | |
} | |
let activeEffect; | |
class ReactiveEffect { | |
constructor(fn, trigger, scheduler, scope) { | |
this.fn = fn; | |
this.trigger = trigger; | |
this.scheduler = scheduler; | |
this.active = true; | |
this.deps = []; | |
/** | |
* @internal | |
*/ | |
this._dirtyLevel = 4; | |
/** | |
* @internal | |
*/ | |
this._trackId = 0; | |
/** | |
* @internal | |
*/ | |
this._runnings = 0; | |
/** | |
* @internal | |
*/ | |
this._shouldSchedule = false; | |
/** | |
* @internal | |
*/ | |
this._depsLength = 0; | |
recordEffectScope(this, scope); | |
} | |
get dirty() { | |
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) { | |
this._dirtyLevel = 1; | |
pauseTracking(); | |
for (let i = 0; i < this._depsLength; i++) { | |
const dep = this.deps[i]; | |
if (dep.computed) { | |
triggerComputed(dep.computed); | |
if (this._dirtyLevel >= 4) { | |
break; | |
} | |
} | |
} | |
if (this._dirtyLevel === 1) { | |
this._dirtyLevel = 0; | |
} | |
resetTracking(); | |
} | |
return this._dirtyLevel >= 4; | |
} | |
set dirty(v) { | |
this._dirtyLevel = v ? 4 : 0; | |
} | |
run() { | |
this._dirtyLevel = 0; | |
if (!this.active) { | |
return this.fn(); | |
} | |
let lastShouldTrack = shouldTrack; | |
let lastEffect = activeEffect; | |
try { | |
shouldTrack = true; | |
activeEffect = this; | |
this._runnings++; | |
preCleanupEffect(this); | |
return this.fn(); | |
} finally { | |
postCleanupEffect(this); | |
this._runnings--; | |
activeEffect = lastEffect; | |
shouldTrack = lastShouldTrack; | |
} | |
} | |
stop() { | |
if (this.active) { | |
preCleanupEffect(this); | |
postCleanupEffect(this); | |
this.onStop && this.onStop(); | |
this.active = false; | |
} | |
} | |
} | |
function triggerComputed(computed) { | |
return computed.value; | |
} | |
function preCleanupEffect(effect2) { | |
effect2._trackId++; | |
effect2._depsLength = 0; | |
} | |
function postCleanupEffect(effect2) { | |
if (effect2.deps.length > effect2._depsLength) { | |
for (let i = effect2._depsLength; i < effect2.deps.length; i++) { | |
cleanupDepEffect(effect2.deps[i], effect2); | |
} | |
effect2.deps.length = effect2._depsLength; | |
} | |
} | |
function cleanupDepEffect(dep, effect2) { | |
const trackId = dep.get(effect2); | |
if (trackId !== void 0 && effect2._trackId !== trackId) { | |
dep.delete(effect2); | |
if (dep.size === 0) { | |
dep.cleanup(); | |
} | |
} | |
} | |
function effect(fn, options) { | |
if (fn.effect instanceof ReactiveEffect) { | |
fn = fn.effect.fn; | |
} | |
const _effect = new ReactiveEffect(fn, shared.NOOP, () => { | |
if (_effect.dirty) { | |
_effect.run(); | |
} | |
}); | |
if (options) { | |
shared.extend(_effect, options); | |
if (options.scope) recordEffectScope(_effect, options.scope); | |
} | |
if (!options || !options.lazy) { | |
_effect.run(); | |
} | |
const runner = _effect.run.bind(_effect); | |
runner.effect = _effect; | |
return runner; | |
} | |
function stop(runner) { | |
runner.effect.stop(); | |
} | |
let shouldTrack = true; | |
let pauseScheduleStack = 0; | |
const trackStack = []; | |
function pauseTracking() { | |
trackStack.push(shouldTrack); | |
shouldTrack = false; | |
} | |
function enableTracking() { | |
trackStack.push(shouldTrack); | |
shouldTrack = true; | |
} | |
function resetTracking() { | |
const last = trackStack.pop(); | |
shouldTrack = last === void 0 ? true : last; | |
} | |
function pauseScheduling() { | |
pauseScheduleStack++; | |
} | |
function resetScheduling() { | |
pauseScheduleStack--; | |
while (!pauseScheduleStack && queueEffectSchedulers.length) { | |
queueEffectSchedulers.shift()(); | |
} | |
} | |
function trackEffect(effect2, dep, debuggerEventExtraInfo) { | |
var _a; | |
if (dep.get(effect2) !== effect2._trackId) { | |
dep.set(effect2, effect2._trackId); | |
const oldDep = effect2.deps[effect2._depsLength]; | |
if (oldDep !== dep) { | |
if (oldDep) { | |
cleanupDepEffect(oldDep, effect2); | |
} | |
effect2.deps[effect2._depsLength++] = dep; | |
} else { | |
effect2._depsLength++; | |
} | |
{ | |
(_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, shared.extend({ effect: effect2 }, debuggerEventExtraInfo)); | |
} | |
} | |
} | |
const queueEffectSchedulers = []; | |
function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) { | |
var _a; | |
pauseScheduling(); | |
for (const effect2 of dep.keys()) { | |
let tracking; | |
if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) { | |
effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0); | |
effect2._dirtyLevel = dirtyLevel; | |
} | |
if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) { | |
{ | |
(_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, shared.extend({ effect: effect2 }, debuggerEventExtraInfo)); | |
} | |
effect2.trigger(); | |
if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) { | |
effect2._shouldSchedule = false; | |
if (effect2.scheduler) { | |
queueEffectSchedulers.push(effect2.scheduler); | |
} | |
} | |
} | |
} | |
resetScheduling(); | |
} | |
const createDep = (cleanup, computed) => { | |
const dep = /* @__PURE__ */ new Map(); | |
dep.cleanup = cleanup; | |
dep.computed = computed; | |
return dep; | |
}; | |
const targetMap = /* @__PURE__ */ new WeakMap(); | |
const ITERATE_KEY = Symbol("iterate" ); | |
const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" ); | |
function track(target, type, key) { | |
if (shouldTrack && activeEffect) { | |
let depsMap = targetMap.get(target); | |
if (!depsMap) { | |
targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); | |
} | |
let dep = depsMap.get(key); | |
if (!dep) { | |
depsMap.set(key, dep = createDep(() => depsMap.delete(key))); | |
} | |
trackEffect( | |
activeEffect, | |
dep, | |
{ | |
target, | |
type, | |
key | |
} | |
); | |
} | |
} | |
function trigger(target, type, key, newValue, oldValue, oldTarget) { | |
const depsMap = targetMap.get(target); | |
if (!depsMap) { | |
return; | |
} | |
let deps = []; | |
if (type === "clear") { | |
deps = [...depsMap.values()]; | |
} else if (key === "length" && shared.isArray(target)) { | |
const newLength = Number(newValue); | |
depsMap.forEach((dep, key2) => { | |
if (key2 === "length" || !shared.isSymbol(key2) && key2 >= newLength) { | |
deps.push(dep); | |
} | |
}); | |
} else { | |
if (key !== void 0) { | |
deps.push(depsMap.get(key)); | |
} | |
switch (type) { | |
case "add": | |
if (!shared.isArray(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
if (shared.isMap(target)) { | |
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); | |
} | |
} else if (shared.isIntegerKey(key)) { | |
deps.push(depsMap.get("length")); | |
} | |
break; | |
case "delete": | |
if (!shared.isArray(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
if (shared.isMap(target)) { | |
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); | |
} | |
} | |
break; | |
case "set": | |
if (shared.isMap(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
} | |
break; | |
} | |
} | |
pauseScheduling(); | |
for (const dep of deps) { | |
if (dep) { | |
triggerEffects( | |
dep, | |
4, | |
{ | |
target, | |
type, | |
key, | |
newValue, | |
oldValue, | |
oldTarget | |
} | |
); | |
} | |
} | |
resetScheduling(); | |
} | |
function getDepFromReactive(object, key) { | |
const depsMap = targetMap.get(object); | |
return depsMap && depsMap.get(key); | |
} | |
const isNonTrackableKeys = /* @__PURE__ */ shared.makeMap(`__proto__,__v_isRef,__isVue`); | |
const builtInSymbols = new Set( | |
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(shared.isSymbol) | |
); | |
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations(); | |
function createArrayInstrumentations() { | |
const instrumentations = {}; | |
["includes", "indexOf", "lastIndexOf"].forEach((key) => { | |
instrumentations[key] = function(...args) { | |
const arr = toRaw(this); | |
for (let i = 0, l = this.length; i < l; i++) { | |
track(arr, "get", i + ""); | |
} | |
const res = arr[key](...args); | |
if (res === -1 || res === false) { | |
return arr[key](...args.map(toRaw)); | |
} else { | |
return res; | |
} | |
}; | |
}); | |
["push", "pop", "shift", "unshift", "splice"].forEach((key) => { | |
instrumentations[key] = function(...args) { | |
pauseTracking(); | |
pauseScheduling(); | |
const res = toRaw(this)[key].apply(this, args); | |
resetScheduling(); | |
resetTracking(); | |
return res; | |
}; | |
}); | |
return instrumentations; | |
} | |
function hasOwnProperty(key) { | |
if (!shared.isSymbol(key)) key = String(key); | |
const obj = toRaw(this); | |
track(obj, "has", key); | |
return obj.hasOwnProperty(key); | |
} | |
class BaseReactiveHandler { | |
constructor(_isReadonly = false, _isShallow = false) { | |
this._isReadonly = _isReadonly; | |
this._isShallow = _isShallow; | |
} | |
get(target, key, receiver) { | |
const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow; | |
if (key === "__v_isReactive") { | |
return !isReadonly2; | |
} else if (key === "__v_isReadonly") { | |
return isReadonly2; | |
} else if (key === "__v_isShallow") { | |
return isShallow2; | |
} else if (key === "__v_raw") { | |
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype | |
// this means the reciever is a user proxy of the reactive proxy | |
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) { | |
return target; | |
} | |
return; | |
} | |
const targetIsArray = shared.isArray(target); | |
if (!isReadonly2) { | |
if (targetIsArray && shared.hasOwn(arrayInstrumentations, key)) { | |
return Reflect.get(arrayInstrumentations, key, receiver); | |
} | |
if (key === "hasOwnProperty") { | |
return hasOwnProperty; | |
} | |
} | |
const res = Reflect.get(target, key, receiver); | |
if (shared.isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { | |
return res; | |
} | |
if (!isReadonly2) { | |
track(target, "get", key); | |
} | |
if (isShallow2) { | |
return res; | |
} | |
if (isRef(res)) { | |
return targetIsArray && shared.isIntegerKey(key) ? res : res.value; | |
} | |
if (shared.isObject(res)) { | |
return isReadonly2 ? readonly(res) : reactive(res); | |
} | |
return res; | |
} | |
} | |
class MutableReactiveHandler extends BaseReactiveHandler { | |
constructor(isShallow2 = false) { | |
super(false, isShallow2); | |
} | |
set(target, key, value, receiver) { | |
let oldValue = target[key]; | |
if (!this._isShallow) { | |
const isOldValueReadonly = isReadonly(oldValue); | |
if (!isShallow(value) && !isReadonly(value)) { | |
oldValue = toRaw(oldValue); | |
value = toRaw(value); | |
} | |
if (!shared.isArray(target) && isRef(oldValue) && !isRef(value)) { | |
if (isOldValueReadonly) { | |
return false; | |
} else { | |
oldValue.value = value; | |
return true; | |
} | |
} | |
} | |
const hadKey = shared.isArray(target) && shared.isIntegerKey(key) ? Number(key) < target.length : shared.hasOwn(target, key); | |
const result = Reflect.set(target, key, value, receiver); | |
if (target === toRaw(receiver)) { | |
if (!hadKey) { | |
trigger(target, "add", key, value); | |
} else if (shared.hasChanged(value, oldValue)) { | |
trigger(target, "set", key, value, oldValue); | |
} | |
} | |
return result; | |
} | |
deleteProperty(target, key) { | |
const hadKey = shared.hasOwn(target, key); | |
const oldValue = target[key]; | |
const result = Reflect.deleteProperty(target, key); | |
if (result && hadKey) { | |
trigger(target, "delete", key, void 0, oldValue); | |
} | |
return result; | |
} | |
has(target, key) { | |
const result = Reflect.has(target, key); | |
if (!shared.isSymbol(key) || !builtInSymbols.has(key)) { | |
track(target, "has", key); | |
} | |
return result; | |
} | |
ownKeys(target) { | |
track( | |
target, | |
"iterate", | |
shared.isArray(target) ? "length" : ITERATE_KEY | |
); | |
return Reflect.ownKeys(target); | |
} | |
} | |
class ReadonlyReactiveHandler extends BaseReactiveHandler { | |
constructor(isShallow2 = false) { | |
super(true, isShallow2); | |
} | |
set(target, key) { | |
{ | |
warn( | |
`Set operation on key "${String(key)}" failed: target is readonly.`, | |
target | |
); | |
} | |
return true; | |
} | |
deleteProperty(target, key) { | |
{ | |
warn( | |
`Delete operation on key "${String(key)}" failed: target is readonly.`, | |
target | |
); | |
} | |
return true; | |
} | |
} | |
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler(); | |
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(); | |
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler( | |
true | |
); | |
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true); | |
const toShallow = (value) => value; | |
const getProto = (v) => Reflect.getPrototypeOf(v); | |
function get(target, key, isReadonly2 = false, isShallow2 = false) { | |
target = target["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const rawKey = toRaw(key); | |
if (!isReadonly2) { | |
if (shared.hasChanged(key, rawKey)) { | |
track(rawTarget, "get", key); | |
} | |
track(rawTarget, "get", rawKey); | |
} | |
const { has: has2 } = getProto(rawTarget); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
if (has2.call(rawTarget, key)) { | |
return wrap(target.get(key)); | |
} else if (has2.call(rawTarget, rawKey)) { | |
return wrap(target.get(rawKey)); | |
} else if (target !== rawTarget) { | |
target.get(key); | |
} | |
} | |
function has(key, isReadonly2 = false) { | |
const target = this["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const rawKey = toRaw(key); | |
if (!isReadonly2) { | |
if (shared.hasChanged(key, rawKey)) { | |
track(rawTarget, "has", key); | |
} | |
track(rawTarget, "has", rawKey); | |
} | |
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); | |
} | |
function size(target, isReadonly2 = false) { | |
target = target["__v_raw"]; | |
!isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY); | |
return Reflect.get(target, "size", target); | |
} | |
function add(value, _isShallow = false) { | |
if (!_isShallow && !isShallow(value) && !isReadonly(value)) { | |
value = toRaw(value); | |
} | |
const target = toRaw(this); | |
const proto = getProto(target); | |
const hadKey = proto.has.call(target, value); | |
if (!hadKey) { | |
target.add(value); | |
trigger(target, "add", value, value); | |
} | |
return this; | |
} | |
function set(key, value, _isShallow = false) { | |
if (!_isShallow && !isShallow(value) && !isReadonly(value)) { | |
value = toRaw(value); | |
} | |
const target = toRaw(this); | |
const { has: has2, get: get2 } = getProto(target); | |
let hadKey = has2.call(target, key); | |
if (!hadKey) { | |
key = toRaw(key); | |
hadKey = has2.call(target, key); | |
} else { | |
checkIdentityKeys(target, has2, key); | |
} | |
const oldValue = get2.call(target, key); | |
target.set(key, value); | |
if (!hadKey) { | |
trigger(target, "add", key, value); | |
} else if (shared.hasChanged(value, oldValue)) { | |
trigger(target, "set", key, value, oldValue); | |
} | |
return this; | |
} | |
function deleteEntry(key) { | |
const target = toRaw(this); | |
const { has: has2, get: get2 } = getProto(target); | |
let hadKey = has2.call(target, key); | |
if (!hadKey) { | |
key = toRaw(key); | |
hadKey = has2.call(target, key); | |
} else { | |
checkIdentityKeys(target, has2, key); | |
} | |
const oldValue = get2 ? get2.call(target, key) : void 0; | |
const result = target.delete(key); | |
if (hadKey) { | |
trigger(target, "delete", key, void 0, oldValue); | |
} | |
return result; | |
} | |
function clear() { | |
const target = toRaw(this); | |
const hadItems = target.size !== 0; | |
const oldTarget = shared.isMap(target) ? new Map(target) : new Set(target) ; | |
const result = target.clear(); | |
if (hadItems) { | |
trigger(target, "clear", void 0, void 0, oldTarget); | |
} | |
return result; | |
} | |
function createForEach(isReadonly2, isShallow2) { | |
return function forEach(callback, thisArg) { | |
const observed = this; | |
const target = observed["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
!isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY); | |
return target.forEach((value, key) => { | |
return callback.call(thisArg, wrap(value), wrap(key), observed); | |
}); | |
}; | |
} | |
function createIterableMethod(method, isReadonly2, isShallow2) { | |
return function(...args) { | |
const target = this["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const targetIsMap = shared.isMap(rawTarget); | |
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; | |
const isKeyOnly = method === "keys" && targetIsMap; | |
const innerIterator = target[method](...args); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
!isReadonly2 && track( | |
rawTarget, | |
"iterate", | |
isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY | |
); | |
return { | |
// iterator protocol | |
next() { | |
const { value, done } = innerIterator.next(); | |
return done ? { value, done } : { | |
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), | |
done | |
}; | |
}, | |
// iterable protocol | |
[Symbol.iterator]() { | |
return this; | |
} | |
}; | |
}; | |
} | |
function createReadonlyMethod(type) { | |
return function(...args) { | |
{ | |
const key = args[0] ? `on key "${args[0]}" ` : ``; | |
warn( | |
`${shared.capitalize(type)} operation ${key}failed: target is readonly.`, | |
toRaw(this) | |
); | |
} | |
return type === "delete" ? false : type === "clear" ? void 0 : this; | |
}; | |
} | |
function createInstrumentations() { | |
const mutableInstrumentations2 = { | |
get(key) { | |
return get(this, key); | |
}, | |
get size() { | |
return size(this); | |
}, | |
has, | |
add, | |
set, | |
delete: deleteEntry, | |
clear, | |
forEach: createForEach(false, false) | |
}; | |
const shallowInstrumentations2 = { | |
get(key) { | |
return get(this, key, false, true); | |
}, | |
get size() { | |
return size(this); | |
}, | |
has, | |
add(value) { | |
return add.call(this, value, true); | |
}, | |
set(key, value) { | |
return set.call(this, key, value, true); | |
}, | |
delete: deleteEntry, | |
clear, | |
forEach: createForEach(false, true) | |
}; | |
const readonlyInstrumentations2 = { | |
get(key) { | |
return get(this, key, true); | |
}, | |
get size() { | |
return size(this, true); | |
}, | |
has(key) { | |
return has.call(this, key, true); | |
}, | |
add: createReadonlyMethod("add"), | |
set: createReadonlyMethod("set"), | |
delete: createReadonlyMethod("delete"), | |
clear: createReadonlyMethod("clear"), | |
forEach: createForEach(true, false) | |
}; | |
const shallowReadonlyInstrumentations2 = { | |
get(key) { | |
return get(this, key, true, true); | |
}, | |
get size() { | |
return size(this, true); | |
}, | |
has(key) { | |
return has.call(this, key, true); | |
}, | |
add: createReadonlyMethod("add"), | |
set: createReadonlyMethod("set"), | |
delete: createReadonlyMethod("delete"), | |
clear: createReadonlyMethod("clear"), | |
forEach: createForEach(true, true) | |
}; | |
const iteratorMethods = [ | |
"keys", | |
"values", | |
"entries", | |
Symbol.iterator | |
]; | |
iteratorMethods.forEach((method) => { | |
mutableInstrumentations2[method] = createIterableMethod(method, false, false); | |
readonlyInstrumentations2[method] = createIterableMethod(method, true, false); | |
shallowInstrumentations2[method] = createIterableMethod(method, false, true); | |
shallowReadonlyInstrumentations2[method] = createIterableMethod( | |
method, | |
true, | |
true | |
); | |
}); | |
return [ | |
mutableInstrumentations2, | |
readonlyInstrumentations2, | |
shallowInstrumentations2, | |
shallowReadonlyInstrumentations2 | |
]; | |
} | |
const [ | |
mutableInstrumentations, | |
readonlyInstrumentations, | |
shallowInstrumentations, | |
shallowReadonlyInstrumentations | |
] = /* @__PURE__ */ createInstrumentations(); | |
function createInstrumentationGetter(isReadonly2, shallow) { | |
const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations; | |
return (target, key, receiver) => { | |
if (key === "__v_isReactive") { | |
return !isReadonly2; | |
} else if (key === "__v_isReadonly") { | |
return isReadonly2; | |
} else if (key === "__v_raw") { | |
return target; | |
} | |
return Reflect.get( | |
shared.hasOwn(instrumentations, key) && key in target ? instrumentations : target, | |
key, | |
receiver | |
); | |
}; | |
} | |
const mutableCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(false, false) | |
}; | |
const shallowCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(false, true) | |
}; | |
const readonlyCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(true, false) | |
}; | |
const shallowReadonlyCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(true, true) | |
}; | |
function checkIdentityKeys(target, has2, key) { | |
const rawKey = toRaw(key); | |
if (rawKey !== key && has2.call(target, rawKey)) { | |
const type = shared.toRawType(target); | |
warn( | |
`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.` | |
); | |
} | |
} | |
const reactiveMap = /* @__PURE__ */ new WeakMap(); | |
const shallowReactiveMap = /* @__PURE__ */ new WeakMap(); | |
const readonlyMap = /* @__PURE__ */ new WeakMap(); | |
const shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); | |
function targetTypeMap(rawType) { | |
switch (rawType) { | |
case "Object": | |
case "Array": | |
return 1 /* COMMON */; | |
case "Map": | |
case "Set": | |
case "WeakMap": | |
case "WeakSet": | |
return 2 /* COLLECTION */; | |
default: | |
return 0 /* INVALID */; | |
} | |
} | |
function getTargetType(value) { | |
return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(shared.toRawType(value)); | |
} | |
function reactive(target) { | |
if (isReadonly(target)) { | |
return target; | |
} | |
return createReactiveObject( | |
target, | |
false, | |
mutableHandlers, | |
mutableCollectionHandlers, | |
reactiveMap | |
); | |
} | |
function shallowReactive(target) { | |
return createReactiveObject( | |
target, | |
false, | |
shallowReactiveHandlers, | |
shallowCollectionHandlers, | |
shallowReactiveMap | |
); | |
} | |
function readonly(target) { | |
return createReactiveObject( | |
target, | |
true, | |
readonlyHandlers, | |
readonlyCollectionHandlers, | |
readonlyMap | |
); | |
} | |
function shallowReadonly(target) { | |
return createReactiveObject( | |
target, | |
true, | |
shallowReadonlyHandlers, | |
shallowReadonlyCollectionHandlers, | |
shallowReadonlyMap | |
); | |
} | |
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { | |
if (!shared.isObject(target)) { | |
{ | |
warn( | |
`value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String( | |
target | |
)}` | |
); | |
} | |
return target; | |
} | |
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { | |
return target; | |
} | |
const existingProxy = proxyMap.get(target); | |
if (existingProxy) { | |
return existingProxy; | |
} | |
const targetType = getTargetType(target); | |
if (targetType === 0 /* INVALID */) { | |
return target; | |
} | |
const proxy = new Proxy( | |
target, | |
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers | |
); | |
proxyMap.set(target, proxy); | |
return proxy; | |
} | |
function isReactive(value) { | |
if (isReadonly(value)) { | |
return isReactive(value["__v_raw"]); | |
} | |
return !!(value && value["__v_isReactive"]); | |
} | |
function isReadonly(value) { | |
return !!(value && value["__v_isReadonly"]); | |
} | |
function isShallow(value) { | |
return !!(value && value["__v_isShallow"]); | |
} | |
function isProxy(value) { | |
return value ? !!value["__v_raw"] : false; | |
} | |
function toRaw(observed) { | |
const raw = observed && observed["__v_raw"]; | |
return raw ? toRaw(raw) : observed; | |
} | |
function markRaw(value) { | |
if (Object.isExtensible(value)) { | |
shared.def(value, "__v_skip", true); | |
} | |
return value; | |
} | |
const toReactive = (value) => shared.isObject(value) ? reactive(value) : value; | |
const toReadonly = (value) => shared.isObject(value) ? readonly(value) : value; | |
const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`; | |
class ComputedRefImpl { | |
constructor(getter, _setter, isReadonly, isSSR) { | |
this.getter = getter; | |
this._setter = _setter; | |
this.dep = void 0; | |
this.__v_isRef = true; | |
this["__v_isReadonly"] = false; | |
this.effect = new ReactiveEffect( | |
() => getter(this._value), | |
() => triggerRefValue( | |
this, | |
this.effect._dirtyLevel === 2 ? 2 : 3 | |
) | |
); | |
this.effect.computed = this; | |
this.effect.active = this._cacheable = !isSSR; | |
this["__v_isReadonly"] = isReadonly; | |
} | |
get value() { | |
const self = toRaw(this); | |
if ((!self._cacheable || self.effect.dirty) && shared.hasChanged(self._value, self._value = self.effect.run())) { | |
triggerRefValue(self, 4); | |
} | |
trackRefValue(self); | |
if (self.effect._dirtyLevel >= 2) { | |
if (this._warnRecursive) { | |
warn(COMPUTED_SIDE_EFFECT_WARN, ` | |
getter: `, this.getter); | |
} | |
triggerRefValue(self, 2); | |
} | |
return self._value; | |
} | |
set value(newValue) { | |
this._setter(newValue); | |
} | |
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x | |
get _dirty() { | |
return this.effect.dirty; | |
} | |
set _dirty(v) { | |
this.effect.dirty = v; | |
} | |
// #endregion | |
} | |
function computed(getterOrOptions, debugOptions, isSSR = false) { | |
let getter; | |
let setter; | |
const onlyGetter = shared.isFunction(getterOrOptions); | |
if (onlyGetter) { | |
getter = getterOrOptions; | |
setter = () => { | |
warn("Write operation failed: computed value is readonly"); | |
} ; | |
} else { | |
getter = getterOrOptions.get; | |
setter = getterOrOptions.set; | |
} | |
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR); | |
if (debugOptions && !isSSR) { | |
cRef.effect.onTrack = debugOptions.onTrack; | |
cRef.effect.onTrigger = debugOptions.onTrigger; | |
} | |
return cRef; | |
} | |
function trackRefValue(ref2) { | |
var _a; | |
if (shouldTrack && activeEffect) { | |
ref2 = toRaw(ref2); | |
trackEffect( | |
activeEffect, | |
(_a = ref2.dep) != null ? _a : ref2.dep = createDep( | |
() => ref2.dep = void 0, | |
ref2 instanceof ComputedRefImpl ? ref2 : void 0 | |
), | |
{ | |
target: ref2, | |
type: "get", | |
key: "value" | |
} | |
); | |
} | |
} | |
function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) { | |
ref2 = toRaw(ref2); | |
const dep = ref2.dep; | |
if (dep) { | |
triggerEffects( | |
dep, | |
dirtyLevel, | |
{ | |
target: ref2, | |
type: "set", | |
key: "value", | |
newValue: newVal, | |
oldValue: oldVal | |
} | |
); | |
} | |
} | |
function isRef(r) { | |
return !!(r && r.__v_isRef === true); | |
} | |
function ref(value) { | |
return createRef(value, false); | |
} | |
function shallowRef(value) { | |
return createRef(value, true); | |
} | |
function createRef(rawValue, shallow) { | |
if (isRef(rawValue)) { | |
return rawValue; | |
} | |
return new RefImpl(rawValue, shallow); | |
} | |
class RefImpl { | |
constructor(value, __v_isShallow) { | |
this.__v_isShallow = __v_isShallow; | |
this.dep = void 0; | |
this.__v_isRef = true; | |
this._rawValue = __v_isShallow ? value : toRaw(value); | |
this._value = __v_isShallow ? value : toReactive(value); | |
} | |
get value() { | |
trackRefValue(this); | |
return this._value; | |
} | |
set value(newVal) { | |
const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal); | |
newVal = useDirectValue ? newVal : toRaw(newVal); | |
if (shared.hasChanged(newVal, this._rawValue)) { | |
const oldVal = this._rawValue; | |
this._rawValue = newVal; | |
this._value = useDirectValue ? newVal : toReactive(newVal); | |
triggerRefValue(this, 4, newVal, oldVal); | |
} | |
} | |
} | |
function triggerRef(ref2) { | |
triggerRefValue(ref2, 4, ref2.value ); | |
} | |
function unref(ref2) { | |
return isRef(ref2) ? ref2.value : ref2; | |
} | |
function toValue(source) { | |
return shared.isFunction(source) ? source() : unref(source); | |
} | |
const shallowUnwrapHandlers = { | |
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)), | |
set: (target, key, value, receiver) => { | |
const oldValue = target[key]; | |
if (isRef(oldValue) && !isRef(value)) { | |
oldValue.value = value; | |
return true; | |
} else { | |
return Reflect.set(target, key, value, receiver); | |
} | |
} | |
}; | |
function proxyRefs(objectWithRefs) { | |
return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers); | |
} | |
class CustomRefImpl { | |
constructor(factory) { | |
this.dep = void 0; | |
this.__v_isRef = true; | |
const { get, set } = factory( | |
() => trackRefValue(this), | |
() => triggerRefValue(this) | |
); | |
this._get = get; | |
this._set = set; | |
} | |
get value() { | |
return this._get(); | |
} | |
set value(newVal) { | |
this._set(newVal); | |
} | |
} | |
function customRef(factory) { | |
return new CustomRefImpl(factory); | |
} | |
function toRefs(object) { | |
if (!isProxy(object)) { | |
warn(`toRefs() expects a reactive object but received a plain one.`); | |
} | |
const ret = shared.isArray(object) ? new Array(object.length) : {}; | |
for (const key in object) { | |
ret[key] = propertyToRef(object, key); | |
} | |
return ret; | |
} | |
class ObjectRefImpl { | |
constructor(_object, _key, _defaultValue) { | |
this._object = _object; | |
this._key = _key; | |
this._defaultValue = _defaultValue; | |
this.__v_isRef = true; | |
} | |
get value() { | |
const val = this._object[this._key]; | |
return val === void 0 ? this._defaultValue : val; | |
} | |
set value(newVal) { | |
this._object[this._key] = newVal; | |
} | |
get dep() { | |
return getDepFromReactive(toRaw(this._object), this._key); | |
} | |
} | |
class GetterRefImpl { | |
constructor(_getter) { | |
this._getter = _getter; | |
this.__v_isRef = true; | |
this.__v_isReadonly = true; | |
} | |
get value() { | |
return this._getter(); | |
} | |
} | |
function toRef(source, key, defaultValue) { | |
if (isRef(source)) { | |
return source; | |
} else if (shared.isFunction(source)) { | |
return new GetterRefImpl(source); | |
} else if (shared.isObject(source) && arguments.length > 1) { | |
return propertyToRef(source, key, defaultValue); | |
} else { | |
return ref(source); | |
} | |
} | |
function propertyToRef(source, key, defaultValue) { | |
const val = source[key]; | |
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue); | |
} | |
const deferredComputed = computed; | |
const TrackOpTypes = { | |
"GET": "get", | |
"HAS": "has", | |
"ITERATE": "iterate" | |
}; | |
const TriggerOpTypes = { | |
"SET": "set", | |
"ADD": "add", | |
"DELETE": "delete", | |
"CLEAR": "clear" | |
}; | |
const ReactiveFlags = { | |
"SKIP": "__v_skip", | |
"IS_REACTIVE": "__v_isReactive", | |
"IS_READONLY": "__v_isReadonly", | |
"IS_SHALLOW": "__v_isShallow", | |
"RAW": "__v_raw" | |
}; | |
exports.EffectScope = EffectScope; | |
exports.ITERATE_KEY = ITERATE_KEY; | |
exports.ReactiveEffect = ReactiveEffect; | |
exports.ReactiveFlags = ReactiveFlags; | |
exports.TrackOpTypes = TrackOpTypes; | |
exports.TriggerOpTypes = TriggerOpTypes; | |
exports.computed = computed; | |
exports.customRef = customRef; | |
exports.deferredComputed = deferredComputed; | |
exports.effect = effect; | |
exports.effectScope = effectScope; | |
exports.enableTracking = enableTracking; | |
exports.getCurrentScope = getCurrentScope; | |
exports.isProxy = isProxy; | |
exports.isReactive = isReactive; | |
exports.isReadonly = isReadonly; | |
exports.isRef = isRef; | |
exports.isShallow = isShallow; | |
exports.markRaw = markRaw; | |
exports.onScopeDispose = onScopeDispose; | |
exports.pauseScheduling = pauseScheduling; | |
exports.pauseTracking = pauseTracking; | |
exports.proxyRefs = proxyRefs; | |
exports.reactive = reactive; | |
exports.readonly = readonly; | |
exports.ref = ref; | |
exports.resetScheduling = resetScheduling; | |
exports.resetTracking = resetTracking; | |
exports.shallowReactive = shallowReactive; | |
exports.shallowReadonly = shallowReadonly; | |
exports.shallowRef = shallowRef; | |
exports.stop = stop; | |
exports.toRaw = toRaw; | |
exports.toRef = toRef; | |
exports.toRefs = toRefs; | |
exports.toValue = toValue; | |
exports.track = track; | |
exports.trigger = trigger; | |
exports.triggerRef = triggerRef; | |
exports.unref = unref; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/reactivity/dist/reactivity.esm-browser.js === | |
/** | |
* @vue/reactivity v3.4.35 | |
* (c) 2018-present Yuxi (Evan) You and Vue contributors | |
* @license MIT | |
**/ | |
/*! #__NO_SIDE_EFFECTS__ */ | |
// @__NO_SIDE_EFFECTS__ | |
function makeMap(str, expectsLowerCase) { | |
const set = new Set(str.split(",")); | |
return (val) => set.has(val); | |
} | |
const NOOP = () => { | |
}; | |
const extend = Object.assign; | |
const hasOwnProperty$1 = Object.prototype.hasOwnProperty; | |
const hasOwn = (val, key) => hasOwnProperty$1.call(val, key); | |
const isArray = Array.isArray; | |
const isMap = (val) => toTypeString(val) === "[object Map]"; | |
const isFunction = (val) => typeof val === "function"; | |
const isString = (val) => typeof val === "string"; | |
const isSymbol = (val) => typeof val === "symbol"; | |
const isObject = (val) => val !== null && typeof val === "object"; | |
const objectToString = Object.prototype.toString; | |
const toTypeString = (value) => objectToString.call(value); | |
const toRawType = (value) => { | |
return toTypeString(value).slice(8, -1); | |
}; | |
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; | |
const cacheStringFunction = (fn) => { | |
const cache = /* @__PURE__ */ Object.create(null); | |
return (str) => { | |
const hit = cache[str]; | |
return hit || (cache[str] = fn(str)); | |
}; | |
}; | |
const capitalize = cacheStringFunction((str) => { | |
return str.charAt(0).toUpperCase() + str.slice(1); | |
}); | |
const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | |
const def = (obj, key, value, writable = false) => { | |
Object.defineProperty(obj, key, { | |
configurable: true, | |
enumerable: false, | |
writable, | |
value | |
}); | |
}; | |
function warn(msg, ...args) { | |
console.warn(`[Vue warn] ${msg}`, ...args); | |
} | |
let activeEffectScope; | |
class EffectScope { | |
constructor(detached = false) { | |
this.detached = detached; | |
/** | |
* @internal | |
*/ | |
this._active = true; | |
/** | |
* @internal | |
*/ | |
this.effects = []; | |
/** | |
* @internal | |
*/ | |
this.cleanups = []; | |
this.parent = activeEffectScope; | |
if (!detached && activeEffectScope) { | |
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( | |
this | |
) - 1; | |
} | |
} | |
get active() { | |
return this._active; | |
} | |
run(fn) { | |
if (this._active) { | |
const currentEffectScope = activeEffectScope; | |
try { | |
activeEffectScope = this; | |
return fn(); | |
} finally { | |
activeEffectScope = currentEffectScope; | |
} | |
} else { | |
warn(`cannot run an inactive effect scope.`); | |
} | |
} | |
/** | |
* This should only be called on non-detached scopes | |
* @internal | |
*/ | |
on() { | |
activeEffectScope = this; | |
} | |
/** | |
* This should only be called on non-detached scopes | |
* @internal | |
*/ | |
off() { | |
activeEffectScope = this.parent; | |
} | |
stop(fromParent) { | |
if (this._active) { | |
let i, l; | |
for (i = 0, l = this.effects.length; i < l; i++) { | |
this.effects[i].stop(); | |
} | |
for (i = 0, l = this.cleanups.length; i < l; i++) { | |
this.cleanups[i](); | |
} | |
if (this.scopes) { | |
for (i = 0, l = this.scopes.length; i < l; i++) { | |
this.scopes[i].stop(true); | |
} | |
} | |
if (!this.detached && this.parent && !fromParent) { | |
const last = this.parent.scopes.pop(); | |
if (last && last !== this) { | |
this.parent.scopes[this.index] = last; | |
last.index = this.index; | |
} | |
} | |
this.parent = void 0; | |
this._active = false; | |
} | |
} | |
} | |
function effectScope(detached) { | |
return new EffectScope(detached); | |
} | |
function recordEffectScope(effect, scope = activeEffectScope) { | |
if (scope && scope.active) { | |
scope.effects.push(effect); | |
} | |
} | |
function getCurrentScope() { | |
return activeEffectScope; | |
} | |
function onScopeDispose(fn) { | |
if (activeEffectScope) { | |
activeEffectScope.cleanups.push(fn); | |
} else { | |
warn( | |
`onScopeDispose() is called when there is no active effect scope to be associated with.` | |
); | |
} | |
} | |
let activeEffect; | |
class ReactiveEffect { | |
constructor(fn, trigger, scheduler, scope) { | |
this.fn = fn; | |
this.trigger = trigger; | |
this.scheduler = scheduler; | |
this.active = true; | |
this.deps = []; | |
/** | |
* @internal | |
*/ | |
this._dirtyLevel = 4; | |
/** | |
* @internal | |
*/ | |
this._trackId = 0; | |
/** | |
* @internal | |
*/ | |
this._runnings = 0; | |
/** | |
* @internal | |
*/ | |
this._shouldSchedule = false; | |
/** | |
* @internal | |
*/ | |
this._depsLength = 0; | |
recordEffectScope(this, scope); | |
} | |
get dirty() { | |
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) { | |
this._dirtyLevel = 1; | |
pauseTracking(); | |
for (let i = 0; i < this._depsLength; i++) { | |
const dep = this.deps[i]; | |
if (dep.computed) { | |
triggerComputed(dep.computed); | |
if (this._dirtyLevel >= 4) { | |
break; | |
} | |
} | |
} | |
if (this._dirtyLevel === 1) { | |
this._dirtyLevel = 0; | |
} | |
resetTracking(); | |
} | |
return this._dirtyLevel >= 4; | |
} | |
set dirty(v) { | |
this._dirtyLevel = v ? 4 : 0; | |
} | |
run() { | |
this._dirtyLevel = 0; | |
if (!this.active) { | |
return this.fn(); | |
} | |
let lastShouldTrack = shouldTrack; | |
let lastEffect = activeEffect; | |
try { | |
shouldTrack = true; | |
activeEffect = this; | |
this._runnings++; | |
preCleanupEffect(this); | |
return this.fn(); | |
} finally { | |
postCleanupEffect(this); | |
this._runnings--; | |
activeEffect = lastEffect; | |
shouldTrack = lastShouldTrack; | |
} | |
} | |
stop() { | |
if (this.active) { | |
preCleanupEffect(this); | |
postCleanupEffect(this); | |
this.onStop && this.onStop(); | |
this.active = false; | |
} | |
} | |
} | |
function triggerComputed(computed) { | |
return computed.value; | |
} | |
function preCleanupEffect(effect2) { | |
effect2._trackId++; | |
effect2._depsLength = 0; | |
} | |
function postCleanupEffect(effect2) { | |
if (effect2.deps.length > effect2._depsLength) { | |
for (let i = effect2._depsLength; i < effect2.deps.length; i++) { | |
cleanupDepEffect(effect2.deps[i], effect2); | |
} | |
effect2.deps.length = effect2._depsLength; | |
} | |
} | |
function cleanupDepEffect(dep, effect2) { | |
const trackId = dep.get(effect2); | |
if (trackId !== void 0 && effect2._trackId !== trackId) { | |
dep.delete(effect2); | |
if (dep.size === 0) { | |
dep.cleanup(); | |
} | |
} | |
} | |
function effect(fn, options) { | |
if (fn.effect instanceof ReactiveEffect) { | |
fn = fn.effect.fn; | |
} | |
const _effect = new ReactiveEffect(fn, NOOP, () => { | |
if (_effect.dirty) { | |
_effect.run(); | |
} | |
}); | |
if (options) { | |
extend(_effect, options); | |
if (options.scope) recordEffectScope(_effect, options.scope); | |
} | |
if (!options || !options.lazy) { | |
_effect.run(); | |
} | |
const runner = _effect.run.bind(_effect); | |
runner.effect = _effect; | |
return runner; | |
} | |
function stop(runner) { | |
runner.effect.stop(); | |
} | |
let shouldTrack = true; | |
let pauseScheduleStack = 0; | |
const trackStack = []; | |
function pauseTracking() { | |
trackStack.push(shouldTrack); | |
shouldTrack = false; | |
} | |
function enableTracking() { | |
trackStack.push(shouldTrack); | |
shouldTrack = true; | |
} | |
function resetTracking() { | |
const last = trackStack.pop(); | |
shouldTrack = last === void 0 ? true : last; | |
} | |
function pauseScheduling() { | |
pauseScheduleStack++; | |
} | |
function resetScheduling() { | |
pauseScheduleStack--; | |
while (!pauseScheduleStack && queueEffectSchedulers.length) { | |
queueEffectSchedulers.shift()(); | |
} | |
} | |
function trackEffect(effect2, dep, debuggerEventExtraInfo) { | |
var _a; | |
if (dep.get(effect2) !== effect2._trackId) { | |
dep.set(effect2, effect2._trackId); | |
const oldDep = effect2.deps[effect2._depsLength]; | |
if (oldDep !== dep) { | |
if (oldDep) { | |
cleanupDepEffect(oldDep, effect2); | |
} | |
effect2.deps[effect2._depsLength++] = dep; | |
} else { | |
effect2._depsLength++; | |
} | |
{ | |
(_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo)); | |
} | |
} | |
} | |
const queueEffectSchedulers = []; | |
function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) { | |
var _a; | |
pauseScheduling(); | |
for (const effect2 of dep.keys()) { | |
let tracking; | |
if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) { | |
effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0); | |
effect2._dirtyLevel = dirtyLevel; | |
} | |
if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) { | |
{ | |
(_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo)); | |
} | |
effect2.trigger(); | |
if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) { | |
effect2._shouldSchedule = false; | |
if (effect2.scheduler) { | |
queueEffectSchedulers.push(effect2.scheduler); | |
} | |
} | |
} | |
} | |
resetScheduling(); | |
} | |
const createDep = (cleanup, computed) => { | |
const dep = /* @__PURE__ */ new Map(); | |
dep.cleanup = cleanup; | |
dep.computed = computed; | |
return dep; | |
}; | |
const targetMap = /* @__PURE__ */ new WeakMap(); | |
const ITERATE_KEY = Symbol("iterate" ); | |
const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" ); | |
function track(target, type, key) { | |
if (shouldTrack && activeEffect) { | |
let depsMap = targetMap.get(target); | |
if (!depsMap) { | |
targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); | |
} | |
let dep = depsMap.get(key); | |
if (!dep) { | |
depsMap.set(key, dep = createDep(() => depsMap.delete(key))); | |
} | |
trackEffect( | |
activeEffect, | |
dep, | |
{ | |
target, | |
type, | |
key | |
} | |
); | |
} | |
} | |
function trigger(target, type, key, newValue, oldValue, oldTarget) { | |
const depsMap = targetMap.get(target); | |
if (!depsMap) { | |
return; | |
} | |
let deps = []; | |
if (type === "clear") { | |
deps = [...depsMap.values()]; | |
} else if (key === "length" && isArray(target)) { | |
const newLength = Number(newValue); | |
depsMap.forEach((dep, key2) => { | |
if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) { | |
deps.push(dep); | |
} | |
}); | |
} else { | |
if (key !== void 0) { | |
deps.push(depsMap.get(key)); | |
} | |
switch (type) { | |
case "add": | |
if (!isArray(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
if (isMap(target)) { | |
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); | |
} | |
} else if (isIntegerKey(key)) { | |
deps.push(depsMap.get("length")); | |
} | |
break; | |
case "delete": | |
if (!isArray(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
if (isMap(target)) { | |
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); | |
} | |
} | |
break; | |
case "set": | |
if (isMap(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
} | |
break; | |
} | |
} | |
pauseScheduling(); | |
for (const dep of deps) { | |
if (dep) { | |
triggerEffects( | |
dep, | |
4, | |
{ | |
target, | |
type, | |
key, | |
newValue, | |
oldValue, | |
oldTarget | |
} | |
); | |
} | |
} | |
resetScheduling(); | |
} | |
function getDepFromReactive(object, key) { | |
const depsMap = targetMap.get(object); | |
return depsMap && depsMap.get(key); | |
} | |
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); | |
const builtInSymbols = new Set( | |
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol) | |
); | |
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations(); | |
function createArrayInstrumentations() { | |
const instrumentations = {}; | |
["includes", "indexOf", "lastIndexOf"].forEach((key) => { | |
instrumentations[key] = function(...args) { | |
const arr = toRaw(this); | |
for (let i = 0, l = this.length; i < l; i++) { | |
track(arr, "get", i + ""); | |
} | |
const res = arr[key](...args); | |
if (res === -1 || res === false) { | |
return arr[key](...args.map(toRaw)); | |
} else { | |
return res; | |
} | |
}; | |
}); | |
["push", "pop", "shift", "unshift", "splice"].forEach((key) => { | |
instrumentations[key] = function(...args) { | |
pauseTracking(); | |
pauseScheduling(); | |
const res = toRaw(this)[key].apply(this, args); | |
resetScheduling(); | |
resetTracking(); | |
return res; | |
}; | |
}); | |
return instrumentations; | |
} | |
function hasOwnProperty(key) { | |
if (!isSymbol(key)) key = String(key); | |
const obj = toRaw(this); | |
track(obj, "has", key); | |
return obj.hasOwnProperty(key); | |
} | |
class BaseReactiveHandler { | |
constructor(_isReadonly = false, _isShallow = false) { | |
this._isReadonly = _isReadonly; | |
this._isShallow = _isShallow; | |
} | |
get(target, key, receiver) { | |
const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow; | |
if (key === "__v_isReactive") { | |
return !isReadonly2; | |
} else if (key === "__v_isReadonly") { | |
return isReadonly2; | |
} else if (key === "__v_isShallow") { | |
return isShallow2; | |
} else if (key === "__v_raw") { | |
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype | |
// this means the reciever is a user proxy of the reactive proxy | |
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) { | |
return target; | |
} | |
return; | |
} | |
const targetIsArray = isArray(target); | |
if (!isReadonly2) { | |
if (targetIsArray && hasOwn(arrayInstrumentations, key)) { | |
return Reflect.get(arrayInstrumentations, key, receiver); | |
} | |
if (key === "hasOwnProperty") { | |
return hasOwnProperty; | |
} | |
} | |
const res = Reflect.get(target, key, receiver); | |
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { | |
return res; | |
} | |
if (!isReadonly2) { | |
track(target, "get", key); | |
} | |
if (isShallow2) { | |
return res; | |
} | |
if (isRef(res)) { | |
return targetIsArray && isIntegerKey(key) ? res : res.value; | |
} | |
if (isObject(res)) { | |
return isReadonly2 ? readonly(res) : reactive(res); | |
} | |
return res; | |
} | |
} | |
class MutableReactiveHandler extends BaseReactiveHandler { | |
constructor(isShallow2 = false) { | |
super(false, isShallow2); | |
} | |
set(target, key, value, receiver) { | |
let oldValue = target[key]; | |
if (!this._isShallow) { | |
const isOldValueReadonly = isReadonly(oldValue); | |
if (!isShallow(value) && !isReadonly(value)) { | |
oldValue = toRaw(oldValue); | |
value = toRaw(value); | |
} | |
if (!isArray(target) && isRef(oldValue) && !isRef(value)) { | |
if (isOldValueReadonly) { | |
return false; | |
} else { | |
oldValue.value = value; | |
return true; | |
} | |
} | |
} | |
const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key); | |
const result = Reflect.set(target, key, value, receiver); | |
if (target === toRaw(receiver)) { | |
if (!hadKey) { | |
trigger(target, "add", key, value); | |
} else if (hasChanged(value, oldValue)) { | |
trigger(target, "set", key, value, oldValue); | |
} | |
} | |
return result; | |
} | |
deleteProperty(target, key) { | |
const hadKey = hasOwn(target, key); | |
const oldValue = target[key]; | |
const result = Reflect.deleteProperty(target, key); | |
if (result && hadKey) { | |
trigger(target, "delete", key, void 0, oldValue); | |
} | |
return result; | |
} | |
has(target, key) { | |
const result = Reflect.has(target, key); | |
if (!isSymbol(key) || !builtInSymbols.has(key)) { | |
track(target, "has", key); | |
} | |
return result; | |
} | |
ownKeys(target) { | |
track( | |
target, | |
"iterate", | |
isArray(target) ? "length" : ITERATE_KEY | |
); | |
return Reflect.ownKeys(target); | |
} | |
} | |
class ReadonlyReactiveHandler extends BaseReactiveHandler { | |
constructor(isShallow2 = false) { | |
super(true, isShallow2); | |
} | |
set(target, key) { | |
{ | |
warn( | |
`Set operation on key "${String(key)}" failed: target is readonly.`, | |
target | |
); | |
} | |
return true; | |
} | |
deleteProperty(target, key) { | |
{ | |
warn( | |
`Delete operation on key "${String(key)}" failed: target is readonly.`, | |
target | |
); | |
} | |
return true; | |
} | |
} | |
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler(); | |
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(); | |
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler( | |
true | |
); | |
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true); | |
const toShallow = (value) => value; | |
const getProto = (v) => Reflect.getPrototypeOf(v); | |
function get(target, key, isReadonly2 = false, isShallow2 = false) { | |
target = target["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const rawKey = toRaw(key); | |
if (!isReadonly2) { | |
if (hasChanged(key, rawKey)) { | |
track(rawTarget, "get", key); | |
} | |
track(rawTarget, "get", rawKey); | |
} | |
const { has: has2 } = getProto(rawTarget); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
if (has2.call(rawTarget, key)) { | |
return wrap(target.get(key)); | |
} else if (has2.call(rawTarget, rawKey)) { | |
return wrap(target.get(rawKey)); | |
} else if (target !== rawTarget) { | |
target.get(key); | |
} | |
} | |
function has(key, isReadonly2 = false) { | |
const target = this["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const rawKey = toRaw(key); | |
if (!isReadonly2) { | |
if (hasChanged(key, rawKey)) { | |
track(rawTarget, "has", key); | |
} | |
track(rawTarget, "has", rawKey); | |
} | |
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); | |
} | |
function size(target, isReadonly2 = false) { | |
target = target["__v_raw"]; | |
!isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY); | |
return Reflect.get(target, "size", target); | |
} | |
function add(value, _isShallow = false) { | |
if (!_isShallow && !isShallow(value) && !isReadonly(value)) { | |
value = toRaw(value); | |
} | |
const target = toRaw(this); | |
const proto = getProto(target); | |
const hadKey = proto.has.call(target, value); | |
if (!hadKey) { | |
target.add(value); | |
trigger(target, "add", value, value); | |
} | |
return this; | |
} | |
function set(key, value, _isShallow = false) { | |
if (!_isShallow && !isShallow(value) && !isReadonly(value)) { | |
value = toRaw(value); | |
} | |
const target = toRaw(this); | |
const { has: has2, get: get2 } = getProto(target); | |
let hadKey = has2.call(target, key); | |
if (!hadKey) { | |
key = toRaw(key); | |
hadKey = has2.call(target, key); | |
} else { | |
checkIdentityKeys(target, has2, key); | |
} | |
const oldValue = get2.call(target, key); | |
target.set(key, value); | |
if (!hadKey) { | |
trigger(target, "add", key, value); | |
} else if (hasChanged(value, oldValue)) { | |
trigger(target, "set", key, value, oldValue); | |
} | |
return this; | |
} | |
function deleteEntry(key) { | |
const target = toRaw(this); | |
const { has: has2, get: get2 } = getProto(target); | |
let hadKey = has2.call(target, key); | |
if (!hadKey) { | |
key = toRaw(key); | |
hadKey = has2.call(target, key); | |
} else { | |
checkIdentityKeys(target, has2, key); | |
} | |
const oldValue = get2 ? get2.call(target, key) : void 0; | |
const result = target.delete(key); | |
if (hadKey) { | |
trigger(target, "delete", key, void 0, oldValue); | |
} | |
return result; | |
} | |
function clear() { | |
const target = toRaw(this); | |
const hadItems = target.size !== 0; | |
const oldTarget = isMap(target) ? new Map(target) : new Set(target) ; | |
const result = target.clear(); | |
if (hadItems) { | |
trigger(target, "clear", void 0, void 0, oldTarget); | |
} | |
return result; | |
} | |
function createForEach(isReadonly2, isShallow2) { | |
return function forEach(callback, thisArg) { | |
const observed = this; | |
const target = observed["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
!isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY); | |
return target.forEach((value, key) => { | |
return callback.call(thisArg, wrap(value), wrap(key), observed); | |
}); | |
}; | |
} | |
function createIterableMethod(method, isReadonly2, isShallow2) { | |
return function(...args) { | |
const target = this["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const targetIsMap = isMap(rawTarget); | |
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; | |
const isKeyOnly = method === "keys" && targetIsMap; | |
const innerIterator = target[method](...args); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
!isReadonly2 && track( | |
rawTarget, | |
"iterate", | |
isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY | |
); | |
return { | |
// iterator protocol | |
next() { | |
const { value, done } = innerIterator.next(); | |
return done ? { value, done } : { | |
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), | |
done | |
}; | |
}, | |
// iterable protocol | |
[Symbol.iterator]() { | |
return this; | |
} | |
}; | |
}; | |
} | |
function createReadonlyMethod(type) { | |
return function(...args) { | |
{ | |
const key = args[0] ? `on key "${args[0]}" ` : ``; | |
warn( | |
`${capitalize(type)} operation ${key}failed: target is readonly.`, | |
toRaw(this) | |
); | |
} | |
return type === "delete" ? false : type === "clear" ? void 0 : this; | |
}; | |
} | |
function createInstrumentations() { | |
const mutableInstrumentations2 = { | |
get(key) { | |
return get(this, key); | |
}, | |
get size() { | |
return size(this); | |
}, | |
has, | |
add, | |
set, | |
delete: deleteEntry, | |
clear, | |
forEach: createForEach(false, false) | |
}; | |
const shallowInstrumentations2 = { | |
get(key) { | |
return get(this, key, false, true); | |
}, | |
get size() { | |
return size(this); | |
}, | |
has, | |
add(value) { | |
return add.call(this, value, true); | |
}, | |
set(key, value) { | |
return set.call(this, key, value, true); | |
}, | |
delete: deleteEntry, | |
clear, | |
forEach: createForEach(false, true) | |
}; | |
const readonlyInstrumentations2 = { | |
get(key) { | |
return get(this, key, true); | |
}, | |
get size() { | |
return size(this, true); | |
}, | |
has(key) { | |
return has.call(this, key, true); | |
}, | |
add: createReadonlyMethod("add"), | |
set: createReadonlyMethod("set"), | |
delete: createReadonlyMethod("delete"), | |
clear: createReadonlyMethod("clear"), | |
forEach: createForEach(true, false) | |
}; | |
const shallowReadonlyInstrumentations2 = { | |
get(key) { | |
return get(this, key, true, true); | |
}, | |
get size() { | |
return size(this, true); | |
}, | |
has(key) { | |
return has.call(this, key, true); | |
}, | |
add: createReadonlyMethod("add"), | |
set: createReadonlyMethod("set"), | |
delete: createReadonlyMethod("delete"), | |
clear: createReadonlyMethod("clear"), | |
forEach: createForEach(true, true) | |
}; | |
const iteratorMethods = [ | |
"keys", | |
"values", | |
"entries", | |
Symbol.iterator | |
]; | |
iteratorMethods.forEach((method) => { | |
mutableInstrumentations2[method] = createIterableMethod(method, false, false); | |
readonlyInstrumentations2[method] = createIterableMethod(method, true, false); | |
shallowInstrumentations2[method] = createIterableMethod(method, false, true); | |
shallowReadonlyInstrumentations2[method] = createIterableMethod( | |
method, | |
true, | |
true | |
); | |
}); | |
return [ | |
mutableInstrumentations2, | |
readonlyInstrumentations2, | |
shallowInstrumentations2, | |
shallowReadonlyInstrumentations2 | |
]; | |
} | |
const [ | |
mutableInstrumentations, | |
readonlyInstrumentations, | |
shallowInstrumentations, | |
shallowReadonlyInstrumentations | |
] = /* @__PURE__ */ createInstrumentations(); | |
function createInstrumentationGetter(isReadonly2, shallow) { | |
const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations; | |
return (target, key, receiver) => { | |
if (key === "__v_isReactive") { | |
return !isReadonly2; | |
} else if (key === "__v_isReadonly") { | |
return isReadonly2; | |
} else if (key === "__v_raw") { | |
return target; | |
} | |
return Reflect.get( | |
hasOwn(instrumentations, key) && key in target ? instrumentations : target, | |
key, | |
receiver | |
); | |
}; | |
} | |
const mutableCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(false, false) | |
}; | |
const shallowCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(false, true) | |
}; | |
const readonlyCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(true, false) | |
}; | |
const shallowReadonlyCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(true, true) | |
}; | |
function checkIdentityKeys(target, has2, key) { | |
const rawKey = toRaw(key); | |
if (rawKey !== key && has2.call(target, rawKey)) { | |
const type = toRawType(target); | |
warn( | |
`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.` | |
); | |
} | |
} | |
const reactiveMap = /* @__PURE__ */ new WeakMap(); | |
const shallowReactiveMap = /* @__PURE__ */ new WeakMap(); | |
const readonlyMap = /* @__PURE__ */ new WeakMap(); | |
const shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); | |
function targetTypeMap(rawType) { | |
switch (rawType) { | |
case "Object": | |
case "Array": | |
return 1 /* COMMON */; | |
case "Map": | |
case "Set": | |
case "WeakMap": | |
case "WeakSet": | |
return 2 /* COLLECTION */; | |
default: | |
return 0 /* INVALID */; | |
} | |
} | |
function getTargetType(value) { | |
return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value)); | |
} | |
function reactive(target) { | |
if (isReadonly(target)) { | |
return target; | |
} | |
return createReactiveObject( | |
target, | |
false, | |
mutableHandlers, | |
mutableCollectionHandlers, | |
reactiveMap | |
); | |
} | |
function shallowReactive(target) { | |
return createReactiveObject( | |
target, | |
false, | |
shallowReactiveHandlers, | |
shallowCollectionHandlers, | |
shallowReactiveMap | |
); | |
} | |
function readonly(target) { | |
return createReactiveObject( | |
target, | |
true, | |
readonlyHandlers, | |
readonlyCollectionHandlers, | |
readonlyMap | |
); | |
} | |
function shallowReadonly(target) { | |
return createReactiveObject( | |
target, | |
true, | |
shallowReadonlyHandlers, | |
shallowReadonlyCollectionHandlers, | |
shallowReadonlyMap | |
); | |
} | |
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { | |
if (!isObject(target)) { | |
{ | |
warn( | |
`value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String( | |
target | |
)}` | |
); | |
} | |
return target; | |
} | |
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { | |
return target; | |
} | |
const existingProxy = proxyMap.get(target); | |
if (existingProxy) { | |
return existingProxy; | |
} | |
const targetType = getTargetType(target); | |
if (targetType === 0 /* INVALID */) { | |
return target; | |
} | |
const proxy = new Proxy( | |
target, | |
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers | |
); | |
proxyMap.set(target, proxy); | |
return proxy; | |
} | |
function isReactive(value) { | |
if (isReadonly(value)) { | |
return isReactive(value["__v_raw"]); | |
} | |
return !!(value && value["__v_isReactive"]); | |
} | |
function isReadonly(value) { | |
return !!(value && value["__v_isReadonly"]); | |
} | |
function isShallow(value) { | |
return !!(value && value["__v_isShallow"]); | |
} | |
function isProxy(value) { | |
return value ? !!value["__v_raw"] : false; | |
} | |
function toRaw(observed) { | |
const raw = observed && observed["__v_raw"]; | |
return raw ? toRaw(raw) : observed; | |
} | |
function markRaw(value) { | |
if (Object.isExtensible(value)) { | |
def(value, "__v_skip", true); | |
} | |
return value; | |
} | |
const toReactive = (value) => isObject(value) ? reactive(value) : value; | |
const toReadonly = (value) => isObject(value) ? readonly(value) : value; | |
const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`; | |
class ComputedRefImpl { | |
constructor(getter, _setter, isReadonly, isSSR) { | |
this.getter = getter; | |
this._setter = _setter; | |
this.dep = void 0; | |
this.__v_isRef = true; | |
this["__v_isReadonly"] = false; | |
this.effect = new ReactiveEffect( | |
() => getter(this._value), | |
() => triggerRefValue( | |
this, | |
this.effect._dirtyLevel === 2 ? 2 : 3 | |
) | |
); | |
this.effect.computed = this; | |
this.effect.active = this._cacheable = !isSSR; | |
this["__v_isReadonly"] = isReadonly; | |
} | |
get value() { | |
const self = toRaw(this); | |
if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) { | |
triggerRefValue(self, 4); | |
} | |
trackRefValue(self); | |
if (self.effect._dirtyLevel >= 2) { | |
if (this._warnRecursive) { | |
warn(COMPUTED_SIDE_EFFECT_WARN, ` | |
getter: `, this.getter); | |
} | |
triggerRefValue(self, 2); | |
} | |
return self._value; | |
} | |
set value(newValue) { | |
this._setter(newValue); | |
} | |
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x | |
get _dirty() { | |
return this.effect.dirty; | |
} | |
set _dirty(v) { | |
this.effect.dirty = v; | |
} | |
// #endregion | |
} | |
function computed(getterOrOptions, debugOptions, isSSR = false) { | |
let getter; | |
let setter; | |
const onlyGetter = isFunction(getterOrOptions); | |
if (onlyGetter) { | |
getter = getterOrOptions; | |
setter = () => { | |
warn("Write operation failed: computed value is readonly"); | |
} ; | |
} else { | |
getter = getterOrOptions.get; | |
setter = getterOrOptions.set; | |
} | |
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR); | |
if (debugOptions && !isSSR) { | |
cRef.effect.onTrack = debugOptions.onTrack; | |
cRef.effect.onTrigger = debugOptions.onTrigger; | |
} | |
return cRef; | |
} | |
function trackRefValue(ref2) { | |
var _a; | |
if (shouldTrack && activeEffect) { | |
ref2 = toRaw(ref2); | |
trackEffect( | |
activeEffect, | |
(_a = ref2.dep) != null ? _a : ref2.dep = createDep( | |
() => ref2.dep = void 0, | |
ref2 instanceof ComputedRefImpl ? ref2 : void 0 | |
), | |
{ | |
target: ref2, | |
type: "get", | |
key: "value" | |
} | |
); | |
} | |
} | |
function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) { | |
ref2 = toRaw(ref2); | |
const dep = ref2.dep; | |
if (dep) { | |
triggerEffects( | |
dep, | |
dirtyLevel, | |
{ | |
target: ref2, | |
type: "set", | |
key: "value", | |
newValue: newVal, | |
oldValue: oldVal | |
} | |
); | |
} | |
} | |
function isRef(r) { | |
return !!(r && r.__v_isRef === true); | |
} | |
function ref(value) { | |
return createRef(value, false); | |
} | |
function shallowRef(value) { | |
return createRef(value, true); | |
} | |
function createRef(rawValue, shallow) { | |
if (isRef(rawValue)) { | |
return rawValue; | |
} | |
return new RefImpl(rawValue, shallow); | |
} | |
class RefImpl { | |
constructor(value, __v_isShallow) { | |
this.__v_isShallow = __v_isShallow; | |
this.dep = void 0; | |
this.__v_isRef = true; | |
this._rawValue = __v_isShallow ? value : toRaw(value); | |
this._value = __v_isShallow ? value : toReactive(value); | |
} | |
get value() { | |
trackRefValue(this); | |
return this._value; | |
} | |
set value(newVal) { | |
const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal); | |
newVal = useDirectValue ? newVal : toRaw(newVal); | |
if (hasChanged(newVal, this._rawValue)) { | |
const oldVal = this._rawValue; | |
this._rawValue = newVal; | |
this._value = useDirectValue ? newVal : toReactive(newVal); | |
triggerRefValue(this, 4, newVal, oldVal); | |
} | |
} | |
} | |
function triggerRef(ref2) { | |
triggerRefValue(ref2, 4, ref2.value ); | |
} | |
function unref(ref2) { | |
return isRef(ref2) ? ref2.value : ref2; | |
} | |
function toValue(source) { | |
return isFunction(source) ? source() : unref(source); | |
} | |
const shallowUnwrapHandlers = { | |
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)), | |
set: (target, key, value, receiver) => { | |
const oldValue = target[key]; | |
if (isRef(oldValue) && !isRef(value)) { | |
oldValue.value = value; | |
return true; | |
} else { | |
return Reflect.set(target, key, value, receiver); | |
} | |
} | |
}; | |
function proxyRefs(objectWithRefs) { | |
return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers); | |
} | |
class CustomRefImpl { | |
constructor(factory) { | |
this.dep = void 0; | |
this.__v_isRef = true; | |
const { get, set } = factory( | |
() => trackRefValue(this), | |
() => triggerRefValue(this) | |
); | |
this._get = get; | |
this._set = set; | |
} | |
get value() { | |
return this._get(); | |
} | |
set value(newVal) { | |
this._set(newVal); | |
} | |
} | |
function customRef(factory) { | |
return new CustomRefImpl(factory); | |
} | |
function toRefs(object) { | |
if (!isProxy(object)) { | |
warn(`toRefs() expects a reactive object but received a plain one.`); | |
} | |
const ret = isArray(object) ? new Array(object.length) : {}; | |
for (const key in object) { | |
ret[key] = propertyToRef(object, key); | |
} | |
return ret; | |
} | |
class ObjectRefImpl { | |
constructor(_object, _key, _defaultValue) { | |
this._object = _object; | |
this._key = _key; | |
this._defaultValue = _defaultValue; | |
this.__v_isRef = true; | |
} | |
get value() { | |
const val = this._object[this._key]; | |
return val === void 0 ? this._defaultValue : val; | |
} | |
set value(newVal) { | |
this._object[this._key] = newVal; | |
} | |
get dep() { | |
return getDepFromReactive(toRaw(this._object), this._key); | |
} | |
} | |
class GetterRefImpl { | |
constructor(_getter) { | |
this._getter = _getter; | |
this.__v_isRef = true; | |
this.__v_isReadonly = true; | |
} | |
get value() { | |
return this._getter(); | |
} | |
} | |
function toRef(source, key, defaultValue) { | |
if (isRef(source)) { | |
return source; | |
} else if (isFunction(source)) { | |
return new GetterRefImpl(source); | |
} else if (isObject(source) && arguments.length > 1) { | |
return propertyToRef(source, key, defaultValue); | |
} else { | |
return ref(source); | |
} | |
} | |
function propertyToRef(source, key, defaultValue) { | |
const val = source[key]; | |
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue); | |
} | |
const deferredComputed = computed; | |
const TrackOpTypes = { | |
"GET": "get", | |
"HAS": "has", | |
"ITERATE": "iterate" | |
}; | |
const TriggerOpTypes = { | |
"SET": "set", | |
"ADD": "add", | |
"DELETE": "delete", | |
"CLEAR": "clear" | |
}; | |
const ReactiveFlags = { | |
"SKIP": "__v_skip", | |
"IS_REACTIVE": "__v_isReactive", | |
"IS_READONLY": "__v_isReadonly", | |
"IS_SHALLOW": "__v_isShallow", | |
"RAW": "__v_raw" | |
}; | |
export { EffectScope, ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, computed, customRef, deferredComputed, effect, effectScope, enableTracking, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, pauseScheduling, pauseTracking, proxyRefs, reactive, readonly, ref, resetScheduling, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, track, trigger, triggerRef, unref }; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/reactivity/dist/reactivity.global.js === | |
/** | |
* @vue/reactivity v3.4.35 | |
* (c) 2018-present Yuxi (Evan) You and Vue contributors | |
* @license MIT | |
**/ | |
var VueReactivity = (function (exports) { | |
'use strict'; | |
/*! #__NO_SIDE_EFFECTS__ */ | |
// @__NO_SIDE_EFFECTS__ | |
function makeMap(str, expectsLowerCase) { | |
const set = new Set(str.split(",")); | |
return (val) => set.has(val); | |
} | |
const NOOP = () => { | |
}; | |
const extend = Object.assign; | |
const hasOwnProperty$1 = Object.prototype.hasOwnProperty; | |
const hasOwn = (val, key) => hasOwnProperty$1.call(val, key); | |
const isArray = Array.isArray; | |
const isMap = (val) => toTypeString(val) === "[object Map]"; | |
const isFunction = (val) => typeof val === "function"; | |
const isString = (val) => typeof val === "string"; | |
const isSymbol = (val) => typeof val === "symbol"; | |
const isObject = (val) => val !== null && typeof val === "object"; | |
const objectToString = Object.prototype.toString; | |
const toTypeString = (value) => objectToString.call(value); | |
const toRawType = (value) => { | |
return toTypeString(value).slice(8, -1); | |
}; | |
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; | |
const cacheStringFunction = (fn) => { | |
const cache = /* @__PURE__ */ Object.create(null); | |
return (str) => { | |
const hit = cache[str]; | |
return hit || (cache[str] = fn(str)); | |
}; | |
}; | |
const capitalize = cacheStringFunction((str) => { | |
return str.charAt(0).toUpperCase() + str.slice(1); | |
}); | |
const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | |
const def = (obj, key, value, writable = false) => { | |
Object.defineProperty(obj, key, { | |
configurable: true, | |
enumerable: false, | |
writable, | |
value | |
}); | |
}; | |
function warn(msg, ...args) { | |
console.warn(`[Vue warn] ${msg}`, ...args); | |
} | |
let activeEffectScope; | |
class EffectScope { | |
constructor(detached = false) { | |
this.detached = detached; | |
/** | |
* @internal | |
*/ | |
this._active = true; | |
/** | |
* @internal | |
*/ | |
this.effects = []; | |
/** | |
* @internal | |
*/ | |
this.cleanups = []; | |
this.parent = activeEffectScope; | |
if (!detached && activeEffectScope) { | |
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( | |
this | |
) - 1; | |
} | |
} | |
get active() { | |
return this._active; | |
} | |
run(fn) { | |
if (this._active) { | |
const currentEffectScope = activeEffectScope; | |
try { | |
activeEffectScope = this; | |
return fn(); | |
} finally { | |
activeEffectScope = currentEffectScope; | |
} | |
} else { | |
warn(`cannot run an inactive effect scope.`); | |
} | |
} | |
/** | |
* This should only be called on non-detached scopes | |
* @internal | |
*/ | |
on() { | |
activeEffectScope = this; | |
} | |
/** | |
* This should only be called on non-detached scopes | |
* @internal | |
*/ | |
off() { | |
activeEffectScope = this.parent; | |
} | |
stop(fromParent) { | |
if (this._active) { | |
let i, l; | |
for (i = 0, l = this.effects.length; i < l; i++) { | |
this.effects[i].stop(); | |
} | |
for (i = 0, l = this.cleanups.length; i < l; i++) { | |
this.cleanups[i](); | |
} | |
if (this.scopes) { | |
for (i = 0, l = this.scopes.length; i < l; i++) { | |
this.scopes[i].stop(true); | |
} | |
} | |
if (!this.detached && this.parent && !fromParent) { | |
const last = this.parent.scopes.pop(); | |
if (last && last !== this) { | |
this.parent.scopes[this.index] = last; | |
last.index = this.index; | |
} | |
} | |
this.parent = void 0; | |
this._active = false; | |
} | |
} | |
} | |
function effectScope(detached) { | |
return new EffectScope(detached); | |
} | |
function recordEffectScope(effect, scope = activeEffectScope) { | |
if (scope && scope.active) { | |
scope.effects.push(effect); | |
} | |
} | |
function getCurrentScope() { | |
return activeEffectScope; | |
} | |
function onScopeDispose(fn) { | |
if (activeEffectScope) { | |
activeEffectScope.cleanups.push(fn); | |
} else { | |
warn( | |
`onScopeDispose() is called when there is no active effect scope to be associated with.` | |
); | |
} | |
} | |
let activeEffect; | |
class ReactiveEffect { | |
constructor(fn, trigger, scheduler, scope) { | |
this.fn = fn; | |
this.trigger = trigger; | |
this.scheduler = scheduler; | |
this.active = true; | |
this.deps = []; | |
/** | |
* @internal | |
*/ | |
this._dirtyLevel = 4; | |
/** | |
* @internal | |
*/ | |
this._trackId = 0; | |
/** | |
* @internal | |
*/ | |
this._runnings = 0; | |
/** | |
* @internal | |
*/ | |
this._shouldSchedule = false; | |
/** | |
* @internal | |
*/ | |
this._depsLength = 0; | |
recordEffectScope(this, scope); | |
} | |
get dirty() { | |
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) { | |
this._dirtyLevel = 1; | |
pauseTracking(); | |
for (let i = 0; i < this._depsLength; i++) { | |
const dep = this.deps[i]; | |
if (dep.computed) { | |
triggerComputed(dep.computed); | |
if (this._dirtyLevel >= 4) { | |
break; | |
} | |
} | |
} | |
if (this._dirtyLevel === 1) { | |
this._dirtyLevel = 0; | |
} | |
resetTracking(); | |
} | |
return this._dirtyLevel >= 4; | |
} | |
set dirty(v) { | |
this._dirtyLevel = v ? 4 : 0; | |
} | |
run() { | |
this._dirtyLevel = 0; | |
if (!this.active) { | |
return this.fn(); | |
} | |
let lastShouldTrack = shouldTrack; | |
let lastEffect = activeEffect; | |
try { | |
shouldTrack = true; | |
activeEffect = this; | |
this._runnings++; | |
preCleanupEffect(this); | |
return this.fn(); | |
} finally { | |
postCleanupEffect(this); | |
this._runnings--; | |
activeEffect = lastEffect; | |
shouldTrack = lastShouldTrack; | |
} | |
} | |
stop() { | |
if (this.active) { | |
preCleanupEffect(this); | |
postCleanupEffect(this); | |
this.onStop && this.onStop(); | |
this.active = false; | |
} | |
} | |
} | |
function triggerComputed(computed) { | |
return computed.value; | |
} | |
function preCleanupEffect(effect2) { | |
effect2._trackId++; | |
effect2._depsLength = 0; | |
} | |
function postCleanupEffect(effect2) { | |
if (effect2.deps.length > effect2._depsLength) { | |
for (let i = effect2._depsLength; i < effect2.deps.length; i++) { | |
cleanupDepEffect(effect2.deps[i], effect2); | |
} | |
effect2.deps.length = effect2._depsLength; | |
} | |
} | |
function cleanupDepEffect(dep, effect2) { | |
const trackId = dep.get(effect2); | |
if (trackId !== void 0 && effect2._trackId !== trackId) { | |
dep.delete(effect2); | |
if (dep.size === 0) { | |
dep.cleanup(); | |
} | |
} | |
} | |
function effect(fn, options) { | |
if (fn.effect instanceof ReactiveEffect) { | |
fn = fn.effect.fn; | |
} | |
const _effect = new ReactiveEffect(fn, NOOP, () => { | |
if (_effect.dirty) { | |
_effect.run(); | |
} | |
}); | |
if (options) { | |
extend(_effect, options); | |
if (options.scope) recordEffectScope(_effect, options.scope); | |
} | |
if (!options || !options.lazy) { | |
_effect.run(); | |
} | |
const runner = _effect.run.bind(_effect); | |
runner.effect = _effect; | |
return runner; | |
} | |
function stop(runner) { | |
runner.effect.stop(); | |
} | |
let shouldTrack = true; | |
let pauseScheduleStack = 0; | |
const trackStack = []; | |
function pauseTracking() { | |
trackStack.push(shouldTrack); | |
shouldTrack = false; | |
} | |
function enableTracking() { | |
trackStack.push(shouldTrack); | |
shouldTrack = true; | |
} | |
function resetTracking() { | |
const last = trackStack.pop(); | |
shouldTrack = last === void 0 ? true : last; | |
} | |
function pauseScheduling() { | |
pauseScheduleStack++; | |
} | |
function resetScheduling() { | |
pauseScheduleStack--; | |
while (!pauseScheduleStack && queueEffectSchedulers.length) { | |
queueEffectSchedulers.shift()(); | |
} | |
} | |
function trackEffect(effect2, dep, debuggerEventExtraInfo) { | |
var _a; | |
if (dep.get(effect2) !== effect2._trackId) { | |
dep.set(effect2, effect2._trackId); | |
const oldDep = effect2.deps[effect2._depsLength]; | |
if (oldDep !== dep) { | |
if (oldDep) { | |
cleanupDepEffect(oldDep, effect2); | |
} | |
effect2.deps[effect2._depsLength++] = dep; | |
} else { | |
effect2._depsLength++; | |
} | |
{ | |
(_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo)); | |
} | |
} | |
} | |
const queueEffectSchedulers = []; | |
function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) { | |
var _a; | |
pauseScheduling(); | |
for (const effect2 of dep.keys()) { | |
let tracking; | |
if (effect2._dirtyLevel < dirtyLevel && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) { | |
effect2._shouldSchedule || (effect2._shouldSchedule = effect2._dirtyLevel === 0); | |
effect2._dirtyLevel = dirtyLevel; | |
} | |
if (effect2._shouldSchedule && (tracking != null ? tracking : tracking = dep.get(effect2) === effect2._trackId)) { | |
{ | |
(_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo)); | |
} | |
effect2.trigger(); | |
if ((!effect2._runnings || effect2.allowRecurse) && effect2._dirtyLevel !== 2) { | |
effect2._shouldSchedule = false; | |
if (effect2.scheduler) { | |
queueEffectSchedulers.push(effect2.scheduler); | |
} | |
} | |
} | |
} | |
resetScheduling(); | |
} | |
const createDep = (cleanup, computed) => { | |
const dep = /* @__PURE__ */ new Map(); | |
dep.cleanup = cleanup; | |
dep.computed = computed; | |
return dep; | |
}; | |
const targetMap = /* @__PURE__ */ new WeakMap(); | |
const ITERATE_KEY = Symbol("iterate" ); | |
const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" ); | |
function track(target, type, key) { | |
if (shouldTrack && activeEffect) { | |
let depsMap = targetMap.get(target); | |
if (!depsMap) { | |
targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); | |
} | |
let dep = depsMap.get(key); | |
if (!dep) { | |
depsMap.set(key, dep = createDep(() => depsMap.delete(key))); | |
} | |
trackEffect( | |
activeEffect, | |
dep, | |
{ | |
target, | |
type, | |
key | |
} | |
); | |
} | |
} | |
function trigger(target, type, key, newValue, oldValue, oldTarget) { | |
const depsMap = targetMap.get(target); | |
if (!depsMap) { | |
return; | |
} | |
let deps = []; | |
if (type === "clear") { | |
deps = [...depsMap.values()]; | |
} else if (key === "length" && isArray(target)) { | |
const newLength = Number(newValue); | |
depsMap.forEach((dep, key2) => { | |
if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) { | |
deps.push(dep); | |
} | |
}); | |
} else { | |
if (key !== void 0) { | |
deps.push(depsMap.get(key)); | |
} | |
switch (type) { | |
case "add": | |
if (!isArray(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
if (isMap(target)) { | |
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); | |
} | |
} else if (isIntegerKey(key)) { | |
deps.push(depsMap.get("length")); | |
} | |
break; | |
case "delete": | |
if (!isArray(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
if (isMap(target)) { | |
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); | |
} | |
} | |
break; | |
case "set": | |
if (isMap(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
} | |
break; | |
} | |
} | |
pauseScheduling(); | |
for (const dep of deps) { | |
if (dep) { | |
triggerEffects( | |
dep, | |
4, | |
{ | |
target, | |
type, | |
key, | |
newValue, | |
oldValue, | |
oldTarget | |
} | |
); | |
} | |
} | |
resetScheduling(); | |
} | |
function getDepFromReactive(object, key) { | |
const depsMap = targetMap.get(object); | |
return depsMap && depsMap.get(key); | |
} | |
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); | |
const builtInSymbols = new Set( | |
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol) | |
); | |
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations(); | |
function createArrayInstrumentations() { | |
const instrumentations = {}; | |
["includes", "indexOf", "lastIndexOf"].forEach((key) => { | |
instrumentations[key] = function(...args) { | |
const arr = toRaw(this); | |
for (let i = 0, l = this.length; i < l; i++) { | |
track(arr, "get", i + ""); | |
} | |
const res = arr[key](...args); | |
if (res === -1 || res === false) { | |
return arr[key](...args.map(toRaw)); | |
} else { | |
return res; | |
} | |
}; | |
}); | |
["push", "pop", "shift", "unshift", "splice"].forEach((key) => { | |
instrumentations[key] = function(...args) { | |
pauseTracking(); | |
pauseScheduling(); | |
const res = toRaw(this)[key].apply(this, args); | |
resetScheduling(); | |
resetTracking(); | |
return res; | |
}; | |
}); | |
return instrumentations; | |
} | |
function hasOwnProperty(key) { | |
if (!isSymbol(key)) key = String(key); | |
const obj = toRaw(this); | |
track(obj, "has", key); | |
return obj.hasOwnProperty(key); | |
} | |
class BaseReactiveHandler { | |
constructor(_isReadonly = false, _isShallow = false) { | |
this._isReadonly = _isReadonly; | |
this._isShallow = _isShallow; | |
} | |
get(target, key, receiver) { | |
const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow; | |
if (key === "__v_isReactive") { | |
return !isReadonly2; | |
} else if (key === "__v_isReadonly") { | |
return isReadonly2; | |
} else if (key === "__v_isShallow") { | |
return isShallow2; | |
} else if (key === "__v_raw") { | |
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype | |
// this means the reciever is a user proxy of the reactive proxy | |
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) { | |
return target; | |
} | |
return; | |
} | |
const targetIsArray = isArray(target); | |
if (!isReadonly2) { | |
if (targetIsArray && hasOwn(arrayInstrumentations, key)) { | |
return Reflect.get(arrayInstrumentations, key, receiver); | |
} | |
if (key === "hasOwnProperty") { | |
return hasOwnProperty; | |
} | |
} | |
const res = Reflect.get(target, key, receiver); | |
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { | |
return res; | |
} | |
if (!isReadonly2) { | |
track(target, "get", key); | |
} | |
if (isShallow2) { | |
return res; | |
} | |
if (isRef(res)) { | |
return targetIsArray && isIntegerKey(key) ? res : res.value; | |
} | |
if (isObject(res)) { | |
return isReadonly2 ? readonly(res) : reactive(res); | |
} | |
return res; | |
} | |
} | |
class MutableReactiveHandler extends BaseReactiveHandler { | |
constructor(isShallow2 = false) { | |
super(false, isShallow2); | |
} | |
set(target, key, value, receiver) { | |
let oldValue = target[key]; | |
if (!this._isShallow) { | |
const isOldValueReadonly = isReadonly(oldValue); | |
if (!isShallow(value) && !isReadonly(value)) { | |
oldValue = toRaw(oldValue); | |
value = toRaw(value); | |
} | |
if (!isArray(target) && isRef(oldValue) && !isRef(value)) { | |
if (isOldValueReadonly) { | |
return false; | |
} else { | |
oldValue.value = value; | |
return true; | |
} | |
} | |
} | |
const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key); | |
const result = Reflect.set(target, key, value, receiver); | |
if (target === toRaw(receiver)) { | |
if (!hadKey) { | |
trigger(target, "add", key, value); | |
} else if (hasChanged(value, oldValue)) { | |
trigger(target, "set", key, value, oldValue); | |
} | |
} | |
return result; | |
} | |
deleteProperty(target, key) { | |
const hadKey = hasOwn(target, key); | |
const oldValue = target[key]; | |
const result = Reflect.deleteProperty(target, key); | |
if (result && hadKey) { | |
trigger(target, "delete", key, void 0, oldValue); | |
} | |
return result; | |
} | |
has(target, key) { | |
const result = Reflect.has(target, key); | |
if (!isSymbol(key) || !builtInSymbols.has(key)) { | |
track(target, "has", key); | |
} | |
return result; | |
} | |
ownKeys(target) { | |
track( | |
target, | |
"iterate", | |
isArray(target) ? "length" : ITERATE_KEY | |
); | |
return Reflect.ownKeys(target); | |
} | |
} | |
class ReadonlyReactiveHandler extends BaseReactiveHandler { | |
constructor(isShallow2 = false) { | |
super(true, isShallow2); | |
} | |
set(target, key) { | |
{ | |
warn( | |
`Set operation on key "${String(key)}" failed: target is readonly.`, | |
target | |
); | |
} | |
return true; | |
} | |
deleteProperty(target, key) { | |
{ | |
warn( | |
`Delete operation on key "${String(key)}" failed: target is readonly.`, | |
target | |
); | |
} | |
return true; | |
} | |
} | |
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler(); | |
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(); | |
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler( | |
true | |
); | |
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true); | |
const toShallow = (value) => value; | |
const getProto = (v) => Reflect.getPrototypeOf(v); | |
function get(target, key, isReadonly2 = false, isShallow2 = false) { | |
target = target["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const rawKey = toRaw(key); | |
if (!isReadonly2) { | |
if (hasChanged(key, rawKey)) { | |
track(rawTarget, "get", key); | |
} | |
track(rawTarget, "get", rawKey); | |
} | |
const { has: has2 } = getProto(rawTarget); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
if (has2.call(rawTarget, key)) { | |
return wrap(target.get(key)); | |
} else if (has2.call(rawTarget, rawKey)) { | |
return wrap(target.get(rawKey)); | |
} else if (target !== rawTarget) { | |
target.get(key); | |
} | |
} | |
function has(key, isReadonly2 = false) { | |
const target = this["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const rawKey = toRaw(key); | |
if (!isReadonly2) { | |
if (hasChanged(key, rawKey)) { | |
track(rawTarget, "has", key); | |
} | |
track(rawTarget, "has", rawKey); | |
} | |
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); | |
} | |
function size(target, isReadonly2 = false) { | |
target = target["__v_raw"]; | |
!isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY); | |
return Reflect.get(target, "size", target); | |
} | |
function add(value, _isShallow = false) { | |
if (!_isShallow && !isShallow(value) && !isReadonly(value)) { | |
value = toRaw(value); | |
} | |
const target = toRaw(this); | |
const proto = getProto(target); | |
const hadKey = proto.has.call(target, value); | |
if (!hadKey) { | |
target.add(value); | |
trigger(target, "add", value, value); | |
} | |
return this; | |
} | |
function set(key, value, _isShallow = false) { | |
if (!_isShallow && !isShallow(value) && !isReadonly(value)) { | |
value = toRaw(value); | |
} | |
const target = toRaw(this); | |
const { has: has2, get: get2 } = getProto(target); | |
let hadKey = has2.call(target, key); | |
if (!hadKey) { | |
key = toRaw(key); | |
hadKey = has2.call(target, key); | |
} else { | |
checkIdentityKeys(target, has2, key); | |
} | |
const oldValue = get2.call(target, key); | |
target.set(key, value); | |
if (!hadKey) { | |
trigger(target, "add", key, value); | |
} else if (hasChanged(value, oldValue)) { | |
trigger(target, "set", key, value, oldValue); | |
} | |
return this; | |
} | |
function deleteEntry(key) { | |
const target = toRaw(this); | |
const { has: has2, get: get2 } = getProto(target); | |
let hadKey = has2.call(target, key); | |
if (!hadKey) { | |
key = toRaw(key); | |
hadKey = has2.call(target, key); | |
} else { | |
checkIdentityKeys(target, has2, key); | |
} | |
const oldValue = get2 ? get2.call(target, key) : void 0; | |
const result = target.delete(key); | |
if (hadKey) { | |
trigger(target, "delete", key, void 0, oldValue); | |
} | |
return result; | |
} | |
function clear() { | |
const target = toRaw(this); | |
const hadItems = target.size !== 0; | |
const oldTarget = isMap(target) ? new Map(target) : new Set(target) ; | |
const result = target.clear(); | |
if (hadItems) { | |
trigger(target, "clear", void 0, void 0, oldTarget); | |
} | |
return result; | |
} | |
function createForEach(isReadonly2, isShallow2) { | |
return function forEach(callback, thisArg) { | |
const observed = this; | |
const target = observed["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
!isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY); | |
return target.forEach((value, key) => { | |
return callback.call(thisArg, wrap(value), wrap(key), observed); | |
}); | |
}; | |
} | |
function createIterableMethod(method, isReadonly2, isShallow2) { | |
return function(...args) { | |
const target = this["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const targetIsMap = isMap(rawTarget); | |
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; | |
const isKeyOnly = method === "keys" && targetIsMap; | |
const innerIterator = target[method](...args); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
!isReadonly2 && track( | |
rawTarget, | |
"iterate", | |
isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY | |
); | |
return { | |
// iterator protocol | |
next() { | |
const { value, done } = innerIterator.next(); | |
return done ? { value, done } : { | |
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), | |
done | |
}; | |
}, | |
// iterable protocol | |
[Symbol.iterator]() { | |
return this; | |
} | |
}; | |
}; | |
} | |
function createReadonlyMethod(type) { | |
return function(...args) { | |
{ | |
const key = args[0] ? `on key "${args[0]}" ` : ``; | |
warn( | |
`${capitalize(type)} operation ${key}failed: target is readonly.`, | |
toRaw(this) | |
); | |
} | |
return type === "delete" ? false : type === "clear" ? void 0 : this; | |
}; | |
} | |
function createInstrumentations() { | |
const mutableInstrumentations2 = { | |
get(key) { | |
return get(this, key); | |
}, | |
get size() { | |
return size(this); | |
}, | |
has, | |
add, | |
set, | |
delete: deleteEntry, | |
clear, | |
forEach: createForEach(false, false) | |
}; | |
const shallowInstrumentations2 = { | |
get(key) { | |
return get(this, key, false, true); | |
}, | |
get size() { | |
return size(this); | |
}, | |
has, | |
add(value) { | |
return add.call(this, value, true); | |
}, | |
set(key, value) { | |
return set.call(this, key, value, true); | |
}, | |
delete: deleteEntry, | |
clear, | |
forEach: createForEach(false, true) | |
}; | |
const readonlyInstrumentations2 = { | |
get(key) { | |
return get(this, key, true); | |
}, | |
get size() { | |
return size(this, true); | |
}, | |
has(key) { | |
return has.call(this, key, true); | |
}, | |
add: createReadonlyMethod("add"), | |
set: createReadonlyMethod("set"), | |
delete: createReadonlyMethod("delete"), | |
clear: createReadonlyMethod("clear"), | |
forEach: createForEach(true, false) | |
}; | |
const shallowReadonlyInstrumentations2 = { | |
get(key) { | |
return get(this, key, true, true); | |
}, | |
get size() { | |
return size(this, true); | |
}, | |
has(key) { | |
return has.call(this, key, true); | |
}, | |
add: createReadonlyMethod("add"), | |
set: createReadonlyMethod("set"), | |
delete: createReadonlyMethod("delete"), | |
clear: createReadonlyMethod("clear"), | |
forEach: createForEach(true, true) | |
}; | |
const iteratorMethods = [ | |
"keys", | |
"values", | |
"entries", | |
Symbol.iterator | |
]; | |
iteratorMethods.forEach((method) => { | |
mutableInstrumentations2[method] = createIterableMethod(method, false, false); | |
readonlyInstrumentations2[method] = createIterableMethod(method, true, false); | |
shallowInstrumentations2[method] = createIterableMethod(method, false, true); | |
shallowReadonlyInstrumentations2[method] = createIterableMethod( | |
method, | |
true, | |
true | |
); | |
}); | |
return [ | |
mutableInstrumentations2, | |
readonlyInstrumentations2, | |
shallowInstrumentations2, | |
shallowReadonlyInstrumentations2 | |
]; | |
} | |
const [ | |
mutableInstrumentations, | |
readonlyInstrumentations, | |
shallowInstrumentations, | |
shallowReadonlyInstrumentations | |
] = /* @__PURE__ */ createInstrumentations(); | |
function createInstrumentationGetter(isReadonly2, shallow) { | |
const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations; | |
return (target, key, receiver) => { | |
if (key === "__v_isReactive") { | |
return !isReadonly2; | |
} else if (key === "__v_isReadonly") { | |
return isReadonly2; | |
} else if (key === "__v_raw") { | |
return target; | |
} | |
return Reflect.get( | |
hasOwn(instrumentations, key) && key in target ? instrumentations : target, | |
key, | |
receiver | |
); | |
}; | |
} | |
const mutableCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(false, false) | |
}; | |
const shallowCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(false, true) | |
}; | |
const readonlyCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(true, false) | |
}; | |
const shallowReadonlyCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(true, true) | |
}; | |
function checkIdentityKeys(target, has2, key) { | |
const rawKey = toRaw(key); | |
if (rawKey !== key && has2.call(target, rawKey)) { | |
const type = toRawType(target); | |
warn( | |
`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.` | |
); | |
} | |
} | |
const reactiveMap = /* @__PURE__ */ new WeakMap(); | |
const shallowReactiveMap = /* @__PURE__ */ new WeakMap(); | |
const readonlyMap = /* @__PURE__ */ new WeakMap(); | |
const shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); | |
function targetTypeMap(rawType) { | |
switch (rawType) { | |
case "Object": | |
case "Array": | |
return 1 /* COMMON */; | |
case "Map": | |
case "Set": | |
case "WeakMap": | |
case "WeakSet": | |
return 2 /* COLLECTION */; | |
default: | |
return 0 /* INVALID */; | |
} | |
} | |
function getTargetType(value) { | |
return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value)); | |
} | |
function reactive(target) { | |
if (isReadonly(target)) { | |
return target; | |
} | |
return createReactiveObject( | |
target, | |
false, | |
mutableHandlers, | |
mutableCollectionHandlers, | |
reactiveMap | |
); | |
} | |
function shallowReactive(target) { | |
return createReactiveObject( | |
target, | |
false, | |
shallowReactiveHandlers, | |
shallowCollectionHandlers, | |
shallowReactiveMap | |
); | |
} | |
function readonly(target) { | |
return createReactiveObject( | |
target, | |
true, | |
readonlyHandlers, | |
readonlyCollectionHandlers, | |
readonlyMap | |
); | |
} | |
function shallowReadonly(target) { | |
return createReactiveObject( | |
target, | |
true, | |
shallowReadonlyHandlers, | |
shallowReadonlyCollectionHandlers, | |
shallowReadonlyMap | |
); | |
} | |
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { | |
if (!isObject(target)) { | |
{ | |
warn( | |
`value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String( | |
target | |
)}` | |
); | |
} | |
return target; | |
} | |
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { | |
return target; | |
} | |
const existingProxy = proxyMap.get(target); | |
if (existingProxy) { | |
return existingProxy; | |
} | |
const targetType = getTargetType(target); | |
if (targetType === 0 /* INVALID */) { | |
return target; | |
} | |
const proxy = new Proxy( | |
target, | |
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers | |
); | |
proxyMap.set(target, proxy); | |
return proxy; | |
} | |
function isReactive(value) { | |
if (isReadonly(value)) { | |
return isReactive(value["__v_raw"]); | |
} | |
return !!(value && value["__v_isReactive"]); | |
} | |
function isReadonly(value) { | |
return !!(value && value["__v_isReadonly"]); | |
} | |
function isShallow(value) { | |
return !!(value && value["__v_isShallow"]); | |
} | |
function isProxy(value) { | |
return value ? !!value["__v_raw"] : false; | |
} | |
function toRaw(observed) { | |
const raw = observed && observed["__v_raw"]; | |
return raw ? toRaw(raw) : observed; | |
} | |
function markRaw(value) { | |
if (Object.isExtensible(value)) { | |
def(value, "__v_skip", true); | |
} | |
return value; | |
} | |
const toReactive = (value) => isObject(value) ? reactive(value) : value; | |
const toReadonly = (value) => isObject(value) ? readonly(value) : value; | |
const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`; | |
class ComputedRefImpl { | |
constructor(getter, _setter, isReadonly, isSSR) { | |
this.getter = getter; | |
this._setter = _setter; | |
this.dep = void 0; | |
this.__v_isRef = true; | |
this["__v_isReadonly"] = false; | |
this.effect = new ReactiveEffect( | |
() => getter(this._value), | |
() => triggerRefValue( | |
this, | |
this.effect._dirtyLevel === 2 ? 2 : 3 | |
) | |
); | |
this.effect.computed = this; | |
this.effect.active = this._cacheable = !isSSR; | |
this["__v_isReadonly"] = isReadonly; | |
} | |
get value() { | |
const self = toRaw(this); | |
if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) { | |
triggerRefValue(self, 4); | |
} | |
trackRefValue(self); | |
if (self.effect._dirtyLevel >= 2) { | |
if (this._warnRecursive) { | |
warn(COMPUTED_SIDE_EFFECT_WARN, ` | |
getter: `, this.getter); | |
} | |
triggerRefValue(self, 2); | |
} | |
return self._value; | |
} | |
set value(newValue) { | |
this._setter(newValue); | |
} | |
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x | |
get _dirty() { | |
return this.effect.dirty; | |
} | |
set _dirty(v) { | |
this.effect.dirty = v; | |
} | |
// #endregion | |
} | |
function computed(getterOrOptions, debugOptions, isSSR = false) { | |
let getter; | |
let setter; | |
const onlyGetter = isFunction(getterOrOptions); | |
if (onlyGetter) { | |
getter = getterOrOptions; | |
setter = () => { | |
warn("Write operation failed: computed value is readonly"); | |
} ; | |
} else { | |
getter = getterOrOptions.get; | |
setter = getterOrOptions.set; | |
} | |
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR); | |
if (debugOptions && !isSSR) { | |
cRef.effect.onTrack = debugOptions.onTrack; | |
cRef.effect.onTrigger = debugOptions.onTrigger; | |
} | |
return cRef; | |
} | |
function trackRefValue(ref2) { | |
var _a; | |
if (shouldTrack && activeEffect) { | |
ref2 = toRaw(ref2); | |
trackEffect( | |
activeEffect, | |
(_a = ref2.dep) != null ? _a : ref2.dep = createDep( | |
() => ref2.dep = void 0, | |
ref2 instanceof ComputedRefImpl ? ref2 : void 0 | |
), | |
{ | |
target: ref2, | |
type: "get", | |
key: "value" | |
} | |
); | |
} | |
} | |
function triggerRefValue(ref2, dirtyLevel = 4, newVal, oldVal) { | |
ref2 = toRaw(ref2); | |
const dep = ref2.dep; | |
if (dep) { | |
triggerEffects( | |
dep, | |
dirtyLevel, | |
{ | |
target: ref2, | |
type: "set", | |
key: "value", | |
newValue: newVal, | |
oldValue: oldVal | |
} | |
); | |
} | |
} | |
function isRef(r) { | |
return !!(r && r.__v_isRef === true); | |
} | |
function ref(value) { | |
return createRef(value, false); | |
} | |
function shallowRef(value) { | |
return createRef(value, true); | |
} | |
function createRef(rawValue, shallow) { | |
if (isRef(rawValue)) { | |
return rawValue; | |
} | |
return new RefImpl(rawValue, shallow); | |
} | |
class RefImpl { | |
constructor(value, __v_isShallow) { | |
this.__v_isShallow = __v_isShallow; | |
this.dep = void 0; | |
this.__v_isRef = true; | |
this._rawValue = __v_isShallow ? value : toRaw(value); | |
this._value = __v_isShallow ? value : toReactive(value); | |
} | |
get value() { | |
trackRefValue(this); | |
return this._value; | |
} | |
set value(newVal) { | |
const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal); | |
newVal = useDirectValue ? newVal : toRaw(newVal); | |
if (hasChanged(newVal, this._rawValue)) { | |
const oldVal = this._rawValue; | |
this._rawValue = newVal; | |
this._value = useDirectValue ? newVal : toReactive(newVal); | |
triggerRefValue(this, 4, newVal, oldVal); | |
} | |
} | |
} | |
function triggerRef(ref2) { | |
triggerRefValue(ref2, 4, ref2.value ); | |
} | |
function unref(ref2) { | |
return isRef(ref2) ? ref2.value : ref2; | |
} | |
function toValue(source) { | |
return isFunction(source) ? source() : unref(source); | |
} | |
const shallowUnwrapHandlers = { | |
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)), | |
set: (target, key, value, receiver) => { | |
const oldValue = target[key]; | |
if (isRef(oldValue) && !isRef(value)) { | |
oldValue.value = value; | |
return true; | |
} else { | |
return Reflect.set(target, key, value, receiver); | |
} | |
} | |
}; | |
function proxyRefs(objectWithRefs) { | |
return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers); | |
} | |
class CustomRefImpl { | |
constructor(factory) { | |
this.dep = void 0; | |
this.__v_isRef = true; | |
const { get, set } = factory( | |
() => trackRefValue(this), | |
() => triggerRefValue(this) | |
); | |
this._get = get; | |
this._set = set; | |
} | |
get value() { | |
return this._get(); | |
} | |
set value(newVal) { | |
this._set(newVal); | |
} | |
} | |
function customRef(factory) { | |
return new CustomRefImpl(factory); | |
} | |
function toRefs(object) { | |
if (!isProxy(object)) { | |
warn(`toRefs() expects a reactive object but received a plain one.`); | |
} | |
const ret = isArray(object) ? new Array(object.length) : {}; | |
for (const key in object) { | |
ret[key] = propertyToRef(object, key); | |
} | |
return ret; | |
} | |
class ObjectRefImpl { | |
constructor(_object, _key, _defaultValue) { | |
this._object = _object; | |
this._key = _key; | |
this._defaultValue = _defaultValue; | |
this.__v_isRef = true; | |
} | |
get value() { | |
const val = this._object[this._key]; | |
return val === void 0 ? this._defaultValue : val; | |
} | |
set value(newVal) { | |
this._object[this._key] = newVal; | |
} | |
get dep() { | |
return getDepFromReactive(toRaw(this._object), this._key); | |
} | |
} | |
class GetterRefImpl { | |
constructor(_getter) { | |
this._getter = _getter; | |
this.__v_isRef = true; | |
this.__v_isReadonly = true; | |
} | |
get value() { | |
return this._getter(); | |
} | |
} | |
function toRef(source, key, defaultValue) { | |
if (isRef(source)) { | |
return source; | |
} else if (isFunction(source)) { | |
return new GetterRefImpl(source); | |
} else if (isObject(source) && arguments.length > 1) { | |
return propertyToRef(source, key, defaultValue); | |
} else { | |
return ref(source); | |
} | |
} | |
function propertyToRef(source, key, defaultValue) { | |
const val = source[key]; | |
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue); | |
} | |
const deferredComputed = computed; | |
const TrackOpTypes = { | |
"GET": "get", | |
"HAS": "has", | |
"ITERATE": "iterate" | |
}; | |
const TriggerOpTypes = { | |
"SET": "set", | |
"ADD": "add", | |
"DELETE": "delete", | |
"CLEAR": "clear" | |
}; | |
const ReactiveFlags = { | |
"SKIP": "__v_skip", | |
"IS_REACTIVE": "__v_isReactive", | |
"IS_READONLY": "__v_isReadonly", | |
"IS_SHALLOW": "__v_isShallow", | |
"RAW": "__v_raw" | |
}; | |
exports.EffectScope = EffectScope; | |
exports.ITERATE_KEY = ITERATE_KEY; | |
exports.ReactiveEffect = ReactiveEffect; | |
exports.ReactiveFlags = ReactiveFlags; | |
exports.TrackOpTypes = TrackOpTypes; | |
exports.TriggerOpTypes = TriggerOpTypes; | |
exports.computed = computed; | |
exports.customRef = customRef; | |
exports.deferredComputed = deferredComputed; | |
exports.effect = effect; | |
exports.effectScope = effectScope; | |
exports.enableTracking = enableTracking; | |
exports.getCurrentScope = getCurrentScope; | |
exports.isProxy = isProxy; | |
exports.isReactive = isReactive; | |
exports.isReadonly = isReadonly; | |
exports.isRef = isRef; | |
exports.isShallow = isShallow; | |
exports.markRaw = markRaw; | |
exports.onScopeDispose = onScopeDispose; | |
exports.pauseScheduling = pauseScheduling; | |
exports.pauseTracking = pauseTracking; | |
exports.proxyRefs = proxyRefs; | |
exports.reactive = reactive; | |
exports.readonly = readonly; | |
exports.ref = ref; | |
exports.resetScheduling = resetScheduling; | |
exports.resetTracking = resetTracking; | |
exports.shallowReactive = shallowReactive; | |
exports.shallowReadonly = shallowReadonly; | |
exports.shallowRef = shallowRef; | |
exports.stop = stop; | |
exports.toRaw = toRaw; | |
exports.toRef = toRef; | |
exports.toRefs = toRefs; | |
exports.toValue = toValue; | |
exports.track = track; | |
exports.trigger = trigger; | |
exports.triggerRef = triggerRef; | |
exports.unref = unref; | |
return exports; | |
})({}); | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/reactivity/dist/reactivity.d.ts === | |
import { IfAny } from '@vue/shared'; | |
export declare enum TrackOpTypes { | |
GET = "get", | |
HAS = "has", | |
ITERATE = "iterate" | |
} | |
export declare enum TriggerOpTypes { | |
SET = "set", | |
ADD = "add", | |
DELETE = "delete", | |
CLEAR = "clear" | |
} | |
export declare enum ReactiveFlags { | |
SKIP = "__v_skip", | |
IS_REACTIVE = "__v_isReactive", | |
IS_READONLY = "__v_isReadonly", | |
IS_SHALLOW = "__v_isShallow", | |
RAW = "__v_raw" | |
} | |
type Dep = Map<ReactiveEffect, number> & { | |
cleanup: () => void; | |
computed?: ComputedRefImpl<any>; | |
}; | |
export declare class EffectScope { | |
detached: boolean; | |
constructor(detached?: boolean); | |
get active(): boolean; | |
run<T>(fn: () => T): T | undefined; | |
stop(fromParent?: boolean): void; | |
} | |
/** | |
* Creates an effect scope object which can capture the reactive effects (i.e. | |
* computed and watchers) created within it so that these effects can be | |
* disposed together. For detailed use cases of this API, please consult its | |
* corresponding {@link https://github.com/vuejs/rfcs/blob/master/active-rfcs/0041-reactivity-effect-scope.md | RFC}. | |
* | |
* @param detached - Can be used to create a "detached" effect scope. | |
* @see {@link https://vuejs.org/api/reactivity-advanced.html#effectscope} | |
*/ | |
export declare function effectScope(detached?: boolean): EffectScope; | |
/** | |
* Returns the current active effect scope if there is one. | |
* | |
* @see {@link https://vuejs.org/api/reactivity-advanced.html#getcurrentscope} | |
*/ | |
export declare function getCurrentScope(): EffectScope | undefined; | |
/** | |
* Registers a dispose callback on the current active effect scope. The | |
* callback will be invoked when the associated effect scope is stopped. | |
* | |
* @param fn - The callback function to attach to the scope's cleanup. | |
* @see {@link https://vuejs.org/api/reactivity-advanced.html#onscopedispose} | |
*/ | |
export declare function onScopeDispose(fn: () => void): void; | |
export type EffectScheduler = (...args: any[]) => any; | |
export type DebuggerEvent = { | |
effect: ReactiveEffect; | |
} & DebuggerEventExtraInfo; | |
export type DebuggerEventExtraInfo = { | |
target: object; | |
type: TrackOpTypes | TriggerOpTypes; | |
key: any; | |
newValue?: any; | |
oldValue?: any; | |
oldTarget?: Map<any, any> | Set<any>; | |
}; | |
export declare class ReactiveEffect<T = any> { | |
fn: () => T; | |
trigger: () => void; | |
scheduler?: EffectScheduler | undefined; | |
active: boolean; | |
deps: Dep[]; | |
onStop?: () => void; | |
onTrack?: (event: DebuggerEvent) => void; | |
onTrigger?: (event: DebuggerEvent) => void; | |
constructor(fn: () => T, trigger: () => void, scheduler?: EffectScheduler | undefined, scope?: EffectScope); | |
get dirty(): boolean; | |
set dirty(v: boolean); | |
run(): T; | |
stop(): void; | |
} | |
export interface DebuggerOptions { | |
onTrack?: (event: DebuggerEvent) => void; | |
onTrigger?: (event: DebuggerEvent) => void; | |
} | |
export interface ReactiveEffectOptions extends DebuggerOptions { | |
lazy?: boolean; | |
scheduler?: EffectScheduler; | |
scope?: EffectScope; | |
allowRecurse?: boolean; | |
onStop?: () => void; | |
} | |
export interface ReactiveEffectRunner<T = any> { | |
(): T; | |
effect: ReactiveEffect; | |
} | |
/** | |
* Registers the given function to track reactive updates. | |
* | |
* The given function will be run once immediately. Every time any reactive | |
* property that's accessed within it gets updated, the function will run again. | |
* | |
* @param fn - The function that will track reactive updates. | |
* @param options - Allows to control the effect's behaviour. | |
* @returns A runner that can be used to control the effect after creation. | |
*/ | |
export declare function effect<T = any>(fn: () => T, options?: ReactiveEffectOptions): ReactiveEffectRunner; | |
/** | |
* Stops the effect associated with the given runner. | |
* | |
* @param runner - Association with the effect to stop tracking. | |
*/ | |
export declare function stop(runner: ReactiveEffectRunner): void; | |
/** | |
* Temporarily pauses tracking. | |
*/ | |
export declare function pauseTracking(): void; | |
/** | |
* Re-enables effect tracking (if it was paused). | |
*/ | |
export declare function enableTracking(): void; | |
/** | |
* Resets the previous global effect tracking state. | |
*/ | |
export declare function resetTracking(): void; | |
export declare function pauseScheduling(): void; | |
export declare function resetScheduling(): void; | |
declare const ComputedRefSymbol: unique symbol; | |
export interface ComputedRef<T = any> extends WritableComputedRef<T> { | |
readonly value: T; | |
[ComputedRefSymbol]: true; | |
} | |
export interface WritableComputedRef<T> extends Ref<T> { | |
readonly effect: ReactiveEffect<T>; | |
} | |
export type ComputedGetter<T> = (oldValue?: T) => T; | |
export type ComputedSetter<T> = (newValue: T) => void; | |
export interface WritableComputedOptions<T> { | |
get: ComputedGetter<T>; | |
set: ComputedSetter<T>; | |
} | |
export declare class ComputedRefImpl<T> { | |
private getter; | |
private readonly _setter; | |
dep?: Dep; | |
private _value; | |
readonly effect: ReactiveEffect<T>; | |
readonly __v_isRef = true; | |
readonly [ReactiveFlags.IS_READONLY]: boolean; | |
_cacheable: boolean; | |
/** | |
* Dev only | |
*/ | |
_warnRecursive?: boolean; | |
constructor(getter: ComputedGetter<T>, _setter: ComputedSetter<T>, isReadonly: boolean, isSSR: boolean); | |
get value(): T; | |
set value(newValue: T); | |
get _dirty(): boolean; | |
set _dirty(v: boolean); | |
} | |
/** | |
* Takes a getter function and returns a readonly reactive ref object for the | |
* returned value from the getter. It can also take an object with get and set | |
* functions to create a writable ref object. | |
* | |
* @example | |
* ```js | |
* // Creating a readonly computed ref: | |
* const count = ref(1) | |
* const plusOne = computed(() => count.value + 1) | |
* | |
* console.log(plusOne.value) // 2 | |
* plusOne.value++ // error | |
* ``` | |
* | |
* ```js | |
* // Creating a writable computed ref: | |
* const count = ref(1) | |
* const plusOne = computed({ | |
* get: () => count.value + 1, | |
* set: (val) => { | |
* count.value = val - 1 | |
* } | |
* }) | |
* | |
* plusOne.value = 1 | |
* console.log(count.value) // 0 | |
* ``` | |
* | |
* @param getter - Function that produces the next value. | |
* @param debugOptions - For debugging. See {@link https://vuejs.org/guide/extras/reactivity-in-depth.html#computed-debugging}. | |
* @see {@link https://vuejs.org/api/reactivity-core.html#computed} | |
*/ | |
export declare function computed<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions): ComputedRef<T>; | |
export declare function computed<T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions): WritableComputedRef<T>; | |
export type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>; | |
declare const ReactiveMarkerSymbol: unique symbol; | |
export declare class ReactiveMarker { | |
private [ReactiveMarkerSymbol]?; | |
} | |
export type Reactive<T> = UnwrapNestedRefs<T> & (T extends readonly any[] ? ReactiveMarker : {}); | |
/** | |
* Returns a reactive proxy of the object. | |
* | |
* The reactive conversion is "deep": it affects all nested properties. A | |
* reactive object also deeply unwraps any properties that are refs while | |
* maintaining reactivity. | |
* | |
* @example | |
* ```js | |
* const obj = reactive({ count: 0 }) | |
* ``` | |
* | |
* @param target - The source object. | |
* @see {@link https://vuejs.org/api/reactivity-core.html#reactive} | |
*/ | |
export declare function reactive<T extends object>(target: T): Reactive<T>; | |
declare const ShallowReactiveMarker: unique symbol; | |
export type ShallowReactive<T> = T & { | |
[ShallowReactiveMarker]?: true; | |
}; | |
/** | |
* Shallow version of {@link reactive()}. | |
* | |
* Unlike {@link reactive()}, there is no deep conversion: only root-level | |
* properties are reactive for a shallow reactive object. Property values are | |
* stored and exposed as-is - this also means properties with ref values will | |
* not be automatically unwrapped. | |
* | |
* @example | |
* ```js | |
* const state = shallowReactive({ | |
* foo: 1, | |
* nested: { | |
* bar: 2 | |
* } | |
* }) | |
* | |
* // mutating state's own properties is reactive | |
* state.foo++ | |
* | |
* // ...but does not convert nested objects | |
* isReactive(state.nested) // false | |
* | |
* // NOT reactive | |
* state.nested.bar++ | |
* ``` | |
* | |
* @param target - The source object. | |
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreactive} | |
*/ | |
export declare function shallowReactive<T extends object>(target: T): ShallowReactive<T>; | |
type Primitive = string | number | boolean | bigint | symbol | undefined | null; | |
type Builtin = Primitive | Function | Date | Error | RegExp; | |
export type DeepReadonly<T> = T extends Builtin ? T : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends WeakMap<infer K, infer V> ? WeakMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends WeakSet<infer U> ? WeakSet<DeepReadonly<U>> : T extends Promise<infer U> ? Promise<DeepReadonly<U>> : T extends Ref<infer U> ? Readonly<Ref<DeepReadonly<U>>> : T extends {} ? { | |
readonly [K in keyof T]: DeepReadonly<T[K]>; | |
} : Readonly<T>; | |
/** | |
* Takes an object (reactive or plain) or a ref and returns a readonly proxy to | |
* the original. | |
* | |
* A readonly proxy is deep: any nested property accessed will be readonly as | |
* well. It also has the same ref-unwrapping behavior as {@link reactive()}, | |
* except the unwrapped values will also be made readonly. | |
* | |
* @example | |
* ```js | |
* const original = reactive({ count: 0 }) | |
* | |
* const copy = readonly(original) | |
* | |
* watchEffect(() => { | |
* // works for reactivity tracking | |
* console.log(copy.count) | |
* }) | |
* | |
* // mutating original will trigger watchers relying on the copy | |
* original.count++ | |
* | |
* // mutating the copy will fail and result in a warning | |
* copy.count++ // warning! | |
* ``` | |
* | |
* @param target - The source object. | |
* @see {@link https://vuejs.org/api/reactivity-core.html#readonly} | |
*/ | |
export declare function readonly<T extends object>(target: T): DeepReadonly<UnwrapNestedRefs<T>>; | |
/** | |
* Shallow version of {@link readonly()}. | |
* | |
* Unlike {@link readonly()}, there is no deep conversion: only root-level | |
* properties are made readonly. Property values are stored and exposed as-is - | |
* this also means properties with ref values will not be automatically | |
* unwrapped. | |
* | |
* @example | |
* ```js | |
* const state = shallowReadonly({ | |
* foo: 1, | |
* nested: { | |
* bar: 2 | |
* } | |
* }) | |
* | |
* // mutating state's own properties will fail | |
* state.foo++ | |
* | |
* // ...but works on nested objects | |
* isReadonly(state.nested) // false | |
* | |
* // works | |
* state.nested.bar++ | |
* ``` | |
* | |
* @param target - The source object. | |
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreadonly} | |
*/ | |
export declare function shallowReadonly<T extends object>(target: T): Readonly<T>; | |
/** | |
* Checks if an object is a proxy created by {@link reactive()} or | |
* {@link shallowReactive()} (or {@link ref()} in some cases). | |
* | |
* @example | |
* ```js | |
* isReactive(reactive({})) // => true | |
* isReactive(readonly(reactive({}))) // => true | |
* isReactive(ref({}).value) // => true | |
* isReactive(readonly(ref({})).value) // => true | |
* isReactive(ref(true)) // => false | |
* isReactive(shallowRef({}).value) // => false | |
* isReactive(shallowReactive({})) // => true | |
* ``` | |
* | |
* @param value - The value to check. | |
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreactive} | |
*/ | |
export declare function isReactive(value: unknown): boolean; | |
/** | |
* Checks whether the passed value is a readonly object. The properties of a | |
* readonly object can change, but they can't be assigned directly via the | |
* passed object. | |
* | |
* The proxies created by {@link readonly()} and {@link shallowReadonly()} are | |
* both considered readonly, as is a computed ref without a set function. | |
* | |
* @param value - The value to check. | |
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreadonly} | |
*/ | |
export declare function isReadonly(value: unknown): boolean; | |
export declare function isShallow(value: unknown): boolean; | |
/** | |
* Checks if an object is a proxy created by {@link reactive}, | |
* {@link readonly}, {@link shallowReactive} or {@link shallowReadonly()}. | |
* | |
* @param value - The value to check. | |
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy} | |
*/ | |
export declare function isProxy(value: any): boolean; | |
/** | |
* Returns the raw, original object of a Vue-created proxy. | |
* | |
* `toRaw()` can return the original object from proxies created by | |
* {@link reactive()}, {@link readonly()}, {@link shallowReactive()} or | |
* {@link shallowReadonly()}. | |
* | |
* This is an escape hatch that can be used to temporarily read without | |
* incurring proxy access / tracking overhead or write without triggering | |
* changes. It is **not** recommended to hold a persistent reference to the | |
* original object. Use with caution. | |
* | |
* @example | |
* ```js | |
* const foo = {} | |
* const reactiveFoo = reactive(foo) | |
* | |
* console.log(toRaw(reactiveFoo) === foo) // true | |
* ``` | |
* | |
* @param observed - The object for which the "raw" value is requested. | |
* @see {@link https://vuejs.org/api/reactivity-advanced.html#toraw} | |
*/ | |
export declare function toRaw<T>(observed: T): T; | |
export type Raw<T> = T & { | |
[RawSymbol]?: true; | |
}; | |
/** | |
* Marks an object so that it will never be converted to a proxy. Returns the | |
* object itself. | |
* | |
* @example | |
* ```js | |
* const foo = markRaw({}) | |
* console.log(isReactive(reactive(foo))) // false | |
* | |
* // also works when nested inside other reactive objects | |
* const bar = reactive({ foo }) | |
* console.log(isReactive(bar.foo)) // false | |
* ``` | |
* | |
* **Warning:** `markRaw()` together with the shallow APIs such as | |
* {@link shallowReactive()} allow you to selectively opt-out of the default | |
* deep reactive/readonly conversion and embed raw, non-proxied objects in your | |
* state graph. | |
* | |
* @param value - The object to be marked as "raw". | |
* @see {@link https://vuejs.org/api/reactivity-advanced.html#markraw} | |
*/ | |
export declare function markRaw<T extends object>(value: T): Raw<T>; | |
declare const RefSymbol: unique symbol; | |
declare const RawSymbol: unique symbol; | |
export interface Ref<T = any, S = T> { | |
get value(): T; | |
set value(_: S); | |
/** | |
* Type differentiator only. | |
* We need this to be in public d.ts but don't want it to show up in IDE | |
* autocomplete, so we use a private Symbol instead. | |
*/ | |
[RefSymbol]: true; | |
} | |
/** | |
* Checks if a value is a ref object. | |
* | |
* @param r - The value to inspect. | |
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isref} | |
*/ | |
export declare function isRef<T>(r: Ref<T> | unknown): r is Ref<T>; | |
/** | |
* Takes an inner value and returns a reactive and mutable ref object, which | |
* has a single property `.value` that points to the inner value. | |
* | |
* @param value - The object to wrap in the ref. | |
* @see {@link https://vuejs.org/api/reactivity-core.html#ref} | |
*/ | |
export declare function ref<T>(value: T): Ref<UnwrapRef<T>, UnwrapRef<T> | T>; | |
export declare function ref<T = any>(): Ref<T | undefined>; | |
declare const ShallowRefMarker: unique symbol; | |
export type ShallowRef<T = any> = Ref<T> & { | |
[ShallowRefMarker]?: true; | |
}; | |
/** | |
* Shallow version of {@link ref()}. | |
* | |
* @example | |
* ```js | |
* const state = shallowRef({ count: 1 }) | |
* | |
* // does NOT trigger change | |
* state.value.count = 2 | |
* | |
* // does trigger change | |
* state.value = { count: 2 } | |
* ``` | |
* | |
* @param value - The "inner value" for the shallow ref. | |
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowref} | |
*/ | |
export declare function shallowRef<T>(value: T): Ref extends T ? T extends Ref ? IfAny<T, ShallowRef<T>, T> : ShallowRef<T> : ShallowRef<T>; | |
export declare function shallowRef<T = any>(): ShallowRef<T | undefined>; | |
/** | |
* Force trigger effects that depends on a shallow ref. This is typically used | |
* after making deep mutations to the inner value of a shallow ref. | |
* | |
* @example | |
* ```js | |
* const shallow = shallowRef({ | |
* greet: 'Hello, world' | |
* }) | |
* | |
* // Logs "Hello, world" once for the first run-through | |
* watchEffect(() => { | |
* console.log(shallow.value.greet) | |
* }) | |
* | |
* // This won't trigger the effect because the ref is shallow | |
* shallow.value.greet = 'Hello, universe' | |
* | |
* // Logs "Hello, universe" | |
* triggerRef(shallow) | |
* ``` | |
* | |
* @param ref - The ref whose tied effects shall be executed. | |
* @see {@link https://vuejs.org/api/reactivity-advanced.html#triggerref} | |
*/ | |
export declare function triggerRef(ref: Ref): void; | |
export type MaybeRef<T = any> = T | Ref<T>; | |
export type MaybeRefOrGetter<T = any> = MaybeRef<T> | (() => T); | |
/** | |
* Returns the inner value if the argument is a ref, otherwise return the | |
* argument itself. This is a sugar function for | |
* `val = isRef(val) ? val.value : val`. | |
* | |
* @example | |
* ```js | |
* function useFoo(x: number | Ref<number>) { | |
* const unwrapped = unref(x) | |
* // unwrapped is guaranteed to be number now | |
* } | |
* ``` | |
* | |
* @param ref - Ref or plain value to be converted into the plain value. | |
* @see {@link https://vuejs.org/api/reactivity-utilities.html#unref} | |
*/ | |
export declare function unref<T>(ref: MaybeRef<T> | ComputedRef<T> | ShallowRef<T>): T; | |
/** | |
* Normalizes values / refs / getters to values. | |
* This is similar to {@link unref()}, except that it also normalizes getters. | |
* If the argument is a getter, it will be invoked and its return value will | |
* be returned. | |
* | |
* @example | |
* ```js | |
* toValue(1) // 1 | |
* toValue(ref(1)) // 1 | |
* toValue(() => 1) // 1 | |
* ``` | |
* | |
* @param source - A getter, an existing ref, or a non-function value. | |
* @see {@link https://vuejs.org/api/reactivity-utilities.html#tovalue} | |
*/ | |
export declare function toValue<T>(source: MaybeRefOrGetter<T> | ComputedRef<T> | ShallowRef<T>): T; | |
/** | |
* Returns a reactive proxy for the given object. | |
* | |
* If the object already is reactive, it's returned as-is. If not, a new | |
* reactive proxy is created. Direct child properties that are refs are properly | |
* handled, as well. | |
* | |
* @param objectWithRefs - Either an already-reactive object or a simple object | |
* that contains refs. | |
*/ | |
export declare function proxyRefs<T extends object>(objectWithRefs: T): ShallowUnwrapRef<T>; | |
export type CustomRefFactory<T> = (track: () => void, trigger: () => void) => { | |
get: () => T; | |
set: (value: T) => void; | |
}; | |
/** | |
* Creates a customized ref with explicit control over its dependency tracking | |
* and updates triggering. | |
* | |
* @param factory - The function that receives the `track` and `trigger` callbacks. | |
* @see {@link https://vuejs.org/api/reactivity-advanced.html#customref} | |
*/ | |
export declare function customRef<T>(factory: CustomRefFactory<T>): Ref<T>; | |
export type ToRefs<T = any> = { | |
[K in keyof T]: ToRef<T[K]>; | |
}; | |
/** | |
* Converts a reactive object to a plain object where each property of the | |
* resulting object is a ref pointing to the corresponding property of the | |
* original object. Each individual ref is created using {@link toRef()}. | |
* | |
* @param object - Reactive object to be made into an object of linked refs. | |
* @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs} | |
*/ | |
export declare function toRefs<T extends object>(object: T): ToRefs<T>; | |
export type ToRef<T> = IfAny<T, Ref<T>, [T] extends [Ref] ? T : Ref<T>>; | |
/** | |
* Used to normalize values / refs / getters into refs. | |
* | |
* @example | |
* ```js | |
* // returns existing refs as-is | |
* toRef(existingRef) | |
* | |
* // creates a ref that calls the getter on .value access | |
* toRef(() => props.foo) | |
* | |
* // creates normal refs from non-function values | |
* // equivalent to ref(1) | |
* toRef(1) | |
* ``` | |
* | |
* Can also be used to create a ref for a property on a source reactive object. | |
* The created ref is synced with its source property: mutating the source | |
* property will update the ref, and vice-versa. | |
* | |
* @example | |
* ```js | |
* const state = reactive({ | |
* foo: 1, | |
* bar: 2 | |
* }) | |
* | |
* const fooRef = toRef(state, 'foo') | |
* | |
* // mutating the ref updates the original | |
* fooRef.value++ | |
* console.log(state.foo) // 2 | |
* | |
* // mutating the original also updates the ref | |
* state.foo++ | |
* console.log(fooRef.value) // 3 | |
* ``` | |
* | |
* @param source - A getter, an existing ref, a non-function value, or a | |
* reactive object to create a property ref from. | |
* @param [key] - (optional) Name of the property in the reactive object. | |
* @see {@link https://vuejs.org/api/reactivity-utilities.html#toref} | |
*/ | |
export declare function toRef<T>(value: T): T extends () => infer R ? Readonly<Ref<R>> : T extends Ref ? T : Ref<UnwrapRef<T>>; | |
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>; | |
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<Exclude<T[K], undefined>>; | |
/** | |
* This is a special exported interface for other packages to declare | |
* additional types that should bail out for ref unwrapping. For example | |
* \@vue/runtime-dom can declare it like so in its d.ts: | |
* | |
* ``` ts | |
* declare module '@vue/reactivity' { | |
* export interface RefUnwrapBailTypes { | |
* runtimeDOMBailTypes: Node | Window | |
* } | |
* } | |
* ``` | |
*/ | |
export interface RefUnwrapBailTypes { | |
} | |
export type ShallowUnwrapRef<T> = { | |
[K in keyof T]: DistributeRef<T[K]>; | |
}; | |
type DistributeRef<T> = T extends Ref<infer V> ? V : T; | |
export type UnwrapRef<T> = T extends ShallowRef<infer V> ? V : T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>; | |
type UnwrapRefSimple<T> = T extends Builtin | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | { | |
[RawSymbol]?: true; | |
} ? T : T extends Map<infer K, infer V> ? Map<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Map<any, any>>> : T extends WeakMap<infer K, infer V> ? WeakMap<K, UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakMap<any, any>>> : T extends Set<infer V> ? Set<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof Set<any>>> : T extends WeakSet<infer V> ? WeakSet<UnwrapRefSimple<V>> & UnwrapRef<Omit<T, keyof WeakSet<any>>> : T extends ReadonlyArray<any> ? { | |
[K in keyof T]: UnwrapRefSimple<T[K]>; | |
} : T extends object & { | |
[ShallowReactiveMarker]?: never; | |
} ? { | |
[P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>; | |
} : T; | |
/** | |
* @deprecated use `computed` instead. See #5912 | |
*/ | |
export declare const deferredComputed: typeof computed; | |
export declare const ITERATE_KEY: unique symbol; | |
/** | |
* Tracks access to a reactive property. | |
* | |
* This will check which effect is running at the moment and record it as dep | |
* which records all effects that depend on the reactive property. | |
* | |
* @param target - Object holding the reactive property. | |
* @param type - Defines the type of access to the reactive property. | |
* @param key - Identifier of the reactive property to track. | |
*/ | |
export declare function track(target: object, type: TrackOpTypes, key: unknown): void; | |
/** | |
* Finds all deps associated with the target (or a specific property) and | |
* triggers the effects stored within. | |
* | |
* @param target - The reactive object. | |
* @param type - Defines the type of the operation that needs to trigger effects. | |
* @param key - Can be used to target a specific reactive property in the target object. | |
*/ | |
export declare function trigger(target: object, type: TriggerOpTypes, key?: unknown, newValue?: unknown, oldValue?: unknown, oldTarget?: Map<unknown, unknown> | Set<unknown>): void; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/runtime-dom/node_modules/@vue/shared/index.js === | |
'use strict' | |
if (process.env.NODE_ENV === 'production') { | |
module.exports = require('./dist/shared.cjs.prod.js') | |
} else { | |
module.exports = require('./dist/shared.cjs.js') | |
} | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/runtime-dom/node_modules/@vue/shared/dist/shared.esm-bundler.js === | |
/** | |
* @vue/shared v3.4.35 | |
* (c) 2018-present Yuxi (Evan) You and Vue contributors | |
* @license MIT | |
**/ | |
/*! #__NO_SIDE_EFFECTS__ */ | |
// @__NO_SIDE_EFFECTS__ | |
function makeMap(str, expectsLowerCase) { | |
const set = new Set(str.split(",")); | |
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val); | |
} | |
const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {}; | |
const EMPTY_ARR = !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : []; | |
const NOOP = () => { | |
}; | |
const NO = () => false; | |
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter | |
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); | |
const isModelListener = (key) => key.startsWith("onUpdate:"); | |
const extend = Object.assign; | |
const remove = (arr, el) => { | |
const i = arr.indexOf(el); | |
if (i > -1) { | |
arr.splice(i, 1); | |
} | |
}; | |
const hasOwnProperty = Object.prototype.hasOwnProperty; | |
const hasOwn = (val, key) => hasOwnProperty.call(val, key); | |
const isArray = Array.isArray; | |
const isMap = (val) => toTypeString(val) === "[object Map]"; | |
const isSet = (val) => toTypeString(val) === "[object Set]"; | |
const isDate = (val) => toTypeString(val) === "[object Date]"; | |
const isRegExp = (val) => toTypeString(val) === "[object RegExp]"; | |
const isFunction = (val) => typeof val === "function"; | |
const isString = (val) => typeof val === "string"; | |
const isSymbol = (val) => typeof val === "symbol"; | |
const isObject = (val) => val !== null && typeof val === "object"; | |
const isPromise = (val) => { | |
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); | |
}; | |
const objectToString = Object.prototype.toString; | |
const toTypeString = (value) => objectToString.call(value); | |
const toRawType = (value) => { | |
return toTypeString(value).slice(8, -1); | |
}; | |
const isPlainObject = (val) => toTypeString(val) === "[object Object]"; | |
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; | |
const isReservedProp = /* @__PURE__ */ makeMap( | |
// the leading comma is intentional so empty string "" is also included | |
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" | |
); | |
const isBuiltInDirective = /* @__PURE__ */ makeMap( | |
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo" | |
); | |
const cacheStringFunction = (fn) => { | |
const cache = /* @__PURE__ */ Object.create(null); | |
return (str) => { | |
const hit = cache[str]; | |
return hit || (cache[str] = fn(str)); | |
}; | |
}; | |
const camelizeRE = /-(\w)/g; | |
const camelize = cacheStringFunction((str) => { | |
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); | |
}); | |
const hyphenateRE = /\B([A-Z])/g; | |
const hyphenate = cacheStringFunction( | |
(str) => str.replace(hyphenateRE, "-$1").toLowerCase() | |
); | |
const capitalize = cacheStringFunction((str) => { | |
return str.charAt(0).toUpperCase() + str.slice(1); | |
}); | |
const toHandlerKey = cacheStringFunction((str) => { | |
const s = str ? `on${capitalize(str)}` : ``; | |
return s; | |
}); | |
const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | |
const invokeArrayFns = (fns, ...arg) => { | |
for (let i = 0; i < fns.length; i++) { | |
fns[i](...arg); | |
} | |
}; | |
const def = (obj, key, value, writable = false) => { | |
Object.defineProperty(obj, key, { | |
configurable: true, | |
enumerable: false, | |
writable, | |
value | |
}); | |
}; | |
const looseToNumber = (val) => { | |
const n = parseFloat(val); | |
return isNaN(n) ? val : n; | |
}; | |
const toNumber = (val) => { | |
const n = isString(val) ? Number(val) : NaN; | |
return isNaN(n) ? val : n; | |
}; | |
let _globalThis; | |
const getGlobalThis = () => { | |
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); | |
}; | |
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/; | |
function genPropsAccessExp(name) { | |
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`; | |
} | |
const PatchFlags = { | |
"TEXT": 1, | |
"1": "TEXT", | |
"CLASS": 2, | |
"2": "CLASS", | |
"STYLE": 4, | |
"4": "STYLE", | |
"PROPS": 8, | |
"8": "PROPS", | |
"FULL_PROPS": 16, | |
"16": "FULL_PROPS", | |
"NEED_HYDRATION": 32, | |
"32": "NEED_HYDRATION", | |
"STABLE_FRAGMENT": 64, | |
"64": "STABLE_FRAGMENT", | |
"KEYED_FRAGMENT": 128, | |
"128": "KEYED_FRAGMENT", | |
"UNKEYED_FRAGMENT": 256, | |
"256": "UNKEYED_FRAGMENT", | |
"NEED_PATCH": 512, | |
"512": "NEED_PATCH", | |
"DYNAMIC_SLOTS": 1024, | |
"1024": "DYNAMIC_SLOTS", | |
"DEV_ROOT_FRAGMENT": 2048, | |
"2048": "DEV_ROOT_FRAGMENT", | |
"HOISTED": -1, | |
"-1": "HOISTED", | |
"BAIL": -2, | |
"-2": "BAIL" | |
}; | |
const PatchFlagNames = { | |
[1]: `TEXT`, | |
[2]: `CLASS`, | |
[4]: `STYLE`, | |
[8]: `PROPS`, | |
[16]: `FULL_PROPS`, | |
[32]: `NEED_HYDRATION`, | |
[64]: `STABLE_FRAGMENT`, | |
[128]: `KEYED_FRAGMENT`, | |
[256]: `UNKEYED_FRAGMENT`, | |
[512]: `NEED_PATCH`, | |
[1024]: `DYNAMIC_SLOTS`, | |
[2048]: `DEV_ROOT_FRAGMENT`, | |
[-1]: `HOISTED`, | |
[-2]: `BAIL` | |
}; | |
const ShapeFlags = { | |
"ELEMENT": 1, | |
"1": "ELEMENT", | |
"FUNCTIONAL_COMPONENT": 2, | |
"2": "FUNCTIONAL_COMPONENT", | |
"STATEFUL_COMPONENT": 4, | |
"4": "STATEFUL_COMPONENT", | |
"TEXT_CHILDREN": 8, | |
"8": "TEXT_CHILDREN", | |
"ARRAY_CHILDREN": 16, | |
"16": "ARRAY_CHILDREN", | |
"SLOTS_CHILDREN": 32, | |
"32": "SLOTS_CHILDREN", | |
"TELEPORT": 64, | |
"64": "TELEPORT", | |
"SUSPENSE": 128, | |
"128": "SUSPENSE", | |
"COMPONENT_SHOULD_KEEP_ALIVE": 256, | |
"256": "COMPONENT_SHOULD_KEEP_ALIVE", | |
"COMPONENT_KEPT_ALIVE": 512, | |
"512": "COMPONENT_KEPT_ALIVE", | |
"COMPONENT": 6, | |
"6": "COMPONENT" | |
}; | |
const SlotFlags = { | |
"STABLE": 1, | |
"1": "STABLE", | |
"DYNAMIC": 2, | |
"2": "DYNAMIC", | |
"FORWARDED": 3, | |
"3": "FORWARDED" | |
}; | |
const slotFlagsText = { | |
[1]: "STABLE", | |
[2]: "DYNAMIC", | |
[3]: "FORWARDED" | |
}; | |
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error"; | |
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); | |
const isGloballyWhitelisted = isGloballyAllowed; | |
const range = 2; | |
function generateCodeFrame(source, start = 0, end = source.length) { | |
start = Math.max(0, Math.min(start, source.length)); | |
end = Math.max(0, Math.min(end, source.length)); | |
if (start > end) return ""; | |
let lines = source.split(/(\r?\n)/); | |
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); | |
lines = lines.filter((_, idx) => idx % 2 === 0); | |
let count = 0; | |
const res = []; | |
for (let i = 0; i < lines.length; i++) { | |
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); | |
if (count >= start) { | |
for (let j = i - range; j <= i + range || end > count; j++) { | |
if (j < 0 || j >= lines.length) continue; | |
const line = j + 1; | |
res.push( | |
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` | |
); | |
const lineLength = lines[j].length; | |
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; | |
if (j === i) { | |
const pad = start - (count - (lineLength + newLineSeqLength)); | |
const length = Math.max( | |
1, | |
end > count ? lineLength - pad : end - start | |
); | |
res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); | |
} else if (j > i) { | |
if (end > count) { | |
const length = Math.max(Math.min(end - count, lineLength), 1); | |
res.push(` | ` + "^".repeat(length)); | |
} | |
count += lineLength + newLineSeqLength; | |
} | |
} | |
break; | |
} | |
} | |
return res.join("\n"); | |
} | |
function normalizeStyle(value) { | |
if (isArray(value)) { | |
const res = {}; | |
for (let i = 0; i < value.length; i++) { | |
const item = value[i]; | |
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); | |
if (normalized) { | |
for (const key in normalized) { | |
res[key] = normalized[key]; | |
} | |
} | |
} | |
return res; | |
} else if (isString(value) || isObject(value)) { | |
return value; | |
} | |
} | |
const listDelimiterRE = /;(?![^(]*\))/g; | |
const propertyDelimiterRE = /:([^]+)/; | |
const styleCommentRE = /\/\*[^]*?\*\//g; | |
function parseStringStyle(cssText) { | |
const ret = {}; | |
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { | |
if (item) { | |
const tmp = item.split(propertyDelimiterRE); | |
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | |
} | |
}); | |
return ret; | |
} | |
function stringifyStyle(styles) { | |
let ret = ""; | |
if (!styles || isString(styles)) { | |
return ret; | |
} | |
for (const key in styles) { | |
const value = styles[key]; | |
if (isString(value) || typeof value === "number") { | |
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | |
ret += `${normalizedKey}:${value};`; | |
} | |
} | |
return ret; | |
} | |
function normalizeClass(value) { | |
let res = ""; | |
if (isString(value)) { | |
res = value; | |
} else if (isArray(value)) { | |
for (let i = 0; i < value.length; i++) { | |
const normalized = normalizeClass(value[i]); | |
if (normalized) { | |
res += normalized + " "; | |
} | |
} | |
} else if (isObject(value)) { | |
for (const name in value) { | |
if (value[name]) { | |
res += name + " "; | |
} | |
} | |
} | |
return res.trim(); | |
} | |
function normalizeProps(props) { | |
if (!props) return null; | |
let { class: klass, style } = props; | |
if (klass && !isString(klass)) { | |
props.class = normalizeClass(klass); | |
} | |
if (style) { | |
props.style = normalizeStyle(style); | |
} | |
return props; | |
} | |
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot"; | |
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view"; | |
const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics"; | |
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr"; | |
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); | |
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); | |
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); | |
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); | |
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; | |
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); | |
const isBooleanAttr = /* @__PURE__ */ makeMap( | |
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected` | |
); | |
function includeBooleanAttr(value) { | |
return !!value || value === ""; | |
} | |
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/; | |
const attrValidationCache = {}; | |
function isSSRSafeAttrName(name) { | |
if (attrValidationCache.hasOwnProperty(name)) { | |
return attrValidationCache[name]; | |
} | |
const isUnsafe = unsafeAttrCharRE.test(name); | |
if (isUnsafe) { | |
console.error(`unsafe attribute name: ${name}`); | |
} | |
return attrValidationCache[name] = !isUnsafe; | |
} | |
const propsToAttrMap = { | |
acceptCharset: "accept-charset", | |
className: "class", | |
htmlFor: "for", | |
httpEquiv: "http-equiv" | |
}; | |
const isKnownHtmlAttr = /* @__PURE__ */ makeMap( | |
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap` | |
); | |
const isKnownSvgAttr = /* @__PURE__ */ makeMap( | |
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` | |
); | |
function isRenderableAttrValue(value) { | |
if (value == null) { | |
return false; | |
} | |
const type = typeof value; | |
return type === "string" || type === "number" || type === "boolean"; | |
} | |
const escapeRE = /["'&<>]/; | |
function escapeHtml(string) { | |
const str = "" + string; | |
const match = escapeRE.exec(str); | |
if (!match) { | |
return str; | |
} | |
let html = ""; | |
let escaped; | |
let index; | |
let lastIndex = 0; | |
for (index = match.index; index < str.length; index++) { | |
switch (str.charCodeAt(index)) { | |
case 34: | |
escaped = """; | |
break; | |
case 38: | |
escaped = "&"; | |
break; | |
case 39: | |
escaped = "'"; | |
break; | |
case 60: | |
escaped = "<"; | |
break; | |
case 62: | |
escaped = ">"; | |
break; | |
default: | |
continue; | |
} | |
if (lastIndex !== index) { | |
html += str.slice(lastIndex, index); | |
} | |
lastIndex = index + 1; | |
html += escaped; | |
} | |
return lastIndex !== index ? html + str.slice(lastIndex, index) : html; | |
} | |
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g; | |
function escapeHtmlComment(src) { | |
return src.replace(commentStripRE, ""); | |
} | |
function looseCompareArrays(a, b) { | |
if (a.length !== b.length) return false; | |
let equal = true; | |
for (let i = 0; equal && i < a.length; i++) { | |
equal = looseEqual(a[i], b[i]); | |
} | |
return equal; | |
} | |
function looseEqual(a, b) { | |
if (a === b) return true; | |
let aValidType = isDate(a); | |
let bValidType = isDate(b); | |
if (aValidType || bValidType) { | |
return aValidType && bValidType ? a.getTime() === b.getTime() : false; | |
} | |
aValidType = isSymbol(a); | |
bValidType = isSymbol(b); | |
if (aValidType || bValidType) { | |
return a === b; | |
} | |
aValidType = isArray(a); | |
bValidType = isArray(b); | |
if (aValidType || bValidType) { | |
return aValidType && bValidType ? looseCompareArrays(a, b) : false; | |
} | |
aValidType = isObject(a); | |
bValidType = isObject(b); | |
if (aValidType || bValidType) { | |
if (!aValidType || !bValidType) { | |
return false; | |
} | |
const aKeysCount = Object.keys(a).length; | |
const bKeysCount = Object.keys(b).length; | |
if (aKeysCount !== bKeysCount) { | |
return false; | |
} | |
for (const key in a) { | |
const aHasKey = a.hasOwnProperty(key); | |
const bHasKey = b.hasOwnProperty(key); | |
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { | |
return false; | |
} | |
} | |
} | |
return String(a) === String(b); | |
} | |
function looseIndexOf(arr, val) { | |
return arr.findIndex((item) => looseEqual(item, val)); | |
} | |
const isRef = (val) => { | |
return !!(val && val.__v_isRef === true); | |
}; | |
const toDisplayString = (val) => { | |
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val); | |
}; | |
const replacer = (_key, val) => { | |
if (isRef(val)) { | |
return replacer(_key, val.value); | |
} else if (isMap(val)) { | |
return { | |
[`Map(${val.size})`]: [...val.entries()].reduce( | |
(entries, [key, val2], i) => { | |
entries[stringifySymbol(key, i) + " =>"] = val2; | |
return entries; | |
}, | |
{} | |
) | |
}; | |
} else if (isSet(val)) { | |
return { | |
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) | |
}; | |
} else if (isSymbol(val)) { | |
return stringifySymbol(val); | |
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { | |
return String(val); | |
} | |
return val; | |
}; | |
const stringifySymbol = (v, i = "") => { | |
var _a; | |
return ( | |
// Symbol.description in es2019+ so we need to cast here to pass | |
// the lib: es2016 check | |
isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v | |
); | |
}; | |
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString }; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/runtime-dom/node_modules/@vue/shared/dist/shared.d.ts === | |
/** | |
* Make a map and return a function for checking if a key | |
* is in that map. | |
* IMPORTANT: all calls of this function must be prefixed with | |
* \/\*#\_\_PURE\_\_\*\/ | |
* So that rollup can tree-shake them if necessary. | |
*/ | |
/*! #__NO_SIDE_EFFECTS__ */ | |
export declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean; | |
export declare const EMPTY_OBJ: { | |
readonly [key: string]: any; | |
}; | |
export declare const EMPTY_ARR: readonly never[]; | |
export declare const NOOP: () => void; | |
/** | |
* Always return false. | |
*/ | |
export declare const NO: () => boolean; | |
export declare const isOn: (key: string) => boolean; | |
export declare const isModelListener: (key: string) => boolean; | |
export declare const extend: { | |
<T extends {}, U>(target: T, source: U): T & U; | |
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V; | |
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W; | |
(target: object, ...sources: any[]): any; | |
}; | |
export declare const remove: <T>(arr: T[], el: T) => void; | |
export declare const hasOwn: (val: object, key: string | symbol) => key is never; | |
export declare const isArray: (arg: any) => arg is any[]; | |
export declare const isMap: (val: unknown) => val is Map<any, any>; | |
export declare const isSet: (val: unknown) => val is Set<any>; | |
export declare const isDate: (val: unknown) => val is Date; | |
export declare const isRegExp: (val: unknown) => val is RegExp; | |
export declare const isFunction: (val: unknown) => val is Function; | |
export declare const isString: (val: unknown) => val is string; | |
export declare const isSymbol: (val: unknown) => val is symbol; | |
export declare const isObject: (val: unknown) => val is Record<any, any>; | |
export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>; | |
export declare const objectToString: () => string; | |
export declare const toTypeString: (value: unknown) => string; | |
export declare const toRawType: (value: unknown) => string; | |
export declare const isPlainObject: (val: unknown) => val is object; | |
export declare const isIntegerKey: (key: unknown) => boolean; | |
export declare const isReservedProp: (key: string) => boolean; | |
export declare const isBuiltInDirective: (key: string) => boolean; | |
/** | |
* @private | |
*/ | |
export declare const camelize: (str: string) => string; | |
/** | |
* @private | |
*/ | |
export declare const hyphenate: (str: string) => string; | |
/** | |
* @private | |
*/ | |
export declare const capitalize: <T extends string>(str: T) => Capitalize<T>; | |
/** | |
* @private | |
*/ | |
export declare const toHandlerKey: <T extends string>(str: T) => T extends "" ? "" : `on${Capitalize<T>}`; | |
export declare const hasChanged: (value: any, oldValue: any) => boolean; | |
export declare const invokeArrayFns: (fns: Function[], ...arg: any[]) => void; | |
export declare const def: (obj: object, key: string | symbol, value: any, writable?: boolean) => void; | |
/** | |
* "123-foo" will be parsed to 123 | |
* This is used for the .number modifier in v-model | |
*/ | |
export declare const looseToNumber: (val: any) => any; | |
/** | |
* Only concerns number-like strings | |
* "123-foo" will be returned as-is | |
*/ | |
export declare const toNumber: (val: any) => any; | |
export declare const getGlobalThis: () => any; | |
export declare function genPropsAccessExp(name: string): string; | |
/** | |
* Patch flags are optimization hints generated by the compiler. | |
* when a block with dynamicChildren is encountered during diff, the algorithm | |
* enters "optimized mode". In this mode, we know that the vdom is produced by | |
* a render function generated by the compiler, so the algorithm only needs to | |
* handle updates explicitly marked by these patch flags. | |
* | |
* Patch flags can be combined using the | bitwise operator and can be checked | |
* using the & operator, e.g. | |
* | |
* ```js | |
* const flag = TEXT | CLASS | |
* if (flag & TEXT) { ... } | |
* ``` | |
* | |
* Check the `patchElement` function in '../../runtime-core/src/renderer.ts' to see how the | |
* flags are handled during diff. | |
*/ | |
export declare enum PatchFlags { | |
/** | |
* Indicates an element with dynamic textContent (children fast path) | |
*/ | |
TEXT = 1, | |
/** | |
* Indicates an element with dynamic class binding. | |
*/ | |
CLASS = 2, | |
/** | |
* Indicates an element with dynamic style | |
* The compiler pre-compiles static string styles into static objects | |
* + detects and hoists inline static objects | |
* e.g. `style="color: red"` and `:style="{ color: 'red' }"` both get hoisted | |
* as: | |
* ```js | |
* const style = { color: 'red' } | |
* render() { return e('div', { style }) } | |
* ``` | |
*/ | |
STYLE = 4, | |
/** | |
* Indicates an element that has non-class/style dynamic props. | |
* Can also be on a component that has any dynamic props (includes | |
* class/style). when this flag is present, the vnode also has a dynamicProps | |
* array that contains the keys of the props that may change so the runtime | |
* can diff them faster (without having to worry about removed props) | |
*/ | |
PROPS = 8, | |
/** | |
* Indicates an element with props with dynamic keys. When keys change, a full | |
* diff is always needed to remove the old key. This flag is mutually | |
* exclusive with CLASS, STYLE and PROPS. | |
*/ | |
FULL_PROPS = 16, | |
/** | |
* Indicates an element that requires props hydration | |
* (but not necessarily patching) | |
* e.g. event listeners & v-bind with prop modifier | |
*/ | |
NEED_HYDRATION = 32, | |
/** | |
* Indicates a fragment whose children order doesn't change. | |
*/ | |
STABLE_FRAGMENT = 64, | |
/** | |
* Indicates a fragment with keyed or partially keyed children | |
*/ | |
KEYED_FRAGMENT = 128, | |
/** | |
* Indicates a fragment with unkeyed children. | |
*/ | |
UNKEYED_FRAGMENT = 256, | |
/** | |
* Indicates an element that only needs non-props patching, e.g. ref or | |
* directives (onVnodeXXX hooks). since every patched vnode checks for refs | |
* and onVnodeXXX hooks, it simply marks the vnode so that a parent block | |
* will track it. | |
*/ | |
NEED_PATCH = 512, | |
/** | |
* Indicates a component with dynamic slots (e.g. slot that references a v-for | |
* iterated value, or dynamic slot names). | |
* Components with this flag are always force updated. | |
*/ | |
DYNAMIC_SLOTS = 1024, | |
/** | |
* Indicates a fragment that was created only because the user has placed | |
* comments at the root level of a template. This is a dev-only flag since | |
* comments are stripped in production. | |
*/ | |
DEV_ROOT_FRAGMENT = 2048, | |
/** | |
* SPECIAL FLAGS ------------------------------------------------------------- | |
* Special flags are negative integers. They are never matched against using | |
* bitwise operators (bitwise matching should only happen in branches where | |
* patchFlag > 0), and are mutually exclusive. When checking for a special | |
* flag, simply check patchFlag === FLAG. | |
*/ | |
/** | |
* Indicates a hoisted static vnode. This is a hint for hydration to skip | |
* the entire sub tree since static content never needs to be updated. | |
*/ | |
HOISTED = -1, | |
/** | |
* A special flag that indicates that the diffing algorithm should bail out | |
* of optimized mode. For example, on block fragments created by renderSlot() | |
* when encountering non-compiler generated slots (i.e. manually written | |
* render functions, which should always be fully diffed) | |
* OR manually cloneVNodes | |
*/ | |
BAIL = -2 | |
} | |
/** | |
* dev only flag -> name mapping | |
*/ | |
export declare const PatchFlagNames: Record<PatchFlags, string>; | |
export declare enum ShapeFlags { | |
ELEMENT = 1, | |
FUNCTIONAL_COMPONENT = 2, | |
STATEFUL_COMPONENT = 4, | |
TEXT_CHILDREN = 8, | |
ARRAY_CHILDREN = 16, | |
SLOTS_CHILDREN = 32, | |
TELEPORT = 64, | |
SUSPENSE = 128, | |
COMPONENT_SHOULD_KEEP_ALIVE = 256, | |
COMPONENT_KEPT_ALIVE = 512, | |
COMPONENT = 6 | |
} | |
export declare enum SlotFlags { | |
/** | |
* Stable slots that only reference slot props or context state. The slot | |
* can fully capture its own dependencies so when passed down the parent won't | |
* need to force the child to update. | |
*/ | |
STABLE = 1, | |
/** | |
* Slots that reference scope variables (v-for or an outer slot prop), or | |
* has conditional structure (v-if, v-for). The parent will need to force | |
* the child to update because the slot does not fully capture its dependencies. | |
*/ | |
DYNAMIC = 2, | |
/** | |
* `<slot/>` being forwarded into a child component. Whether the parent needs | |
* to update the child is dependent on what kind of slots the parent itself | |
* received. This has to be refined at runtime, when the child's vnode | |
* is being created (in `normalizeChildren`) | |
*/ | |
FORWARDED = 3 | |
} | |
/** | |
* Dev only | |
*/ | |
export declare const slotFlagsText: { | |
1: string; | |
2: string; | |
3: string; | |
}; | |
export declare const isGloballyAllowed: (key: string) => boolean; | |
/** @deprecated use `isGloballyAllowed` instead */ | |
export declare const isGloballyWhitelisted: (key: string) => boolean; | |
export declare function generateCodeFrame(source: string, start?: number, end?: number): string; | |
export type NormalizedStyle = Record<string, string | number>; | |
export declare function normalizeStyle(value: unknown): NormalizedStyle | string | undefined; | |
export declare function parseStringStyle(cssText: string): NormalizedStyle; | |
export declare function stringifyStyle(styles: NormalizedStyle | string | undefined): string; | |
export declare function normalizeClass(value: unknown): string; | |
export declare function normalizeProps(props: Record<string, any> | null): Record<string, any> | null; | |
/** | |
* Compiler only. | |
* Do NOT use in runtime code paths unless behind `__DEV__` flag. | |
*/ | |
export declare const isHTMLTag: (key: string) => boolean; | |
/** | |
* Compiler only. | |
* Do NOT use in runtime code paths unless behind `__DEV__` flag. | |
*/ | |
export declare const isSVGTag: (key: string) => boolean; | |
/** | |
* Compiler only. | |
* Do NOT use in runtime code paths unless behind `__DEV__` flag. | |
*/ | |
export declare const isMathMLTag: (key: string) => boolean; | |
/** | |
* Compiler only. | |
* Do NOT use in runtime code paths unless behind `__DEV__` flag. | |
*/ | |
export declare const isVoidTag: (key: string) => boolean; | |
export declare const isSpecialBooleanAttr: (key: string) => boolean; | |
/** | |
* The full list is needed during SSR to produce the correct initial markup. | |
*/ | |
export declare const isBooleanAttr: (key: string) => boolean; | |
/** | |
* Boolean attributes should be included if the value is truthy or ''. | |
* e.g. `<select multiple>` compiles to `{ multiple: '' }` | |
*/ | |
export declare function includeBooleanAttr(value: unknown): boolean; | |
export declare function isSSRSafeAttrName(name: string): boolean; | |
export declare const propsToAttrMap: Record<string, string | undefined>; | |
/** | |
* Known attributes, this is used for stringification of runtime static nodes | |
* so that we don't stringify bindings that cannot be set from HTML. | |
* Don't also forget to allow `data-*` and `aria-*`! | |
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes | |
*/ | |
export declare const isKnownHtmlAttr: (key: string) => boolean; | |
/** | |
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute | |
*/ | |
export declare const isKnownSvgAttr: (key: string) => boolean; | |
/** | |
* Shared between server-renderer and runtime-core hydration logic | |
*/ | |
export declare function isRenderableAttrValue(value: unknown): boolean; | |
export declare function escapeHtml(string: unknown): string; | |
export declare function escapeHtmlComment(src: string): string; | |
export declare function looseEqual(a: any, b: any): boolean; | |
export declare function looseIndexOf(arr: any[], val: any): number; | |
/** | |
* For converting {{ interpolation }} values to displayed strings. | |
* @private | |
*/ | |
export declare const toDisplayString: (val: unknown) => string; | |
export type Prettify<T> = { | |
[K in keyof T]: T[K]; | |
} & {}; | |
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; | |
export type LooseRequired<T> = { | |
[P in keyof (T & Required<T>)]: T[P]; | |
}; | |
export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N; | |
export type Awaited<T> = T extends null | undefined ? T : T extends object & { | |
then(onfulfilled: infer F, ...args: infer _): any; | |
} ? F extends (value: infer V, ...args: infer _) => any ? Awaited<V> : never : T; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/runtime-dom/node_modules/@vue/shared/dist/shared.cjs.prod.js === | |
/** | |
* @vue/shared v3.4.35 | |
* (c) 2018-present Yuxi (Evan) You and Vue contributors | |
* @license MIT | |
**/ | |
'use strict'; | |
Object.defineProperty(exports, '__esModule', { value: true }); | |
/*! #__NO_SIDE_EFFECTS__ */ | |
// @__NO_SIDE_EFFECTS__ | |
function makeMap(str, expectsLowerCase) { | |
const set = new Set(str.split(",")); | |
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val); | |
} | |
const EMPTY_OBJ = {}; | |
const EMPTY_ARR = []; | |
const NOOP = () => { | |
}; | |
const NO = () => false; | |
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter | |
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); | |
const isModelListener = (key) => key.startsWith("onUpdate:"); | |
const extend = Object.assign; | |
const remove = (arr, el) => { | |
const i = arr.indexOf(el); | |
if (i > -1) { | |
arr.splice(i, 1); | |
} | |
}; | |
const hasOwnProperty = Object.prototype.hasOwnProperty; | |
const hasOwn = (val, key) => hasOwnProperty.call(val, key); | |
const isArray = Array.isArray; | |
const isMap = (val) => toTypeString(val) === "[object Map]"; | |
const isSet = (val) => toTypeString(val) === "[object Set]"; | |
const isDate = (val) => toTypeString(val) === "[object Date]"; | |
const isRegExp = (val) => toTypeString(val) === "[object RegExp]"; | |
const isFunction = (val) => typeof val === "function"; | |
const isString = (val) => typeof val === "string"; | |
const isSymbol = (val) => typeof val === "symbol"; | |
const isObject = (val) => val !== null && typeof val === "object"; | |
const isPromise = (val) => { | |
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); | |
}; | |
const objectToString = Object.prototype.toString; | |
const toTypeString = (value) => objectToString.call(value); | |
const toRawType = (value) => { | |
return toTypeString(value).slice(8, -1); | |
}; | |
const isPlainObject = (val) => toTypeString(val) === "[object Object]"; | |
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; | |
const isReservedProp = /* @__PURE__ */ makeMap( | |
// the leading comma is intentional so empty string "" is also included | |
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" | |
); | |
const isBuiltInDirective = /* @__PURE__ */ makeMap( | |
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo" | |
); | |
const cacheStringFunction = (fn) => { | |
const cache = /* @__PURE__ */ Object.create(null); | |
return (str) => { | |
const hit = cache[str]; | |
return hit || (cache[str] = fn(str)); | |
}; | |
}; | |
const camelizeRE = /-(\w)/g; | |
const camelize = cacheStringFunction((str) => { | |
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); | |
}); | |
const hyphenateRE = /\B([A-Z])/g; | |
const hyphenate = cacheStringFunction( | |
(str) => str.replace(hyphenateRE, "-$1").toLowerCase() | |
); | |
const capitalize = cacheStringFunction((str) => { | |
return str.charAt(0).toUpperCase() + str.slice(1); | |
}); | |
const toHandlerKey = cacheStringFunction((str) => { | |
const s = str ? `on${capitalize(str)}` : ``; | |
return s; | |
}); | |
const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | |
const invokeArrayFns = (fns, ...arg) => { | |
for (let i = 0; i < fns.length; i++) { | |
fns[i](...arg); | |
} | |
}; | |
const def = (obj, key, value, writable = false) => { | |
Object.defineProperty(obj, key, { | |
configurable: true, | |
enumerable: false, | |
writable, | |
value | |
}); | |
}; | |
const looseToNumber = (val) => { | |
const n = parseFloat(val); | |
return isNaN(n) ? val : n; | |
}; | |
const toNumber = (val) => { | |
const n = isString(val) ? Number(val) : NaN; | |
return isNaN(n) ? val : n; | |
}; | |
let _globalThis; | |
const getGlobalThis = () => { | |
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); | |
}; | |
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/; | |
function genPropsAccessExp(name) { | |
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`; | |
} | |
const PatchFlags = { | |
"TEXT": 1, | |
"1": "TEXT", | |
"CLASS": 2, | |
"2": "CLASS", | |
"STYLE": 4, | |
"4": "STYLE", | |
"PROPS": 8, | |
"8": "PROPS", | |
"FULL_PROPS": 16, | |
"16": "FULL_PROPS", | |
"NEED_HYDRATION": 32, | |
"32": "NEED_HYDRATION", | |
"STABLE_FRAGMENT": 64, | |
"64": "STABLE_FRAGMENT", | |
"KEYED_FRAGMENT": 128, | |
"128": "KEYED_FRAGMENT", | |
"UNKEYED_FRAGMENT": 256, | |
"256": "UNKEYED_FRAGMENT", | |
"NEED_PATCH": 512, | |
"512": "NEED_PATCH", | |
"DYNAMIC_SLOTS": 1024, | |
"1024": "DYNAMIC_SLOTS", | |
"DEV_ROOT_FRAGMENT": 2048, | |
"2048": "DEV_ROOT_FRAGMENT", | |
"HOISTED": -1, | |
"-1": "HOISTED", | |
"BAIL": -2, | |
"-2": "BAIL" | |
}; | |
const PatchFlagNames = { | |
[1]: `TEXT`, | |
[2]: `CLASS`, | |
[4]: `STYLE`, | |
[8]: `PROPS`, | |
[16]: `FULL_PROPS`, | |
[32]: `NEED_HYDRATION`, | |
[64]: `STABLE_FRAGMENT`, | |
[128]: `KEYED_FRAGMENT`, | |
[256]: `UNKEYED_FRAGMENT`, | |
[512]: `NEED_PATCH`, | |
[1024]: `DYNAMIC_SLOTS`, | |
[2048]: `DEV_ROOT_FRAGMENT`, | |
[-1]: `HOISTED`, | |
[-2]: `BAIL` | |
}; | |
const ShapeFlags = { | |
"ELEMENT": 1, | |
"1": "ELEMENT", | |
"FUNCTIONAL_COMPONENT": 2, | |
"2": "FUNCTIONAL_COMPONENT", | |
"STATEFUL_COMPONENT": 4, | |
"4": "STATEFUL_COMPONENT", | |
"TEXT_CHILDREN": 8, | |
"8": "TEXT_CHILDREN", | |
"ARRAY_CHILDREN": 16, | |
"16": "ARRAY_CHILDREN", | |
"SLOTS_CHILDREN": 32, | |
"32": "SLOTS_CHILDREN", | |
"TELEPORT": 64, | |
"64": "TELEPORT", | |
"SUSPENSE": 128, | |
"128": "SUSPENSE", | |
"COMPONENT_SHOULD_KEEP_ALIVE": 256, | |
"256": "COMPONENT_SHOULD_KEEP_ALIVE", | |
"COMPONENT_KEPT_ALIVE": 512, | |
"512": "COMPONENT_KEPT_ALIVE", | |
"COMPONENT": 6, | |
"6": "COMPONENT" | |
}; | |
const SlotFlags = { | |
"STABLE": 1, | |
"1": "STABLE", | |
"DYNAMIC": 2, | |
"2": "DYNAMIC", | |
"FORWARDED": 3, | |
"3": "FORWARDED" | |
}; | |
const slotFlagsText = { | |
[1]: "STABLE", | |
[2]: "DYNAMIC", | |
[3]: "FORWARDED" | |
}; | |
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error"; | |
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); | |
const isGloballyWhitelisted = isGloballyAllowed; | |
const range = 2; | |
function generateCodeFrame(source, start = 0, end = source.length) { | |
start = Math.max(0, Math.min(start, source.length)); | |
end = Math.max(0, Math.min(end, source.length)); | |
if (start > end) return ""; | |
let lines = source.split(/(\r?\n)/); | |
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); | |
lines = lines.filter((_, idx) => idx % 2 === 0); | |
let count = 0; | |
const res = []; | |
for (let i = 0; i < lines.length; i++) { | |
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); | |
if (count >= start) { | |
for (let j = i - range; j <= i + range || end > count; j++) { | |
if (j < 0 || j >= lines.length) continue; | |
const line = j + 1; | |
res.push( | |
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` | |
); | |
const lineLength = lines[j].length; | |
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; | |
if (j === i) { | |
const pad = start - (count - (lineLength + newLineSeqLength)); | |
const length = Math.max( | |
1, | |
end > count ? lineLength - pad : end - start | |
); | |
res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); | |
} else if (j > i) { | |
if (end > count) { | |
const length = Math.max(Math.min(end - count, lineLength), 1); | |
res.push(` | ` + "^".repeat(length)); | |
} | |
count += lineLength + newLineSeqLength; | |
} | |
} | |
break; | |
} | |
} | |
return res.join("\n"); | |
} | |
function normalizeStyle(value) { | |
if (isArray(value)) { | |
const res = {}; | |
for (let i = 0; i < value.length; i++) { | |
const item = value[i]; | |
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); | |
if (normalized) { | |
for (const key in normalized) { | |
res[key] = normalized[key]; | |
} | |
} | |
} | |
return res; | |
} else if (isString(value) || isObject(value)) { | |
return value; | |
} | |
} | |
const listDelimiterRE = /;(?![^(]*\))/g; | |
const propertyDelimiterRE = /:([^]+)/; | |
const styleCommentRE = /\/\*[^]*?\*\//g; | |
function parseStringStyle(cssText) { | |
const ret = {}; | |
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { | |
if (item) { | |
const tmp = item.split(propertyDelimiterRE); | |
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | |
} | |
}); | |
return ret; | |
} | |
function stringifyStyle(styles) { | |
let ret = ""; | |
if (!styles || isString(styles)) { | |
return ret; | |
} | |
for (const key in styles) { | |
const value = styles[key]; | |
if (isString(value) || typeof value === "number") { | |
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | |
ret += `${normalizedKey}:${value};`; | |
} | |
} | |
return ret; | |
} | |
function normalizeClass(value) { | |
let res = ""; | |
if (isString(value)) { | |
res = value; | |
} else if (isArray(value)) { | |
for (let i = 0; i < value.length; i++) { | |
const normalized = normalizeClass(value[i]); | |
if (normalized) { | |
res += normalized + " "; | |
} | |
} | |
} else if (isObject(value)) { | |
for (const name in value) { | |
if (value[name]) { | |
res += name + " "; | |
} | |
} | |
} | |
return res.trim(); | |
} | |
function normalizeProps(props) { | |
if (!props) return null; | |
let { class: klass, style } = props; | |
if (klass && !isString(klass)) { | |
props.class = normalizeClass(klass); | |
} | |
if (style) { | |
props.style = normalizeStyle(style); | |
} | |
return props; | |
} | |
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot"; | |
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view"; | |
const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics"; | |
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr"; | |
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); | |
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); | |
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); | |
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); | |
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; | |
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); | |
const isBooleanAttr = /* @__PURE__ */ makeMap( | |
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected` | |
); | |
function includeBooleanAttr(value) { | |
return !!value || value === ""; | |
} | |
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/; | |
const attrValidationCache = {}; | |
function isSSRSafeAttrName(name) { | |
if (attrValidationCache.hasOwnProperty(name)) { | |
return attrValidationCache[name]; | |
} | |
const isUnsafe = unsafeAttrCharRE.test(name); | |
if (isUnsafe) { | |
console.error(`unsafe attribute name: ${name}`); | |
} | |
return attrValidationCache[name] = !isUnsafe; | |
} | |
const propsToAttrMap = { | |
acceptCharset: "accept-charset", | |
className: "class", | |
htmlFor: "for", | |
httpEquiv: "http-equiv" | |
}; | |
const isKnownHtmlAttr = /* @__PURE__ */ makeMap( | |
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap` | |
); | |
const isKnownSvgAttr = /* @__PURE__ */ makeMap( | |
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` | |
); | |
function isRenderableAttrValue(value) { | |
if (value == null) { | |
return false; | |
} | |
const type = typeof value; | |
return type === "string" || type === "number" || type === "boolean"; | |
} | |
const escapeRE = /["'&<>]/; | |
function escapeHtml(string) { | |
const str = "" + string; | |
const match = escapeRE.exec(str); | |
if (!match) { | |
return str; | |
} | |
let html = ""; | |
let escaped; | |
let index; | |
let lastIndex = 0; | |
for (index = match.index; index < str.length; index++) { | |
switch (str.charCodeAt(index)) { | |
case 34: | |
escaped = """; | |
break; | |
case 38: | |
escaped = "&"; | |
break; | |
case 39: | |
escaped = "'"; | |
break; | |
case 60: | |
escaped = "<"; | |
break; | |
case 62: | |
escaped = ">"; | |
break; | |
default: | |
continue; | |
} | |
if (lastIndex !== index) { | |
html += str.slice(lastIndex, index); | |
} | |
lastIndex = index + 1; | |
html += escaped; | |
} | |
return lastIndex !== index ? html + str.slice(lastIndex, index) : html; | |
} | |
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g; | |
function escapeHtmlComment(src) { | |
return src.replace(commentStripRE, ""); | |
} | |
function looseCompareArrays(a, b) { | |
if (a.length !== b.length) return false; | |
let equal = true; | |
for (let i = 0; equal && i < a.length; i++) { | |
equal = looseEqual(a[i], b[i]); | |
} | |
return equal; | |
} | |
function looseEqual(a, b) { | |
if (a === b) return true; | |
let aValidType = isDate(a); | |
let bValidType = isDate(b); | |
if (aValidType || bValidType) { | |
return aValidType && bValidType ? a.getTime() === b.getTime() : false; | |
} | |
aValidType = isSymbol(a); | |
bValidType = isSymbol(b); | |
if (aValidType || bValidType) { | |
return a === b; | |
} | |
aValidType = isArray(a); | |
bValidType = isArray(b); | |
if (aValidType || bValidType) { | |
return aValidType && bValidType ? looseCompareArrays(a, b) : false; | |
} | |
aValidType = isObject(a); | |
bValidType = isObject(b); | |
if (aValidType || bValidType) { | |
if (!aValidType || !bValidType) { | |
return false; | |
} | |
const aKeysCount = Object.keys(a).length; | |
const bKeysCount = Object.keys(b).length; | |
if (aKeysCount !== bKeysCount) { | |
return false; | |
} | |
for (const key in a) { | |
const aHasKey = a.hasOwnProperty(key); | |
const bHasKey = b.hasOwnProperty(key); | |
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { | |
return false; | |
} | |
} | |
} | |
return String(a) === String(b); | |
} | |
function looseIndexOf(arr, val) { | |
return arr.findIndex((item) => looseEqual(item, val)); | |
} | |
const isRef = (val) => { | |
return !!(val && val.__v_isRef === true); | |
}; | |
const toDisplayString = (val) => { | |
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val); | |
}; | |
const replacer = (_key, val) => { | |
if (isRef(val)) { | |
return replacer(_key, val.value); | |
} else if (isMap(val)) { | |
return { | |
[`Map(${val.size})`]: [...val.entries()].reduce( | |
(entries, [key, val2], i) => { | |
entries[stringifySymbol(key, i) + " =>"] = val2; | |
return entries; | |
}, | |
{} | |
) | |
}; | |
} else if (isSet(val)) { | |
return { | |
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) | |
}; | |
} else if (isSymbol(val)) { | |
return stringifySymbol(val); | |
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { | |
return String(val); | |
} | |
return val; | |
}; | |
const stringifySymbol = (v, i = "") => { | |
var _a; | |
return ( | |
// Symbol.description in es2019+ so we need to cast here to pass | |
// the lib: es2016 check | |
isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v | |
); | |
}; | |
exports.EMPTY_ARR = EMPTY_ARR; | |
exports.EMPTY_OBJ = EMPTY_OBJ; | |
exports.NO = NO; | |
exports.NOOP = NOOP; | |
exports.PatchFlagNames = PatchFlagNames; | |
exports.PatchFlags = PatchFlags; | |
exports.ShapeFlags = ShapeFlags; | |
exports.SlotFlags = SlotFlags; | |
exports.camelize = camelize; | |
exports.capitalize = capitalize; | |
exports.def = def; | |
exports.escapeHtml = escapeHtml; | |
exports.escapeHtmlComment = escapeHtmlComment; | |
exports.extend = extend; | |
exports.genPropsAccessExp = genPropsAccessExp; | |
exports.generateCodeFrame = generateCodeFrame; | |
exports.getGlobalThis = getGlobalThis; | |
exports.hasChanged = hasChanged; | |
exports.hasOwn = hasOwn; | |
exports.hyphenate = hyphenate; | |
exports.includeBooleanAttr = includeBooleanAttr; | |
exports.invokeArrayFns = invokeArrayFns; | |
exports.isArray = isArray; | |
exports.isBooleanAttr = isBooleanAttr; | |
exports.isBuiltInDirective = isBuiltInDirective; | |
exports.isDate = isDate; | |
exports.isFunction = isFunction; | |
exports.isGloballyAllowed = isGloballyAllowed; | |
exports.isGloballyWhitelisted = isGloballyWhitelisted; | |
exports.isHTMLTag = isHTMLTag; | |
exports.isIntegerKey = isIntegerKey; | |
exports.isKnownHtmlAttr = isKnownHtmlAttr; | |
exports.isKnownSvgAttr = isKnownSvgAttr; | |
exports.isMap = isMap; | |
exports.isMathMLTag = isMathMLTag; | |
exports.isModelListener = isModelListener; | |
exports.isObject = isObject; | |
exports.isOn = isOn; | |
exports.isPlainObject = isPlainObject; | |
exports.isPromise = isPromise; | |
exports.isRegExp = isRegExp; | |
exports.isRenderableAttrValue = isRenderableAttrValue; | |
exports.isReservedProp = isReservedProp; | |
exports.isSSRSafeAttrName = isSSRSafeAttrName; | |
exports.isSVGTag = isSVGTag; | |
exports.isSet = isSet; | |
exports.isSpecialBooleanAttr = isSpecialBooleanAttr; | |
exports.isString = isString; | |
exports.isSymbol = isSymbol; | |
exports.isVoidTag = isVoidTag; | |
exports.looseEqual = looseEqual; | |
exports.looseIndexOf = looseIndexOf; | |
exports.looseToNumber = looseToNumber; | |
exports.makeMap = makeMap; | |
exports.normalizeClass = normalizeClass; | |
exports.normalizeProps = normalizeProps; | |
exports.normalizeStyle = normalizeStyle; | |
exports.objectToString = objectToString; | |
exports.parseStringStyle = parseStringStyle; | |
exports.propsToAttrMap = propsToAttrMap; | |
exports.remove = remove; | |
exports.slotFlagsText = slotFlagsText; | |
exports.stringifyStyle = stringifyStyle; | |
exports.toDisplayString = toDisplayString; | |
exports.toHandlerKey = toHandlerKey; | |
exports.toNumber = toNumber; | |
exports.toRawType = toRawType; | |
exports.toTypeString = toTypeString; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/runtime-dom/node_modules/@vue/shared/dist/shared.cjs.js === | |
/** | |
* @vue/shared v3.4.35 | |
* (c) 2018-present Yuxi (Evan) You and Vue contributors | |
* @license MIT | |
**/ | |
'use strict'; | |
Object.defineProperty(exports, '__esModule', { value: true }); | |
/*! #__NO_SIDE_EFFECTS__ */ | |
// @__NO_SIDE_EFFECTS__ | |
function makeMap(str, expectsLowerCase) { | |
const set = new Set(str.split(",")); | |
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val); | |
} | |
const EMPTY_OBJ = Object.freeze({}) ; | |
const EMPTY_ARR = Object.freeze([]) ; | |
const NOOP = () => { | |
}; | |
const NO = () => false; | |
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter | |
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97); | |
const isModelListener = (key) => key.startsWith("onUpdate:"); | |
const extend = Object.assign; | |
const remove = (arr, el) => { | |
const i = arr.indexOf(el); | |
if (i > -1) { | |
arr.splice(i, 1); | |
} | |
}; | |
const hasOwnProperty = Object.prototype.hasOwnProperty; | |
const hasOwn = (val, key) => hasOwnProperty.call(val, key); | |
const isArray = Array.isArray; | |
const isMap = (val) => toTypeString(val) === "[object Map]"; | |
const isSet = (val) => toTypeString(val) === "[object Set]"; | |
const isDate = (val) => toTypeString(val) === "[object Date]"; | |
const isRegExp = (val) => toTypeString(val) === "[object RegExp]"; | |
const isFunction = (val) => typeof val === "function"; | |
const isString = (val) => typeof val === "string"; | |
const isSymbol = (val) => typeof val === "symbol"; | |
const isObject = (val) => val !== null && typeof val === "object"; | |
const isPromise = (val) => { | |
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); | |
}; | |
const objectToString = Object.prototype.toString; | |
const toTypeString = (value) => objectToString.call(value); | |
const toRawType = (value) => { | |
return toTypeString(value).slice(8, -1); | |
}; | |
const isPlainObject = (val) => toTypeString(val) === "[object Object]"; | |
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; | |
const isReservedProp = /* @__PURE__ */ makeMap( | |
// the leading comma is intentional so empty string "" is also included | |
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" | |
); | |
const isBuiltInDirective = /* @__PURE__ */ makeMap( | |
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo" | |
); | |
const cacheStringFunction = (fn) => { | |
const cache = /* @__PURE__ */ Object.create(null); | |
return (str) => { | |
const hit = cache[str]; | |
return hit || (cache[str] = fn(str)); | |
}; | |
}; | |
const camelizeRE = /-(\w)/g; | |
const camelize = cacheStringFunction((str) => { | |
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); | |
}); | |
const hyphenateRE = /\B([A-Z])/g; | |
const hyphenate = cacheStringFunction( | |
(str) => str.replace(hyphenateRE, "-$1").toLowerCase() | |
); | |
const capitalize = cacheStringFunction((str) => { | |
return str.charAt(0).toUpperCase() + str.slice(1); | |
}); | |
const toHandlerKey = cacheStringFunction((str) => { | |
const s = str ? `on${capitalize(str)}` : ``; | |
return s; | |
}); | |
const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | |
const invokeArrayFns = (fns, ...arg) => { | |
for (let i = 0; i < fns.length; i++) { | |
fns[i](...arg); | |
} | |
}; | |
const def = (obj, key, value, writable = false) => { | |
Object.defineProperty(obj, key, { | |
configurable: true, | |
enumerable: false, | |
writable, | |
value | |
}); | |
}; | |
const looseToNumber = (val) => { | |
const n = parseFloat(val); | |
return isNaN(n) ? val : n; | |
}; | |
const toNumber = (val) => { | |
const n = isString(val) ? Number(val) : NaN; | |
return isNaN(n) ? val : n; | |
}; | |
let _globalThis; | |
const getGlobalThis = () => { | |
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); | |
}; | |
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/; | |
function genPropsAccessExp(name) { | |
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`; | |
} | |
const PatchFlags = { | |
"TEXT": 1, | |
"1": "TEXT", | |
"CLASS": 2, | |
"2": "CLASS", | |
"STYLE": 4, | |
"4": "STYLE", | |
"PROPS": 8, | |
"8": "PROPS", | |
"FULL_PROPS": 16, | |
"16": "FULL_PROPS", | |
"NEED_HYDRATION": 32, | |
"32": "NEED_HYDRATION", | |
"STABLE_FRAGMENT": 64, | |
"64": "STABLE_FRAGMENT", | |
"KEYED_FRAGMENT": 128, | |
"128": "KEYED_FRAGMENT", | |
"UNKEYED_FRAGMENT": 256, | |
"256": "UNKEYED_FRAGMENT", | |
"NEED_PATCH": 512, | |
"512": "NEED_PATCH", | |
"DYNAMIC_SLOTS": 1024, | |
"1024": "DYNAMIC_SLOTS", | |
"DEV_ROOT_FRAGMENT": 2048, | |
"2048": "DEV_ROOT_FRAGMENT", | |
"HOISTED": -1, | |
"-1": "HOISTED", | |
"BAIL": -2, | |
"-2": "BAIL" | |
}; | |
const PatchFlagNames = { | |
[1]: `TEXT`, | |
[2]: `CLASS`, | |
[4]: `STYLE`, | |
[8]: `PROPS`, | |
[16]: `FULL_PROPS`, | |
[32]: `NEED_HYDRATION`, | |
[64]: `STABLE_FRAGMENT`, | |
[128]: `KEYED_FRAGMENT`, | |
[256]: `UNKEYED_FRAGMENT`, | |
[512]: `NEED_PATCH`, | |
[1024]: `DYNAMIC_SLOTS`, | |
[2048]: `DEV_ROOT_FRAGMENT`, | |
[-1]: `HOISTED`, | |
[-2]: `BAIL` | |
}; | |
const ShapeFlags = { | |
"ELEMENT": 1, | |
"1": "ELEMENT", | |
"FUNCTIONAL_COMPONENT": 2, | |
"2": "FUNCTIONAL_COMPONENT", | |
"STATEFUL_COMPONENT": 4, | |
"4": "STATEFUL_COMPONENT", | |
"TEXT_CHILDREN": 8, | |
"8": "TEXT_CHILDREN", | |
"ARRAY_CHILDREN": 16, | |
"16": "ARRAY_CHILDREN", | |
"SLOTS_CHILDREN": 32, | |
"32": "SLOTS_CHILDREN", | |
"TELEPORT": 64, | |
"64": "TELEPORT", | |
"SUSPENSE": 128, | |
"128": "SUSPENSE", | |
"COMPONENT_SHOULD_KEEP_ALIVE": 256, | |
"256": "COMPONENT_SHOULD_KEEP_ALIVE", | |
"COMPONENT_KEPT_ALIVE": 512, | |
"512": "COMPONENT_KEPT_ALIVE", | |
"COMPONENT": 6, | |
"6": "COMPONENT" | |
}; | |
const SlotFlags = { | |
"STABLE": 1, | |
"1": "STABLE", | |
"DYNAMIC": 2, | |
"2": "DYNAMIC", | |
"FORWARDED": 3, | |
"3": "FORWARDED" | |
}; | |
const slotFlagsText = { | |
[1]: "STABLE", | |
[2]: "DYNAMIC", | |
[3]: "FORWARDED" | |
}; | |
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error"; | |
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); | |
const isGloballyWhitelisted = isGloballyAllowed; | |
const range = 2; | |
function generateCodeFrame(source, start = 0, end = source.length) { | |
start = Math.max(0, Math.min(start, source.length)); | |
end = Math.max(0, Math.min(end, source.length)); | |
if (start > end) return ""; | |
let lines = source.split(/(\r?\n)/); | |
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); | |
lines = lines.filter((_, idx) => idx % 2 === 0); | |
let count = 0; | |
const res = []; | |
for (let i = 0; i < lines.length; i++) { | |
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0); | |
if (count >= start) { | |
for (let j = i - range; j <= i + range || end > count; j++) { | |
if (j < 0 || j >= lines.length) continue; | |
const line = j + 1; | |
res.push( | |
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}` | |
); | |
const lineLength = lines[j].length; | |
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0; | |
if (j === i) { | |
const pad = start - (count - (lineLength + newLineSeqLength)); | |
const length = Math.max( | |
1, | |
end > count ? lineLength - pad : end - start | |
); | |
res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); | |
} else if (j > i) { | |
if (end > count) { | |
const length = Math.max(Math.min(end - count, lineLength), 1); | |
res.push(` | ` + "^".repeat(length)); | |
} | |
count += lineLength + newLineSeqLength; | |
} | |
} | |
break; | |
} | |
} | |
return res.join("\n"); | |
} | |
function normalizeStyle(value) { | |
if (isArray(value)) { | |
const res = {}; | |
for (let i = 0; i < value.length; i++) { | |
const item = value[i]; | |
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); | |
if (normalized) { | |
for (const key in normalized) { | |
res[key] = normalized[key]; | |
} | |
} | |
} | |
return res; | |
} else if (isString(value) || isObject(value)) { | |
return value; | |
} | |
} | |
const listDelimiterRE = /;(?![^(]*\))/g; | |
const propertyDelimiterRE = /:([^]+)/; | |
const styleCommentRE = /\/\*[^]*?\*\//g; | |
function parseStringStyle(cssText) { | |
const ret = {}; | |
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { | |
if (item) { | |
const tmp = item.split(propertyDelimiterRE); | |
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | |
} | |
}); | |
return ret; | |
} | |
function stringifyStyle(styles) { | |
let ret = ""; | |
if (!styles || isString(styles)) { | |
return ret; | |
} | |
for (const key in styles) { | |
const value = styles[key]; | |
if (isString(value) || typeof value === "number") { | |
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | |
ret += `${normalizedKey}:${value};`; | |
} | |
} | |
return ret; | |
} | |
function normalizeClass(value) { | |
let res = ""; | |
if (isString(value)) { | |
res = value; | |
} else if (isArray(value)) { | |
for (let i = 0; i < value.length; i++) { | |
const normalized = normalizeClass(value[i]); | |
if (normalized) { | |
res += normalized + " "; | |
} | |
} | |
} else if (isObject(value)) { | |
for (const name in value) { | |
if (value[name]) { | |
res += name + " "; | |
} | |
} | |
} | |
return res.trim(); | |
} | |
function normalizeProps(props) { | |
if (!props) return null; | |
let { class: klass, style } = props; | |
if (klass && !isString(klass)) { | |
props.class = normalizeClass(klass); | |
} | |
if (style) { | |
props.style = normalizeStyle(style); | |
} | |
return props; | |
} | |
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot"; | |
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view"; | |
const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics"; | |
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr"; | |
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS); | |
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS); | |
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS); | |
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS); | |
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; | |
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); | |
const isBooleanAttr = /* @__PURE__ */ makeMap( | |
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected` | |
); | |
function includeBooleanAttr(value) { | |
return !!value || value === ""; | |
} | |
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/; | |
const attrValidationCache = {}; | |
function isSSRSafeAttrName(name) { | |
if (attrValidationCache.hasOwnProperty(name)) { | |
return attrValidationCache[name]; | |
} | |
const isUnsafe = unsafeAttrCharRE.test(name); | |
if (isUnsafe) { | |
console.error(`unsafe attribute name: ${name}`); | |
} | |
return attrValidationCache[name] = !isUnsafe; | |
} | |
const propsToAttrMap = { | |
acceptCharset: "accept-charset", | |
className: "class", | |
htmlFor: "for", | |
httpEquiv: "http-equiv" | |
}; | |
const isKnownHtmlAttr = /* @__PURE__ */ makeMap( | |
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap` | |
); | |
const isKnownSvgAttr = /* @__PURE__ */ makeMap( | |
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan` | |
); | |
function isRenderableAttrValue(value) { | |
if (value == null) { | |
return false; | |
} | |
const type = typeof value; | |
return type === "string" || type === "number" || type === "boolean"; | |
} | |
const escapeRE = /["'&<>]/; | |
function escapeHtml(string) { | |
const str = "" + string; | |
const match = escapeRE.exec(str); | |
if (!match) { | |
return str; | |
} | |
let html = ""; | |
let escaped; | |
let index; | |
let lastIndex = 0; | |
for (index = match.index; index < str.length; index++) { | |
switch (str.charCodeAt(index)) { | |
case 34: | |
escaped = """; | |
break; | |
case 38: | |
escaped = "&"; | |
break; | |
case 39: | |
escaped = "'"; | |
break; | |
case 60: | |
escaped = "<"; | |
break; | |
case 62: | |
escaped = ">"; | |
break; | |
default: | |
continue; | |
} | |
if (lastIndex !== index) { | |
html += str.slice(lastIndex, index); | |
} | |
lastIndex = index + 1; | |
html += escaped; | |
} | |
return lastIndex !== index ? html + str.slice(lastIndex, index) : html; | |
} | |
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g; | |
function escapeHtmlComment(src) { | |
return src.replace(commentStripRE, ""); | |
} | |
function looseCompareArrays(a, b) { | |
if (a.length !== b.length) return false; | |
let equal = true; | |
for (let i = 0; equal && i < a.length; i++) { | |
equal = looseEqual(a[i], b[i]); | |
} | |
return equal; | |
} | |
function looseEqual(a, b) { | |
if (a === b) return true; | |
let aValidType = isDate(a); | |
let bValidType = isDate(b); | |
if (aValidType || bValidType) { | |
return aValidType && bValidType ? a.getTime() === b.getTime() : false; | |
} | |
aValidType = isSymbol(a); | |
bValidType = isSymbol(b); | |
if (aValidType || bValidType) { | |
return a === b; | |
} | |
aValidType = isArray(a); | |
bValidType = isArray(b); | |
if (aValidType || bValidType) { | |
return aValidType && bValidType ? looseCompareArrays(a, b) : false; | |
} | |
aValidType = isObject(a); | |
bValidType = isObject(b); | |
if (aValidType || bValidType) { | |
if (!aValidType || !bValidType) { | |
return false; | |
} | |
const aKeysCount = Object.keys(a).length; | |
const bKeysCount = Object.keys(b).length; | |
if (aKeysCount !== bKeysCount) { | |
return false; | |
} | |
for (const key in a) { | |
const aHasKey = a.hasOwnProperty(key); | |
const bHasKey = b.hasOwnProperty(key); | |
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { | |
return false; | |
} | |
} | |
} | |
return String(a) === String(b); | |
} | |
function looseIndexOf(arr, val) { | |
return arr.findIndex((item) => looseEqual(item, val)); | |
} | |
const isRef = (val) => { | |
return !!(val && val.__v_isRef === true); | |
}; | |
const toDisplayString = (val) => { | |
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val); | |
}; | |
const replacer = (_key, val) => { | |
if (isRef(val)) { | |
return replacer(_key, val.value); | |
} else if (isMap(val)) { | |
return { | |
[`Map(${val.size})`]: [...val.entries()].reduce( | |
(entries, [key, val2], i) => { | |
entries[stringifySymbol(key, i) + " =>"] = val2; | |
return entries; | |
}, | |
{} | |
) | |
}; | |
} else if (isSet(val)) { | |
return { | |
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v)) | |
}; | |
} else if (isSymbol(val)) { | |
return stringifySymbol(val); | |
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) { | |
return String(val); | |
} | |
return val; | |
}; | |
const stringifySymbol = (v, i = "") => { | |
var _a; | |
return ( | |
// Symbol.description in es2019+ so we need to cast here to pass | |
// the lib: es2016 check | |
isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v | |
); | |
}; | |
exports.EMPTY_ARR = EMPTY_ARR; | |
exports.EMPTY_OBJ = EMPTY_OBJ; | |
exports.NO = NO; | |
exports.NOOP = NOOP; | |
exports.PatchFlagNames = PatchFlagNames; | |
exports.PatchFlags = PatchFlags; | |
exports.ShapeFlags = ShapeFlags; | |
exports.SlotFlags = SlotFlags; | |
exports.camelize = camelize; | |
exports.capitalize = capitalize; | |
exports.def = def; | |
exports.escapeHtml = escapeHtml; | |
exports.escapeHtmlComment = escapeHtmlComment; | |
exports.extend = extend; | |
exports.genPropsAccessExp = genPropsAccessExp; | |
exports.generateCodeFrame = generateCodeFrame; | |
exports.getGlobalThis = getGlobalThis; | |
exports.hasChanged = hasChanged; | |
exports.hasOwn = hasOwn; | |
exports.hyphenate = hyphenate; | |
exports.includeBooleanAttr = includeBooleanAttr; | |
exports.invokeArrayFns = invokeArrayFns; | |
exports.isArray = isArray; | |
exports.isBooleanAttr = isBooleanAttr; | |
exports.isBuiltInDirective = isBuiltInDirective; | |
exports.isDate = isDate; | |
exports.isFunction = isFunction; | |
exports.isGloballyAllowed = isGloballyAllowed; | |
exports.isGloballyWhitelisted = isGloballyWhitelisted; | |
exports.isHTMLTag = isHTMLTag; | |
exports.isIntegerKey = isIntegerKey; | |
exports.isKnownHtmlAttr = isKnownHtmlAttr; | |
exports.isKnownSvgAttr = isKnownSvgAttr; | |
exports.isMap = isMap; | |
exports.isMathMLTag = isMathMLTag; | |
exports.isModelListener = isModelListener; | |
exports.isObject = isObject; | |
exports.isOn = isOn; | |
exports.isPlainObject = isPlainObject; | |
exports.isPromise = isPromise; | |
exports.isRegExp = isRegExp; | |
exports.isRenderableAttrValue = isRenderableAttrValue; | |
exports.isReservedProp = isReservedProp; | |
exports.isSSRSafeAttrName = isSSRSafeAttrName; | |
exports.isSVGTag = isSVGTag; | |
exports.isSet = isSet; | |
exports.isSpecialBooleanAttr = isSpecialBooleanAttr; | |
exports.isString = isString; | |
exports.isSymbol = isSymbol; | |
exports.isVoidTag = isVoidTag; | |
exports.looseEqual = looseEqual; | |
exports.looseIndexOf = looseIndexOf; | |
exports.looseToNumber = looseToNumber; | |
exports.makeMap = makeMap; | |
exports.normalizeClass = normalizeClass; | |
exports.normalizeProps = normalizeProps; | |
exports.normalizeStyle = normalizeStyle; | |
exports.objectToString = objectToString; | |
exports.parseStringStyle = parseStringStyle; | |
exports.propsToAttrMap = propsToAttrMap; | |
exports.remove = remove; | |
exports.slotFlagsText = slotFlagsText; | |
exports.stringifyStyle = stringifyStyle; | |
exports.toDisplayString = toDisplayString; | |
exports.toHandlerKey = toHandlerKey; | |
exports.toNumber = toNumber; | |
exports.toRawType = toRawType; | |
exports.toTypeString = toTypeString; | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/runtime-dom/index.js === | |
'use strict' | |
if (process.env.NODE_ENV === 'production') { | |
module.exports = require('./dist/runtime-dom.cjs.prod.js') | |
} else { | |
module.exports = require('./dist/runtime-dom.cjs.js') | |
} | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/runtime-dom/dist/runtime-dom.global.prod.js === | |
/** | |
* @vue/runtime-dom v3.4.35 | |
* (c) 2018-present Yuxi (Evan) You and Vue contributors | |
* @license MIT | |
**/var VueRuntimeDOM=function(e){"use strict";let t,n,l,r,i,o,s,a;/*! #__NO_SIDE_EFFECTS__ */function u(e,t){let n=new Set(e.split(","));return e=>n.has(e)}let c={},f=[],d=()=>{},p=()=>!1,h=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||97>e.charCodeAt(2)),g=e=>e.startsWith("onUpdate:"),m=Object.assign,_=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},y=Object.prototype.hasOwnProperty,b=(e,t)=>y.call(e,t),C=Array.isArray,S=e=>"[object Map]"===L(e),E=e=>"[object Set]"===L(e),x=e=>"[object Date]"===L(e),w=e=>"[object RegExp]"===L(e),k=e=>"function"==typeof e,T=e=>"string"==typeof e,A=e=>"symbol"==typeof e,O=e=>null!==e&&"object"==typeof e,R=e=>(O(e)||k(e))&&k(e.then)&&k(e.catch),N=Object.prototype.toString,L=e=>N.call(e),M=e=>L(e).slice(8,-1),P=e=>"[object Object]"===L(e),I=e=>T(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,F=u(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),V=e=>{let t=Object.create(null);return n=>t[n]||(t[n]=e(n))},U=/-(\w)/g,B=V(e=>e.replace(U,(e,t)=>t?t.toUpperCase():"")),D=/\B([A-Z])/g,j=V(e=>e.replace(D,"-$1").toLowerCase()),$=V(e=>e.charAt(0).toUpperCase()+e.slice(1)),H=V(e=>e?`on${$(e)}`:""),W=(e,t)=>!Object.is(e,t),K=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},z=(e,t,n,l=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:l,value:n})},G=e=>{let t=parseFloat(e);return isNaN(t)?e:t},q=e=>{let t=T(e)?Number(e):NaN;return isNaN(t)?e:t},J=()=>t||(t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}),X=u("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error");function Y(e){if(C(e)){let t={};for(let n=0;n<e.length;n++){let l=e[n],r=T(l)?function(e){let t={};return e.replace(ee,"").split(Z).forEach(e=>{if(e){let n=e.split(Q);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}(l):Y(l);if(r)for(let e in r)t[e]=r[e]}return t}if(T(e)||O(e))return e}let Z=/;(?![^(]*\))/g,Q=/:([^]+)/,ee=/\/\*[^]*?\*\//g;function et(e){let t="";if(T(e))t=e;else if(C(e))for(let n=0;n<e.length;n++){let l=et(e[n]);l&&(t+=l+" ")}else if(O(e))for(let n in e)e[n]&&(t+=n+" ");return t.trim()}let en=u("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function el(e,t){if(e===t)return!0;let n=x(e),l=x(t);if(n||l)return!!n&&!!l&&e.getTime()===t.getTime();if(n=A(e),l=A(t),n||l)return e===t;if(n=C(e),l=C(t),n||l)return!!n&&!!l&&function(e,t){if(e.length!==t.length)return!1;let n=!0;for(let l=0;n&&l<e.length;l++)n=el(e[l],t[l]);return n}(e,t);if(n=O(e),l=O(t),n||l){if(!n||!l||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e){let l=e.hasOwnProperty(n),r=t.hasOwnProperty(n);if(l&&!r||!l&&r||!el(e[n],t[n]))return!1}}return String(e)===String(t)}function er(e,t){return e.findIndex(e=>el(e,t))}let ei=e=>!!(e&&!0===e.__v_isRef),eo=e=>T(e)?e:null==e?"":C(e)||O(e)&&(e.toString===N||!k(e.toString))?ei(e)?eo(e.value):JSON.stringify(e,es,2):String(e),es=(e,t)=>ei(t)?es(e,t.value):S(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],l)=>(e[ea(t,l)+" =>"]=n,e),{})}:E(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>ea(e))}:A(t)?ea(t):!O(t)||C(t)||P(t)?t:String(t),ea=(e,t="")=>{var n;return A(e)?`Symbol(${null!=(n=e.description)?n:t})`:e};class eu{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=n,!e&&n&&(this.index=(n.scopes||(n.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){let t=n;try{return n=this,e()}finally{n=t}}}on(){n=this}off(){n=this.parent}stop(e){if(this._active){let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0,this._active=!1}}}function ec(e,t=n){t&&t.active&&t.effects.push(e)}class ef{constructor(e,t,n,l){this.fn=e,this.trigger=t,this.scheduler=n,this.active=!0,this.deps=[],this._dirtyLevel=4,this._trackId=0,this._runnings=0,this._shouldSchedule=!1,this._depsLength=0,ec(this,l)}get dirty(){if(2===this._dirtyLevel||3===this._dirtyLevel){this._dirtyLevel=1,e_();for(let e=0;e<this._depsLength;e++){let t=this.deps[e];if(t.computed&&(t.computed.value,this._dirtyLevel>=4))break}1===this._dirtyLevel&&(this._dirtyLevel=0),ey()}return this._dirtyLevel>=4}set dirty(e){this._dirtyLevel=e?4:0}run(){if(this._dirtyLevel=0,!this.active)return this.fn();let e=eg,t=l;try{return eg=!0,l=this,this._runnings++,ed(this),this.fn()}finally{ep(this),this._runnings--,l=t,eg=e}}stop(){this.active&&(ed(this),ep(this),this.onStop&&this.onStop(),this.active=!1)}}function ed(e){e._trackId++,e._depsLength=0}function ep(e){if(e.deps.length>e._depsLength){for(let t=e._depsLength;t<e.deps.length;t++)eh(e.deps[t],e);e.deps.length=e._depsLength}}function eh(e,t){let n=e.get(t);void 0!==n&&t._trackId!==n&&(e.delete(t),0===e.size&&e.cleanup())}let eg=!0,em=0,ev=[];function e_(){ev.push(eg),eg=!1}function ey(){let e=ev.pop();eg=void 0===e||e}function eb(){for(em--;!em&&eS.length;)eS.shift()()}function eC(e,t,n){if(t.get(e)!==e._trackId){t.set(e,e._trackId);let n=e.deps[e._depsLength];n!==t?(n&&eh(n,e),e.deps[e._depsLength++]=t):e._depsLength++}}let eS=[];function eE(e,t,n){for(let n of(em++,e.keys())){let l;n._dirtyLevel<t&&(null!=l?l:l=e.get(n)===n._trackId)&&(n._shouldSchedule||(n._shouldSchedule=0===n._dirtyLevel),n._dirtyLevel=t),n._shouldSchedule&&(null!=l?l:l=e.get(n)===n._trackId)&&(n.trigger(),(!n._runnings||n.allowRecurse)&&2!==n._dirtyLevel&&(n._shouldSchedule=!1,n.scheduler&&eS.push(n.scheduler)))}eb()}let ex=(e,t)=>{let n=new Map;return n.cleanup=e,n.computed=t,n},ew=new WeakMap,ek=Symbol(""),eT=Symbol("");function eA(e,t,n){if(eg&&l){let t=ew.get(e);t||ew.set(e,t=new Map);let r=t.get(n);r||t.set(n,r=ex(()=>t.delete(n))),eC(l,r)}}function eO(e,t,n,l,r,i){let o=ew.get(e);if(!o)return;let s=[];if("clear"===t)s=[...o.values()];else if("length"===n&&C(e)){let e=Number(l);o.forEach((t,n)=>{("length"===n||!A(n)&&n>=e)&&s.push(t)})}else switch(void 0!==n&&s.push(o.get(n)),t){case"add":C(e)?I(n)&&s.push(o.get("length")):(s.push(o.get(ek)),S(e)&&s.push(o.get(eT)));break;case"delete":!C(e)&&(s.push(o.get(ek)),S(e)&&s.push(o.get(eT)));break;case"set":S(e)&&s.push(o.get(ek))}for(let e of(em++,s))e&&eE(e,4);eb()}let eR=u("__proto__,__v_isRef,__isVue"),eN=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(A)),eL=function(){let e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...e){let n=tc(this);for(let e=0,t=this.length;e<t;e++)eA(n,"get",e+"");let l=n[t](...e);return -1===l||!1===l?n[t](...e.map(tc)):l}}),["push","pop","shift","unshift","splice"].forEach(t=>{e[t]=function(...e){e_(),em++;let n=tc(this)[t].apply(this,e);return eb(),ey(),n}}),e}();function eM(e){A(e)||(e=String(e));let t=tc(this);return eA(t,"has",e),t.hasOwnProperty(e)}class eP{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){let l=this._isReadonly,r=this._isShallow;if("__v_isReactive"===t)return!l;if("__v_isReadonly"===t)return l;if("__v_isShallow"===t)return r;if("__v_raw"===t)return n===(l?r?tt:te:r?e7:e9).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let i=C(e);if(!l){if(i&&b(eL,t))return Reflect.get(eL,t,n);if("hasOwnProperty"===t)return eM}let o=Reflect.get(e,t,n);return(A(t)?eN.has(t):eR(t))?o:(l||eA(e,"get",t),r)?o:tv(o)?i&&I(t)?o:o.value:O(o)?l?tr(o):tn(o):o}}class eI extends eP{constructor(e=!1){super(!1,e)}set(e,t,n,l){let r=e[t];if(!this._isShallow){let t=ts(r);if(ta(n)||ts(n)||(r=tc(r),n=tc(n)),!C(e)&&tv(r)&&!tv(n))return!t&&(r.value=n,!0)}let i=C(e)&&I(t)?Number(t)<e.length:b(e,t),o=Reflect.set(e,t,n,l);return e===tc(l)&&(i?W(n,r)&&eO(e,"set",t,n):eO(e,"add",t,n)),o}deleteProperty(e,t){let n=b(e,t);e[t];let l=Reflect.deleteProperty(e,t);return l&&n&&eO(e,"delete",t,void 0),l}has(e,t){let n=Reflect.has(e,t);return A(t)&&eN.has(t)||eA(e,"has",t),n}ownKeys(e){return eA(e,"iterate",C(e)?"length":ek),Reflect.ownKeys(e)}}class eF extends eP{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}let eV=new eI,eU=new eF,eB=new eI(!0),eD=new eF(!0),ej=e=>e,e$=e=>Reflect.getPrototypeOf(e);function eH(e,t,n=!1,l=!1){let r=tc(e=e.__v_raw),i=tc(t);n||(W(t,i)&&eA(r,"get",t),eA(r,"get",i));let{has:o}=e$(r),s=l?ej:n?tp:td;return o.call(r,t)?s(e.get(t)):o.call(r,i)?s(e.get(i)):void(e!==r&&e.get(t))}function eW(e,t=!1){let n=this.__v_raw,l=tc(n),r=tc(e);return t||(W(e,r)&&eA(l,"has",e),eA(l,"has",r)),e===r?n.has(e):n.has(e)||n.has(r)}function eK(e,t=!1){return e=e.__v_raw,t||eA(tc(e),"iterate",ek),Reflect.get(e,"size",e)}function ez(e,t=!1){t||ta(e)||ts(e)||(e=tc(e));let n=tc(this);return e$(n).has.call(n,e)||(n.add(e),eO(n,"add",e,e)),this}function eG(e,t,n=!1){n||ta(t)||ts(t)||(t=tc(t));let l=tc(this),{has:r,get:i}=e$(l),o=r.call(l,e);o||(e=tc(e),o=r.call(l,e));let s=i.call(l,e);return l.set(e,t),o?W(t,s)&&eO(l,"set",e,t):eO(l,"add",e,t),this}function eq(e){let t=tc(this),{has:n,get:l}=e$(t),r=n.call(t,e);r||(e=tc(e),r=n.call(t,e)),l&&l.call(t,e);let i=t.delete(e);return r&&eO(t,"delete",e,void 0),i}function eJ(){let e=tc(this),t=0!==e.size,n=e.clear();return t&&eO(e,"clear",void 0,void 0),n}function eX(e,t){return function(n,l){let r=this,i=r.__v_raw,o=tc(i),s=t?ej:e?tp:td;return e||eA(o,"iterate",ek),i.forEach((e,t)=>n.call(l,s(e),s(t),r))}}function eY(e,t,n){return function(...l){let r=this.__v_raw,i=tc(r),o=S(i),s="entries"===e||e===Symbol.iterator&&o,a=r[e](...l),u=n?ej:t?tp:td;return t||eA(i,"iterate","keys"===e&&o?eT:ek),{next(){let{value:e,done:t}=a.next();return t?{value:e,done:t}:{value:s?[u(e[0]),u(e[1])]:u(e),done:t}},[Symbol.iterator](){return this}}}}function eZ(e){return function(...t){return"delete"!==e&&("clear"===e?void 0:this)}}let[eQ,e0,e1,e2]=function(){let e={get(e){return eH(this,e)},get size(){return eK(this)},has:eW,add:ez,set:eG,delete:eq,clear:eJ,forEach:eX(!1,!1)},t={get(e){return eH(this,e,!1,!0)},get size(){return eK(this)},has:eW,add(e){return ez.call(this,e,!0)},set(e,t){return eG.call(this,e,t,!0)},delete:eq,clear:eJ,forEach:eX(!1,!0)},n={get(e){return eH(this,e,!0)},get size(){return eK(this,!0)},has(e){return eW.call(this,e,!0)},add:eZ("add"),set:eZ("set"),delete:eZ("delete"),clear:eZ("clear"),forEach:eX(!0,!1)},l={get(e){return eH(this,e,!0,!0)},get size(){return eK(this,!0)},has(e){return eW.call(this,e,!0)},add:eZ("add"),set:eZ("set"),delete:eZ("delete"),clear:eZ("clear"),forEach:eX(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{e[r]=eY(r,!1,!1),n[r]=eY(r,!0,!1),t[r]=eY(r,!1,!0),l[r]=eY(r,!0,!0)}),[e,n,t,l]}();function e6(e,t){let n=t?e?e2:e1:e?e0:eQ;return(t,l,r)=>"__v_isReactive"===l?!e:"__v_isReadonly"===l?e:"__v_raw"===l?t:Reflect.get(b(n,l)&&l in t?n:t,l,r)}let e4={get:e6(!1,!1)},e3={get:e6(!1,!0)},e8={get:e6(!0,!1)},e5={get:e6(!0,!0)},e9=new WeakMap,e7=new WeakMap,te=new WeakMap,tt=new WeakMap;function tn(e){return ts(e)?e:ti(e,!1,eV,e4,e9)}function tl(e){return ti(e,!1,eB,e3,e7)}function tr(e){return ti(e,!0,eU,e8,te)}function ti(e,t,n,l,r){if(!O(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let i=r.get(e);if(i)return i;let o=e.__v_skip||!Object.isExtensible(e)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(M(e));if(0===o)return e;let s=new Proxy(e,2===o?l:n);return r.set(e,s),s}function to(e){return ts(e)?to(e.__v_raw):!!(e&&e.__v_isReactive)}function ts(e){return!!(e&&e.__v_isReadonly)}function ta(e){return!!(e&&e.__v_isShallow)}function tu(e){return!!e&&!!e.__v_raw}function tc(e){let t=e&&e.__v_raw;return t?tc(t):e}function tf(e){return Object.isExtensible(e)&&z(e,"__v_skip",!0),e}let td=e=>O(e)?tn(e):e,tp=e=>O(e)?tr(e):e;class th{constructor(e,t,n,l){this.getter=e,this._setter=t,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this.effect=new ef(()=>e(this._value),()=>tm(this,2===this.effect._dirtyLevel?2:3)),this.effect.computed=this,this.effect.active=this._cacheable=!l,this.__v_isReadonly=n}get value(){let e=tc(this);return(!e._cacheable||e.effect.dirty)&&W(e._value,e._value=e.effect.run())&&tm(e,4),tg(e),e.effect._dirtyLevel>=2&&tm(e,2),e._value}set value(e){this._setter(e)}get _dirty(){return this.effect.dirty}set _dirty(e){this.effect.dirty=e}}function tg(e){var t;eg&&l&&(e=tc(e),eC(l,null!=(t=e.dep)?t:e.dep=ex(()=>e.dep=void 0,e instanceof th?e:void 0)))}function tm(e,t=4,n,l){let r=(e=tc(e)).dep;r&&eE(r,t)}function tv(e){return!!(e&&!0===e.__v_isRef)}function t_(e){return ty(e,!1)}function ty(e,t){return tv(e)?e:new tb(e,t)}class tb{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:tc(e),this._value=t?e:td(e)}get value(){return tg(this),this._value}set value(e){let t=this.__v_isShallow||ta(e)||ts(e);W(e=t?e:tc(e),this._rawValue)&&(this._rawValue,this._rawValue=e,this._value=t?e:td(e),tm(this,4))}}function tC(e){return tv(e)?e.value:e}let tS={get:(e,t,n)=>tC(Reflect.get(e,t,n)),set:(e,t,n,l)=>{let r=e[t];return tv(r)&&!tv(n)?(r.value=n,!0):Reflect.set(e,t,n,l)}};function tE(e){return to(e)?e:new Proxy(e,tS)}class tx{constructor(e){this.dep=void 0,this.__v_isRef=!0;let{get:t,set:n}=e(()=>tg(this),()=>tm(this));this._get=t,this._set=n}get value(){return this._get()}set value(e){this._set(e)}}function tw(e){return new tx(e)}class tk{constructor(e,t,n){this._object=e,this._key=t,this._defaultValue=n,this.__v_isRef=!0}get value(){let e=this._object[this._key];return void 0===e?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return function(e,t){let n=ew.get(e);return n&&n.get(t)}(tc(this._object),this._key)}}class tT{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function tA(e,t,n){let l=e[t];return tv(l)?l:new tk(e,t,n)}function tO(e,t,n,l){try{return l?e(...l):e()}catch(e){tN(e,t,n)}}function tR(e,t,n,l){if(k(e)){let r=tO(e,t,n,l);return r&&R(r)&&r.catch(e=>{tN(e,t,n)}),r}if(C(e)){let r=[];for(let i=0;i<e.length;i++)r.push(tR(e[i],t,n,l));return r}}function tN(e,t,n,l=!0){if(t&&t.vnode,t){let l=t.parent,r=t.proxy,i=`https://vuejs.org/error-reference/#runtime-${n}`;for(;l;){let t=l.ec;if(t){for(let n=0;n<t.length;n++)if(!1===t[n](e,r,i))return}l=l.parent}let o=t.appContext.config.errorHandler;if(o){e_(),tO(o,null,10,[e,r,i]),ey();return}}!function(e,t,n,l=!0){console.error(e)}(e,0,0,l)}let tL=!1,tM=!1,tP=[],tI=0,tF=[],tV=null,tU=0,tB=Promise.resolve(),tD=null;function tj(e){let t=tD||tB;return e?t.then(this?e.bind(this):e):t}function t$(e){tP.length&&tP.includes(e,tL&&e.allowRecurse?tI+1:tI)||(null==e.id?tP.push(e):tP.splice(function(e){let t=tI+1,n=tP.length;for(;t<n;){let l=t+n>>>1,r=tP[l],i=tG(r);i<e||i===e&&r.pre?t=l+1:n=l}return t}(e.id),0,e),tH())}function tH(){tL||tM||(tM=!0,tD=tB.then(function e(t){tM=!1,tL=!0,tP.sort(tq);try{for(tI=0;tI<tP.length;tI++){let e=tP[tI];e&&!1!==e.active&&tO(e,e.i,e.i?15:14)}}finally{tI=0,tP.length=0,tz(),tL=!1,tD=null,(tP.length||tF.length)&&e()}}))}function tW(e){C(e)?tF.push(...e):tV&&tV.includes(e,e.allowRecurse?tU+1:tU)||tF.push(e),tH()}function tK(e,t,n=tL?tI+1:0){for(;n<tP.length;n++){let t=tP[n];if(t&&t.pre){if(e&&t.id!==e.uid)continue;tP.splice(n,1),n--,t()}}}function tz(e){if(tF.length){let e=[...new Set(tF)].sort((e,t)=>tG(e)-tG(t));if(tF.length=0,tV){tV.push(...e);return}for(tU=0,tV=e;tU<tV.length;tU++){let e=tV[tU];!1!==e.active&&e()}tV=null,tU=0}}let tG=e=>null==e.id?1/0:e.id,tq=(e,t)=>{let n=tG(e)-tG(t);if(0===n){if(e.pre&&!t.pre)return -1;if(t.pre&&!e.pre)return 1}return n},tJ=null,tX=null;function tY(e){let t=tJ;return tJ=e,tX=e&&e.type.__scopeId||null,t}function tZ(e,t=tJ,n){if(!t||e._n)return e;let l=(...n)=>{let r;l._d&&l3(-1);let i=tY(t);try{r=e(...n)}finally{tY(i),l._d&&l3(1)}return r};return l._n=!0,l._c=!0,l._d=!0,l}function tQ(e,t,n,l){let r=e.dirs,i=t&&t.dirs;for(let o=0;o<r.length;o++){let s=r[o];i&&(s.oldValue=i[o].value);let a=s.dir[l];a&&(e_(),tR(a,n,8,[e.el,s,e,t]),ey())}}let t0=Symbol("_leaveCb"),t1=Symbol("_enterCb");function t2(){let e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return nm(()=>{e.isMounted=!0}),ny(()=>{e.isUnmounting=!0}),e}let t6=[Function,Array],t4={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:t6,onEnter:t6,onAfterEnter:t6,onEnterCancelled:t6,onBeforeLeave:t6,onLeave:t6,onAfterLeave:t6,onLeaveCancelled:t6,onBeforeAppear:t6,onAppear:t6,onAfterAppear:t6,onAppearCancelled:t6},t3=e=>{let t=e.subTree;return t.component?t3(t.component):t},t8={name:"BaseTransition",props:t4,setup(e,{slots:t}){let n=rg(),l=t2();return()=>{let r=t.default&&nn(t.default(),!0);if(!r||!r.length)return;let i=r[0];if(r.length>1){for(let e of r)if(e.type!==lZ){i=e;break}}let o=tc(e),{mode:s}=o;if(l.isLeaving)return t7(i);let a=ne(i);if(!a)return t7(i);let u=t9(a,o,l,n,e=>u=e);nt(a,u);let c=n.subTree,f=c&&ne(c);if(f&&f.type!==lZ&&!l7(a,f)&&t3(n).type!==lZ){let e=t9(f,o,l,n);if(nt(f,e),"out-in"===s&&a.type!==lZ)return l.isLeaving=!0,e.afterLeave=()=>{l.isLeaving=!1,!1!==n.update.active&&(n.effect.dirty=!0,n.update())},t7(i);"in-out"===s&&a.type!==lZ&&(e.delayLeave=(e,t,n)=>{t5(l,f)[String(f.key)]=f,e[t0]=()=>{t(),e[t0]=void 0,delete u.delayedLeave},u.delayedLeave=n})}return i}}};function t5(e,t){let{leavingVNodes:n}=e,l=n.get(t.type);return l||(l=Object.create(null),n.set(t.type,l)),l}function t9(e,t,n,l,r){let{appear:i,mode:o,persisted:s=!1,onBeforeEnter:a,onEnter:u,onAfterEnter:c,onEnterCancelled:f,onBeforeLeave:d,onLeave:p,onAfterLeave:h,onLeaveCancelled:g,onBeforeAppear:m,onAppear:_,onAfterAppear:y,onAppearCancelled:b}=t,S=String(e.key),E=t5(n,e),x=(e,t)=>{e&&tR(e,l,9,t)},w=(e,t)=>{let n=t[1];x(e,t),C(e)?e.every(e=>e.length<=1)&&n():e.length<=1&&n()},k={mode:o,persisted:s,beforeEnter(t){let l=a;if(!n.isMounted){if(!i)return;l=m||a}t[t0]&&t[t0](!0);let r=E[S];r&&l7(e,r)&&r.el[t0]&&r.el[t0](),x(l,[t])},enter(e){let t=u,l=c,r=f;if(!n.isMounted){if(!i)return;t=_||u,l=y||c,r=b||f}let o=!1,s=e[t1]=t=>{o||(o=!0,t?x(r,[e]):x(l,[e]),k.delayedLeave&&k.delayedLeave(),e[t1]=void 0)};t?w(t,[e,s]):s()},leave(t,l){let r=String(e.key);if(t[t1]&&t[t1](!0),n.isUnmounting)return l();x(d,[t]);let i=!1,o=t[t0]=n=>{i||(i=!0,l(),n?x(g,[t]):x(h,[t]),t[t0]=void 0,E[r]!==e||delete E[r])};E[r]=e,p?w(p,[t,o]):o()},clone(e){let i=t9(e,t,n,l,r);return r&&r(i),i}};return k}function t7(e){if(no(e))return(e=ri(e)).children=null,e}function ne(e){if(!no(e))return e;let{shapeFlag:t,children:n}=e;if(n){if(16&t)return n[0];if(32&t&&k(n.default))return n.default()}}function nt(e,t){6&e.shapeFlag&&e.component?nt(e.component.subTree,t):128&e.shapeFlag?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function nn(e,t=!1,n){let l=[],r=0;for(let i=0;i<e.length;i++){let o=e[i],s=null==n?o.key:String(n)+String(null!=o.key?o.key:i);o.type===lX?(128&o.patchFlag&&r++,l=l.concat(nn(o.children,t,s))):(t||o.type!==lZ)&&l.push(null!=s?ri(o,{key:s}):o)}if(r>1)for(let e=0;e<l.length;e++)l[e].patchFlag=-2;return l}/*! #__NO_SIDE_EFFECTS__ */function nl(e,t){return k(e)?m({name:e.name},t,{setup:e}):e}let nr=e=>!!e.type.__asyncLoader;function ni(e,t){let{ref:n,props:l,children:r,ce:i}=t.vnode,o=rl(e,l,r);return o.ref=n,o.ce=i,delete t.vnode.ce,o}let no=e=>e.type.__isKeepAlive;function ns(e,t){return C(e)?e.some(e=>ns(e,t)):T(e)?e.split(",").includes(t):!!w(e)&&e.test(t)}function na(e,t){nc(e,"a",t)}function nu(e,t){nc(e,"da",t)}function nc(e,t,n=rh){let l=e.__wdc||(e.__wdc=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()});if(np(t,l,n),n){let e=n.parent;for(;e&&e.parent;)no(e.parent.vnode)&&function(e,t,n,l){let r=np(t,e,l,!0);nb(()=>{_(l[t],r)},n)}(l,t,n,e),e=e.parent}}function nf(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function nd(e){return 128&e.shapeFlag?e.ssContent:e}function np(e,t,n=rh,l=!1){if(n){let r=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...l)=>{e_();let r=rm(n),i=tR(t,n,e,l);return r(),ey(),i});return l?r.unshift(i):r.push(i),i}}let nh=e=>(t,n=rh)=>{ry&&"sp"!==e||np(e,(...e)=>t(...e),n)},ng=nh("bm"),nm=nh("m"),nv=nh("bu"),n_=nh("u"),ny=nh("bum"),nb=nh("um"),nC=nh("sp"),nS=nh("rtg"),nE=nh("rtc");function nx(e,t=rh){np("ec",e,t)}let nw="components",nk=Symbol.for("v-ndc");function nT(e,t,n=!0,l=!1){let r=tJ||rh;if(r){let n=r.type;if(e===nw){let e=rw(n,!1);if(e&&(e===t||e===B(t)||e===$(B(t))))return n}let i=nA(r[e]||n[e],t)||nA(r.appContext[e],t);return!i&&l?n:i}}function nA(e,t){return e&&(e[t]||e[B(t)]||e[$(B(t))])}let nO=e=>e?r_(e)?rx(e):nO(e.parent):null,nR=m(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>nO(e.parent),$root:e=>nO(e.root),$emit:e=>e.emit,$options:e=>nU(e),$forceUpdate:e=>e.f||(e.f=()=>{e.effect.dirty=!0,t$(e.update)}),$nextTick:e=>e.n||(e.n=tj.bind(e.proxy)),$watch:e=>lL.bind(e)}),nN=(e,t)=>e!==c&&!e.__isScriptSetup&&b(e,t),nL={get({_:e},t){let n,l,r;if("__v_skip"===t)return!0;let{ctx:i,setupState:o,data:s,props:a,accessCache:u,type:f,appContext:d}=e;if("$"!==t[0]){let l=u[t];if(void 0!==l)switch(l){case 1:return o[t];case 2:return s[t];case 4:return i[t];case 3:return a[t]}else{if(nN(o,t))return u[t]=1,o[t];if(s!==c&&b(s,t))return u[t]=2,s[t];if((n=e.propsOptions[0])&&b(n,t))return u[t]=3,a[t];if(i!==c&&b(i,t))return u[t]=4,i[t];nF&&(u[t]=0)}}let p=nR[t];return p?("$attrs"===t&&eA(e.attrs,"get",""),p(e)):(l=f.__cssModules)&&(l=l[t])?l:i!==c&&b(i,t)?(u[t]=4,i[t]):b(r=d.config.globalProperties,t)?r[t]:void 0},set({_:e},t,n){let{data:l,setupState:r,ctx:i}=e;return nN(r,t)?(r[t]=n,!0):l!==c&&b(l,t)?(l[t]=n,!0):!b(e.props,t)&&!("$"===t[0]&&t.slice(1) in e)&&(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:l,appContext:r,propsOptions:i}},o){let s;return!!n[o]||e!==c&&b(e,o)||nN(t,o)||(s=i[0])&&b(s,o)||b(l,o)||b(nR,o)||b(r.config.globalProperties,o)},defineProperty(e,t,n){return null!=n.get?e._.accessCache[t]=0:b(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},nM=m({},nL,{get(e,t){if(t!==Symbol.unscopables)return nL.get(e,t,e)},has:(e,t)=>"_"!==t[0]&&!X(t)});function nP(){let e=rg();return e.setupContext||(e.setupContext=rE(e))}function nI(e){return C(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}let nF=!0;function nV(e,t,n){tR(C(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function nU(e){let t;let n=e.type,{mixins:l,extends:r}=n,{mixins:i,optionsCache:o,config:{optionMergeStrategies:s}}=e.appContext,a=o.get(n);return a?t=a:i.length||l||r?(t={},i.length&&i.forEach(e=>nB(t,e,s,!0)),nB(t,n,s)):t=n,O(n)&&o.set(n,t),t}function nB(e,t,n,l=!1){let{mixins:r,extends:i}=t;for(let o in i&&nB(e,i,n,!0),r&&r.forEach(t=>nB(e,t,n,!0)),t)if(l&&"expose"===o);else{let l=nD[o]||n&&n[o];e[o]=l?l(e[o],t[o]):t[o]}return e}let nD={data:nj,props:nK,emits:nK,methods:nW,computed:nW,beforeCreate:nH,created:nH,beforeMount:nH,mounted:nH,beforeUpdate:nH,updated:nH,beforeDestroy:nH,beforeUnmount:nH,destroyed:nH,unmounted:nH,activated:nH,deactivated:nH,errorCaptured:nH,serverPrefetch:nH,components:nW,directives:nW,watch:function(e,t){if(!e)return t;if(!t)return e;let n=m(Object.create(null),e);for(let l in t)n[l]=nH(e[l],t[l]);return n},provide:nj,inject:function(e,t){return nW(n$(e),n$(t))}};function nj(e,t){return t?e?function(){return m(k(e)?e.call(this,this):e,k(t)?t.call(this,this):t)}:t:e}function n$(e){if(C(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function nH(e,t){return e?[...new Set([].concat(e,t))]:t}function nW(e,t){return e?m(Object.create(null),e,t):t}function nK(e,t){return e?C(e)&&C(t)?[...new Set([...e,...t])]:m(Object.create(null),nI(e),nI(null!=t?t:{})):t}function nz(){return{app:null,config:{isNativeTag:p,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let nG=0,nq=null;function nJ(e,t){if(rh){let n=rh.provides,l=rh.parent&&rh.parent.provides;l===n&&(n=rh.provides=Object.create(l)),n[e]=t}}function nX(e,t,n=!1){let l=rh||tJ;if(l||nq){let r=l?null==l.parent?l.vnode.appContext&&l.vnode.appContext.provides:l.parent.provides:nq._context.provides;if(r&&e in r)return r[e];if(arguments.length>1)return n&&k(t)?t.call(l&&l.proxy):t}}let nY={},nZ=()=>Object.create(nY),nQ=e=>Object.getPrototypeOf(e)===nY;function n0(e,t,n,l){let r;let[i,o]=e.propsOptions,s=!1;if(t)for(let a in t){let u;if(F(a))continue;let c=t[a];i&&b(i,u=B(a))?o&&o.includes(u)?(r||(r={}))[u]=c:n[u]=c:lV(e.emitsOptions,a)||a in l&&c===l[a]||(l[a]=c,s=!0)}if(o){let t=tc(n),l=r||c;for(let r=0;r<o.length;r++){let s=o[r];n[s]=n1(i,t,s,l[s],e,!b(l,s))}}return s}function n1(e,t,n,l,r,i){let o=e[n];if(null!=o){let e=b(o,"default");if(e&&void 0===l){let e=o.default;if(o.type!==Function&&!o.skipFactory&&k(e)){let{propsDefaults:i}=r;if(n in i)l=i[n];else{let o=rm(r);l=i[n]=e.call(null,t),o()}}else l=e}o[0]&&(i&&!e?l=!1:o[1]&&(""===l||l===j(n))&&(l=!0))}return l}let n2=new WeakMap;function n6(e){return!("$"===e[0]||F(e))}let n4=e=>"_"===e[0]||"$stable"===e,n3=e=>C(e)?e.map(rs):[rs(e)],n8=(e,t,n)=>{if(t._n)return t;let l=tZ((...e)=>n3(t(...e)),n);return l._c=!1,l},n5=(e,t,n)=>{let l=e._ctx;for(let n in e){if(n4(n))continue;let r=e[n];if(k(r))t[n]=n8(n,r,l);else if(null!=r){let e=n3(r);t[n]=()=>e}}},n9=(e,t)=>{let n=n3(t);e.slots.default=()=>n},n7=(e,t,n)=>{for(let l in t)(n||"_"!==l)&&(e[l]=t[l])},le=(e,t,n)=>{let l=e.slots=nZ();if(32&e.vnode.shapeFlag){let e=t._;e?(n7(l,t,n),n&&z(l,"_",e,!0)):n5(t,l)}else t&&n9(e,t)},lt=(e,t,n)=>{let{vnode:l,slots:r}=e,i=!0,o=c;if(32&l.shapeFlag){let e=t._;e?n&&1===e?i=!1:n7(r,t,n):(i=!t.$stable,n5(t,r)),o=t}else t&&(n9(e,t),o={default:1});if(i)for(let e in r)n4(e)||null!=o[e]||delete r[e]};function ln(e,t,n,l,r=!1){if(C(e)){e.forEach((e,i)=>ln(e,t&&(C(t)?t[i]:t),n,l,r));return}if(nr(l)&&!r)return;let i=4&l.shapeFlag?rx(l.component):l.el,o=r?null:i,{i:s,r:a}=e,u=t&&t.r,f=s.refs===c?s.refs={}:s.refs,d=s.setupState;if(null!=u&&u!==a&&(T(u)?(f[u]=null,b(d,u)&&(d[u]=null)):tv(u)&&(u.value=null)),k(a))tO(a,s,12,[o,f]);else{let t=T(a),l=tv(a);if(t||l){let s=()=>{if(e.f){let n=t?b(d,a)?d[a]:f[a]:a.value;r?C(n)&&_(n,i):C(n)?n.includes(i)||n.push(i):t?(f[a]=[i],b(d,a)&&(d[a]=f[a])):(a.value=[i],e.k&&(f[e.k]=a.value))}else t?(f[a]=o,b(d,a)&&(d[a]=o)):l&&(a.value=o,e.k&&(f[e.k]=o))};o?(s.id=-1,ly(s,n)):s()}}}let ll=Symbol("_vte"),lr=e=>e.__isTeleport,li=e=>e&&(e.disabled||""===e.disabled),lo=e=>"undefined"!=typeof SVGElement&&e instanceof SVGElement,ls=e=>"function"==typeof MathMLElement&&e instanceof MathMLElement,la=(e,t)=>{let n=e&&e.to;return T(n)?t?t(n):null:n};function lu(e,t,n,{o:{insert:l},m:r},i=2){0===i&&l(e.targetAnchor,t,n);let{el:o,anchor:s,shapeFlag:a,children:u,props:c}=e,f=2===i;if(f&&l(o,t,n),(!f||li(c))&&16&a)for(let e=0;e<u.length;e++)r(u[e],t,n,2);f&&l(s,t,n)}function lc(e){let t=e.ctx;if(t&&t.ut){let n=e.children[0].el;for(;n&&n!==e.targetAnchor;)1===n.nodeType&&n.setAttribute("data-v-owner",t.uid),n=n.nextSibling;t.ut()}}function lf(e,t,n,l){let r=t.targetStart=n(""),i=t.targetAnchor=n("");return r[ll]=i,e&&(l(r,e),l(i,e)),i}let ld=!1,lp=()=>{ld||(console.error("Hydration completed but contains mismatches."),ld=!0)},lh=e=>e.namespaceURI.includes("svg")&&"foreignObject"!==e.tagName,lg=e=>e.namespaceURI.includes("MathML"),lm=e=>lh(e)?"svg":lg(e)?"mathml":void 0,lv=e=>8===e.nodeType;function l_(e){let{mt:t,p:n,o:{patchProp:l,createText:r,nextSibling:i,parentNode:o,remove:s,insert:a,createComment:u}}=e,c=(n,l,s,u,h,b=!1)=>{b=b||!!l.dynamicChildren;let C=lv(n)&&"["===n.data,S=()=>g(n,l,s,u,h,C),{type:E,ref:x,shapeFlag:w,patchFlag:k}=l,T=n.nodeType;l.el=n,-2===k&&(b=!1,l.dynamicChildren=null);let A=null;switch(E){case lY:3!==T?""===l.children?(a(l.el=r(""),o(n),n),A=n):A=S():(n.data!==l.children&&(lp(),n.data=l.children),A=i(n));break;case lZ:y(n)?(A=i(n),_(l.el=n.content.firstChild,n,s)):A=8!==T||C?S():i(n);break;case lQ:if(C&&(T=(n=i(n)).nodeType),1===T||3===T){A=n;let e=!l.children.length;for(let t=0;t<l.staticCount;t++)e&&(l.children+=1===A.nodeType?A.outerHTML:A.data),t===l.staticCount-1&&(l.anchor=A),A=i(A);return C?i(A):A}S();break;case lX:A=C?p(n,l,s,u,h,b):S();break;default:if(1&w)A=1===T&&l.type.toLowerCase()===n.tagName.toLowerCase()||y(n)?f(n,l,s,u,h,b):S();else if(6&w){l.slotScopeIds=h;let e=o(n);if(A=C?m(n):lv(n)&&"teleport start"===n.data?m(n,n.data,"teleport end"):i(n),t(l,e,null,s,u,lm(e),b),nr(l)){let t;C?(t=rl(lX)).anchor=A?A.previousSibling:e.lastChild:t=3===n.nodeType?ro(""):rl("div"),t.el=n,l.component.subTree=t}}else 64&w?A=8!==T?S():l.type.hydrate(n,l,s,u,h,b,e,d):128&w&&(A=l.type.hydrate(n,l,s,u,lm(o(n)),h,b,e,c))}return null!=x&&ln(x,null,u,l),A},f=(e,t,n,r,i,o)=>{o=o||!!t.dynamicChildren;let{type:a,props:u,patchFlag:c,shapeFlag:f,dirs:p,transition:g}=t,m="input"===a||"option"===a;if(m||-1!==c){let a;p&&tQ(t,null,n,"created");let b=!1;if(y(e)){b=lx(r,g)&&n&&n.vnode.props&&n.vnode.props.appear;let l=e.content.firstChild;b&&g.beforeEnter(l),_(l,e,n),t.el=e=l}if(16&f&&!(u&&(u.innerHTML||u.textContent))){let l=d(e.firstChild,t,e,n,r,i,o);for(;l;){lp();let e=l;l=l.nextSibling,s(e)}}else 8&f&&e.textContent!==t.children&&(lp(),e.textContent=t.children);if(u){if(m||!o||48&c)for(let t in u)(m&&(t.endsWith("value")||"indeterminate"===t)||h(t)&&!F(t)||"."===t[0])&&l(e,t,null,u[t],void 0,n);else if(u.onClick)l(e,"onClick",null,u.onClick,void 0,n);else if(4&c&&to(u.style))for(let e in u.style)u.style[e]}(a=u&&u.onVnodeBeforeMount)&&rf(a,n,t),p&&tQ(t,null,n,"beforeMount"),((a=u&&u.onVnodeMounted)||p||b)&&lq(()=>{a&&rf(a,n,t),b&&g.enter(e),p&&tQ(t,null,n,"mounted")},r)}return e.nextSibling},d=(e,t,l,o,s,u,f)=>{f=f||!!t.dynamicChildren;let d=t.children,p=d.length;for(let t=0;t<p;t++){let p=f?d[t]:d[t]=rs(d[t]),h=p.type===lY;if(e){if(h&&!f){let n=d[t+1];n&&(n=rs(n)).type===lY&&(a(r(e.data.slice(p.children.length)),l,i(e)),e.data=p.children)}e=c(e,p,o,s,u,f)}else h&&!p.children?a(p.el=r(""),l):(lp(),n(null,p,l,null,o,s,lm(l),u))}return e},p=(e,t,n,l,r,s)=>{let{slotScopeIds:c}=t;c&&(r=r?r.concat(c):c);let f=o(e),p=d(i(e),t,f,n,l,r,s);return p&&lv(p)&&"]"===p.data?i(t.anchor=p):(lp(),a(t.anchor=u("]"),f,p),p)},g=(e,t,l,r,a,u)=>{if(lp(),t.el=null,u){let t=m(e);for(;;){let n=i(e);if(n&&n!==t)s(n);else break}}let c=i(e),f=o(e);return s(e),n(null,t,f,c,l,r,lm(f),a),c},m=(e,t="[",n="]")=>{let l=0;for(;e;)if((e=i(e))&&lv(e)&&(e.data===t&&l++,e.data===n)){if(0===l)return i(e);l--}return e},_=(e,t,n)=>{let l=t.parentNode;l&&l.replaceChild(e,t);let r=n;for(;r;)r.vnode.el===t&&(r.vnode.el=r.subTree.el=e),r=r.parent},y=e=>1===e.nodeType&&"template"===e.tagName.toLowerCase();return[(e,t)=>{if(!t.hasChildNodes()){n(null,e,t),tz(),t._vnode=e;return}c(t.firstChild,e,null,null,null),tz(),t._vnode=e},c]}let ly=lq;function lb(e){return lC(e,l_)}function lC(e,t){var n;let l,r;J().__VUE__=!0;let{insert:o,remove:s,patchProp:a,createElement:u,createText:p,createComment:h,setText:g,setElementText:_,parentNode:y,nextSibling:S,setScopeId:E=d,insertStaticContent:x}=e,w=(e,t,n,l=null,r=null,i=null,o,s=null,a=!!t.dynamicChildren)=>{if(e===t)return;e&&!l7(e,t)&&(l=es(e),en(e,r,i,!0),e=null),-2===t.patchFlag&&(a=!1,t.dynamicChildren=null);let{type:u,ref:c,shapeFlag:f}=t;switch(u){case lY:T(e,t,n,l);break;case lZ:A(e,t,n,l);break;case lQ:null==e&&N(t,n,l,o);break;case lX:W(e,t,n,l,r,i,o,s,a);break;default:1&f?P(e,t,n,l,r,i,o,s,a):6&f?z(e,t,n,l,r,i,o,s,a):64&f?u.process(e,t,n,l,r,i,o,s,a,ed):128&f&&u.process(e,t,n,l,r,i,o,s,a,ed)}null!=c&&r&&ln(c,e&&e.ref,i,t||e,!t)},T=(e,t,n,l)=>{if(null==e)o(t.el=p(t.children),n,l);else{let n=t.el=e.el;t.children!==e.children&&g(n,t.children)}},A=(e,t,n,l)=>{null==e?o(t.el=h(t.children||""),n,l):t.el=e.el},N=(e,t,n,l)=>{[e.el,e.anchor]=x(e.children,t,n,l,e.el,e.anchor)},L=({el:e,anchor:t},n,l)=>{let r;for(;e&&e!==t;)r=S(e),o(e,n,l),e=r;o(t,n,l)},M=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=S(e),s(e),e=n;s(t)},P=(e,t,n,l,r,i,o,s,a)=>{"svg"===t.type?o="svg":"math"===t.type&&(o="mathml"),null==e?I(t,n,l,r,i,o,s,a):D(e,t,r,i,o,s,a)},I=(e,t,n,l,r,i,s,c)=>{let f,d;let{props:p,shapeFlag:h,transition:g,dirs:m}=e;if(f=e.el=u(e.type,i,p&&p.is,p),8&h?_(f,e.children):16&h&&U(e.children,f,null,l,r,lS(e,i),s,c),m&&tQ(e,null,l,"created"),V(f,e,e.scopeId,s,l),p){for(let e in p)"value"===e||F(e)||a(f,e,null,p[e],i,l);"value"in p&&a(f,"value",null,p.value,i),(d=p.onVnodeBeforeMount)&&rf(d,l,e)}m&&tQ(e,null,l,"beforeMount");let y=lx(r,g);y&&g.beforeEnter(f),o(f,t,n),((d=p&&p.onVnodeMounted)||y||m)&&ly(()=>{d&&rf(d,l,e),y&&g.enter(f),m&&tQ(e,null,l,"mounted")},r)},V=(e,t,n,l,r)=>{if(n&&E(e,n),l)for(let t=0;t<l.length;t++)E(e,l[t]);if(r&&t===r.subTree){let t=r.vnode;V(e,t,t.scopeId,t.slotScopeIds,r.parent)}},U=(e,t,n,l,r,i,o,s,a=0)=>{for(let u=a;u<e.length;u++)w(null,e[u]=s?ra(e[u]):rs(e[u]),t,n,l,r,i,o,s)},D=(e,t,n,l,r,i,o)=>{let s;let u=t.el=e.el,{patchFlag:f,dynamicChildren:d,dirs:p}=t;f|=16&e.patchFlag;let h=e.props||c,g=t.props||c;if(n&&lE(n,!1),(s=g.onVnodeBeforeUpdate)&&rf(s,n,t,e),p&&tQ(t,e,n,"beforeUpdate"),n&&lE(n,!0),(h.innerHTML&&null==g.innerHTML||h.textContent&&null==g.textContent)&&_(u,""),d?$(e.dynamicChildren,d,u,n,l,lS(t,r),i):o||Z(e,t,u,null,n,l,lS(t,r),i,!1),f>0){if(16&f)H(u,h,g,n,r);else if(2&f&&h.class!==g.class&&a(u,"class",null,g.class,r),4&f&&a(u,"style",h.style,g.style,r),8&f){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let l=e[t],i=h[l],o=g[l];(o!==i||"value"===l)&&a(u,l,i,o,r,n)}}1&f&&e.children!==t.children&&_(u,t.children)}else o||null!=d||H(u,h,g,n,r);((s=g.onVnodeUpdated)||p)&&ly(()=>{s&&rf(s,n,t,e),p&&tQ(t,e,n,"updated")},l)},$=(e,t,n,l,r,i,o)=>{for(let s=0;s<t.length;s++){let a=e[s],u=t[s],c=a.el&&(a.type===lX||!l7(a,u)||70&a.shapeFlag)?y(a.el):n;w(a,u,c,null,l,r,i,o,!0)}},H=(e,t,n,l,r)=>{if(t!==n){if(t!==c)for(let i in t)F(i)||i in n||a(e,i,t[i],null,r,l);for(let i in n){if(F(i))continue;let o=n[i],s=t[i];o!==s&&"value"!==i&&a(e,i,s,o,r,l)}"value"in n&&a(e,"value",t.value,n.value,r)}},W=(e,t,n,l,r,i,s,a,u)=>{let c=t.el=e?e.el:p(""),f=t.anchor=e?e.anchor:p(""),{patchFlag:d,dynamicChildren:h,slotScopeIds:g}=t;g&&(a=a?a.concat(g):g),null==e?(o(c,n,l),o(f,n,l),U(t.children||[],n,f,r,i,s,a,u)):d>0&&64&d&&h&&e.dynamicChildren?($(e.dynamicChildren,h,n,r,i,s,a),(null!=t.key||r&&t===r.subTree)&&lw(e,t,!0)):Z(e,t,n,f,r,i,s,a,u)},z=(e,t,n,l,r,i,o,s,a)=>{t.slotScopeIds=s,null==e?512&t.shapeFlag?r.ctx.activate(t,n,l,o,a):G(t,n,l,r,i,o,a):q(e,t,a)},G=(e,t,n,l,r,o,s)=>{let a=e.component=function(e,t,n){let l=e.type,r=(t?t.appContext:e.appContext)||rd,i={uid:rp++,vnode:e,type:l,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,scope:new eu(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(r.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:function e(t,n,l=!1){let r=l?n2:n.propsCache,i=r.get(t);if(i)return i;let o=t.props,s={},a=[],u=!1;if(!k(t)){let r=t=>{u=!0;let[l,r]=e(t,n,!0);m(s,l),r&&a.push(...r)};!l&&n.mixins.length&&n.mixins.forEach(r),t.extends&&r(t.extends),t.mixins&&t.mixins.forEach(r)}if(!o&&!u)return O(t)&&r.set(t,f),f;if(C(o))for(let e=0;e<o.length;e++){let t=B(o[e]);n6(t)&&(s[t]=c)}else if(o)for(let e in o){let t=B(e);if(n6(t)){let n=o[e],l=s[t]=C(n)||k(n)?{type:n}:m({},n),r=l.type,i=!1,u=!0;if(C(r))for(let e=0;e<r.length;++e){let t=r[e],n=k(t)&&t.name;if("Boolean"===n){i=!0;break}"String"===n&&(u=!1)}else i=k(r)&&"Boolean"===r.name;l[0]=i,l[1]=u,(i||b(l,"default"))&&a.push(t)}}let d=[s,a];return O(t)&&r.set(t,d),d}(l,r),emitsOptions:function e(t,n,l=!1){let r=n.emitsCache,i=r.get(t);if(void 0!==i)return i;let o=t.emits,s={},a=!1;if(!k(t)){let r=t=>{let l=e(t,n,!0);l&&(a=!0,m(s,l))};!l&&n.mixins.length&&n.mixins.forEach(r),t.extends&&r(t.extends),t.mixins&&t.mixins.forEach(r)}return o||a?(C(o)?o.forEach(e=>s[e]=null):m(s,o),O(t)&&r.set(t,s),s):(O(t)&&r.set(t,null),null)}(l,r),emit:null,emitted:null,propsDefaults:c,inheritAttrs:l.inheritAttrs,ctx:c,data:c,props:c,attrs:c,slots:c,refs:c,setupState:c,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=t?t.root:i,i.emit=lF.bind(null,i),e.ce&&e.ce(i),i}(e,l,r);no(e)&&(a.ctx.renderer=ed),function(e,t=!1,n=!1){t&&i(t);let{props:l,children:r}=e.vnode,o=r_(e);(function(e,t,n,l=!1){let r={},i=nZ();for(let n in e.propsDefaults=Object.create(null),n0(e,t,r,i),e.propsOptions[0])n in r||(r[n]=void 0);n?e.props=l?r:tl(r):e.type.props?e.props=r:e.props=i,e.attrs=i})(e,l,o,t),le(e,r,n),o&&function(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,nL);let{setup:l}=n;if(l){let n=e.setupContext=l.length>1?rE(e):null,r=rm(e);e_();let i=tO(l,e,0,[e.props,n]);if(ey(),r(),R(i)){if(i.then(rv,rv),t)return i.then(n=>{rb(e,n,t)}).catch(t=>{tN(t,e,0)});e.asyncDep=i}else rb(e,i,t)}else rC(e,t)}(e,t),t&&i(!1)}(a,!1,s),a.asyncDep?(r&&r.registerDep(a,X,s),e.el||A(null,a.subTree=rl(lZ),t,n)):X(a,e,t,n,r,o,s)},q=(e,t,n)=>{let l=t.component=e.component;if(function(e,t,n){let{props:l,children:r,component:i}=e,{props:o,children:s,patchFlag:a}=t,u=i.emitsOptions;if(t.dirs||t.transition)return!0;if(!n||!(a>=0))return(!!r||!!s)&&(!s||!s.$stable)||l!==o&&(l?!o||lj(l,o,u):!!o);if(1024&a)return!0;if(16&a)return l?lj(l,o,u):!!o;if(8&a){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(o[n]!==l[n]&&!lV(u,n))return!0}}return!1}(e,t,n)){if(l.asyncDep&&!l.asyncResolved){Y(l,t,n);return}l.next=t,function(e){let t=tP.indexOf(e);t>tI&&tP.splice(t,1)}(l.update),l.effect.dirty=!0,l.update()}else t.el=e.el,l.vnode=t},X=(e,t,n,l,i,o,s)=>{let a=()=>{if(e.isMounted){let t,{next:n,bu:l,u:r,parent:u,vnode:c}=e;{let t=function e(t){let n=t.subTree.component;if(n)return n.asyncDep&&!n.asyncResolved?n:e(n)}(e);if(t){n&&(n.el=c.el,Y(e,n,s)),t.asyncDep.then(()=>{e.isUnmounted||a()});return}}let f=n;lE(e,!1),n?(n.el=c.el,Y(e,n,s)):n=c,l&&K(l),(t=n.props&&n.props.onVnodeBeforeUpdate)&&rf(t,u,n,c),lE(e,!0);let d=lU(e),p=e.subTree;e.subTree=d,w(p,d,y(p.el),es(p),e,i,o),n.el=d.el,null===f&&l$(e,d.el),r&&ly(r,i),(t=n.props&&n.props.onVnodeUpdated)&&ly(()=>rf(t,u,n,c),i)}else{let s;let{el:a,props:u}=t,{bm:c,m:f,parent:d}=e,p=nr(t);if(lE(e,!1),c&&K(c),!p&&(s=u&&u.onVnodeBeforeMount)&&rf(s,d,t),lE(e,!0),a&&r){let n=()=>{e.subTree=lU(e),r(a,e.subTree,e,i,null)};p?t.type.__asyncLoader().then(()=>!e.isUnmounted&&n()):n()}else{let r=e.subTree=lU(e);w(null,r,n,l,e,i,o),t.el=r.el}if(f&&ly(f,i),!p&&(s=u&&u.onVnodeMounted)){let e=t;ly(()=>rf(s,d,e),i)}(256&t.shapeFlag||d&&nr(d.vnode)&&256&d.vnode.shapeFlag)&&e.a&&ly(e.a,i),e.isMounted=!0,t=n=l=null}},u=e.effect=new ef(a,d,()=>t$(c),e.scope),c=e.update=()=>{u.dirty&&u.run()};c.i=e,c.id=e.uid,lE(e,!0),c()},Y=(e,t,n)=>{t.component=e;let l=e.vnode.props;e.vnode=t,e.next=null,function(e,t,n,l){let{props:r,attrs:i,vnode:{patchFlag:o}}=e,s=tc(r),[a]=e.propsOptions,u=!1;if((l||o>0)&&!(16&o)){if(8&o){let n=e.vnode.dynamicProps;for(let l=0;l<n.length;l++){let o=n[l];if(lV(e.emitsOptions,o))continue;let c=t[o];if(a){if(b(i,o))c!==i[o]&&(i[o]=c,u=!0);else{let t=B(o);r[t]=n1(a,s,t,c,e,!1)}}else c!==i[o]&&(i[o]=c,u=!0)}}}else{let l;for(let o in n0(e,t,r,i)&&(u=!0),s)t&&(b(t,o)||(l=j(o))!==o&&b(t,l))||(a?n&&(void 0!==n[o]||void 0!==n[l])&&(r[o]=n1(a,s,o,void 0,e,!0)):delete r[o]);if(i!==s)for(let e in i)t&&b(t,e)||(delete i[e],u=!0)}u&&eO(e.attrs,"set","")}(e,t.props,l,n),lt(e,t.children,n),e_(),tK(e),ey()},Z=(e,t,n,l,r,i,o,s,a=!1)=>{let u=e&&e.children,c=e?e.shapeFlag:0,f=t.children,{patchFlag:d,shapeFlag:p}=t;if(d>0){if(128&d){ee(u,f,n,l,r,i,o,s,a);return}if(256&d){Q(u,f,n,l,r,i,o,s,a);return}}8&p?(16&c&&eo(u,r,i),f!==u&&_(n,f)):16&c?16&p?ee(u,f,n,l,r,i,o,s,a):eo(u,r,i,!0):(8&c&&_(n,""),16&p&&U(f,n,l,r,i,o,s,a))},Q=(e,t,n,l,r,i,o,s,a)=>{let u;e=e||f,t=t||f;let c=e.length,d=t.length,p=Math.min(c,d);for(u=0;u<p;u++){let l=t[u]=a?ra(t[u]):rs(t[u]);w(e[u],l,n,null,r,i,o,s,a)}c>d?eo(e,r,i,!0,!1,p):U(t,n,l,r,i,o,s,a,p)},ee=(e,t,n,l,r,i,o,s,a)=>{let u=0,c=t.length,d=e.length-1,p=c-1;for(;u<=d&&u<=p;){let l=e[u],c=t[u]=a?ra(t[u]):rs(t[u]);if(l7(l,c))w(l,c,n,null,r,i,o,s,a);else break;u++}for(;u<=d&&u<=p;){let l=e[d],u=t[p]=a?ra(t[p]):rs(t[p]);if(l7(l,u))w(l,u,n,null,r,i,o,s,a);else break;d--,p--}if(u>d){if(u<=p){let e=p+1,f=e<c?t[e].el:l;for(;u<=p;)w(null,t[u]=a?ra(t[u]):rs(t[u]),n,f,r,i,o,s,a),u++}}else if(u>p)for(;u<=d;)en(e[u],r,i,!0),u++;else{let h;let g=u,m=u,_=new Map;for(u=m;u<=p;u++){let e=t[u]=a?ra(t[u]):rs(t[u]);null!=e.key&&_.set(e.key,u)}let y=0,b=p-m+1,C=!1,S=0,E=Array(b);for(u=0;u<b;u++)E[u]=0;for(u=g;u<=d;u++){let l;let c=e[u];if(y>=b){en(c,r,i,!0);continue}if(null!=c.key)l=_.get(c.key);else for(h=m;h<=p;h++)if(0===E[h-m]&&l7(c,t[h])){l=h;break}void 0===l?en(c,r,i,!0):(E[l-m]=u+1,l>=S?S=l:C=!0,w(c,t[l],n,null,r,i,o,s,a),y++)}let x=C?function(e){let t,n,l,r,i;let o=e.slice(),s=[0],a=e.length;for(t=0;t<a;t++){let a=e[t];if(0!==a){if(e[n=s[s.length-1]]<a){o[t]=n,s.push(t);continue}for(l=0,r=s.length-1;l<r;)e[s[i=l+r>>1]]<a?l=i+1:r=i;a<e[s[l]]&&(l>0&&(o[t]=s[l-1]),s[l]=t)}}for(l=s.length,r=s[l-1];l-- >0;)s[l]=r,r=o[r];return s}(E):f;for(h=x.length-1,u=b-1;u>=0;u--){let e=m+u,f=t[e],d=e+1<c?t[e+1].el:l;0===E[u]?w(null,f,n,d,r,i,o,s,a):C&&(h<0||u!==x[h]?et(f,n,d,2):h--)}}},et=(e,t,n,l,r=null)=>{let{el:i,type:s,transition:a,children:u,shapeFlag:c}=e;if(6&c){et(e.component.subTree,t,n,l);return}if(128&c){e.suspense.move(t,n,l);return}if(64&c){s.move(e,t,n,ed);return}if(s===lX){o(i,t,n);for(let e=0;e<u.length;e++)et(u[e],t,n,l);o(e.anchor,t,n);return}if(s===lQ){L(e,t,n);return}if(2!==l&&1&c&&a){if(0===l)a.beforeEnter(i),o(i,t,n),ly(()=>a.enter(i),r);else{let{leave:e,delayLeave:l,afterLeave:r}=a,s=()=>o(i,t,n),u=()=>{e(i,()=>{s(),r&&r()})};l?l(i,s,u):u()}}else o(i,t,n)},en=(e,t,n,l=!1,r=!1)=>{let i;let{type:o,props:s,ref:a,children:u,dynamicChildren:c,shapeFlag:f,patchFlag:d,dirs:p,cacheIndex:h}=e;if(-2===d&&(r=!1),null!=a&&ln(a,null,n,e,!0),null!=h&&(t.renderCache[h]=void 0),256&f){t.ctx.deactivate(e);return}let g=1&f&&p,m=!nr(e);if(m&&(i=s&&s.onVnodeBeforeUnmount)&&rf(i,t,e),6&f)ei(e.component,n,l);else{if(128&f){e.suspense.unmount(n,l);return}g&&tQ(e,null,t,"beforeUnmount"),64&f?e.type.remove(e,t,n,ed,l):c&&!c.hasOnce&&(o!==lX||d>0&&64&d)?eo(c,t,n,!1,!0):(o===lX&&384&d||!r&&16&f)&&eo(u,t,n),l&&el(e)}(m&&(i=s&&s.onVnodeUnmounted)||g)&&ly(()=>{i&&rf(i,t,e),g&&tQ(e,null,t,"unmounted")},n)},el=e=>{let{type:t,el:n,anchor:l,transition:r}=e;if(t===lX){er(n,l);return}if(t===lQ){M(e);return}let i=()=>{s(n),r&&!r.persisted&&r.afterLeave&&r.afterLeave()};if(1&e.shapeFlag&&r&&!r.persisted){let{leave:t,delayLeave:l}=r,o=()=>t(n,i);l?l(e.el,i,o):o()}else i()},er=(e,t)=>{let n;for(;e!==t;)n=S(e),s(e),e=n;s(t)},ei=(e,t,n)=>{let{bum:l,scope:r,update:i,subTree:o,um:s,m:a,a:u}=e;lk(a),lk(u),l&&K(l),r.stop(),i&&(i.active=!1,en(o,e,t,n)),s&&ly(s,t),ly(()=>{e.isUnmounted=!0},t),t&&t.pendingBranch&&!t.isUnmounted&&e.asyncDep&&!e.asyncResolved&&e.suspenseId===t.pendingId&&(t.deps--,0===t.deps&&t.resolve())},eo=(e,t,n,l=!1,r=!1,i=0)=>{for(let o=i;o<e.length;o++)en(e[o],t,n,l,r)},es=e=>{if(6&e.shapeFlag)return es(e.component.subTree);if(128&e.shapeFlag)return e.suspense.next();let t=S(e.anchor||e.el),n=t&&t[ll];return n?S(n):t},ea=!1,ec=(e,t,n)=>{null==e?t._vnode&&en(t._vnode,null,null,!0):w(t._vnode||null,e,t,null,null,null,n),ea||(ea=!0,tK(),tz(),ea=!1),t._vnode=e},ed={p:w,um:en,m:et,r:el,mt:G,mc:U,pc:Z,pbc:$,n:es,o:e};return t&&([l,r]=t(ed)),{render:ec,hydrate:l,createApp:(n=l,function(e,t=null){k(e)||(e=m({},e)),null==t||O(t)||(t=null);let l=nz(),r=new WeakSet,i=!1,o=l.app={_uid:nG++,_component:e,_props:t,_container:null,_context:l,_instance:null,version:rO,get config(){return l.config},set config(v){},use:(e,...t)=>(r.has(e)||(e&&k(e.install)?(r.add(e),e.install(o,...t)):k(e)&&(r.add(e),e(o,...t))),o),mixin:e=>(l.mixins.includes(e)||l.mixins.push(e),o),component:(e,t)=>t?(l.components[e]=t,o):l.components[e],directive:(e,t)=>t?(l.directives[e]=t,o):l.directives[e],mount(r,s,a){if(!i){let u=rl(e,t);return u.appContext=l,!0===a?a="svg":!1===a&&(a=void 0),s&&n?n(u,r):ec(u,r,a),i=!0,o._container=r,r.__vue_app__=o,rx(u.component)}},unmount(){i&&(ec(null,o._container),delete o._container.__vue_app__)},provide:(e,t)=>(l.provides[e]=t,o),runWithContext(e){let t=nq;nq=o;try{return e()}finally{nq=t}}};return o})}}function lS({type:e,props:t},n){return"svg"===n&&"foreignObject"===e||"mathml"===n&&"annotation-xml"===e&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function lE({effect:e,update:t},n){e.allowRecurse=t.allowRecurse=n}function lx(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function lw(e,t,n=!1){let l=e.children,r=t.children;if(C(l)&&C(r))for(let e=0;e<l.length;e++){let t=l[e],i=r[e];!(1&i.shapeFlag)||i.dynamicChildren||((i.patchFlag<=0||32===i.patchFlag)&&((i=r[e]=ra(r[e])).el=t.el),n||-2===i.patchFlag||lw(t,i)),i.type===lY&&(i.el=t.el)}}function lk(e){if(e)for(let t=0;t<e.length;t++)e[t].active=!1}let lT=Symbol.for("v-scx");function lA(e,t){return lN(e,null,{flush:"post"})}function lO(e,t){return lN(e,null,{flush:"sync"})}let lR={};function lN(e,t,{immediate:l,deep:r,flush:i,once:o,onTrack:s,onTrigger:a}=c){let u,f,p;if(t&&o){let e=t;t=(...t)=>{e(...t),T()}}let h=rh,g=e=>!0===r?e:lP(e,!1===r?1:void 0),m=!1,y=!1;if(tv(e)?(u=()=>e.value,m=ta(e)):to(e)?(u=()=>g(e),m=!0):C(e)?(y=!0,m=e.some(e=>to(e)||ta(e)),u=()=>e.map(e=>tv(e)?e.value:to(e)?g(e):k(e)?tO(e,h,2):void 0)):u=k(e)?t?()=>tO(e,h,2):()=>(f&&f(),tR(e,h,3,[b])):d,t&&r){let e=u;u=()=>lP(e())}let b=e=>{f=x.onStop=()=>{tO(e,h,4),f=x.onStop=void 0}},S=y?Array(e.length).fill(lR):lR,E=()=>{if(x.active&&x.dirty){if(t){let e=x.run();(r||m||(y?e.some((e,t)=>W(e,S[t])):W(e,S)))&&(f&&f(),tR(t,h,3,[e,S===lR?void 0:y&&S[0]===lR?[]:S,b]),S=e)}else x.run()}};E.allowRecurse=!!t,"sync"===i?p=E:"post"===i?p=()=>ly(E,h&&h.suspense):(E.pre=!0,h&&(E.id=h.uid),p=()=>t$(E));let x=new ef(u,d,p),w=n,T=()=>{x.stop(),w&&_(w.effects,x)};return t?l?E():S=x.run():"post"===i?ly(x.run.bind(x),h&&h.suspense):x.run(),T}function lL(e,t,n){let l;let r=this.proxy,i=T(e)?e.includes(".")?lM(r,e):()=>r[e]:e.bind(r,r);k(t)?l=t:(l=t.handler,n=t);let o=rm(this),s=lN(i,l.bind(r),n);return o(),s}function lM(e,t){let n=t.split(".");return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}function lP(e,t=1/0,n){if(t<=0||!O(e)||e.__v_skip||(n=n||new Set).has(e))return e;if(n.add(e),t--,tv(e))lP(e.value,t,n);else if(C(e))for(let l=0;l<e.length;l++)lP(e[l],t,n);else if(E(e)||S(e))e.forEach(e=>{lP(e,t,n)});else if(P(e)){for(let l in e)lP(e[l],t,n);for(let l of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,l)&&lP(e[l],t,n)}return e}let lI=(e,t)=>"modelValue"===t||"model-value"===t?e.modelModifiers:e[`${t}Modifiers`]||e[`${B(t)}Modifiers`]||e[`${j(t)}Modifiers`];function lF(e,t,...n){let l;if(e.isUnmounted)return;let r=e.vnode.props||c,i=n,o=t.startsWith("update:"),s=o&&lI(r,t.slice(7));s&&(s.trim&&(i=n.map(e=>T(e)?e.trim():e)),s.number&&(i=n.map(G)));let a=r[l=H(t)]||r[l=H(B(t))];!a&&o&&(a=r[l=H(j(t))]),a&&tR(a,e,6,i);let u=r[l+"Once"];if(u){if(e.emitted){if(e.emitted[l])return}else e.emitted={};e.emitted[l]=!0,tR(u,e,6,i)}}function lV(e,t){return!!(e&&h(t))&&(b(e,(t=t.slice(2).replace(/Once$/,""))[0].toLowerCase()+t.slice(1))||b(e,j(t))||b(e,t))}function lU(e){let t,n;let{type:l,vnode:r,proxy:i,withProxy:o,propsOptions:[s],slots:a,attrs:u,emit:c,render:f,renderCache:d,props:p,data:h,setupState:m,ctx:_,inheritAttrs:y}=e,b=tY(e);try{if(4&r.shapeFlag){let e=o||i;t=rs(f.call(e,e,d,p,m,h,_)),n=u}else t=rs(l.length>1?l(p,{attrs:u,slots:a,emit:c}):l(p,null)),n=l.props?u:lB(u)}catch(n){l0.length=0,tN(n,e,1),t=rl(lZ)}let C=t;if(n&&!1!==y){let e=Object.keys(n),{shapeFlag:t}=C;e.length&&7&t&&(s&&e.some(g)&&(n=lD(n,s)),C=ri(C,n,!1,!0))}return r.dirs&&((C=ri(C,null,!1,!0)).dirs=C.dirs?C.dirs.concat(r.dirs):r.dirs),r.transition&&(C.transition=r.transition),t=C,tY(b),t}let lB=e=>{let t;for(let n in e)("class"===n||"style"===n||h(n))&&((t||(t={}))[n]=e[n]);return t},lD=(e,t)=>{let n={};for(let l in e)g(l)&&l.slice(9) in t||(n[l]=e[l]);return n};function lj(e,t,n){let l=Object.keys(t);if(l.length!==Object.keys(e).length)return!0;for(let r=0;r<l.length;r++){let i=l[r];if(t[i]!==e[i]&&!lV(n,i))return!0}return!1}function l$({vnode:e,parent:t},n){for(;t;){let l=t.subTree;if(l.suspense&&l.suspense.activeBranch===e&&(l.el=e.el),l===e)(e=t.vnode).el=n,t=t.parent;else break}}let lH=e=>e.__isSuspense,lW=0;function lK(e,t){let n=e.props&&e.props[t];k(n)&&n()}function lz(e,t,n,l,r,i,o,s,a,u,c=!1){let f;let{p:d,m:p,um:h,n:g,o:{parentNode:m,remove:_}}=u,y=function(e){let t=e.props&&e.props.suspensible;return null!=t&&!1!==t}(e);y&&t&&t.pendingBranch&&(f=t.pendingId,t.deps++);let b=e.props?q(e.props.timeout):void 0,C=i,S={vnode:e,parent:t,parentComponent:n,namespace:o,container:l,hiddenContainer:r,deps:0,pendingId:lW++,timeout:"number"==typeof b?b:-1,activeBranch:null,pendingBranch:null,isInFallback:!c,isHydrating:c,isUnmounted:!1,effects:[],resolve(e=!1,n=!1){let{vnode:l,activeBranch:r,pendingBranch:o,pendingId:s,effects:a,parentComponent:u,container:c}=S,d=!1;S.isHydrating?S.isHydrating=!1:e||((d=r&&o.transition&&"out-in"===o.transition.mode)&&(r.transition.afterLeave=()=>{s===S.pendingId&&(p(o,c,i===C?g(r):i,0),tW(a))}),r&&(m(r.el)!==S.hiddenContainer&&(i=g(r)),h(r,u,S,!0)),d||p(o,c,i,0)),lJ(S,o),S.pendingBranch=null,S.isInFallback=!1;let _=S.parent,b=!1;for(;_;){if(_.pendingBranch){_.effects.push(...a),b=!0;break}_=_.parent}b||d||tW(a),S.effects=[],y&&t&&t.pendingBranch&&f===t.pendingId&&(t.deps--,0!==t.deps||n||t.resolve()),lK(l,"onResolve")},fallback(e){if(!S.pendingBranch)return;let{vnode:t,activeBranch:n,parentComponent:l,container:r,namespace:i}=S;lK(t,"onFallback");let o=g(n),u=()=>{S.isInFallback&&(d(null,e,r,o,l,null,i,s,a),lJ(S,e))},c=e.transition&&"out-in"===e.transition.mode;c&&(n.transition.afterLeave=u),S.isInFallback=!0,h(n,l,null,!0),c||u()},move(e,t,n){S.activeBranch&&p(S.activeBranch,e,t,n),S.container=e},next:()=>S.activeBranch&&g(S.activeBranch),registerDep(e,t,n){let l=!!S.pendingBranch;l&&S.deps++;let r=e.vnode.el;e.asyncDep.catch(t=>{tN(t,e,0)}).then(i=>{if(e.isUnmounted||S.isUnmounted||S.pendingId!==e.suspenseId)return;e.asyncResolved=!0;let{vnode:s}=e;rb(e,i,!1),r&&(s.el=r);let a=!r&&e.subTree.el;t(e,s,m(r||e.subTree.el),r?null:g(e.subTree),S,o,n),a&&_(a),l$(e,s.el),l&&0==--S.deps&&S.resolve()})},unmount(e,t){S.isUnmounted=!0,S.activeBranch&&h(S.activeBranch,n,e,t),S.pendingBranch&&h(S.pendingBranch,n,e,t)}};return S}function lG(e){let t;if(k(e)){let n=l4&&e._c;n&&(e._d=!1,l2()),e=e(),n&&(e._d=!0,t=l1,l6())}return C(e)&&(e=function(e,t=!0){let n;for(let t=0;t<e.length;t++){let l=e[t];if(!l9(l))return;if(l.type!==lZ||"v-if"===l.children){if(n)return;n=l}}return n}(e)),e=rs(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(t=>t!==e)),e}function lq(e,t){t&&t.pendingBranch?C(e)?t.effects.push(...e):t.effects.push(e):tW(e)}function lJ(e,t){e.activeBranch=t;let{vnode:n,parentComponent:l}=e,r=t.el;for(;!r&&t.component;)r=(t=t.component.subTree).el;n.el=r,l&&l.subTree===n&&(l.vnode.el=r,l$(l,r))}let lX=Symbol.for("v-fgt"),lY=Symbol.for("v-txt"),lZ=Symbol.for("v-cmt"),lQ=Symbol.for("v-stc"),l0=[],l1=null;function l2(e=!1){l0.push(l1=e?null:[])}function l6(){l0.pop(),l1=l0[l0.length-1]||null}let l4=1;function l3(e){l4+=e,e<0&&l1&&(l1.hasOnce=!0)}function l8(e){return e.dynamicChildren=l4>0?l1||f:null,l6(),l4>0&&l1&&l1.push(e),e}function l5(e,t,n,l,r){return l8(rl(e,t,n,l,r,!0))}function l9(e){return!!e&&!0===e.__v_isVNode}function l7(e,t){return e.type===t.type&&e.key===t.key}let re=({key:e})=>null!=e?e:null,rt=({ref:e,ref_key:t,ref_for:n})=>("number"==typeof e&&(e=""+e),null!=e?T(e)||tv(e)||k(e)?{i:tJ,r:e,k:t,f:!!n}:e:null);function rn(e,t=null,n=null,l=0,r=null,i=e===lX?0:1,o=!1,s=!1){let a={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&re(t),ref:t&&rt(t),scopeId:tX,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:l,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:tJ};return s?(ru(a,n),128&i&&e.normalize(a)):n&&(a.shapeFlag|=T(n)?8:16),l4>0&&!o&&l1&&(a.patchFlag>0||6&i)&&32!==a.patchFlag&&l1.push(a),a}let rl=function(e,t=null,n=null,l=0,r=null,i=!1){var o;if(e&&e!==nk||(e=lZ),l9(e)){let l=ri(e,t,!0);return n&&ru(l,n),l4>0&&!i&&l1&&(6&l.shapeFlag?l1[l1.indexOf(e)]=l:l1.push(l)),l.patchFlag=-2,l}if(k(o=e)&&"__vccOpts"in o&&(e=e.__vccOpts),t){let{class:e,style:n}=t=rr(t);e&&!T(e)&&(t.class=et(e)),O(n)&&(tu(n)&&!C(n)&&(n=m({},n)),t.style=Y(n))}let s=T(e)?1:lH(e)?128:lr(e)?64:O(e)?4:k(e)?2:0;return rn(e,t,n,l,r,s,i,!0)};function rr(e){return e?tu(e)||nQ(e)?m({},e):e:null}function ri(e,t,n=!1,l=!1){let{props:r,ref:i,patchFlag:o,children:s,transition:a}=e,u=t?rc(r||{},t):r,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&re(u),ref:t&&t.ref?n&&i?C(i)?i.concat(rt(t)):[i,rt(t)]:rt(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==lX?-1===o?16:16|o:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:a,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ri(e.ssContent),ssFallback:e.ssFallback&&ri(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return a&&l&&nt(c,a.clone(c)),c}function ro(e=" ",t=0){return rl(lY,null,e,t)}function rs(e){return null==e||"boolean"==typeof e?rl(lZ):C(e)?rl(lX,null,e.slice()):"object"==typeof e?ra(e):rl(lY,null,String(e))}function ra(e){return null===e.el&&-1!==e.patchFlag||e.memo?e:ri(e)}function ru(e,t){let n=0,{shapeFlag:l}=e;if(null==t)t=null;else if(C(t))n=16;else if("object"==typeof t){if(65&l){let n=t.default;n&&(n._c&&(n._d=!1),ru(e,n()),n._c&&(n._d=!0));return}{n=32;let l=t._;l||nQ(t)?3===l&&tJ&&(1===tJ.slots._?t._=1:(t._=2,e.patchFlag|=1024)):t._ctx=tJ}}else k(t)?(t={default:t,_ctx:tJ},n=32):(t=String(t),64&l?(n=16,t=[ro(t)]):n=8);e.children=t,e.shapeFlag|=n}function rc(...e){let t={};for(let n=0;n<e.length;n++){let l=e[n];for(let e in l)if("class"===e)t.class!==l.class&&(t.class=et([t.class,l.class]));else if("style"===e)t.style=Y([t.style,l.style]);else if(h(e)){let n=t[e],r=l[e];r&&n!==r&&!(C(n)&&n.includes(r))&&(t[e]=n?[].concat(n,r):r)}else""!==e&&(t[e]=l[e])}return t}function rf(e,t,n,l=null){tR(e,t,7,[n,l])}let rd=nz(),rp=0,rh=null,rg=()=>rh||tJ;r=e=>{rh=e},i=e=>{ry=e};let rm=e=>{let t=rh;return r(e),e.scope.on(),()=>{e.scope.off(),r(t)}},rv=()=>{rh&&rh.scope.off(),r(null)};function r_(e){return 4&e.vnode.shapeFlag}let ry=!1;function rb(e,t,n){k(t)?e.render=t:O(t)&&(e.setupState=tE(t)),rC(e,n)}function rC(e,t,n){let l=e.type;if(!e.render){if(!t&&o&&!l.render){let t=l.template||nU(e).template;if(t){let{isCustomElement:n,compilerOptions:r}=e.appContext.config,{delimiters:i,compilerOptions:s}=l,a=m(m({isCustomElement:n,delimiters:i},r),s);l.render=o(t,a)}}e.render=l.render||d,s&&s(e)}{let t=rm(e);e_();try{!function(e){let t=nU(e),n=e.proxy,l=e.ctx;nF=!1,t.beforeCreate&&nV(t.beforeCreate,e,"bc");let{data:r,computed:i,methods:o,watch:s,provide:a,inject:u,created:c,beforeMount:f,mounted:p,beforeUpdate:h,updated:g,activated:m,deactivated:_,beforeDestroy:y,beforeUnmount:b,destroyed:S,unmounted:E,render:x,renderTracked:w,renderTriggered:A,errorCaptured:R,serverPrefetch:N,expose:L,inheritAttrs:M,components:P,directives:I,filters:F}=t;if(u&&function(e,t,n=d){for(let n in C(e)&&(e=n$(e)),e){let l;let r=e[n];tv(l=O(r)?"default"in r?nX(r.from||n,r.default,!0):nX(r.from||n):nX(r))?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>l.value,set:e=>l.value=e}):t[n]=l}}(u,l,null),o)for(let e in o){let t=o[e];k(t)&&(l[e]=t.bind(n))}if(r){let t=r.call(n,n);O(t)&&(e.data=tn(t))}if(nF=!0,i)for(let e in i){let t=i[e],r=k(t)?t.bind(n,n):k(t.get)?t.get.bind(n,n):d,o=rk({get:r,set:!k(t)&&k(t.set)?t.set.bind(n):d});Object.defineProperty(l,e,{enumerable:!0,configurable:!0,get:()=>o.value,set:e=>o.value=e})}if(s)for(let e in s)!function e(t,n,l,r){let i=r.includes(".")?lM(l,r):()=>l[r];if(T(t)){let e=n[t];k(e)&&lN(i,e,void 0)}else if(k(t)){var o;o=t.bind(l),lN(i,o,void 0)}else if(O(t)){if(C(t))t.forEach(t=>e(t,n,l,r));else{let e=k(t.handler)?t.handler.bind(l):n[t.handler];k(e)&&lN(i,e,t)}}}(s[e],l,n,e);if(a){let e=k(a)?a.call(n):a;Reflect.ownKeys(e).forEach(t=>{nJ(t,e[t])})}function V(e,t){C(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(c&&nV(c,e,"c"),V(ng,f),V(nm,p),V(nv,h),V(n_,g),V(na,m),V(nu,_),V(nx,R),V(nE,w),V(nS,A),V(ny,b),V(nb,E),V(nC,N),C(L)){if(L.length){let t=e.exposed||(e.exposed={});L.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t})})}else e.exposed||(e.exposed={})}x&&e.render===d&&(e.render=x),null!=M&&(e.inheritAttrs=M),P&&(e.components=P),I&&(e.directives=I)}(e)}finally{ey(),t()}}}let rS={get:(e,t)=>(eA(e,"get",""),e[t])};function rE(e){return{attrs:new Proxy(e.attrs,rS),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function rx(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(tE(tf(e.exposed)),{get:(t,n)=>n in t?t[n]:n in nR?nR[n](e):void 0,has:(e,t)=>t in e||t in nR})):e.proxy}function rw(e,t=!0){return k(e)?e.displayName||e.name:e.name||t&&e.__name}let rk=(e,t)=>(function(e,t,n=!1){let l,r;let i=k(e);return i?(l=e,r=d):(l=e.get,r=e.set),new th(l,r,i||!r,n)})(e,0,ry);function rT(e,t,n){let l=arguments.length;return 2!==l?(l>3?n=Array.prototype.slice.call(arguments,2):3===l&&l9(n)&&(n=[n]),rl(e,t,n)):!O(t)||C(t)?rl(e,null,t):l9(t)?rl(e,null,[t]):rl(e,t)}function rA(e,t){let n=e.memo;if(n.length!=t.length)return!1;for(let e=0;e<n.length;e++)if(W(n[e],t[e]))return!1;return l4>0&&l1&&l1.push(e),!0}let rO="3.4.35",rR="undefined"!=typeof document?document:null,rN=rR&&rR.createElement("template"),rL="transition",rM="animation",rP=Symbol("_vtc"),rI=(e,{slots:t})=>rT(t8,rD(e),t);rI.displayName="Transition";let rF={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},rV=rI.props=m({},t4,rF),rU=(e,t=[])=>{C(e)?e.forEach(e=>e(...t)):e&&e(...t)},rB=e=>!!e&&(C(e)?e.some(e=>e.length>1):e.length>1);function rD(e){let t={};for(let n in e)n in rF||(t[n]=e[n]);if(!1===e.css)return t;let{name:n="v",type:l,duration:r,enterFromClass:i=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:s=`${n}-enter-to`,appearFromClass:a=i,appearActiveClass:u=o,appearToClass:c=s,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:d=`${n}-leave-active`,leaveToClass:p=`${n}-leave-to`}=e,h=function(e){if(null==e)return null;if(O(e))return[q(e.enter),q(e.leave)];{let t=q(e);return[t,t]}}(r),g=h&&h[0],_=h&&h[1],{onBeforeEnter:y,onEnter:b,onEnterCancelled:C,onLeave:S,onLeaveCancelled:E,onBeforeAppear:x=y,onAppear:w=b,onAppearCancelled:k=C}=t,T=(e,t,n)=>{r$(e,t?c:s),r$(e,t?u:o),n&&n()},A=(e,t)=>{e._isLeaving=!1,r$(e,f),r$(e,p),r$(e,d),t&&t()},R=e=>(t,n)=>{let r=e?w:b,o=()=>T(t,e,n);rU(r,[t,o]),rH(()=>{r$(t,e?a:i),rj(t,e?c:s),rB(r)||rK(t,l,g,o)})};return m(t,{onBeforeEnter(e){rU(y,[e]),rj(e,i),rj(e,o)},onBeforeAppear(e){rU(x,[e]),rj(e,a),rj(e,u)},onEnter:R(!1),onAppear:R(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>A(e,t);rj(e,f),rj(e,d),rJ(),rH(()=>{e._isLeaving&&(r$(e,f),rj(e,p),rB(S)||rK(e,l,_,n))}),rU(S,[e,n])},onEnterCancelled(e){T(e,!1),rU(C,[e])},onAppearCancelled(e){T(e,!0),rU(k,[e])},onLeaveCancelled(e){A(e),rU(E,[e])}})}function rj(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[rP]||(e[rP]=new Set)).add(t)}function r$(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));let n=e[rP];n&&(n.delete(t),n.size||(e[rP]=void 0))}function rH(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let rW=0;function rK(e,t,n,l){let r=e._endId=++rW,i=()=>{r===e._endId&&l()};if(n)return setTimeout(i,n);let{type:o,timeout:s,propCount:a}=rz(e,t);if(!o)return l();let u=o+"end",c=0,f=()=>{e.removeEventListener(u,d),i()},d=t=>{t.target===e&&++c>=a&&f()};setTimeout(()=>{c<a&&f()},s+1),e.addEventListener(u,d)}function rz(e,t){let n=window.getComputedStyle(e),l=e=>(n[e]||"").split(", "),r=l(`${rL}Delay`),i=l(`${rL}Duration`),o=rG(r,i),s=l(`${rM}Delay`),a=l(`${rM}Duration`),u=rG(s,a),c=null,f=0,d=0;t===rL?o>0&&(c=rL,f=o,d=i.length):t===rM?u>0&&(c=rM,f=u,d=a.length):d=(c=(f=Math.max(o,u))>0?o>u?rL:rM:null)?c===rL?i.length:a.length:0;let p=c===rL&&/\b(transform|all)(,|$)/.test(l(`${rL}Property`).toString());return{type:c,timeout:f,propCount:d,hasTransform:p}}function rG(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>rq(t)+rq(e[n])))}function rq(e){return"auto"===e?0:1e3*Number(e.slice(0,-1).replace(",","."))}function rJ(){return document.body.offsetHeight}let rX=Symbol("_vod"),rY=Symbol("_vsh");function rZ(e,t){e.style.display=t?e[rX]:"none",e[rY]=!t}let rQ=Symbol("");function r0(e,t){if(1===e.nodeType){let n=e.style,l="";for(let e in t)n.setProperty(`--${e}`,t[e]),l+=`--${e}: ${t[e]};`;n[rQ]=l}}let r1=/(^|;)\s*display\s*:/,r2=/\s*!important$/;function r6(e,t,n){if(C(n))n.forEach(n=>r6(e,t,n));else if(null==n&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{let l=function(e,t){let n=r3[t];if(n)return n;let l=B(t);if("filter"!==l&&l in e)return r3[t]=l;l=$(l);for(let n=0;n<r4.length;n++){let r=r4[n]+l;if(r in e)return r3[t]=r}return t}(e,t);r2.test(n)?e.setProperty(j(l),n.replace(r2,""),"important"):e[l]=n}}let r4=["Webkit","Moz","ms"],r3={},r8="http://www.w3.org/1999/xlink";function r5(e,t,n,l,r,i=en(t)){l&&t.startsWith("xlink:")?null==n?e.removeAttributeNS(r8,t.slice(6,t.length)):e.setAttributeNS(r8,t,n):null==n||i&&!(n||""===n)?e.removeAttribute(t):e.setAttribute(t,i?"":A(n)?String(n):n)}function r9(e,t,n,l){e.addEventListener(t,n,l)}let r7=Symbol("_vei"),ie=/(?:Once|Passive|Capture)$/,it=0,il=Promise.resolve(),ir=()=>it||(il.then(()=>it=0),it=Date.now()),ii=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)>96&&123>e.charCodeAt(2);/*! #__NO_SIDE_EFFECTS__ */function io(e,t,n){let l=nl(e,t);class r extends ia{constructor(e){super(l,e,n)}}return r.def=l,r}let is="undefined"!=typeof HTMLElement?HTMLElement:class{};class ia extends is{constructor(e,t={},n){super(),this._def=e,this._props=t,this._instance=null,this._connected=!1,this._resolved=!1,this._numberProps=null,this._ob=null,this.shadowRoot&&n?n(this._createVNode(),this.shadowRoot):(this.attachShadow({mode:"open"}),this._def.__asyncLoader||this._resolveProps(this._def))}connectedCallback(){this._connected=!0,this._instance||(this._resolved?this._update():this._resolveDef())}disconnectedCallback(){this._connected=!1,tj(()=>{this._connected||(this._ob&&(this._ob.disconnect(),this._ob=null),iV(null,this.shadowRoot),this._instance=null)})}_resolveDef(){this._resolved=!0;for(let e=0;e<this.attributes.length;e++)this._setAttr(this.attributes[e].name);this._ob=new MutationObserver(e=>{for(let t of e)this._setAttr(t.attributeName)}),this._ob.observe(this,{attributes:!0});let e=(e,t=!1)=>{let n;let{props:l,styles:r}=e;if(l&&!C(l))for(let e in l){let t=l[e];(t===Number||t&&t.type===Number)&&(e in this._props&&(this._props[e]=q(this._props[e])),(n||(n=Object.create(null)))[B(e)]=!0)}this._numberProps=n,t&&this._resolveProps(e),this._applyStyles(r),this._update()},t=this._def.__asyncLoader;t?t().then(t=>e(t,!0)):e(this._def)}_resolveProps(e){let{props:t}=e,n=C(t)?t:Object.keys(t||{});for(let e of Object.keys(this))"_"!==e[0]&&n.includes(e)&&this._setProp(e,this[e],!0,!1);for(let e of n.map(B))Object.defineProperty(this,e,{get(){return this._getProp(e)},set(t){this._setProp(e,t)}})}_setAttr(e){let t=this.hasAttribute(e)?this.getAttribute(e):void 0,n=B(e);this._numberProps&&this._numberProps[n]&&(t=q(t)),this._setProp(n,t,!1)}_getProp(e){return this._props[e]}_setProp(e,t,n=!0,l=!0){t!==this._props[e]&&(this._props[e]=t,l&&this._instance&&this._update(),n&&(!0===t?this.setAttribute(j(e),""):"string"==typeof t||"number"==typeof t?this.setAttribute(j(e),t+""):t||this.removeAttribute(j(e))))}_update(){iV(this._createVNode(),this.shadowRoot)}_createVNode(){let e=rl(this._def,m({},this._props));return this._instance||(e.ce=e=>{this._instance=e,e.isCE=!0;let t=(e,t)=>{this.dispatchEvent(new CustomEvent(e,{detail:t}))};e.emit=(e,...n)=>{t(e,n),j(e)!==e&&t(j(e),n)};let n=this;for(;n=n&&(n.parentNode||n.host);)if(n instanceof ia){e.parent=n._instance,e.provides=n._instance.provides;break}}),e}_applyStyles(e){e&&e.forEach(e=>{let t=document.createElement("style");t.textContent=e,this.shadowRoot.appendChild(t)})}}let iu=new WeakMap,ic=new WeakMap,id=Symbol("_moveCb"),ip=Symbol("_enterCb"),ih={name:"TransitionGroup",props:m({},rV,{tag:String,moveClass:String}),setup(e,{slots:t}){let n,l;let r=rg(),i=t2();return n_(()=>{if(!n.length)return;let t=e.moveClass||`${e.name||"v"}-move`;if(!function(e,t,n){let l=e.cloneNode(),r=e[rP];r&&r.forEach(e=>{e.split(/\s+/).forEach(e=>e&&l.classList.remove(e))}),n.split(/\s+/).forEach(e=>e&&l.classList.add(e)),l.style.display="none";let i=1===t.nodeType?t:t.parentNode;i.appendChild(l);let{hasTransform:o}=rz(l);return i.removeChild(l),o}(n[0].el,r.vnode.el,t))return;n.forEach(ig),n.forEach(im);let l=n.filter(iv);rJ(),l.forEach(e=>{let n=e.el,l=n.style;rj(n,t),l.transform=l.webkitTransform=l.transitionDuration="";let r=n[id]=e=>{(!e||e.target===n)&&(!e||/transform$/.test(e.propertyName))&&(n.removeEventListener("transitionend",r),n[id]=null,r$(n,t))};n.addEventListener("transitionend",r)})}),()=>{let o=tc(e),s=rD(o),a=o.tag||lX;if(n=[],l)for(let e=0;e<l.length;e++){let t=l[e];t.el&&t.el instanceof Element&&(n.push(t),nt(t,t9(t,s,i,r)),iu.set(t,t.el.getBoundingClientRect()))}l=t.default?nn(t.default()):[];for(let e=0;e<l.length;e++){let t=l[e];null!=t.key&&nt(t,t9(t,s,i,r))}return rl(a,null,l)}}};function ig(e){let t=e.el;t[id]&&t[id](),t[ip]&&t[ip]()}function im(e){ic.set(e,e.el.getBoundingClientRect())}function iv(e){let t=iu.get(e),n=ic.get(e),l=t.left-n.left,r=t.top-n.top;if(l||r){let t=e.el.style;return t.transform=t.webkitTransform=`translate(${l}px,${r}px)`,t.transitionDuration="0s",e}}ih.props;let i_=e=>{let t=e.props["onUpdate:modelValue"]||!1;return C(t)?e=>K(t,e):t};function iy(e){e.target.composing=!0}function ib(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}let iC=Symbol("_assign"),iS={created(e,{modifiers:{lazy:t,trim:n,number:l}},r){e[iC]=i_(r);let i=l||r.props&&"number"===r.props.type;r9(e,t?"change":"input",t=>{if(t.target.composing)return;let l=e.value;n&&(l=l.trim()),i&&(l=G(l)),e[iC](l)}),n&&r9(e,"change",()=>{e.value=e.value.trim()}),t||(r9(e,"compositionstart",iy),r9(e,"compositionend",ib),r9(e,"change",ib))},mounted(e,{value:t}){e.value=null==t?"":t},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:l,trim:r,number:i}},o){if(e[iC]=i_(o),e.composing)return;let s=(i||"number"===e.type)&&!/^0\d/.test(e.value)?G(e.value):e.value,a=null==t?"":t;s===a||document.activeElement===e&&"range"!==e.type&&(l&&t===n||r&&e.value.trim()===a)||(e.value=a)}},iE={deep:!0,created(e,t,n){e[iC]=i_(n),r9(e,"change",()=>{let t=e._modelValue,n=iA(e),l=e.checked,r=e[iC];if(C(t)){let e=er(t,n),i=-1!==e;if(l&&!i)r(t.concat(n));else if(!l&&i){let n=[...t];n.splice(e,1),r(n)}}else if(E(t)){let e=new Set(t);l?e.add(n):e.delete(n),r(e)}else r(iO(e,l))})},mounted:ix,beforeUpdate(e,t,n){e[iC]=i_(n),ix(e,t,n)}};function ix(e,{value:t,oldValue:n},l){e._modelValue=t,C(t)?e.checked=er(t,l.props.value)>-1:E(t)?e.checked=t.has(l.props.value):t!==n&&(e.checked=el(t,iO(e,!0)))}let iw={created(e,{value:t},n){e.checked=el(t,n.props.value),e[iC]=i_(n),r9(e,"change",()=>{e[iC](iA(e))})},beforeUpdate(e,{value:t,oldValue:n},l){e[iC]=i_(l),t!==n&&(e.checked=el(t,l.props.value))}},ik={deep:!0,created(e,{value:t,modifiers:{number:n}},l){let r=E(t);r9(e,"change",()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?G(iA(e)):iA(e));e[iC](e.multiple?r?new Set(t):t:t[0]),e._assigning=!0,tj(()=>{e._assigning=!1})}),e[iC]=i_(l)},mounted(e,{value:t}){iT(e,t)},beforeUpdate(e,t,n){e[iC]=i_(n)},updated(e,{value:t}){e._assigning||iT(e,t)}};function iT(e,t,n){let l=e.multiple,r=C(t);if(!l||r||E(t)){for(let n=0,i=e.options.length;n<i;n++){let i=e.options[n],o=iA(i);if(l){if(r){let e=typeof o;"string"===e||"number"===e?i.selected=t.some(e=>String(e)===String(o)):i.selected=er(t,o)>-1}else i.selected=t.has(o)}else if(el(iA(i),t)){e.selectedIndex!==n&&(e.selectedIndex=n);return}}l||-1===e.selectedIndex||(e.selectedIndex=-1)}}function iA(e){return"_value"in e?e._value:e.value}function iO(e,t){let n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}function iR(e,t,n,l,r){let i=function(e,t){switch(e){case"SELECT":return ik;case"TEXTAREA":return iS;default:switch(t){case"checkbox":return iE;case"radio":return iw;default:return iS}}}(e.tagName,n.props&&n.props.type)[r];i&&i(e,t,n,l)}let iN=["ctrl","shift","alt","meta"],iL={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&0!==e.button,middle:e=>"button"in e&&1!==e.button,right:e=>"button"in e&&2!==e.button,exact:(e,t)=>iN.some(n=>e[`${n}Key`]&&!t.includes(n))},iM={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},iP=m({patchProp:(e,t,n,l,r,i)=>{let o="svg"===r;"class"===t?function(e,t,n){let l=e[rP];l&&(t=(t?[t,...l]:[...l]).join(" ")),null==t?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}(e,l,o):"style"===t?function(e,t,n){let l=e.style,r=T(n),i=!1;if(n&&!r){if(t){if(T(t))for(let e of t.split(";")){let t=e.slice(0,e.indexOf(":")).trim();null==n[t]&&r6(l,t,"")}else for(let e in t)null==n[e]&&r6(l,e,"")}for(let e in n)"display"===e&&(i=!0),r6(l,e,n[e])}else if(r){if(t!==n){let e=l[rQ];e&&(n+=";"+e),l.cssText=n,i=r1.test(n)}}else t&&e.removeAttribute("style");rX in e&&(e[rX]=i?l.display:"",e[rY]&&(l.display="none"))}(e,n,l):h(t)?g(t)||function(e,t,n,l,r=null){let i=e[r7]||(e[r7]={}),o=i[t];if(l&&o)o.value=l;else{let[n,s]=function(e){let t;if(ie.test(e)){let n;for(t={};n=e.match(ie);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[":"===e[2]?e.slice(3):j(e.slice(2)),t]}(t);l?r9(e,n,i[t]=function(e,t){let n=e=>{if(e._vts){if(e._vts<=n.attached)return}else e._vts=Date.now();tR(function(e,t){if(!C(t))return t;{let n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}}(e,n.value),t,5,[e])};return n.value=e,n.attached=ir(),n}(l,r),s):o&&(!function(e,t,n,l){e.removeEventListener(t,n,l)}(e,n,o,s),i[t]=void 0)}}(e,t,0,l,i):("."===t[0]?(t=t.slice(1),0):"^"===t[0]?(t=t.slice(1),1):!function(e,t,n,l){if(l)return!!("innerHTML"===t||"textContent"===t||t in e&&ii(t)&&k(n));if("spellcheck"===t||"draggable"===t||"translate"===t||"form"===t||"list"===t&&"INPUT"===e.tagName||"type"===t&&"TEXTAREA"===e.tagName)return!1;if("width"===t||"height"===t){let t=e.tagName;if("IMG"===t||"VIDEO"===t||"CANVAS"===t||"SOURCE"===t)return!1}return!(ii(t)&&T(n))&&t in e}(e,t,l,o))?("true-value"===t?e._trueValue=l:"false-value"===t&&(e._falseValue=l),r5(e,t,l,o)):(!function(e,t,n,l){if("innerHTML"===t||"textContent"===t){if(null==n)return;e[t]=n;return}let r=e.tagName;if("value"===t&&"PROGRESS"!==r&&!r.includes("-")){let l="OPTION"===r?e.getAttribute("value")||"":e.value,i=null==n?"":String(n);l===i&&"_value"in e||(e.value=i),null==n&&e.removeAttribute(t),e._value=n;return}let i=!1;if(""===n||null==n){let l=typeof e[t];if("boolean"===l){var o;n=!!(o=n)||""===o}else null==n&&"string"===l?(n="",i=!0):"number"===l&&(n=0,i=!0)}try{e[t]=n}catch(e){}i&&e.removeAttribute(t)}(e,t,l),e.tagName.includes("-")||"value"!==t&&"checked"!==t&&"selected"!==t||r5(e,t,l,o,i,"value"!==t))}},{insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,l)=>{let r="svg"===t?rR.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?rR.createElementNS("http://www.w3.org/1998/Math/MathML",e):n?rR.createElement(e,{is:n}):rR.createElement(e);return"select"===e&&l&&null!=l.multiple&&r.setAttribute("multiple",l.multiple),r},createText:e=>rR.createTextNode(e),createComment:e=>rR.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>rR.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,l,r,i){let o=n?n.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),r!==i&&(r=r.nextSibling););else{rN.innerHTML="svg"===l?`<svg>${e}</svg>`:"mathml"===l?`<math>${e}</math>`:e;let r=rN.content;if("svg"===l||"mathml"===l){let e=r.firstChild;for(;e.firstChild;)r.appendChild(e.firstChild);r.removeChild(e)}t.insertBefore(r,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}}),iI=!1;function iF(){return a=iI?a:lb(iP),iI=!0,a}let iV=(...e)=>{(a||(a=lC(iP))).render(...e)},iU=(...e)=>{iF().hydrate(...e)};function iB(e){return e instanceof SVGElement?"svg":"function"==typeof MathMLElement&&e instanceof MathMLElement?"mathml":void 0}function iD(e){return T(e)?document.querySelector(e):e}return e.BaseTransition=t8,e.BaseTransitionPropsValidators=t4,e.Comment=lZ,e.DeprecationTypes=null,e.EffectScope=eu,e.ErrorCodes={SETUP_FUNCTION:0,0:"SETUP_FUNCTION",RENDER_FUNCTION:1,1:"RENDER_FUNCTION",WATCH_GETTER:2,2:"WATCH_GETTER",WATCH_CALLBACK:3,3:"WATCH_CALLBACK",WATCH_CLEANUP:4,4:"WATCH_CLEANUP",NATIVE_EVENT_HANDLER:5,5:"NATIVE_EVENT_HANDLER",COMPONENT_EVENT_HANDLER:6,6:"COMPONENT_EVENT_HANDLER",VNODE_HOOK:7,7:"VNODE_HOOK",DIRECTIVE_HOOK:8,8:"DIRECTIVE_HOOK",TRANSITION_HOOK:9,9:"TRANSITION_HOOK",APP_ERROR_HANDLER:10,10:"APP_ERROR_HANDLER",APP_WARN_HANDLER:11,11:"APP_WARN_HANDLER",FUNCTION_REF:12,12:"FUNCTION_REF",ASYNC_COMPONENT_LOADER:13,13:"ASYNC_COMPONENT_LOADER",SCHEDULER:14,14:"SCHEDULER",COMPONENT_UPDATE:15,15:"COMPONENT_UPDATE"},e.ErrorTypeStrings=null,e.Fragment=lX,e.KeepAlive={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){let n=rg(),l=n.ctx,r=new Map,i=new Set,o=null,s=n.suspense,{renderer:{p:a,m:u,um:c,o:{createElement:f}}}=l,d=f("div");function p(e){nf(e),c(e,n,s,!0)}function h(e){r.forEach((t,n)=>{let l=rw(t.type);!l||e&&e(l)||g(n)})}function g(e){let t=r.get(e);o&&l7(t,o)?o&&nf(o):p(t),r.delete(e),i.delete(e)}l.activate=(e,t,n,l,r)=>{let i=e.component;u(e,t,n,0,s),a(i.vnode,e,t,n,i,s,l,e.slotScopeIds,r),ly(()=>{i.isDeactivated=!1,i.a&&K(i.a);let t=e.props&&e.props.onVnodeMounted;t&&rf(t,i.parent,e)},s)},l.deactivate=e=>{let t=e.component;lk(t.m),lk(t.a),u(e,d,null,1,s),ly(()=>{t.da&&K(t.da);let n=e.props&&e.props.onVnodeUnmounted;n&&rf(n,t.parent,e),t.isDeactivated=!0},s)},lN(()=>[e.include,e.exclude],([e,t])=>{e&&h(t=>ns(e,t)),t&&h(e=>!ns(t,e))},{flush:"post",deep:!0});let m=null,_=()=>{null!=m&&(lH(n.subTree.type)?ly(()=>{r.set(m,nd(n.subTree))},n.subTree.suspense):r.set(m,nd(n.subTree)))};return nm(_),n_(_),ny(()=>{r.forEach(e=>{let{subTree:t,suspense:l}=n,r=nd(t);if(e.type===r.type&&e.key===r.key){nf(r);let e=r.component.da;e&&ly(e,l);return}p(e)})}),()=>{if(m=null,!t.default)return null;let n=t.default(),l=n[0];if(n.length>1)return o=null,n;if(!l9(l)||!(4&l.shapeFlag)&&!(128&l.shapeFlag))return o=null,l;let s=nd(l),a=s.type,u=rw(nr(s)?s.type.__asyncResolved||{}:a),{include:c,exclude:f,max:d}=e;if(c&&(!u||!ns(c,u))||f&&u&&ns(f,u))return o=s,l;let p=null==s.key?a:s.key,h=r.get(p);return s.el&&(s=ri(s),128&l.shapeFlag&&(l.ssContent=s)),m=p,h?(s.el=h.el,s.component=h.component,s.transition&&nt(s,s.transition),s.shapeFlag|=512,i.delete(p),i.add(p)):(i.add(p),d&&i.size>parseInt(d,10)&&g(i.values().next().value)),s.shapeFlag|=256,o=s,lH(l.type)?l:s}}},e.ReactiveEffect=ef,e.Static=lQ,e.Suspense={name:"Suspense",__isSuspense:!0,process(e,t,n,l,r,i,o,s,a,u){if(null==e)(function(e,t,n,l,r,i,o,s,a){let{p:u,o:{createElement:c}}=a,f=c("div"),d=e.suspense=lz(e,r,l,t,f,n,i,o,s,a);u(null,d.pendingBranch=e.ssContent,f,null,l,d,i,o),d.deps>0?(lK(e,"onPending"),lK(e,"onFallback"),u(null,e.ssFallback,t,n,l,null,i,o),lJ(d,e.ssFallback)):d.resolve(!1,!0)})(t,n,l,r,i,o,s,a,u);else{if(i&&i.deps>0&&!e.suspense.isInFallback){t.suspense=e.suspense,t.suspense.vnode=t,t.el=e.el;return}(function(e,t,n,l,r,i,o,s,{p:a,um:u,o:{createElement:c}}){let f=t.suspense=e.suspense;f.vnode=t,t.el=e.el;let d=t.ssContent,p=t.ssFallback,{activeBranch:h,pendingBranch:g,isInFallback:m,isHydrating:_}=f;if(g)f.pendingBranch=d,l7(d,g)?(a(g,d,f.hiddenContainer,null,r,f,i,o,s),f.deps<=0?f.resolve():m&&!_&&(a(h,p,n,l,r,null,i,o,s),lJ(f,p))):(f.pendingId=lW++,_?(f.isHydrating=!1,f.activeBranch=g):u(g,r,f),f.deps=0,f.effects.length=0,f.hiddenContainer=c("div"),m?(a(null,d,f.hiddenContainer,null,r,f,i,o,s),f.deps<=0?f.resolve():(a(h,p,n,l,r,null,i,o,s),lJ(f,p))):h&&l7(d,h)?(a(h,d,n,l,r,f,i,o,s),f.resolve(!0)):(a(null,d,f.hiddenContainer,null,r,f,i,o,s),f.deps<=0&&f.resolve()));else if(h&&l7(d,h))a(h,d,n,l,r,f,i,o,s),lJ(f,d);else if(lK(t,"onPending"),f.pendingBranch=d,512&d.shapeFlag?f.pendingId=d.component.suspenseId:f.pendingId=lW++,a(null,d,f.hiddenContainer,null,r,f,i,o,s),f.deps<=0)f.resolve();else{let{timeout:e,pendingId:t}=f;e>0?setTimeout(()=>{f.pendingId===t&&f.fallback(p)},e):0===e&&f.fallback(p)}})(e,t,n,l,r,o,s,a,u)}},hydrate:function(e,t,n,l,r,i,o,s,a){let u=t.suspense=lz(t,l,n,e.parentNode,document.createElement("div"),null,r,i,o,s,!0),c=a(e,u.pendingBranch=t.ssContent,n,u,i,o);return 0===u.deps&&u.resolve(!1,!0),c},normalize:function(e){let{shapeFlag:t,children:n}=e,l=32&t;e.ssContent=lG(l?n.default:n),e.ssFallback=l?lG(n.fallback):rl(lZ)}},e.Teleport={name:"Teleport",__isTeleport:!0,process(e,t,n,l,r,i,o,s,a,u){let{mc:c,pc:f,pbc:d,o:{insert:p,querySelector:h,createText:g,createComment:m}}=u,_=li(t.props),{shapeFlag:y,children:b,dynamicChildren:C}=t;if(null==e){let e=t.el=g(""),u=t.anchor=g("");p(e,n,l),p(u,n,l);let f=t.target=la(t.props,h),d=lf(f,t,g,p);f&&("svg"===o||lo(f)?o="svg":("mathml"===o||ls(f))&&(o="mathml"));let m=(e,t)=>{16&y&&c(b,e,t,r,i,o,s,a)};_?m(n,u):f&&m(f,d)}else{t.el=e.el,t.targetStart=e.targetStart;let l=t.anchor=e.anchor,c=t.target=e.target,p=t.targetAnchor=e.targetAnchor,g=li(e.props),m=g?n:c;if("svg"===o||lo(c)?o="svg":("mathml"===o||ls(c))&&(o="mathml"),C?(d(e.dynamicChildren,C,m,r,i,o,s),lw(e,t,!0)):a||f(e,t,m,g?l:p,r,i,o,s,!1),_)g?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):lu(t,n,l,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){let e=t.target=la(t.props,h);e&&lu(t,e,null,u,0)}else g&&lu(t,c,p,u,1)}lc(t)},remove(e,t,n,{um:l,o:{remove:r}},i){let{shapeFlag:o,children:s,anchor:a,targetStart:u,targetAnchor:c,target:f,props:d}=e;if(f&&(r(u),r(c)),i&&r(a),16&o){let e=i||!li(d);for(let r=0;r<s.length;r++){let i=s[r];l(i,t,n,e,!!i.dynamicChildren)}}},move:lu,hydrate:function(e,t,n,l,r,i,{o:{nextSibling:o,parentNode:s,querySelector:a,insert:u,createText:c}},f){let d=t.target=la(t.props,a);if(d){let a=d._lpa||d.firstChild;if(16&t.shapeFlag){if(li(t.props))t.anchor=f(o(e),t,s(e),n,l,r,i),t.targetStart=a,t.targetAnchor=a&&o(a);else{t.anchor=o(e);let s=a;for(;s;){if(s&&8===s.nodeType){if("teleport start anchor"===s.data)t.targetStart=s;else if("teleport anchor"===s.data){t.targetAnchor=s,d._lpa=t.targetAnchor&&o(t.targetAnchor);break}}s=o(s)}t.targetAnchor||lf(d,t,c,u),f(a&&o(a),t,d,n,l,r,i)}}lc(t)}return t.anchor&&o(t.anchor)}},e.Text=lY,e.TrackOpTypes={GET:"get",HAS:"has",ITERATE:"iterate"},e.Transition=rI,e.TransitionGroup=ih,e.TriggerOpTypes={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},e.VueElement=ia,e.assertNumber=function(e,t){},e.callWithAsyncErrorHandling=tR,e.callWithErrorHandling=tO,e.camelize=B,e.capitalize=$,e.cloneVNode=ri,e.compatUtils=null,e.computed=rk,e.createApp=(...e)=>{let t=(a||(a=lC(iP))).createApp(...e),{mount:n}=t;return t.mount=e=>{let l=iD(e);if(!l)return;let r=t._component;k(r)||r.render||r.template||(r.template=l.innerHTML),l.innerHTML="";let i=n(l,!1,iB(l));return l instanceof Element&&(l.removeAttribute("v-cloak"),l.setAttribute("data-v-app","")),i},t},e.createBlock=l5,e.createCommentVNode=function(e="",t=!1){return t?(l2(),l5(lZ,null,e)):rl(lZ,null,e)},e.createElementBlock=function(e,t,n,l,r,i){return l8(rn(e,t,n,l,r,i,!0))},e.createElementVNode=rn,e.createHydrationRenderer=lb,e.createPropsRestProxy=function(e,t){let n={};for(let l in e)t.includes(l)||Object.defineProperty(n,l,{enumerable:!0,get:()=>e[l]});return n},e.createRenderer=function(e){return lC(e)},e.createSSRApp=(...e)=>{let t=iF().createApp(...e),{mount:n}=t;return t.mount=e=>{let t=iD(e);if(t)return n(t,!0,iB(t))},t},e.createSlots=function(e,t){for(let n=0;n<t.length;n++){let l=t[n];if(C(l))for(let t=0;t<l.length;t++)e[l[t].name]=l[t].fn;else l&&(e[l.name]=l.key?(...e)=>{let t=l.fn(...e);return t&&(t.key=l.key),t}:l.fn)}return e},e.createStaticVNode=function(e,t){let n=rl(lQ,null,e);return n.staticCount=t,n},e.createTextVNode=ro,e.createVNode=rl,e.customRef=tw,e.defineAsyncComponent=/*! #__NO_SIDE_EFFECTS__ */function(e){let t;k(e)&&(e={loader:e});let{loader:n,loadingComponent:l,errorComponent:r,delay:i=200,timeout:o,suspensible:s=!0,onError:a}=e,u=null,c=0,f=()=>(c++,u=null,d()),d=()=>{let e;return u||(e=u=n().catch(e=>{if(e=e instanceof Error?e:Error(String(e)),a)return new Promise((t,n)=>{a(e,()=>t(f()),()=>n(e),c+1)});throw e}).then(n=>e!==u&&u?u:(n&&(n.__esModule||"Module"===n[Symbol.toStringTag])&&(n=n.default),t=n,n)))};return nl({name:"AsyncComponentWrapper",__asyncLoader:d,get __asyncResolved(){return t},setup(){let e=rh;if(t)return()=>ni(t,e);let n=t=>{u=null,tN(t,e,13,!r)};if(s&&e.suspense)return d().then(t=>()=>ni(t,e)).catch(e=>(n(e),()=>r?rl(r,{error:e}):null));let a=t_(!1),c=t_(),f=t_(!!i);return i&&setTimeout(()=>{f.value=!1},i),null!=o&&setTimeout(()=>{if(!a.value&&!c.value){let e=Error(`Async component timed out after ${o}ms.`);n(e),c.value=e}},o),d().then(()=>{a.value=!0,e.parent&&no(e.parent.vnode)&&(e.parent.effect.dirty=!0,t$(e.parent.update))}).catch(e=>{n(e),c.value=e}),()=>a.value&&t?ni(t,e):c.value&&r?rl(r,{error:c.value}):l&&!f.value?rl(l):void 0}})},e.defineComponent=nl,e.defineCustomElement=io,e.defineEmits=function(){return null},e.defineExpose=function(e){},e.defineModel=function(){},e.defineOptions=function(e){},e.defineProps=function(){return null},e.defineSSRCustomElement=(e,t)=>io(e,t,iU),e.defineSlots=function(){return null},e.devtools=void 0,e.effect=function(e,t){e.effect instanceof ef&&(e=e.effect.fn);let n=new ef(e,d,()=>{n.dirty&&n.run()});t&&(m(n,t),t.scope&&ec(n,t.scope)),t&&t.lazy||n.run();let l=n.run.bind(n);return l.effect=n,l},e.effectScope=function(e){return new eu(e)},e.getCurrentInstance=rg,e.getCurrentScope=function(){return n},e.getTransitionRawChildren=nn,e.guardReactiveProps=rr,e.h=rT,e.handleError=tN,e.hasInjectionContext=function(){return!!(rh||tJ||nq)},e.hydrate=iU,e.initCustomFormatter=function(){},e.initDirectivesForSSR=d,e.inject=nX,e.isMemoSame=rA,e.isProxy=tu,e.isReactive=to,e.isReadonly=ts,e.isRef=tv,e.isRuntimeOnly=()=>!o,e.isShallow=ta,e.isVNode=l9,e.markRaw=tf,e.mergeDefaults=function(e,t){let n=nI(e);for(let e in t){if(e.startsWith("__skip"))continue;let l=n[e];l?C(l)||k(l)?l=n[e]={type:l,default:t[e]}:l.default=t[e]:null===l&&(l=n[e]={default:t[e]}),l&&t[`__skip_${e}`]&&(l.skipFactory=!0)}return n},e.mergeModels=function(e,t){return e&&t?C(e)&&C(t)?e.concat(t):m({},nI(e),nI(t)):e||t},e.mergeProps=rc,e.nextTick=tj,e.normalizeClass=et,e.normalizeProps=function(e){if(!e)return null;let{class:t,style:n}=e;return t&&!T(t)&&(e.class=et(t)),n&&(e.style=Y(n)),e},e.normalizeStyle=Y,e.onActivated=na,e.onBeforeMount=ng,e.onBeforeUnmount=ny,e.onBeforeUpdate=nv,e.onDeactivated=nu,e.onErrorCaptured=nx,e.onMounted=nm,e.onRenderTracked=nE,e.onRenderTriggered=nS,e.onScopeDispose=function(e){n&&n.cleanups.push(e)},e.onServerPrefetch=nC,e.onUnmounted=nb,e.onUpdated=n_,e.openBlock=l2,e.popScopeId=function(){tX=null},e.provide=nJ,e.proxyRefs=tE,e.pushScopeId=function(e){tX=e},e.queuePostFlushCb=tW,e.reactive=tn,e.readonly=tr,e.ref=t_,e.registerRuntimeCompiler=function(e){o=e,s=e=>{e.render._rc&&(e.withProxy=new Proxy(e.ctx,nM))}},e.render=iV,e.renderList=function(e,t,n,l){let r;let i=n&&n[l];if(C(e)||T(e)){r=Array(e.length);for(let n=0,l=e.length;n<l;n++)r[n]=t(e[n],n,void 0,i&&i[n])}else if("number"==typeof e){r=Array(e);for(let n=0;n<e;n++)r[n]=t(n+1,n,void 0,i&&i[n])}else if(O(e)){if(e[Symbol.iterator])r=Array.from(e,(e,n)=>t(e,n,void 0,i&&i[n]));else{let n=Object.keys(e);r=Array(n.length);for(let l=0,o=n.length;l<o;l++){let o=n[l];r[l]=t(e[o],o,l,i&&i[l])}}}else r=[];return n&&(n[l]=r),r},e.renderSlot=function(e,t,n={},l,r){if(tJ.isCE||tJ.parent&&nr(tJ.parent)&&tJ.parent.isCE)return"default"!==t&&(n.name=t),rl("slot",n,l&&l());let i=e[t];i&&i._c&&(i._d=!1),l2();let o=i&&function e(t){return t.some(t=>!l9(t)||!!(t.type!==lZ&&(t.type!==lX||e(t.children))))?t:null}(i(n)),s=l5(lX,{key:(n.key||o&&o.key||`_${t}`)+(!o&&l?"_fb":"")},o||(l?l():[]),o&&1===e._?64:-2);return!r&&s.scopeId&&(s.slotScopeIds=[s.scopeId+"-s"]),i&&i._c&&(i._d=!0),s},e.resolveComponent=function(e,t){return nT(nw,e,!0,t)||e},e.resolveDirective=function(e){return nT("directives",e)},e.resolveDynamicComponent=function(e){return T(e)?nT(nw,e,!1)||e:e||nk},e.resolveFilter=null,e.resolveTransitionHooks=t9,e.setBlockTracking=l3,e.setDevtoolsHook=d,e.setTransitionHooks=nt,e.shallowReactive=tl,e.shallowReadonly=function(e){return ti(e,!0,eD,e5,tt)},e.shallowRef=function(e){return ty(e,!0)},e.ssrContextKey=lT,e.ssrUtils=null,e.stop=function(e){e.effect.stop()},e.toDisplayString=eo,e.toHandlerKey=H,e.toHandlers=function(e,t){let n={};for(let l in e)n[t&&/[A-Z]/.test(l)?`on:${l}`:H(l)]=e[l];return n},e.toRaw=tc,e.toRef=function(e,t,n){return tv(e)?e:k(e)?new tT(e):O(e)&&arguments.length>1?tA(e,t,n):t_(e)},e.toRefs=function(e){let t=C(e)?Array(e.length):{};for(let n in e)t[n]=tA(e,n);return t},e.toValue=function(e){return k(e)?e():tC(e)},e.transformVNodeArgs=function(e){},e.triggerRef=function(e){tm(e,4)},e.unref=tC,e.useAttrs=function(){return nP().attrs},e.useCssModule=function(e="$style"){return c},e.useCssVars=function(e){let t=rg();if(!t)return;let n=t.ut=(n=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(e=>r0(e,n))},l=()=>{let l=e(t.proxy);(function e(t,n){if(128&t.shapeFlag){let l=t.suspense;t=l.activeBranch,l.pendingBranch&&!l.isHydrating&&l.effects.push(()=>{e(l.activeBranch,n)})}for(;t.component;)t=t.component.subTree;if(1&t.shapeFlag&&t.el)r0(t.el,n);else if(t.type===lX)t.children.forEach(t=>e(t,n));else if(t.type===lQ){let{el:e,anchor:l}=t;for(;e&&(r0(e,n),e!==l);)e=e.nextSibling}})(t.subTree,l),n(l)};nm(()=>{lA(l);let e=new MutationObserver(l);e.observe(t.subTree.el.parentNode,{childList:!0}),nb(()=>e.disconnect())})},e.useModel=function(e,t,n=c){let l=rg(),r=B(t),i=j(t),o=lI(e,t),s=tw((o,s)=>{let a,u;let f=c;return lO(()=>{let n=e[t];W(a,n)&&(a=n,s())}),{get:()=>(o(),n.get?n.get(a):a),set(e){if(!W(e,a)&&!(f!==c&&W(e,f)))return;let o=l.vnode.props;o&&(t in o||r in o||i in o)&&(`onUpdate:${t}` in o||`onUpdate:${r}` in o||`onUpdate:${i}` in o)||(a=e,s());let d=n.set?n.set(e):e;l.emit(`update:${t}`,d),W(e,d)&&W(e,f)&&!W(d,u)&&s(),f=e,u=d}}});return s[Symbol.iterator]=()=>{let e=0;return{next:()=>e<2?{value:e++?o||c:s,done:!1}:{done:!0}}},s},e.useSSRContext=()=>{},e.useSlots=function(){return nP().slots},e.useTransitionState=t2,e.vModelCheckbox=iE,e.vModelDynamic={created(e,t,n){iR(e,t,n,null,"created")},mounted(e,t,n){iR(e,t,n,null,"mounted")},beforeUpdate(e,t,n,l){iR(e,t,n,l,"beforeUpdate")},updated(e,t,n,l){iR(e,t,n,l,"updated")}},e.vModelRadio=iw,e.vModelSelect=ik,e.vModelText=iS,e.vShow={beforeMount(e,{value:t},{transition:n}){e[rX]="none"===e.style.display?"":e.style.display,n&&t?n.beforeEnter(e):rZ(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:l}){!t!=!n&&(l?t?(l.beforeEnter(e),rZ(e,!0),l.enter(e)):l.leave(e,()=>{rZ(e,!1)}):rZ(e,t))},beforeUnmount(e,{value:t}){rZ(e,t)}},e.version=rO,e.warn=d,e.watch=function(e,t,n){return lN(e,t,n)},e.watchEffect=function(e,t){return lN(e,null,t)},e.watchPostEffect=lA,e.watchSyncEffect=lO,e.withAsyncContext=function(e){let t=rg(),n=e();return rv(),R(n)&&(n=n.catch(e=>{throw rm(t),e})),[n,()=>rm(t)]},e.withCtx=tZ,e.withDefaults=function(e,t){return null},e.withDirectives=function(e,t){if(null===tJ)return e;let n=rx(tJ),l=e.dirs||(e.dirs=[]);for(let e=0;e<t.length;e++){let[r,i,o,s=c]=t[e];r&&(k(r)&&(r={mounted:r,updated:r}),r.deep&&lP(i),l.push({dir:r,instance:n,value:i,oldValue:void 0,arg:o,modifiers:s}))}return e},e.withKeys=(e,t)=>{let n=e._withKeys||(e._withKeys={}),l=t.join(".");return n[l]||(n[l]=n=>{if(!("key"in n))return;let l=j(n.key);if(t.some(e=>e===l||iM[e]===l))return e(n)})},e.withMemo=function(e,t,n,l){let r=n[l];if(r&&rA(r,e))return r;let i=t();return i.memo=e.slice(),i.cacheIndex=l,n[l]=i},e.withModifiers=(e,t)=>{let n=e._withMods||(e._withMods={}),l=t.join(".");return n[l]||(n[l]=(n,...l)=>{for(let e=0;e<t.length;e++){let l=iL[t[e]];if(l&&l(n,t))return}return e(n,...l)})},e.withScopeId=e=>tZ,e}({}); | |
=== END FILE === | |
=== START FILE: ./node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js === | |
/** | |
* @vue/runtime-dom v3.4.35 | |
* (c) 2018-present Yuxi (Evan) You and Vue contributors | |
* @license MIT | |
**/ | |
'use strict'; | |
Object.defineProperty(exports, '__esModule', { value: true }); | |
var runtimeCore = require('@vue/runtime-core'); | |
var shared = require('@vue/shared'); | |
const svgNS = "http://www.w3.org/2000/svg"; | |
const mathmlNS = "http://www.w3.org/1998/Math/MathML"; | |
const doc = typeof document !== "undefined" ? document : null; | |
const templateContainer = doc && /* @__PURE__ */ doc.createElement("template"); | |
const nodeOps = { | |
insert: (child, parent, anchor) => { | |
parent.insertBefore(child, anchor || null); | |
}, | |
remove: (child) => { | |
const parent = child.parentNode; | |
if (parent) { | |
parent.removeChild(child); | |
} | |
}, | |
createElement: (tag, namespace, is, props) => { | |
const el = namespace === "svg" ? doc.createElementNS(svgNS, tag) : namespace === "mathml" ? doc.createElementNS(mathmlNS, tag) : is ? doc.createElement(tag, { is }) : doc.createElement(tag); | |
if (tag === "select" && props && props.multiple != null) { | |
el.setAttribute("multiple", props.multiple); | |
} | |
return el; | |
}, | |
createText: (text) => doc.createTextNode(text), | |
createComment: (text) => doc.createComment(text), | |
setText: (node, text) => { | |
node.nodeValue = text; | |
}, | |
setElementText: (el, text) => { | |
el.textContent = text; | |
}, | |
parentNode: (node) => node.parentNode, | |
nextSibling: (node) => node.nextSibling, | |
querySelector: (selector) => doc.querySelector(selector), | |
setScopeId(el, id) { | |
el.setAttribute(id, ""); | |
}, | |
// __UNSAFE__ | |
// Reason: innerHTML. | |
// Static content here can only come from compiled templates. | |
// As long as the user only uses trusted templates, this is safe. | |
insertStaticContent(content, parent, anchor, namespace, start, end) { | |
const before = anchor ? anchor.previousSibling : parent.lastChild; | |
if (start && (start === end || start.nextSibling)) { | |
while (true) { | |
parent.insertBefore(start.cloneNode(true), anchor); | |
if (start === end || !(start = start.nextSibling)) break; | |
} | |
} else { | |
templateContainer.innerHTML = namespace === "svg" ? `<svg>${content}</svg>` : namespace === "mathml" ? `<math>${content}</math>` : content; | |
const template = templateContainer.content; | |
if (namespace === "svg" || namespace === "mathml") { | |
const wrapper = template.firstChild; | |
while (wrapper.firstChild) { | |
template.appendChild(wrapper.firstChild); | |
} | |
template.removeChild(wrapper); | |
} | |
parent.insertBefore(template, anchor); | |
} | |
return [ | |
// first | |
before ? before.nextSibling : parent.firstChild, | |
// last | |
anchor ? anchor.previousSibling : parent.lastChild | |
]; | |
} | |
}; | |
const TRANSITION = "transition"; | |
const ANIMATION = "animation"; | |
const vtcKey = Symbol("_vtc"); | |
const Transition = (props, { slots }) => runtimeCore.h(runtimeCore.BaseTransition, resolveTransitionProps(props), slots); | |
Transition.displayName = "Transition"; | |
const DOMTransitionPropsValidators = { | |
name: String, | |
type: String, | |
css: { | |
type: Boolean, | |
default: true | |
}, | |
duration: [String, Number, Object], | |
enterFromClass: String, | |
enterActiveClass: String, | |
enterToClass: String, | |
appearFromClass: String, | |
appearActiveClass: String, | |
appearToClass: String, | |
leaveFromClass: String, | |
leaveActiveClass: String, | |
leaveToClass: String | |
}; | |
const TransitionPropsValidators = Transition.props = /* @__PURE__ */ shared.extend( | |
{}, | |
runtimeCore.BaseTransitionPropsValidators, | |
DOMTransitionPropsValidators | |
); | |
const callHook = (hook, args = []) => { | |
if (shared.isArray(hook)) { | |
hook.forEach((h2) => h2(...args)); | |
} else if (hook) { | |
hook(...args); | |
} | |
}; | |
const hasExplicitCallback = (hook) => { | |
return hook ? shared.isArray(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false; | |
}; | |
function resolveTransitionProps(rawProps) { | |
const baseProps = {}; | |
for (const key in rawProps) { | |
if (!(key in DOMTransitionPropsValidators)) { | |
baseProps[key] = rawProps[key]; | |
} | |
} | |
if (rawProps.css === false) { | |
return baseProps; | |
} | |
const { | |
name = "v", | |
type, | |
duration, | |
enterFromClass = `${name}-enter-from`, | |
enterActiveClass = `${name}-enter-active`, | |
enterToClass = `${name}-enter-to`, | |
appearFromClass = enterFromClass, | |
appearActiveClass = enterActiveClass, | |
appearToClass = enterToClass, | |
leaveFromClass = `${name}-leave-from`, | |
leaveActiveClass = `${name}-leave-active`, | |
leaveToClass = `${name}-leave-to` | |
} = rawProps; | |
const durations = normalizeDuration(duration); | |
const enterDuration = durations && durations[0]; | |
const leaveDuration = durations && durations[1]; | |
const { | |
onBeforeEnter, | |
onEnter, | |
onEnterCancelled, | |
onLeave, | |
onLeaveCancelled, | |
onBeforeAppear = onBeforeEnter, | |
onAppear = onEnter, | |
onAppearCancelled = onEnterCancelled | |
} = baseProps; | |
const finishEnter = (el, isAppear, done) => { | |
removeTransitionClass(el, isAppear ? appearToClass : enterToClass); | |
removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass); | |
done && done(); | |
}; | |
const finishLeave = (el, done) => { | |
el._isLeaving = false; | |
removeTransitionClass(el, leaveFromClass); | |
removeTransitionClass(el, leaveToClass); | |
removeTransitionClass(el, leaveActiveClass); | |
done && done(); | |
}; | |
const makeEnterHook = (isAppear) => { | |
return (el, done) => { | |
const hook = isAppear ? onAppear : onEnter; | |
const resolve = () => finishEnter(el, isAppear, done); | |
callHook(hook, [el, resolve]); | |
nextFrame(() => { | |
removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass); | |
addTransitionClass(el, isAppear ? appearToClass : enterToClass); | |
if (!hasExplicitCallback(hook)) { | |
whenTransitionEnds(el, type, enterDuration, resolve); | |
} | |
}); | |
}; | |
}; | |
return shared.extend(baseProps, { | |
onBeforeEnter(el) { | |
callHook(onBeforeEnter, [el]); | |
addTransitionClass(el, enterFromClass); | |
addTransitionClass(el, enterActiveClass); | |
}, | |
onBeforeAppear(el) { | |
callHook(onBeforeAppear, [el]); | |
addTransitionClass(el, appearFromClass); | |
addTransitionClass(el, appearActiveClass); | |
}, | |
onEnter: makeEnterHook(false), | |
onAppear: makeEnterHook(true), | |
onLeave(el, done) { | |
el._isLeaving = true; | |
const resolve = () => finishLeave(el, done); | |
addTransitionClass(el, leaveFromClass); | |
addTransitionClass(el, leaveActiveClass); | |
forceReflow(); | |
nextFrame(() => { | |
if (!el._isLeaving) { | |
return; | |
} | |
removeTransitionClass(el, leaveFromClass); | |
addTransitionClass(el, leaveToClass); | |
if (!hasExplicitCallback(onLeave)) { | |
whenTransitionEnds(el, type, leaveDuration, resolve); | |
} | |
}); | |
callHook(onLeave, [el, resolve]); | |
}, | |
onEnterCancelled(el) { | |
finishEnter(el, false); | |
callHook(onEnterCancelled, [el]); | |
}, | |
onAppearCancelled(el) { | |
finishEnter(el, true); | |
callHook(onAppearCancelled, [el]); | |
}, | |
onLeaveCancelled(el) { | |
finishLeave(el); | |
callHook(onLeaveCancelled, [el]); | |
} | |
}); | |
} | |
function normalizeDuration(duration) { | |
if (duration == null) { | |
return null; | |
} else if (shared.isObject(duration)) { | |
return [NumberOf(duration.enter), NumberOf(duration.leave)]; | |
} else { | |
const n = NumberOf(duration); | |
return [n, n]; | |
} | |
} | |
function NumberOf(val) { | |
const res = shared.toNumber(val); | |
return res; | |
} | |
function addTransitionClass(el, cls) { | |
cls.split(/\s+/).forEach((c) => c && el.classList.add(c)); | |
(el[vtcKey] || (el[vtcKey] = /* @__PURE__ */ new Set())).add(cls); | |
} | |
function removeTransitionClass(el, cls) { | |
cls.split(/\s+/).forEach((c) => c && el.classList.remove(c)); | |
const _vtc = el[vtcKey]; | |
if (_vtc) { | |
_vtc.delete(cls); | |
if (!_vtc.size) { | |
el[vtcKey] = void 0; | |
} | |
} | |
} | |
function nextFrame(cb) { | |
requestAnimationFrame(() => { | |
requestAnimationFrame(cb); | |
}); | |
} | |
let endId = 0; | |
function whenTransitionEnds(el, expectedType, explicitTimeout, resolve) { | |
const id = el._endId = ++endId; | |
const resolveIfNotStale = () => { | |
if (id === el._endId) { | |
resolve(); | |
} | |
}; | |
if (explicitTimeout) { | |
return setTimeout(resolveIfNotStale, explicitTimeout); | |
} | |
const { type, timeout, propCount } = getTransitionInfo(el, expectedType); | |
if (!type) { | |
return resolve(); | |
} | |
const endEvent = type + "end"; | |
let ended = 0; | |
const end = () => { | |
el.removeEventListener(endEvent, onEnd); | |
resolveIfNotStale(); | |
}; | |
const onEnd = (e) => { | |
if (e.target === el && ++ended >= propCount) { | |
end(); | |
} | |
}; | |
setTimeout(() => { | |
if (ended < propCount) { | |
end(); | |
} | |
}, timeout + 1); | |
el.addEventListener(endEvent, onEnd); | |
} | |
function getTransitionInfo(el, expectedType) { | |
const styles = window.getComputedStyle(el); | |
const getStyleProperties = (key) => (styles[key] || "").split(", "); | |
const transitionDelays = getStyleProperties(`${TRANSITION}Delay`); | |
const transitionDurations = getStyleProperties(`${TRANSITION}Duration`); | |
const transitionTimeout = getTimeout(transitionDelays, transitionDurations); | |
const animationDelays = getStyleProperties(`${ANIMATION}Delay`); | |
const animationDurations = getStyleProperties(`${ANIMATION}Duration`); | |
const animationTimeout = getTimeout(animationDelays, animationDurations); | |
let type = null; | |
let timeout = 0; | |
let propCount = 0; | |
if (expectedType === TRANSITION) { | |
if (transitionTimeout > 0) { | |
type = TRANSITION; | |
timeout = transitionTimeout; | |
propCount = transitionDurations.length; | |
} | |
} else if (expectedType === ANIMATION) { | |
if (animationTimeout > 0) { | |
type = ANIMATION; | |
timeout = animationTimeout; | |
propCount = animationDurations.length; | |
} | |
} else { | |
timeout = Math.max(transitionTimeout, animationTimeout); | |
type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null; | |
propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0; | |
} | |
const hasTransform = type === TRANSITION && /\b(transform|all)(,|$)/.test( | |
getStyleProperties(`${TRANSITION}Property`).toString() | |
); | |
return { | |
type, | |
timeout, | |
propCount, | |
hasTransform | |
}; | |
} | |
function getTimeout(delays, durations) { | |
while (delays.length < durations.length) { | |
delays = delays.concat(delays); | |
} | |
return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i]))); | |
} | |
function toMs(s) { | |
if (s === "auto") return 0; | |
return Number(s.slice(0, -1).replace(",", ".")) * 1e3; | |
} | |
function forceReflow() { | |
return document.body.offsetHeight; | |
} | |
function patchClass(el, value, isSVG) { | |
const transitionClasses = el[vtcKey]; | |
if (transitionClasses) { | |
value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" "); | |
} | |
if (value == null) { | |
el.removeAttribute("class"); | |
} else if (isSVG) { | |
el.setAttribute("class", value); | |
} else { | |
el.className = value; | |
} | |
} | |
const vShowOriginalDisplay = Symbol("_vod"); | |
const vShowHidden = Symbol("_vsh"); | |
const vShow = { | |
beforeMount(el, { value }, { transition }) { | |
el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display; | |
if (transition && value) { | |
transition.beforeEnter(el); | |
} else { | |
setDisplay(el, value); | |
} | |
}, | |
mounted(el, { value }, { transition }) { | |
if (transition && value) { | |
transition.enter(el); | |
} | |
}, | |
updated(el, { value, oldValue }, { transition }) { | |
if (!value === !oldValue) return; | |
if (transition) { | |
if (value) { | |
transition.beforeEnter(el); | |
setDisplay(el, true); | |
transition.enter(el); | |
} else { | |
transition.leave(el, () => { | |
setDisplay(el, false); | |
}); | |
} | |
} else { | |
setDisplay(el, value); | |
} | |
}, | |
beforeUnmount(el, { value }) { | |
setDisplay(el, value); | |
} | |
}; | |
function setDisplay(el, value) { | |
el.style.display = value ? el[vShowOriginalDisplay] : "none"; | |
el[vShowHidden] = !value; | |
} | |
function initVShowForSSR() { | |
vShow.getSSRProps = ({ value }) => { | |
if (!value) { | |
return { style: { display: "none" } }; | |
} | |
}; | |
} | |
const CSS_VAR_TEXT = Symbol(""); | |
function useCssVars(getter) { | |
return; | |
} | |
const displayRE = /(^|;)\s*display\s*:/; | |
function patchStyle(el, prev, next) { | |
const style = el.style; | |
const isCssString = shared.isString(next); | |
let hasControlledDisplay = false; | |
if (next && !isCssString) { | |
if (prev) { | |
if (!shared.isString(prev)) { | |
for (const key in prev) { | |
if (next[key] == null) { | |
setStyle(style, key, ""); | |
} | |
} | |
} else { | |
for (const prevStyle of prev.split(";")) { | |
const key = prevStyle.slice(0, prevStyle.indexOf(":")).trim(); | |
if (next[key] == null) { | |
setStyle(style, key, ""); | |
} | |
} | |
} | |
} | |
for (const key in next) { | |
if (key === "display") { | |
hasControlledDisplay = true; | |
} | |
setStyle(style, key, next[key]); | |
} | |
} else { | |
if (isCssString) { | |
if (prev !== next) { | |
const cssVarText = style[CSS_VAR_TEXT]; | |
if (cssVarText) { | |
next += ";" + cssVarText; | |
} | |
style.cssText = next; | |
hasControlledDisplay = displayRE.test(next); | |
} | |
} else if (prev) { | |
el.removeAttribute("style"); | |
} | |
} | |
if (vShowOriginalDisplay in el) { | |
el[vShowOriginalDisplay] = hasControlledDisplay ? style.display : ""; | |
if (el[vShowHidden]) { | |
style.display = "none"; | |
} | |
} | |
} | |
const importantRE = /\s*!important$/; | |
function setStyle(style, name, val) { | |
if (shared.isArray(val)) { | |
val.forEach((v) => setStyle(style, name, v)); | |
} else { | |
if (val == null) val = ""; | |
if (name.startsWith("--")) { | |
style.setProperty(name, val); | |
} else { | |
const prefixed = autoPrefix(style, name); | |
if (importantRE.test(val)) { | |
style.setProperty( | |
shared.hyphenate(prefixed), | |
val.replace(importantRE, ""), | |
"important" | |
); | |
} else { | |
style[prefixed] = val; | |
} | |
} | |
} | |
} | |
const prefixes = ["Webkit", "Moz", "ms"]; | |
const prefixCache = {}; | |
function autoPrefix(style, rawName) { | |
const cached = prefixCache[rawName]; | |
if (cached) { | |
return cached; | |
} | |
let name = runtimeCore.camelize(rawName); | |
if (name !== "filter" && name in style) { | |
return prefixCache[rawName] = name; | |
} | |
name = shared.capitalize(name); | |
for (let i = 0; i < prefixes.length; i++) { | |
const prefixed = prefixes[i] + name; | |
if (prefixed in style) { | |
return prefixCache[rawName] = prefixed; | |
} | |
} | |
return rawName; | |
} | |
const xlinkNS = "http://www.w3.org/1999/xlink"; | |
function patchAttr(el, key, value, isSVG, instance, isBoolean = shared.isSpecialBooleanAttr(key)) { | |
if (isSVG && key.startsWith("xlink:")) { | |
if (value == null) { | |
el.removeAttributeNS(xlinkNS, key.slice(6, key.length)); | |
} else { | |
el.setAttributeNS(xlinkNS, key, value); | |
} | |
} else { | |
if (value == null || isBoolean && !shared.includeBooleanAttr(value)) { | |
el.removeAttribute(key); | |
} else { | |
el.setAttribute( | |
key, | |
isBoolean ? "" : shared.isSymbol(value) ? String(value) : value | |
); | |
} | |
} | |
} | |
function patchDOMProp(el, key, value, parentComponent) { | |
if (key === "innerHTML" || key === "textContent") { | |
if (value == null) return; | |
el[key] = value; | |
return; | |
} | |
const tag = el.tagName; | |
if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally | |
!tag.includes("-")) { | |
const oldValue = tag === "OPTION" ? el.getAttribute("value") || "" : el.value; | |
const newValue = value == null ? "" : String(value); | |
if (oldValue !== newValue || !("_value" in el)) { | |
el.value = newValue; | |
} | |
if (value == null) { | |
el.removeAttribute(key); | |
} | |
el._value = value; | |
return; | |
} | |
let needRemove = false; | |
if (value === "" || value == null) { | |
const type = typeof el[key]; | |
if (type === "boolean") { | |
value = shared.includeBooleanAttr(value); | |
} else if (value == null & |
View raw
(Sorry about that, but we can’t show files that are this big right now.)
View raw
(Sorry about that, but we can’t show files that are this big right now.)
View raw
(Sorry about that, but we can’t show files that are this big right now.)
View raw
(Sorry about that, but we can’t show files that are this big right now.)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment