UNPKG

vite-plugin-react-code-navigation

Version:
1,313 lines (1,305 loc) 1.28 MB
var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); // node_modules/@jridgewell/set-array/dist/set-array.umd.js var require_set_array_umd = __commonJS({ "node_modules/@jridgewell/set-array/dist/set-array.umd.js"(exports, module) { (function(global, factory) { typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.setArray = {})); })(exports, function(exports2) { "use strict"; exports2.get = void 0; exports2.put = void 0; exports2.pop = void 0; class SetArray { constructor() { this._indexes = { __proto__: null }; this.array = []; } } (() => { exports2.get = (strarr, key) => strarr._indexes[key]; exports2.put = (strarr, key) => { const index = exports2.get(strarr, key); if (index !== void 0) return index; const { array, _indexes: indexes } = strarr; return indexes[key] = array.push(key) - 1; }; exports2.pop = (strarr) => { const { array, _indexes: indexes } = strarr; if (array.length === 0) return; const last = array.pop(); indexes[last] = void 0; }; })(); exports2.SetArray = SetArray; Object.defineProperty(exports2, "__esModule", { value: true }); }); } }); // node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js var require_sourcemap_codec_umd = __commonJS({ "node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js"(exports, module) { (function(global, factory) { typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.sourcemapCodec = {})); })(exports, function(exports2) { "use strict"; const comma = ",".charCodeAt(0); const semicolon = ";".charCodeAt(0); const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; const intToChar = new Uint8Array(64); const charToInt = new Uint8Array(128); for (let i = 0; i < chars.length; i++) { const c = chars.charCodeAt(i); intToChar[i] = c; charToInt[c] = i; } const td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) { const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); return out.toString(); } } : { decode(buf) { let out = ""; for (let i = 0; i < buf.length; i++) { out += String.fromCharCode(buf[i]); } return out; } }; function decode(mappings) { const state = new Int32Array(5); const decoded = []; let index = 0; do { const semi = indexOf(mappings, index); const line = []; let sorted = true; let lastCol = 0; state[0] = 0; for (let i = index; i < semi; i++) { let seg; i = decodeInteger(mappings, i, state, 0); const col = state[0]; if (col < lastCol) sorted = false; lastCol = col; if (hasMoreVlq(mappings, i, semi)) { i = decodeInteger(mappings, i, state, 1); i = decodeInteger(mappings, i, state, 2); i = decodeInteger(mappings, i, state, 3); if (hasMoreVlq(mappings, i, semi)) { i = decodeInteger(mappings, i, state, 4); seg = [col, state[1], state[2], state[3], state[4]]; } else { seg = [col, state[1], state[2], state[3]]; } } else { seg = [col]; } line.push(seg); } if (!sorted) sort(line); decoded.push(line); index = semi + 1; } while (index <= mappings.length); return decoded; } function indexOf(mappings, index) { const idx = mappings.indexOf(";", index); return idx === -1 ? mappings.length : idx; } function decodeInteger(mappings, pos, state, j) { let value = 0; let shift = 0; let integer = 0; do { const c = mappings.charCodeAt(pos++); integer = charToInt[c]; value |= (integer & 31) << shift; shift += 5; } while (integer & 32); const shouldNegate = value & 1; value >>>= 1; if (shouldNegate) { value = -2147483648 | -value; } state[j] += value; return pos; } function hasMoreVlq(mappings, i, length) { if (i >= length) return false; return mappings.charCodeAt(i) !== comma; } function sort(line) { line.sort(sortComparator); } function sortComparator(a, b) { return a[0] - b[0]; } function encode(decoded) { const state = new Int32Array(5); const bufLength = 1024 * 16; const subLength = bufLength - 36; const buf = new Uint8Array(bufLength); const sub = buf.subarray(0, subLength); let pos = 0; let out = ""; for (let i = 0; i < decoded.length; i++) { const line = decoded[i]; if (i > 0) { if (pos === bufLength) { out += td.decode(buf); pos = 0; } buf[pos++] = semicolon; } if (line.length === 0) continue; state[0] = 0; for (let j = 0; j < line.length; j++) { const segment = line[j]; if (pos > subLength) { out += td.decode(sub); buf.copyWithin(0, subLength, pos); pos -= subLength; } if (j > 0) buf[pos++] = comma; pos = encodeInteger(buf, pos, state, segment, 0); if (segment.length === 1) continue; pos = encodeInteger(buf, pos, state, segment, 1); pos = encodeInteger(buf, pos, state, segment, 2); pos = encodeInteger(buf, pos, state, segment, 3); if (segment.length === 4) continue; pos = encodeInteger(buf, pos, state, segment, 4); } } return out + td.decode(buf.subarray(0, pos)); } function encodeInteger(buf, pos, state, segment, j) { const next = segment[j]; let num = next - state[j]; state[j] = next; num = num < 0 ? -num << 1 | 1 : num << 1; do { let clamped = num & 31; num >>>= 5; if (num > 0) clamped |= 32; buf[pos++] = intToChar[clamped]; } while (num > 0); return pos; } exports2.decode = decode; exports2.encode = encode; Object.defineProperty(exports2, "__esModule", { value: true }); }); } }); // node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js var require_resolve_uri_umd = __commonJS({ "node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js"(exports, module) { (function(global, factory) { typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, global.resolveURI = factory()); })(exports, function() { "use strict"; const schemeRegex = /^[\w+.-]+:\/\//; const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/; const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i; var UrlType; (function(UrlType2) { UrlType2[UrlType2["Empty"] = 1] = "Empty"; UrlType2[UrlType2["Hash"] = 2] = "Hash"; UrlType2[UrlType2["Query"] = 3] = "Query"; UrlType2[UrlType2["RelativePath"] = 4] = "RelativePath"; UrlType2[UrlType2["AbsolutePath"] = 5] = "AbsolutePath"; UrlType2[UrlType2["SchemeRelative"] = 6] = "SchemeRelative"; UrlType2[UrlType2["Absolute"] = 7] = "Absolute"; })(UrlType || (UrlType = {})); function isAbsoluteUrl(input) { return schemeRegex.test(input); } function isSchemeRelativeUrl(input) { return input.startsWith("//"); } function isAbsolutePath(input) { return input.startsWith("/"); } function isFileUrl(input) { return input.startsWith("file:"); } function isRelative(input) { return /^[.?#]/.test(input); } function parseAbsoluteUrl(input) { const match = urlRegex.exec(input); return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || ""); } function parseFileUrl(input) { const match = fileRegex.exec(input); const path = match[2]; return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || ""); } function makeUrl(scheme, user, host, port, path, query, hash) { return { scheme, user, host, port, path, query, hash, type: UrlType.Absolute }; } function parseUrl(input) { if (isSchemeRelativeUrl(input)) { const url2 = parseAbsoluteUrl("http:" + input); url2.scheme = ""; url2.type = UrlType.SchemeRelative; return url2; } if (isAbsolutePath(input)) { const url2 = parseAbsoluteUrl("http://foo.com" + input); url2.scheme = ""; url2.host = ""; url2.type = UrlType.AbsolutePath; return url2; } if (isFileUrl(input)) return parseFileUrl(input); if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input); const url = parseAbsoluteUrl("http://foo.com/" + input); url.scheme = ""; url.host = ""; url.type = input ? input.startsWith("?") ? UrlType.Query : input.startsWith("#") ? UrlType.Hash : UrlType.RelativePath : UrlType.Empty; return url; } function stripPathFilename(path) { if (path.endsWith("/..")) return path; const index = path.lastIndexOf("/"); return path.slice(0, index + 1); } function mergePaths(url, base) { normalizePath(base, base.type); if (url.path === "/") { url.path = base.path; } else { url.path = stripPathFilename(base.path) + url.path; } } function normalizePath(url, type) { const rel = type <= UrlType.RelativePath; const pieces = url.path.split("/"); let pointer = 1; let positive = 0; let addTrailingSlash = false; for (let i = 1; i < pieces.length; i++) { const piece = pieces[i]; if (!piece) { addTrailingSlash = true; continue; } addTrailingSlash = false; if (piece === ".") continue; if (piece === "..") { if (positive) { addTrailingSlash = true; positive--; pointer--; } else if (rel) { pieces[pointer++] = piece; } continue; } pieces[pointer++] = piece; positive++; } let path = ""; for (let i = 1; i < pointer; i++) { path += "/" + pieces[i]; } if (!path || addTrailingSlash && !path.endsWith("/..")) { path += "/"; } url.path = path; } function resolve(input, base) { if (!input && !base) return ""; const url = parseUrl(input); let inputType = url.type; if (base && inputType !== UrlType.Absolute) { const baseUrl = parseUrl(base); const baseType = baseUrl.type; switch (inputType) { case UrlType.Empty: url.hash = baseUrl.hash; case UrlType.Hash: url.query = baseUrl.query; case UrlType.Query: case UrlType.RelativePath: mergePaths(url, baseUrl); case UrlType.AbsolutePath: url.user = baseUrl.user; url.host = baseUrl.host; url.port = baseUrl.port; case UrlType.SchemeRelative: url.scheme = baseUrl.scheme; } if (baseType > inputType) inputType = baseType; } normalizePath(url, inputType); const queryHash = url.query + url.hash; switch (inputType) { case UrlType.Hash: case UrlType.Query: return queryHash; case UrlType.RelativePath: { const path = url.path.slice(1); if (!path) return queryHash || "."; if (isRelative(base || input) && !isRelative(path)) { return "./" + path + queryHash; } return path + queryHash; } case UrlType.AbsolutePath: return url.path + queryHash; default: return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash; } } return resolve; }); } }); // node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js var require_trace_mapping_umd = __commonJS({ "node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js"(exports, module) { (function(global, factory) { typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require_sourcemap_codec_umd(), require_resolve_uri_umd()) : typeof define === "function" && define.amd ? define(["exports", "@jridgewell/sourcemap-codec", "@jridgewell/resolve-uri"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.traceMapping = {}, global.sourcemapCodec, global.resolveURI)); })(exports, function(exports2, sourcemapCodec, resolveUri) { "use strict"; function _interopDefaultLegacy(e) { return e && typeof e === "object" && "default" in e ? e : { "default": e }; } var resolveUri__default = /* @__PURE__ */ _interopDefaultLegacy(resolveUri); function resolve(input, base) { if (base && !base.endsWith("/")) base += "/"; return resolveUri__default["default"](input, base); } function stripFilename(path) { if (!path) return ""; const index = path.lastIndexOf("/"); return path.slice(0, index + 1); } const COLUMN = 0; const SOURCES_INDEX = 1; const SOURCE_LINE = 2; const SOURCE_COLUMN = 3; const NAMES_INDEX = 4; const REV_GENERATED_LINE = 1; const REV_GENERATED_COLUMN = 2; function maybeSort(mappings, owned) { const unsortedIndex = nextUnsortedSegmentLine(mappings, 0); if (unsortedIndex === mappings.length) return mappings; if (!owned) mappings = mappings.slice(); for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) { mappings[i] = sortSegments(mappings[i], owned); } return mappings; } function nextUnsortedSegmentLine(mappings, start) { for (let i = start; i < mappings.length; i++) { if (!isSorted(mappings[i])) return i; } return mappings.length; } function isSorted(line) { for (let j = 1; j < line.length; j++) { if (line[j][COLUMN] < line[j - 1][COLUMN]) { return false; } } return true; } function sortSegments(line, owned) { if (!owned) line = line.slice(); return line.sort(sortComparator); } function sortComparator(a, b) { return a[COLUMN] - b[COLUMN]; } let found = false; function binarySearch(haystack, needle, low, high) { while (low <= high) { const mid = low + (high - low >> 1); const cmp = haystack[mid][COLUMN] - needle; if (cmp === 0) { found = true; return mid; } if (cmp < 0) { low = mid + 1; } else { high = mid - 1; } } found = false; return low - 1; } function upperBound(haystack, needle, index) { for (let i = index + 1; i < haystack.length; index = i++) { if (haystack[i][COLUMN] !== needle) break; } return index; } function lowerBound(haystack, needle, index) { for (let i = index - 1; i >= 0; index = i--) { if (haystack[i][COLUMN] !== needle) break; } return index; } function memoizedState() { return { lastKey: -1, lastNeedle: -1, lastIndex: -1 }; } function memoizedBinarySearch(haystack, needle, state, key) { const { lastKey, lastNeedle, lastIndex } = state; let low = 0; let high = haystack.length - 1; if (key === lastKey) { if (needle === lastNeedle) { found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; return lastIndex; } if (needle >= lastNeedle) { low = lastIndex === -1 ? 0 : lastIndex; } else { high = lastIndex; } } state.lastKey = key; state.lastNeedle = needle; return state.lastIndex = binarySearch(haystack, needle, low, high); } function buildBySources(decoded, memos) { const sources = memos.map(buildNullArray); for (let i = 0; i < decoded.length; i++) { const line = decoded[i]; for (let j = 0; j < line.length; j++) { const seg = line[j]; if (seg.length === 1) continue; const sourceIndex = seg[SOURCES_INDEX]; const sourceLine = seg[SOURCE_LINE]; const sourceColumn = seg[SOURCE_COLUMN]; const originalSource = sources[sourceIndex]; const originalLine = originalSource[sourceLine] || (originalSource[sourceLine] = []); const memo = memos[sourceIndex]; const index = upperBound(originalLine, sourceColumn, memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine)); insert(originalLine, memo.lastIndex = index + 1, [sourceColumn, i, seg[COLUMN]]); } } return sources; } function insert(array, index, value) { for (let i = array.length; i > index; i--) { array[i] = array[i - 1]; } array[index] = value; } function buildNullArray() { return { __proto__: null }; } const AnyMap = function(map, mapUrl) { const parsed = typeof map === "string" ? JSON.parse(map) : map; if (!("sections" in parsed)) return new TraceMap(parsed, mapUrl); const mappings = []; const sources = []; const sourcesContent = []; const names = []; recurse(parsed, mapUrl, mappings, sources, sourcesContent, names, 0, 0, Infinity, Infinity); const joined = { version: 3, file: parsed.file, names, sources, sourcesContent, mappings }; return exports2.presortedDecodedMap(joined); }; function recurse(input, mapUrl, mappings, sources, sourcesContent, names, lineOffset, columnOffset, stopLine, stopColumn) { const { sections } = input; for (let i = 0; i < sections.length; i++) { const { map, offset } = sections[i]; let sl = stopLine; let sc = stopColumn; if (i + 1 < sections.length) { const nextOffset = sections[i + 1].offset; sl = Math.min(stopLine, lineOffset + nextOffset.line); if (sl === stopLine) { sc = Math.min(stopColumn, columnOffset + nextOffset.column); } else if (sl < stopLine) { sc = columnOffset + nextOffset.column; } } addSection(map, mapUrl, mappings, sources, sourcesContent, names, lineOffset + offset.line, columnOffset + offset.column, sl, sc); } } function addSection(input, mapUrl, mappings, sources, sourcesContent, names, lineOffset, columnOffset, stopLine, stopColumn) { if ("sections" in input) return recurse(...arguments); const map = new TraceMap(input, mapUrl); const sourcesOffset = sources.length; const namesOffset = names.length; const decoded = exports2.decodedMappings(map); const { resolvedSources, sourcesContent: contents } = map; append(sources, resolvedSources); append(names, map.names); if (contents) append(sourcesContent, contents); else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null); for (let i = 0; i < decoded.length; i++) { const lineI = lineOffset + i; if (lineI > stopLine) return; const out = getLine(mappings, lineI); const cOffset = i === 0 ? columnOffset : 0; const line = decoded[i]; for (let j = 0; j < line.length; j++) { const seg = line[j]; const column = cOffset + seg[COLUMN]; if (lineI === stopLine && column >= stopColumn) return; if (seg.length === 1) { out.push([column]); continue; } const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX]; const sourceLine = seg[SOURCE_LINE]; const sourceColumn = seg[SOURCE_COLUMN]; out.push(seg.length === 4 ? [column, sourcesIndex, sourceLine, sourceColumn] : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]); } } } function append(arr, other) { for (let i = 0; i < other.length; i++) arr.push(other[i]); } function getLine(arr, index) { for (let i = arr.length; i <= index; i++) arr[i] = []; return arr[index]; } const LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)"; const COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)"; const LEAST_UPPER_BOUND = -1; const GREATEST_LOWER_BOUND = 1; exports2.encodedMappings = void 0; exports2.decodedMappings = void 0; exports2.traceSegment = void 0; exports2.originalPositionFor = void 0; exports2.generatedPositionFor = void 0; exports2.allGeneratedPositionsFor = void 0; exports2.eachMapping = void 0; exports2.sourceContentFor = void 0; exports2.presortedDecodedMap = void 0; exports2.decodedMap = void 0; exports2.encodedMap = void 0; class TraceMap { constructor(map, mapUrl) { const isString = typeof map === "string"; if (!isString && map._decodedMemo) return map; const parsed = isString ? JSON.parse(map) : map; const { version, file, names, sourceRoot, sources, sourcesContent } = parsed; this.version = version; this.file = file; this.names = names; this.sourceRoot = sourceRoot; this.sources = sources; this.sourcesContent = sourcesContent; const from = resolve(sourceRoot || "", stripFilename(mapUrl)); this.resolvedSources = sources.map((s) => resolve(s || "", from)); const { mappings } = parsed; if (typeof mappings === "string") { this._encoded = mappings; this._decoded = void 0; } else { this._encoded = void 0; this._decoded = maybeSort(mappings, isString); } this._decodedMemo = memoizedState(); this._bySources = void 0; this._bySourceMemos = void 0; } } (() => { exports2.encodedMappings = (map) => { var _a; return (_a = map._encoded) !== null && _a !== void 0 ? _a : map._encoded = sourcemapCodec.encode(map._decoded); }; exports2.decodedMappings = (map) => { return map._decoded || (map._decoded = sourcemapCodec.decode(map._encoded)); }; exports2.traceSegment = (map, line, column) => { const decoded = exports2.decodedMappings(map); if (line >= decoded.length) return null; const segments = decoded[line]; const index = traceSegmentInternal(segments, map._decodedMemo, line, column, GREATEST_LOWER_BOUND); return index === -1 ? null : segments[index]; }; exports2.originalPositionFor = (map, { line, column, bias }) => { line--; if (line < 0) throw new Error(LINE_GTR_ZERO); if (column < 0) throw new Error(COL_GTR_EQ_ZERO); const decoded = exports2.decodedMappings(map); if (line >= decoded.length) return OMapping(null, null, null, null); const segments = decoded[line]; const index = traceSegmentInternal(segments, map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND); if (index === -1) return OMapping(null, null, null, null); const segment = segments[index]; if (segment.length === 1) return OMapping(null, null, null, null); const { names, resolvedSources } = map; return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null); }; exports2.allGeneratedPositionsFor = (map, { source, line, column, bias }) => { return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true); }; exports2.generatedPositionFor = (map, { source, line, column, bias }) => { return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false); }; exports2.eachMapping = (map, cb) => { const decoded = exports2.decodedMappings(map); const { names, resolvedSources } = map; for (let i = 0; i < decoded.length; i++) { const line = decoded[i]; for (let j = 0; j < line.length; j++) { const seg = line[j]; const generatedLine = i + 1; const generatedColumn = seg[0]; let source = null; let originalLine = null; let originalColumn = null; let name = null; if (seg.length !== 1) { source = resolvedSources[seg[1]]; originalLine = seg[2] + 1; originalColumn = seg[3]; } if (seg.length === 5) name = names[seg[4]]; cb({ generatedLine, generatedColumn, source, originalLine, originalColumn, name }); } } }; exports2.sourceContentFor = (map, source) => { const { sources, resolvedSources, sourcesContent } = map; if (sourcesContent == null) return null; let index = sources.indexOf(source); if (index === -1) index = resolvedSources.indexOf(source); return index === -1 ? null : sourcesContent[index]; }; exports2.presortedDecodedMap = (map, mapUrl) => { const tracer = new TraceMap(clone(map, []), mapUrl); tracer._decoded = map.mappings; return tracer; }; exports2.decodedMap = (map) => { return clone(map, exports2.decodedMappings(map)); }; exports2.encodedMap = (map) => { return clone(map, exports2.encodedMappings(map)); }; function generatedPosition(map, source, line, column, bias, all) { line--; if (line < 0) throw new Error(LINE_GTR_ZERO); if (column < 0) throw new Error(COL_GTR_EQ_ZERO); const { sources, resolvedSources } = map; let sourceIndex = sources.indexOf(source); if (sourceIndex === -1) sourceIndex = resolvedSources.indexOf(source); if (sourceIndex === -1) return all ? [] : GMapping(null, null); const generated = map._bySources || (map._bySources = buildBySources(exports2.decodedMappings(map), map._bySourceMemos = sources.map(memoizedState))); const segments = generated[sourceIndex][line]; if (segments == null) return all ? [] : GMapping(null, null); const memo = map._bySourceMemos[sourceIndex]; if (all) return sliceGeneratedPositions(segments, memo, line, column, bias); const index = traceSegmentInternal(segments, memo, line, column, bias); if (index === -1) return GMapping(null, null); const segment = segments[index]; return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]); } })(); function clone(map, mappings) { return { version: map.version, file: map.file, names: map.names, sourceRoot: map.sourceRoot, sources: map.sources, sourcesContent: map.sourcesContent, mappings }; } function OMapping(source, line, column, name) { return { source, line, column, name }; } function GMapping(line, column) { return { line, column }; } function traceSegmentInternal(segments, memo, line, column, bias) { let index = memoizedBinarySearch(segments, column, memo, line); if (found) { index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index); } else if (bias === LEAST_UPPER_BOUND) index++; if (index === -1 || index === segments.length) return -1; return index; } function sliceGeneratedPositions(segments, memo, line, column, bias) { let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND); if (!found && bias === LEAST_UPPER_BOUND) min++; if (min === -1 || min === segments.length) return []; const matchedColumn = found ? column : segments[min][COLUMN]; if (!found) min = lowerBound(segments, matchedColumn, min); const max = upperBound(segments, matchedColumn, min); const result = []; for (; min <= max; min++) { const segment = segments[min]; result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN])); } return result; } exports2.AnyMap = AnyMap; exports2.GREATEST_LOWER_BOUND = GREATEST_LOWER_BOUND; exports2.LEAST_UPPER_BOUND = LEAST_UPPER_BOUND; exports2.TraceMap = TraceMap; Object.defineProperty(exports2, "__esModule", { value: true }); }); } }); // node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js var require_gen_mapping_umd = __commonJS({ "node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js"(exports, module) { (function(global, factory) { typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require_set_array_umd(), require_sourcemap_codec_umd(), require_trace_mapping_umd()) : typeof define === "function" && define.amd ? define(["exports", "@jridgewell/set-array", "@jridgewell/sourcemap-codec", "@jridgewell/trace-mapping"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.genMapping = {}, global.setArray, global.sourcemapCodec, global.traceMapping)); })(exports, function(exports2, setArray, sourcemapCodec, traceMapping) { "use strict"; const COLUMN = 0; const SOURCES_INDEX = 1; const SOURCE_LINE = 2; const SOURCE_COLUMN = 3; const NAMES_INDEX = 4; const NO_NAME = -1; exports2.addSegment = void 0; exports2.addMapping = void 0; exports2.maybeAddSegment = void 0; exports2.maybeAddMapping = void 0; exports2.setSourceContent = void 0; exports2.toDecodedMap = void 0; exports2.toEncodedMap = void 0; exports2.fromMap = void 0; exports2.allMappings = void 0; let addSegmentInternal; class GenMapping { constructor({ file, sourceRoot } = {}) { this._names = new setArray.SetArray(); this._sources = new setArray.SetArray(); this._sourcesContent = []; this._mappings = []; this.file = file; this.sourceRoot = sourceRoot; } } (() => { exports2.addSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { return addSegmentInternal(false, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content); }; exports2.maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content); }; exports2.addMapping = (map, mapping) => { return addMappingInternal(false, map, mapping); }; exports2.maybeAddMapping = (map, mapping) => { return addMappingInternal(true, map, mapping); }; exports2.setSourceContent = (map, source, content) => { const { _sources: sources, _sourcesContent: sourcesContent } = map; sourcesContent[setArray.put(sources, source)] = content; }; exports2.toDecodedMap = (map) => { const { file, sourceRoot, _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names } = map; removeEmptyFinalLines(mappings); return { version: 3, file: file || void 0, names: names.array, sourceRoot: sourceRoot || void 0, sources: sources.array, sourcesContent, mappings }; }; exports2.toEncodedMap = (map) => { const decoded = exports2.toDecodedMap(map); return Object.assign(Object.assign({}, decoded), { mappings: sourcemapCodec.encode(decoded.mappings) }); }; exports2.allMappings = (map) => { const out = []; const { _mappings: mappings, _sources: sources, _names: names } = map; for (let i = 0; i < mappings.length; i++) { const line = mappings[i]; for (let j = 0; j < line.length; j++) { const seg = line[j]; const generated = { line: i + 1, column: seg[COLUMN] }; let source = void 0; let original = void 0; let name = void 0; if (seg.length !== 1) { source = sources.array[seg[SOURCES_INDEX]]; original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] }; if (seg.length === 5) name = names.array[seg[NAMES_INDEX]]; } out.push({ generated, source, original, name }); } } return out; }; exports2.fromMap = (input) => { const map = new traceMapping.TraceMap(input); const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot }); putAll(gen._names, map.names); putAll(gen._sources, map.sources); gen._sourcesContent = map.sourcesContent || map.sources.map(() => null); gen._mappings = traceMapping.decodedMappings(map); return gen; }; addSegmentInternal = (skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names } = map; const line = getLine(mappings, genLine); const index = getColumnIndex(line, genColumn); if (!source) { if (skipable && skipSourceless(line, index)) return; return insert(line, index, [genColumn]); } const sourcesIndex = setArray.put(sources, source); const namesIndex = name ? setArray.put(names, name) : NO_NAME; if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content !== null && content !== void 0 ? content : null; if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) { return; } return insert(line, index, name ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] : [genColumn, sourcesIndex, sourceLine, sourceColumn]); }; })(); function getLine(mappings, index) { for (let i = mappings.length; i <= index; i++) { mappings[i] = []; } return mappings[index]; } function getColumnIndex(line, genColumn) { let index = line.length; for (let i = index - 1; i >= 0; index = i--) { const current = line[i]; if (genColumn >= current[COLUMN]) break; } return index; } function insert(array, index, value) { for (let i = array.length; i > index; i--) { array[i] = array[i - 1]; } array[index] = value; } function removeEmptyFinalLines(mappings) { const { length } = mappings; let len = length; for (let i = len - 1; i >= 0; len = i, i--) { if (mappings[i].length > 0) break; } if (len < length) mappings.length = len; } function putAll(strarr, array) { for (let i = 0; i < array.length; i++) setArray.put(strarr, array[i]); } function skipSourceless(line, index) { if (index === 0) return true; const prev = line[index - 1]; return prev.length === 1; } function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) { if (index === 0) return false; const prev = line[index - 1]; if (prev.length === 1) return false; return sourcesIndex === prev[SOURCES_INDEX] && sourceLine === prev[SOURCE_LINE] && sourceColumn === prev[SOURCE_COLUMN] && namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME); } function addMappingInternal(skipable, map, mapping) { const { generated, source, original, name, content } = mapping; if (!source) { return addSegmentInternal(skipable, map, generated.line - 1, generated.column, null, null, null, null, null); } const s = source; return addSegmentInternal(skipable, map, generated.line - 1, generated.column, s, original.line - 1, original.column, name, content); } exports2.GenMapping = GenMapping; Object.defineProperty(exports2, "__esModule", { value: true }); }); } }); // node_modules/@babel/generator/lib/source-map.js var require_source_map = __commonJS({ "node_modules/@babel/generator/lib/source-map.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _genMapping = require_gen_mapping_umd(); var SourceMap = class { constructor(opts, code) { var _opts$sourceFileName; this._map = void 0; this._rawMappings = void 0; this._sourceFileName = void 0; this._lastGenLine = 0; this._lastSourceLine = 0; this._lastSourceColumn = 0; const map = this._map = new _genMapping.GenMapping({ sourceRoot: opts.sourceRoot }); this._sourceFileName = (_opts$sourceFileName = opts.sourceFileName) == null ? void 0 : _opts$sourceFileName.replace(/\\/g, "/"); this._rawMappings = void 0; if (typeof code === "string") { (0, _genMapping.setSourceContent)(map, this._sourceFileName, code); } else if (typeof code === "object") { Object.keys(code).forEach((sourceFileName) => { (0, _genMapping.setSourceContent)(map, sourceFileName.replace(/\\/g, "/"), code[sourceFileName]); }); } } get() { return (0, _genMapping.toEncodedMap)(this._map); } getDecoded() { return (0, _genMapping.toDecodedMap)(this._map); } getRawMappings() { return this._rawMappings || (this._rawMappings = (0, _genMapping.allMappings)(this._map)); } mark(generated, line, column, identifierName, filename) { this._rawMappings = void 0; (0, _genMapping.maybeAddMapping)(this._map, { name: identifierName, generated, source: line == null ? void 0 : (filename == null ? void 0 : filename.replace(/\\/g, "/")) || this._sourceFileName, original: line == null ? void 0 : { line, column } }); } }; exports.default = SourceMap; } }); // node_modules/@babel/generator/lib/buffer.js var require_buffer = __commonJS({ "node_modules/@babel/generator/lib/buffer.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var Buffer2 = class { constructor(map) { this._map = null; this._buf = ""; this._str = ""; this._appendCount = 0; this._last = 0; this._queue = []; this._queueCursor = 0; this._position = { line: 1, column: 0 }; this._sourcePosition = { identifierName: void 0, line: void 0, column: void 0, filename: void 0 }; this._map = map; this._allocQueue(); } _allocQueue() { const queue = this._queue; for (let i = 0; i < 16; i++) { queue.push({ char: 0, repeat: 1, line: void 0, column: void 0, identifierName: void 0, filename: "" }); } } _pushQueue(char, repeat, line, column, identifierName, filename) { const cursor = this._queueCursor; if (cursor === this._queue.length) { this._allocQueue(); } const item = this._queue[cursor]; item.char = char; item.repeat = repeat; item.line = line; item.column = column; item.identifierName = identifierName; item.filename = filename; this._queueCursor++; } _popQueue() { if (this._queueCursor === 0) { throw new Error("Cannot pop from empty queue"); } return this._queue[--this._queueCursor]; } get() { this._flush(); const map = this._map; const result = { code: (this._buf + this._str).trimRight(), decodedMap: map == null ? void 0 : map.getDecoded(), get map() { const resultMap = map ? map.get() : null; result.map = resultMap; return resultMap; }, set map(value) { Object.defineProperty(result, "map", { value, writable: true }); }, get rawMappings() { const mappings = map == null ? void 0 : map.getRawMappings(); result.rawMappings = mappings; return mappings; }, set rawMappings(value) { Object.defineProperty(result, "rawMappings", { value, writable: true }); } }; return result; } append(str, maybeNewline) { this._flush(); this._append(str, this._sourcePosition, maybeNewline); } appendChar(char) { this._flush(); this._appendChar(char, 1, this._sourcePosition); } queue(char) { if (char === 10) { while (this._queueCursor !== 0) { const char2 = this._queue[this._queueCursor - 1].char; if (char2 !== 32 && char2 !== 9) { break; } this._queueCursor--; } } const sourcePosition = this._sourcePosition; this._pushQueue(char, 1, sourcePosition.line, sourcePosition.column, sourcePosition.identifierName, sourcePosition.filename); } queueIndentation(char, repeat) { this._pushQueue(char, repeat, void 0, void 0, void 0, void 0); } _flush() { const queueCursor = this._queueCursor; const queue = this._queue; for (let i = 0; i < queueCursor; i++) { const item = queue[i]; this._appendChar(item.char, item.repeat, item); } this._queueCursor = 0; } _appendChar(char, repeat, sourcePos) { this._last = char; this._str += repeat > 1 ? String.fromCharCode(char).repeat(repeat) : String.fromCharCode(char); if (char !== 10) { this._mark(sourcePos.line, sourcePos.column, sourcePos.identifierName, sourcePos.filename); this._position.column += repeat; } else { this._position.line++; this._position.column = 0; } } _append(str, sourcePos, maybeNewline) { const len = str.length; const position = this._position; this._last = str.charCodeAt(len - 1); if (++this._appendCount > 4096) { +this._str; this._buf += this._str; this._str = str; this._appendCount = 0; } else { this._str += str; } if (!maybeNewline && !this._map) { position.column += len; return; } const { column, identifierName, filename } = sourcePos; let line = sourcePos.line; let i = str.indexOf("\n"); let last = 0; if (i !== 0) { this._mark(line, column, identifierName, filename); } while (i !== -1) { position.line++; position.column = 0; last = i + 1; if (last < len) { this._mark(++line, 0, identifierName, filename); } i = str.indexOf("\n", last); } position.column += len - last; } _mark(line, column, identifierName, filename) { var _this$_map; (_this$_map = this._map) == null ? void 0 : _this$_map.mark(this._position, line, column, identifierName, filename); } removeTrailingNewline() { const queueCursor = this._queueCursor; if (queueCursor !== 0 && this._queue[queueCursor - 1].char === 10) { this._queueCursor--; } } removeLastSemicolon() { const queueCursor = this._queueCursor; if (queueCursor !== 0 && this._queue[queueCursor - 1].char === 59) { this._queueCursor--; } } getLastChar() { const queueCursor = this._queueCursor; return queueCursor !== 0 ? this._queue[queueCursor - 1].char : this._last; } getNewlineCount() { const queueCursor = this._queueCursor; let count = 0; if (queueCursor === 0) return this._last === 10 ? 1 : 0; for (let i = queueCursor - 1; i >= 0; i--) { if (this._queue[i].char !== 10) { break; } count++; } return count === queueCursor && this._last === 10 ? count + 1 : count; } endsWithCharAndNewline() { const queue = this._queue; const queueCursor = this._queueCursor; if (queueCursor !== 0) { const lastCp = queue[queueCursor - 1].char; if (lastCp !== 10) return; if (queueCursor > 1) {