pixelagent 0.1.15 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,54 +1,54 @@
1
- import { jsxs as d, Fragment as G, jsx as n } from "react/jsx-runtime";
2
- import { useState as A, useEffect as H, useRef as W, useMemo as we, useLayoutEffect as Wt, useCallback as L, useId as Yt } from "react";
3
- import { getElementDisplayLabel as Ue, captureTextSnapshot as Ze, captureInlineStyles as Qe, restoreInlineStyles as ye, restoreTextSnapshot as Ne, getPreviewTargets as Ee, clearTailwindStatePreview as ke, applyTailwindStatePreview as Fe, setEditableTextPreview as et, getRelevantComputedStyles as Ce, getEditableTextInfo as ue, readReactSource as We, detectStylingSystem as bt, countElementInstances as yt, getScopeSelector as wt, getCssSelector as xt, copyToClipboard as Nt, getWindowSelectionText as kt, getNearestReactComponentName as Xt, getDomPath as Gt, resolveElementFromEntry as Ct, getAnnotationSessionDisplay as Kt, loadAnnotationSession as jt, saveAnnotationSession as qt, DEFAULT_PIXEL_AGENT_UI_SETTINGS as Jt, readHostThemeFromDocument as tt, resolvePixelAgentChrome as Zt, applyHostThemeToDocument as Qt, pixelAgentRootAttributes as en, getElementsInArea as tn, formatAllAnnotations as nn, formatAnnotation as rn } from "@pixelagent/shared";
1
+ import { jsxs as d, Fragment as K, jsx as n } from "react/jsx-runtime";
2
+ import { useState as S, useEffect as _, useRef as Y, useMemo as xe, useLayoutEffect as Kt, useCallback as $, useId as jt } from "react";
3
+ import { getElementDisplayLabel as Xe, captureTextSnapshot as tt, captureInlineStyles as nt, restoreInlineStyles as we, restoreTextSnapshot as ke, getPreviewTargets as $e, clearTailwindStatePreview as Ce, applyTailwindStatePreview as ze, setEditableTextPreview as rt, getRelevantComputedStyles as Me, getEditableTextInfo as fe, readReactSource as Ge, detectStylingSystem as kt, countElementInstances as Ct, getScopeSelector as Mt, getCssSelector as At, copyToClipboard as St, getWindowSelectionText as Lt, getNearestReactComponentName as qt, getDomPath as Jt, resolveElementFromEntry as Et, getAnnotationSessionDisplay as Zt, loadAnnotationSession as Qt, saveAnnotationSession as en, DEFAULT_PIXEL_AGENT_UI_SETTINGS as tn, readHostThemeFromDocument as it, resolvePixelAgentChrome as nn, applyHostThemeToDocument as rn, pixelAgentRootAttributes as an, getElementsInArea as on, formatAllAnnotations as sn, formatAnnotation as ln } from "@pixelagent/shared";
4
4
  export * from "@pixelagent/shared";
5
- import { createPortal as Ye } from "react-dom";
6
- function Mt({
5
+ import { createPortal as Ke } from "react-dom";
6
+ function $t({
7
7
  element: e,
8
8
  selected: t,
9
9
  multiSelected: i = [],
10
10
  primarySelected: r = null
11
11
  }) {
12
- const [a, o] = A([]), s = r ?? t;
13
- if (H(() => {
14
- const l = /* @__PURE__ */ new Map(), p = i.length > 0;
15
- e && !t && !p && l.set(e, !1), t && l.set(t, !0);
16
- for (const g of i)
17
- l.set(g, !0);
12
+ const [a, s] = S([]), o = r ?? t;
13
+ if (_(() => {
14
+ const l = /* @__PURE__ */ new Map(), f = i.length > 0;
15
+ e && !t && !f && l.set(e, !1), t && l.set(t, !0);
16
+ for (const m of i)
17
+ l.set(m, !0);
18
18
  if (l.size === 0) {
19
- o([]);
19
+ s([]);
20
20
  return;
21
21
  }
22
- const f = () => {
23
- o(
24
- Array.from(l.entries()).map(([g, m]) => ({
25
- rect: g.getBoundingClientRect(),
26
- label: Ue(g),
27
- isSelected: m,
28
- isPrimary: s !== null && g === s
22
+ const p = () => {
23
+ s(
24
+ Array.from(l.entries()).map(([m, g]) => ({
25
+ rect: m.getBoundingClientRect(),
26
+ label: Xe(m),
27
+ isSelected: g,
28
+ isPrimary: o !== null && m === o
29
29
  }))
30
30
  );
31
31
  };
32
- f();
33
- const v = Array.from(l.keys()).map((g) => {
34
- const m = new ResizeObserver(f);
35
- return m.observe(g), m;
32
+ p();
33
+ const v = Array.from(l.keys()).map((m) => {
34
+ const g = new ResizeObserver(p);
35
+ return g.observe(m), g;
36
36
  });
37
- return window.addEventListener("scroll", f, !0), window.addEventListener("resize", f), () => {
38
- for (const g of v) g.disconnect();
39
- window.removeEventListener("scroll", f, !0), window.removeEventListener("resize", f);
37
+ return window.addEventListener("scroll", p, !0), window.addEventListener("resize", p), () => {
38
+ for (const m of v) m.disconnect();
39
+ window.removeEventListener("scroll", p, !0), window.removeEventListener("resize", p);
40
40
  };
41
- }, [e, t, i, s]), a.length === 0) return null;
42
- const u = a.find((l) => l.isPrimary) ?? a.find((l) => l.isSelected) ?? a[0], c = a.filter((l) => l.isSelected).length;
43
- return /* @__PURE__ */ d(G, { children: [
44
- a.map((l, p) => /* @__PURE__ */ n(
41
+ }, [e, t, i, o]), a.length === 0) return null;
42
+ const c = a.find((l) => l.isPrimary) ?? a.find((l) => l.isSelected) ?? a[0], u = a.filter((l) => l.isSelected).length;
43
+ return /* @__PURE__ */ d(K, { children: [
44
+ a.map((l, f) => /* @__PURE__ */ n(
45
45
  "div",
46
46
  {
47
47
  className: [
48
48
  "pa-highlight",
49
49
  l.isSelected ? "pa-highlight-selected" : "",
50
50
  l.isPrimary ? "pa-highlight-primary" : "",
51
- l.isSelected && !l.isPrimary && c > 1 ? "pa-highlight-scope" : ""
51
+ l.isSelected && !l.isPrimary && u > 1 ? "pa-highlight-scope" : ""
52
52
  ].filter(Boolean).join(" "),
53
53
  style: {
54
54
  top: l.rect.top,
@@ -57,106 +57,106 @@ function Mt({
57
57
  height: l.rect.height
58
58
  }
59
59
  },
60
- `${l.label}-${p}`
60
+ `${l.label}-${f}`
61
61
  )),
62
62
  /* @__PURE__ */ n(
63
63
  "div",
64
64
  {
65
65
  className: "pa-tooltip",
66
66
  style: {
67
- top: Math.max(0, u.rect.top - 28),
68
- left: u.rect.left
67
+ top: Math.max(0, c.rect.top - 28),
68
+ left: c.rect.left
69
69
  },
70
- children: c > 1 ? `${c} instances · ${u.label}` : u.label
70
+ children: u > 1 ? `${u} instances · ${c.label}` : c.label
71
71
  }
72
72
  )
73
73
  ] });
74
74
  }
75
- const At = 0.35, an = 0.48;
76
- function on(e, t, i, r = At) {
75
+ const It = 0.35, cn = 0.48;
76
+ function dn(e, t, i, r = It) {
77
77
  if (e < 8 || t < 8) return null;
78
- const a = 1, o = Math.max(1, Math.round(e * a)), s = Math.max(1, Math.round(t * a)), u = document.createElement("canvas");
79
- u.width = o, u.height = s;
80
- const c = u.getContext("2d");
81
- if (!c) return null;
82
- const l = c.createImageData(o, s), p = l.data, f = Math.min(0.5, i / Math.min(e, t)), v = 0.3, g = 0.2, m = Math.max(0.4, f + 0.1);
83
- let y = 0;
84
- const E = new Float32Array(o * s * 2);
85
- let x = 0;
86
- for (let N = 0; N < s; N++)
87
- for (let T = 0; T < o; T++) {
88
- const P = T / o - 0.5, $ = N / s - 0.5, k = sn(P, $, v, g, m), I = nt(0.8, 0, k - 0.15), C = nt(0, 1, I), h = (P * C + 0.5) * o - T, B = ($ * C + 0.5) * s - N;
89
- Math.abs(h) > y && (y = Math.abs(h)), Math.abs(B) > y && (y = Math.abs(B)), E[x++] = h, E[x++] = B;
78
+ const a = 1, s = Math.max(1, Math.round(e * a)), o = Math.max(1, Math.round(t * a)), c = document.createElement("canvas");
79
+ c.width = s, c.height = o;
80
+ const u = c.getContext("2d");
81
+ if (!u) return null;
82
+ const l = u.createImageData(s, o), f = l.data, p = Math.min(0.5, i / Math.min(e, t)), v = 0.3, m = 0.2, g = Math.max(0.4, p + 0.1);
83
+ let b = 0;
84
+ const E = new Float32Array(s * o * 2);
85
+ let N = 0;
86
+ for (let k = 0; k < o; k++)
87
+ for (let I = 0; I < s; I++) {
88
+ const P = I / s - 0.5, R = k / o - 0.5, x = un(P, R, v, m, g), T = at(0.8, 0, x - 0.15), C = at(0, 1, T), h = (P * C + 0.5) * s - I, F = (R * C + 0.5) * o - k;
89
+ Math.abs(h) > b && (b = Math.abs(h)), Math.abs(F) > b && (b = Math.abs(F)), E[N++] = h, E[N++] = F;
90
90
  }
91
- if (y === 0) return null;
92
- y *= 0.4 * r;
91
+ if (b === 0) return null;
92
+ b *= 0.4 * r;
93
93
  let w = 0;
94
- for (let N = 0; N < p.length; N += 4) {
95
- const T = E[w++] / y + 0.5, P = E[w++] / y + 0.5;
96
- p[N] = T * 255, p[N + 1] = P * 255, p[N + 2] = 0, p[N + 3] = 255;
94
+ for (let k = 0; k < f.length; k += 4) {
95
+ const I = E[w++] / b + 0.5, P = E[w++] / b + 0.5;
96
+ f[k] = I * 255, f[k + 1] = P * 255, f[k + 2] = 0, f[k + 3] = 255;
97
97
  }
98
- return c.putImageData(l, 0, 0), {
99
- href: u.toDataURL("image/png"),
100
- scale: y / a,
101
- width: o,
102
- height: s
98
+ return u.putImageData(l, 0, 0), {
99
+ href: c.toDataURL("image/png"),
100
+ scale: b / a,
101
+ width: s,
102
+ height: o
103
103
  };
104
104
  }
105
- function sn(e, t, i, r, a) {
106
- const o = Math.abs(e) - i + a, s = Math.abs(t) - r + a;
107
- return Math.min(Math.max(o, s), 0) + Math.hypot(Math.max(o, 0), Math.max(s, 0)) - a;
105
+ function un(e, t, i, r, a) {
106
+ const s = Math.abs(e) - i + a, o = Math.abs(t) - r + a;
107
+ return Math.min(Math.max(s, o), 0) + Math.hypot(Math.max(s, 0), Math.max(o, 0)) - a;
108
108
  }
109
- function nt(e, t, i) {
109
+ function at(e, t, i) {
110
110
  const r = Math.max(0, Math.min(1, (i - e) / (t - e)));
111
111
  return r * r * (3 - 2 * r);
112
112
  }
113
- function _e() {
113
+ function Ue() {
114
114
  if (typeof navigator > "u") return !1;
115
115
  const e = navigator.userAgent;
116
116
  return !(/AppleWebKit/i.test(e) && !/Chrome|Chromium|Edg|OPR|CriOS|FxiOS/i.test(e) || /Firefox/i.test(e));
117
117
  }
118
- const ln = {
118
+ const pn = {
119
119
  default: "blur(4px) saturate(130%)",
120
120
  /** Toolbar — slightly stronger frost + refraction chain. */
121
121
  enhanced: "blur(6px) saturate(138%)"
122
122
  };
123
- function cn(e, t = "default") {
124
- const i = ln[t], a = e !== null && _e() ? `${i} url(#${e})` : i;
123
+ function hn(e, t = "default") {
124
+ const i = pn[t], a = e !== null && Ue() ? `${i} url(#${e})` : i;
125
125
  return {
126
126
  backdropFilter: a,
127
127
  WebkitBackdropFilter: a
128
128
  };
129
129
  }
130
- let dn = 0;
131
- function St({
130
+ let fn = 0;
131
+ function Tt({
132
132
  shape: e = "rect",
133
133
  cornerRadius: t,
134
134
  tint: i = "neutral",
135
135
  intensity: r = "default",
136
136
  className: a = "",
137
- style: o,
138
- children: s
137
+ style: s,
138
+ children: o
139
139
  }) {
140
- const u = t ?? (e === "capsule" ? 9999 : 20), c = r === "enhanced" ? an : At, l = W(null), p = we(() => `pa-lg-${++dn}`, []), [f, v] = A(null);
141
- Wt(() => {
142
- const m = l.current;
143
- if (!m) return;
144
- let y = 0;
140
+ const c = t ?? (e === "capsule" ? 9999 : 20), u = r === "enhanced" ? cn : It, l = Y(null), f = xe(() => `pa-lg-${++fn}`, []), [p, v] = S(null);
141
+ Kt(() => {
142
+ const g = l.current;
143
+ if (!g) return;
144
+ let b = 0;
145
145
  const E = () => {
146
- cancelAnimationFrame(y), y = requestAnimationFrame(() => {
147
- const w = m.getBoundingClientRect(), N = Math.round(w.width), T = Math.round(w.height);
148
- if (N < 8 || T < 8) return;
149
- const P = e === "capsule" ? T / 2 : Math.min(u, N / 2, T / 2), $ = on(N, T, P, c);
150
- $ && v($);
146
+ cancelAnimationFrame(b), b = requestAnimationFrame(() => {
147
+ const w = g.getBoundingClientRect(), k = Math.round(w.width), I = Math.round(w.height);
148
+ if (k < 8 || I < 8) return;
149
+ const P = e === "capsule" ? I / 2 : Math.min(c, k / 2, I / 2), R = dn(k, I, P, u);
150
+ R && v(R);
151
151
  });
152
152
  };
153
153
  E();
154
- const x = new ResizeObserver(E);
155
- return x.observe(m), () => {
156
- cancelAnimationFrame(y), x.disconnect();
154
+ const N = new ResizeObserver(E);
155
+ return N.observe(g), () => {
156
+ cancelAnimationFrame(b), N.disconnect();
157
157
  };
158
- }, [e, u, c]);
159
- const g = f && _e() && typeof document < "u" ? Ye(
158
+ }, [e, c, u]);
159
+ const m = p && Ue() && typeof document < "u" ? Ke(
160
160
  /* @__PURE__ */ n(
161
161
  "svg",
162
162
  {
@@ -175,21 +175,21 @@ function St({
175
175
  children: /* @__PURE__ */ n("defs", { children: /* @__PURE__ */ d(
176
176
  "filter",
177
177
  {
178
- id: p,
178
+ id: f,
179
179
  filterUnits: "userSpaceOnUse",
180
180
  colorInterpolationFilters: "sRGB",
181
181
  x: "0",
182
182
  y: "0",
183
- width: f.width,
184
- height: f.height,
183
+ width: p.width,
184
+ height: p.height,
185
185
  children: [
186
186
  /* @__PURE__ */ n(
187
187
  "feImage",
188
188
  {
189
- href: f.href,
190
- xlinkHref: f.href,
191
- width: f.width,
192
- height: f.height,
189
+ href: p.href,
190
+ xlinkHref: p.href,
191
+ width: p.width,
192
+ height: p.height,
193
193
  preserveAspectRatio: "none",
194
194
  result: "map"
195
195
  }
@@ -199,7 +199,7 @@ function St({
199
199
  {
200
200
  in: "SourceGraphic",
201
201
  in2: "map",
202
- scale: f.scale,
202
+ scale: p.scale,
203
203
  xChannelSelector: "R",
204
204
  yChannelSelector: "G"
205
205
  }
@@ -211,31 +211,31 @@ function St({
211
211
  ),
212
212
  document.body
213
213
  ) : null;
214
- return /* @__PURE__ */ d(G, { children: [
215
- g,
214
+ return /* @__PURE__ */ d(K, { children: [
215
+ m,
216
216
  /* @__PURE__ */ d(
217
217
  "div",
218
218
  {
219
219
  ref: l,
220
220
  className: `pa-glass-surface pa-glass-surface--${e} pa-glass-surface--${i} ${a}`.trim(),
221
221
  style: {
222
- borderRadius: e === "capsule" ? "999px" : `${u}px`,
223
- ...cn(
224
- f && _e() ? p : null,
222
+ borderRadius: e === "capsule" ? "999px" : `${c}px`,
223
+ ...hn(
224
+ p && Ue() ? f : null,
225
225
  r
226
226
  ),
227
- ...o
227
+ ...s
228
228
  },
229
229
  children: [
230
230
  /* @__PURE__ */ n("div", { className: "pa-glass-surface-bg", "aria-hidden": "true" }),
231
231
  /* @__PURE__ */ n("div", { className: "pa-glass-surface-shine", "aria-hidden": "true" }),
232
- /* @__PURE__ */ n("div", { className: "pa-glass-surface-content", children: s })
232
+ /* @__PURE__ */ n("div", { className: "pa-glass-surface-content", children: o })
233
233
  ]
234
234
  }
235
235
  )
236
236
  ] });
237
237
  }
238
- function V({
238
+ function H({
239
239
  variant: e = "regular",
240
240
  className: t = "",
241
241
  children: i,
@@ -259,7 +259,7 @@ function Te({
259
259
  children: a
260
260
  }) {
261
261
  return /* @__PURE__ */ n(
262
- St,
262
+ Tt,
263
263
  {
264
264
  shape: "rect",
265
265
  cornerRadius: e === "popover" ? 16 : 20,
@@ -269,65 +269,65 @@ function Te({
269
269
  }
270
270
  );
271
271
  }
272
- function Lt({
272
+ function Rt({
273
273
  defaultPosition: e = null,
274
274
  computeDefaultPosition: t
275
275
  } = {}) {
276
- const [i, r] = A(e), [a, o] = A(!1), s = W(null), u = W(null), c = L(() => {
276
+ const [i, r] = S(e), [a, s] = S(!1), o = Y(null), c = Y(null), u = $(() => {
277
277
  if (i !== null) return;
278
- const g = u.current;
279
- if (!g) return;
280
- const m = g.getBoundingClientRect();
278
+ const m = c.current;
279
+ if (!m) return;
280
+ const g = m.getBoundingClientRect();
281
281
  r(
282
- t ? t(m) : {
283
- x: (window.innerWidth - m.width) / 2,
284
- y: window.innerHeight - m.height - 24
282
+ t ? t(g) : {
283
+ x: (window.innerWidth - g.width) / 2,
284
+ y: window.innerHeight - g.height - 24
285
285
  }
286
286
  );
287
287
  }, [i, t]);
288
- H(() => {
289
- c();
290
- }, [c]), H(() => {
291
- const g = () => {
292
- r((m) => {
293
- if (!m || !u.current) return m;
294
- const y = u.current.getBoundingClientRect();
288
+ _(() => {
289
+ u();
290
+ }, [u]), _(() => {
291
+ const m = () => {
292
+ r((g) => {
293
+ if (!g || !c.current) return g;
294
+ const b = c.current.getBoundingClientRect();
295
295
  return {
296
- x: Math.min(m.x, window.innerWidth - y.width),
297
- y: Math.min(m.y, window.innerHeight - y.height)
296
+ x: Math.min(g.x, window.innerWidth - b.width),
297
+ y: Math.min(g.y, window.innerHeight - b.height)
298
298
  };
299
299
  });
300
300
  };
301
- return window.addEventListener("resize", g), () => window.removeEventListener("resize", g);
301
+ return window.addEventListener("resize", m), () => window.removeEventListener("resize", m);
302
302
  }, []);
303
- const l = L(
304
- (g) => {
305
- if (g.button !== 0) return;
306
- const m = u.current;
307
- if (!m) return;
308
- let y = i;
309
- if (!y) {
310
- const E = m.getBoundingClientRect();
311
- y = { x: E.left, y: E.top }, r(y);
303
+ const l = $(
304
+ (m) => {
305
+ if (m.button !== 0) return;
306
+ const g = c.current;
307
+ if (!g) return;
308
+ let b = i;
309
+ if (!b) {
310
+ const E = g.getBoundingClientRect();
311
+ b = { x: E.left, y: E.top }, r(b);
312
312
  }
313
- s.current = {
314
- pointerId: g.pointerId,
315
- startX: g.clientX,
316
- startY: g.clientY,
317
- originX: y.x,
318
- originY: y.y
319
- }, o(!0), g.currentTarget.setPointerCapture(g.pointerId), g.preventDefault();
313
+ o.current = {
314
+ pointerId: m.pointerId,
315
+ startX: m.clientX,
316
+ startY: m.clientY,
317
+ originX: b.x,
318
+ originY: b.y
319
+ }, s(!0), m.currentTarget.setPointerCapture(m.pointerId), m.preventDefault();
320
320
  },
321
321
  [i]
322
- ), p = L((g) => {
323
- if (!s.current || s.current.pointerId !== g.pointerId) return;
324
- const m = u.current, y = (m == null ? void 0 : m.offsetWidth) ?? 320, E = (m == null ? void 0 : m.offsetHeight) ?? 48, x = g.clientX - s.current.startX, w = g.clientY - s.current.startY, N = Math.max(8, Math.min(window.innerWidth - y - 8, s.current.originX + x)), T = Math.max(8, Math.min(window.innerHeight - E - 8, s.current.originY + w));
325
- r({ x: N, y: T });
326
- }, []), f = L((g) => {
327
- if (!(!s.current || s.current.pointerId !== g.pointerId)) {
328
- s.current = null, o(!1);
322
+ ), f = $((m) => {
323
+ if (!o.current || o.current.pointerId !== m.pointerId) return;
324
+ const g = c.current, b = (g == null ? void 0 : g.offsetWidth) ?? 320, E = (g == null ? void 0 : g.offsetHeight) ?? 48, N = m.clientX - o.current.startX, w = m.clientY - o.current.startY, k = Math.max(8, Math.min(window.innerWidth - b - 8, o.current.originX + N)), I = Math.max(8, Math.min(window.innerHeight - E - 8, o.current.originY + w));
325
+ r({ x: k, y: I });
326
+ }, []), p = $((m) => {
327
+ if (!(!o.current || o.current.pointerId !== m.pointerId)) {
328
+ o.current = null, s(!1);
329
329
  try {
330
- g.currentTarget.releasePointerCapture(g.pointerId);
330
+ m.currentTarget.releasePointerCapture(m.pointerId);
331
331
  } catch {
332
332
  }
333
333
  }
@@ -340,19 +340,19 @@ function Lt({
340
340
  bottom: "auto"
341
341
  } : void 0;
342
342
  return {
343
- elementRef: u,
343
+ elementRef: c,
344
344
  position: i,
345
345
  isDragging: a,
346
346
  style: v,
347
347
  dragHandleProps: {
348
348
  onPointerDown: l,
349
- onPointerMove: p,
350
- onPointerUp: f,
351
- onPointerCancel: f
349
+ onPointerMove: f,
350
+ onPointerUp: p,
351
+ onPointerCancel: p
352
352
  }
353
353
  };
354
354
  }
355
- function un({ className: e }) {
355
+ function mn({ className: e }) {
356
356
  return /* @__PURE__ */ d("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
357
357
  /* @__PURE__ */ n(
358
358
  "path",
@@ -378,7 +378,7 @@ function un({ className: e }) {
378
378
  )
379
379
  ] });
380
380
  }
381
- function pn({ className: e }) {
381
+ function gn({ className: e }) {
382
382
  return /* @__PURE__ */ d("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
383
383
  /* @__PURE__ */ n(
384
384
  "path",
@@ -404,8 +404,8 @@ function pn({ className: e }) {
404
404
  )
405
405
  ] });
406
406
  }
407
- const pe = (e, t, i) => Math.min(i, Math.max(t, e));
408
- function Xe(e) {
407
+ const me = (e, t, i) => Math.min(i, Math.max(t, e));
408
+ function je(e) {
409
409
  const t = e.trim();
410
410
  if (!t) return null;
411
411
  const i = t.match(/^#([0-9a-f]{6})$/i);
@@ -417,144 +417,144 @@ function Xe(e) {
417
417
  };
418
418
  const r = t.match(/^#([0-9a-f]{3})$/i);
419
419
  if (r) {
420
- const [o, s, u] = r[1].split("");
420
+ const [s, o, c] = r[1].split("");
421
421
  return {
422
- r: parseInt(o + o, 16),
423
- g: parseInt(s + s, 16),
424
- b: parseInt(u + u, 16)
422
+ r: parseInt(s + s, 16),
423
+ g: parseInt(o + o, 16),
424
+ b: parseInt(c + c, 16)
425
425
  };
426
426
  }
427
427
  const a = t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
428
428
  return a ? {
429
- r: pe(parseInt(a[1], 10), 0, 255),
430
- g: pe(parseInt(a[2], 10), 0, 255),
431
- b: pe(parseInt(a[3], 10), 0, 255)
429
+ r: me(parseInt(a[1], 10), 0, 255),
430
+ g: me(parseInt(a[2], 10), 0, 255),
431
+ b: me(parseInt(a[3], 10), 0, 255)
432
432
  } : null;
433
433
  }
434
- function Et(e) {
435
- const t = (i) => pe(Math.round(i), 0, 255).toString(16).padStart(2, "0");
434
+ function Pt(e) {
435
+ const t = (i) => me(Math.round(i), 0, 255).toString(16).padStart(2, "0");
436
436
  return `#${t(e.r)}${t(e.g)}${t(e.b)}`;
437
437
  }
438
- function hn(e) {
438
+ function vn(e) {
439
439
  return `rgb(${e.r}, ${e.g}, ${e.b})`;
440
440
  }
441
- function It({ r: e, g: t, b: i }) {
442
- const r = e / 255, a = t / 255, o = i / 255, s = Math.max(r, a, o), u = Math.min(r, a, o), c = s - u;
441
+ function Dt({ r: e, g: t, b: i }) {
442
+ const r = e / 255, a = t / 255, s = i / 255, o = Math.max(r, a, s), c = Math.min(r, a, s), u = o - c;
443
443
  let l = 0;
444
- c !== 0 && (s === r ? l = (a - o) / c % 6 : s === a ? l = (o - r) / c + 2 : l = (r - a) / c + 4, l *= 60, l < 0 && (l += 360));
445
- const p = s === 0 ? 0 : c / s * 100, f = s * 100;
446
- return { h: l, s: p, v: f };
447
- }
448
- function Tt({ h: e, s: t, v: i }) {
449
- const r = pe(t, 0, 100) / 100, a = pe(i, 0, 100) / 100, o = a * r, s = o * (1 - Math.abs(e / 60 % 2 - 1)), u = a - o;
450
- let c = 0, l = 0, p = 0;
451
- const f = (e % 360 + 360) % 360;
452
- return f < 60 ? (c = o, l = s) : f < 120 ? (c = s, l = o) : f < 180 ? (l = o, p = s) : f < 240 ? (l = s, p = o) : f < 300 ? (c = s, p = o) : (c = o, p = s), {
453
- r: Math.round((c + u) * 255),
454
- g: Math.round((l + u) * 255),
455
- b: Math.round((p + u) * 255)
444
+ u !== 0 && (o === r ? l = (a - s) / u % 6 : o === a ? l = (s - r) / u + 2 : l = (r - a) / u + 4, l *= 60, l < 0 && (l += 360));
445
+ const f = o === 0 ? 0 : u / o * 100, p = o * 100;
446
+ return { h: l, s: f, v: p };
447
+ }
448
+ function Ot({ h: e, s: t, v: i }) {
449
+ const r = me(t, 0, 100) / 100, a = me(i, 0, 100) / 100, s = a * r, o = s * (1 - Math.abs(e / 60 % 2 - 1)), c = a - s;
450
+ let u = 0, l = 0, f = 0;
451
+ const p = (e % 360 + 360) % 360;
452
+ return p < 60 ? (u = s, l = o) : p < 120 ? (u = o, l = s) : p < 180 ? (l = s, f = o) : p < 240 ? (l = o, f = s) : p < 300 ? (u = o, f = s) : (u = s, f = o), {
453
+ r: Math.round((u + c) * 255),
454
+ g: Math.round((l + c) * 255),
455
+ b: Math.round((f + c) * 255)
456
456
  };
457
457
  }
458
- function rt(e) {
459
- const t = Xe(e);
460
- return t ? It(t) : { h: 0, s: 0, v: 45 };
458
+ function ot(e) {
459
+ const t = je(e);
460
+ return t ? Dt(t) : { h: 0, s: 0, v: 45 };
461
461
  }
462
- function fn(e) {
462
+ function bn(e) {
463
463
  return e.replace(/^#/, "").toUpperCase().slice(0, 6);
464
464
  }
465
- function mn(e, t) {
465
+ function yn(e, t) {
466
466
  const i = e.replace(/[^0-9a-f]/gi, "").slice(0, 6);
467
- return i.length < 6 ? t : Xe(`#${i}`) ?? t;
467
+ return i.length < 6 ? t : je(`#${i}`) ?? t;
468
468
  }
469
- function gn(e) {
470
- return Et(Tt(e));
469
+ function wn(e) {
470
+ return Pt(Ot(e));
471
471
  }
472
- function vn(e, t, i) {
473
- const r = it((e - i.left) / i.width), a = it((t - i.top) / i.height);
472
+ function xn(e, t, i) {
473
+ const r = st((e - i.left) / i.width), a = st((t - i.top) / i.height);
474
474
  return { x: r * 100, y: a * 100 };
475
475
  }
476
- function it(e) {
476
+ function st(e) {
477
477
  return Math.min(1, Math.max(0, e));
478
478
  }
479
- function bn() {
479
+ function Nn() {
480
480
  if (typeof document > "u") return {};
481
481
  const e = document.querySelector("[data-pixelagent-root]") ?? document.querySelector("[data-pixelagent-toolbar-portal]"), t = e == null ? void 0 : e.getAttribute("data-pa-chrome");
482
482
  return t ? { "data-pa-chrome": t } : {};
483
483
  }
484
- function Be({ label: e, value: t, onChange: i }) {
485
- const [r, a] = A(!1), [o, s] = A(() => rt(t)), u = W(null), c = W(null), l = W(null), p = Yt(), [f, v] = A({ top: 0, left: 0, width: 260 }), g = Tt(o), m = fn(Et(g)), y = Xe(t) ? t : hn(g), E = e.toLowerCase().includes("color") ? e : `${e} color`;
486
- H(() => {
487
- s(rt(t));
484
+ function _e({ label: e, value: t, onChange: i }) {
485
+ const [r, a] = S(!1), [s, o] = S(() => ot(t)), c = Y(null), u = Y(null), l = Y(null), f = jt(), [p, v] = S({ top: 0, left: 0, width: 260 }), m = Ot(s), g = bn(Pt(m)), b = je(t) ? t : vn(m), E = e.toLowerCase().includes("color") ? e : `${e} color`;
486
+ _(() => {
487
+ o(ot(t));
488
488
  }, [t]);
489
- const x = L(
490
- (k) => {
491
- s(k), i(gn(k));
489
+ const N = $(
490
+ (x) => {
491
+ o(x), i(wn(x));
492
492
  },
493
493
  [i]
494
- ), w = L(
495
- (k) => {
496
- x(It(k));
494
+ ), w = $(
495
+ (x) => {
496
+ N(Dt(x));
497
497
  },
498
- [x]
499
- ), N = L(() => {
500
- const k = u.current;
501
- if (!k) return;
502
- const I = k.getBoundingClientRect(), C = 260;
503
- let h = I.left;
498
+ [N]
499
+ ), k = $(() => {
500
+ const x = c.current;
501
+ if (!x) return;
502
+ const T = x.getBoundingClientRect(), C = 260;
503
+ let h = T.left;
504
504
  h + C > window.innerWidth - 12 && (h = window.innerWidth - C - 12), h = Math.max(12, h);
505
- let B = I.bottom + 8;
506
- const Y = 320;
507
- B + Y > window.innerHeight - 12 && (B = Math.max(12, I.top - Y - 8)), v({ top: B, left: h, width: C });
505
+ let F = T.bottom + 8;
506
+ const W = 320;
507
+ F + W > window.innerHeight - 12 && (F = Math.max(12, T.top - W - 8)), v({ top: F, left: h, width: C });
508
508
  }, []);
509
- H(() => {
509
+ _(() => {
510
510
  if (!r) return;
511
- N();
512
- const k = (C) => {
513
- var B, Y;
511
+ k();
512
+ const x = (C) => {
513
+ var F, W;
514
514
  const h = C.target;
515
- (B = u.current) != null && B.contains(h) || (Y = c.current) != null && Y.contains(h) || a(!1);
516
- }, I = (C) => {
515
+ (F = c.current) != null && F.contains(h) || (W = u.current) != null && W.contains(h) || a(!1);
516
+ }, T = (C) => {
517
517
  C.key === "Escape" && a(!1);
518
518
  };
519
- return window.addEventListener("mousedown", k, !0), window.addEventListener("keydown", I), window.addEventListener("resize", N), window.addEventListener("scroll", N, !0), () => {
520
- window.removeEventListener("mousedown", k, !0), window.removeEventListener("keydown", I), window.removeEventListener("resize", N), window.removeEventListener("scroll", N, !0);
519
+ return window.addEventListener("mousedown", x, !0), window.addEventListener("keydown", T), window.addEventListener("resize", k), window.addEventListener("scroll", k, !0), () => {
520
+ window.removeEventListener("mousedown", x, !0), window.removeEventListener("keydown", T), window.removeEventListener("resize", k), window.removeEventListener("scroll", k, !0);
521
521
  };
522
- }, [r, N]);
523
- const T = (k, I) => {
524
- var Y;
525
- const C = (Y = l.current) == null ? void 0 : Y.getBoundingClientRect();
522
+ }, [r, k]);
523
+ const I = (x, T) => {
524
+ var W;
525
+ const C = (W = l.current) == null ? void 0 : W.getBoundingClientRect();
526
526
  if (!C) return;
527
- const { x: h, y: B } = vn(k, I, C);
528
- x({ ...o, s: h, v: 100 - B });
529
- }, P = (k) => {
530
- k.preventDefault(), T(k.clientX, k.clientY);
531
- const I = (h) => T(h.clientX, h.clientY), C = () => {
532
- window.removeEventListener("mousemove", I), window.removeEventListener("mouseup", C);
527
+ const { x: h, y: F } = xn(x, T, C);
528
+ N({ ...s, s: h, v: 100 - F });
529
+ }, P = (x) => {
530
+ x.preventDefault(), I(x.clientX, x.clientY);
531
+ const T = (h) => I(h.clientX, h.clientY), C = () => {
532
+ window.removeEventListener("mousemove", T), window.removeEventListener("mouseup", C);
533
533
  };
534
- window.addEventListener("mousemove", I), window.addEventListener("mouseup", C);
535
- }, $ = r ? Ye(
534
+ window.addEventListener("mousemove", T), window.addEventListener("mouseup", C);
535
+ }, R = r ? Ke(
536
536
  /* @__PURE__ */ n(
537
537
  "div",
538
538
  {
539
539
  className: "pa-root pa-root--toolbar-portal pa-color-picker-portal",
540
540
  "data-pixelagent-picker-portal": !0,
541
- ...bn(),
541
+ ...Nn(),
542
542
  children: /* @__PURE__ */ d(
543
543
  "div",
544
544
  {
545
- ref: c,
546
- id: p,
545
+ ref: u,
546
+ id: f,
547
547
  role: "dialog",
548
548
  "aria-label": E,
549
549
  className: "pa-color-picker",
550
- style: { top: f.top, left: f.left, width: f.width },
550
+ style: { top: p.top, left: p.left, width: p.width },
551
551
  children: [
552
552
  /* @__PURE__ */ d("header", { className: "pa-color-picker-header", children: [
553
553
  /* @__PURE__ */ n(
554
554
  "span",
555
555
  {
556
556
  className: "pa-color-picker-preview",
557
- style: { backgroundColor: y },
557
+ style: { backgroundColor: b },
558
558
  "aria-hidden": "true"
559
559
  }
560
560
  ),
@@ -565,13 +565,13 @@ function Be({ label: e, value: t, onChange: i }) {
565
565
  {
566
566
  ref: l,
567
567
  className: "pa-color-picker-sb",
568
- style: { "--pa-picker-h": String(Math.round(o.h)) },
568
+ style: { "--pa-picker-h": String(Math.round(s.h)) },
569
569
  onMouseDown: P,
570
570
  children: /* @__PURE__ */ n(
571
571
  "span",
572
572
  {
573
573
  className: "pa-color-picker-sb-thumb",
574
- style: { left: `${o.s}%`, top: `${100 - o.v}%` },
574
+ style: { left: `${s.s}%`, top: `${100 - s.v}%` },
575
575
  "aria-hidden": "true"
576
576
  }
577
577
  )
@@ -585,16 +585,16 @@ function Be({ label: e, value: t, onChange: i }) {
585
585
  className: "pa-color-picker-hue-input",
586
586
  min: 0,
587
587
  max: 360,
588
- value: Math.round(o.h),
588
+ value: Math.round(s.h),
589
589
  "aria-label": "Hue",
590
- onChange: (k) => x({ ...o, h: parseFloat(k.target.value) })
590
+ onChange: (x) => N({ ...s, h: parseFloat(x.target.value) })
591
591
  }
592
592
  ),
593
593
  /* @__PURE__ */ n(
594
594
  "span",
595
595
  {
596
596
  className: "pa-color-picker-hue-thumb",
597
- style: { left: `${o.h / 360 * 100}%` },
597
+ style: { left: `${s.h / 360 * 100}%` },
598
598
  "aria-hidden": "true"
599
599
  }
600
600
  )
@@ -606,14 +606,14 @@ function Be({ label: e, value: t, onChange: i }) {
606
606
  {
607
607
  className: "pa-input pa-color-picker-input",
608
608
  type: "text",
609
- value: m,
609
+ value: g,
610
610
  spellCheck: !1,
611
- onChange: (k) => w(mn(k.target.value, g))
611
+ onChange: (x) => w(yn(x.target.value, m))
612
612
  }
613
613
  )
614
614
  ] }),
615
- /* @__PURE__ */ n("div", { className: "pa-color-picker-rgb", children: ["r", "g", "b"].map((k) => /* @__PURE__ */ d("label", { className: "pa-color-picker-field pa-color-picker-field--rgb", children: [
616
- /* @__PURE__ */ n("span", { className: "pa-color-picker-field-label", children: k.toUpperCase() }),
615
+ /* @__PURE__ */ n("div", { className: "pa-color-picker-rgb", children: ["r", "g", "b"].map((x) => /* @__PURE__ */ d("label", { className: "pa-color-picker-field pa-color-picker-field--rgb", children: [
616
+ /* @__PURE__ */ n("span", { className: "pa-color-picker-field-label", children: x.toUpperCase() }),
617
617
  /* @__PURE__ */ n(
618
618
  "input",
619
619
  {
@@ -621,14 +621,14 @@ function Be({ label: e, value: t, onChange: i }) {
621
621
  type: "number",
622
622
  min: 0,
623
623
  max: 255,
624
- value: g[k],
625
- onChange: (I) => {
626
- const C = yn(parseInt(I.target.value, 10));
627
- w({ ...g, [k]: C });
624
+ value: m[x],
625
+ onChange: (T) => {
626
+ const C = kn(parseInt(T.target.value, 10));
627
+ w({ ...m, [x]: C });
628
628
  }
629
629
  }
630
630
  )
631
- ] }, k)) })
631
+ ] }, x)) })
632
632
  ]
633
633
  }
634
634
  )
@@ -641,17 +641,17 @@ function Be({ label: e, value: t, onChange: i }) {
641
641
  /* @__PURE__ */ d(
642
642
  "button",
643
643
  {
644
- ref: u,
644
+ ref: c,
645
645
  type: "button",
646
646
  className: "pa-color-field-trigger",
647
647
  "aria-expanded": r,
648
648
  "aria-haspopup": "dialog",
649
- "aria-controls": r ? p : void 0,
649
+ "aria-controls": r ? f : void 0,
650
650
  onClick: () => {
651
- r || N(), a((k) => !k);
651
+ r || k(), a((x) => !x);
652
652
  },
653
653
  children: [
654
- /* @__PURE__ */ n("span", { className: "pa-color-field-swatch", style: { backgroundColor: y }, "aria-hidden": "true" }),
654
+ /* @__PURE__ */ n("span", { className: "pa-color-field-swatch", style: { backgroundColor: b }, "aria-hidden": "true" }),
655
655
  /* @__PURE__ */ n(
656
656
  "input",
657
657
  {
@@ -666,14 +666,14 @@ function Be({ label: e, value: t, onChange: i }) {
666
666
  ]
667
667
  }
668
668
  ),
669
- $
669
+ R
670
670
  ] });
671
671
  }
672
- function yn(e) {
672
+ function kn(e) {
673
673
  return Number.isFinite(e) ? Math.min(255, Math.max(0, e)) : 0;
674
674
  }
675
- function le({ title: e, children: t, defaultOpen: i = !0, badge: r }) {
676
- const [a, o] = A(i);
675
+ function ue({ title: e, children: t, defaultOpen: i = !0, badge: r }) {
676
+ const [a, s] = S(i);
677
677
  return /* @__PURE__ */ d("section", { className: `pa-edit-section ${a ? "pa-edit-section--open" : ""}`, children: [
678
678
  /* @__PURE__ */ d(
679
679
  "button",
@@ -681,7 +681,7 @@ function le({ title: e, children: t, defaultOpen: i = !0, badge: r }) {
681
681
  type: "button",
682
682
  className: "pa-edit-section-header",
683
683
  "aria-expanded": a,
684
- onClick: () => o((s) => !s),
684
+ onClick: () => s((o) => !o),
685
685
  children: [
686
686
  /* @__PURE__ */ n("span", { className: "pa-edit-section-title", children: e }),
687
687
  r ? /* @__PURE__ */ n("span", { className: "pa-edit-section-badge", children: r }) : null,
@@ -692,7 +692,7 @@ function le({ title: e, children: t, defaultOpen: i = !0, badge: r }) {
692
692
  a ? /* @__PURE__ */ n("div", { className: "pa-edit-section-body", children: t }) : null
693
693
  ] });
694
694
  }
695
- const ce = [
695
+ const pe = [
696
696
  { value: "Inter, system-ui, sans-serif", label: "Inter" },
697
697
  { value: "system-ui, sans-serif", label: "System UI" },
698
698
  {
@@ -706,37 +706,37 @@ const ce = [
706
706
  { value: '"JetBrains Mono", ui-monospace, monospace', label: "JetBrains Mono" },
707
707
  { value: "ui-monospace, monospace", label: "Monospace" }
708
708
  ], Ie = "";
709
- function Me(e) {
709
+ function Ae(e) {
710
710
  var i;
711
711
  return (((i = e.split(",")[0]) == null ? void 0 : i.trim()) ?? "").replace(/^["']|["']$/g, "");
712
712
  }
713
- function wn(e) {
713
+ function Cn(e) {
714
714
  const t = e.trim();
715
715
  if (!t)
716
716
  return {
717
717
  selectValue: Ie,
718
- options: ce
718
+ options: pe
719
719
  };
720
- const i = Me(t).toLowerCase(), r = ce.find(
721
- (o) => o.value === t || Me(o.value).toLowerCase() === i
720
+ const i = Ae(t).toLowerCase(), r = pe.find(
721
+ (s) => s.value === t || Ae(s.value).toLowerCase() === i
722
722
  );
723
723
  if (r)
724
- return { selectValue: r.value, options: ce };
725
- const a = ce.find((o) => {
726
- const s = Me(o.value).toLowerCase();
727
- return t.toLowerCase().includes(s) || s.includes(i);
724
+ return { selectValue: r.value, options: pe };
725
+ const a = pe.find((s) => {
726
+ const o = Ae(s.value).toLowerCase();
727
+ return t.toLowerCase().includes(o) || o.includes(i);
728
728
  });
729
- return a ? { selectValue: a.value, options: ce } : {
729
+ return a ? { selectValue: a.value, options: pe } : {
730
730
  selectValue: t,
731
731
  options: [
732
- ...ce,
733
- { value: t, label: Me(t) || "Custom" }
732
+ ...pe,
733
+ { value: t, label: Ae(t) || "Custom" }
734
734
  ]
735
735
  };
736
736
  }
737
- function xn({ value: e, onChange: t }) {
738
- const { selectValue: i, options: r } = we(
739
- () => wn(e),
737
+ function Mn({ value: e, onChange: t }) {
738
+ const { selectValue: i, options: r } = xe(
739
+ () => Cn(e),
740
740
  [e]
741
741
  );
742
742
  return /* @__PURE__ */ d("label", { className: "pa-edit-stack-field", children: [
@@ -747,8 +747,8 @@ function xn({ value: e, onChange: t }) {
747
747
  className: "pa-select pa-font-family-select",
748
748
  value: i || Ie,
749
749
  onChange: (a) => {
750
- const o = a.target.value;
751
- o && o !== Ie && t(o);
750
+ const s = a.target.value;
751
+ s && s !== Ie && t(s);
752
752
  },
753
753
  children: [
754
754
  /* @__PURE__ */ n("option", { value: Ie, disabled: !0, children: "Select font style" }),
@@ -758,11 +758,11 @@ function xn({ value: e, onChange: t }) {
758
758
  )
759
759
  ] });
760
760
  }
761
- function Ge(e) {
761
+ function qe(e) {
762
762
  const t = e.trim().match(/^(-?\d+(?:\.\d+)?)px$/i);
763
763
  return t ? parseFloat(t[1]) : null;
764
764
  }
765
- function Nn(e) {
765
+ function An(e) {
766
766
  const t = e.trim();
767
767
  if (!t) return null;
768
768
  if (t.endsWith("%")) {
@@ -772,21 +772,21 @@ function Nn(e) {
772
772
  const i = parseFloat(t);
773
773
  return Number.isFinite(i) && i >= 0 && i <= 1 ? i : null;
774
774
  }
775
- function kn(e) {
776
- const t = Pt(e);
775
+ function Sn(e) {
776
+ const t = Ft(e);
777
777
  if (t !== null) return t > 0;
778
- const i = Ge(e);
778
+ const i = qe(e);
779
779
  return i !== null && i > 0;
780
780
  }
781
- function Pt(e) {
781
+ function Ft(e) {
782
782
  const t = e.trim().split(/\s+/).filter(Boolean);
783
783
  if (t.length === 0) return null;
784
- const i = t.map((a) => Ge(a));
784
+ const i = t.map((a) => qe(a));
785
785
  if (i.some((a) => a === null)) return null;
786
786
  const r = i[0];
787
787
  return i.every((a) => a === r) ? r : null;
788
788
  }
789
- const Cn = {
789
+ const Ln = {
790
790
  padding: { kind: "uniform-px", min: 0, max: 80, step: 1 },
791
791
  margin: { kind: "uniform-px", min: 0, max: 80, step: 1 },
792
792
  width: { kind: "text" },
@@ -800,19 +800,19 @@ const Cn = {
800
800
  "border-radius": { kind: "px", min: 0, max: 48, step: 1 },
801
801
  opacity: { kind: "opacity", min: 0, max: 1, step: 0.01 }
802
802
  };
803
- function Mn(e, t, i) {
803
+ function En(e, t, i) {
804
804
  switch (i.kind) {
805
805
  case "opacity":
806
- return Nn(t);
806
+ return An(t);
807
807
  case "px":
808
- return Ge(t);
808
+ return qe(t);
809
809
  case "uniform-px":
810
- return Pt(t);
810
+ return Ft(t);
811
811
  default:
812
812
  return null;
813
813
  }
814
814
  }
815
- function An(e, t, i) {
815
+ function $n(e, t, i) {
816
816
  switch (i.kind) {
817
817
  case "opacity":
818
818
  return String(Math.round(t * 100) / 100);
@@ -823,16 +823,16 @@ function An(e, t, i) {
823
823
  return String(t);
824
824
  }
825
825
  }
826
- function re({
826
+ function ie({
827
827
  property: e,
828
828
  label: t,
829
829
  value: i,
830
830
  onChange: r,
831
831
  compact: a = !1
832
832
  }) {
833
- const o = Cn[e] ?? { kind: "text" }, s = Mn(e, i, o), u = o.kind !== "text" && s !== null, c = a ? "pa-prop-row pa-prop-row--compact" : "pa-prop-row", l = a ? "pa-edit-field-label" : "pa-prop-label";
834
- if (!u)
835
- return /* @__PURE__ */ d("label", { className: c, children: [
833
+ const s = Ln[e] ?? { kind: "text" }, o = En(e, i, s), c = s.kind !== "text" && o !== null, u = a ? "pa-prop-row pa-prop-row--compact" : "pa-prop-row", l = a ? "pa-edit-field-label" : "pa-prop-label";
834
+ if (!c)
835
+ return /* @__PURE__ */ d("label", { className: u, children: [
836
836
  /* @__PURE__ */ n("span", { className: l, children: t }),
837
837
  /* @__PURE__ */ n(
838
838
  "input",
@@ -840,14 +840,14 @@ function re({
840
840
  className: "pa-input",
841
841
  type: "text",
842
842
  value: i,
843
- onChange: (m) => r(m.target.value)
843
+ onChange: (g) => r(g.target.value)
844
844
  }
845
845
  )
846
846
  ] });
847
- const p = o.min ?? 0, f = o.max ?? 100, v = o.step ?? 1, g = (m) => {
848
- r(An(e, m, o));
847
+ const f = s.min ?? 0, p = s.max ?? 100, v = s.step ?? 1, m = (g) => {
848
+ r($n(e, g, s));
849
849
  };
850
- return /* @__PURE__ */ d("label", { className: `${c} pa-prop-row--slider`, children: [
850
+ return /* @__PURE__ */ d("label", { className: `${u} pa-prop-row--slider`, children: [
851
851
  /* @__PURE__ */ n("span", { className: l, children: t }),
852
852
  /* @__PURE__ */ d("div", { className: "pa-prop-slider-wrap", children: [
853
853
  /* @__PURE__ */ n(
@@ -855,12 +855,12 @@ function re({
855
855
  {
856
856
  type: "range",
857
857
  className: "pa-slider",
858
- min: p,
859
- max: f,
858
+ min: f,
859
+ max: p,
860
860
  step: v,
861
- value: s,
861
+ value: o,
862
862
  "aria-valuetext": i,
863
- onChange: (m) => g(parseFloat(m.target.value))
863
+ onChange: (g) => m(parseFloat(g.target.value))
864
864
  }
865
865
  ),
866
866
  /* @__PURE__ */ n(
@@ -869,14 +869,14 @@ function re({
869
869
  className: "pa-input pa-prop-slider-value",
870
870
  type: "text",
871
871
  value: i,
872
- onChange: (m) => r(m.target.value),
872
+ onChange: (g) => r(g.target.value),
873
873
  "aria-label": `${t} value`
874
874
  }
875
875
  )
876
876
  ] })
877
877
  ] });
878
878
  }
879
- function Sn(e) {
879
+ function In(e) {
880
880
  const t = e.trim().split(/\s+/).filter(Boolean), i = t[0] ?? "0px";
881
881
  if (t.length <= 1) return { top: i, right: i, bottom: i, left: i };
882
882
  const r = t[1];
@@ -884,63 +884,63 @@ function Sn(e) {
884
884
  const a = t[2];
885
885
  return t.length === 3 ? { top: i, right: r, bottom: a, left: r } : { top: i, right: r, bottom: a, left: t[3] };
886
886
  }
887
- function Ln({ top: e, right: t, bottom: i, left: r }) {
887
+ function Tn({ top: e, right: t, bottom: i, left: r }) {
888
888
  return e === t && t === i && i === r ? e : e === i && t === r ? `${e} ${t}` : t === r ? `${e} ${t} ${i}` : `${e} ${t} ${i} ${r}`;
889
889
  }
890
- function oe(e) {
890
+ function le(e) {
891
891
  const t = e.trim().match(/^(-?\d+(?:\.\d+)?)px$/i);
892
892
  return t ? t[1] : e;
893
893
  }
894
- function se(e) {
894
+ function ce(e) {
895
895
  const t = e.trim();
896
896
  return t === "" ? "0px" : /^-?\d+(?:\.\d+)?$/.test(t) ? `${t}px` : t;
897
897
  }
898
- function at(e, t) {
899
- return e === t ? oe(e) : `${oe(e)}, ${oe(t)}`;
898
+ function lt(e, t) {
899
+ return e === t ? le(e) : `${le(e)}, ${le(t)}`;
900
900
  }
901
- function ot(e, t) {
901
+ function ct(e, t) {
902
902
  const i = e.split(",").map((r) => r.trim()).filter(Boolean);
903
903
  if (i.length === 0) return [t, t];
904
904
  if (i.length === 1) {
905
- const r = se(i[0]);
905
+ const r = ce(i[0]);
906
906
  return [r, r];
907
907
  }
908
- return [se(i[0]), se(i[1])];
908
+ return [ce(i[0]), ce(i[1])];
909
909
  }
910
- const st = 12, Ke = {
911
- width: st,
912
- height: st,
910
+ const dt = 12, Je = {
911
+ width: dt,
912
+ height: dt,
913
913
  viewBox: "0 0 12 12",
914
914
  fill: "none",
915
915
  "aria-hidden": !0
916
916
  };
917
- function En() {
918
- return /* @__PURE__ */ d("svg", { ...Ke, children: [
917
+ function Rn() {
918
+ return /* @__PURE__ */ d("svg", { ...Je, children: [
919
919
  /* @__PURE__ */ n("rect", { x: "1.5", y: "1.5", width: "9", height: "9", stroke: "currentColor", strokeOpacity: "0.35" }),
920
920
  /* @__PURE__ */ n("line", { x1: "1.5", y1: "1.5", x2: "1.5", y2: "10.5", stroke: "currentColor", strokeWidth: "1.5" }),
921
921
  /* @__PURE__ */ n("line", { x1: "10.5", y1: "1.5", x2: "10.5", y2: "10.5", stroke: "currentColor", strokeWidth: "1.5" })
922
922
  ] });
923
923
  }
924
- function In() {
925
- return /* @__PURE__ */ d("svg", { ...Ke, children: [
924
+ function Pn() {
925
+ return /* @__PURE__ */ d("svg", { ...Je, children: [
926
926
  /* @__PURE__ */ n("rect", { x: "1.5", y: "1.5", width: "9", height: "9", stroke: "currentColor", strokeOpacity: "0.35" }),
927
927
  /* @__PURE__ */ n("line", { x1: "1.5", y1: "1.5", x2: "10.5", y2: "1.5", stroke: "currentColor", strokeWidth: "1.5" }),
928
928
  /* @__PURE__ */ n("line", { x1: "1.5", y1: "10.5", x2: "10.5", y2: "10.5", stroke: "currentColor", strokeWidth: "1.5" })
929
929
  ] });
930
930
  }
931
- function Ae({ side: e }) {
931
+ function Se({ side: e }) {
932
932
  const t = {
933
933
  top: { x1: 1.5, y1: 1.5, x2: 10.5, y2: 1.5 },
934
934
  right: { x1: 10.5, y1: 1.5, x2: 10.5, y2: 10.5 },
935
935
  bottom: { x1: 1.5, y1: 10.5, x2: 10.5, y2: 10.5 },
936
936
  left: { x1: 1.5, y1: 1.5, x2: 1.5, y2: 10.5 }
937
937
  }[e];
938
- return /* @__PURE__ */ d("svg", { ...Ke, children: [
938
+ return /* @__PURE__ */ d("svg", { ...Je, children: [
939
939
  /* @__PURE__ */ n("rect", { x: "1.5", y: "1.5", width: "9", height: "9", stroke: "currentColor", strokeOpacity: "0.35" }),
940
940
  /* @__PURE__ */ n("line", { ...t, stroke: "currentColor", strokeWidth: "1.5" })
941
941
  ] });
942
942
  }
943
- function Tn() {
943
+ function Dn() {
944
944
  return /* @__PURE__ */ d("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: [
945
945
  /* @__PURE__ */ n("rect", { x: "2", y: "2", width: "4", height: "4", stroke: "currentColor", strokeWidth: "1.2" }),
946
946
  /* @__PURE__ */ n("rect", { x: "8", y: "2", width: "4", height: "4", stroke: "currentColor", strokeWidth: "1.2" }),
@@ -948,10 +948,10 @@ function Tn() {
948
948
  /* @__PURE__ */ n("rect", { x: "8", y: "8", width: "4", height: "4", stroke: "currentColor", strokeWidth: "1.2" })
949
949
  ] });
950
950
  }
951
- function de({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
952
- const [o, s] = A(t);
953
- return H(() => {
954
- s(t);
951
+ function he({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
952
+ const [s, o] = S(t);
953
+ return _(() => {
954
+ o(t);
955
955
  }, [t]), /* @__PURE__ */ d("label", { className: `pa-spacing-cell ${r ? "pa-spacing-cell--mixed" : ""}`, children: [
956
956
  /* @__PURE__ */ n("span", { className: "pa-spacing-cell-icon", children: e }),
957
957
  /* @__PURE__ */ n(
@@ -959,11 +959,11 @@ function de({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
959
959
  {
960
960
  className: "pa-input pa-spacing-cell-input",
961
961
  type: "text",
962
- value: o,
963
- onChange: (u) => s(u.target.value),
964
- onBlur: () => a(o),
965
- onKeyDown: (u) => {
966
- u.key === "Enter" && u.target.blur(), u.key === "Escape" && (s(t), u.target.blur());
962
+ value: s,
963
+ onChange: (c) => o(c.target.value),
964
+ onBlur: () => a(s),
965
+ onKeyDown: (c) => {
966
+ c.key === "Enter" && c.target.blur(), c.key === "Escape" && (o(t), c.target.blur());
967
967
  },
968
968
  "aria-label": i,
969
969
  spellCheck: !1
@@ -971,10 +971,10 @@ function de({ icon: e, display: t, ariaLabel: i, mixed: r, onCommit: a }) {
971
971
  )
972
972
  ] });
973
973
  }
974
- function lt({ label: e, value: t, onChange: i }) {
975
- const r = Sn(t), [a, o] = A(!1), s = (l) => {
976
- i(Ln({ ...r, ...l }));
977
- }, u = r.left !== r.right, c = r.top !== r.bottom;
974
+ function ut({ label: e, value: t, onChange: i }) {
975
+ const r = In(t), [a, s] = S(!1), o = (l) => {
976
+ i(Tn({ ...r, ...l }));
977
+ }, c = r.left !== r.right, u = r.top !== r.bottom;
978
978
  return /* @__PURE__ */ d("div", { className: "pa-prop-row pa-prop-row--compact pa-spacing-row", children: [
979
979
  /* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: e }),
980
980
  /* @__PURE__ */ d(
@@ -988,66 +988,66 @@ function lt({ label: e, value: t, onChange: i }) {
988
988
  // Col 2 (vertical pair) → T on top, B on bottom
989
989
  /* @__PURE__ */ d("div", { className: "pa-spacing-grid", children: [
990
990
  /* @__PURE__ */ n(
991
- de,
991
+ he,
992
992
  {
993
- icon: /* @__PURE__ */ n(Ae, { side: "left" }),
994
- display: oe(r.left),
993
+ icon: /* @__PURE__ */ n(Se, { side: "left" }),
994
+ display: le(r.left),
995
995
  ariaLabel: `${e} left`,
996
- onCommit: (l) => s({ left: se(l) })
996
+ onCommit: (l) => o({ left: ce(l) })
997
997
  }
998
998
  ),
999
999
  /* @__PURE__ */ n(
1000
- de,
1000
+ he,
1001
1001
  {
1002
- icon: /* @__PURE__ */ n(Ae, { side: "top" }),
1003
- display: oe(r.top),
1002
+ icon: /* @__PURE__ */ n(Se, { side: "top" }),
1003
+ display: le(r.top),
1004
1004
  ariaLabel: `${e} top`,
1005
- onCommit: (l) => s({ top: se(l) })
1005
+ onCommit: (l) => o({ top: ce(l) })
1006
1006
  }
1007
1007
  ),
1008
1008
  /* @__PURE__ */ n(
1009
- de,
1009
+ he,
1010
1010
  {
1011
- icon: /* @__PURE__ */ n(Ae, { side: "right" }),
1012
- display: oe(r.right),
1011
+ icon: /* @__PURE__ */ n(Se, { side: "right" }),
1012
+ display: le(r.right),
1013
1013
  ariaLabel: `${e} right`,
1014
- onCommit: (l) => s({ right: se(l) })
1014
+ onCommit: (l) => o({ right: ce(l) })
1015
1015
  }
1016
1016
  ),
1017
1017
  /* @__PURE__ */ n(
1018
- de,
1018
+ he,
1019
1019
  {
1020
- icon: /* @__PURE__ */ n(Ae, { side: "bottom" }),
1021
- display: oe(r.bottom),
1020
+ icon: /* @__PURE__ */ n(Se, { side: "bottom" }),
1021
+ display: le(r.bottom),
1022
1022
  ariaLabel: `${e} bottom`,
1023
- onCommit: (l) => s({ bottom: se(l) })
1023
+ onCommit: (l) => o({ bottom: ce(l) })
1024
1024
  }
1025
1025
  )
1026
1026
  ] })
1027
1027
  ) : /* @__PURE__ */ d("div", { className: "pa-spacing-pair", children: [
1028
1028
  /* @__PURE__ */ n(
1029
- de,
1029
+ he,
1030
1030
  {
1031
- icon: /* @__PURE__ */ n(En, {}),
1032
- display: at(r.left, r.right),
1033
- mixed: u,
1031
+ icon: /* @__PURE__ */ n(Rn, {}),
1032
+ display: lt(r.left, r.right),
1033
+ mixed: c,
1034
1034
  ariaLabel: `${e} horizontal`,
1035
1035
  onCommit: (l) => {
1036
- const [p, f] = ot(l, r.left);
1037
- s({ left: p, right: f });
1036
+ const [f, p] = ct(l, r.left);
1037
+ o({ left: f, right: p });
1038
1038
  }
1039
1039
  }
1040
1040
  ),
1041
1041
  /* @__PURE__ */ n(
1042
- de,
1042
+ he,
1043
1043
  {
1044
- icon: /* @__PURE__ */ n(In, {}),
1045
- display: at(r.top, r.bottom),
1046
- mixed: c,
1044
+ icon: /* @__PURE__ */ n(Pn, {}),
1045
+ display: lt(r.top, r.bottom),
1046
+ mixed: u,
1047
1047
  ariaLabel: `${e} vertical`,
1048
1048
  onCommit: (l) => {
1049
- const [p, f] = ot(l, r.top);
1050
- s({ top: p, bottom: f });
1049
+ const [f, p] = ct(l, r.top);
1050
+ o({ top: f, bottom: p });
1051
1051
  }
1052
1052
  }
1053
1053
  )
@@ -1057,11 +1057,11 @@ function lt({ label: e, value: t, onChange: i }) {
1057
1057
  {
1058
1058
  type: "button",
1059
1059
  className: `pa-spacing-toggle ${a ? "pa-spacing-toggle--on" : ""}`,
1060
- onClick: () => o((l) => !l),
1060
+ onClick: () => s((l) => !l),
1061
1061
  "aria-pressed": a,
1062
1062
  "aria-label": a ? "Collapse to pair view" : "Expand to per-side view",
1063
1063
  title: a ? "Collapse to pair view" : "Expand to per-side view",
1064
- children: /* @__PURE__ */ n(Tn, {})
1064
+ children: /* @__PURE__ */ n(Dn, {})
1065
1065
  }
1066
1066
  )
1067
1067
  ]
@@ -1069,7 +1069,7 @@ function lt({ label: e, value: t, onChange: i }) {
1069
1069
  )
1070
1070
  ] });
1071
1071
  }
1072
- function Pn({
1072
+ function On({
1073
1073
  options: e,
1074
1074
  value: t,
1075
1075
  ariaLabel: i,
@@ -1089,7 +1089,7 @@ function Pn({
1089
1089
  a.value
1090
1090
  )) });
1091
1091
  }
1092
- function Rn({
1092
+ function Fn({
1093
1093
  options: e,
1094
1094
  ariaLabel: t,
1095
1095
  onToggle: i
@@ -1108,7 +1108,7 @@ function Rn({
1108
1108
  r.id
1109
1109
  )) });
1110
1110
  }
1111
- function $n({ className: e }) {
1111
+ function Bn({ className: e }) {
1112
1112
  return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
1113
1113
  "path",
1114
1114
  {
@@ -1117,7 +1117,7 @@ function $n({ className: e }) {
1117
1117
  }
1118
1118
  ) });
1119
1119
  }
1120
- function Dn({ className: e }) {
1120
+ function zn({ className: e }) {
1121
1121
  return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
1122
1122
  "path",
1123
1123
  {
@@ -1126,7 +1126,7 @@ function Dn({ className: e }) {
1126
1126
  }
1127
1127
  ) });
1128
1128
  }
1129
- function On({ className: e }) {
1129
+ function _n({ className: e }) {
1130
1130
  return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
1131
1131
  "path",
1132
1132
  {
@@ -1135,10 +1135,10 @@ function On({ className: e }) {
1135
1135
  }
1136
1136
  ) });
1137
1137
  }
1138
- function Fn({ className: e }) {
1138
+ function Hn({ className: e }) {
1139
1139
  return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { fill: "currentColor", d: "M2 3h12v1.5H2V3zm0 3.5h12v1.5H2V6.5zm0 3.5h12v1.5H2V10zm0 3.5h12v1.5H2V13.5z" }) });
1140
1140
  }
1141
- function Bn({ className: e }) {
1141
+ function Vn({ className: e }) {
1142
1142
  return /* @__PURE__ */ n("svg", { className: e, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ n(
1143
1143
  "path",
1144
1144
  {
@@ -1147,33 +1147,33 @@ function Bn({ className: e }) {
1147
1147
  }
1148
1148
  ) });
1149
1149
  }
1150
- function Rt(e) {
1150
+ function Bt(e) {
1151
1151
  const t = parseInt(e.trim(), 10);
1152
1152
  return Number.isFinite(t) ? t >= 600 : e.trim() === "bold" || e.trim() === "bolder";
1153
1153
  }
1154
- function zn(e) {
1155
- return Rt(e) ? "400" : "700";
1154
+ function Wn(e) {
1155
+ return Bt(e) ? "400" : "700";
1156
1156
  }
1157
- function $t(e) {
1157
+ function zt(e) {
1158
1158
  return e.trim() === "italic" || e.trim() === "oblique";
1159
1159
  }
1160
- function Hn(e) {
1161
- return $t(e) ? "normal" : "italic";
1160
+ function Un(e) {
1161
+ return zt(e) ? "normal" : "italic";
1162
1162
  }
1163
- function ct(e, t) {
1163
+ function pt(e, t) {
1164
1164
  return e.split(/\s+/).includes(t);
1165
1165
  }
1166
- function dt(e, t) {
1166
+ function ht(e, t) {
1167
1167
  const i = new Set(
1168
1168
  e.trim().split(/\s+/).filter((r) => r && r !== "none")
1169
1169
  );
1170
1170
  return i.has(t) ? i.delete(t) : i.add(t), i.size === 0 ? "none" : Array.from(i).join(" ");
1171
1171
  }
1172
- function _n(e) {
1172
+ function Yn(e) {
1173
1173
  const t = e.trim();
1174
1174
  return t === "center" || t === "right" || t === "justify" ? t : "left";
1175
1175
  }
1176
- const ut = [
1176
+ const ft = [
1177
1177
  "none",
1178
1178
  "solid",
1179
1179
  "dashed",
@@ -1183,7 +1183,7 @@ const ut = [
1183
1183
  "ridge",
1184
1184
  "inset",
1185
1185
  "outset"
1186
- ], pt = [
1186
+ ], mt = [
1187
1187
  "block",
1188
1188
  "inline",
1189
1189
  "inline-block",
@@ -1193,27 +1193,27 @@ const ut = [
1193
1193
  "inline-grid",
1194
1194
  "none",
1195
1195
  "contents"
1196
- ], Vn = /* @__PURE__ */ new Set(["flex", "inline-flex", "grid", "inline-grid"]);
1197
- function Un({
1196
+ ], Xn = /* @__PURE__ */ new Set(["flex", "inline-flex", "grid", "inline-grid"]);
1197
+ function Gn({
1198
1198
  values: e,
1199
1199
  onPropertyChange: t,
1200
1200
  textKind: i,
1201
1201
  textValue: r,
1202
1202
  onTextChange: a,
1203
- targetScope: o,
1204
- onTargetScopeChange: s,
1205
- elementState: u,
1206
- onElementStateChange: c,
1203
+ targetScope: s,
1204
+ onTargetScopeChange: o,
1205
+ elementState: c,
1206
+ onElementStateChange: u,
1207
1207
  instanceCount: l,
1208
- scopeHint: p,
1209
- stateHint: f
1208
+ scopeHint: f,
1209
+ stateHint: p
1210
1210
  }) {
1211
- var I, C;
1212
- const v = e["font-weight"] ?? "", g = e["font-style"] ?? "normal", m = e["text-decoration"] ?? "none", y = _n(e["text-align"] ?? "left"), E = ((I = e.display) == null ? void 0 : I.trim()) ?? "", x = !!E, w = Vn.has(E), N = [...pt];
1213
- E && !pt.includes(E) && N.push(E);
1214
- const T = ((C = e.gap) == null ? void 0 : C.trim()) ?? "", P = T === "normal" || T === "" ? "0px" : T, $ = e["border-style"] ?? "none", k = [...ut];
1215
- return $ && !ut.includes($) && k.push($), /* @__PURE__ */ d("div", { className: "pa-edit-sections", children: [
1216
- /* @__PURE__ */ d(le, { title: "Targeting", defaultOpen: !0, children: [
1211
+ var T, C;
1212
+ const v = e["font-weight"] ?? "", m = e["font-style"] ?? "normal", g = e["text-decoration"] ?? "none", b = Yn(e["text-align"] ?? "left"), E = ((T = e.display) == null ? void 0 : T.trim()) ?? "", N = !!E, w = Xn.has(E), k = [...mt];
1213
+ E && !mt.includes(E) && k.push(E);
1214
+ const I = ((C = e.gap) == null ? void 0 : C.trim()) ?? "", P = I === "normal" || I === "" ? "0px" : I, R = e["border-style"] ?? "none", x = [...ft];
1215
+ return R && !ft.includes(R) && x.push(R), /* @__PURE__ */ d("div", { className: "pa-edit-sections", children: [
1216
+ /* @__PURE__ */ d(ue, { title: "Targeting", defaultOpen: !0, children: [
1217
1217
  /* @__PURE__ */ d("div", { className: "pa-edit-field-grid pa-edit-field-grid--2", children: [
1218
1218
  /* @__PURE__ */ d("label", { className: "pa-edit-mini-field", children: [
1219
1219
  /* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Scope" }),
@@ -1221,8 +1221,8 @@ function Un({
1221
1221
  "select",
1222
1222
  {
1223
1223
  className: "pa-select",
1224
- value: o,
1225
- onChange: (h) => s(h.target.value),
1224
+ value: s,
1225
+ onChange: (h) => o(h.target.value),
1226
1226
  children: [
1227
1227
  /* @__PURE__ */ n("option", { value: "this-instance", children: "This instance" }),
1228
1228
  /* @__PURE__ */ d("option", { value: "all-instances", disabled: l <= 1, children: [
@@ -1240,8 +1240,8 @@ function Un({
1240
1240
  "select",
1241
1241
  {
1242
1242
  className: "pa-select",
1243
- value: u,
1244
- onChange: (h) => c(h.target.value),
1243
+ value: c,
1244
+ onChange: (h) => u(h.target.value),
1245
1245
  children: [
1246
1246
  /* @__PURE__ */ n("option", { value: "normal", children: "Normal" }),
1247
1247
  /* @__PURE__ */ n("option", { value: "hover", children: "Hover" }),
@@ -1253,10 +1253,10 @@ function Un({
1253
1253
  )
1254
1254
  ] })
1255
1255
  ] }),
1256
- p ? /* @__PURE__ */ n("p", { className: "pa-edit-inline-hint", children: p }) : null,
1257
- f ? /* @__PURE__ */ n("p", { className: "pa-edit-inline-hint", children: f }) : null
1256
+ f ? /* @__PURE__ */ n("p", { className: "pa-edit-inline-hint", children: f }) : null,
1257
+ p ? /* @__PURE__ */ n("p", { className: "pa-edit-inline-hint", children: p }) : null
1258
1258
  ] }),
1259
- i !== "none" && /* @__PURE__ */ n(le, { title: "Content", defaultOpen: !0, children: /* @__PURE__ */ d("label", { className: "pa-edit-stack-field", children: [
1259
+ i !== "none" && /* @__PURE__ */ n(ue, { title: "Content", defaultOpen: !0, children: /* @__PURE__ */ d("label", { className: "pa-edit-stack-field", children: [
1260
1260
  /* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Text" }),
1261
1261
  /* @__PURE__ */ n(
1262
1262
  "textarea",
@@ -1269,9 +1269,9 @@ function Un({
1269
1269
  }
1270
1270
  )
1271
1271
  ] }) }),
1272
- /* @__PURE__ */ d(le, { title: "Typography", defaultOpen: !0, children: [
1272
+ /* @__PURE__ */ d(ue, { title: "Typography", defaultOpen: !0, children: [
1273
1273
  /* @__PURE__ */ n(
1274
- xn,
1274
+ Mn,
1275
1275
  {
1276
1276
  value: e["font-family"] ?? "",
1277
1277
  onChange: (h) => t("font-family", h)
@@ -1280,42 +1280,42 @@ function Un({
1280
1280
  /* @__PURE__ */ d("div", { className: "pa-edit-field-block", children: [
1281
1281
  /* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Style" }),
1282
1282
  /* @__PURE__ */ n(
1283
- Rn,
1283
+ Fn,
1284
1284
  {
1285
1285
  ariaLabel: "Text style",
1286
1286
  options: [
1287
1287
  {
1288
1288
  id: "bold",
1289
1289
  title: "Bold",
1290
- pressed: Rt(v),
1290
+ pressed: Bt(v),
1291
1291
  content: /* @__PURE__ */ n("span", { className: "pa-segmented-type pa-segmented-type--bold", children: "B" })
1292
1292
  },
1293
1293
  {
1294
1294
  id: "italic",
1295
1295
  title: "Italic",
1296
- pressed: $t(g),
1296
+ pressed: zt(m),
1297
1297
  content: /* @__PURE__ */ n("span", { className: "pa-segmented-type pa-segmented-type--italic", children: "I" })
1298
1298
  },
1299
1299
  {
1300
1300
  id: "underline",
1301
1301
  title: "Underline",
1302
- pressed: ct(m, "underline"),
1302
+ pressed: pt(g, "underline"),
1303
1303
  content: /* @__PURE__ */ n("span", { className: "pa-segmented-type pa-segmented-type--underline", children: "U" })
1304
1304
  },
1305
1305
  {
1306
1306
  id: "strikethrough",
1307
1307
  title: "Strikethrough",
1308
- pressed: ct(m, "line-through"),
1309
- content: /* @__PURE__ */ n(Bn, { className: "pa-segmented-icon" })
1308
+ pressed: pt(g, "line-through"),
1309
+ content: /* @__PURE__ */ n(Vn, { className: "pa-segmented-icon" })
1310
1310
  }
1311
1311
  ],
1312
1312
  onToggle: (h) => {
1313
- h === "bold" ? t("font-weight", zn(v)) : h === "italic" ? t("font-style", Hn(g)) : h === "underline" ? t(
1313
+ h === "bold" ? t("font-weight", Wn(v)) : h === "italic" ? t("font-style", Un(m)) : h === "underline" ? t(
1314
1314
  "text-decoration",
1315
- dt(m, "underline")
1315
+ ht(g, "underline")
1316
1316
  ) : h === "strikethrough" && t(
1317
1317
  "text-decoration",
1318
- dt(m, "line-through")
1318
+ ht(g, "line-through")
1319
1319
  );
1320
1320
  }
1321
1321
  }
@@ -1324,31 +1324,31 @@ function Un({
1324
1324
  /* @__PURE__ */ d("div", { className: "pa-edit-field-block", children: [
1325
1325
  /* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Align" }),
1326
1326
  /* @__PURE__ */ n(
1327
- Pn,
1327
+ On,
1328
1328
  {
1329
1329
  ariaLabel: "Text align",
1330
- value: y,
1330
+ value: b,
1331
1331
  onChange: (h) => t("text-align", h),
1332
1332
  options: [
1333
1333
  {
1334
1334
  value: "left",
1335
1335
  title: "Align left",
1336
- content: /* @__PURE__ */ n($n, { className: "pa-segmented-icon" })
1336
+ content: /* @__PURE__ */ n(Bn, { className: "pa-segmented-icon" })
1337
1337
  },
1338
1338
  {
1339
1339
  value: "center",
1340
1340
  title: "Align center",
1341
- content: /* @__PURE__ */ n(Dn, { className: "pa-segmented-icon" })
1341
+ content: /* @__PURE__ */ n(zn, { className: "pa-segmented-icon" })
1342
1342
  },
1343
1343
  {
1344
1344
  value: "right",
1345
1345
  title: "Align right",
1346
- content: /* @__PURE__ */ n(On, { className: "pa-segmented-icon" })
1346
+ content: /* @__PURE__ */ n(_n, { className: "pa-segmented-icon" })
1347
1347
  },
1348
1348
  {
1349
1349
  value: "justify",
1350
1350
  title: "Justify",
1351
- content: /* @__PURE__ */ n(Fn, { className: "pa-segmented-icon" })
1351
+ content: /* @__PURE__ */ n(Hn, { className: "pa-segmented-icon" })
1352
1352
  }
1353
1353
  ]
1354
1354
  }
@@ -1356,7 +1356,7 @@ function Un({
1356
1356
  ] }),
1357
1357
  /* @__PURE__ */ d("div", { className: "pa-edit-field-grid pa-edit-field-grid--2 pa-edit-size-row", children: [
1358
1358
  /* @__PURE__ */ n(
1359
- re,
1359
+ ie,
1360
1360
  {
1361
1361
  compact: !0,
1362
1362
  property: "font-size",
@@ -1366,7 +1366,7 @@ function Un({
1366
1366
  }
1367
1367
  ),
1368
1368
  /* @__PURE__ */ n(
1369
- re,
1369
+ ie,
1370
1370
  {
1371
1371
  compact: !0,
1372
1372
  property: "line-height",
@@ -1377,7 +1377,7 @@ function Un({
1377
1377
  )
1378
1378
  ] }),
1379
1379
  /* @__PURE__ */ n(
1380
- Be,
1380
+ _e,
1381
1381
  {
1382
1382
  label: "Color",
1383
1383
  value: e.color ?? "",
@@ -1385,10 +1385,10 @@ function Un({
1385
1385
  }
1386
1386
  )
1387
1387
  ] }),
1388
- /* @__PURE__ */ d(le, { title: "Layout", defaultOpen: !0, children: [
1388
+ /* @__PURE__ */ d(ue, { title: "Layout", defaultOpen: !0, children: [
1389
1389
  /* @__PURE__ */ d("div", { className: "pa-edit-split-fields", children: [
1390
1390
  /* @__PURE__ */ n(
1391
- re,
1391
+ ie,
1392
1392
  {
1393
1393
  compact: !0,
1394
1394
  property: "width",
@@ -1398,7 +1398,7 @@ function Un({
1398
1398
  }
1399
1399
  ),
1400
1400
  /* @__PURE__ */ n(
1401
- re,
1401
+ ie,
1402
1402
  {
1403
1403
  compact: !0,
1404
1404
  property: "height",
@@ -1409,7 +1409,7 @@ function Un({
1409
1409
  )
1410
1410
  ] }),
1411
1411
  /* @__PURE__ */ n(
1412
- lt,
1412
+ ut,
1413
1413
  {
1414
1414
  property: "padding",
1415
1415
  label: "Padding",
@@ -1418,7 +1418,7 @@ function Un({
1418
1418
  }
1419
1419
  ),
1420
1420
  /* @__PURE__ */ n(
1421
- lt,
1421
+ ut,
1422
1422
  {
1423
1423
  property: "margin",
1424
1424
  label: "Margin",
@@ -1426,7 +1426,7 @@ function Un({
1426
1426
  onChange: (h) => t("margin", h)
1427
1427
  }
1428
1428
  ),
1429
- x && /* @__PURE__ */ d("label", { className: "pa-prop-row pa-prop-row--compact", children: [
1429
+ N && /* @__PURE__ */ d("label", { className: "pa-prop-row pa-prop-row--compact", children: [
1430
1430
  /* @__PURE__ */ n("span", { className: "pa-edit-field-label", children: "Display" }),
1431
1431
  /* @__PURE__ */ n(
1432
1432
  "select",
@@ -1434,12 +1434,12 @@ function Un({
1434
1434
  className: "pa-select",
1435
1435
  value: E,
1436
1436
  onChange: (h) => t("display", h.target.value),
1437
- children: N.map((h) => /* @__PURE__ */ n("option", { value: h, children: h }, h))
1437
+ children: k.map((h) => /* @__PURE__ */ n("option", { value: h, children: h }, h))
1438
1438
  }
1439
1439
  )
1440
1440
  ] }),
1441
1441
  w && /* @__PURE__ */ n(
1442
- re,
1442
+ ie,
1443
1443
  {
1444
1444
  compact: !0,
1445
1445
  property: "gap",
@@ -1449,9 +1449,9 @@ function Un({
1449
1449
  }
1450
1450
  )
1451
1451
  ] }),
1452
- /* @__PURE__ */ d(le, { title: "Fill", children: [
1452
+ /* @__PURE__ */ d(ue, { title: "Fill", children: [
1453
1453
  /* @__PURE__ */ n(
1454
- Be,
1454
+ _e,
1455
1455
  {
1456
1456
  label: "Background",
1457
1457
  value: e["background-color"] ?? "",
@@ -1459,7 +1459,7 @@ function Un({
1459
1459
  }
1460
1460
  ),
1461
1461
  /* @__PURE__ */ n(
1462
- re,
1462
+ ie,
1463
1463
  {
1464
1464
  compact: !0,
1465
1465
  property: "opacity",
@@ -1469,9 +1469,9 @@ function Un({
1469
1469
  }
1470
1470
  )
1471
1471
  ] }),
1472
- /* @__PURE__ */ d(le, { title: "Border", defaultOpen: !0, children: [
1472
+ /* @__PURE__ */ d(ue, { title: "Border", defaultOpen: !0, children: [
1473
1473
  /* @__PURE__ */ n(
1474
- Be,
1474
+ _e,
1475
1475
  {
1476
1476
  label: "Border color",
1477
1477
  value: e["border-color"] ?? "",
@@ -1484,14 +1484,14 @@ function Un({
1484
1484
  "select",
1485
1485
  {
1486
1486
  className: "pa-select",
1487
- value: $,
1487
+ value: R,
1488
1488
  onChange: (h) => t("border-style", h.target.value),
1489
- children: k.map((h) => /* @__PURE__ */ n("option", { value: h, children: h }, h))
1489
+ children: x.map((h) => /* @__PURE__ */ n("option", { value: h, children: h }, h))
1490
1490
  }
1491
1491
  )
1492
1492
  ] }),
1493
1493
  /* @__PURE__ */ n(
1494
- re,
1494
+ ie,
1495
1495
  {
1496
1496
  compact: !0,
1497
1497
  property: "border-width",
@@ -1501,7 +1501,7 @@ function Un({
1501
1501
  }
1502
1502
  ),
1503
1503
  /* @__PURE__ */ n(
1504
- re,
1504
+ ie,
1505
1505
  {
1506
1506
  compact: !0,
1507
1507
  property: "border-radius",
@@ -1513,7 +1513,7 @@ function Un({
1513
1513
  ] })
1514
1514
  ] });
1515
1515
  }
1516
- const Wn = 50, ht = [
1516
+ const Kn = 50, gt = [
1517
1517
  "font-family",
1518
1518
  "font-size",
1519
1519
  "font-weight",
@@ -1535,212 +1535,217 @@ const Wn = 50, ht = [
1535
1535
  "border-radius",
1536
1536
  "opacity"
1537
1537
  ];
1538
- function Yn(e, t, i) {
1539
- var te;
1540
- const r = W([]), a = W(/* @__PURE__ */ new Set()), o = W([]), s = W(null), u = W([]), [c, l] = A({}), [p, f] = A({}), [v, g] = A("none"), [m, y] = A(""), [E, x] = A(""), [w, N] = A(() => /* @__PURE__ */ new Map()), [T, P] = A(!1), $ = L(() => {
1538
+ function jn(e, t, i) {
1539
+ var ee;
1540
+ const r = Y([]), a = Y(/* @__PURE__ */ new Set()), s = Y([]), o = Y(null), c = Y([]), [u, l] = S({}), [f, p] = S({}), [v, m] = S("none"), [g, b] = S(""), [E, N] = S(""), [w, k] = S(() => /* @__PURE__ */ new Map()), [I, P] = S(!1), R = $(() => {
1541
1541
  const M = Array.from(a.current);
1542
1542
  return {
1543
- inline: Qe(M, [...ht]),
1544
- text: e && v !== "none" ? Ze(e, v) : null
1543
+ inline: nt(M, [...gt]),
1544
+ text: e && v !== "none" ? tt(e, v) : null
1545
1545
  };
1546
- }, [e, v]), k = L(() => {
1547
- u.current.push($()), u.current.length > Wn && u.current.shift(), P(u.current.length > 0);
1548
- }, [$]), I = L(
1546
+ }, [e, v]), x = $(() => {
1547
+ c.current.push(R()), c.current.length > Kn && c.current.shift(), P(c.current.length > 0);
1548
+ }, [R]), T = $(
1549
1549
  (M) => {
1550
- var R;
1550
+ var L;
1551
1551
  if (!e) return;
1552
- const D = Array.from(a.current);
1553
- ye(o.current.filter((z) => D.includes(z.element))), s.current && Ne(s.current);
1554
- const O = Ee(e, t);
1555
- r.current = O, a.current = new Set(O), ke(D), Fe(O, i);
1556
- const _ = e ? ((R = w.get(e)) == null ? void 0 : R.get(i)) ?? [] : [];
1557
- if (M && _.length > 0)
1558
- for (const z of _)
1552
+ const O = Array.from(a.current);
1553
+ we(s.current.filter((z) => O.includes(z.element))), o.current && ke(o.current);
1554
+ const D = $e(e, t);
1555
+ r.current = D, a.current = new Set(D), Ce(O), ze(D, i);
1556
+ const U = e ? ((L = w.get(e)) == null ? void 0 : L.get(i)) ?? [] : [];
1557
+ if (M && U.length > 0)
1558
+ for (const z of U)
1559
1559
  if (z.property === "textContent" || z.property === "value")
1560
- for (const X of O)
1561
- et(X, z.property, z.newValue);
1560
+ for (const X of D)
1561
+ rt(X, z.property, z.newValue);
1562
1562
  else
1563
- for (const X of O)
1563
+ for (const X of D)
1564
1564
  X.style.setProperty(z.property, z.newValue);
1565
1565
  },
1566
1566
  [e, t, i, w]
1567
1567
  );
1568
- H(() => {
1568
+ _(() => {
1569
1569
  if (!e) {
1570
- r.current = [], a.current = /* @__PURE__ */ new Set(), o.current = [], s.current = null, u.current = [], l({}), f({}), g("none"), y(""), x(""), N(/* @__PURE__ */ new Map()), P(!1);
1570
+ r.current = [], a.current = /* @__PURE__ */ new Set(), s.current = [], o.current = null, c.current = [], l({}), p({}), m("none"), b(""), N(""), k(/* @__PURE__ */ new Map()), P(!1);
1571
1571
  return;
1572
1572
  }
1573
- const M = Ee(e, t);
1574
- r.current = M, a.current = new Set(M), o.current = Qe(M, [...ht]), u.current = [], P(!1);
1575
- const D = Ce(e);
1576
- l(D), f(D);
1577
- const O = ue(e);
1578
- return g(O.kind), y(O.value), x(O.value), s.current = O.kind !== "none" ? Ze(e, O.kind) : null, Fe(M, i), () => ke(M);
1579
- }, [e]), H(() => {
1580
- e && I(!0);
1581
- }, [t]), H(() => {
1582
- var O;
1573
+ const M = $e(e, t);
1574
+ r.current = M, a.current = new Set(M), s.current = nt(M, [...gt]), c.current = [], P(!1);
1575
+ const O = Me(e);
1576
+ l(O), p(O);
1577
+ const D = fe(e);
1578
+ return m(D.kind), b(D.value), N(D.value), o.current = D.kind !== "none" ? tt(e, D.kind) : null, ze(M, i), () => Ce(M);
1579
+ }, [e]), _(() => {
1580
+ e && T(!0);
1581
+ }, [t]), _(() => {
1582
+ var U;
1583
1583
  if (!e) return;
1584
- const M = Ee(e, t);
1585
- r.current = M, ye(
1586
- o.current.filter((_) => M.includes(_.element))
1584
+ const M = $e(e, t);
1585
+ r.current = M, we(
1586
+ s.current.filter((L) => M.includes(L.element))
1587
1587
  );
1588
- const D = ((O = w.get(e)) == null ? void 0 : O.get(i)) ?? [];
1589
- for (const _ of D)
1590
- if (!(_.property === "textContent" || _.property === "value"))
1591
- for (const R of M)
1592
- R.style.setProperty(_.property, _.newValue);
1593
- ke(Array.from(a.current)), Fe(M, i), a.current = new Set(M);
1588
+ const O = ((U = w.get(e)) == null ? void 0 : U.get(i)) ?? [];
1589
+ for (const L of O)
1590
+ if (!(L.property === "textContent" || L.property === "value"))
1591
+ for (const z of M)
1592
+ z.style.setProperty(L.property, L.newValue);
1593
+ const D = { ...f };
1594
+ for (const L of O)
1595
+ L.property === "textContent" || L.property === "value" || (D[L.property] = L.newValue);
1596
+ l(D), Ce(Array.from(a.current)), ze(M, i), a.current = new Set(M);
1594
1597
  }, [i, e, t]);
1595
- const C = L(
1596
- (M, D, O) => {
1597
- e && N((_) => {
1598
- const R = new Map(_), z = new Map(R.get(e) ?? /* @__PURE__ */ new Map()), q = (z.get(i) ?? []).filter((fe) => fe.property !== M);
1599
- return O === D ? q.length === 0 ? z.delete(i) : z.set(i, q) : z.set(i, [...q, { property: M, oldValue: D, newValue: O }]), z.size === 0 ? R.delete(e) : R.set(e, z), R;
1598
+ const C = $(
1599
+ (M, O, D) => {
1600
+ e && k((U) => {
1601
+ const L = new Map(U), z = new Map(L.get(e) ?? /* @__PURE__ */ new Map()), q = (z.get(i) ?? []).filter((Re) => Re.property !== M);
1602
+ return D === O ? q.length === 0 ? z.delete(i) : z.set(i, q) : z.set(i, [...q, { property: M, oldValue: O, newValue: D }]), z.size === 0 ? L.delete(e) : L.set(e, z), L;
1600
1603
  });
1601
1604
  },
1602
1605
  [e, i]
1603
- ), h = L(
1604
- (M, D) => {
1606
+ ), h = $(
1607
+ (M, O) => {
1605
1608
  if (!e) return;
1606
- const O = { [M]: D };
1607
- M === "border-width" && (c["border-style"] ?? "none") === "none" && kn(D) && (O["border-style"] = "solid"), k(), l((_) => ({ ..._, ...O }));
1608
- for (const [_, R] of Object.entries(O)) {
1609
- const z = p[_] ?? "";
1609
+ const D = { [M]: O };
1610
+ M === "border-width" && (u["border-style"] ?? "none") === "none" && Sn(O) && (D["border-style"] = "solid"), x(), l((U) => ({ ...U, ...D }));
1611
+ for (const [U, L] of Object.entries(D)) {
1612
+ const z = f[U] ?? "";
1610
1613
  for (const X of r.current)
1611
- X.style.setProperty(_, R), a.current.add(X);
1612
- C(_, z, R);
1614
+ X.style.setProperty(U, L), a.current.add(X);
1615
+ C(U, z, L);
1613
1616
  }
1614
1617
  },
1615
- [e, p, c, k, C]
1616
- ), B = L(
1618
+ [e, f, u, x, C]
1619
+ ), F = $(
1617
1620
  (M) => {
1618
1621
  if (!(!e || v === "none")) {
1619
- k(), y(M);
1620
- for (const D of r.current)
1621
- et(D, v, M), a.current.add(D);
1622
+ x(), b(M);
1623
+ for (const O of r.current)
1624
+ rt(O, v, M), a.current.add(O);
1622
1625
  C(v, E, M);
1623
1626
  }
1624
1627
  },
1625
- [e, v, E, k, C]
1626
- ), Y = L(() => {
1627
- const M = u.current.pop();
1628
- if (M && (ye(M.inline), M.text && Ne(M.text), P(u.current.length > 0), e)) {
1629
- l(Ce(e));
1630
- const D = ue(e);
1631
- D.kind !== "none" && y(D.value);
1628
+ [e, v, E, x, C]
1629
+ ), W = $(() => {
1630
+ const M = c.current.pop();
1631
+ if (M && (we(M.inline), M.text && ke(M.text), P(c.current.length > 0), e)) {
1632
+ l(Me(e));
1633
+ const O = fe(e);
1634
+ O.kind !== "none" && b(O.value);
1632
1635
  }
1633
- }, [e]), ne = L(() => {
1634
- if (ye(o.current), s.current && Ne(s.current), u.current = [], P(!1), N(/* @__PURE__ */ new Map()), e) {
1635
- l(Ce(e));
1636
- const M = ue(e);
1637
- y(M.value);
1636
+ }, [e]), ge = $(() => {
1637
+ if (we(s.current), o.current && ke(o.current), c.current = [], P(!1), k(/* @__PURE__ */ new Map()), e) {
1638
+ l(Me(e));
1639
+ const M = fe(e);
1640
+ b(M.value);
1638
1641
  }
1639
- }, [e]), Q = L(() => {
1640
- ye(o.current), s.current && Ne(s.current);
1641
- }, []), J = L(() => {
1642
- if (Q(), ke(Array.from(a.current)), u.current = [], P(!1), N(/* @__PURE__ */ new Map()), e) {
1643
- l(Ce(e));
1644
- const M = ue(e);
1645
- M.kind !== "none" && y(M.value);
1642
+ }, [e]), j = $(() => {
1643
+ we(s.current), o.current && ke(o.current);
1644
+ }, []), oe = $(() => {
1645
+ if (j(), Ce(Array.from(a.current)), c.current = [], P(!1), k(/* @__PURE__ */ new Map()), e) {
1646
+ l(Me(e));
1647
+ const M = fe(e);
1648
+ M.kind !== "none" && b(M.value);
1646
1649
  }
1647
- }, [Q, e]), he = e ? ((te = w.get(e)) == null ? void 0 : te.get(i)) ?? [] : [];
1648
- let F = 0;
1650
+ }, [j, e]), re = e ? ((ee = w.get(e)) == null ? void 0 : ee.get(i)) ?? [] : [];
1651
+ let V = 0;
1649
1652
  for (const M of w.values())
1650
- for (const D of M.values()) F += D.length;
1651
- const ee = L(() => {
1652
- N(/* @__PURE__ */ new Map());
1653
+ for (const O of M.values()) V += O.length;
1654
+ const G = $(() => {
1655
+ k(/* @__PURE__ */ new Map());
1653
1656
  }, []);
1654
1657
  return {
1655
- values: c,
1658
+ values: u,
1656
1659
  textKind: v,
1657
- textValue: m,
1658
- pendingChanges: he,
1660
+ textValue: g,
1661
+ pendingChanges: re,
1659
1662
  pendingByElement: w,
1660
- totalPendingCount: F,
1661
- clearAllPending: ee,
1662
- canUndo: T,
1663
+ totalPendingCount: V,
1664
+ clearAllPending: G,
1665
+ canUndo: I,
1663
1666
  updateProperty: h,
1664
- updateText: B,
1665
- undo: Y,
1666
- reset: ne,
1667
- clearPreviews: J,
1668
- revertPreviews: Q
1667
+ updateText: F,
1668
+ undo: W,
1669
+ reset: ge,
1670
+ clearPreviews: oe,
1671
+ revertPreviews: j
1669
1672
  };
1670
1673
  }
1671
- function Xn({
1674
+ function qn({
1672
1675
  selectedElement: e,
1673
1676
  hoveredElement: t,
1674
1677
  onSelectElement: i,
1675
1678
  onHoverElement: r,
1676
1679
  targetScope: a,
1677
- onTargetScopeChange: o,
1678
- elementState: s,
1679
- onElementStateChange: u,
1680
- onApply: c,
1680
+ onTargetScopeChange: s,
1681
+ elementState: o,
1682
+ onElementStateChange: c,
1683
+ onApply: u,
1681
1684
  applyStatus: l,
1682
- isToolbarTarget: p,
1683
- onPreviewApi: f
1685
+ isToolbarTarget: f,
1686
+ onPreviewApi: p
1684
1687
  }) {
1685
1688
  const {
1686
1689
  values: v,
1687
- textKind: g,
1688
- textValue: m,
1689
- pendingChanges: y,
1690
+ textKind: m,
1691
+ textValue: g,
1692
+ pendingChanges: b,
1690
1693
  pendingByElement: E,
1691
- totalPendingCount: x,
1694
+ totalPendingCount: N,
1692
1695
  clearAllPending: w,
1693
- canUndo: N,
1694
- updateProperty: T,
1696
+ canUndo: k,
1697
+ updateProperty: I,
1695
1698
  updateText: P,
1696
- undo: $,
1697
- reset: k,
1698
- clearPreviews: I,
1699
+ undo: R,
1700
+ reset: x,
1701
+ clearPreviews: T,
1699
1702
  revertPreviews: C
1700
- } = Yn(e, a, s), { elementRef: h, isDragging: B, style: Y, dragHandleProps: ne } = Lt({
1701
- computeDefaultPosition: (R) => ({
1702
- x: window.innerWidth - R.width - 16,
1703
+ } = jn(e, a, o), { elementRef: h, isDragging: F, style: W, dragHandleProps: ge } = Rt({
1704
+ computeDefaultPosition: (L) => ({
1705
+ x: window.innerWidth - L.width - 16,
1703
1706
  y: 16
1704
1707
  })
1705
1708
  });
1706
- H(() => (f == null || f({ clearPreviews: I, revertPreviews: C }), () => f == null ? void 0 : f(null)), [f, I, C]);
1707
- const Q = L(
1708
- (R) => {
1709
- if (p(R.target)) return;
1710
- const X = document.elementsFromPoint(R.clientX, R.clientY).find(
1709
+ _(() => (p == null || p({ clearPreviews: T, revertPreviews: C }), () => p == null ? void 0 : p(null)), [p, T, C]);
1710
+ const j = $(
1711
+ (L) => {
1712
+ if (f(L.target)) return;
1713
+ const X = document.elementsFromPoint(L.clientX, L.clientY).find(
1711
1714
  (q) => q instanceof Element && !q.closest(
1712
1715
  "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
1713
1716
  )
1714
1717
  );
1715
1718
  r(X ?? null);
1716
1719
  },
1717
- [p, r]
1718
- ), J = L(
1719
- (R) => {
1720
- if (p(R.target)) return;
1721
- R.preventDefault(), R.stopPropagation();
1722
- const X = document.elementsFromPoint(R.clientX, R.clientY).find(
1720
+ [f, r]
1721
+ ), oe = $(
1722
+ (L) => {
1723
+ if (f(L.target)) return;
1724
+ L.preventDefault(), L.stopPropagation();
1725
+ const X = document.elementsFromPoint(L.clientX, L.clientY).find(
1723
1726
  (q) => q instanceof Element && !q.closest(
1724
1727
  "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]"
1725
1728
  )
1726
1729
  );
1727
1730
  i(X ?? null);
1728
1731
  },
1729
- [p, i]
1732
+ [f, i]
1730
1733
  );
1731
- H(() => (document.addEventListener("mousemove", Q, !0), document.addEventListener("click", J, !0), () => {
1732
- document.removeEventListener("mousemove", Q, !0), document.removeEventListener("click", J, !0);
1733
- }), [Q, J]);
1734
- const he = async () => {
1735
- x === 0 || !await c(E) || (w(), C());
1736
- }, F = e ? We(e) : null, ee = e ? bt(e) : null, te = e ? yt(e) : 0, M = e ? wt(e, "all-instances") : "", D = s !== "normal" && ee === "tailwind" ? "Tailwind variant preview: matching hover:/focus:/… classes are applied without the prefix." : s !== "normal" ? "State preview uses focus/disabled simulation where possible." : null, O = te > 1 ? a === "all-instances" ? `Preview & Apply on ${te} elements (${M}).` : `This instance only — ${te - 1} other on page.` : a === "all-instances" ? "Only one match — scope has no effect." : null, _ = we(() => !e || a !== "all-instances" ? [] : Ee(e, "all-instances"), [e, a]);
1737
- return /* @__PURE__ */ d(G, { children: [
1734
+ _(() => (document.addEventListener("mousemove", j, !0), document.addEventListener("click", oe, !0), () => {
1735
+ document.removeEventListener("mousemove", j, !0), document.removeEventListener("click", oe, !0);
1736
+ }), [j, oe]);
1737
+ const re = async () => {
1738
+ if (N === 0) return;
1739
+ const L = await u(E);
1740
+ L.applied && (w(), L.skipRevert || C());
1741
+ }, V = e ? Ge(e) : null, G = e ? kt(e) : null, ee = e ? Ct(e) : 0, M = e ? Mt(e, "all-instances") : "", O = o !== "normal" && G === "tailwind" ? "Tailwind variant preview: matching hover:/focus:/… classes are applied without the prefix." : o !== "normal" ? "State preview uses focus/disabled simulation where possible." : null, D = ee > 1 ? a === "all-instances" ? `Preview & Apply on ${ee} elements (${M}).` : `This instance only — ${ee - 1} other on page.` : a === "all-instances" ? "Only one match — scope has no effect." : null, U = xe(() => !e || a !== "all-instances" ? [] : $e(e, "all-instances"), [e, a]);
1742
+ return /* @__PURE__ */ d(K, { children: [
1738
1743
  /* @__PURE__ */ n(
1739
- Mt,
1744
+ $t,
1740
1745
  {
1741
1746
  element: a === "all-instances" ? null : t,
1742
1747
  selected: e,
1743
- multiSelected: _,
1748
+ multiSelected: U,
1744
1749
  primarySelected: e
1745
1750
  }
1746
1751
  ),
@@ -1748,8 +1753,8 @@ function Xn({
1748
1753
  "div",
1749
1754
  {
1750
1755
  ref: h,
1751
- className: `pa-edit-panel-float ${B ? "pa-edit-panel-float--dragging" : ""}`,
1752
- style: Y,
1756
+ className: `pa-edit-panel-float ${F ? "pa-edit-panel-float--dragging" : ""}`,
1757
+ style: W,
1753
1758
  children: /* @__PURE__ */ n(Te, { variant: "sheet", side: "right", className: "pa-edit-panel-glass", children: /* @__PURE__ */ d("div", { className: "pa-edit-panel-inner", children: [
1754
1759
  /* @__PURE__ */ d("div", { className: "pa-edit-panel-header", children: [
1755
1760
  /* @__PURE__ */ n(
@@ -1759,7 +1764,7 @@ function Xn({
1759
1764
  className: "pa-edit-panel-drag",
1760
1765
  "aria-label": "Drag edit panel",
1761
1766
  title: "Drag to move",
1762
- ...ne,
1767
+ ...ge,
1763
1768
  children: /* @__PURE__ */ d("span", { className: "pa-edit-panel-grip", "aria-hidden": "true", children: [
1764
1769
  /* @__PURE__ */ n("span", {}),
1765
1770
  /* @__PURE__ */ n("span", {}),
@@ -1772,57 +1777,57 @@ function Xn({
1772
1777
  ),
1773
1778
  /* @__PURE__ */ n("h3", { className: "pa-edit-title", children: "Edit" })
1774
1779
  ] }),
1775
- e ? /* @__PURE__ */ d(G, { children: [
1780
+ e ? /* @__PURE__ */ d(K, { children: [
1776
1781
  /* @__PURE__ */ d("div", { className: "pa-edit-meta", children: [
1777
1782
  /* @__PURE__ */ n(
1778
1783
  "code",
1779
1784
  {
1780
1785
  className: "pa-edit-meta-label",
1781
- title: `This instance: ${xt(e)}
1786
+ title: `This instance: ${At(e)}
1782
1787
  All instances: ${M}`,
1783
- children: Ue(e)
1788
+ children: Xe(e)
1784
1789
  }
1785
1790
  ),
1786
- ((F == null ? void 0 : F.sourceFile) || ee) && /* @__PURE__ */ d("span", { className: "pa-edit-source", children: [
1787
- (F == null ? void 0 : F.sourceFile) && /* @__PURE__ */ d(G, { children: [
1788
- F.sourceFile,
1789
- F.lineNumber ? `:${F.lineNumber}` : ""
1791
+ ((V == null ? void 0 : V.sourceFile) || G) && /* @__PURE__ */ d("span", { className: "pa-edit-source", children: [
1792
+ (V == null ? void 0 : V.sourceFile) && /* @__PURE__ */ d(K, { children: [
1793
+ V.sourceFile,
1794
+ V.lineNumber ? `:${V.lineNumber}` : ""
1790
1795
  ] }),
1791
- F != null && F.sourceFile && ee ? " · " : "",
1792
- ee ?? ""
1796
+ V != null && V.sourceFile && G ? " · " : "",
1797
+ G ?? ""
1793
1798
  ] })
1794
1799
  ] }),
1795
1800
  /* @__PURE__ */ n("div", { className: "pa-edit-panel-scroll", children: /* @__PURE__ */ n(
1796
- Un,
1801
+ Gn,
1797
1802
  {
1798
1803
  values: v,
1799
- onPropertyChange: T,
1800
- textKind: g,
1801
- textValue: m,
1804
+ onPropertyChange: I,
1805
+ textKind: m,
1806
+ textValue: g,
1802
1807
  onTextChange: P,
1803
1808
  targetScope: a,
1804
- onTargetScopeChange: o,
1805
- elementState: s,
1806
- onElementStateChange: u,
1807
- instanceCount: te,
1808
- scopeHint: O,
1809
- stateHint: D
1809
+ onTargetScopeChange: s,
1810
+ elementState: o,
1811
+ onElementStateChange: c,
1812
+ instanceCount: ee,
1813
+ scopeHint: D,
1814
+ stateHint: O
1810
1815
  }
1811
1816
  ) }),
1812
1817
  /* @__PURE__ */ d("div", { className: "pa-edit-panel-sticky", children: [
1813
1818
  /* @__PURE__ */ d("div", { className: "pa-edit-actions", children: [
1814
- /* @__PURE__ */ n(V, { variant: "regular", onClick: $, disabled: !N, children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
1815
- /* @__PURE__ */ n(un, { className: "pa-glass-btn-icon" }),
1819
+ /* @__PURE__ */ n(H, { variant: "regular", onClick: R, disabled: !k, children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
1820
+ /* @__PURE__ */ n(mn, { className: "pa-glass-btn-icon" }),
1816
1821
  /* @__PURE__ */ n("span", { children: "Undo" })
1817
1822
  ] }) }),
1818
1823
  /* @__PURE__ */ n(
1819
- V,
1824
+ H,
1820
1825
  {
1821
1826
  variant: "regular",
1822
- onClick: k,
1823
- disabled: y.length === 0,
1827
+ onClick: x,
1828
+ disabled: b.length === 0,
1824
1829
  children: /* @__PURE__ */ d("span", { className: "pa-glass-btn-inner", children: [
1825
- /* @__PURE__ */ n(pn, { className: "pa-glass-btn-icon" }),
1830
+ /* @__PURE__ */ n(gn, { className: "pa-glass-btn-icon" }),
1826
1831
  /* @__PURE__ */ n("span", { children: "Reset" })
1827
1832
  ] })
1828
1833
  }
@@ -1833,16 +1838,16 @@ All instances: ${M}`,
1833
1838
  "span",
1834
1839
  {
1835
1840
  className: l ? /fail/i.test(l) ? "pa-change-count pa-change-count--error" : "pa-change-count pa-change-count--success" : "pa-change-count",
1836
- children: l ?? `${x} pending change${x !== 1 ? "s" : ""}`
1841
+ children: l ?? `${N} pending change${N !== 1 ? "s" : ""}`
1837
1842
  }
1838
1843
  ),
1839
1844
  /* @__PURE__ */ n(
1840
- V,
1845
+ H,
1841
1846
  {
1842
1847
  variant: "glass-primary",
1843
- onClick: he,
1844
- disabled: x === 0,
1845
- title: F != null && F.sourceFile ? void 0 : "No source file — Apply copies selector + changes to clipboard",
1848
+ onClick: re,
1849
+ disabled: N === 0,
1850
+ title: V != null && V.sourceFile ? void 0 : "No source file — Apply copies selector + changes to clipboard",
1846
1851
  children: "Apply"
1847
1852
  }
1848
1853
  )
@@ -1854,7 +1859,7 @@ All instances: ${M}`,
1854
1859
  )
1855
1860
  ] });
1856
1861
  }
1857
- async function Gn(e, t = {}) {
1862
+ async function Jn(e, t = {}) {
1858
1863
  if (t.onApply)
1859
1864
  try {
1860
1865
  const r = await t.onApply(e);
@@ -1874,11 +1879,11 @@ async function Gn(e, t = {}) {
1874
1879
  } catch (r) {
1875
1880
  return { mode: "error", message: r instanceof Error ? r.message : String(r) };
1876
1881
  }
1877
- return await Nt(JSON.stringify(e, null, 2)), { mode: "clipboard" };
1882
+ return await St(JSON.stringify(e, null, 2)), { mode: "clipboard" };
1878
1883
  }
1879
- function Kn(e) {
1880
- const [t, i] = A(null);
1881
- return H(() => {
1884
+ function Zn(e) {
1885
+ const [t, i] = S(null);
1886
+ return _(() => {
1882
1887
  if (!e) {
1883
1888
  i(null);
1884
1889
  return;
@@ -1891,8 +1896,8 @@ function Kn(e) {
1891
1896
  };
1892
1897
  }, [e]), t;
1893
1898
  }
1894
- const ie = 8, j = 8, jn = 12, qn = 300, Jn = 280;
1895
- function ze(e, t, i, r) {
1899
+ const ae = 8, Q = 8, Qn = 12, er = 300, tr = 280;
1900
+ function He(e, t, i, r) {
1896
1901
  return {
1897
1902
  top: e,
1898
1903
  left: t,
@@ -1902,10 +1907,10 @@ function ze(e, t, i, r) {
1902
1907
  height: r
1903
1908
  };
1904
1909
  }
1905
- function Ve(e, t) {
1910
+ function Ye(e, t) {
1906
1911
  return e.left < t.right && e.right > t.left && e.top < t.bottom && e.bottom > t.top;
1907
1912
  }
1908
- function Zn(e, t) {
1913
+ function nr(e, t) {
1909
1914
  return {
1910
1915
  top: e.top - t,
1911
1916
  left: e.left - t,
@@ -1915,105 +1920,105 @@ function Zn(e, t) {
1915
1920
  height: e.height + t * 2
1916
1921
  };
1917
1922
  }
1918
- function Qn() {
1923
+ function rr() {
1919
1924
  if (typeof document > "u") return null;
1920
1925
  const e = document.querySelector(
1921
1926
  "[data-pixelagent-toolbar-portal] .pa-toolbar-float"
1922
1927
  );
1923
- return e ? Zn(e.getBoundingClientRect(), jn) : null;
1928
+ return e ? nr(e.getBoundingClientRect(), Qn) : null;
1924
1929
  }
1925
- function He(e, t) {
1930
+ function Ve(e, t) {
1926
1931
  return Math.min(
1927
- Math.max(ie, e),
1928
- window.innerWidth - t - ie
1932
+ Math.max(ae, e),
1933
+ window.innerWidth - t - ae
1929
1934
  );
1930
1935
  }
1931
- function Se(e, t) {
1936
+ function Le(e, t) {
1932
1937
  return Math.min(
1933
- Math.max(ie, e),
1934
- window.innerHeight - t - ie
1938
+ Math.max(ae, e),
1939
+ window.innerHeight - t - ae
1935
1940
  );
1936
1941
  }
1937
- function er(e) {
1938
- return e.top >= ie && e.left >= ie && e.right <= window.innerWidth - ie && e.bottom <= window.innerHeight - ie;
1942
+ function ir(e) {
1943
+ return e.top >= ae && e.left >= ae && e.right <= window.innerWidth - ae && e.bottom <= window.innerHeight - ae;
1939
1944
  }
1940
- function tr(e, t) {
1941
- return t && Ve(e, t) ? !1 : er(e);
1945
+ function ar(e, t) {
1946
+ return t && Ye(e, t) ? !1 : ir(e);
1942
1947
  }
1943
- function nr(e, t = qn, i = Jn) {
1944
- const r = Qn(), o = e.top > window.innerHeight * 0.45 ? [
1945
- { placement: "above", top: e.top - i - j, left: e.left },
1946
- { placement: "below", top: e.bottom + j, left: e.left },
1947
- { placement: "right", top: e.top, left: e.right + j },
1948
- { placement: "left", top: e.top, left: e.left - t - j }
1948
+ function or(e, t = er, i = tr) {
1949
+ const r = rr(), s = e.top > window.innerHeight * 0.45 ? [
1950
+ { placement: "above", top: e.top - i - Q, left: e.left },
1951
+ { placement: "below", top: e.bottom + Q, left: e.left },
1952
+ { placement: "right", top: e.top, left: e.right + Q },
1953
+ { placement: "left", top: e.top, left: e.left - t - Q }
1949
1954
  ] : [
1950
- { placement: "below", top: e.bottom + j, left: e.left },
1951
- { placement: "above", top: e.top - i - j, left: e.left },
1952
- { placement: "right", top: e.top, left: e.right + j },
1953
- { placement: "left", top: e.top, left: e.left - t - j }
1955
+ { placement: "below", top: e.bottom + Q, left: e.left },
1956
+ { placement: "above", top: e.top - i - Q, left: e.left },
1957
+ { placement: "right", top: e.top, left: e.right + Q },
1958
+ { placement: "left", top: e.top, left: e.left - t - Q }
1954
1959
  ];
1955
- for (const { top: c, left: l } of o) {
1956
- const p = ze(
1957
- Se(c, i),
1958
- He(l, t),
1960
+ for (const { top: u, left: l } of s) {
1961
+ const f = He(
1962
+ Le(u, i),
1963
+ Ve(l, t),
1959
1964
  t,
1960
1965
  i
1961
1966
  );
1962
- if (tr(p, r))
1963
- return { top: p.top, left: p.left };
1967
+ if (ar(f, r))
1968
+ return { top: f.top, left: f.left };
1964
1969
  }
1965
- let s = Se(e.top - i - j, i), u = He(e.left, t);
1970
+ let o = Le(e.top - i - Q, i), c = Ve(e.left, t);
1966
1971
  if (r) {
1967
- let c = ze(s, u, t, i);
1968
- Ve(c, r) && (s = Se(r.top - i - j, i), c = ze(s, u, t, i)), Ve(c, r) && (s = Se(e.bottom + j, i), u = He(
1969
- Math.min(e.left, r.left - t - j),
1972
+ let u = He(o, c, t, i);
1973
+ Ye(u, r) && (o = Le(r.top - i - Q, i), u = He(o, c, t, i)), Ye(u, r) && (o = Le(e.bottom + Q, i), c = Ve(
1974
+ Math.min(e.left, r.left - t - Q),
1970
1975
  t
1971
1976
  ));
1972
1977
  }
1973
- return { top: s, left: u };
1978
+ return { top: o, left: c };
1974
1979
  }
1975
- function rr({
1980
+ function sr({
1976
1981
  elements: e,
1977
1982
  areaBbox: t,
1978
1983
  onSubmit: i,
1979
1984
  onCancel: r
1980
1985
  }) {
1981
- const [a, o] = A(""), s = W(null), u = W(null), c = e[0] ?? null, l = t ? new DOMRect(t.x, t.y, t.width, t.height) : null, p = Kn(c), f = l ?? p, v = kt(), g = c ? ue(c) : { kind: "none", value: "" }, m = g.kind !== "none" ? g.value : void 0;
1982
- if (H(() => {
1986
+ const [a, s] = S(""), o = Y(null), c = Y(null), u = e[0] ?? null, l = t ? new DOMRect(t.x, t.y, t.width, t.height) : null, f = Zn(u), p = l ?? f, v = Lt(), m = u ? fe(u) : { kind: "none", value: "" }, g = m.kind !== "none" ? m.value : void 0;
1987
+ if (_(() => {
1983
1988
  var w;
1984
- (w = s.current) == null || w.focus();
1985
- }, [e]), H(() => {
1986
- const w = (N) => {
1987
- N.key === "Escape" && r();
1989
+ (w = o.current) == null || w.focus();
1990
+ }, [e]), _(() => {
1991
+ const w = (k) => {
1992
+ k.key === "Escape" && r();
1988
1993
  };
1989
1994
  return document.addEventListener("keydown", w), () => document.removeEventListener("keydown", w);
1990
- }, [r]), !f) return null;
1991
- const y = nr(f), E = e.length > 1 ? `${e.length} selected` : c ? Ue(c) : "Area selection", x = (w) => {
1995
+ }, [r]), !p) return null;
1996
+ const b = or(p), E = e.length > 1 ? `${e.length} selected` : u ? Xe(u) : "Area selection", N = (w) => {
1992
1997
  a.trim() && i(a, w);
1993
1998
  };
1994
1999
  return /* @__PURE__ */ n(
1995
2000
  Te,
1996
2001
  {
1997
2002
  variant: "popover",
1998
- style: { top: y.top, left: y.left },
2003
+ style: { top: b.top, left: b.left },
1999
2004
  children: /* @__PURE__ */ d(
2000
2005
  "div",
2001
2006
  {
2002
- ref: u,
2007
+ ref: c,
2003
2008
  role: "dialog",
2004
2009
  "aria-modal": "true",
2005
2010
  "aria-label": "Add annotation",
2006
2011
  className: "pa-popover-body",
2007
2012
  children: [
2008
2013
  /* @__PURE__ */ n("div", { className: "pa-popover-header", children: /* @__PURE__ */ n("span", { className: "pa-popover-selector", children: E }) }),
2009
- (v || m) && /* @__PURE__ */ d("div", { className: "pa-popover-context", children: [
2014
+ (v || g) && /* @__PURE__ */ d("div", { className: "pa-popover-context", children: [
2010
2015
  v && /* @__PURE__ */ d("p", { className: "pa-popover-context-line", children: [
2011
2016
  /* @__PURE__ */ n("span", { className: "pa-popover-context-label", children: "Selected" }),
2012
2017
  v
2013
2018
  ] }),
2014
- m && m !== v && /* @__PURE__ */ d("p", { className: "pa-popover-context-line", children: [
2019
+ g && g !== v && /* @__PURE__ */ d("p", { className: "pa-popover-context-line", children: [
2015
2020
  /* @__PURE__ */ n("span", { className: "pa-popover-context-label", children: "Element" }),
2016
- m
2021
+ g
2017
2022
  ] })
2018
2023
  ] }),
2019
2024
  /* @__PURE__ */ d("label", { className: "pa-label", children: [
@@ -2021,35 +2026,35 @@ function rr({
2021
2026
  /* @__PURE__ */ n(
2022
2027
  "textarea",
2023
2028
  {
2024
- ref: s,
2029
+ ref: o,
2025
2030
  className: "pa-textarea",
2026
2031
  value: a,
2027
- onChange: (w) => o(w.target.value),
2032
+ onChange: (w) => s(w.target.value),
2028
2033
  placeholder: "Describe the change...",
2029
2034
  rows: 3,
2030
2035
  onKeyDown: (w) => {
2031
- w.key === "Enter" && (w.metaKey || w.ctrlKey) && (w.preventDefault(), x(w.shiftKey)), w.key === "Escape" && r();
2036
+ w.key === "Enter" && (w.metaKey || w.ctrlKey) && (w.preventDefault(), N(w.shiftKey)), w.key === "Escape" && r();
2032
2037
  }
2033
2038
  }
2034
2039
  )
2035
2040
  ] }),
2036
2041
  /* @__PURE__ */ n("p", { className: "pa-popover-hint", children: "⌘↵ Add · ⇧⌘↵ Add & next · Esc Cancel" }),
2037
2042
  /* @__PURE__ */ d("div", { className: "pa-popover-actions", children: [
2038
- /* @__PURE__ */ n(V, { variant: "ghost", onClick: r, children: "Cancel" }),
2043
+ /* @__PURE__ */ n(H, { variant: "ghost", onClick: r, children: "Cancel" }),
2039
2044
  /* @__PURE__ */ n(
2040
- V,
2045
+ H,
2041
2046
  {
2042
2047
  variant: "ghost",
2043
- onClick: () => x(!0),
2048
+ onClick: () => N(!0),
2044
2049
  disabled: !a.trim(),
2045
2050
  children: "Add & next"
2046
2051
  }
2047
2052
  ),
2048
2053
  /* @__PURE__ */ n(
2049
- V,
2054
+ H,
2050
2055
  {
2051
2056
  variant: "glass-primary",
2052
- onClick: () => x(!1),
2057
+ onClick: () => N(!1),
2053
2058
  disabled: !a.trim(),
2054
2059
  children: "Add"
2055
2060
  }
@@ -2061,7 +2066,7 @@ function rr({
2061
2066
  }
2062
2067
  );
2063
2068
  }
2064
- function ir({ area: e, isDragging: t }) {
2069
+ function lr({ area: e, isDragging: t }) {
2065
2070
  return !e || e.width < 2 || e.height < 2 ? null : /* @__PURE__ */ n(
2066
2071
  "div",
2067
2072
  {
@@ -2076,7 +2081,7 @@ function ir({ area: e, isDragging: t }) {
2076
2081
  }
2077
2082
  );
2078
2083
  }
2079
- function ar(e) {
2084
+ function cr(e) {
2080
2085
  const { elements: t, note: i, areaBbox: r } = e, a = t[0];
2081
2086
  if (!a && r)
2082
2087
  return {
@@ -2095,39 +2100,39 @@ function ar(e) {
2095
2100
  };
2096
2101
  if (!a)
2097
2102
  throw new Error("buildAnnotationEntry requires at least one element or areaBbox");
2098
- const o = a.getBoundingClientRect(), s = We(a), u = kt(), c = ue(a), l = c.kind !== "none" ? c.value : void 0, p = t.map((f) => xt(f));
2103
+ const s = a.getBoundingClientRect(), o = Ge(a), c = Lt(), u = fe(a), l = u.kind !== "none" ? u.value : void 0, f = t.map((p) => At(p));
2099
2104
  return {
2100
2105
  id: crypto.randomUUID(),
2101
- selector: p[0],
2102
- selectors: p.length > 1 ? p : void 0,
2106
+ selector: f[0],
2107
+ selectors: f.length > 1 ? f : void 0,
2103
2108
  note: i.trim(),
2104
- position: { x: Math.round(o.x), y: Math.round(o.y) },
2109
+ position: { x: Math.round(s.x), y: Math.round(s.y) },
2105
2110
  bbox: {
2106
- x: Math.round(o.x),
2107
- y: Math.round(o.y),
2108
- width: Math.round(o.width),
2109
- height: Math.round(o.height)
2111
+ x: Math.round(s.x),
2112
+ y: Math.round(s.y),
2113
+ width: Math.round(s.width),
2114
+ height: Math.round(s.height)
2110
2115
  },
2111
2116
  areaBbox: r,
2112
- domPath: Gt(a),
2113
- selectedText: u,
2117
+ domPath: Jt(a),
2118
+ selectedText: c,
2114
2119
  elementText: l,
2115
- sourceFile: s.sourceFile,
2116
- lineNumber: s.lineNumber,
2117
- componentName: Xt(a) ?? s.componentName,
2120
+ sourceFile: o.sourceFile,
2121
+ lineNumber: o.lineNumber,
2122
+ componentName: qt(a) ?? o.componentName,
2118
2123
  createdAt: Date.now()
2119
2124
  };
2120
2125
  }
2121
- function or(e) {
2122
- const t = Ct(e);
2126
+ function dr(e) {
2127
+ const t = Et(e);
2123
2128
  if (t) return t.getBoundingClientRect();
2124
2129
  if (e.bbox) {
2125
- const { x: i, y: r, width: a, height: o } = e.bbox;
2126
- return new DOMRect(i, r, a, o);
2130
+ const { x: i, y: r, width: a, height: s } = e.bbox;
2131
+ return new DOMRect(i, r, a, s);
2127
2132
  }
2128
2133
  if (e.areaBbox) {
2129
- const { x: i, y: r, width: a, height: o } = e.areaBbox;
2130
- return new DOMRect(i, r, a, o);
2134
+ const { x: i, y: r, width: a, height: s } = e.areaBbox;
2135
+ return new DOMRect(i, r, a, s);
2131
2136
  }
2132
2137
  if (e.position) {
2133
2138
  const { x: i, y: r } = e.position;
@@ -2135,46 +2140,46 @@ function or(e) {
2135
2140
  }
2136
2141
  return null;
2137
2142
  }
2138
- function sr(e) {
2143
+ function ur(e) {
2139
2144
  return `${Math.round(e.top)}:${Math.round(e.left)}:${Math.round(e.width)}:${Math.round(e.height)}`;
2140
2145
  }
2141
- const lr = 20;
2142
- function cr({ annotations: e }) {
2143
- const [t, i] = A([]);
2144
- return H(() => {
2146
+ const pr = 20;
2147
+ function hr({ annotations: e }) {
2148
+ const [t, i] = S([]);
2149
+ return _(() => {
2145
2150
  if (e.length === 0) {
2146
2151
  i([]);
2147
2152
  return;
2148
2153
  }
2149
2154
  const r = /* @__PURE__ */ new Map(), a = () => {
2150
- const u = [];
2151
- e.forEach((c, l) => {
2152
- const p = or(c);
2153
- if (!p) return;
2154
- const f = sr(p), v = r.get(f) ?? 0;
2155
- r.set(f, v + 1), u.push({
2156
- id: c.id,
2155
+ const c = [];
2156
+ e.forEach((u, l) => {
2157
+ const f = dr(u);
2158
+ if (!f) return;
2159
+ const p = ur(f), v = r.get(p) ?? 0;
2160
+ r.set(p, v + 1), c.push({
2161
+ id: u.id,
2157
2162
  index: l + 1,
2158
- top: p.top - 6 - v * lr,
2159
- left: p.right - 6
2163
+ top: f.top - 6 - v * pr,
2164
+ left: f.right - 6
2160
2165
  });
2161
- }), i(u);
2166
+ }), i(c);
2162
2167
  };
2163
2168
  a();
2164
- const o = /* @__PURE__ */ new Set();
2165
- for (const u of e) {
2166
- const c = Ct(u);
2167
- c && o.add(c);
2169
+ const s = /* @__PURE__ */ new Set();
2170
+ for (const c of e) {
2171
+ const u = Et(c);
2172
+ u && s.add(u);
2168
2173
  }
2169
- const s = Array.from(o).map((u) => {
2170
- const c = new ResizeObserver(a);
2171
- return c.observe(u), c;
2174
+ const o = Array.from(s).map((c) => {
2175
+ const u = new ResizeObserver(a);
2176
+ return u.observe(c), u;
2172
2177
  });
2173
2178
  return window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), () => {
2174
- for (const u of s) u.disconnect();
2179
+ for (const c of o) c.disconnect();
2175
2180
  window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
2176
2181
  };
2177
- }, [e]), t.length === 0 ? null : /* @__PURE__ */ n(G, { children: t.map((r) => /* @__PURE__ */ n(
2182
+ }, [e]), t.length === 0 ? null : /* @__PURE__ */ n(K, { children: t.map((r) => /* @__PURE__ */ n(
2178
2183
  "span",
2179
2184
  {
2180
2185
  className: "pa-annotation-badge",
@@ -2185,24 +2190,24 @@ function cr({ annotations: e }) {
2185
2190
  r.id
2186
2191
  )) });
2187
2192
  }
2188
- const je = "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]";
2189
- function Le(e) {
2190
- return e instanceof Element ? !!e.closest(je) : !1;
2193
+ const Ze = "[data-pixelagent-root],[data-pixelagent-toolbar-portal],[data-pixelagent-picker-portal]";
2194
+ function Ee(e) {
2195
+ return e instanceof Element ? !!e.closest(Ze) : !1;
2191
2196
  }
2192
- function ft(e, t) {
2197
+ function vt(e, t) {
2193
2198
  return document.elementsFromPoint(e, t).find(
2194
- (r) => r instanceof Element && !r.closest(je)
2199
+ (r) => r instanceof Element && !r.closest(Ze)
2195
2200
  ) ?? null;
2196
2201
  }
2197
- function Dt(e) {
2202
+ function _t(e) {
2198
2203
  return e ? e === "Copied all!" || e.startsWith("Copy failed") : !1;
2199
2204
  }
2200
- function Ot({
2205
+ function Ht({
2201
2206
  feedback: e,
2202
2207
  slotClassName: t,
2203
2208
  children: i
2204
2209
  }) {
2205
- return e && Dt(e) ? /* @__PURE__ */ n(
2210
+ return e && _t(e) ? /* @__PURE__ */ n(
2206
2211
  "span",
2207
2212
  {
2208
2213
  className: `pa-status pa-copy-feedback-slot ${t}`,
@@ -2210,32 +2215,32 @@ function Ot({
2210
2215
  "aria-live": "polite",
2211
2216
  children: e
2212
2217
  }
2213
- ) : /* @__PURE__ */ n(G, { children: i });
2218
+ ) : /* @__PURE__ */ n(K, { children: i });
2214
2219
  }
2215
- function dr({
2220
+ function fr({
2216
2221
  annotations: e,
2217
2222
  collapsed: t,
2218
2223
  onToggleCollapsed: i,
2219
2224
  onClose: r,
2220
2225
  onCopyAll: a,
2221
- onCopyOne: o,
2222
- onRemove: s,
2223
- onUpdate: u,
2224
- copyStatus: c,
2226
+ onCopyOne: s,
2227
+ onRemove: o,
2228
+ onUpdate: c,
2229
+ copyStatus: u,
2225
2230
  copiedEntryId: l,
2226
- copyAllFrom: p
2231
+ copyAllFrom: f
2227
2232
  }) {
2228
- const [f, v] = A(null), [g, m] = A("");
2229
- H(() => {
2230
- const x = (w) => {
2233
+ const [p, v] = S(null), [m, g] = S("");
2234
+ _(() => {
2235
+ const N = (w) => {
2231
2236
  w.key === "Escape" && (t ? r() : i());
2232
2237
  };
2233
- return document.addEventListener("keydown", x), () => document.removeEventListener("keydown", x);
2238
+ return document.addEventListener("keydown", N), () => document.removeEventListener("keydown", N);
2234
2239
  }, [t, r, i]);
2235
- const y = (x) => {
2236
- v(x.id), m(x.note);
2237
- }, E = (x) => {
2238
- g.trim() && (u(x, { note: g.trim() }), v(null));
2240
+ const b = (N) => {
2241
+ v(N.id), g(N.note);
2242
+ }, E = (N) => {
2243
+ m.trim() && (c(N, { note: m.trim() }), v(null));
2239
2244
  };
2240
2245
  return /* @__PURE__ */ d(
2241
2246
  Te,
@@ -2247,7 +2252,7 @@ function dr({
2247
2252
  /* @__PURE__ */ d("div", { className: "pa-session-header", children: [
2248
2253
  /* @__PURE__ */ d("div", { className: "pa-session-header-main", children: [
2249
2254
  /* @__PURE__ */ n(
2250
- V,
2255
+ H,
2251
2256
  {
2252
2257
  variant: "ghost",
2253
2258
  className: "pa-glass-btn--sm pa-session-collapse-btn",
@@ -2266,12 +2271,12 @@ function dr({
2266
2271
  !t && /* @__PURE__ */ n("p", { className: "pa-session-subtitle", children: "Persists until tab close" }),
2267
2272
  /* @__PURE__ */ d("div", { className: "pa-session-actions", children: [
2268
2273
  /* @__PURE__ */ n(
2269
- Ot,
2274
+ Ht,
2270
2275
  {
2271
- feedback: p === "session" ? c : null,
2276
+ feedback: f === "session" ? u : null,
2272
2277
  slotClassName: "pa-copy-feedback-slot--session",
2273
2278
  children: /* @__PURE__ */ n(
2274
- V,
2279
+ H,
2275
2280
  {
2276
2281
  variant: "glass-primary",
2277
2282
  className: "pa-glass-btn--sm",
@@ -2282,46 +2287,46 @@ function dr({
2282
2287
  )
2283
2288
  }
2284
2289
  ),
2285
- /* @__PURE__ */ n(V, { variant: "ghost", onClick: r, "aria-label": "Close session panel", children: "✕" })
2290
+ /* @__PURE__ */ n(H, { variant: "ghost", onClick: r, "aria-label": "Close session panel", children: "✕" })
2286
2291
  ] })
2287
2292
  ] }),
2288
2293
  !t && /* @__PURE__ */ d("ul", { className: "pa-session-list", children: [
2289
2294
  e.length === 0 && /* @__PURE__ */ n("li", { className: "pa-session-empty", children: "No annotations yet. Click an element, drag an area, or Shift+click for multi-select." }),
2290
- e.map((x) => {
2291
- const w = Kt(x);
2292
- return /* @__PURE__ */ n("li", { className: "pa-session-item", children: f === x.id ? /* @__PURE__ */ d("div", { className: "pa-session-edit", children: [
2295
+ e.map((N) => {
2296
+ const w = Zt(N);
2297
+ return /* @__PURE__ */ n("li", { className: "pa-session-item", children: p === N.id ? /* @__PURE__ */ d("div", { className: "pa-session-edit", children: [
2293
2298
  /* @__PURE__ */ d("label", { className: "pa-label", children: [
2294
2299
  "Note",
2295
2300
  /* @__PURE__ */ n(
2296
2301
  "textarea",
2297
2302
  {
2298
2303
  className: "pa-textarea",
2299
- value: g,
2300
- onChange: (N) => m(N.target.value),
2304
+ value: m,
2305
+ onChange: (k) => g(k.target.value),
2301
2306
  rows: 3
2302
2307
  }
2303
2308
  )
2304
2309
  ] }),
2305
2310
  /* @__PURE__ */ d("div", { className: "pa-session-item-actions", children: [
2306
- /* @__PURE__ */ n(V, { variant: "ghost", onClick: () => v(null), children: "Cancel" }),
2311
+ /* @__PURE__ */ n(H, { variant: "ghost", onClick: () => v(null), children: "Cancel" }),
2307
2312
  /* @__PURE__ */ n(
2308
- V,
2313
+ H,
2309
2314
  {
2310
2315
  variant: "glass-primary",
2311
- onClick: () => E(x.id),
2312
- disabled: !g.trim(),
2316
+ onClick: () => E(N.id),
2317
+ disabled: !m.trim(),
2313
2318
  children: "Save"
2314
2319
  }
2315
2320
  )
2316
2321
  ] })
2317
- ] }) : /* @__PURE__ */ d(G, { children: [
2322
+ ] }) : /* @__PURE__ */ d(K, { children: [
2318
2323
  /* @__PURE__ */ d("div", { className: "pa-session-content", children: [
2319
2324
  /* @__PURE__ */ n("span", { className: "pa-session-target", children: w.target }),
2320
2325
  /* @__PURE__ */ n("p", { className: "pa-session-note", children: w.note }),
2321
2326
  w.meta && /* @__PURE__ */ n("p", { className: "pa-session-meta-line", children: w.meta })
2322
2327
  ] }),
2323
2328
  /* @__PURE__ */ d("div", { className: "pa-session-item-actions", children: [
2324
- c === "Copied!" && l === x.id ? /* @__PURE__ */ n(
2329
+ u === "Copied!" && l === N.id ? /* @__PURE__ */ n(
2325
2330
  "span",
2326
2331
  {
2327
2332
  className: "pa-status pa-copy-feedback-slot pa-copy-feedback-slot--item",
@@ -2330,44 +2335,44 @@ function dr({
2330
2335
  children: "Copied!"
2331
2336
  }
2332
2337
  ) : /* @__PURE__ */ n(
2333
- V,
2338
+ H,
2334
2339
  {
2335
2340
  variant: "glass-primary",
2336
2341
  className: "pa-glass-btn--sm",
2337
- onClick: () => o(x.id),
2342
+ onClick: () => s(N.id),
2338
2343
  "aria-label": "Copy annotation",
2339
2344
  children: "Copy"
2340
2345
  }
2341
2346
  ),
2342
2347
  /* @__PURE__ */ n(
2343
- V,
2348
+ H,
2344
2349
  {
2345
2350
  variant: "ghost",
2346
2351
  className: "pa-glass-btn--sm",
2347
- onClick: () => y(x),
2352
+ onClick: () => b(N),
2348
2353
  "aria-label": "Edit annotation note",
2349
2354
  children: "✎"
2350
2355
  }
2351
2356
  ),
2352
2357
  /* @__PURE__ */ n(
2353
- V,
2358
+ H,
2354
2359
  {
2355
2360
  variant: "ghost",
2356
2361
  className: "pa-glass-btn--sm",
2357
- onClick: () => s(x.id),
2362
+ onClick: () => o(N.id),
2358
2363
  "aria-label": "Remove annotation",
2359
2364
  children: "✕"
2360
2365
  }
2361
2366
  )
2362
2367
  ] })
2363
- ] }) }, x.id);
2368
+ ] }) }, N.id);
2364
2369
  })
2365
2370
  ] })
2366
2371
  ]
2367
2372
  }
2368
2373
  );
2369
2374
  }
2370
- function ur() {
2375
+ function mr() {
2371
2376
  return /* @__PURE__ */ d("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
2372
2377
  /* @__PURE__ */ n(
2373
2378
  "path",
@@ -2388,7 +2393,7 @@ function ur() {
2388
2393
  )
2389
2394
  ] });
2390
2395
  }
2391
- function pr() {
2396
+ function gr() {
2392
2397
  return /* @__PURE__ */ d("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
2393
2398
  /* @__PURE__ */ n("circle", { cx: "8", cy: "8", r: "2.75", stroke: "currentColor", strokeWidth: "1.25" }),
2394
2399
  /* @__PURE__ */ n(
@@ -2402,7 +2407,7 @@ function pr() {
2402
2407
  )
2403
2408
  ] });
2404
2409
  }
2405
- function hr() {
2410
+ function vr() {
2406
2411
  return /* @__PURE__ */ n("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ n(
2407
2412
  "path",
2408
2413
  {
@@ -2413,27 +2418,27 @@ function hr() {
2413
2418
  }
2414
2419
  ) });
2415
2420
  }
2416
- function fr({
2421
+ function br({
2417
2422
  open: e,
2418
2423
  onClose: t,
2419
2424
  hostTheme: i,
2420
2425
  chrome: r,
2421
2426
  onToggleHostTheme: a
2422
2427
  }) {
2423
- const o = W(null);
2424
- return H(() => {
2428
+ const s = Y(null);
2429
+ return _(() => {
2425
2430
  if (!e) return;
2426
- const s = (c) => {
2427
- c.key === "Escape" && t();
2428
- }, u = (c) => {
2429
- var p, f;
2430
- const l = c.target;
2431
- (p = o.current) != null && p.contains(l) || (f = l.closest) != null && f.call(l, "[data-pa-settings-trigger]") || t();
2431
+ const o = (u) => {
2432
+ u.key === "Escape" && t();
2433
+ }, c = (u) => {
2434
+ var f, p;
2435
+ const l = u.target;
2436
+ (f = s.current) != null && f.contains(l) || (p = l.closest) != null && p.call(l, "[data-pa-settings-trigger]") || t();
2432
2437
  };
2433
- return window.addEventListener("keydown", s), window.addEventListener("mousedown", u), () => {
2434
- window.removeEventListener("keydown", s), window.removeEventListener("mousedown", u);
2438
+ return window.addEventListener("keydown", o), window.addEventListener("mousedown", c), () => {
2439
+ window.removeEventListener("keydown", o), window.removeEventListener("mousedown", c);
2435
2440
  };
2436
- }, [e, t]), e ? /* @__PURE__ */ n("div", { ref: o, className: "pa-settings-menu", role: "dialog", "aria-label": "PixelAgent settings", children: /* @__PURE__ */ n(Te, { variant: "popover", className: "pa-settings-menu-panel", children: /* @__PURE__ */ d("div", { className: "pa-settings-menu-inner", children: [
2441
+ }, [e, t]), e ? /* @__PURE__ */ n("div", { ref: s, className: "pa-settings-menu", role: "dialog", "aria-label": "PixelAgent settings", children: /* @__PURE__ */ n(Te, { variant: "popover", className: "pa-settings-menu-panel", children: /* @__PURE__ */ d("div", { className: "pa-settings-menu-inner", children: [
2437
2442
  /* @__PURE__ */ d("header", { className: "pa-settings-menu-header", children: [
2438
2443
  /* @__PURE__ */ n("h4", { className: "pa-settings-menu-title", children: "Settings" }),
2439
2444
  /* @__PURE__ */ n("p", { className: "pa-settings-menu-subtitle", children: "Appearance and chrome" })
@@ -2443,13 +2448,13 @@ function fr({
2443
2448
  /* @__PURE__ */ d("div", { className: "pa-settings-row", children: [
2444
2449
  /* @__PURE__ */ n("span", { className: "pa-settings-row-value", children: i === "dark" ? "Dark canvas" : "Light canvas" }),
2445
2450
  /* @__PURE__ */ n(
2446
- V,
2451
+ H,
2447
2452
  {
2448
2453
  variant: "icon",
2449
2454
  onClick: a,
2450
2455
  "aria-label": i === "dark" ? "Switch host to light theme" : "Switch host to dark theme",
2451
2456
  title: i === "dark" ? "Light theme" : "Dark theme",
2452
- children: i === "dark" ? /* @__PURE__ */ n(pr, {}) : /* @__PURE__ */ n(hr, {})
2457
+ children: i === "dark" ? /* @__PURE__ */ n(gr, {}) : /* @__PURE__ */ n(vr, {})
2453
2458
  }
2454
2459
  )
2455
2460
  ] })
@@ -2464,29 +2469,29 @@ function fr({
2464
2469
  ] })
2465
2470
  ] }) }) }) : null;
2466
2471
  }
2467
- const mt = "0 0 24 24";
2468
- function mr() {
2469
- return /* @__PURE__ */ d(G, { children: [
2472
+ const bt = "0 0 24 24";
2473
+ function yr() {
2474
+ return /* @__PURE__ */ d(K, { children: [
2470
2475
  /* @__PURE__ */ n("rect", { x: "3", y: "14", width: "4", height: "4", fill: "currentColor" }),
2471
2476
  /* @__PURE__ */ n("path", { fill: "currentColor", d: "M7 5h12v12L7 5z" })
2472
2477
  ] });
2473
2478
  }
2474
- const gr = "M4.5 2.5L4.5 17.25L9.1 12.9L11.35 19.15L13.55 17.95L11.05 11.85L16.85 11.85L4.5 2.5Z";
2475
- function vr({ size: e = 22, variant: t = "cursor" }) {
2479
+ const wr = "M4.5 2.5L4.5 17.25L9.1 12.9L11.35 19.15L13.55 17.95L11.05 11.85L16.85 11.85L4.5 2.5Z";
2480
+ function xr({ size: e = 22, variant: t = "cursor" }) {
2476
2481
  return t === "pointer" ? /* @__PURE__ */ n(
2477
2482
  "svg",
2478
2483
  {
2479
2484
  className: "pa-brand-cursor pa-brand-cursor--pointer",
2480
2485
  width: e,
2481
2486
  height: e,
2482
- viewBox: mt,
2487
+ viewBox: bt,
2483
2488
  xmlns: "http://www.w3.org/2000/svg",
2484
2489
  "aria-hidden": "true",
2485
2490
  children: /* @__PURE__ */ n(
2486
2491
  "path",
2487
2492
  {
2488
2493
  fill: "currentColor",
2489
- d: gr
2494
+ d: wr
2490
2495
  }
2491
2496
  )
2492
2497
  }
@@ -2496,60 +2501,60 @@ function vr({ size: e = 22, variant: t = "cursor" }) {
2496
2501
  className: "pa-brand-cursor pa-brand-cursor--minimal",
2497
2502
  width: e,
2498
2503
  height: e,
2499
- viewBox: mt,
2504
+ viewBox: bt,
2500
2505
  xmlns: "http://www.w3.org/2000/svg",
2501
2506
  "aria-hidden": "true",
2502
- children: /* @__PURE__ */ n(mr, {})
2507
+ children: /* @__PURE__ */ n(yr, {})
2503
2508
  }
2504
2509
  );
2505
2510
  }
2506
- const br = ["element", "area", "multi"], yr = {
2511
+ const Nr = ["element", "area", "multi"], kr = {
2507
2512
  element: "Click",
2508
2513
  area: "Area",
2509
2514
  multi: "Multi"
2510
2515
  };
2511
- function wr({
2516
+ function Cr({
2512
2517
  rootAttributes: e,
2513
2518
  hostTheme: t,
2514
2519
  chrome: i,
2515
2520
  settingsOpen: r,
2516
2521
  onToggleSettings: a,
2517
- onCloseSettings: o,
2518
- onToggleHostTheme: s,
2519
- active: u,
2520
- mode: c,
2522
+ onCloseSettings: s,
2523
+ onToggleHostTheme: o,
2524
+ active: c,
2525
+ mode: u,
2521
2526
  captureMode: l,
2522
- annotationCount: p,
2523
- multiSelectCount: f,
2527
+ annotationCount: f,
2528
+ multiSelectCount: p,
2524
2529
  copyStatus: v,
2525
- copyAllFrom: g,
2526
- onActivateAnnotate: m,
2527
- onActivateEdit: y,
2530
+ copyAllFrom: m,
2531
+ onActivateAnnotate: g,
2532
+ onActivateEdit: b,
2528
2533
  onDeactivate: E,
2529
- onCopyAll: x,
2534
+ onCopyAll: N,
2530
2535
  onCaptureModeChange: w,
2531
- onConfirmMultiSelect: N
2536
+ onConfirmMultiSelect: k
2532
2537
  }) {
2533
- const { elementRef: T, isDragging: P, style: $, dragHandleProps: k } = Lt(), I = /* @__PURE__ */ d(
2538
+ const { elementRef: I, isDragging: P, style: R, dragHandleProps: x } = Rt(), T = /* @__PURE__ */ d(
2534
2539
  "div",
2535
2540
  {
2536
- ref: T,
2541
+ ref: I,
2537
2542
  className: `pa-toolbar-float ${P ? "pa-toolbar-float--dragging" : ""}`,
2538
- style: $,
2543
+ style: R,
2539
2544
  role: "toolbar",
2540
2545
  "aria-label": "PixelAgent",
2541
2546
  children: [
2542
- !u && /* @__PURE__ */ n(
2543
- fr,
2547
+ !c && /* @__PURE__ */ n(
2548
+ br,
2544
2549
  {
2545
2550
  open: r,
2546
- onClose: o,
2551
+ onClose: s,
2547
2552
  hostTheme: t,
2548
2553
  chrome: i,
2549
- onToggleHostTheme: s
2554
+ onToggleHostTheme: o
2550
2555
  }
2551
2556
  ),
2552
- /* @__PURE__ */ n(St, { shape: "capsule", className: "pa-toolbar-glass", intensity: "enhanced", children: /* @__PURE__ */ d("div", { className: "pa-toolbar-inner", children: [
2557
+ /* @__PURE__ */ n(Tt, { shape: "capsule", className: "pa-toolbar-glass", intensity: "enhanced", children: /* @__PURE__ */ d("div", { className: "pa-toolbar-inner", children: [
2553
2558
  /* @__PURE__ */ n(
2554
2559
  "button",
2555
2560
  {
@@ -2557,15 +2562,15 @@ function wr({
2557
2562
  className: "pa-toolbar-drag",
2558
2563
  "aria-label": "Drag PixelAgent toolbar",
2559
2564
  title: "Drag to move",
2560
- ...k,
2561
- children: /* @__PURE__ */ n(vr, { size: 22 })
2565
+ ...x,
2566
+ children: /* @__PURE__ */ n(xr, { size: 22 })
2562
2567
  }
2563
2568
  ),
2564
2569
  /* @__PURE__ */ n("span", { className: "pa-toolbar-divider", "aria-hidden": "true" }),
2565
- u ? /* @__PURE__ */ d(G, { children: [
2570
+ c ? /* @__PURE__ */ d(K, { children: [
2566
2571
  /* @__PURE__ */ d("div", { className: "pa-toolbar-segment", children: [
2567
- /* @__PURE__ */ n("span", { className: "pa-mode-badge", children: c }),
2568
- c === "annotate" && /* @__PURE__ */ d(G, { children: [
2572
+ /* @__PURE__ */ n("span", { className: "pa-mode-badge", children: u }),
2573
+ u === "annotate" && /* @__PURE__ */ d(K, { children: [
2569
2574
  /* @__PURE__ */ n(
2570
2575
  "select",
2571
2576
  {
@@ -2573,31 +2578,31 @@ function wr({
2573
2578
  value: l,
2574
2579
  onChange: (C) => w(C.target.value),
2575
2580
  "aria-label": "Capture mode",
2576
- children: br.map((C) => /* @__PURE__ */ n("option", { value: C, children: yr[C] }, C))
2581
+ children: Nr.map((C) => /* @__PURE__ */ n("option", { value: C, children: kr[C] }, C))
2577
2582
  }
2578
2583
  ),
2579
- f > 0 && /* @__PURE__ */ n(
2580
- V,
2584
+ p > 0 && /* @__PURE__ */ n(
2585
+ H,
2581
2586
  {
2582
2587
  variant: "glass-primary",
2583
- onClick: N,
2588
+ onClick: k,
2584
2589
  "aria-label": "Annotate selected elements",
2585
- children: f
2590
+ children: p
2586
2591
  }
2587
2592
  ),
2588
2593
  /* @__PURE__ */ n(
2589
- Ot,
2594
+ Ht,
2590
2595
  {
2591
- feedback: g === "toolbar" ? v : null,
2596
+ feedback: m === "toolbar" ? v : null,
2592
2597
  slotClassName: "pa-copy-feedback-slot--toolbar",
2593
2598
  children: /* @__PURE__ */ n(
2594
- V,
2599
+ H,
2595
2600
  {
2596
2601
  variant: "glass-primary",
2597
- onClick: x,
2598
- disabled: p === 0,
2599
- "aria-label": p > 0 ? `Copy all annotations (${p})` : "Copy all annotations",
2600
- children: p > 0 ? `Copy (${p})` : "Copy"
2602
+ onClick: N,
2603
+ disabled: f === 0,
2604
+ "aria-label": f > 0 ? `Copy all annotations (${f})` : "Copy all annotations",
2605
+ children: f > 0 ? `Copy (${f})` : "Copy"
2601
2606
  }
2602
2607
  )
2603
2608
  }
@@ -2605,7 +2610,7 @@ function wr({
2605
2610
  ] })
2606
2611
  ] }),
2607
2612
  /* @__PURE__ */ n(
2608
- V,
2613
+ H,
2609
2614
  {
2610
2615
  variant: "icon",
2611
2616
  className: "pa-toolbar-close",
@@ -2633,13 +2638,13 @@ function wr({
2633
2638
  }
2634
2639
  )
2635
2640
  ] }) : /* @__PURE__ */ d("div", { className: "pa-toolbar-segment", children: [
2636
- /* @__PURE__ */ n(V, { onClick: m, children: "Annotate" }),
2637
- /* @__PURE__ */ n(V, { onClick: y, children: "Edit" })
2641
+ /* @__PURE__ */ n(H, { onClick: g, children: "Annotate" }),
2642
+ /* @__PURE__ */ n(H, { onClick: b, children: "Edit" })
2638
2643
  ] }),
2639
- !u && /* @__PURE__ */ d(G, { children: [
2644
+ !c && /* @__PURE__ */ d(K, { children: [
2640
2645
  /* @__PURE__ */ n("span", { className: "pa-toolbar-divider", "aria-hidden": "true" }),
2641
2646
  /* @__PURE__ */ n(
2642
- V,
2647
+ H,
2643
2648
  {
2644
2649
  variant: "icon",
2645
2650
  className: "pa-toolbar-settings",
@@ -2648,44 +2653,44 @@ function wr({
2648
2653
  "aria-label": "PixelAgent settings",
2649
2654
  "aria-expanded": r,
2650
2655
  title: "Settings",
2651
- children: /* @__PURE__ */ n(ur, {})
2656
+ children: /* @__PURE__ */ n(mr, {})
2652
2657
  }
2653
2658
  )
2654
2659
  ] }),
2655
- v && !Dt(v) && v !== "Copied!" && /* @__PURE__ */ n("span", { className: "pa-status pa-toolbar-status", role: "status", children: v })
2660
+ v && !_t(v) && v !== "Copied!" && /* @__PURE__ */ n("span", { className: "pa-status pa-toolbar-status", role: "status", children: v })
2656
2661
  ] }) })
2657
2662
  ]
2658
2663
  }
2659
2664
  );
2660
- return typeof document > "u" ? I : Ye(
2665
+ return typeof document > "u" ? T : Ke(
2661
2666
  /* @__PURE__ */ n(
2662
2667
  "div",
2663
2668
  {
2664
2669
  className: "pa-root pa-root--toolbar-portal",
2665
2670
  "data-pixelagent-toolbar-portal": !0,
2666
2671
  ...e,
2667
- children: I
2672
+ children: T
2668
2673
  }
2669
2674
  ),
2670
2675
  document.body
2671
2676
  );
2672
2677
  }
2673
- function xr() {
2674
- const e = W(jt()), [t, i] = A(
2678
+ function Mr() {
2679
+ const e = Y(Qt()), [t, i] = S(
2675
2680
  () => {
2676
- var o;
2677
- return ((o = e.current) == null ? void 0 : o.annotations) ?? [];
2681
+ var s;
2682
+ return ((s = e.current) == null ? void 0 : s.annotations) ?? [];
2678
2683
  }
2679
2684
  );
2680
- H(() => {
2681
- qt({ annotations: t });
2685
+ _(() => {
2686
+ en({ annotations: t });
2682
2687
  }, [t]);
2683
- const r = L((o, s) => {
2688
+ const r = $((s, o) => {
2684
2689
  i(
2685
- (u) => u.map((c) => c.id === o ? { ...c, ...s } : c)
2690
+ (c) => c.map((u) => u.id === s ? { ...u, ...o } : u)
2686
2691
  );
2687
- }, []), a = L((o) => {
2688
- i((s) => s.filter((u) => u.id !== o));
2692
+ }, []), a = $((s) => {
2693
+ i((o) => o.filter((c) => c.id !== s));
2689
2694
  }, []);
2690
2695
  return {
2691
2696
  annotations: t,
@@ -2694,227 +2699,284 @@ function xr() {
2694
2699
  removeAnnotation: a
2695
2700
  };
2696
2701
  }
2697
- function Nr({
2702
+ function Ar({
2698
2703
  ui: e,
2699
2704
  hostTheme: t,
2700
2705
  onHostThemeChange: i
2701
2706
  }) {
2702
- const r = we(
2703
- () => ({ ...Jt, ...e }),
2707
+ const r = xe(
2708
+ () => ({ ...tn, ...e }),
2704
2709
  [e]
2705
- ), [a, o] = A(
2706
- () => t ?? tt(r) ?? "dark"
2707
- ), [s, u] = A(!1), c = t ?? a;
2708
- H(() => {
2710
+ ), [a, s] = S(
2711
+ () => t ?? it(r) ?? "dark"
2712
+ ), [o, c] = S(!1), u = t ?? a;
2713
+ _(() => {
2709
2714
  if (t !== void 0) return;
2710
2715
  const v = () => {
2711
- const y = tt(r);
2712
- y && o(y);
2716
+ const b = it(r);
2717
+ b && s(b);
2713
2718
  };
2714
2719
  v();
2715
- const g = r.hostThemeAttribute, m = new MutationObserver(v);
2716
- return m.observe(document.documentElement, {
2720
+ const m = r.hostThemeAttribute, g = new MutationObserver(v);
2721
+ return g.observe(document.documentElement, {
2717
2722
  attributes: !0,
2718
- attributeFilter: [g]
2719
- }), () => m.disconnect();
2723
+ attributeFilter: [m]
2724
+ }), () => g.disconnect();
2720
2725
  }, [t, r]);
2721
- const l = we(
2722
- () => Zt(r, c),
2723
- [r, c]
2724
- ), p = L(() => {
2725
- const v = c === "dark" ? "light" : "dark";
2726
+ const l = xe(
2727
+ () => nn(r, u),
2728
+ [r, u]
2729
+ ), f = $(() => {
2730
+ const v = u === "dark" ? "light" : "dark";
2726
2731
  if (i) {
2727
2732
  i(v);
2728
2733
  return;
2729
2734
  }
2730
- o(v), Qt(v, r);
2731
- }, [c, i, r]), f = L(() => {
2732
- u((v) => !v);
2735
+ s(v), rn(v, r);
2736
+ }, [u, i, r]), p = $(() => {
2737
+ c((v) => !v);
2733
2738
  }, []);
2734
2739
  return {
2735
2740
  chrome: l,
2736
- rootAttributes: en(l),
2737
- hostTheme: c,
2738
- toggleHostTheme: p,
2739
- settingsOpen: s,
2740
- setSettingsOpen: u,
2741
- toggleSettings: f,
2741
+ rootAttributes: an(l),
2742
+ hostTheme: u,
2743
+ toggleHostTheme: f,
2744
+ settingsOpen: o,
2745
+ setSettingsOpen: c,
2746
+ toggleSettings: p,
2742
2747
  uiSettings: r
2743
2748
  };
2744
2749
  }
2745
- const gt = "/__pixelagent/apply";
2746
- function vt(e) {
2750
+ const yt = "/__pixelagent/apply", wt = "pixelagent-runtime-styles";
2751
+ let xt = 0;
2752
+ const We = /* @__PURE__ */ new WeakMap();
2753
+ function Sr(e) {
2754
+ let t = We.get(e);
2755
+ if (t) return t;
2756
+ for (const i of Array.from(e.classList))
2757
+ if (i.startsWith("pa-runtime-"))
2758
+ return We.set(e, i), i;
2759
+ return xt += 1, t = `pa-runtime-${xt}`, We.set(e, t), e.classList.add(t), t;
2760
+ }
2761
+ function Lr() {
2762
+ let e = document.getElementById(wt);
2763
+ return e || (e = document.createElement("style"), e.id = wt, document.head.appendChild(e)), e;
2764
+ }
2765
+ function Er(e, t, i, r) {
2766
+ const a = Lr(), s = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = new RegExp(
2767
+ `(\\.${s}:${t}\\s*\\{)([\\s\\S]*?)(\\})`,
2768
+ "m"
2769
+ ), c = `${i}: ${r} !important`;
2770
+ let u = a.textContent ?? "";
2771
+ const l = u.match(o);
2772
+ if (l) {
2773
+ const f = l[2], p = new RegExp(`(\\s*${i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s*:\\s*)[^;]+;?`);
2774
+ let v;
2775
+ if (p.test(f))
2776
+ v = f.replace(p, `$1${r} !important;`);
2777
+ else {
2778
+ const m = f.replace(/\s+$/, ""), g = m.endsWith(";") || m === "" ? "" : ";";
2779
+ v = `${m}${g}
2780
+ ${c};
2781
+ `;
2782
+ }
2783
+ u = u.replace(o, `$1${v}$3`);
2784
+ } else
2785
+ u && !u.endsWith(`
2786
+ `) && (u += `
2787
+ `), u += `
2788
+ .${e}:${t} {
2789
+ ${c};
2790
+ }
2791
+ `;
2792
+ a.textContent = u;
2793
+ }
2794
+ function Nt(e) {
2747
2795
  const t = Math.min(e.startX, e.currentX), i = Math.min(e.startY, e.currentY), r = Math.abs(e.currentX - e.startX), a = Math.abs(e.currentY - e.startY);
2748
2796
  return { x: t, y: i, width: r, height: a };
2749
2797
  }
2750
- function kr({
2798
+ function $r({
2751
2799
  ui: e,
2752
2800
  hostTheme: t,
2753
2801
  onHostThemeChange: i,
2754
2802
  applyEndpoint: r,
2755
- onApply: a
2803
+ onApply: a,
2804
+ runtimeStateStyles: s
2756
2805
  } = {}) {
2757
- const o = Nr({ ui: e, hostTheme: t, onHostThemeChange: i }), [s, u] = A(null);
2758
- H(() => {
2806
+ const o = Ar({ ui: e, hostTheme: t, onHostThemeChange: i }), [c, u] = S(null);
2807
+ _(() => {
2759
2808
  if (r || a) return;
2760
- let b = !1;
2761
- return fetch(gt, { method: "GET" }).then((S) => {
2762
- !b && S.status === 405 && u(gt);
2809
+ let y = !1;
2810
+ return fetch(yt, { method: "GET" }).then((A) => {
2811
+ !y && A.status === 405 && u(yt);
2763
2812
  }).catch(() => {
2764
2813
  }), () => {
2765
- b = !0;
2814
+ y = !0;
2766
2815
  };
2767
2816
  }, [r, a]);
2768
- const [c, l] = A(!1), [p, f] = A("idle"), [v, g] = A("element"), {
2769
- annotations: m,
2770
- setAnnotations: y,
2771
- updateAnnotation: E,
2772
- removeAnnotation: x
2773
- } = xr(), [w, N] = A(null), [T, P] = A(null), [$, k] = A([]), [I, C] = A(null), [h, B] = A(null), [Y, ne] = A(!1), [Q, J] = A(!1), he = c && p === "annotate" && m.length > 0 && !Y, [F, ee] = A("this-instance"), [te, M] = A("normal"), [D, O] = A(null), [_, R] = A(null), [z, X] = A(null), q = W(null), fe = W(null), me = L(
2774
- (b, S) => {
2775
- fe.current && clearTimeout(fe.current), O(b), R((S == null ? void 0 : S.entryId) ?? null), X((S == null ? void 0 : S.copyAllFrom) ?? null), fe.current = setTimeout(() => {
2776
- O(null), R(null), X(null);
2817
+ const [l, f] = S(!1), [p, v] = S("idle"), [m, g] = S("element"), {
2818
+ annotations: b,
2819
+ setAnnotations: E,
2820
+ updateAnnotation: N,
2821
+ removeAnnotation: w
2822
+ } = Mr(), [k, I] = S(null), [P, R] = S(null), [x, T] = S([]), [C, h] = S(null), [F, W] = S(null), [ge, j] = S(!1), [oe, re] = S(!1), V = l && p === "annotate" && b.length > 0 && !ge, [G, ee] = S("this-instance"), [M, O] = S("normal"), [D, U] = S(null), [L, z] = S(null), [X, q] = S(null), Re = Y(null), Pe = Y(null), de = $(
2823
+ (y, A) => {
2824
+ Pe.current && clearTimeout(Pe.current), U(y), z((A == null ? void 0 : A.entryId) ?? null), q((A == null ? void 0 : A.copyAllFrom) ?? null), Pe.current = setTimeout(() => {
2825
+ U(null), z(null), q(null);
2777
2826
  }, 2500);
2778
2827
  },
2779
2828
  []
2780
- ), xe = L(
2781
- async (b, S, K) => {
2782
- if (b)
2829
+ ), Ne = $(
2830
+ async (y, A, J) => {
2831
+ if (y)
2783
2832
  try {
2784
- await Nt(b), me(S, K);
2833
+ await St(y), de(A, J);
2785
2834
  } catch {
2786
- me("Copy failed — check clipboard permissions", K);
2835
+ de("Copy failed — check clipboard permissions", J);
2787
2836
  }
2788
2837
  },
2789
- [me]
2790
- ), ge = L(
2791
- (b, S) => {
2792
- b.length === 0 && !S || (C({ elements: b, areaBbox: S }), P(b[0] ?? null));
2838
+ [de]
2839
+ ), ve = $(
2840
+ (y, A) => {
2841
+ y.length === 0 && !A || (h({ elements: y, areaBbox: A }), R(y[0] ?? null));
2793
2842
  },
2794
2843
  []
2795
- ), Pe = L(
2796
- (b) => {
2797
- if (!(!c || p !== "annotate" || Le(b.target))) {
2798
- if (h) {
2799
- B(
2800
- (S) => S && { ...S, currentX: b.clientX, currentY: b.clientY }
2844
+ ), De = $(
2845
+ (y) => {
2846
+ if (!(!l || p !== "annotate" || Ee(y.target))) {
2847
+ if (F) {
2848
+ W(
2849
+ (A) => A && { ...A, currentX: y.clientX, currentY: y.clientY }
2801
2850
  );
2802
2851
  return;
2803
2852
  }
2804
- v !== "area" && N(ft(b.clientX, b.clientY));
2853
+ m !== "area" && I(vt(y.clientX, y.clientY));
2805
2854
  }
2806
2855
  },
2807
- [c, p, h, v]
2808
- ), Re = L(
2809
- (b) => {
2810
- !c || p !== "annotate" || Le(b.target) || v !== "area" || b.button !== 0 || (b.preventDefault(), b.stopPropagation(), B({
2811
- startX: b.clientX,
2812
- startY: b.clientY,
2813
- currentX: b.clientX,
2814
- currentY: b.clientY
2815
- }), C(null));
2856
+ [l, p, F, m]
2857
+ ), Oe = $(
2858
+ (y) => {
2859
+ !l || p !== "annotate" || Ee(y.target) || m !== "area" || y.button !== 0 || (y.preventDefault(), y.stopPropagation(), W({
2860
+ startX: y.clientX,
2861
+ startY: y.clientY,
2862
+ currentX: y.clientX,
2863
+ currentY: y.clientY
2864
+ }), h(null));
2816
2865
  },
2817
- [c, p, v]
2818
- ), $e = L(() => {
2819
- if (!h) return;
2820
- const b = vt(h);
2821
- if (B(null), b.width < 8 || b.height < 8) return;
2822
- const S = tn(b, je);
2823
- ge(S, b);
2824
- }, [h, ge]), De = L(
2825
- (b) => {
2826
- if (!c || p !== "annotate" || Le(b.target) || v === "area") return;
2827
- b.preventDefault(), b.stopPropagation();
2828
- const S = ft(b.clientX, b.clientY);
2829
- if (!S) return;
2830
- if (b.shiftKey || v === "multi") {
2831
- k((Z) => Z.includes(S) ? Z.filter((U) => U !== S) : [...Z, S]), P(S);
2866
+ [l, p, m]
2867
+ ), Fe = $(() => {
2868
+ if (!F) return;
2869
+ const y = Nt(F);
2870
+ if (W(null), y.width < 8 || y.height < 8) return;
2871
+ const A = on(y, Ze);
2872
+ ve(A, y);
2873
+ }, [F, ve]), Be = $(
2874
+ (y) => {
2875
+ if (!l || p !== "annotate" || Ee(y.target) || m === "area") return;
2876
+ y.preventDefault(), y.stopPropagation();
2877
+ const A = vt(y.clientX, y.clientY);
2878
+ if (!A) return;
2879
+ if (y.shiftKey || m === "multi") {
2880
+ T((te) => te.includes(A) ? te.filter((B) => B !== A) : [...te, A]), R(A);
2832
2881
  return;
2833
2882
  }
2834
- const K = $.length > 0 ? $ : [S];
2835
- ge(K.includes(S) ? K : [S]);
2883
+ const J = x.length > 0 ? x : [A];
2884
+ ve(J.includes(A) ? J : [A]);
2836
2885
  },
2837
- [c, p, v, $, ge]
2886
+ [l, p, m, x, ve]
2838
2887
  );
2839
- H(() => {
2840
- !T || F !== "all-instances" || yt(T) <= 1 && ee("this-instance");
2841
- }, [T, F]), H(() => {
2842
- if (c)
2843
- return document.addEventListener("mousemove", Pe, !0), document.addEventListener("mousedown", Re, !0), document.addEventListener("mouseup", $e, !0), document.addEventListener("click", De, !0), () => {
2844
- document.removeEventListener("mousemove", Pe, !0), document.removeEventListener("mousedown", Re, !0), document.removeEventListener("mouseup", $e, !0), document.removeEventListener("click", De, !0);
2888
+ _(() => {
2889
+ !P || G !== "all-instances" || Ct(P) <= 1 && ee("this-instance");
2890
+ }, [P, G]), _(() => {
2891
+ if (l)
2892
+ return document.addEventListener("mousemove", De, !0), document.addEventListener("mousedown", Oe, !0), document.addEventListener("mouseup", Fe, !0), document.addEventListener("click", Be, !0), () => {
2893
+ document.removeEventListener("mousemove", De, !0), document.removeEventListener("mousedown", Oe, !0), document.removeEventListener("mouseup", Fe, !0), document.removeEventListener("click", Be, !0);
2845
2894
  };
2846
- }, [c, Pe, Re, $e, De]);
2847
- const Ft = L(
2848
- (b, S) => {
2849
- if (!I || !b.trim()) return;
2850
- const { elements: K, areaBbox: Z } = I;
2851
- if (K.length === 0 && !Z) return;
2852
- const ve = ar({
2853
- elements: K,
2854
- note: b,
2855
- areaBbox: Z
2895
+ }, [l, De, Oe, Fe, Be]);
2896
+ const Vt = $(
2897
+ (y, A) => {
2898
+ if (!C || !y.trim()) return;
2899
+ const { elements: J, areaBbox: te } = C;
2900
+ if (J.length === 0 && !te) return;
2901
+ const be = cr({
2902
+ elements: J,
2903
+ note: y,
2904
+ areaBbox: te
2856
2905
  });
2857
- y((U) => [...U, ve]), ne(!1), J(!1), S ? (C(null), P(null)) : (C(null), P(null), k([]));
2906
+ E((B) => [...B, be]), j(!1), re(!1), A ? (h(null), R(null)) : (h(null), R(null), T([]));
2858
2907
  },
2859
- [I, y]
2860
- ), Bt = L(() => {
2861
- C(null), P(null);
2862
- }, []), qe = L(
2863
- async (b) => {
2864
- const S = nn(m);
2865
- await xe(S, "Copied all!", { copyAllFrom: b });
2908
+ [C, E]
2909
+ ), Wt = $(() => {
2910
+ h(null), R(null);
2911
+ }, []), Qe = $(
2912
+ async (y) => {
2913
+ const A = sn(b);
2914
+ await Ne(A, "Copied all!", { copyAllFrom: y });
2866
2915
  },
2867
- [m, xe]
2868
- ), zt = L(
2869
- async (b) => {
2870
- const S = m.find((K) => K.id === b);
2871
- S && await xe(rn(S), "Copied!", { entryId: b });
2916
+ [b, Ne]
2917
+ ), Ut = $(
2918
+ async (y) => {
2919
+ const A = b.find((J) => J.id === y);
2920
+ A && await Ne(ln(A), "Copied!", { entryId: y });
2872
2921
  },
2873
- [m, xe]
2874
- ), Ht = L(
2875
- async (b) => {
2876
- const S = [];
2877
- for (const [U, ae] of b)
2878
- for (const [Oe, be] of ae)
2879
- be.length > 0 && S.push([U, Oe, be]);
2880
- if (S.length === 0) return !1;
2881
- const K = r ?? s ?? void 0, Z = [];
2882
- for (const [U, ae, Oe] of S) {
2883
- const be = We(U), Ut = {
2922
+ [b, Ne]
2923
+ ), Yt = $(
2924
+ async (y) => {
2925
+ const A = [];
2926
+ for (const [B, Z] of y)
2927
+ for (const [se, ne] of Z)
2928
+ ne.length > 0 && A.push([B, se, ne]);
2929
+ if (A.length === 0) return { applied: !1 };
2930
+ if (s) {
2931
+ for (const [B, Z, se] of A) {
2932
+ if (Z === "normal") continue;
2933
+ const ne = Sr(B);
2934
+ for (const ye of se)
2935
+ B.style.removeProperty(ye.property), Er(ne, Z, ye.property, ye.newValue);
2936
+ }
2937
+ for (const [B, Z, se] of A)
2938
+ if (Z === "normal")
2939
+ for (const ne of se)
2940
+ B.style.setProperty(ne.property, ne.newValue);
2941
+ return de("Change applied"), { applied: !0, skipRevert: !0 };
2942
+ }
2943
+ const J = r ?? c ?? void 0, te = [];
2944
+ for (const [B, Z, se] of A) {
2945
+ const ne = Ge(B), ye = {
2884
2946
  schemaVersion: 1,
2885
- elementSelector: wt(U, F),
2886
- sourceFile: be.sourceFile,
2887
- lineNumber: be.lineNumber,
2888
- targetScope: F,
2889
- state: ae,
2890
- stylingSystem: bt(U),
2891
- changes: Oe
2947
+ elementSelector: Mt(B, G),
2948
+ sourceFile: ne.sourceFile,
2949
+ lineNumber: ne.lineNumber,
2950
+ targetScope: G,
2951
+ state: Z,
2952
+ stylingSystem: kt(B),
2953
+ changes: se
2892
2954
  };
2893
- Z.push(await Gn(Ut, { applyEndpoint: K, onApply: a }));
2955
+ te.push(await Jn(ye, { applyEndpoint: J, onApply: a }));
2894
2956
  }
2895
- const ve = Z.every(
2896
- (U) => U.mode === "mcp" && U.result.success && U.result.linesChanged.length > 0
2957
+ const be = te.every(
2958
+ (B) => B.mode === "mcp" && B.result.success && B.result.linesChanged.length > 0
2897
2959
  );
2898
- return me(ve ? "Change applied" : "Apply failed"), Z.forEach((U, ae) => {
2899
- U.mode === "error" ? console.error(`[pixelagent] Apply #${ae} failed:`, U.message) : U.mode === "clipboard" ? console.warn(`[pixelagent] Apply #${ae} fell back to clipboard`) : U.mode === "mcp" && !U.result.success && console.warn(`[pixelagent] Apply #${ae} reported no changes:`, U.result);
2900
- }), ve;
2960
+ return de(be ? "Change applied" : "Apply failed"), te.forEach((B, Z) => {
2961
+ B.mode === "error" ? console.error(`[pixelagent] Apply #${Z} failed:`, B.message) : B.mode === "clipboard" ? console.warn(`[pixelagent] Apply #${Z} fell back to clipboard`) : B.mode === "mcp" && !B.result.success && console.warn(`[pixelagent] Apply #${Z} reported no changes:`, B.result);
2962
+ }), { applied: be };
2901
2963
  },
2902
- [F, r, s, a, me]
2903
- ), Je = (b) => {
2904
- o.setSettingsOpen(!1), l(!0), f(b), P(null), N(null), C(null), k([]), B(null), b === "annotate" && ne(!1);
2905
- }, _t = () => {
2906
- l(!1), f("idle"), P(null), N(null), C(null), k([]), B(null), ne(!1), J(!1);
2907
- }, Vt = h ? vt(h) : null;
2964
+ [G, r, c, a, s, de]
2965
+ ), et = (y) => {
2966
+ o.setSettingsOpen(!1), f(!0), v(y), R(null), I(null), h(null), T([]), W(null), y === "annotate" && j(!1);
2967
+ }, Xt = () => {
2968
+ f(!1), v("idle"), R(null), I(null), h(null), T([]), W(null), j(!1), re(!1);
2969
+ }, Gt = F ? Nt(F) : null;
2908
2970
  return /* @__PURE__ */ d(
2909
2971
  "div",
2910
2972
  {
2911
- ref: q,
2973
+ ref: Re,
2912
2974
  className: "pa-root",
2913
2975
  "data-pixelagent-root": !0,
2914
2976
  ...o.rootAttributes,
2915
2977
  children: [
2916
2978
  /* @__PURE__ */ n(
2917
- wr,
2979
+ Cr,
2918
2980
  {
2919
2981
  rootAttributes: o.rootAttributes,
2920
2982
  hostTheme: o.hostTheme,
@@ -2923,91 +2985,91 @@ function kr({
2923
2985
  onToggleSettings: o.toggleSettings,
2924
2986
  onCloseSettings: () => o.setSettingsOpen(!1),
2925
2987
  onToggleHostTheme: o.toggleHostTheme,
2926
- active: c,
2988
+ active: l,
2927
2989
  mode: p,
2928
- captureMode: v,
2929
- annotationCount: m.length,
2930
- multiSelectCount: $.length,
2990
+ captureMode: m,
2991
+ annotationCount: b.length,
2992
+ multiSelectCount: x.length,
2931
2993
  copyStatus: D,
2932
- copyAllFrom: z,
2933
- onActivateAnnotate: () => Je("annotate"),
2934
- onActivateEdit: () => Je("edit"),
2935
- onDeactivate: _t,
2936
- onCopyAll: () => qe("toolbar"),
2994
+ copyAllFrom: X,
2995
+ onActivateAnnotate: () => et("annotate"),
2996
+ onActivateEdit: () => et("edit"),
2997
+ onDeactivate: Xt,
2998
+ onCopyAll: () => Qe("toolbar"),
2937
2999
  onCaptureModeChange: g,
2938
3000
  onConfirmMultiSelect: () => {
2939
- $.length > 0 && ge($);
3001
+ x.length > 0 && ve(x);
2940
3002
  }
2941
3003
  }
2942
3004
  ),
2943
- c && p === "annotate" && /* @__PURE__ */ d(G, { children: [
3005
+ l && p === "annotate" && /* @__PURE__ */ d(K, { children: [
2944
3006
  /* @__PURE__ */ n(
2945
- Mt,
3007
+ $t,
2946
3008
  {
2947
- element: w,
2948
- selected: T,
2949
- multiSelected: $
3009
+ element: k,
3010
+ selected: P,
3011
+ multiSelected: x
2950
3012
  }
2951
3013
  ),
2952
- /* @__PURE__ */ n(cr, { annotations: m }),
2953
- /* @__PURE__ */ n(ir, { area: Vt, isDragging: !!h })
3014
+ /* @__PURE__ */ n(hr, { annotations: b }),
3015
+ /* @__PURE__ */ n(lr, { area: Gt, isDragging: !!F })
2954
3016
  ] }),
2955
- c && p === "annotate" && I && /* @__PURE__ */ n(
2956
- rr,
3017
+ l && p === "annotate" && C && /* @__PURE__ */ n(
3018
+ sr,
2957
3019
  {
2958
- elements: I.elements,
2959
- areaBbox: I.areaBbox,
2960
- onSubmit: Ft,
2961
- onCancel: Bt
3020
+ elements: C.elements,
3021
+ areaBbox: C.areaBbox,
3022
+ onSubmit: Vt,
3023
+ onCancel: Wt
2962
3024
  }
2963
3025
  ),
2964
- c && p === "edit" && /* @__PURE__ */ n(
2965
- Xn,
3026
+ l && p === "edit" && /* @__PURE__ */ n(
3027
+ qn,
2966
3028
  {
2967
- selectedElement: T,
2968
- hoveredElement: w,
2969
- onSelectElement: P,
2970
- onHoverElement: N,
2971
- targetScope: F,
3029
+ selectedElement: P,
3030
+ hoveredElement: k,
3031
+ onSelectElement: R,
3032
+ onHoverElement: I,
3033
+ targetScope: G,
2972
3034
  onTargetScopeChange: ee,
2973
- elementState: te,
2974
- onElementStateChange: M,
2975
- onApply: Ht,
3035
+ elementState: M,
3036
+ onElementStateChange: O,
3037
+ onApply: Yt,
2976
3038
  applyStatus: p === "edit" ? D : null,
2977
- isToolbarTarget: Le
3039
+ isToolbarTarget: Ee
2978
3040
  }
2979
3041
  ),
2980
- he && /* @__PURE__ */ n(
2981
- dr,
3042
+ V && /* @__PURE__ */ n(
3043
+ fr,
2982
3044
  {
2983
- annotations: m,
2984
- collapsed: Q,
2985
- onToggleCollapsed: () => J((b) => !b),
3045
+ annotations: b,
3046
+ collapsed: oe,
3047
+ onToggleCollapsed: () => re((y) => !y),
2986
3048
  onClose: () => {
2987
- ne(!0), J(!1);
3049
+ j(!0), re(!1);
2988
3050
  },
2989
- onCopyAll: () => qe("session"),
2990
- onCopyOne: zt,
2991
- onRemove: x,
2992
- onUpdate: E,
3051
+ onCopyAll: () => Qe("session"),
3052
+ onCopyOne: Ut,
3053
+ onRemove: w,
3054
+ onUpdate: N,
2993
3055
  copyStatus: D,
2994
- copiedEntryId: _,
2995
- copyAllFrom: z
3056
+ copiedEntryId: L,
3057
+ copyAllFrom: X
2996
3058
  }
2997
3059
  )
2998
3060
  ]
2999
3061
  }
3000
3062
  );
3001
3063
  }
3002
- function Cr() {
3064
+ function Ir() {
3003
3065
  return typeof process < "u" && process.env.NODE_ENV !== "production";
3004
3066
  }
3005
- function Er() {
3006
- return Cr() ? /* @__PURE__ */ n(kr, {}) : null;
3067
+ function Or() {
3068
+ return Ir() ? /* @__PURE__ */ n($r, {}) : null;
3007
3069
  }
3008
3070
  export {
3009
- kr as PixelAgent,
3010
- Er as PixelAgentDev,
3011
- Cr as isDevEnvironment
3071
+ $r as PixelAgent,
3072
+ Or as PixelAgentDev,
3073
+ Ir as isDevEnvironment
3012
3074
  };
3013
3075
  //# sourceMappingURL=pixelagent.js.map