@nightshadeui/canvas 3.13.0 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/canvas.mjs CHANGED
@@ -1,23 +1,24 @@
1
1
  import { Fragment as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createVNode as a, guardReactiveProps as o, markRaw as s, normalizeClass as c, normalizeProps as l, normalizeStyle as u, openBlock as d, reactive as f, renderList as p, renderSlot as m, resolveComponent as h, toDisplayString as g, withCtx as _, withModifiers as v } from "vue";
2
+ import { DomEventProxy as ee, InputStateManager as te, InputStateManager as y, boxCenter as ne, boxFromPoints as b, boxOverlap as re, clamp as x, getCssColorVar as ie, getCssVarNumber as S, subtractPoints as ae } from "@nightshadeui/util";
2
3
  // \0rolldown/runtime.js
3
- var ee = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), y = (e, t) => {
4
+ var C = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), w = (e, t) => {
4
5
  let n = e.__vccOpts || e;
5
6
  for (let [e, r] of t) n[e] = r;
6
7
  return n;
7
- }, te = { props: { canvas: {
8
+ }, T = { props: { canvas: {
8
9
  type: Object,
9
10
  required: !0
10
- } } }, ne = {
11
+ } } }, oe = {
11
12
  key: 0,
12
13
  class: "CanvasBoxSelect tone-primary"
13
14
  };
14
- function re(e, t, a, o, s, c) {
15
- return a.canvas.boxSelect.isSelecting() ? (d(), r("div", ne, [i("div", {
15
+ function se(e, t, a, o, s, c) {
16
+ return a.canvas.boxSelect.isSelecting() ? (d(), r("div", oe, [i("div", {
16
17
  class: "Box",
17
18
  style: u(a.canvas.boxSelect.getSelectionStyle())
18
19
  }, null, 4)])) : n("", !0);
19
20
  }
20
- var b = /*#__PURE__*/ y(te, [["render", re], ["__scopeId", "data-v-102d2948"]]), ie = {
21
+ var E = /*#__PURE__*/ w(T, [["render", se], ["__scopeId", "data-v-102d2948"]]), D = {
21
22
  props: { canvas: {
22
23
  type: Object,
23
24
  required: !0
@@ -40,7 +41,7 @@ var b = /*#__PURE__*/ y(te, [["render", re], ["__scopeId", "data-v-102d2948"]]),
40
41
  return `(${e.x.toFixed(2)}, ${e.y.toFixed(2)})`;
41
42
  } }
42
43
  };
43
- function ae(e, n, r, o, s, c) {
44
+ function O(e, n, r, o, s, c) {
44
45
  let l = h("HGroup"), u = h("VGroup");
45
46
  return d(), t(u, {
46
47
  class: "CanvasDebugCoords",
@@ -71,7 +72,7 @@ function ae(e, n, r, o, s, c) {
71
72
  _: 1
72
73
  });
73
74
  }
74
- var oe = /*#__PURE__*/ y(ie, [["render", ae], ["__scopeId", "data-v-c4407149"]]), se = { props: {
75
+ var k = /*#__PURE__*/ w(D, [["render", O], ["__scopeId", "data-v-c4407149"]]), A = { props: {
75
76
  canvasObject: {
76
77
  type: Object,
77
78
  required: !0
@@ -81,7 +82,7 @@ var oe = /*#__PURE__*/ y(ie, [["render", ae], ["__scopeId", "data-v-c4407149"]])
81
82
  required: !0
82
83
  }
83
84
  } };
84
- function x(e, t, n, i, a, o) {
85
+ function ce(e, t, n, i, a, o) {
85
86
  return d(), r("div", {
86
87
  class: c(["ResizeHandle", `ResizeHandle-${n.direction}`]),
87
88
  onUidragstart: t[0] ||= v((e) => n.canvasObject.startResizing(n.direction), ["stop", "prevent"]),
@@ -90,8 +91,8 @@ function x(e, t, n, i, a, o) {
90
91
  }, null, 34);
91
92
  }
92
93
  // src/components/CanvasObject.vue
93
- var S = {
94
- components: { CanvasObjectResize: /* @__PURE__ */ y(se, [["render", x], ["__scopeId", "data-v-0ef12a7d"]]) },
94
+ var j = {
95
+ components: { CanvasObjectResize: /* @__PURE__ */ w(A, [["render", ce], ["__scopeId", "data-v-0ef12a7d"]]) },
95
96
  props: {
96
97
  canvas: {
97
98
  type: Object,
@@ -187,7 +188,7 @@ var S = {
187
188
  this.canvas.objectRegistry.unregister(this.objectId), this.canvasObject.setElement(null), this.canvas.selection.removeFromSelection(this.objectId), this.canvas.events.objectPosUpdated.removeAll(this), this.canvas.events.selectionChanged.removeAll(this);
188
189
  }
189
190
  };
190
- function C(n, i, a, s, c, f) {
191
+ function le(n, i, a, s, c, f) {
191
192
  let g = h("CanvasObjectResize");
192
193
  return d(), r("div", {
193
194
  ref: "rootEl",
@@ -203,8 +204,8 @@ function C(n, i, a, s, c, f) {
203
204
  direction: e
204
205
  }, null, 8, ["canvasObject", "direction"]))), 128))], 36);
205
206
  }
206
- var w = /*#__PURE__*/ y(S, [["render", C]]), ce = {
207
- components: { CanvasBoxSelect: b },
207
+ var ue = /*#__PURE__*/ w(j, [["render", le]]), de = {
208
+ components: { CanvasBoxSelect: E },
208
209
  props: { canvas: {
209
210
  type: Object,
210
211
  required: !0
@@ -218,10 +219,10 @@ var w = /*#__PURE__*/ y(S, [["render", C]]), ce = {
218
219
  methods: { onCanvasUiClick() {
219
220
  this.canvas.selection.deselectAll();
220
221
  } }
221
- }, le = { class: "CanvasView" };
222
- function ue(e, t, n, o, s, c) {
222
+ }, fe = { class: "CanvasView" };
223
+ function M(e, t, n, o, s, c) {
223
224
  let l = h("CanvasBoxSelect");
224
- return d(), r("div", le, [i("div", {
225
+ return d(), r("div", fe, [i("div", {
225
226
  ref: "viewport",
226
227
  class: "Viewport",
227
228
  onMousedown: t[0] ||= (...e) => n.canvas.pan.onMouseDown && n.canvas.pan.onMouseDown(...e),
@@ -246,129 +247,7 @@ function ue(e, t, n, o, s, c) {
246
247
  a(l, { canvas: n.canvas }, null, 8, ["canvas"])
247
248
  ], 544), m(e.$slots, "overlays", {}, void 0, !0)]);
248
249
  }
249
- var T = /*#__PURE__*/ y(ce, [["render", ue], ["__scopeId", "data-v-0fb4b6a8"]]);
250
- // ../util/out/box.js
251
- function E(e, t) {
252
- return [{
253
- x: Math.min(e.x, t.x),
254
- y: Math.min(e.y, t.y)
255
- }, {
256
- x: Math.max(e.x, t.x),
257
- y: Math.max(e.y, t.y)
258
- }];
259
- }
260
- function D(e, t) {
261
- let n = e[1].x >= t[0].x && t[1].x >= e[0].x, r = e[1].y >= t[0].y && t[1].y >= e[0].y;
262
- return n && r;
263
- }
264
- // ../util/out/dom/DomEventProxy.js
265
- var de = class {
266
- constructor(e) {
267
- this.target = e, this.entries = [];
268
- }
269
- add(e, t, n) {
270
- this.target.addEventListener(e, t, n), this.entries.push({
271
- type: e,
272
- listener: t,
273
- options: n
274
- });
275
- }
276
- removeAll() {
277
- for (let e of this.entries) this.target.removeEventListener(e.type, e.listener, e.options);
278
- this.entries = [];
279
- }
280
- }, O = [
281
- "button",
282
- "a",
283
- "input",
284
- "textarea",
285
- "select",
286
- "[role=\"textbox\"]",
287
- "[role=\"button\"]",
288
- "[nodrag]"
289
- ], k = class {
290
- constructor() {
291
- this.lastMousePos = {
292
- x: window.innerWidth * .5,
293
- y: window.innerHeight * .5
294
- }, this.lmbPressed = !1, this.mmbPressed = !1, this.rmbPressed = !1, this.altKey = !1, this.ctrlKey = !1, this.metaKey = !1, this.shiftKey = !1, this.dragDistance = 4, this.windowEvents = new de(window), this.lastMouseDownPos = {
295
- x: window.innerWidth * .5,
296
- y: window.innerHeight * .5
297
- }, this.lastMouseDownTarget = null, this.dragTarget = null, this.inClickVicinity = !1, this.listening = !1;
298
- }
299
- get ctrlOrMetaKey() {
300
- return this.ctrlKey || this.metaKey;
301
- }
302
- mount() {
303
- this.listening || (this.listening = !0, this.windowEvents.add("mousedown", (e) => this.onMouseDown(e)), this.windowEvents.add("mousemove", (e) => this.onMouseMove(e)), this.windowEvents.add("mouseup", (e) => this.onMouseUp(e)), this.windowEvents.add("keydown", (e) => this.onKeyDown(e)), this.windowEvents.add("keyup", (e) => this.onKeyUp(e)));
304
- }
305
- unmount() {
306
- this.listening && (this.listening = !1, this.windowEvents.removeAll(), this.dragTarget = null, this.inClickVicinity = !1, this.lastMouseDownTarget = null);
307
- }
308
- onMouseDown(e) {
309
- this.lastMousePos = {
310
- x: e.pageX,
311
- y: e.pageY
312
- }, this.lmbPressed = e.button === 0, this.mmbPressed = e.button === 1, this.rmbPressed = e.button === 2, e.button === 0 && (this.lastMouseDownPos = {
313
- x: e.pageX,
314
- y: e.pageY
315
- }, this.lastMouseDownTarget = e.target, this.inClickVicinity = !0);
316
- }
317
- onMouseMove(e) {
318
- if (this.lastMousePos = {
319
- x: e.pageX,
320
- y: e.pageY
321
- }, !this.lmbPressed) return;
322
- if (this.dragTarget) {
323
- this.dragTarget.dispatchEvent(this.cloneMouseEvent("uidragmove", e));
324
- return;
325
- }
326
- if (!this.inClickVicinity || !this.lastMouseDownTarget) return;
327
- let t = e.pageX - this.lastMouseDownPos.x, n = e.pageY - this.lastMouseDownPos.y;
328
- Math.hypot(t, n) < this.dragDistance || (this.inClickVicinity = !1, this.isDragAllowed(this.lastMouseDownTarget) && (this.dragTarget = this.lastMouseDownTarget, this.dragTarget.dispatchEvent(this.cloneMouseEvent("uidragstart", e))));
329
- }
330
- onMouseUp(e) {
331
- if (e.button === 0) {
332
- let t = this.dragTarget, n = this.inClickVicinity, r = this.lastMouseDownTarget;
333
- this.dragTarget = null, this.inClickVicinity = !1, this.lastMouseDownTarget = null, t && t.dispatchEvent(this.cloneMouseEvent("uidragend", e)), n && r && (r.dispatchEvent(this.cloneMouseEvent("uiclick", e)), this.dispatchActivate(r, e));
334
- }
335
- this.lastMousePos = {
336
- x: e.pageX,
337
- y: e.pageY
338
- }, this.lmbPressed = !1, this.mmbPressed = !1, this.rmbPressed = !1;
339
- }
340
- onKeyDown(e) {
341
- this.updateModifiers(e), (e.key === "Enter" || e.key === " ") && e.target && (e.target === document.body && e.key === " " && e.preventDefault(), this.dispatchActivate(e.target, e));
342
- }
343
- onKeyUp(e) {
344
- this.updateModifiers(e);
345
- }
346
- updateModifiers(e) {
347
- this.altKey = e.altKey, this.ctrlKey = e.ctrlKey, this.metaKey = e.metaKey, this.shiftKey = e.shiftKey;
348
- }
349
- dispatchActivate(e, t) {
350
- e.closest(":disabled") || e.dispatchEvent(new CustomEvent("uiactivate", { detail: t }));
351
- }
352
- isDragAllowed(e) {
353
- return e instanceof Element && !e.closest(O.join(","));
354
- }
355
- cloneMouseEvent(e, t) {
356
- return new MouseEvent(e, {
357
- bubbles: !0,
358
- cancelable: !0,
359
- clientX: t.clientX,
360
- clientY: t.clientY,
361
- screenX: t.screenX,
362
- screenY: t.screenY,
363
- button: t.button,
364
- buttons: t.buttons,
365
- ctrlKey: t.ctrlKey,
366
- shiftKey: t.shiftKey,
367
- altKey: t.altKey,
368
- metaKey: t.metaKey
369
- });
370
- }
371
- }, fe = /* @__PURE__ */ ee((() => {
250
+ var pe = /*#__PURE__*/ w(de, [["render", M], ["__scopeId", "data-v-0fb4b6a8"]]), N = /* @__PURE__ */ C((() => {
372
251
  var e;
373
252
  (function(e) {
374
253
  (function(t) {
@@ -415,111 +294,111 @@ var de = class {
415
294
  } : function(e, t) {
416
295
  return e[t];
417
296
  }
418
- }, u = Object.getPrototypeOf(Function), d = typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map : he(), f = typeof Set == "function" && typeof Set.prototype.entries == "function" ? Set : ge(), p = typeof WeakMap == "function" ? WeakMap : q(), m = r ? Symbol.for("@reflect-metadata:registry") : void 0, h = U(), g = W(h);
297
+ }, u = Object.getPrototypeOf(Function), d = typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map : G(), f = typeof Set == "function" && typeof Set.prototype.entries == "function" ? Set : K(), p = typeof WeakMap == "function" ? WeakMap : q(), m = r ? Symbol.for("@reflect-metadata:registry") : void 0, h = ge(), g = H(h);
419
298
  function _(e, t, n, r) {
420
- if (E(n)) {
421
- if (!M(e) || !me(t)) throw TypeError();
422
- return oe(e, t);
299
+ if (k(n)) {
300
+ if (!pe(e) || !P(t)) throw TypeError();
301
+ return S(e, t);
423
302
  }
424
- if (!M(e) || !O(t) || !O(r) && !E(r) && !D(r)) throw TypeError();
425
- return D(r) && (r = void 0), n = j(n), se(e, t, n, r);
303
+ if (!pe(e) || !j(t) || !j(r) && !k(r) && !A(r)) throw TypeError();
304
+ return A(r) && (r = void 0), n = M(n), ae(e, t, n, r);
426
305
  }
427
306
  e("decorate", _);
428
307
  function v(e, t) {
429
308
  function n(n, r) {
430
- if (!O(n) || !E(r) && !P(r)) throw TypeError();
431
- ce(e, t, n, r);
309
+ if (!j(n) || !k(r) && !me(r)) throw TypeError();
310
+ se(e, t, n, r);
432
311
  }
433
312
  return n;
434
313
  }
435
314
  e("metadata", v);
436
315
  function ee(e, t, n, r) {
437
- if (!O(n)) throw TypeError();
438
- return E(r) || (r = j(r)), ce(e, t, n, r);
316
+ if (!j(n)) throw TypeError();
317
+ return k(r) || (r = M(r)), se(e, t, n, r);
439
318
  }
440
319
  e("defineMetadata", ee);
441
- function y(e, t, n) {
442
- if (!O(t)) throw TypeError();
443
- return E(n) || (n = j(n)), x(e, t, n);
444
- }
445
- e("hasMetadata", y);
446
320
  function te(e, t, n) {
447
- if (!O(t)) throw TypeError();
448
- return E(n) || (n = j(n)), S(e, t, n);
321
+ if (!j(t)) throw TypeError();
322
+ return k(n) || (n = M(n)), C(e, t, n);
449
323
  }
450
- e("hasOwnMetadata", te);
324
+ e("hasMetadata", te);
325
+ function y(e, t, n) {
326
+ if (!j(t)) throw TypeError();
327
+ return k(n) || (n = M(n)), w(e, t, n);
328
+ }
329
+ e("hasOwnMetadata", y);
451
330
  function ne(e, t, n) {
452
- if (!O(t)) throw TypeError();
453
- return E(n) || (n = j(n)), C(e, t, n);
331
+ if (!j(t)) throw TypeError();
332
+ return k(n) || (n = M(n)), T(e, t, n);
454
333
  }
455
334
  e("getMetadata", ne);
456
- function re(e, t, n) {
457
- if (!O(t)) throw TypeError();
458
- return E(n) || (n = j(n)), w(e, t, n);
335
+ function b(e, t, n) {
336
+ if (!j(t)) throw TypeError();
337
+ return k(n) || (n = M(n)), oe(e, t, n);
459
338
  }
460
- e("getOwnMetadata", re);
461
- function b(e, t) {
462
- if (!O(e)) throw TypeError();
463
- return E(t) || (t = j(t)), le(e, t);
339
+ e("getOwnMetadata", b);
340
+ function re(e, t) {
341
+ if (!j(e)) throw TypeError();
342
+ return k(t) || (t = M(t)), E(e, t);
464
343
  }
465
- e("getMetadataKeys", b);
466
- function ie(e, t) {
467
- if (!O(e)) throw TypeError();
468
- return E(t) || (t = j(t)), ue(e, t);
344
+ e("getMetadataKeys", re);
345
+ function x(e, t) {
346
+ if (!j(e)) throw TypeError();
347
+ return k(t) || (t = M(t)), D(e, t);
469
348
  }
470
- e("getOwnMetadataKeys", ie);
471
- function ae(e, t, n) {
472
- if (!O(t) || (E(n) || (n = j(n)), !O(t))) throw TypeError();
473
- E(n) || (n = j(n));
474
- var r = K(t, n, !1);
475
- return !E(r) && r.OrdinaryDeleteMetadata(e, t, n);
349
+ e("getOwnMetadataKeys", x);
350
+ function ie(e, t, n) {
351
+ if (!j(t) || (k(n) || (n = M(n)), !j(t))) throw TypeError();
352
+ k(n) || (n = M(n));
353
+ var r = W(t, n, !1);
354
+ return !k(r) && r.OrdinaryDeleteMetadata(e, t, n);
476
355
  }
477
- e("deleteMetadata", ae);
478
- function oe(e, t) {
356
+ e("deleteMetadata", ie);
357
+ function S(e, t) {
479
358
  for (var n = e.length - 1; n >= 0; --n) {
480
359
  var r = e[n], i = r(t);
481
- if (!E(i) && !D(i)) {
482
- if (!me(i)) throw TypeError();
360
+ if (!k(i) && !A(i)) {
361
+ if (!P(i)) throw TypeError();
483
362
  t = i;
484
363
  }
485
364
  }
486
365
  return t;
487
366
  }
488
- function se(e, t, n, r) {
367
+ function ae(e, t, n, r) {
489
368
  for (var i = e.length - 1; i >= 0; --i) {
490
369
  var a = e[i], o = a(t, n, r);
491
- if (!E(o) && !D(o)) {
492
- if (!O(o)) throw TypeError();
370
+ if (!k(o) && !A(o)) {
371
+ if (!j(o)) throw TypeError();
493
372
  r = o;
494
373
  }
495
374
  }
496
375
  return r;
497
376
  }
498
- function x(e, t, n) {
499
- if (S(e, t, n)) return !0;
377
+ function C(e, t, n) {
378
+ if (w(e, t, n)) return !0;
500
379
  var r = V(t);
501
- return !D(r) && x(e, r, n);
380
+ return !A(r) && C(e, r, n);
502
381
  }
503
- function S(e, t, n) {
504
- var r = K(t, n, !1);
505
- return !E(r) && A(r.OrdinaryHasOwnMetadata(e, t, n));
382
+ function w(e, t, n) {
383
+ var r = W(t, n, !1);
384
+ return !k(r) && de(r.OrdinaryHasOwnMetadata(e, t, n));
506
385
  }
507
- function C(e, t, n) {
508
- if (S(e, t, n)) return w(e, t, n);
386
+ function T(e, t, n) {
387
+ if (w(e, t, n)) return oe(e, t, n);
509
388
  var r = V(t);
510
- if (!D(r)) return C(e, r, n);
389
+ if (!A(r)) return T(e, r, n);
511
390
  }
512
- function w(e, t, n) {
513
- var r = K(t, n, !1);
514
- if (!E(r)) return r.OrdinaryGetOwnMetadata(e, t, n);
391
+ function oe(e, t, n) {
392
+ var r = W(t, n, !1);
393
+ if (!k(r)) return r.OrdinaryGetOwnMetadata(e, t, n);
515
394
  }
516
- function ce(e, t, n, r) {
517
- K(n, r, !0).OrdinaryDefineOwnMetadata(e, t, n, r);
395
+ function se(e, t, n, r) {
396
+ W(n, r, !0).OrdinaryDefineOwnMetadata(e, t, n, r);
518
397
  }
519
- function le(e, t) {
520
- var n = ue(e, t), r = V(e);
398
+ function E(e, t) {
399
+ var n = D(e, t), r = V(e);
521
400
  if (r === null) return n;
522
- var i = le(r, t);
401
+ var i = E(r, t);
523
402
  if (i.length <= 0) return n;
524
403
  if (n.length <= 0) return i;
525
404
  for (var a = new f(), o = [], s = 0, c = n; s < c.length; s++) {
@@ -532,11 +411,11 @@ var de = class {
532
411
  }
533
412
  return o;
534
413
  }
535
- function ue(e, t) {
536
- var n = K(e, t, !1);
414
+ function D(e, t) {
415
+ var n = W(e, t, !1);
537
416
  return n ? n.OrdinaryOwnMetadataKeys(e, t) : [];
538
417
  }
539
- function T(e) {
418
+ function O(e) {
540
419
  if (e === null) return 1;
541
420
  switch (typeof e) {
542
421
  case "undefined": return 0;
@@ -548,20 +427,20 @@ var de = class {
548
427
  default: return 6;
549
428
  }
550
429
  }
551
- function E(e) {
430
+ function k(e) {
552
431
  return e === void 0;
553
432
  }
554
- function D(e) {
433
+ function A(e) {
555
434
  return e === null;
556
435
  }
557
- function de(e) {
436
+ function ce(e) {
558
437
  return typeof e == "symbol";
559
438
  }
560
- function O(e) {
439
+ function j(e) {
561
440
  return typeof e == "object" ? e !== null : typeof e == "function";
562
441
  }
563
- function k(e, t) {
564
- switch (T(e)) {
442
+ function le(e, t) {
443
+ switch (O(e)) {
565
444
  case 0: return e;
566
445
  case 1: return e;
567
446
  case 2: return e;
@@ -572,58 +451,58 @@ var de = class {
572
451
  var n = t === 3 ? "string" : t === 5 ? "number" : "default", r = I(e, i);
573
452
  if (r !== void 0) {
574
453
  var a = r.call(e, n);
575
- if (O(a)) throw TypeError();
454
+ if (j(a)) throw TypeError();
576
455
  return a;
577
456
  }
578
- return fe(e, n === "default" ? "number" : n);
457
+ return ue(e, n === "default" ? "number" : n);
579
458
  }
580
- function fe(e, t) {
459
+ function ue(e, t) {
581
460
  if (t === "string") {
582
461
  var n = e.toString;
583
462
  if (N(n)) {
584
463
  var r = n.call(e);
585
- if (!O(r)) return r;
464
+ if (!j(r)) return r;
586
465
  }
587
466
  var i = e.valueOf;
588
467
  if (N(i)) {
589
468
  var r = i.call(e);
590
- if (!O(r)) return r;
469
+ if (!j(r)) return r;
591
470
  }
592
471
  } else {
593
472
  var i = e.valueOf;
594
473
  if (N(i)) {
595
474
  var r = i.call(e);
596
- if (!O(r)) return r;
475
+ if (!j(r)) return r;
597
476
  }
598
477
  var a = e.toString;
599
478
  if (N(a)) {
600
479
  var r = a.call(e);
601
- if (!O(r)) return r;
480
+ if (!j(r)) return r;
602
481
  }
603
482
  }
604
483
  throw TypeError();
605
484
  }
606
- function A(e) {
485
+ function de(e) {
607
486
  return !!e;
608
487
  }
609
- function pe(e) {
488
+ function fe(e) {
610
489
  return "" + e;
611
490
  }
612
- function j(e) {
613
- var t = k(e, 3);
614
- return de(t) ? t : pe(t);
615
- }
616
491
  function M(e) {
492
+ var t = le(e, 3);
493
+ return ce(t) ? t : fe(t);
494
+ }
495
+ function pe(e) {
617
496
  return Array.isArray ? Array.isArray(e) : e instanceof Object ? e instanceof Array : Object.prototype.toString.call(e) === "[object Array]";
618
497
  }
619
498
  function N(e) {
620
499
  return typeof e == "function";
621
500
  }
622
- function me(e) {
501
+ function P(e) {
623
502
  return typeof e == "function";
624
503
  }
625
- function P(e) {
626
- switch (T(e)) {
504
+ function me(e) {
505
+ switch (O(e)) {
627
506
  case 3: return !0;
628
507
  case 4: return !0;
629
508
  default: return !1;
@@ -643,7 +522,7 @@ var de = class {
643
522
  var t = I(e, a);
644
523
  if (!N(t)) throw TypeError();
645
524
  var n = t.call(e);
646
- if (!O(n)) throw TypeError();
525
+ if (!j(n)) throw TypeError();
647
526
  return n;
648
527
  }
649
528
  function R(e) {
@@ -665,9 +544,9 @@ var de = class {
665
544
  var i = r.constructor;
666
545
  return typeof i != "function" || i === e ? t : i;
667
546
  }
668
- function H() {
547
+ function he() {
669
548
  var e;
670
- !E(m) && t.Reflect !== void 0 && !(m in t.Reflect) && typeof t.Reflect.defineMetadata == "function" && (e = G(t.Reflect));
549
+ !k(m) && t.Reflect !== void 0 && !(m in t.Reflect) && typeof t.Reflect.defineMetadata == "function" && (e = U(t.Reflect));
671
550
  var n, r, i, a = new p(), o = {
672
551
  registerProvider: s,
673
552
  getProvider: l,
@@ -678,11 +557,11 @@ var de = class {
678
557
  if (!Object.isExtensible(o)) throw Error("Cannot add provider to a frozen registry.");
679
558
  switch (!0) {
680
559
  case e === t: break;
681
- case E(n):
560
+ case k(n):
682
561
  n = t;
683
562
  break;
684
563
  case n === t: break;
685
- case E(r):
564
+ case k(r):
686
565
  r = t;
687
566
  break;
688
567
  case r === t: break;
@@ -690,11 +569,11 @@ var de = class {
690
569
  }
691
570
  }
692
571
  function c(t, a) {
693
- if (!E(n)) {
572
+ if (!k(n)) {
694
573
  if (n.isProviderFor(t, a)) return n;
695
- if (!E(r)) {
574
+ if (!k(r)) {
696
575
  if (r.isProviderFor(t, a)) return n;
697
- if (!E(i)) for (var o = L(i);;) {
576
+ if (!k(i)) for (var o = L(i);;) {
698
577
  var s = z(o);
699
578
  if (!s) return;
700
579
  var c = R(s);
@@ -702,41 +581,41 @@ var de = class {
702
581
  }
703
582
  }
704
583
  }
705
- if (!E(e) && e.isProviderFor(t, a)) return e;
584
+ if (!k(e) && e.isProviderFor(t, a)) return e;
706
585
  }
707
586
  function l(e, t) {
708
587
  var n = a.get(e), r;
709
- return E(n) || (r = n.get(t)), E(r) && (r = c(e, t), E(r) || (E(n) && (n = new d(), a.set(e, n)), n.set(t, r))), r;
588
+ return k(n) || (r = n.get(t)), k(r) && (r = c(e, t), k(r) || (k(n) && (n = new d(), a.set(e, n)), n.set(t, r))), r;
710
589
  }
711
590
  function u(e) {
712
- if (E(e)) throw TypeError();
713
- return n === e || r === e || !E(i) && i.has(e);
591
+ if (k(e)) throw TypeError();
592
+ return n === e || r === e || !k(i) && i.has(e);
714
593
  }
715
594
  function h(e, t, n) {
716
595
  if (!u(n)) throw Error("Metadata provider not registered.");
717
596
  var r = l(e, t);
718
597
  if (r !== n) {
719
- if (!E(r)) return !1;
598
+ if (!k(r)) return !1;
720
599
  var i = a.get(e);
721
- E(i) && (i = new d(), a.set(e, i)), i.set(t, n);
600
+ k(i) && (i = new d(), a.set(e, i)), i.set(t, n);
722
601
  }
723
602
  return !0;
724
603
  }
725
604
  }
726
- function U() {
605
+ function ge() {
727
606
  var e;
728
- return !E(m) && O(t.Reflect) && Object.isExtensible(t.Reflect) && (e = t.Reflect[m]), E(e) && (e = H()), !E(m) && O(t.Reflect) && Object.isExtensible(t.Reflect) && Object.defineProperty(t.Reflect, m, {
607
+ return !k(m) && j(t.Reflect) && Object.isExtensible(t.Reflect) && (e = t.Reflect[m]), k(e) && (e = he()), !k(m) && j(t.Reflect) && Object.isExtensible(t.Reflect) && Object.defineProperty(t.Reflect, m, {
729
608
  enumerable: !1,
730
609
  configurable: !1,
731
610
  writable: !1,
732
611
  value: e
733
612
  }), e;
734
613
  }
735
- function W(e) {
614
+ function H(e) {
736
615
  var t = new p(), n = {
737
616
  isProviderFor: function(e, n) {
738
617
  var r = t.get(e);
739
- return !E(r) && r.has(n);
618
+ return !k(r) && r.has(n);
740
619
  },
741
620
  OrdinaryDefineOwnMetadata: o,
742
621
  OrdinaryHasOwnMetadata: i,
@@ -747,12 +626,12 @@ var de = class {
747
626
  return h.registerProvider(n), n;
748
627
  function r(r, i, a) {
749
628
  var o = t.get(r), s = !1;
750
- if (E(o)) {
629
+ if (k(o)) {
751
630
  if (!a) return;
752
631
  o = new d(), t.set(r, o), s = !0;
753
632
  }
754
633
  var c = o.get(i);
755
- if (E(c)) {
634
+ if (k(c)) {
756
635
  if (!a) return;
757
636
  if (c = new d(), o.set(i, c), !e.setProvider(r, i, n)) throw o.delete(i), s && t.delete(r), Error("Wrong provider for target.");
758
637
  }
@@ -760,18 +639,18 @@ var de = class {
760
639
  }
761
640
  function i(e, t, n) {
762
641
  var i = r(t, n, !1);
763
- return !E(i) && A(i.has(e));
642
+ return !k(i) && de(i.has(e));
764
643
  }
765
644
  function a(e, t, n) {
766
645
  var i = r(t, n, !1);
767
- if (!E(i)) return i.get(e);
646
+ if (!k(i)) return i.get(e);
768
647
  }
769
648
  function o(e, t, n, i) {
770
649
  r(n, i, !0).set(e, t);
771
650
  }
772
651
  function s(e, t) {
773
652
  var n = [], i = r(e, t, !1);
774
- if (E(i)) return n;
653
+ if (k(i)) return n;
775
654
  for (var a = L(i.keys()), o = 0;;) {
776
655
  var s = z(a);
777
656
  if (!s) return n.length = o, n;
@@ -790,20 +669,20 @@ var de = class {
790
669
  }
791
670
  function c(e, n, i) {
792
671
  var a = r(n, i, !1);
793
- if (E(a) || !a.delete(e)) return !1;
672
+ if (k(a) || !a.delete(e)) return !1;
794
673
  if (a.size === 0) {
795
674
  var o = t.get(n);
796
- E(o) || (o.delete(i), o.size === 0 && t.delete(o));
675
+ k(o) || (o.delete(i), o.size === 0 && t.delete(o));
797
676
  }
798
677
  return !0;
799
678
  }
800
679
  }
801
- function G(e) {
680
+ function U(e) {
802
681
  var t = e.defineMetadata, n = e.hasOwnMetadata, r = e.getOwnMetadata, i = e.getOwnMetadataKeys, a = e.deleteMetadata, o = new p();
803
682
  return {
804
683
  isProviderFor: function(e, t) {
805
684
  var n = o.get(e);
806
- return !E(n) && n.has(t) ? !0 : i(e, t).length ? (E(n) && (n = new f(), o.set(e, n)), n.add(t), !0) : !1;
685
+ return !k(n) && n.has(t) ? !0 : i(e, t).length ? (k(n) && (n = new f(), o.set(e, n)), n.add(t), !0) : !1;
807
686
  },
808
687
  OrdinaryDefineOwnMetadata: t,
809
688
  OrdinaryHasOwnMetadata: n,
@@ -812,15 +691,15 @@ var de = class {
812
691
  OrdinaryDeleteMetadata: a
813
692
  };
814
693
  }
815
- function K(e, t, n) {
694
+ function W(e, t, n) {
816
695
  var r = h.getProvider(e, t);
817
- if (!E(r)) return r;
696
+ if (!k(r)) return r;
818
697
  if (n) {
819
698
  if (h.setProvider(e, t, g)) return g;
820
699
  throw Error("Illegal state.");
821
700
  }
822
701
  }
823
- function he() {
702
+ function G() {
824
703
  var e = {}, t = [], n = function() {
825
704
  function e(e, t, n) {
826
705
  this._index = 0, this._keys = e, this._values = t, this._selector = n;
@@ -909,7 +788,7 @@ var de = class {
909
788
  return [e, t];
910
789
  }
911
790
  }
912
- function ge() {
791
+ function K() {
913
792
  return function() {
914
793
  function e() {
915
794
  this._map = new d();
@@ -1003,31 +882,31 @@ var de = class {
1003
882
  }
1004
883
  });
1005
884
  })(e ||= {});
1006
- })), A = class extends Error {
885
+ })), P = class extends Error {
1007
886
  constructor() {
1008
887
  super(...arguments), this.name = this.constructor.name;
1009
888
  }
1010
- }, pe = class extends A {
889
+ }, me = class extends P {
1011
890
  constructor(e, t) {
1012
891
  super(`"${t}" not found in Mesh "${e}"`);
1013
892
  }
1014
- }, j = class extends A {
893
+ }, F = class extends P {
1015
894
  constructor(e) {
1016
895
  super(`Invalid binding "${e}". Valid bindings are: string to constructor e.g. ("MyService", MyService) or abstract class to constructor e.g. (MyService, MyServiceImpl) orconstructor to self e.g. (MyService)`);
1017
896
  }
1018
897
  };
1019
898
  // ../../node_modules/mesh-ioc/out/main/util.js
1020
- function M(e) {
899
+ function I(e) {
1021
900
  return typeof e == "string" ? e : e.name;
1022
901
  }
1023
- function N(e) {
902
+ function L(e) {
1024
903
  return typeof e == "function" && e.prototype != null;
1025
904
  }
1026
- function me(e, ...t) {
1027
- return N(e) ? new e(...t) : e(...t);
905
+ function R(e, ...t) {
906
+ return L(e) ? new e(...t) : e(...t);
1028
907
  }
1029
908
  // ../../node_modules/mesh-ioc/out/main/mesh.js
1030
- var P = Symbol.for("MESH_REF"), F = class e {
909
+ var z = Symbol.for("MESH_REF"), B = class e {
1031
910
  constructor(t = "default", n = void 0) {
1032
911
  this.name = t, this.parent = n, this.bindings = /* @__PURE__ */ new Map(), this.instances = /* @__PURE__ */ new Map(), this.middlewares = [], this.constant(e, this), this.injectRef(this);
1033
912
  }
@@ -1046,7 +925,7 @@ var P = Symbol.for("MESH_REF"), F = class e {
1046
925
  return this.middlewares.push(e), this;
1047
926
  }
1048
927
  service(e, t) {
1049
- let n = M(e);
928
+ let n = I(e);
1050
929
  if (typeof t == "function") return this.bindings.set(n, {
1051
930
  type: "service",
1052
931
  class: t
@@ -1055,10 +934,10 @@ var P = Symbol.for("MESH_REF"), F = class e {
1055
934
  type: "service",
1056
935
  class: e
1057
936
  }), this;
1058
- throw new j(String(e));
937
+ throw new F(String(e));
1059
938
  }
1060
939
  scope(e, t) {
1061
- let n = M(e);
940
+ let n = I(e);
1062
941
  if (typeof t == "function") return this.bindings.set(n, {
1063
942
  type: "scope",
1064
943
  factory: t
@@ -1067,43 +946,43 @@ var P = Symbol.for("MESH_REF"), F = class e {
1067
946
  type: "scope",
1068
947
  factory: e
1069
948
  }), this;
1070
- throw new j(String(e));
949
+ throw new F(String(e));
1071
950
  }
1072
951
  constant(e, t) {
1073
- let n = M(e);
952
+ let n = I(e);
1074
953
  return this.bindings.set(n, {
1075
954
  type: "constant",
1076
955
  value: t
1077
956
  }), this;
1078
957
  }
1079
958
  alias(e, t) {
1080
- let n = M(e), r = M(t);
959
+ let n = I(e), r = I(t);
1081
960
  return this.bindings.set(n, {
1082
961
  type: "alias",
1083
962
  key: r
1084
963
  }), this;
1085
964
  }
1086
965
  delete(e) {
1087
- let t = M(e);
966
+ let t = I(e);
1088
967
  return this.bindings.delete(t), this;
1089
968
  }
1090
969
  resolve(e, t = !0) {
1091
970
  let n = this.tryResolve(e, t);
1092
971
  if (n === void 0) {
1093
- let t = M(e);
1094
- throw new pe(this.name, t);
972
+ let t = I(e);
973
+ throw new me(this.name, t);
1095
974
  }
1096
975
  return n;
1097
976
  }
1098
977
  tryResolve(e, t = !0) {
1099
- let n = M(e), r = this.instances.get(n);
978
+ let n = I(e), r = this.instances.get(n);
1100
979
  if (r) return r;
1101
980
  let i = this.bindings.get(n);
1102
981
  if (i) return r = this.instantiate(i), r = this.connect(r), this.instances.set(n, r), r;
1103
982
  if (t && this.parent) return this.parent.tryResolve(e);
1104
983
  }
1105
984
  getBinding(e, t = !0) {
1106
- let n = M(e), r = this.bindings.get(n);
985
+ let n = I(e), r = this.bindings.get(n);
1107
986
  if (r) return r;
1108
987
  if (t && this.parent) return this.parent.getBinding(e);
1109
988
  }
@@ -1118,7 +997,7 @@ var P = Symbol.for("MESH_REF"), F = class e {
1118
997
  for (let [, t] of this.allBindings()) t.type === "service" && (yield* this.traverseClassDeps(t.class, e));
1119
998
  }
1120
999
  *traverseClassDeps(e, t = /* @__PURE__ */ new Set()) {
1121
- let n = L(e);
1000
+ let n = he(e);
1122
1001
  for (let e of n) {
1123
1002
  if (t.has(e.key)) continue;
1124
1003
  t.add(e.key), yield e;
@@ -1134,7 +1013,7 @@ var P = Symbol.for("MESH_REF"), F = class e {
1134
1013
  return Object.defineProperty(n, "name", { value: t.name }), this.injectRef(n.prototype), new n();
1135
1014
  }
1136
1015
  case "constant": return e.value;
1137
- case "scope": return (t) => me(e.factory, t ?? this);
1016
+ case "scope": return (t) => R(e.factory, t ?? this);
1138
1017
  }
1139
1018
  }
1140
1019
  applyMiddleware(e) {
@@ -1143,42 +1022,42 @@ var P = Symbol.for("MESH_REF"), F = class e {
1143
1022
  return this.parent && (t = this.parent.applyMiddleware(t)), t;
1144
1023
  }
1145
1024
  injectRef(e) {
1146
- typeof e == "object" && Object.defineProperty(e, P, {
1025
+ typeof e == "object" && Object.defineProperty(e, z, {
1147
1026
  get: () => this,
1148
1027
  enumerable: !1,
1149
1028
  configurable: !0
1150
1029
  });
1151
1030
  }
1152
1031
  };
1153
- fe();
1154
- var I = [];
1155
- function L(e) {
1032
+ N();
1033
+ var V = [];
1034
+ function he(e) {
1156
1035
  let t = [], n = e;
1157
1036
  for (; n !== Object.prototype;) {
1158
- let e = I.filter((e) => e.class === n);
1037
+ let e = V.filter((e) => e.class === n);
1159
1038
  t.push(...e), n = Object.getPrototypeOf(n);
1160
1039
  }
1161
1040
  return t;
1162
1041
  }
1163
1042
  // ../../node_modules/mesh-ioc/out/main/proxy.js
1164
- var R = Object.getOwnPropertyNames(Reflect);
1165
- function z(e, t, n = !0) {
1043
+ var ge = Object.getOwnPropertyNames(Reflect);
1044
+ function H(e, t, n = !0) {
1166
1045
  let r, i = {};
1167
- for (let a of R) i[a] = function(i, ...o) {
1046
+ for (let a of ge) i[a] = function(i, ...o) {
1168
1047
  let s = r;
1169
- return s ||= e[P].resolve(t), n && (r = s), Reflect[a](s, ...o);
1048
+ return s ||= e[z].resolve(t), n && (r = s), Reflect[a](s, ...o);
1170
1049
  };
1171
1050
  return new Proxy(e, i);
1172
1051
  }
1173
1052
  // src/CanvasConfig.ts
1174
- var B = class {
1053
+ var U = class {
1175
1054
  constructor() {
1176
1055
  this.autoCenter = !0, this.allowMultiSelect = !0;
1177
1056
  }
1178
1057
  set(e) {
1179
1058
  Object.assign(this, e);
1180
1059
  }
1181
- }, V = class {
1060
+ }, W = class {
1182
1061
  constructor() {
1183
1062
  this.objects = /* @__PURE__ */ new Map();
1184
1063
  }
@@ -1194,7 +1073,7 @@ var B = class {
1194
1073
  getAll() {
1195
1074
  return [...this.objects.values()];
1196
1075
  }
1197
- }, H = class {
1076
+ }, G = class {
1198
1077
  constructor() {
1199
1078
  this._groups = /* @__PURE__ */ new Map();
1200
1079
  }
@@ -1218,13 +1097,13 @@ var B = class {
1218
1097
  emit(e) {
1219
1098
  for (let t of this._groups.values()) for (let n of t) n(e);
1220
1099
  }
1221
- }, U = class {
1100
+ }, K = class {
1222
1101
  constructor() {
1223
- this.mounted = new H(), this.unmounted = new H(), this.selectionChanged = new H(), this.dragMove = new H(), this.dragEnd = new H(), this.objectPosUpdated = new H();
1102
+ this.mounted = new G(), this.unmounted = new G(), this.selectionChanged = new G(), this.dragMove = new G(), this.dragEnd = new G(), this.objectPosUpdated = new G();
1224
1103
  }
1225
- }, W = class {
1104
+ }, q = class {
1226
1105
  constructor() {
1227
- this.selectedIds = /* @__PURE__ */ new Set(), this.events = z(this, U);
1106
+ this.selectedIds = /* @__PURE__ */ new Set(), this.events = H(this, K);
1228
1107
  }
1229
1108
  get size() {
1230
1109
  return this.selectedIds.size;
@@ -1282,58 +1161,7 @@ var B = class {
1282
1161
  setSelected(e, t) {
1283
1162
  t ? this.addToSelection(e) : this.removeFromSelection(e);
1284
1163
  }
1285
- };
1286
- // ../util/src/math.ts
1287
- function G(e, t, n) {
1288
- return Math.max(t, Math.min(n, e));
1289
- }
1290
- // ../util/src/point.ts
1291
- function K(e, t) {
1292
- return {
1293
- x: e.x - t.x,
1294
- y: e.y - t.y
1295
- };
1296
- }
1297
- // ../util/src/box.ts
1298
- function he(e) {
1299
- let [t, n] = e;
1300
- return {
1301
- x: (n.x - t.x) * .5 + t.x,
1302
- y: (n.y - t.y) * .5 + t.y
1303
- };
1304
- }
1305
- // ../util/src/css.ts
1306
- function ge(e, t, n) {
1307
- let r = e ?? document.documentElement;
1308
- return getComputedStyle(r).getPropertyValue(t).trim() || n;
1309
- }
1310
- function q(e, t, n) {
1311
- let r = ge(e, t, String(n)), i = Number(r.replace(/px|em|%|vh|vw/g, ""));
1312
- return Number.isFinite(i) ? i : n;
1313
- }
1314
- function J(e, t, n) {
1315
- let r = e ?? document.documentElement, i = ge(e, t, n), a = document.createElement("span");
1316
- a.style.position = "absolute", a.style.visibility = "hidden", a.style.pointerEvents = "none", a.style.color = n, a.style.color = i, r.appendChild(a);
1317
- let o = getComputedStyle(a).color.trim();
1318
- return a.remove(), o || n;
1319
- }
1320
- // ../util/src/dom/DomEventProxy.ts
1321
- var _e = class {
1322
- constructor(e) {
1323
- this.target = e, this.entries = [];
1324
- }
1325
- add(e, t, n) {
1326
- this.target.addEventListener(e, t, n), this.entries.push({
1327
- type: e,
1328
- listener: t,
1329
- options: n
1330
- });
1331
- }
1332
- removeAll() {
1333
- for (let e of this.entries) this.target.removeEventListener(e.type, e.listener, e.options);
1334
- this.entries = [];
1335
- }
1336
- }, Y = class {
1164
+ }, J = class {
1337
1165
  constructor() {
1338
1166
  this.zoom = 1, this.cellSize = 32, this.scrollPos = {
1339
1167
  x: 0,
@@ -1395,12 +1223,12 @@ var _e = class {
1395
1223
  return this.canvasToLocal(this.pageToCanvas(e));
1396
1224
  }
1397
1225
  getViewportCenterInLocal() {
1398
- let e = he(this.viewportBox), t = this.pageToViewport(e);
1226
+ let e = ne(this.viewportBox), t = this.pageToViewport(e);
1399
1227
  return this.viewportToLocal(t);
1400
1228
  }
1401
- }, ve = class {
1229
+ }, _e = class {
1402
1230
  constructor() {
1403
- this.config = z(this, B), this.inputStateManager = z(this, k), this.objectRegistry = z(this, V), this.selection = z(this, W), this.space = z(this, Y), this.selectionOriginPos = null, this.initialSelectionIds = /* @__PURE__ */ new Set(), this.objectBoxes = [];
1231
+ this.config = H(this, U), this.inputStateManager = H(this, y), this.objectRegistry = H(this, W), this.selection = H(this, q), this.space = H(this, J), this.selectionOriginPos = null, this.initialSelectionIds = /* @__PURE__ */ new Set(), this.objectBoxes = [];
1404
1232
  }
1405
1233
  isSelecting() {
1406
1234
  return this.selectionOriginPos != null;
@@ -1418,11 +1246,11 @@ var _e = class {
1418
1246
  this.isSelecting() && this.updateSelection(e), this.stopSelecting();
1419
1247
  }
1420
1248
  getSelectionBox() {
1421
- return this.selectionOriginPos ? E(this.space.pageToLocal(this.selectionOriginPos), this.space.pageToLocal(this.inputStateManager.lastMousePos)) : null;
1249
+ return this.selectionOriginPos ? b(this.space.pageToLocal(this.selectionOriginPos), this.space.pageToLocal(this.inputStateManager.lastMousePos)) : null;
1422
1250
  }
1423
1251
  getSelectionStyle() {
1424
1252
  if (!this.selectionOriginPos) return null;
1425
- let e = E(this.selectionOriginPos, this.inputStateManager.lastMousePos), t = this.space.pageToCanvas(e[0]), n = this.space.pageToCanvas(e[1]);
1253
+ let e = b(this.selectionOriginPos, this.inputStateManager.lastMousePos), t = this.space.pageToCanvas(e[0]), n = this.space.pageToCanvas(e[1]);
1426
1254
  return {
1427
1255
  left: `${t.x}px`,
1428
1256
  top: `${t.y}px`,
@@ -1440,15 +1268,15 @@ var _e = class {
1440
1268
  if (!t.isSelectable()) continue;
1441
1269
  let n = t.element;
1442
1270
  if (!n) continue;
1443
- let r = n.getBoundingClientRect(), i = E({
1271
+ let r = n.getBoundingClientRect(), i = b({
1444
1272
  x: r.left,
1445
1273
  y: r.top
1446
1274
  }, {
1447
1275
  x: r.right,
1448
1276
  y: r.bottom
1449
1277
  });
1450
- if (!D(i, e)) continue;
1451
- let a = E(this.space.pageToLocal(i[0]), this.space.pageToLocal(i[1]));
1278
+ if (!re(i, e)) continue;
1279
+ let a = b(this.space.pageToLocal(i[0]), this.space.pageToLocal(i[1]));
1452
1280
  this.objectBoxes.push([t.objectId, a]);
1453
1281
  }
1454
1282
  }
@@ -1456,15 +1284,15 @@ var _e = class {
1456
1284
  let t = this.getSelectionBox();
1457
1285
  if (!t) return;
1458
1286
  let n = new Set(this.initialSelectionIds);
1459
- for (let [e, r] of this.objectBoxes) D(t, r) && n.add(e);
1287
+ for (let [e, r] of this.objectBoxes) re(t, r) && n.add(e);
1460
1288
  this.selection.setSelectedIds(n);
1461
1289
  }
1462
- }, ye = /* @__PURE__ */ new Map();
1463
- function be(e) {
1290
+ }, ve = /* @__PURE__ */ new Map();
1291
+ function ye(e) {
1464
1292
  return function(t) {
1465
1293
  return (n, r) => {
1466
- let i = ye.get(e) || [];
1467
- ye.set(e, i), i.push({
1294
+ let i = ve.get(e) || [];
1295
+ ve.set(e, i), i.push({
1468
1296
  target: n.constructor,
1469
1297
  memberName: r,
1470
1298
  metadata: t
@@ -1472,11 +1300,11 @@ function be(e) {
1472
1300
  };
1473
1301
  };
1474
1302
  }
1475
- function xe(e) {
1476
- return ye.get(e) || [];
1303
+ function be(e) {
1304
+ return ve.get(e) || [];
1477
1305
  }
1478
- function Se(e, t, n = !0) {
1479
- let r = [], i = xe(e), a = n ? t.allBindings() : t.bindings.entries();
1306
+ function xe(e, t, n = !0) {
1307
+ let r = [], i = be(e), a = n ? t.allBindings() : t.bindings.entries();
1480
1308
  for (let [e, n] of a) if (n.type === "service") for (let { target: a, memberName: o, metadata: s } of i) (a === n.class || Object.prototype.isPrototypeOf.call(a, n.class)) && r.push({
1481
1309
  target: t.resolve(e),
1482
1310
  memberName: o,
@@ -1484,30 +1312,30 @@ function Se(e, t, n = !0) {
1484
1312
  });
1485
1313
  return r;
1486
1314
  }
1487
- function Ce(e, t, n = !0, ...r) {
1488
- return Se(e, t, n).map((e) => e.target[e.memberName](...r));
1315
+ function Se(e, t, n = !0, ...r) {
1316
+ return xe(e, t, n).map((e) => e.target[e.memberName](...r));
1489
1317
  }
1490
1318
  // ../../node_modules/@flexent/init-decorator/out/main/index.js
1491
- var we = be("init");
1492
- async function Te(e, t = !0) {
1493
- let n = Ce("init", e, t);
1319
+ var Ce = ye("init");
1320
+ async function we(e, t = !0) {
1321
+ let n = Se("init", e, t);
1494
1322
  await Promise.all(n);
1495
1323
  }
1496
1324
  // \0@oxc-project+runtime@0.156.0/helpers/esm/decorateMetadata.js
1497
- function X(e, t) {
1325
+ function Y(e, t) {
1498
1326
  if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
1499
1327
  }
1500
1328
  // \0@oxc-project+runtime@0.156.0/helpers/esm/decorate.js
1501
- function Ee(e, t, n, r) {
1329
+ function Te(e, t, n, r) {
1502
1330
  var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
1503
1331
  if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
1504
1332
  else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
1505
1333
  return i > 3 && a && Object.defineProperty(t, n, a), a;
1506
1334
  }
1507
1335
  // src/CanvasMove.ts
1508
- var De = class {
1336
+ var X = class {
1509
1337
  constructor() {
1510
- this.events = z(this, U), this.selection = z(this, W), this.objectRegistry = z(this, V), this.space = z(this, Y), this.movingIds = /* @__PURE__ */ new Set(), this.moveOriginPos = null;
1338
+ this.events = H(this, K), this.selection = H(this, q), this.objectRegistry = H(this, W), this.space = H(this, J), this.movingIds = /* @__PURE__ */ new Set(), this.moveOriginPos = null;
1511
1339
  }
1512
1340
  init() {
1513
1341
  this.events.dragMove.on((e) => this.onDragMove(e)), this.events.dragEnd.on(() => this.stopMovingSelection()), this.events.unmounted.on(() => this.stopMovingSelection());
@@ -1524,27 +1352,27 @@ var De = class {
1524
1352
  }
1525
1353
  onDragMove(e) {
1526
1354
  if (!this.moveOriginPos) return;
1527
- let t = this.space.pageToLocal(this.moveOriginPos), n = K(this.space.pageToLocal({
1355
+ let t = this.space.pageToLocal(this.moveOriginPos), n = this.space.pageToLocal({
1528
1356
  x: e.pageX,
1529
1357
  y: e.pageY
1530
- }), t);
1531
- for (let e of this.movingIds) this.objectRegistry.get(e)?.onMoveOffset(n);
1358
+ }), r = ae(n, t);
1359
+ for (let e of this.movingIds) this.objectRegistry.get(e)?.onMoveOffset(r);
1532
1360
  }
1533
1361
  stopMovingSelection() {
1534
1362
  for (let e of this.movingIds) this.objectRegistry.get(e)?.onMoveEnd();
1535
1363
  this.movingIds.clear(), this.moveOriginPos = null;
1536
1364
  }
1537
1365
  };
1538
- Ee([
1539
- we(),
1540
- X("design:type", Function),
1541
- X("design:paramtypes", []),
1542
- X("design:returntype", void 0)
1543
- ], De.prototype, "init", null);
1366
+ Te([
1367
+ Ce(),
1368
+ Y("design:type", Function),
1369
+ Y("design:paramtypes", []),
1370
+ Y("design:returntype", void 0)
1371
+ ], X.prototype, "init", null);
1544
1372
  // src/CanvasObjectController.ts
1545
- var Oe = class {
1373
+ var Ee = class {
1546
1374
  constructor(e) {
1547
- this.config = z(this, B), this.events = z(this, U), this.selection = z(this, W), this.move = z(this, De), this.space = z(this, Y), this.element = null, this.selectable = !0, this.movable = !0, this.snapToGrid = !0, this.resizable = "none", this.bounds = [{
1375
+ this.config = H(this, U), this.events = H(this, K), this.selection = H(this, q), this.move = H(this, X), this.space = H(this, J), this.element = null, this.selectable = !0, this.movable = !0, this.snapToGrid = !0, this.resizable = "none", this.bounds = [{
1548
1376
  x: 1,
1549
1377
  y: 1
1550
1378
  }, {
@@ -1620,15 +1448,15 @@ var Oe = class {
1620
1448
  let e = this.space.localToCanvas({
1621
1449
  x: this.localPos.x,
1622
1450
  y: this.localPos.y
1623
- }), t = K(this.space.localToCanvas({
1451
+ }), t = this.space.localToCanvas({
1624
1452
  x: this.localPos.x + this.localPos.w,
1625
1453
  y: this.localPos.y + this.localPos.h
1626
- }), e), n = this.pos.w === void 0 ? void 0 : t.x, r = this.pos.h === void 0 ? void 0 : t.y;
1454
+ }), n = ae(t, e), r = this.pos.w === void 0 ? void 0 : n.x, i = this.pos.h === void 0 ? void 0 : n.y;
1627
1455
  return {
1628
1456
  x: e.x,
1629
1457
  y: e.y,
1630
- w: n,
1631
- h: r
1458
+ w: r,
1459
+ h: i
1632
1460
  };
1633
1461
  }
1634
1462
  getStyle() {
@@ -1704,8 +1532,8 @@ var Oe = class {
1704
1532
  this.resizingDirection &&= (this.commitNewPos({
1705
1533
  x: this.maybeRound(this.localPos.x),
1706
1534
  y: this.maybeRound(this.localPos.y),
1707
- w: G(this.maybeRound(this.localPos.w), this.bounds[0].x, this.bounds[1].x),
1708
- h: G(this.maybeRound(this.localPos.h), this.bounds[0].y, this.bounds[1].y)
1535
+ w: x(this.maybeRound(this.localPos.w), this.bounds[0].x, this.bounds[1].x),
1536
+ h: x(this.maybeRound(this.localPos.h), this.bounds[0].y, this.bounds[1].y)
1709
1537
  }), null);
1710
1538
  }
1711
1539
  getResizeDirections() {
@@ -1742,15 +1570,15 @@ var Oe = class {
1742
1570
  this.localPos = {
1743
1571
  x: this.pos.x,
1744
1572
  y: this.pos.y,
1745
- w: G(e, this.bounds[0].x, this.bounds[1].x),
1746
- h: G(t, this.bounds[0].y, this.bounds[1].y)
1573
+ w: x(e, this.bounds[0].x, this.bounds[1].x),
1574
+ h: x(t, this.bounds[0].y, this.bounds[1].y)
1747
1575
  };
1748
1576
  }
1749
1577
  maybeRound(e) {
1750
1578
  return this.snapToGrid ? Math.round(e) : e;
1751
1579
  }
1752
1580
  getResizingUpdates(e, t) {
1753
- let [n, r] = this.resizingBounds, i = G(t.x, r.x - this.bounds[1].x, r.x - this.bounds[0].x), a = G(t.x, n.x + this.bounds[0].x, n.x + this.bounds[1].x), o = G(t.y, r.y - this.bounds[1].y, r.y - this.bounds[0].y), s = G(t.y, n.y + this.bounds[0].y, n.y + this.bounds[1].y);
1581
+ let [n, r] = this.resizingBounds, i = x(t.x, r.x - this.bounds[1].x, r.x - this.bounds[0].x), a = x(t.x, n.x + this.bounds[0].x, n.x + this.bounds[1].x), o = x(t.y, r.y - this.bounds[1].y, r.y - this.bounds[0].y), s = x(t.y, n.y + this.bounds[0].y, n.y + this.bounds[1].y);
1754
1582
  switch (e) {
1755
1583
  case "n": return [{
1756
1584
  x: n.x,
@@ -1819,7 +1647,7 @@ var Oe = class {
1819
1647
  }
1820
1648
  }, Z = class {
1821
1649
  constructor() {
1822
- this.viewportEl = null, this.windowEvents = new _e(window), this.config = z(this, B), this.space = z(this, Y);
1650
+ this.viewportEl = null, this.windowEvents = new ee(window), this.config = H(this, U), this.space = H(this, J);
1823
1651
  }
1824
1652
  mount(e) {
1825
1653
  this.viewportEl = e, this.recalcCanvasMetrics(), this.updateViewportBox(), this.centerOnOrigin(), this.onScroll(), this.windowEvents.add("resize", () => this.updateViewportBox()), this.windowEvents.add("scroll", () => this.updateViewportBox()), this.config.autoCenter && requestAnimationFrame(() => this.centerOnOrigin());
@@ -1883,16 +1711,16 @@ var Oe = class {
1883
1711
  });
1884
1712
  }
1885
1713
  createGridSvg() {
1886
- let e = this.space.cellSize, t = q(this.viewportEl, "--CanvasView-grid-subdivisions", 4), n = Math.round(e / t), r = Array.from({ length: t + 1 }, (e, t) => t * n);
1714
+ let e = this.space.cellSize, t = S(this.viewportEl, "--CanvasView-grid-subdivisions", 4), n = Math.round(e / t), r = Array.from({ length: t + 1 }, (e, t) => t * n);
1887
1715
  r[t] = e;
1888
1716
  let i = [{
1889
1717
  coords: r,
1890
- radius: q(this.viewportEl, "--CanvasView-grid-minor-radius", 1),
1891
- fill: J(this.viewportEl, "--CanvasView-grid-minor-fill", "var(--border-base)")
1718
+ radius: S(this.viewportEl, "--CanvasView-grid-minor-radius", 1),
1719
+ fill: ie(this.viewportEl, "--CanvasView-grid-minor-fill", "var(--border-base)")
1892
1720
  }, {
1893
1721
  coords: [0, e],
1894
- radius: q(this.viewportEl, "--CanvasView-grid-major-radius", 2),
1895
- fill: J(this.viewportEl, "--CanvasView-grid-major-fill", "var(--border-deep)")
1722
+ radius: S(this.viewportEl, "--CanvasView-grid-major-radius", 2),
1723
+ fill: ie(this.viewportEl, "--CanvasView-grid-major-fill", "var(--border-deep)")
1896
1724
  }].filter((e) => e.radius > 0).flatMap((e) => e.coords.flatMap((t) => e.coords.map((n) => `<circle cx="${t}" cy="${n}" r="${e.radius}" fill="${e.fill}"/>`)));
1897
1725
  return [
1898
1726
  `<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${e}" viewBox="0 0 ${e} ${e}">`,
@@ -1934,8 +1762,8 @@ var Oe = class {
1934
1762
  };
1935
1763
  }
1936
1764
  recalcCanvasMetrics() {
1937
- let e = q(this.viewportEl, "--CanvasView-margin-cells", 64);
1938
- this.space.cellSize = q(this.viewportEl, "--CanvasView-grid-cell-size", 32);
1765
+ let e = S(this.viewportEl, "--CanvasView-margin-cells", 64);
1766
+ this.space.cellSize = S(this.viewportEl, "--CanvasView-grid-cell-size", 32);
1939
1767
  let t = e * this.space.cellSize;
1940
1768
  this.space.canvasSize = {
1941
1769
  x: t * 2,
@@ -1947,7 +1775,7 @@ var Oe = class {
1947
1775
  }
1948
1776
  }, Q = class {
1949
1777
  constructor() {
1950
- this.viewport = z(this, Z), this.events = z(this, U), this.windowEvents = new _e(window), this.isPanning = !1;
1778
+ this.viewport = H(this, Z), this.events = H(this, K), this.windowEvents = new ee(window), this.isPanning = !1;
1951
1779
  }
1952
1780
  init() {
1953
1781
  this.events.unmounted.on(() => this.stopPanning());
@@ -1965,11 +1793,11 @@ var Oe = class {
1965
1793
  e.button === 1 && this.stopPanning();
1966
1794
  }
1967
1795
  };
1968
- Ee([
1969
- we(),
1970
- X("design:type", Function),
1971
- X("design:paramtypes", []),
1972
- X("design:returntype", void 0)
1796
+ Te([
1797
+ Ce(),
1798
+ Y("design:type", Function),
1799
+ Y("design:paramtypes", []),
1800
+ Y("design:returntype", void 0)
1973
1801
  ], Q.prototype, "init", null);
1974
1802
  // src/CanvasZoom.ts
1975
1803
  var $ = [
@@ -1984,19 +1812,19 @@ var $ = [
1984
1812
  1.5,
1985
1813
  1.75,
1986
1814
  2
1987
- ], ke = Math.min(...$), Ae = Math.max(...$), je = class {
1815
+ ], De = Math.min(...$), Oe = Math.max(...$), ke = class {
1988
1816
  constructor() {
1989
- this.viewport = z(this, Z), this.space = z(this, Y);
1817
+ this.viewport = H(this, Z), this.space = H(this, J);
1990
1818
  }
1991
1819
  onWheel(e) {
1992
1820
  if (!e.ctrlKey) return;
1993
1821
  e.preventDefault();
1994
- let t = G(e.deltaY, -40, 40) / 400, n = Math.exp(-t);
1822
+ let t = x(e.deltaY, -40, 40) / 400, n = Math.exp(-t);
1995
1823
  this.setZoom(this.space.zoom * n);
1996
1824
  }
1997
1825
  setZoom(e) {
1998
1826
  let t = this.space.getViewportCenterInLocal();
1999
- this.space.zoom = G(e, ke, Ae), this.viewport.scrollToLocalPoint(t);
1827
+ this.space.zoom = x(e, De, Oe), this.viewport.scrollToLocalPoint(t);
2000
1828
  }
2001
1829
  zoomIn() {
2002
1830
  let e = this.getClosestZoomStepIndex();
@@ -2014,14 +1842,14 @@ var $ = [
2014
1842
  }
2015
1843
  return e;
2016
1844
  }
2017
- }, Me = class {
1845
+ }, Ae = class {
2018
1846
  constructor(e = {}) {
2019
- this.mesh = s(new F()), this.boxSelect = z(this, ve), this.config = z(this, B), this.space = z(this, Y), this.viewport = z(this, Z), this.pan = z(this, Q), this.events = z(this, U), this.inputStateManager = z(this, k), this.objectRegistry = z(this, V), this.selection = z(this, W), this.zoom = z(this, je);
2020
- let t = e.inputStateManager ?? new k();
2021
- this.ownsInputStateManager = e.inputStateManager == null, this.mesh.connect(this), this.mesh.use((e) => f(e)), this.mesh.constant(k, t), this.mesh.service(ve), this.mesh.service(Z), this.mesh.service(Q), this.mesh.service(B), this.mesh.service(Y), this.mesh.service(U), this.mesh.service(De), this.mesh.service(V), this.mesh.service(W), this.mesh.service(je), this.config.set(e), Te(this.mesh);
1847
+ this.mesh = s(new B()), this.boxSelect = H(this, _e), this.config = H(this, U), this.space = H(this, J), this.viewport = H(this, Z), this.pan = H(this, Q), this.events = H(this, K), this.inputStateManager = H(this, y), this.objectRegistry = H(this, W), this.selection = H(this, q), this.zoom = H(this, ke);
1848
+ let t = e.inputStateManager ?? new y();
1849
+ this.ownsInputStateManager = e.inputStateManager == null, this.mesh.connect(this), this.mesh.use((e) => f(e)), this.mesh.constant(y, t), this.mesh.service(_e), this.mesh.service(Z), this.mesh.service(Q), this.mesh.service(U), this.mesh.service(J), this.mesh.service(K), this.mesh.service(X), this.mesh.service(W), this.mesh.service(q), this.mesh.service(ke), this.config.set(e), we(this.mesh);
2022
1850
  }
2023
1851
  createObjectController(e) {
2024
- return this.mesh.connect(new Oe(e));
1852
+ return this.mesh.connect(new Ee(e));
2025
1853
  }
2026
1854
  mount(e) {
2027
1855
  this.viewport.mount(e), this.events.mounted.emit(), this.ownsInputStateManager && this.inputStateManager.mount();
@@ -2030,4 +1858,4 @@ var $ = [
2030
1858
  this.viewport.destroy(), this.ownsInputStateManager && this.inputStateManager.unmount(), this.events.unmounted.emit();
2031
1859
  }
2032
1860
  };
2033
- export { b as CanvasBoxSelect, B as CanvasConfig, Me as CanvasController, oe as CanvasDebugCoords, U as CanvasEvents, w as CanvasObject, Oe as CanvasObjectController, V as CanvasObjectRegistry, Q as CanvasPan, W as CanvasSelection, Y as CanvasSpace, T as CanvasView, Z as CanvasViewport, je as CanvasZoom, k as InputStateManager };
1861
+ export { E as CanvasBoxSelect, U as CanvasConfig, Ae as CanvasController, k as CanvasDebugCoords, K as CanvasEvents, ue as CanvasObject, Ee as CanvasObjectController, W as CanvasObjectRegistry, Q as CanvasPan, q as CanvasSelection, J as CanvasSpace, pe as CanvasView, Z as CanvasViewport, ke as CanvasZoom, te as InputStateManager };