react-grab 0.0.15 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3349 +1,77 @@
1
- var ReactGrab = (function (exports) {
2
- 'use strict';
3
-
4
- /**
5
- * @license MIT
6
- *
7
- * Copyright (c) 2025 Aiden Bai
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
-
13
- // src/hotkeys.ts
14
- var FORM_TAGS_AND_ROLES = [
15
- "input",
16
- "textarea",
17
- "select",
18
- "searchbox",
19
- "slider",
20
- "spinbutton",
21
- "menuitem",
22
- "menuitemcheckbox",
23
- "menuitemradio",
24
- "option",
25
- "radio",
26
- "textbox"
27
- ];
28
- var isCustomElement = (element) => {
29
- return Boolean(element.tagName) && !element.tagName.startsWith("-") && element.tagName.includes("-");
30
- };
31
- var isReadonlyArray = (value) => {
32
- return Array.isArray(value);
33
- };
34
- var isHotkeyEnabledOnTagName = (event, enabledOnTags = false) => {
35
- const { composed, target } = event;
36
- let targetTagName;
37
- let targetRole;
38
- if (target instanceof HTMLElement && isCustomElement(target) && composed) {
39
- const composedPath = event.composedPath();
40
- const targetElement = composedPath[0];
41
- if (targetElement instanceof HTMLElement) {
42
- targetTagName = targetElement.tagName;
43
- targetRole = targetElement.role;
44
- }
45
- } else if (target instanceof HTMLElement) {
46
- targetTagName = target.tagName;
47
- targetRole = target.role;
48
- }
49
- if (isReadonlyArray(enabledOnTags)) {
50
- return Boolean(
51
- targetTagName && enabledOnTags && enabledOnTags.some(
52
- (tag) => typeof targetTagName === "string" && tag.toLowerCase() === targetTagName.toLowerCase() || tag === targetRole
53
- )
54
- );
55
- }
56
- return Boolean(targetTagName && enabledOnTags && enabledOnTags);
57
- };
58
- var isKeyboardEventTriggeredByInput = (event) => {
59
- return isHotkeyEnabledOnTagName(event, FORM_TAGS_AND_ROLES);
60
- };
61
- var trackHotkeys = () => {
62
- const handleKeyDown = (event) => {
63
- if (isKeyboardEventTriggeredByInput(event)) {
64
- return;
65
- }
66
- if (event.code === void 0) {
67
- return;
68
- }
69
- libStore.setState((state) => {
70
- const newTimestamps = new Map(state.keyPressTimestamps);
71
- if (!state.pressedKeys.has(event.key)) {
72
- newTimestamps.set(event.key, Date.now());
73
- }
74
- return {
75
- ...state,
76
- keyPressTimestamps: newTimestamps,
77
- pressedKeys: /* @__PURE__ */ new Set([event.key, ...state.pressedKeys])
78
- };
79
- });
80
- };
81
- const handleKeyUp = (event) => {
82
- if (event.code === void 0) {
83
- return;
84
- }
85
- libStore.setState((state) => {
86
- const newTimestamps = new Map(state.keyPressTimestamps);
87
- newTimestamps.delete(event.key);
88
- return {
89
- ...state,
90
- keyPressTimestamps: newTimestamps,
91
- pressedKeys: new Set(
92
- [...state.pressedKeys].filter((key) => key !== event.key)
93
- )
94
- };
95
- });
96
- };
97
- const handleBlur = () => {
98
- libStore.setState((state) => ({
99
- ...state,
100
- keyPressTimestamps: /* @__PURE__ */ new Map(),
101
- pressedKeys: /* @__PURE__ */ new Set()
102
- }));
103
- };
104
- const handleContextmenu = () => {
105
- libStore.setState((state) => ({
106
- ...state,
107
- keyPressTimestamps: /* @__PURE__ */ new Map(),
108
- pressedKeys: /* @__PURE__ */ new Set()
109
- }));
110
- };
111
- document.addEventListener("keydown", handleKeyDown);
112
- document.addEventListener("keyup", handleKeyUp);
113
- window.addEventListener("blur", handleBlur);
114
- window.addEventListener("contextmenu", handleContextmenu);
115
- return () => {
116
- document.removeEventListener("keydown", handleKeyDown);
117
- document.removeEventListener("keyup", handleKeyUp);
118
- window.removeEventListener("blur", handleBlur);
119
- window.removeEventListener("contextmenu", handleContextmenu);
120
- };
121
- };
122
- var isKeyPressed = (key) => {
123
- const { pressedKeys } = libStore.getState();
124
- if (key.length === 1) {
125
- return pressedKeys.has(key.toLowerCase()) || pressedKeys.has(key.toUpperCase());
126
- }
127
- return pressedKeys.has(key);
128
- };
129
- var watchKeyHeldFor = (key, duration, onHeld) => {
130
- let timeoutId = null;
131
- let unsubscribe = null;
132
- const watchStartTime = Date.now();
133
- const cleanup = () => {
134
- if (timeoutId !== null) {
135
- clearTimeout(timeoutId);
136
- timeoutId = null;
137
- }
138
- if (unsubscribe !== null) {
139
- unsubscribe();
140
- unsubscribe = null;
141
- }
142
- };
143
- const checkSingleKeyPressed = (keyToCheck, pressedKeys) => {
144
- if (keyToCheck.length === 1) {
145
- return pressedKeys.has(keyToCheck.toLowerCase()) || pressedKeys.has(keyToCheck.toUpperCase());
146
- }
147
- return pressedKeys.has(keyToCheck);
148
- };
149
- const checkAllKeysPressed = (pressedKeys) => {
150
- if (Array.isArray(key)) {
151
- return key.every(
152
- (keyFromCombo) => checkSingleKeyPressed(keyFromCombo, pressedKeys)
153
- );
154
- }
155
- return checkSingleKeyPressed(key, pressedKeys);
156
- };
157
- const scheduleCallback = () => {
158
- const state = libStore.getState();
159
- const { pressedKeys } = state;
160
- if (!checkAllKeysPressed(pressedKeys)) {
161
- if (timeoutId !== null) {
162
- clearTimeout(timeoutId);
163
- timeoutId = null;
164
- }
165
- return;
166
- }
167
- const elapsed = Date.now() - watchStartTime;
168
- const remaining = duration - elapsed;
169
- if (remaining <= 0) {
170
- onHeld();
171
- cleanup();
172
- return;
173
- }
174
- if (timeoutId !== null) {
175
- clearTimeout(timeoutId);
176
- }
177
- timeoutId = setTimeout(() => {
178
- onHeld();
179
- cleanup();
180
- }, remaining);
181
- };
182
- unsubscribe = libStore.subscribe(
183
- () => {
184
- scheduleCallback();
185
- },
186
- (state) => state.pressedKeys
187
- );
188
- scheduleCallback();
189
- return cleanup;
190
- };
191
-
192
- // ../../node_modules/.pnpm/bippy@0.3.31_@types+react@19.2.2_react@19.2.0/node_modules/bippy/dist/src-R2iEnVC1.js
193
- var version = "0.3.31";
194
- var BIPPY_INSTRUMENTATION_STRING = `bippy-${version}`;
195
- var objectDefineProperty = Object.defineProperty;
196
- var objectHasOwnProperty = Object.prototype.hasOwnProperty;
197
- var NO_OP = () => {
198
- };
199
- var checkDCE = (fn) => {
200
- try {
201
- const code = Function.prototype.toString.call(fn);
202
- if (code.indexOf("^_^") > -1) setTimeout(() => {
203
- throw new Error("React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build");
204
- });
205
- } catch {
206
- }
207
- };
208
- var isRealReactDevtools = (rdtHook = getRDTHook()) => {
209
- return "getFiberRoots" in rdtHook;
210
- };
211
- var isReactRefreshOverride = false;
212
- var injectFnStr = void 0;
213
- var isReactRefresh = (rdtHook = getRDTHook()) => {
214
- if (isReactRefreshOverride) return true;
215
- if (typeof rdtHook.inject === "function") injectFnStr = rdtHook.inject.toString();
216
- return Boolean(injectFnStr?.includes("(injected)"));
217
- };
218
- var onActiveListeners = /* @__PURE__ */ new Set();
219
- var _renderers = /* @__PURE__ */ new Set();
220
- var installRDTHook = (onActive) => {
221
- const renderers = /* @__PURE__ */ new Map();
222
- let i = 0;
223
- let rdtHook = {
224
- checkDCE,
225
- supportsFiber: true,
226
- supportsFlight: true,
227
- hasUnsupportedRendererAttached: false,
228
- renderers,
229
- onCommitFiberRoot: NO_OP,
230
- onCommitFiberUnmount: NO_OP,
231
- onPostCommitFiberRoot: NO_OP,
232
- on: NO_OP,
233
- inject(renderer) {
234
- const nextID = ++i;
235
- renderers.set(nextID, renderer);
236
- _renderers.add(renderer);
237
- if (!rdtHook._instrumentationIsActive) {
238
- rdtHook._instrumentationIsActive = true;
239
- onActiveListeners.forEach((listener) => listener());
240
- }
241
- return nextID;
242
- },
243
- _instrumentationSource: BIPPY_INSTRUMENTATION_STRING,
244
- _instrumentationIsActive: false
245
- };
246
- try {
247
- objectDefineProperty(globalThis, "__REACT_DEVTOOLS_GLOBAL_HOOK__", {
248
- get() {
249
- return rdtHook;
250
- },
251
- set(newHook) {
252
- if (newHook && typeof newHook === "object") {
253
- const ourRenderers = rdtHook.renderers;
254
- rdtHook = newHook;
255
- if (ourRenderers.size > 0) {
256
- ourRenderers.forEach((renderer, id) => {
257
- _renderers.add(renderer);
258
- newHook.renderers.set(id, renderer);
259
- });
260
- patchRDTHook(onActive);
261
- }
262
- }
263
- },
264
- configurable: true,
265
- enumerable: true
266
- });
267
- const originalWindowHasOwnProperty = window.hasOwnProperty;
268
- let hasRanHack = false;
269
- objectDefineProperty(window, "hasOwnProperty", {
270
- value: function() {
271
- try {
272
- if (!hasRanHack && arguments[0] === "__REACT_DEVTOOLS_GLOBAL_HOOK__") {
273
- globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__ = void 0;
274
- hasRanHack = true;
275
- return -0;
276
- }
277
- } catch {
278
- }
279
- return originalWindowHasOwnProperty.apply(this, arguments);
280
- },
281
- configurable: true,
282
- writable: true
283
- });
284
- } catch {
285
- patchRDTHook(onActive);
286
- }
287
- return rdtHook;
288
- };
289
- var patchRDTHook = (onActive) => {
290
- if (onActive) onActiveListeners.add(onActive);
291
- try {
292
- const rdtHook = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;
293
- if (!rdtHook) return;
294
- if (!rdtHook._instrumentationSource) {
295
- rdtHook.checkDCE = checkDCE;
296
- rdtHook.supportsFiber = true;
297
- rdtHook.supportsFlight = true;
298
- rdtHook.hasUnsupportedRendererAttached = false;
299
- rdtHook._instrumentationSource = BIPPY_INSTRUMENTATION_STRING;
300
- rdtHook._instrumentationIsActive = false;
301
- rdtHook.on = NO_OP;
302
- if (rdtHook.renderers.size) {
303
- rdtHook._instrumentationIsActive = true;
304
- onActiveListeners.forEach((listener) => listener());
305
- return;
306
- }
307
- const prevInject = rdtHook.inject;
308
- if (isReactRefresh(rdtHook) && !isRealReactDevtools()) {
309
- isReactRefreshOverride = true;
310
- const nextID = rdtHook.inject({ scheduleRefresh() {
311
- } });
312
- if (nextID) rdtHook._instrumentationIsActive = true;
313
- }
314
- rdtHook.inject = (renderer) => {
315
- const id = prevInject(renderer);
316
- _renderers.add(renderer);
317
- rdtHook._instrumentationIsActive = true;
318
- onActiveListeners.forEach((listener) => listener());
319
- return id;
320
- };
321
- }
322
- if (rdtHook.renderers.size || rdtHook._instrumentationIsActive || isReactRefresh()) onActive?.();
323
- } catch {
324
- }
325
- };
326
- var hasRDTHook = () => {
327
- return objectHasOwnProperty.call(globalThis, "__REACT_DEVTOOLS_GLOBAL_HOOK__");
328
- };
329
- var getRDTHook = (onActive) => {
330
- if (!hasRDTHook()) return installRDTHook(onActive);
331
- patchRDTHook(onActive);
332
- return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;
333
- };
334
- var isClientEnvironment = () => {
335
- return Boolean(typeof window !== "undefined" && (window.document?.createElement || window.navigator?.product === "ReactNative"));
336
- };
337
- var safelyInstallRDTHook = () => {
338
- try {
339
- if (isClientEnvironment()) getRDTHook();
340
- } catch {
341
- }
342
- };
343
- var FunctionComponentTag = 0;
344
- var ClassComponentTag = 1;
345
- var HostComponentTag = 5;
346
- var ForwardRefTag = 11;
347
- var SuspenseComponentTag = 13;
348
- var SimpleMemoComponentTag = 15;
349
- var LazyComponentTag = 16;
350
- var SuspenseListComponentTag = 19;
351
- var HostHoistableTag = 26;
352
- var HostSingletonTag = 27;
353
- var ActivityComponentTag = 28;
354
- var ViewTransitionComponentTag = 30;
355
- var getType = (type) => {
356
- const currentType = type;
357
- if (typeof currentType === "function") return currentType;
358
- if (typeof currentType === "object" && currentType) return getType(currentType.type || currentType.render);
359
- return null;
360
- };
361
- var getDisplayName = (type) => {
362
- const currentType = type;
363
- if (typeof currentType === "string") return currentType;
364
- if (typeof currentType !== "function" && !(typeof currentType === "object" && currentType)) return null;
365
- const name = currentType.displayName || currentType.name || null;
366
- if (name) return name;
367
- const unwrappedType = getType(currentType);
368
- if (!unwrappedType) return null;
369
- return unwrappedType.displayName || unwrappedType.name || null;
370
- };
371
- var instrument = (options) => {
372
- return getRDTHook(() => {
373
- const rdtHook = getRDTHook();
374
- options.onActive?.();
375
- rdtHook._instrumentationSource = options.name ?? BIPPY_INSTRUMENTATION_STRING;
376
- const prevOnCommitFiberRoot = rdtHook.onCommitFiberRoot;
377
- if (options.onCommitFiberRoot) rdtHook.onCommitFiberRoot = (rendererID, root, priority) => {
378
- if (prevOnCommitFiberRoot) prevOnCommitFiberRoot(rendererID, root, priority);
379
- options.onCommitFiberRoot?.(rendererID, root, priority);
380
- };
381
- const prevOnCommitFiberUnmount = rdtHook.onCommitFiberUnmount;
382
- if (options.onCommitFiberUnmount) rdtHook.onCommitFiberUnmount = (rendererID, root) => {
383
- if (prevOnCommitFiberUnmount) prevOnCommitFiberUnmount(rendererID, root);
384
- options.onCommitFiberUnmount?.(rendererID, root);
385
- };
386
- const prevOnPostCommitFiberRoot = rdtHook.onPostCommitFiberRoot;
387
- if (options.onPostCommitFiberRoot) rdtHook.onPostCommitFiberRoot = (rendererID, root) => {
388
- if (prevOnPostCommitFiberRoot) prevOnPostCommitFiberRoot(rendererID, root);
389
- options.onPostCommitFiberRoot?.(rendererID, root);
390
- };
391
- });
392
- };
393
- var getFiberFromHostInstance = (hostInstance) => {
394
- const rdtHook = getRDTHook();
395
- for (const renderer of rdtHook.renderers.values()) try {
396
- const fiber = renderer.findFiberByHostInstance?.(hostInstance);
397
- if (fiber) return fiber;
398
- } catch {
399
- }
400
- if (typeof hostInstance === "object" && hostInstance != null) {
401
- if ("_reactRootContainer" in hostInstance) return hostInstance._reactRootContainer?._internalRoot?.current?.child;
402
- for (const key in hostInstance) if (key.startsWith("__reactContainer$") || key.startsWith("__reactInternalInstance$") || key.startsWith("__reactFiber")) return hostInstance[key] || null;
403
- }
404
- return null;
405
- };
406
- var _fiberRoots = /* @__PURE__ */ new Set();
407
- safelyInstallRDTHook();
408
-
409
- // ../../node_modules/.pnpm/bippy@0.3.31_@types+react@19.2.2_react@19.2.0/node_modules/bippy/dist/source-DWOhEbf2.js
410
- var __create = Object.create;
411
- var __defProp = Object.defineProperty;
412
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
413
- var __getOwnPropNames = Object.getOwnPropertyNames;
414
- var __getProtoOf = Object.getPrototypeOf;
415
- var __hasOwnProp = Object.prototype.hasOwnProperty;
416
- var __commonJS = (cb, mod) => function() {
417
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
418
- };
419
- var __copyProps = (to, from, except, desc) => {
420
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
421
- key = keys[i];
422
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
423
- get: ((k) => from[k]).bind(null, key),
424
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
425
- });
426
- }
427
- return to;
428
- };
429
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(__defProp(target, "default", {
430
- value: mod,
431
- enumerable: true
432
- }) , mod));
433
- var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
434
- var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code\])?$/;
435
- function parseStack(stackString, options) {
436
- if (stackString.match(CHROME_IE_STACK_REGEXP)) return parseV8OrIeString(stackString);
437
- else return parseFFOrSafariString(stackString);
438
- }
439
- function extractLocation(urlLike) {
440
- if (!urlLike.includes(":")) return [
441
- urlLike,
442
- void 0,
443
- void 0
444
- ];
445
- const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
446
- const parts = regExp.exec(urlLike.replace(/[()]/g, ""));
447
- return [
448
- parts[1],
449
- parts[2] || void 0,
450
- parts[3] || void 0
451
- ];
452
- }
453
- function applySlice(lines, options) {
454
- return lines;
455
- }
456
- function parseV8OrIeString(stack, options) {
457
- const filtered = applySlice(stack.split("\n").filter((line) => {
458
- return !!line.match(CHROME_IE_STACK_REGEXP);
459
- }));
460
- return filtered.map((line) => {
461
- if (line.includes("(eval ")) line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
462
- let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
463
- const location = sanitizedLine.match(/ (\(.+\)$)/);
464
- sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
465
- const locationParts = extractLocation(location ? location[1] : sanitizedLine);
466
- const functionName = location && sanitizedLine || void 0;
467
- const fileName = ["eval", "<anonymous>"].includes(locationParts[0]) ? void 0 : locationParts[0];
468
- return {
469
- function: functionName,
470
- file: fileName,
471
- line: locationParts[1] ? +locationParts[1] : void 0,
472
- col: locationParts[2] ? +locationParts[2] : void 0,
473
- raw: line
474
- };
475
- });
476
- }
477
- function parseFFOrSafariString(stack, options) {
478
- const filtered = applySlice(stack.split("\n").filter((line) => {
479
- return !line.match(SAFARI_NATIVE_CODE_REGEXP);
480
- }));
481
- return filtered.map((line) => {
482
- if (line.includes(" > eval")) line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
483
- if (!line.includes("@") && !line.includes(":")) return { function: line };
484
- else {
485
- const functionNameRegex = /(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/;
486
- const matches = line.match(functionNameRegex);
487
- const functionName = matches && matches[1] ? matches[1] : void 0;
488
- const locationParts = extractLocation(line.replace(functionNameRegex, ""));
489
- return {
490
- function: functionName,
491
- file: locationParts[0],
492
- line: locationParts[1] ? +locationParts[1] : void 0,
493
- col: locationParts[2] ? +locationParts[2] : void 0,
494
- raw: line
495
- };
496
- }
497
- });
498
- }
499
- var require_base64 = __commonJS({ "../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/base64.js"(exports) {
500
- var intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
501
- exports.encode = function(number) {
502
- if (0 <= number && number < intToCharMap.length) return intToCharMap[number];
503
- throw new TypeError("Must be between 0 and 63: " + number);
504
- };
505
- exports.decode = function(charCode) {
506
- var bigA = 65;
507
- var bigZ = 90;
508
- var littleA = 97;
509
- var littleZ = 122;
510
- var zero = 48;
511
- var nine = 57;
512
- var plus = 43;
513
- var slash = 47;
514
- var littleOffset = 26;
515
- var numberOffset = 52;
516
- if (bigA <= charCode && charCode <= bigZ) return charCode - bigA;
517
- if (littleA <= charCode && charCode <= littleZ) return charCode - littleA + littleOffset;
518
- if (zero <= charCode && charCode <= nine) return charCode - zero + numberOffset;
519
- if (charCode == plus) return 62;
520
- if (charCode == slash) return 63;
521
- return -1;
522
- };
523
- } });
524
- var require_base64_vlq = __commonJS({ "../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/base64-vlq.js"(exports) {
525
- var base64 = require_base64();
526
- var VLQ_BASE_SHIFT = 5;
527
- var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
528
- var VLQ_BASE_MASK = VLQ_BASE - 1;
529
- var VLQ_CONTINUATION_BIT = VLQ_BASE;
530
- function toVLQSigned(aValue) {
531
- return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0;
532
- }
533
- function fromVLQSigned(aValue) {
534
- var isNegative = (aValue & 1) === 1;
535
- var shifted = aValue >> 1;
536
- return isNegative ? -shifted : shifted;
537
- }
538
- exports.encode = function base64VLQ_encode(aValue) {
539
- var encoded = "";
540
- var digit;
541
- var vlq = toVLQSigned(aValue);
542
- do {
543
- digit = vlq & VLQ_BASE_MASK;
544
- vlq >>>= VLQ_BASE_SHIFT;
545
- if (vlq > 0) digit |= VLQ_CONTINUATION_BIT;
546
- encoded += base64.encode(digit);
547
- } while (vlq > 0);
548
- return encoded;
549
- };
550
- exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
551
- var strLen = aStr.length;
552
- var result = 0;
553
- var shift = 0;
554
- var continuation, digit;
555
- do {
556
- if (aIndex >= strLen) throw new Error("Expected more digits in base 64 VLQ value.");
557
- digit = base64.decode(aStr.charCodeAt(aIndex++));
558
- if (digit === -1) throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
559
- continuation = !!(digit & VLQ_CONTINUATION_BIT);
560
- digit &= VLQ_BASE_MASK;
561
- result = result + (digit << shift);
562
- shift += VLQ_BASE_SHIFT;
563
- } while (continuation);
564
- aOutParam.value = fromVLQSigned(result);
565
- aOutParam.rest = aIndex;
566
- };
567
- } });
568
- var require_util = __commonJS({ "../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/util.js"(exports) {
569
- function getArg(aArgs, aName, aDefaultValue) {
570
- if (aName in aArgs) return aArgs[aName];
571
- else if (arguments.length === 3) return aDefaultValue;
572
- else throw new Error('"' + aName + '" is a required argument.');
573
- }
574
- exports.getArg = getArg;
575
- var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
576
- var dataUrlRegexp = /^data:.+\,.+$/;
577
- function urlParse(aUrl) {
578
- var match = aUrl.match(urlRegexp);
579
- if (!match) return null;
580
- return {
581
- scheme: match[1],
582
- auth: match[2],
583
- host: match[3],
584
- port: match[4],
585
- path: match[5]
586
- };
587
- }
588
- exports.urlParse = urlParse;
589
- function urlGenerate(aParsedUrl) {
590
- var url = "";
591
- if (aParsedUrl.scheme) url += aParsedUrl.scheme + ":";
592
- url += "//";
593
- if (aParsedUrl.auth) url += aParsedUrl.auth + "@";
594
- if (aParsedUrl.host) url += aParsedUrl.host;
595
- if (aParsedUrl.port) url += ":" + aParsedUrl.port;
596
- if (aParsedUrl.path) url += aParsedUrl.path;
597
- return url;
598
- }
599
- exports.urlGenerate = urlGenerate;
600
- var MAX_CACHED_INPUTS = 32;
601
- function lruMemoize(f) {
602
- var cache = [];
603
- return function(input) {
604
- for (var i = 0; i < cache.length; i++) if (cache[i].input === input) {
605
- var temp = cache[0];
606
- cache[0] = cache[i];
607
- cache[i] = temp;
608
- return cache[0].result;
609
- }
610
- var result = f(input);
611
- cache.unshift({
612
- input,
613
- result
614
- });
615
- if (cache.length > MAX_CACHED_INPUTS) cache.pop();
616
- return result;
617
- };
618
- }
619
- var normalize = lruMemoize(function normalize$1(aPath) {
620
- var path = aPath;
621
- var url = urlParse(aPath);
622
- if (url) {
623
- if (!url.path) return aPath;
624
- path = url.path;
625
- }
626
- var isAbsolute = exports.isAbsolute(path);
627
- var parts = [];
628
- var start = 0;
629
- var i = 0;
630
- while (true) {
631
- start = i;
632
- i = path.indexOf("/", start);
633
- if (i === -1) {
634
- parts.push(path.slice(start));
635
- break;
636
- } else {
637
- parts.push(path.slice(start, i));
638
- while (i < path.length && path[i] === "/") i++;
639
- }
640
- }
641
- for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
642
- part = parts[i];
643
- if (part === ".") parts.splice(i, 1);
644
- else if (part === "..") up++;
645
- else if (up > 0) if (part === "") {
646
- parts.splice(i + 1, up);
647
- up = 0;
648
- } else {
649
- parts.splice(i, 2);
650
- up--;
651
- }
652
- }
653
- path = parts.join("/");
654
- if (path === "") path = isAbsolute ? "/" : ".";
655
- if (url) {
656
- url.path = path;
657
- return urlGenerate(url);
658
- }
659
- return path;
660
- });
661
- exports.normalize = normalize;
662
- function join(aRoot, aPath) {
663
- if (aRoot === "") aRoot = ".";
664
- if (aPath === "") aPath = ".";
665
- var aPathUrl = urlParse(aPath);
666
- var aRootUrl = urlParse(aRoot);
667
- if (aRootUrl) aRoot = aRootUrl.path || "/";
668
- if (aPathUrl && !aPathUrl.scheme) {
669
- if (aRootUrl) aPathUrl.scheme = aRootUrl.scheme;
670
- return urlGenerate(aPathUrl);
671
- }
672
- if (aPathUrl || aPath.match(dataUrlRegexp)) return aPath;
673
- if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
674
- aRootUrl.host = aPath;
675
- return urlGenerate(aRootUrl);
676
- }
677
- var joined = aPath.charAt(0) === "/" ? aPath : normalize(aRoot.replace(/\/+$/, "") + "/" + aPath);
678
- if (aRootUrl) {
679
- aRootUrl.path = joined;
680
- return urlGenerate(aRootUrl);
681
- }
682
- return joined;
683
- }
684
- exports.join = join;
685
- exports.isAbsolute = function(aPath) {
686
- return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
687
- };
688
- function relative(aRoot, aPath) {
689
- if (aRoot === "") aRoot = ".";
690
- aRoot = aRoot.replace(/\/$/, "");
691
- var level = 0;
692
- while (aPath.indexOf(aRoot + "/") !== 0) {
693
- var index = aRoot.lastIndexOf("/");
694
- if (index < 0) return aPath;
695
- aRoot = aRoot.slice(0, index);
696
- if (aRoot.match(/^([^\/]+:\/)?\/*$/)) return aPath;
697
- ++level;
698
- }
699
- return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
700
- }
701
- exports.relative = relative;
702
- var supportsNullProto = function() {
703
- var obj = /* @__PURE__ */ Object.create(null);
704
- return !("__proto__" in obj);
705
- }();
706
- function identity(s) {
707
- return s;
708
- }
709
- function toSetString(aStr) {
710
- if (isProtoString(aStr)) return "$" + aStr;
711
- return aStr;
712
- }
713
- exports.toSetString = supportsNullProto ? identity : toSetString;
714
- function fromSetString(aStr) {
715
- if (isProtoString(aStr)) return aStr.slice(1);
716
- return aStr;
717
- }
718
- exports.fromSetString = supportsNullProto ? identity : fromSetString;
719
- function isProtoString(s) {
720
- if (!s) return false;
721
- var length = s.length;
722
- if (length < 9) return false;
723
- if (s.charCodeAt(length - 1) !== 95 || s.charCodeAt(length - 2) !== 95 || s.charCodeAt(length - 3) !== 111 || s.charCodeAt(length - 4) !== 116 || s.charCodeAt(length - 5) !== 111 || s.charCodeAt(length - 6) !== 114 || s.charCodeAt(length - 7) !== 112 || s.charCodeAt(length - 8) !== 95 || s.charCodeAt(length - 9) !== 95) return false;
724
- for (var i = length - 10; i >= 0; i--) if (s.charCodeAt(i) !== 36) return false;
725
- return true;
726
- }
727
- function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
728
- var cmp = strcmp(mappingA.source, mappingB.source);
729
- if (cmp !== 0) return cmp;
730
- cmp = mappingA.originalLine - mappingB.originalLine;
731
- if (cmp !== 0) return cmp;
732
- cmp = mappingA.originalColumn - mappingB.originalColumn;
733
- if (cmp !== 0 || onlyCompareOriginal) return cmp;
734
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
735
- if (cmp !== 0) return cmp;
736
- cmp = mappingA.generatedLine - mappingB.generatedLine;
737
- if (cmp !== 0) return cmp;
738
- return strcmp(mappingA.name, mappingB.name);
739
- }
740
- exports.compareByOriginalPositions = compareByOriginalPositions;
741
- function compareByOriginalPositionsNoSource(mappingA, mappingB, onlyCompareOriginal) {
742
- var cmp;
743
- cmp = mappingA.originalLine - mappingB.originalLine;
744
- if (cmp !== 0) return cmp;
745
- cmp = mappingA.originalColumn - mappingB.originalColumn;
746
- if (cmp !== 0 || onlyCompareOriginal) return cmp;
747
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
748
- if (cmp !== 0) return cmp;
749
- cmp = mappingA.generatedLine - mappingB.generatedLine;
750
- if (cmp !== 0) return cmp;
751
- return strcmp(mappingA.name, mappingB.name);
752
- }
753
- exports.compareByOriginalPositionsNoSource = compareByOriginalPositionsNoSource;
754
- function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
755
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
756
- if (cmp !== 0) return cmp;
757
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
758
- if (cmp !== 0 || onlyCompareGenerated) return cmp;
759
- cmp = strcmp(mappingA.source, mappingB.source);
760
- if (cmp !== 0) return cmp;
761
- cmp = mappingA.originalLine - mappingB.originalLine;
762
- if (cmp !== 0) return cmp;
763
- cmp = mappingA.originalColumn - mappingB.originalColumn;
764
- if (cmp !== 0) return cmp;
765
- return strcmp(mappingA.name, mappingB.name);
766
- }
767
- exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
768
- function compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompareGenerated) {
769
- var cmp = mappingA.generatedColumn - mappingB.generatedColumn;
770
- if (cmp !== 0 || onlyCompareGenerated) return cmp;
771
- cmp = strcmp(mappingA.source, mappingB.source);
772
- if (cmp !== 0) return cmp;
773
- cmp = mappingA.originalLine - mappingB.originalLine;
774
- if (cmp !== 0) return cmp;
775
- cmp = mappingA.originalColumn - mappingB.originalColumn;
776
- if (cmp !== 0) return cmp;
777
- return strcmp(mappingA.name, mappingB.name);
778
- }
779
- exports.compareByGeneratedPositionsDeflatedNoLine = compareByGeneratedPositionsDeflatedNoLine;
780
- function strcmp(aStr1, aStr2) {
781
- if (aStr1 === aStr2) return 0;
782
- if (aStr1 === null) return 1;
783
- if (aStr2 === null) return -1;
784
- if (aStr1 > aStr2) return 1;
785
- return -1;
786
- }
787
- function compareByGeneratedPositionsInflated(mappingA, mappingB) {
788
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
789
- if (cmp !== 0) return cmp;
790
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
791
- if (cmp !== 0) return cmp;
792
- cmp = strcmp(mappingA.source, mappingB.source);
793
- if (cmp !== 0) return cmp;
794
- cmp = mappingA.originalLine - mappingB.originalLine;
795
- if (cmp !== 0) return cmp;
796
- cmp = mappingA.originalColumn - mappingB.originalColumn;
797
- if (cmp !== 0) return cmp;
798
- return strcmp(mappingA.name, mappingB.name);
799
- }
800
- exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
801
- function parseSourceMapInput(str) {
802
- return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
803
- }
804
- exports.parseSourceMapInput = parseSourceMapInput;
805
- function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
806
- sourceURL = sourceURL || "";
807
- if (sourceRoot) {
808
- if (sourceRoot[sourceRoot.length - 1] !== "/" && sourceURL[0] !== "/") sourceRoot += "/";
809
- sourceURL = sourceRoot + sourceURL;
810
- }
811
- if (sourceMapURL) {
812
- var parsed = urlParse(sourceMapURL);
813
- if (!parsed) throw new Error("sourceMapURL could not be parsed");
814
- if (parsed.path) {
815
- var index = parsed.path.lastIndexOf("/");
816
- if (index >= 0) parsed.path = parsed.path.substring(0, index + 1);
817
- }
818
- sourceURL = join(urlGenerate(parsed), sourceURL);
819
- }
820
- return normalize(sourceURL);
821
- }
822
- exports.computeSourceURL = computeSourceURL;
823
- } });
824
- var require_array_set = __commonJS({ "../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/array-set.js"(exports) {
825
- var util$4 = require_util();
826
- var has = Object.prototype.hasOwnProperty;
827
- var hasNativeMap = typeof Map !== "undefined";
828
- function ArraySet$2() {
829
- this._array = [];
830
- this._set = hasNativeMap ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
831
- }
832
- ArraySet$2.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
833
- var set = new ArraySet$2();
834
- for (var i = 0, len = aArray.length; i < len; i++) set.add(aArray[i], aAllowDuplicates);
835
- return set;
836
- };
837
- ArraySet$2.prototype.size = function ArraySet_size() {
838
- return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
839
- };
840
- ArraySet$2.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
841
- var sStr = hasNativeMap ? aStr : util$4.toSetString(aStr);
842
- var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
843
- var idx = this._array.length;
844
- if (!isDuplicate || aAllowDuplicates) this._array.push(aStr);
845
- if (!isDuplicate) if (hasNativeMap) this._set.set(aStr, idx);
846
- else this._set[sStr] = idx;
847
- };
848
- ArraySet$2.prototype.has = function ArraySet_has(aStr) {
849
- if (hasNativeMap) return this._set.has(aStr);
850
- else {
851
- var sStr = util$4.toSetString(aStr);
852
- return has.call(this._set, sStr);
853
- }
854
- };
855
- ArraySet$2.prototype.indexOf = function ArraySet_indexOf(aStr) {
856
- if (hasNativeMap) {
857
- var idx = this._set.get(aStr);
858
- if (idx >= 0) return idx;
859
- } else {
860
- var sStr = util$4.toSetString(aStr);
861
- if (has.call(this._set, sStr)) return this._set[sStr];
862
- }
863
- throw new Error('"' + aStr + '" is not in the set.');
864
- };
865
- ArraySet$2.prototype.at = function ArraySet_at(aIdx) {
866
- if (aIdx >= 0 && aIdx < this._array.length) return this._array[aIdx];
867
- throw new Error("No element indexed by " + aIdx);
868
- };
869
- ArraySet$2.prototype.toArray = function ArraySet_toArray() {
870
- return this._array.slice();
871
- };
872
- exports.ArraySet = ArraySet$2;
873
- } });
874
- var require_mapping_list = __commonJS({ "../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/mapping-list.js"(exports) {
875
- var util$3 = require_util();
876
- function generatedPositionAfter(mappingA, mappingB) {
877
- var lineA = mappingA.generatedLine;
878
- var lineB = mappingB.generatedLine;
879
- var columnA = mappingA.generatedColumn;
880
- var columnB = mappingB.generatedColumn;
881
- return lineB > lineA || lineB == lineA && columnB >= columnA || util$3.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
882
- }
883
- function MappingList$1() {
884
- this._array = [];
885
- this._sorted = true;
886
- this._last = {
887
- generatedLine: -1,
888
- generatedColumn: 0
889
- };
890
- }
891
- MappingList$1.prototype.unsortedForEach = function MappingList_forEach(aCallback, aThisArg) {
892
- this._array.forEach(aCallback, aThisArg);
893
- };
894
- MappingList$1.prototype.add = function MappingList_add(aMapping) {
895
- if (generatedPositionAfter(this._last, aMapping)) {
896
- this._last = aMapping;
897
- this._array.push(aMapping);
898
- } else {
899
- this._sorted = false;
900
- this._array.push(aMapping);
901
- }
902
- };
903
- MappingList$1.prototype.toArray = function MappingList_toArray() {
904
- if (!this._sorted) {
905
- this._array.sort(util$3.compareByGeneratedPositionsInflated);
906
- this._sorted = true;
907
- }
908
- return this._array;
909
- };
910
- exports.MappingList = MappingList$1;
911
- } });
912
- var require_source_map_generator = __commonJS({ "../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-map-generator.js"(exports) {
913
- var base64VLQ$1 = require_base64_vlq();
914
- var util$2 = require_util();
915
- var ArraySet$1 = require_array_set().ArraySet;
916
- var MappingList = require_mapping_list().MappingList;
917
- function SourceMapGenerator$1(aArgs) {
918
- if (!aArgs) aArgs = {};
919
- this._file = util$2.getArg(aArgs, "file", null);
920
- this._sourceRoot = util$2.getArg(aArgs, "sourceRoot", null);
921
- this._skipValidation = util$2.getArg(aArgs, "skipValidation", false);
922
- this._ignoreInvalidMapping = util$2.getArg(aArgs, "ignoreInvalidMapping", false);
923
- this._sources = new ArraySet$1();
924
- this._names = new ArraySet$1();
925
- this._mappings = new MappingList();
926
- this._sourcesContents = null;
927
- }
928
- SourceMapGenerator$1.prototype._version = 3;
929
- SourceMapGenerator$1.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer, generatorOps) {
930
- var sourceRoot = aSourceMapConsumer.sourceRoot;
931
- var generator = new SourceMapGenerator$1(Object.assign(generatorOps || {}, {
932
- file: aSourceMapConsumer.file,
933
- sourceRoot
934
- }));
935
- aSourceMapConsumer.eachMapping(function(mapping) {
936
- var newMapping = { generated: {
937
- line: mapping.generatedLine,
938
- column: mapping.generatedColumn
939
- } };
940
- if (mapping.source != null) {
941
- newMapping.source = mapping.source;
942
- if (sourceRoot != null) newMapping.source = util$2.relative(sourceRoot, newMapping.source);
943
- newMapping.original = {
944
- line: mapping.originalLine,
945
- column: mapping.originalColumn
946
- };
947
- if (mapping.name != null) newMapping.name = mapping.name;
948
- }
949
- generator.addMapping(newMapping);
950
- });
951
- aSourceMapConsumer.sources.forEach(function(sourceFile) {
952
- var sourceRelative = sourceFile;
953
- if (sourceRoot !== null) sourceRelative = util$2.relative(sourceRoot, sourceFile);
954
- if (!generator._sources.has(sourceRelative)) generator._sources.add(sourceRelative);
955
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
956
- if (content != null) generator.setSourceContent(sourceFile, content);
957
- });
958
- return generator;
959
- };
960
- SourceMapGenerator$1.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
961
- var generated = util$2.getArg(aArgs, "generated");
962
- var original = util$2.getArg(aArgs, "original", null);
963
- var source = util$2.getArg(aArgs, "source", null);
964
- var name = util$2.getArg(aArgs, "name", null);
965
- if (!this._skipValidation) {
966
- if (this._validateMapping(generated, original, source, name) === false) return;
967
- }
968
- if (source != null) {
969
- source = String(source);
970
- if (!this._sources.has(source)) this._sources.add(source);
971
- }
972
- if (name != null) {
973
- name = String(name);
974
- if (!this._names.has(name)) this._names.add(name);
975
- }
976
- this._mappings.add({
977
- generatedLine: generated.line,
978
- generatedColumn: generated.column,
979
- originalLine: original != null && original.line,
980
- originalColumn: original != null && original.column,
981
- source,
982
- name
983
- });
984
- };
985
- SourceMapGenerator$1.prototype.setSourceContent = function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
986
- var source = aSourceFile;
987
- if (this._sourceRoot != null) source = util$2.relative(this._sourceRoot, source);
988
- if (aSourceContent != null) {
989
- if (!this._sourcesContents) this._sourcesContents = /* @__PURE__ */ Object.create(null);
990
- this._sourcesContents[util$2.toSetString(source)] = aSourceContent;
991
- } else if (this._sourcesContents) {
992
- delete this._sourcesContents[util$2.toSetString(source)];
993
- if (Object.keys(this._sourcesContents).length === 0) this._sourcesContents = null;
994
- }
995
- };
996
- SourceMapGenerator$1.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
997
- var sourceFile = aSourceFile;
998
- if (aSourceFile == null) {
999
- if (aSourceMapConsumer.file == null) throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);
1000
- sourceFile = aSourceMapConsumer.file;
1001
- }
1002
- var sourceRoot = this._sourceRoot;
1003
- if (sourceRoot != null) sourceFile = util$2.relative(sourceRoot, sourceFile);
1004
- var newSources = new ArraySet$1();
1005
- var newNames = new ArraySet$1();
1006
- this._mappings.unsortedForEach(function(mapping) {
1007
- if (mapping.source === sourceFile && mapping.originalLine != null) {
1008
- var original = aSourceMapConsumer.originalPositionFor({
1009
- line: mapping.originalLine,
1010
- column: mapping.originalColumn
1011
- });
1012
- if (original.source != null) {
1013
- mapping.source = original.source;
1014
- if (aSourceMapPath != null) mapping.source = util$2.join(aSourceMapPath, mapping.source);
1015
- if (sourceRoot != null) mapping.source = util$2.relative(sourceRoot, mapping.source);
1016
- mapping.originalLine = original.line;
1017
- mapping.originalColumn = original.column;
1018
- if (original.name != null) mapping.name = original.name;
1019
- }
1020
- }
1021
- var source = mapping.source;
1022
- if (source != null && !newSources.has(source)) newSources.add(source);
1023
- var name = mapping.name;
1024
- if (name != null && !newNames.has(name)) newNames.add(name);
1025
- }, this);
1026
- this._sources = newSources;
1027
- this._names = newNames;
1028
- aSourceMapConsumer.sources.forEach(function(sourceFile$1) {
1029
- var content = aSourceMapConsumer.sourceContentFor(sourceFile$1);
1030
- if (content != null) {
1031
- if (aSourceMapPath != null) sourceFile$1 = util$2.join(aSourceMapPath, sourceFile$1);
1032
- if (sourceRoot != null) sourceFile$1 = util$2.relative(sourceRoot, sourceFile$1);
1033
- this.setSourceContent(sourceFile$1, content);
1034
- }
1035
- }, this);
1036
- };
1037
- SourceMapGenerator$1.prototype._validateMapping = function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, aName) {
1038
- if (aOriginal && typeof aOriginal.line !== "number" && typeof aOriginal.column !== "number") {
1039
- var message = "original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";
1040
- if (this._ignoreInvalidMapping) {
1041
- if (typeof console !== "undefined" && console.warn) console.warn(message);
1042
- return false;
1043
- } else throw new Error(message);
1044
- }
1045
- if (aGenerated && "line" in aGenerated && "column" in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) return;
1046
- else if (aGenerated && "line" in aGenerated && "column" in aGenerated && aOriginal && "line" in aOriginal && "column" in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) return;
1047
- else {
1048
- var message = "Invalid mapping: " + JSON.stringify({
1049
- generated: aGenerated,
1050
- source: aSource,
1051
- original: aOriginal,
1052
- name: aName
1053
- });
1054
- if (this._ignoreInvalidMapping) {
1055
- if (typeof console !== "undefined" && console.warn) console.warn(message);
1056
- return false;
1057
- } else throw new Error(message);
1058
- }
1059
- };
1060
- SourceMapGenerator$1.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() {
1061
- var previousGeneratedColumn = 0;
1062
- var previousGeneratedLine = 1;
1063
- var previousOriginalColumn = 0;
1064
- var previousOriginalLine = 0;
1065
- var previousName = 0;
1066
- var previousSource = 0;
1067
- var result = "";
1068
- var next;
1069
- var mapping;
1070
- var nameIdx;
1071
- var sourceIdx;
1072
- var mappings = this._mappings.toArray();
1073
- for (var i = 0, len = mappings.length; i < len; i++) {
1074
- mapping = mappings[i];
1075
- next = "";
1076
- if (mapping.generatedLine !== previousGeneratedLine) {
1077
- previousGeneratedColumn = 0;
1078
- while (mapping.generatedLine !== previousGeneratedLine) {
1079
- next += ";";
1080
- previousGeneratedLine++;
1081
- }
1082
- } else if (i > 0) {
1083
- if (!util$2.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) continue;
1084
- next += ",";
1085
- }
1086
- next += base64VLQ$1.encode(mapping.generatedColumn - previousGeneratedColumn);
1087
- previousGeneratedColumn = mapping.generatedColumn;
1088
- if (mapping.source != null) {
1089
- sourceIdx = this._sources.indexOf(mapping.source);
1090
- next += base64VLQ$1.encode(sourceIdx - previousSource);
1091
- previousSource = sourceIdx;
1092
- next += base64VLQ$1.encode(mapping.originalLine - 1 - previousOriginalLine);
1093
- previousOriginalLine = mapping.originalLine - 1;
1094
- next += base64VLQ$1.encode(mapping.originalColumn - previousOriginalColumn);
1095
- previousOriginalColumn = mapping.originalColumn;
1096
- if (mapping.name != null) {
1097
- nameIdx = this._names.indexOf(mapping.name);
1098
- next += base64VLQ$1.encode(nameIdx - previousName);
1099
- previousName = nameIdx;
1100
- }
1101
- }
1102
- result += next;
1103
- }
1104
- return result;
1105
- };
1106
- SourceMapGenerator$1.prototype._generateSourcesContent = function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
1107
- return aSources.map(function(source) {
1108
- if (!this._sourcesContents) return null;
1109
- if (aSourceRoot != null) source = util$2.relative(aSourceRoot, source);
1110
- var key = util$2.toSetString(source);
1111
- return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null;
1112
- }, this);
1113
- };
1114
- SourceMapGenerator$1.prototype.toJSON = function SourceMapGenerator_toJSON() {
1115
- var map = {
1116
- version: this._version,
1117
- sources: this._sources.toArray(),
1118
- names: this._names.toArray(),
1119
- mappings: this._serializeMappings()
1120
- };
1121
- if (this._file != null) map.file = this._file;
1122
- if (this._sourceRoot != null) map.sourceRoot = this._sourceRoot;
1123
- if (this._sourcesContents) map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
1124
- return map;
1125
- };
1126
- SourceMapGenerator$1.prototype.toString = function SourceMapGenerator_toString() {
1127
- return JSON.stringify(this.toJSON());
1128
- };
1129
- exports.SourceMapGenerator = SourceMapGenerator$1;
1130
- } });
1131
- var require_binary_search = __commonJS({ "../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/binary-search.js"(exports) {
1132
- exports.GREATEST_LOWER_BOUND = 1;
1133
- exports.LEAST_UPPER_BOUND = 2;
1134
- function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
1135
- var mid = Math.floor((aHigh - aLow) / 2) + aLow;
1136
- var cmp = aCompare(aNeedle, aHaystack[mid], true);
1137
- if (cmp === 0) return mid;
1138
- else if (cmp > 0) {
1139
- if (aHigh - mid > 1) return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
1140
- if (aBias == exports.LEAST_UPPER_BOUND) return aHigh < aHaystack.length ? aHigh : -1;
1141
- else return mid;
1142
- } else {
1143
- if (mid - aLow > 1) return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
1144
- if (aBias == exports.LEAST_UPPER_BOUND) return mid;
1145
- else return aLow < 0 ? -1 : aLow;
1146
- }
1147
- }
1148
- exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
1149
- if (aHaystack.length === 0) return -1;
1150
- var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports.GREATEST_LOWER_BOUND);
1151
- if (index < 0) return -1;
1152
- while (index - 1 >= 0) {
1153
- if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) break;
1154
- --index;
1155
- }
1156
- return index;
1157
- };
1158
- } });
1159
- var require_quick_sort = __commonJS({ "../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/quick-sort.js"(exports) {
1160
- function SortTemplate(comparator) {
1161
- function swap(ary, x, y) {
1162
- var temp = ary[x];
1163
- ary[x] = ary[y];
1164
- ary[y] = temp;
1165
- }
1166
- function randomIntInRange(low, high) {
1167
- return Math.round(low + Math.random() * (high - low));
1168
- }
1169
- function doQuickSort(ary, comparator$1, p, r) {
1170
- if (p < r) {
1171
- var pivotIndex = randomIntInRange(p, r);
1172
- var i = p - 1;
1173
- swap(ary, pivotIndex, r);
1174
- var pivot = ary[r];
1175
- for (var j = p; j < r; j++) if (comparator$1(ary[j], pivot, false) <= 0) {
1176
- i += 1;
1177
- swap(ary, i, j);
1178
- }
1179
- swap(ary, i + 1, j);
1180
- var q = i + 1;
1181
- doQuickSort(ary, comparator$1, p, q - 1);
1182
- doQuickSort(ary, comparator$1, q + 1, r);
1183
- }
1184
- }
1185
- return doQuickSort;
1186
- }
1187
- function cloneSort(comparator) {
1188
- let template = SortTemplate.toString();
1189
- let templateFn = new Function(`return ${template}`)();
1190
- return templateFn(comparator);
1191
- }
1192
- let sortCache = /* @__PURE__ */ new WeakMap();
1193
- exports.quickSort = function(ary, comparator, start = 0) {
1194
- let doQuickSort = sortCache.get(comparator);
1195
- if (doQuickSort === void 0) {
1196
- doQuickSort = cloneSort(comparator);
1197
- sortCache.set(comparator, doQuickSort);
1198
- }
1199
- doQuickSort(ary, comparator, start, ary.length - 1);
1200
- };
1201
- } });
1202
- var require_source_map_consumer = __commonJS({ "../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-map-consumer.js"(exports) {
1203
- var util$1 = require_util();
1204
- var binarySearch = require_binary_search();
1205
- var ArraySet = require_array_set().ArraySet;
1206
- var base64VLQ = require_base64_vlq();
1207
- var quickSort = require_quick_sort().quickSort;
1208
- function SourceMapConsumer$1(aSourceMap, aSourceMapURL) {
1209
- var sourceMap = aSourceMap;
1210
- if (typeof aSourceMap === "string") sourceMap = util$1.parseSourceMapInput(aSourceMap);
1211
- return sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
1212
- }
1213
- SourceMapConsumer$1.fromSourceMap = function(aSourceMap, aSourceMapURL) {
1214
- return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
1215
- };
1216
- SourceMapConsumer$1.prototype._version = 3;
1217
- SourceMapConsumer$1.prototype.__generatedMappings = null;
1218
- Object.defineProperty(SourceMapConsumer$1.prototype, "_generatedMappings", {
1219
- configurable: true,
1220
- enumerable: true,
1221
- get: function() {
1222
- if (!this.__generatedMappings) this._parseMappings(this._mappings, this.sourceRoot);
1223
- return this.__generatedMappings;
1224
- }
1225
- });
1226
- SourceMapConsumer$1.prototype.__originalMappings = null;
1227
- Object.defineProperty(SourceMapConsumer$1.prototype, "_originalMappings", {
1228
- configurable: true,
1229
- enumerable: true,
1230
- get: function() {
1231
- if (!this.__originalMappings) this._parseMappings(this._mappings, this.sourceRoot);
1232
- return this.__originalMappings;
1233
- }
1234
- });
1235
- SourceMapConsumer$1.prototype._charIsMappingSeparator = function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
1236
- var c = aStr.charAt(index);
1237
- return c === ";" || c === ",";
1238
- };
1239
- SourceMapConsumer$1.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
1240
- throw new Error("Subclasses must implement _parseMappings");
1241
- };
1242
- SourceMapConsumer$1.GENERATED_ORDER = 1;
1243
- SourceMapConsumer$1.ORIGINAL_ORDER = 2;
1244
- SourceMapConsumer$1.GREATEST_LOWER_BOUND = 1;
1245
- SourceMapConsumer$1.LEAST_UPPER_BOUND = 2;
1246
- SourceMapConsumer$1.prototype.eachMapping = function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
1247
- var context = aContext || null;
1248
- var order = aOrder || SourceMapConsumer$1.GENERATED_ORDER;
1249
- var mappings;
1250
- switch (order) {
1251
- case SourceMapConsumer$1.GENERATED_ORDER:
1252
- mappings = this._generatedMappings;
1253
- break;
1254
- case SourceMapConsumer$1.ORIGINAL_ORDER:
1255
- mappings = this._originalMappings;
1256
- break;
1257
- default:
1258
- throw new Error("Unknown order of iteration.");
1259
- }
1260
- var sourceRoot = this.sourceRoot;
1261
- var boundCallback = aCallback.bind(context);
1262
- var names = this._names;
1263
- var sources = this._sources;
1264
- var sourceMapURL = this._sourceMapURL;
1265
- for (var i = 0, n = mappings.length; i < n; i++) {
1266
- var mapping = mappings[i];
1267
- var source = mapping.source === null ? null : sources.at(mapping.source);
1268
- if (source !== null) source = util$1.computeSourceURL(sourceRoot, source, sourceMapURL);
1269
- boundCallback({
1270
- source,
1271
- generatedLine: mapping.generatedLine,
1272
- generatedColumn: mapping.generatedColumn,
1273
- originalLine: mapping.originalLine,
1274
- originalColumn: mapping.originalColumn,
1275
- name: mapping.name === null ? null : names.at(mapping.name)
1276
- });
1277
- }
1278
- };
1279
- SourceMapConsumer$1.prototype.allGeneratedPositionsFor = function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
1280
- var line = util$1.getArg(aArgs, "line");
1281
- var needle = {
1282
- source: util$1.getArg(aArgs, "source"),
1283
- originalLine: line,
1284
- originalColumn: util$1.getArg(aArgs, "column", 0)
1285
- };
1286
- needle.source = this._findSourceIndex(needle.source);
1287
- if (needle.source < 0) return [];
1288
- var mappings = [];
1289
- var index = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util$1.compareByOriginalPositions, binarySearch.LEAST_UPPER_BOUND);
1290
- if (index >= 0) {
1291
- var mapping = this._originalMappings[index];
1292
- if (aArgs.column === void 0) {
1293
- var originalLine = mapping.originalLine;
1294
- while (mapping && mapping.originalLine === originalLine) {
1295
- mappings.push({
1296
- line: util$1.getArg(mapping, "generatedLine", null),
1297
- column: util$1.getArg(mapping, "generatedColumn", null),
1298
- lastColumn: util$1.getArg(mapping, "lastGeneratedColumn", null)
1299
- });
1300
- mapping = this._originalMappings[++index];
1301
- }
1302
- } else {
1303
- var originalColumn = mapping.originalColumn;
1304
- while (mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn) {
1305
- mappings.push({
1306
- line: util$1.getArg(mapping, "generatedLine", null),
1307
- column: util$1.getArg(mapping, "generatedColumn", null),
1308
- lastColumn: util$1.getArg(mapping, "lastGeneratedColumn", null)
1309
- });
1310
- mapping = this._originalMappings[++index];
1311
- }
1312
- }
1313
- }
1314
- return mappings;
1315
- };
1316
- exports.SourceMapConsumer = SourceMapConsumer$1;
1317
- function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
1318
- var sourceMap = aSourceMap;
1319
- if (typeof aSourceMap === "string") sourceMap = util$1.parseSourceMapInput(aSourceMap);
1320
- var version2 = util$1.getArg(sourceMap, "version");
1321
- var sources = util$1.getArg(sourceMap, "sources");
1322
- var names = util$1.getArg(sourceMap, "names", []);
1323
- var sourceRoot = util$1.getArg(sourceMap, "sourceRoot", null);
1324
- var sourcesContent = util$1.getArg(sourceMap, "sourcesContent", null);
1325
- var mappings = util$1.getArg(sourceMap, "mappings");
1326
- var file = util$1.getArg(sourceMap, "file", null);
1327
- if (version2 != this._version) throw new Error("Unsupported version: " + version2);
1328
- if (sourceRoot) sourceRoot = util$1.normalize(sourceRoot);
1329
- sources = sources.map(String).map(util$1.normalize).map(function(source) {
1330
- return sourceRoot && util$1.isAbsolute(sourceRoot) && util$1.isAbsolute(source) ? util$1.relative(sourceRoot, source) : source;
1331
- });
1332
- this._names = ArraySet.fromArray(names.map(String), true);
1333
- this._sources = ArraySet.fromArray(sources, true);
1334
- this._absoluteSources = this._sources.toArray().map(function(s) {
1335
- return util$1.computeSourceURL(sourceRoot, s, aSourceMapURL);
1336
- });
1337
- this.sourceRoot = sourceRoot;
1338
- this.sourcesContent = sourcesContent;
1339
- this._mappings = mappings;
1340
- this._sourceMapURL = aSourceMapURL;
1341
- this.file = file;
1342
- }
1343
- BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer$1.prototype);
1344
- BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer$1;
1345
- BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
1346
- var relativeSource = aSource;
1347
- if (this.sourceRoot != null) relativeSource = util$1.relative(this.sourceRoot, relativeSource);
1348
- if (this._sources.has(relativeSource)) return this._sources.indexOf(relativeSource);
1349
- var i;
1350
- for (i = 0; i < this._absoluteSources.length; ++i) if (this._absoluteSources[i] == aSource) return i;
1351
- return -1;
1352
- };
1353
- BasicSourceMapConsumer.fromSourceMap = function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
1354
- var smc = Object.create(BasicSourceMapConsumer.prototype);
1355
- var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
1356
- var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
1357
- smc.sourceRoot = aSourceMap._sourceRoot;
1358
- smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), smc.sourceRoot);
1359
- smc.file = aSourceMap._file;
1360
- smc._sourceMapURL = aSourceMapURL;
1361
- smc._absoluteSources = smc._sources.toArray().map(function(s) {
1362
- return util$1.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
1363
- });
1364
- var generatedMappings = aSourceMap._mappings.toArray().slice();
1365
- var destGeneratedMappings = smc.__generatedMappings = [];
1366
- var destOriginalMappings = smc.__originalMappings = [];
1367
- for (var i = 0, length = generatedMappings.length; i < length; i++) {
1368
- var srcMapping = generatedMappings[i];
1369
- var destMapping = new Mapping();
1370
- destMapping.generatedLine = srcMapping.generatedLine;
1371
- destMapping.generatedColumn = srcMapping.generatedColumn;
1372
- if (srcMapping.source) {
1373
- destMapping.source = sources.indexOf(srcMapping.source);
1374
- destMapping.originalLine = srcMapping.originalLine;
1375
- destMapping.originalColumn = srcMapping.originalColumn;
1376
- if (srcMapping.name) destMapping.name = names.indexOf(srcMapping.name);
1377
- destOriginalMappings.push(destMapping);
1378
- }
1379
- destGeneratedMappings.push(destMapping);
1380
- }
1381
- quickSort(smc.__originalMappings, util$1.compareByOriginalPositions);
1382
- return smc;
1383
- };
1384
- BasicSourceMapConsumer.prototype._version = 3;
1385
- Object.defineProperty(BasicSourceMapConsumer.prototype, "sources", { get: function() {
1386
- return this._absoluteSources.slice();
1387
- } });
1388
- function Mapping() {
1389
- this.generatedLine = 0;
1390
- this.generatedColumn = 0;
1391
- this.source = null;
1392
- this.originalLine = null;
1393
- this.originalColumn = null;
1394
- this.name = null;
1395
- }
1396
- const compareGenerated = util$1.compareByGeneratedPositionsDeflatedNoLine;
1397
- function sortGenerated(array, start) {
1398
- let l = array.length;
1399
- let n = array.length - start;
1400
- if (n <= 1) return;
1401
- else if (n == 2) {
1402
- let a = array[start];
1403
- let b = array[start + 1];
1404
- if (compareGenerated(a, b) > 0) {
1405
- array[start] = b;
1406
- array[start + 1] = a;
1407
- }
1408
- } else if (n < 20) for (let i = start; i < l; i++) for (let j = i; j > start; j--) {
1409
- let a = array[j - 1];
1410
- let b = array[j];
1411
- if (compareGenerated(a, b) <= 0) break;
1412
- array[j - 1] = b;
1413
- array[j] = a;
1414
- }
1415
- else quickSort(array, compareGenerated, start);
1416
- }
1417
- BasicSourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
1418
- var generatedLine = 1;
1419
- var previousGeneratedColumn = 0;
1420
- var previousOriginalLine = 0;
1421
- var previousOriginalColumn = 0;
1422
- var previousSource = 0;
1423
- var previousName = 0;
1424
- var length = aStr.length;
1425
- var index = 0;
1426
- var temp = {};
1427
- var originalMappings = [];
1428
- var generatedMappings = [];
1429
- var mapping, segment, end, value;
1430
- let subarrayStart = 0;
1431
- while (index < length) if (aStr.charAt(index) === ";") {
1432
- generatedLine++;
1433
- index++;
1434
- previousGeneratedColumn = 0;
1435
- sortGenerated(generatedMappings, subarrayStart);
1436
- subarrayStart = generatedMappings.length;
1437
- } else if (aStr.charAt(index) === ",") index++;
1438
- else {
1439
- mapping = new Mapping();
1440
- mapping.generatedLine = generatedLine;
1441
- for (end = index; end < length; end++) if (this._charIsMappingSeparator(aStr, end)) break;
1442
- aStr.slice(index, end);
1443
- segment = [];
1444
- while (index < end) {
1445
- base64VLQ.decode(aStr, index, temp);
1446
- value = temp.value;
1447
- index = temp.rest;
1448
- segment.push(value);
1449
- }
1450
- if (segment.length === 2) throw new Error("Found a source, but no line and column");
1451
- if (segment.length === 3) throw new Error("Found a source and line, but no column");
1452
- mapping.generatedColumn = previousGeneratedColumn + segment[0];
1453
- previousGeneratedColumn = mapping.generatedColumn;
1454
- if (segment.length > 1) {
1455
- mapping.source = previousSource + segment[1];
1456
- previousSource += segment[1];
1457
- mapping.originalLine = previousOriginalLine + segment[2];
1458
- previousOriginalLine = mapping.originalLine;
1459
- mapping.originalLine += 1;
1460
- mapping.originalColumn = previousOriginalColumn + segment[3];
1461
- previousOriginalColumn = mapping.originalColumn;
1462
- if (segment.length > 4) {
1463
- mapping.name = previousName + segment[4];
1464
- previousName += segment[4];
1465
- }
1466
- }
1467
- generatedMappings.push(mapping);
1468
- if (typeof mapping.originalLine === "number") {
1469
- let currentSource = mapping.source;
1470
- while (originalMappings.length <= currentSource) originalMappings.push(null);
1471
- if (originalMappings[currentSource] === null) originalMappings[currentSource] = [];
1472
- originalMappings[currentSource].push(mapping);
1473
- }
1474
- }
1475
- sortGenerated(generatedMappings, subarrayStart);
1476
- this.__generatedMappings = generatedMappings;
1477
- for (var i = 0; i < originalMappings.length; i++) if (originalMappings[i] != null) quickSort(originalMappings[i], util$1.compareByOriginalPositionsNoSource);
1478
- this.__originalMappings = [].concat(...originalMappings);
1479
- };
1480
- BasicSourceMapConsumer.prototype._findMapping = function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, aColumnName, aComparator, aBias) {
1481
- if (aNeedle[aLineName] <= 0) throw new TypeError("Line must be greater than or equal to 1, got " + aNeedle[aLineName]);
1482
- if (aNeedle[aColumnName] < 0) throw new TypeError("Column must be greater than or equal to 0, got " + aNeedle[aColumnName]);
1483
- return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
1484
- };
1485
- BasicSourceMapConsumer.prototype.computeColumnSpans = function SourceMapConsumer_computeColumnSpans() {
1486
- for (var index = 0; index < this._generatedMappings.length; ++index) {
1487
- var mapping = this._generatedMappings[index];
1488
- if (index + 1 < this._generatedMappings.length) {
1489
- var nextMapping = this._generatedMappings[index + 1];
1490
- if (mapping.generatedLine === nextMapping.generatedLine) {
1491
- mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
1492
- continue;
1493
- }
1494
- }
1495
- mapping.lastGeneratedColumn = Infinity;
1496
- }
1497
- };
1498
- BasicSourceMapConsumer.prototype.originalPositionFor = function SourceMapConsumer_originalPositionFor(aArgs) {
1499
- var needle = {
1500
- generatedLine: util$1.getArg(aArgs, "line"),
1501
- generatedColumn: util$1.getArg(aArgs, "column")
1502
- };
1503
- var index = this._findMapping(needle, this._generatedMappings, "generatedLine", "generatedColumn", util$1.compareByGeneratedPositionsDeflated, util$1.getArg(aArgs, "bias", SourceMapConsumer$1.GREATEST_LOWER_BOUND));
1504
- if (index >= 0) {
1505
- var mapping = this._generatedMappings[index];
1506
- if (mapping.generatedLine === needle.generatedLine) {
1507
- var source = util$1.getArg(mapping, "source", null);
1508
- if (source !== null) {
1509
- source = this._sources.at(source);
1510
- source = util$1.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
1511
- }
1512
- var name = util$1.getArg(mapping, "name", null);
1513
- if (name !== null) name = this._names.at(name);
1514
- return {
1515
- source,
1516
- line: util$1.getArg(mapping, "originalLine", null),
1517
- column: util$1.getArg(mapping, "originalColumn", null),
1518
- name
1519
- };
1520
- }
1521
- }
1522
- return {
1523
- source: null,
1524
- line: null,
1525
- column: null,
1526
- name: null
1527
- };
1528
- };
1529
- BasicSourceMapConsumer.prototype.hasContentsOfAllSources = function BasicSourceMapConsumer_hasContentsOfAllSources() {
1530
- if (!this.sourcesContent) return false;
1531
- return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function(sc) {
1532
- return sc == null;
1533
- });
1534
- };
1535
- BasicSourceMapConsumer.prototype.sourceContentFor = function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
1536
- if (!this.sourcesContent) return null;
1537
- var index = this._findSourceIndex(aSource);
1538
- if (index >= 0) return this.sourcesContent[index];
1539
- var relativeSource = aSource;
1540
- if (this.sourceRoot != null) relativeSource = util$1.relative(this.sourceRoot, relativeSource);
1541
- var url;
1542
- if (this.sourceRoot != null && (url = util$1.urlParse(this.sourceRoot))) {
1543
- var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
1544
- if (url.scheme == "file" && this._sources.has(fileUriAbsPath)) return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
1545
- if ((!url.path || url.path == "/") && this._sources.has("/" + relativeSource)) return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
1546
- }
1547
- if (nullOnMissing) return null;
1548
- else throw new Error('"' + relativeSource + '" is not in the SourceMap.');
1549
- };
1550
- BasicSourceMapConsumer.prototype.generatedPositionFor = function SourceMapConsumer_generatedPositionFor(aArgs) {
1551
- var source = util$1.getArg(aArgs, "source");
1552
- source = this._findSourceIndex(source);
1553
- if (source < 0) return {
1554
- line: null,
1555
- column: null,
1556
- lastColumn: null
1557
- };
1558
- var needle = {
1559
- source,
1560
- originalLine: util$1.getArg(aArgs, "line"),
1561
- originalColumn: util$1.getArg(aArgs, "column")
1562
- };
1563
- var index = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util$1.compareByOriginalPositions, util$1.getArg(aArgs, "bias", SourceMapConsumer$1.GREATEST_LOWER_BOUND));
1564
- if (index >= 0) {
1565
- var mapping = this._originalMappings[index];
1566
- if (mapping.source === needle.source) return {
1567
- line: util$1.getArg(mapping, "generatedLine", null),
1568
- column: util$1.getArg(mapping, "generatedColumn", null),
1569
- lastColumn: util$1.getArg(mapping, "lastGeneratedColumn", null)
1570
- };
1571
- }
1572
- return {
1573
- line: null,
1574
- column: null,
1575
- lastColumn: null
1576
- };
1577
- };
1578
- exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
1579
- function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
1580
- var sourceMap = aSourceMap;
1581
- if (typeof aSourceMap === "string") sourceMap = util$1.parseSourceMapInput(aSourceMap);
1582
- var version2 = util$1.getArg(sourceMap, "version");
1583
- var sections = util$1.getArg(sourceMap, "sections");
1584
- if (version2 != this._version) throw new Error("Unsupported version: " + version2);
1585
- this._sources = new ArraySet();
1586
- this._names = new ArraySet();
1587
- var lastOffset = {
1588
- line: -1,
1589
- column: 0
1590
- };
1591
- this._sections = sections.map(function(s) {
1592
- if (s.url) throw new Error("Support for url field in sections not implemented.");
1593
- var offset = util$1.getArg(s, "offset");
1594
- var offsetLine = util$1.getArg(offset, "line");
1595
- var offsetColumn = util$1.getArg(offset, "column");
1596
- if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) throw new Error("Section offsets must be ordered and non-overlapping.");
1597
- lastOffset = offset;
1598
- return {
1599
- generatedOffset: {
1600
- generatedLine: offsetLine + 1,
1601
- generatedColumn: offsetColumn + 1
1602
- },
1603
- consumer: new SourceMapConsumer$1(util$1.getArg(s, "map"), aSourceMapURL)
1604
- };
1605
- });
1606
- }
1607
- IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer$1.prototype);
1608
- IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer$1;
1609
- IndexedSourceMapConsumer.prototype._version = 3;
1610
- Object.defineProperty(IndexedSourceMapConsumer.prototype, "sources", { get: function() {
1611
- var sources = [];
1612
- for (var i = 0; i < this._sections.length; i++) for (var j = 0; j < this._sections[i].consumer.sources.length; j++) sources.push(this._sections[i].consumer.sources[j]);
1613
- return sources;
1614
- } });
1615
- IndexedSourceMapConsumer.prototype.originalPositionFor = function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
1616
- var needle = {
1617
- generatedLine: util$1.getArg(aArgs, "line"),
1618
- generatedColumn: util$1.getArg(aArgs, "column")
1619
- };
1620
- var sectionIndex = binarySearch.search(needle, this._sections, function(needle$1, section$1) {
1621
- var cmp = needle$1.generatedLine - section$1.generatedOffset.generatedLine;
1622
- if (cmp) return cmp;
1623
- return needle$1.generatedColumn - section$1.generatedOffset.generatedColumn;
1624
- });
1625
- var section = this._sections[sectionIndex];
1626
- if (!section) return {
1627
- source: null,
1628
- line: null,
1629
- column: null,
1630
- name: null
1631
- };
1632
- return section.consumer.originalPositionFor({
1633
- line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),
1634
- column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
1635
- bias: aArgs.bias
1636
- });
1637
- };
1638
- IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = function IndexedSourceMapConsumer_hasContentsOfAllSources() {
1639
- return this._sections.every(function(s) {
1640
- return s.consumer.hasContentsOfAllSources();
1641
- });
1642
- };
1643
- IndexedSourceMapConsumer.prototype.sourceContentFor = function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
1644
- for (var i = 0; i < this._sections.length; i++) {
1645
- var section = this._sections[i];
1646
- var content = section.consumer.sourceContentFor(aSource, true);
1647
- if (content || content === "") return content;
1648
- }
1649
- if (nullOnMissing) return null;
1650
- else throw new Error('"' + aSource + '" is not in the SourceMap.');
1651
- };
1652
- IndexedSourceMapConsumer.prototype.generatedPositionFor = function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
1653
- for (var i = 0; i < this._sections.length; i++) {
1654
- var section = this._sections[i];
1655
- if (section.consumer._findSourceIndex(util$1.getArg(aArgs, "source")) === -1) continue;
1656
- var generatedPosition = section.consumer.generatedPositionFor(aArgs);
1657
- if (generatedPosition) {
1658
- var ret = {
1659
- line: generatedPosition.line + (section.generatedOffset.generatedLine - 1),
1660
- column: generatedPosition.column + (section.generatedOffset.generatedLine === generatedPosition.line ? section.generatedOffset.generatedColumn - 1 : 0)
1661
- };
1662
- return ret;
1663
- }
1664
- }
1665
- return {
1666
- line: null,
1667
- column: null
1668
- };
1669
- };
1670
- IndexedSourceMapConsumer.prototype._parseMappings = function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
1671
- this.__generatedMappings = [];
1672
- this.__originalMappings = [];
1673
- for (var i = 0; i < this._sections.length; i++) {
1674
- var section = this._sections[i];
1675
- var sectionMappings = section.consumer._generatedMappings;
1676
- for (var j = 0; j < sectionMappings.length; j++) {
1677
- var mapping = sectionMappings[j];
1678
- var source = section.consumer._sources.at(mapping.source);
1679
- if (source !== null) source = util$1.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
1680
- this._sources.add(source);
1681
- source = this._sources.indexOf(source);
1682
- var name = null;
1683
- if (mapping.name) {
1684
- name = section.consumer._names.at(mapping.name);
1685
- this._names.add(name);
1686
- name = this._names.indexOf(name);
1687
- }
1688
- var adjustedMapping = {
1689
- source,
1690
- generatedLine: mapping.generatedLine + (section.generatedOffset.generatedLine - 1),
1691
- generatedColumn: mapping.generatedColumn + (section.generatedOffset.generatedLine === mapping.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
1692
- originalLine: mapping.originalLine,
1693
- originalColumn: mapping.originalColumn,
1694
- name
1695
- };
1696
- this.__generatedMappings.push(adjustedMapping);
1697
- if (typeof adjustedMapping.originalLine === "number") this.__originalMappings.push(adjustedMapping);
1698
- }
1699
- }
1700
- quickSort(this.__generatedMappings, util$1.compareByGeneratedPositionsDeflated);
1701
- quickSort(this.__originalMappings, util$1.compareByOriginalPositions);
1702
- };
1703
- exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
1704
- } });
1705
- var require_source_node = __commonJS({ "../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-node.js"(exports) {
1706
- var SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
1707
- var util = require_util();
1708
- var REGEX_NEWLINE = /(\r?\n)/;
1709
- var NEWLINE_CODE = 10;
1710
- var isSourceNode = "$$$isSourceNode$$$";
1711
- function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
1712
- this.children = [];
1713
- this.sourceContents = {};
1714
- this.line = aLine == null ? null : aLine;
1715
- this.column = aColumn == null ? null : aColumn;
1716
- this.source = aSource == null ? null : aSource;
1717
- this.name = aName == null ? null : aName;
1718
- this[isSourceNode] = true;
1719
- if (aChunks != null) this.add(aChunks);
1720
- }
1721
- SourceNode.fromStringWithSourceMap = function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
1722
- var node = new SourceNode();
1723
- var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
1724
- var remainingLinesIndex = 0;
1725
- var shiftNextLine = function() {
1726
- var lineContents = getNextLine();
1727
- var newLine = getNextLine() || "";
1728
- return lineContents + newLine;
1729
- function getNextLine() {
1730
- return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : void 0;
1731
- }
1732
- };
1733
- var lastGeneratedLine = 1, lastGeneratedColumn = 0;
1734
- var lastMapping = null;
1735
- aSourceMapConsumer.eachMapping(function(mapping) {
1736
- if (lastMapping !== null) if (lastGeneratedLine < mapping.generatedLine) {
1737
- addMappingWithCode(lastMapping, shiftNextLine());
1738
- lastGeneratedLine++;
1739
- lastGeneratedColumn = 0;
1740
- } else {
1741
- var nextLine = remainingLines[remainingLinesIndex] || "";
1742
- var code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
1743
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
1744
- lastGeneratedColumn = mapping.generatedColumn;
1745
- addMappingWithCode(lastMapping, code);
1746
- lastMapping = mapping;
1747
- return;
1748
- }
1749
- while (lastGeneratedLine < mapping.generatedLine) {
1750
- node.add(shiftNextLine());
1751
- lastGeneratedLine++;
1752
- }
1753
- if (lastGeneratedColumn < mapping.generatedColumn) {
1754
- var nextLine = remainingLines[remainingLinesIndex] || "";
1755
- node.add(nextLine.substr(0, mapping.generatedColumn));
1756
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
1757
- lastGeneratedColumn = mapping.generatedColumn;
1758
- }
1759
- lastMapping = mapping;
1760
- }, this);
1761
- if (remainingLinesIndex < remainingLines.length) {
1762
- if (lastMapping) addMappingWithCode(lastMapping, shiftNextLine());
1763
- node.add(remainingLines.splice(remainingLinesIndex).join(""));
1764
- }
1765
- aSourceMapConsumer.sources.forEach(function(sourceFile) {
1766
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
1767
- if (content != null) {
1768
- if (aRelativePath != null) sourceFile = util.join(aRelativePath, sourceFile);
1769
- node.setSourceContent(sourceFile, content);
1770
- }
1771
- });
1772
- return node;
1773
- function addMappingWithCode(mapping, code) {
1774
- if (mapping === null || mapping.source === void 0) node.add(code);
1775
- else {
1776
- var source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source;
1777
- node.add(new SourceNode(mapping.originalLine, mapping.originalColumn, source, code, mapping.name));
1778
- }
1779
- }
1780
- };
1781
- SourceNode.prototype.add = function SourceNode_add(aChunk) {
1782
- if (Array.isArray(aChunk)) aChunk.forEach(function(chunk) {
1783
- this.add(chunk);
1784
- }, this);
1785
- else if (aChunk[isSourceNode] || typeof aChunk === "string") {
1786
- if (aChunk) this.children.push(aChunk);
1787
- } else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
1788
- return this;
1789
- };
1790
- SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
1791
- if (Array.isArray(aChunk)) for (var i = aChunk.length - 1; i >= 0; i--) this.prepend(aChunk[i]);
1792
- else if (aChunk[isSourceNode] || typeof aChunk === "string") this.children.unshift(aChunk);
1793
- else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
1794
- return this;
1795
- };
1796
- SourceNode.prototype.walk = function SourceNode_walk(aFn) {
1797
- var chunk;
1798
- for (var i = 0, len = this.children.length; i < len; i++) {
1799
- chunk = this.children[i];
1800
- if (chunk[isSourceNode]) chunk.walk(aFn);
1801
- else if (chunk !== "") aFn(chunk, {
1802
- source: this.source,
1803
- line: this.line,
1804
- column: this.column,
1805
- name: this.name
1806
- });
1807
- }
1808
- };
1809
- SourceNode.prototype.join = function SourceNode_join(aSep) {
1810
- var newChildren;
1811
- var i;
1812
- var len = this.children.length;
1813
- if (len > 0) {
1814
- newChildren = [];
1815
- for (i = 0; i < len - 1; i++) {
1816
- newChildren.push(this.children[i]);
1817
- newChildren.push(aSep);
1818
- }
1819
- newChildren.push(this.children[i]);
1820
- this.children = newChildren;
1821
- }
1822
- return this;
1823
- };
1824
- SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
1825
- var lastChild = this.children[this.children.length - 1];
1826
- if (lastChild[isSourceNode]) lastChild.replaceRight(aPattern, aReplacement);
1827
- else if (typeof lastChild === "string") this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
1828
- else this.children.push("".replace(aPattern, aReplacement));
1829
- return this;
1830
- };
1831
- SourceNode.prototype.setSourceContent = function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
1832
- this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
1833
- };
1834
- SourceNode.prototype.walkSourceContents = function SourceNode_walkSourceContents(aFn) {
1835
- for (var i = 0, len = this.children.length; i < len; i++) if (this.children[i][isSourceNode]) this.children[i].walkSourceContents(aFn);
1836
- var sources = Object.keys(this.sourceContents);
1837
- for (var i = 0, len = sources.length; i < len; i++) aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
1838
- };
1839
- SourceNode.prototype.toString = function SourceNode_toString() {
1840
- var str = "";
1841
- this.walk(function(chunk) {
1842
- str += chunk;
1843
- });
1844
- return str;
1845
- };
1846
- SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
1847
- var generated = {
1848
- code: "",
1849
- line: 1,
1850
- column: 0
1851
- };
1852
- var map = new SourceMapGenerator(aArgs);
1853
- var sourceMappingActive = false;
1854
- var lastOriginalSource = null;
1855
- var lastOriginalLine = null;
1856
- var lastOriginalColumn = null;
1857
- var lastOriginalName = null;
1858
- this.walk(function(chunk, original) {
1859
- generated.code += chunk;
1860
- if (original.source !== null && original.line !== null && original.column !== null) {
1861
- if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) map.addMapping({
1862
- source: original.source,
1863
- original: {
1864
- line: original.line,
1865
- column: original.column
1866
- },
1867
- generated: {
1868
- line: generated.line,
1869
- column: generated.column
1870
- },
1871
- name: original.name
1872
- });
1873
- lastOriginalSource = original.source;
1874
- lastOriginalLine = original.line;
1875
- lastOriginalColumn = original.column;
1876
- lastOriginalName = original.name;
1877
- sourceMappingActive = true;
1878
- } else if (sourceMappingActive) {
1879
- map.addMapping({ generated: {
1880
- line: generated.line,
1881
- column: generated.column
1882
- } });
1883
- lastOriginalSource = null;
1884
- sourceMappingActive = false;
1885
- }
1886
- for (var idx = 0, length = chunk.length; idx < length; idx++) if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
1887
- generated.line++;
1888
- generated.column = 0;
1889
- if (idx + 1 === length) {
1890
- lastOriginalSource = null;
1891
- sourceMappingActive = false;
1892
- } else if (sourceMappingActive) map.addMapping({
1893
- source: original.source,
1894
- original: {
1895
- line: original.line,
1896
- column: original.column
1897
- },
1898
- generated: {
1899
- line: generated.line,
1900
- column: generated.column
1901
- },
1902
- name: original.name
1903
- });
1904
- } else generated.column++;
1905
- });
1906
- this.walkSourceContents(function(sourceFile, sourceContent) {
1907
- map.setSourceContent(sourceFile, sourceContent);
1908
- });
1909
- return {
1910
- code: generated.code,
1911
- map
1912
- };
1913
- };
1914
- exports.SourceNode = SourceNode;
1915
- } });
1916
- var require_source_map = __commonJS({ "../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/source-map.js"(exports) {
1917
- exports.SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
1918
- exports.SourceMapConsumer = require_source_map_consumer().SourceMapConsumer;
1919
- exports.SourceNode = require_source_node().SourceNode;
1920
- } });
1921
- var import_source_map = __toESM(require_source_map());
1922
- var reentry = false;
1923
- var describeBuiltInComponentFrame = (name) => {
1924
- return `
1925
- in ${name}`;
1926
- };
1927
- var INLINE_SOURCEMAP_REGEX = /^data:application\/json[^,]+base64,/;
1928
- var SOURCEMAP_REGEX = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/;
1929
- var getSourceMap = async (url, content) => {
1930
- const lines = content.split("\n");
1931
- let sourceMapUrl;
1932
- for (let i = lines.length - 1; i >= 0 && !sourceMapUrl; i--) {
1933
- const result = lines[i].match(SOURCEMAP_REGEX);
1934
- if (result) sourceMapUrl = result[1];
1935
- }
1936
- if (!sourceMapUrl) return null;
1937
- if (!(INLINE_SOURCEMAP_REGEX.test(sourceMapUrl) || sourceMapUrl.startsWith("/"))) {
1938
- const parsedURL = url.split("/");
1939
- parsedURL[parsedURL.length - 1] = sourceMapUrl;
1940
- sourceMapUrl = parsedURL.join("/");
1941
- }
1942
- const response = await fetch(sourceMapUrl);
1943
- const rawSourceMap = await response.json();
1944
- return new import_source_map.SourceMapConsumer(rawSourceMap);
1945
- };
1946
- var parseStackFrame = async (frame, maxDepth) => {
1947
- const sources = parseStack(frame);
1948
- if (!sources.length) return [];
1949
- const pendingSources = sources.slice(0, maxDepth) ;
1950
- const results = await Promise.all(pendingSources.map(async ({ file: fileName, line: lineNumber, col: columnNumber = 0 }) => {
1951
- if (!fileName || !lineNumber) return null;
1952
- try {
1953
- const response = await fetch(fileName);
1954
- if (response.ok) {
1955
- const content = await response.text();
1956
- const sourcemap = await getSourceMap(fileName, content);
1957
- if (sourcemap) {
1958
- const result = sourcemap.originalPositionFor({
1959
- line: lineNumber,
1960
- column: columnNumber
1961
- });
1962
- return {
1963
- fileName: (sourcemap.file || result.source).replace(/^file:\/\//, ""),
1964
- lineNumber: result.line,
1965
- columnNumber: result.column
1966
- };
1967
- }
1968
- }
1969
- return {
1970
- fileName: fileName.replace(/^file:\/\//, ""),
1971
- lineNumber,
1972
- columnNumber
1973
- };
1974
- } catch {
1975
- return {
1976
- fileName: fileName.replace(/^file:\/\//, ""),
1977
- lineNumber,
1978
- columnNumber
1979
- };
1980
- }
1981
- }));
1982
- return results.filter((result) => result !== null);
1983
- };
1984
- var describeNativeComponentFrame = (fn, construct) => {
1985
- if (!fn || reentry) return "";
1986
- const previousPrepareStackTrace = Error.prepareStackTrace;
1987
- Error.prepareStackTrace = void 0;
1988
- reentry = true;
1989
- const previousDispatcher = getCurrentDispatcher();
1990
- setCurrentDispatcher(null);
1991
- const prevError = console.error;
1992
- const prevWarn = console.warn;
1993
- console.error = () => {
1994
- };
1995
- console.warn = () => {
1996
- };
1997
- try {
1998
- const RunInRootFrame = { DetermineComponentFrameRoot() {
1999
- let control;
2000
- try {
2001
- if (construct) {
2002
- const Fake = function() {
2003
- throw Error();
2004
- };
2005
- Object.defineProperty(Fake.prototype, "props", { set: function() {
2006
- throw Error();
2007
- } });
2008
- if (typeof Reflect === "object" && Reflect.construct) {
2009
- try {
2010
- Reflect.construct(Fake, []);
2011
- } catch (x) {
2012
- control = x;
2013
- }
2014
- Reflect.construct(fn, [], Fake);
2015
- } else {
2016
- try {
2017
- Fake.call();
2018
- } catch (x) {
2019
- control = x;
2020
- }
2021
- fn.call(Fake.prototype);
2022
- }
2023
- } else {
2024
- try {
2025
- throw Error();
2026
- } catch (x) {
2027
- control = x;
2028
- }
2029
- const maybePromise = fn();
2030
- if (maybePromise && typeof maybePromise.catch === "function") maybePromise.catch(() => {
2031
- });
2032
- }
2033
- } catch (sample) {
2034
- if (sample && control && typeof sample.stack === "string") return [sample.stack, control.stack];
2035
- }
2036
- return [null, null];
2037
- } };
2038
- RunInRootFrame.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
2039
- const namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, "name");
2040
- if (namePropDescriptor?.configurable) Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, "name", { value: "DetermineComponentFrameRoot" });
2041
- const [sampleStack, controlStack] = RunInRootFrame.DetermineComponentFrameRoot();
2042
- if (sampleStack && controlStack) {
2043
- const sampleLines = sampleStack.split("\n");
2044
- const controlLines = controlStack.split("\n");
2045
- let sampleIndex = 0;
2046
- let controlIndex = 0;
2047
- while (sampleIndex < sampleLines.length && !sampleLines[sampleIndex].includes("DetermineComponentFrameRoot")) sampleIndex++;
2048
- while (controlIndex < controlLines.length && !controlLines[controlIndex].includes("DetermineComponentFrameRoot")) controlIndex++;
2049
- if (sampleIndex === sampleLines.length || controlIndex === controlLines.length) {
2050
- sampleIndex = sampleLines.length - 1;
2051
- controlIndex = controlLines.length - 1;
2052
- while (sampleIndex >= 1 && controlIndex >= 0 && sampleLines[sampleIndex] !== controlLines[controlIndex]) controlIndex--;
2053
- }
2054
- for (; sampleIndex >= 1 && controlIndex >= 0; sampleIndex--, controlIndex--) if (sampleLines[sampleIndex] !== controlLines[controlIndex]) {
2055
- if (sampleIndex !== 1 || controlIndex !== 1) do {
2056
- sampleIndex--;
2057
- controlIndex--;
2058
- if (controlIndex < 0 || sampleLines[sampleIndex] !== controlLines[controlIndex]) {
2059
- let frame = `
2060
- ${sampleLines[sampleIndex].replace(" at new ", " at ")}`;
2061
- const displayName = getDisplayName(fn);
2062
- if (displayName && frame.includes("<anonymous>")) frame = frame.replace("<anonymous>", displayName);
2063
- return frame;
2064
- }
2065
- } while (sampleIndex >= 1 && controlIndex >= 0);
2066
- break;
2067
- }
2068
- }
2069
- } finally {
2070
- reentry = false;
2071
- Error.prepareStackTrace = previousPrepareStackTrace;
2072
- setCurrentDispatcher(previousDispatcher);
2073
- console.error = prevError;
2074
- console.warn = prevWarn;
2075
- }
2076
- const name = fn ? getDisplayName(fn) : "";
2077
- const syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
2078
- return syntheticFrame;
2079
- };
2080
- var getCurrentDispatcher = () => {
2081
- const rdtHook = getRDTHook();
2082
- for (const renderer of [...Array.from(_renderers), ...Array.from(rdtHook.renderers.values())]) {
2083
- const currentDispatcherRef = renderer.currentDispatcherRef;
2084
- if (currentDispatcherRef && typeof currentDispatcherRef === "object") return "H" in currentDispatcherRef ? currentDispatcherRef.H : currentDispatcherRef.current;
2085
- }
2086
- return null;
2087
- };
2088
- var setCurrentDispatcher = (value) => {
2089
- for (const renderer of _renderers) {
2090
- const currentDispatcherRef = renderer.currentDispatcherRef;
2091
- if (currentDispatcherRef && typeof currentDispatcherRef === "object") if ("H" in currentDispatcherRef) currentDispatcherRef.H = value;
2092
- else currentDispatcherRef.current = value;
2093
- }
2094
- };
2095
- var describeFiber = (fiber, childFiber) => {
2096
- const tag = fiber.tag;
2097
- switch (tag) {
2098
- case HostHoistableTag:
2099
- case HostSingletonTag:
2100
- case HostComponentTag:
2101
- return describeBuiltInComponentFrame(fiber.type);
2102
- case LazyComponentTag:
2103
- return describeBuiltInComponentFrame("Lazy");
2104
- case SuspenseComponentTag:
2105
- if (fiber.child !== childFiber && childFiber !== null) return describeBuiltInComponentFrame("Suspense Fallback");
2106
- return describeBuiltInComponentFrame("Suspense");
2107
- case SuspenseListComponentTag:
2108
- return describeBuiltInComponentFrame("SuspenseList");
2109
- case FunctionComponentTag:
2110
- case SimpleMemoComponentTag:
2111
- return describeNativeComponentFrame(fiber.type, false);
2112
- case ForwardRefTag:
2113
- return describeNativeComponentFrame(fiber.type.render, false);
2114
- case ClassComponentTag:
2115
- return describeNativeComponentFrame(fiber.type, true);
2116
- case ActivityComponentTag:
2117
- return describeBuiltInComponentFrame("Activity");
2118
- case ViewTransitionComponentTag:
2119
- return describeBuiltInComponentFrame("ViewTransition");
2120
- default:
2121
- return "";
2122
- }
2123
- };
2124
- var describeDebugInfoFrame = (name, env, _debugLocation) => {
2125
- let result = `
2126
- in ${name}`;
2127
- if (env) result += ` (at ${env})`;
2128
- return result;
2129
- };
2130
- var getFiberStackTrace = (workInProgress) => {
2131
- try {
2132
- let info = "";
2133
- let node = workInProgress;
2134
- let previous = null;
2135
- do {
2136
- info += describeFiber(node, previous);
2137
- const debugInfo = node._debugInfo;
2138
- if (debugInfo && Array.isArray(debugInfo)) for (let i = debugInfo.length - 1; i >= 0; i--) {
2139
- const entry = debugInfo[i];
2140
- if (typeof entry.name === "string") info += describeDebugInfoFrame(entry.name, entry.env, entry.debugLocation);
2141
- }
2142
- previous = node;
2143
- node = node.return;
2144
- } while (node);
2145
- return info;
2146
- } catch (error) {
2147
- if (error instanceof Error) return `
2148
- Error generating stack: ${error.message}
2149
- ${error.stack}`;
2150
- return "";
2151
- }
2152
- };
2153
- var isCapitalized = (str) => {
2154
- if (!str.length) return false;
2155
- return str[0] === str[0].toUpperCase();
2156
- };
2157
- var getOwnerStack = async (stackTrace) => {
2158
- const componentPattern = /\n\s+(?:in|at)\s+([^\s(]+)(?:\s+\((?:at\s+)?([^)]+)\))?/g;
2159
- const matches = [];
2160
- let match;
2161
- match = componentPattern.exec(stackTrace);
2162
- while (match !== null) {
2163
- const name = match[1];
2164
- const locationStr = match[2];
2165
- if (!isCapitalized(name)) {
2166
- match = componentPattern.exec(stackTrace);
2167
- matches.push({
2168
- name,
2169
- source: void 0
2170
- });
2171
- continue;
2172
- }
2173
- let source;
2174
- if (locationStr && locationStr !== "Server") try {
2175
- const mockFrame = ` at ${name} (${locationStr})`;
2176
- const parsedSources = await parseStackFrame(mockFrame, 1);
2177
- if (parsedSources.length > 0) source = parsedSources[0];
2178
- } catch {
2179
- }
2180
- matches.push({
2181
- name,
2182
- source: source || void 0
2183
- });
2184
- match = componentPattern.exec(stackTrace);
2185
- }
2186
- return matches;
2187
- };
2188
-
2189
- // src/instrumentation.ts
2190
- var fiberRoots = _fiberRoots;
2191
- instrument({
2192
- onCommitFiberRoot(_, fiberRoot) {
2193
- fiberRoots.add(fiberRoot);
2194
- }
2195
- });
2196
- var getStack = async (element) => {
2197
- const fiber = getFiberFromHostInstance(element);
2198
- if (!fiber) return null;
2199
- const stackTrace = getFiberStackTrace(fiber);
2200
- const rawOwnerStack = await getOwnerStack(stackTrace);
2201
- const stack = rawOwnerStack.map((item) => ({
2202
- componentName: item.name,
2203
- fileName: item.source?.fileName
2204
- }));
2205
- return stack;
2206
- };
2207
- var filterStack = (stack) => {
2208
- return stack.filter(
2209
- (item) => item.fileName && !item.fileName.includes("node_modules") && item.componentName.length > 1 && !item.fileName.startsWith("_")
2210
- );
2211
- };
2212
- var findCommonRoot = (paths) => {
2213
- if (paths.length === 0) return "";
2214
- if (paths.length === 1) {
2215
- const lastSlash2 = paths[0].lastIndexOf("/");
2216
- return lastSlash2 > 0 ? paths[0].substring(0, lastSlash2 + 1) : "";
2217
- }
2218
- let commonPrefix = paths[0];
2219
- for (let i = 1; i < paths.length; i++) {
2220
- const path = paths[i];
2221
- let j = 0;
2222
- while (j < commonPrefix.length && j < path.length && commonPrefix[j] === path[j]) {
2223
- j++;
2224
- }
2225
- commonPrefix = commonPrefix.substring(0, j);
2226
- }
2227
- const lastSlash = commonPrefix.lastIndexOf("/");
2228
- return lastSlash > 0 ? commonPrefix.substring(0, lastSlash + 1) : "";
2229
- };
2230
- var serializeStack = (stack) => {
2231
- const filePaths = stack.map((item) => item.fileName).filter((path) => !!path);
2232
- const commonRoot = findCommonRoot(filePaths);
2233
- return stack.map((item) => {
2234
- let fileName = item.fileName;
2235
- if (fileName && commonRoot) {
2236
- fileName = fileName.startsWith(commonRoot) ? fileName.substring(commonRoot.length) : fileName;
2237
- }
2238
- return `${item.componentName}${fileName ? ` (${fileName})` : ""}`;
2239
- }).join("\n");
2240
- };
2241
- var getHTMLSnippet = (element) => {
2242
- const semanticTags = /* @__PURE__ */ new Set([
2243
- "article",
2244
- "aside",
2245
- "footer",
2246
- "form",
2247
- "header",
2248
- "main",
2249
- "nav",
2250
- "section"
2251
- ]);
2252
- const hasDistinguishingFeatures = (el) => {
2253
- const tagName = el.tagName.toLowerCase();
2254
- if (semanticTags.has(tagName)) return true;
2255
- if (el.id) return true;
2256
- if (el.className && typeof el.className === "string") {
2257
- const classes = el.className.trim();
2258
- if (classes && classes.length > 0) return true;
2259
- }
2260
- return Array.from(el.attributes).some(
2261
- (attr) => attr.name.startsWith("data-")
2262
- );
2263
- };
2264
- const getAncestorChain = (el, maxDepth = 10) => {
2265
- const ancestors2 = [];
2266
- let current = el.parentElement;
2267
- let depth = 0;
2268
- while (current && depth < maxDepth && current.tagName !== "BODY") {
2269
- if (hasDistinguishingFeatures(current)) {
2270
- ancestors2.push(current);
2271
- if (ancestors2.length >= 3) break;
2272
- }
2273
- current = current.parentElement;
2274
- depth++;
2275
- }
2276
- return ancestors2.reverse();
2277
- };
2278
- const getCSSPath = (el) => {
2279
- const parts = [];
2280
- let current = el;
2281
- let depth = 0;
2282
- const maxDepth = 5;
2283
- while (current && depth < maxDepth && current.tagName !== "BODY") {
2284
- let selector = current.tagName.toLowerCase();
2285
- if (current.id) {
2286
- selector += `#${current.id}`;
2287
- parts.unshift(selector);
2288
- break;
2289
- } else if (current.className && typeof current.className === "string" && current.className.trim()) {
2290
- const classes = current.className.trim().split(/\s+/).slice(0, 2);
2291
- selector += `.${classes.join(".")}`;
2292
- }
2293
- if (!current.id && (!current.className || !current.className.trim()) && current.parentElement) {
2294
- const siblings = Array.from(current.parentElement.children);
2295
- const index = siblings.indexOf(current);
2296
- if (index >= 0 && siblings.length > 1) {
2297
- selector += `:nth-child(${index + 1})`;
2298
- }
2299
- }
2300
- parts.unshift(selector);
2301
- current = current.parentElement;
2302
- depth++;
2303
- }
2304
- return parts.join(" > ");
2305
- };
2306
- const getElementTag = (el, compact = false) => {
2307
- const tagName = el.tagName.toLowerCase();
2308
- const attrs = [];
2309
- if (el.id) {
2310
- attrs.push(`id="${el.id}"`);
2311
- }
2312
- if (el.className && typeof el.className === "string") {
2313
- const classes = el.className.trim().split(/\s+/);
2314
- if (classes.length > 0 && classes[0]) {
2315
- const displayClasses = compact ? classes.slice(0, 3) : classes;
2316
- let classStr = displayClasses.join(" ");
2317
- if (classStr.length > 30) {
2318
- classStr = classStr.substring(0, 30) + "...";
2319
- }
2320
- attrs.push(`class="${classStr}"`);
2321
- }
2322
- }
2323
- const dataAttrs = Array.from(el.attributes).filter(
2324
- (attr) => attr.name.startsWith("data-")
2325
- );
2326
- const displayDataAttrs = compact ? dataAttrs.slice(0, 1) : dataAttrs;
2327
- for (const attr of displayDataAttrs) {
2328
- let value = attr.value;
2329
- if (value.length > 20) {
2330
- value = value.substring(0, 20) + "...";
2331
- }
2332
- attrs.push(`${attr.name}="${value}"`);
2333
- }
2334
- const ariaLabel = el.getAttribute("aria-label");
2335
- if (ariaLabel && !compact) {
2336
- let value = ariaLabel;
2337
- if (value.length > 20) {
2338
- value = value.substring(0, 20) + "...";
2339
- }
2340
- attrs.push(`aria-label="${value}"`);
2341
- }
2342
- return attrs.length > 0 ? `<${tagName} ${attrs.join(" ")}>` : `<${tagName}>`;
2343
- };
2344
- const getClosingTag = (el) => {
2345
- return `</${el.tagName.toLowerCase()}>`;
2346
- };
2347
- const getTextContent = (el) => {
2348
- let text = el.textContent || "";
2349
- text = text.trim().replace(/\s+/g, " ");
2350
- const maxLength = 60;
2351
- if (text.length > maxLength) {
2352
- text = text.substring(0, maxLength) + "...";
2353
- }
2354
- return text;
2355
- };
2356
- const getSiblingIdentifier = (el) => {
2357
- if (el.id) return `#${el.id}`;
2358
- if (el.className && typeof el.className === "string") {
2359
- const classes = el.className.trim().split(/\s+/);
2360
- if (classes.length > 0 && classes[0]) {
2361
- return `.${classes[0]}`;
2362
- }
2363
- }
2364
- return null;
2365
- };
2366
- const lines = [];
2367
- lines.push(`Path: ${getCSSPath(element)}`);
2368
- lines.push("");
2369
- const ancestors = getAncestorChain(element);
2370
- for (let i = 0; i < ancestors.length; i++) {
2371
- const indent2 = " ".repeat(i);
2372
- lines.push(indent2 + getElementTag(ancestors[i], true));
2373
- }
2374
- const parent = element.parentElement;
2375
- let targetIndex = -1;
2376
- if (parent) {
2377
- const siblings = Array.from(parent.children);
2378
- targetIndex = siblings.indexOf(element);
2379
- if (targetIndex > 0) {
2380
- const prevSibling = siblings[targetIndex - 1];
2381
- const prevId = getSiblingIdentifier(prevSibling);
2382
- if (prevId && targetIndex <= 2) {
2383
- const indent2 = " ".repeat(ancestors.length);
2384
- lines.push(`${indent2} ${getElementTag(prevSibling, true)}`);
2385
- lines.push(`${indent2} </${prevSibling.tagName.toLowerCase()}>`);
2386
- } else if (targetIndex > 0) {
2387
- const indent2 = " ".repeat(ancestors.length);
2388
- lines.push(
2389
- `${indent2} ... (${targetIndex} element${targetIndex === 1 ? "" : "s"})`
2390
- );
2391
- }
2392
- }
2393
- }
2394
- const indent = " ".repeat(ancestors.length);
2395
- lines.push(indent + " <!-- SELECTED -->");
2396
- const textContent = getTextContent(element);
2397
- const childrenCount = element.children.length;
2398
- if (textContent && childrenCount === 0 && textContent.length < 40) {
2399
- lines.push(
2400
- `${indent} ${getElementTag(element)}${textContent}${getClosingTag(
2401
- element
2402
- )}`
2403
- );
2404
- } else {
2405
- lines.push(indent + " " + getElementTag(element));
2406
- if (textContent) {
2407
- lines.push(`${indent} ${textContent}`);
2408
- }
2409
- if (childrenCount > 0) {
2410
- lines.push(
2411
- `${indent} ... (${childrenCount} element${childrenCount === 1 ? "" : "s"})`
2412
- );
2413
- }
2414
- lines.push(indent + " " + getClosingTag(element));
2415
- }
2416
- if (parent && targetIndex >= 0) {
2417
- const siblings = Array.from(parent.children);
2418
- const siblingsAfter = siblings.length - targetIndex - 1;
2419
- if (siblingsAfter > 0) {
2420
- const nextSibling = siblings[targetIndex + 1];
2421
- const nextId = getSiblingIdentifier(nextSibling);
2422
- if (nextId && siblingsAfter <= 2) {
2423
- lines.push(`${indent} ${getElementTag(nextSibling, true)}`);
2424
- lines.push(`${indent} </${nextSibling.tagName.toLowerCase()}>`);
2425
- } else {
2426
- lines.push(
2427
- `${indent} ... (${siblingsAfter} element${siblingsAfter === 1 ? "" : "s"})`
2428
- );
2429
- }
2430
- }
2431
- }
2432
- for (let i = ancestors.length - 1; i >= 0; i--) {
2433
- const indent2 = " ".repeat(i);
2434
- lines.push(indent2 + getClosingTag(ancestors[i]));
2435
- }
2436
- return lines.join("\n");
2437
- };
2438
-
2439
- // src/overlay.ts
2440
- var VIEWPORT_MARGIN_PX = 8;
2441
- var LABEL_OFFSET_PX = 6;
2442
- var INDICATOR_CLAMP_PADDING_PX = 4;
2443
- var INDICATOR_SUCCESS_VISIBLE_MS = 1500;
2444
- var INDICATOR_FADE_MS = 200;
2445
- var lerp = (start, end, factor) => {
2446
- return start + (end - start) * factor;
2447
- };
2448
- var SELECTION_LERP_FACTOR = 0.95;
2449
- var createSelectionElement = ({
2450
- borderRadius,
2451
- height,
2452
- transform,
2453
- width,
2454
- x,
2455
- y
2456
- }) => {
2457
- const overlay = document.createElement("div");
2458
- overlay.style.position = "fixed";
2459
- overlay.style.top = `${y}px`;
2460
- overlay.style.left = `${x}px`;
2461
- overlay.style.width = `${width}px`;
2462
- overlay.style.height = `${height}px`;
2463
- overlay.style.borderRadius = borderRadius;
2464
- overlay.style.transform = transform;
2465
- overlay.style.pointerEvents = "none";
2466
- overlay.style.border = "1px solid rgb(210, 57, 192)";
2467
- overlay.style.backgroundColor = "rgba(210, 57, 192, 0.2)";
2468
- overlay.style.zIndex = "2147483646";
2469
- overlay.style.boxSizing = "border-box";
2470
- overlay.style.display = "none";
2471
- return overlay;
2472
- };
2473
- var updateSelectionElement = (element, { borderRadius, height, transform, width, x, y }) => {
2474
- const currentTop = parseFloat(element.style.top) || 0;
2475
- const currentLeft = parseFloat(element.style.left) || 0;
2476
- const currentWidth = parseFloat(element.style.width) || 0;
2477
- const currentHeight = parseFloat(element.style.height) || 0;
2478
- const topValue = `${lerp(currentTop, y, SELECTION_LERP_FACTOR)}px`;
2479
- const leftValue = `${lerp(currentLeft, x, SELECTION_LERP_FACTOR)}px`;
2480
- const widthValue = `${lerp(currentWidth, width, SELECTION_LERP_FACTOR)}px`;
2481
- const heightValue = `${lerp(currentHeight, height, SELECTION_LERP_FACTOR)}px`;
2482
- if (element.style.top !== topValue) {
2483
- element.style.top = topValue;
2484
- }
2485
- if (element.style.left !== leftValue) {
2486
- element.style.left = leftValue;
2487
- }
2488
- if (element.style.width !== widthValue) {
2489
- element.style.width = widthValue;
2490
- }
2491
- if (element.style.height !== heightValue) {
2492
- element.style.height = heightValue;
2493
- }
2494
- if (element.style.borderRadius !== borderRadius) {
2495
- element.style.borderRadius = borderRadius;
2496
- }
2497
- if (element.style.transform !== transform) {
2498
- element.style.transform = transform;
2499
- }
2500
- };
2501
- var createSelectionOverlay = (root) => {
2502
- const element = createSelectionElement({
2503
- borderRadius: "0px",
2504
- height: 0,
2505
- transform: "none",
2506
- width: 0,
2507
- x: -1e3,
2508
- y: -1e3
2509
- });
2510
- root.appendChild(element);
2511
- let visible = false;
2512
- return {
2513
- hide: () => {
2514
- visible = false;
2515
- element.style.display = "none";
2516
- element.style.pointerEvents = "none";
2517
- },
2518
- isVisible: () => visible,
2519
- show: () => {
2520
- visible = true;
2521
- element.style.display = "block";
2522
- element.style.pointerEvents = "auto";
2523
- },
2524
- update: (selection) => {
2525
- updateSelectionElement(element, selection);
2526
- }
2527
- };
2528
- };
2529
- var createGrabbedOverlay = (root, selection) => {
2530
- const element = document.createElement("div");
2531
- element.style.position = "fixed";
2532
- element.style.top = `${selection.y}px`;
2533
- element.style.left = `${selection.x}px`;
2534
- element.style.width = `${selection.width}px`;
2535
- element.style.height = `${selection.height}px`;
2536
- element.style.borderRadius = selection.borderRadius;
2537
- element.style.transform = selection.transform;
2538
- element.style.pointerEvents = "none";
2539
- element.style.border = "1px solid rgb(210, 57, 192)";
2540
- element.style.backgroundColor = "rgba(210, 57, 192, 0.2)";
2541
- element.style.zIndex = "2147483646";
2542
- element.style.boxSizing = "border-box";
2543
- element.style.transition = "opacity 0.3s ease-out";
2544
- element.style.opacity = "1";
2545
- root.appendChild(element);
2546
- requestAnimationFrame(() => {
2547
- element.style.opacity = "0";
2548
- });
2549
- setTimeout(() => {
2550
- element.remove();
2551
- }, 300);
2552
- };
2553
- var createSpinner = () => {
2554
- const spinner = document.createElement("span");
2555
- spinner.style.display = "inline-block";
2556
- spinner.style.width = "8px";
2557
- spinner.style.height = "8px";
2558
- spinner.style.border = "1.5px solid rgb(210, 57, 192)";
2559
- spinner.style.borderTopColor = "transparent";
2560
- spinner.style.borderRadius = "50%";
2561
- spinner.style.marginRight = "4px";
2562
- spinner.style.verticalAlign = "middle";
2563
- spinner.animate(
2564
- [{ transform: "rotate(0deg)" }, { transform: "rotate(360deg)" }],
2565
- {
2566
- duration: 600,
2567
- easing: "linear",
2568
- iterations: Infinity
2569
- }
2570
- );
2571
- return spinner;
2572
- };
2573
- var activeIndicator = null;
2574
- var createIndicator = () => {
2575
- const indicator = document.createElement("div");
2576
- indicator.style.position = "fixed";
2577
- indicator.style.top = "calc(8px + env(safe-area-inset-top))";
2578
- indicator.style.padding = "2px 6px";
2579
- indicator.style.backgroundColor = "#fde7f7";
2580
- indicator.style.color = "#b21c8e";
2581
- indicator.style.border = "1px solid #f7c5ec";
2582
- indicator.style.borderRadius = "4px";
2583
- indicator.style.fontSize = "11px";
2584
- indicator.style.fontWeight = "500";
2585
- indicator.style.fontFamily = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif";
2586
- indicator.style.zIndex = "2147483647";
2587
- indicator.style.pointerEvents = "none";
2588
- indicator.style.opacity = "0";
2589
- indicator.style.transition = "opacity 0.2s ease-in-out";
2590
- indicator.style.display = "flex";
2591
- indicator.style.alignItems = "center";
2592
- indicator.style.maxWidth = "calc(100vw - (16px + env(safe-area-inset-left) + env(safe-area-inset-right)))";
2593
- indicator.style.overflow = "hidden";
2594
- indicator.style.textOverflow = "ellipsis";
2595
- indicator.style.whiteSpace = "nowrap";
2596
- return indicator;
2597
- };
2598
- var showLabel = (root, selectionLeftPx, selectionTopPx, tagName) => {
2599
- let indicator = activeIndicator;
2600
- let isNewIndicator = false;
2601
- if (!indicator) {
2602
- indicator = createIndicator();
2603
- root.appendChild(indicator);
2604
- activeIndicator = indicator;
2605
- isNewIndicator = true;
2606
- isProcessing = false;
2607
- }
2608
- if (!isProcessing) {
2609
- const labelText = indicator.querySelector("span");
2610
- if (labelText) {
2611
- const tagNameMonospace = document.createElement("span");
2612
- tagNameMonospace.textContent = tagName ? `<${tagName}>` : "<element>";
2613
- tagNameMonospace.style.fontFamily = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace";
2614
- tagNameMonospace.style.fontVariantNumeric = "tabular-nums";
2615
- labelText.replaceChildren(tagNameMonospace);
2616
- } else {
2617
- const newLabelText = document.createElement("span");
2618
- const tagNameMonospace = document.createElement("span");
2619
- tagNameMonospace.textContent = tagName ? `<${tagName}>` : "<element>";
2620
- tagNameMonospace.style.fontFamily = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace";
2621
- tagNameMonospace.style.fontVariantNumeric = "tabular-nums";
2622
- newLabelText.appendChild(tagNameMonospace);
2623
- indicator.appendChild(newLabelText);
2624
- }
2625
- }
2626
- const indicatorRect = indicator.getBoundingClientRect();
2627
- const viewportWidthPx = window.innerWidth;
2628
- const viewportHeightPx = window.innerHeight;
2629
- let indicatorLeftPx = Math.round(selectionLeftPx);
2630
- let indicatorTopPx = Math.round(selectionTopPx) - indicatorRect.height - LABEL_OFFSET_PX;
2631
- const CLAMPED_PADDING = INDICATOR_CLAMP_PADDING_PX;
2632
- const minLeft = VIEWPORT_MARGIN_PX;
2633
- const minTop = VIEWPORT_MARGIN_PX;
2634
- const maxLeft = viewportWidthPx - indicatorRect.width - VIEWPORT_MARGIN_PX;
2635
- const maxTop = viewportHeightPx - indicatorRect.height - VIEWPORT_MARGIN_PX;
2636
- const willClampLeft = indicatorLeftPx < minLeft;
2637
- const willClampTop = indicatorTopPx < minTop;
2638
- const isClamped = willClampLeft || willClampTop;
2639
- indicatorLeftPx = Math.max(minLeft, Math.min(indicatorLeftPx, maxLeft));
2640
- indicatorTopPx = Math.max(minTop, Math.min(indicatorTopPx, maxTop));
2641
- if (isClamped) {
2642
- indicatorLeftPx += CLAMPED_PADDING;
2643
- indicatorTopPx += CLAMPED_PADDING;
2644
- }
2645
- indicator.style.left = `${indicatorLeftPx}px`;
2646
- indicator.style.top = `${indicatorTopPx}px`;
2647
- indicator.style.right = "auto";
2648
- if (isNewIndicator) {
2649
- requestAnimationFrame(() => {
2650
- indicator.style.opacity = "1";
2651
- });
2652
- } else if (indicator.style.opacity !== "1") {
2653
- indicator.style.opacity = "1";
2654
- }
2655
- };
2656
- var isProcessing = false;
2657
- var activeGrabbedIndicators = /* @__PURE__ */ new Set();
2658
- var updateLabelToProcessing = (root, selectionLeftPx, selectionTopPx) => {
2659
- const indicator = createIndicator();
2660
- indicator.style.zIndex = "2147483648";
2661
- root.appendChild(indicator);
2662
- activeGrabbedIndicators.add(indicator);
2663
- const positionIndicator = () => {
2664
- if (selectionLeftPx === void 0 || selectionTopPx === void 0) return;
2665
- const indicatorRect = indicator.getBoundingClientRect();
2666
- const viewportWidthPx = window.innerWidth;
2667
- const viewportHeightPx = window.innerHeight;
2668
- let indicatorLeftPx = Math.round(selectionLeftPx);
2669
- let indicatorTopPx = Math.round(selectionTopPx) - indicatorRect.height - LABEL_OFFSET_PX;
2670
- const CLAMPED_PADDING = INDICATOR_CLAMP_PADDING_PX;
2671
- const minLeft = VIEWPORT_MARGIN_PX;
2672
- const minTop = VIEWPORT_MARGIN_PX;
2673
- const maxLeft = viewportWidthPx - indicatorRect.width - VIEWPORT_MARGIN_PX;
2674
- const maxTop = viewportHeightPx - indicatorRect.height - VIEWPORT_MARGIN_PX;
2675
- const willClampLeft = indicatorLeftPx < minLeft;
2676
- const willClampTop = indicatorTopPx < minTop;
2677
- const isClamped = willClampLeft || willClampTop;
2678
- indicatorLeftPx = Math.max(minLeft, Math.min(indicatorLeftPx, maxLeft));
2679
- indicatorTopPx = Math.max(minTop, Math.min(indicatorTopPx, maxTop));
2680
- if (isClamped) {
2681
- indicatorLeftPx += CLAMPED_PADDING;
2682
- indicatorTopPx += CLAMPED_PADDING;
2683
- }
2684
- indicator.style.left = `${indicatorLeftPx}px`;
2685
- indicator.style.top = `${indicatorTopPx}px`;
2686
- indicator.style.right = "auto";
2687
- };
2688
- const loadingSpinner = createSpinner();
2689
- const labelText = document.createElement("span");
2690
- labelText.textContent = "Grabbing\u2026";
2691
- indicator.appendChild(loadingSpinner);
2692
- indicator.appendChild(labelText);
2693
- positionIndicator();
2694
- requestAnimationFrame(() => {
2695
- indicator.style.opacity = "1";
2696
- });
2697
- return (tagName) => {
2698
- indicator.textContent = "";
2699
- const checkmarkIcon = document.createElement("span");
2700
- checkmarkIcon.textContent = "\u2713";
2701
- checkmarkIcon.style.display = "inline-block";
2702
- checkmarkIcon.style.marginRight = "4px";
2703
- checkmarkIcon.style.fontWeight = "600";
2704
- const newLabelText = document.createElement("span");
2705
- const tagNameMonospace = document.createElement("span");
2706
- tagNameMonospace.textContent = tagName ? `<${tagName}>` : "<element>";
2707
- tagNameMonospace.style.fontFamily = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace";
2708
- tagNameMonospace.style.fontVariantNumeric = "tabular-nums";
2709
- newLabelText.appendChild(document.createTextNode("Grabbed "));
2710
- newLabelText.appendChild(tagNameMonospace);
2711
- indicator.appendChild(checkmarkIcon);
2712
- indicator.appendChild(newLabelText);
2713
- requestAnimationFrame(() => {
2714
- positionIndicator();
2715
- });
2716
- setTimeout(() => {
2717
- indicator.style.opacity = "0";
2718
- setTimeout(() => {
2719
- indicator.remove();
2720
- activeGrabbedIndicators.delete(indicator);
2721
- }, INDICATOR_FADE_MS);
2722
- }, INDICATOR_SUCCESS_VISIBLE_MS);
2723
- };
2724
- };
2725
- var hideLabel = () => {
2726
- if (activeIndicator) {
2727
- activeIndicator.remove();
2728
- activeIndicator = null;
2729
- }
2730
- isProcessing = false;
2731
- };
2732
- var cleanupGrabbedIndicators = () => {
2733
- for (const indicator of activeGrabbedIndicators) {
2734
- indicator.remove();
2735
- }
2736
- activeGrabbedIndicators.clear();
2737
- };
2738
- var activeProgressIndicator = null;
2739
- var createProgressIndicatorElement = () => {
2740
- const container = document.createElement("div");
2741
- container.style.position = "fixed";
2742
- container.style.zIndex = "2147483647";
2743
- container.style.pointerEvents = "none";
2744
- container.style.opacity = "0";
2745
- container.style.transition = "opacity 0.1s ease-in-out";
2746
- const progressBarContainer = document.createElement("div");
2747
- progressBarContainer.style.width = "32px";
2748
- progressBarContainer.style.height = "2px";
2749
- progressBarContainer.style.backgroundColor = "rgba(178, 28, 142, 0.2)";
2750
- progressBarContainer.style.borderRadius = "1px";
2751
- progressBarContainer.style.overflow = "hidden";
2752
- progressBarContainer.style.position = "relative";
2753
- const progressBarFill = document.createElement("div");
2754
- progressBarFill.style.width = "0%";
2755
- progressBarFill.style.height = "100%";
2756
- progressBarFill.style.backgroundColor = "#b21c8e";
2757
- progressBarFill.style.borderRadius = "1px";
2758
- progressBarFill.style.transition = "width 0.05s linear";
2759
- progressBarFill.setAttribute("data-progress-fill", "true");
2760
- progressBarContainer.appendChild(progressBarFill);
2761
- container.appendChild(progressBarContainer);
2762
- return container;
2763
- };
2764
- var showProgressIndicator = (root, progress, mouseX, mouseY) => {
2765
- if (!activeProgressIndicator) {
2766
- activeProgressIndicator = createProgressIndicatorElement();
2767
- root.appendChild(activeProgressIndicator);
2768
- requestAnimationFrame(() => {
2769
- if (activeProgressIndicator) {
2770
- activeProgressIndicator.style.opacity = "1";
2771
- }
2772
- });
2773
- }
2774
- const indicator = activeProgressIndicator;
2775
- const indicatorRect = indicator.getBoundingClientRect();
2776
- const viewportWidth = window.innerWidth;
2777
- const viewportHeight = window.innerHeight;
2778
- const CURSOR_OFFSET = 14;
2779
- const VIEWPORT_MARGIN = 8;
2780
- let indicatorLeft = mouseX - indicatorRect.width / 2;
2781
- let indicatorTop = mouseY + CURSOR_OFFSET;
2782
- if (indicatorTop + indicatorRect.height + VIEWPORT_MARGIN > viewportHeight) {
2783
- indicatorTop = mouseY - indicatorRect.height - CURSOR_OFFSET;
2784
- }
2785
- indicatorTop = Math.max(
2786
- VIEWPORT_MARGIN,
2787
- Math.min(indicatorTop, viewportHeight - indicatorRect.height - VIEWPORT_MARGIN)
2788
- );
2789
- indicatorLeft = Math.max(
2790
- VIEWPORT_MARGIN,
2791
- Math.min(indicatorLeft, viewportWidth - indicatorRect.width - VIEWPORT_MARGIN)
2792
- );
2793
- indicator.style.top = `${indicatorTop}px`;
2794
- indicator.style.left = `${indicatorLeft}px`;
2795
- const progressFill = indicator.querySelector(
2796
- "[data-progress-fill]"
2797
- );
2798
- if (progressFill) {
2799
- const percentage = Math.min(100, Math.max(0, progress * 100));
2800
- progressFill.style.width = `${percentage}%`;
2801
- }
2802
- };
2803
- var hideProgressIndicator = () => {
2804
- if (activeProgressIndicator) {
2805
- activeProgressIndicator.style.opacity = "0";
2806
- setTimeout(() => {
2807
- if (activeProgressIndicator) {
2808
- activeProgressIndicator.remove();
2809
- activeProgressIndicator = null;
2810
- }
2811
- }, 100);
2812
- }
2813
- };
2814
-
2815
- // src/utils/copy-text.ts
2816
- var IS_NAVIGATOR_CLIPBOARD_AVAILABLE = typeof window !== "undefined" && window.navigator.clipboard && window.isSecureContext;
2817
- var copyTextToClipboard = async (text) => {
2818
- if (IS_NAVIGATOR_CLIPBOARD_AVAILABLE) {
2819
- try {
2820
- await navigator.clipboard.writeText(text);
2821
- return true;
2822
- } catch {
2823
- }
2824
- }
2825
- const textareaElement = document.createElement("textarea");
2826
- textareaElement.value = text;
2827
- textareaElement.setAttribute("readonly", "");
2828
- textareaElement.style.position = "fixed";
2829
- textareaElement.style.top = "-9999px";
2830
- textareaElement.style.opacity = "0";
2831
- textareaElement.style.pointerEvents = "none";
2832
- const doc = document.body || document.documentElement;
2833
- doc.appendChild(textareaElement);
2834
- textareaElement.select();
2835
- textareaElement.setSelectionRange(0, textareaElement.value.length);
2836
- let didCopyToClipboard = false;
2837
- try {
2838
- didCopyToClipboard = document.execCommand("copy");
2839
- } catch {
2840
- didCopyToClipboard = false;
2841
- } finally {
2842
- doc.removeChild(textareaElement);
2843
- }
2844
- return didCopyToClipboard;
2845
- };
2846
-
2847
- // src/utils/is-element-visible.ts
2848
- var isElementVisible = (element, computedStyle = window.getComputedStyle(element)) => {
2849
- return computedStyle.display !== "none" && computedStyle.visibility !== "hidden" && computedStyle.opacity !== "0";
2850
- };
2851
-
2852
- // src/utils/mount-root.ts
2853
- var ATTRIBUTE_NAME = "data-react-grab";
2854
- var mountRoot = () => {
2855
- const mountedHost = document.querySelector(`[${ATTRIBUTE_NAME}]`);
2856
- if (mountedHost) {
2857
- const mountedRoot = mountedHost.shadowRoot?.querySelector(
2858
- `[${ATTRIBUTE_NAME}]`
2859
- );
2860
- if (mountedRoot instanceof HTMLDivElement && mountedHost.shadowRoot) {
2861
- return mountedRoot;
2862
- }
2863
- }
2864
- const host = document.createElement("div");
2865
- host.setAttribute(ATTRIBUTE_NAME, "true");
2866
- host.style.zIndex = "2147483646";
2867
- host.style.position = "fixed";
2868
- host.style.top = "0";
2869
- host.style.left = "0";
2870
- const shadowRoot = host.attachShadow({ mode: "open" });
2871
- const root = document.createElement("div");
2872
- root.setAttribute(ATTRIBUTE_NAME, "true");
2873
- shadowRoot.appendChild(root);
2874
- const doc = document.body ?? document.documentElement;
2875
- doc.appendChild(host);
2876
- return root;
2877
- };
2878
-
2879
- // src/utils/store.ts
2880
- var createStore = (initializer) => {
2881
- const subscriberMap = /* @__PURE__ */ new Map();
2882
- let currentListenerIndex = 0;
2883
- let currentState;
2884
- const setState = (maybeStateOrReducer) => {
2885
- const prevState = currentState;
2886
- const resolvedState = typeof maybeStateOrReducer === "function" ? maybeStateOrReducer(prevState) : maybeStateOrReducer;
2887
- const nextState = {
2888
- ...prevState,
2889
- ...resolvedState
2890
- };
2891
- currentState = nextState;
2892
- for (const entry of subscriberMap.values()) {
2893
- if (entry.type === "selected" /* Selected */) {
2894
- const nextSelectedValue = entry.selector(nextState);
2895
- const prevSelectedValue = entry.prevSelectedValue;
2896
- if (!Object.is(prevSelectedValue, nextSelectedValue)) {
2897
- entry.prevSelectedValue = nextSelectedValue;
2898
- entry.listener(nextSelectedValue, prevSelectedValue);
2899
- }
2900
- } else {
2901
- entry.listener(nextState, prevState);
2902
- }
2903
- }
2904
- return currentState;
2905
- };
2906
- const getState = () => {
2907
- return currentState;
2908
- };
2909
- const initialState = initializer(setState, getState);
2910
- currentState = initialState;
2911
- const subscribeWithSelector = (listener, selector) => {
2912
- const index = String(currentListenerIndex++);
2913
- const wrappedListener = (value, prevValue) => listener(value, prevValue);
2914
- const entry = {
2915
- listener: wrappedListener,
2916
- prevSelectedValue: selector(currentState),
2917
- selector,
2918
- type: "selected" /* Selected */
2919
- };
2920
- subscriberMap.set(index, entry);
2921
- return () => {
2922
- subscriberMap.delete(index);
2923
- };
2924
- };
2925
- const subscribeToFullState = (listener) => {
2926
- const index = String(currentListenerIndex++);
2927
- const entry = {
2928
- listener,
2929
- type: "full" /* Full */
2930
- };
2931
- subscriberMap.set(index, entry);
2932
- return () => {
2933
- subscriberMap.delete(index);
2934
- };
2935
- };
2936
- function subscribe(subscriber, selector) {
2937
- return selector ? subscribeWithSelector(subscriber, selector) : subscribeToFullState(subscriber);
2938
- }
2939
- const store = {
2940
- getInitialState() {
2941
- return initialState;
2942
- },
2943
- getState,
2944
- setState,
2945
- subscribe
2946
- };
2947
- return store;
2948
- };
2949
-
2950
- // src/index.ts
2951
- var libStore = createStore(() => ({
2952
- keyPressTimestamps: /* @__PURE__ */ new Map(),
2953
- mouseX: -1e3,
2954
- mouseY: -1e3,
2955
- overlayMode: "hidden",
2956
- pressedKeys: /* @__PURE__ */ new Set()
2957
- }));
2958
- var init = (options = {}) => {
2959
- if (options.enabled === false) {
2960
- return;
2961
- }
2962
- const resolvedOptions = {
2963
- hotkey: ["Meta", "C"],
2964
- keyHoldDuration: 500,
2965
- ...options
2966
- };
2967
- const root = mountRoot();
2968
- const selectionOverlay = createSelectionOverlay(root);
2969
- let hoveredElement = null;
2970
- let lastGrabbedElement = null;
2971
- let isCopying = false;
2972
- let progressAnimationFrame = null;
2973
- let progressStartTime = null;
2974
- const checkIsActivationHotkeyPressed = () => {
2975
- if (Array.isArray(resolvedOptions.hotkey)) {
2976
- for (const key of resolvedOptions.hotkey) {
2977
- if (!isKeyPressed(key)) {
2978
- return false;
2979
- }
2980
- }
2981
- return true;
2982
- }
2983
- return isKeyPressed(resolvedOptions.hotkey);
2984
- };
2985
- const updateProgressIndicator = () => {
2986
- if (progressStartTime === null) return;
2987
- const elapsed = Date.now() - progressStartTime;
2988
- const progress = Math.min(1, elapsed / resolvedOptions.keyHoldDuration);
2989
- const { mouseX, mouseY } = libStore.getState();
2990
- showProgressIndicator(root, progress, mouseX, mouseY);
2991
- if (progress < 1) {
2992
- progressAnimationFrame = requestAnimationFrame(updateProgressIndicator);
2993
- }
2994
- };
2995
- const startProgressTracking = () => {
2996
- if (progressAnimationFrame !== null) return;
2997
- progressStartTime = Date.now();
2998
- const { mouseX, mouseY } = libStore.getState();
2999
- showProgressIndicator(root, 0, mouseX, mouseY);
3000
- progressAnimationFrame = requestAnimationFrame(updateProgressIndicator);
3001
- };
3002
- const stopProgressTracking = () => {
3003
- if (progressAnimationFrame !== null) {
3004
- cancelAnimationFrame(progressAnimationFrame);
3005
- progressAnimationFrame = null;
3006
- }
3007
- progressStartTime = null;
3008
- hideProgressIndicator();
3009
- };
3010
- let cleanupActivationHotkeyWatcher = null;
3011
- const handleKeyStateChange = (pressedKeys) => {
3012
- const { overlayMode } = libStore.getState();
3013
- if (pressedKeys.has("Escape") || pressedKeys.has("Esc")) {
3014
- libStore.setState((state) => {
3015
- const nextPressedKeys = new Set(state.pressedKeys);
3016
- nextPressedKeys.delete("Escape");
3017
- nextPressedKeys.delete("Esc");
3018
- const nextTimestamps = new Map(state.keyPressTimestamps);
3019
- nextTimestamps.delete("Escape");
3020
- nextTimestamps.delete("Esc");
3021
- const activationKeys = Array.isArray(resolvedOptions.hotkey) ? resolvedOptions.hotkey : [resolvedOptions.hotkey];
3022
- for (const activationKey of activationKeys) {
3023
- if (activationKey.length === 1) {
3024
- nextPressedKeys.delete(activationKey.toLowerCase());
3025
- nextPressedKeys.delete(activationKey.toUpperCase());
3026
- nextTimestamps.delete(activationKey.toLowerCase());
3027
- nextTimestamps.delete(activationKey.toUpperCase());
3028
- } else {
3029
- nextPressedKeys.delete(activationKey);
3030
- nextTimestamps.delete(activationKey);
3031
- }
3032
- }
3033
- return {
3034
- ...state,
3035
- keyPressTimestamps: nextTimestamps,
3036
- overlayMode: "hidden",
3037
- pressedKeys: nextPressedKeys
3038
- };
3039
- });
3040
- if (cleanupActivationHotkeyWatcher) {
3041
- cleanupActivationHotkeyWatcher();
3042
- cleanupActivationHotkeyWatcher = null;
3043
- }
3044
- stopProgressTracking();
3045
- return;
3046
- }
3047
- const isActivationHotkeyPressed = checkIsActivationHotkeyPressed();
3048
- if (!isActivationHotkeyPressed) {
3049
- if (cleanupActivationHotkeyWatcher) {
3050
- cleanupActivationHotkeyWatcher();
3051
- cleanupActivationHotkeyWatcher = null;
3052
- }
3053
- if (overlayMode !== "hidden") {
3054
- libStore.setState((state) => ({
3055
- ...state,
3056
- overlayMode: "hidden"
3057
- }));
3058
- }
3059
- stopProgressTracking();
3060
- return;
3061
- }
3062
- if (overlayMode === "hidden" && !cleanupActivationHotkeyWatcher) {
3063
- startProgressTracking();
3064
- cleanupActivationHotkeyWatcher = watchKeyHeldFor(
3065
- resolvedOptions.hotkey,
3066
- resolvedOptions.keyHoldDuration,
3067
- () => {
3068
- libStore.setState((state) => ({
3069
- ...state,
3070
- overlayMode: "visible"
3071
- }));
3072
- stopProgressTracking();
3073
- cleanupActivationHotkeyWatcher = null;
3074
- }
3075
- );
3076
- }
3077
- };
3078
- const cleanupKeyStateChangeSubscription = libStore.subscribe(
3079
- handleKeyStateChange,
3080
- (state) => state.pressedKeys
3081
- );
3082
- let mouseMoveScheduled = false;
3083
- let pendingMouseX = -1e3;
3084
- let pendingMouseY = -1e3;
3085
- const handleMouseMove = (event) => {
3086
- pendingMouseX = event.clientX;
3087
- pendingMouseY = event.clientY;
3088
- if (mouseMoveScheduled) return;
3089
- mouseMoveScheduled = true;
3090
- requestAnimationFrame(() => {
3091
- mouseMoveScheduled = false;
3092
- libStore.setState((state) => ({
3093
- ...state,
3094
- mouseX: pendingMouseX,
3095
- mouseY: pendingMouseY
3096
- }));
3097
- });
3098
- };
3099
- const handleMouseDown = (event) => {
3100
- if (event.button !== 0) {
3101
- return;
3102
- }
3103
- const { overlayMode } = libStore.getState();
3104
- if (overlayMode === "hidden") {
3105
- return;
3106
- }
3107
- event.preventDefault();
3108
- event.stopPropagation();
3109
- event.stopImmediatePropagation();
3110
- libStore.setState((state) => ({
3111
- ...state,
3112
- overlayMode: "copying"
3113
- }));
3114
- };
3115
- const handleVisibilityChange = () => {
3116
- if (document.hidden) {
3117
- cleanupGrabbedIndicators();
3118
- hideLabel();
3119
- }
3120
- };
3121
- window.addEventListener("mousemove", handleMouseMove);
3122
- window.addEventListener("mousedown", handleMouseDown);
3123
- document.addEventListener("visibilitychange", handleVisibilityChange);
3124
- const cleanupTrackHotkeys = trackHotkeys();
3125
- const getElementAtPosition = (x, y) => {
3126
- const elements = document.elementsFromPoint(x, y);
3127
- for (const element of elements) {
3128
- if (element.closest(`[${ATTRIBUTE_NAME}]`)) {
3129
- continue;
3130
- }
3131
- const computedStyle = window.getComputedStyle(element);
3132
- if (!isElementVisible(element, computedStyle)) {
3133
- continue;
3134
- }
3135
- return element;
3136
- }
3137
- return null;
3138
- };
3139
- const handleCopy = async (element) => {
3140
- const tagName = (element.tagName || "").toLowerCase();
3141
- const rect = element.getBoundingClientRect();
3142
- const cleanupIndicator = updateLabelToProcessing(root, rect.left, rect.top);
3143
- try {
3144
- const htmlSnippet = getHTMLSnippet(element);
3145
- await copyTextToClipboard(
3146
- `
1
+ var ReactGrab=(function(exports){'use strict';/**
2
+ * @license MIT
3
+ *
4
+ * Copyright (c) 2025 Aiden Bai
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ var ye={name:"cursor",open:t=>{if(!t)return;let e=new URL("cursor://anysphere.cursor-deeplink/prompt");e.searchParams.set("text",t),window.open(e.toString(),"_blank");}};var Nt=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"],Ft=t=>!!t.tagName&&!t.tagName.startsWith("-")&&t.tagName.includes("-"),kt=t=>Array.isArray(t),Pt=(t,e=false)=>{let{composed:n,target:r}=t,l,i;if(r instanceof HTMLElement&&Ft(r)&&n){let s=t.composedPath()[0];s instanceof HTMLElement&&(l=s.tagName,i=s.role);}else r instanceof HTMLElement&&(l=r.tagName,i=r.role);return kt(e)?!!(l&&e&&e.some(o=>typeof l=="string"&&o.toLowerCase()===l.toLowerCase()||o===i)):!!(l&&e&&e)},Dt=t=>Pt(t,Nt),ze=()=>{let t=l=>{Dt(l)||l.code!==void 0&&I.setState(i=>{let o=new Map(i.keyPressTimestamps);return i.pressedKeys.has(l.key)||o.set(l.key,Date.now()),{...i,keyPressTimestamps:o,pressedKeys:new Set([l.key,...i.pressedKeys])}});},e=l=>{l.code!==void 0&&I.setState(i=>{let o=new Map(i.keyPressTimestamps);return o.delete(l.key),{...i,keyPressTimestamps:o,pressedKeys:new Set([...i.pressedKeys].filter(s=>s!==l.key))}});},n=()=>{I.setState(l=>({...l,keyPressTimestamps:new Map,pressedKeys:new Set}));},r=()=>{I.setState(l=>({...l,keyPressTimestamps:new Map,pressedKeys:new Set}));};return document.addEventListener("keydown",t),document.addEventListener("keyup",e),window.addEventListener("blur",n),window.addEventListener("contextmenu",r),()=>{document.removeEventListener("keydown",t),document.removeEventListener("keyup",e),window.removeEventListener("blur",n),window.removeEventListener("contextmenu",r);}},ve=t=>{let{pressedKeys:e}=I.getState();return t.length===1?e.has(t.toLowerCase())||e.has(t.toUpperCase()):e.has(t)},Be=(t,e,n)=>{let r=null,l=null,i=Date.now(),o=()=>{r!==null&&(clearTimeout(r),r=null),l!==null&&(l(),l=null);},s=(y,g)=>y.length===1?g.has(y.toLowerCase())||g.has(y.toUpperCase()):g.has(y),u=y=>Array.isArray(t)?t.every(g=>s(g,y)):s(t,y),c=()=>{let y=I.getState(),{pressedKeys:g}=y;if(!u(g)){r!==null&&(clearTimeout(r),r=null);return}let p=Date.now()-i,a=e-p;if(a<=0){n(),o();return}r!==null&&clearTimeout(r),r=setTimeout(()=>{n(),o();},a);};return l=I.subscribe(()=>{c();},y=>y.pressedKeys),c(),o};var Ke="0.3.32",se=`bippy-${Ke}`,We=Object.defineProperty,Ht=Object.prototype.hasOwnProperty,Q=()=>{},Xe=t=>{try{Function.prototype.toString.call(t).indexOf("^_^")>-1&&setTimeout(()=>{throw new Error("React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build")});}catch{}},Ye=(t=B())=>"getFiberRoots"in t,Qe=false,qe,_e=(t=B())=>Qe?true:(typeof t.inject=="function"&&(qe=t.inject.toString()),!!qe?.includes("(injected)")),oe=new Set,q=new Set,Ze=t=>{let e=new Map,n=0,r={checkDCE:Xe,supportsFiber:true,supportsFlight:true,hasUnsupportedRendererAttached:false,renderers:e,onCommitFiberRoot:Q,onCommitFiberUnmount:Q,onPostCommitFiberRoot:Q,on:Q,inject(l){let i=++n;return e.set(i,l),q.add(l),r._instrumentationIsActive||(r._instrumentationIsActive=true,oe.forEach(o=>o())),i},_instrumentationSource:se,_instrumentationIsActive:false};try{We(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__",{get(){return r},set(o){if(o&&typeof o=="object"){let s=r.renderers;r=o,s.size>0&&(s.forEach((u,c)=>{q.add(u),o.renderers.set(c,u);}),ie(t));}},configurable:!0,enumerable:!0});let l=window.hasOwnProperty,i=!1;We(window,"hasOwnProperty",{value:function(){try{if(!i&&arguments[0]==="__REACT_DEVTOOLS_GLOBAL_HOOK__")return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,i=!0,-0}catch{}return l.apply(this,arguments)},configurable:!0,writable:!0});}catch{ie(t);}return r},ie=t=>{t&&oe.add(t);try{let e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!e)return;if(!e._instrumentationSource){if(e.checkDCE=Xe,e.supportsFiber=!0,e.supportsFlight=!0,e.hasUnsupportedRendererAttached=!1,e._instrumentationSource=se,e._instrumentationIsActive=!1,e.on=Q,e.renderers.size){e._instrumentationIsActive=!0,oe.forEach(r=>r());return}let n=e.inject;_e(e)&&!Ye()&&(Qe=!0,e.inject({scheduleRefresh(){}})&&(e._instrumentationIsActive=!0)),e.inject=r=>{let l=n(r);return q.add(r),e._instrumentationIsActive=!0,oe.forEach(i=>i()),l};}(e.renderers.size||e._instrumentationIsActive||_e())&&t?.();}catch{}},Je=()=>Ht.call(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__"),B=t=>Je()?(ie(t),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):Ze(t),et=()=>!!(typeof window<"u"&&(window.document?.createElement||window.navigator?.product==="ReactNative")),tt=()=>{try{et()&&B();}catch{}},ae=0,Z=1;var le=5;var ce=11,Se=13,nt=14,ue=15,Ce=16;var be=19;var de=26,fe=27,we=28,Ee=30;var Te=t=>{switch(t.tag){case le:case de:case fe:return true;default:return typeof t.type=="string"}},Le=t=>{switch(t.tag){case ae:case Z:case ue:case nt:case ce:return true;default:return false}};function Re(t,e,n=false){return t&&e(t)instanceof Promise?Ae(t,e,n):Me(t,e,n)}var Me=(t,e,n=false)=>{if(!t)return null;if(e(t)===true)return t;let r=n?t.return:t.child;for(;r;){let l=Me(r,e,n);if(l)return l;r=n?null:r.sibling;}return null},Ae=async(t,e,n=false)=>{if(!t)return null;if(await e(t)===true)return t;let r=n?t.return:t.child;for(;r;){let l=await Ae(r,e,n);if(l)return l;r=n?null:r.sibling;}return null};var K=t=>{let e=t;return typeof e=="function"?e:typeof e=="object"&&e?K(e.type||e.render):null},pe=t=>{let e=t;if(typeof e=="string")return e;if(typeof e!="function"&&!(typeof e=="object"&&e))return null;let n=e.displayName||e.name||null;if(n)return n;let r=K(e);return r&&(r.displayName||r.name)||null};var Oe=t=>B(()=>{let e=B();t.onActive?.(),e._instrumentationSource=t.name??se;let n=e.onCommitFiberRoot;t.onCommitFiberRoot&&(e.onCommitFiberRoot=(i,o,s)=>{n&&n(i,o,s),t.onCommitFiberRoot?.(i,o,s);});let r=e.onCommitFiberUnmount;t.onCommitFiberUnmount&&(e.onCommitFiberUnmount=(i,o)=>{r&&r(i,o),t.onCommitFiberUnmount?.(i,o);});let l=e.onPostCommitFiberRoot;t.onPostCommitFiberRoot&&(e.onPostCommitFiberRoot=(i,o)=>{l&&l(i,o),t.onPostCommitFiberRoot?.(i,o);});}),xe=t=>{let e=B();for(let n of e.renderers.values())try{let r=n.findFiberByHostInstance?.(t);if(r)return r}catch{}if(typeof t=="object"&&t!=null){if("_reactRootContainer"in t)return t._reactRootContainer?._internalRoot?.current?.child;for(let n in t)if(n.startsWith("__reactContainer$")||n.startsWith("__reactInternalInstance$")||n.startsWith("__reactFiber"))return t[n]||null}return null},Ie=new Set;tt();var qt=Object.create,rt=Object.defineProperty,Kt=Object.getOwnPropertyDescriptor,ot=Object.getOwnPropertyNames,Xt=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty,U=(t,e)=>function(){return e||(0, t[ot(t)[0]])((e={exports:{}}).exports,e),e.exports},Qt=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var l=ot(e),i=0,o=l.length,s;i<o;i++)s=l[i],!Yt.call(t,s)&&s!==n&&rt(t,s,{get:(u=>e[u]).bind(null,s),enumerable:!(r=Kt(e,s))||r.enumerable});return t},Zt=(t,e,n)=>(n=t!=null?qt(Xt(t)):{},Qt(rt(n,"default",{value:t,enumerable:true}),t)),it=/^\s*at .*(\S+:\d+|\(native\))/m,Jt=/^(eval@)?(\[native code\])?$/;function en(t,e){return t.match(it)?tn(t,e):nn(t,e)}function st(t){if(!t.includes(":"))return [t,void 0,void 0];let n=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));return [n[1],n[2]||void 0,n[3]||void 0]}function at(t,e){return e&&e.slice!=null?Array.isArray(e.slice)?t.slice(e.slice[0],e.slice[1]):t.slice(0,e.slice):t}function tn(t,e){return at(t.split(`
10
+ `).filter(r=>!!r.match(it)),e).map(r=>{r.includes("(eval ")&&(r=r.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));let l=r.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),i=l.match(/ (\(.+\)$)/);l=i?l.replace(i[0],""):l;let o=st(i?i[1]:l),s=i&&l||void 0,u=["eval","<anonymous>"].includes(o[0])?void 0:o[0];return {function:s,file:u,line:o[1]?+o[1]:void 0,col:o[2]?+o[2]:void 0,raw:r}})}function nn(t,e){return at(t.split(`
11
+ `).filter(r=>!r.match(Jt)),e).map(r=>{if(r.includes(" > eval")&&(r=r.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),!r.includes("@")&&!r.includes(":"))return {function:r};{let l=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,i=r.match(l),o=i&&i[1]?i[1]:void 0,s=st(r.replace(l,""));return {function:o,file:s[0],line:s[1]?+s[1]:void 0,col:s[2]?+s[2]:void 0,raw:r}}})}var rn=U({"../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/base64.js"(t){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");t.encode=function(n){if(0<=n&&n<e.length)return e[n];throw new TypeError("Must be between 0 and 63: "+n)},t.decode=function(n){var r=65,l=90,i=97,o=122,s=48,u=57,c=43,y=47,g=26,p=52;return r<=n&&n<=l?n-r:i<=n&&n<=o?n-i+g:s<=n&&n<=u?n-s+p:n==c?62:n==y?63:-1};}}),lt=U({"../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/base64-vlq.js"(t){var e=rn(),n=5,r=1<<n,l=r-1,i=r;function o(u){return u<0?(-u<<1)+1:(u<<1)+0}function s(u){var c=(u&1)===1,y=u>>1;return c?-y:y}t.encode=function(c){var y="",g,p=o(c);do g=p&l,p>>>=n,p>0&&(g|=i),y+=e.encode(g);while(p>0);return y},t.decode=function(c,y,g){var p=c.length,a=0,f=0,m,d;do{if(y>=p)throw new Error("Expected more digits in base 64 VLQ value.");if(d=e.decode(c.charCodeAt(y++)),d===-1)throw new Error("Invalid base64 digit: "+c.charAt(y-1));m=!!(d&i),d&=l,a=a+(d<<f),f+=n;}while(m);g.value=s(a),g.rest=y;};}}),ee=U({"../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/util.js"(t){function e(v,_,w){if(_ in v)return v[_];if(arguments.length===3)return w;throw new Error('"'+_+'" is a required argument.')}t.getArg=e;var n=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,r=/^data:.+\,.+$/;function l(v){var _=v.match(n);return _?{scheme:_[1],auth:_[2],host:_[3],port:_[4],path:_[5]}:null}t.urlParse=l;function i(v){var _="";return v.scheme&&(_+=v.scheme+":"),_+="//",v.auth&&(_+=v.auth+"@"),v.host&&(_+=v.host),v.port&&(_+=":"+v.port),v.path&&(_+=v.path),_}t.urlGenerate=i;var o=32;function s(v){var _=[];return function(w){for(var C=0;C<_.length;C++)if(_[C].input===w){var P=_[0];return _[0]=_[C],_[C]=P,_[0].result}var A=v(w);return _.unshift({input:w,result:A}),_.length>o&&_.pop(),A}}var u=s(function(_){var w=_,C=l(_);if(C){if(!C.path)return _;w=C.path;}for(var P=t.isAbsolute(w),A=[],k=0,O=0;;)if(k=O,O=w.indexOf("/",k),O===-1){A.push(w.slice(k));break}else for(A.push(w.slice(k,O));O<w.length&&w[O]==="/";)O++;for(var z,D=0,O=A.length-1;O>=0;O--)z=A[O],z==="."?A.splice(O,1):z===".."?D++:D>0&&(z===""?(A.splice(O+1,D),D=0):(A.splice(O,2),D--));return w=A.join("/"),w===""&&(w=P?"/":"."),C?(C.path=w,i(C)):w});t.normalize=u;function c(v,_){v===""&&(v="."),_===""&&(_=".");var w=l(_),C=l(v);if(C&&(v=C.path||"/"),w&&!w.scheme)return C&&(w.scheme=C.scheme),i(w);if(w||_.match(r))return _;if(C&&!C.host&&!C.path)return C.host=_,i(C);var P=_.charAt(0)==="/"?_:u(v.replace(/\/+$/,"")+"/"+_);return C?(C.path=P,i(C)):P}t.join=c,t.isAbsolute=function(v){return v.charAt(0)==="/"||n.test(v)};function y(v,_){v===""&&(v="."),v=v.replace(/\/$/,"");for(var w=0;_.indexOf(v+"/")!==0;){var C=v.lastIndexOf("/");if(C<0||(v=v.slice(0,C),v.match(/^([^\/]+:\/)?\/*$/)))return _;++w;}return Array(w+1).join("../")+_.substr(v.length+1)}t.relative=y;var g=function(){var v=Object.create(null);return !("__proto__"in v)}();function p(v){return v}function a(v){return m(v)?"$"+v:v}t.toSetString=g?p:a;function f(v){return m(v)?v.slice(1):v}t.fromSetString=g?p:f;function m(v){if(!v)return false;var _=v.length;if(_<9||v.charCodeAt(_-1)!==95||v.charCodeAt(_-2)!==95||v.charCodeAt(_-3)!==111||v.charCodeAt(_-4)!==116||v.charCodeAt(_-5)!==111||v.charCodeAt(_-6)!==114||v.charCodeAt(_-7)!==112||v.charCodeAt(_-8)!==95||v.charCodeAt(_-9)!==95)return false;for(var w=_-10;w>=0;w--)if(v.charCodeAt(w)!==36)return false;return true}function d(v,_,w){var C=E(v.source,_.source);return C!==0||(C=v.originalLine-_.originalLine,C!==0)||(C=v.originalColumn-_.originalColumn,C!==0||w)||(C=v.generatedColumn-_.generatedColumn,C!==0)||(C=v.generatedLine-_.generatedLine,C!==0)?C:E(v.name,_.name)}t.compareByOriginalPositions=d;function h(v,_,w){var C;return C=v.originalLine-_.originalLine,C!==0||(C=v.originalColumn-_.originalColumn,C!==0||w)||(C=v.generatedColumn-_.generatedColumn,C!==0)||(C=v.generatedLine-_.generatedLine,C!==0)?C:E(v.name,_.name)}t.compareByOriginalPositionsNoSource=h;function S(v,_,w){var C=v.generatedLine-_.generatedLine;return C!==0||(C=v.generatedColumn-_.generatedColumn,C!==0||w)||(C=E(v.source,_.source),C!==0)||(C=v.originalLine-_.originalLine,C!==0)||(C=v.originalColumn-_.originalColumn,C!==0)?C:E(v.name,_.name)}t.compareByGeneratedPositionsDeflated=S;function b(v,_,w){var C=v.generatedColumn-_.generatedColumn;return C!==0||w||(C=E(v.source,_.source),C!==0)||(C=v.originalLine-_.originalLine,C!==0)||(C=v.originalColumn-_.originalColumn,C!==0)?C:E(v.name,_.name)}t.compareByGeneratedPositionsDeflatedNoLine=b;function E(v,_){return v===_?0:v===null?1:_===null?-1:v>_?1:-1}function T(v,_){var w=v.generatedLine-_.generatedLine;return w!==0||(w=v.generatedColumn-_.generatedColumn,w!==0)||(w=E(v.source,_.source),w!==0)||(w=v.originalLine-_.originalLine,w!==0)||(w=v.originalColumn-_.originalColumn,w!==0)?w:E(v.name,_.name)}t.compareByGeneratedPositionsInflated=T;function L(v){return JSON.parse(v.replace(/^\)]}'[^\n]*\n/,""))}t.parseSourceMapInput=L;function R(v,_,w){if(_=_||"",v&&(v[v.length-1]!=="/"&&_[0]!=="/"&&(v+="/"),_=v+_),w){var C=l(w);if(!C)throw new Error("sourceMapURL could not be parsed");if(C.path){var P=C.path.lastIndexOf("/");P>=0&&(C.path=C.path.substring(0,P+1));}_=c(i(C),_);}return u(_)}t.computeSourceURL=R;}}),ct=U({"../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/array-set.js"(t){var e=ee(),n=Object.prototype.hasOwnProperty,r=typeof Map<"u";function l(){this._array=[],this._set=r?new Map:Object.create(null);}l.fromArray=function(o,s){for(var u=new l,c=0,y=o.length;c<y;c++)u.add(o[c],s);return u},l.prototype.size=function(){return r?this._set.size:Object.getOwnPropertyNames(this._set).length},l.prototype.add=function(o,s){var u=r?o:e.toSetString(o),c=r?this.has(o):n.call(this._set,u),y=this._array.length;(!c||s)&&this._array.push(o),c||(r?this._set.set(o,y):this._set[u]=y);},l.prototype.has=function(o){if(r)return this._set.has(o);var s=e.toSetString(o);return n.call(this._set,s)},l.prototype.indexOf=function(o){if(r){var s=this._set.get(o);if(s>=0)return s}else {var u=e.toSetString(o);if(n.call(this._set,u))return this._set[u]}throw new Error('"'+o+'" is not in the set.')},l.prototype.at=function(o){if(o>=0&&o<this._array.length)return this._array[o];throw new Error("No element indexed by "+o)},l.prototype.toArray=function(){return this._array.slice()},t.ArraySet=l;}}),on=U({"../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/mapping-list.js"(t){var e=ee();function n(l,i){var o=l.generatedLine,s=i.generatedLine,u=l.generatedColumn,c=i.generatedColumn;return s>o||s==o&&c>=u||e.compareByGeneratedPositionsInflated(l,i)<=0}function r(){this._array=[],this._sorted=true,this._last={generatedLine:-1,generatedColumn:0};}r.prototype.unsortedForEach=function(i,o){this._array.forEach(i,o);},r.prototype.add=function(i){n(this._last,i)?(this._last=i,this._array.push(i)):(this._sorted=false,this._array.push(i));},r.prototype.toArray=function(){return this._sorted||(this._array.sort(e.compareByGeneratedPositionsInflated),this._sorted=true),this._array},t.MappingList=r;}}),ut=U({"../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-map-generator.js"(t){var e=lt(),n=ee(),r=ct().ArraySet,l=on().MappingList;function i(o){o||(o={}),this._file=n.getArg(o,"file",null),this._sourceRoot=n.getArg(o,"sourceRoot",null),this._skipValidation=n.getArg(o,"skipValidation",false),this._ignoreInvalidMapping=n.getArg(o,"ignoreInvalidMapping",false),this._sources=new r,this._names=new r,this._mappings=new l,this._sourcesContents=null;}i.prototype._version=3,i.fromSourceMap=function(s,u){var c=s.sourceRoot,y=new i(Object.assign(u||{},{file:s.file,sourceRoot:c}));return s.eachMapping(function(g){var p={generated:{line:g.generatedLine,column:g.generatedColumn}};g.source!=null&&(p.source=g.source,c!=null&&(p.source=n.relative(c,p.source)),p.original={line:g.originalLine,column:g.originalColumn},g.name!=null&&(p.name=g.name)),y.addMapping(p);}),s.sources.forEach(function(g){var p=g;c!==null&&(p=n.relative(c,g)),y._sources.has(p)||y._sources.add(p);var a=s.sourceContentFor(g);a!=null&&y.setSourceContent(g,a);}),y},i.prototype.addMapping=function(s){var u=n.getArg(s,"generated"),c=n.getArg(s,"original",null),y=n.getArg(s,"source",null),g=n.getArg(s,"name",null);!this._skipValidation&&this._validateMapping(u,c,y,g)===false||(y!=null&&(y=String(y),this._sources.has(y)||this._sources.add(y)),g!=null&&(g=String(g),this._names.has(g)||this._names.add(g)),this._mappings.add({generatedLine:u.line,generatedColumn:u.column,originalLine:c!=null&&c.line,originalColumn:c!=null&&c.column,source:y,name:g}));},i.prototype.setSourceContent=function(s,u){var c=s;this._sourceRoot!=null&&(c=n.relative(this._sourceRoot,c)),u!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[n.toSetString(c)]=u):this._sourcesContents&&(delete this._sourcesContents[n.toSetString(c)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null));},i.prototype.applySourceMap=function(s,u,c){var y=u;if(u==null){if(s.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);y=s.file;}var g=this._sourceRoot;g!=null&&(y=n.relative(g,y));var p=new r,a=new r;this._mappings.unsortedForEach(function(f){if(f.source===y&&f.originalLine!=null){var m=s.originalPositionFor({line:f.originalLine,column:f.originalColumn});m.source!=null&&(f.source=m.source,c!=null&&(f.source=n.join(c,f.source)),g!=null&&(f.source=n.relative(g,f.source)),f.originalLine=m.line,f.originalColumn=m.column,m.name!=null&&(f.name=m.name));}var d=f.source;d!=null&&!p.has(d)&&p.add(d);var h=f.name;h!=null&&!a.has(h)&&a.add(h);},this),this._sources=p,this._names=a,s.sources.forEach(function(f){var m=s.sourceContentFor(f);m!=null&&(c!=null&&(f=n.join(c,f)),g!=null&&(f=n.relative(g,f)),this.setSourceContent(f,m));},this);},i.prototype._validateMapping=function(s,u,c,y){if(u&&typeof u.line!="number"&&typeof u.column!="number"){var g="original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(g),false;throw new Error(g)}if(!(s&&"line"in s&&"column"in s&&s.line>0&&s.column>=0&&!u&&!c&&!y)){if(s&&"line"in s&&"column"in s&&u&&"line"in u&&"column"in u&&s.line>0&&s.column>=0&&u.line>0&&u.column>=0&&c)return;var g="Invalid mapping: "+JSON.stringify({generated:s,source:c,original:u,name:y});if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(g),false;throw new Error(g)}},i.prototype._serializeMappings=function(){for(var s=0,u=1,c=0,y=0,g=0,p=0,a="",f,m,d,h,S=this._mappings.toArray(),b=0,E=S.length;b<E;b++){if(m=S[b],f="",m.generatedLine!==u)for(s=0;m.generatedLine!==u;)f+=";",u++;else if(b>0){if(!n.compareByGeneratedPositionsInflated(m,S[b-1]))continue;f+=",";}f+=e.encode(m.generatedColumn-s),s=m.generatedColumn,m.source!=null&&(h=this._sources.indexOf(m.source),f+=e.encode(h-p),p=h,f+=e.encode(m.originalLine-1-y),y=m.originalLine-1,f+=e.encode(m.originalColumn-c),c=m.originalColumn,m.name!=null&&(d=this._names.indexOf(m.name),f+=e.encode(d-g),g=d)),a+=f;}return a},i.prototype._generateSourcesContent=function(s,u){return s.map(function(c){if(!this._sourcesContents)return null;u!=null&&(c=n.relative(u,c));var y=n.toSetString(c);return Object.prototype.hasOwnProperty.call(this._sourcesContents,y)?this._sourcesContents[y]:null},this)},i.prototype.toJSON=function(){var s={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(s.file=this._file),this._sourceRoot!=null&&(s.sourceRoot=this._sourceRoot),this._sourcesContents&&(s.sourcesContent=this._generateSourcesContent(s.sources,s.sourceRoot)),s},i.prototype.toString=function(){return JSON.stringify(this.toJSON())},t.SourceMapGenerator=i;}}),sn=U({"../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/binary-search.js"(t){t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2;function e(n,r,l,i,o,s){var u=Math.floor((r-n)/2)+n,c=o(l,i[u],true);return c===0?u:c>0?r-u>1?e(u,r,l,i,o,s):s==t.LEAST_UPPER_BOUND?r<i.length?r:-1:u:u-n>1?e(n,u,l,i,o,s):s==t.LEAST_UPPER_BOUND?u:n<0?-1:n}t.search=function(r,l,i,o){if(l.length===0)return -1;var s=e(-1,l.length,r,l,i,o||t.GREATEST_LOWER_BOUND);if(s<0)return -1;for(;s-1>=0&&i(l[s],l[s-1],true)===0;)--s;return s};}}),an=U({"../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/quick-sort.js"(t){function e(l){function i(u,c,y){var g=u[c];u[c]=u[y],u[y]=g;}function o(u,c){return Math.round(u+Math.random()*(c-u))}function s(u,c,y,g){if(y<g){var p=o(y,g),a=y-1;i(u,p,g);for(var f=u[g],m=y;m<g;m++)c(u[m],f,false)<=0&&(a+=1,i(u,a,m));i(u,a+1,m);var d=a+1;s(u,c,y,d-1),s(u,c,d+1,g);}}return s}function n(l){let i=e.toString();return new Function(`return ${i}`)()(l)}let r=new WeakMap;t.quickSort=function(l,i,o=0){let s=r.get(i);s===void 0&&(s=n(i),r.set(i,s)),s(l,i,o,l.length-1);};}}),ln=U({"../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-map-consumer.js"(t){var e=ee(),n=sn(),r=ct().ArraySet,l=lt(),i=an().quickSort;function o(p,a){var f=p;return typeof p=="string"&&(f=e.parseSourceMapInput(p)),f.sections!=null?new g(f,a):new s(f,a)}o.fromSourceMap=function(p,a){return s.fromSourceMap(p,a)},o.prototype._version=3,o.prototype.__generatedMappings=null,Object.defineProperty(o.prototype,"_generatedMappings",{configurable:true,enumerable:true,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),o.prototype.__originalMappings=null,Object.defineProperty(o.prototype,"_originalMappings",{configurable:true,enumerable:true,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),o.prototype._charIsMappingSeparator=function(a,f){var m=a.charAt(f);return m===";"||m===","},o.prototype._parseMappings=function(a,f){throw new Error("Subclasses must implement _parseMappings")},o.GENERATED_ORDER=1,o.ORIGINAL_ORDER=2,o.GREATEST_LOWER_BOUND=1,o.LEAST_UPPER_BOUND=2,o.prototype.eachMapping=function(a,f,m){var d=f||null,h=m||o.GENERATED_ORDER,S;switch(h){case o.GENERATED_ORDER:S=this._generatedMappings;break;case o.ORIGINAL_ORDER:S=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}for(var b=this.sourceRoot,E=a.bind(d),T=this._names,L=this._sources,R=this._sourceMapURL,v=0,_=S.length;v<_;v++){var w=S[v],C=w.source===null?null:L.at(w.source);C!==null&&(C=e.computeSourceURL(b,C,R)),E({source:C,generatedLine:w.generatedLine,generatedColumn:w.generatedColumn,originalLine:w.originalLine,originalColumn:w.originalColumn,name:w.name===null?null:T.at(w.name)});}},o.prototype.allGeneratedPositionsFor=function(a){var f=e.getArg(a,"line"),m={source:e.getArg(a,"source"),originalLine:f,originalColumn:e.getArg(a,"column",0)};if(m.source=this._findSourceIndex(m.source),m.source<0)return [];var d=[],h=this._findMapping(m,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,n.LEAST_UPPER_BOUND);if(h>=0){var S=this._originalMappings[h];if(a.column===void 0)for(var b=S.originalLine;S&&S.originalLine===b;)d.push({line:e.getArg(S,"generatedLine",null),column:e.getArg(S,"generatedColumn",null),lastColumn:e.getArg(S,"lastGeneratedColumn",null)}),S=this._originalMappings[++h];else for(var E=S.originalColumn;S&&S.originalLine===f&&S.originalColumn==E;)d.push({line:e.getArg(S,"generatedLine",null),column:e.getArg(S,"generatedColumn",null),lastColumn:e.getArg(S,"lastGeneratedColumn",null)}),S=this._originalMappings[++h];}return d},t.SourceMapConsumer=o;function s(p,a){var f=p;typeof p=="string"&&(f=e.parseSourceMapInput(p));var m=e.getArg(f,"version"),d=e.getArg(f,"sources"),h=e.getArg(f,"names",[]),S=e.getArg(f,"sourceRoot",null),b=e.getArg(f,"sourcesContent",null),E=e.getArg(f,"mappings"),T=e.getArg(f,"file",null);if(m!=this._version)throw new Error("Unsupported version: "+m);S&&(S=e.normalize(S)),d=d.map(String).map(e.normalize).map(function(L){return S&&e.isAbsolute(S)&&e.isAbsolute(L)?e.relative(S,L):L}),this._names=r.fromArray(h.map(String),true),this._sources=r.fromArray(d,true),this._absoluteSources=this._sources.toArray().map(function(L){return e.computeSourceURL(S,L,a)}),this.sourceRoot=S,this.sourcesContent=b,this._mappings=E,this._sourceMapURL=a,this.file=T;}s.prototype=Object.create(o.prototype),s.prototype.consumer=o,s.prototype._findSourceIndex=function(p){var a=p;if(this.sourceRoot!=null&&(a=e.relative(this.sourceRoot,a)),this._sources.has(a))return this._sources.indexOf(a);var f;for(f=0;f<this._absoluteSources.length;++f)if(this._absoluteSources[f]==p)return f;return -1},s.fromSourceMap=function(a,f){var m=Object.create(s.prototype),d=m._names=r.fromArray(a._names.toArray(),true),h=m._sources=r.fromArray(a._sources.toArray(),true);m.sourceRoot=a._sourceRoot,m.sourcesContent=a._generateSourcesContent(m._sources.toArray(),m.sourceRoot),m.file=a._file,m._sourceMapURL=f,m._absoluteSources=m._sources.toArray().map(function(_){return e.computeSourceURL(m.sourceRoot,_,f)});for(var S=a._mappings.toArray().slice(),b=m.__generatedMappings=[],E=m.__originalMappings=[],T=0,L=S.length;T<L;T++){var R=S[T],v=new u;v.generatedLine=R.generatedLine,v.generatedColumn=R.generatedColumn,R.source&&(v.source=h.indexOf(R.source),v.originalLine=R.originalLine,v.originalColumn=R.originalColumn,R.name&&(v.name=d.indexOf(R.name)),E.push(v)),b.push(v);}return i(m.__originalMappings,e.compareByOriginalPositions),m},s.prototype._version=3,Object.defineProperty(s.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});function u(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null;}let c=e.compareByGeneratedPositionsDeflatedNoLine;function y(p,a){let f=p.length,m=p.length-a;if(!(m<=1))if(m==2){let d=p[a],h=p[a+1];c(d,h)>0&&(p[a]=h,p[a+1]=d);}else if(m<20)for(let d=a;d<f;d++)for(let h=d;h>a;h--){let S=p[h-1],b=p[h];if(c(S,b)<=0)break;p[h-1]=b,p[h]=S;}else i(p,c,a);}s.prototype._parseMappings=function(a,f){var m=1,d=0,h=0,S=0,b=0,E=0,T=a.length,L=0,v={},_=[],w=[],C,A,k,O;let z=0;for(;L<T;)if(a.charAt(L)===";")m++,L++,d=0,y(w,z),z=w.length;else if(a.charAt(L)===",")L++;else {for(C=new u,C.generatedLine=m,k=L;k<T&&!this._charIsMappingSeparator(a,k);k++);for(a.slice(L,k),A=[];L<k;)l.decode(a,L,v),O=v.value,L=v.rest,A.push(O);if(A.length===2)throw new Error("Found a source, but no line and column");if(A.length===3)throw new Error("Found a source and line, but no column");if(C.generatedColumn=d+A[0],d=C.generatedColumn,A.length>1&&(C.source=b+A[1],b+=A[1],C.originalLine=h+A[2],h=C.originalLine,C.originalLine+=1,C.originalColumn=S+A[3],S=C.originalColumn,A.length>4&&(C.name=E+A[4],E+=A[4])),w.push(C),typeof C.originalLine=="number"){let M=C.source;for(;_.length<=M;)_.push(null);_[M]===null&&(_[M]=[]),_[M].push(C);}}y(w,z),this.__generatedMappings=w;for(var D=0;D<_.length;D++)_[D]!=null&&i(_[D],e.compareByOriginalPositionsNoSource);this.__originalMappings=[].concat(..._);},s.prototype._findMapping=function(a,f,m,d,h,S){if(a[m]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+a[m]);if(a[d]<0)throw new TypeError("Column must be greater than or equal to 0, got "+a[d]);return n.search(a,f,h,S)},s.prototype.computeColumnSpans=function(){for(var a=0;a<this._generatedMappings.length;++a){var f=this._generatedMappings[a];if(a+1<this._generatedMappings.length){var m=this._generatedMappings[a+1];if(f.generatedLine===m.generatedLine){f.lastGeneratedColumn=m.generatedColumn-1;continue}}f.lastGeneratedColumn=1/0;}},s.prototype.originalPositionFor=function(a){var f={generatedLine:e.getArg(a,"line"),generatedColumn:e.getArg(a,"column")},m=this._findMapping(f,this._generatedMappings,"generatedLine","generatedColumn",e.compareByGeneratedPositionsDeflated,e.getArg(a,"bias",o.GREATEST_LOWER_BOUND));if(m>=0){var d=this._generatedMappings[m];if(d.generatedLine===f.generatedLine){var h=e.getArg(d,"source",null);h!==null&&(h=this._sources.at(h),h=e.computeSourceURL(this.sourceRoot,h,this._sourceMapURL));var S=e.getArg(d,"name",null);return S!==null&&(S=this._names.at(S)),{source:h,line:e.getArg(d,"originalLine",null),column:e.getArg(d,"originalColumn",null),name:S}}}return {source:null,line:null,column:null,name:null}},s.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(a){return a==null}):false},s.prototype.sourceContentFor=function(a,f){if(!this.sourcesContent)return null;var m=this._findSourceIndex(a);if(m>=0)return this.sourcesContent[m];var d=a;this.sourceRoot!=null&&(d=e.relative(this.sourceRoot,d));var h;if(this.sourceRoot!=null&&(h=e.urlParse(this.sourceRoot))){var S=d.replace(/^file:\/\//,"");if(h.scheme=="file"&&this._sources.has(S))return this.sourcesContent[this._sources.indexOf(S)];if((!h.path||h.path=="/")&&this._sources.has("/"+d))return this.sourcesContent[this._sources.indexOf("/"+d)]}if(f)return null;throw new Error('"'+d+'" is not in the SourceMap.')},s.prototype.generatedPositionFor=function(a){var f=e.getArg(a,"source");if(f=this._findSourceIndex(f),f<0)return {line:null,column:null,lastColumn:null};var m={source:f,originalLine:e.getArg(a,"line"),originalColumn:e.getArg(a,"column")},d=this._findMapping(m,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,e.getArg(a,"bias",o.GREATEST_LOWER_BOUND));if(d>=0){var h=this._originalMappings[d];if(h.source===m.source)return {line:e.getArg(h,"generatedLine",null),column:e.getArg(h,"generatedColumn",null),lastColumn:e.getArg(h,"lastGeneratedColumn",null)}}return {line:null,column:null,lastColumn:null}},t.BasicSourceMapConsumer=s;function g(p,a){var f=p;typeof p=="string"&&(f=e.parseSourceMapInput(p));var m=e.getArg(f,"version"),d=e.getArg(f,"sections");if(m!=this._version)throw new Error("Unsupported version: "+m);this._sources=new r,this._names=new r;var h={line:-1,column:0};this._sections=d.map(function(S){if(S.url)throw new Error("Support for url field in sections not implemented.");var b=e.getArg(S,"offset"),E=e.getArg(b,"line"),T=e.getArg(b,"column");if(E<h.line||E===h.line&&T<h.column)throw new Error("Section offsets must be ordered and non-overlapping.");return h=b,{generatedOffset:{generatedLine:E+1,generatedColumn:T+1},consumer:new o(e.getArg(S,"map"),a)}});}g.prototype=Object.create(o.prototype),g.prototype.constructor=o,g.prototype._version=3,Object.defineProperty(g.prototype,"sources",{get:function(){for(var p=[],a=0;a<this._sections.length;a++)for(var f=0;f<this._sections[a].consumer.sources.length;f++)p.push(this._sections[a].consumer.sources[f]);return p}}),g.prototype.originalPositionFor=function(a){var f={generatedLine:e.getArg(a,"line"),generatedColumn:e.getArg(a,"column")},m=n.search(f,this._sections,function(h,S){var b=h.generatedLine-S.generatedOffset.generatedLine;return b||h.generatedColumn-S.generatedOffset.generatedColumn}),d=this._sections[m];return d?d.consumer.originalPositionFor({line:f.generatedLine-(d.generatedOffset.generatedLine-1),column:f.generatedColumn-(d.generatedOffset.generatedLine===f.generatedLine?d.generatedOffset.generatedColumn-1:0),bias:a.bias}):{source:null,line:null,column:null,name:null}},g.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(a){return a.consumer.hasContentsOfAllSources()})},g.prototype.sourceContentFor=function(a,f){for(var m=0;m<this._sections.length;m++){var d=this._sections[m],h=d.consumer.sourceContentFor(a,true);if(h||h==="")return h}if(f)return null;throw new Error('"'+a+'" is not in the SourceMap.')},g.prototype.generatedPositionFor=function(a){for(var f=0;f<this._sections.length;f++){var m=this._sections[f];if(m.consumer._findSourceIndex(e.getArg(a,"source"))!==-1){var d=m.consumer.generatedPositionFor(a);if(d){var h={line:d.line+(m.generatedOffset.generatedLine-1),column:d.column+(m.generatedOffset.generatedLine===d.line?m.generatedOffset.generatedColumn-1:0)};return h}}}return {line:null,column:null}},g.prototype._parseMappings=function(a,f){this.__generatedMappings=[],this.__originalMappings=[];for(var m=0;m<this._sections.length;m++)for(var d=this._sections[m],h=d.consumer._generatedMappings,S=0;S<h.length;S++){var b=h[S],E=d.consumer._sources.at(b.source);E!==null&&(E=e.computeSourceURL(d.consumer.sourceRoot,E,this._sourceMapURL)),this._sources.add(E),E=this._sources.indexOf(E);var T=null;b.name&&(T=d.consumer._names.at(b.name),this._names.add(T),T=this._names.indexOf(T));var L={source:E,generatedLine:b.generatedLine+(d.generatedOffset.generatedLine-1),generatedColumn:b.generatedColumn+(d.generatedOffset.generatedLine===b.generatedLine?d.generatedOffset.generatedColumn-1:0),originalLine:b.originalLine,originalColumn:b.originalColumn,name:T};this.__generatedMappings.push(L),typeof L.originalLine=="number"&&this.__originalMappings.push(L);}i(this.__generatedMappings,e.compareByGeneratedPositionsDeflated),i(this.__originalMappings,e.compareByOriginalPositions);},t.IndexedSourceMapConsumer=g;}}),cn=U({"../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-node.js"(t){var e=ut().SourceMapGenerator,n=ee(),r=/(\r?\n)/,l=10,i="$$$isSourceNode$$$";function o(s,u,c,y,g){this.children=[],this.sourceContents={},this.line=s??null,this.column=u??null,this.source=c??null,this.name=g??null,this[i]=true,y!=null&&this.add(y);}o.fromStringWithSourceMap=function(u,c,y){var g=new o,p=u.split(r),a=0,f=function(){var b=T(),E=T()||"";return b+E;function T(){return a<p.length?p[a++]:void 0}},m=1,d=0,h=null;return c.eachMapping(function(b){if(h!==null)if(m<b.generatedLine)S(h,f()),m++,d=0;else {var E=p[a]||"",T=E.substr(0,b.generatedColumn-d);p[a]=E.substr(b.generatedColumn-d),d=b.generatedColumn,S(h,T),h=b;return}for(;m<b.generatedLine;)g.add(f()),m++;if(d<b.generatedColumn){var E=p[a]||"";g.add(E.substr(0,b.generatedColumn)),p[a]=E.substr(b.generatedColumn),d=b.generatedColumn;}h=b;},this),a<p.length&&(h&&S(h,f()),g.add(p.splice(a).join(""))),c.sources.forEach(function(b){var E=c.sourceContentFor(b);E!=null&&(y!=null&&(b=n.join(y,b)),g.setSourceContent(b,E));}),g;function S(b,E){if(b===null||b.source===void 0)g.add(E);else {var T=y?n.join(y,b.source):b.source;g.add(new o(b.originalLine,b.originalColumn,T,E,b.name));}}},o.prototype.add=function(u){if(Array.isArray(u))u.forEach(function(c){this.add(c);},this);else if(u[i]||typeof u=="string")u&&this.children.push(u);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+u);return this},o.prototype.prepend=function(u){if(Array.isArray(u))for(var c=u.length-1;c>=0;c--)this.prepend(u[c]);else if(u[i]||typeof u=="string")this.children.unshift(u);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+u);return this},o.prototype.walk=function(u){for(var c,y=0,g=this.children.length;y<g;y++)c=this.children[y],c[i]?c.walk(u):c!==""&&u(c,{source:this.source,line:this.line,column:this.column,name:this.name});},o.prototype.join=function(u){var c,y,g=this.children.length;if(g>0){for(c=[],y=0;y<g-1;y++)c.push(this.children[y]),c.push(u);c.push(this.children[y]),this.children=c;}return this},o.prototype.replaceRight=function(u,c){var y=this.children[this.children.length-1];return y[i]?y.replaceRight(u,c):typeof y=="string"?this.children[this.children.length-1]=y.replace(u,c):this.children.push("".replace(u,c)),this},o.prototype.setSourceContent=function(u,c){this.sourceContents[n.toSetString(u)]=c;},o.prototype.walkSourceContents=function(u){for(var c=0,y=this.children.length;c<y;c++)this.children[c][i]&&this.children[c].walkSourceContents(u);for(var g=Object.keys(this.sourceContents),c=0,y=g.length;c<y;c++)u(n.fromSetString(g[c]),this.sourceContents[g[c]]);},o.prototype.toString=function(){var u="";return this.walk(function(c){u+=c;}),u},o.prototype.toStringWithSourceMap=function(u){var c={code:"",line:1,column:0},y=new e(u),g=false,p=null,a=null,f=null,m=null;return this.walk(function(d,h){c.code+=d,h.source!==null&&h.line!==null&&h.column!==null?((p!==h.source||a!==h.line||f!==h.column||m!==h.name)&&y.addMapping({source:h.source,original:{line:h.line,column:h.column},generated:{line:c.line,column:c.column},name:h.name}),p=h.source,a=h.line,f=h.column,m=h.name,g=true):g&&(y.addMapping({generated:{line:c.line,column:c.column}}),p=null,g=false);for(var S=0,b=d.length;S<b;S++)d.charCodeAt(S)===l?(c.line++,c.column=0,S+1===b?(p=null,g=false):g&&y.addMapping({source:h.source,original:{line:h.line,column:h.column},generated:{line:c.line,column:c.column},name:h.name})):c.column++;}),this.walkSourceContents(function(d,h){y.setSourceContent(d,h);}),{code:c.code,map:y}},t.SourceNode=o;}}),un=U({"../../node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/source-map.js"(t){t.SourceMapGenerator=ut().SourceMapGenerator,t.SourceMapConsumer=ln().SourceMapConsumer,t.SourceNode=cn().SourceNode;}}),dn=Zt(un()),me=false,W=t=>`
12
+ in ${t}`,fn=/^data:application\/json[^,]+base64,/,pn=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/,dt=async(t,e)=>{let n=e.split(`
13
+ `),r;for(let s=n.length-1;s>=0&&!r;s--){let u=n[s].match(pn);u&&(r=u[1]||u[2]);}if(!r)return null;let l=/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(r);if(!(fn.test(r)||l||r.startsWith("/"))){let s=t.split("/");s[s.length-1]=r,r=s.join("/");}let o=await(await fetch(r)).json();return new dn.SourceMapConsumer(o)},Fe=async(t,e)=>{let n=en(t);if(!n.length)return [];let r=n.slice(0,e);return (await Promise.all(r.map(async({file:i,line:o,col:s=0})=>{if(!i||!o)return null;try{let u=await fetch(i);if(u.ok){let c=await u.text(),y=await dt(i,c);if(y){let g=y.originalPositionFor({line:o,column:s});return {fileName:((g&&typeof g.source=="string"?g.source:void 0)||void 0||i).replace(/^file:\/\//,""),lineNumber:g?.line??o,columnNumber:g?.column??s}}}return {fileName:i.replace(/^file:\/\//,""),lineNumber:o,columnNumber:s}}catch{return {fileName:i.replace(/^file:\/\//,""),lineNumber:o,columnNumber:s}}}))).filter(i=>i!==null)},J=(t,e)=>{if(!t||me)return "";let n=Error.prepareStackTrace;Error.prepareStackTrace=void 0,me=true;let r=ke();Ne(null);let l=console.error,i=console.warn;console.error=()=>{},console.warn=()=>{};try{let u={DetermineComponentFrameRoot(){let p;try{if(e){let a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[]);}catch(f){p=f;}Reflect.construct(t,[],a);}else {try{a.call();}catch(f){p=f;}t.call(a.prototype);}}else {try{throw Error()}catch(f){p=f;}let a=t();a&&typeof a.catch=="function"&&a.catch(()=>{});}}catch(a){if(a&&p&&typeof a.stack=="string")return [a.stack,p.stack]}return [null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot",Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name")?.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});let[y,g]=u.DetermineComponentFrameRoot();if(y&&g){let p=y.split(`
14
+ `),a=g.split(`
15
+ `),f=0,m=0;for(;f<p.length&&!p[f].includes("DetermineComponentFrameRoot");)f++;for(;m<a.length&&!a[m].includes("DetermineComponentFrameRoot");)m++;if(f===p.length||m===a.length)for(f=p.length-1,m=a.length-1;f>=1&&m>=0&&p[f]!==a[m];)m--;for(;f>=1&&m>=0;f--,m--)if(p[f]!==a[m]){if(f!==1||m!==1)do if(f--,m--,m<0||p[f]!==a[m]){let d=`
16
+ ${p[f].replace(" at new "," at ")}`,h=pe(t);return h&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",h)),d}while(f>=1&&m>=0);break}}}finally{me=false,Error.prepareStackTrace=n,Ne(r),console.error=l,console.warn=i;}let o=t?pe(t):"";return o?W(o):""},ke=()=>{let t=B();for(let e of [...Array.from(q),...Array.from(t.renderers.values())]){let n=e.currentDispatcherRef;if(n&&typeof n=="object")return "H"in n?n.H:n.current}return null},Ne=t=>{for(let e of q){let n=e.currentDispatcherRef;n&&typeof n=="object"&&("H"in n?n.H=t:n.current=t);}},ft=t=>{let e=Error.prepareStackTrace;Error.prepareStackTrace=void 0;let n=t.stack;if(!n)return "";Error.prepareStackTrace=e,n.startsWith(`Error: react-stack-top-frame
17
+ `)&&(n=n.slice(29));let r=n.indexOf(`
18
+ `);if(r!==-1&&(n=n.slice(r+1)),r=Math.max(n.indexOf("react_stack_bottom_frame"),n.indexOf("react-stack-bottom-frame")),r!==-1&&(r=n.lastIndexOf(`
19
+ `,r)),r!==-1)n=n.slice(0,r);else return "";return n},pt=t=>{let e=t._debugStack;if(e instanceof Error&&typeof e?.stack=="string"){let i=ft(e);if(i)return i}if(!ke())return null;let r=Te(t)?K(Re(t,i=>{if(Le(i))return true},true)?.type):K(t.type);return !r||me?null:J(r,t.tag===Z)},Pe=async t=>{let e=t._debugSource;if(e){let{fileName:n,lineNumber:r}=e;return {fileName:n,lineNumber:r,columnNumber:"columnNumber"in e&&typeof e.columnNumber=="number"?e.columnNumber:0}}try{let n=pt(t);if(n)return (await Fe(n,1))[0]||null}catch{}return null},mt=(t,e)=>{switch(t.tag){case de:case fe:case le:return W(t.type);case Ce:return W("Lazy");case Se:return t.child!==e&&e!==null?W("Suspense Fallback"):W("Suspense");case be:return W("SuspenseList");case ae:case ue:return J(t.type,false);case ce:return J(t.type.render,false);case Z:return J(t.type,true);case we:return W("Activity");case Ee:return W("ViewTransition");default:return ""}},ht=(t,e,n)=>{let r=`
20
+ in ${t}`;return e&&(r+=` (at ${e})`),r},De=t=>{try{let e="",n=t,r=null;do{e+=mt(n,r);let l=n._debugInfo;if(l&&Array.isArray(l))for(let i=l.length-1;i>=0;i--){let o=l[i];typeof o.name=="string"&&(e+=ht(o.name,o.env,o.debugLocation));}r=n,n=n.return;}while(n);return e}catch(e){return e instanceof Error?`
21
+ Error generating stack: ${e.message}
22
+ ${e.stack}`:""}},gt=t=>t.length?t[0]===t[0].toUpperCase():false,He=async t=>{let e=/\n\s+(?:in|at)\s+([^\s(]+)(?:\s+\((?:at\s+)?([^)]+)\))?/g,n=[],r;for(r=e.exec(t);r!==null;){let l=r[1],i=r[2];if(!gt(l)){r=e.exec(t),n.push({name:l,source:void 0});continue}let o;if(i&&i!=="Server")try{let s=` at ${l} (${i})`,u=await Fe(s,1);u.length>0&&(o=u[0]);}catch{}n.push({name:l,source:o||void 0}),r=e.exec(t);}return n};var mn=Ie;Oe({onCommitFiberRoot(t,e){mn.add(e);}});var yt=async t=>{let e=xe(t);if(!e)return null;let n=De(e),l=(await He(n)).map(i=>({componentName:i.name,fileName:i.source?.fileName}));if(l.length>0&&e){let i=await Pe(e);if(i){let o=e.type,s=o?.displayName??o?.name??l[0].componentName;l[0].displayName=s,l[0].source=`${i.fileName}:${i.lineNumber}:${i.columnNumber}`;}}return l},vt=t=>t.filter(e=>e.fileName&&!e.fileName.includes("node_modules")&&e.componentName.length>1&&!e.fileName.startsWith("_")),hn=t=>{if(t.length===0)return "";if(t.length===1){let r=t[0].lastIndexOf("/");return r>0?t[0].substring(0,r+1):""}let e=t[0];for(let r=1;r<t.length;r++){let l=t[r],i=0;for(;i<e.length&&i<l.length&&e[i]===l[i];)i++;e=e.substring(0,i);}let n=e.lastIndexOf("/");return n>0?e.substring(0,n+1):""},_t=t=>{let e=t.map(r=>r.fileName).filter(r=>!!r),n=hn(e);return t.map((r,l)=>{let i=r.fileName;i&&n&&(i=i.startsWith(n)?i.substring(n.length):i);let s=`${r.displayName||r.componentName}${i?` (${i})`:""}`;return l===0&&r.source&&(s+=`
23
+ ${r.source}`),s}).join(`
24
+ `)},St=t=>{let e=new Set(["article","aside","footer","form","header","main","nav","section"]),n=d=>{let h=d.tagName.toLowerCase();if(e.has(h)||d.id)return true;if(d.className&&typeof d.className=="string"){let S=d.className.trim();if(S&&S.length>0)return true}return Array.from(d.attributes).some(S=>S.name.startsWith("data-"))},r=(d,h=10)=>{let S=[],b=d.parentElement,E=0;for(;b&&E<h&&b.tagName!=="BODY"&&!(n(b)&&(S.push(b),S.length>=3));)b=b.parentElement,E++;return S.reverse()},l=d=>{let h=[],S=d,b=0,E=5;for(;S&&b<E&&S.tagName!=="BODY";){let T=S.tagName.toLowerCase();if(S.id){T+=`#${S.id}`,h.unshift(T);break}else if(S.className&&typeof S.className=="string"&&S.className.trim()){let L=S.className.trim().split(/\s+/).slice(0,2);T+=`.${L.join(".")}`;}if(!S.id&&(!S.className||!S.className.trim())&&S.parentElement){let L=Array.from(S.parentElement.children),R=L.indexOf(S);R>=0&&L.length>1&&(T+=`:nth-child(${R+1})`);}h.unshift(T),S=S.parentElement,b++;}return h.join(" > ")},i=(d,h=false)=>{let S=d.tagName.toLowerCase(),b=[];if(d.id&&b.push(`id="${d.id}"`),d.className&&typeof d.className=="string"){let R=d.className.trim().split(/\s+/);if(R.length>0&&R[0]){let _=(h?R.slice(0,3):R).join(" ");_.length>30&&(_=_.substring(0,30)+"..."),b.push(`class="${_}"`);}}let E=Array.from(d.attributes).filter(R=>R.name.startsWith("data-")),T=h?E.slice(0,1):E;for(let R of T){let v=R.value;v.length>20&&(v=v.substring(0,20)+"..."),b.push(`${R.name}="${v}"`);}let L=d.getAttribute("aria-label");if(L&&!h){let R=L;R.length>20&&(R=R.substring(0,20)+"..."),b.push(`aria-label="${R}"`);}return b.length>0?`<${S} ${b.join(" ")}>`:`<${S}>`},o=d=>`</${d.tagName.toLowerCase()}>`,s=d=>{let h=d.textContent||"";h=h.trim().replace(/\s+/g," ");let S=60;return h.length>S&&(h=h.substring(0,S)+"..."),h},u=d=>{if(d.id)return `#${d.id}`;if(d.className&&typeof d.className=="string"){let h=d.className.trim().split(/\s+/);if(h.length>0&&h[0])return `.${h[0]}`}return null},c=[];c.push(`Path: ${l(t)}`),c.push("");let y=r(t);for(let d=0;d<y.length;d++){let h=" ".repeat(d);c.push(h+i(y[d],true));}let g=t.parentElement,p=-1;if(g){let d=Array.from(g.children);if(p=d.indexOf(t),p>0){let h=d[p-1];if(u(h)&&p<=2){let b=" ".repeat(y.length);c.push(`${b} ${i(h,true)}`),c.push(`${b} </${h.tagName.toLowerCase()}>`);}else if(p>0){let b=" ".repeat(y.length);c.push(`${b} ... (${p} element${p===1?"":"s"})`);}}}let a=" ".repeat(y.length);c.push(a+" <!-- SELECTED -->");let f=s(t),m=t.children.length;if(f&&m===0&&f.length<40?c.push(`${a} ${i(t)}${f}${o(t)}`):(c.push(a+" "+i(t)),f&&c.push(`${a} ${f}`),m>0&&c.push(`${a} ... (${m} element${m===1?"":"s"})`),c.push(a+" "+o(t))),g&&p>=0){let d=Array.from(g.children),h=d.length-p-1;if(h>0){let S=d[p+1];u(S)&&h<=2?(c.push(`${a} ${i(S,true)}`),c.push(`${a} </${S.tagName.toLowerCase()}>`)):c.push(`${a} ... (${h} element${h===1?"":"s"})`);}}for(let d=y.length-1;d>=0;d--){let h=" ".repeat(d);c.push(h+o(y[d]));}return c.join(`
25
+ `)};var he=(t,e,n)=>t+(e-t)*n;var gn=({borderRadius:t,height:e,transform:n,width:r,x:l,y:i})=>{let o=document.createElement("div");return o.style.position="fixed",o.style.top=`${i}px`,o.style.left=`${l}px`,o.style.width=`${r}px`,o.style.height=`${e}px`,o.style.borderRadius=t,o.style.transform=n,o.style.pointerEvents="none",o.style.border="1px solid rgb(210, 57, 192)",o.style.backgroundColor="rgba(210, 57, 192, 0.2)",o.style.zIndex="2147483646",o.style.boxSizing="border-box",o.style.display="none",o},yn=(t,{borderRadius:e,height:n,transform:r,width:l,x:i,y:o})=>{let s=parseFloat(t.style.top)||0,u=parseFloat(t.style.left)||0,c=parseFloat(t.style.width)||0,y=parseFloat(t.style.height)||0,g=`${he(s,o,.95)}px`,p=`${he(u,i,.95)}px`,a=`${he(c,l,.95)}px`,f=`${he(y,n,.95)}px`;t.style.top!==g&&(t.style.top=g),t.style.left!==p&&(t.style.left=p),t.style.width!==a&&(t.style.width=a),t.style.height!==f&&(t.style.height=f),t.style.borderRadius!==e&&(t.style.borderRadius=e),t.style.transform!==r&&(t.style.transform=r);},Ct=t=>{let e=gn({borderRadius:"0px",height:0,transform:"none",width:0,x:-1e3,y:-1e3});t.appendChild(e);let n=false;return {hide:()=>{n=false,e.style.display="none";},isVisible:()=>n,show:()=>{n=true,e.style.display="block";},update:r=>{yn(e,r);}}},bt=(t,e)=>{let n=document.createElement("div");n.style.position="fixed",n.style.top=`${e.y}px`,n.style.left=`${e.x}px`,n.style.width=`${e.width}px`,n.style.height=`${e.height}px`,n.style.borderRadius=e.borderRadius,n.style.transform=e.transform,n.style.pointerEvents="none",n.style.border="1px solid rgb(210, 57, 192)",n.style.backgroundColor="rgba(210, 57, 192, 0.2)",n.style.zIndex="2147483646",n.style.boxSizing="border-box",n.style.transition="opacity 0.3s ease-out",n.style.opacity="1",t.appendChild(n),requestAnimationFrame(()=>{n.style.opacity="0";}),setTimeout(()=>{n.remove();},300);},vn=()=>{let t=document.createElement("span");return t.style.display="inline-block",t.style.width="8px",t.style.height="8px",t.style.border="1.5px solid rgb(210, 57, 192)",t.style.borderTopColor="transparent",t.style.borderRadius="50%",t.style.marginRight="4px",t.style.verticalAlign="middle",t.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:600,easing:"linear",iterations:1/0}),t},te=null,wt=()=>{let t=document.createElement("div");return t.style.position="fixed",t.style.top="calc(8px + env(safe-area-inset-top))",t.style.padding="2px 6px",t.style.backgroundColor="#fde7f7",t.style.color="#b21c8e",t.style.border="1px solid #f7c5ec",t.style.borderRadius="4px",t.style.fontSize="11px",t.style.fontWeight="500",t.style.fontFamily="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",t.style.zIndex="2147483647",t.style.pointerEvents="none",t.style.opacity="0",t.style.transition="opacity 0.2s ease-in-out",t.style.display="flex",t.style.alignItems="center",t.style.maxWidth="calc(100vw - (16px + env(safe-area-inset-left) + env(safe-area-inset-right)))",t.style.overflow="hidden",t.style.textOverflow="ellipsis",t.style.whiteSpace="nowrap",t},Et=(t,e,n,r)=>{let l=te,i=false;if(l||(l=wt(),t.appendChild(l),te=l,i=true,je=false),!je){let b=l.querySelector("span");if(b){let E=document.createElement("span");E.textContent=r?`<${r}>`:"<element>",E.style.fontFamily="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",E.style.fontVariantNumeric="tabular-nums",b.replaceChildren(E);}else {let E=document.createElement("span"),T=document.createElement("span");T.textContent=r?`<${r}>`:"<element>",T.style.fontFamily="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",T.style.fontVariantNumeric="tabular-nums",E.appendChild(T),l.appendChild(E);}}let o=l.getBoundingClientRect(),s=window.innerWidth,u=window.innerHeight,c=Math.round(e),y=Math.round(n)-o.height-6,g=4,p=8,a=8,f=s-o.width-8,m=u-o.height-8,d=c<p,h=y<a,S=d||h;c=Math.max(p,Math.min(c,f)),y=Math.max(a,Math.min(y,m)),S&&(c+=g,y+=g),l.style.left=`${c}px`,l.style.top=`${y}px`,l.style.right="auto",i?requestAnimationFrame(()=>{l.style.opacity="1";}):l.style.opacity!=="1"&&(l.style.opacity="1");},je=false,ge=new Set,Tt=(t,e,n)=>{let r=wt();r.style.zIndex="2147483648",t.appendChild(r),ge.add(r);let l=()=>{if(e===void 0||n===void 0)return;let s=r.getBoundingClientRect(),u=window.innerWidth,c=window.innerHeight,y=Math.round(e),g=Math.round(n)-s.height-6,p=4,a=8,f=8,m=u-s.width-8,d=c-s.height-8,h=y<a,S=g<f,b=h||S;y=Math.max(a,Math.min(y,m)),g=Math.max(f,Math.min(g,d)),b&&(y+=p,g+=p),r.style.left=`${y}px`,r.style.top=`${g}px`,r.style.right="auto";},i=vn(),o=document.createElement("span");return o.textContent="Grabbing\u2026",r.appendChild(i),r.appendChild(o),l(),requestAnimationFrame(()=>{r.style.opacity="1";}),s=>{r.textContent="";let u=document.createElement("span");u.textContent="\u2713",u.style.display="inline-block",u.style.marginRight="4px",u.style.fontWeight="600";let c=document.createElement("span"),y=document.createElement("span");y.textContent=s?`<${s}>`:"<element>",y.style.fontFamily="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",y.style.fontVariantNumeric="tabular-nums",c.appendChild(document.createTextNode("Grabbed ")),c.appendChild(y),r.appendChild(u),r.appendChild(c),requestAnimationFrame(()=>{l();}),setTimeout(()=>{r.style.opacity="0",setTimeout(()=>{r.remove(),ge.delete(r);},200);},1500);}},X=()=>{te&&(te.remove(),te=null),je=false;},$e=()=>{for(let t of ge)t.remove();ge.clear();},V=null,_n=()=>{let t=document.createElement("div");t.style.position="fixed",t.style.zIndex="2147483647",t.style.pointerEvents="none",t.style.opacity="0",t.style.transition="opacity 0.1s ease-in-out";let e=document.createElement("div");e.style.width="32px",e.style.height="2px",e.style.backgroundColor="rgba(178, 28, 142, 0.2)",e.style.borderRadius="1px",e.style.overflow="hidden",e.style.position="relative";let n=document.createElement("div");return n.style.width="0%",n.style.height="100%",n.style.backgroundColor="#b21c8e",n.style.borderRadius="1px",n.style.transition="width 0.05s linear",n.setAttribute("data-progress-fill","true"),e.appendChild(n),t.appendChild(e),t},Ge=(t,e,n,r)=>{V||(V=_n(),t.appendChild(V),requestAnimationFrame(()=>{V&&(V.style.opacity="1");}));let l=V,i=l.getBoundingClientRect(),o=window.innerWidth,s=window.innerHeight,u=14,c=8,y=n-i.width/2,g=r+u;g+i.height+c>s&&(g=r-i.height-u),g=Math.max(c,Math.min(g,s-i.height-c)),y=Math.max(c,Math.min(y,o-i.width-c)),l.style.top=`${g}px`,l.style.left=`${y}px`;let p=l.querySelector("[data-progress-fill]");if(p){let a=Math.min(100,Math.max(0,e*100));p.style.width=`${a}%`;}},Lt=()=>{V&&(V.style.opacity="0",setTimeout(()=>{V&&(V.remove(),V=null);},100));};var Sn=typeof window<"u"&&window.navigator.clipboard&&window.isSecureContext,Ue=async t=>{if(Sn)try{return await navigator.clipboard.writeText(t),!0}catch{}let e=document.createElement("textarea");e.value=t,e.setAttribute("readonly",""),e.style.position="fixed",e.style.top="-9999px",e.style.opacity="0",e.style.pointerEvents="none";let n=document.body||document.documentElement;n.appendChild(e),e.select(),e.setSelectionRange(0,e.value.length);let r=false;try{r=document.execCommand("copy");}catch{r=false;}finally{n.removeChild(e);}return r};var Rt=(t,e=window.getComputedStyle(t))=>e.display!=="none"&&e.visibility!=="hidden"&&e.opacity!=="0";var Y="data-react-grab",Mt=()=>{let t=document.querySelector(`[${Y}]`);if(t){let i=t.shadowRoot?.querySelector(`[${Y}]`);if(i instanceof HTMLDivElement&&t.shadowRoot)return i}let e=document.createElement("div");e.setAttribute(Y,"true"),e.style.zIndex="2147483646",e.style.position="fixed",e.style.top="0",e.style.left="0";let n=e.attachShadow({mode:"open"}),r=document.createElement("div");return r.setAttribute(Y,"true"),n.appendChild(r),(document.body??document.documentElement).appendChild(e),r};var At=t=>{let e=new Map,n=0,r,l=g=>{let p=r,a=typeof g=="function"?g(p):g,f={...p,...a};r=f;for(let m of e.values())if(m.type==="selected"){let d=m.selector(f),h=m.prevSelectedValue;Object.is(h,d)||(m.prevSelectedValue=d,m.listener(d,h));}else m.listener(f,p);return r},i=()=>r,o=t(l,i);r=o;let s=(g,p)=>{let a=String(n++),m={listener:(d,h)=>g(d,h),prevSelectedValue:p(r),selector:p,type:"selected"};return e.set(a,m),()=>{e.delete(a);}},u=g=>{let p=String(n++),a={listener:g,type:"full"};return e.set(p,a),()=>{e.delete(p);}};function c(g,p){return p?s(g,p):u(g)}return {getInitialState(){return o},getState:i,setState:l,subscribe:c}};var I=At(()=>({keyPressTimestamps:new Map,mouseX:-1e3,mouseY:-1e3,overlayMode:"hidden",pressedKeys:new Set})),Cn=(t={})=>{if(t.enabled===false)return;let e={adapter:void 0,enabled:true,hotkey:["Meta","C"],keyHoldDuration:500,...t},n=Mt(),r=Ct(n),l=null,i=null,o=false,s=null,u=null,c=()=>{if(Array.isArray(e.hotkey)){for(let M of e.hotkey)if(!ve(M))return false;return true}return ve(e.hotkey)},y=()=>{if(u===null)return;let M=Date.now()-u,F=Math.min(1,M/e.keyHoldDuration),{mouseX:j,mouseY:N}=I.getState();Ge(n,F,j,N),F<1&&(s=requestAnimationFrame(y));},g=()=>{if(s!==null)return;u=Date.now();let{mouseX:M,mouseY:F}=I.getState();Ge(n,0,M,F),s=requestAnimationFrame(y);},p=()=>{s!==null&&(cancelAnimationFrame(s),s=null),u=null,Lt();},a=null,f=M=>{let{overlayMode:F}=I.getState();if(M.has("Escape")||M.has("Esc")){I.setState(N=>{let x=new Set(N.pressedKeys);x.delete("Escape"),x.delete("Esc");let $=new Map(N.keyPressTimestamps);$.delete("Escape"),$.delete("Esc");let G=Array.isArray(e.hotkey)?e.hotkey:[e.hotkey];for(let H of G)H.length===1?(x.delete(H.toLowerCase()),x.delete(H.toUpperCase()),$.delete(H.toLowerCase()),$.delete(H.toUpperCase())):(x.delete(H),$.delete(H));return {...N,keyPressTimestamps:$,overlayMode:"hidden",pressedKeys:x}}),a&&(a(),a=null),p();return}if(!c()){a&&(a(),a=null),F!=="hidden"&&I.setState(N=>({...N,overlayMode:"hidden"})),p();return}F==="hidden"&&!a&&(g(),a=Be(e.hotkey,e.keyHoldDuration,()=>{I.setState(N=>({...N,overlayMode:"visible"})),p(),a=null;}));},m=I.subscribe(f,M=>M.pressedKeys),d=false,h=-1e3,S=-1e3,b=M=>{h=M.clientX,S=M.clientY,!d&&(d=true,requestAnimationFrame(()=>{d=false,I.setState(F=>({...F,mouseX:h,mouseY:S}));}));},E=M=>{if(M.button!==0)return;let{overlayMode:F}=I.getState();F!=="hidden"&&(M.preventDefault(),M.stopPropagation(),M.stopImmediatePropagation(),I.setState(j=>({...j,overlayMode:"copying"})));},T=()=>{document.hidden&&($e(),X());},L=false,R=()=>{L||(L=true,requestAnimationFrame(()=>{L=false,O();}));},v=false,_=()=>{v||(v=true,requestAnimationFrame(()=>{v=false,O();}));};window.addEventListener("mousemove",b),window.addEventListener("mousedown",E),window.addEventListener("scroll",R,true),window.addEventListener("resize",_),document.addEventListener("visibilitychange",T);let w=ze(),C=(M,F)=>{let j=document.elementsFromPoint(M,F);for(let N of j){if(N.closest(`[${Y}]`))continue;let x=window.getComputedStyle(N);if(Rt(N,x))return N}return null},P=async M=>{let F=(M.tagName||"").toLowerCase(),j=M.getBoundingClientRect(),N=Tt(n,j.left,j.top);try{let x=St(M);await Ue(`
3147
26
 
3148
27
  <referenced_element>
3149
- ${htmlSnippet}
3150
- </referenced_element>`
3151
- );
3152
- cleanupIndicator(tagName);
3153
- const stack = await getStack(element);
3154
- if (stack) {
3155
- const filteredStack = filterStack(stack);
3156
- const serializedStack = serializeStack(filteredStack);
3157
- const fullText = `${htmlSnippet}
28
+ ${x}
29
+ </referenced_element>`),N(F);let $=await yt(M);if($){let G=vt($);if(G.length>0){let H=_t(G),ne=`${x}
3158
30
 
3159
31
  Component owner stack:
3160
- ${serializedStack}`;
3161
- await copyTextToClipboard(
3162
- `
32
+ ${H}`;await Ue(`
3163
33
 
3164
34
  <referenced_element>
3165
- ${fullText}
3166
- </referenced_element>`
3167
- ).catch(() => {
3168
- });
3169
- }
3170
- } catch {
3171
- cleanupIndicator(tagName);
3172
- }
3173
- };
3174
- const handleRender = (state) => {
3175
- const { mouseX, mouseY, overlayMode } = state;
3176
- if (overlayMode === "hidden") {
3177
- if (selectionOverlay.isVisible()) {
3178
- selectionOverlay.hide();
3179
- }
3180
- if (!isCopying) {
3181
- hideLabel();
3182
- }
3183
- hoveredElement = null;
3184
- lastGrabbedElement = null;
3185
- return;
3186
- }
3187
- if (overlayMode === "copying" && hoveredElement) {
3188
- if (!isCopying) {
3189
- isCopying = true;
3190
- lastGrabbedElement = hoveredElement;
3191
- const computedStyle2 = window.getComputedStyle(hoveredElement);
3192
- const rect2 = hoveredElement.getBoundingClientRect();
3193
- createGrabbedOverlay(root, {
3194
- borderRadius: computedStyle2.borderRadius || "0px",
3195
- height: rect2.height,
3196
- transform: computedStyle2.transform || "none",
3197
- width: rect2.width,
3198
- x: rect2.left,
3199
- y: rect2.top
3200
- });
3201
- void handleCopy(hoveredElement).finally(() => {
3202
- isCopying = false;
3203
- });
3204
- const isStillPressed = checkIsActivationHotkeyPressed();
3205
- libStore.setState((state2) => ({
3206
- ...state2,
3207
- overlayMode: isStillPressed ? "visible" : "hidden"
3208
- }));
3209
- }
3210
- return;
3211
- }
3212
- const element = getElementAtPosition(mouseX, mouseY);
3213
- if (!element) {
3214
- if (selectionOverlay.isVisible()) {
3215
- selectionOverlay.hide();
3216
- }
3217
- if (!isCopying) {
3218
- hideLabel();
3219
- }
3220
- hoveredElement = null;
3221
- return;
3222
- }
3223
- if (lastGrabbedElement && element !== lastGrabbedElement) {
3224
- lastGrabbedElement = null;
3225
- }
3226
- if (element === lastGrabbedElement) {
3227
- if (selectionOverlay.isVisible()) {
3228
- selectionOverlay.hide();
3229
- }
3230
- if (!isCopying) {
3231
- hideLabel();
3232
- }
3233
- hoveredElement = element;
3234
- return;
3235
- }
3236
- const tagName = (element.tagName || "").toLowerCase();
3237
- hoveredElement = element;
3238
- const rect = element.getBoundingClientRect();
3239
- const computedStyle = window.getComputedStyle(element);
3240
- const borderRadius = computedStyle.borderRadius || "0px";
3241
- const transform = computedStyle.transform || "none";
3242
- selectionOverlay.update({
3243
- borderRadius,
3244
- height: rect.height,
3245
- transform,
3246
- width: rect.width,
3247
- x: rect.left,
3248
- y: rect.top
3249
- });
3250
- if (!selectionOverlay.isVisible()) {
3251
- selectionOverlay.show();
3252
- }
3253
- showLabel(root, rect.left, rect.top, tagName);
3254
- };
3255
- let renderScheduled = false;
3256
- const scheduleRender = () => {
3257
- if (renderScheduled) return;
3258
- renderScheduled = true;
3259
- requestAnimationFrame(() => {
3260
- renderScheduled = false;
3261
- handleRender(libStore.getState());
3262
- });
3263
- };
3264
- const cleanupRenderSubscription = libStore.subscribe(() => {
3265
- scheduleRender();
3266
- });
3267
- const continuousRender = () => {
3268
- scheduleRender();
3269
- requestAnimationFrame(continuousRender);
3270
- };
3271
- continuousRender();
3272
- return () => {
3273
- window.removeEventListener("mousemove", handleMouseMove);
3274
- window.removeEventListener("mousedown", handleMouseDown);
3275
- document.removeEventListener("visibilitychange", handleVisibilityChange);
3276
- cleanupTrackHotkeys();
3277
- cleanupRenderSubscription();
3278
- cleanupKeyStateChangeSubscription();
3279
- if (cleanupActivationHotkeyWatcher) {
3280
- cleanupActivationHotkeyWatcher();
3281
- }
3282
- stopProgressTracking();
3283
- cleanupGrabbedIndicators();
3284
- hideLabel();
3285
- };
3286
- };
3287
- if (typeof window !== "undefined" && typeof document !== "undefined") {
3288
- const currentScript = document.currentScript;
3289
- let options = {};
3290
- if (currentScript) {
3291
- const maybeOptions = currentScript.getAttribute("data-options");
3292
- if (maybeOptions) {
3293
- try {
3294
- options = JSON.parse(maybeOptions);
3295
- } catch {
3296
- }
3297
- }
3298
- }
3299
- init(options);
3300
- }
3301
- /*! Bundled license information:
3302
-
3303
- bippy/dist/src-R2iEnVC1.js:
3304
- (**
3305
- * @license bippy
3306
- *
3307
- * Copyright (c) Aiden Bai
3308
- *
3309
- * This source code is licensed under the MIT license found in the
3310
- * LICENSE file in the root directory of this source tree.
3311
- *)
3312
-
3313
- bippy/dist/index.js:
3314
- (**
3315
- * @license bippy
3316
- *
3317
- * Copyright (c) Aiden Bai
3318
- *
3319
- * This source code is licensed under the MIT license found in the
3320
- * LICENSE file in the root directory of this source tree.
3321
- *)
35
+ ${ne}
36
+ </referenced_element>`).catch(()=>{}),e.adapter&&e.adapter.open(ne);}else e.adapter&&e.adapter.open(x);}else e.adapter&&e.adapter.open(x);}catch{N(F);}},A=M=>{let{mouseX:F,mouseY:j,overlayMode:N}=M;if(N==="hidden"){r.isVisible()&&r.hide(),o||X(),l=null,i=null;return}if(N==="copying"&&l){if(!o){o=true,i=l;let Ve=window.getComputedStyle(l),re=l.getBoundingClientRect();bt(n,{borderRadius:Ve.borderRadius||"0px",height:re.height,transform:Ve.transform||"none",width:re.width,x:re.left,y:re.top}),P(l).finally(()=>{o=false;});let xt=c();I.setState(It=>({...It,overlayMode:xt?"visible":"hidden"}));}return}let x=C(F,j);if(!x){r.isVisible()&&r.hide(),o||X(),l=null;return}if(i&&x!==i&&(i=null),x===i){r.isVisible()&&r.hide(),o||X(),l=x;return}let $=(x.tagName||"").toLowerCase();l=x;let G=x.getBoundingClientRect(),H=window.getComputedStyle(x),ne=H.borderRadius||"0px",Ot=H.transform||"none";r.update({borderRadius:ne,height:G.height,transform:Ot,width:G.width,x:G.left,y:G.top}),r.isVisible()||r.show(),Et(n,G.left,G.top,$);},k=false,O=()=>{k||(k=true,requestAnimationFrame(()=>{k=false,A(I.getState());}));},z=I.subscribe(()=>{O();}),D=()=>{O(),requestAnimationFrame(D);};return D(),()=>{window.removeEventListener("mousemove",b),window.removeEventListener("mousedown",E),window.removeEventListener("scroll",R,true),window.removeEventListener("resize",_),document.removeEventListener("visibilitychange",T),w(),z(),m(),a&&a(),p(),$e(),X();}};if(typeof window<"u"&&typeof document<"u"){let t=document.currentScript,e={};if(t?.dataset){let{adapter:n,enabled:r,hotkey:l,keyHoldDuration:i}=t.dataset;if(n!==void 0&&n==="cursor"&&(e.adapter=ye),r!==void 0&&(e.enabled=r==="true"),l!==void 0){let o=l.split(",").map(s=>s.trim());e.hotkey=o.length===1?o[0]:o;}if(i!==void 0){let o=Number(i);Number.isNaN(o)||(e.keyHoldDuration=o);}}Cn(e);}/*! Bundled license information:
3322
37
 
3323
- bippy/dist/source-DWOhEbf2.js:
3324
- (**
3325
- * @license bippy
3326
- *
3327
- * Copyright (c) Aiden Bai
3328
- *
3329
- * This source code is licensed under the MIT license found in the
3330
- * LICENSE file in the root directory of this source tree.
3331
- *)
3332
-
3333
- bippy/dist/source.js:
3334
- (**
3335
- * @license bippy
3336
- *
3337
- * Copyright (c) Aiden Bai
3338
- *
3339
- * This source code is licensed under the MIT license found in the
3340
- * LICENSE file in the root directory of this source tree.
3341
- *)
3342
- */
38
+ bippy/dist/src-De8xuJ2u.js:
39
+ (**
40
+ * @license bippy
41
+ *
42
+ * Copyright (c) Aiden Bai
43
+ *
44
+ * This source code is licensed under the MIT license found in the
45
+ * LICENSE file in the root directory of this source tree.
46
+ *)
3343
47
 
3344
- exports.init = init;
3345
- exports.libStore = libStore;
48
+ bippy/dist/index.js:
49
+ (**
50
+ * @license bippy
51
+ *
52
+ * Copyright (c) Aiden Bai
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE file in the root directory of this source tree.
56
+ *)
3346
57
 
3347
- return exports;
58
+ bippy/dist/source-CBCTB51B.js:
59
+ (**
60
+ * @license bippy
61
+ *
62
+ * Copyright (c) Aiden Bai
63
+ *
64
+ * This source code is licensed under the MIT license found in the
65
+ * LICENSE file in the root directory of this source tree.
66
+ *)
3348
67
 
3349
- })({});
68
+ bippy/dist/source.js:
69
+ (**
70
+ * @license bippy
71
+ *
72
+ * Copyright (c) Aiden Bai
73
+ *
74
+ * This source code is licensed under the MIT license found in the
75
+ * LICENSE file in the root directory of this source tree.
76
+ *)
77
+ */exports.cursorAdapter=ye;exports.init=Cn;exports.libStore=I;return exports;})({});