@commentkit/comment-kit 0.7.1 → 0.7.3

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +10 -6
  3. package/SECURITY.md +14 -6
  4. package/dist/angular.es.js +2 -2
  5. package/dist/comment-kit.es.js +5 -5
  6. package/dist/demo.es.js +35 -34
  7. package/dist/headless.es.js +3 -3
  8. package/dist/preact.es.js +2 -2
  9. package/dist/qwik.qwik.mjs +2 -2
  10. package/dist/react.es.js +2 -2
  11. package/dist/shared/{ShadowRootContext-Bv-4aElu.js → ShadowRootContext-CjciYxVN.js} +4 -4
  12. package/dist/shared/annotation-toolbar-XpqojzM2.js +1094 -0
  13. package/dist/shared/{attachment-refresh-CzQFXHkL.js → attachment-refresh-agUheZPF.js} +2 -2
  14. package/dist/shared/{button-group-CWdKaOlC.js → button-group-C285iSkZ.js} +1 -1
  15. package/dist/shared/capture-privacy-DUROnio5.js +77 -0
  16. package/dist/shared/{comment-drawing-canvas-DdXlMgbF.js → comment-drawing-canvas-B3zqdIZH.js} +2 -2
  17. package/dist/shared/{comment-icon-Dg9ZWpz-.js → comment-icon-4SQd3nlz.js} +1 -1
  18. package/dist/shared/{comment-image-lightbox-B7iHjnAz.js → comment-image-lightbox-j9y3Klh6.js} +5 -5
  19. package/dist/shared/{comment-images-content-D7YNUgo5.js → comment-images-content-aJrMaOi9.js} +3 -3
  20. package/dist/shared/{comment-kit-core-C862uNAm.js → comment-kit-core-Bsyydwpk.js} +786 -703
  21. package/dist/shared/{comment-kit-ui-0vd-DY4S.js → comment-kit-ui-qKjCHHOy.js} +4642 -4820
  22. package/dist/shared/{comment-screenshot-annotator-DcaSSuWB.js → comment-screenshot-annotator-aDtgMbBF.js} +2 -2
  23. package/dist/shared/{comment-screenshot-overlay-D_nFoJmM.js → comment-screenshot-overlay-B-rAubia.js} +113 -118
  24. package/dist/shared/comment-shortcut-groups-CfEmkitU.js +153 -0
  25. package/dist/shared/{dev-export-panel-pWBlhlse.js → dev-export-panel-mrxmtzei.js} +3 -4
  26. package/dist/shared/dev-grab-Cc-lJYBv.js +196 -0
  27. package/dist/shared/{element-selector-DC-_XJ0k.js → element-selector-4TxTAXHK.js} +408 -405
  28. package/dist/shared/{mount-ui-B68j8r6I.js → mount-ui-Dbqe5VsO.js} +121 -106
  29. package/dist/shared/{pusher-C1FHQGXV.js → pusher-zAMukOay.js} +1 -1
  30. package/dist/shared/{realtime-recovery-DJ_adc-H.js → realtime-recovery-BSVMwsXJ.js} +1 -1
  31. package/dist/shared/realtime-t5o6fk6w.js +321 -0
  32. package/dist/shared/request-activity-DQrAUwfA.js +11 -0
  33. package/dist/shared/{separator-XDBsaWyw.js → separator-aphZiRoJ.js} +1 -1
  34. package/dist/shared/{shadow-root-CrO75sED.js → shadow-root-DlfbvZF9.js} +31 -31
  35. package/dist/shared/{styles-C9Jwvm0Q.js → styles-CnYsLS2f.js} +1 -1
  36. package/dist/shared/text-B4HHZNaa.js +23 -0
  37. package/dist/shared/token-session-ZzSO1tEl.js +25 -0
  38. package/dist/shared/{validation-D-8u4M7I.js → validation-3wbbbuX0.js} +14 -2
  39. package/dist/shared/{websocket-manager-CFak_YHy.js → websocket-manager-DGN8T9mq.js} +136 -116
  40. package/dist/solid.es.js +2 -2
  41. package/dist/svelte.es.js +2 -2
  42. package/dist/types/core/api-client.d.ts +3 -1
  43. package/dist/types/core/comment-kit-core.d.ts +2 -5
  44. package/dist/types/core/types.d.ts +22 -5
  45. package/dist/types/core/websocket-manager.d.ts +1 -0
  46. package/dist/vue.es.js +2 -2
  47. package/docs/api-reference.md +19 -4
  48. package/package.json +1 -1
  49. package/dist/shared/annotation-toolbar-cGC1p-SP.js +0 -1093
  50. package/dist/shared/dev-grab-eQ9EgEGY.js +0 -210
  51. package/dist/shared/realtime-Diqz7G_y.js +0 -317
@@ -1,30 +1,31 @@
1
- import { a as e, i as t, m as n, n as r, o as i } from "./dom-Bhf4WFtY.js";
2
- import { n as a } from "./dist-De294MVF.js";
3
- import { t as o } from "./button-By0hGrJK.js";
4
- import { t as s } from "./createReactComponent-BZHeRbD0.js";
5
- import { G as c, K as ee, S as te, V as l, n as ne } from "./comment-kit-ui-0vd-DY4S.js";
6
- import * as u from "react";
7
- import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
8
- var re = s("outline", "paperclip", "Paperclip", [["path", {
1
+ import { u as e } from "./comment-kit-core-Bsyydwpk.js";
2
+ import { a as t, i as n, m as r, n as i, o as a } from "./dom-Bhf4WFtY.js";
3
+ import { n as o } from "./dist-De294MVF.js";
4
+ import { t as s } from "./button-By0hGrJK.js";
5
+ import { t as c } from "./createReactComponent-BZHeRbD0.js";
6
+ import { G as l, K as ee, S as te, V as u, n as ne } from "./comment-kit-ui-qKjCHHOy.js";
7
+ import * as d from "react";
8
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
9
+ var re = c("outline", "paperclip", "Paperclip", [["path", {
9
10
  d: "M15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3l6.5 -6.5a3 3 0 0 0 -6 -6l-6.5 6.5a4.5 4.5 0 0 0 9 9l6.5 -6.5",
10
11
  key: "svg-0"
11
- }]]), ie = s("outline", "x", "X", [["path", {
12
+ }]]), ie = c("outline", "x", "X", [["path", {
12
13
  d: "M18 6l-12 12",
13
14
  key: "svg-0"
14
15
  }], ["path", {
15
16
  d: "M6 6l12 12",
16
17
  key: "svg-1"
17
- }]]), m = ".ck-element-selector{z-index:calc(var(--z-ck-fab) - 1);pointer-events:none;position:fixed;inset:0}.ck-element-selector-outline,.ck-element-selector-mark{pointer-events:none;border-radius:4px;position:fixed}.ck-element-selector-outline{z-index:calc(var(--z-ck-fab) - 1);border:2px solid var(--primary);background-color:color-mix(in oklch, var(--primary) 8%, transparent);box-shadow:0 0 0 1px color-mix(in oklch, var(--background) 95%, transparent), 0 0 0 4px color-mix(in oklch, var(--primary) 18%, transparent)}.ck-element-selector-outline[data-state=selected]{background-color:color-mix(in oklch, var(--primary) 12%, transparent);border-style:solid}.ck-element-selector-outline[data-state=multi]{border-style:dashed;border-color:color-mix(in oklch, var(--primary) 70%, var(--foreground));background-color:color-mix(in oklch, var(--primary) 6%, transparent)}.ck-element-selector-outline[data-state=multi]:before{content:attr(data-multi-index);top:-10px;background:var(--primary);min-width:20px;height:20px;color:var(--primary-foreground,white);text-align:center;border-radius:999px;padding:0 6px;font:600 11px/20px ui-monospace,SF Mono,Menlo,monospace;position:absolute;inset-inline-start:-10px;box-shadow:0 1px 3px #00000040}.ck-element-selector-multibar{bottom:24px;z-index:calc(var(--z-ck-fab) + 1);border:1px solid var(--border);background-color:var(--popover);color:var(--popover-foreground);box-shadow:0 18px 30px -12px #00000047, 0 0 0 1px color-mix(in oklch, var(--foreground) 8%, transparent);pointer-events:auto;border-radius:999px;align-items:center;gap:8px;padding:6px 10px;font:13px/1 system-ui,sans-serif;display:inline-flex;position:fixed;inset-inline-start:50%;transform:translate(-50%)}.ck-element-selector-multibar-count{color:var(--popover-foreground);padding:0 4px}.ck-element-selector-marquee{z-index:calc(var(--z-ck-fab) - 1);border:1px dashed var(--primary);background-color:color-mix(in oklch, var(--primary) 12%, transparent);pointer-events:none;border-radius:4px;position:fixed}.ck-element-selector-context-menu{z-index:calc(var(--z-ck-fab) + 2);border:1px solid var(--border);background-color:var(--popover);min-width:200px;color:var(--popover-foreground);box-shadow:0 18px 30px -12px #0000004d, 0 0 0 1px color-mix(in oklch, var(--foreground) 8%, transparent);pointer-events:auto;border-radius:8px;margin:0;padding:4px;font:13px/1 system-ui,sans-serif;list-style:none;position:fixed}.ck-element-selector-context-menu li{list-style:none}.ck-element-selector-context-menu button{width:100%;color:inherit;text-align:left;cursor:pointer;font:inherit;background:0 0;border:0;border-radius:4px;padding:8px 10px}.ck-element-selector-context-menu button:hover,.ck-element-selector-context-menu button:focus-visible{background-color:color-mix(in oklch, var(--primary) 14%, transparent);outline:none}.ck-element-selector-mark{z-index:calc(var(--z-ck-fab) - 2);border:2px solid color-mix(in oklch, var(--primary) 78%, var(--foreground));box-shadow:inset 0 0 0 1px color-mix(in oklch, var(--background) 80%, transparent), 0 0 0 3px color-mix(in oklch, var(--primary) 14%, transparent)}.ck-element-selector-composer{z-index:var(--z-ck-fab);border:1px solid var(--border);background-color:var(--popover);width:min(28rem,100vw - 1rem);color:var(--popover-foreground);box-shadow:0 22px 42px -16px #00000052, 0 0 0 1px color-mix(in oklch, var(--foreground) 8%, transparent);pointer-events:auto;border-radius:8px;align-items:stretch;gap:.625rem;padding:.75rem;display:grid;position:fixed}.ck-element-selector-input-row{min-width:0}.ck-element-selector-composer .ck-input{border-radius:7px;width:100%;min-width:0;min-height:3rem;padding-inline:.875rem;font-size:.875rem;line-height:1.25rem}.ck-element-selector-actions{align-items:center;gap:.5rem;width:100%;display:flex}.ck-element-selector-actions .ck-button{min-height:2.375rem}.ck-element-selector-attach-action{gap:.375rem;margin-inline-end:auto}.ck-element-selector-grab-action{min-width:8.75rem}.ck-element-selector-action-icon{flex:none;width:.95rem;height:.95rem}.ck-element-selector-file-input{clip:rect(0 0 0 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.ck-element-selector-attachment{border:1px solid color-mix(in oklch, var(--border) 80%, transparent);background-color:color-mix(in oklch, var(--muted) 55%, transparent);border-radius:7px;align-items:center;gap:.625rem;width:100%;min-width:0;padding:.5rem;display:flex}.ck-element-selector-attachment-image{object-fit:cover;border-radius:6px;flex:none;width:2.5rem;height:2.5rem}.ck-element-selector-attachment-meta{flex:1;gap:.125rem;min-width:0;display:grid}.ck-element-selector-attachment-name,.ck-element-selector-attachment-path,.ck-element-selector-attachment-size{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ck-element-selector-attachment-name{color:var(--foreground);font-size:.75rem;font-weight:600;line-height:1rem}.ck-element-selector-attachment-path,.ck-element-selector-attachment-size{color:var(--muted-foreground);font-size:.6875rem;line-height:.875rem}.ck-element-selector-error{width:100%;color:var(--destructive);font-size:.75rem;line-height:1rem}@media (width<=420px){.ck-element-selector-actions{flex-wrap:wrap}.ck-element-selector-attach-action{margin-inline-end:0}.ck-element-selector-save-action,.ck-element-selector-grab-action{flex:auto}}", ae = "data-commentkit-freeze", h = "\n*, *::before, *::after {\n animation-play-state: paused !important;\n transition: none !important;\n}\n", g = 0, _ = null, v = [];
18
- function y() {
19
- if (_ || typeof document > "u") return;
20
- let e = document.createElement("style");
21
- e.setAttribute(ae, ""), e.textContent = h, document.head.appendChild(e), _ = e;
22
- }
18
+ }]]), h = ".ck-element-selector{z-index:calc(var(--z-ck-fab) - 1);pointer-events:none;position:fixed;inset:0}.ck-element-selector-outline,.ck-element-selector-mark{pointer-events:none;border-radius:4px;position:fixed}.ck-element-selector-outline{z-index:calc(var(--z-ck-fab) - 1);border:2px solid var(--primary);background-color:color-mix(in oklch, var(--primary) 8%, transparent);box-shadow:0 0 0 1px color-mix(in oklch, var(--background) 95%, transparent), 0 0 0 4px color-mix(in oklch, var(--primary) 18%, transparent)}.ck-element-selector-outline[data-state=selected]{background-color:color-mix(in oklch, var(--primary) 12%, transparent);border-style:solid}.ck-element-selector-outline[data-state=multi]{border-style:dashed;border-color:color-mix(in oklch, var(--primary) 70%, var(--foreground));background-color:color-mix(in oklch, var(--primary) 6%, transparent)}.ck-element-selector-outline[data-state=multi]:before{content:attr(data-multi-index);top:-10px;background:var(--primary);min-width:20px;height:20px;color:var(--primary-foreground,white);text-align:center;border-radius:999px;padding:0 6px;font:600 11px/20px ui-monospace,SF Mono,Menlo,monospace;position:absolute;inset-inline-start:-10px;box-shadow:0 1px 3px #00000040}.ck-element-selector-multibar{bottom:24px;z-index:calc(var(--z-ck-fab) + 1);border:1px solid var(--border);background-color:var(--popover);color:var(--popover-foreground);box-shadow:0 18px 30px -12px #00000047, 0 0 0 1px color-mix(in oklch, var(--foreground) 8%, transparent);pointer-events:auto;border-radius:999px;align-items:center;gap:8px;padding:6px 10px;font:13px/1 system-ui,sans-serif;display:inline-flex;position:fixed;inset-inline-start:50%;transform:translate(-50%)}.ck-element-selector-multibar-count{color:var(--popover-foreground);padding:0 4px}.ck-element-selector-marquee{z-index:calc(var(--z-ck-fab) - 1);border:1px dashed var(--primary);background-color:color-mix(in oklch, var(--primary) 12%, transparent);pointer-events:none;border-radius:4px;position:fixed}.ck-element-selector-context-menu{z-index:calc(var(--z-ck-fab) + 2);border:1px solid var(--border);background-color:var(--popover);min-width:200px;color:var(--popover-foreground);box-shadow:0 18px 30px -12px #0000004d, 0 0 0 1px color-mix(in oklch, var(--foreground) 8%, transparent);pointer-events:auto;border-radius:8px;margin:0;padding:4px;font:13px/1 system-ui,sans-serif;list-style:none;position:fixed}.ck-element-selector-context-menu li{list-style:none}.ck-element-selector-context-menu button{width:100%;color:inherit;text-align:left;cursor:pointer;font:inherit;background:0 0;border:0;border-radius:4px;padding:8px 10px}.ck-element-selector-context-menu button:hover,.ck-element-selector-context-menu button:focus-visible{background-color:color-mix(in oklch, var(--primary) 14%, transparent);outline:none}.ck-element-selector-mark{z-index:calc(var(--z-ck-fab) - 2);border:2px solid color-mix(in oklch, var(--primary) 78%, var(--foreground));box-shadow:inset 0 0 0 1px color-mix(in oklch, var(--background) 80%, transparent), 0 0 0 3px color-mix(in oklch, var(--primary) 14%, transparent)}.ck-element-selector-composer{z-index:var(--z-ck-fab);border:1px solid var(--border);background-color:var(--popover);width:min(28rem,100vw - 1rem);color:var(--popover-foreground);box-shadow:0 22px 42px -16px #00000052, 0 0 0 1px color-mix(in oklch, var(--foreground) 8%, transparent);pointer-events:auto;border-radius:8px;align-items:stretch;gap:.625rem;padding:.75rem;display:grid;position:fixed}.ck-element-selector-input-row{min-width:0}.ck-element-selector-composer .ck-input{border-radius:7px;width:100%;min-width:0;min-height:3rem;padding-inline:.875rem;font-size:.875rem;line-height:1.25rem}.ck-element-selector-actions{align-items:center;gap:.5rem;width:100%;display:flex}.ck-element-selector-actions .ck-button{min-height:2.375rem}.ck-element-selector-attach-action{gap:.375rem;margin-inline-end:auto}.ck-element-selector-grab-action{min-width:8.75rem}.ck-element-selector-action-icon{flex:none;width:.95rem;height:.95rem}.ck-element-selector-file-input{clip:rect(0 0 0 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.ck-element-selector-attachment{border:1px solid color-mix(in oklch, var(--border) 80%, transparent);background-color:color-mix(in oklch, var(--muted) 55%, transparent);border-radius:7px;align-items:center;gap:.625rem;width:100%;min-width:0;padding:.5rem;display:flex}.ck-element-selector-attachment-image{object-fit:cover;border-radius:6px;flex:none;width:2.5rem;height:2.5rem}.ck-element-selector-attachment-meta{flex:1;gap:.125rem;min-width:0;display:grid}.ck-element-selector-attachment-name,.ck-element-selector-attachment-path,.ck-element-selector-attachment-size{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ck-element-selector-attachment-name{color:var(--foreground);font-size:.75rem;font-weight:600;line-height:1rem}.ck-element-selector-attachment-path,.ck-element-selector-attachment-size{color:var(--muted-foreground);font-size:.6875rem;line-height:.875rem}.ck-element-selector-error{width:100%;color:var(--destructive);font-size:.75rem;line-height:1rem}@media (width<=420px){.ck-element-selector-actions{flex-wrap:wrap}.ck-element-selector-attach-action{margin-inline-end:0}.ck-element-selector-save-action,.ck-element-selector-grab-action{flex:auto}}", ae = "data-commentkit-freeze", g = "\n*, *::before, *::after {\n animation-play-state: paused !important;\n transition: none !important;\n}\n", _ = 0, v = null, y = [];
23
19
  function b() {
24
- _ &&= (_.remove(), null);
20
+ if (v || typeof document > "u") return;
21
+ let e = document.createElement("style");
22
+ e.setAttribute(ae, ""), e.textContent = g, document.head.appendChild(e), v = e;
25
23
  }
26
24
  function x() {
27
- typeof document < "u" && typeof document.getAnimations == "function" && (v = document.getAnimations().filter((e) => {
25
+ v &&= (v.remove(), null);
26
+ }
27
+ function S() {
28
+ typeof document < "u" && typeof document.getAnimations == "function" && (y = document.getAnimations().filter((e) => {
28
29
  if (e.playState !== "running") return !1;
29
30
  try {
30
31
  return e.pause(), !0;
@@ -33,61 +34,61 @@ function x() {
33
34
  }
34
35
  }));
35
36
  }
36
- function S() {
37
- for (let e of v) try {
37
+ function C() {
38
+ for (let e of y) try {
38
39
  e.play();
39
40
  } catch {}
40
- v = [];
41
+ y = [];
41
42
  }
42
43
  function oe() {
43
- g++, g === 1 && (y(), x());
44
+ _++, _ === 1 && (b(), S());
44
45
  let e = !1;
45
46
  return () => {
46
- e || (e = !0, g = Math.max(0, g - 1), g === 0 && (b(), S()));
47
+ e || (e = !0, _ = Math.max(0, _ - 1), _ === 0 && (x(), C()));
47
48
  };
48
49
  }
49
- var C = 448, se = 236, w = 8, T = .9, E = 1e3, D = 2147483600;
50
- function O(e) {
50
+ var w = 448, se = 236, T = 8, E = .9, D = 1e3, O = 2147483600;
51
+ function k(e) {
51
52
  return typeof Element < "u" && e instanceof Element;
52
53
  }
53
- function k() {
54
+ function A() {
54
55
  let e = document.activeElement;
55
56
  for (; e?.shadowRoot?.activeElement;) e = e.shadowRoot.activeElement;
56
57
  return e;
57
58
  }
58
59
  function ce(e) {
59
60
  let t = typeof e.composedPath == "function" ? e.composedPath()[0] ?? e.target : e.target;
60
- if (!O(t)) return !1;
61
+ if (!k(t)) return !1;
61
62
  let n = t.tagName.toLowerCase();
62
63
  return n === "input" || n === "textarea" || n === "select" || t instanceof HTMLElement && t.isContentEditable;
63
64
  }
64
- function A(e) {
65
+ function j(e) {
65
66
  let t = e.getRootNode();
66
67
  return !!(e.closest("[data-commentkit], [data-commentkit-host], [data-commentkit-ui], .ck-root") || typeof ShadowRoot < "u" && t instanceof ShadowRoot && t.host.matches("[data-commentkit], [data-commentkit-host], [data-commentkit-ui]"));
67
68
  }
68
- function j(e, t = B(e)) {
69
+ function M(e, t = V(e)) {
69
70
  let n = e.tagName.toLowerCase();
70
- if (n === "html" || n === "body" || A(e) || e.closest("[data-commentkit-ignore], [data-react-grab-ignore]") || !V(t)) return !1;
71
+ if (n === "html" || n === "body" || j(e) || e.closest("[data-commentkit-ignore], [data-react-grab-ignore]") || !H(t)) return !1;
71
72
  let r = window.getComputedStyle(e);
72
73
  if (r.display === "none" || r.visibility === "hidden") return !1;
73
74
  let i = Number.parseFloat(r.opacity || "1");
74
75
  if (Number.isFinite(i) && i <= .01) return !1;
75
- let a = Number.parseInt(r.zIndex || "", 10), o = r.position === "fixed" || r.position === "absolute", s = t.width / Math.max(window.innerWidth, 1) >= T && t.height / Math.max(window.innerHeight, 1) >= T;
76
- return !(r.pointerEvents === "none" && r.position === "fixed" && Number.isFinite(a) && a >= D || s && o && (r.backgroundColor === "transparent" || r.backgroundColor === "rgba(0, 0, 0, 0)" || Number.isFinite(i) && i < .1 || Number.isFinite(a) && a > E));
76
+ let a = Number.parseInt(r.zIndex || "", 10), o = r.position === "fixed" || r.position === "absolute", s = t.width / Math.max(window.innerWidth, 1) >= E && t.height / Math.max(window.innerHeight, 1) >= E;
77
+ return !(r.pointerEvents === "none" && r.position === "fixed" && Number.isFinite(a) && a >= O || s && o && (r.backgroundColor === "transparent" || r.backgroundColor === "rgba(0, 0, 0, 0)" || Number.isFinite(i) && i < .1 || Number.isFinite(a) && a > D));
77
78
  }
78
- function M(e) {
79
+ function N(e) {
79
80
  return typeof e.composedPath == "function" ? e.composedPath() : e.target ? [e.target] : [];
80
81
  }
81
- function N(e) {
82
- return M(e).some((e) => O(e) && A(e));
82
+ function P(e) {
83
+ return N(e).some((e) => k(e) && j(e));
83
84
  }
84
- function P(e, t) {
85
+ function F(e, t) {
85
86
  if (typeof document.elementsFromPoint == "function") return document.elementsFromPoint(e, t);
86
87
  let n = document.elementFromPoint?.(e, t);
87
88
  return n ? [n] : [];
88
89
  }
89
- function F(e, t) {
90
- return P(e, t).find((e) => j(e)) ?? null;
90
+ function I(e, t) {
91
+ return F(e, t).find((e) => M(e)) ?? null;
91
92
  }
92
93
  function le(e) {
93
94
  let t = Math.min(e.startX, e.x), n = Math.min(e.startY, e.y), r = Math.abs(e.x - e.startX), i = Math.abs(e.y - e.startY);
@@ -100,11 +101,11 @@ function le(e) {
100
101
  bottom: n + i
101
102
  };
102
103
  }
103
- function I(e, t) {
104
+ function L(e, t) {
104
105
  return !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom);
105
106
  }
106
- var L = 200, R = 5e3;
107
- function z(e) {
107
+ var R = 200, z = 5e3;
108
+ function B(e) {
108
109
  let t = window.getComputedStyle(e), n = (e) => e === "hidden" || e === "clip";
109
110
  return n(t.overflowX) || n(t.overflowY) || n(t.overflow);
110
111
  }
@@ -112,15 +113,15 @@ function ue(e) {
112
113
  let t = [];
113
114
  if (typeof document > "u") return t;
114
115
  let n = 0, r = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT, { acceptNode(r) {
115
- if (n >= R || t.length >= L) return NodeFilter.FILTER_REJECT;
116
+ if (n >= z || t.length >= R) return NodeFilter.FILTER_REJECT;
116
117
  n += 1;
117
- let i = r, a = B(i), o = V(a) && I(a, e);
118
- return !o && z(i) ? NodeFilter.FILTER_REJECT : o && j(i, a) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
118
+ let i = r, a = V(i), o = H(a) && L(a, e);
119
+ return !o && B(i) ? NodeFilter.FILTER_REJECT : o && M(i, a) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
119
120
  } }), i = r.nextNode();
120
- for (; i && (t.push(i), !(t.length >= L || n >= R));) i = r.nextNode();
121
+ for (; i && (t.push(i), !(t.length >= R || n >= z));) i = r.nextNode();
121
122
  return t;
122
123
  }
123
- function B(e) {
124
+ function V(e) {
124
125
  let t = e.getBoundingClientRect();
125
126
  return {
126
127
  top: t.top,
@@ -131,30 +132,30 @@ function B(e) {
131
132
  right: t.right
132
133
  };
133
134
  }
134
- function V(e) {
135
+ function H(e) {
135
136
  return e.width > 0 && e.height > 0;
136
137
  }
137
- function H(n) {
138
+ function U(e) {
138
139
  return {
139
- element: n,
140
- selector: t(n),
141
- xpath: e(n),
142
- rect: B(n)
140
+ element: e,
141
+ selector: n(e),
142
+ xpath: t(e),
143
+ rect: V(e)
143
144
  };
144
145
  }
145
- function U(e, t, n) {
146
+ function W(e, t, n) {
146
147
  return Math.min(n, Math.max(t, e));
147
148
  }
148
- function W() {
149
+ function G() {
149
150
  return {
150
151
  width: Math.max(window.innerWidth || 0, 16),
151
152
  height: Math.max(window.innerHeight || 0, 16)
152
153
  };
153
154
  }
154
155
  function de(e) {
155
- let t = W(), r = U(e.rect.left + e.rect.width / 2, 0, t.width), i = U(e.rect.top + e.rect.height / 2, 0, t.height);
156
+ let t = G(), n = W(e.rect.left + e.rect.width / 2, 0, t.width), i = W(e.rect.top + e.rect.height / 2, 0, t.height);
156
157
  return {
157
- ...n(r, i, t),
158
+ ...r(n, i, t),
158
159
  element: e.selector,
159
160
  xpath: e.xpath
160
161
  };
@@ -194,7 +195,7 @@ function me(e, t) {
194
195
  previewUrl: e.type.startsWith("image/") && typeof URL.createObjectURL == "function" ? URL.createObjectURL(e) : null
195
196
  };
196
197
  }
197
- function G(e) {
198
+ function K(e) {
198
199
  e && typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(e);
199
200
  }
200
201
  async function he(e, t) {
@@ -202,15 +203,15 @@ async function he(e, t) {
202
203
  if (!navigator.clipboard?.writeText) throw Error("clipboard unavailable");
203
204
  await navigator.clipboard.writeText(e);
204
205
  try {
205
- a.success(`${t} copied`);
206
+ o.success(`${t} copied`);
206
207
  } catch {}
207
208
  } catch {
208
209
  try {
209
- a.error(`Could not copy ${t.toLowerCase()}`);
210
+ o.error(`Could not copy ${t.toLowerCase()}`);
210
211
  } catch {}
211
212
  }
212
213
  }
213
- function K(e) {
214
+ function q(e) {
214
215
  return {
215
216
  top: e.top,
216
217
  left: e.left,
@@ -219,18 +220,18 @@ function K(e) {
219
220
  };
220
221
  }
221
222
  function ge(e, t = se) {
222
- let n = W(), r = Math.max(w, n.width - C - w), i = U(e.left, w, r), a = e.bottom + w, o = e.top - t - w;
223
+ let n = G(), r = Math.max(T, n.width - w - T), i = W(e.left, T, r), a = e.bottom + T, o = e.top - t - T;
223
224
  return {
224
225
  left: i,
225
- top: a + t <= n.height - w ? a : U(o, w, n.height - t - w)
226
+ top: a + t <= n.height - T ? a : W(o, T, n.height - t - T)
226
227
  };
227
228
  }
228
- var _e = 220, q = 200;
229
+ var _e = 220, J = 200;
229
230
  function ve(e) {
230
- let t = W();
231
+ let t = G();
231
232
  return {
232
- left: U(e.x, w, Math.max(w, t.width - _e - w)),
233
- top: U(e.y, w, Math.max(w, t.height - q - w))
233
+ left: W(e.x, T, Math.max(T, t.width - _e - T)),
234
+ top: W(e.y, T, Math.max(T, t.height - J - T))
234
235
  };
235
236
  }
236
237
  function ye(e) {
@@ -239,18 +240,18 @@ function ye(e) {
239
240
  function be(e) {
240
241
  return e.flatMap((e) => {
241
242
  if (!ye(e)) return [];
242
- let t = r(e.position.element ?? "", e.position.xpath);
243
+ let t = i(e.position.element ?? "", e.position.xpath);
243
244
  if (!t) return [];
244
- let n = B(t);
245
- return j(t, n) ? [{
245
+ let n = V(t);
246
+ return M(t, n) ? [{
246
247
  id: e.id,
247
248
  rect: n
248
249
  }] : [];
249
250
  });
250
251
  }
251
252
  function xe(e) {
252
- let [t, n] = u.useState(0);
253
- return u.useEffect(() => {
253
+ let [t, n] = d.useState(0);
254
+ return d.useEffect(() => {
254
255
  if (!e) return;
255
256
  let t = 0, r = () => {
256
257
  t ||= window.requestAnimationFrame(() => {
@@ -274,63 +275,63 @@ function xe(e) {
274
275
  };
275
276
  }, [e]), t;
276
277
  }
277
- var J = u.memo(function({ core: n, state: r, active: a }) {
278
- let s = l(), { canWrite: m, message: ae } = ee(), [h, g] = u.useState(null), [_, v] = u.useState(null), [y, b] = u.useState([]), [x, S] = u.useState(null), [C, w] = u.useState(null), [T, E] = u.useState(""), [D, O] = u.useState(null), [A, j] = u.useState(!1), M = u.useRef(null), [P, I] = u.useState(!1), [L, R] = u.useState(null), z = u.useRef(null), V = u.useRef(null), U = u.useRef(null), W = u.useRef(null), [pe, _e] = u.useState(se), q = i().path, J = u.useMemo(() => r.comments.filter((e) => e.page?.path === q), [r.comments, q]), Se = J.some(ye), Ce = xe(a || Se || !!_ || y.length > 0), we = u.useRef(null), Te = u.useRef([]), Ee = u.useRef(""), De = u.useRef(null);
279
- u.useEffect(() => {
280
- we.current = _?.element ?? h?.element ?? null;
281
- }, [h, _]), u.useEffect(() => {
282
- Te.current = y;
283
- }, [y]), u.useEffect(() => {
284
- Ee.current = T;
285
- }, [T]), u.useEffect(() => {
286
- De.current = D;
287
- }, [D]);
288
- let Oe = u.useMemo(() => be(J), [J, Ce]);
289
- u.useEffect(() => {
290
- let e = M.current;
291
- (e && (r.currentUser?.id !== e.userId || (r.activeBranch ?? null) !== e.branch || q !== e.page || !e.submitting && r.activeTool === null || r.activeTool !== null && r.activeTool !== "select") || !a && !A) && (M.current = null, g(null), v(null), b([]), w(null), E(""), O((e) => (G(e?.previewUrl), null)), j(!1), R(null), S(null), Q.current = null, $.current = !1);
278
+ var Y = d.memo(function({ core: r, state: i, active: o }) {
279
+ let c = u(), { canWrite: h, message: ae } = ee(), [g, _] = d.useState(null), [v, y] = d.useState(null), [b, x] = d.useState([]), [S, C] = d.useState(null), [w, T] = d.useState(null), [E, D] = d.useState(""), [O, k] = d.useState(null), [j, M] = d.useState(!1), N = d.useRef(null), [F, L] = d.useState(!1), [R, z] = d.useState(null), B = d.useRef(null), H = d.useRef(null), W = d.useRef(null), G = d.useRef(null), [pe, _e] = d.useState(se), J = a().path, Y = d.useMemo(() => i.comments.filter((e) => e.page?.path === J), [i.comments, J]), Se = Y.some(ye), Ce = xe(o || Se || !!v || b.length > 0), we = d.useRef(null), Te = d.useRef([]), Ee = d.useRef(""), De = d.useRef(null);
280
+ d.useEffect(() => {
281
+ we.current = v?.element ?? g?.element ?? null;
282
+ }, [g, v]), d.useEffect(() => {
283
+ Te.current = b;
284
+ }, [b]), d.useEffect(() => {
285
+ Ee.current = E;
286
+ }, [E]), d.useEffect(() => {
287
+ De.current = O;
288
+ }, [O]);
289
+ let Oe = d.useMemo(() => be(Y), [Y, Ce]);
290
+ d.useEffect(() => {
291
+ let e = N.current;
292
+ (e && (i.currentUser?.id !== e.userId || (i.activeBranch ?? null) !== e.branch || J !== e.page || !e.submitting && i.activeTool === null || i.activeTool !== null && i.activeTool !== "select") || !o && !j) && (N.current = null, _(null), y(null), x([]), T(null), D(""), k((e) => (K(e?.previewUrl), null)), M(!1), z(null), C(null), Q.current = null, $.current = !1);
292
293
  }, [
293
- a,
294
- A,
295
- r.activeTool,
296
- r.activeBranch,
297
- r.currentUser?.id,
298
- q
299
- ]), u.useEffect(() => () => {
300
- M.current = null, G(De.current?.previewUrl);
301
- }, []), u.useEffect(() => {
302
- if (!a) return;
294
+ o,
295
+ j,
296
+ i.activeTool,
297
+ i.activeBranch,
298
+ i.currentUser?.id,
299
+ J
300
+ ]), d.useEffect(() => () => {
301
+ N.current = null, K(De.current?.previewUrl);
302
+ }, []), d.useEffect(() => {
303
+ if (!o) return;
303
304
  let e = document.body.style.cursor;
304
305
  document.body.style.cursor = "crosshair";
305
306
  let t = oe();
306
307
  return () => {
307
308
  document.body.style.cursor = e, t();
308
309
  };
309
- }, [a]);
310
- let Y = a && !!_;
311
- u.useEffect(() => {
312
- if (!Y) return;
313
- let e = k();
314
- return e instanceof HTMLElement && !z.current?.contains(e) && (W.current = e), z.current?.querySelector("[data-ck-composer-input]")?.focus({ preventScroll: !0 }), () => {
315
- let e = W.current;
316
- W.current = null, e && e.isConnected && e.focus({ preventScroll: !0 });
310
+ }, [o]);
311
+ let X = o && !!v;
312
+ d.useEffect(() => {
313
+ if (!X) return;
314
+ let e = A();
315
+ return e instanceof HTMLElement && !B.current?.contains(e) && (G.current = e), B.current?.querySelector("[data-ck-composer-input]")?.focus({ preventScroll: !0 }), () => {
316
+ let e = G.current;
317
+ G.current = null, e && e.isConnected && e.focus({ preventScroll: !0 });
317
318
  };
318
- }, [Y]);
319
- let ke = u.useRef(r.isAuthenticated);
320
- u.useEffect(() => {
321
- let e = !ke.current && r.isAuthenticated;
322
- if (ke.current = r.isAuthenticated, !e || !Y || !T.trim()) return;
323
- let t = z.current?.querySelector("[data-ck-composer-input]");
319
+ }, [X]);
320
+ let ke = d.useRef(i.isAuthenticated);
321
+ d.useEffect(() => {
322
+ let e = !ke.current && i.isAuthenticated;
323
+ if (ke.current = i.isAuthenticated, !e || !X || !E.trim()) return;
324
+ let t = B.current?.querySelector("[data-ck-composer-input]");
324
325
  t?.focus({ preventScroll: !0 });
325
326
  let n = t?.value.length ?? 0;
326
- t?.setSelectionRange?.(n, n), R((e) => e && e.startsWith("Sign in to save comments") ? null : e);
327
+ t?.setSelectionRange?.(n, n), z((e) => e && e.startsWith("Sign in to save comments") ? null : e);
327
328
  }, [
328
- r.isAuthenticated,
329
- Y,
330
- T
331
- ]), u.useLayoutEffect(() => {
332
- if (!Y) return;
333
- let e = z.current;
329
+ i.isAuthenticated,
330
+ X,
331
+ E
332
+ ]), d.useLayoutEffect(() => {
333
+ if (!X) return;
334
+ let e = B.current;
334
335
  if (!e) return;
335
336
  let t = () => {
336
337
  let t = e.getBoundingClientRect().height;
@@ -345,81 +346,81 @@ var J = u.memo(function({ core: n, state: r, active: a }) {
345
346
  }
346
347
  return () => n?.disconnect();
347
348
  }, [
348
- Y,
349
- D,
350
- L
351
- ]), u.useEffect(() => {
352
- if (!a) return;
349
+ X,
350
+ O,
351
+ R
352
+ ]), d.useEffect(() => {
353
+ if (!o) return;
353
354
  let e = () => {
354
- v((e) => e && {
355
+ y((e) => e && {
355
356
  ...e,
356
- rect: B(e.element)
357
- }), g((e) => e && {
357
+ rect: V(e.element)
358
+ }), _((e) => e && {
358
359
  ...e,
359
- rect: B(e.element)
360
- }), b((e) => e.map((e) => ({
360
+ rect: V(e.element)
361
+ }), x((e) => e.map((e) => ({
361
362
  ...e,
362
- rect: B(e.element)
363
+ rect: V(e.element)
363
364
  })));
364
365
  };
365
366
  return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
366
367
  window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
367
368
  };
368
- }, [a]);
369
- let X = u.useCallback(async (e, t, r) => {
370
- if (!e || P) return !1;
371
- I(!0), R(null);
369
+ }, [o]);
370
+ let Z = d.useCallback(async (e, t, n) => {
371
+ if (!e || F) return !1;
372
+ L(!0), z(null);
372
373
  try {
373
- let i = t?.trim(), a = r ? [{
374
- name: r.name,
375
- path: r.path,
376
- pathSource: r.pathSource,
377
- type: r.type,
378
- size: r.size,
379
- lastModified: r.lastModified
374
+ let i = t?.trim(), a = n ? [{
375
+ name: n.name,
376
+ path: n.path,
377
+ pathSource: n.pathSource,
378
+ type: n.type,
379
+ size: n.size,
380
+ lastModified: n.lastModified
380
381
  }] : [], o = i || a.length > 0 ? {
381
382
  ...i ? { comment: i } : {},
382
383
  ...a.length > 0 ? { attachments: a } : {}
383
- } : void 0, s = o ? await n.grabElement(e, o) : await n.grabElement(e);
384
- return I(!1), s ? (v(null), g(null), E(""), O((e) => (G(e?.previewUrl), null)), n.setTool(null), !0) : (R("Could not grab this element."), !1);
384
+ } : void 0, s = o ? await r.grabElement(e, o) : await r.grabElement(e);
385
+ return L(!1), s ? (y(null), _(null), D(""), k((e) => (K(e?.previewUrl), null)), r.setTool(null), !0) : (z("Could not grab this element."), !1);
385
386
  } catch {
386
- return I(!1), R("Could not copy this element for the agent."), !1;
387
+ return L(!1), z("Could not copy this element for the agent."), !1;
387
388
  }
388
- }, [n, P]), Z = u.useCallback(async (e) => {
389
- if (e.length === 0 || P) return !1;
390
- I(!0), R(null);
389
+ }, [r, F]), Ae = d.useCallback(async (e) => {
390
+ if (e.length === 0 || F) return !1;
391
+ L(!0), z(null);
391
392
  try {
392
- let t = await n.grabElements(e);
393
- return I(!1), t ? (b([]), v(null), g(null), E(""), O((e) => (G(e?.previewUrl), null)), n.setTool(null), !0) : (R("Could not grab these elements."), !1);
393
+ let t = await r.grabElements(e);
394
+ return L(!1), t ? (x([]), y(null), _(null), D(""), k((e) => (K(e?.previewUrl), null)), r.setTool(null), !0) : (z("Could not grab these elements."), !1);
394
395
  } catch {
395
- return I(!1), R("Could not copy these elements for the agent."), !1;
396
+ return L(!1), z("Could not copy these elements for the agent."), !1;
396
397
  }
397
- }, [n, P]), Ae = u.useCallback(() => {
398
+ }, [r, F]), je = d.useCallback(() => {
398
399
  let e = Te.current.map((e) => e.element);
399
- Z(e);
400
- }, [Z]), je = u.useCallback(() => {
401
- b([]);
402
- }, []), Q = u.useRef(null), $ = u.useRef(!1), Me = u.useRef(null);
403
- Me.current = x;
404
- let Ne = u.useRef(null);
405
- Ne.current = C, u.useEffect(() => {
406
- if (!C) return;
407
- let e = n.blockEscape();
400
+ Ae(e);
401
+ }, [Ae]), Me = d.useCallback(() => {
402
+ x([]);
403
+ }, []), Q = d.useRef(null), $ = d.useRef(!1), Ne = d.useRef(null);
404
+ Ne.current = S;
405
+ let Pe = d.useRef(null);
406
+ Pe.current = w, d.useEffect(() => {
407
+ if (!w) return;
408
+ let e = r.blockEscape();
408
409
  return () => e();
409
- }, [C, n]), u.useEffect(() => {
410
- if (!C) return;
411
- let e = k();
412
- return e instanceof HTMLElement && !U.current?.contains(e) && (W.current = e), U.current?.querySelector("[role=\"menuitem\"]")?.focus({ preventScroll: !0 }), () => {
413
- let e = W.current;
414
- W.current = null, e && e.isConnected && e.focus({ preventScroll: !0 });
410
+ }, [w, r]), d.useEffect(() => {
411
+ if (!w) return;
412
+ let e = A();
413
+ return e instanceof HTMLElement && !W.current?.contains(e) && (G.current = e), W.current?.querySelector("[role=\"menuitem\"]")?.focus({ preventScroll: !0 }), () => {
414
+ let e = G.current;
415
+ G.current = null, e && e.isConnected && e.focus({ preventScroll: !0 });
415
416
  };
416
- }, [C]);
417
- let Pe = u.useCallback((e) => {
418
- let t = U.current;
417
+ }, [w]);
418
+ let Fe = d.useCallback((e) => {
419
+ let t = W.current;
419
420
  if (!t) return;
420
421
  let n = Array.from(t.querySelectorAll("[role=\"menuitem\"]"));
421
422
  if (n.length === 0) return;
422
- let r = k(), i = n.findIndex((e) => e === r), a = (e) => {
423
+ let r = A(), i = n.findIndex((e) => e === r), a = (e) => {
423
424
  n[(e + n.length) % n.length]?.focus({ preventScroll: !0 });
424
425
  };
425
426
  switch (e.key) {
@@ -436,452 +437,454 @@ var J = u.memo(function({ core: n, state: r, active: a }) {
436
437
  e.preventDefault(), e.stopPropagation(), a(n.length - 1);
437
438
  break;
438
439
  case "Enter":
439
- case " ": e.preventDefault(), e.stopPropagation(), k()?.click();
440
+ case " ": e.preventDefault(), e.stopPropagation(), A()?.click();
440
441
  }
441
442
  }, []);
442
- u.useEffect(() => {
443
- if (!a && !A) return;
444
- let r = (e) => {
445
- e.button !== 0 || N(e) || _ || (w(null), Q.current = {
446
- x: e.clientX,
447
- y: e.clientY
443
+ d.useEffect(() => {
444
+ if (!o && !j) return;
445
+ let i = (t) => {
446
+ e() || t.button !== 0 || P(t) || v || (T(null), Q.current = {
447
+ x: t.clientX,
448
+ y: t.clientY
448
449
  }, $.current = !1);
449
- }, i = (n) => {
450
- if (N(n)) return;
451
- let r = F(n.clientX, n.clientY);
452
- r && (n.preventDefault(), n.stopPropagation(), w({
453
- element: r,
454
- selector: t(r),
455
- xpath: e(r),
456
- x: n.clientX,
457
- y: n.clientY
458
- }));
459
- }, o = null, s = null, c = () => {
460
- o &&= (clearTimeout(o), null), s = null;
461
- }, ee = (n) => {
462
- if (N(n) || n.touches.length !== 1) return;
463
- let r = n.touches[0];
464
- if (!r) return;
465
- let i = F(r.clientX, r.clientY);
466
- i && (s = {
450
+ }, a = (r) => {
451
+ if (e() || P(r)) return;
452
+ let i = I(r.clientX, r.clientY);
453
+ i && (r.preventDefault(), r.stopPropagation(), T({
454
+ element: i,
455
+ selector: n(i),
456
+ xpath: t(i),
467
457
  x: r.clientX,
468
- y: r.clientY,
469
- element: i
470
- }, o = setTimeout(() => {
471
- s && (w({
472
- element: s.element,
473
- selector: t(s.element),
474
- xpath: e(s.element),
475
- x: s.x,
476
- y: s.y
477
- }), s = null, o = null);
458
+ y: r.clientY
459
+ }));
460
+ }, s = null, c = null, l = () => {
461
+ s &&= (clearTimeout(s), null), c = null;
462
+ }, ee = (r) => {
463
+ if (e() || P(r) || r.touches.length !== 1) return;
464
+ let i = r.touches[0];
465
+ if (!i) return;
466
+ let a = I(i.clientX, i.clientY);
467
+ a && (c = {
468
+ x: i.clientX,
469
+ y: i.clientY,
470
+ element: a
471
+ }, s = setTimeout(() => {
472
+ c && (T({
473
+ element: c.element,
474
+ selector: n(c.element),
475
+ xpath: t(c.element),
476
+ x: c.x,
477
+ y: c.y
478
+ }), c = null, s = null);
478
479
  }, 550));
479
480
  }, te = (e) => {
480
- if (!s || e.touches.length !== 1) return;
481
+ if (!c || e.touches.length !== 1) return;
481
482
  let t = e.touches[0];
482
483
  if (!t) return;
483
- let n = t.clientX - s.x, r = t.clientY - s.y;
484
- (Math.abs(n) > 10 || Math.abs(r) > 10) && c();
485
- }, l = () => {
486
- c();
487
- }, ne = (e) => {
488
- if (N(e)) return;
489
- let t = Q.current;
490
- if (t) {
491
- if (e.pointerType === "mouse" && !(e.buttons & 1)) Q.current = null, $.current = !1, S(null);
484
+ let n = t.clientX - c.x, r = t.clientY - c.y;
485
+ (Math.abs(n) > 10 || Math.abs(r) > 10) && l();
486
+ }, u = () => {
487
+ l();
488
+ }, ne = (t) => {
489
+ if (e() || P(t)) return;
490
+ let n = Q.current;
491
+ if (n) {
492
+ if (t.pointerType === "mouse" && !(t.buttons & 1)) Q.current = null, $.current = !1, C(null);
492
493
  else {
493
- let n = e.clientX - t.x, r = e.clientY - t.y;
494
- if (Me.current || Math.abs(n) > 6 || Math.abs(r) > 6) {
495
- $.current = !0, S({
496
- startX: t.x,
497
- startY: t.y,
498
- x: e.clientX,
499
- y: e.clientY
500
- }), g(null);
494
+ let e = t.clientX - n.x, r = t.clientY - n.y;
495
+ if (Ne.current || Math.abs(e) > 6 || Math.abs(r) > 6) {
496
+ $.current = !0, C({
497
+ startX: n.x,
498
+ startY: n.y,
499
+ x: t.clientX,
500
+ y: t.clientY
501
+ }), _(null);
501
502
  return;
502
503
  }
503
504
  }
504
505
  }
505
- if (_) return;
506
- let n = F(e.clientX, e.clientY);
507
- g(n ? H(n) : null);
508
- }, u = () => {
509
- Q.current = null, $.current = !1, S(null);
510
- }, d = (e) => {
511
- let t = Q.current;
506
+ if (v) return;
507
+ let r = I(t.clientX, t.clientY);
508
+ _(r ? U(r) : null);
509
+ }, d = () => {
510
+ Q.current = null, $.current = !1, C(null);
511
+ }, f = (t) => {
512
+ if (e()) return;
513
+ let n = Q.current;
512
514
  Q.current = null;
513
- let n = Me.current;
514
- if (!t || !n) return;
515
- let r = le({
516
- ...n,
517
- x: e.clientX,
518
- y: e.clientY
515
+ let r = Ne.current;
516
+ if (!n || !r) return;
517
+ let i = le({
518
+ ...r,
519
+ x: t.clientX,
520
+ y: t.clientY
519
521
  });
520
- if (r.width < 6 || r.height < 6) {
521
- S(null);
522
+ if (i.width < 6 || i.height < 6) {
523
+ C(null);
522
524
  return;
523
525
  }
524
- let i = ue(r);
525
- if (i.length > 0) {
526
- let e = i.map(H);
527
- b((t) => {
526
+ let a = ue(i);
527
+ if (a.length > 0) {
528
+ let e = a.map(U);
529
+ x((t) => {
528
530
  let n = new Set(t.map((e) => e.element)), r = [...t];
529
531
  for (let t of e) n.has(t.element) || r.push(t);
530
532
  return r;
531
533
  });
532
534
  }
533
- S(null);
534
- }, f = (e) => {
535
- if (N(e) || A) return;
535
+ C(null);
536
+ }, p = (t) => {
537
+ if (e() || P(t) || j) return;
536
538
  if ($.current) {
537
- $.current = !1, e.preventDefault(), e.stopPropagation();
539
+ $.current = !1, t.preventDefault(), t.stopPropagation();
538
540
  return;
539
541
  }
540
- e.preventDefault(), e.stopPropagation();
541
- let t = F(e.clientX, e.clientY);
542
- _ && !e.shiftKey ? (v(null), g(null), E(""), O((e) => (G(e?.previewUrl), null)), R(null)) : t && (e.shiftKey ? (b((e) => e.some((e) => e.element === t) ? e.filter((e) => e.element !== t) : [..._ && !e.some((e) => e.element === _.element) ? [...e, _] : e, H(t)]), g(null), v(null), E(""), O((e) => (G(e?.previewUrl), null)), R(null)) : (v(H(t)), g(null), E(""), O((e) => (G(e?.previewUrl), null)), R(null)));
543
- }, p = (e) => {
544
- if (e.key === "Escape") {
545
- if (e.isComposing) return;
546
- if (Ne.current) {
547
- e.preventDefault(), e.stopPropagation(), w(null);
542
+ t.preventDefault(), t.stopPropagation();
543
+ let n = I(t.clientX, t.clientY);
544
+ v && !t.shiftKey ? (y(null), _(null), D(""), k((e) => (K(e?.previewUrl), null)), z(null)) : n && (t.shiftKey ? (x((e) => e.some((e) => e.element === n) ? e.filter((e) => e.element !== n) : [...v && !e.some((e) => e.element === v.element) ? [...e, v] : e, U(n)]), _(null), y(null), D(""), k((e) => (K(e?.previewUrl), null)), z(null)) : (y(U(n)), _(null), D(""), k((e) => (K(e?.previewUrl), null)), z(null)));
545
+ }, m = (t) => {
546
+ if (e()) return;
547
+ if (t.key === "Escape") {
548
+ if (t.isComposing) return;
549
+ if (Pe.current) {
550
+ t.preventDefault(), t.stopPropagation(), T(null);
548
551
  return;
549
552
  }
550
- e.preventDefault(), e.stopPropagation(), M.current = null, j(!1), v(null), g(null), E(""), O((e) => (G(e?.previewUrl), null)), R(null), n.setTool(null);
553
+ t.preventDefault(), t.stopPropagation(), N.current = null, M(!1), y(null), _(null), D(""), k((e) => (K(e?.previewUrl), null)), z(null), r.setTool(null);
551
554
  return;
552
555
  }
553
- if (A || !e.metaKey && !e.ctrlKey || e.shiftKey || e.altKey || e.key !== "c" && e.key !== "C" && e.code !== "KeyC" || ce(e)) return;
554
- let t = typeof window < "u" ? window.getSelection() : null;
555
- if (t && !t.isCollapsed && t.toString().length > 0) return;
556
- let r = Te.current;
557
- if (r.length > 0) {
558
- e.preventDefault(), e.stopPropagation(), Z(r.map((e) => e.element));
556
+ if (j || !t.metaKey && !t.ctrlKey || t.shiftKey || t.altKey || t.key !== "c" && t.key !== "C" && t.code !== "KeyC" || ce(t)) return;
557
+ let n = typeof window < "u" ? window.getSelection() : null;
558
+ if (n && !n.isCollapsed && n.toString().length > 0) return;
559
+ let i = Te.current;
560
+ if (i.length > 0) {
561
+ t.preventDefault(), t.stopPropagation(), Ae(i.map((e) => e.element));
559
562
  return;
560
563
  }
561
- let i = we.current;
562
- if (!i) return;
563
- e.preventDefault(), e.stopPropagation();
564
- let a = _?.element === i;
565
- X(i, a ? Ee.current : void 0, a ? De.current : null);
564
+ let a = we.current;
565
+ if (!a) return;
566
+ t.preventDefault(), t.stopPropagation();
567
+ let o = v?.element === a;
568
+ Z(a, o ? Ee.current : void 0, o ? De.current : null);
566
569
  };
567
- return document.addEventListener("pointerdown", r, !0), document.addEventListener("pointermove", ne, !0), document.addEventListener("pointerup", d, !0), document.addEventListener("pointercancel", u, !0), document.addEventListener("click", f, !0), document.addEventListener("contextmenu", i, !0), document.addEventListener("touchstart", ee, {
570
+ return document.addEventListener("pointerdown", i, !0), document.addEventListener("pointermove", ne, !0), document.addEventListener("pointerup", f, !0), document.addEventListener("pointercancel", d, !0), document.addEventListener("click", p, !0), document.addEventListener("contextmenu", a, !0), document.addEventListener("touchstart", ee, {
568
571
  capture: !0,
569
572
  passive: !0
570
573
  }), document.addEventListener("touchmove", te, {
571
574
  capture: !0,
572
575
  passive: !0
573
- }), document.addEventListener("touchend", l, {
576
+ }), document.addEventListener("touchend", u, {
574
577
  capture: !0,
575
578
  passive: !0
576
- }), document.addEventListener("touchcancel", l, {
579
+ }), document.addEventListener("touchcancel", u, {
577
580
  capture: !0,
578
581
  passive: !0
579
- }), window.addEventListener("keydown", p, !0), () => {
580
- document.removeEventListener("pointerdown", r, !0), document.removeEventListener("pointermove", ne, !0), document.removeEventListener("pointerup", d, !0), document.removeEventListener("pointercancel", u, !0), document.removeEventListener("click", f, !0), document.removeEventListener("contextmenu", i, !0), document.removeEventListener("touchstart", ee, !0), document.removeEventListener("touchmove", te, !0), document.removeEventListener("touchend", l, !0), document.removeEventListener("touchcancel", l, !0), window.removeEventListener("keydown", p, !0), c();
582
+ }), window.addEventListener("keydown", m, !0), () => {
583
+ document.removeEventListener("pointerdown", i, !0), document.removeEventListener("pointermove", ne, !0), document.removeEventListener("pointerup", f, !0), document.removeEventListener("pointercancel", d, !0), document.removeEventListener("click", p, !0), document.removeEventListener("contextmenu", a, !0), document.removeEventListener("touchstart", ee, !0), document.removeEventListener("touchmove", te, !0), document.removeEventListener("touchend", u, !0), document.removeEventListener("touchcancel", u, !0), window.removeEventListener("keydown", m, !0), l();
581
584
  };
582
585
  }, [
583
- a,
584
- A,
585
- n,
586
- X,
586
+ o,
587
+ j,
588
+ r,
587
589
  Z,
588
- _
590
+ Ae,
591
+ v
589
592
  ]);
590
- let Fe = u.useCallback(async (e) => {
593
+ let Ie = d.useCallback(async (e) => {
591
594
  e.preventDefault();
592
- let t = T.trim();
593
- if (!_ || !t || A) return;
594
- if (!r.currentUser) {
595
- R("Sign in to save comments. You can still use Grab for agent without signing in."), n.toggleLoginModal();
595
+ let t = E.trim();
596
+ if (!v || !t || j) return;
597
+ if (!i.currentUser) {
598
+ z("Sign in to save comments. You can still use Grab for agent without signing in."), r.toggleLoginModal();
596
599
  return;
597
600
  }
598
- let a = {
599
- userId: r.currentUser.id,
600
- branch: r.activeBranch ?? null,
601
- page: q,
601
+ let n = {
602
+ userId: i.currentUser.id,
603
+ branch: i.activeBranch ?? null,
604
+ page: J,
602
605
  submitting: !1
603
606
  };
604
- M.current = a;
607
+ N.current = n;
605
608
  let o = () => {
606
- let e = n.getState();
607
- return M.current === a && e.isAuthenticated && e.currentUser?.id === a.userId && (e.activeBranch ?? null) === a.branch && (e.activeTool === null || e.activeTool === "select") && i().path === a.page;
608
- }, s = n.on("auth:logout", () => {
609
- M.current === a && (M.current = null, j(!1));
609
+ let e = r.getState();
610
+ return N.current === n && e.isAuthenticated && e.currentUser?.id === n.userId && (e.activeBranch ?? null) === n.branch && (e.activeTool === null || e.activeTool === "select") && a().path === n.page;
611
+ }, s = r.on("auth:logout", () => {
612
+ N.current === n && (N.current = null, M(!1));
610
613
  });
611
- j(!0), R(null);
614
+ M(!0), z(null);
612
615
  try {
613
- let e = await c(n, t, de(_), { files: D ? [D.file] : [] }, () => !o() || n.getState().activeTool !== "select" ? !1 : (a.submitting = !0, !0));
616
+ let e = await l(r, t, de(v), { files: O ? [O.file] : [] }, () => !o() || r.getState().activeTool !== "select" ? !1 : (n.submitting = !0, !0));
614
617
  if (!o()) return;
615
618
  if (e.status === "failed") throw Error(e.message);
616
- v(null), E(""), O((e) => (G(e?.previewUrl), null)), n.setTool(null);
619
+ y(null), D(""), k((e) => (K(e?.previewUrl), null)), r.setTool(null);
617
620
  } catch {
618
621
  if (!o()) return;
619
- n.getState().activeTool === null && n.setTool("select"), R("Could not save this comment. Try again.");
622
+ r.getState().activeTool === null && r.setTool("select"), z("Could not save this comment. Try again.");
620
623
  } finally {
621
- s(), M.current === a && (M.current = null, j(!1));
624
+ s(), N.current === n && (N.current = null, M(!1));
622
625
  }
623
626
  }, [
624
- D,
625
- T,
626
- n,
627
- q,
628
- A,
629
- _,
630
- r.activeBranch,
631
- r.currentUser
632
- ]), Ie = u.useCallback(() => {
633
- X(_?.element ?? null, T, D);
627
+ O,
628
+ E,
629
+ r,
630
+ J,
631
+ j,
632
+ v,
633
+ i.activeBranch,
634
+ i.currentUser
635
+ ]), Le = d.useCallback(() => {
636
+ Z(v?.element ?? null, E, O);
634
637
  }, [
635
- D,
636
- T,
637
- X,
638
- _
639
- ]), Le = u.useCallback(() => {
640
- V.current?.click();
641
- }, []), Re = u.useCallback((e) => {
638
+ O,
639
+ E,
640
+ Z,
641
+ v
642
+ ]), Re = d.useCallback(() => {
643
+ H.current?.click();
644
+ }, []), ze = d.useCallback((e) => {
642
645
  let t = e.currentTarget, n = t.files?.[0] ?? null;
643
- O((e) => (G(e?.previewUrl), n ? me(n, t) : null)), t.value = "";
644
- }, []), ze = u.useCallback(() => {
645
- O((e) => (G(e?.previewUrl), null));
646
- }, []), Be = u.useMemo(() => ne(), []);
647
- return !a && !A && Oe.length === 0 ? null : /* @__PURE__ */ p("div", {
646
+ k((e) => (K(e?.previewUrl), n ? me(n, t) : null)), t.value = "";
647
+ }, []), Be = d.useCallback(() => {
648
+ k((e) => (K(e?.previewUrl), null));
649
+ }, []), Ve = d.useMemo(() => ne(), []);
650
+ return !o && !j && Oe.length === 0 ? null : /* @__PURE__ */ m("div", {
648
651
  className: "ck-element-selector",
649
652
  "data-testid": "ck-element-selector",
650
653
  children: [
651
- Oe.map((e) => /* @__PURE__ */ f("div", {
654
+ Oe.map((e) => /* @__PURE__ */ p("div", {
652
655
  "aria-hidden": "true",
653
656
  className: "ck-element-selector-mark",
654
657
  "data-comment-id": e.id,
655
- style: K(e.rect)
658
+ style: q(e.rect)
656
659
  }, e.id)),
657
- a && h && !x && /* @__PURE__ */ f("div", {
660
+ o && g && !S && /* @__PURE__ */ p("div", {
658
661
  "aria-hidden": "true",
659
662
  className: "ck-element-selector-outline",
660
663
  "data-state": "hover",
661
- style: K(h.rect)
664
+ style: q(g.rect)
662
665
  }),
663
- a && x && /* @__PURE__ */ f("div", {
666
+ o && S && /* @__PURE__ */ p("div", {
664
667
  "aria-hidden": "true",
665
668
  className: "ck-element-selector-marquee",
666
669
  "data-testid": "ck-element-selector-marquee",
667
670
  style: {
668
- left: Math.min(x.startX, x.x),
669
- top: Math.min(x.startY, x.y),
670
- width: Math.abs(x.x - x.startX),
671
- height: Math.abs(x.y - x.startY)
671
+ left: Math.min(S.startX, S.x),
672
+ top: Math.min(S.startY, S.y),
673
+ width: Math.abs(S.x - S.startX),
674
+ height: Math.abs(S.y - S.startY)
672
675
  }
673
676
  }),
674
- a && y.map((e, t) => /* @__PURE__ */ f("div", {
677
+ o && b.map((e, t) => /* @__PURE__ */ p("div", {
675
678
  "aria-hidden": "true",
676
679
  className: "ck-element-selector-outline",
677
680
  "data-state": "multi",
678
681
  "data-multi-index": t + 1,
679
- style: K(e.rect)
682
+ style: q(e.rect)
680
683
  }, `multi-${t}-${e.selector}-${e.xpath}`)),
681
- a && C && /* @__PURE__ */ p("ul", {
682
- ref: U,
684
+ o && w && /* @__PURE__ */ m("ul", {
685
+ ref: W,
683
686
  className: "ck-element-selector-context-menu",
684
687
  "data-testid": "ck-element-selector-context-menu",
685
688
  role: "menu",
686
689
  "aria-label": "Element actions",
687
- onKeyDown: Pe,
688
- style: ve(C),
690
+ onKeyDown: Fe,
691
+ style: ve(w),
689
692
  children: [
690
- /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f("button", {
693
+ /* @__PURE__ */ p("li", { children: /* @__PURE__ */ p("button", {
691
694
  type: "button",
692
695
  role: "menuitem",
693
696
  "data-testid": "ck-context-menu-grab",
694
697
  onClick: () => {
695
- let e = C.element;
696
- w(null), X(e);
698
+ let e = w.element;
699
+ T(null), Z(e);
697
700
  },
698
701
  children: "Grab for agent"
699
702
  }) }),
700
- /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f("button", {
703
+ /* @__PURE__ */ p("li", { children: /* @__PURE__ */ p("button", {
701
704
  type: "button",
702
705
  role: "menuitem",
703
706
  "data-testid": "ck-context-menu-comment",
704
- disabled: !m,
707
+ disabled: !h,
705
708
  onClick: () => {
706
- let e = H(C.element);
707
- w(null), v(e);
709
+ let e = U(w.element);
710
+ T(null), y(e);
708
711
  },
709
712
  children: "Add comment"
710
713
  }) }),
711
- /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f("button", {
714
+ /* @__PURE__ */ p("li", { children: /* @__PURE__ */ p("button", {
712
715
  type: "button",
713
716
  role: "menuitem",
714
717
  "data-testid": "ck-context-menu-copy-selector",
715
718
  onClick: () => {
716
- let e = C.selector;
717
- w(null), he(e, "CSS selector");
719
+ let e = w.selector;
720
+ T(null), he(e, "CSS selector");
718
721
  },
719
722
  children: "Copy CSS selector"
720
723
  }) }),
721
- /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f("button", {
724
+ /* @__PURE__ */ p("li", { children: /* @__PURE__ */ p("button", {
722
725
  type: "button",
723
726
  role: "menuitem",
724
727
  "data-testid": "ck-context-menu-copy-xpath",
725
728
  onClick: () => {
726
- let e = C.xpath;
727
- w(null), he(e, "XPath");
729
+ let e = w.xpath;
730
+ T(null), he(e, "XPath");
728
731
  },
729
732
  children: "Copy XPath"
730
733
  }) }),
731
- /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f("button", {
734
+ /* @__PURE__ */ p("li", { children: /* @__PURE__ */ p("button", {
732
735
  type: "button",
733
736
  role: "menuitem",
734
737
  "data-testid": "ck-context-menu-inspect",
735
738
  onClick: () => {
736
- console.log("[CommentKit] inspect", C.element), w(null);
739
+ console.log("[CommentKit] inspect", w.element), T(null);
737
740
  },
738
741
  children: "Inspect (log to console)"
739
742
  }) })
740
743
  ]
741
744
  }),
742
- a && y.length > 0 && /* @__PURE__ */ p("div", {
745
+ o && b.length > 0 && /* @__PURE__ */ m("div", {
743
746
  className: "ck-element-selector-multibar",
744
747
  "data-testid": "ck-element-selector-multibar",
745
748
  children: [
746
- /* @__PURE__ */ p("span", {
749
+ /* @__PURE__ */ m("span", {
747
750
  className: "ck-element-selector-multibar-count",
748
- children: [y.length, " selected"]
751
+ children: [b.length, " selected"]
749
752
  }),
750
- /* @__PURE__ */ f(o, {
753
+ /* @__PURE__ */ p(s, {
751
754
  type: "button",
752
755
  size: "sm",
753
- onClick: Ae,
754
- disabled: P,
756
+ onClick: je,
757
+ disabled: F,
755
758
  "data-testid": "ck-element-grab-many-button",
756
- children: P ? "Grabbing…" : `Grab ${y.length} for agent`
759
+ children: F ? "Grabbing…" : `Grab ${b.length} for agent`
757
760
  }),
758
- /* @__PURE__ */ f(o, {
761
+ /* @__PURE__ */ p(s, {
759
762
  type: "button",
760
763
  size: "sm",
761
764
  variant: "ghost",
762
- onClick: je,
763
- disabled: P,
765
+ onClick: Me,
766
+ disabled: F,
764
767
  "data-testid": "ck-element-grab-clear-button",
765
768
  children: "Clear"
766
769
  })
767
770
  ]
768
771
  }),
769
- (a || A) && _ && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("div", {
772
+ (o || j) && v && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", {
770
773
  "aria-hidden": "true",
771
774
  className: "ck-element-selector-outline",
772
775
  "data-state": "selected",
773
- style: K(_.rect)
774
- }), /* @__PURE__ */ p("form", {
775
- ref: z,
776
+ style: q(v.rect)
777
+ }), /* @__PURE__ */ m("form", {
778
+ ref: B,
776
779
  className: "ck-element-selector-composer",
777
- style: ge(_.rect, pe),
778
- onSubmit: Fe,
780
+ style: ge(v.rect, pe),
781
+ onSubmit: Ie,
779
782
  children: [
780
- /* @__PURE__ */ f("div", {
783
+ /* @__PURE__ */ p("div", {
781
784
  className: "ck-element-selector-input-row",
782
- children: /* @__PURE__ */ f(te, {
785
+ children: /* @__PURE__ */ p(te, {
783
786
  "data-ck-composer-input": "",
784
787
  "aria-label": "Element comment",
785
- value: T,
788
+ value: E,
786
789
  placeholder: "Add comment",
787
- disabled: A || P,
790
+ disabled: j || F,
788
791
  onChange: (e) => {
789
- E(e.currentTarget.value), L && R(null);
792
+ D(e.currentTarget.value), R && z(null);
790
793
  }
791
794
  })
792
795
  }),
793
- !s && /* @__PURE__ */ f("input", {
794
- ref: V,
796
+ !c && /* @__PURE__ */ p("input", {
797
+ ref: H,
795
798
  "aria-label": "Attach file",
796
799
  className: "ck-element-selector-file-input",
797
800
  type: "file",
798
- disabled: A || P,
799
- onChange: Re
801
+ disabled: j || F,
802
+ onChange: ze
800
803
  }),
801
- D && /* @__PURE__ */ p("div", {
804
+ O && /* @__PURE__ */ m("div", {
802
805
  className: "ck-element-selector-attachment",
803
806
  "data-testid": "ck-element-attachment-preview",
804
807
  children: [
805
- D.previewUrl && /* @__PURE__ */ f("img", {
808
+ O.previewUrl && /* @__PURE__ */ p("img", {
806
809
  alt: "",
807
810
  "aria-hidden": "true",
808
811
  className: "ck-element-selector-attachment-image",
809
- src: D.previewUrl
812
+ src: O.previewUrl
810
813
  }),
811
- /* @__PURE__ */ p("div", {
814
+ /* @__PURE__ */ m("div", {
812
815
  className: "ck-element-selector-attachment-meta",
813
816
  children: [
814
- /* @__PURE__ */ f("span", {
817
+ /* @__PURE__ */ p("span", {
815
818
  className: "ck-element-selector-attachment-name",
816
- children: D.name
819
+ children: O.name
817
820
  }),
818
- /* @__PURE__ */ f("span", {
821
+ /* @__PURE__ */ p("span", {
819
822
  className: "ck-element-selector-attachment-path",
820
- title: D.path,
821
- children: D.path
823
+ title: O.path,
824
+ children: O.path
822
825
  }),
823
- /* @__PURE__ */ f("span", {
826
+ /* @__PURE__ */ p("span", {
824
827
  className: "ck-element-selector-attachment-size",
825
- children: fe(D.size)
828
+ children: fe(O.size)
826
829
  })
827
830
  ]
828
831
  }),
829
- /* @__PURE__ */ f(o, {
832
+ /* @__PURE__ */ p(s, {
830
833
  type: "button",
831
834
  size: "icon-xs",
832
835
  variant: "ghost",
833
836
  "aria-label": "Remove attachment",
834
- disabled: A || P,
835
- onClick: ze,
836
- children: /* @__PURE__ */ f(ie, {
837
+ disabled: j || F,
838
+ onClick: Be,
839
+ children: /* @__PURE__ */ p(ie, {
837
840
  className: "ck-element-selector-action-icon",
838
841
  "aria-hidden": "true"
839
842
  })
840
843
  })
841
844
  ]
842
845
  }),
843
- /* @__PURE__ */ p("div", {
846
+ /* @__PURE__ */ m("div", {
844
847
  className: "ck-element-selector-actions",
845
848
  children: [
846
- !s && /* @__PURE__ */ p(o, {
849
+ !c && /* @__PURE__ */ m(s, {
847
850
  type: "button",
848
851
  variant: "outline",
849
852
  className: "ck-element-selector-attach-action",
850
- disabled: A || P,
851
- onClick: Le,
853
+ disabled: j || F,
854
+ onClick: Re,
852
855
  "data-testid": "ck-element-attach-button",
853
- children: [/* @__PURE__ */ f(re, {
856
+ children: [/* @__PURE__ */ p(re, {
854
857
  className: "ck-element-selector-action-icon",
855
858
  "aria-hidden": "true"
856
- }), /* @__PURE__ */ f("span", { children: "Attach" })]
859
+ }), /* @__PURE__ */ p("span", { children: "Attach" })]
857
860
  }),
858
- /* @__PURE__ */ f(o, {
861
+ /* @__PURE__ */ p(s, {
859
862
  type: "submit",
860
863
  className: "ck-element-selector-save-action",
861
- disabled: !m || !T.trim() || A || P,
862
- children: A ? "Saving" : "Save"
864
+ disabled: !h || !E.trim() || j || F,
865
+ children: j ? "Saving" : "Save"
863
866
  }),
864
- /* @__PURE__ */ f(o, {
867
+ /* @__PURE__ */ p(s, {
865
868
  type: "button",
866
869
  className: "ck-element-selector-grab-action",
867
- variant: Be ? "default" : "outline",
868
- disabled: A || P,
869
- onClick: Ie,
870
- title: s ? "Copy element context to clipboard for your agent" : "Copy element source + screenshot to clipboard for your agent",
870
+ variant: Ve ? "default" : "outline",
871
+ disabled: j || F,
872
+ onClick: Le,
873
+ title: c ? "Copy element context to clipboard for your agent" : "Copy element source + screenshot to clipboard for your agent",
871
874
  "data-testid": "ck-element-grab-button",
872
- children: P ? "Grabbing…" : "Grab for agent"
875
+ children: F ? "Grabbing…" : "Grab for agent"
873
876
  })
874
877
  ]
875
878
  }),
876
- !m && /* @__PURE__ */ f("p", {
879
+ !h && /* @__PURE__ */ p("p", {
877
880
  role: "status",
878
881
  className: "ck-element-selector-error",
879
882
  children: ae
880
883
  }),
881
- L && /* @__PURE__ */ f("p", {
884
+ R && /* @__PURE__ */ p("p", {
882
885
  className: "ck-element-selector-error",
883
886
  role: "alert",
884
- children: L
887
+ children: R
885
888
  })
886
889
  ]
887
890
  })] })
@@ -889,9 +892,9 @@ var J = u.memo(function({ core: n, state: r, active: a }) {
889
892
  });
890
893
  });
891
894
  function Se(e) {
892
- return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("style", {
895
+ return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("style", {
893
896
  "data-ck-tool-styles": "element-selector",
894
- children: m
895
- }), /* @__PURE__ */ f(J, { ...e })] });
897
+ children: h
898
+ }), /* @__PURE__ */ p(Y, { ...e })] });
896
899
  }
897
900
  export { Se as ElementSelector };