pixelagent 0.1.4 → 0.1.6

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