react-grab 0.0.37 → 0.0.39
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.
- package/dist/index.cjs +189 -51
- package/dist/index.d.cts +15 -3
- package/dist/index.d.ts +15 -3
- package/dist/index.global.js +19 -15
- package/dist/index.js +189 -52
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -680,10 +680,10 @@ var ReactGrabRenderer = (props) => {
|
|
|
680
680
|
return label.text;
|
|
681
681
|
},
|
|
682
682
|
get x() {
|
|
683
|
-
return
|
|
683
|
+
return props.mouseX ?? 0;
|
|
684
684
|
},
|
|
685
685
|
get y() {
|
|
686
|
-
return
|
|
686
|
+
return props.mouseY ?? 0;
|
|
687
687
|
}
|
|
688
688
|
})
|
|
689
689
|
}), web.createComponent(solidJs.Show, {
|
|
@@ -773,8 +773,16 @@ var formatComponentSourceLocation = async (el) => {
|
|
|
773
773
|
const source$1 = await source.getSourceFromHostInstance(el);
|
|
774
774
|
if (!source$1) return null;
|
|
775
775
|
const fileName = source.normalizeFileName(source$1.fileName);
|
|
776
|
-
if (
|
|
777
|
-
|
|
776
|
+
if (source.isSourceFile(fileName)) {
|
|
777
|
+
return `${fileName}:${source$1.lineNumber}:${source$1.columnNumber}`;
|
|
778
|
+
}
|
|
779
|
+
if (fileName && (fileName.includes(".tsx") || fileName.includes(".ts") || fileName.includes(".jsx") || fileName.includes(".js"))) {
|
|
780
|
+
const cleanedFileName = fileName.replace(/^webpack:\/\/_N_E\//, "").replace(/^webpack:\/\/\//, "").replace(/^webpack:\/\//, "").replace(/^\.\//, "");
|
|
781
|
+
if (cleanedFileName && !cleanedFileName.startsWith("node_modules") && !cleanedFileName.includes(".next") && !cleanedFileName.startsWith("webpack")) {
|
|
782
|
+
return `${cleanedFileName}:${source$1.lineNumber}:${source$1.columnNumber}`;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
return null;
|
|
778
786
|
};
|
|
779
787
|
var getHTMLSnippet = async (element) => {
|
|
780
788
|
const semanticTags = /* @__PURE__ */ new Set([
|
|
@@ -887,14 +895,17 @@ var getHTMLSnippet = async (element) => {
|
|
|
887
895
|
const siblings = Array.from(parent.children);
|
|
888
896
|
targetIndex = siblings.indexOf(element);
|
|
889
897
|
if (targetIndex > 0) {
|
|
890
|
-
const
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
+
const indent2 = " ".repeat(ancestors.length);
|
|
899
|
+
if (targetIndex <= 2) {
|
|
900
|
+
for (let i = 0; i < targetIndex; i++) {
|
|
901
|
+
const sibling = siblings[i];
|
|
902
|
+
const siblingId = extractSiblingIdentifier(sibling);
|
|
903
|
+
if (siblingId) {
|
|
904
|
+
lines.push(`${indent2} ${formatElementOpeningTag(sibling, true)}`);
|
|
905
|
+
lines.push(`${indent2} </${sibling.tagName.toLowerCase()}>`);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
} else {
|
|
898
909
|
lines.push(
|
|
899
910
|
`${indent2} ... (${targetIndex} element${targetIndex === 1 ? "" : "s"})`
|
|
900
911
|
);
|
|
@@ -936,11 +947,15 @@ var getHTMLSnippet = async (element) => {
|
|
|
936
947
|
const siblings = Array.from(parent.children);
|
|
937
948
|
const siblingsAfter = siblings.length - targetIndex - 1;
|
|
938
949
|
if (siblingsAfter > 0) {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
950
|
+
if (siblingsAfter <= 2) {
|
|
951
|
+
for (let i = targetIndex + 1; i < siblings.length; i++) {
|
|
952
|
+
const sibling = siblings[i];
|
|
953
|
+
const siblingId = extractSiblingIdentifier(sibling);
|
|
954
|
+
if (siblingId) {
|
|
955
|
+
lines.push(`${indent} ${formatElementOpeningTag(sibling, true)}`);
|
|
956
|
+
lines.push(`${indent} </${sibling.tagName.toLowerCase()}>`);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
944
959
|
} else {
|
|
945
960
|
lines.push(
|
|
946
961
|
`${indent} ... (${siblingsAfter} element${siblingsAfter === 1 ? "" : "s"})`
|
|
@@ -975,17 +990,18 @@ var waitForFocus = () => {
|
|
|
975
990
|
window.focus();
|
|
976
991
|
});
|
|
977
992
|
};
|
|
978
|
-
var copyContent = async (content) => {
|
|
993
|
+
var copyContent = async (content, onSuccess) => {
|
|
979
994
|
await waitForFocus();
|
|
980
995
|
try {
|
|
981
996
|
if (Array.isArray(content)) {
|
|
982
997
|
if (!navigator?.clipboard?.write) {
|
|
983
998
|
for (const contentPart of content) {
|
|
984
999
|
if (typeof contentPart === "string") {
|
|
985
|
-
const result = copyContentFallback(contentPart);
|
|
1000
|
+
const result = copyContentFallback(contentPart, onSuccess);
|
|
986
1001
|
if (!result) return result;
|
|
987
1002
|
}
|
|
988
1003
|
}
|
|
1004
|
+
onSuccess?.();
|
|
989
1005
|
return true;
|
|
990
1006
|
}
|
|
991
1007
|
const mimeTypeMap = /* @__PURE__ */ new Map();
|
|
@@ -1004,28 +1020,52 @@ var copyContent = async (content) => {
|
|
|
1004
1020
|
}
|
|
1005
1021
|
}
|
|
1006
1022
|
}
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1023
|
+
if (mimeTypeMap.size === 0) {
|
|
1024
|
+
const plainTextFallback = content.find(
|
|
1025
|
+
(contentPart) => typeof contentPart === "string"
|
|
1026
|
+
);
|
|
1027
|
+
if (typeof plainTextFallback === "string") {
|
|
1028
|
+
return copyContentFallback(plainTextFallback, onSuccess);
|
|
1029
|
+
}
|
|
1030
|
+
return false;
|
|
1031
|
+
}
|
|
1032
|
+
try {
|
|
1033
|
+
await navigator.clipboard.write([
|
|
1034
|
+
new ClipboardItem(Object.fromEntries(mimeTypeMap))
|
|
1035
|
+
]);
|
|
1036
|
+
onSuccess?.();
|
|
1037
|
+
return true;
|
|
1038
|
+
} catch {
|
|
1039
|
+
const plainTextParts = content.filter(
|
|
1040
|
+
(contentPart) => typeof contentPart === "string"
|
|
1041
|
+
);
|
|
1042
|
+
if (plainTextParts.length > 0) {
|
|
1043
|
+
const combinedText = plainTextParts.join("\n\n");
|
|
1044
|
+
return copyContentFallback(combinedText, onSuccess);
|
|
1045
|
+
}
|
|
1046
|
+
return false;
|
|
1047
|
+
}
|
|
1011
1048
|
} else if (content instanceof Blob) {
|
|
1012
1049
|
await navigator.clipboard.write([
|
|
1013
1050
|
new ClipboardItem({ [content.type]: content })
|
|
1014
1051
|
]);
|
|
1052
|
+
onSuccess?.();
|
|
1015
1053
|
return true;
|
|
1016
1054
|
} else {
|
|
1017
1055
|
try {
|
|
1018
1056
|
await navigator.clipboard.writeText(String(content));
|
|
1057
|
+
onSuccess?.();
|
|
1019
1058
|
return true;
|
|
1020
1059
|
} catch {
|
|
1021
|
-
|
|
1060
|
+
const result = copyContentFallback(content, onSuccess);
|
|
1061
|
+
return result;
|
|
1022
1062
|
}
|
|
1023
1063
|
}
|
|
1024
1064
|
} catch {
|
|
1025
1065
|
return false;
|
|
1026
1066
|
}
|
|
1027
1067
|
};
|
|
1028
|
-
var copyContentFallback = (content) => {
|
|
1068
|
+
var copyContentFallback = (content, onSuccess) => {
|
|
1029
1069
|
if (!document.execCommand) return false;
|
|
1030
1070
|
const el = document.createElement("textarea");
|
|
1031
1071
|
el.value = String(content);
|
|
@@ -1035,12 +1075,46 @@ var copyContentFallback = (content) => {
|
|
|
1035
1075
|
doc.append(el);
|
|
1036
1076
|
try {
|
|
1037
1077
|
el.select();
|
|
1038
|
-
|
|
1078
|
+
const result = document.execCommand("copy");
|
|
1079
|
+
if (result) onSuccess?.();
|
|
1080
|
+
return result;
|
|
1039
1081
|
} finally {
|
|
1040
1082
|
el.remove();
|
|
1041
1083
|
}
|
|
1042
1084
|
};
|
|
1043
1085
|
|
|
1086
|
+
// src/utils/play-copy-sound.ts
|
|
1087
|
+
var playCopySound = () => {
|
|
1088
|
+
try {
|
|
1089
|
+
const audioContext = new (window.AudioContext || // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access -- window.webkitAudioContext is not typed
|
|
1090
|
+
window.webkitAudioContext)();
|
|
1091
|
+
const masterGain = audioContext.createGain();
|
|
1092
|
+
masterGain.connect(audioContext.destination);
|
|
1093
|
+
const notes = [
|
|
1094
|
+
{ freq: 523.25, start: 0, duration: 0.1 },
|
|
1095
|
+
{ freq: 659.25, start: 0.05, duration: 0.1 },
|
|
1096
|
+
{ freq: 783.99, start: 0.1, duration: 0.15 }
|
|
1097
|
+
];
|
|
1098
|
+
notes.forEach((note) => {
|
|
1099
|
+
const oscillator = audioContext.createOscillator();
|
|
1100
|
+
const gainNode = audioContext.createGain();
|
|
1101
|
+
oscillator.connect(gainNode);
|
|
1102
|
+
gainNode.connect(masterGain);
|
|
1103
|
+
oscillator.frequency.value = note.freq;
|
|
1104
|
+
oscillator.type = "triangle";
|
|
1105
|
+
const startTime = audioContext.currentTime + note.start;
|
|
1106
|
+
const peakTime = startTime + 0.01;
|
|
1107
|
+
const endTime = startTime + note.duration;
|
|
1108
|
+
gainNode.gain.setValueAtTime(0, startTime);
|
|
1109
|
+
gainNode.gain.linearRampToValueAtTime(0.15, peakTime);
|
|
1110
|
+
gainNode.gain.exponentialRampToValueAtTime(0.01, endTime);
|
|
1111
|
+
oscillator.start(startTime);
|
|
1112
|
+
oscillator.stop(endTime);
|
|
1113
|
+
});
|
|
1114
|
+
} catch {
|
|
1115
|
+
}
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1044
1118
|
// src/utils/is-element-visible.ts
|
|
1045
1119
|
var isElementVisible = (element, computedStyle = window.getComputedStyle(element)) => {
|
|
1046
1120
|
return computedStyle.display !== "none" && computedStyle.visibility !== "hidden" && computedStyle.opacity !== "0";
|
|
@@ -1148,6 +1222,12 @@ var createElementBounds = (element) => {
|
|
|
1148
1222
|
};
|
|
1149
1223
|
};
|
|
1150
1224
|
|
|
1225
|
+
// src/utils/is-localhost.ts
|
|
1226
|
+
var isLocalhost = () => {
|
|
1227
|
+
const hostname = window.location.hostname;
|
|
1228
|
+
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]";
|
|
1229
|
+
};
|
|
1230
|
+
|
|
1151
1231
|
// src/core.tsx
|
|
1152
1232
|
var PROGRESS_INDICATOR_DELAY_MS = 150;
|
|
1153
1233
|
var init = (rawOptions) => {
|
|
@@ -1155,6 +1235,7 @@ var init = (rawOptions) => {
|
|
|
1155
1235
|
enabled: true,
|
|
1156
1236
|
keyHoldDuration: 300,
|
|
1157
1237
|
allowActivationInsideInput: true,
|
|
1238
|
+
playCopySound: false,
|
|
1158
1239
|
...rawOptions
|
|
1159
1240
|
};
|
|
1160
1241
|
if (options.enabled === false) {
|
|
@@ -1214,13 +1295,11 @@ var init = (rawOptions) => {
|
|
|
1214
1295
|
setGrabbedBoxes((previousBoxes) => previousBoxes.filter((box) => box.id !== boxId));
|
|
1215
1296
|
}, SUCCESS_LABEL_DURATION_MS);
|
|
1216
1297
|
};
|
|
1217
|
-
const showTemporarySuccessLabel = (text
|
|
1298
|
+
const showTemporarySuccessLabel = (text) => {
|
|
1218
1299
|
const labelId = `success-${Date.now()}-${Math.random()}`;
|
|
1219
1300
|
setSuccessLabels((previousLabels) => [...previousLabels, {
|
|
1220
1301
|
id: labelId,
|
|
1221
|
-
text
|
|
1222
|
-
x: positionX,
|
|
1223
|
-
y: positionY
|
|
1302
|
+
text
|
|
1224
1303
|
}]);
|
|
1225
1304
|
setTimeout(() => {
|
|
1226
1305
|
setSuccessLabels((previousLabels) => previousLabels.filter((label) => label.id !== labelId));
|
|
@@ -1251,7 +1330,8 @@ ${context}
|
|
|
1251
1330
|
computedStyles: element.computedStyles
|
|
1252
1331
|
}))
|
|
1253
1332
|
};
|
|
1254
|
-
const
|
|
1333
|
+
const jsonString = JSON.stringify(structuredData);
|
|
1334
|
+
const base64Data = btoa(encodeURIComponent(jsonString).replace(/%([0-9A-F]{2})/g, (_match, p1) => String.fromCharCode(parseInt(p1, 16))));
|
|
1255
1335
|
const htmlContent = `<div data-react-grab="${base64Data}"></div>`;
|
|
1256
1336
|
return new Blob([htmlContent], {
|
|
1257
1337
|
type: "text/html"
|
|
@@ -1298,6 +1378,8 @@ ${context}
|
|
|
1298
1378
|
} catch {
|
|
1299
1379
|
}
|
|
1300
1380
|
};
|
|
1381
|
+
const isExtensionEnvironment = () => window.__REACT_GRAB_EXTENSION_ACTIVE__ === true || options.isExtension === true;
|
|
1382
|
+
const isExtensionTextOnlyMode = () => isExtensionEnvironment() && !isLocalhost();
|
|
1301
1383
|
const executeCopyOperation = async (positionX, positionY, operation) => {
|
|
1302
1384
|
setCopyStartX(positionX);
|
|
1303
1385
|
setCopyStartY(positionY);
|
|
@@ -1308,21 +1390,49 @@ ${context}
|
|
|
1308
1390
|
stopProgressAnimation();
|
|
1309
1391
|
});
|
|
1310
1392
|
};
|
|
1393
|
+
const hasInnerText = (element) => "innerText" in element;
|
|
1394
|
+
const extractElementTextContent = (element) => {
|
|
1395
|
+
if (hasInnerText(element)) {
|
|
1396
|
+
return element.innerText;
|
|
1397
|
+
}
|
|
1398
|
+
return element.textContent ?? "";
|
|
1399
|
+
};
|
|
1400
|
+
const createCombinedTextContent = (elements) => elements.map((element) => extractElementTextContent(element).trim()).filter((textContent) => textContent.length > 0).join("\n\n");
|
|
1311
1401
|
const copySingleElementToClipboard = async (targetElement2) => {
|
|
1312
1402
|
showTemporaryGrabbedBox(createElementBounds(targetElement2));
|
|
1313
1403
|
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
1404
|
+
let didCopy = false;
|
|
1314
1405
|
try {
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1406
|
+
if (isExtensionTextOnlyMode()) {
|
|
1407
|
+
const plainTextContent = createCombinedTextContent([targetElement2]);
|
|
1408
|
+
if (plainTextContent.length > 0) {
|
|
1409
|
+
didCopy = await copyContent(plainTextContent, options.playCopySound ? playCopySound : void 0);
|
|
1410
|
+
}
|
|
1411
|
+
} else {
|
|
1412
|
+
const content = await getHTMLSnippet(targetElement2);
|
|
1413
|
+
const plainTextContent = wrapInSelectedElementTags(content);
|
|
1414
|
+
const htmlContent = createStructuredClipboardHtmlBlob([{
|
|
1415
|
+
tagName: extractElementTagName(targetElement2),
|
|
1416
|
+
content,
|
|
1417
|
+
computedStyles: extractRelevantComputedStyles(targetElement2)
|
|
1418
|
+
}]);
|
|
1419
|
+
didCopy = await copyContent([plainTextContent, htmlContent], options.playCopySound ? playCopySound : void 0);
|
|
1420
|
+
if (!didCopy) {
|
|
1421
|
+
const plainTextContentOnly = createCombinedTextContent([targetElement2]);
|
|
1422
|
+
if (plainTextContentOnly.length > 0) {
|
|
1423
|
+
didCopy = await copyContent(plainTextContentOnly, options.playCopySound ? playCopySound : void 0);
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1323
1427
|
} catch {
|
|
1428
|
+
const plainTextContentOnly = createCombinedTextContent([targetElement2]);
|
|
1429
|
+
if (plainTextContentOnly.length > 0) {
|
|
1430
|
+
didCopy = await copyContent(plainTextContentOnly, options.playCopySound ? playCopySound : void 0);
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
if (didCopy) {
|
|
1434
|
+
showTemporarySuccessLabel(extractElementLabelText(targetElement2));
|
|
1324
1435
|
}
|
|
1325
|
-
showTemporarySuccessLabel(extractElementLabelText(targetElement2), copyStartX(), copyStartY());
|
|
1326
1436
|
notifyElementsSelected([targetElement2]);
|
|
1327
1437
|
};
|
|
1328
1438
|
const copyMultipleElementsToClipboard = async (targetElements) => {
|
|
@@ -1331,19 +1441,43 @@ ${context}
|
|
|
1331
1441
|
showTemporaryGrabbedBox(createElementBounds(element));
|
|
1332
1442
|
}
|
|
1333
1443
|
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
1444
|
+
let didCopy = false;
|
|
1334
1445
|
try {
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1446
|
+
if (isExtensionTextOnlyMode()) {
|
|
1447
|
+
const plainTextContent = createCombinedTextContent(targetElements);
|
|
1448
|
+
if (plainTextContent.length > 0) {
|
|
1449
|
+
didCopy = await copyContent(plainTextContent, options.playCopySound ? playCopySound : void 0);
|
|
1450
|
+
}
|
|
1451
|
+
} else {
|
|
1452
|
+
const elementSnippetResults = await Promise.allSettled(targetElements.map((element) => getHTMLSnippet(element)));
|
|
1453
|
+
const elementSnippets = elementSnippetResults.map((result) => result.status === "fulfilled" ? result.value : "").filter((snippet) => snippet.trim());
|
|
1454
|
+
if (elementSnippets.length > 0) {
|
|
1455
|
+
const plainTextContent = elementSnippets.map((snippet) => wrapInSelectedElementTags(snippet)).join("\n\n");
|
|
1456
|
+
const structuredElements = elementSnippets.map((content, elementIndex) => ({
|
|
1457
|
+
tagName: extractElementTagName(targetElements[elementIndex]),
|
|
1458
|
+
content,
|
|
1459
|
+
computedStyles: extractRelevantComputedStyles(targetElements[elementIndex])
|
|
1460
|
+
}));
|
|
1461
|
+
const htmlContent = createStructuredClipboardHtmlBlob(structuredElements);
|
|
1462
|
+
didCopy = await copyContent([plainTextContent, htmlContent], options.playCopySound ? playCopySound : void 0);
|
|
1463
|
+
if (!didCopy) {
|
|
1464
|
+
const plainTextContentOnly = createCombinedTextContent(targetElements);
|
|
1465
|
+
if (plainTextContentOnly.length > 0) {
|
|
1466
|
+
didCopy = await copyContent(plainTextContentOnly, options.playCopySound ? playCopySound : void 0);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
} else {
|
|
1470
|
+
const plainTextContentOnly = createCombinedTextContent(targetElements);
|
|
1471
|
+
if (plainTextContentOnly.length > 0) {
|
|
1472
|
+
didCopy = await copyContent(plainTextContentOnly, options.playCopySound ? playCopySound : void 0);
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1344
1476
|
} catch {
|
|
1345
1477
|
}
|
|
1346
|
-
|
|
1478
|
+
if (didCopy) {
|
|
1479
|
+
showTemporarySuccessLabel(`${targetElements.length} elements`);
|
|
1480
|
+
}
|
|
1347
1481
|
notifyElementsSelected(targetElements);
|
|
1348
1482
|
};
|
|
1349
1483
|
const targetElement = solidJs.createMemo(() => {
|
|
@@ -1718,7 +1852,11 @@ ${context}
|
|
|
1718
1852
|
// src/index.ts
|
|
1719
1853
|
var globalApi = null;
|
|
1720
1854
|
var getGlobalApi = () => globalApi;
|
|
1721
|
-
|
|
1855
|
+
var EXTENSION_MARKER = "__REACT_GRAB_EXTENSION_ACTIVE__";
|
|
1856
|
+
if (!window[EXTENSION_MARKER]) {
|
|
1857
|
+
globalApi = init();
|
|
1858
|
+
}
|
|
1722
1859
|
|
|
1723
1860
|
exports.getGlobalApi = getGlobalApi;
|
|
1724
1861
|
exports.init = init;
|
|
1862
|
+
exports.playCopySound = playCopySound;
|
package/dist/index.d.cts
CHANGED
|
@@ -3,6 +3,8 @@ interface Options {
|
|
|
3
3
|
keyHoldDuration?: number;
|
|
4
4
|
allowActivationInsideInput?: boolean;
|
|
5
5
|
onActivate?: () => void;
|
|
6
|
+
playCopySound?: boolean;
|
|
7
|
+
isExtension?: boolean;
|
|
6
8
|
}
|
|
7
9
|
interface ReactGrabAPI {
|
|
8
10
|
activate: () => void;
|
|
@@ -32,8 +34,6 @@ interface ReactGrabRendererProps {
|
|
|
32
34
|
successLabels?: Array<{
|
|
33
35
|
id: string;
|
|
34
36
|
text: string;
|
|
35
|
-
x: number;
|
|
36
|
-
y: number;
|
|
37
37
|
}>;
|
|
38
38
|
labelVariant?: "hover" | "processing" | "success";
|
|
39
39
|
labelText?: string;
|
|
@@ -48,8 +48,20 @@ interface ReactGrabRendererProps {
|
|
|
48
48
|
crosshairVisible?: boolean;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
declare global {
|
|
52
|
+
interface Window {
|
|
53
|
+
__REACT_GRAB_EXTENSION_ACTIVE__?: boolean;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
51
56
|
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
52
57
|
|
|
58
|
+
declare const playCopySound: () => void;
|
|
59
|
+
|
|
60
|
+
declare global {
|
|
61
|
+
interface Window {
|
|
62
|
+
__REACT_GRAB_EXTENSION_ACTIVE__?: boolean;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
53
65
|
declare const getGlobalApi: () => ReactGrabAPI | null;
|
|
54
66
|
|
|
55
|
-
export { type Options, type OverlayBounds, type ReactGrabAPI, type ReactGrabRendererProps, getGlobalApi, init };
|
|
67
|
+
export { type Options, type OverlayBounds, type ReactGrabAPI, type ReactGrabRendererProps, getGlobalApi, init, playCopySound };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ interface Options {
|
|
|
3
3
|
keyHoldDuration?: number;
|
|
4
4
|
allowActivationInsideInput?: boolean;
|
|
5
5
|
onActivate?: () => void;
|
|
6
|
+
playCopySound?: boolean;
|
|
7
|
+
isExtension?: boolean;
|
|
6
8
|
}
|
|
7
9
|
interface ReactGrabAPI {
|
|
8
10
|
activate: () => void;
|
|
@@ -32,8 +34,6 @@ interface ReactGrabRendererProps {
|
|
|
32
34
|
successLabels?: Array<{
|
|
33
35
|
id: string;
|
|
34
36
|
text: string;
|
|
35
|
-
x: number;
|
|
36
|
-
y: number;
|
|
37
37
|
}>;
|
|
38
38
|
labelVariant?: "hover" | "processing" | "success";
|
|
39
39
|
labelText?: string;
|
|
@@ -48,8 +48,20 @@ interface ReactGrabRendererProps {
|
|
|
48
48
|
crosshairVisible?: boolean;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
declare global {
|
|
52
|
+
interface Window {
|
|
53
|
+
__REACT_GRAB_EXTENSION_ACTIVE__?: boolean;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
51
56
|
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
52
57
|
|
|
58
|
+
declare const playCopySound: () => void;
|
|
59
|
+
|
|
60
|
+
declare global {
|
|
61
|
+
interface Window {
|
|
62
|
+
__REACT_GRAB_EXTENSION_ACTIVE__?: boolean;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
53
65
|
declare const getGlobalApi: () => ReactGrabAPI | null;
|
|
54
66
|
|
|
55
|
-
export { type Options, type OverlayBounds, type ReactGrabAPI, type ReactGrabRendererProps, getGlobalApi, init };
|
|
67
|
+
export { type Options, type OverlayBounds, type ReactGrabAPI, type ReactGrabRendererProps, getGlobalApi, init, playCopySound };
|
package/dist/index.global.js
CHANGED
|
@@ -6,25 +6,29 @@ var ReactGrab=(function(exports){'use strict';/**
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
var qr=(e,t)=>e===t;var Xr=Symbol("solid-track"),at={equals:qr},Nn=$n,me=1,ze=2,On={owned:null,cleanups:null,context:null,owner:null};var L=null,p=null,Be=null,G=null,te=null,ie=null,ct=0;function Pe(e,t){let n=G,r=L,o=e.length===0,i=t===void 0?r:t,s=o?On:{owned:null,cleanups:null,context:i?i.context:null,owner:i},a=o?e:()=>e(()=>ue(()=>Oe(s)));L=s,G=null;try{return ve(a,!0)}finally{G=n,L=r;}}function k(e,t){t=t?Object.assign({},at,t):at;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},r=o=>(typeof o=="function"&&(o=o(n.value)),Fn(n,o));return [An.bind(n),r]}function fe(e,t,n){let r=It(e,t,false,me);Xe(r);}function se(e,t,n){Nn=Qr;let r=It(e,t,false,me);(r.user=true),ie?ie.push(r):Xe(r);}function U(e,t,n){n=n?Object.assign({},at,n):at;let r=It(e,t,true,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,Xe(r),An.bind(r)}function ue(e){if(G===null)return e();let t=G;G=null;try{return Be?Be.untrack(e):e()}finally{G=t;}}function _e(e,t,n){let r=Array.isArray(e),o;return s=>{let a;if(r){a=Array(e.length);for(let f=0;f<e.length;f++)a[f]=e[f]();}else a=e();let l=ue(()=>t(a,o,s));return o=a,l}}function _n(e){se(()=>ue(e));}function he(e){return L===null||(L.cleanups===null?L.cleanups=[e]:L.cleanups.push(e)),e}k(false);function An(){let e=p;if(this.sources&&(this.state))if((this.state)===me)Xe(this);else {let t=te;te=null,ve(()=>lt(this),false),te=t;}if(G){let t=this.observers?this.observers.length:0;G.sources?(G.sources.push(this),G.sourceSlots.push(t)):(G.sources=[this],G.sourceSlots=[t]),this.observers?(this.observers.push(G),this.observerSlots.push(G.sources.length-1)):(this.observers=[G],this.observerSlots=[G.sources.length-1]);}return e&&p.sources.has(this)?this.tValue:this.value}function Fn(e,t,n){let r=e.value;if(!e.comparator||!e.comparator(r,t)){e.value=t;e.observers&&e.observers.length&&ve(()=>{for(let o=0;o<e.observers.length;o+=1){let i=e.observers[o],s=p&&p.running;s&&p.disposed.has(i)||((s?!i.tState:!i.state)&&(i.pure?te.push(i):ie.push(i),i.observers&&kn(i)),s?i.tState=me:i.state=me);}if(te.length>1e6)throw te=[],new Error},false);}return t}function Xe(e){if(!e.fn)return;Oe(e);let t=ct;vn(e,e.value,t);}function vn(e,t,n){let r,o=L,i=G;G=L=e;try{r=e.fn(t);}catch(s){return e.pure&&((e.state=me,e.owned&&e.owned.forEach(Oe),e.owned=null)),e.updatedAt=n+1,Mt(s)}finally{G=i,L=o;}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?Fn(e,r):e.value=r,e.updatedAt=n);}function It(e,t,n,r=me,o){let i={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:L,context:L?L.context:null,pure:n};if(L===null||L!==On&&(L.owned?L.owned.push(i):L.owned=[i]),Be);return i}function Ue(e){let t=p;if((e.state)===0)return;if((e.state)===ze)return lt(e);if(e.suspense&&ue(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<ct);){(e.state)&&n.push(e);}for(let r=n.length-1;r>=0;r--){if(e=n[r],t);if((e.state)===me)Xe(e);else if((e.state)===ze){let o=te;te=null,ve(()=>lt(e,n[0]),false),te=o;}}}function ve(e,t){if(te)return e();let n=false;t||(te=[]),ie?n=true:ie=[],ct++;try{let r=e();return Zr(n),r}catch(r){n||(ie=null),te=null,Mt(r);}}function Zr(e){if(te&&($n(te),te=null),e)return;let n=ie;ie=null,n.length&&ve(()=>Nn(n),false);}function $n(e){for(let t=0;t<e.length;t++)Ue(e[t]);}function Qr(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:Ue(r);}for(t=0;t<n;t++)Ue(e[t]);}function lt(e,t){e.state=0;for(let r=0;r<e.sources.length;r+=1){let o=e.sources[r];if(o.sources){let i=o.state;i===me?o!==t&&(!o.updatedAt||o.updatedAt<ct)&&Ue(o):i===ze&<(o,t);}}}function kn(e){for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(!r.state)&&(r.state=ze,r.pure?te.push(r):ie.push(r),r.observers&&kn(r));}}function Oe(e){let t;if(e.sources)for(;e.sources.length;){let n=e.sources.pop(),r=e.sourceSlots.pop(),o=n.observers;if(o&&o.length){let i=o.pop(),s=n.observerSlots.pop();r<o.length&&(i.sourceSlots[s]=r,o[r]=i,n.observerSlots[r]=s);}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)Oe(e.tOwned[t]);delete e.tOwned;}if(e.owned){for(t=e.owned.length-1;t>=0;t--)Oe(e.owned[t]);e.owned=null;}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null;}e.state=0;}function eo(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function Mt(e,t=L){let r=eo(e);throw r;}var to=Symbol("fallback");function Rn(e){for(let t=0;t<e.length;t++)e[t]();}function no(e,t,n={}){let r=[],o=[],i=[],s=0,a=t.length>1?[]:null;return he(()=>Rn(i)),()=>{let l=e()||[],f=l.length,d,m;return l[Xr],ue(()=>{let C,w,E,O,N,S,$,R,P;if(f===0)s!==0&&(Rn(i),i=[],r=[],o=[],s=0,a&&(a=[])),n.fallback&&(r=[to],o[0]=Pe(z=>(i[0]=z,n.fallback())),s=1);else if(s===0){for(o=new Array(f),m=0;m<f;m++)r[m]=l[m],o[m]=Pe(x);s=f;}else {for(E=new Array(f),O=new Array(f),a&&(N=new Array(f)),S=0,$=Math.min(s,f);S<$&&r[S]===l[S];S++);for($=s-1,R=f-1;$>=S&&R>=S&&r[$]===l[R];$--,R--)E[R]=o[$],O[R]=i[$],a&&(N[R]=a[$]);for(C=new Map,w=new Array(R+1),m=R;m>=S;m--)P=l[m],d=C.get(P),w[m]=d===void 0?-1:d,C.set(P,m);for(d=S;d<=$;d++)P=r[d],m=C.get(P),m!==void 0&&m!==-1?(E[m]=o[d],O[m]=i[d],a&&(N[m]=a[d]),m=w[m],C.set(P,m)):i[d]();for(m=S;m<f;m++)m in E?(o[m]=E[m],i[m]=O[m],a&&(a[m]=N[m],a[m](m))):o[m]=Pe(x);o=o.slice(0,s=f),r=l.slice(0);}return o});function x(C){if(i[m]=C,a){let[w,E]=k(m);return a[m]=E,t(l[m],w)}return t(l[m])}}}function I(e,t){return ue(()=>e(t||{}))}var oo=e=>`Stale read from <${e}>.`;function ut(e){let t="fallback"in e&&{fallback:()=>e.fallback};return U(no(()=>e.each,e.children,t||void 0))}function J(e){let t=e.keyed,n=U(()=>e.when,void 0,void 0),r=t?n:U(n,void 0,{equals:(o,i)=>!o==!i});return U(()=>{let o=r();if(o){let i=e.children;return typeof i=="function"&&i.length>0?ue(()=>i(t?o:()=>{if(!ue(r))throw oo("Show");return n()})):i}return e.fallback},void 0,void 0)}var Ae=e=>U(()=>e());function ao(e,t,n){let r=n.length,o=t.length,i=r,s=0,a=0,l=t[o-1].nextSibling,f=null;for(;s<o||a<i;){if(t[s]===n[a]){s++,a++;continue}for(;t[o-1]===n[i-1];)o--,i--;if(o===s){let d=i<r?a?n[a-1].nextSibling:n[i-a]:l;for(;a<i;)e.insertBefore(n[a++],d);}else if(i===a)for(;s<o;)(!f||!f.has(t[s]))&&t[s].remove(),s++;else if(t[s]===n[i-1]&&n[a]===t[o-1]){let d=t[--o].nextSibling;e.insertBefore(n[a++],t[s++].nextSibling),e.insertBefore(n[--i],d),t[o]=n[i];}else {if(!f){f=new Map;let m=a;for(;m<i;)f.set(n[m],m++);}let d=f.get(t[s]);if(d!=null)if(a<d&&d<i){let m=s,x=1,C;for(;++m<o&&m<i&&!((C=f.get(t[m]))==null||C!==d+x);)x++;if(x>d-a){let w=t[s];for(;a<d;)e.insertBefore(n[a++],w);}else e.replaceChild(n[a++],t[s++]);}else s++;else t[s++].remove();}}}function Pn(e,t,n,r={}){let o;return Pe(i=>{o=i,t===document?e():Se(t,e(),t.firstChild?null:void 0,n);},r.owner),()=>{o(),t.textContent="";}}function ae(e,t,n,r){let o,i=()=>{let a=document.createElement("template");return a.innerHTML=e,a.content.firstChild},s=()=>(o||(o=i())).cloneNode(true);return s.cloneNode=s,s}function lo(e,t,n){(e.removeAttribute(t));}function dt(e,t,n){if(!t)return n?lo(e,"style"):t;let r=e.style;if(typeof t=="string")return r.cssText=t;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),t||(t={});let o,i;for(i in n)t[i]==null&&r.removeProperty(i),delete n[i];for(i in t)o=t[i],o!==n[i]&&(r.setProperty(i,o),n[i]=o);return n}function we(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t);}function Fe(e,t,n){return ue(()=>e(t,n))}function Se(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return ft(e,t,r,n);fe(o=>ft(e,t(),o,n),r);}function ft(e,t,n,r,o){for(;typeof n=="function";)n=n();if(t===n)return n;let s=typeof t,a=r!==void 0;if(e=a&&n[0]&&n[0].parentNode||e,s==="string"||s==="number"){if(s==="number"&&(t=t.toString(),t===n))return n;if(a){let l=n[0];l&&l.nodeType===3?l.data!==t&&(l.data=t):l=document.createTextNode(t),n=je(e,n,r,l);}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t;}else if(t==null||s==="boolean"){n=je(e,n,r);}else {if(s==="function")return fe(()=>{let l=t();for(;typeof l=="function";)l=l();n=ft(e,l,n,r);}),()=>n;if(Array.isArray(t)){let l=[],f=n&&Array.isArray(n);if(Pt(l,t,n,o))return fe(()=>n=ft(e,l,n,r,true)),()=>n;if(l.length===0){if(n=je(e,n,r),a)return n}else f?n.length===0?Mn(e,l,r):ao(e,n,l):(n&&je(e),Mn(e,l));n=l;}else if(t.nodeType){if(Array.isArray(n)){if(a)return n=je(e,n,r,t);je(e,n,null,t);}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t;}}return n}function Pt(e,t,n,r){let o=false;for(let i=0,s=t.length;i<s;i++){let a=t[i],l=n&&n[e.length],f;if(!(a==null||a===true||a===false))if((f=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))o=Pt(e,a,l)||o;else if(f==="function")if(r){for(;typeof a=="function";)a=a();o=Pt(e,Array.isArray(a)?a:[a],Array.isArray(l)?l:[l])||o;}else e.push(a),o=true;else {let d=String(a);l&&l.nodeType===3&&l.data===d?e.push(l):e.push(document.createTextNode(d));}}return o}function Mn(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n);}function je(e,t,n,r){if(n===void 0)return e.textContent="";let o=r||document.createTextNode("");if(t.length){let i=false;for(let s=t.length-1;s>=0;s--){let a=t[s];if(o!==a){let l=a.parentNode===e;!i&&!s?l?e.replaceChild(o,a):e.insertBefore(o,n):l&&a.remove();}else i=true;}}else e.insertBefore(o,n);return [o]}var co=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"],uo=e=>!!e.tagName&&!e.tagName.startsWith("-")&&e.tagName.includes("-"),fo=e=>Array.isArray(e),mo=(e,t=false)=>{let{composed:n,target:r}=e,o,i;if(r instanceof HTMLElement&&uo(r)&&n){let a=e.composedPath()[0];a instanceof HTMLElement&&(o=a.tagName,i=a.role);}else r instanceof HTMLElement&&(o=r.tagName,i=r.role);return fo(t)?!!(o&&t&&t.some(s=>typeof o=="string"&&s.toLowerCase()===o.toLowerCase()||s===i)):!!(o&&t&&t)},Dn=e=>mo(e,co);var Ve="data-react-grab",Hn=()=>{let e=document.querySelector(`[${Ve}]`);if(e){let i=e.shadowRoot?.querySelector(`[${Ve}]`);if(i instanceof HTMLDivElement&&e.shadowRoot)return i}let t=document.createElement("div");t.setAttribute(Ve,"true"),t.style.zIndex="2147483646",t.style.position="fixed",t.style.top="0",t.style.left="0";let n=t.attachShadow({mode:"open"}),r=document.createElement("div");return r.setAttribute(Ve,"true"),n.appendChild(r),(document.body??document.documentElement).appendChild(t),r};var pe=(e,t,n)=>e+(t-e)*n;var go=ae("<div>"),mt=e=>{let[t,n]=k(e.bounds.x),[r,o]=k(e.bounds.y),[i,s]=k(e.bounds.width),[a,l]=k(e.bounds.height),[f,d]=k(1),m=false,x=null,C=null,w=e.bounds,E=false,O=()=>e.lerpFactor!==void 0?e.lerpFactor:e.variant==="drag"?.7:.95,N=()=>{if(E)return;E=true;let R=()=>{let P=pe(t(),w.x,O()),z=pe(r(),w.y,O()),K=pe(i(),w.width,O()),y=pe(a(),w.height,O());n(P),o(z),s(K),l(y),Math.abs(P-w.x)<.5&&Math.abs(z-w.y)<.5&&Math.abs(K-w.width)<.5&&Math.abs(y-w.height)<.5?(x=null,E=false):x=requestAnimationFrame(R);};x=requestAnimationFrame(R);};se(_e(()=>e.bounds,R=>{if(w=R,!m){n(w.x),o(w.y),s(w.width),l(w.height),m=true;return}N();})),se(()=>{e.variant==="grabbed"&&e.createdAt&&(C=window.setTimeout(()=>{d(0);},1500));}),he(()=>{x!==null&&(cancelAnimationFrame(x),x=null),C!==null&&(window.clearTimeout(C),C=null),E=false;});let S={position:"fixed","box-sizing":"border-box","pointer-events":e.variant==="drag"?"none":"auto","z-index":"2147483646"},$=()=>e.variant==="drag"?{border:"1px dashed rgba(210, 57, 192, 0.4)","background-color":"rgba(210, 57, 192, 0.05)","will-change":"transform, width, height",contain:"layout paint size",cursor:"crosshair"}:{border:"1px solid rgb(210, 57, 192)","background-color":"rgba(210, 57, 192, 0.2)",transition:e.variant==="grabbed"?"opacity 0.3s ease-out":void 0};return I(J,{get when(){return e.visible!==false},get children(){var R=go();return fe(P=>dt(R,{...S,...$(),top:`${r()}px`,left:`${t()}px`,width:`${i()}px`,height:`${a()}px`,"border-radius":e.bounds.borderRadius,transform:e.bounds.transform,opacity:f()},P)),R}})};var po=ae('<span style="display:inline-block;width:8px;height:8px;border:1.5px solid rgb(210, 57, 192);border-top-color:transparent;border-radius:50%;margin-right:4px;vertical-align:middle">'),Bn=e=>{let t;return _n(()=>{t&&t.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:600,easing:"linear",iterations:1/0});}),(()=>{var n=po(),r=t;return typeof r=="function"?Fe(r,n):t=n,fe(o=>dt(n,{...e.style},o)),n})()};var ht=(e,t,n,r)=>{let o=window.innerWidth,i=window.innerHeight,s=8,a=8,l=o-n-8,f=i-r-8,d=Math.max(s,Math.min(e,l)),m=Math.max(a,Math.min(t,f));return {left:d,top:m}};var bo=ae("<span style=display:inline-block;margin-right:4px;font-weight:600>\u2713"),yo=ae("<div style=margin-right:4px>Copied"),wo=ae(`<span style="font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;font-variant-numeric:tabular-nums;vertical-align:middle">`),So=ae("<span style=font-variant-numeric:tabular-nums;font-size:10px;margin-left:4px;vertical-align:middle>"),To=ae("<div style=margin-left:4px>to clipboard"),Co=ae(`<div style="position:fixed;padding:2px 6px;background-color:#fde7f7;color:#b21c8e;border:1px solid #f7c5ec;border-radius:4px;font-size:11px;font-weight:500;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;pointer-events:none;transition:opacity 0.2s ease-in-out;display:flex;align-items:center;max-width:calc(100vw - (16px + env(safe-area-inset-left) + env(safe-area-inset-right)));overflow:hidden;text-overflow:ellipsis;white-space:nowrap">`),Lt=e=>{let[t,n]=k(0),[r,o]=k(0),i,s=e.x,a=e.y,l=e.x,f=e.y,d=null,m=false,x=()=>{s=pe(s,l,.3),a=pe(a,f,.3),o($=>$+1),Math.abs(s-l)<.5&&Math.abs(a-f)<.5?d=null:d=requestAnimationFrame(x);},C=()=>{d===null&&(d=requestAnimationFrame(x));},w=()=>{if(l=e.x,f=e.y,!m){s=l,a=f,m=true,o(S=>S+1);return}C();};se(_e(()=>e.visible,S=>{if(S!==false)requestAnimationFrame(()=>{n(1);});else {n(0);return}if(e.variant==="success"){let $=setTimeout(()=>{n(0);},1700);he(()=>clearTimeout($));}})),se(()=>{w();}),he(()=>{d!==null&&(cancelAnimationFrame(d),d=null);});let E=()=>i?.getBoundingClientRect(),O=()=>{r();let S=E();if(!S)return {left:s,top:a};let $=window.innerWidth,R=window.innerHeight,P=[{left:Math.round(s)+14,top:Math.round(a)+14},{left:Math.round(s)-S.width-14,top:Math.round(a)+14},{left:Math.round(s)+14,top:Math.round(a)-S.height-14},{left:Math.round(s)-S.width-14,top:Math.round(a)-S.height-14}];for(let K of P){let y=K.left>=8&&K.left+S.width<=$-8,_=K.top>=8&&K.top+S.height<=R-8;if(y&&_)return K}let z=ht(P[0].left,P[0].top,S.width,S.height);return z.left+=4,z.top+=4,z},N=()=>{let $=e.text.indexOf(" in ");return $===-1?{primary:e.text,secondary:""}:{primary:e.text.slice(0,$),secondary:e.text.slice($)}};return I(J,{get when(){return e.visible!==false},get children(){var S=Co(),$=i;return typeof $=="function"?Fe($,S):i=S,Se(S,I(J,{get when(){return e.variant==="processing"},get children(){return I(Bn,{})}}),null),Se(S,I(J,{get when(){return e.variant==="success"},get children(){return bo()}}),null),Se(S,I(J,{get when(){return e.variant==="success"},get children(){return yo()}}),null),Se(S,I(J,{get when(){return e.variant==="processing"},children:"Grabbing\u2026"}),null),Se(S,I(J,{get when(){return e.variant!=="processing"},get children(){return [(()=>{var R=wo();return Se(R,()=>N().primary),R})(),I(J,{get when(){return Ae(()=>e.variant==="hover")()&&N().secondary!==""},get children(){var R=So();return Se(R,()=>N().secondary),R}})]}}),null),Se(S,I(J,{get when(){return e.variant==="success"},get children(){return To()}}),null),fe(R=>{var P=`${O().top}px`,z=`${O().left}px`,K=e.zIndex?.toString()??"2147483647",y=t();return P!==R.e&&we(S,"top",R.e=P),z!==R.t&&we(S,"left",R.t=z),K!==R.a&&we(S,"z-index",R.a=K),y!==R.o&&we(S,"opacity",R.o=y),R},{e:void 0,t:void 0,a:void 0,o:void 0}),S}})};var xo=ae('<div style="position:fixed;z-index:2147483647;pointer-events:none;transition:opacity 0.1s ease-in-out"><div style="width:32px;height:2px;background-color:rgba(178, 28, 142, 0.2);border-radius:1px;overflow:hidden;position:relative"><div style="height:100%;background-color:#b21c8e;border-radius:1px;transition:width 0.05s cubic-bezier(0.165, 0.84, 0.44, 1)">'),vo=e=>{let[t,n]=k(0);return se(_e(()=>e,r=>{r!==false?requestAnimationFrame(()=>{n(1);}):n(0);})),t},Vn=e=>{let t=vo(e.visible),n,r=()=>{let o=n?.getBoundingClientRect();if(!o)return {left:e.mouseX,top:e.mouseY};let i=window.innerHeight,s=e.mouseX-o.width/2,a=e.mouseY+14+o.height+8>i?e.mouseY-o.height-14:e.mouseY+14;return ht(s,a,o.width,o.height)};return I(J,{get when(){return e.visible!==false},get children(){var o=xo(),i=o.firstChild,s=i.firstChild,a=n;return typeof a=="function"?Fe(a,o):n=o,fe(l=>{var f=`${r().top}px`,d=`${r().left}px`,m=t(),x=`${Math.min(100,Math.max(0,e.progress*100))}%`;return f!==l.e&&we(o,"top",l.e=f),d!==l.t&&we(o,"left",l.t=d),m!==l.a&&we(o,"opacity",l.a=m),x!==l.o&&we(s,"width",l.o=x),l},{e:void 0,t:void 0,a:void 0,o:void 0}),o}})};var Eo=ae("<canvas style=position:fixed;top:0;left:0;pointer-events:none;z-index:2147483645>"),Yn=e=>{let t,n=null,r=0,o=0,i=1,s=e.mouseX,a=e.mouseY,l=e.mouseX,f=e.mouseY,d=null,m=false,x=()=>{t&&(i=Math.max(window.devicePixelRatio||1,2),r=window.innerWidth,o=window.innerHeight,t.width=r*i,t.height=o*i,t.style.width=`${r}px`,t.style.height=`${o}px`,n=t.getContext("2d"),n&&n.scale(i,i));},C=()=>{n&&(n.clearRect(0,0,r,o),n.strokeStyle="rgba(210, 57, 192)",n.lineWidth=1,n.beginPath(),n.moveTo(s,0),n.lineTo(s,o),n.moveTo(0,a),n.lineTo(r,a),n.stroke());},w=()=>{s=pe(s,l,.3),a=pe(a,f,.3),C(),Math.abs(s-l)<.5&&Math.abs(a-f)<.5?d=null:d=requestAnimationFrame(w);},E=()=>{d===null&&(d=requestAnimationFrame(w));},O=()=>{if(l=e.mouseX,f=e.mouseY,!m){s=l,a=f,m=true,C();return}E();};return se(()=>{x(),C();let N=()=>{x(),C();};window.addEventListener("resize",N),he(()=>{window.removeEventListener("resize",N),d!==null&&(cancelAnimationFrame(d),d=null);});}),se(()=>{O();}),I(J,{get when(){return e.visible!==false},get children(){var N=Eo(),S=t;return typeof S=="function"?Fe(S,N):t=N,N}})};var Gn=e=>[I(J,{get when(){return Ae(()=>!!e.selectionVisible)()&&e.selectionBounds},get children(){return I(mt,{variant:"selection",get bounds(){return e.selectionBounds},get visible(){return e.selectionVisible}})}}),I(J,{get when(){return Ae(()=>e.crosshairVisible===true&&e.mouseX!==void 0)()&&e.mouseY!==void 0},get children(){return I(Yn,{get mouseX(){return e.mouseX},get mouseY(){return e.mouseY},visible:true})}}),I(J,{get when(){return Ae(()=>!!e.dragVisible)()&&e.dragBounds},get children(){return I(mt,{variant:"drag",get bounds(){return e.dragBounds},get visible(){return e.dragVisible}})}}),I(ut,{get each(){return e.grabbedBoxes??[]},children:t=>I(mt,{variant:"grabbed",get bounds(){return t.bounds},get createdAt(){return t.createdAt}})}),I(ut,{get each(){return e.successLabels??[]},children:t=>I(Lt,{variant:"success",get text(){return t.text},get x(){return t.x},get y(){return t.y}})}),I(J,{get when(){return Ae(()=>!!(e.labelVisible&&e.labelVariant&&e.labelText&&e.labelX!==void 0))()&&e.labelY!==void 0},get children(){return I(Lt,{get variant(){return e.labelVariant},get text(){return e.labelText},get x(){return e.labelX},get y(){return e.labelY},get visible(){return e.labelVisible},get zIndex(){return e.labelZIndex}})}}),I(J,{get when(){return Ae(()=>!!(e.progressVisible&&e.progress!==void 0&&e.mouseX!==void 0))()&&e.mouseY!==void 0},get children(){return I(Vn,{get progress(){return e.progress},get mouseX(){return e.mouseX},get mouseY(){return e.mouseY},get visible(){return e.progressVisible}})}})];var qn="0.5.14",Ke=`bippy-${qn}`,zn=Object.defineProperty,Ro=Object.prototype.hasOwnProperty,We=()=>{},Xn=e=>{try{Function.prototype.toString.call(e).indexOf("^_^")>-1&&setTimeout(()=>{throw 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{}},Dt=(e=Ee())=>"getFiberRoots"in e,Wn=false,Un,bt=(e=Ee())=>Wn?true:(typeof e.inject=="function"&&(Un=e.inject.toString()),!!Un?.includes("(injected)")),pt=new Set,Le=new Set,Kn=e=>{let t=new Map,n=0,r={_instrumentationIsActive:false,_instrumentationSource:Ke,checkDCE:Xn,hasUnsupportedRendererAttached:false,inject(o){let i=++n;return t.set(i,o),Le.add(o),r._instrumentationIsActive||(r._instrumentationIsActive=true,pt.forEach(s=>s())),i},on:We,onCommitFiberRoot:We,onCommitFiberUnmount:We,onPostCommitFiberRoot:We,renderers:t,supportsFiber:true,supportsFlight:true};try{zn(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__",{configurable:!0,enumerable:!0,get(){return r},set(s){if(s&&typeof s=="object"){let a=r.renderers;r=s,a.size>0&&(a.forEach((l,f)=>{Le.add(l),s.renderers.set(f,l);}),yt(e));}}});let o=window.hasOwnProperty,i=!1;zn(window,"hasOwnProperty",{configurable:!0,value:function(...s){try{if(!i&&s[0]==="__REACT_DEVTOOLS_GLOBAL_HOOK__")return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,i=!0,-0}catch{}return o.apply(this,s)},writable:!0});}catch{yt(e);}return r},yt=e=>{e&&pt.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=Xn,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=Ke,t._instrumentationIsActive=!1;let n=Dt(t);if(n||(t.on=We),t.renderers.size){t._instrumentationIsActive=!0,pt.forEach(i=>i());return}let r=t.inject,o=bt(t);o&&!n&&(Wn=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=i=>{let s=r(i);return Le.add(i),o&&t.renderers.set(s,i),t._instrumentationIsActive=!0,pt.forEach(a=>a()),s};}(t.renderers.size||t._instrumentationIsActive||bt())&&e?.();}catch{}},Ht=()=>Ro.call(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__"),Ee=e=>Ht()?(yt(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):Kn(e),Zn=()=>!!(typeof window<"u"&&(window.document?.createElement||window.navigator?.product==="ReactNative")),Bt=()=>{try{Zn()&&Ee();}catch{}};Bt();var wt=0,St=1;var Tt=5;var Ct=11,jt=13,Jn=14,xt=15,Vt=16;var Yt=19;var vt=26,Et=27,Gt=28,zt=30;var Ut=e=>{switch(e.tag){case Tt:case vt:case Et:return true;default:return typeof e.type=="string"}},De=e=>{switch(e.tag){case St:case Ct:case wt:case Jn:case xt:return true;default:return false}};function $e(e,t,n=false){return e&&t(e)instanceof Promise?Xt(e,t,n):qt(e,t,n)}var qt=(e,t,n=false)=>{if(!e)return null;if(t(e)===true)return e;let r=n?e.return:e.child;for(;r;){let o=qt(r,t,n);if(o)return o;r=n?null:r.sibling;}return null},Xt=async(e,t,n=false)=>{if(!e)return null;if(await t(e)===true)return e;let r=n?e.return:e.child;for(;r;){let o=await Xt(r,t,n);if(o)return o;r=n?null:r.sibling;}return null};var Wt=e=>{let t=e;return typeof t=="function"?t:typeof t=="object"&&t?Wt(t.type||t.render):null},ke=e=>{let t=e;if(typeof t=="string")return t;if(typeof t!="function"&&!(typeof t=="object"&&t))return null;let n=t.displayName||t.name||null;if(n)return n;let r=Wt(t);return r&&(r.displayName||r.name)||null};var Kt=e=>{let t=e.alternate;if(!t)return e;if(t.actualStartTime&&e.actualStartTime)return t.actualStartTime>e.actualStartTime?t:e;for(let n of Rt){let r=$e(n.current,o=>{if(o===e)return true});if(r)return r}return e};var Zt=e=>{let t=Ee(e.onActive);t._instrumentationSource=e.name??Ke;let n=t.onCommitFiberRoot;if(e.onCommitFiberRoot){let i=(s,a,l)=>{n!==i&&(n?.(s,a,l),e.onCommitFiberRoot?.(s,a,l));};t.onCommitFiberRoot=i;}let r=t.onCommitFiberUnmount;if(e.onCommitFiberUnmount){let i=(s,a)=>{t.onCommitFiberUnmount===i&&(r?.(s,a),e.onCommitFiberUnmount?.(s,a));};t.onCommitFiberUnmount=i;}let o=t.onPostCommitFiberRoot;if(e.onPostCommitFiberRoot){let i=(s,a)=>{t.onPostCommitFiberRoot===i&&(o?.(s,a),e.onPostCommitFiberRoot?.(s,a));};t.onPostCommitFiberRoot=i;}return t},He=e=>{let t=Ee();for(let n of t.renderers.values())try{let r=n.findFiberByHostInstance?.(e);if(r)return r}catch{}if(typeof e=="object"&&e){if("_reactRootContainer"in e)return e._reactRootContainer?._internalRoot?.current?.child;for(let n in e)if(n.startsWith("__reactContainer$")||n.startsWith("__reactInternalInstance$")||n.startsWith("__reactFiber"))return e[n]||null}return null},Rt=new Set;var Mo=Object.create,sr=Object.defineProperty,Po=Object.getOwnPropertyDescriptor,Lo=Object.getOwnPropertyNames,Do=Object.getPrototypeOf,Ho=Object.prototype.hasOwnProperty,Bo=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),jo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=Lo(t),i=0,s=o.length,a;i<s;i++)a=o[i],!Ho.call(e,a)&&a!==n&&sr(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=Po(t,a))||r.enumerable});return e},Vo=(e,t,n)=>(n=e==null?{}:Mo(Do(e)),jo(sr(n,"default",{value:e,enumerable:true}),e)),Yo=()=>{let e=Ee();for(let t of [...Array.from(Le),...Array.from(e.renderers.values())]){let n=t.currentDispatcherRef;if(n&&typeof n=="object")return "H"in n?n.H:n.current}return null},Qn=e=>{for(let t of Le){let n=t.currentDispatcherRef;n&&typeof n=="object"&&("H"in n?n.H=e:n.current=e);}},Re=e=>`
|
|
10
|
-
in ${e}`,
|
|
9
|
+
var no=(e,t)=>e===t;var ro=Symbol("solid-track"),ft={equals:no},In=Dn,me=1,Ke=2,kn={owned:null,cleanups:null,context:null,owner:null};var D=null,p=null,Ge=null,G=null,te=null,ie=null,mt=0;function De(e,t){let n=G,r=D,o=e.length===0,i=t===void 0?r:t,s=o?kn:{owned:null,cleanups:null,context:i?i.context:null,owner:i},a=o?e:()=>e(()=>ue(()=>Ae(s)));D=s,G=null;try{return ve(a,!0)}finally{G=n,D=r;}}function I(e,t){t=t?Object.assign({},ft,t):ft;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},r=o=>(typeof o=="function"&&(o=o(n.value)),Ln(n,o));return [Pn.bind(n),r]}function fe(e,t,n){let r=Ht(e,t,false,me);Qe(r);}function se(e,t,n){In=lo;let r=Ht(e,t,false,me);(r.user=true),ie?ie.push(r):Qe(r);}function q(e,t,n){n=n?Object.assign({},ft,n):ft;let r=Ht(e,t,true,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,Qe(r),Pn.bind(r)}function ue(e){if(G===null)return e();let t=G;G=null;try{return Ge?Ge.untrack(e):e()}finally{G=t;}}function Fe(e,t,n){let r=Array.isArray(e),o;return s=>{let a;if(r){a=Array(e.length);for(let f=0;f<e.length;f++)a[f]=e[f]();}else a=e();let l=ue(()=>t(a,o,s));return o=a,l}}function Mn(e){se(()=>ue(e));}function he(e){return D===null||(D.cleanups===null?D.cleanups=[e]:D.cleanups.push(e)),e}I(false);function Pn(){let e=p;if(this.sources&&(this.state))if((this.state)===me)Qe(this);else {let t=te;te=null,ve(()=>dt(this),false),te=t;}if(G){let t=this.observers?this.observers.length:0;G.sources?(G.sources.push(this),G.sourceSlots.push(t)):(G.sources=[this],G.sourceSlots=[t]),this.observers?(this.observers.push(G),this.observerSlots.push(G.sources.length-1)):(this.observers=[G],this.observerSlots=[G.sources.length-1]);}return e&&p.sources.has(this)?this.tValue:this.value}function Ln(e,t,n){let r=e.value;if(!e.comparator||!e.comparator(r,t)){e.value=t;e.observers&&e.observers.length&&ve(()=>{for(let o=0;o<e.observers.length;o+=1){let i=e.observers[o],s=p&&p.running;s&&p.disposed.has(i)||((s?!i.tState:!i.state)&&(i.pure?te.push(i):ie.push(i),i.observers&&Hn(i)),s?i.tState=me:i.state=me);}if(te.length>1e6)throw te=[],new Error},false);}return t}function Qe(e){if(!e.fn)return;Ae(e);let t=mt;An(e,e.value,t);}function An(e,t,n){let r,o=D,i=G;G=D=e;try{r=e.fn(t);}catch(s){return e.pure&&((e.state=me,e.owned&&e.owned.forEach(Ae),e.owned=null)),e.updatedAt=n+1,jt(s)}finally{G=i,D=o;}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?Ln(e,r):e.value=r,e.updatedAt=n);}function Ht(e,t,n,r=me,o){let i={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:D,context:D?D.context:null,pure:n};if(D===null||D!==kn&&(D.owned?D.owned.push(i):D.owned=[i]),Ge);return i}function Ze(e){let t=p;if((e.state)===0)return;if((e.state)===Ke)return dt(e);if(e.suspense&&ue(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<mt);){(e.state)&&n.push(e);}for(let r=n.length-1;r>=0;r--){if(e=n[r],t);if((e.state)===me)Qe(e);else if((e.state)===Ke){let o=te;te=null,ve(()=>dt(e,n[0]),false),te=o;}}}function ve(e,t){if(te)return e();let n=false;t||(te=[]),ie?n=true:ie=[],mt++;try{let r=e();return so(n),r}catch(r){n||(ie=null),te=null,jt(r);}}function so(e){if(te&&(Dn(te),te=null),e)return;let n=ie;ie=null,n.length&&ve(()=>In(n),false);}function Dn(e){for(let t=0;t<e.length;t++)Ze(e[t]);}function lo(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:Ze(r);}for(t=0;t<n;t++)Ze(e[t]);}function dt(e,t){e.state=0;for(let r=0;r<e.sources.length;r+=1){let o=e.sources[r];if(o.sources){let i=o.state;i===me?o!==t&&(!o.updatedAt||o.updatedAt<mt)&&Ze(o):i===Ke&&dt(o,t);}}}function Hn(e){for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(!r.state)&&(r.state=Ke,r.pure?te.push(r):ie.push(r),r.observers&&Hn(r));}}function Ae(e){let t;if(e.sources)for(;e.sources.length;){let n=e.sources.pop(),r=e.sourceSlots.pop(),o=n.observers;if(o&&o.length){let i=o.pop(),s=n.observerSlots.pop();r<o.length&&(i.sourceSlots[s]=r,o[r]=i,n.observerSlots[r]=s);}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)Ae(e.tOwned[t]);delete e.tOwned;}if(e.owned){for(t=e.owned.length-1;t>=0;t--)Ae(e.owned[t]);e.owned=null;}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null;}e.state=0;}function co(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function jt(e,t=D){let r=co(e);throw r;}var uo=Symbol("fallback");function $n(e){for(let t=0;t<e.length;t++)e[t]();}function fo(e,t,n={}){let r=[],o=[],i=[],s=0,a=t.length>1?[]:null;return he(()=>$n(i)),()=>{let l=e()||[],f=l.length,d,m;return l[ro],ue(()=>{let C,T,R,_,O,S,$,N,P;if(f===0)s!==0&&($n(i),i=[],r=[],o=[],s=0,a&&(a=[])),n.fallback&&(r=[uo],o[0]=De(z=>(i[0]=z,n.fallback())),s=1);else if(s===0){for(o=new Array(f),m=0;m<f;m++)r[m]=l[m],o[m]=De(x);s=f;}else {for(R=new Array(f),_=new Array(f),a&&(O=new Array(f)),S=0,$=Math.min(s,f);S<$&&r[S]===l[S];S++);for($=s-1,N=f-1;$>=S&&N>=S&&r[$]===l[N];$--,N--)R[N]=o[$],_[N]=i[$],a&&(O[N]=a[$]);for(C=new Map,T=new Array(N+1),m=N;m>=S;m--)P=l[m],d=C.get(P),T[m]=d===void 0?-1:d,C.set(P,m);for(d=S;d<=$;d++)P=r[d],m=C.get(P),m!==void 0&&m!==-1?(R[m]=o[d],_[m]=i[d],a&&(O[m]=a[d]),m=T[m],C.set(P,m)):i[d]();for(m=S;m<f;m++)m in R?(o[m]=R[m],i[m]=_[m],a&&(a[m]=O[m],a[m](m))):o[m]=De(x);o=o.slice(0,s=f),r=l.slice(0);}return o});function x(C){if(i[m]=C,a){let[T,R]=I(m);return a[m]=R,t(l[m],T)}return t(l[m])}}}function k(e,t){return ue(()=>e(t||{}))}var ho=e=>`Stale read from <${e}>.`;function ht(e){let t="fallback"in e&&{fallback:()=>e.fallback};return q(fo(()=>e.each,e.children,t||void 0))}function J(e){let t=e.keyed,n=q(()=>e.when,void 0,void 0),r=t?n:q(n,void 0,{equals:(o,i)=>!o==!i});return q(()=>{let o=r();if(o){let i=e.children;return typeof i=="function"&&i.length>0?ue(()=>i(t?o:()=>{if(!ue(r))throw ho("Show");return n()})):i}return e.fallback},void 0,void 0)}var $e=e=>q(()=>e());function bo(e,t,n){let r=n.length,o=t.length,i=r,s=0,a=0,l=t[o-1].nextSibling,f=null;for(;s<o||a<i;){if(t[s]===n[a]){s++,a++;continue}for(;t[o-1]===n[i-1];)o--,i--;if(o===s){let d=i<r?a?n[a-1].nextSibling:n[i-a]:l;for(;a<i;)e.insertBefore(n[a++],d);}else if(i===a)for(;s<o;)(!f||!f.has(t[s]))&&t[s].remove(),s++;else if(t[s]===n[i-1]&&n[a]===t[o-1]){let d=t[--o].nextSibling;e.insertBefore(n[a++],t[s++].nextSibling),e.insertBefore(n[--i],d),t[o]=n[i];}else {if(!f){f=new Map;let m=a;for(;m<i;)f.set(n[m],m++);}let d=f.get(t[s]);if(d!=null)if(a<d&&d<i){let m=s,x=1,C;for(;++m<o&&m<i&&!((C=f.get(t[m]))==null||C!==d+x);)x++;if(x>d-a){let T=t[s];for(;a<d;)e.insertBefore(n[a++],T);}else e.replaceChild(n[a++],t[s++]);}else s++;else t[s++].remove();}}}function Vn(e,t,n,r={}){let o;return De(i=>{o=i,t===document?e():Te(t,e(),t.firstChild?null:void 0,n);},r.owner),()=>{o(),t.textContent="";}}function ae(e,t,n,r){let o,i=()=>{let a=document.createElement("template");return a.innerHTML=e,a.content.firstChild},s=()=>(o||(o=i())).cloneNode(true);return s.cloneNode=s,s}function yo(e,t,n){(e.removeAttribute(t));}function pt(e,t,n){if(!t)return n?yo(e,"style"):t;let r=e.style;if(typeof t=="string")return r.cssText=t;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),t||(t={});let o,i;for(i in n)t[i]==null&&r.removeProperty(i),delete n[i];for(i in t)o=t[i],o!==n[i]&&(r.setProperty(i,o),n[i]=o);return n}function we(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t);}function Ie(e,t,n){return ue(()=>e(t,n))}function Te(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return gt(e,t,r,n);fe(o=>gt(e,t(),o,n),r);}function gt(e,t,n,r,o){for(;typeof n=="function";)n=n();if(t===n)return n;let s=typeof t,a=r!==void 0;if(e=a&&n[0]&&n[0].parentNode||e,s==="string"||s==="number"){if(s==="number"&&(t=t.toString(),t===n))return n;if(a){let l=n[0];l&&l.nodeType===3?l.data!==t&&(l.data=t):l=document.createTextNode(t),n=ze(e,n,r,l);}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t;}else if(t==null||s==="boolean"){n=ze(e,n,r);}else {if(s==="function")return fe(()=>{let l=t();for(;typeof l=="function";)l=l();n=gt(e,l,n,r);}),()=>n;if(Array.isArray(t)){let l=[],f=n&&Array.isArray(n);if(Bt(l,t,n,o))return fe(()=>n=gt(e,l,n,r,true)),()=>n;if(l.length===0){if(n=ze(e,n,r),a)return n}else f?n.length===0?Bn(e,l,r):bo(e,n,l):(n&&ze(e),Bn(e,l));n=l;}else if(t.nodeType){if(Array.isArray(n)){if(a)return n=ze(e,n,r,t);ze(e,n,null,t);}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t;}}return n}function Bt(e,t,n,r){let o=false;for(let i=0,s=t.length;i<s;i++){let a=t[i],l=n&&n[e.length],f;if(!(a==null||a===true||a===false))if((f=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))o=Bt(e,a,l)||o;else if(f==="function")if(r){for(;typeof a=="function";)a=a();o=Bt(e,Array.isArray(a)?a:[a],Array.isArray(l)?l:[l])||o;}else e.push(a),o=true;else {let d=String(a);l&&l.nodeType===3&&l.data===d?e.push(l):e.push(document.createTextNode(d));}}return o}function Bn(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n);}function ze(e,t,n,r){if(n===void 0)return e.textContent="";let o=r||document.createTextNode("");if(t.length){let i=false;for(let s=t.length-1;s>=0;s--){let a=t[s];if(o!==a){let l=a.parentNode===e;!i&&!s?l?e.replaceChild(o,a):e.insertBefore(o,n):l&&a.remove();}else i=true;}}else e.insertBefore(o,n);return [o]}var wo=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"],To=e=>!!e.tagName&&!e.tagName.startsWith("-")&&e.tagName.includes("-"),So=e=>Array.isArray(e),Co=(e,t=false)=>{let{composed:n,target:r}=e,o,i;if(r instanceof HTMLElement&&To(r)&&n){let a=e.composedPath()[0];a instanceof HTMLElement&&(o=a.tagName,i=a.role);}else r instanceof HTMLElement&&(o=r.tagName,i=r.role);return So(t)?!!(o&&t&&t.some(s=>typeof o=="string"&&s.toLowerCase()===o.toLowerCase()||s===i)):!!(o&&t&&t)},Gn=e=>Co(e,wo);var Ue="data-react-grab",zn=()=>{let e=document.querySelector(`[${Ue}]`);if(e){let i=e.shadowRoot?.querySelector(`[${Ue}]`);if(i instanceof HTMLDivElement&&e.shadowRoot)return i}let t=document.createElement("div");t.setAttribute(Ue,"true"),t.style.zIndex="2147483646",t.style.position="fixed",t.style.top="0",t.style.left="0";let n=t.attachShadow({mode:"open"}),r=document.createElement("div");return r.setAttribute(Ue,"true"),n.appendChild(r),(document.body??document.documentElement).appendChild(t),r};var pe=(e,t,n)=>e+(t-e)*n;var Eo=ae("<div>"),bt=e=>{let[t,n]=I(e.bounds.x),[r,o]=I(e.bounds.y),[i,s]=I(e.bounds.width),[a,l]=I(e.bounds.height),[f,d]=I(1),m=false,x=null,C=null,T=e.bounds,R=false,_=()=>e.lerpFactor!==void 0?e.lerpFactor:e.variant==="drag"?.7:.95,O=()=>{if(R)return;R=true;let N=()=>{let P=pe(t(),T.x,_()),z=pe(r(),T.y,_()),K=pe(i(),T.width,_()),y=pe(a(),T.height,_());n(P),o(z),s(K),l(y),Math.abs(P-T.x)<.5&&Math.abs(z-T.y)<.5&&Math.abs(K-T.width)<.5&&Math.abs(y-T.height)<.5?(x=null,R=false):x=requestAnimationFrame(N);};x=requestAnimationFrame(N);};se(Fe(()=>e.bounds,N=>{if(T=N,!m){n(T.x),o(T.y),s(T.width),l(T.height),m=true;return}O();})),se(()=>{e.variant==="grabbed"&&e.createdAt&&(C=window.setTimeout(()=>{d(0);},1500));}),he(()=>{x!==null&&(cancelAnimationFrame(x),x=null),C!==null&&(window.clearTimeout(C),C=null),R=false;});let S={position:"fixed","box-sizing":"border-box","pointer-events":e.variant==="drag"?"none":"auto","z-index":"2147483646"},$=()=>e.variant==="drag"?{border:"1px dashed rgba(210, 57, 192, 0.4)","background-color":"rgba(210, 57, 192, 0.05)","will-change":"transform, width, height",contain:"layout paint size",cursor:"crosshair"}:{border:"1px solid rgb(210, 57, 192)","background-color":"rgba(210, 57, 192, 0.2)",transition:e.variant==="grabbed"?"opacity 0.3s ease-out":void 0};return k(J,{get when(){return e.visible!==false},get children(){var N=Eo();return fe(P=>pt(N,{...S,...$(),top:`${r()}px`,left:`${t()}px`,width:`${i()}px`,height:`${a()}px`,"border-radius":e.bounds.borderRadius,transform:e.bounds.transform,opacity:f()},P)),N}})};var vo=ae('<span style="display:inline-block;width:8px;height:8px;border:1.5px solid rgb(210, 57, 192);border-top-color:transparent;border-radius:50%;margin-right:4px;vertical-align:middle">'),Un=e=>{let t;return Mn(()=>{t&&t.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:600,easing:"linear",iterations:1/0});}),(()=>{var n=vo(),r=t;return typeof r=="function"?Ie(r,n):t=n,fe(o=>pt(n,{...e.style},o)),n})()};var yt=(e,t,n,r)=>{let o=window.innerWidth,i=window.innerHeight,s=8,a=8,l=o-n-8,f=i-r-8,d=Math.max(s,Math.min(e,l)),m=Math.max(a,Math.min(t,f));return {left:d,top:m}};var Ro=ae("<span style=display:inline-block;margin-right:4px;font-weight:600>\u2713"),No=ae("<div style=margin-right:4px>Copied"),_o=ae(`<span style="font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;font-variant-numeric:tabular-nums;vertical-align:middle">`),Oo=ae("<span style=font-variant-numeric:tabular-nums;font-size:10px;margin-left:4px;vertical-align:middle>"),Ao=ae("<div style=margin-left:4px>to clipboard"),Fo=ae(`<div style="position:fixed;padding:2px 6px;background-color:#fde7f7;color:#b21c8e;border:1px solid #f7c5ec;border-radius:4px;font-size:11px;font-weight:500;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;pointer-events:none;transition:opacity 0.2s ease-in-out;display:flex;align-items:center;max-width:calc(100vw - (16px + env(safe-area-inset-left) + env(safe-area-inset-right)));overflow:hidden;text-overflow:ellipsis;white-space:nowrap">`),Vt=e=>{let[t,n]=I(0),[r,o]=I(0),i,s=e.x,a=e.y,l=e.x,f=e.y,d=null,m=false,x=()=>{s=pe(s,l,.3),a=pe(a,f,.3),o($=>$+1),Math.abs(s-l)<.5&&Math.abs(a-f)<.5?d=null:d=requestAnimationFrame(x);},C=()=>{d===null&&(d=requestAnimationFrame(x));},T=()=>{if(l=e.x,f=e.y,!m){s=l,a=f,m=true,o(S=>S+1);return}C();};se(Fe(()=>e.visible,S=>{if(S!==false)requestAnimationFrame(()=>{n(1);});else {n(0);return}if(e.variant==="success"){let $=setTimeout(()=>{n(0);},1700);he(()=>clearTimeout($));}})),se(()=>{T();}),he(()=>{d!==null&&(cancelAnimationFrame(d),d=null);});let R=()=>i?.getBoundingClientRect(),_=()=>{r();let S=R();if(!S)return {left:s,top:a};let $=window.innerWidth,N=window.innerHeight,P=[{left:Math.round(s)+14,top:Math.round(a)+14},{left:Math.round(s)-S.width-14,top:Math.round(a)+14},{left:Math.round(s)+14,top:Math.round(a)-S.height-14},{left:Math.round(s)-S.width-14,top:Math.round(a)-S.height-14}];for(let K of P){let y=K.left>=8&&K.left+S.width<=$-8,A=K.top>=8&&K.top+S.height<=N-8;if(y&&A)return K}let z=yt(P[0].left,P[0].top,S.width,S.height);return z.left+=4,z.top+=4,z},O=()=>{let $=e.text.indexOf(" in ");return $===-1?{primary:e.text,secondary:""}:{primary:e.text.slice(0,$),secondary:e.text.slice($)}};return k(J,{get when(){return e.visible!==false},get children(){var S=Fo(),$=i;return typeof $=="function"?Ie($,S):i=S,Te(S,k(J,{get when(){return e.variant==="processing"},get children(){return k(Un,{})}}),null),Te(S,k(J,{get when(){return e.variant==="success"},get children(){return Ro()}}),null),Te(S,k(J,{get when(){return e.variant==="success"},get children(){return No()}}),null),Te(S,k(J,{get when(){return e.variant==="processing"},children:"Grabbing\u2026"}),null),Te(S,k(J,{get when(){return e.variant!=="processing"},get children(){return [(()=>{var N=_o();return Te(N,()=>O().primary),N})(),k(J,{get when(){return $e(()=>e.variant==="hover")()&&O().secondary!==""},get children(){var N=Oo();return Te(N,()=>O().secondary),N}})]}}),null),Te(S,k(J,{get when(){return e.variant==="success"},get children(){return Ao()}}),null),fe(N=>{var P=`${_().top}px`,z=`${_().left}px`,K=e.zIndex?.toString()??"2147483647",y=t();return P!==N.e&&we(S,"top",N.e=P),z!==N.t&&we(S,"left",N.t=z),K!==N.a&&we(S,"z-index",N.a=K),y!==N.o&&we(S,"opacity",N.o=y),N},{e:void 0,t:void 0,a:void 0,o:void 0}),S}})};var $o=ae('<div style="position:fixed;z-index:2147483647;pointer-events:none;transition:opacity 0.1s ease-in-out"><div style="width:32px;height:2px;background-color:rgba(178, 28, 142, 0.2);border-radius:1px;overflow:hidden;position:relative"><div style="height:100%;background-color:#b21c8e;border-radius:1px;transition:width 0.05s cubic-bezier(0.165, 0.84, 0.44, 1)">'),Io=e=>{let[t,n]=I(0);return se(Fe(()=>e,r=>{r!==false?requestAnimationFrame(()=>{n(1);}):n(0);})),t},Xn=e=>{let t=Io(e.visible),n,r=()=>{let o=n?.getBoundingClientRect();if(!o)return {left:e.mouseX,top:e.mouseY};let i=window.innerHeight,s=e.mouseX-o.width/2,a=e.mouseY+14+o.height+8>i?e.mouseY-o.height-14:e.mouseY+14;return yt(s,a,o.width,o.height)};return k(J,{get when(){return e.visible!==false},get children(){var o=$o(),i=o.firstChild,s=i.firstChild,a=n;return typeof a=="function"?Ie(a,o):n=o,fe(l=>{var f=`${r().top}px`,d=`${r().left}px`,m=t(),x=`${Math.min(100,Math.max(0,e.progress*100))}%`;return f!==l.e&&we(o,"top",l.e=f),d!==l.t&&we(o,"left",l.t=d),m!==l.a&&we(o,"opacity",l.a=m),x!==l.o&&we(s,"width",l.o=x),l},{e:void 0,t:void 0,a:void 0,o:void 0}),o}})};var ko=ae("<canvas style=position:fixed;top:0;left:0;pointer-events:none;z-index:2147483645>"),Wn=e=>{let t,n=null,r=0,o=0,i=1,s=e.mouseX,a=e.mouseY,l=e.mouseX,f=e.mouseY,d=null,m=false,x=()=>{t&&(i=Math.max(window.devicePixelRatio||1,2),r=window.innerWidth,o=window.innerHeight,t.width=r*i,t.height=o*i,t.style.width=`${r}px`,t.style.height=`${o}px`,n=t.getContext("2d"),n&&n.scale(i,i));},C=()=>{n&&(n.clearRect(0,0,r,o),n.strokeStyle="rgba(210, 57, 192)",n.lineWidth=1,n.beginPath(),n.moveTo(s,0),n.lineTo(s,o),n.moveTo(0,a),n.lineTo(r,a),n.stroke());},T=()=>{s=pe(s,l,.3),a=pe(a,f,.3),C(),Math.abs(s-l)<.5&&Math.abs(a-f)<.5?d=null:d=requestAnimationFrame(T);},R=()=>{d===null&&(d=requestAnimationFrame(T));},_=()=>{if(l=e.mouseX,f=e.mouseY,!m){s=l,a=f,m=true,C();return}R();};return se(()=>{x(),C();let O=()=>{x(),C();};window.addEventListener("resize",O),he(()=>{window.removeEventListener("resize",O),d!==null&&(cancelAnimationFrame(d),d=null);});}),se(()=>{_();}),k(J,{get when(){return e.visible!==false},get children(){var O=ko(),S=t;return typeof S=="function"?Ie(S,O):t=O,O}})};var Kn=e=>[k(J,{get when(){return $e(()=>!!e.selectionVisible)()&&e.selectionBounds},get children(){return k(bt,{variant:"selection",get bounds(){return e.selectionBounds},get visible(){return e.selectionVisible}})}}),k(J,{get when(){return $e(()=>e.crosshairVisible===true&&e.mouseX!==void 0)()&&e.mouseY!==void 0},get children(){return k(Wn,{get mouseX(){return e.mouseX},get mouseY(){return e.mouseY},visible:true})}}),k(J,{get when(){return $e(()=>!!e.dragVisible)()&&e.dragBounds},get children(){return k(bt,{variant:"drag",get bounds(){return e.dragBounds},get visible(){return e.dragVisible}})}}),k(ht,{get each(){return e.grabbedBoxes??[]},children:t=>k(bt,{variant:"grabbed",get bounds(){return t.bounds},get createdAt(){return t.createdAt}})}),k(ht,{get each(){return e.successLabels??[]},children:t=>k(Vt,{variant:"success",get text(){return t.text},get x(){return e.mouseX??0},get y(){return e.mouseY??0}})}),k(J,{get when(){return $e(()=>!!(e.labelVisible&&e.labelVariant&&e.labelText&&e.labelX!==void 0))()&&e.labelY!==void 0},get children(){return k(Vt,{get variant(){return e.labelVariant},get text(){return e.labelText},get x(){return e.labelX},get y(){return e.labelY},get visible(){return e.labelVisible},get zIndex(){return e.labelZIndex}})}}),k(J,{get when(){return $e(()=>!!(e.progressVisible&&e.progress!==void 0&&e.mouseX!==void 0))()&&e.mouseY!==void 0},get children(){return k(Xn,{get progress(){return e.progress},get mouseX(){return e.mouseX},get mouseY(){return e.mouseY},get visible(){return e.progressVisible}})}})];var Qn="0.5.14",tt=`bippy-${Qn}`,Zn=Object.defineProperty,Mo=Object.prototype.hasOwnProperty,et=()=>{},er=e=>{try{Function.prototype.toString.call(e).indexOf("^_^")>-1&&setTimeout(()=>{throw 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{}},Yt=(e=Re())=>"getFiberRoots"in e,tr=false,Jn,St=(e=Re())=>tr?true:(typeof e.inject=="function"&&(Jn=e.inject.toString()),!!Jn?.includes("(injected)")),Tt=new Set,He=new Set,nr=e=>{let t=new Map,n=0,r={_instrumentationIsActive:false,_instrumentationSource:tt,checkDCE:er,hasUnsupportedRendererAttached:false,inject(o){let i=++n;return t.set(i,o),He.add(o),r._instrumentationIsActive||(r._instrumentationIsActive=true,Tt.forEach(s=>s())),i},on:et,onCommitFiberRoot:et,onCommitFiberUnmount:et,onPostCommitFiberRoot:et,renderers:t,supportsFiber:true,supportsFlight:true};try{Zn(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__",{configurable:!0,enumerable:!0,get(){return r},set(s){if(s&&typeof s=="object"){let a=r.renderers;r=s,a.size>0&&(a.forEach((l,f)=>{He.add(l),s.renderers.set(f,l);}),Ct(e));}}});let o=window.hasOwnProperty,i=!1;Zn(window,"hasOwnProperty",{configurable:!0,value:function(...s){try{if(!i&&s[0]==="__REACT_DEVTOOLS_GLOBAL_HOOK__")return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,i=!0,-0}catch{}return o.apply(this,s)},writable:!0});}catch{Ct(e);}return r},Ct=e=>{e&&Tt.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=er,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=tt,t._instrumentationIsActive=!1;let n=Yt(t);if(n||(t.on=et),t.renderers.size){t._instrumentationIsActive=!0,Tt.forEach(i=>i());return}let r=t.inject,o=St(t);o&&!n&&(tr=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=i=>{let s=r(i);return He.add(i),o&&t.renderers.set(s,i),t._instrumentationIsActive=!0,Tt.forEach(a=>a()),s};}(t.renderers.size||t._instrumentationIsActive||St())&&e?.();}catch{}},Gt=()=>Mo.call(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__"),Re=e=>Gt()?(Ct(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):nr(e),rr=()=>!!(typeof window<"u"&&(window.document?.createElement||window.navigator?.product==="ReactNative")),zt=()=>{try{rr()&&Re();}catch{}};zt();var xt=0,Et=1;var vt=5;var Rt=11,Ut=13,or=14,Nt=15,qt=16;var Xt=19;var _t=26,Ot=27,Wt=28,Kt=30;var Zt=e=>{switch(e.tag){case vt:case _t:case Ot:return true;default:return typeof e.type=="string"}},je=e=>{switch(e.tag){case Et:case Rt:case xt:case or:case Nt:return true;default:return false}};function ke(e,t,n=false){return e&&t(e)instanceof Promise?Qt(e,t,n):Jt(e,t,n)}var Jt=(e,t,n=false)=>{if(!e)return null;if(t(e)===true)return e;let r=n?e.return:e.child;for(;r;){let o=Jt(r,t,n);if(o)return o;r=n?null:r.sibling;}return null},Qt=async(e,t,n=false)=>{if(!e)return null;if(await t(e)===true)return e;let r=n?e.return:e.child;for(;r;){let o=await Qt(r,t,n);if(o)return o;r=n?null:r.sibling;}return null};var en=e=>{let t=e;return typeof t=="function"?t:typeof t=="object"&&t?en(t.type||t.render):null},Me=e=>{let t=e;if(typeof t=="string")return t;if(typeof t!="function"&&!(typeof t=="object"&&t))return null;let n=t.displayName||t.name||null;if(n)return n;let r=en(t);return r&&(r.displayName||r.name)||null};var tn=e=>{let t=e.alternate;if(!t)return e;if(t.actualStartTime&&e.actualStartTime)return t.actualStartTime>e.actualStartTime?t:e;for(let n of At){let r=ke(n.current,o=>{if(o===e)return true});if(r)return r}return e};var nn=e=>{let t=Re(e.onActive);t._instrumentationSource=e.name??tt;let n=t.onCommitFiberRoot;if(e.onCommitFiberRoot){let i=(s,a,l)=>{n!==i&&(n?.(s,a,l),e.onCommitFiberRoot?.(s,a,l));};t.onCommitFiberRoot=i;}let r=t.onCommitFiberUnmount;if(e.onCommitFiberUnmount){let i=(s,a)=>{t.onCommitFiberUnmount===i&&(r?.(s,a),e.onCommitFiberUnmount?.(s,a));};t.onCommitFiberUnmount=i;}let o=t.onPostCommitFiberRoot;if(e.onPostCommitFiberRoot){let i=(s,a)=>{t.onPostCommitFiberRoot===i&&(o?.(s,a),e.onPostCommitFiberRoot?.(s,a));};t.onPostCommitFiberRoot=i;}return t},Be=e=>{let t=Re();for(let n of t.renderers.values())try{let r=n.findFiberByHostInstance?.(e);if(r)return r}catch{}if(typeof e=="object"&&e){if("_reactRootContainer"in e)return e._reactRootContainer?._internalRoot?.current?.child;for(let n in e)if(n.startsWith("__reactContainer$")||n.startsWith("__reactInternalInstance$")||n.startsWith("__reactFiber"))return e[n]||null}return null},At=new Set;var Go=Object.create,dr=Object.defineProperty,zo=Object.getOwnPropertyDescriptor,Uo=Object.getOwnPropertyNames,qo=Object.getPrototypeOf,Xo=Object.prototype.hasOwnProperty,Wo=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ko=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=Uo(t),i=0,s=o.length,a;i<s;i++)a=o[i],!Xo.call(e,a)&&a!==n&&dr(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=zo(t,a))||r.enumerable});return e},Zo=(e,t,n)=>(n=e==null?{}:Go(qo(e)),Ko(dr(n,"default",{value:e,enumerable:true}),e)),Jo=()=>{let e=Re();for(let t of [...Array.from(He),...Array.from(e.renderers.values())]){let n=t.currentDispatcherRef;if(n&&typeof n=="object")return "H"in n?n.H:n.current}return null},ir=e=>{for(let t of He){let n=t.currentDispatcherRef;n&&typeof n=="object"&&("H"in n?n.H=e:n.current=e);}},Ne=e=>`
|
|
10
|
+
in ${e}`,Qo=(e,t)=>{let n=Ne(e);return t&&(n+=` (at ${t})`),n},rn=false,on=(e,t)=>{if(!e||rn)return "";let n=Error.prepareStackTrace;Error.prepareStackTrace=void 0,rn=true;let r=Jo();ir(null);let o=console.error,i=console.warn;console.error=()=>{},console.warn=()=>{};try{let l={DetermineComponentFrameRoot(){let x;try{if(t){let C=function(){throw Error()};if(Object.defineProperty(C.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(C,[]);}catch(T){x=T;}Reflect.construct(e,[],C);}else {try{C.call();}catch(T){x=T;}e.call(C.prototype);}}else {try{throw Error()}catch(T){x=T;}let C=e();C&&typeof C.catch=="function"&&C.catch(()=>{});}}catch(C){if(C instanceof Error&&x instanceof Error&&typeof C.stack=="string")return [C.stack,x.stack]}return [null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot",Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name")?.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});let[d,m]=l.DetermineComponentFrameRoot();if(d&&m){let x=d.split(`
|
|
11
11
|
`),C=m.split(`
|
|
12
|
-
`),
|
|
13
|
-
${x[
|
|
12
|
+
`),T=0,R=0;for(;T<x.length&&!x[T].includes("DetermineComponentFrameRoot");)T++;for(;R<C.length&&!C[R].includes("DetermineComponentFrameRoot");)R++;if(T===x.length||R===C.length)for(T=x.length-1,R=C.length-1;T>=1&&R>=0&&x[T]!==C[R];)R--;for(;T>=1&&R>=0;T--,R--)if(x[T]!==C[R]){if(T!==1||R!==1)do if(T--,R--,R<0||x[T]!==C[R]){let _=`
|
|
13
|
+
${x[T].replace(" at new "," at ")}`,O=Me(e);return O&&_.includes("<anonymous>")&&(_=_.replace("<anonymous>",O)),_}while(T>=1&&R>=0);break}}}finally{rn=false,Error.prepareStackTrace=n,ir(r),console.error=o,console.warn=i;}let s=e?Me(e):"";return s?Ne(s):""},ei=(e,t)=>{let n=e.tag,r="";switch(n){case Wt:r=Ne("Activity");break;case Et:r=on(e.type,true);break;case Rt:r=on(e.type.render,false);break;case xt:case Nt:r=on(e.type,false);break;case vt:case _t:case Ot:r=Ne(e.type);break;case qt:r=Ne("Lazy");break;case Ut:r=e.child!==t&&t!==null?Ne("Suspense Fallback"):Ne("Suspense");break;case Xt:r=Ne("SuspenseList");break;case Kt:r=Ne("ViewTransition");break;default:return ""}return r},ti=e=>{try{let t="",n=e,r=null;do{t+=ei(n,r);let o=n._debugInfo;if(o&&Array.isArray(o))for(let i=o.length-1;i>=0;i--){let s=o[i];typeof s.name=="string"&&(t+=Qo(s.name,s.env));}r=n,n=n.return;}while(n);return t}catch(t){return t instanceof Error?`
|
|
14
14
|
Error generating stack: ${t.message}
|
|
15
|
-
${t.stack}`:""}},
|
|
15
|
+
${t.stack}`:""}},ni=e=>{let t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;let n=e;if(!n)return "";Error.prepareStackTrace=t,n.startsWith(`Error: react-stack-top-frame
|
|
16
16
|
`)&&(n=n.slice(29));let r=n.indexOf(`
|
|
17
17
|
`);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(`
|
|
18
|
-
`,r)),r!==-1)n=n.slice(0,r);else return "";return n},
|
|
19
|
-
`),r=[];for(let o of n)if(/^\s*at\s+/.test(o)){let i=
|
|
20
|
-
`).filter(r=>!!r.match(
|
|
21
|
-
`).filter(r=>!r.match(
|
|
22
|
-
`),r;for(let i=n.length-1;i>=0&&!r;i--){let s=n[i].match(Jo);s&&(r=s[1]||s[2]);}if(!r)return null;let o=fr.test(r);if(!(Zo.test(r)||o||r.startsWith("/"))){let i=e.split("/");i[i.length-1]=r,r=i.join("/");}return r},ni=e=>({file:e.file,mappings:(0, ur.decode)(e.mappings),names:e.names,sourceRoot:e.sourceRoot,sources:e.sources,sourcesContent:e.sourcesContent,version:3}),ri=e=>{let t=e.sections.map(({map:r,offset:o})=>({map:{...r,mappings:(0, ur.decode)(r.mappings)},offset:o})),n=new Set;for(let r of t)for(let o of r.map.sources)n.add(o);return {file:e.file,mappings:[],names:[],sections:t,sourceRoot:void 0,sources:Array.from(n),sourcesContent:void 0,version:3}},rr=e=>{if(!e)return false;let t=e.trim();if(!t)return false;let n=t.match(fr);if(!n)return true;let r=n[0].toLowerCase();return r==="http:"||r==="https:"},oi=async(e,t=fetch)=>{if(!rr(e))return null;let n;try{n=await(await t(e)).text();}catch{return null}if(!n)return null;let r=ti(e,n);if(!r||!rr(r))return null;try{let o=await t(r),i=await o.json();return "sections"in i?ri(i):ni(i)}catch{return null}},ii=async(e,t=true,n)=>{if(t&&Ze.has(e)){let i=Ze.get(e);if(i==null)return null;if(Qo(i)){let s=i.deref();if(s)return s;Ze.delete(e);}else return i}if(t&&Nt.has(e))return Nt.get(e);let r=oi(e,n);t&&Nt.set(e,r);let o=await r;return t&&Nt.delete(e),t&&(o===null?Ze.set(e,null):Ze.set(e,dr?new WeakRef(o):o)),o},or=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,si=["rsc://","file:///","webpack://","node:","turbopack://","metro://"],ir="about://React/",ai=["<anonymous>","eval",""],li=/\.(jsx|tsx|ts|js)$/,ci=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,ui=/^\?[\w~.\-]+(?:=[^&#]*)?(?:&[\w~.\-]+(?:=[^&#]*)?)*$/,fi=e=>e._debugStack instanceof Error&&typeof e._debugStack?.stack=="string",di=e=>{let t=e._debugSource;return t?typeof t=="object"&&!!t&&"fileName"in t&&typeof t.fileName=="string"&&"lineNumber"in t&&typeof t.lineNumber=="number":false},mi=async(e,t=true,n)=>{if(di(e))return e._debugSource||null;let r=mr(e);return hr(r,void 0,t,n)},mr=e=>fi(e)?qo(e._debugStack.stack):Uo(e),hi=async(e,t=true,n)=>{let r=await hr(e,1,t,n);return !r||r.length===0?null:r[0]},hr=async(e,t=1,n=true,r)=>{let o=lr(e,{slice:t??1}),i=[];for(let s of o){if(!s?.file)continue;let a=await ii(s.file,n,r);if(a&&typeof s.line=="number"&&typeof s.col=="number"){let l=ei(a,s.line,s.col);if(l){i.push(l);continue}}i.push({fileName:s.file,lineNumber:s.line,columnNumber:s.col,functionName:s.function});}return i},Ye=e=>{if(!e||ai.includes(e))return "";let t=e;if(t.startsWith(ir)){let r=t.slice(ir.length),o=r.indexOf("/"),i=r.indexOf(":");t=o!==-1&&(i===-1||o<i)?r.slice(o+1):r;}for(let r of si)if(t.startsWith(r)){t=t.slice(r.length),r==="file:///"&&(t=`/${t.replace(/^\/+/,"")}`);break}if(or.test(t)){let r=t.match(or);r&&(t=t.slice(r[0].length));}let n=t.indexOf("?");if(n!==-1){let r=t.slice(n);ui.test(r)&&(t=t.slice(0,n));}return t},tn=e=>{let t=Ye(e);return !(!t||!li.test(t)||ci.test(t))},gi=async(e,t=true,n)=>{let r=$e(e,s=>{if(De(s))return true},true);if(r){let s=await mi(r,t,n);if(s?.fileName){let a=Ye(s.fileName);if(tn(a))return {fileName:a,lineNumber:s.lineNumber,columnNumber:s.columnNumber,functionName:s.functionName}}}let o=lr(mr(e),{includeInElement:false}),i=null;for(;o.length;){let s=o.pop();if(!s||!s.raw||!s.file)continue;let a=await hi(s.raw,t,n);if(a)return {fileName:Ye(a.fileName),lineNumber:a.lineNumber,columnNumber:a.columnNumber,functionName:a.functionName};i={fileName:Ye(s.file),lineNumber:s.line,columnNumber:s.col,functionName:s.function};}return i},gr=async(e,t=true,n)=>{let r=He(e);if(!r||!Ut(r))return null;let o=Kt(r);return o?gi(o,t,n):null};var pi=new Set(["role","name","aria-label","rel","href"]);function bi(e,t){let n=pi.has(e);n||=e.startsWith("data-")&&Je(e);let r=Je(t)&&t.length<100;return r||=t.startsWith("#")&&Je(t.slice(1)),n&&r}function yi(e){return Je(e)}function wi(e){return Je(e)}function Si(e){return true}function br(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(e.tagName.toLowerCase()==="html")return "html";let n={root:document.body,idName:yi,className:wi,tagName:Si,attr:bi,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},r=new Date,o={...n,...t},i=Ei(o.root,n),s,a=0;for(let f of Ti(e,o,i)){if(new Date().getTime()-r.getTime()>o.timeoutMs||a>=o.maxNumberOfPathChecks){let m=xi(e,i);if(!m)throw new Error(`Timeout: Can't find a unique selector after ${o.timeoutMs}ms`);return Qe(m)}if(a++,on(f,i)){s=f;break}}if(!s)throw new Error("Selector was not found.");let l=[...Sr(s,e,o,i,r)];return l.sort(nn),l.length>0?Qe(l[0]):Qe(s)}function*Ti(e,t,n){let r=[],o=[],i=e,s=0;for(;i&&i!==n;){let a=Ci(i,t);for(let l of a)l.level=s;if(r.push(a),i=i.parentElement,s++,o.push(...wr(r)),s>=t.seedMinLength){o.sort(nn);for(let l of o)yield l;o=[];}}o.sort(nn);for(let a of o)yield a;}function Je(e){if(/^[a-z\-]{3,}$/i.test(e)){let t=e.split(/-|[A-Z]/);for(let n of t)if(n.length<=2||/[^aeiou]{4,}/i.test(n))return false;return true}return false}function Ci(e,t){let n=[],r=e.getAttribute("id");r&&t.idName(r)&&n.push({name:"#"+CSS.escape(r),penalty:0});for(let s=0;s<e.classList.length;s++){let a=e.classList[s];t.className(a)&&n.push({name:"."+CSS.escape(a),penalty:1});}for(let s=0;s<e.attributes.length;s++){let a=e.attributes[s];t.attr(a.name,a.value)&&n.push({name:`[${CSS.escape(a.name)}="${CSS.escape(a.value)}"]`,penalty:2});}let o=e.tagName.toLowerCase();if(t.tagName(o)){n.push({name:o,penalty:5});let s=rn(e,o);s!==void 0&&n.push({name:yr(o,s),penalty:10});}let i=rn(e);return i!==void 0&&n.push({name:vi(o,i),penalty:50}),n}function Qe(e){let t=e[0],n=t.name;for(let r=1;r<e.length;r++){let o=e[r].level||0;t.level===o-1?n=`${e[r].name} > ${n}`:n=`${e[r].name} ${n}`,t=e[r];}return n}function pr(e){return e.map(t=>t.penalty).reduce((t,n)=>t+n,0)}function nn(e,t){return pr(e)-pr(t)}function rn(e,t){let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let o=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&(t===void 0||r.tagName.toLowerCase()===t)&&o++,r!==e);)r=r.nextSibling;return o}function xi(e,t){let n=0,r=e,o=[];for(;r&&r!==t;){let i=r.tagName.toLowerCase(),s=rn(r,i);if(s===void 0)return;o.push({name:yr(i,s),penalty:NaN,level:n}),r=r.parentElement,n++;}if(on(o,t))return o}function vi(e,t){return e==="html"?"html":`${e}:nth-child(${t})`}function yr(e,t){return e==="html"?"html":`${e}:nth-of-type(${t})`}function*wr(e,t=[]){if(e.length>0)for(let n of e[0])yield*wr(e.slice(1,e.length),t.concat(n));else yield t;}function Ei(e,t){return e.nodeType===Node.DOCUMENT_NODE?e:e===t.root?e.ownerDocument:e}function on(e,t){let n=Qe(e);switch(t.querySelectorAll(n).length){case 0:throw new Error(`Can't select any node with this selector: ${n}`);case 1:return true;default:return false}}function*Sr(e,t,n,r,o){if(e.length>2&&e.length>n.optimizedMinLength)for(let i=1;i<e.length-1;i++){if(new Date().getTime()-o.getTime()>n.timeoutMs)return;let a=[...e];a.splice(i,1),on(a,r)&&r.querySelector(Qe(a))===t&&(yield a,yield*Sr(a,t,n,r,o));}}var Ot=e=>e.length>0&&/^[A-Z]/.test(e);Zt({onCommitFiberRoot(e,t){Rt.add(t);}});var Ri=e=>br(e),_t=(e,t)=>e.length>t?`${e.substring(0,t)}...`:e,Ni=e=>!Ot(e)||e.startsWith("_")||e.includes("Provider")&&e.includes("Context"),Tr=e=>{let t=He(e);if(!t)return null;let n=null;return $e(t,r=>{if(De(r)){let o=ke(r);if(o&&!Ni(o))return n=o,true}return false},true),n},Cr=async e=>{let t=await gr(e);if(!t)return null;let n=Ye(t.fileName);return tn(n)?`${n}:${t.lineNumber}:${t.columnNumber}`:null},sn=async e=>{let t=new Set(["article","aside","footer","form","header","main","nav","section"]),n=y=>{let _=y.tagName.toLowerCase();if(t.has(_)||y.id)return true;if(y.className&&typeof y.className=="string"){let H=y.className.trim();if(H&&H.length>0)return true}return Array.from(y.attributes).some(H=>H.name.startsWith("data-"))},r=(y,_=10)=>{let H=[],h=y.parentElement,g=0;for(;h&&g<_&&h.tagName!=="BODY"&&!(n(h)&&(H.push(h),H.length>=3));)h=h.parentElement,g++;return H.reverse()},o=(y,_=false)=>{let H=y.tagName.toLowerCase(),h=[];if(y.id&&h.push(`id="${y.id}"`),y.className&&typeof y.className=="string"){let v=y.className.trim().split(/\s+/);if(v.length>0&&v[0]){let M=_?v.slice(0,3):v,B=_t(M.join(" "),30);h.push(`class="${B}"`);}}let g=Array.from(y.attributes).filter(v=>v.name.startsWith("data-")),c=_?g.slice(0,1):g;for(let v of c)h.push(`${v.name}="${_t(v.value,20)}"`);let b=y.getAttribute("aria-label");return b&&!_&&h.push(`aria-label="${_t(b,20)}"`),h.length>0?`<${H} ${h.join(" ")}>`:`<${H}>`},i=y=>`</${y.tagName.toLowerCase()}>`,s=y=>{let _=(y.textContent||"").trim().replace(/\s+/g," ");return _t(_,60)},a=y=>{if(y.id)return `#${y.id}`;if(y.className&&typeof y.className=="string"){let _=y.className.trim().split(/\s+/);if(_.length>0&&_[0])return `.${_[0]}`}return null},l=[],f=Ri(e);l.push(`- selector: ${f}`);let d=e.getBoundingClientRect();l.push(`- width: ${Math.round(d.width)}`),l.push(`- height: ${Math.round(d.height)}`),l.push("HTML snippet:"),l.push("```html");let m=r(e),x=m.map(y=>Tr(y)),C=Tr(e),w=await Promise.all(m.map(y=>Cr(y))),E=await Cr(e);for(let y=0;y<m.length;y++){let _=" ".repeat(y),H=x[y],h=w[y];H&&h&&(y===0||x[y-1]!==H)&&l.push(`${_}<${H} source="${h}">`),l.push(`${_}${o(m[y],true)}`);}let O=e.parentElement,N=-1;if(O){let y=Array.from(O.children);if(N=y.indexOf(e),N>0){let _=y[N-1];if(a(_)&&N<=2){let h=" ".repeat(m.length);l.push(`${h} ${o(_,true)}`),l.push(`${h} </${_.tagName.toLowerCase()}>`);}else if(N>0){let h=" ".repeat(m.length);l.push(`${h} ... (${N} element${N===1?"":"s"})`);}}}let S=" ".repeat(m.length),$=m.length>0?x[x.length-1]:null,R=C&&E&&C!==$;R&&l.push(`${S} <${C} used-at="${E}">`),l.push(`${S} <!-- IMPORTANT: selected element -->`);let P=s(e),z=e.children.length,K=`${S}${R?" ":" "}`;if(P&&z===0&&P.length<40?l.push(`${K}${o(e)}${P}${i(e)}`):(l.push(`${K}${o(e)}`),P&&l.push(`${K} ${P}`),z>0&&l.push(`${K} ... (${z} element${z===1?"":"s"})`),l.push(`${K}${i(e)}`)),R&&l.push(`${S} </${C}>`),O&&N>=0){let y=Array.from(O.children),_=y.length-N-1;if(_>0){let H=y[N+1];a(H)&&_<=2?(l.push(`${S} ${o(H,true)}`),l.push(`${S} </${H.tagName.toLowerCase()}>`)):l.push(`${S} ... (${_} element${_===1?"":"s"})`);}}for(let y=m.length-1;y>=0;y--){let _=" ".repeat(y);l.push(`${_}${i(m[y])}`);let H=x[y],h=w[y];H&&h&&(y===m.length-1||x[y+1]!==H)&&l.push(`${_}</${H}>`);}return l.push("```"),l.join(`
|
|
23
|
-
`)};var
|
|
24
|
-
${u}
|
|
25
|
-
</selected_element>`,nt=u=>{let T=window.getComputedStyle(u),A=u.getBoundingClientRect();return {width:`${Math.round(A.width)}px`,height:`${Math.round(A.height)}px`,paddingTop:T.paddingTop,paddingRight:T.paddingRight,paddingBottom:T.paddingBottom,paddingLeft:T.paddingLeft,background:T.background,opacity:T.opacity}},un=u=>{let T={elements:u.map(W=>({tagName:W.tagName,content:W.content,computedStyles:W.computedStyles}))},Y=`<div data-react-grab="${btoa(JSON.stringify(T))}"></div>`;return new Blob([Y],{type:"text/html"})},rt=u=>(u.tagName||"").toLowerCase(),Fr=u=>{let T=He(u);if(!T)return null;let A=null;return $e(T,Y=>{if(De(Y)){let W=ke(Y);if(W&&Ot(W)&&!W.startsWith("_"))return A=W,true}return false},true),A},fn=u=>{let T=rt(u),A=Fr(u);return T&&A?`<${T}> in ${A}`:T?`<${T}>`:"<element>"},dn=u=>{try{let T=u.map(A=>({tagName:rt(A)}));window.dispatchEvent(new CustomEvent("react-grab:element-selected",{detail:{elements:T}}));}catch{}},At=async(u,T,A)=>{Z(u),V(T),N(true),Lr(),await A().finally(()=>{N(false),it();});},$r=async u=>{xe(cn(u)),await new Promise(T=>requestAnimationFrame(T));try{let T=await sn(u),A=tt(T),Y=un([{tagName:rt(u),content:T,computedStyles:nt(u)}]);await an([A,Y]);}catch{}Ne(fn(u),D(),j()),dn([u]);},mn=async u=>{if(u.length!==0){for(let T of u)xe(cn(T));await new Promise(T=>requestAnimationFrame(T));try{let T=await Promise.all(u.map(oe=>sn(oe))),A=T.filter(oe=>oe.trim()).map(oe=>tt(oe)).join(`
|
|
18
|
+
`,r)),r!==-1)n=n.slice(0,r);else return "";return n},ri=/(^|@)\S+:\d+/,mr=/^\s*at .*(\S+:\d+|\(native\))/m,oi=/^(eval@)?(\[native code\])?$/;var hr=(e,t)=>{if(t?.includeInElement!==false){let n=e.split(`
|
|
19
|
+
`),r=[];for(let o of n)if(/^\s*at\s+/.test(o)){let i=sr(o,void 0)[0];i&&r.push(i);}else if(/^\s*in\s+/.test(o)){let i=o.replace(/^\s*in\s+/,"").replace(/\s*\(at .*\)$/,"");r.push({function:i,raw:o});}else if(o.match(ri)){let i=ar(o,void 0)[0];i&&r.push(i);}return sn(r,t)}return e.match(mr)?sr(e,t):ar(e,t)},gr=e=>{if(!e.includes(":"))return [e,void 0,void 0];let t=/(.+?)(?::(\d+))?(?::(\d+))?$/,n=t.exec(e.replace(/[()]/g,""));return [n[1],n[2]||void 0,n[3]||void 0]},sn=(e,t)=>t&&t.slice!=null?Array.isArray(t.slice)?e.slice(t.slice[0],t.slice[1]):e.slice(0,t.slice):e;var sr=(e,t)=>sn(e.split(`
|
|
20
|
+
`).filter(r=>!!r.match(mr)),t).map(r=>{let o=r;o.includes("(eval ")&&(o=o.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));let i=o.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),s=i.match(/ (\(.+\)$)/);i=s?i.replace(s[0],""):i;let a=gr(s?s[1]:i),l=s&&i||void 0,f=["eval","<anonymous>"].includes(a[0])?void 0:a[0];return {function:l,file:f,line:a[1]?+a[1]:void 0,col:a[2]?+a[2]:void 0,raw:o}});var ar=(e,t)=>sn(e.split(`
|
|
21
|
+
`).filter(r=>!r.match(oi)),t).map(r=>{let o=r;if(o.includes(" > eval")&&(o=o.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),!o.includes("@")&&!o.includes(":"))return {function:o};{let i=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,s=o.match(i),a=s&&s[1]?s[1]:void 0,l=gr(o.replace(i,""));return {function:a,file:l[0],line:l[1]?+l[1]:void 0,col:l[2]?+l[2]:void 0,raw:o}}});var ii=Wo((e,t)=>{(function(n,r){typeof e=="object"&&t!==void 0?r(e):typeof define=="function"&&define.amd?define(["exports"],r):(n=typeof globalThis<"u"?globalThis:n||self,r(n.sourcemapCodec={}));})(void 0,function(n){let r=44,o=59,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=new Uint8Array(64),a=new Uint8Array(128);for(let h=0;h<i.length;h++){let g=i.charCodeAt(h);s[h]=g,a[g]=h;}function l(h,g){let u=0,b=0,v=0;do{let j=h.next();v=a[j],u|=(v&31)<<b,b+=5;}while(v&32);let M=u&1;return u>>>=1,M&&(u=-2147483648|-u),g+u}function f(h,g,u){let b=g-u;b=b<0?-b<<1|1:b<<1;do{let v=b&31;b>>>=5,b>0&&(v|=32),h.write(s[v]);}while(b>0);return g}function d(h,g){return h.pos>=g?false:h.peek()!==r}let m=1024*16,x=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(h){return Buffer.from(h.buffer,h.byteOffset,h.byteLength).toString()}}:{decode(h){let g="";for(let u=0;u<h.length;u++)g+=String.fromCharCode(h[u]);return g}};class C{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(m);}write(g){let{buffer:u}=this;u[this.pos++]=g,this.pos===m&&(this.out+=x.decode(u),this.pos=0);}flush(){let{buffer:g,out:u,pos:b}=this;return b>0?u+x.decode(g.subarray(0,b)):u}}class T{constructor(g){this.pos=0,this.buffer=g;}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(g){let{buffer:u,pos:b}=this,v=u.indexOf(g,b);return v===-1?u.length:v}}let R=[];function _(h){let{length:g}=h,u=new T(h),b=[],v=[],M=0;for(;u.pos<g;u.pos++){M=l(u,M);let j=l(u,0);if(!d(u,g)){let X=v.pop();X[2]=M,X[3]=j;continue}let B=l(u,0),Z=l(u,0),U=Z&1,V=U?[M,j,0,0,B,l(u,0)]:[M,j,0,0,B],Q=R;if(d(u,g)){Q=[];do{let X=l(u,0);Q.push(X);}while(d(u,g))}V.vars=Q,b.push(V),v.push(V);}return b}function O(h){let g=new C;for(let u=0;u<h.length;)u=S(h,u,g,[0]);return g.flush()}function S(h,g,u,b){let v=h[g],{0:M,1:j,2:B,3:Z,4:U,vars:V}=v;g>0&&u.write(r),b[0]=f(u,M,b[0]),f(u,j,0),f(u,U,0);let Q=v.length===6?1:0;f(u,Q,0),v.length===6&&f(u,v[5],0);for(let X of V)f(u,X,0);for(g++;g<h.length;){let X=h[g],{0:F,1:W}=X;if(F>B||F===B&&W>=Z)break;g=S(h,g,u,b);}return u.write(r),b[0]=f(u,B,b[0]),f(u,Z,0),g}function $(h){let{length:g}=h,u=new T(h),b=[],v=[],M=0,j=0,B=0,Z=0,U=0,V=0,Q=0,X=0;do{let F=u.indexOf(";"),W=0;for(;u.pos<F;u.pos++){if(W=l(u,W),!d(u,F)){let le=v.pop();le[2]=M,le[3]=W;continue}let re=l(u,0),de=re&1,ne=re&2,ce=re&4,Ce=null,ye=R,xe;if(de){let le=l(u,j);B=l(u,j===le?B:0),j=le,xe=[M,W,0,0,le,B];}else xe=[M,W,0,0];if(xe.isScope=!!ce,ne){let le=Z,Ee=U;Z=l(u,Z);let Oe=le===Z;U=l(u,Oe?U:0),V=l(u,Oe&&Ee===U?V:0),Ce=[Z,U,V];}if(xe.callsite=Ce,d(u,F)){ye=[];do{Q=M,X=W;let le=l(u,0),Ee;if(le<-1){Ee=[[l(u,0)]];for(let Oe=-1;Oe>le;Oe--){let st=Q;Q=l(u,Q),X=l(u,Q===st?X:0);let at=l(u,0);Ee.push([at,Q,X]);}}else Ee=[[le]];ye.push(Ee);}while(d(u,F))}xe.bindings=ye,b.push(xe),v.push(xe);}M++,u.pos=F+1;}while(u.pos<g);return b}function N(h){if(h.length===0)return "";let g=new C;for(let u=0;u<h.length;)u=P(h,u,g,[0,0,0,0,0,0,0]);return g.flush()}function P(h,g,u,b){let v=h[g],{0:M,1:j,2:B,3:Z,isScope:U,callsite:V,bindings:Q}=v;b[0]<M?(z(u,b[0],M),b[0]=M,b[1]=0):g>0&&u.write(r),b[1]=f(u,v[1],b[1]);let X=(v.length===6?1:0)|(V?2:0)|(U?4:0);if(f(u,X,0),v.length===6){let{4:F,5:W}=v;F!==b[2]&&(b[3]=0),b[2]=f(u,F,b[2]),b[3]=f(u,W,b[3]);}if(V){let{0:F,1:W,2:re}=v.callsite;F===b[4]?W!==b[5]&&(b[6]=0):(b[5]=0,b[6]=0),b[4]=f(u,F,b[4]),b[5]=f(u,W,b[5]),b[6]=f(u,re,b[6]);}if(Q)for(let F of Q){F.length>1&&f(u,-F.length,0);let W=F[0][0];f(u,W,0);let re=M,de=j;for(let ne=1;ne<F.length;ne++){let ce=F[ne];re=f(u,ce[1],re),de=f(u,ce[2],de),f(u,ce[0],0);}}for(g++;g<h.length;){let F=h[g],{0:W,1:re}=F;if(W>B||W===B&&re>=Z)break;g=P(h,g,u,b);}return b[0]<B?(z(u,b[0],B),b[0]=B,b[1]=0):u.write(r),b[1]=f(u,Z,b[1]),g}function z(h,g,u){do h.write(o);while(++g<u)}function K(h){let{length:g}=h,u=new T(h),b=[],v=0,M=0,j=0,B=0,Z=0;do{let U=u.indexOf(";"),V=[],Q=true,X=0;for(v=0;u.pos<U;){let F;v=l(u,v),v<X&&(Q=false),X=v,d(u,U)?(M=l(u,M),j=l(u,j),B=l(u,B),d(u,U)?(Z=l(u,Z),F=[v,M,j,B,Z]):F=[v,M,j,B]):F=[v],V.push(F),u.pos++;}Q||y(V),b.push(V),u.pos=U+1;}while(u.pos<=g);return b}function y(h){h.sort(A);}function A(h,g){return h[0]-g[0]}function L(h){let g=new C,u=0,b=0,v=0,M=0;for(let j=0;j<h.length;j++){let B=h[j];if(j>0&&g.write(o),B.length===0)continue;let Z=0;for(let U=0;U<B.length;U++){let V=B[U];U>0&&g.write(r),Z=f(g,V[0],Z),V.length!==1&&(u=f(g,V[1],u),b=f(g,V[2],b),v=f(g,V[3],v),V.length!==4&&(M=f(g,V[4],M)));}}return g.flush()}n.decode=K,n.decodeGeneratedRanges=$,n.decodeOriginalScopes=_,n.encode=L,n.encodeGeneratedRanges=N,n.encodeOriginalScopes=O,Object.defineProperty(n,"__esModule",{value:true});});}),pr=Zo(ii()),br=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,si=/^data:application\/json[^,]+base64,/,ai=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/,yr=typeof WeakRef<"u",nt=new Map,Ft=new Map,li=e=>yr&&e instanceof WeakRef,lr=(e,t,n,r)=>{if(n<0||n>=e.length)return null;let o=e[n];if(!o||o.length===0)return null;let i=null;for(let d of o)if(d[0]<=r)i=d;else break;if(!i||i.length<4)return null;let[,s,a,l]=i;if(s===void 0||a===void 0||l===void 0)return null;let f=t[s];return f?{columnNumber:l,fileName:f,lineNumber:a+1}:null},ci=(e,t,n)=>{if(e.sections){let r=null;for(let s of e.sections)if(t>s.offset.line||t===s.offset.line&&n>=s.offset.column)r=s;else break;if(!r)return null;let o=t-r.offset.line,i=t===r.offset.line?n-r.offset.column:n;return lr(r.map.mappings,r.map.sources,o,i)}return lr(e.mappings,e.sources,t-1,n)},ui=(e,t)=>{let n=t.split(`
|
|
22
|
+
`),r;for(let i=n.length-1;i>=0&&!r;i--){let s=n[i].match(ai);s&&(r=s[1]||s[2]);}if(!r)return null;let o=br.test(r);if(!(si.test(r)||o||r.startsWith("/"))){let i=e.split("/");i[i.length-1]=r,r=i.join("/");}return r},fi=e=>({file:e.file,mappings:(0, pr.decode)(e.mappings),names:e.names,sourceRoot:e.sourceRoot,sources:e.sources,sourcesContent:e.sourcesContent,version:3}),di=e=>{let t=e.sections.map(({map:r,offset:o})=>({map:{...r,mappings:(0, pr.decode)(r.mappings)},offset:o})),n=new Set;for(let r of t)for(let o of r.map.sources)n.add(o);return {file:e.file,mappings:[],names:[],sections:t,sourceRoot:void 0,sources:Array.from(n),sourcesContent:void 0,version:3}},cr=e=>{if(!e)return false;let t=e.trim();if(!t)return false;let n=t.match(br);if(!n)return true;let r=n[0].toLowerCase();return r==="http:"||r==="https:"},mi=async(e,t=fetch)=>{if(!cr(e))return null;let n;try{n=await(await t(e)).text();}catch{return null}if(!n)return null;let r=ui(e,n);if(!r||!cr(r))return null;try{let o=await t(r),i=await o.json();return "sections"in i?di(i):fi(i)}catch{return null}},hi=async(e,t=true,n)=>{if(t&&nt.has(e)){let i=nt.get(e);if(i==null)return null;if(li(i)){let s=i.deref();if(s)return s;nt.delete(e);}else return i}if(t&&Ft.has(e))return Ft.get(e);let r=mi(e,n);t&&Ft.set(e,r);let o=await r;return t&&Ft.delete(e),t&&(o===null?nt.set(e,null):nt.set(e,yr?new WeakRef(o):o)),o},ur=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,gi=["rsc://","file:///","webpack://","node:","turbopack://","metro://"],fr="about://React/",pi=["<anonymous>","eval",""],bi=/\.(jsx|tsx|ts|js)$/,yi=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,wi=/^\?[\w~.\-]+(?:=[^&#]*)?(?:&[\w~.\-]+(?:=[^&#]*)?)*$/,Ti=e=>e._debugStack instanceof Error&&typeof e._debugStack?.stack=="string",Si=e=>{let t=e._debugSource;return t?typeof t=="object"&&!!t&&"fileName"in t&&typeof t.fileName=="string"&&"lineNumber"in t&&typeof t.lineNumber=="number":false},Ci=async(e,t=true,n)=>{if(Si(e))return e._debugSource||null;let r=wr(e);return Tr(r,void 0,t,n)},wr=e=>Ti(e)?ni(e._debugStack.stack):ti(e),xi=async(e,t=true,n)=>{let r=await Tr(e,1,t,n);return !r||r.length===0?null:r[0]},Tr=async(e,t=1,n=true,r)=>{let o=hr(e,{slice:t??1}),i=[];for(let s of o){if(!s?.file)continue;let a=await hi(s.file,n,r);if(a&&typeof s.line=="number"&&typeof s.col=="number"){let l=ci(a,s.line,s.col);if(l){i.push(l);continue}}i.push({fileName:s.file,lineNumber:s.line,columnNumber:s.col,functionName:s.function});}return i},qe=e=>{if(!e||pi.includes(e))return "";let t=e;if(t.startsWith(fr)){let r=t.slice(fr.length),o=r.indexOf("/"),i=r.indexOf(":");t=o!==-1&&(i===-1||o<i)?r.slice(o+1):r;}for(let r of gi)if(t.startsWith(r)){t=t.slice(r.length),r==="file:///"&&(t=`/${t.replace(/^\/+/,"")}`);break}if(ur.test(t)){let r=t.match(ur);r&&(t=t.slice(r[0].length));}let n=t.indexOf("?");if(n!==-1){let r=t.slice(n);wi.test(r)&&(t=t.slice(0,n));}return t},an=e=>{let t=qe(e);return !(!t||!bi.test(t)||yi.test(t))},Ei=async(e,t=true,n)=>{let r=ke(e,s=>{if(je(s))return true},true);if(r){let s=await Ci(r,t,n);if(s?.fileName){let a=qe(s.fileName);if(an(a))return {fileName:a,lineNumber:s.lineNumber,columnNumber:s.columnNumber,functionName:s.functionName}}}let o=hr(wr(e),{includeInElement:false}),i=null;for(;o.length;){let s=o.pop();if(!s||!s.raw||!s.file)continue;let a=await xi(s.raw,t,n);if(a)return {fileName:qe(a.fileName),lineNumber:a.lineNumber,columnNumber:a.columnNumber,functionName:a.functionName};i={fileName:qe(s.file),lineNumber:s.line,columnNumber:s.col,functionName:s.function};}return i},Sr=async(e,t=true,n)=>{let r=Be(e);if(!r||!Zt(r))return null;let o=tn(r);return o?Ei(o,t,n):null};var vi=new Set(["role","name","aria-label","rel","href"]);function Ri(e,t){let n=vi.has(e);n||=e.startsWith("data-")&&rt(e);let r=rt(t)&&t.length<100;return r||=t.startsWith("#")&&rt(t.slice(1)),n&&r}function Ni(e){return rt(e)}function _i(e){return rt(e)}function Oi(e){return true}function xr(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(e.tagName.toLowerCase()==="html")return "html";let n={root:document.body,idName:Ni,className:_i,tagName:Oi,attr:Ri,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},r=new Date,o={...n,...t},i=ki(o.root,n),s,a=0;for(let f of Ai(e,o,i)){if(new Date().getTime()-r.getTime()>o.timeoutMs||a>=o.maxNumberOfPathChecks){let m=$i(e,i);if(!m)throw new Error(`Timeout: Can't find a unique selector after ${o.timeoutMs}ms`);return ot(m)}if(a++,un(f,i)){s=f;break}}if(!s)throw new Error("Selector was not found.");let l=[...Rr(s,e,o,i,r)];return l.sort(ln),l.length>0?ot(l[0]):ot(s)}function*Ai(e,t,n){let r=[],o=[],i=e,s=0;for(;i&&i!==n;){let a=Fi(i,t);for(let l of a)l.level=s;if(r.push(a),i=i.parentElement,s++,o.push(...vr(r)),s>=t.seedMinLength){o.sort(ln);for(let l of o)yield l;o=[];}}o.sort(ln);for(let a of o)yield a;}function rt(e){if(/^[a-z\-]{3,}$/i.test(e)){let t=e.split(/-|[A-Z]/);for(let n of t)if(n.length<=2||/[^aeiou]{4,}/i.test(n))return false;return true}return false}function Fi(e,t){let n=[],r=e.getAttribute("id");r&&t.idName(r)&&n.push({name:"#"+CSS.escape(r),penalty:0});for(let s=0;s<e.classList.length;s++){let a=e.classList[s];t.className(a)&&n.push({name:"."+CSS.escape(a),penalty:1});}for(let s=0;s<e.attributes.length;s++){let a=e.attributes[s];t.attr(a.name,a.value)&&n.push({name:`[${CSS.escape(a.name)}="${CSS.escape(a.value)}"]`,penalty:2});}let o=e.tagName.toLowerCase();if(t.tagName(o)){n.push({name:o,penalty:5});let s=cn(e,o);s!==void 0&&n.push({name:Er(o,s),penalty:10});}let i=cn(e);return i!==void 0&&n.push({name:Ii(o,i),penalty:50}),n}function ot(e){let t=e[0],n=t.name;for(let r=1;r<e.length;r++){let o=e[r].level||0;t.level===o-1?n=`${e[r].name} > ${n}`:n=`${e[r].name} ${n}`,t=e[r];}return n}function Cr(e){return e.map(t=>t.penalty).reduce((t,n)=>t+n,0)}function ln(e,t){return Cr(e)-Cr(t)}function cn(e,t){let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let o=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&(t===void 0||r.tagName.toLowerCase()===t)&&o++,r!==e);)r=r.nextSibling;return o}function $i(e,t){let n=0,r=e,o=[];for(;r&&r!==t;){let i=r.tagName.toLowerCase(),s=cn(r,i);if(s===void 0)return;o.push({name:Er(i,s),penalty:NaN,level:n}),r=r.parentElement,n++;}if(un(o,t))return o}function Ii(e,t){return e==="html"?"html":`${e}:nth-child(${t})`}function Er(e,t){return e==="html"?"html":`${e}:nth-of-type(${t})`}function*vr(e,t=[]){if(e.length>0)for(let n of e[0])yield*vr(e.slice(1,e.length),t.concat(n));else yield t;}function ki(e,t){return e.nodeType===Node.DOCUMENT_NODE?e:e===t.root?e.ownerDocument:e}function un(e,t){let n=ot(e);switch(t.querySelectorAll(n).length){case 0:throw new Error(`Can't select any node with this selector: ${n}`);case 1:return true;default:return false}}function*Rr(e,t,n,r,o){if(e.length>2&&e.length>n.optimizedMinLength)for(let i=1;i<e.length-1;i++){if(new Date().getTime()-o.getTime()>n.timeoutMs)return;let a=[...e];a.splice(i,1),un(a,r)&&r.querySelector(ot(a))===t&&(yield a,yield*Rr(a,t,n,r,o));}}var $t=e=>e.length>0&&/^[A-Z]/.test(e);nn({onCommitFiberRoot(e,t){At.add(t);}});var Mi=e=>xr(e),It=(e,t)=>e.length>t?`${e.substring(0,t)}...`:e,Pi=e=>!$t(e)||e.startsWith("_")||e.includes("Provider")&&e.includes("Context"),Nr=e=>{let t=Be(e);if(!t)return null;let n=null;return ke(t,r=>{if(je(r)){let o=Me(r);if(o&&!Pi(o))return n=o,true}return false},true),n},_r=async e=>{let t=await Sr(e);if(!t)return null;let n=qe(t.fileName);if(an(n))return `${n}:${t.lineNumber}:${t.columnNumber}`;if(n&&(n.includes(".tsx")||n.includes(".ts")||n.includes(".jsx")||n.includes(".js"))){let r=n.replace(/^webpack:\/\/_N_E\//,"").replace(/^webpack:\/\/\//,"").replace(/^webpack:\/\//,"").replace(/^\.\//,"");if(r&&!r.startsWith("node_modules")&&!r.includes(".next")&&!r.startsWith("webpack"))return `${r}:${t.lineNumber}:${t.columnNumber}`}return null},fn=async e=>{let t=new Set(["article","aside","footer","form","header","main","nav","section"]),n=y=>{let A=y.tagName.toLowerCase();if(t.has(A)||y.id)return true;if(y.className&&typeof y.className=="string"){let L=y.className.trim();if(L&&L.length>0)return true}return Array.from(y.attributes).some(L=>L.name.startsWith("data-"))},r=(y,A=10)=>{let L=[],h=y.parentElement,g=0;for(;h&&g<A&&h.tagName!=="BODY"&&!(n(h)&&(L.push(h),L.length>=3));)h=h.parentElement,g++;return L.reverse()},o=(y,A=false)=>{let L=y.tagName.toLowerCase(),h=[];if(y.id&&h.push(`id="${y.id}"`),y.className&&typeof y.className=="string"){let v=y.className.trim().split(/\s+/);if(v.length>0&&v[0]){let M=A?v.slice(0,3):v,j=It(M.join(" "),30);h.push(`class="${j}"`);}}let g=Array.from(y.attributes).filter(v=>v.name.startsWith("data-")),u=A?g.slice(0,1):g;for(let v of u)h.push(`${v.name}="${It(v.value,20)}"`);let b=y.getAttribute("aria-label");return b&&!A&&h.push(`aria-label="${It(b,20)}"`),h.length>0?`<${L} ${h.join(" ")}>`:`<${L}>`},i=y=>`</${y.tagName.toLowerCase()}>`,s=y=>{let A=(y.textContent||"").trim().replace(/\s+/g," ");return It(A,60)},a=y=>{if(y.id)return `#${y.id}`;if(y.className&&typeof y.className=="string"){let A=y.className.trim().split(/\s+/);if(A.length>0&&A[0])return `.${A[0]}`}return null},l=[],f=Mi(e);l.push(`- selector: ${f}`);let d=e.getBoundingClientRect();l.push(`- width: ${Math.round(d.width)}`),l.push(`- height: ${Math.round(d.height)}`),l.push("HTML snippet:"),l.push("```html");let m=r(e),x=m.map(y=>Nr(y)),C=Nr(e),T=await Promise.all(m.map(y=>_r(y))),R=await _r(e);for(let y=0;y<m.length;y++){let A=" ".repeat(y),L=x[y],h=T[y];L&&h&&(y===0||x[y-1]!==L)&&l.push(`${A}<${L} source="${h}">`),l.push(`${A}${o(m[y],true)}`);}let _=e.parentElement,O=-1;if(_){let y=Array.from(_.children);if(O=y.indexOf(e),O>0){let A=" ".repeat(m.length);if(O<=2)for(let L=0;L<O;L++){let h=y[L];a(h)&&(l.push(`${A} ${o(h,true)}`),l.push(`${A} </${h.tagName.toLowerCase()}>`));}else l.push(`${A} ... (${O} element${O===1?"":"s"})`);}}let S=" ".repeat(m.length),$=m.length>0?x[x.length-1]:null,N=C&&R&&C!==$;N&&l.push(`${S} <${C} used-at="${R}">`),l.push(`${S} <!-- IMPORTANT: selected element -->`);let P=s(e),z=e.children.length,K=`${S}${N?" ":" "}`;if(P&&z===0&&P.length<40?l.push(`${K}${o(e)}${P}${i(e)}`):(l.push(`${K}${o(e)}`),P&&l.push(`${K} ${P}`),z>0&&l.push(`${K} ... (${z} element${z===1?"":"s"})`),l.push(`${K}${i(e)}`)),N&&l.push(`${S} </${C}>`),_&&O>=0){let y=Array.from(_.children),A=y.length-O-1;if(A>0)if(A<=2)for(let L=O+1;L<y.length;L++){let h=y[L];a(h)&&(l.push(`${S} ${o(h,true)}`),l.push(`${S} </${h.tagName.toLowerCase()}>`));}else l.push(`${S} ... (${A} element${A===1?"":"s"})`);}for(let y=m.length-1;y>=0;y--){let A=" ".repeat(y);l.push(`${A}${i(m[y])}`);let L=x[y],h=T[y];L&&h&&(y===m.length-1||x[y+1]!==L)&&l.push(`${A}</${L}>`);}return l.push("```"),l.join(`
|
|
23
|
+
`)};var Li=()=>document.hasFocus()?new Promise(e=>setTimeout(e,50)):new Promise(e=>{let t=()=>{window.removeEventListener("focus",t),setTimeout(e,50);};window.addEventListener("focus",t),window.focus();}),_e=async(e,t)=>{await Li();try{if(Array.isArray(e)){if(!navigator?.clipboard?.write){for(let r of e)if(typeof r=="string"){let o=kt(r,t);if(!o)return o}return t?.(),!0}let n=new Map;for(let r of e)if(r instanceof Blob){let o=r.type||"text/plain";n.has(o)||n.set(o,r);}else n.has("text/plain")||n.set("text/plain",new Blob([r],{type:"text/plain"}));if(n.size===0){let r=e.find(o=>typeof o=="string");return typeof r=="string"?kt(r,t):!1}try{return await navigator.clipboard.write([new ClipboardItem(Object.fromEntries(n))]),t?.(),!0}catch{let r=e.filter(o=>typeof o=="string");if(r.length>0){let o=r.join(`
|
|
26
24
|
|
|
27
|
-
`)
|
|
25
|
+
`);return kt(o,t)}return !1}}else {if(e instanceof Blob)return await navigator.clipboard.write([new ClipboardItem({[e.type]:e})]),t?.(),!0;try{return await navigator.clipboard.writeText(String(e)),t?.(),!0}catch{return kt(e,t)}}}catch{return false}},kt=(e,t)=>{if(!document.execCommand)return false;let n=document.createElement("textarea");n.value=String(e),n.style.clipPath="inset(50%)",n.ariaHidden="true",(document.body||document.documentElement).append(n);try{n.select();let o=document.execCommand("copy");return o&&t?.(),o}finally{n.remove();}};var Se=()=>{try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createGain();t.connect(e.destination),[{freq:523.25,start:0,duration:.1},{freq:659.25,start:.05,duration:.1},{freq:783.99,start:.1,duration:.15}].forEach(r=>{let o=e.createOscillator(),i=e.createGain();o.connect(i),i.connect(t),o.frequency.value=r.freq,o.type="triangle";let s=e.currentTime+r.start,a=s+.01,l=s+r.duration;i.gain.setValueAtTime(0,s),i.gain.linearRampToValueAtTime(.15,a),i.gain.exponentialRampToValueAtTime(.01,l),o.start(s),o.stop(l);});}catch{}};var Or=(e,t=window.getComputedStyle(e))=>t.display!=="none"&&t.visibility!=="hidden"&&t.opacity!=="0";var it=e=>{if(e.closest(`[${Ue}]`))return false;let t=window.getComputedStyle(e);return !(!Or(e,t)||t.pointerEvents==="none")};var dn=(e,t)=>{let n=document.elementsFromPoint(e,t);for(let r of n)if(it(r))return r;return null};var Ar=(e,t,n)=>{let r=[],o=Array.from(document.querySelectorAll("*")),i=e.x,s=e.y,a=e.x+e.width,l=e.y+e.height;for(let f of o){if(!n){let R=(f.tagName||"").toUpperCase();if(R==="HTML"||R==="BODY")continue}if(!t(f))continue;let d=f.getBoundingClientRect(),m=d.left,x=d.top,C=d.left+d.width,T=d.top+d.height;if(n){let R=Math.max(i,m),_=Math.max(s,x),O=Math.min(a,C),S=Math.min(l,T),$=Math.max(0,O-R),N=Math.max(0,S-_),P=$*N,z=Math.max(0,d.width*d.height);z>0&&P/z>=.75&&r.push(f);}else m<a&&C>i&&x<l&&T>s&&r.push(f);}return r},Fr=e=>e.filter(t=>!e.some(n=>n!==t&&n.contains(t)));var $r=(e,t)=>{let n=Ar(e,t,true);return Fr(n)},Ir=(e,t)=>{let n=Ar(e,t,false);return Fr(n)};var mn=e=>{let t=e.getBoundingClientRect(),n=window.getComputedStyle(e);return {borderRadius:n.borderRadius||"0px",height:t.height,transform:n.transform||"none",width:t.width,x:t.left,y:t.top}};var kr=()=>{let e=window.location.hostname;return e==="localhost"||e==="127.0.0.1"||e==="[::1]"};var Di=150,Mr=e=>{let t={enabled:true,keyHoldDuration:300,allowActivationInsideInput:true,playCopySound:false,...e};return t.enabled===false?{activate:()=>{},deactivate:()=>{},toggle:()=>{},isActive:()=>false,dispose:()=>{}}:De(n=>{let[o,i]=I(false),[s,a]=I(-1e3),[l,f]=I(-1e3),[d,m]=I(false),[x,C]=I(-1e3),[T,R]=I(-1e3),[_,O]=I(false),[S,$]=I(null),[N,P]=I(null),[z,K]=I(0),[y,A]=I([]),[L,h]=I([]),[g,u]=I(false),[b,v]=I(false),[M,j]=I(false),[B,Z]=I(-1e3),[U,V]=I(-1e3),[Q,X]=I(false),F=null,W=null,re=null,de=null,ne=null,ce=-1e3,Ce=-1e3,ye=q(()=>g()&&!_()),xe=q(()=>s()>-1e3&&l()>-1e3),le=c=>(c.metaKey||c.ctrlKey)&&c.key.toLowerCase()==="c",Ee=c=>{let w=`grabbed-${Date.now()}-${Math.random()}`,E=Date.now(),Y={id:w,bounds:c,createdAt:E},H=y();A([...H,Y]),setTimeout(()=>{A(oe=>oe.filter(We=>We.id!==w));},1700);},Oe=c=>{let w=`success-${Date.now()}-${Math.random()}`;h(E=>[...E,{id:w,text:c}]),setTimeout(()=>{h(E=>E.filter(Y=>Y.id!==w));},1700);},st=c=>`<selected_element>
|
|
26
|
+
${c}
|
|
27
|
+
</selected_element>`,at=c=>{let w=window.getComputedStyle(c),E=c.getBoundingClientRect();return {width:`${Math.round(E.width)}px`,height:`${Math.round(E.height)}px`,paddingTop:w.paddingTop,paddingRight:w.paddingRight,paddingBottom:w.paddingBottom,paddingLeft:w.paddingLeft,background:w.background,opacity:w.opacity}},hn=c=>{let w={elements:c.map(oe=>({tagName:oe.tagName,content:oe.content,computedStyles:oe.computedStyles}))},E=JSON.stringify(w),H=`<div data-react-grab="${btoa(encodeURIComponent(E).replace(/%([0-9A-F]{2})/g,(oe,We)=>String.fromCharCode(parseInt(We,16))))}"></div>`;return new Blob([H],{type:"text/html"})},lt=c=>(c.tagName||"").toLowerCase(),Lr=c=>{let w=Be(c);if(!w)return null;let E=null;return ke(w,Y=>{if(je(Y)){let H=Me(Y);if(H&&$t(H)&&!H.startsWith("_"))return E=H,true}return false},true),E},gn=c=>{let w=lt(c),E=Lr(c);return w&&E?`<${w}> in ${E}`:w?`<${w}>`:"<element>"},pn=c=>{try{let w=c.map(E=>({tagName:lt(E)}));window.dispatchEvent(new CustomEvent("react-grab:element-selected",{detail:{elements:w}}));}catch{}},Dr=()=>window.__REACT_GRAB_EXTENSION_ACTIVE__===true||t.isExtension===true,bn=()=>Dr()&&!kr(),Mt=async(c,w,E)=>{Z(c),V(w),O(true),Ur(),await E().finally(()=>{O(false),ut();});},Hr=c=>"innerText"in c,jr=c=>Hr(c)?c.innerText:c.textContent??"",Ve=c=>c.map(w=>jr(w).trim()).filter(w=>w.length>0).join(`
|
|
28
|
+
|
|
29
|
+
`),Br=async c=>{Ee(mn(c)),await new Promise(E=>requestAnimationFrame(E));let w=false;try{if(bn()){let E=Ve([c]);E.length>0&&(w=await _e(E,t.playCopySound?Se:void 0));}else {let E=await fn(c),Y=st(E),H=hn([{tagName:lt(c),content:E,computedStyles:at(c)}]);if(w=await _e([Y,H],t.playCopySound?Se:void 0),!w){let oe=Ve([c]);oe.length>0&&(w=await _e(oe,t.playCopySound?Se:void 0));}}}catch{let E=Ve([c]);E.length>0&&(w=await _e(E,t.playCopySound?Se:void 0));}w&&Oe(gn(c)),pn([c]);},yn=async c=>{if(c.length===0)return;for(let E of c)Ee(mn(E));await new Promise(E=>requestAnimationFrame(E));let w=false;try{if(bn()){let E=Ve(c);E.length>0&&(w=await _e(E,t.playCopySound?Se:void 0));}else {let Y=(await Promise.allSettled(c.map(H=>fn(H)))).map(H=>H.status==="fulfilled"?H.value:"").filter(H=>H.trim());if(Y.length>0){let H=Y.map(Ye=>st(Ye)).join(`
|
|
30
|
+
|
|
31
|
+
`),oe=Y.map((Ye,Rn)=>({tagName:lt(c[Rn]),content:Ye,computedStyles:at(c[Rn])})),We=hn(oe);if(w=await _e([H,We],t.playCopySound?Se:void 0),!w){let Ye=Ve(c);Ye.length>0&&(w=await _e(Ye,t.playCopySound?Se:void 0));}}else {let H=Ve(c);H.length>0&&(w=await _e(H,t.playCopySound?Se:void 0));}}}catch{}w&&Oe(`${c.length} elements`),pn(c);},Pe=q(()=>!ye()||d()?null:dn(s(),l())),Vr=q(()=>{let c=Pe();if(!c)return;let w=c.getBoundingClientRect(),E=window.getComputedStyle(c);return {borderRadius:E.borderRadius||"0px",height:w.height,transform:E.transform||"none",width:w.width,x:w.left,y:w.top}}),ct=2,wn=(c,w)=>({x:Math.abs(c-x()),y:Math.abs(w-T())}),Tn=q(()=>{if(!d())return false;let c=wn(s(),l());return c.x>ct||c.y>ct}),Sn=(c,w)=>{let E=Math.min(x(),c),Y=Math.min(T(),w),H=Math.abs(c-x()),oe=Math.abs(w-T());return {x:E,y:Y,width:H,height:oe}},Yr=q(()=>{if(!Tn())return;let c=Sn(s(),l());return {borderRadius:"0px",height:c.height,transform:"none",width:c.width,x:c.x,y:c.y}}),Gr=q(()=>{let c=Pe();return c?gn(c):"<element>"}),Cn=q(()=>_()?{x:B(),y:U()}:{x:s(),y:l()}),xn=q(()=>_()?{x:B(),y:U()}:{x:s(),y:l()}),zr=q(()=>!!(Pe()&&Pe()===S()));se(Fe(()=>[Pe(),S()],([c,w])=>{w&&c&&w!==c&&$(null);}));let En=q(()=>{let c=N();if(z(),c===null)return 0;let E=(Date.now()-c)/t.keyHoldDuration,Y=1-Math.exp(-E),H=.95;return _()?Math.min(Y,H):1}),Ur=()=>{P(Date.now()),v(false),re=window.setTimeout(()=>{v(true),re=null;},Di);let c=()=>{if(N()===null)return;K(E=>E+1),En()<1&&(W=requestAnimationFrame(c));};c();},ut=()=>{W!==null&&(cancelAnimationFrame(W),W=null),re!==null&&(window.clearTimeout(re),re=null),P(null),v(false);},Pt=()=>{ut(),u(true),document.body.style.cursor="crosshair";},Xe=()=>{i(false),u(false),document.body.style.cursor="",d()&&(m(false),document.body.style.userSelect=""),F&&window.clearTimeout(F),de&&window.clearTimeout(de),ne&&(window.clearTimeout(ne),ne=null),X(false),ce=-1e3,Ce=-1e3,ut();},vn=new AbortController,Le=vn.signal;window.addEventListener("keydown",c=>{if(c.key==="Escape"&&o()){Xe();return}if(!(!t.allowActivationInsideInput&&Gn(c))&&le(c)){if(g()){de!==null&&window.clearTimeout(de),de=window.setTimeout(()=>{Xe();},200);return}c.repeat||(F!==null&&window.clearTimeout(F),o()||i(true),F=window.setTimeout(()=>{Pt(),t.onActivate?.();},t.keyHoldDuration));}},{signal:Le}),window.addEventListener("keyup",c=>{if(!o()&&!g())return;let w=!c.metaKey&&!c.ctrlKey;(c.key.toLowerCase()==="c"||w)&&Xe();},{signal:Le,capture:true}),window.addEventListener("mousemove",c=>{a(c.clientX),f(c.clientY),ce===-1e3&&(ce=c.clientX,Ce=c.clientY);let w=c.clientX-ce,E=c.clientY-Ce;Math.sqrt(w*w+E*E)>=200?(ne!==null&&window.clearTimeout(ne),X(false),ce=c.clientX,Ce=c.clientY,ne=window.setTimeout(()=>{X(true),ce=s(),Ce=l(),ne=null;},100)):ne===null&&!Q()&&(ne=window.setTimeout(()=>{X(true),ce=s(),Ce=l(),ne=null;},100));},{signal:Le}),window.addEventListener("mousedown",c=>{!ye()||_()||(c.preventDefault(),m(true),C(c.clientX),R(c.clientY),document.body.style.userSelect="none");},{signal:Le}),window.addEventListener("mouseup",c=>{if(!d())return;let w=wn(c.clientX,c.clientY),E=w.x>ct||w.y>ct;if(m(false),document.body.style.userSelect="",E){j(true);let Y=Sn(c.clientX,c.clientY),H=$r(Y,it);if(H.length>0)Mt(c.clientX,c.clientY,()=>yn(H));else {let oe=Ir(Y,it);oe.length>0&&Mt(c.clientX,c.clientY,()=>yn(oe));}}else {let Y=dn(c.clientX,c.clientY);if(!Y)return;$(Y),Mt(c.clientX,c.clientY,()=>Br(Y));}},{signal:Le}),window.addEventListener("click",c=>{(ye()||_()||M())&&(c.preventDefault(),c.stopPropagation(),M()&&j(false));},{signal:Le,capture:true}),document.addEventListener("visibilitychange",()=>{document.hidden&&A([]);},{signal:Le}),he(()=>{vn.abort(),F&&window.clearTimeout(F),de&&window.clearTimeout(de),ne&&window.clearTimeout(ne),ut(),document.body.style.userSelect="",document.body.style.cursor="";});let qr=zn(),Xr=q(()=>false),Wr=q(()=>ye()&&Tn()),Kr=q(()=>_()?"processing":"hover"),Zr=q(()=>ye()&&!d()&&Q()&&(!!Pe()&&!zr()||!Pe())||_()),Jr=q(()=>_()&&b()&&xe()),Qr=q(()=>ye()&&!d());return Vn(()=>k(Kn,{get selectionVisible(){return Xr()},get selectionBounds(){return Vr()},get dragVisible(){return Wr()},get dragBounds(){return Yr()},get grabbedBoxes(){return y()},get successLabels(){return L()},get labelVariant(){return Kr()},get labelText(){return Gr()},get labelX(){return Cn().x},get labelY(){return Cn().y},get labelVisible(){return Zr()},get progressVisible(){return Jr()},get progress(){return En()},get mouseX(){return xn().x},get mouseY(){return xn().y},get crosshairVisible(){return Qr()}}),qr),{activate:()=>{g()||(Pt(),t.onActivate?.());},deactivate:()=>{g()&&Xe();},toggle:()=>{g()?Xe():(Pt(),t.onActivate?.());},isActive:()=>g(),dispose:n}})};var Pr=null,Xl=()=>Pr,Hi="__REACT_GRAB_EXTENSION_ACTIVE__";window[Hi]||(Pr=Mr());/*! Bundled license information:
|
|
28
32
|
|
|
29
33
|
bippy/dist/rdt-hook-DAGphl8S.js:
|
|
30
34
|
(**
|
|
@@ -85,4 +89,4 @@ bippy/dist/source.js:
|
|
|
85
89
|
* This source code is licensed under the MIT license found in the
|
|
86
90
|
* LICENSE file in the root directory of this source tree.
|
|
87
91
|
*)
|
|
88
|
-
*/exports.getGlobalApi=
|
|
92
|
+
*/exports.getGlobalApi=Xl;exports.init=Mr;exports.playCopySound=Se;return exports;})({});
|
package/dist/index.js
CHANGED
|
@@ -678,10 +678,10 @@ var ReactGrabRenderer = (props) => {
|
|
|
678
678
|
return label.text;
|
|
679
679
|
},
|
|
680
680
|
get x() {
|
|
681
|
-
return
|
|
681
|
+
return props.mouseX ?? 0;
|
|
682
682
|
},
|
|
683
683
|
get y() {
|
|
684
|
-
return
|
|
684
|
+
return props.mouseY ?? 0;
|
|
685
685
|
}
|
|
686
686
|
})
|
|
687
687
|
}), createComponent(Show, {
|
|
@@ -771,8 +771,16 @@ var formatComponentSourceLocation = async (el) => {
|
|
|
771
771
|
const source = await getSourceFromHostInstance(el);
|
|
772
772
|
if (!source) return null;
|
|
773
773
|
const fileName = normalizeFileName(source.fileName);
|
|
774
|
-
if (
|
|
775
|
-
|
|
774
|
+
if (isSourceFile(fileName)) {
|
|
775
|
+
return `${fileName}:${source.lineNumber}:${source.columnNumber}`;
|
|
776
|
+
}
|
|
777
|
+
if (fileName && (fileName.includes(".tsx") || fileName.includes(".ts") || fileName.includes(".jsx") || fileName.includes(".js"))) {
|
|
778
|
+
const cleanedFileName = fileName.replace(/^webpack:\/\/_N_E\//, "").replace(/^webpack:\/\/\//, "").replace(/^webpack:\/\//, "").replace(/^\.\//, "");
|
|
779
|
+
if (cleanedFileName && !cleanedFileName.startsWith("node_modules") && !cleanedFileName.includes(".next") && !cleanedFileName.startsWith("webpack")) {
|
|
780
|
+
return `${cleanedFileName}:${source.lineNumber}:${source.columnNumber}`;
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
return null;
|
|
776
784
|
};
|
|
777
785
|
var getHTMLSnippet = async (element) => {
|
|
778
786
|
const semanticTags = /* @__PURE__ */ new Set([
|
|
@@ -885,14 +893,17 @@ var getHTMLSnippet = async (element) => {
|
|
|
885
893
|
const siblings = Array.from(parent.children);
|
|
886
894
|
targetIndex = siblings.indexOf(element);
|
|
887
895
|
if (targetIndex > 0) {
|
|
888
|
-
const
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
+
const indent2 = " ".repeat(ancestors.length);
|
|
897
|
+
if (targetIndex <= 2) {
|
|
898
|
+
for (let i = 0; i < targetIndex; i++) {
|
|
899
|
+
const sibling = siblings[i];
|
|
900
|
+
const siblingId = extractSiblingIdentifier(sibling);
|
|
901
|
+
if (siblingId) {
|
|
902
|
+
lines.push(`${indent2} ${formatElementOpeningTag(sibling, true)}`);
|
|
903
|
+
lines.push(`${indent2} </${sibling.tagName.toLowerCase()}>`);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
} else {
|
|
896
907
|
lines.push(
|
|
897
908
|
`${indent2} ... (${targetIndex} element${targetIndex === 1 ? "" : "s"})`
|
|
898
909
|
);
|
|
@@ -934,11 +945,15 @@ var getHTMLSnippet = async (element) => {
|
|
|
934
945
|
const siblings = Array.from(parent.children);
|
|
935
946
|
const siblingsAfter = siblings.length - targetIndex - 1;
|
|
936
947
|
if (siblingsAfter > 0) {
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
948
|
+
if (siblingsAfter <= 2) {
|
|
949
|
+
for (let i = targetIndex + 1; i < siblings.length; i++) {
|
|
950
|
+
const sibling = siblings[i];
|
|
951
|
+
const siblingId = extractSiblingIdentifier(sibling);
|
|
952
|
+
if (siblingId) {
|
|
953
|
+
lines.push(`${indent} ${formatElementOpeningTag(sibling, true)}`);
|
|
954
|
+
lines.push(`${indent} </${sibling.tagName.toLowerCase()}>`);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
942
957
|
} else {
|
|
943
958
|
lines.push(
|
|
944
959
|
`${indent} ... (${siblingsAfter} element${siblingsAfter === 1 ? "" : "s"})`
|
|
@@ -973,17 +988,18 @@ var waitForFocus = () => {
|
|
|
973
988
|
window.focus();
|
|
974
989
|
});
|
|
975
990
|
};
|
|
976
|
-
var copyContent = async (content) => {
|
|
991
|
+
var copyContent = async (content, onSuccess) => {
|
|
977
992
|
await waitForFocus();
|
|
978
993
|
try {
|
|
979
994
|
if (Array.isArray(content)) {
|
|
980
995
|
if (!navigator?.clipboard?.write) {
|
|
981
996
|
for (const contentPart of content) {
|
|
982
997
|
if (typeof contentPart === "string") {
|
|
983
|
-
const result = copyContentFallback(contentPart);
|
|
998
|
+
const result = copyContentFallback(contentPart, onSuccess);
|
|
984
999
|
if (!result) return result;
|
|
985
1000
|
}
|
|
986
1001
|
}
|
|
1002
|
+
onSuccess?.();
|
|
987
1003
|
return true;
|
|
988
1004
|
}
|
|
989
1005
|
const mimeTypeMap = /* @__PURE__ */ new Map();
|
|
@@ -1002,28 +1018,52 @@ var copyContent = async (content) => {
|
|
|
1002
1018
|
}
|
|
1003
1019
|
}
|
|
1004
1020
|
}
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1021
|
+
if (mimeTypeMap.size === 0) {
|
|
1022
|
+
const plainTextFallback = content.find(
|
|
1023
|
+
(contentPart) => typeof contentPart === "string"
|
|
1024
|
+
);
|
|
1025
|
+
if (typeof plainTextFallback === "string") {
|
|
1026
|
+
return copyContentFallback(plainTextFallback, onSuccess);
|
|
1027
|
+
}
|
|
1028
|
+
return false;
|
|
1029
|
+
}
|
|
1030
|
+
try {
|
|
1031
|
+
await navigator.clipboard.write([
|
|
1032
|
+
new ClipboardItem(Object.fromEntries(mimeTypeMap))
|
|
1033
|
+
]);
|
|
1034
|
+
onSuccess?.();
|
|
1035
|
+
return true;
|
|
1036
|
+
} catch {
|
|
1037
|
+
const plainTextParts = content.filter(
|
|
1038
|
+
(contentPart) => typeof contentPart === "string"
|
|
1039
|
+
);
|
|
1040
|
+
if (plainTextParts.length > 0) {
|
|
1041
|
+
const combinedText = plainTextParts.join("\n\n");
|
|
1042
|
+
return copyContentFallback(combinedText, onSuccess);
|
|
1043
|
+
}
|
|
1044
|
+
return false;
|
|
1045
|
+
}
|
|
1009
1046
|
} else if (content instanceof Blob) {
|
|
1010
1047
|
await navigator.clipboard.write([
|
|
1011
1048
|
new ClipboardItem({ [content.type]: content })
|
|
1012
1049
|
]);
|
|
1050
|
+
onSuccess?.();
|
|
1013
1051
|
return true;
|
|
1014
1052
|
} else {
|
|
1015
1053
|
try {
|
|
1016
1054
|
await navigator.clipboard.writeText(String(content));
|
|
1055
|
+
onSuccess?.();
|
|
1017
1056
|
return true;
|
|
1018
1057
|
} catch {
|
|
1019
|
-
|
|
1058
|
+
const result = copyContentFallback(content, onSuccess);
|
|
1059
|
+
return result;
|
|
1020
1060
|
}
|
|
1021
1061
|
}
|
|
1022
1062
|
} catch {
|
|
1023
1063
|
return false;
|
|
1024
1064
|
}
|
|
1025
1065
|
};
|
|
1026
|
-
var copyContentFallback = (content) => {
|
|
1066
|
+
var copyContentFallback = (content, onSuccess) => {
|
|
1027
1067
|
if (!document.execCommand) return false;
|
|
1028
1068
|
const el = document.createElement("textarea");
|
|
1029
1069
|
el.value = String(content);
|
|
@@ -1033,12 +1073,46 @@ var copyContentFallback = (content) => {
|
|
|
1033
1073
|
doc.append(el);
|
|
1034
1074
|
try {
|
|
1035
1075
|
el.select();
|
|
1036
|
-
|
|
1076
|
+
const result = document.execCommand("copy");
|
|
1077
|
+
if (result) onSuccess?.();
|
|
1078
|
+
return result;
|
|
1037
1079
|
} finally {
|
|
1038
1080
|
el.remove();
|
|
1039
1081
|
}
|
|
1040
1082
|
};
|
|
1041
1083
|
|
|
1084
|
+
// src/utils/play-copy-sound.ts
|
|
1085
|
+
var playCopySound = () => {
|
|
1086
|
+
try {
|
|
1087
|
+
const audioContext = new (window.AudioContext || // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access -- window.webkitAudioContext is not typed
|
|
1088
|
+
window.webkitAudioContext)();
|
|
1089
|
+
const masterGain = audioContext.createGain();
|
|
1090
|
+
masterGain.connect(audioContext.destination);
|
|
1091
|
+
const notes = [
|
|
1092
|
+
{ freq: 523.25, start: 0, duration: 0.1 },
|
|
1093
|
+
{ freq: 659.25, start: 0.05, duration: 0.1 },
|
|
1094
|
+
{ freq: 783.99, start: 0.1, duration: 0.15 }
|
|
1095
|
+
];
|
|
1096
|
+
notes.forEach((note) => {
|
|
1097
|
+
const oscillator = audioContext.createOscillator();
|
|
1098
|
+
const gainNode = audioContext.createGain();
|
|
1099
|
+
oscillator.connect(gainNode);
|
|
1100
|
+
gainNode.connect(masterGain);
|
|
1101
|
+
oscillator.frequency.value = note.freq;
|
|
1102
|
+
oscillator.type = "triangle";
|
|
1103
|
+
const startTime = audioContext.currentTime + note.start;
|
|
1104
|
+
const peakTime = startTime + 0.01;
|
|
1105
|
+
const endTime = startTime + note.duration;
|
|
1106
|
+
gainNode.gain.setValueAtTime(0, startTime);
|
|
1107
|
+
gainNode.gain.linearRampToValueAtTime(0.15, peakTime);
|
|
1108
|
+
gainNode.gain.exponentialRampToValueAtTime(0.01, endTime);
|
|
1109
|
+
oscillator.start(startTime);
|
|
1110
|
+
oscillator.stop(endTime);
|
|
1111
|
+
});
|
|
1112
|
+
} catch {
|
|
1113
|
+
}
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1042
1116
|
// src/utils/is-element-visible.ts
|
|
1043
1117
|
var isElementVisible = (element, computedStyle = window.getComputedStyle(element)) => {
|
|
1044
1118
|
return computedStyle.display !== "none" && computedStyle.visibility !== "hidden" && computedStyle.opacity !== "0";
|
|
@@ -1146,6 +1220,12 @@ var createElementBounds = (element) => {
|
|
|
1146
1220
|
};
|
|
1147
1221
|
};
|
|
1148
1222
|
|
|
1223
|
+
// src/utils/is-localhost.ts
|
|
1224
|
+
var isLocalhost = () => {
|
|
1225
|
+
const hostname = window.location.hostname;
|
|
1226
|
+
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]";
|
|
1227
|
+
};
|
|
1228
|
+
|
|
1149
1229
|
// src/core.tsx
|
|
1150
1230
|
var PROGRESS_INDICATOR_DELAY_MS = 150;
|
|
1151
1231
|
var init = (rawOptions) => {
|
|
@@ -1153,6 +1233,7 @@ var init = (rawOptions) => {
|
|
|
1153
1233
|
enabled: true,
|
|
1154
1234
|
keyHoldDuration: 300,
|
|
1155
1235
|
allowActivationInsideInput: true,
|
|
1236
|
+
playCopySound: false,
|
|
1156
1237
|
...rawOptions
|
|
1157
1238
|
};
|
|
1158
1239
|
if (options.enabled === false) {
|
|
@@ -1212,13 +1293,11 @@ var init = (rawOptions) => {
|
|
|
1212
1293
|
setGrabbedBoxes((previousBoxes) => previousBoxes.filter((box) => box.id !== boxId));
|
|
1213
1294
|
}, SUCCESS_LABEL_DURATION_MS);
|
|
1214
1295
|
};
|
|
1215
|
-
const showTemporarySuccessLabel = (text
|
|
1296
|
+
const showTemporarySuccessLabel = (text) => {
|
|
1216
1297
|
const labelId = `success-${Date.now()}-${Math.random()}`;
|
|
1217
1298
|
setSuccessLabels((previousLabels) => [...previousLabels, {
|
|
1218
1299
|
id: labelId,
|
|
1219
|
-
text
|
|
1220
|
-
x: positionX,
|
|
1221
|
-
y: positionY
|
|
1300
|
+
text
|
|
1222
1301
|
}]);
|
|
1223
1302
|
setTimeout(() => {
|
|
1224
1303
|
setSuccessLabels((previousLabels) => previousLabels.filter((label) => label.id !== labelId));
|
|
@@ -1249,7 +1328,8 @@ ${context}
|
|
|
1249
1328
|
computedStyles: element.computedStyles
|
|
1250
1329
|
}))
|
|
1251
1330
|
};
|
|
1252
|
-
const
|
|
1331
|
+
const jsonString = JSON.stringify(structuredData);
|
|
1332
|
+
const base64Data = btoa(encodeURIComponent(jsonString).replace(/%([0-9A-F]{2})/g, (_match, p1) => String.fromCharCode(parseInt(p1, 16))));
|
|
1253
1333
|
const htmlContent = `<div data-react-grab="${base64Data}"></div>`;
|
|
1254
1334
|
return new Blob([htmlContent], {
|
|
1255
1335
|
type: "text/html"
|
|
@@ -1296,6 +1376,8 @@ ${context}
|
|
|
1296
1376
|
} catch {
|
|
1297
1377
|
}
|
|
1298
1378
|
};
|
|
1379
|
+
const isExtensionEnvironment = () => window.__REACT_GRAB_EXTENSION_ACTIVE__ === true || options.isExtension === true;
|
|
1380
|
+
const isExtensionTextOnlyMode = () => isExtensionEnvironment() && !isLocalhost();
|
|
1299
1381
|
const executeCopyOperation = async (positionX, positionY, operation) => {
|
|
1300
1382
|
setCopyStartX(positionX);
|
|
1301
1383
|
setCopyStartY(positionY);
|
|
@@ -1306,21 +1388,49 @@ ${context}
|
|
|
1306
1388
|
stopProgressAnimation();
|
|
1307
1389
|
});
|
|
1308
1390
|
};
|
|
1391
|
+
const hasInnerText = (element) => "innerText" in element;
|
|
1392
|
+
const extractElementTextContent = (element) => {
|
|
1393
|
+
if (hasInnerText(element)) {
|
|
1394
|
+
return element.innerText;
|
|
1395
|
+
}
|
|
1396
|
+
return element.textContent ?? "";
|
|
1397
|
+
};
|
|
1398
|
+
const createCombinedTextContent = (elements) => elements.map((element) => extractElementTextContent(element).trim()).filter((textContent) => textContent.length > 0).join("\n\n");
|
|
1309
1399
|
const copySingleElementToClipboard = async (targetElement2) => {
|
|
1310
1400
|
showTemporaryGrabbedBox(createElementBounds(targetElement2));
|
|
1311
1401
|
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
1402
|
+
let didCopy = false;
|
|
1312
1403
|
try {
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1404
|
+
if (isExtensionTextOnlyMode()) {
|
|
1405
|
+
const plainTextContent = createCombinedTextContent([targetElement2]);
|
|
1406
|
+
if (plainTextContent.length > 0) {
|
|
1407
|
+
didCopy = await copyContent(plainTextContent, options.playCopySound ? playCopySound : void 0);
|
|
1408
|
+
}
|
|
1409
|
+
} else {
|
|
1410
|
+
const content = await getHTMLSnippet(targetElement2);
|
|
1411
|
+
const plainTextContent = wrapInSelectedElementTags(content);
|
|
1412
|
+
const htmlContent = createStructuredClipboardHtmlBlob([{
|
|
1413
|
+
tagName: extractElementTagName(targetElement2),
|
|
1414
|
+
content,
|
|
1415
|
+
computedStyles: extractRelevantComputedStyles(targetElement2)
|
|
1416
|
+
}]);
|
|
1417
|
+
didCopy = await copyContent([plainTextContent, htmlContent], options.playCopySound ? playCopySound : void 0);
|
|
1418
|
+
if (!didCopy) {
|
|
1419
|
+
const plainTextContentOnly = createCombinedTextContent([targetElement2]);
|
|
1420
|
+
if (plainTextContentOnly.length > 0) {
|
|
1421
|
+
didCopy = await copyContent(plainTextContentOnly, options.playCopySound ? playCopySound : void 0);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1321
1425
|
} catch {
|
|
1426
|
+
const plainTextContentOnly = createCombinedTextContent([targetElement2]);
|
|
1427
|
+
if (plainTextContentOnly.length > 0) {
|
|
1428
|
+
didCopy = await copyContent(plainTextContentOnly, options.playCopySound ? playCopySound : void 0);
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
if (didCopy) {
|
|
1432
|
+
showTemporarySuccessLabel(extractElementLabelText(targetElement2));
|
|
1322
1433
|
}
|
|
1323
|
-
showTemporarySuccessLabel(extractElementLabelText(targetElement2), copyStartX(), copyStartY());
|
|
1324
1434
|
notifyElementsSelected([targetElement2]);
|
|
1325
1435
|
};
|
|
1326
1436
|
const copyMultipleElementsToClipboard = async (targetElements) => {
|
|
@@ -1329,19 +1439,43 @@ ${context}
|
|
|
1329
1439
|
showTemporaryGrabbedBox(createElementBounds(element));
|
|
1330
1440
|
}
|
|
1331
1441
|
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
1442
|
+
let didCopy = false;
|
|
1332
1443
|
try {
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1444
|
+
if (isExtensionTextOnlyMode()) {
|
|
1445
|
+
const plainTextContent = createCombinedTextContent(targetElements);
|
|
1446
|
+
if (plainTextContent.length > 0) {
|
|
1447
|
+
didCopy = await copyContent(plainTextContent, options.playCopySound ? playCopySound : void 0);
|
|
1448
|
+
}
|
|
1449
|
+
} else {
|
|
1450
|
+
const elementSnippetResults = await Promise.allSettled(targetElements.map((element) => getHTMLSnippet(element)));
|
|
1451
|
+
const elementSnippets = elementSnippetResults.map((result) => result.status === "fulfilled" ? result.value : "").filter((snippet) => snippet.trim());
|
|
1452
|
+
if (elementSnippets.length > 0) {
|
|
1453
|
+
const plainTextContent = elementSnippets.map((snippet) => wrapInSelectedElementTags(snippet)).join("\n\n");
|
|
1454
|
+
const structuredElements = elementSnippets.map((content, elementIndex) => ({
|
|
1455
|
+
tagName: extractElementTagName(targetElements[elementIndex]),
|
|
1456
|
+
content,
|
|
1457
|
+
computedStyles: extractRelevantComputedStyles(targetElements[elementIndex])
|
|
1458
|
+
}));
|
|
1459
|
+
const htmlContent = createStructuredClipboardHtmlBlob(structuredElements);
|
|
1460
|
+
didCopy = await copyContent([plainTextContent, htmlContent], options.playCopySound ? playCopySound : void 0);
|
|
1461
|
+
if (!didCopy) {
|
|
1462
|
+
const plainTextContentOnly = createCombinedTextContent(targetElements);
|
|
1463
|
+
if (plainTextContentOnly.length > 0) {
|
|
1464
|
+
didCopy = await copyContent(plainTextContentOnly, options.playCopySound ? playCopySound : void 0);
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
} else {
|
|
1468
|
+
const plainTextContentOnly = createCombinedTextContent(targetElements);
|
|
1469
|
+
if (plainTextContentOnly.length > 0) {
|
|
1470
|
+
didCopy = await copyContent(plainTextContentOnly, options.playCopySound ? playCopySound : void 0);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1342
1474
|
} catch {
|
|
1343
1475
|
}
|
|
1344
|
-
|
|
1476
|
+
if (didCopy) {
|
|
1477
|
+
showTemporarySuccessLabel(`${targetElements.length} elements`);
|
|
1478
|
+
}
|
|
1345
1479
|
notifyElementsSelected(targetElements);
|
|
1346
1480
|
};
|
|
1347
1481
|
const targetElement = createMemo(() => {
|
|
@@ -1716,6 +1850,9 @@ ${context}
|
|
|
1716
1850
|
// src/index.ts
|
|
1717
1851
|
var globalApi = null;
|
|
1718
1852
|
var getGlobalApi = () => globalApi;
|
|
1719
|
-
|
|
1853
|
+
var EXTENSION_MARKER = "__REACT_GRAB_EXTENSION_ACTIVE__";
|
|
1854
|
+
if (!window[EXTENSION_MARKER]) {
|
|
1855
|
+
globalApi = init();
|
|
1856
|
+
}
|
|
1720
1857
|
|
|
1721
|
-
export { getGlobalApi, init };
|
|
1858
|
+
export { getGlobalApi, init, playCopySound };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-grab",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
"@medv/finder": "^4.0.2",
|
|
70
70
|
"bippy": "^0.5.14",
|
|
71
71
|
"modern-screenshot": "^4.6.6",
|
|
72
|
-
"solid-js": "^1.9.10"
|
|
72
|
+
"solid-js": "^1.9.10",
|
|
73
|
+
"solid-sonner": "^0.2.8"
|
|
73
74
|
},
|
|
74
75
|
"scripts": {
|
|
75
76
|
"build": "NODE_ENV=production tsup",
|