@8btc/whiteboard 0.0.20-alpha.30 → 0.0.20-alpha.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +740 -731
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4,11 +4,11 @@ var ai = (n) => {
4
4
  };
5
5
  var kn = (n, i, t) => i in n ? In(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t;
6
6
  var p = (n, i, t) => kn(n, typeof i != "symbol" ? i + "" : i, t), Fe = (n, i, t) => i.has(n) || ai("Cannot " + t);
7
- var r = (n, i, t) => (Fe(n, i, "read from private field"), t ? t.call(n) : i.get(n)), g = (n, i, t) => i.has(n) ? ai("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(n) : i.set(n, t), x = (n, i, t, e) => (Fe(n, i, "write to private field"), e ? e.call(n, t) : i.set(n, t), t), E = (n, i, t) => (Fe(n, i, "access private method"), t);
7
+ var r = (n, i, t) => (Fe(n, i, "read from private field"), t ? t.call(n) : i.get(n)), u = (n, i, t) => i.has(n) ? ai("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(n) : i.set(n, t), C = (n, i, t, e) => (Fe(n, i, "write to private field"), e ? e.call(n, t) : i.set(n, t), t), E = (n, i, t) => (Fe(n, i, "access private method"), t);
8
8
  import { jsxs as k, jsx as c, Fragment as Ie } from "react/jsx-runtime";
9
- import { useState as R, useEffect as Z, useRef as Ue, useMemo as St, forwardRef as $, createContext as Rn, isValidElement as li, version as $n, cloneElement as An, useContext as Fn, Fragment as Hn, useCallback as J, memo as ct } from "react";
10
- import _ from "konva";
11
- import { N as b, R as N, I as Q } from "./const-BJHbPsA9.js";
9
+ import { useState as $, useEffect as U, useRef as Ue, useMemo as St, forwardRef as A, createContext as Rn, isValidElement as li, version as $n, cloneElement as An, useContext as Fn, Fragment as Hn, useCallback as Q, memo as dt } from "react";
10
+ import M from "konva";
11
+ import { N as b, R as N, I as tt } from "./const-BJHbPsA9.js";
12
12
  import Ln from "mitt";
13
13
  import { Editor as Dn } from "@tiptap/core";
14
14
  import Pn from "@tiptap/starter-kit";
@@ -28,42 +28,42 @@ import { useCurrentEditor as ts, useEditorState as es } from "@tiptap/react";
28
28
  import { FloatingDelayGroup as is, useMergeRefs as Ni, FloatingPortal as ns, useFloating as ss, offset as os, flip as rs, shift as as, autoUpdate as ls, useHover as hs, useFocus as cs, useDismiss as ds, useRole as gs, useInteractions as us } from "@floating-ui/react";
29
29
  import * as ie from "@radix-ui/react-popover";
30
30
  import { useHotkeys as Ti } from "react-hotkeys-hook";
31
- var T, S, tt, ne, se, oe, re, ae, le, he, ce, de, _i;
31
+ var T, S, et, ne, se, oe, re, ae, le, he, ce, de, _i;
32
32
  class ms {
33
33
  constructor(i, t) {
34
- g(this, de);
35
- g(this, T);
36
- g(this, S);
37
- g(this, tt, { x: 0, y: 0, scale: 1 });
34
+ u(this, de);
35
+ u(this, T);
36
+ u(this, S);
37
+ u(this, et, { x: 0, y: 0, scale: 1 });
38
38
  /**
39
39
  * 处理滚轮缩放和平移
40
40
  */
41
- g(this, ne, (i) => {
41
+ u(this, ne, (i) => {
42
42
  i.evt.preventDefault();
43
43
  const e = r(this, S).getPointerPosition();
44
44
  if (e)
45
45
  if (i.evt.ctrlKey) {
46
- const s = r(this, tt).scale, o = {
47
- x: (e.x - r(this, tt).x) / s,
48
- y: (e.y - r(this, tt).y) / s
49
- }, a = 1.01, h = i.evt.deltaY > 0 ? -1 : 1, l = Math.min(Math.abs(i.evt.deltaY), 10);
46
+ const s = r(this, et).scale, o = {
47
+ x: (e.x - r(this, et).x) / s,
48
+ y: (e.y - r(this, et).y) / s
49
+ }, a = 1.01, l = i.evt.deltaY > 0 ? -1 : 1, h = Math.min(Math.abs(i.evt.deltaY), 10);
50
50
  let d = s;
51
- for (let u = 0; u < l; u++)
52
- d = h > 0 ? d * a : d / a;
53
- const f = Math.max(0.1, Math.min(5, d)), m = {
54
- x: e.x - o.x * f,
55
- y: e.y - o.y * f
51
+ for (let g = 0; g < h; g++)
52
+ d = l > 0 ? d * a : d / a;
53
+ const m = Math.max(0.1, Math.min(5, d)), f = {
54
+ x: e.x - o.x * m,
55
+ y: e.y - o.y * m
56
56
  };
57
- r(this, T)._updateViewport({ x: m.x, y: m.y, scale: f });
57
+ r(this, T)._updateViewport({ x: f.x, y: f.y, scale: m });
58
58
  } else {
59
59
  const s = i.evt.shiftKey ? i.evt.deltaY : i.evt.deltaX, o = i.evt.shiftKey ? 0 : i.evt.deltaY;
60
60
  r(this, T)._updateViewport({
61
- x: r(this, tt).x - s,
62
- y: r(this, tt).y - o
61
+ x: r(this, et).x - s,
62
+ y: r(this, et).y - o
63
63
  });
64
64
  }
65
65
  });
66
- g(this, se, (i) => {
66
+ u(this, se, (i) => {
67
67
  const t = r(this, T).getToolType();
68
68
  if (i.evt.button !== 0 || t === "hand")
69
69
  return;
@@ -89,7 +89,7 @@ class ms {
89
89
  if (s) {
90
90
  const o = s.width(), a = s.height();
91
91
  if (o && a) {
92
- const h = {
92
+ const l = {
93
93
  x: s.x(),
94
94
  y: s.y(),
95
95
  width: o,
@@ -97,14 +97,14 @@ class ms {
97
97
  };
98
98
  r(this, T)._createDraftNode(t, {
99
99
  $_parentId: s.id(),
100
- $_bounds: h
100
+ $_bounds: l
101
101
  });
102
102
  }
103
103
  }
104
104
  }
105
105
  r(this, T)._selectNodes();
106
106
  });
107
- g(this, oe, () => {
107
+ u(this, oe, () => {
108
108
  const i = r(this, T).getState().toolType;
109
109
  if (i === "hand")
110
110
  return;
@@ -123,7 +123,7 @@ class ms {
123
123
  "arrow"
124
124
  ].includes(i) && r(this, T)._updateDraftNode();
125
125
  });
126
- g(this, re, () => {
126
+ u(this, re, () => {
127
127
  const i = r(this, T).getState().toolType;
128
128
  if (i !== "hand") {
129
129
  if (i === "select") {
@@ -141,25 +141,25 @@ class ms {
141
141
  ].includes(i) && r(this, T)._finalizeDraftNode(), i === "text" && r(this, T)._createTextNodeAtDrawingPosition("");
142
142
  }
143
143
  });
144
- g(this, ae, (i) => {
144
+ u(this, ae, (i) => {
145
145
  if (i.target !== r(this, S))
146
146
  return;
147
147
  const t = r(this, T).getState().toolType;
148
148
  t === "hand" ? this.setCursor("grabbing") : t === "select" && this.setCursor("all-scroll");
149
149
  });
150
- g(this, le, (i) => {
150
+ u(this, le, (i) => {
151
151
  i.target === r(this, S) && r(this, T)._updateViewport({
152
152
  x: r(this, S).x(),
153
153
  y: r(this, S).y()
154
154
  });
155
155
  });
156
- g(this, he, (i) => {
156
+ u(this, he, (i) => {
157
157
  i.target === r(this, S) && (r(this, T)._updateViewport({
158
158
  x: r(this, S).x(),
159
159
  y: r(this, S).y()
160
160
  }), this.resetCursor());
161
161
  });
162
- g(this, ce, (i) => {
162
+ u(this, ce, (i) => {
163
163
  if (i.evt.preventDefault(), r(this, T).getToolType() !== "select")
164
164
  return;
165
165
  const t = r(this, S).getPointerPosition(), e = i.target;
@@ -172,7 +172,7 @@ class ms {
172
172
  targetIds: Array.isArray(s) ? s.map((o) => o.id()) : s ? [s.id()] : []
173
173
  });
174
174
  });
175
- x(this, T, i), x(this, S, new _.Stage({
175
+ C(this, T, i), C(this, S, new M.Stage({
176
176
  id: "canvas-stage",
177
177
  container: t.container,
178
178
  width: t.width,
@@ -195,14 +195,14 @@ class ms {
195
195
  * 获取当前视口状态
196
196
  */
197
197
  getViewport() {
198
- return { ...r(this, tt) };
198
+ return { ...r(this, et) };
199
199
  }
200
200
  /**
201
201
  * 设置视口(包括位置、缩放和尺寸)
202
202
  */
203
203
  setViewport(i) {
204
- const t = { ...r(this, tt), ...i };
205
- x(this, tt, t), i.x !== void 0 && r(this, S).x(i.x), i.y !== void 0 && r(this, S).y(i.y), i.scale !== void 0 && (r(this, S).scaleX(i.scale), r(this, S).scaleY(i.scale));
204
+ const t = { ...r(this, et), ...i };
205
+ C(this, et, t), i.x !== void 0 && r(this, S).x(i.x), i.y !== void 0 && r(this, S).y(i.y), i.scale !== void 0 && (r(this, S).scaleX(i.scale), r(this, S).scaleY(i.scale));
206
206
  }
207
207
  /**
208
208
  * 设置是否可拖拽
@@ -235,55 +235,55 @@ class ms {
235
235
  r(this, S).destroy();
236
236
  }
237
237
  }
238
- T = new WeakMap(), S = new WeakMap(), tt = new WeakMap(), ne = new WeakMap(), se = new WeakMap(), oe = new WeakMap(), re = new WeakMap(), ae = new WeakMap(), le = new WeakMap(), he = new WeakMap(), ce = new WeakMap(), de = new WeakSet(), /**
238
+ T = new WeakMap(), S = new WeakMap(), et = new WeakMap(), ne = new WeakMap(), se = new WeakMap(), oe = new WeakMap(), re = new WeakMap(), ae = new WeakMap(), le = new WeakMap(), he = new WeakMap(), ce = new WeakMap(), de = new WeakSet(), /**
239
239
  * 设置事件监听器
240
240
  */
241
241
  _i = function() {
242
242
  r(this, S).on("wheel", r(this, ne)), r(this, S).on("pointerdown", r(this, se)), r(this, S).on("pointermove", r(this, oe)), r(this, S).on("pointerup", r(this, re)), r(this, S).on("dragstart", r(this, ae)), r(this, S).on("dragmove", r(this, le)), r(this, S).on("dragend", r(this, he)), r(this, S).on("contextmenu", r(this, ce));
243
243
  };
244
- var Lt, I, ge, ue, me, fe, pe, ye, ve, Mi;
244
+ var Lt, _, ge, ue, me, fe, pe, ye, ve, Mi;
245
245
  class fs {
246
246
  constructor(i, t) {
247
- g(this, ve);
248
- g(this, Lt);
249
- g(this, I);
247
+ u(this, ve);
248
+ u(this, Lt);
249
+ u(this, _);
250
250
  /**
251
251
  * 处理 transformstart 事件
252
252
  */
253
- g(this, ge, () => {
253
+ u(this, ge, () => {
254
254
  this.emitPositionChange();
255
255
  });
256
256
  /**
257
257
  * 处理 transform 事件
258
258
  */
259
- g(this, ue, () => {
259
+ u(this, ue, () => {
260
260
  this.emitPositionChange();
261
261
  });
262
262
  /**
263
263
  * 处理 transformend 事件
264
264
  */
265
- g(this, me, () => {
265
+ u(this, me, () => {
266
266
  this.emitPositionChange();
267
267
  });
268
268
  /**
269
269
  * 处理 dragstart 事件
270
270
  */
271
- g(this, fe, () => {
271
+ u(this, fe, () => {
272
272
  this.emitPositionChange();
273
273
  });
274
274
  /**
275
275
  * 处理 dragmove 事件
276
276
  */
277
- g(this, pe, () => {
277
+ u(this, pe, () => {
278
278
  this.emitPositionChange();
279
279
  });
280
280
  /**
281
281
  * 处理 dragend 事件
282
282
  */
283
- g(this, ye, () => {
283
+ u(this, ye, () => {
284
284
  this.emitPositionChange();
285
285
  });
286
- x(this, Lt, i), x(this, I, new _.Transformer({
286
+ C(this, Lt, i), C(this, _, new M.Transformer({
287
287
  rotateEnabled: t?.rotateEnabled ?? !0,
288
288
  ignoreStroke: t?.ignoreStroke ?? !0,
289
289
  anchorSize: t?.anchorSize ?? 8,
@@ -297,21 +297,21 @@ class fs {
297
297
  * 获取原生 Konva.Transformer 实例
298
298
  */
299
299
  getTransformer() {
300
- return r(this, I);
300
+ return r(this, _);
301
301
  }
302
302
  /**
303
303
  * 获取 Transformer 的位置信息
304
304
  */
305
305
  getPosition() {
306
- if (r(this, I).nodes().length === 0)
306
+ if (r(this, _).nodes().length === 0)
307
307
  return null;
308
- const t = r(this, I).getClientRect();
308
+ const t = r(this, _).getClientRect();
309
309
  return {
310
310
  x: t.x,
311
311
  y: t.y,
312
312
  width: t.width,
313
313
  height: t.height,
314
- rotation: r(this, I).rotation()
314
+ rotation: r(this, _).rotation()
315
315
  };
316
316
  }
317
317
  /**
@@ -322,30 +322,39 @@ class fs {
322
322
  this.clearNodes();
323
323
  return;
324
324
  }
325
- r(this, I).nodes(i), r(this, I).moveToTop(), r(this, I).rotateEnabled(
325
+ r(this, _).nodes(i), r(this, _).moveToTop(), r(this, _).rotateEnabled(
326
326
  !i.some(
327
327
  (t) => ["rich-text", "html"].includes(t.getAttr("$_type"))
328
328
  )
329
- ), i.length === 1 && i[0].getAttr("$_type") === "rich-text" && r(this, I).enabledAnchors([
329
+ ), i.length === 1 && i[0].getAttr("$_type") === "rich-text" ? r(this, _).enabledAnchors([
330
330
  "top-left",
331
331
  "top-right",
332
332
  "bottom-left",
333
333
  "bottom-right",
334
334
  "middle-left",
335
335
  "middle-right"
336
- ]), i.length === 1 && i[0].getAttr("$_type") === "arrow" ? r(this, I).visible(!1) : r(this, I).visible(!0), this.emitPositionChange();
336
+ ]) : i.length === 1 && i[0].getAttr("$_type") === "arrow" ? (r(this, _).enabledAnchors([]), r(this, _).rotateEnabled(!1), r(this, _).borderStroke("transparent")) : (r(this, _).visible(!0), r(this, _).rotateEnabled(!0), r(this, _).enabledAnchors([
337
+ "top-left",
338
+ "top-center",
339
+ "top-right",
340
+ "middle-right",
341
+ "middle-left",
342
+ "bottom-left",
343
+ "bottom-center",
344
+ "bottom-right"
345
+ ]), r(this, _).borderStroke("rgb(0, 161, 255)")), this.emitPositionChange();
337
346
  }
338
347
  /**
339
348
  * 获取当前变换的节点
340
349
  */
341
350
  getNodes() {
342
- return r(this, I).nodes();
351
+ return r(this, _).nodes();
343
352
  }
344
353
  /**
345
354
  * 清除所有节点
346
355
  */
347
356
  clearNodes() {
348
- r(this, I).nodes([]), this.emitPositionChange();
357
+ r(this, _).nodes([]), this.emitPositionChange();
349
358
  }
350
359
  /**
351
360
  * emit Transformer 位置
@@ -358,15 +367,15 @@ class fs {
358
367
  * 销毁 Transformer
359
368
  */
360
369
  destroy() {
361
- r(this, I).destroy();
370
+ r(this, _).destroy();
362
371
  }
363
372
  }
364
- Lt = new WeakMap(), I = new WeakMap(), ge = new WeakMap(), ue = new WeakMap(), me = new WeakMap(), fe = new WeakMap(), pe = new WeakMap(), ye = new WeakMap(), ve = new WeakSet(), /**
373
+ Lt = new WeakMap(), _ = new WeakMap(), ge = new WeakMap(), ue = new WeakMap(), me = new WeakMap(), fe = new WeakMap(), pe = new WeakMap(), ye = new WeakMap(), ve = new WeakSet(), /**
365
374
  * 设置事件监听器
366
375
  */
367
376
  Mi = function() {
368
- r(this, I).on("transformstart", r(this, ge)), r(this, I).on("transform", r(this, ue)), r(this, I).on("transformend", r(this, me)), r(this, I).on("dragstart", r(this, fe)), r(this, I).on("dragmove", r(this, pe)), r(this, I).on("dragend", r(this, ye)), r(this, I).on("pointerdblclick", (i) => {
369
- const t = r(this, I).nodes();
377
+ r(this, _).on("transformstart", r(this, ge)), r(this, _).on("transform", r(this, ue)), r(this, _).on("transformend", r(this, me)), r(this, _).on("dragstart", r(this, fe)), r(this, _).on("dragmove", r(this, pe)), r(this, _).on("dragend", r(this, ye)), r(this, _).on("pointerdblclick", (i) => {
378
+ const t = r(this, _).nodes();
370
379
  if (t.length === 1) {
371
380
  const e = t[0];
372
381
  e.fire("pointerdblclick", {
@@ -376,85 +385,85 @@ Mi = function() {
376
385
  }
377
386
  });
378
387
  };
379
- var L, V, W, O;
388
+ var P, O, G, Z;
380
389
  class ps {
381
390
  // todo: 优化 selectedNodeIds 的存储和查询性能
382
391
  // private _selectedNodeIds: Set<string> = new Set();
383
392
  constructor(i) {
384
- g(this, L, []);
385
- g(this, V);
386
- g(this, W, []);
387
- g(this, O);
388
- x(this, V, i), x(this, O, Ln());
393
+ u(this, P, []);
394
+ u(this, O);
395
+ u(this, G, []);
396
+ u(this, Z);
397
+ C(this, O, i), C(this, Z, Ln());
389
398
  }
390
399
  /**
391
400
  * 获取当前状态
392
401
  */
393
402
  getState() {
394
- return { ...r(this, V) };
403
+ return { ...r(this, O) };
395
404
  }
396
405
  /**
397
406
  * 获取完整历史状态
398
407
  */
399
408
  getHistory() {
400
409
  return {
401
- past: [...r(this, L)],
402
- present: { ...r(this, V) },
403
- future: [...r(this, W)]
410
+ past: [...r(this, P)],
411
+ present: { ...r(this, O) },
412
+ future: [...r(this, G)]
404
413
  };
405
414
  }
406
415
  /**
407
416
  * 是否可以撤销
408
417
  */
409
418
  canUndo() {
410
- return r(this, L).length > 0;
419
+ return r(this, P).length > 0;
411
420
  }
412
421
  /**
413
422
  * 是否可以重做
414
423
  */
415
424
  canRedo() {
416
- return r(this, W).length > 0;
425
+ return r(this, G).length > 0;
417
426
  }
418
427
  /**
419
428
  * 订阅状态事件
420
429
  */
421
430
  on(i, t) {
422
- r(this, O).on(i, t);
431
+ r(this, Z).on(i, t);
423
432
  }
424
433
  /**
425
434
  * 取消订阅状态事件
426
435
  */
427
436
  off(i, t) {
428
- r(this, O).off(i, t);
437
+ r(this, Z).off(i, t);
429
438
  }
430
439
  /**
431
440
  * @internal
432
441
  * 发送事件
433
442
  */
434
443
  _emit(i, t) {
435
- r(this, O).emit(i, t);
444
+ r(this, Z).emit(i, t);
436
445
  }
437
446
  /**
438
447
  * 撤销操作
439
448
  */
440
449
  undo() {
441
- if (r(this, L).length === 0) return;
442
- const i = r(this, L)[r(this, L).length - 1], t = r(this, L).slice(0, r(this, L).length - 1);
443
- x(this, L, t), x(this, W, [r(this, V), ...r(this, W)]), x(this, V, i), this._renderCanvas(i), r(this, O).emit("state:undo", i), r(this, O).emit("state:change", i);
450
+ if (r(this, P).length === 0) return;
451
+ const i = r(this, P)[r(this, P).length - 1], t = r(this, P).slice(0, r(this, P).length - 1);
452
+ C(this, P, t), C(this, G, [r(this, O), ...r(this, G)]), C(this, O, i), this._renderCanvas(i), r(this, Z).emit("state:undo", i), r(this, Z).emit("state:change", i);
444
453
  }
445
454
  /**
446
455
  * 重做操作
447
456
  */
448
457
  redo() {
449
- if (r(this, W).length === 0) return;
450
- const i = r(this, W)[0], t = r(this, W).slice(1);
451
- x(this, L, [...r(this, L), r(this, V)]), x(this, W, t), x(this, V, i), this._renderCanvas(i), r(this, O).emit("state:redo", i), r(this, O).emit("state:change", i);
458
+ if (r(this, G).length === 0) return;
459
+ const i = r(this, G)[0], t = r(this, G).slice(1);
460
+ C(this, P, [...r(this, P), r(this, O)]), C(this, G, t), C(this, O, i), this._renderCanvas(i), r(this, Z).emit("state:redo", i), r(this, Z).emit("state:change", i);
452
461
  }
453
462
  /**
454
463
  * 重置历史记录
455
464
  */
456
465
  resetHistory() {
457
- x(this, L, []), x(this, W, []), r(this, O).emit("state:reset", r(this, V)), r(this, O).emit("state:change", r(this, V));
466
+ C(this, P, []), C(this, G, []), r(this, Z).emit("state:reset", r(this, O)), r(this, Z).emit("state:change", r(this, O));
458
467
  }
459
468
  /**
460
469
  * 更新状态
@@ -462,17 +471,17 @@ class ps {
462
471
  * @param addToHistory - 是否添加到历史记录
463
472
  */
464
473
  _updateState(i, t) {
465
- const e = { ...r(this, V), ...i };
466
- t && (x(this, L, [...r(this, L), r(this, V)]), x(this, W, [])), x(this, V, e), r(this, O).emit("state:change", e);
474
+ const e = { ...r(this, O), ...i };
475
+ t && (C(this, P, [...r(this, P), r(this, O)]), C(this, G, [])), C(this, O, e), r(this, Z).emit("state:change", e);
467
476
  }
468
477
  /**
469
478
  * 清理资源
470
479
  */
471
480
  _dispose() {
472
- r(this, O).all.clear();
481
+ r(this, Z).all.clear();
473
482
  }
474
483
  }
475
- L = new WeakMap(), V = new WeakMap(), W = new WeakMap(), O = new WeakMap();
484
+ P = new WeakMap(), O = new WeakMap(), G = new WeakMap(), Z = new WeakMap();
476
485
  class st {
477
486
  }
478
487
  const ys = {
@@ -574,9 +583,9 @@ function ki(n, i) {
574
583
  { x: 0, y: 0.25 }
575
584
  // 左上
576
585
  ]
577
- }[i].map((l) => ({
578
- x: Number((t + l.x * s).toFixed(2)) - n.x,
579
- y: Number((e + l.y * o).toFixed(2)) - n.y
586
+ }[i].map((h) => ({
587
+ x: Number((t + h.x * s).toFixed(2)) - n.x,
588
+ y: Number((e + h.y * o).toFixed(2)) - n.y
580
589
  }));
581
590
  }
582
591
  function hi(n, i) {
@@ -600,7 +609,7 @@ function hi(n, i) {
600
609
  };
601
610
  }
602
611
  function ci(n, i) {
603
- const t = n.width ?? Q.MIN_SIZE, e = n.height ?? Q.MIN_SIZE, s = ot(n, i);
612
+ const t = n.width ?? tt.MIN_SIZE, e = n.height ?? tt.MIN_SIZE, s = ot(n, i);
604
613
  if (!n.image) {
605
614
  const a = document.createElement("canvas");
606
615
  a.width = t, a.height = e, n.image = a;
@@ -613,7 +622,7 @@ function ci(n, i) {
613
622
  };
614
623
  }
615
624
  function di(n, i) {
616
- const t = n.width ?? Q.MIN_SIZE, e = n.height ?? Q.MIN_SIZE, s = ot(n, i);
625
+ const t = n.width ?? tt.MIN_SIZE, e = n.height ?? tt.MIN_SIZE, s = ot(n, i);
617
626
  if (!n.$_coverUrl) {
618
627
  const a = document.createElement("canvas");
619
628
  a.width = t, a.height = e, n.image = a;
@@ -725,7 +734,7 @@ function vi(n, i) {
725
734
  strokeWidth: 2,
726
735
  ...n,
727
736
  ...s,
728
- points: o.flatMap((h) => [h.x, h.y]),
737
+ points: o.flatMap((l) => [l.x, l.y]),
729
738
  closed: !0,
730
739
  name: `${b.nodeRoot} ${b.selectable} ${b.polygon}`,
731
740
  draggable: !0,
@@ -768,12 +777,12 @@ var Dt, Ce, $i;
768
777
  class ws extends st {
769
778
  constructor(t, e, s = !1) {
770
779
  super();
771
- g(this, Ce);
780
+ u(this, Ce);
772
781
  p(this, "core");
773
782
  p(this, "config");
774
783
  p(this, "element");
775
784
  p(this, "isDraft");
776
- g(this, Dt, ({ type: t }) => {
785
+ u(this, Dt, ({ type: t }) => {
777
786
  const e = t === "select";
778
787
  this.element.listening(e && (this.config.$_listening ?? !0));
779
788
  });
@@ -790,7 +799,7 @@ class ws extends st {
790
799
  this.config = e;
791
800
  }
792
801
  createElement() {
793
- return new _.Rect(this.config);
802
+ return new M.Rect(this.config);
794
803
  }
795
804
  /**
796
805
  * 获取 Konva.Rect 实例
@@ -831,20 +840,20 @@ $i = function() {
831
840
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !0);
832
841
  });
833
842
  };
834
- var ht, He, Pt, Bt, Ai, Le;
843
+ var ct, He, Pt, Bt, Ai, Le;
835
844
  class bs extends st {
836
845
  constructor(t, e, s = !1) {
837
846
  super();
838
- g(this, ht);
847
+ u(this, ct);
839
848
  p(this, "core");
840
849
  p(this, "config");
841
850
  p(this, "element");
842
851
  p(this, "isDraft");
843
- g(this, Pt, ({ type: t }) => {
852
+ u(this, Pt, ({ type: t }) => {
844
853
  const e = t === "select";
845
854
  this.element.listening(e && (this.config.$_listening ?? !0));
846
855
  });
847
- g(this, Bt, () => {
856
+ u(this, Bt, () => {
848
857
  const t = this.getElement().getLayer();
849
858
  if (!t) return;
850
859
  const e = t.find(
@@ -858,7 +867,7 @@ class bs extends st {
858
867
  !0
859
868
  );
860
869
  });
861
- this.core = t, this.config = ci(e, this.core.getTheme()), this.element = this.createElement(), rt(this.element, this), this.isDraft = s, E(this, ht, He).call(this), E(this, ht, Ai).call(this, this.getElement());
870
+ this.core = t, this.config = ci(e, this.core.getTheme()), this.element = this.createElement(), rt(this.element, this), this.isDraft = s, E(this, ct, He).call(this), E(this, ct, Ai).call(this, this.getElement());
862
871
  }
863
872
  getID() {
864
873
  return this.config.id;
@@ -870,7 +879,7 @@ class bs extends st {
870
879
  this.config = e;
871
880
  }
872
881
  createElement() {
873
- return new _.Image(this.config);
882
+ return new M.Image(this.config);
874
883
  }
875
884
  /**
876
885
  * 获取 Konva.Image 实例
@@ -889,7 +898,7 @@ class bs extends st {
889
898
  ...t
890
899
  },
891
900
  this.core.getTheme()
892
- ), delete this.config.image, this.getElement().setAttrs(this.config), t.$_imageUrl && t.$_imageUrl !== e.$_imageUrl && E(this, ht, He).call(this);
901
+ ), delete this.config.image, this.getElement().setAttrs(this.config), t.$_imageUrl && t.$_imageUrl !== e.$_imageUrl && E(this, ct, He).call(this);
893
902
  }
894
903
  /**
895
904
  * 销毁
@@ -904,7 +913,7 @@ class bs extends st {
904
913
  };
905
914
  }
906
915
  }
907
- ht = new WeakSet(), /**
916
+ ct = new WeakSet(), /**
908
917
  * 加载图片
909
918
  */
910
919
  He = function() {
@@ -917,7 +926,7 @@ He = function() {
917
926
  e.crossOrigin = "anonymous", e.src = t, e.onload = () => {
918
927
  this.getElement().image(e);
919
928
  const s = this.config.width ?? e.width, o = this.config.height ?? e.height;
920
- this.getElement().width(Math.max(s, Q.MIN_SIZE)), this.getElement().height(Math.max(o, Q.MIN_SIZE));
929
+ this.getElement().width(Math.max(s, tt.MIN_SIZE)), this.getElement().height(Math.max(o, tt.MIN_SIZE));
921
930
  }, e.onerror = () => {
922
931
  console.error("Failed to load image:", t);
923
932
  };
@@ -926,12 +935,12 @@ He = function() {
926
935
  */
927
936
  Ai = function(t) {
928
937
  this.core.on("toolType:change", r(this, Pt)), t.on("transform", (e) => {
929
- const s = e.target, o = Math.max(Q.MIN_SIZE, s.width() * s.scaleX()), a = Math.max(Q.MIN_SIZE, s.height() * s.scaleY());
930
- s.scale({ x: 1, y: 1 }), s.width(o), s.height(a), E(this, ht, Le).call(this);
938
+ const s = e.target, o = Math.max(tt.MIN_SIZE, s.width() * s.scaleX()), a = Math.max(tt.MIN_SIZE, s.height() * s.scaleY());
939
+ s.scale({ x: 1, y: 1 }), s.width(o), s.height(a), E(this, ct, Le).call(this);
931
940
  }), t.on("transformend", () => {
932
941
  this.syncConfigFromElement(), r(this, Bt).call(this);
933
942
  }), t.on("dragmove", () => {
934
- E(this, ht, Le).call(this);
943
+ E(this, ct, Le).call(this);
935
944
  }), t.on("dragend", () => {
936
945
  this.syncConfigFromElement(), r(this, Bt).call(this);
937
946
  });
@@ -941,46 +950,46 @@ Ai = function(t) {
941
950
  Le = function() {
942
951
  const t = this.getElement(), e = t.getLayer();
943
952
  if (!e) return;
944
- const s = t.x(), o = t.y(), a = t.width(), h = t.height(), l = e.find(
945
- (f) => f.hasName(this.config.id)
953
+ const s = t.x(), o = t.y(), a = t.width(), l = t.height(), h = e.find(
954
+ (m) => m.hasName(this.config.id)
946
955
  ), d = this.core.getState().nodes || [];
947
- l.forEach((f) => {
948
- const m = d.find((u) => u.id === f.id());
949
- if (m?.$_type === "image-marker" && m.$_relativeBox) {
950
- const { start: u, end: y } = m.$_relativeBox, w = s + u.ratioX * a, v = o + u.ratioY * h, M = s + y.ratioX * a, C = o + y.ratioY * h, B = Math.min(w, M), dt = Math.min(v, C), K = Math.abs(M - w), q = Math.abs(C - v);
951
- f.setAttrs({
952
- x: B,
953
- y: dt,
954
- width: K,
955
- height: q
956
- }), f.getChildren().forEach((z) => {
957
- z.getClassName() === "Rect" ? z.setAttrs({ width: K, height: q }) : z.getClassName() === "Group" && z.setAttrs({ x: K, y: q });
958
- }), xi(f)?.syncConfigFromElement();
956
+ h.forEach((m) => {
957
+ const f = d.find((g) => g.id === m.id());
958
+ if (f?.$_type === "image-marker" && f.$_relativeBox) {
959
+ const { start: g, end: y } = f.$_relativeBox, x = s + g.ratioX * a, v = o + g.ratioY * l, I = s + y.ratioX * a, w = o + y.ratioY * l, z = Math.min(x, I), X = Math.min(v, w), R = Math.abs(I - x), F = Math.abs(w - v);
960
+ m.setAttrs({
961
+ x: z,
962
+ y: X,
963
+ width: R,
964
+ height: F
965
+ }), m.getChildren().forEach((Y) => {
966
+ Y.getClassName() === "Rect" ? Y.setAttrs({ width: R, height: F }) : Y.getClassName() === "Group" && Y.setAttrs({ x: R, y: F });
967
+ }), xi(m)?.syncConfigFromElement();
959
968
  }
960
969
  });
961
970
  };
962
- var et, X, mt, at, _t, Mt, $t, Fi, Hi;
971
+ var at, K, mt, lt, _t, Mt, $t, Fi, Hi;
963
972
  class Es extends st {
964
973
  constructor(t, e, s = !1) {
965
974
  super();
966
- g(this, $t);
975
+ u(this, $t);
967
976
  p(this, "core");
968
977
  p(this, "config");
969
978
  p(this, "element");
970
979
  p(this, "isDraft");
971
- g(this, et);
972
- g(this, X);
973
- g(this, mt);
974
- g(this, at);
975
- g(this, _t);
976
- g(this, Mt);
980
+ u(this, at);
981
+ u(this, K);
982
+ u(this, mt);
983
+ u(this, lt);
984
+ u(this, _t);
985
+ u(this, Mt);
977
986
  this.core = t, this.config = gi(e, this.core.getTheme()), this.isDraft = s, this.element = this.createElement(), rt(this.element, this);
978
987
  const o = this.getElement();
979
- x(this, et, o.findOne(".rect")), x(this, X, o.findOne(".marker-group")), x(this, mt, r(this, X).findOne("Circle")), x(this, at, r(this, X).findOne("Text")), E(this, $t, Hi).call(this), x(this, _t, () => {
988
+ C(this, at, o.findOne(".rect")), C(this, K, o.findOne(".marker-group")), C(this, mt, r(this, K).findOne("Circle")), C(this, lt, r(this, K).findOne("Text")), E(this, $t, Hi).call(this), C(this, _t, () => {
980
989
  E(this, $t, Fi).call(this);
981
- }), this.core.on("viewport:scale:change", r(this, _t)), x(this, Mt, (a) => {
982
- const h = a.includes(this.config.id);
983
- this.setFocusState(h);
990
+ }), this.core.on("viewport:scale:change", r(this, _t)), C(this, Mt, (a) => {
991
+ const l = a.includes(this.config.id);
992
+ this.setFocusState(l);
984
993
  }), this.core.on("nodes:selected", r(this, Mt));
985
994
  }
986
995
  getID() {
@@ -990,14 +999,14 @@ class Es extends st {
990
999
  return this.config;
991
1000
  }
992
1001
  createElement() {
993
- const t = Math.max(this.config.width ?? N.MIN_SIZE, N.MIN_SIZE), e = Math.max(this.config.height ?? N.MIN_SIZE, N.MIN_SIZE), s = new _.Group({
1002
+ const t = Math.max(this.config.width ?? N.MIN_SIZE, N.MIN_SIZE), e = Math.max(this.config.height ?? N.MIN_SIZE, N.MIN_SIZE), s = new M.Group({
994
1003
  id: this.config.id,
995
1004
  name: `${b.nodeRoot} ${b.imageMarker} ${this.config.$_parentId}`,
996
1005
  x: this.config.x,
997
1006
  y: this.config.y,
998
1007
  width: t,
999
1008
  height: e
1000
- }), o = this.core.getStageScale(), a = 2 / o, h = [5 / o, 5 / o], l = N.CORNER_RADIUS / o, d = new _.Rect({
1009
+ }), o = this.core.getStageScale(), a = 2 / o, l = N.CORNER_RADIUS / o, h = new M.Rect({
1001
1010
  name: "rect",
1002
1011
  x: 0,
1003
1012
  y: 0,
@@ -1005,20 +1014,20 @@ class Es extends st {
1005
1014
  height: e,
1006
1015
  stroke: this.config.markerColor,
1007
1016
  strokeWidth: a,
1008
- dash: h,
1017
+ // dash: rectDash,
1009
1018
  cornerRadius: l,
1010
1019
  listening: !1
1011
- }), f = new _.Group({
1020
+ }), d = new M.Group({
1012
1021
  name: "marker-group",
1013
1022
  x: t,
1014
1023
  y: e,
1015
1024
  visible: !this.isDraft
1016
- }), m = 14 / o, u = 3 / o, y = 16 / o, w = new _.Circle({
1025
+ }), m = 14 / o, f = 3 / o, g = 16 / o, y = new M.Circle({
1017
1026
  radius: m,
1018
1027
  fill: this.config.markerColor,
1019
1028
  stroke: "white",
1020
- strokeWidth: u
1021
- }), v = new _.Text({
1029
+ strokeWidth: f
1030
+ }), x = new M.Text({
1022
1031
  x: -m,
1023
1032
  y: -m,
1024
1033
  width: m * 2,
@@ -1026,10 +1035,10 @@ class Es extends st {
1026
1035
  text: String(this.config.$_markerNumber || ""),
1027
1036
  align: "center",
1028
1037
  verticalAlign: "middle",
1029
- fontSize: y,
1038
+ fontSize: g,
1030
1039
  fill: "white"
1031
1040
  });
1032
- return f.add(w), f.add(v), s.add(d), s.add(f), s;
1041
+ return d.add(y), d.add(x), s.add(h), s.add(d), s;
1033
1042
  }
1034
1043
  /**
1035
1044
  * 获取 Konva.Group 实例
@@ -1051,7 +1060,7 @@ class Es extends st {
1051
1060
  const e = this.getElement();
1052
1061
  e.x(this.config.x), e.y(this.config.y);
1053
1062
  const s = Math.max(this.config.width ?? N.MIN_SIZE, N.MIN_SIZE), o = Math.max(this.config.height ?? N.MIN_SIZE, N.MIN_SIZE);
1054
- e.width(s), e.height(o), r(this, et).width(s), r(this, et).height(o), r(this, X).x(s), r(this, X).y(o), t.markerColor && (r(this, et).stroke(t.markerColor), r(this, mt).fill(t.markerColor)), t.$_markerNumber !== void 0 && r(this, at).text(String(t.$_markerNumber));
1063
+ e.width(s), e.height(o), r(this, at).width(s), r(this, at).height(o), r(this, K).x(s), r(this, K).y(o), t.markerColor && (r(this, at).stroke(t.markerColor), r(this, mt).fill(t.markerColor)), t.$_markerNumber !== void 0 && r(this, lt).text(String(t.$_markerNumber));
1055
1064
  }
1056
1065
  /**
1057
1066
  * 销毁
@@ -1064,7 +1073,7 @@ class Es extends st {
1064
1073
  */
1065
1074
  setFocusState(t) {
1066
1075
  const e = this.core.getStageScale(), s = t ? 4 / e : 3 / e, o = t ? 1.2 : 1;
1067
- r(this, et).strokeWidth(s), r(this, mt).strokeWidth(s), r(this, X).scaleX(o), r(this, X).scaleY(o);
1076
+ r(this, at).strokeWidth(s), r(this, mt).strokeWidth(s), r(this, K).scaleX(o), r(this, K).scaleY(o);
1068
1077
  }
1069
1078
  syncConfigFromElement() {
1070
1079
  const t = this.getElement();
@@ -1077,22 +1086,22 @@ class Es extends st {
1077
1086
  };
1078
1087
  }
1079
1088
  }
1080
- et = new WeakMap(), X = new WeakMap(), mt = new WeakMap(), at = new WeakMap(), _t = new WeakMap(), Mt = new WeakMap(), $t = new WeakSet(), /**
1089
+ at = new WeakMap(), K = new WeakMap(), mt = new WeakMap(), lt = new WeakMap(), _t = new WeakMap(), Mt = new WeakMap(), $t = new WeakSet(), /**
1081
1090
  * 更新标记点的缩放以保持视觉大小不变
1082
1091
  */
1083
1092
  Fi = function() {
1084
- const t = this.core.getStageScale(), e = 14 / t, s = 3 / t, o = 16 / t, a = 3 / t, h = [5 / t, 5 / t], l = N.CORNER_RADIUS / t;
1085
- r(this, et).strokeWidth(a), r(this, et).dash(h), r(this, et).cornerRadius(l), r(this, mt).radius(e), r(this, mt).strokeWidth(s), r(this, at).x(-e), r(this, at).y(-e), r(this, at).width(e * 2), r(this, at).height(e * 2), r(this, at).fontSize(o);
1093
+ const t = this.core.getStageScale(), e = 14 / t, s = 3 / t, o = 16 / t, a = 3 / t, l = N.CORNER_RADIUS / t;
1094
+ r(this, at).strokeWidth(a), r(this, at).cornerRadius(l), r(this, mt).radius(e), r(this, mt).strokeWidth(s), r(this, lt).x(-e), r(this, lt).y(-e), r(this, lt).width(e * 2), r(this, lt).height(e * 2), r(this, lt).fontSize(o);
1086
1095
  }, /**
1087
1096
  * 设置事件处理器
1088
1097
  */
1089
1098
  Hi = function() {
1090
- r(this, X).on("pointerover", () => {
1099
+ r(this, K).on("pointerover", () => {
1091
1100
  this.setFocusState(!0), this.core._setCursor("pointer");
1092
- }), r(this, X).on("pointerout", () => {
1101
+ }), r(this, K).on("pointerout", () => {
1093
1102
  const e = (this.core.getState().selectedNodeIds || []).includes(this.config.id);
1094
1103
  this.setFocusState(e), this.core._resetCursor();
1095
- }), r(this, X).on("pointerdown", () => {
1104
+ }), r(this, K).on("pointerdown", () => {
1096
1105
  this.core._selectNodes([this.config.id]);
1097
1106
  });
1098
1107
  };
@@ -1100,17 +1109,17 @@ var gt, Vt, xe, Li;
1100
1109
  class Ss extends st {
1101
1110
  constructor(t, e, s = !1) {
1102
1111
  super();
1103
- g(this, xe);
1112
+ u(this, xe);
1104
1113
  p(this, "core");
1105
1114
  p(this, "config");
1106
1115
  p(this, "element");
1107
1116
  p(this, "isDraft");
1108
1117
  p(this, "htmlElement");
1109
- g(this, gt, () => {
1118
+ u(this, gt, () => {
1110
1119
  const t = this.element.getClientRect();
1111
1120
  this.htmlElement.style.left = `${t.x}px`, this.htmlElement.style.top = `${t.y}px`, this.htmlElement.style.width = `${t.width}px`, this.htmlElement.style.height = `${t.height}px`;
1112
1121
  });
1113
- g(this, Vt, ({ type: t }) => {
1122
+ u(this, Vt, ({ type: t }) => {
1114
1123
  const e = t === "select";
1115
1124
  this.element.listening(e && (this.config.$_listening ?? !0));
1116
1125
  });
@@ -1129,7 +1138,7 @@ class Ss extends st {
1129
1138
  this.config = e;
1130
1139
  }
1131
1140
  createElement() {
1132
- return new _.Rect(this.config);
1141
+ return new M.Rect(this.config);
1133
1142
  }
1134
1143
  /**
1135
1144
  * 获取 Konva.Rect 实例
@@ -1176,50 +1185,50 @@ var Ot, we, be, Di;
1176
1185
  class Ns extends st {
1177
1186
  constructor(t, e, s = !1) {
1178
1187
  super();
1179
- g(this, be);
1188
+ u(this, be);
1180
1189
  p(this, "core");
1181
1190
  p(this, "config");
1182
1191
  p(this, "element");
1183
1192
  p(this, "isDraft");
1184
1193
  p(this, "rect");
1185
- g(this, Ot, ({ type: t }) => {
1194
+ u(this, Ot, ({ type: t }) => {
1186
1195
  const e = t === "select";
1187
1196
  this.element.listening(e && (this.config.$_listening ?? !0));
1188
1197
  });
1189
1198
  /**
1190
1199
  * 编辑文字
1191
1200
  */
1192
- g(this, we, () => {
1201
+ u(this, we, () => {
1193
1202
  const t = this.element, e = this.core.getCanvasTransformer(), s = t.getClientRect(), o = document.createElement("textarea");
1194
1203
  this.core.getStage().getContent().appendChild(o), o.name = "text-editor", o.draggable = !1, o.value = t.text(), o.style.position = "absolute", o.style.top = s.y + "px", o.style.left = s.x + "px", o.style.minWidth = "2px", o.style.fieldSizing = "content", o.style.whiteSpace = "nowrap", o.style.height = t.height() + "px", o.style.fontSize = t.fontSize() + "px", o.style.border = "none", o.style.padding = "0px", o.style.margin = "0px", o.style.overflow = "hidden", o.style.background = "none", o.style.outline = "none", o.style.resize = "none", o.style.lineHeight = t.lineHeight().toString(), o.style.fontFamily = t.fontFamily(), o.style.transformOrigin = "left top", o.style.textAlign = t.align(), o.style.color = t.fill().toString();
1195
1204
  const a = t.rotation();
1196
- let h = "";
1197
- a && (h += "rotateZ(" + a + "deg)"), o.style.transform = h + `scale(${t.getAbsoluteScale().x})`, o.focus();
1198
- const l = () => {
1199
- this.core.off("viewport:change", f), o.parentNode?.removeChild(o), window.removeEventListener("click", d), window.removeEventListener("touchstart", d), t.show(), e.getTransformer().show(), e.getTransformer().forceUpdate();
1205
+ let l = "";
1206
+ a && (l += "rotateZ(" + a + "deg)"), o.style.transform = l + `scale(${t.getAbsoluteScale().x})`, o.focus();
1207
+ const h = () => {
1208
+ this.core.off("viewport:change", m), o.parentNode?.removeChild(o), window.removeEventListener("click", d), window.removeEventListener("touchstart", d), t.show(), e.getTransformer().show(), e.getTransformer().forceUpdate();
1200
1209
  };
1201
- o.addEventListener("keydown", function(m) {
1202
- if (m.key === "Escape") {
1203
- const u = o.value;
1204
- t.text(o.value), l(), u.trim() || t.destroy();
1210
+ o.addEventListener("keydown", function(f) {
1211
+ if (f.key === "Escape") {
1212
+ const g = o.value;
1213
+ t.text(o.value), h(), g.trim() || t.destroy();
1205
1214
  }
1206
1215
  }), o.addEventListener("keydown", function() {
1207
1216
  o.style.height = "auto", o.style.height = o.scrollHeight + t.fontSize() * t.lineHeight() + "px";
1208
1217
  });
1209
- const d = (m) => {
1210
- m.target !== o && (t.text(o.value), l());
1211
- }, f = () => {
1212
- const m = t.getClientRect();
1213
- o.style.top = m.y + "px", o.style.left = m.x + "px";
1214
- const u = t.rotation();
1218
+ const d = (f) => {
1219
+ f.target !== o && (t.text(o.value), h());
1220
+ }, m = () => {
1221
+ const f = t.getClientRect();
1222
+ o.style.top = f.y + "px", o.style.left = f.x + "px";
1223
+ const g = t.rotation();
1215
1224
  let y = "";
1216
- u && (y += "rotateZ(" + u + "deg)"), o.style.transform = y + `scale(${t.getAbsoluteScale().x})`;
1225
+ g && (y += "rotateZ(" + g + "deg)"), o.style.transform = y + `scale(${t.getAbsoluteScale().x})`;
1217
1226
  };
1218
1227
  setTimeout(() => {
1219
- this.core.on("viewport:change", f), window.addEventListener("click", d), window.addEventListener("touchstart", d);
1228
+ this.core.on("viewport:change", m), window.addEventListener("click", d), window.addEventListener("touchstart", d);
1220
1229
  });
1221
1230
  });
1222
- this.core = t, this.config = mi(e, this.core.getTheme()), this.element = this.createElement(), this.rect = new _.Rect(this.config), rt(this.element, this), this.isDraft = s, E(this, be, Di).call(this), setTimeout(() => {
1231
+ this.core = t, this.config = mi(e, this.core.getTheme()), this.element = this.createElement(), this.rect = new M.Rect(this.config), rt(this.element, this), this.isDraft = s, E(this, be, Di).call(this), setTimeout(() => {
1223
1232
  r(this, we).call(this);
1224
1233
  });
1225
1234
  }
@@ -1234,7 +1243,7 @@ class Ns extends st {
1234
1243
  this.config = e;
1235
1244
  }
1236
1245
  createElement() {
1237
- return new _.Text(this.config);
1246
+ return new M.Text(this.config);
1238
1247
  }
1239
1248
  /**
1240
1249
  * 获取 Konva.Text 实例
@@ -1279,7 +1288,7 @@ var It, ft, Ee, Zt, Ut, zt, Wt, Se, Pi;
1279
1288
  class Ts extends st {
1280
1289
  constructor(t, e, s = !1) {
1281
1290
  super();
1282
- g(this, Se);
1291
+ u(this, Se);
1283
1292
  p(this, "core");
1284
1293
  p(this, "config");
1285
1294
  p(this, "element");
@@ -1308,7 +1317,7 @@ class Ts extends st {
1308
1317
  window.addEventListener("click", r(this, Wt));
1309
1318
  }), window.addEventListener("keydown", r(this, zt));
1310
1319
  });
1311
- g(this, It, async () => {
1320
+ u(this, It, async () => {
1312
1321
  const t = this.htmlEditorElement.getBoundingClientRect();
1313
1322
  if (t.width === 0 || t.height === 0)
1314
1323
  return;
@@ -1339,11 +1348,11 @@ class Ts extends st {
1339
1348
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !1);
1340
1349
  }));
1341
1350
  });
1342
- g(this, ft, () => {
1351
+ u(this, ft, () => {
1343
1352
  const t = this.element.getClientRect();
1344
1353
  this.htmlElement.style.left = `${t.x}px`, this.htmlElement.style.top = `${t.y}px`, this.config.lockX ? this.htmlEditorElement.style.width = `${this.element.width() / this.config.htmlScale * this.config.scaleWhenCreate}px` : this.htmlEditorElement.style.width = "max-content", this.htmlEditorElement.style.transform = `scale(${this.config.htmlScale})`;
1345
1354
  });
1346
- g(this, Ee, () => {
1355
+ u(this, Ee, () => {
1347
1356
  this.resizeObserver = new ResizeObserver((t) => {
1348
1357
  for (const e of t) {
1349
1358
  let s = !1;
@@ -1354,18 +1363,18 @@ class Ts extends st {
1354
1363
  }
1355
1364
  }), this.resizeObserver.observe(this.htmlEditorElement);
1356
1365
  });
1357
- g(this, Zt, ({ type: t }) => {
1366
+ u(this, Zt, ({ type: t }) => {
1358
1367
  const e = t === "select";
1359
1368
  this.element.listening(e && (this.config.$_listening ?? !0));
1360
1369
  });
1361
- g(this, Ut, (t) => {
1370
+ u(this, Ut, (t) => {
1362
1371
  const e = this.element.getClientRect();
1363
1372
  this.htmlElement.style.left = `${e.x}px`, this.htmlElement.style.top = `${e.y}px`, this.htmlElement.style.transform = `scale(${this.core.getState().viewport.scale / this.config.scaleWhenCreate})`;
1364
1373
  });
1365
- g(this, zt, (t) => {
1374
+ u(this, zt, (t) => {
1366
1375
  t.key === "Escape" && this.detachEditor();
1367
1376
  });
1368
- g(this, Wt, (t) => {
1377
+ u(this, Wt, (t) => {
1369
1378
  const e = t.target;
1370
1379
  this.htmlElement.contains(e) || this.detachEditor();
1371
1380
  });
@@ -1384,7 +1393,7 @@ class Ts extends st {
1384
1393
  delete e.image, this.config = e;
1385
1394
  }
1386
1395
  createElement() {
1387
- return new _.Image({ ...this.config });
1396
+ return new M.Image({ ...this.config });
1388
1397
  }
1389
1398
  /**
1390
1399
  * 获取 Konva.Rect 实例
@@ -1441,7 +1450,7 @@ var Et, De, Xt, Yt, Bi;
1441
1450
  class _s extends st {
1442
1451
  constructor(t, e, s = !1) {
1443
1452
  super();
1444
- g(this, Et);
1453
+ u(this, Et);
1445
1454
  p(this, "core");
1446
1455
  p(this, "config");
1447
1456
  p(this, "element");
@@ -1449,16 +1458,16 @@ class _s extends st {
1449
1458
  p(this, "imgCover");
1450
1459
  p(this, "playIcon");
1451
1460
  p(this, "isDraft");
1452
- g(this, Xt, ({ type: t }) => {
1461
+ u(this, Xt, ({ type: t }) => {
1453
1462
  const e = t === "select";
1454
1463
  this.element.listening(e && (this.config.$_listening ?? !0));
1455
1464
  });
1456
- g(this, Yt, () => {
1465
+ u(this, Yt, () => {
1457
1466
  this.getElement().getLayer() && this.core._rebuildStateAfterNodeChange([this], !0);
1458
1467
  });
1459
1468
  this.core = t, this.config = di(e, this.core.getTheme());
1460
- const { group: o, image: a, imgCover: h, playIcon: l } = this.createElement();
1461
- this.element = o, this.cover = a, this.imgCover = h, this.playIcon = l, this.element = o, rt(this.element, this), this.isDraft = s, E(this, Et, De).call(this), E(this, Et, Bi).call(this, this.getElement());
1469
+ const { group: o, image: a, imgCover: l, playIcon: h } = this.createElement();
1470
+ this.element = o, this.cover = a, this.imgCover = l, this.playIcon = h, this.element = o, rt(this.element, this), this.isDraft = s, E(this, Et, De).call(this), E(this, Et, Bi).call(this, this.getElement());
1462
1471
  }
1463
1472
  getID() {
1464
1473
  return this.config.id;
@@ -1470,11 +1479,11 @@ class _s extends st {
1470
1479
  this.config = e;
1471
1480
  }
1472
1481
  createElement() {
1473
- const t = new _.Group({
1482
+ const t = new M.Group({
1474
1483
  ...this.config,
1475
1484
  width: void 0,
1476
1485
  height: void 0
1477
- }), e = new _.Image({
1486
+ }), e = new M.Image({
1478
1487
  ...this.config,
1479
1488
  name: "",
1480
1489
  id: `${this.config.id}-image`,
@@ -1483,7 +1492,7 @@ class _s extends st {
1483
1492
  listening: !1
1484
1493
  });
1485
1494
  t.add(e);
1486
- const s = new _.Rect({
1495
+ const s = new M.Rect({
1487
1496
  name: "",
1488
1497
  x: 0,
1489
1498
  y: 0,
@@ -1493,7 +1502,7 @@ class _s extends st {
1493
1502
  listening: !1
1494
1503
  });
1495
1504
  t.add(s);
1496
- const o = new _.RegularPolygon({
1505
+ const o = new M.RegularPolygon({
1497
1506
  x: this.config.width / 2,
1498
1507
  // 微调使其视觉居中
1499
1508
  y: this.config.height / 2,
@@ -1557,7 +1566,7 @@ De = function() {
1557
1566
  e.crossOrigin = "anonymous", e.src = t, e.onload = () => {
1558
1567
  this.cover.image(e);
1559
1568
  let s = this.config.width ?? e.width, o = this.config.height ?? e.height;
1560
- s = Math.max(s, Q.MIN_SIZE), o = Math.max(o, Q.MIN_SIZE), this.cover.width(s), this.cover.height(o), this.imgCover.width(s), this.imgCover.height(o), this.playIcon.x(s / 2), this.playIcon.y(o / 2);
1569
+ s = Math.max(s, tt.MIN_SIZE), o = Math.max(o, tt.MIN_SIZE), this.cover.width(s), this.cover.height(o), this.imgCover.width(s), this.imgCover.height(o), this.playIcon.x(s / 2), this.playIcon.y(o / 2);
1561
1570
  }, e.onerror = () => {
1562
1571
  console.error("Failed to load image:", t);
1563
1572
  };
@@ -1566,8 +1575,8 @@ De = function() {
1566
1575
  */
1567
1576
  Bi = function(t) {
1568
1577
  this.core.on("toolType:change", r(this, Xt)), t.on("transform", (e) => {
1569
- const s = e.target, o = Math.max(Q.MIN_SIZE, this.cover.width() * s.scaleX()), a = Math.max(
1570
- Q.MIN_SIZE,
1578
+ const s = e.target, o = Math.max(tt.MIN_SIZE, this.cover.width() * s.scaleX()), a = Math.max(
1579
+ tt.MIN_SIZE,
1571
1580
  this.cover.height() * s.scaleY()
1572
1581
  );
1573
1582
  this.cover.width(o), this.cover.height(a), this.imgCover.width(o), this.imgCover.height(a), this.playIcon.x(o / 2), this.playIcon.y(a / 2), t.scale({ x: 1, y: 1 });
@@ -1581,12 +1590,12 @@ var Gt, Ne, Vi;
1581
1590
  class Ms extends st {
1582
1591
  constructor(t, e, s = !1) {
1583
1592
  super();
1584
- g(this, Ne);
1593
+ u(this, Ne);
1585
1594
  p(this, "core");
1586
1595
  p(this, "config");
1587
1596
  p(this, "element");
1588
1597
  p(this, "isDraft");
1589
- g(this, Gt, ({ type: t }) => {
1598
+ u(this, Gt, ({ type: t }) => {
1590
1599
  const e = t === "select";
1591
1600
  this.element.listening(e && (this.config.$_listening ?? !0));
1592
1601
  });
@@ -1603,7 +1612,7 @@ class Ms extends st {
1603
1612
  this.config = e;
1604
1613
  }
1605
1614
  createElement() {
1606
- return new _.Star(this.config);
1615
+ return new M.Star(this.config);
1607
1616
  }
1608
1617
  /**
1609
1618
  * 获取 Konva.Star 实例
@@ -1655,12 +1664,12 @@ var Kt, Te, Oi;
1655
1664
  class ks extends st {
1656
1665
  constructor(t, e, s = !1) {
1657
1666
  super();
1658
- g(this, Te);
1667
+ u(this, Te);
1659
1668
  p(this, "core");
1660
1669
  p(this, "config");
1661
1670
  p(this, "element");
1662
1671
  p(this, "isDraft");
1663
- g(this, Kt, ({ type: t }) => {
1672
+ u(this, Kt, ({ type: t }) => {
1664
1673
  const e = t === "select";
1665
1674
  this.element.listening(e && (this.config.$_listening ?? !0));
1666
1675
  });
@@ -1677,7 +1686,7 @@ class ks extends st {
1677
1686
  this.config = e;
1678
1687
  }
1679
1688
  createElement() {
1680
- return new _.Ellipse(this.config);
1689
+ return new M.Ellipse(this.config);
1681
1690
  }
1682
1691
  /**
1683
1692
  * 获取 Konva.Ellipse 实例
@@ -1728,12 +1737,12 @@ var qt, _e, Zi;
1728
1737
  class $s extends st {
1729
1738
  constructor(t, e, s = !1) {
1730
1739
  super();
1731
- g(this, _e);
1740
+ u(this, _e);
1732
1741
  p(this, "core");
1733
1742
  p(this, "config");
1734
1743
  p(this, "element");
1735
1744
  p(this, "isDraft");
1736
- g(this, qt, ({ type: t }) => {
1745
+ u(this, qt, ({ type: t }) => {
1737
1746
  const e = t === "select";
1738
1747
  this.element.listening(e && (this.config.$_listening ?? !0));
1739
1748
  });
@@ -1750,7 +1759,7 @@ class $s extends st {
1750
1759
  this.config = e;
1751
1760
  }
1752
1761
  createElement() {
1753
- return new _.Line(this.config);
1762
+ return new M.Line(this.config);
1754
1763
  }
1755
1764
  /**
1756
1765
  * 获取 Konva.Line 实例
@@ -1785,35 +1794,35 @@ Zi = function() {
1785
1794
  this.core.on("toolType:change", r(this, qt)), t.on("transform", (e) => {
1786
1795
  const s = e.target, { width: o, height: a } = Rs(s);
1787
1796
  s.scale({ x: 1, y: 1 }), s.width(o), s.height(a);
1788
- const h = ki(
1797
+ const l = ki(
1789
1798
  { x: s.x(), y: s.y(), width: o, height: a },
1790
1799
  this.config.$_shape
1791
1800
  );
1792
- s.points(h.flatMap((l) => [l.x, l.y]));
1801
+ s.points(l.flatMap((h) => [h.x, h.y]));
1793
1802
  }), t.on("transformend", (e) => {
1794
1803
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !0);
1795
1804
  }), t.on("dragend", (e) => {
1796
1805
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !0);
1797
1806
  });
1798
1807
  };
1799
- var A, F, wt, bt, P, Ui, Nt, zi, Wi, jt, Xi;
1808
+ var H, L, wt, bt, V, Ui, Nt, zi, Wi, jt, Xi;
1800
1809
  class As extends st {
1801
1810
  constructor(t, e, s = !1) {
1802
1811
  super();
1803
- g(this, P);
1812
+ u(this, V);
1804
1813
  p(this, "core");
1805
1814
  p(this, "config");
1806
1815
  p(this, "element");
1807
1816
  p(this, "isDraft");
1808
- g(this, A, null);
1809
- g(this, F, null);
1810
- g(this, wt, null);
1811
- g(this, bt, null);
1812
- g(this, jt, ({ type: t }) => {
1817
+ u(this, H, null);
1818
+ u(this, L, null);
1819
+ u(this, wt, null);
1820
+ u(this, bt, null);
1821
+ u(this, jt, ({ type: t }) => {
1813
1822
  const e = t === "select";
1814
1823
  this.element.listening(e && (this.config.$_listening ?? !0));
1815
1824
  });
1816
- this.core = t, this.config = Ci(e, this.core.getTheme()), this.element = this.createElement(), rt(this.element, this), this.isDraft = s, E(this, P, Ui).call(this), E(this, P, Xi).call(this);
1825
+ this.core = t, this.config = Ci(e, this.core.getTheme()), this.element = this.createElement(), rt(this.element, this), this.isDraft = s, E(this, V, Ui).call(this), E(this, V, Xi).call(this);
1817
1826
  }
1818
1827
  getID() {
1819
1828
  return this.config.id;
@@ -1826,7 +1835,7 @@ class As extends st {
1826
1835
  this.config = e;
1827
1836
  }
1828
1837
  createElement() {
1829
- return new _.Arrow(this.config);
1838
+ return new M.Arrow(this.config);
1830
1839
  }
1831
1840
  /**
1832
1841
  * 获取 Konva.Arrow 实例
@@ -1844,23 +1853,23 @@ class As extends st {
1844
1853
  ...t
1845
1854
  },
1846
1855
  this.core.getTheme()
1847
- ), this.getElement().setAttrs(this.config), E(this, P, Nt).call(this);
1856
+ ), this.getElement().setAttrs(this.config), E(this, V, Nt).call(this);
1848
1857
  }
1849
1858
  /**
1850
1859
  * 销毁
1851
1860
  */
1852
1861
  destroy() {
1853
- this.core.off("toolType:change", r(this, jt)), r(this, bt) && this.core.off("nodes:selected", r(this, bt)), r(this, wt) && this.core.off("viewport:scale:change", r(this, wt)), r(this, A)?.destroy(), r(this, F)?.destroy(), this.element.destroy();
1862
+ this.core.off("toolType:change", r(this, jt)), r(this, bt) && this.core.off("nodes:selected", r(this, bt)), r(this, wt) && this.core.off("viewport:scale:change", r(this, wt)), r(this, H)?.destroy(), r(this, L)?.destroy(), this.element.destroy();
1854
1863
  }
1855
1864
  }
1856
- A = new WeakMap(), F = new WeakMap(), wt = new WeakMap(), bt = new WeakMap(), P = new WeakSet(), /**
1865
+ H = new WeakMap(), L = new WeakMap(), wt = new WeakMap(), bt = new WeakMap(), V = new WeakSet(), /**
1857
1866
  * 创建起点和终点的控制锚点
1858
1867
  */
1859
1868
  Ui = function() {
1860
1869
  const t = this.core.getMainLayer();
1861
1870
  if (!t) return;
1862
1871
  const e = this.core.getStageScale(), s = 6 / e, o = 2 / e;
1863
- x(this, A, new _.Circle({
1872
+ C(this, H, new M.Circle({
1864
1873
  radius: s,
1865
1874
  fill: "white",
1866
1875
  stroke: "#1976d2",
@@ -1868,7 +1877,7 @@ Ui = function() {
1868
1877
  draggable: !0,
1869
1878
  visible: !1,
1870
1879
  name: "arrow-anchor"
1871
- })), x(this, F, new _.Circle({
1880
+ })), C(this, L, new M.Circle({
1872
1881
  radius: s,
1873
1882
  fill: "white",
1874
1883
  stroke: "#1976d2",
@@ -1876,33 +1885,33 @@ Ui = function() {
1876
1885
  draggable: !0,
1877
1886
  visible: !1,
1878
1887
  name: "arrow-anchor"
1879
- })), t.add(r(this, A)), t.add(r(this, F)), E(this, P, Nt).call(this), r(this, A).on("dragmove", () => {
1888
+ })), t.add(r(this, H)), t.add(r(this, L)), E(this, V, Nt).call(this), r(this, H).on("dragmove", () => {
1880
1889
  const a = [...this.element.points()];
1881
1890
  if (a.length < 4) return;
1882
- const h = this.element, l = r(this, A).position();
1883
- a[0] = l.x - h.x(), a[1] = l.y - h.y(), h.points(a), this.core.getCanvasTransformer().emitPositionChange();
1884
- }), r(this, A).on("dragend", () => {
1891
+ const l = this.element, h = r(this, H).position();
1892
+ a[0] = h.x - l.x(), a[1] = h.y - l.y(), l.points(a), this.core.getCanvasTransformer().emitPositionChange();
1893
+ }), r(this, H).on("dragend", () => {
1885
1894
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !0);
1886
- }), r(this, F).on("dragmove", () => {
1895
+ }), r(this, L).on("dragmove", () => {
1887
1896
  const a = [...this.element.points()];
1888
1897
  if (a.length < 4) return;
1889
- const h = this.element, l = r(this, F).position();
1890
- a[a.length - 2] = l.x - h.x(), a[a.length - 1] = l.y - h.y(), h.points(a), this.core.getCanvasTransformer().emitPositionChange();
1891
- }), r(this, F).on("dragend", () => {
1898
+ const l = this.element, h = r(this, L).position();
1899
+ a[a.length - 2] = h.x - l.x(), a[a.length - 1] = h.y - l.y(), l.points(a), this.core.getCanvasTransformer().emitPositionChange();
1900
+ }), r(this, L).on("dragend", () => {
1892
1901
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !0);
1893
1902
  });
1894
1903
  }, /**
1895
1904
  * 更新锚点位置
1896
1905
  */
1897
1906
  Nt = function() {
1898
- if (!r(this, A) || !r(this, F)) return;
1907
+ if (!r(this, H) || !r(this, L)) return;
1899
1908
  const t = this.element.points();
1900
1909
  if (t.length < 4) return;
1901
1910
  const e = this.element, s = e.x(), o = e.y();
1902
- r(this, A).position({
1911
+ r(this, H).position({
1903
1912
  x: s + t[0],
1904
1913
  y: o + t[1]
1905
- }), r(this, F).position({
1914
+ }), r(this, L).position({
1906
1915
  x: s + t[t.length - 2],
1907
1916
  y: o + t[t.length - 1]
1908
1917
  });
@@ -1910,31 +1919,31 @@ Nt = function() {
1910
1919
  * 更新锚点样式(根据缩放调整大小)
1911
1920
  */
1912
1921
  zi = function() {
1913
- if (!r(this, A) || !r(this, F)) return;
1922
+ if (!r(this, H) || !r(this, L)) return;
1914
1923
  const t = this.core.getStageScale(), e = 6 / t, s = 2 / t;
1915
- r(this, A).radius(e), r(this, A).strokeWidth(s), r(this, F).radius(e), r(this, F).strokeWidth(s);
1924
+ r(this, H).radius(e), r(this, H).strokeWidth(s), r(this, L).radius(e), r(this, L).strokeWidth(s);
1916
1925
  }, /**
1917
1926
  * 显示或隐藏锚点
1918
1927
  */
1919
1928
  Wi = function(t) {
1920
- !r(this, A) || !r(this, F) || (r(this, A).visible(t), r(this, F).visible(t), t && (E(this, P, Nt).call(this), r(this, A).moveToTop(), r(this, F).moveToTop()));
1929
+ !r(this, H) || !r(this, L) || (r(this, H).visible(t), r(this, L).visible(t), t && (E(this, V, Nt).call(this), r(this, H).moveToTop(), r(this, L).moveToTop()));
1921
1930
  }, jt = new WeakMap(), /**
1922
1931
  * 设置事件处理器
1923
1932
  */
1924
1933
  Xi = function() {
1925
1934
  const t = this.getElement();
1926
- this.core.on("toolType:change", r(this, jt)), x(this, bt, (e) => {
1935
+ this.core.on("toolType:change", r(this, jt)), C(this, bt, (e) => {
1927
1936
  const s = e.includes(this.config.id);
1928
- E(this, P, Wi).call(this, s);
1929
- }), this.core.on("nodes:selected", r(this, bt)), x(this, wt, () => {
1930
- E(this, P, zi).call(this);
1937
+ E(this, V, Wi).call(this, s);
1938
+ }), this.core.on("nodes:selected", r(this, bt)), C(this, wt, () => {
1939
+ E(this, V, zi).call(this);
1931
1940
  }), this.core.on("viewport:scale:change", r(this, wt)), t.on("transform", (e) => {
1932
- const s = e.target, o = s.scaleX(), a = s.scaleY(), l = s.points().map((d, f) => f % 2 === 0 ? d * o : d * a);
1933
- s.points(l), s.scale({ x: 1, y: 1 }), E(this, P, Nt).call(this);
1941
+ const s = e.target, o = s.scaleX(), a = s.scaleY(), h = s.points().map((d, m) => m % 2 === 0 ? d * o : d * a);
1942
+ s.points(h), s.scale({ x: 1, y: 1 }), E(this, V, Nt).call(this);
1934
1943
  }), t.on("transformend", () => {
1935
1944
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !0);
1936
1945
  }), t.on("dragmove", () => {
1937
- E(this, P, Nt).call(this);
1946
+ E(this, V, Nt).call(this);
1938
1947
  }), t.on("dragend", () => {
1939
1948
  this.syncConfigFromElement(), this.core._rebuildStateAfterNodeChange(this, !0);
1940
1949
  });
@@ -2064,7 +2073,7 @@ function ee(n, i) {
2064
2073
  { x: s, y: o }
2065
2074
  ];
2066
2075
  }
2067
- var kt, D, j, it, H, Rt, Y, G, lt, pt, Me, U, Yi, Gi, Pe, Be, Ki;
2076
+ var kt, B, J, it, D, Rt, q, j, ht, pt, Me, W, Yi, Gi, Pe, Be, Ki;
2068
2077
  class Ls extends ps {
2069
2078
  constructor(t, e) {
2070
2079
  const s = e?.state, o = {
@@ -2079,29 +2088,29 @@ class Ls extends ps {
2079
2088
  }
2080
2089
  };
2081
2090
  super(o);
2082
- g(this, U);
2083
- g(this, kt);
2084
- g(this, D);
2085
- g(this, j);
2086
- g(this, it);
2087
- g(this, H, null);
2088
- g(this, Rt);
2089
- g(this, Y, null);
2090
- g(this, G, null);
2091
+ u(this, W);
2092
+ u(this, kt);
2093
+ u(this, B);
2094
+ u(this, J);
2095
+ u(this, it);
2096
+ u(this, D, null);
2097
+ u(this, Rt);
2098
+ u(this, q, null);
2099
+ u(this, j, null);
2091
2100
  /** 节点映射,方便快速查找 */
2092
- g(this, lt, /* @__PURE__ */ new Map());
2093
- g(this, pt, null);
2101
+ u(this, ht, /* @__PURE__ */ new Map());
2102
+ u(this, pt, null);
2094
2103
  p(this, "isEditingText", !1);
2095
- g(this, Me, (t) => {
2104
+ u(this, Me, (t) => {
2096
2105
  (t.key === "Delete" || t.key === "Backspace") && (t.stopPropagation(), this.deleteSelectedNodes());
2097
2106
  });
2098
- x(this, kt, e?.theme ?? Ii), x(this, Rt, t), x(this, D, new ms(this, {
2107
+ C(this, kt, e?.theme ?? Ii), C(this, Rt, t), C(this, B, new ms(this, {
2099
2108
  container: t,
2100
2109
  width: t.clientWidth,
2101
2110
  height: t.clientHeight,
2102
2111
  draggable: !1,
2103
2112
  className: "touch-none"
2104
- })), x(this, j, new _.Layer()), x(this, it, new fs(this)), r(this, D).getStage().add(r(this, j)), r(this, j).add(r(this, it).getTransformer()), this._renderCanvas(o), E(this, U, Yi).call(this), E(this, U, Gi).call(this);
2113
+ })), C(this, J, new M.Layer()), C(this, it, new fs(this)), r(this, B).getStage().add(r(this, J)), r(this, J).add(r(this, it).getTransformer()), this._renderCanvas(o), E(this, W, Yi).call(this), E(this, W, Gi).call(this);
2105
2114
  }
2106
2115
  /**
2107
2116
  * 获取当前主题
@@ -2113,13 +2122,13 @@ class Ls extends ps {
2113
2122
  * 设置主题并重新渲染
2114
2123
  */
2115
2124
  setTheme(t) {
2116
- x(this, kt, t), this._renderCanvas(this.getState()), this._emit("theme:change", t);
2125
+ C(this, kt, t), this._renderCanvas(this.getState()), this._emit("theme:change", t);
2117
2126
  }
2118
2127
  /**
2119
2128
  * 获取 CanvasStage 实例
2120
2129
  */
2121
2130
  getCanvasStage() {
2122
- return r(this, D);
2131
+ return r(this, B);
2123
2132
  }
2124
2133
  /**
2125
2134
  * 获取 CanvasTransformer 实例
@@ -2137,7 +2146,7 @@ class Ls extends ps {
2137
2146
  * 获取 Konva.Stage 实例
2138
2147
  */
2139
2148
  getStage() {
2140
- return r(this, D).getStage();
2149
+ return r(this, B).getStage();
2141
2150
  }
2142
2151
  /**
2143
2152
  * 获取 Stage 容器元素
@@ -2149,7 +2158,7 @@ class Ls extends ps {
2149
2158
  * 获取主图层
2150
2159
  */
2151
2160
  getMainLayer() {
2152
- return r(this, j);
2161
+ return r(this, J);
2153
2162
  }
2154
2163
  /**
2155
2164
  * 获取当前工具类型
@@ -2180,46 +2189,46 @@ class Ls extends ps {
2180
2189
  ), this._emit("toolType:change", {
2181
2190
  type: t,
2182
2191
  meta: e
2183
- }), t === "hand" ? (r(this, D).setDraggable(!0), r(this, D).setCursor("grab")) : (r(this, D).setDraggable(!1), r(this, D).resetCursor());
2192
+ }), t === "hand" ? (r(this, B).setDraggable(!0), r(this, B).setCursor("grab")) : (r(this, B).setDraggable(!1), r(this, B).resetCursor());
2184
2193
  }
2185
2194
  /**
2186
2195
  * 根据 ID 获取 Canvas 节点实例
2187
2196
  */
2188
2197
  getCanvasNodeById(t) {
2189
- return r(this, lt).get(t) || null;
2198
+ return r(this, ht).get(t) || null;
2190
2199
  }
2191
2200
  /**
2192
2201
  * 设置是否可拖拽(内部使用)
2193
2202
  */
2194
2203
  setDraggable(t) {
2195
- r(this, D).setDraggable(t);
2204
+ r(this, B).setDraggable(t);
2196
2205
  }
2197
2206
  /**
2198
2207
  * 设置光标
2199
2208
  * @internal 仅供内部使用
2200
2209
  */
2201
2210
  _setCursor(t) {
2202
- r(this, D).setCursor(t);
2211
+ r(this, B).setCursor(t);
2203
2212
  }
2204
2213
  /**
2205
2214
  * 重置光标
2206
2215
  * @internal 仅供内部使用
2207
2216
  */
2208
2217
  _resetCursor() {
2209
- r(this, D).resetCursor();
2218
+ r(this, B).resetCursor();
2210
2219
  }
2211
2220
  /**
2212
2221
  * 获取当前 Stage 缩放比例
2213
2222
  */
2214
2223
  getStageScale() {
2215
- return r(this, D).getStage().scaleX();
2224
+ return r(this, B).getStage().scaleX();
2216
2225
  }
2217
2226
  /**
2218
2227
  * 更新视口位置
2219
2228
  * @internal 仅供内部使用,外部请使用 CanvasApi
2220
2229
  */
2221
2230
  _updateViewport(t, e = !1) {
2222
- r(this, D).setViewport(t);
2231
+ r(this, B).setViewport(t);
2223
2232
  const s = this.getState().viewport, o = {
2224
2233
  ...s,
2225
2234
  ...t
@@ -2234,54 +2243,54 @@ class Ls extends ps {
2234
2243
  createNodes(t, e) {
2235
2244
  const s = t.map((o) => wi(this, o.$_type, o, !1)).filter((o) => o !== null);
2236
2245
  s.forEach((o) => {
2237
- r(this, j).add(o.getElement());
2238
- }), E(this, U, Be).call(this, s, e), this._emit("nodes:created", t);
2246
+ r(this, J).add(o.getElement());
2247
+ }), E(this, W, Be).call(this, s, e), this._emit("nodes:created", t);
2239
2248
  }
2240
2249
  /**
2241
2250
  * 创建图片标注节点(内部使用)
2242
2251
  */
2243
2252
  createImageMarkerNode(t, e, s, o) {
2244
2253
  const a = this.getState().nodes || [];
2245
- let h = 0;
2246
- a.forEach((C) => {
2247
- C.$_type === "image-marker" && typeof C.$_markerNumber == "number" && (h = Math.max(h, C.$_markerNumber));
2254
+ let l = 0;
2255
+ a.forEach((w) => {
2256
+ w.$_type === "image-marker" && typeof w.$_markerNumber == "number" && (l = Math.max(l, w.$_markerNumber));
2248
2257
  });
2249
- const l = (e.x - o.x) / o.width, d = (e.y - o.y) / o.height, f = (s.x - o.x) / o.width, m = (s.y - o.y) / o.height, u = Math.min(e.x, s.x), y = Math.min(e.y, s.y), w = Math.abs(s.x - e.x), v = Math.abs(s.y - e.y), M = {
2258
+ const h = (e.x - o.x) / o.width, d = (e.y - o.y) / o.height, m = (s.x - o.x) / o.width, f = (s.y - o.y) / o.height, g = Math.min(e.x, s.x), y = Math.min(e.y, s.y), x = Math.abs(s.x - e.x), v = Math.abs(s.y - e.y), I = {
2250
2259
  id: Tt(),
2251
2260
  $_type: "image-marker",
2252
- x: u,
2261
+ x: g,
2253
2262
  y,
2254
- width: w,
2263
+ width: x,
2255
2264
  height: v,
2256
2265
  visible: !0,
2257
2266
  line: "dashed",
2258
2267
  $_parentId: t,
2259
- $_markerNumber: h + 1,
2268
+ $_markerNumber: l + 1,
2260
2269
  $_relativeBox: {
2261
2270
  start: {
2262
- ratioX: Math.max(0, Math.min(1, l)),
2271
+ ratioX: Math.max(0, Math.min(1, h)),
2263
2272
  ratioY: Math.max(0, Math.min(1, d))
2264
2273
  },
2265
2274
  end: {
2266
- ratioX: Math.max(0, Math.min(1, f)),
2267
- ratioY: Math.max(0, Math.min(1, m))
2275
+ ratioX: Math.max(0, Math.min(1, m)),
2276
+ ratioY: Math.max(0, Math.min(1, f))
2268
2277
  }
2269
2278
  }
2270
2279
  };
2271
- this.createNodes([M], !0);
2280
+ this.createNodes([I], !0);
2272
2281
  }
2273
2282
  /**
2274
2283
  * 在指定位置查找图片节点
2275
2284
  * @internal 仅供内部使用
2276
2285
  */
2277
2286
  _findImageAtPosition(t) {
2278
- const a = r(this, j).getChildren().filter(
2279
- (h) => !h.name().includes("imageMarker")
2280
- ).slice().sort((h, l) => l.zIndex() - h.zIndex());
2281
- for (const h of a) {
2282
- const l = h.x(), d = h.y(), f = h.width(), m = h.height();
2283
- if (t.x >= l && t.x <= l + f && t.y >= d && t.y <= d + m)
2284
- return h.getAttr("$_type") === "image" ? h : null;
2287
+ const a = r(this, J).getChildren().filter(
2288
+ (l) => !l.name().includes("imageMarker")
2289
+ ).slice().sort((l, h) => h.zIndex() - l.zIndex());
2290
+ for (const l of a) {
2291
+ const h = l.x(), d = l.y(), m = l.width(), f = l.height();
2292
+ if (t.x >= h && t.x <= h + m && t.y >= d && t.y <= d + f)
2293
+ return l.getAttr("$_type") === "image" ? l : null;
2285
2294
  }
2286
2295
  return null;
2287
2296
  }
@@ -2289,83 +2298,83 @@ class Ls extends ps {
2289
2298
  * @internal 仅供内部使用
2290
2299
  */
2291
2300
  _setDrawingPosition(t) {
2292
- x(this, G, [t, t]);
2301
+ C(this, j, [t, t]);
2293
2302
  }
2294
2303
  /**
2295
2304
  * @internal 仅供内部使用
2296
2305
  */
2297
2306
  _updateDrawingPosition(t) {
2298
- r(this, G) && (r(this, G)[1] = t);
2307
+ r(this, j) && (r(this, j)[1] = t);
2299
2308
  }
2300
2309
  /**
2301
2310
  * @internal 仅供内部使用
2302
2311
  */
2303
2312
  _createDraftNode(t, e) {
2304
- r(this, H) && r(this, H).destroy();
2313
+ r(this, D) && r(this, D).destroy();
2305
2314
  const s = Fs(
2306
2315
  t,
2307
- r(this, G)[0],
2316
+ r(this, j)[0],
2308
2317
  {
2309
2318
  ...e,
2310
2319
  ...this.getToolMeta()
2311
2320
  }
2312
2321
  );
2313
- x(this, H, wi(this, t, s, !0)), r(this, H) && r(this, j).add(r(this, H).getElement());
2322
+ C(this, D, wi(this, t, s, !0)), r(this, D) && r(this, J).add(r(this, D).getElement());
2314
2323
  }
2315
2324
  /**
2316
2325
  * @internal 仅供内部使用
2317
2326
  */
2318
2327
  _updateDraftNode() {
2319
- if (!r(this, H)) return;
2320
- const t = r(this, H).getConfig(), e = Hs(
2328
+ if (!r(this, D)) return;
2329
+ const t = r(this, D).getConfig(), e = Hs(
2321
2330
  t,
2322
- r(this, G)[1],
2323
- r(this, G)[0]
2331
+ r(this, j)[1],
2332
+ r(this, j)[0]
2324
2333
  );
2325
- r(this, H).update(e);
2334
+ r(this, D).update(e);
2326
2335
  }
2327
2336
  /**
2328
2337
  * @internal 仅供内部使用
2329
2338
  */
2330
2339
  _finalizeDraftNode() {
2331
- if (!r(this, H)) return;
2332
- const t = Tt(), e = r(this, H).getConfig();
2340
+ if (!r(this, D)) return;
2341
+ const t = Tt(), e = r(this, D).getConfig();
2333
2342
  if (e.$_type === "image-marker") {
2334
2343
  const o = e.$_bounds, a = {
2335
2344
  x: e.x,
2336
2345
  y: e.y
2337
- }, h = {
2346
+ }, l = {
2338
2347
  x: e.x + (e.width || 0),
2339
2348
  y: e.y + (e.height || 0)
2340
- }, l = this.getState().nodes || [];
2349
+ }, h = this.getState().nodes || [];
2341
2350
  let d = 0;
2342
- l.forEach((v) => {
2351
+ h.forEach((v) => {
2343
2352
  v.$_type === "image-marker" && typeof v.$_markerNumber == "number" && (d = Math.max(d, v.$_markerNumber));
2344
2353
  });
2345
- const f = (a.x - o.x) / o.width, m = (a.y - o.y) / o.height, u = (h.x - o.x) / o.width, y = (h.y - o.y) / o.height, w = {
2354
+ const m = (a.x - o.x) / o.width, f = (a.y - o.y) / o.height, g = (l.x - o.x) / o.width, y = (l.y - o.y) / o.height, x = {
2346
2355
  ...e,
2347
2356
  $_markerNumber: d + 1,
2348
2357
  $_relativeBox: {
2349
2358
  start: {
2350
- ratioX: Math.max(0, Math.min(1, f)),
2351
- ratioY: Math.max(0, Math.min(1, m))
2359
+ ratioX: Math.max(0, Math.min(1, m)),
2360
+ ratioY: Math.max(0, Math.min(1, f))
2352
2361
  },
2353
2362
  end: {
2354
- ratioX: Math.max(0, Math.min(1, u)),
2363
+ ratioX: Math.max(0, Math.min(1, g)),
2355
2364
  ratioY: Math.max(0, Math.min(1, y))
2356
2365
  }
2357
2366
  },
2358
2367
  $_type: "image-marker",
2359
2368
  id: t
2360
2369
  };
2361
- this.createNodes([w], !0), r(this, H).destroy(), x(this, H, null), this.setToolType("select");
2370
+ this.createNodes([x], !0), r(this, D).destroy(), C(this, D, null), this.setToolType("select");
2362
2371
  return;
2363
2372
  }
2364
2373
  const s = {
2365
2374
  ...e,
2366
2375
  id: t
2367
2376
  };
2368
- if (s.$_type === "ellipse" && (s.width || 0) < 10 && (s.height || 0) < 10 && (s.width = 10, s.height = 10), s.$_type === "star" && (s.outerRadius || 0) < 10 && (s.outerRadius = 10), this.createNodes([s], !0), r(this, H).destroy(), x(this, H, null), this.setToolType("select"), s.$_type === "rich-text") {
2377
+ if (s.$_type === "ellipse" && (s.width || 0) < 10 && (s.height || 0) < 10 && (s.width = 10, s.height = 10), s.$_type === "star" && (s.outerRadius || 0) < 10 && (s.outerRadius = 10), this.createNodes([s], !0), r(this, D).destroy(), C(this, D, null), this.setToolType("select"), s.$_type === "rich-text") {
2369
2378
  const o = this.getCanvasNodeById(t);
2370
2379
  o && o.attachEditor();
2371
2380
  }
@@ -2375,7 +2384,7 @@ class Ls extends ps {
2375
2384
  * @internal 仅供内部使用
2376
2385
  */
2377
2386
  _createTextNodeAtDrawingPosition(t) {
2378
- const e = r(this, G)[1], s = {
2387
+ const e = r(this, j)[1], s = {
2379
2388
  id: Tt(),
2380
2389
  $_type: "text",
2381
2390
  x: e.x,
@@ -2388,34 +2397,34 @@ class Ls extends ps {
2388
2397
  * @internal 仅供内部使用
2389
2398
  */
2390
2399
  _createSelectRect() {
2391
- this.isEditingText || (r(this, Y) && r(this, Y).destroy(), x(this, Y, new _.Rect({
2392
- x: r(this, G)[0].x,
2393
- y: r(this, G)[0].y,
2400
+ this.isEditingText || (r(this, q) && r(this, q).destroy(), C(this, q, new M.Rect({
2401
+ x: r(this, j)[0].x,
2402
+ y: r(this, j)[0].y,
2394
2403
  width: 0,
2395
2404
  height: 0,
2396
2405
  stroke: this.getTheme()["theme.select-rect-border"],
2397
2406
  strokeWidth: 1,
2398
2407
  fill: this.getTheme()["theme.select-rect-fill"]
2399
- })), r(this, j).add(r(this, Y)));
2408
+ })), r(this, J).add(r(this, q)));
2400
2409
  }
2401
2410
  /*
2402
2411
  * @internal 仅供内部使用
2403
2412
  */
2404
2413
  _updateSelectRect() {
2405
- if (!r(this, Y)) return;
2406
- const [t, e] = ee(...r(this, G));
2407
- r(this, Y).setAttrs({
2414
+ if (!r(this, q)) return;
2415
+ const [t, e] = ee(...r(this, j));
2416
+ r(this, q).setAttrs({
2408
2417
  x: t.x,
2409
2418
  y: t.y,
2410
2419
  width: e.x - t.x,
2411
2420
  height: e.y - t.y
2412
2421
  });
2413
- const s = r(this, Y).getClientRect(), a = r(this, j).find(`.${b.selectable}`).filter((h) => {
2414
- const l = h.getClientRect();
2415
- return _.Util.haveIntersection(s, l);
2422
+ const s = r(this, q).getClientRect(), a = r(this, J).find(`.${b.selectable}`).filter((l) => {
2423
+ const h = l.getClientRect();
2424
+ return M.Util.haveIntersection(s, h);
2416
2425
  });
2417
2426
  this._selectNodes(
2418
- a.length > 0 ? a.filter((h) => h.listening()).map((h) => h.id()) : void 0,
2427
+ a.length > 0 ? a.filter((l) => l.listening()).map((l) => l.id()) : void 0,
2419
2428
  !1
2420
2429
  );
2421
2430
  }
@@ -2423,7 +2432,7 @@ class Ls extends ps {
2423
2432
  * @internal 仅供内部使用
2424
2433
  */
2425
2434
  _finalizeSelectRect() {
2426
- r(this, Y) && (r(this, Y).destroy(), x(this, Y, null));
2435
+ r(this, q) && (r(this, q).destroy(), C(this, q, null));
2427
2436
  }
2428
2437
  /**
2429
2438
  * 选择节点
@@ -2437,8 +2446,8 @@ class Ls extends ps {
2437
2446
  if (a.length === 0)
2438
2447
  r(this, it).clearNodes();
2439
2448
  else {
2440
- const h = this.getStage().find(`.${b.selectable}`).filter((l) => a.includes(l.id())).filter((l) => l.listening()).filter((l) => l.isVisible());
2441
- r(this, it).setNodes(h);
2449
+ const l = this.getStage().find(`.${b.selectable}`).filter((h) => a.includes(h.id())).filter((h) => h.listening()).filter((h) => h.isVisible());
2450
+ r(this, it).setNodes(l);
2442
2451
  }
2443
2452
  this._updateState({ selectedNodeIds: a }, !1), this._emit("nodes:selected", a);
2444
2453
  }
@@ -2454,15 +2463,15 @@ class Ls extends ps {
2454
2463
  if (t.length === 0) return [];
2455
2464
  const e = this.getState().nodes || [], s = new Set(t);
2456
2465
  t.forEach((a) => {
2457
- e.find((l) => l.id === a)?.$_type === "image" && e.forEach((l) => {
2458
- l.$_type === "image-marker" && l.$_parentId === a && s.add(l.id);
2466
+ e.find((h) => h.id === a)?.$_type === "image" && e.forEach((h) => {
2467
+ h.$_type === "image-marker" && h.$_parentId === a && s.add(h.id);
2459
2468
  });
2460
2469
  });
2461
2470
  const o = e.filter((a) => s.has(a.id));
2462
2471
  return s.forEach((a) => {
2463
- const h = this.getStage().findOne(`#${a}`);
2464
- h && h.destroy();
2465
- }), E(this, U, Ki).call(this, Array.from(s), !0), r(this, it).clearNodes(), this._updateState(
2472
+ const l = this.getStage().findOne(`#${a}`);
2473
+ l && l.destroy();
2474
+ }), E(this, W, Ki).call(this, Array.from(s), !0), r(this, it).clearNodes(), this._updateState(
2466
2475
  {
2467
2476
  selectedNodeIds: []
2468
2477
  },
@@ -2481,14 +2490,14 @@ class Ls extends ps {
2481
2490
  * 销毁 canvas
2482
2491
  */
2483
2492
  dispose() {
2484
- r(this, pt) && (r(this, pt).disconnect(), x(this, pt, null)), this.getCanvasTransformer().destroy(), this.getMainLayer().destroy(), this.getCanvasStage().destroy(), this._dispose();
2493
+ r(this, pt) && (r(this, pt).disconnect(), C(this, pt, null)), this.getCanvasTransformer().destroy(), this.getMainLayer().destroy(), this.getCanvasStage().destroy(), this._dispose();
2485
2494
  }
2486
2495
  /**
2487
2496
  * @internal 仅供内部使用
2488
2497
  * 在元素节点改变后(例如 tranfromEnd dragEnd)重建 state.nodes
2489
2498
  */
2490
2499
  _rebuildStateAfterNodeChange(t, e) {
2491
- E(this, U, Be).call(this, Array.isArray(t) ? t : [t], e);
2500
+ E(this, W, Be).call(this, Array.isArray(t) ? t : [t], e);
2492
2501
  }
2493
2502
  /**
2494
2503
  * 实现父类的状态同步方法
@@ -2502,9 +2511,9 @@ class Ls extends ps {
2502
2511
  scale: t.viewport.scale
2503
2512
  },
2504
2513
  !1
2505
- ), r(this, lt).forEach((e, s) => {
2514
+ ), r(this, ht).forEach((e, s) => {
2506
2515
  e.destroy();
2507
- }), r(this, lt).clear(), this.createNodes(t.nodes || [], !1), this._selectNodes(t.selectedNodeIds || [], !1, !0);
2516
+ }), r(this, ht).clear(), this.createNodes(t.nodes || [], !1), this._selectNodes(t.selectedNodeIds || [], !1, !0);
2508
2517
  }
2509
2518
  _showContextMenu(t) {
2510
2519
  this._emit("contextmenu:show", t);
@@ -2512,12 +2521,12 @@ class Ls extends ps {
2512
2521
  // 在调整节点上下层级后调用,同步到 store 中
2513
2522
  _syncNodesZIndexToStore() {
2514
2523
  const t = this.getStage().find(`.${b.nodeRoot}`).map((a) => a.id()).filter((a) => a), e = this.getState().nodes || [], s = /* @__PURE__ */ new Map();
2515
- t.forEach((a, h) => {
2516
- s.set(a, h);
2524
+ t.forEach((a, l) => {
2525
+ s.set(a, l);
2517
2526
  });
2518
- const o = [...e].sort((a, h) => {
2519
- const l = s.get(a.id) ?? Number.MIN_SAFE_INTEGER, d = s.get(h.id) ?? Number.MIN_SAFE_INTEGER;
2520
- return l - d;
2527
+ const o = [...e].sort((a, l) => {
2528
+ const h = s.get(a.id) ?? Number.MIN_SAFE_INTEGER, d = s.get(l.id) ?? Number.MIN_SAFE_INTEGER;
2529
+ return h - d;
2521
2530
  });
2522
2531
  this._updateState({ nodes: o }, !0), this._emit("nodes:sorted", t);
2523
2532
  }
@@ -2528,7 +2537,7 @@ class Ls extends ps {
2528
2537
  this._emit("texteditor:unregister", void 0);
2529
2538
  }
2530
2539
  }
2531
- kt = new WeakMap(), D = new WeakMap(), j = new WeakMap(), it = new WeakMap(), H = new WeakMap(), Rt = new WeakMap(), Y = new WeakMap(), G = new WeakMap(), lt = new WeakMap(), pt = new WeakMap(), Me = new WeakMap(), U = new WeakSet(), /**
2540
+ kt = new WeakMap(), B = new WeakMap(), J = new WeakMap(), it = new WeakMap(), D = new WeakMap(), Rt = new WeakMap(), q = new WeakMap(), j = new WeakMap(), ht = new WeakMap(), pt = new WeakMap(), Me = new WeakMap(), W = new WeakSet(), /**
2532
2541
  * 设置键盘事件监听
2533
2542
  */
2534
2543
  Yi = function() {
@@ -2538,14 +2547,14 @@ Yi = function() {
2538
2547
  * 设置尺寸变化监听
2539
2548
  */
2540
2549
  Gi = function() {
2541
- x(this, pt, new ResizeObserver((t) => {
2550
+ C(this, pt, new ResizeObserver((t) => {
2542
2551
  for (const e of t) {
2543
- const { width: s, height: o } = e.contentRect, a = this.getStage(), h = this.getState().viewport, l = a.width(), d = a.height(), f = h.x + l / 2, m = h.y + d / 2;
2552
+ const { width: s, height: o } = e.contentRect, a = this.getStage(), l = this.getState().viewport, h = a.width(), d = a.height(), m = l.x + h / 2, f = l.y + d / 2;
2544
2553
  a.width(s), a.height(o);
2545
- const u = f - s / 2, y = m - o / 2;
2554
+ const g = m - s / 2, y = f - o / 2;
2546
2555
  this._updateViewport(
2547
2556
  {
2548
- x: u,
2557
+ x: g,
2549
2558
  y
2550
2559
  },
2551
2560
  !1
@@ -2557,34 +2566,34 @@ Gi = function() {
2557
2566
  */
2558
2567
  Pe = function(t) {
2559
2568
  const e = this.getState().nodes || [], s = /* @__PURE__ */ new Map();
2560
- e.forEach((d, f) => {
2561
- s.set(d.id, f);
2569
+ e.forEach((d, m) => {
2570
+ s.set(d.id, m);
2562
2571
  });
2563
- const o = Array.from(r(this, lt).values()).map(
2572
+ const o = Array.from(r(this, ht).values()).map(
2564
2573
  (d) => d.getConfig()
2565
- ), a = [], h = [];
2574
+ ), a = [], l = [];
2566
2575
  o.forEach((d) => {
2567
- s.has(d.id) ? a.push(d) : h.push(d);
2568
- }), a.sort((d, f) => {
2569
- const m = s.get(d.id) ?? 0, u = s.get(f.id) ?? 0;
2570
- return m - u;
2576
+ s.has(d.id) ? a.push(d) : l.push(d);
2577
+ }), a.sort((d, m) => {
2578
+ const f = s.get(d.id) ?? 0, g = s.get(m.id) ?? 0;
2579
+ return f - g;
2571
2580
  });
2572
- const l = {
2573
- nodes: [...a, ...h]
2581
+ const h = {
2582
+ nodes: [...a, ...l]
2574
2583
  };
2575
- this._updateState(l, t);
2584
+ this._updateState(h, t);
2576
2585
  }, /**
2577
2586
  * 更新 state.nodes
2578
2587
  */
2579
2588
  Be = function(t, e) {
2580
2589
  t.length !== 0 && (t.forEach((s) => {
2581
- r(this, lt).set(s.getID(), s);
2582
- }), E(this, U, Pe).call(this, e));
2590
+ r(this, ht).set(s.getID(), s);
2591
+ }), E(this, W, Pe).call(this, e));
2583
2592
  }, Ki = function(t, e = !1) {
2584
2593
  t.length !== 0 && (t.forEach((s) => {
2585
- const o = r(this, lt).get(s);
2586
- o && o.destroy(), r(this, lt).delete(s);
2587
- }), E(this, U, Pe).call(this, e));
2594
+ const o = r(this, ht).get(s);
2595
+ o && o.destroy(), r(this, ht).delete(s);
2596
+ }), E(this, W, Pe).call(this, e));
2588
2597
  };
2589
2598
  class Ds extends Ls {
2590
2599
  /**
@@ -2665,11 +2674,11 @@ class Ds extends Ls {
2665
2674
  const t = this.getState().selectedNodeIds || [];
2666
2675
  if (t.length === 0)
2667
2676
  return console.warn("No selection to export"), null;
2668
- const e = i?.padding ?? 0, s = new _.Group();
2669
- t.forEach((h) => {
2670
- const l = this.getStage().findOne(`#${h}`);
2671
- if (l) {
2672
- const d = l.clone();
2677
+ const e = i?.padding ?? 0, s = new M.Group();
2678
+ t.forEach((l) => {
2679
+ const h = this.getStage().findOne(`#${l}`);
2680
+ if (h) {
2681
+ const d = h.clone();
2673
2682
  s.add(d);
2674
2683
  }
2675
2684
  });
@@ -2694,37 +2703,37 @@ class Ds extends Ls {
2694
2703
  if (!e)
2695
2704
  return console.warn("Image shape not found on stage"), null;
2696
2705
  const o = (this.getState().nodes || []).filter(
2697
- (m) => m.$_type === "image-marker" && m.$_parentId === i
2706
+ (x) => x.$_type === "image-marker" && x.$_parentId === i
2698
2707
  );
2699
2708
  if (o.length === 0)
2700
2709
  return console.warn("No image-marker nodes found for the given image ID"), null;
2701
- const a = new _.Group(), h = e.clone();
2702
- a.add(h);
2703
- const l = t?.markerScale ?? 1;
2704
- o.forEach((m) => {
2705
- const u = this.getStage().findOne(`#${m.id}`);
2706
- if (u) {
2707
- const y = u.clone(), w = y.findOne(".rect"), v = y.findOne(".marker-group");
2708
- if (w && (w.strokeWidth(3 * l), w.dash([5 * l, 5 * l]), w.cornerRadius(6 * l)), v) {
2709
- const M = v.findOne("Circle"), C = v.findOne("Text");
2710
- if (M && (M.radius(14 * l), M.strokeWidth(3 * l)), C) {
2711
- const B = 14 * l;
2712
- C.x(-B), C.y(-B), C.width(B * 2), C.height(B * 2), C.fontSize(16 * l);
2710
+ const a = new M.Group(), l = e.clone();
2711
+ a.add(l);
2712
+ const h = e.width(), d = e.height(), m = Math.min(h, d), f = t?.markerScale ?? Math.max(1, Math.min(8, m / 400));
2713
+ o.forEach((x) => {
2714
+ const v = this.getStage().findOne(`#${x.id}`);
2715
+ if (v) {
2716
+ const I = v.clone(), w = I.findOne(".rect"), z = I.findOne(".marker-group");
2717
+ if (w && (w.strokeWidth(3 * f), w.cornerRadius(6 * f)), z) {
2718
+ const X = z.findOne("Circle"), R = z.findOne("Text");
2719
+ if (X && (X.radius(14 * f), X.strokeWidth(3 * f)), R) {
2720
+ const F = 14 * f;
2721
+ R.x(-F), R.y(-F), R.width(F * 2), R.height(F * 2), R.fontSize(16 * f);
2713
2722
  }
2714
2723
  }
2715
- a.add(y);
2724
+ a.add(I);
2716
2725
  }
2717
2726
  });
2718
- const d = a.getClientRect(), f = a.toDataURL({
2719
- x: d.x,
2720
- y: d.y,
2721
- width: d.width,
2722
- height: d.height,
2727
+ const g = a.getClientRect(), y = a.toDataURL({
2728
+ x: g.x,
2729
+ y: g.y,
2730
+ width: g.width,
2731
+ height: g.height,
2723
2732
  pixelRatio: t?.pixelRatio ?? 2,
2724
2733
  mimeType: t?.mimeType ?? "image/png",
2725
2734
  quality: t?.quality ?? 1
2726
2735
  });
2727
- return a.destroy(), f;
2736
+ return a.destroy(), y;
2728
2737
  }
2729
2738
  /**
2730
2739
  * 删除当前选中的节点
@@ -2822,30 +2831,30 @@ class Ds extends Ls {
2822
2831
  scrollToContent(i) {
2823
2832
  if ((this.getState().nodes || []).length === 0) return;
2824
2833
  const e = i?.padding ?? 50, s = i?.scale === !0, o = i?.nodeIds;
2825
- let a = 1 / 0, h = 1 / 0, l = -1 / 0, d = -1 / 0;
2826
- const f = this.getMainLayer(), m = this.getState().selectedNodeIds || [], u = o && o.length > 0, y = !u && m.length > 0, w = u ? o : y ? m : null;
2827
- if (f.children.forEach((z) => {
2828
- if (z.visible() && z.getClassName() !== "Transformer" && z.hasName(b.selectable)) {
2829
- if (w) {
2830
- const ut = z.id();
2831
- if (!w.includes(ut)) return;
2834
+ let a = 1 / 0, l = 1 / 0, h = -1 / 0, d = -1 / 0;
2835
+ const m = this.getMainLayer(), f = this.getState().selectedNodeIds || [], g = o && o.length > 0, y = !g && f.length > 0, x = g ? o : y ? f : null;
2836
+ if (m.children.forEach((Y) => {
2837
+ if (Y.visible() && Y.getClassName() !== "Transformer" && Y.hasName(b.selectable)) {
2838
+ if (x) {
2839
+ const ut = Y.id();
2840
+ if (!x.includes(ut)) return;
2832
2841
  }
2833
- const xt = z.getAttrs(), ni = xt.x || 0, si = xt.y || 0, En = xt.width || 0, Sn = xt.height || 0;
2842
+ const xt = Y.getAttrs(), ni = xt.x || 0, si = xt.y || 0, En = xt.width || 0, Sn = xt.height || 0;
2834
2843
  if (xt.rotation || 0) {
2835
- const ut = z.getClientRect({ skipTransform: !1 }), Ae = this.getStage(), te = Ae.scaleX(), oi = Ae.x(), ri = Ae.y(), Nn = (ut.x - oi) / te, Tn = (ut.y - ri) / te, _n = (ut.x + ut.width - oi) / te, Mn = (ut.y + ut.height - ri) / te;
2836
- a = Math.min(a, Nn), h = Math.min(h, Tn), l = Math.max(l, _n), d = Math.max(d, Mn);
2844
+ const ut = Y.getClientRect({ skipTransform: !1 }), Ae = this.getStage(), te = Ae.scaleX(), oi = Ae.x(), ri = Ae.y(), Nn = (ut.x - oi) / te, Tn = (ut.y - ri) / te, _n = (ut.x + ut.width - oi) / te, Mn = (ut.y + ut.height - ri) / te;
2845
+ a = Math.min(a, Nn), l = Math.min(l, Tn), h = Math.max(h, _n), d = Math.max(d, Mn);
2837
2846
  } else
2838
- a = Math.min(a, ni), h = Math.min(h, si), l = Math.max(l, ni + En), d = Math.max(d, si + Sn);
2847
+ a = Math.min(a, ni), l = Math.min(l, si), h = Math.max(h, ni + En), d = Math.max(d, si + Sn);
2839
2848
  }
2840
- }), a === 1 / 0 || h === 1 / 0) return;
2841
- const v = l - a, M = d - h, C = a + v / 2, B = h + M / 2;
2842
- let K = this.getState().viewport.scale;
2849
+ }), a === 1 / 0 || l === 1 / 0) return;
2850
+ const v = h - a, I = d - l, w = a + v / 2, z = l + I / 2;
2851
+ let R = this.getState().viewport.scale;
2843
2852
  if (s) {
2844
- const z = (this.getStage().width() - e * 2) / v, xt = (this.getStage().height() - e * 2) / M;
2845
- K = Math.min(z, xt, 1);
2853
+ const Y = (this.getStage().width() - e * 2) / v, xt = (this.getStage().height() - e * 2) / I;
2854
+ R = Math.min(Y, xt, 1);
2846
2855
  }
2847
- const q = this.getStage().width() / 2 - C * K, Ct = this.getStage().height() / 2 - B * K;
2848
- this.updateViewport({ x: q, y: Ct, scale: K }, !0);
2856
+ const F = this.getStage().width() / 2 - w * R, Ct = this.getStage().height() / 2 - z * R;
2857
+ this.updateViewport({ x: F, y: Ct, scale: R }, !0);
2849
2858
  }
2850
2859
  /**
2851
2860
  * 导出当前状态
@@ -2900,8 +2909,8 @@ class Ds extends Ls {
2900
2909
  }
2901
2910
  }
2902
2911
  function Ps(n, i, t, e = !1) {
2903
- const [s, o] = i, [a, h] = t, l = a + (n - s) / (o - s) * (h - a);
2904
- return e ? a < h ? Math.max(Math.min(l, h), a) : Math.max(Math.min(l, a), h) : l;
2912
+ const [s, o] = i, [a, l] = t, h = a + (n - s) / (o - s) * (l - a);
2913
+ return e ? a < l ? Math.max(Math.min(h, l), a) : Math.max(Math.min(h, a), l) : h;
2905
2914
  }
2906
2915
  const Ei = [
2907
2916
  {
@@ -2932,7 +2941,7 @@ function Bs({
2932
2941
  size: e = 15,
2933
2942
  showGrid: s = !0
2934
2943
  }) {
2935
- const o = n / t, a = i / t, h = t;
2944
+ const o = n / t, a = i / t, l = t;
2936
2945
  return s ? /* @__PURE__ */ k(
2937
2946
  "svg",
2938
2947
  {
@@ -2941,30 +2950,30 @@ function Bs({
2941
2950
  xmlns: "http://www.w3.org/2000/svg",
2942
2951
  "aria-hidden": "true",
2943
2952
  children: [
2944
- /* @__PURE__ */ c("defs", { children: Ei.map(({ min: l, mid: d, step: f }, m) => {
2945
- const u = f * e * h, y = 0.5 + o * h, w = 0.5 + a * h, v = y > 0 ? y % u : u + y % u, M = w > 0 ? w % u : u + w % u, C = h < d ? Ps(h, [l, d], [0, 1]) : 1;
2953
+ /* @__PURE__ */ c("defs", { children: Ei.map(({ min: h, mid: d, step: m }, f) => {
2954
+ const g = m * e * l, y = 0.5 + o * l, x = 0.5 + a * l, v = y > 0 ? y % g : g + y % g, I = x > 0 ? x % g : g + x % g, w = l < d ? Ps(l, [h, d], [0, 1]) : 1;
2946
2955
  return /* @__PURE__ */ c(
2947
2956
  "pattern",
2948
2957
  {
2949
- id: `grid_${f}`,
2950
- width: u,
2951
- height: u,
2958
+ id: `grid_${m}`,
2959
+ width: g,
2960
+ height: g,
2952
2961
  patternUnits: "userSpaceOnUse",
2953
2962
  children: /* @__PURE__ */ c(
2954
2963
  "circle",
2955
2964
  {
2956
2965
  className: "grid-dot",
2957
2966
  cx: v,
2958
- cy: M,
2967
+ cy: I,
2959
2968
  r: 1,
2960
- opacity: C
2969
+ opacity: w
2961
2970
  }
2962
2971
  )
2963
2972
  },
2964
- m
2973
+ f
2965
2974
  );
2966
2975
  }) }),
2967
- Ei.map(({ step: l }, d) => /* @__PURE__ */ c("rect", { width: "100%", height: "100%", fill: `url(#grid_${l})` }, d))
2976
+ Ei.map(({ step: h }, d) => /* @__PURE__ */ c("rect", { width: "100%", height: "100%", fill: `url(#grid_${h})` }, d))
2968
2977
  ]
2969
2978
  }
2970
2979
  ) : null;
@@ -3018,24 +3027,24 @@ function Ft({
3018
3027
  );
3019
3028
  }
3020
3029
  function Zs({ api: n }) {
3021
- const [i, t] = R(n.getState().viewport);
3022
- Z(() => {
3023
- n.on("viewport:change", (l) => {
3024
- t(l);
3030
+ const [i, t] = $(n.getState().viewport);
3031
+ U(() => {
3032
+ n.on("viewport:change", (h) => {
3033
+ t(h);
3025
3034
  });
3026
3035
  }, [t, n]);
3027
- const e = (l) => {
3028
- const d = n.getStage().width() / 2, f = n.getStage().height() / 2, m = (d - i.x) / i.scale, u = (f - i.y) / i.scale, y = d - m * l, w = f - u * l;
3029
- n.updateViewport({ x: y, y: w, scale: l });
3036
+ const e = (h) => {
3037
+ const d = n.getStage().width() / 2, m = n.getStage().height() / 2, f = (d - i.x) / i.scale, g = (m - i.y) / i.scale, y = d - f * h, x = m - g * h;
3038
+ n.updateViewport({ x: y, y: x, scale: h });
3030
3039
  }, s = () => {
3031
- const l = Math.min(i.scale * 1.2, 5);
3032
- e(l);
3040
+ const h = Math.min(i.scale * 1.2, 5);
3041
+ e(h);
3033
3042
  }, o = () => {
3034
- const l = Math.max(i.scale / 1.2, 0.1);
3035
- e(l);
3043
+ const h = Math.max(i.scale / 1.2, 0.1);
3044
+ e(h);
3036
3045
  }, a = () => {
3037
3046
  e(1);
3038
- }, h = Math.round(i.scale * 100);
3047
+ }, l = Math.round(i.scale * 100);
3039
3048
  return /* @__PURE__ */ k("div", { className: "zoom-panel flex items-center gap-2", children: [
3040
3049
  /* @__PURE__ */ c(
3041
3050
  Ft,
@@ -3053,10 +3062,10 @@ function Zs({ api: n }) {
3053
3062
  size: "sm",
3054
3063
  variant: "secondary",
3055
3064
  onClick: a,
3056
- title: `${h}%`,
3065
+ title: `${l}%`,
3057
3066
  className: "min-w-16",
3058
3067
  children: [
3059
- h,
3068
+ l,
3060
3069
  "%"
3061
3070
  ]
3062
3071
  }
@@ -3074,8 +3083,8 @@ function Zs({ api: n }) {
3074
3083
  ] });
3075
3084
  }
3076
3085
  function Us({ api: n }) {
3077
- const [i, t] = R(n.canUndo()), [e, s] = R(n.canRedo());
3078
- return Z(() => {
3086
+ const [i, t] = $(n.canUndo()), [e, s] = $(n.canRedo());
3087
+ return U(() => {
3079
3088
  const o = () => {
3080
3089
  t(n.canUndo()), s(n.canRedo());
3081
3090
  };
@@ -3108,18 +3117,18 @@ function Us({ api: n }) {
3108
3117
  ] });
3109
3118
  }
3110
3119
  function Xo({ setApi: n, theme: i }) {
3111
- const t = Ue(null), [e, s] = R(null), [o, a] = R({ x: 0, y: 0, scale: 1 });
3112
- return Z(() => {
3120
+ const t = Ue(null), [e, s] = $(null), [o, a] = $({ x: 0, y: 0, scale: 1 });
3121
+ return U(() => {
3113
3122
  if (!t.current) return;
3114
- const h = new Ds(t.current, {
3123
+ const l = new Ds(t.current, {
3115
3124
  theme: i
3116
3125
  });
3117
- return s(h), n?.(h), h.on("viewport:change", (l) => {
3118
- a(l);
3126
+ return s(l), n?.(l), l.on("viewport:change", (h) => {
3127
+ a(h);
3119
3128
  }), () => {
3120
- h.dispose();
3129
+ l.dispose();
3121
3130
  };
3122
- }, []), Z(() => {
3131
+ }, []), U(() => {
3123
3132
  e && i && e.setTheme(i);
3124
3133
  }, [e, i]), /* @__PURE__ */ k("div", { className: "whiteboard relative size-full", children: [
3125
3134
  /* @__PURE__ */ c(
@@ -3144,17 +3153,17 @@ function Xo({ setApi: n, theme: i }) {
3144
3153
  ] });
3145
3154
  }
3146
3155
  function Yo(n) {
3147
- const [i, t] = R(null);
3148
- return Z(() => {
3156
+ const [i, t] = $(null);
3157
+ return U(() => {
3149
3158
  if (!n) return;
3150
3159
  const s = ({
3151
3160
  clientX: o,
3152
3161
  clientY: a,
3153
- targetIds: h
3162
+ targetIds: l
3154
3163
  }) => {
3155
- let l = [];
3156
- if (h.length > 1)
3157
- l = [
3164
+ let h = [];
3165
+ if (l.length > 1)
3166
+ h = [
3158
3167
  // {
3159
3168
  // label: "组合",
3160
3169
  // action: () => {
@@ -3170,9 +3179,9 @@ function Yo(n) {
3170
3179
  // },
3171
3180
  // },
3172
3181
  ];
3173
- else if (h.length === 1) {
3174
- const d = h[0];
3175
- d === "canvas-stage" ? l = [] : l = [
3182
+ else if (l.length === 1) {
3183
+ const d = l[0];
3184
+ d === "canvas-stage" ? h = [] : h = [
3176
3185
  {
3177
3186
  label: "置顶",
3178
3187
  action: () => {
@@ -3199,20 +3208,20 @@ function Yo(n) {
3199
3208
  }
3200
3209
  ];
3201
3210
  }
3202
- if (l.length === 0) {
3211
+ if (h.length === 0) {
3203
3212
  t(null);
3204
3213
  return;
3205
3214
  }
3206
3215
  t({
3207
3216
  x: o,
3208
3217
  y: a,
3209
- items: l
3218
+ items: h
3210
3219
  });
3211
3220
  };
3212
3221
  return n.on("contextmenu:show", s), () => {
3213
3222
  n.off("contextmenu:show", s);
3214
3223
  };
3215
- }, [n]), Z(() => {
3224
+ }, [n]), U(() => {
3216
3225
  const s = () => {
3217
3226
  i && t(null);
3218
3227
  };
@@ -3312,9 +3321,9 @@ function Ys({
3312
3321
  delay: s = 600,
3313
3322
  closeDelay: o = 0
3314
3323
  } = {}) {
3315
- const [a, h] = R(n), l = t ?? a, d = e ?? h, f = ss({
3324
+ const [a, l] = $(n), h = t ?? a, d = e ?? l, m = ss({
3316
3325
  placement: i,
3317
- open: l,
3326
+ open: h,
3318
3327
  onOpenChange: d,
3319
3328
  whileElementsMounted: ls,
3320
3329
  middleware: [
@@ -3326,7 +3335,7 @@ function Ys({
3326
3335
  }),
3327
3336
  as({ padding: 4 })
3328
3337
  ]
3329
- }), m = f.context, u = hs(m, {
3338
+ }), f = m.context, g = hs(f, {
3330
3339
  mouseOnly: !0,
3331
3340
  move: !1,
3332
3341
  restMs: s,
@@ -3334,17 +3343,17 @@ function Ys({
3334
3343
  delay: {
3335
3344
  close: o
3336
3345
  }
3337
- }), y = cs(m, {
3346
+ }), y = cs(f, {
3338
3347
  enabled: t == null
3339
- }), w = ds(m), v = gs(m, { role: "tooltip" }), M = us([u, y, w, v]);
3348
+ }), x = ds(f), v = gs(f, { role: "tooltip" }), I = us([g, y, x, v]);
3340
3349
  return St(
3341
3350
  () => ({
3342
- open: l,
3351
+ open: h,
3343
3352
  setOpen: d,
3344
- ...M,
3345
- ...f
3353
+ ...I,
3354
+ ...m
3346
3355
  }),
3347
- [l, d, M, f]
3356
+ [h, d, I, m]
3348
3357
  );
3349
3358
  }
3350
3359
  const Ve = Rn(null);
@@ -3365,7 +3374,7 @@ function Ji({ children: n, ...i }) {
3365
3374
  }
3366
3375
  ) : /* @__PURE__ */ c(Ve.Provider, { value: t, children: n });
3367
3376
  }
3368
- const Qi = $(
3377
+ const Qi = A(
3369
3378
  function({ children: i, asChild: t = !1, ...e }, s) {
3370
3379
  const o = ji(), a = li(i) ? parseInt($n, 10) >= 19 ? (
3371
3380
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -3373,44 +3382,44 @@ const Qi = $(
3373
3382
  ) : (
3374
3383
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3375
3384
  i.ref
3376
- ) : void 0, h = Ni([o.refs.setReference, s, a]);
3385
+ ) : void 0, l = Ni([o.refs.setReference, s, a]);
3377
3386
  if (t && li(i)) {
3378
- const l = {
3387
+ const h = {
3379
3388
  "data-tooltip-state": o.open ? "open" : "closed"
3380
3389
  };
3381
3390
  return An(
3382
3391
  i,
3383
3392
  o.getReferenceProps({
3384
- ref: h,
3393
+ ref: l,
3385
3394
  ...e,
3386
3395
  ...typeof i.props == "object" ? i.props : {},
3387
- ...l
3396
+ ...h
3388
3397
  })
3389
3398
  );
3390
3399
  }
3391
3400
  return /* @__PURE__ */ c(
3392
3401
  "button",
3393
3402
  {
3394
- ref: h,
3403
+ ref: l,
3395
3404
  "data-tooltip-state": o.open ? "open" : "closed",
3396
3405
  ...o.getReferenceProps(e),
3397
3406
  children: i
3398
3407
  }
3399
3408
  );
3400
3409
  }
3401
- ), tn = $(
3410
+ ), tn = A(
3402
3411
  function({ style: i, children: t, portal: e = !0, portalProps: s = {}, ...o }, a) {
3403
- const h = ji(), l = Ni([h.refs.setFloating, a]);
3404
- if (!h.open) return null;
3412
+ const l = ji(), h = Ni([l.refs.setFloating, a]);
3413
+ if (!l.open) return null;
3405
3414
  const d = /* @__PURE__ */ c(
3406
3415
  "div",
3407
3416
  {
3408
- ref: l,
3417
+ ref: h,
3409
3418
  style: {
3410
- ...h.floatingStyles,
3419
+ ...l.floatingStyles,
3411
3420
  ...i
3412
3421
  },
3413
- ...h.getFloatingProps(o),
3422
+ ...l.getFloatingProps(o),
3414
3423
  className: "tiptap-tooltip",
3415
3424
  children: t
3416
3425
  }
@@ -3426,7 +3435,7 @@ const Gs = ({
3426
3435
  }) => n.length === 0 ? null : /* @__PURE__ */ c("div", { children: n.map((i, t) => /* @__PURE__ */ k(Hn, { children: [
3427
3436
  t > 0 && /* @__PURE__ */ c("kbd", { children: "+" }),
3428
3437
  /* @__PURE__ */ c("kbd", { children: i })
3429
- ] }, t)) }), vt = $(
3438
+ ] }, t)) }), vt = A(
3430
3439
  ({
3431
3440
  className: n,
3432
3441
  children: i,
@@ -3435,8 +3444,8 @@ const Gs = ({
3435
3444
  shortcutKeys: s,
3436
3445
  variant: o,
3437
3446
  size: a,
3438
- ...h
3439
- }, l) => {
3447
+ ...l
3448
+ }, h) => {
3440
3449
  const d = St(
3441
3450
  () => ke({ shortcutKeys: s }),
3442
3451
  [s]
@@ -3445,10 +3454,10 @@ const Gs = ({
3445
3454
  "button",
3446
3455
  {
3447
3456
  className: nt("tiptap-button", n),
3448
- ref: l,
3457
+ ref: h,
3449
3458
  "data-style": o,
3450
3459
  "data-size": a,
3451
- ...h,
3460
+ ...l,
3452
3461
  children: i
3453
3462
  }
3454
3463
  ) : /* @__PURE__ */ k(Ji, { delay: 200, children: [
@@ -3456,10 +3465,10 @@ const Gs = ({
3456
3465
  Qi,
3457
3466
  {
3458
3467
  className: nt("tiptap-button", n),
3459
- ref: l,
3468
+ ref: h,
3460
3469
  "data-style": o,
3461
3470
  "data-size": a,
3462
- ...h,
3471
+ ...l,
3463
3472
  children: i
3464
3473
  }
3465
3474
  ),
@@ -3471,7 +3480,7 @@ const Gs = ({
3471
3480
  }
3472
3481
  );
3473
3482
  vt.displayName = "Button";
3474
- const Ht = $(({ className: n, children: i, orientation: t = "vertical", ...e }, s) => /* @__PURE__ */ c(
3483
+ const Ht = A(({ className: n, children: i, orientation: t = "vertical", ...e }, s) => /* @__PURE__ */ c(
3475
3484
  "div",
3476
3485
  {
3477
3486
  ref: s,
@@ -3483,7 +3492,7 @@ const Ht = $(({ className: n, children: i, orientation: t = "vertical", ...e },
3483
3492
  }
3484
3493
  ));
3485
3494
  Ht.displayName = "ButtonGroup";
3486
- const Re = $(
3495
+ const Re = A(
3487
3496
  ({
3488
3497
  variant: n,
3489
3498
  size: i = "default",
@@ -3492,10 +3501,10 @@ const Re = $(
3492
3501
  className: s,
3493
3502
  children: o,
3494
3503
  ...a
3495
- }, h) => /* @__PURE__ */ c(
3504
+ }, l) => /* @__PURE__ */ c(
3496
3505
  "div",
3497
3506
  {
3498
- ref: h,
3507
+ ref: l,
3499
3508
  className: `tiptap-badge ${s || ""}`,
3500
3509
  "data-style": n,
3501
3510
  "data-size": i,
@@ -3513,7 +3522,7 @@ function Ks({
3513
3522
  }) {
3514
3523
  return /* @__PURE__ */ c(Re, { children: ke({ shortcutKeys: i }) });
3515
3524
  }
3516
- const At = $(
3525
+ const At = A(
3517
3526
  ({
3518
3527
  editor: n,
3519
3528
  type: i,
@@ -3522,55 +3531,55 @@ const At = $(
3522
3531
  onToggled: s,
3523
3532
  showShortcut: o = !1,
3524
3533
  onClick: a,
3525
- children: h,
3526
- ...l
3534
+ children: l,
3535
+ ...h
3527
3536
  }, d) => {
3528
- const { editor: f } = yt(n), {
3529
- isVisible: m,
3530
- handleMark: u,
3537
+ const { editor: m } = yt(n), {
3538
+ isVisible: f,
3539
+ handleMark: g,
3531
3540
  label: y,
3532
- canToggle: w,
3541
+ canToggle: x,
3533
3542
  isActive: v,
3534
- Icon: M,
3535
- shortcutKeys: C
3543
+ Icon: I,
3544
+ shortcutKeys: w
3536
3545
  } = eo({
3537
- editor: f,
3546
+ editor: m,
3538
3547
  type: i,
3539
3548
  hideWhenUnavailable: e,
3540
3549
  onToggled: s
3541
- }), B = J(
3542
- (dt) => {
3543
- a?.(dt), !dt.defaultPrevented && u();
3550
+ }), z = Q(
3551
+ (X) => {
3552
+ a?.(X), !X.defaultPrevented && g();
3544
3553
  },
3545
- [u, a]
3554
+ [g, a]
3546
3555
  );
3547
- return m ? /* @__PURE__ */ c(
3556
+ return f ? /* @__PURE__ */ c(
3548
3557
  vt,
3549
3558
  {
3550
3559
  type: "button",
3551
- disabled: !w,
3560
+ disabled: !x,
3552
3561
  variant: "ghost",
3553
3562
  "data-active-state": v ? "on" : "off",
3554
- "data-disabled": !w,
3563
+ "data-disabled": !x,
3555
3564
  role: "button",
3556
3565
  tabIndex: -1,
3557
3566
  "aria-label": y,
3558
3567
  "aria-pressed": v,
3559
3568
  tooltip: y,
3560
- onClick: B,
3561
- ...l,
3569
+ onClick: z,
3570
+ ...h,
3562
3571
  ref: d,
3563
- children: h ?? /* @__PURE__ */ k(Ie, { children: [
3564
- /* @__PURE__ */ c(M, { className: "tiptap-button-icon" }),
3572
+ children: l ?? /* @__PURE__ */ k(Ie, { children: [
3573
+ /* @__PURE__ */ c(I, { className: "tiptap-button-icon" }),
3565
3574
  t && /* @__PURE__ */ c("span", { className: "tiptap-button-text", children: t }),
3566
- o && /* @__PURE__ */ c(Ks, { type: i, shortcutKeys: C })
3575
+ o && /* @__PURE__ */ c(Ks, { type: i, shortcutKeys: w })
3567
3576
  ] })
3568
3577
  }
3569
3578
  ) : null;
3570
3579
  }
3571
3580
  );
3572
3581
  At.displayName = "MarkButton";
3573
- const en = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3582
+ const en = dt(({ className: n, ...i }) => /* @__PURE__ */ c(
3574
3583
  "svg",
3575
3584
  {
3576
3585
  width: "24",
@@ -3592,7 +3601,7 @@ const en = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3592
3601
  }
3593
3602
  ));
3594
3603
  en.displayName = "BoldIcon";
3595
- const nn = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3604
+ const nn = dt(({ className: n, ...i }) => /* @__PURE__ */ k(
3596
3605
  "svg",
3597
3606
  {
3598
3607
  width: "24",
@@ -3628,7 +3637,7 @@ const nn = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3628
3637
  }
3629
3638
  ));
3630
3639
  nn.displayName = "Code2Icon";
3631
- const sn = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3640
+ const sn = dt(({ className: n, ...i }) => /* @__PURE__ */ c(
3632
3641
  "svg",
3633
3642
  {
3634
3643
  width: "24",
@@ -3648,7 +3657,7 @@ const sn = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3648
3657
  }
3649
3658
  ));
3650
3659
  sn.displayName = "ItalicIcon";
3651
- const on = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3660
+ const on = dt(({ className: n, ...i }) => /* @__PURE__ */ k(
3652
3661
  "svg",
3653
3662
  {
3654
3663
  width: "24",
@@ -3677,7 +3686,7 @@ const on = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3677
3686
  }
3678
3687
  ));
3679
3688
  on.displayName = "StrikeIcon";
3680
- const rn = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3689
+ const rn = dt(({ className: n, ...i }) => /* @__PURE__ */ k(
3681
3690
  "svg",
3682
3691
  {
3683
3692
  width: "24",
@@ -3719,7 +3728,7 @@ const rn = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3719
3728
  }
3720
3729
  ));
3721
3730
  rn.displayName = "SubscriptIcon";
3722
- const an = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3731
+ const an = dt(({ className: n, ...i }) => /* @__PURE__ */ k(
3723
3732
  "svg",
3724
3733
  {
3725
3734
  width: "24",
@@ -3761,7 +3770,7 @@ const an = ct(({ className: n, ...i }) => /* @__PURE__ */ k(
3761
3770
  }
3762
3771
  ));
3763
3772
  an.displayName = "SuperscriptIcon";
3764
- const ln = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3773
+ const ln = dt(({ className: n, ...i }) => /* @__PURE__ */ c(
3765
3774
  "svg",
3766
3775
  {
3767
3776
  width: "24",
@@ -3822,26 +3831,26 @@ function eo(n) {
3822
3831
  type: t,
3823
3832
  hideWhenUnavailable: e = !1,
3824
3833
  onToggled: s
3825
- } = n, { editor: o } = yt(i), [a, h] = R(!0), l = We(o, t), d = js(o, t);
3826
- Z(() => {
3834
+ } = n, { editor: o } = yt(i), [a, l] = $(!0), h = We(o, t), d = js(o, t);
3835
+ U(() => {
3827
3836
  if (!o) return;
3828
- const m = () => {
3829
- h(Qs({ editor: o, type: t, hideWhenUnavailable: e }));
3837
+ const f = () => {
3838
+ l(Qs({ editor: o, type: t, hideWhenUnavailable: e }));
3830
3839
  };
3831
- return m(), o.on("selectionUpdate", m), () => {
3832
- o.off("selectionUpdate", m);
3840
+ return f(), o.on("selectionUpdate", f), () => {
3841
+ o.off("selectionUpdate", f);
3833
3842
  };
3834
3843
  }, [o, t, e]);
3835
- const f = J(() => {
3844
+ const m = Q(() => {
3836
3845
  if (!o) return !1;
3837
- const m = Js(o, t);
3838
- return m && s?.(), m;
3846
+ const f = Js(o, t);
3847
+ return f && s?.(), f;
3839
3848
  }, [o, t, s]);
3840
3849
  return {
3841
3850
  isVisible: a,
3842
3851
  isActive: d,
3843
- handleMark: f,
3844
- canToggle: l,
3852
+ handleMark: m,
3853
+ canToggle: h,
3845
3854
  label: to(t),
3846
3855
  shortcutKeys: hn[t],
3847
3856
  Icon: qs[t]
@@ -3855,44 +3864,44 @@ function cn({
3855
3864
  onSelect: s,
3856
3865
  onClose: o,
3857
3866
  orientation: a = "vertical",
3858
- autoSelectFirstItem: h = !0
3867
+ autoSelectFirstItem: l = !0
3859
3868
  }) {
3860
- const [l, d] = R(
3861
- h ? 0 : -1
3869
+ const [h, d] = $(
3870
+ l ? 0 : -1
3862
3871
  );
3863
- return Z(() => {
3864
- const f = (u) => {
3872
+ return U(() => {
3873
+ const m = (g) => {
3865
3874
  if (!e.length) return !1;
3866
- const y = () => d((v) => v === -1 ? 0 : (v + 1) % e.length), w = () => d((v) => v === -1 ? e.length - 1 : (v - 1 + e.length) % e.length);
3867
- switch (u.key) {
3875
+ const y = () => d((v) => v === -1 ? 0 : (v + 1) % e.length), x = () => d((v) => v === -1 ? e.length - 1 : (v - 1 + e.length) % e.length);
3876
+ switch (g.key) {
3868
3877
  case "ArrowUp":
3869
- return a === "horizontal" ? !1 : (u.preventDefault(), w(), !0);
3878
+ return a === "horizontal" ? !1 : (g.preventDefault(), x(), !0);
3870
3879
  case "ArrowDown":
3871
- return a === "horizontal" ? !1 : (u.preventDefault(), y(), !0);
3880
+ return a === "horizontal" ? !1 : (g.preventDefault(), y(), !0);
3872
3881
  case "ArrowLeft":
3873
- return a === "vertical" ? !1 : (u.preventDefault(), w(), !0);
3882
+ return a === "vertical" ? !1 : (g.preventDefault(), x(), !0);
3874
3883
  case "ArrowRight":
3875
- return a === "vertical" ? !1 : (u.preventDefault(), y(), !0);
3884
+ return a === "vertical" ? !1 : (g.preventDefault(), y(), !0);
3876
3885
  case "Tab":
3877
- return u.preventDefault(), u.shiftKey ? w() : y(), !0;
3886
+ return g.preventDefault(), g.shiftKey ? x() : y(), !0;
3878
3887
  case "Home":
3879
- return u.preventDefault(), d(0), !0;
3888
+ return g.preventDefault(), d(0), !0;
3880
3889
  case "End":
3881
- return u.preventDefault(), d(e.length - 1), !0;
3890
+ return g.preventDefault(), d(e.length - 1), !0;
3882
3891
  case "Enter":
3883
- return u.isComposing ? !1 : (u.preventDefault(), l !== -1 && e[l] && s?.(e[l]), !0);
3892
+ return g.isComposing ? !1 : (g.preventDefault(), h !== -1 && e[h] && s?.(e[h]), !0);
3884
3893
  case "Escape":
3885
- return u.preventDefault(), o?.(), !0;
3894
+ return g.preventDefault(), o?.(), !0;
3886
3895
  default:
3887
3896
  return !1;
3888
3897
  }
3889
3898
  };
3890
- let m = null;
3891
- if (n ? m = n.view.dom : i?.current && (m = i.current), m)
3892
- return m.addEventListener("keydown", f, !0), () => {
3893
- m?.removeEventListener(
3899
+ let f = null;
3900
+ if (n ? f = n.view.dom : i?.current && (f = i.current), f)
3901
+ return f.addEventListener("keydown", m, !0), () => {
3902
+ f?.removeEventListener(
3894
3903
  "keydown",
3895
- f,
3904
+ m,
3896
3905
  !0
3897
3906
  );
3898
3907
  };
@@ -3900,25 +3909,25 @@ function cn({
3900
3909
  n,
3901
3910
  i,
3902
3911
  e,
3903
- l,
3912
+ h,
3904
3913
  s,
3905
3914
  o,
3906
3915
  a
3907
- ]), Z(() => {
3908
- t && d(h ? 0 : -1);
3909
- }, [t, h]), {
3910
- selectedIndex: e.length ? l : void 0,
3916
+ ]), U(() => {
3917
+ t && d(l ? 0 : -1);
3918
+ }, [t, l]), {
3919
+ selectedIndex: e.length ? h : void 0,
3911
3920
  setSelectedIndex: d
3912
3921
  };
3913
3922
  }
3914
3923
  function $e(n = "max", i = 768) {
3915
- const [t, e] = R(void 0);
3916
- return Z(() => {
3917
- const s = n === "min" ? `(min-width: ${i}px)` : `(max-width: ${i - 1}px)`, o = window.matchMedia(s), a = (h) => e(h.matches);
3924
+ const [t, e] = $(void 0);
3925
+ return U(() => {
3926
+ const s = n === "min" ? `(min-width: ${i}px)` : `(max-width: ${i - 1}px)`, o = window.matchMedia(s), a = (l) => e(l.matches);
3918
3927
  return e(o.matches), o.addEventListener("change", a), () => o.removeEventListener("change", a);
3919
3928
  }, [n, i]), !!t;
3920
3929
  }
3921
- const Xe = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3930
+ const Xe = dt(({ className: n, ...i }) => /* @__PURE__ */ c(
3922
3931
  "svg",
3923
3932
  {
3924
3933
  width: "24",
@@ -3940,7 +3949,7 @@ const Xe = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3940
3949
  }
3941
3950
  ));
3942
3951
  Xe.displayName = "BanIcon";
3943
- const Ye = ct(({ className: n, ...i }) => /* @__PURE__ */ c(
3952
+ const Ye = dt(({ className: n, ...i }) => /* @__PURE__ */ c(
3944
3953
  "svg",
3945
3954
  {
3946
3955
  width: "24",
@@ -3989,7 +3998,7 @@ function un({
3989
3998
  }
3990
3999
  ) });
3991
4000
  }
3992
- const Ge = $(
4001
+ const Ge = A(
3993
4002
  ({ decorative: n, orientation: i = "vertical", className: t, ...e }, s) => {
3994
4003
  const a = n ? { role: "none" } : { "aria-orientation": i === "vertical" ? i : void 0, role: "separator" };
3995
4004
  return /* @__PURE__ */ c(
@@ -4005,11 +4014,11 @@ const Ge = $(
4005
4014
  }
4006
4015
  );
4007
4016
  Ge.displayName = "Separator";
4008
- const Ke = $(
4017
+ const Ke = A(
4009
4018
  ({ className: n, ...i }, t) => /* @__PURE__ */ c("div", { ref: t, className: nt("tiptap-card", n), ...i })
4010
4019
  );
4011
4020
  Ke.displayName = "Card";
4012
- const io = $(
4021
+ const io = A(
4013
4022
  ({ className: n, ...i }, t) => /* @__PURE__ */ c(
4014
4023
  "div",
4015
4024
  {
@@ -4020,11 +4029,11 @@ const io = $(
4020
4029
  )
4021
4030
  );
4022
4031
  io.displayName = "CardHeader";
4023
- const qe = $(
4032
+ const qe = A(
4024
4033
  ({ className: n, ...i }, t) => /* @__PURE__ */ c("div", { ref: t, className: nt("tiptap-card-body", n), ...i })
4025
4034
  );
4026
4035
  qe.displayName = "CardBody";
4027
- const je = $(({ className: n, orientation: i = "vertical", ...t }, e) => /* @__PURE__ */ c(
4036
+ const je = A(({ className: n, orientation: i = "vertical", ...t }, e) => /* @__PURE__ */ c(
4028
4037
  "div",
4029
4038
  {
4030
4039
  ref: e,
@@ -4034,7 +4043,7 @@ const je = $(({ className: n, orientation: i = "vertical", ...t }, e) => /* @__P
4034
4043
  }
4035
4044
  ));
4036
4045
  je.displayName = "CardItemGroup";
4037
- const no = $(
4046
+ const no = A(
4038
4047
  ({ className: n, ...i }, t) => /* @__PURE__ */ c(
4039
4048
  "div",
4040
4049
  {
@@ -4045,7 +4054,7 @@ const no = $(
4045
4054
  )
4046
4055
  );
4047
4056
  no.displayName = "CardGroupLabel";
4048
- const so = $(
4057
+ const so = A(
4049
4058
  ({ className: n, ...i }, t) => /* @__PURE__ */ c(
4050
4059
  "div",
4051
4060
  {
@@ -4061,7 +4070,7 @@ function oo({
4061
4070
  }) {
4062
4071
  return /* @__PURE__ */ c(Re, { children: ke({ shortcutKeys: n }) });
4063
4072
  }
4064
- const mn = $(
4073
+ const mn = A(
4065
4074
  ({
4066
4075
  editor: n,
4067
4076
  highlightColor: i,
@@ -4070,57 +4079,57 @@ const mn = $(
4070
4079
  mode: s = "mark",
4071
4080
  onApplied: o,
4072
4081
  showShortcut: a = !1,
4073
- onClick: h,
4074
- children: l,
4082
+ onClick: l,
4083
+ children: h,
4075
4084
  style: d,
4076
- useColorValue: f = !1,
4077
- ...m
4078
- }, u) => {
4085
+ useColorValue: m = !1,
4086
+ ...f
4087
+ }, g) => {
4079
4088
  const { editor: y } = yt(n), {
4080
- isVisible: w,
4089
+ isVisible: x,
4081
4090
  canColorHighlight: v,
4082
- isActive: M,
4083
- handleColorHighlight: C,
4084
- label: B,
4085
- shortcutKeys: dt
4091
+ isActive: I,
4092
+ handleColorHighlight: w,
4093
+ label: z,
4094
+ shortcutKeys: X
4086
4095
  } = Qe({
4087
4096
  editor: y,
4088
4097
  highlightColor: i,
4089
- useColorValue: f,
4098
+ useColorValue: m,
4090
4099
  label: t || `Toggle highlight (${i})`,
4091
4100
  hideWhenUnavailable: e,
4092
4101
  mode: s,
4093
4102
  onApplied: o
4094
- }), K = J(
4103
+ }), R = Q(
4095
4104
  (Ct) => {
4096
- h?.(Ct), !Ct.defaultPrevented && (C(), Ct.preventDefault(), Ct.stopPropagation());
4105
+ l?.(Ct), !Ct.defaultPrevented && (w(), Ct.preventDefault(), Ct.stopPropagation());
4097
4106
  },
4098
- [C, h]
4099
- ), q = St(
4107
+ [w, l]
4108
+ ), F = St(
4100
4109
  () => ({
4101
4110
  ...d,
4102
4111
  "--highlight-color": i
4103
4112
  }),
4104
4113
  [i, d]
4105
4114
  );
4106
- return w ? /* @__PURE__ */ c(
4115
+ return x ? /* @__PURE__ */ c(
4107
4116
  vt,
4108
4117
  {
4109
4118
  type: "button",
4110
4119
  variant: "ghost",
4111
- "data-active-state": M ? "on" : "off",
4120
+ "data-active-state": I ? "on" : "off",
4112
4121
  role: "button",
4113
4122
  tabIndex: -1,
4114
4123
  disabled: !v,
4115
4124
  "data-disabled": !v,
4116
- "aria-label": B,
4117
- "aria-pressed": M,
4118
- tooltip: B,
4119
- onClick: K,
4120
- style: q,
4121
- ...m,
4122
- ref: u,
4123
- children: l ?? /* @__PURE__ */ k(Ie, { children: [
4125
+ "aria-label": z,
4126
+ "aria-pressed": I,
4127
+ tooltip: z,
4128
+ onClick: R,
4129
+ style: F,
4130
+ ...f,
4131
+ ref: g,
4132
+ children: h ?? /* @__PURE__ */ k(Ie, { children: [
4124
4133
  /* @__PURE__ */ c(
4125
4134
  "span",
4126
4135
  {
@@ -4129,7 +4138,7 @@ const mn = $(
4129
4138
  }
4130
4139
  ),
4131
4140
  t && /* @__PURE__ */ c("span", { className: "tiptap-button-text", children: t }),
4132
- a && /* @__PURE__ */ c(oo, { shortcutKeys: dt })
4141
+ a && /* @__PURE__ */ c(oo, { shortcutKeys: X })
4133
4142
  ] })
4134
4143
  }
4135
4144
  ) : null;
@@ -4228,8 +4237,8 @@ function ao(n, i, t = "mark") {
4228
4237
  try {
4229
4238
  const { state: e } = n, { selection: s } = e, o = s.$anchor;
4230
4239
  for (let a = o.depth; a >= 0; a--) {
4231
- const h = o.node(a);
4232
- if (h && h.attrs?.backgroundColor === i)
4240
+ const l = o.node(a);
4241
+ if (l && l.attrs?.backgroundColor === i)
4233
4242
  return !0;
4234
4243
  }
4235
4244
  return !1;
@@ -4258,62 +4267,62 @@ function Qe(n) {
4258
4267
  hideWhenUnavailable: s = !1,
4259
4268
  mode: o = "mark",
4260
4269
  useColorValue: a = !1,
4261
- onApplied: h
4262
- } = n, { editor: l } = yt(i), d = $e(), [f, m] = R(!0), u = Je(l, o), y = e && ro(e, a), w = ao(l, y, o);
4263
- Z(() => {
4264
- if (!l) return;
4265
- const C = () => {
4266
- m(ho({ editor: l, hideWhenUnavailable: s, mode: o }));
4270
+ onApplied: l
4271
+ } = n, { editor: h } = yt(i), d = $e(), [m, f] = $(!0), g = Je(h, o), y = e && ro(e, a), x = ao(h, y, o);
4272
+ U(() => {
4273
+ if (!h) return;
4274
+ const w = () => {
4275
+ f(ho({ editor: h, hideWhenUnavailable: s, mode: o }));
4267
4276
  };
4268
- return C(), l.on("selectionUpdate", C), () => {
4269
- l.off("selectionUpdate", C);
4277
+ return w(), h.on("selectionUpdate", w), () => {
4278
+ h.off("selectionUpdate", w);
4270
4279
  };
4271
- }, [l, s, o]);
4272
- const v = J(() => {
4273
- if (!l || !u || !y || !t)
4280
+ }, [h, s, o]);
4281
+ const v = Q(() => {
4282
+ if (!h || !g || !y || !t)
4274
4283
  return !1;
4275
4284
  if (o === "mark") {
4276
- if (l.state.storedMarks) {
4277
- const C = l.schema.marks.highlight;
4278
- C && l.view.dispatch(
4279
- l.state.tr.removeStoredMark(C)
4285
+ if (h.state.storedMarks) {
4286
+ const w = h.schema.marks.highlight;
4287
+ w && h.view.dispatch(
4288
+ h.state.tr.removeStoredMark(w)
4280
4289
  );
4281
4290
  }
4282
4291
  return setTimeout(() => {
4283
- const C = l.chain().focus().toggleHighlight({ color: y }).run();
4284
- return C && h?.({ color: y, label: t, mode: o }), C;
4292
+ const w = h.chain().focus().toggleHighlight({ color: y }).run();
4293
+ return w && l?.({ color: y, label: t, mode: o }), w;
4285
4294
  }, 0), !0;
4286
4295
  } else {
4287
- const C = l.chain().focus().toggleNodeBackgroundColor(y).run();
4288
- return C && h?.({ color: y, label: t, mode: o }), C;
4296
+ const w = h.chain().focus().toggleNodeBackgroundColor(y).run();
4297
+ return w && l?.({ color: y, label: t, mode: o }), w;
4289
4298
  }
4290
- }, [u, y, l, t, h, o]), M = J(() => {
4291
- const C = lo(l, o);
4292
- return C && h?.({ color: "", label: "Remove highlight", mode: o }), C;
4293
- }, [l, h, o]);
4299
+ }, [g, y, h, t, l, o]), I = Q(() => {
4300
+ const w = lo(h, o);
4301
+ return w && l?.({ color: "", label: "Remove highlight", mode: o }), w;
4302
+ }, [h, l, o]);
4294
4303
  return Ti(
4295
4304
  Oe,
4296
- (C) => {
4297
- C.preventDefault(), v();
4305
+ (w) => {
4306
+ w.preventDefault(), v();
4298
4307
  },
4299
4308
  {
4300
- enabled: f && u,
4309
+ enabled: m && g,
4301
4310
  enableOnContentEditable: !d,
4302
4311
  enableOnFormTags: !0
4303
4312
  }
4304
4313
  ), {
4305
- isVisible: f,
4306
- isActive: w,
4314
+ isVisible: m,
4315
+ isActive: x,
4307
4316
  handleColorHighlight: v,
4308
- handleRemoveHighlight: M,
4309
- canColorHighlight: u,
4317
+ handleRemoveHighlight: I,
4318
+ canColorHighlight: g,
4310
4319
  label: t || "Highlight",
4311
4320
  shortcutKeys: Oe,
4312
4321
  Icon: Ye,
4313
4322
  mode: o
4314
4323
  };
4315
4324
  }
4316
- const yn = $(({ className: n, children: i, ...t }, e) => /* @__PURE__ */ c(
4325
+ const yn = A(({ className: n, children: i, ...t }, e) => /* @__PURE__ */ c(
4317
4326
  vt,
4318
4327
  {
4319
4328
  type: "button",
@@ -4344,16 +4353,16 @@ function co({
4344
4353
  const { handleRemoveHighlight: e } = Qe({ editor: n }), s = $e(), o = Ue(null), a = St(
4345
4354
  () => [...i, { label: "Remove highlight", value: "none" }],
4346
4355
  [i]
4347
- ), { selectedIndex: h } = cn({
4356
+ ), { selectedIndex: l } = cn({
4348
4357
  containerRef: o,
4349
4358
  items: a,
4350
4359
  orientation: "both",
4351
- onSelect: (l) => {
4360
+ onSelect: (h) => {
4352
4361
  if (!o.current) return !1;
4353
4362
  const d = o.current.querySelector(
4354
4363
  '[data-highlighted="true"]'
4355
4364
  );
4356
- return d && d.click(), l.value === "none" && e(), !0;
4365
+ return d && d.click(), h.value === "none" && e(), !0;
4357
4366
  },
4358
4367
  autoSelectFirstItem: !1
4359
4368
  });
@@ -4364,18 +4373,18 @@ function co({
4364
4373
  tabIndex: 0,
4365
4374
  style: s ? { boxShadow: "none", border: 0 } : {},
4366
4375
  children: /* @__PURE__ */ c(qe, { style: s ? { padding: 0 } : {}, children: /* @__PURE__ */ k(je, { orientation: "horizontal", children: [
4367
- /* @__PURE__ */ c(Ht, { orientation: "horizontal", children: i.map((l, d) => /* @__PURE__ */ c(
4376
+ /* @__PURE__ */ c(Ht, { orientation: "horizontal", children: i.map((h, d) => /* @__PURE__ */ c(
4368
4377
  mn,
4369
4378
  {
4370
4379
  editor: n,
4371
- highlightColor: t ? l.colorValue : l.value,
4372
- tooltip: l.label,
4373
- "aria-label": `${l.label} highlight color`,
4374
- tabIndex: d === h ? 0 : -1,
4375
- "data-highlighted": h === d,
4380
+ highlightColor: t ? h.colorValue : h.value,
4381
+ tooltip: h.label,
4382
+ "aria-label": `${h.label} highlight color`,
4383
+ tabIndex: d === l ? 0 : -1,
4384
+ "data-highlighted": l === d,
4376
4385
  useColorValue: t
4377
4386
  },
4378
- l.value
4387
+ h.value
4379
4388
  )) }),
4380
4389
  /* @__PURE__ */ c(Ge, {}),
4381
4390
  /* @__PURE__ */ c(Ht, { orientation: "horizontal", children: /* @__PURE__ */ c(
@@ -4384,11 +4393,11 @@ function co({
4384
4393
  onClick: e,
4385
4394
  "aria-label": "Remove highlight",
4386
4395
  tooltip: "Remove highlight",
4387
- tabIndex: h === i.length ? 0 : -1,
4396
+ tabIndex: l === i.length ? 0 : -1,
4388
4397
  type: "button",
4389
4398
  role: "menuitem",
4390
4399
  variant: "ghost",
4391
- "data-highlighted": h === i.length,
4400
+ "data-highlighted": l === i.length,
4392
4401
  children: /* @__PURE__ */ c(Xe, { className: "tiptap-button-icon" })
4393
4402
  }
4394
4403
  ) })
@@ -4410,21 +4419,21 @@ function go({
4410
4419
  onApplied: s,
4411
4420
  ...o
4412
4421
  }) {
4413
- const { editor: a } = yt(n), [h, l] = R(!1), { isVisible: d, canColorHighlight: f, isActive: m, label: u, Icon: y } = Qe({
4422
+ const { editor: a } = yt(n), [l, h] = $(!1), { isVisible: d, canColorHighlight: m, isActive: f, label: g, Icon: y } = Qe({
4414
4423
  editor: a,
4415
4424
  hideWhenUnavailable: t,
4416
4425
  onApplied: s
4417
4426
  });
4418
- return d ? /* @__PURE__ */ k(dn, { open: h, onOpenChange: l, children: [
4427
+ return d ? /* @__PURE__ */ k(dn, { open: l, onOpenChange: h, children: [
4419
4428
  /* @__PURE__ */ c(gn, { asChild: !0, children: /* @__PURE__ */ c(
4420
4429
  yn,
4421
4430
  {
4422
- disabled: !f,
4423
- "data-active-state": m ? "on" : "off",
4424
- "data-disabled": !f,
4425
- "aria-pressed": m,
4426
- "aria-label": u,
4427
- tooltip: u,
4431
+ disabled: !m,
4432
+ "data-active-state": f ? "on" : "off",
4433
+ "data-disabled": !m,
4434
+ "aria-pressed": f,
4435
+ "aria-label": g,
4436
+ tooltip: g,
4428
4437
  ...o,
4429
4438
  children: /* @__PURE__ */ c(y, { className: "tiptap-button-icon" })
4430
4439
  }
@@ -4439,7 +4448,7 @@ function go({
4439
4448
  ) })
4440
4449
  ] }) : null;
4441
4450
  }
4442
- const ti = ct(({ className: n, ...i }) => /* @__PURE__ */ k("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: `lucide lucide-palette-icon lucide-palette ${n}`, ...i, children: [
4451
+ const ti = dt(({ className: n, ...i }) => /* @__PURE__ */ k("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: `lucide lucide-palette-icon lucide-palette ${n}`, ...i, children: [
4443
4452
  /* @__PURE__ */ c("path", { d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z" }),
4444
4453
  /* @__PURE__ */ c("circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor" }),
4445
4454
  /* @__PURE__ */ c("circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor" }),
@@ -4452,7 +4461,7 @@ function uo({
4452
4461
  }) {
4453
4462
  return /* @__PURE__ */ c(Re, { children: ke({ shortcutKeys: n }) });
4454
4463
  }
4455
- const vn = $(
4464
+ const vn = A(
4456
4465
  ({
4457
4466
  editor: n,
4458
4467
  textColor: i,
@@ -4461,36 +4470,36 @@ const vn = $(
4461
4470
  onApplied: s,
4462
4471
  showShortcut: o = !1,
4463
4472
  onClick: a,
4464
- children: h,
4465
- style: l,
4473
+ children: l,
4474
+ style: h,
4466
4475
  useColorValue: d = !1,
4467
- ...f
4468
- }, m) => {
4469
- const { editor: u } = yt(n), {
4476
+ ...m
4477
+ }, f) => {
4478
+ const { editor: g } = yt(n), {
4470
4479
  isVisible: y,
4471
- canTextColor: w,
4480
+ canTextColor: x,
4472
4481
  isActive: v,
4473
- handleTextColor: M,
4474
- label: C,
4475
- shortcutKeys: B
4482
+ handleTextColor: I,
4483
+ label: w,
4484
+ shortcutKeys: z
4476
4485
  } = ii({
4477
- editor: u,
4486
+ editor: g,
4478
4487
  textColor: i,
4479
4488
  useColorValue: d,
4480
4489
  label: t || `Toggle text color (${i})`,
4481
4490
  hideWhenUnavailable: e,
4482
4491
  onApplied: s
4483
- }), dt = J(
4484
- (q) => {
4485
- a?.(q), !q.defaultPrevented && (M(), q.preventDefault(), q.stopPropagation());
4492
+ }), X = Q(
4493
+ (F) => {
4494
+ a?.(F), !F.defaultPrevented && (I(), F.preventDefault(), F.stopPropagation());
4486
4495
  },
4487
- [M, a]
4488
- ), K = St(
4496
+ [I, a]
4497
+ ), R = St(
4489
4498
  () => ({
4490
- ...l,
4499
+ ...h,
4491
4500
  "--text-color": i
4492
4501
  }),
4493
- [i, l]
4502
+ [i, h]
4494
4503
  );
4495
4504
  return y ? /* @__PURE__ */ k(
4496
4505
  vt,
@@ -4500,24 +4509,24 @@ const vn = $(
4500
4509
  "data-active-state": v ? "on" : "off",
4501
4510
  role: "button",
4502
4511
  tabIndex: -1,
4503
- disabled: !w,
4504
- "data-disabled": !w,
4505
- "aria-label": C,
4512
+ disabled: !x,
4513
+ "data-disabled": !x,
4514
+ "aria-label": w,
4506
4515
  "aria-pressed": v,
4507
- tooltip: C,
4508
- onClick: dt,
4509
- ref: m,
4510
- style: K,
4511
- ...f,
4516
+ tooltip: w,
4517
+ onClick: X,
4518
+ ref: f,
4519
+ style: R,
4520
+ ...m,
4512
4521
  children: [
4513
- h || /* @__PURE__ */ c(
4522
+ l || /* @__PURE__ */ c(
4514
4523
  "span",
4515
4524
  {
4516
4525
  className: "tiptap-button-text-color",
4517
4526
  style: { "--highlight-color": i }
4518
4527
  }
4519
4528
  ),
4520
- o && /* @__PURE__ */ c(uo, { shortcutKeys: B })
4529
+ o && /* @__PURE__ */ c(uo, { shortcutKeys: z })
4521
4530
  ]
4522
4531
  }
4523
4532
  ) : null;
@@ -4601,31 +4610,31 @@ function ii({
4601
4610
  useColorValue: s = !1,
4602
4611
  onApplied: o
4603
4612
  } = {}) {
4604
- const { editor: a } = yt(n), h = $e(), [l, d] = R(!0), [f, m] = R(!1), u = ei(a);
4605
- Z(() => {
4613
+ const { editor: a } = yt(n), l = $e(), [h, d] = $(!0), [m, f] = $(!1), g = ei(a);
4614
+ U(() => {
4606
4615
  if (!a) {
4607
4616
  d(!1);
4608
4617
  return;
4609
4618
  }
4610
4619
  const v = po({ editor: a, hideWhenUnavailable: e });
4611
4620
  d(v);
4612
- }, [a, e]), Z(() => {
4621
+ }, [a, e]), U(() => {
4613
4622
  if (!a) {
4614
- m(!1);
4623
+ f(!1);
4615
4624
  return;
4616
4625
  }
4617
4626
  const v = () => {
4618
- m(Si(a, i));
4627
+ f(Si(a, i));
4619
4628
  };
4620
4629
  return a.on("selectionUpdate", v), a.on("transaction", v), v(), () => {
4621
4630
  a.off("selectionUpdate", v), a.off("transaction", v);
4622
4631
  };
4623
4632
  }, [a, i]);
4624
- const y = J(() => {
4625
- if (!a || !u) return;
4633
+ const y = Q(() => {
4634
+ if (!a || !g) return;
4626
4635
  const v = i ? mo(i, s) : "#000000";
4627
4636
  Si(a, v) ? a.chain().focus().unsetColor().run() : (a.chain().focus().setColor(v).run(), o?.({ color: v, label: t }));
4628
- }, [a, i, s, t, u, o]), w = J(() => {
4637
+ }, [a, i, s, t, g, o]), x = Q(() => {
4629
4638
  fo(a);
4630
4639
  }, [a]);
4631
4640
  return Ti(
@@ -4634,22 +4643,22 @@ function ii({
4634
4643
  v.preventDefault(), y();
4635
4644
  },
4636
4645
  {
4637
- enabled: !h && l && u,
4646
+ enabled: !l && h && g,
4638
4647
  enableOnFormTags: ["INPUT", "TEXTAREA", "SELECT"]
4639
4648
  },
4640
- [y, h, l, u]
4649
+ [y, l, h, g]
4641
4650
  ), {
4642
- isVisible: l,
4643
- canTextColor: u,
4644
- isActive: f,
4651
+ isVisible: h,
4652
+ canTextColor: g,
4653
+ isActive: m,
4645
4654
  handleTextColor: y,
4646
- handleRemoveTextColor: w,
4655
+ handleRemoveTextColor: x,
4647
4656
  label: t,
4648
4657
  shortcutKeys: Ze,
4649
4658
  Icon: ti
4650
4659
  };
4651
4660
  }
4652
- const wn = $(({ className: n, children: i, ...t }, e) => /* @__PURE__ */ c(
4661
+ const wn = A(({ className: n, children: i, ...t }, e) => /* @__PURE__ */ c(
4653
4662
  vt,
4654
4663
  {
4655
4664
  type: "button",
@@ -4681,16 +4690,16 @@ function yo({
4681
4690
  const { handleRemoveTextColor: e } = ii({ editor: n }), s = $e(), o = Ue(null), a = St(
4682
4691
  () => [...i, { label: "Remove color", value: "none" }],
4683
4692
  [i]
4684
- ), { selectedIndex: h } = cn({
4693
+ ), { selectedIndex: l } = cn({
4685
4694
  containerRef: o,
4686
4695
  items: a,
4687
4696
  orientation: "both",
4688
- onSelect: (l) => {
4697
+ onSelect: (h) => {
4689
4698
  if (!o.current) return !1;
4690
4699
  const d = o.current.querySelector(
4691
4700
  '[data-highlighted="true"]'
4692
4701
  );
4693
- return d && d.click(), l.value === "none" && e(), !0;
4702
+ return d && d.click(), h.value === "none" && e(), !0;
4694
4703
  },
4695
4704
  autoSelectFirstItem: !1
4696
4705
  });
@@ -4701,18 +4710,18 @@ function yo({
4701
4710
  tabIndex: 0,
4702
4711
  style: s ? { boxShadow: "none", border: 0 } : {},
4703
4712
  children: /* @__PURE__ */ c(qe, { style: s ? { padding: 0 } : {}, children: /* @__PURE__ */ k(je, { orientation: "horizontal", children: [
4704
- /* @__PURE__ */ c(Ht, { orientation: "horizontal", children: i.map((l, d) => /* @__PURE__ */ c(
4713
+ /* @__PURE__ */ c(Ht, { orientation: "horizontal", children: i.map((h, d) => /* @__PURE__ */ c(
4705
4714
  vn,
4706
4715
  {
4707
4716
  editor: n,
4708
- textColor: t ? l.colorValue : l.value,
4709
- tooltip: l.label,
4710
- "aria-label": `${l.label} text color`,
4711
- tabIndex: d === h ? 0 : -1,
4712
- "data-highlighted": h === d,
4717
+ textColor: t ? h.colorValue : h.value,
4718
+ tooltip: h.label,
4719
+ "aria-label": `${h.label} text color`,
4720
+ tabIndex: d === l ? 0 : -1,
4721
+ "data-highlighted": l === d,
4713
4722
  useColorValue: t
4714
4723
  },
4715
- l.value
4724
+ h.value
4716
4725
  )) }),
4717
4726
  /* @__PURE__ */ c(Ge, {}),
4718
4727
  /* @__PURE__ */ c(Ht, { orientation: "horizontal", children: /* @__PURE__ */ c(
@@ -4721,11 +4730,11 @@ function yo({
4721
4730
  onClick: e,
4722
4731
  "aria-label": "Remove text color",
4723
4732
  tooltip: "Remove text color",
4724
- tabIndex: h === i.length ? 0 : -1,
4733
+ tabIndex: l === i.length ? 0 : -1,
4725
4734
  type: "button",
4726
4735
  role: "menuitem",
4727
4736
  variant: "ghost",
4728
- "data-highlighted": h === i.length,
4737
+ "data-highlighted": l === i.length,
4729
4738
  children: /* @__PURE__ */ c(Xe, { className: "tiptap-button-icon" })
4730
4739
  }
4731
4740
  ) })
@@ -4747,21 +4756,21 @@ function vo({
4747
4756
  onApplied: s,
4748
4757
  ...o
4749
4758
  }) {
4750
- const { editor: a } = yt(n), [h, l] = R(!1), { isVisible: d, canTextColor: f, isActive: m, label: u, Icon: y } = ii({
4759
+ const { editor: a } = yt(n), [l, h] = $(!1), { isVisible: d, canTextColor: m, isActive: f, label: g, Icon: y } = ii({
4751
4760
  editor: a,
4752
4761
  hideWhenUnavailable: t,
4753
4762
  onApplied: s
4754
4763
  });
4755
- return d ? /* @__PURE__ */ k(dn, { open: h, onOpenChange: l, children: [
4764
+ return d ? /* @__PURE__ */ k(dn, { open: l, onOpenChange: h, children: [
4756
4765
  /* @__PURE__ */ c(gn, { asChild: !0, children: /* @__PURE__ */ c(
4757
4766
  wn,
4758
4767
  {
4759
- disabled: !f,
4760
- "data-active-state": m ? "on" : "off",
4761
- "data-disabled": !f,
4762
- "aria-pressed": m,
4763
- "aria-label": u,
4764
- tooltip: u,
4768
+ disabled: !m,
4769
+ "data-active-state": f ? "on" : "off",
4770
+ "data-disabled": !m,
4771
+ "aria-pressed": f,
4772
+ "aria-label": g,
4773
+ tooltip: g,
4765
4774
  ...o,
4766
4775
  children: /* @__PURE__ */ c(y, { className: "tiptap-button-icon" })
4767
4776
  }
@@ -4790,43 +4799,43 @@ function xo({
4790
4799
  editor: n,
4791
4800
  fonts: i = Co
4792
4801
  }) {
4793
- const [t, e] = R(
4802
+ const [t, e] = $(
4794
4803
  void 0
4795
- ), s = J(() => n ? n.can().setFontFamily("") : !1, [n]), o = J(
4796
- (l) => n ? l ? n.isActive("textStyle", { fontFamily: l }) : !n.isActive("textStyle", { fontFamily: /.+/ }) : !1,
4804
+ ), s = Q(() => n ? n.can().setFontFamily("") : !1, [n]), o = Q(
4805
+ (h) => n ? h ? n.isActive("textStyle", { fontFamily: h }) : !n.isActive("textStyle", { fontFamily: /.+/ }) : !1,
4797
4806
  [n]
4798
4807
  );
4799
- Z(() => {
4808
+ U(() => {
4800
4809
  if (!n) {
4801
4810
  e(void 0);
4802
4811
  return;
4803
4812
  }
4804
- const l = () => {
4813
+ const h = () => {
4805
4814
  const d = n.getAttributes("textStyle");
4806
4815
  e(d.fontFamily);
4807
4816
  };
4808
- return n.on("selectionUpdate", l), n.on("transaction", l), l(), () => {
4809
- n.off("selectionUpdate", l), n.off("transaction", l);
4817
+ return n.on("selectionUpdate", h), n.on("transaction", h), h(), () => {
4818
+ n.off("selectionUpdate", h), n.off("transaction", h);
4810
4819
  };
4811
4820
  }, [n]);
4812
- const a = J(
4813
- (l) => {
4814
- n && (l ? n.chain().focus().setFontFamily(l).run() : n.chain().focus().unsetFontFamily().run());
4821
+ const a = Q(
4822
+ (h) => {
4823
+ n && (h ? n.chain().focus().setFontFamily(h).run() : n.chain().focus().unsetFontFamily().run());
4815
4824
  },
4816
4825
  [n]
4817
- ), h = J(() => {
4826
+ ), l = Q(() => {
4818
4827
  n && n.chain().focus().unsetFontFamily().run();
4819
4828
  }, [n]);
4820
4829
  return {
4821
4830
  fonts: i,
4822
4831
  activeFontFamily: t,
4823
4832
  setFontFamily: a,
4824
- unsetFontFamily: h,
4833
+ unsetFontFamily: l,
4825
4834
  canSetFontFamily: s,
4826
4835
  isFontFamilyActive: o
4827
4836
  };
4828
4837
  }
4829
- const bn = $(({ editor: n, fonts: i }, t) => {
4838
+ const bn = A(({ editor: n, fonts: i }, t) => {
4830
4839
  const {
4831
4840
  fonts: e,
4832
4841
  activeFontFamily: s,
@@ -4842,33 +4851,33 @@ const bn = $(({ editor: n, fonts: i }, t) => {
4842
4851
  ref: t,
4843
4852
  className: "font-family-select",
4844
4853
  value: s || "",
4845
- onChange: (h) => o(h.target.value),
4846
- children: e.map((h) => /* @__PURE__ */ c(
4854
+ onChange: (l) => o(l.target.value),
4855
+ children: e.map((l) => /* @__PURE__ */ c(
4847
4856
  "option",
4848
4857
  {
4849
- value: h.value,
4850
- style: { fontFamily: h.value || void 0 },
4851
- children: h.label
4858
+ value: l.value,
4859
+ style: { fontFamily: l.value || void 0 },
4860
+ children: l.label
4852
4861
  },
4853
- h.label
4862
+ l.label
4854
4863
  ))
4855
4864
  }
4856
4865
  );
4857
4866
  });
4858
4867
  bn.displayName = "FontFamilySelect";
4859
4868
  function Go({ api: n }) {
4860
- const [i, t] = R(null), [e, s] = R(1), [o, a] = R(1);
4861
- return Z(() => {
4869
+ const [i, t] = $(null), [e, s] = $(1), [o, a] = $(1);
4870
+ return U(() => {
4862
4871
  if (!n) return;
4863
- const h = (f) => {
4864
- t(f), s(n.getState().viewport.scale), a(f.scaleWhenCreate || 1);
4865
- }, l = () => {
4872
+ const l = (m) => {
4873
+ t(m), s(n.getState().viewport.scale), a(m.scaleWhenCreate || 1);
4874
+ }, h = () => {
4866
4875
  t(null);
4867
- }, d = (f) => {
4868
- s(f);
4876
+ }, d = (m) => {
4877
+ s(m);
4869
4878
  };
4870
- return n.on("texteditor:register", h), n.on("texteditor:unregister", l), n.on("viewport:scale:change", d), () => {
4871
- n.off("texteditor:register", h), n.off("texteditor:unregister", l), n.off("viewport:scale:change", d);
4879
+ return n.on("texteditor:register", l), n.on("texteditor:unregister", h), n.on("viewport:scale:change", d), () => {
4880
+ n.off("texteditor:register", l), n.off("texteditor:unregister", h), n.off("viewport:scale:change", d);
4872
4881
  };
4873
4882
  }, [n]), !n || !i ? null : /* @__PURE__ */ c(Ie, { children: i && /* @__PURE__ */ k(Jn, { className: "rich-text-bubble-menu bubble-menu", editor: i, appendTo: () => document.getElementById("rich-text-html-element"), style: {
4874
4883
  transformOrigin: "bottom center",