@nightshadeui/canvas 2.12.6 → 2.13.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,32 +1,32 @@
1
- import { openBlock as V, createElementBlock as q, createElementVNode as j, normalizeStyle as Z, createCommentVNode as Pt, resolveComponent as oe, createBlock as Xe, withCtx as G, createVNode as K, toDisplayString as X, withModifiers as U, normalizeClass as _t, renderSlot as re, normalizeProps as jt, guardReactiveProps as Ct, Fragment as Et, renderList as It, reactive as Tt } from "vue";
2
- const te = (o, e) => {
3
- const t = o.__vccOpts || o;
4
- for (const [n, r] of e)
5
- t[n] = r;
6
- return t;
7
- }, zt = {
1
+ import { openBlock as U, createElementBlock as q, createElementVNode as C, normalizeStyle as Z, createCommentVNode as Oe, resolveComponent as ot, createBlock as Nt, withCtx as G, createVNode as F, toDisplayString as X, withModifiers as B, normalizeClass as Pe, renderSlot as it, normalizeProps as je, guardReactiveProps as Ce, Fragment as _e, renderList as Ee, reactive as Ie } from "vue";
2
+ const tt = (r, t) => {
3
+ const e = r.__vccOpts || r;
4
+ for (const [n, o] of t)
5
+ e[n] = o;
6
+ return e;
7
+ }, Te = {
8
8
  props: {
9
9
  canvas: { type: Object, required: !0 }
10
10
  }
11
- }, Dt = {
11
+ }, ze = {
12
12
  key: 0,
13
13
  class: "CanvasBoxSelect"
14
14
  };
15
- function Rt(o, e, t, n, r, c) {
16
- return t.canvas.boxSelect.isSelecting() ? (V(), q("div", Dt, [
17
- j("div", {
15
+ function De(r, t, e, n, o, l) {
16
+ return e.canvas.boxSelect.isSelecting() ? (U(), q("div", ze, [
17
+ C("div", {
18
18
  class: "Box",
19
- style: Z(t.canvas.boxSelect.getSelectionStyle())
19
+ style: Z(e.canvas.boxSelect.getSelectionStyle())
20
20
  }, null, 4)
21
- ])) : Pt("", !0);
21
+ ])) : Oe("", !0);
22
22
  }
23
- const kt = /* @__PURE__ */ te(zt, [["render", Rt], ["__scopeId", "data-v-9e8905e1"]]), Bt = {
23
+ const Re = /* @__PURE__ */ tt(Te, [["render", De], ["__scopeId", "data-v-9e8905e1"]]), ke = {
24
24
  props: {
25
25
  canvas: { type: Object, required: !0 }
26
26
  },
27
27
  computed: {
28
28
  pagePos() {
29
- return this.canvas.inputState.lastMousePos;
29
+ return this.canvas.inputStateManager.lastMousePos;
30
30
  },
31
31
  viewportPos() {
32
32
  return this.canvas.space.pageToViewport(this.pagePos);
@@ -39,50 +39,50 @@ const kt = /* @__PURE__ */ te(zt, [["render", Rt], ["__scopeId", "data-v-9e8905e
39
39
  }
40
40
  },
41
41
  methods: {
42
- format(o) {
43
- return `(${o.x.toFixed(2)}, ${o.y.toFixed(2)})`;
42
+ format(r) {
43
+ return `(${r.x.toFixed(2)}, ${r.y.toFixed(2)})`;
44
44
  }
45
45
  }
46
46
  };
47
- function Ut(o, e, t, n, r, c) {
48
- const p = oe("HGroup"), y = oe("VGroup");
49
- return V(), Xe(y, {
47
+ function Be(r, t, e, n, o, l) {
48
+ const g = ot("HGroup"), p = ot("VGroup");
49
+ return U(), Nt(p, {
50
50
  class: "CanvasDebugCoords",
51
51
  gap: "s"
52
52
  }, {
53
53
  default: G(() => [
54
- K(p, { class: "Row" }, {
54
+ F(g, { class: "Row" }, {
55
55
  default: G(() => [
56
- e[0] || (e[0] = j("strong", null, "page", -1)),
57
- j("span", null, X(c.format(c.pagePos)), 1)
56
+ t[0] || (t[0] = C("strong", null, "page", -1)),
57
+ C("span", null, X(l.format(l.pagePos)), 1)
58
58
  ]),
59
59
  _: 1
60
60
  }),
61
- K(p, { class: "Row" }, {
61
+ F(g, { class: "Row" }, {
62
62
  default: G(() => [
63
- e[1] || (e[1] = j("strong", null, "viewport", -1)),
64
- j("span", null, X(c.format(c.viewportPos)), 1)
63
+ t[1] || (t[1] = C("strong", null, "viewport", -1)),
64
+ C("span", null, X(l.format(l.viewportPos)), 1)
65
65
  ]),
66
66
  _: 1
67
67
  }),
68
- K(p, { class: "Row" }, {
68
+ F(g, { class: "Row" }, {
69
69
  default: G(() => [
70
- e[2] || (e[2] = j("strong", null, "canvas", -1)),
71
- j("span", null, X(c.format(c.canvasPos)), 1)
70
+ t[2] || (t[2] = C("strong", null, "canvas", -1)),
71
+ C("span", null, X(l.format(l.canvasPos)), 1)
72
72
  ]),
73
73
  _: 1
74
74
  }),
75
- K(p, { class: "Row" }, {
75
+ F(g, { class: "Row" }, {
76
76
  default: G(() => [
77
- e[3] || (e[3] = j("strong", null, "local", -1)),
78
- j("span", null, X(c.format(c.localPos)), 1)
77
+ t[3] || (t[3] = C("strong", null, "local", -1)),
78
+ C("span", null, X(l.format(l.localPos)), 1)
79
79
  ]),
80
80
  _: 1
81
81
  }),
82
- K(p, { class: "Row" }, {
82
+ F(g, { class: "Row" }, {
83
83
  default: G(() => [
84
- e[4] || (e[4] = j("strong", null, "zoom", -1)),
85
- j("span", null, X(t.canvas.space.zoom.toFixed(2)), 1)
84
+ t[4] || (t[4] = C("strong", null, "zoom", -1)),
85
+ C("span", null, X(e.canvas.space.zoom.toFixed(2)), 1)
86
86
  ]),
87
87
  _: 1
88
88
  })
@@ -90,307 +90,299 @@ function Ut(o, e, t, n, r, c) {
90
90
  _: 1
91
91
  });
92
92
  }
93
- const Ms = /* @__PURE__ */ te(Bt, [["render", Ut], ["__scopeId", "data-v-6d2e1386"]]);
94
- function z(o, e, t) {
95
- return Math.max(e, Math.min(t, o));
93
+ const gs = /* @__PURE__ */ tt(ke, [["render", Be], ["__scopeId", "data-v-871d7c0c"]]);
94
+ function z(r, t, e) {
95
+ return Math.max(t, Math.min(e, r));
96
96
  }
97
- function We(o, e) {
97
+ function Yt(r, t) {
98
98
  return {
99
- x: o.x - e.x,
100
- y: o.y - e.y
99
+ x: r.x - t.x,
100
+ y: r.y - t.y
101
101
  };
102
102
  }
103
- function ie(o, e) {
104
- const t = { x: Math.min(o.x, e.x), y: Math.min(o.y, e.y) }, n = { x: Math.max(o.x, e.x), y: Math.max(o.y, e.y) };
105
- return [t, n];
106
- }
107
- function Le(o, e) {
108
- const t = o[1].x >= e[0].x && e[1].x >= o[0].x, n = o[1].y >= e[0].y && e[1].y >= o[0].y;
109
- return t && n;
110
- }
111
- function Vt(o) {
112
- const [e, t] = o;
103
+ function Ue(r) {
104
+ const [t, e] = r;
113
105
  return {
114
- x: (t.x - e.x) * 0.5 + e.x,
115
- y: (t.y - e.y) * 0.5 + e.y
106
+ x: (e.x - t.x) * 0.5 + t.x,
107
+ y: (e.y - t.y) * 0.5 + t.y
116
108
  };
117
109
  }
118
- function Ze(o, e, t) {
119
- const n = o ?? document.documentElement;
120
- return getComputedStyle(n).getPropertyValue(e).trim() || t;
110
+ function Ht(r, t, e) {
111
+ const n = r ?? document.documentElement;
112
+ return getComputedStyle(n).getPropertyValue(t).trim() || e;
121
113
  }
122
- function W(o, e, t) {
123
- const n = Ze(o, e, String(t)), r = Number(n.replace(/px|em|%|vh|vw/g, ""));
124
- return Number.isFinite(r) ? r : t;
114
+ function W(r, t, e) {
115
+ const n = Ht(r, t, String(e)), o = Number(n.replace(/px|em|%|vh|vw/g, ""));
116
+ return Number.isFinite(o) ? o : e;
125
117
  }
126
- function $e(o, e, t) {
127
- const n = o ?? document.documentElement, r = Ze(o, e, t), c = document.createElement("span");
128
- c.style.position = "absolute", c.style.visibility = "hidden", c.style.pointerEvents = "none", c.style.color = t, c.style.color = r, n.appendChild(c);
129
- const p = getComputedStyle(c).color.trim();
130
- return c.remove(), p || t;
118
+ function Bt(r, t, e) {
119
+ const n = r ?? document.documentElement, o = Ht(r, t, e), l = document.createElement("span");
120
+ l.style.position = "absolute", l.style.visibility = "hidden", l.style.pointerEvents = "none", l.style.color = e, l.style.color = o, n.appendChild(l);
121
+ const g = getComputedStyle(l).color.trim();
122
+ return l.remove(), g || e;
131
123
  }
132
- class ue {
133
- constructor(e) {
134
- this.target = e, this.entries = [];
124
+ let Xt = class {
125
+ constructor(t) {
126
+ this.target = t, this.entries = [];
135
127
  }
136
- add(e, t, n) {
137
- this.target.addEventListener(e, t, n), this.entries.push({ type: e, listener: t, options: n });
128
+ add(t, e, n) {
129
+ this.target.addEventListener(t, e, n), this.entries.push({ type: t, listener: e, options: n });
138
130
  }
139
131
  removeAll() {
140
- for (const e of this.entries)
141
- this.target.removeEventListener(e.type, e.listener, e.options);
132
+ for (const t of this.entries)
133
+ this.target.removeEventListener(t.type, t.listener, t.options);
142
134
  this.entries = [];
143
135
  }
144
- }
145
- function Lt(o, e, t, n = 2, r, c = 1) {
146
- const p = [0, ...$t(o, e), o], y = [0, o], S = [
136
+ };
137
+ function Ve(r, t, e, n = 2, o, l = 1) {
138
+ const g = [0, ...Le(r, t), r], p = [0, r], S = [
147
139
  `<svg xmlns="http://www.w3.org/2000/svg"
148
- width="${o}"
149
- height="${o}"
150
- viewBox="0 0 ${o} ${o}">`
140
+ width="${r}"
141
+ height="${r}"
142
+ viewBox="0 0 ${r} ${r}">`
151
143
  ];
152
- if (c)
153
- for (const C of p)
154
- for (const E of p)
144
+ if (l)
145
+ for (const _ of g)
146
+ for (const E of g)
155
147
  S.push(
156
- `<circle cx="${C}" cy="${E}" r="${c}" fill="${r}"/>`
148
+ `<circle cx="${_}" cy="${E}" r="${l}" fill="${o}"/>`
157
149
  );
158
150
  if (n)
159
- for (const C of y)
160
- for (const E of y)
151
+ for (const _ of p)
152
+ for (const E of p)
161
153
  S.push(
162
- `<circle cx="${C}" cy="${E}" r="${n}" fill="${t}"/>`
154
+ `<circle cx="${_}" cy="${E}" r="${n}" fill="${e}"/>`
163
155
  );
164
156
  return S.push("</svg>"), S.join("");
165
157
  }
166
- function $t(o, e) {
167
- const t = [], n = Math.round(o / e);
168
- for (let r = 1; r < e; r++)
169
- t.push(n * r);
170
- return t;
158
+ function Le(r, t) {
159
+ const e = [], n = Math.round(r / t);
160
+ for (let o = 1; o < t; o++)
161
+ e.push(n * o);
162
+ return e;
171
163
  }
172
- var Ae = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ge = {};
173
- var Fe;
174
- function At() {
175
- if (Fe) return Ge;
176
- Fe = 1;
177
- var o;
178
- return (function(e) {
179
- (function(t) {
180
- var n = typeof globalThis == "object" ? globalThis : typeof Ae == "object" ? Ae : typeof self == "object" ? self : typeof this == "object" ? this : S(), r = c(e);
181
- typeof n.Reflect < "u" && (r = c(n.Reflect, r)), t(r, n), typeof n.Reflect > "u" && (n.Reflect = e);
182
- function c(C, E) {
164
+ var Ut = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Vt = {};
165
+ var Lt;
166
+ function Ae() {
167
+ if (Lt) return Vt;
168
+ Lt = 1;
169
+ var r;
170
+ return (function(t) {
171
+ (function(e) {
172
+ var n = typeof globalThis == "object" ? globalThis : typeof Ut == "object" ? Ut : typeof self == "object" ? self : typeof this == "object" ? this : S(), o = l(t);
173
+ typeof n.Reflect < "u" && (o = l(n.Reflect, o)), e(o, n), typeof n.Reflect > "u" && (n.Reflect = t);
174
+ function l(_, E) {
183
175
  return function(R, N) {
184
- Object.defineProperty(C, R, { configurable: !0, writable: !0, value: N }), E && E(R, N);
176
+ Object.defineProperty(_, R, { configurable: !0, writable: !0, value: N }), E && E(R, N);
185
177
  };
186
178
  }
187
- function p() {
179
+ function g() {
188
180
  try {
189
181
  return Function("return this;")();
190
182
  } catch {
191
183
  }
192
184
  }
193
- function y() {
185
+ function p() {
194
186
  try {
195
187
  return (0, eval)("(function() { return this; })()");
196
188
  } catch {
197
189
  }
198
190
  }
199
191
  function S() {
200
- return p() || y();
192
+ return g() || p();
201
193
  }
202
- })(function(t, n) {
203
- var r = Object.prototype.hasOwnProperty, c = typeof Symbol == "function", p = c && typeof Symbol.toPrimitive < "u" ? Symbol.toPrimitive : "@@toPrimitive", y = c && typeof Symbol.iterator < "u" ? Symbol.iterator : "@@iterator", S = typeof Object.create == "function", C = { __proto__: [] } instanceof Array, E = !S && !C, R = {
194
+ })(function(e, n) {
195
+ var o = Object.prototype.hasOwnProperty, l = typeof Symbol == "function", g = l && typeof Symbol.toPrimitive < "u" ? Symbol.toPrimitive : "@@toPrimitive", p = l && typeof Symbol.iterator < "u" ? Symbol.iterator : "@@iterator", S = typeof Object.create == "function", _ = { __proto__: [] } instanceof Array, E = !S && !_, R = {
204
196
  // create an object in dictionary mode (a.k.a. "slow" mode in v8)
205
197
  create: S ? function() {
206
- return ge(/* @__PURE__ */ Object.create(null));
207
- } : C ? function() {
208
- return ge({ __proto__: null });
198
+ return pt(/* @__PURE__ */ Object.create(null));
199
+ } : _ ? function() {
200
+ return pt({ __proto__: null });
209
201
  } : function() {
210
- return ge({});
202
+ return pt({});
211
203
  },
212
204
  has: E ? function(s, i) {
213
- return r.call(s, i);
205
+ return o.call(s, i);
214
206
  } : function(s, i) {
215
207
  return i in s;
216
208
  },
217
209
  get: E ? function(s, i) {
218
- return r.call(s, i) ? s[i] : void 0;
210
+ return o.call(s, i) ? s[i] : void 0;
219
211
  } : function(s, i) {
220
212
  return s[i];
221
213
  }
222
- }, N = Object.getPrototypeOf(Function), Y = typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map : bt(), de = typeof Set == "function" && typeof Set.prototype.entries == "function" ? Set : xt(), fe = typeof WeakMap == "function" ? WeakMap : St(), $ = c ? /* @__PURE__ */ Symbol.for("@reflect-metadata:registry") : void 0, se = gt(), Se = wt(se);
223
- function Qe(s, i, a, l) {
224
- if (g(a)) {
225
- if (!Te(s))
214
+ }, N = Object.getPrototypeOf(Function), Y = typeof Map == "function" && typeof Map.prototype.entries == "function" ? Map : me(), ut = typeof Set == "function" && typeof Set.prototype.entries == "function" ? Set : be(), ht = typeof WeakMap == "function" ? WeakMap : xe(), L = l ? /* @__PURE__ */ Symbol.for("@reflect-metadata:registry") : void 0, et = ye(), mt = ge(et);
215
+ function Jt(s, i, a, c) {
216
+ if (y(a)) {
217
+ if (!_t(s))
226
218
  throw new TypeError();
227
- if (!ze(i))
219
+ if (!Et(i))
228
220
  throw new TypeError();
229
- return lt(s, i);
221
+ return ce(s, i);
230
222
  } else {
231
- if (!Te(s))
223
+ if (!_t(s))
232
224
  throw new TypeError();
233
225
  if (!O(i))
234
226
  throw new TypeError();
235
- if (!O(l) && !g(l) && !A(l))
227
+ if (!O(c) && !y(c) && !A(c))
236
228
  throw new TypeError();
237
- return A(l) && (l = void 0), a = T(a), ut(s, i, a, l);
229
+ return A(c) && (c = void 0), a = T(a), le(s, i, a, c);
238
230
  }
239
231
  }
240
- t("decorate", Qe);
241
- function et(s, i) {
242
- function a(l, v) {
243
- if (!O(l))
232
+ e("decorate", Jt);
233
+ function Qt(s, i) {
234
+ function a(c, v) {
235
+ if (!O(c))
244
236
  throw new TypeError();
245
- if (!g(v) && !pt(v))
237
+ if (!y(v) && !ve(v))
246
238
  throw new TypeError();
247
- _e(s, i, l, v);
239
+ Mt(s, i, c, v);
248
240
  }
249
241
  return a;
250
242
  }
251
- t("metadata", et);
252
- function tt(s, i, a, l) {
243
+ e("metadata", Qt);
244
+ function te(s, i, a, c) {
253
245
  if (!O(a))
254
246
  throw new TypeError();
255
- return g(l) || (l = T(l)), _e(s, i, a, l);
247
+ return y(c) || (c = T(c)), Mt(s, i, a, c);
256
248
  }
257
- t("defineMetadata", tt);
258
- function st(s, i, a) {
249
+ e("defineMetadata", te);
250
+ function ee(s, i, a) {
259
251
  if (!O(i))
260
252
  throw new TypeError();
261
- return g(a) || (a = T(a)), Me(s, i, a);
253
+ return y(a) || (a = T(a)), bt(s, i, a);
262
254
  }
263
- t("hasMetadata", st);
264
- function nt(s, i, a) {
255
+ e("hasMetadata", ee);
256
+ function se(s, i, a) {
265
257
  if (!O(i))
266
258
  throw new TypeError();
267
- return g(a) || (a = T(a)), ve(s, i, a);
259
+ return y(a) || (a = T(a)), dt(s, i, a);
268
260
  }
269
- t("hasOwnMetadata", nt);
270
- function it(s, i, a) {
261
+ e("hasOwnMetadata", se);
262
+ function ne(s, i, a) {
271
263
  if (!O(i))
272
264
  throw new TypeError();
273
- return g(a) || (a = T(a)), Oe(s, i, a);
265
+ return y(a) || (a = T(a)), xt(s, i, a);
274
266
  }
275
- t("getMetadata", it);
276
- function rt(s, i, a) {
267
+ e("getMetadata", ne);
268
+ function ie(s, i, a) {
277
269
  if (!O(i))
278
270
  throw new TypeError();
279
- return g(a) || (a = T(a)), Pe(s, i, a);
271
+ return y(a) || (a = T(a)), St(s, i, a);
280
272
  }
281
- t("getOwnMetadata", rt);
282
- function ot(s, i) {
273
+ e("getOwnMetadata", ie);
274
+ function re(s, i) {
283
275
  if (!O(s))
284
276
  throw new TypeError();
285
- return g(i) || (i = T(i)), je(s, i);
277
+ return y(i) || (i = T(i)), Ot(s, i);
286
278
  }
287
- t("getMetadataKeys", ot);
288
- function at(s, i) {
279
+ e("getMetadataKeys", re);
280
+ function oe(s, i) {
289
281
  if (!O(s))
290
282
  throw new TypeError();
291
- return g(i) || (i = T(i)), Ce(s, i);
283
+ return y(i) || (i = T(i)), Pt(s, i);
292
284
  }
293
- t("getOwnMetadataKeys", at);
294
- function ct(s, i, a) {
285
+ e("getOwnMetadataKeys", oe);
286
+ function ae(s, i, a) {
295
287
  if (!O(i))
296
288
  throw new TypeError();
297
- if (g(a) || (a = T(a)), !O(i))
289
+ if (y(a) || (a = T(a)), !O(i))
298
290
  throw new TypeError();
299
- g(a) || (a = T(a));
300
- var l = H(
291
+ y(a) || (a = T(a));
292
+ var c = H(
301
293
  i,
302
294
  a,
303
295
  /*Create*/
304
296
  !1
305
297
  );
306
- return g(l) ? !1 : l.OrdinaryDeleteMetadata(s, i, a);
298
+ return y(c) ? !1 : c.OrdinaryDeleteMetadata(s, i, a);
307
299
  }
308
- t("deleteMetadata", ct);
309
- function lt(s, i) {
300
+ e("deleteMetadata", ae);
301
+ function ce(s, i) {
310
302
  for (var a = s.length - 1; a >= 0; --a) {
311
- var l = s[a], v = l(i);
312
- if (!g(v) && !A(v)) {
313
- if (!ze(v))
303
+ var c = s[a], v = c(i);
304
+ if (!y(v) && !A(v)) {
305
+ if (!Et(v))
314
306
  throw new TypeError();
315
307
  i = v;
316
308
  }
317
309
  }
318
310
  return i;
319
311
  }
320
- function ut(s, i, a, l) {
312
+ function le(s, i, a, c) {
321
313
  for (var v = s.length - 1; v >= 0; --v) {
322
- var _ = s[v], P = _(i, a, l);
323
- if (!g(P) && !A(P)) {
314
+ var j = s[v], P = j(i, a, c);
315
+ if (!y(P) && !A(P)) {
324
316
  if (!O(P))
325
317
  throw new TypeError();
326
- l = P;
318
+ c = P;
327
319
  }
328
320
  }
329
- return l;
321
+ return c;
330
322
  }
331
- function Me(s, i, a) {
332
- var l = ve(s, i, a);
333
- if (l)
323
+ function bt(s, i, a) {
324
+ var c = dt(s, i, a);
325
+ if (c)
334
326
  return !0;
335
- var v = ye(i);
336
- return A(v) ? !1 : Me(s, v, a);
327
+ var v = vt(i);
328
+ return A(v) ? !1 : bt(s, v, a);
337
329
  }
338
- function ve(s, i, a) {
339
- var l = H(
330
+ function dt(s, i, a) {
331
+ var c = H(
340
332
  i,
341
333
  a,
342
334
  /*Create*/
343
335
  !1
344
336
  );
345
- return g(l) ? !1 : Ie(l.OrdinaryHasOwnMetadata(s, i, a));
337
+ return y(c) ? !1 : Ct(c.OrdinaryHasOwnMetadata(s, i, a));
346
338
  }
347
- function Oe(s, i, a) {
348
- var l = ve(s, i, a);
349
- if (l)
350
- return Pe(s, i, a);
351
- var v = ye(i);
339
+ function xt(s, i, a) {
340
+ var c = dt(s, i, a);
341
+ if (c)
342
+ return St(s, i, a);
343
+ var v = vt(i);
352
344
  if (!A(v))
353
- return Oe(s, v, a);
345
+ return xt(s, v, a);
354
346
  }
355
- function Pe(s, i, a) {
356
- var l = H(
347
+ function St(s, i, a) {
348
+ var c = H(
357
349
  i,
358
350
  a,
359
351
  /*Create*/
360
352
  !1
361
353
  );
362
- if (!g(l))
363
- return l.OrdinaryGetOwnMetadata(s, i, a);
354
+ if (!y(c))
355
+ return c.OrdinaryGetOwnMetadata(s, i, a);
364
356
  }
365
- function _e(s, i, a, l) {
357
+ function Mt(s, i, a, c) {
366
358
  var v = H(
367
359
  a,
368
- l,
360
+ c,
369
361
  /*Create*/
370
362
  !0
371
363
  );
372
- v.OrdinaryDefineOwnMetadata(s, i, a, l);
364
+ v.OrdinaryDefineOwnMetadata(s, i, a, c);
373
365
  }
374
- function je(s, i) {
375
- var a = Ce(s, i), l = ye(s);
376
- if (l === null)
366
+ function Ot(s, i) {
367
+ var a = Pt(s, i), c = vt(s);
368
+ if (c === null)
377
369
  return a;
378
- var v = je(l, i);
370
+ var v = Ot(c, i);
379
371
  if (v.length <= 0)
380
372
  return a;
381
373
  if (a.length <= 0)
382
374
  return v;
383
- for (var _ = new de(), P = [], w = 0, u = a; w < u.length; w++) {
384
- var h = u[w], d = _.has(h);
385
- d || (_.add(h), P.push(h));
375
+ for (var j = new ut(), P = [], w = 0, u = a; w < u.length; w++) {
376
+ var h = u[w], d = j.has(h);
377
+ d || (j.add(h), P.push(h));
386
378
  }
387
379
  for (var f = 0, m = v; f < m.length; f++) {
388
- var h = m[f], d = _.has(h);
389
- d || (_.add(h), P.push(h));
380
+ var h = m[f], d = j.has(h);
381
+ d || (j.add(h), P.push(h));
390
382
  }
391
383
  return P;
392
384
  }
393
- function Ce(s, i) {
385
+ function Pt(s, i) {
394
386
  var a = H(
395
387
  s,
396
388
  i,
@@ -399,7 +391,7 @@ function At() {
399
391
  );
400
392
  return a ? a.OrdinaryOwnMetadataKeys(s, i) : [];
401
393
  }
402
- function Ee(s) {
394
+ function jt(s) {
403
395
  if (s === null)
404
396
  return 1;
405
397
  switch (typeof s) {
@@ -419,20 +411,20 @@ function At() {
419
411
  return 6;
420
412
  }
421
413
  }
422
- function g(s) {
414
+ function y(s) {
423
415
  return s === void 0;
424
416
  }
425
417
  function A(s) {
426
418
  return s === null;
427
419
  }
428
- function ht(s) {
420
+ function ue(s) {
429
421
  return typeof s == "symbol";
430
422
  }
431
423
  function O(s) {
432
424
  return typeof s == "object" ? s !== null : typeof s == "function";
433
425
  }
434
- function dt(s, i) {
435
- switch (Ee(s)) {
426
+ function he(s, i) {
427
+ switch (jt(s)) {
436
428
  case 0:
437
429
  return s;
438
430
  case 1:
@@ -446,54 +438,54 @@ function At() {
446
438
  case 5:
447
439
  return s;
448
440
  }
449
- var a = "string", l = De(s, p);
450
- if (l !== void 0) {
451
- var v = l.call(s, a);
441
+ var a = "string", c = It(s, g);
442
+ if (c !== void 0) {
443
+ var v = c.call(s, a);
452
444
  if (O(v))
453
445
  throw new TypeError();
454
446
  return v;
455
447
  }
456
- return ft(s);
448
+ return de(s);
457
449
  }
458
- function ft(s, i) {
459
- var a, l;
450
+ function de(s, i) {
451
+ var a, c;
460
452
  {
461
453
  var v = s.toString;
462
- if (ne(v)) {
463
- var l = v.call(s);
464
- if (!O(l))
465
- return l;
454
+ if (st(v)) {
455
+ var c = v.call(s);
456
+ if (!O(c))
457
+ return c;
466
458
  }
467
459
  var a = s.valueOf;
468
- if (ne(a)) {
469
- var l = a.call(s);
470
- if (!O(l))
471
- return l;
460
+ if (st(a)) {
461
+ var c = a.call(s);
462
+ if (!O(c))
463
+ return c;
472
464
  }
473
465
  }
474
466
  throw new TypeError();
475
467
  }
476
- function Ie(s) {
468
+ function Ct(s) {
477
469
  return !!s;
478
470
  }
479
- function vt(s) {
471
+ function fe(s) {
480
472
  return "" + s;
481
473
  }
482
474
  function T(s) {
483
- var i = dt(s);
484
- return ht(i) ? i : vt(i);
475
+ var i = he(s);
476
+ return ue(i) ? i : fe(i);
485
477
  }
486
- function Te(s) {
478
+ function _t(s) {
487
479
  return Array.isArray ? Array.isArray(s) : s instanceof Object ? s instanceof Array : Object.prototype.toString.call(s) === "[object Array]";
488
480
  }
489
- function ne(s) {
481
+ function st(s) {
490
482
  return typeof s == "function";
491
483
  }
492
- function ze(s) {
484
+ function Et(s) {
493
485
  return typeof s == "function";
494
486
  }
495
- function pt(s) {
496
- switch (Ee(s)) {
487
+ function ve(s) {
488
+ switch (jt(s)) {
497
489
  case 3:
498
490
  return !0;
499
491
  case 4:
@@ -502,151 +494,151 @@ function At() {
502
494
  return !1;
503
495
  }
504
496
  }
505
- function pe(s, i) {
497
+ function ft(s, i) {
506
498
  return s === i || s !== s && i !== i;
507
499
  }
508
- function De(s, i) {
500
+ function It(s, i) {
509
501
  var a = s[i];
510
502
  if (a != null) {
511
- if (!ne(a))
503
+ if (!st(a))
512
504
  throw new TypeError();
513
505
  return a;
514
506
  }
515
507
  }
516
- function Re(s) {
517
- var i = De(s, y);
518
- if (!ne(i))
508
+ function Tt(s) {
509
+ var i = It(s, p);
510
+ if (!st(i))
519
511
  throw new TypeError();
520
512
  var a = i.call(s);
521
513
  if (!O(a))
522
514
  throw new TypeError();
523
515
  return a;
524
516
  }
525
- function ke(s) {
517
+ function zt(s) {
526
518
  return s.value;
527
519
  }
528
- function Be(s) {
520
+ function Dt(s) {
529
521
  var i = s.next();
530
522
  return i.done ? !1 : i;
531
523
  }
532
- function Ue(s) {
524
+ function Rt(s) {
533
525
  var i = s.return;
534
526
  i && i.call(s);
535
527
  }
536
- function ye(s) {
528
+ function vt(s) {
537
529
  var i = Object.getPrototypeOf(s);
538
530
  if (typeof s != "function" || s === N || i !== N)
539
531
  return i;
540
- var a = s.prototype, l = a && Object.getPrototypeOf(a);
541
- if (l == null || l === Object.prototype)
532
+ var a = s.prototype, c = a && Object.getPrototypeOf(a);
533
+ if (c == null || c === Object.prototype)
542
534
  return i;
543
- var v = l.constructor;
535
+ var v = c.constructor;
544
536
  return typeof v != "function" || v === s ? i : v;
545
537
  }
546
- function yt() {
538
+ function pe() {
547
539
  var s;
548
- !g($) && typeof n.Reflect < "u" && !($ in n.Reflect) && typeof n.Reflect.defineMetadata == "function" && (s = mt(n.Reflect));
549
- var i, a, l, v = new fe(), _ = {
540
+ !y(L) && typeof n.Reflect < "u" && !(L in n.Reflect) && typeof n.Reflect.defineMetadata == "function" && (s = we(n.Reflect));
541
+ var i, a, c, v = new ht(), j = {
550
542
  registerProvider: P,
551
543
  getProvider: u,
552
544
  setProvider: d
553
545
  };
554
- return _;
546
+ return j;
555
547
  function P(f) {
556
- if (!Object.isExtensible(_))
548
+ if (!Object.isExtensible(j))
557
549
  throw new Error("Cannot add provider to a frozen registry.");
558
550
  switch (!0) {
559
551
  case s === f:
560
552
  break;
561
- case g(i):
553
+ case y(i):
562
554
  i = f;
563
555
  break;
564
556
  case i === f:
565
557
  break;
566
- case g(a):
558
+ case y(a):
567
559
  a = f;
568
560
  break;
569
561
  case a === f:
570
562
  break;
571
563
  default:
572
- l === void 0 && (l = new de()), l.add(f);
564
+ c === void 0 && (c = new ut()), c.add(f);
573
565
  break;
574
566
  }
575
567
  }
576
568
  function w(f, m) {
577
- if (!g(i)) {
569
+ if (!y(i)) {
578
570
  if (i.isProviderFor(f, m))
579
571
  return i;
580
- if (!g(a)) {
572
+ if (!y(a)) {
581
573
  if (a.isProviderFor(f, m))
582
574
  return i;
583
- if (!g(l))
584
- for (var x = Re(l); ; ) {
585
- var M = Be(x);
575
+ if (!y(c))
576
+ for (var x = Tt(c); ; ) {
577
+ var M = Dt(x);
586
578
  if (!M)
587
579
  return;
588
- var I = ke(M);
580
+ var I = zt(M);
589
581
  if (I.isProviderFor(f, m))
590
- return Ue(x), I;
582
+ return Rt(x), I;
591
583
  }
592
584
  }
593
585
  }
594
- if (!g(s) && s.isProviderFor(f, m))
586
+ if (!y(s) && s.isProviderFor(f, m))
595
587
  return s;
596
588
  }
597
589
  function u(f, m) {
598
590
  var x = v.get(f), M;
599
- return g(x) || (M = x.get(m)), g(M) && (M = w(f, m), g(M) || (g(x) && (x = new Y(), v.set(f, x)), x.set(m, M))), M;
591
+ return y(x) || (M = x.get(m)), y(M) && (M = w(f, m), y(M) || (y(x) && (x = new Y(), v.set(f, x)), x.set(m, M))), M;
600
592
  }
601
593
  function h(f) {
602
- if (g(f))
594
+ if (y(f))
603
595
  throw new TypeError();
604
- return i === f || a === f || !g(l) && l.has(f);
596
+ return i === f || a === f || !y(c) && c.has(f);
605
597
  }
606
598
  function d(f, m, x) {
607
599
  if (!h(x))
608
600
  throw new Error("Metadata provider not registered.");
609
601
  var M = u(f, m);
610
602
  if (M !== x) {
611
- if (!g(M))
603
+ if (!y(M))
612
604
  return !1;
613
605
  var I = v.get(f);
614
- g(I) && (I = new Y(), v.set(f, I)), I.set(m, x);
606
+ y(I) && (I = new Y(), v.set(f, I)), I.set(m, x);
615
607
  }
616
608
  return !0;
617
609
  }
618
610
  }
619
- function gt() {
611
+ function ye() {
620
612
  var s;
621
- return !g($) && O(n.Reflect) && Object.isExtensible(n.Reflect) && (s = n.Reflect[$]), g(s) && (s = yt()), !g($) && O(n.Reflect) && Object.isExtensible(n.Reflect) && Object.defineProperty(n.Reflect, $, {
613
+ return !y(L) && O(n.Reflect) && Object.isExtensible(n.Reflect) && (s = n.Reflect[L]), y(s) && (s = pe()), !y(L) && O(n.Reflect) && Object.isExtensible(n.Reflect) && Object.defineProperty(n.Reflect, L, {
622
614
  enumerable: !1,
623
615
  configurable: !1,
624
616
  writable: !1,
625
617
  value: s
626
618
  }), s;
627
619
  }
628
- function wt(s) {
629
- var i = new fe(), a = {
620
+ function ge(s) {
621
+ var i = new ht(), a = {
630
622
  isProviderFor: function(h, d) {
631
623
  var f = i.get(h);
632
- return g(f) ? !1 : f.has(d);
624
+ return y(f) ? !1 : f.has(d);
633
625
  },
634
626
  OrdinaryDefineOwnMetadata: P,
635
627
  OrdinaryHasOwnMetadata: v,
636
- OrdinaryGetOwnMetadata: _,
628
+ OrdinaryGetOwnMetadata: j,
637
629
  OrdinaryOwnMetadataKeys: w,
638
630
  OrdinaryDeleteMetadata: u
639
631
  };
640
- return se.registerProvider(a), a;
641
- function l(h, d, f) {
632
+ return et.registerProvider(a), a;
633
+ function c(h, d, f) {
642
634
  var m = i.get(h), x = !1;
643
- if (g(m)) {
635
+ if (y(m)) {
644
636
  if (!f)
645
637
  return;
646
638
  m = new Y(), i.set(h, m), x = !0;
647
639
  }
648
640
  var M = m.get(d);
649
- if (g(M)) {
641
+ if (y(M)) {
650
642
  if (!f)
651
643
  return;
652
644
  if (M = new Y(), m.set(d, M), !s.setProvider(h, d, a))
@@ -655,26 +647,26 @@ function At() {
655
647
  return M;
656
648
  }
657
649
  function v(h, d, f) {
658
- var m = l(
650
+ var m = c(
659
651
  d,
660
652
  f,
661
653
  /*Create*/
662
654
  !1
663
655
  );
664
- return g(m) ? !1 : Ie(m.has(h));
656
+ return y(m) ? !1 : Ct(m.has(h));
665
657
  }
666
- function _(h, d, f) {
667
- var m = l(
658
+ function j(h, d, f) {
659
+ var m = c(
668
660
  d,
669
661
  f,
670
662
  /*Create*/
671
663
  !1
672
664
  );
673
- if (!g(m))
665
+ if (!y(m))
674
666
  return m.get(h);
675
667
  }
676
668
  function P(h, d, f, m) {
677
- var x = l(
669
+ var x = c(
678
670
  f,
679
671
  m,
680
672
  /*Create*/
@@ -683,72 +675,72 @@ function At() {
683
675
  x.set(h, d);
684
676
  }
685
677
  function w(h, d) {
686
- var f = [], m = l(
678
+ var f = [], m = c(
687
679
  h,
688
680
  d,
689
681
  /*Create*/
690
682
  !1
691
683
  );
692
- if (g(m))
684
+ if (y(m))
693
685
  return f;
694
- for (var x = m.keys(), M = Re(x), I = 0; ; ) {
695
- var Ve = Be(M);
696
- if (!Ve)
686
+ for (var x = m.keys(), M = Tt(x), I = 0; ; ) {
687
+ var kt = Dt(M);
688
+ if (!kt)
697
689
  return f.length = I, f;
698
- var Mt = ke(Ve);
690
+ var Se = zt(kt);
699
691
  try {
700
- f[I] = Mt;
701
- } catch (Ot) {
692
+ f[I] = Se;
693
+ } catch (Me) {
702
694
  try {
703
- Ue(M);
695
+ Rt(M);
704
696
  } finally {
705
- throw Ot;
697
+ throw Me;
706
698
  }
707
699
  }
708
700
  I++;
709
701
  }
710
702
  }
711
703
  function u(h, d, f) {
712
- var m = l(
704
+ var m = c(
713
705
  d,
714
706
  f,
715
707
  /*Create*/
716
708
  !1
717
709
  );
718
- if (g(m) || !m.delete(h))
710
+ if (y(m) || !m.delete(h))
719
711
  return !1;
720
712
  if (m.size === 0) {
721
713
  var x = i.get(d);
722
- g(x) || (x.delete(f), x.size === 0 && i.delete(x));
714
+ y(x) || (x.delete(f), x.size === 0 && i.delete(x));
723
715
  }
724
716
  return !0;
725
717
  }
726
718
  }
727
- function mt(s) {
728
- var i = s.defineMetadata, a = s.hasOwnMetadata, l = s.getOwnMetadata, v = s.getOwnMetadataKeys, _ = s.deleteMetadata, P = new fe(), w = {
719
+ function we(s) {
720
+ var i = s.defineMetadata, a = s.hasOwnMetadata, c = s.getOwnMetadata, v = s.getOwnMetadataKeys, j = s.deleteMetadata, P = new ht(), w = {
729
721
  isProviderFor: function(u, h) {
730
722
  var d = P.get(u);
731
- return !g(d) && d.has(h) ? !0 : v(u, h).length ? (g(d) && (d = new de(), P.set(u, d)), d.add(h), !0) : !1;
723
+ return !y(d) && d.has(h) ? !0 : v(u, h).length ? (y(d) && (d = new ut(), P.set(u, d)), d.add(h), !0) : !1;
732
724
  },
733
725
  OrdinaryDefineOwnMetadata: i,
734
726
  OrdinaryHasOwnMetadata: a,
735
- OrdinaryGetOwnMetadata: l,
727
+ OrdinaryGetOwnMetadata: c,
736
728
  OrdinaryOwnMetadataKeys: v,
737
- OrdinaryDeleteMetadata: _
729
+ OrdinaryDeleteMetadata: j
738
730
  };
739
731
  return w;
740
732
  }
741
733
  function H(s, i, a) {
742
- var l = se.getProvider(s, i);
743
- if (!g(l))
744
- return l;
734
+ var c = et.getProvider(s, i);
735
+ if (!y(c))
736
+ return c;
745
737
  if (a) {
746
- if (se.setProvider(s, i, Se))
747
- return Se;
738
+ if (et.setProvider(s, i, mt))
739
+ return mt;
748
740
  throw new Error("Illegal state.");
749
741
  }
750
742
  }
751
- function bt() {
743
+ function me() {
752
744
  var s = {}, i = [], a = (
753
745
  /** @class */
754
746
  (function() {
@@ -757,7 +749,7 @@ function At() {
757
749
  }
758
750
  return w.prototype["@@iterator"] = function() {
759
751
  return this;
760
- }, w.prototype[y] = function() {
752
+ }, w.prototype[p] = function() {
761
753
  return this;
762
754
  }, w.prototype.next = function() {
763
755
  var u = this._index;
@@ -772,7 +764,7 @@ function At() {
772
764
  return this._index >= 0 && (this._index = -1, this._keys = i, this._values = i), { value: u, done: !0 };
773
765
  }, w;
774
766
  })()
775
- ), l = (
767
+ ), c = (
776
768
  /** @class */
777
769
  (function() {
778
770
  function w() {
@@ -813,7 +805,7 @@ function At() {
813
805
  if (h >= 0) {
814
806
  for (var d = this._keys.length, f = h + 1; f < d; f++)
815
807
  this._keys[f - 1] = this._keys[f], this._values[f - 1] = this._values[f];
816
- return this._keys.length--, this._values.length--, pe(u, this._cacheKey) && (this._cacheKey = s, this._cacheIndex = -2), !0;
808
+ return this._keys.length--, this._values.length--, ft(u, this._cacheKey) && (this._cacheKey = s, this._cacheIndex = -2), !0;
817
809
  }
818
810
  return !1;
819
811
  }, w.prototype.clear = function() {
@@ -821,18 +813,18 @@ function At() {
821
813
  }, w.prototype.keys = function() {
822
814
  return new a(this._keys, this._values, v);
823
815
  }, w.prototype.values = function() {
824
- return new a(this._keys, this._values, _);
816
+ return new a(this._keys, this._values, j);
825
817
  }, w.prototype.entries = function() {
826
818
  return new a(this._keys, this._values, P);
827
819
  }, w.prototype["@@iterator"] = function() {
828
820
  return this.entries();
829
- }, w.prototype[y] = function() {
821
+ }, w.prototype[p] = function() {
830
822
  return this.entries();
831
823
  }, w.prototype._find = function(u, h) {
832
- if (!pe(this._cacheKey, u)) {
824
+ if (!ft(this._cacheKey, u)) {
833
825
  this._cacheIndex = -1;
834
826
  for (var d = 0; d < this._keys.length; d++)
835
- if (pe(this._keys[d], u)) {
827
+ if (ft(this._keys[d], u)) {
836
828
  this._cacheIndex = d;
837
829
  break;
838
830
  }
@@ -841,18 +833,18 @@ function At() {
841
833
  }, w;
842
834
  })()
843
835
  );
844
- return l;
836
+ return c;
845
837
  function v(w, u) {
846
838
  return w;
847
839
  }
848
- function _(w, u) {
840
+ function j(w, u) {
849
841
  return u;
850
842
  }
851
843
  function P(w, u) {
852
844
  return [w, u];
853
845
  }
854
846
  }
855
- function xt() {
847
+ function be() {
856
848
  var s = (
857
849
  /** @class */
858
850
  (function() {
@@ -881,20 +873,20 @@ function At() {
881
873
  return this._map.entries();
882
874
  }, i.prototype["@@iterator"] = function() {
883
875
  return this.keys();
884
- }, i.prototype[y] = function() {
876
+ }, i.prototype[p] = function() {
885
877
  return this.keys();
886
878
  }, i;
887
879
  })()
888
880
  );
889
881
  return s;
890
882
  }
891
- function St() {
892
- var s = 16, i = R.create(), a = l();
883
+ function xe() {
884
+ var s = 16, i = R.create(), a = c();
893
885
  return (
894
886
  /** @class */
895
887
  (function() {
896
888
  function u() {
897
- this._key = l();
889
+ this._key = c();
898
890
  }
899
891
  return u.prototype.has = function(h) {
900
892
  var d = v(
@@ -925,11 +917,11 @@ function At() {
925
917
  );
926
918
  return d !== void 0 ? delete d[this._key] : !1;
927
919
  }, u.prototype.clear = function() {
928
- this._key = l();
920
+ this._key = c();
929
921
  }, u;
930
922
  })()
931
923
  );
932
- function l() {
924
+ function c() {
933
925
  var u;
934
926
  do
935
927
  u = "@@WeakMap@@" + w();
@@ -937,14 +929,14 @@ function At() {
937
929
  return i[u] = !0, u;
938
930
  }
939
931
  function v(u, h) {
940
- if (!r.call(u, a)) {
932
+ if (!o.call(u, a)) {
941
933
  if (!h)
942
934
  return;
943
935
  Object.defineProperty(u, a, { value: R.create() });
944
936
  }
945
937
  return u[a];
946
938
  }
947
- function _(u, h) {
939
+ function j(u, h) {
948
940
  for (var d = 0; d < h; ++d)
949
941
  u[d] = Math.random() * 255 | 0;
950
942
  return u;
@@ -952,9 +944,9 @@ function At() {
952
944
  function P(u) {
953
945
  if (typeof Uint8Array == "function") {
954
946
  var h = new Uint8Array(u);
955
- return typeof crypto < "u" ? crypto.getRandomValues(h) : typeof msCrypto < "u" ? msCrypto.getRandomValues(h) : _(h, u), h;
947
+ return typeof crypto < "u" ? crypto.getRandomValues(h) : typeof msCrypto < "u" ? msCrypto.getRandomValues(h) : j(h, u), h;
956
948
  }
957
- return _(new Array(u), u);
949
+ return j(new Array(u), u);
958
950
  }
959
951
  function w() {
960
952
  var u = P(s);
@@ -966,270 +958,270 @@ function At() {
966
958
  return h;
967
959
  }
968
960
  }
969
- function ge(s) {
961
+ function pt(s) {
970
962
  return s.__ = void 0, delete s.__, s;
971
963
  }
972
964
  });
973
- })(o || (o = {})), Ge;
965
+ })(r || (r = {})), Vt;
974
966
  }
975
- At();
976
- class qe extends Error {
967
+ Ae();
968
+ class Wt extends Error {
977
969
  constructor() {
978
970
  super(...arguments), this.name = this.constructor.name;
979
971
  }
980
972
  }
981
- class Gt extends qe {
982
- constructor(e, t) {
983
- super(`"${t}" not found in Mesh "${e}"`);
973
+ class Ge extends Wt {
974
+ constructor(t, e) {
975
+ super(`"${e}" not found in Mesh "${t}"`);
984
976
  }
985
977
  }
986
- class Ke extends qe {
987
- constructor(e) {
988
- 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)`);
978
+ class At extends Wt {
979
+ constructor(t) {
980
+ super(`Invalid binding "${t}". 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)`);
989
981
  }
990
982
  }
991
- function D(o) {
992
- return typeof o == "string" ? o : o.name;
983
+ function D(r) {
984
+ return typeof r == "string" ? r : r.name;
993
985
  }
994
- function Ft(o) {
995
- return typeof o == "function" && o.prototype != null;
986
+ function $e(r) {
987
+ return typeof r == "function" && r.prototype != null;
996
988
  }
997
- function Kt(o, ...e) {
998
- return Ft(o) ? new o(...e) : o(...e);
989
+ function Fe(r, ...t) {
990
+ return $e(r) ? new r(...t) : r(...t);
999
991
  }
1000
- const Je = /* @__PURE__ */ Symbol.for("MESH_REF");
1001
- class ae {
1002
- constructor(e = "default", t = void 0) {
1003
- this.name = e, this.parent = t, this.bindings = /* @__PURE__ */ new Map(), this.instances = /* @__PURE__ */ new Map(), this.middlewares = [], this.constant(ae, this), this.injectRef(this);
992
+ const Zt = /* @__PURE__ */ Symbol.for("MESH_REF");
993
+ class at {
994
+ constructor(t = "default", e = void 0) {
995
+ this.name = t, this.parent = e, this.bindings = /* @__PURE__ */ new Map(), this.instances = /* @__PURE__ */ new Map(), this.middlewares = [], this.constant(at, this), this.injectRef(this);
1004
996
  }
1005
997
  *[Symbol.iterator]() {
1006
998
  yield* this.bindings.entries();
1007
999
  }
1008
1000
  clone() {
1009
- const e = new ae();
1010
- return e.parent = this.parent, e.bindings = new Map(this.bindings), e;
1001
+ const t = new at();
1002
+ return t.parent = this.parent, t.bindings = new Map(this.bindings), t;
1011
1003
  }
1012
- connect(e) {
1013
- const t = this.applyMiddleware(e);
1014
- return this.injectRef(t), t;
1004
+ connect(t) {
1005
+ const e = this.applyMiddleware(t);
1006
+ return this.injectRef(e), e;
1015
1007
  }
1016
- use(e) {
1017
- return this.middlewares.push(e), this;
1008
+ use(t) {
1009
+ return this.middlewares.push(t), this;
1018
1010
  }
1019
- service(e, t) {
1020
- const n = D(e);
1021
- if (typeof t == "function")
1022
- return this.bindings.set(n, { type: "service", class: t }), this;
1011
+ service(t, e) {
1012
+ const n = D(t);
1023
1013
  if (typeof e == "function")
1024
1014
  return this.bindings.set(n, { type: "service", class: e }), this;
1025
- throw new Ke(String(e));
1026
- }
1027
- scope(e, t) {
1028
- const n = D(e);
1029
1015
  if (typeof t == "function")
1030
- return this.bindings.set(n, { type: "scope", factory: t }), this;
1016
+ return this.bindings.set(n, { type: "service", class: t }), this;
1017
+ throw new At(String(t));
1018
+ }
1019
+ scope(t, e) {
1020
+ const n = D(t);
1031
1021
  if (typeof e == "function")
1032
1022
  return this.bindings.set(n, { type: "scope", factory: e }), this;
1033
- throw new Ke(String(e));
1023
+ if (typeof t == "function")
1024
+ return this.bindings.set(n, { type: "scope", factory: t }), this;
1025
+ throw new At(String(t));
1034
1026
  }
1035
- constant(e, t) {
1036
- const n = D(e);
1037
- return this.bindings.set(n, { type: "constant", value: t }), this;
1027
+ constant(t, e) {
1028
+ const n = D(t);
1029
+ return this.bindings.set(n, { type: "constant", value: e }), this;
1038
1030
  }
1039
- alias(e, t) {
1040
- const n = D(e), r = D(t);
1041
- return this.bindings.set(n, { type: "alias", key: r }), this;
1031
+ alias(t, e) {
1032
+ const n = D(t), o = D(e);
1033
+ return this.bindings.set(n, { type: "alias", key: o }), this;
1042
1034
  }
1043
- delete(e) {
1044
- const t = D(e);
1045
- return this.bindings.delete(t), this;
1035
+ delete(t) {
1036
+ const e = D(t);
1037
+ return this.bindings.delete(e), this;
1046
1038
  }
1047
- resolve(e, t = !0) {
1048
- const n = this.tryResolve(e, t);
1039
+ resolve(t, e = !0) {
1040
+ const n = this.tryResolve(t, e);
1049
1041
  if (n === void 0) {
1050
- const r = D(e);
1051
- throw new Gt(this.name, r);
1042
+ const o = D(t);
1043
+ throw new Ge(this.name, o);
1052
1044
  }
1053
1045
  return n;
1054
1046
  }
1055
- tryResolve(e, t = !0) {
1056
- const n = D(e);
1057
- let r = this.instances.get(n);
1058
- if (r)
1059
- return r;
1060
- const c = this.bindings.get(n);
1061
- if (c)
1062
- return r = this.instantiate(c), r = this.connect(r), this.instances.set(n, r), r;
1063
- if (t && this.parent)
1064
- return this.parent.tryResolve(e);
1065
- }
1066
- getBinding(e, t = !0) {
1067
- const n = D(e), r = this.bindings.get(n);
1068
- if (r)
1069
- return r;
1070
- if (t && this.parent)
1071
- return this.parent.getBinding(e);
1047
+ tryResolve(t, e = !0) {
1048
+ const n = D(t);
1049
+ let o = this.instances.get(n);
1050
+ if (o)
1051
+ return o;
1052
+ const l = this.bindings.get(n);
1053
+ if (l)
1054
+ return o = this.instantiate(l), o = this.connect(o), this.instances.set(n, o), o;
1055
+ if (e && this.parent)
1056
+ return this.parent.tryResolve(t);
1057
+ }
1058
+ getBinding(t, e = !0) {
1059
+ const n = D(t), o = this.bindings.get(n);
1060
+ if (o)
1061
+ return o;
1062
+ if (e && this.parent)
1063
+ return this.parent.getBinding(t);
1072
1064
  }
1073
1065
  *allBindings() {
1074
1066
  yield* this.bindings.entries(), this.parent && (yield* this.parent.allBindings());
1075
1067
  }
1076
1068
  *missingDeps() {
1077
- for (const e of this.allDeps())
1078
- this.getBinding(e.key) || (yield e);
1069
+ for (const t of this.allDeps())
1070
+ this.getBinding(t.key) || (yield t);
1079
1071
  }
1080
1072
  *allDeps() {
1081
- const e = /* @__PURE__ */ new Set();
1082
- for (const [, t] of this.allBindings())
1083
- t.type === "service" && (yield* this.traverseClassDeps(t.class, e));
1084
- }
1085
- *traverseClassDeps(e, t = /* @__PURE__ */ new Set()) {
1086
- const n = Yt(e);
1087
- for (const r of n) {
1088
- if (t.has(r.key))
1073
+ const t = /* @__PURE__ */ new Set();
1074
+ for (const [, e] of this.allBindings())
1075
+ e.type === "service" && (yield* this.traverseClassDeps(e.class, t));
1076
+ }
1077
+ *traverseClassDeps(t, e = /* @__PURE__ */ new Set()) {
1078
+ const n = Ne(t);
1079
+ for (const o of n) {
1080
+ if (e.has(o.key))
1089
1081
  continue;
1090
- t.add(r.key), yield r;
1091
- const c = this.getBinding(r.key);
1092
- c?.type === "service" && (yield* this.traverseClassDeps(c.class, t));
1082
+ e.add(o.key), yield o;
1083
+ const l = this.getBinding(o.key);
1084
+ l?.type === "service" && (yield* this.traverseClassDeps(l.class, e));
1093
1085
  }
1094
1086
  }
1095
- instantiate(e) {
1096
- switch (e.type) {
1087
+ instantiate(t) {
1088
+ switch (t.type) {
1097
1089
  case "alias":
1098
- return this.resolve(e.key);
1090
+ return this.resolve(t.key);
1099
1091
  case "service": {
1100
- const t = e.class, n = class extends t {
1092
+ const e = t.class, n = class extends e {
1101
1093
  };
1102
- return Object.defineProperty(n, "name", { value: t.name }), this.injectRef(n.prototype), new n();
1094
+ return Object.defineProperty(n, "name", { value: e.name }), this.injectRef(n.prototype), new n();
1103
1095
  }
1104
1096
  case "constant":
1105
- return e.value;
1097
+ return t.value;
1106
1098
  case "scope":
1107
- return (n) => Kt(e.factory, n ?? this);
1099
+ return (n) => Fe(t.factory, n ?? this);
1108
1100
  }
1109
1101
  }
1110
- applyMiddleware(e) {
1111
- let t = e;
1102
+ applyMiddleware(t) {
1103
+ let e = t;
1112
1104
  for (const n of this.middlewares)
1113
- t = n(t);
1114
- return this.parent && (t = this.parent.applyMiddleware(t)), t;
1105
+ e = n(e);
1106
+ return this.parent && (e = this.parent.applyMiddleware(e)), e;
1115
1107
  }
1116
- injectRef(e) {
1117
- typeof e == "object" && Object.defineProperty(e, Je, {
1108
+ injectRef(t) {
1109
+ typeof t == "object" && Object.defineProperty(t, Zt, {
1118
1110
  get: () => this,
1119
1111
  enumerable: !1,
1120
1112
  configurable: !0
1121
1113
  });
1122
1114
  }
1123
1115
  }
1124
- const Nt = [];
1125
- function Yt(o) {
1126
- const e = [];
1127
- let t = o;
1128
- for (; t !== Object.prototype; ) {
1129
- const n = Nt.filter((r) => r.class === t);
1130
- e.push(...n), t = Object.getPrototypeOf(t);
1116
+ const Ke = [];
1117
+ function Ne(r) {
1118
+ const t = [];
1119
+ let e = r;
1120
+ for (; e !== Object.prototype; ) {
1121
+ const n = Ke.filter((o) => o.class === e);
1122
+ t.push(...n), e = Object.getPrototypeOf(e);
1131
1123
  }
1132
- return e;
1124
+ return t;
1133
1125
  }
1134
- const Ht = Object.getOwnPropertyNames(Reflect);
1135
- function b(o, e, t = !0) {
1126
+ const Ye = Object.getOwnPropertyNames(Reflect);
1127
+ function b(r, t, e = !0) {
1136
1128
  let n;
1137
- const r = {};
1138
- for (const c of Ht)
1139
- r[c] = function(p, ...y) {
1129
+ const o = {};
1130
+ for (const l of Ye)
1131
+ o[l] = function(g, ...p) {
1140
1132
  let S = n;
1141
- return S || (S = o[Je].resolve(e)), t && (n = S), Reflect[c](S, ...y);
1133
+ return S || (S = r[Zt].resolve(t)), e && (n = S), Reflect[l](S, ...p);
1142
1134
  };
1143
- return new Proxy(o, r);
1135
+ return new Proxy(r, o);
1144
1136
  }
1145
1137
  class J {
1146
1138
  constructor() {
1147
1139
  this.autoCenter = !0, this.allowMultiSelect = !0;
1148
1140
  }
1149
- set(e) {
1150
- Object.assign(this, e);
1141
+ set(t) {
1142
+ Object.assign(this, t);
1151
1143
  }
1152
1144
  }
1153
- class F {
1145
+ class $ {
1154
1146
  constructor() {
1155
1147
  this._groups = /* @__PURE__ */ new Map();
1156
1148
  }
1157
- on(e, t = /* @__PURE__ */ Symbol()) {
1158
- let n = this._groups.get(t);
1159
- return n || (n = /* @__PURE__ */ new Set(), this._groups.set(t, n)), n.add(e), () => this.remove(e, t);
1149
+ on(t, e = /* @__PURE__ */ Symbol()) {
1150
+ let n = this._groups.get(e);
1151
+ return n || (n = /* @__PURE__ */ new Set(), this._groups.set(e, n)), n.add(t), () => this.remove(t, e);
1160
1152
  }
1161
- once(e, t = /* @__PURE__ */ Symbol()) {
1162
- const n = (r) => {
1163
- e(r), this.remove(n, t);
1153
+ once(t, e = /* @__PURE__ */ Symbol()) {
1154
+ const n = (o) => {
1155
+ t(o), this.remove(n, e);
1164
1156
  };
1165
- return this.on(n, t);
1157
+ return this.on(n, e);
1166
1158
  }
1167
- remove(e, t) {
1168
- const n = this._groups.get(t);
1169
- n && (n.delete(e), n.size === 0 && this._groups.delete(t));
1159
+ remove(t, e) {
1160
+ const n = this._groups.get(e);
1161
+ n && (n.delete(t), n.size === 0 && this._groups.delete(e));
1170
1162
  }
1171
- removeAll(e) {
1172
- this._groups.delete(e);
1163
+ removeAll(t) {
1164
+ this._groups.delete(t);
1173
1165
  }
1174
- emit(e) {
1175
- for (const t of this._groups.values())
1176
- for (const n of t)
1177
- n(e);
1166
+ emit(t) {
1167
+ for (const e of this._groups.values())
1168
+ for (const n of e)
1169
+ n(t);
1178
1170
  }
1179
1171
  }
1180
- class k {
1172
+ class K {
1181
1173
  constructor() {
1182
- this.mounted = new F(), this.unmounted = new F(), this.selectionChanged = new F(), this.dragMove = new F(), this.dragEnd = new F(), this.objectPosUpdated = new F();
1174
+ this.mounted = new $(), this.unmounted = new $(), this.selectionChanged = new $(), this.dragMove = new $(), this.dragEnd = new $(), this.objectPosUpdated = new $();
1183
1175
  }
1184
1176
  }
1185
- const we = /* @__PURE__ */ new Map();
1186
- function Xt(o) {
1187
- return function(t) {
1188
- return (n, r) => {
1189
- const c = we.get(o) || [];
1190
- we.set(o, c), c.push({
1177
+ const yt = /* @__PURE__ */ new Map();
1178
+ function He(r) {
1179
+ return function(e) {
1180
+ return (n, o) => {
1181
+ const l = yt.get(r) || [];
1182
+ yt.set(r, l), l.push({
1191
1183
  target: n.constructor,
1192
- memberName: r,
1193
- metadata: t
1184
+ memberName: o,
1185
+ metadata: e
1194
1186
  });
1195
1187
  };
1196
1188
  };
1197
1189
  }
1198
- function Wt(o) {
1199
- return we.get(o) || [];
1190
+ function Xe(r) {
1191
+ return yt.get(r) || [];
1200
1192
  }
1201
- function Zt(o, e, t = !0) {
1202
- const n = [], r = Wt(o), c = t ? e.allBindings() : e.bindings.entries();
1203
- for (const [p, y] of c)
1204
- if (y.type === "service")
1205
- for (const { target: S, memberName: C, metadata: E } of r)
1206
- (S === y.class || Object.prototype.isPrototypeOf.call(S, y.class)) && n.push({
1207
- target: e.resolve(p),
1208
- memberName: C,
1193
+ function We(r, t, e = !0) {
1194
+ const n = [], o = Xe(r), l = e ? t.allBindings() : t.bindings.entries();
1195
+ for (const [g, p] of l)
1196
+ if (p.type === "service")
1197
+ for (const { target: S, memberName: _, metadata: E } of o)
1198
+ (S === p.class || Object.prototype.isPrototypeOf.call(S, p.class)) && n.push({
1199
+ target: t.resolve(g),
1200
+ memberName: _,
1209
1201
  metadata: E
1210
1202
  });
1211
1203
  return n;
1212
1204
  }
1213
- function qt(o, e, t = !0, ...n) {
1214
- return Zt(o, e, t).map((p) => p.target[p.memberName](...n));
1205
+ function Ze(r, t, e = !0, ...n) {
1206
+ return We(r, t, e).map((g) => g.target[g.memberName](...n));
1215
1207
  }
1216
- const he = Xt("init");
1217
- async function Ne(o, e = !0) {
1218
- const t = qt("init", o, e);
1219
- await Promise.all(t);
1208
+ const qt = He("init");
1209
+ async function Gt(r, t = !0) {
1210
+ const e = Ze("init", r, t);
1211
+ await Promise.all(e);
1220
1212
  }
1221
- class ce {
1213
+ class ct {
1222
1214
  constructor() {
1223
1215
  this.objects = /* @__PURE__ */ new Map();
1224
1216
  }
1225
- register(e) {
1226
- this.objects.set(e.objectId, e);
1217
+ register(t) {
1218
+ this.objects.set(t.objectId, t);
1227
1219
  }
1228
- unregister(e) {
1229
- this.objects.delete(e);
1220
+ unregister(t) {
1221
+ this.objects.delete(t);
1230
1222
  }
1231
- get(e) {
1232
- return this.objects.get(e) ?? null;
1223
+ get(t) {
1224
+ return this.objects.get(t) ?? null;
1233
1225
  }
1234
1226
  getAll() {
1235
1227
  return [...this.objects.values()];
@@ -1237,7 +1229,7 @@ class ce {
1237
1229
  }
1238
1230
  class Q {
1239
1231
  constructor() {
1240
- this.selectedIds = /* @__PURE__ */ new Set(), this.events = b(this, k);
1232
+ this.selectedIds = /* @__PURE__ */ new Set(), this.events = b(this, K);
1241
1233
  }
1242
1234
  get size() {
1243
1235
  return this.selectedIds.size;
@@ -1248,225 +1240,225 @@ class Q {
1248
1240
  getFirst() {
1249
1241
  return [...this.selectedIds][0] ?? null;
1250
1242
  }
1251
- isSelected(e) {
1252
- return this.selectedIds.has(e);
1243
+ isSelected(t) {
1244
+ return this.selectedIds.has(t);
1253
1245
  }
1254
- isSingleSelected(e) {
1255
- return this.selectedIds.size === 1 && this.selectedIds.has(e);
1246
+ isSingleSelected(t) {
1247
+ return this.selectedIds.size === 1 && this.selectedIds.has(t);
1256
1248
  }
1257
- setSelectedIds(e) {
1258
- const t = new Set(this.selectedIds);
1259
- this.selectedIds = new Set(e), this.notifySelectionChanged(t);
1249
+ setSelectedIds(t) {
1250
+ const e = new Set(this.selectedIds);
1251
+ this.selectedIds = new Set(t), this.notifySelectionChanged(e);
1260
1252
  }
1261
- selectSingle(e) {
1262
- if (this.isSingleSelected(e))
1253
+ selectSingle(t) {
1254
+ if (this.isSingleSelected(t))
1263
1255
  return;
1264
- const t = new Set(this.selectedIds);
1265
- this.selectedIds.clear(), this.selectedIds.add(e), this.notifySelectionChanged(t);
1256
+ const e = new Set(this.selectedIds);
1257
+ this.selectedIds.clear(), this.selectedIds.add(t), this.notifySelectionChanged(e);
1266
1258
  }
1267
- addToSelection(...e) {
1268
- const t = new Set(this.selectedIds);
1269
- for (const n of e)
1259
+ addToSelection(...t) {
1260
+ const e = new Set(this.selectedIds);
1261
+ for (const n of t)
1270
1262
  this.selectedIds.add(n);
1271
- this.notifySelectionChanged(t);
1263
+ this.notifySelectionChanged(e);
1272
1264
  }
1273
- removeFromSelection(...e) {
1274
- const t = new Set(this.selectedIds);
1275
- for (const n of e)
1265
+ removeFromSelection(...t) {
1266
+ const e = new Set(this.selectedIds);
1267
+ for (const n of t)
1276
1268
  this.selectedIds.delete(n);
1277
- this.notifySelectionChanged(t);
1269
+ this.notifySelectionChanged(e);
1278
1270
  }
1279
- toggleSelection(e) {
1280
- if (this.isSelected(e)) {
1281
- this.removeFromSelection(e);
1271
+ toggleSelection(t) {
1272
+ if (this.isSelected(t)) {
1273
+ this.removeFromSelection(t);
1282
1274
  return;
1283
1275
  }
1284
- this.addToSelection(e);
1276
+ this.addToSelection(t);
1285
1277
  }
1286
1278
  deselectAll() {
1287
1279
  if (this.selectedIds.size === 0)
1288
1280
  return;
1289
- const e = new Set(this.selectedIds);
1290
- this.selectedIds.clear(), this.notifySelectionChanged(e);
1281
+ const t = new Set(this.selectedIds);
1282
+ this.selectedIds.clear(), this.notifySelectionChanged(t);
1291
1283
  }
1292
- notifySelectionChanged(e) {
1293
- if (e.size === this.selectedIds.size) {
1294
- let t = !1;
1295
- for (const n of e)
1284
+ notifySelectionChanged(t) {
1285
+ if (t.size === this.selectedIds.size) {
1286
+ let e = !1;
1287
+ for (const n of t)
1296
1288
  if (!this.selectedIds.has(n)) {
1297
- t = !0;
1289
+ e = !0;
1298
1290
  break;
1299
1291
  }
1300
- if (!t)
1292
+ if (!e)
1301
1293
  return;
1302
1294
  }
1303
1295
  this.events.selectionChanged.emit(this.getSelectedIds());
1304
1296
  }
1305
- setSelected(e, t) {
1306
- if (t) {
1307
- this.addToSelection(e);
1297
+ setSelected(t, e) {
1298
+ if (e) {
1299
+ this.addToSelection(t);
1308
1300
  return;
1309
1301
  }
1310
- this.removeFromSelection(e);
1302
+ this.removeFromSelection(t);
1311
1303
  }
1312
1304
  }
1313
- class L {
1305
+ class V {
1314
1306
  constructor() {
1315
1307
  this.zoom = 1, this.cellSize = 32, this.scrollPos = { x: 0, y: 0 }, this.viewportBox = [{ x: 0, y: 0 }, { x: 0, y: 0 }], this.canvasOrigin = { x: 0, y: 0 }, this.canvasSize = { x: 0, y: 0 };
1316
1308
  }
1317
- localToCanvas(e) {
1309
+ localToCanvas(t) {
1318
1310
  return {
1319
- x: e.x * this.cellSize + this.canvasOrigin.x,
1320
- y: e.y * this.cellSize + this.canvasOrigin.y
1311
+ x: t.x * this.cellSize + this.canvasOrigin.x,
1312
+ y: t.y * this.cellSize + this.canvasOrigin.y
1321
1313
  };
1322
1314
  }
1323
- canvasToLocal(e) {
1315
+ canvasToLocal(t) {
1324
1316
  return {
1325
- x: (e.x - this.canvasOrigin.x) / this.cellSize,
1326
- y: (e.y - this.canvasOrigin.y) / this.cellSize
1317
+ x: (t.x - this.canvasOrigin.x) / this.cellSize,
1318
+ y: (t.y - this.canvasOrigin.y) / this.cellSize
1327
1319
  };
1328
1320
  }
1329
- viewportToCanvas(e) {
1321
+ viewportToCanvas(t) {
1330
1322
  return {
1331
- x: (e.x + this.scrollPos.x) / this.zoom,
1332
- y: (e.y + this.scrollPos.y) / this.zoom
1323
+ x: (t.x + this.scrollPos.x) / this.zoom,
1324
+ y: (t.y + this.scrollPos.y) / this.zoom
1333
1325
  };
1334
1326
  }
1335
- canvasToViewport(e) {
1327
+ canvasToViewport(t) {
1336
1328
  return {
1337
- x: e.x * this.zoom - this.scrollPos.x,
1338
- y: e.y * this.zoom - this.scrollPos.y
1329
+ x: t.x * this.zoom - this.scrollPos.x,
1330
+ y: t.y * this.zoom - this.scrollPos.y
1339
1331
  };
1340
1332
  }
1341
- viewportToLocal(e) {
1342
- return this.canvasToLocal(this.viewportToCanvas(e));
1333
+ viewportToLocal(t) {
1334
+ return this.canvasToLocal(this.viewportToCanvas(t));
1343
1335
  }
1344
- localToViewport(e) {
1345
- return this.canvasToViewport(this.localToCanvas(e));
1336
+ localToViewport(t) {
1337
+ return this.canvasToViewport(this.localToCanvas(t));
1346
1338
  }
1347
- pageToViewport(e) {
1339
+ pageToViewport(t) {
1348
1340
  return {
1349
- x: e.x - this.viewportBox[0].x,
1350
- y: e.y - this.viewportBox[0].y
1341
+ x: t.x - this.viewportBox[0].x,
1342
+ y: t.y - this.viewportBox[0].y
1351
1343
  };
1352
1344
  }
1353
- pageToCanvas(e) {
1354
- return this.viewportToCanvas(this.pageToViewport(e));
1345
+ pageToCanvas(t) {
1346
+ return this.viewportToCanvas(this.pageToViewport(t));
1355
1347
  }
1356
- pageToLocal(e) {
1357
- return this.canvasToLocal(this.pageToCanvas(e));
1348
+ pageToLocal(t) {
1349
+ return this.canvasToLocal(this.pageToCanvas(t));
1358
1350
  }
1359
1351
  getViewportCenterInLocal() {
1360
- const e = Vt(this.viewportBox), t = this.pageToViewport(e);
1361
- return this.viewportToLocal(t);
1352
+ const t = Ue(this.viewportBox), e = this.pageToViewport(t);
1353
+ return this.viewportToLocal(e);
1362
1354
  }
1363
1355
  }
1364
- var Jt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, es = (o, e, t, n) => {
1365
- for (var r = Qt(e, t), c = o.length - 1, p; c >= 0; c--)
1366
- (p = o[c]) && (r = p(e, t, r) || r);
1367
- return r && Jt(e, t, r), r;
1356
+ var qe = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, Qe = (r, t, e, n) => {
1357
+ for (var o = Je(t, e), l = r.length - 1, g; l >= 0; l--)
1358
+ (g = r[l]) && (o = g(t, e, o) || o);
1359
+ return o && qe(t, e, o), o;
1368
1360
  };
1369
- class xe {
1361
+ class wt {
1370
1362
  constructor() {
1371
- this.events = b(this, k), this.selection = b(this, Q), this.objectRegistry = b(this, ce), this.space = b(this, L), this.movingIds = /* @__PURE__ */ new Set(), this.moveOriginPos = null;
1363
+ this.events = b(this, K), this.selection = b(this, Q), this.objectRegistry = b(this, ct), this.space = b(this, V), this.movingIds = /* @__PURE__ */ new Set(), this.moveOriginPos = null;
1372
1364
  }
1373
1365
  init() {
1374
- this.events.dragMove.on((e) => this.onDragMove(e)), this.events.dragEnd.on(() => this.stopMovingSelection()), this.events.unmounted.on(() => this.stopMovingSelection());
1366
+ this.events.dragMove.on((t) => this.onDragMove(t)), this.events.dragEnd.on(() => this.stopMovingSelection()), this.events.unmounted.on(() => this.stopMovingSelection());
1375
1367
  }
1376
- isMoving(e) {
1377
- return this.movingIds.has(e);
1368
+ isMoving(t) {
1369
+ return this.movingIds.has(t);
1378
1370
  }
1379
- startMovingSelection(e) {
1380
- this.movingIds = new Set(this.selection.getSelectedIds()), this.moveOriginPos = { x: e.pageX, y: e.pageY };
1381
- for (const t of this.movingIds)
1382
- this.objectRegistry.get(t)?.onMoveStart();
1371
+ startMovingSelection(t) {
1372
+ this.movingIds = new Set(this.selection.getSelectedIds()), this.moveOriginPos = { x: t.pageX, y: t.pageY };
1373
+ for (const e of this.movingIds)
1374
+ this.objectRegistry.get(e)?.onMoveStart();
1383
1375
  }
1384
- onDragMove(e) {
1376
+ onDragMove(t) {
1385
1377
  if (!this.moveOriginPos)
1386
1378
  return;
1387
- const t = this.space.pageToLocal(this.moveOriginPos), n = this.space.pageToLocal({ x: e.pageX, y: e.pageY }), r = We(n, t);
1388
- for (const c of this.movingIds)
1389
- this.objectRegistry.get(c)?.onMoveOffset(r);
1379
+ const e = this.space.pageToLocal(this.moveOriginPos), n = this.space.pageToLocal({ x: t.pageX, y: t.pageY }), o = Yt(n, e);
1380
+ for (const l of this.movingIds)
1381
+ this.objectRegistry.get(l)?.onMoveOffset(o);
1390
1382
  }
1391
1383
  stopMovingSelection() {
1392
- for (const e of this.movingIds)
1393
- this.objectRegistry.get(e)?.onMoveEnd();
1384
+ for (const t of this.movingIds)
1385
+ this.objectRegistry.get(t)?.onMoveEnd();
1394
1386
  this.movingIds.clear(), this.moveOriginPos = null;
1395
1387
  }
1396
1388
  }
1397
- es([
1398
- he()
1399
- ], xe.prototype, "init");
1389
+ Qe([
1390
+ qt()
1391
+ ], wt.prototype, "init");
1400
1392
  class ts {
1401
- constructor(e) {
1402
- this.config = b(this, J), this.events = b(this, k), this.selection = b(this, Q), this.move = b(this, xe), this.space = b(this, L), this.element = null, this.selectable = !0, this.movable = !0, this.snapToGrid = !0, this.resizable = "none", this.bounds = [{ x: 1, y: 1 }, { x: 10, y: 10 }], this.pos = { x: 0, y: 0 }, this.localPos = { x: 0, y: 0, w: 1, h: 1 }, this.prevLocalPos = { x: 0, y: 0, w: 1, h: 1 }, this.resizingDirection = null, this.resizingBounds = [{ x: 0, y: 0 }, { x: 0, y: 0 }], this.objectId = e;
1393
+ constructor(t) {
1394
+ this.config = b(this, J), this.events = b(this, K), this.selection = b(this, Q), this.move = b(this, wt), this.space = b(this, V), this.element = null, this.selectable = !0, this.movable = !0, this.snapToGrid = !0, this.resizable = "none", this.bounds = [{ x: 1, y: 1 }, { x: 10, y: 10 }], this.pos = { x: 0, y: 0 }, this.localPos = { x: 0, y: 0, w: 1, h: 1 }, this.prevLocalPos = { x: 0, y: 0, w: 1, h: 1 }, this.resizingDirection = null, this.resizingBounds = [{ x: 0, y: 0 }, { x: 0, y: 0 }], this.objectId = t;
1403
1395
  }
1404
- setElement(e) {
1405
- this.element = e;
1396
+ setElement(t) {
1397
+ this.element = t;
1406
1398
  }
1407
1399
  getPos() {
1408
1400
  return this.pos;
1409
1401
  }
1410
- setPos(e) {
1411
- this.pos = e, !this.isMoving() && !this.isResizing() && this.recalcLocalPos();
1402
+ setPos(t) {
1403
+ this.pos = t, !this.isMoving() && !this.isResizing() && this.recalcLocalPos();
1412
1404
  }
1413
1405
  getBounds() {
1414
1406
  return this.bounds;
1415
1407
  }
1416
- setBounds(e) {
1417
- this.bounds = e, !this.isMoving() && !this.isResizing() && this.recalcLocalPos();
1408
+ setBounds(t) {
1409
+ this.bounds = t, !this.isMoving() && !this.isResizing() && this.recalcLocalPos();
1418
1410
  }
1419
1411
  isSelectable() {
1420
1412
  return this.selectable;
1421
1413
  }
1422
- setSelectable(e) {
1423
- this.selectable = e, e || this.selection.removeFromSelection(this.objectId);
1414
+ setSelectable(t) {
1415
+ this.selectable = t, t || this.selection.removeFromSelection(this.objectId);
1424
1416
  }
1425
1417
  isSelected() {
1426
1418
  return this.selection.isSelected(this.objectId);
1427
1419
  }
1428
- setSelected(e) {
1429
- e && !this.selectable || this.selection.setSelected(this.objectId, e);
1420
+ setSelected(t) {
1421
+ t && !this.selectable || this.selection.setSelected(this.objectId, t);
1430
1422
  }
1431
1423
  isMovable() {
1432
1424
  return this.movable;
1433
1425
  }
1434
- setMovable(e) {
1435
- this.movable = e;
1426
+ setMovable(t) {
1427
+ this.movable = t;
1436
1428
  }
1437
1429
  isSnapToGrid() {
1438
1430
  return this.snapToGrid;
1439
1431
  }
1440
- setSnapToGrid(e) {
1441
- this.snapToGrid = e;
1432
+ setSnapToGrid(t) {
1433
+ this.snapToGrid = t;
1442
1434
  }
1443
1435
  isResizable() {
1444
1436
  return this.resizable;
1445
1437
  }
1446
- setResizable(e) {
1447
- this.resizable = e;
1438
+ setResizable(t) {
1439
+ this.resizable = t;
1448
1440
  }
1449
1441
  /* Render state */
1450
1442
  getCanvasCoords() {
1451
- const e = this.space.localToCanvas({ x: this.localPos.x, y: this.localPos.y }), t = this.space.localToCanvas({
1443
+ const t = this.space.localToCanvas({ x: this.localPos.x, y: this.localPos.y }), e = this.space.localToCanvas({
1452
1444
  x: this.localPos.x + this.localPos.w,
1453
1445
  y: this.localPos.y + this.localPos.h
1454
- }), n = We(t, e), r = this.pos.w === void 0 ? void 0 : n.x, c = this.pos.h === void 0 ? void 0 : n.y;
1446
+ }), n = Yt(e, t), o = this.pos.w === void 0 ? void 0 : n.x, l = this.pos.h === void 0 ? void 0 : n.y;
1455
1447
  return {
1456
- x: e.x,
1457
- y: e.y,
1458
- w: r,
1459
- h: c
1448
+ x: t.x,
1449
+ y: t.y,
1450
+ w: o,
1451
+ h: l
1460
1452
  };
1461
1453
  }
1462
1454
  getStyle() {
1463
- const e = this.getCanvasCoords();
1455
+ const t = this.getCanvasCoords();
1464
1456
  return {
1465
1457
  position: "absolute",
1466
- left: `${e.x}px`,
1467
- top: `${e.y}px`,
1468
- width: e.w === void 0 ? void 0 : `${e.w}px`,
1469
- height: e.h === void 0 ? void 0 : `${e.h}px`
1458
+ left: `${t.x}px`,
1459
+ top: `${t.y}px`,
1460
+ width: t.w === void 0 ? void 0 : `${t.w}px`,
1461
+ height: t.h === void 0 ? void 0 : `${t.h}px`
1470
1462
  };
1471
1463
  }
1472
1464
  isMoving() {
@@ -1475,8 +1467,8 @@ class ts {
1475
1467
  isResizing() {
1476
1468
  return this.resizingDirection != null;
1477
1469
  }
1478
- commitNewPos(e) {
1479
- Object.assign(this.pos, e), this.events.objectPosUpdated.emit({
1470
+ commitNewPos(t) {
1471
+ Object.assign(this.pos, t), this.events.objectPosUpdated.emit({
1480
1472
  objectId: this.objectId,
1481
1473
  pos: { ...this.pos }
1482
1474
  });
@@ -1486,11 +1478,11 @@ class ts {
1486
1478
  * Click handles selection
1487
1479
  * Shift/Ctrl/Meta key allows multi-select, if allowed by canvas config
1488
1480
  */
1489
- onUiClick(e) {
1481
+ onUiClick(t) {
1490
1482
  if (!this.selectable)
1491
1483
  return;
1492
- const t = e.shiftKey || e.ctrlKey || e.metaKey;
1493
- if (this.config.allowMultiSelect && t) {
1484
+ const e = t.shiftKey || t.ctrlKey || t.metaKey;
1485
+ if (this.config.allowMultiSelect && e) {
1494
1486
  this.selection.toggleSelection(this.objectId);
1495
1487
  return;
1496
1488
  }
@@ -1500,22 +1492,22 @@ class ts {
1500
1492
  * Dragging starts moving selected objects, if allowed.
1501
1493
  * If not selected, single selection is performed first, then dragging starts.
1502
1494
  */
1503
- onUiDragStart(e) {
1504
- this.movable && (this.isSelected() || (e.shiftKey ? this.selection.addToSelection(this.objectId) : this.selection.selectSingle(this.objectId)), !this.isResizing() && !this.isMoving() && this.move.startMovingSelection(e));
1495
+ onUiDragStart(t) {
1496
+ this.movable && (this.isSelected() || (t.shiftKey ? this.selection.addToSelection(this.objectId) : this.selection.selectSingle(this.objectId)), !this.isResizing() && !this.isMoving() && this.move.startMovingSelection(t));
1505
1497
  }
1506
1498
  /**
1507
1499
  * Drag move is re-emitted to global canvas events, so that each selected object moves.
1508
1500
  * CanvasMove will call onMoveOffset on objects that are currently moving.
1509
1501
  */
1510
- onUiDragMove(e) {
1511
- this.events.dragMove.emit(e);
1502
+ onUiDragMove(t) {
1503
+ this.events.dragMove.emit(t);
1512
1504
  }
1513
1505
  /**
1514
1506
  * Drag end is re-emitted to global canvas events, so that each selected object stops moving.
1515
1507
  * CanvasMove will call onMoveEnd on objects that are currently moving.
1516
1508
  */
1517
- onUiDragEnd(e) {
1518
- this.events.dragEnd.emit(e);
1509
+ onUiDragEnd(t) {
1510
+ this.events.dragEnd.emit(t);
1519
1511
  }
1520
1512
  /* Moving */
1521
1513
  /**
@@ -1529,10 +1521,10 @@ class ts {
1529
1521
  * Move offset is called by CanvasMove when selected objects moves.
1530
1522
  * It calculates the new local position based on the previous local position and the offset.
1531
1523
  */
1532
- onMoveOffset(e) {
1524
+ onMoveOffset(t) {
1533
1525
  this.movable && (this.localPos = {
1534
- x: this.prevLocalPos.x + e.x,
1535
- y: this.prevLocalPos.y + e.y,
1526
+ x: this.prevLocalPos.x + t.x,
1527
+ y: this.prevLocalPos.y + t.y,
1536
1528
  w: this.prevLocalPos.w,
1537
1529
  h: this.prevLocalPos.h
1538
1530
  });
@@ -1548,18 +1540,18 @@ class ts {
1548
1540
  });
1549
1541
  }
1550
1542
  /* Resizing */
1551
- startResizing(e) {
1552
- this.resizable === "none" || !this.canResizeInDirection(e) || (this.resizingDirection = e, this.resizingBounds = this.getObjectBounds(), this.selection.selectSingle(this.objectId));
1543
+ startResizing(t) {
1544
+ this.resizable === "none" || !this.canResizeInDirection(t) || (this.resizingDirection = t, this.resizingBounds = this.getObjectBounds(), this.selection.selectSingle(this.objectId));
1553
1545
  }
1554
- onResizeMove(e) {
1546
+ onResizeMove(t) {
1555
1547
  if (!this.resizingDirection)
1556
1548
  return;
1557
- const t = { x: e.pageX, y: e.pageY }, n = this.space.pageToLocal(t), [r, c] = this.getResizingUpdates(this.resizingDirection, n);
1549
+ const e = { x: t.pageX, y: t.pageY }, n = this.space.pageToLocal(e), [o, l] = this.getResizingUpdates(this.resizingDirection, n);
1558
1550
  this.localPos = {
1559
- x: r.x,
1560
- y: r.y,
1561
- w: c.x - r.x,
1562
- h: c.y - r.y
1551
+ x: o.x,
1552
+ y: o.y,
1553
+ w: l.x - o.x,
1554
+ h: l.y - o.y
1563
1555
  };
1564
1556
  }
1565
1557
  onResizeEnd() {
@@ -1583,68 +1575,68 @@ class ts {
1583
1575
  }
1584
1576
  }
1585
1577
  getObjectBounds() {
1586
- const e = { x: this.localPos.x, y: this.localPos.y }, t = {
1578
+ const t = { x: this.localPos.x, y: this.localPos.y }, e = {
1587
1579
  x: this.localPos.x + this.localPos.w,
1588
1580
  y: this.localPos.y + this.localPos.h
1589
1581
  };
1590
- return [e, t];
1582
+ return [t, e];
1591
1583
  }
1592
- canResizeInDirection(e) {
1593
- return this.getResizeDirections().includes(e);
1584
+ canResizeInDirection(t) {
1585
+ return this.getResizeDirections().includes(t);
1594
1586
  }
1595
1587
  recalcLocalPos() {
1596
- const e = this.pos.w ?? this.localPos.w, t = this.pos.h ?? this.localPos.h;
1588
+ const t = this.pos.w ?? this.localPos.w, e = this.pos.h ?? this.localPos.h;
1597
1589
  this.localPos = {
1598
1590
  x: this.pos.x,
1599
1591
  y: this.pos.y,
1600
- w: z(e, this.bounds[0].x, this.bounds[1].x),
1601
- h: z(t, this.bounds[0].y, this.bounds[1].y)
1592
+ w: z(t, this.bounds[0].x, this.bounds[1].x),
1593
+ h: z(e, this.bounds[0].y, this.bounds[1].y)
1602
1594
  };
1603
1595
  }
1604
- maybeRound(e) {
1605
- return this.snapToGrid ? Math.round(e) : e;
1596
+ maybeRound(t) {
1597
+ return this.snapToGrid ? Math.round(t) : t;
1606
1598
  }
1607
- getResizingUpdates(e, t) {
1608
- const [n, r] = this.resizingBounds, c = z(t.x, r.x - this.bounds[1].x, r.x - this.bounds[0].x), p = z(t.x, n.x + this.bounds[0].x, n.x + this.bounds[1].x), y = z(t.y, r.y - this.bounds[1].y, r.y - this.bounds[0].y), S = z(t.y, n.y + this.bounds[0].y, n.y + this.bounds[1].y);
1609
- switch (e) {
1599
+ getResizingUpdates(t, e) {
1600
+ const [n, o] = this.resizingBounds, l = z(e.x, o.x - this.bounds[1].x, o.x - this.bounds[0].x), g = z(e.x, n.x + this.bounds[0].x, n.x + this.bounds[1].x), p = z(e.y, o.y - this.bounds[1].y, o.y - this.bounds[0].y), S = z(e.y, n.y + this.bounds[0].y, n.y + this.bounds[1].y);
1601
+ switch (t) {
1610
1602
  case "n":
1611
- return [{ x: n.x, y }, { x: r.x, y: r.y }];
1603
+ return [{ x: n.x, y: p }, { x: o.x, y: o.y }];
1612
1604
  case "s":
1613
- return [{ x: n.x, y: n.y }, { x: r.x, y: S }];
1605
+ return [{ x: n.x, y: n.y }, { x: o.x, y: S }];
1614
1606
  case "w":
1615
- return [{ x: c, y: n.y }, { x: r.x, y: r.y }];
1607
+ return [{ x: l, y: n.y }, { x: o.x, y: o.y }];
1616
1608
  case "e":
1617
- return [{ x: n.x, y: n.y }, { x: p, y: r.y }];
1609
+ return [{ x: n.x, y: n.y }, { x: g, y: o.y }];
1618
1610
  case "ne":
1619
- return [{ x: n.x, y }, { x: p, y: r.y }];
1611
+ return [{ x: n.x, y: p }, { x: g, y: o.y }];
1620
1612
  case "nw":
1621
- return [{ x: c, y }, { x: r.x, y: r.y }];
1613
+ return [{ x: l, y: p }, { x: o.x, y: o.y }];
1622
1614
  case "se":
1623
- return [{ x: n.x, y: n.y }, { x: p, y: S }];
1615
+ return [{ x: n.x, y: n.y }, { x: g, y: S }];
1624
1616
  case "sw":
1625
- return [{ x: c, y: n.y }, { x: r.x, y: S }];
1617
+ return [{ x: l, y: n.y }, { x: o.x, y: S }];
1626
1618
  default:
1627
- return [{ x: n.x, y: n.y }, { x: r.x, y: r.y }];
1619
+ return [{ x: n.x, y: n.y }, { x: o.x, y: o.y }];
1628
1620
  }
1629
1621
  }
1630
1622
  }
1631
- const ss = {
1623
+ const es = {
1632
1624
  props: {
1633
1625
  canvasObject: { type: Object, required: !0 },
1634
1626
  direction: { type: String, required: !0 }
1635
1627
  }
1636
1628
  };
1637
- function ns(o, e, t, n, r, c) {
1638
- return V(), q("div", {
1639
- class: _t(["ResizeHandle", `ResizeHandle-${t.direction}`]),
1640
- onUidragstart: e[0] || (e[0] = U((p) => t.canvasObject.startResizing(t.direction), ["stop", "prevent"])),
1641
- onUidragmove: e[1] || (e[1] = U((...p) => t.canvasObject.onResizeMove && t.canvasObject.onResizeMove(...p), ["stop", "prevent"])),
1642
- onUidragend: e[2] || (e[2] = U((...p) => t.canvasObject.onResizeEnd && t.canvasObject.onResizeEnd(...p), ["stop", "prevent"]))
1629
+ function ss(r, t, e, n, o, l) {
1630
+ return U(), q("div", {
1631
+ class: Pe(["ResizeHandle", `ResizeHandle-${e.direction}`]),
1632
+ onUidragstart: t[0] || (t[0] = B((g) => e.canvasObject.startResizing(e.direction), ["stop", "prevent"])),
1633
+ onUidragmove: t[1] || (t[1] = B((...g) => e.canvasObject.onResizeMove && e.canvasObject.onResizeMove(...g), ["stop", "prevent"])),
1634
+ onUidragend: t[2] || (t[2] = B((...g) => e.canvasObject.onResizeEnd && e.canvasObject.onResizeEnd(...g), ["stop", "prevent"]))
1643
1635
  }, null, 34);
1644
1636
  }
1645
- const is = /* @__PURE__ */ te(ss, [["render", ns], ["__scopeId", "data-v-c83350e5"]]), rs = {
1637
+ const ns = /* @__PURE__ */ tt(es, [["render", ss], ["__scopeId", "data-v-c83350e5"]]), is = {
1646
1638
  components: {
1647
- CanvasObjectResize: is
1639
+ CanvasObjectResize: ns
1648
1640
  },
1649
1641
  props: {
1650
1642
  canvas: { type: Object, required: !0 },
@@ -1684,66 +1676,66 @@ const is = /* @__PURE__ */ te(ss, [["render", ns], ["__scopeId", "data-v-c83350e
1684
1676
  }
1685
1677
  },
1686
1678
  watch: {
1687
- pos(o) {
1688
- this.canvasObject.setPos(o);
1679
+ pos(r) {
1680
+ this.canvasObject.setPos(r);
1689
1681
  },
1690
- isSelected(o) {
1691
- this.canvasObject.setSelected(o);
1682
+ isSelected(r) {
1683
+ this.canvasObject.setSelected(r);
1692
1684
  },
1693
- selectable(o) {
1694
- this.canvasObject.setSelectable(o);
1685
+ selectable(r) {
1686
+ this.canvasObject.setSelectable(r);
1695
1687
  },
1696
- movable(o) {
1697
- this.canvasObject.setMovable(o);
1688
+ movable(r) {
1689
+ this.canvasObject.setMovable(r);
1698
1690
  },
1699
- snapToGrid(o) {
1700
- this.canvasObject.setSnapToGrid(o);
1691
+ snapToGrid(r) {
1692
+ this.canvasObject.setSnapToGrid(r);
1701
1693
  },
1702
- resizable(o) {
1703
- this.canvasObject.setResizable(o);
1694
+ resizable(r) {
1695
+ this.canvasObject.setResizable(r);
1704
1696
  },
1705
- bounds(o) {
1706
- this.canvasObject.setBounds(o);
1697
+ bounds(r) {
1698
+ this.canvasObject.setBounds(r);
1707
1699
  }
1708
1700
  },
1709
1701
  created() {
1710
- this.canvasObject = new ts(this.objectId), this.canvas.mesh.connect(this.canvasObject), this.canvas.events.objectPosUpdated.on(({ objectId: o, pos: e }) => {
1711
- o === this.objectId && this.$emit("update:pos", e);
1712
- }, this), this.canvas.events.selectionChanged.on((o) => {
1713
- const e = o.includes(this.objectId);
1714
- this.isSelected !== e && this.$emit("update:isSelected", e);
1702
+ this.canvasObject = new ts(this.objectId), this.canvas.mesh.connect(this.canvasObject), this.canvas.events.objectPosUpdated.on(({ objectId: r, pos: t }) => {
1703
+ r === this.objectId && this.$emit("update:pos", t);
1704
+ }, this), this.canvas.events.selectionChanged.on((r) => {
1705
+ const t = r.includes(this.objectId);
1706
+ this.isSelected !== t && this.$emit("update:isSelected", t);
1715
1707
  }, this);
1716
1708
  },
1717
1709
  mounted() {
1718
- const o = this.canvasObject;
1719
- this.canvas.objectRegistry.register(o), o.setElement(this.$refs.rootEl), o.setPos(this.pos), o.setSelectable(this.selectable), o.setMovable(this.movable), o.setSnapToGrid(this.snapToGrid), o.setResizable(this.resizable), o.setBounds(this.bounds), o.setSelected(this.isSelected);
1710
+ const r = this.canvasObject;
1711
+ this.canvas.objectRegistry.register(r), r.setElement(this.$refs.rootEl), r.setPos(this.pos), r.setSelectable(this.selectable), r.setMovable(this.movable), r.setSnapToGrid(this.snapToGrid), r.setResizable(this.resizable), r.setBounds(this.bounds), r.setSelected(this.isSelected);
1720
1712
  },
1721
1713
  unmounted() {
1722
1714
  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);
1723
1715
  }
1724
1716
  };
1725
- function os(o, e, t, n, r, c) {
1726
- const p = oe("CanvasObjectResize");
1727
- return V(), q("div", {
1717
+ function rs(r, t, e, n, o, l) {
1718
+ const g = ot("CanvasObjectResize");
1719
+ return U(), q("div", {
1728
1720
  ref: "rootEl",
1729
1721
  class: "CanvasObject",
1730
- style: Z(r.canvasObject.getStyle()),
1731
- onUiclick: e[0] || (e[0] = U((...y) => r.canvasObject.onUiClick && r.canvasObject.onUiClick(...y), ["stop", "prevent"])),
1732
- onUidragstart: e[1] || (e[1] = U((...y) => r.canvasObject.onUiDragStart && r.canvasObject.onUiDragStart(...y), ["stop", "prevent"])),
1733
- onUidragmove: e[2] || (e[2] = U((...y) => r.canvasObject.onUiDragMove && r.canvasObject.onUiDragMove(...y), ["stop", "prevent"])),
1734
- onUidragend: e[3] || (e[3] = U((...y) => r.canvasObject.onUiDragEnd && r.canvasObject.onUiDragEnd(...y), ["stop", "prevent"]))
1722
+ style: Z(o.canvasObject.getStyle()),
1723
+ onUiclick: t[0] || (t[0] = B((...p) => o.canvasObject.onUiClick && o.canvasObject.onUiClick(...p), ["stop", "prevent"])),
1724
+ onUidragstart: t[1] || (t[1] = B((...p) => o.canvasObject.onUiDragStart && o.canvasObject.onUiDragStart(...p), ["stop", "prevent"])),
1725
+ onUidragmove: t[2] || (t[2] = B((...p) => o.canvasObject.onUiDragMove && o.canvasObject.onUiDragMove(...p), ["stop", "prevent"])),
1726
+ onUidragend: t[3] || (t[3] = B((...p) => o.canvasObject.onUiDragEnd && o.canvasObject.onUiDragEnd(...p), ["stop", "prevent"]))
1735
1727
  }, [
1736
- re(o.$slots, "default", jt(Ct(c.slotProps))),
1737
- (V(!0), q(Et, null, It(c.resizeDirections, (y) => (V(), Xe(p, {
1738
- key: y,
1739
- canvasObject: r.canvasObject,
1740
- direction: y
1728
+ it(r.$slots, "default", je(Ce(l.slotProps))),
1729
+ (U(!0), q(_e, null, Ee(l.resizeDirections, (p) => (U(), Nt(g, {
1730
+ key: p,
1731
+ canvasObject: o.canvasObject,
1732
+ direction: p
1741
1733
  }, null, 8, ["canvasObject", "direction"]))), 128))
1742
1734
  ], 36);
1743
1735
  }
1744
- const Os = /* @__PURE__ */ te(rs, [["render", os]]), as = {
1736
+ const ms = /* @__PURE__ */ tt(is, [["render", rs]]), os = {
1745
1737
  components: {
1746
- CanvasBoxSelect: kt
1738
+ CanvasBoxSelect: Re
1747
1739
  },
1748
1740
  props: {
1749
1741
  canvas: { type: Object, required: !0 }
@@ -1759,115 +1751,172 @@ const Os = /* @__PURE__ */ te(rs, [["render", os]]), as = {
1759
1751
  this.canvas.selection.deselectAll();
1760
1752
  }
1761
1753
  }
1762
- }, cs = { class: "CanvasView" };
1763
- function ls(o, e, t, n, r, c) {
1764
- const p = oe("CanvasBoxSelect");
1765
- return V(), q("div", cs, [
1766
- j("div", {
1754
+ }, as = { class: "CanvasView" };
1755
+ function cs(r, t, e, n, o, l) {
1756
+ const g = ot("CanvasBoxSelect");
1757
+ return U(), q("div", as, [
1758
+ C("div", {
1767
1759
  ref: "viewport",
1768
1760
  class: "Viewport",
1769
- onMousedown: e[0] || (e[0] = (...y) => t.canvas.pan.onMouseDown && t.canvas.pan.onMouseDown(...y)),
1770
- onUidragstart: e[1] || (e[1] = (...y) => t.canvas.boxSelect.onUiDragStart && t.canvas.boxSelect.onUiDragStart(...y)),
1771
- onUidragmove: e[2] || (e[2] = (...y) => t.canvas.boxSelect.onUiDragMove && t.canvas.boxSelect.onUiDragMove(...y)),
1772
- onUidragend: e[3] || (e[3] = (...y) => t.canvas.boxSelect.onUiDragEnd && t.canvas.boxSelect.onUiDragEnd(...y)),
1773
- onUiclick: e[4] || (e[4] = (...y) => c.onCanvasUiClick && c.onCanvasUiClick(...y)),
1774
- onScroll: e[5] || (e[5] = (...y) => t.canvas.viewport.onScroll && t.canvas.viewport.onScroll(...y)),
1775
- onWheel: e[6] || (e[6] = (...y) => t.canvas.zoom.onWheel && t.canvas.zoom.onWheel(...y))
1761
+ onMousedown: t[0] || (t[0] = (...p) => e.canvas.pan.onMouseDown && e.canvas.pan.onMouseDown(...p)),
1762
+ onUidragstart: t[1] || (t[1] = (...p) => e.canvas.boxSelect.onUiDragStart && e.canvas.boxSelect.onUiDragStart(...p)),
1763
+ onUidragmove: t[2] || (t[2] = (...p) => e.canvas.boxSelect.onUiDragMove && e.canvas.boxSelect.onUiDragMove(...p)),
1764
+ onUidragend: t[3] || (t[3] = (...p) => e.canvas.boxSelect.onUiDragEnd && e.canvas.boxSelect.onUiDragEnd(...p)),
1765
+ onUiclick: t[4] || (t[4] = (...p) => l.onCanvasUiClick && l.onCanvasUiClick(...p)),
1766
+ onScroll: t[5] || (t[5] = (...p) => e.canvas.viewport.onScroll && e.canvas.viewport.onScroll(...p)),
1767
+ onWheel: t[6] || (t[6] = (...p) => e.canvas.zoom.onWheel && e.canvas.zoom.onWheel(...p))
1776
1768
  }, [
1777
- j("div", {
1769
+ C("div", {
1778
1770
  class: "Sizer",
1779
- style: Z(t.canvas.viewport.getSizerStyle())
1771
+ style: Z(e.canvas.viewport.getSizerStyle())
1780
1772
  }, null, 4),
1781
- j("div", {
1773
+ C("div", {
1782
1774
  class: "Canvas",
1783
- style: Z(t.canvas.viewport.getCanvasStyle())
1775
+ style: Z(e.canvas.viewport.getCanvasStyle())
1784
1776
  }, [
1785
- re(o.$slots, "default", {}, void 0, !0),
1786
- j("div", {
1777
+ it(r.$slots, "default", {}, void 0, !0),
1778
+ C("div", {
1787
1779
  class: "Origin",
1788
- style: Z(t.canvas.viewport.getOriginStyle())
1780
+ style: Z(e.canvas.viewport.getOriginStyle())
1789
1781
  }, [
1790
- re(o.$slots, "origin", {}, void 0, !0)
1782
+ it(r.$slots, "origin", {}, void 0, !0)
1791
1783
  ], 4)
1792
1784
  ], 4),
1793
- K(p, { canvas: t.canvas }, null, 8, ["canvas"])
1785
+ F(g, { canvas: e.canvas }, null, 8, ["canvas"])
1794
1786
  ], 544),
1795
- re(o.$slots, "overlays", {}, void 0, !0)
1787
+ it(r.$slots, "overlays", {}, void 0, !0)
1796
1788
  ]);
1797
1789
  }
1798
- const Ps = /* @__PURE__ */ te(as, [["render", ls], ["__scopeId", "data-v-5b37630f"]]);
1799
- var us = Object.defineProperty, hs = Object.getOwnPropertyDescriptor, ds = (o, e, t, n) => {
1800
- for (var r = hs(e, t), c = o.length - 1, p; c >= 0; c--)
1801
- (p = o[c]) && (r = p(e, t, r) || r);
1802
- return r && us(e, t, r), r;
1803
- };
1804
- class ee {
1805
- constructor() {
1806
- this.lastMousePos = { x: window.innerWidth * 0.5, y: window.innerHeight * 0.5 }, this.lmbPressed = !1, this.mmbPressed = !1, this.rmbPressed = !1, this.altKey = !1, this.ctrlKey = !1, this.metaKey = !1, this.shiftKey = !1, this.events = b(this, k), this.windowEvents = new ue(window);
1790
+ const bs = /* @__PURE__ */ tt(os, [["render", cs], ["__scopeId", "data-v-5b37630f"]]);
1791
+ function nt(r, t) {
1792
+ const e = { x: Math.min(r.x, t.x), y: Math.min(r.y, t.y) }, n = { x: Math.max(r.x, t.x), y: Math.max(r.y, t.y) };
1793
+ return [e, n];
1794
+ }
1795
+ function $t(r, t) {
1796
+ const e = r[1].x >= t[0].x && t[1].x >= r[0].x, n = r[1].y >= t[0].y && t[1].y >= r[0].y;
1797
+ return e && n;
1798
+ }
1799
+ class ls {
1800
+ constructor(t) {
1801
+ this.target = t, this.entries = [];
1807
1802
  }
1808
- init() {
1809
- this.events.mounted.on(() => {
1810
- 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));
1811
- }), this.events.unmounted.on(() => {
1812
- this.windowEvents.removeAll();
1813
- });
1803
+ add(t, e, n) {
1804
+ this.target.addEventListener(t, e, n), this.entries.push({ type: t, listener: e, options: n });
1805
+ }
1806
+ removeAll() {
1807
+ for (const t of this.entries)
1808
+ this.target.removeEventListener(t.type, t.listener, t.options);
1809
+ this.entries = [];
1810
+ }
1811
+ }
1812
+ const us = [
1813
+ "button",
1814
+ "a",
1815
+ "input",
1816
+ "textarea",
1817
+ "select",
1818
+ '[role="textbox"]',
1819
+ '[role="button"]',
1820
+ "[nodrag]"
1821
+ ];
1822
+ class rt {
1823
+ constructor() {
1824
+ this.lastMousePos = { x: window.innerWidth * 0.5, y: window.innerHeight * 0.5 }, 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 ls(window), this.lastMouseDownPos = { x: window.innerWidth * 0.5, y: window.innerHeight * 0.5 }, this.lastMouseDownTarget = null, this.dragTarget = null, this.inClickVicinity = !1, this.listening = !1;
1814
1825
  }
1815
1826
  get ctrlOrMetaKey() {
1816
1827
  return this.ctrlKey || this.metaKey;
1817
1828
  }
1818
- onMouseDown(e) {
1819
- this.lastMousePos = { x: e.pageX, y: e.pageY }, this.lmbPressed = e.button === 0, this.mmbPressed = e.button === 1, this.rmbPressed = e.button === 2;
1829
+ mount() {
1830
+ this.listening || (this.listening = !0, this.windowEvents.add("mousedown", (t) => this.onMouseDown(t)), this.windowEvents.add("mousemove", (t) => this.onMouseMove(t)), this.windowEvents.add("mouseup", (t) => this.onMouseUp(t)), this.windowEvents.add("keydown", (t) => this.onKeyDown(t)), this.windowEvents.add("keyup", (t) => this.onKeyUp(t)));
1831
+ }
1832
+ unmount() {
1833
+ this.listening && (this.listening = !1, this.windowEvents.removeAll(), this.dragTarget = null, this.inClickVicinity = !1, this.lastMouseDownTarget = null);
1834
+ }
1835
+ onMouseDown(t) {
1836
+ this.lastMousePos = { x: t.pageX, y: t.pageY }, this.lmbPressed = t.button === 0, this.mmbPressed = t.button === 1, this.rmbPressed = t.button === 2, t.button === 0 && (this.lastMouseDownPos = { x: t.pageX, y: t.pageY }, this.lastMouseDownTarget = t.target, this.inClickVicinity = !0);
1837
+ }
1838
+ onMouseMove(t) {
1839
+ if (this.lastMousePos = { x: t.pageX, y: t.pageY }, !this.lmbPressed)
1840
+ return;
1841
+ if (this.dragTarget) {
1842
+ this.dragTarget.dispatchEvent(this.cloneMouseEvent("uidragmove", t));
1843
+ return;
1844
+ }
1845
+ if (!this.inClickVicinity || !this.lastMouseDownTarget)
1846
+ return;
1847
+ const e = t.pageX - this.lastMouseDownPos.x, n = t.pageY - this.lastMouseDownPos.y;
1848
+ Math.hypot(e, n) < this.dragDistance || (this.inClickVicinity = !1, this.isDragAllowed(this.lastMouseDownTarget) && (this.dragTarget = this.lastMouseDownTarget, this.dragTarget.dispatchEvent(this.cloneMouseEvent("uidragstart", t))));
1849
+ }
1850
+ onMouseUp(t) {
1851
+ if (t.button === 0) {
1852
+ const e = this.dragTarget, n = this.inClickVicinity, o = this.lastMouseDownTarget;
1853
+ this.dragTarget = null, this.inClickVicinity = !1, this.lastMouseDownTarget = null, e && e.dispatchEvent(this.cloneMouseEvent("uidragend", t)), n && o && (o.dispatchEvent(this.cloneMouseEvent("uiclick", t)), this.dispatchActivate(o, t));
1854
+ }
1855
+ this.lastMousePos = { x: t.pageX, y: t.pageY }, this.lmbPressed = !1, this.mmbPressed = !1, this.rmbPressed = !1;
1856
+ }
1857
+ onKeyDown(t) {
1858
+ this.updateModifiers(t), (t.key === "Enter" || t.key === " ") && t.target && (t.target === document.body && t.key === " " && t.preventDefault(), this.dispatchActivate(t.target, t));
1820
1859
  }
1821
- onMouseMove(e) {
1822
- this.lastMousePos = { x: e.pageX, y: e.pageY };
1860
+ onKeyUp(t) {
1861
+ this.updateModifiers(t);
1823
1862
  }
1824
- onMouseUp(e) {
1825
- this.lastMousePos = { x: e.pageX, y: e.pageY }, this.lmbPressed = !1, this.mmbPressed = !1, this.rmbPressed = !1;
1863
+ updateModifiers(t) {
1864
+ this.altKey = t.altKey, this.ctrlKey = t.ctrlKey, this.metaKey = t.metaKey, this.shiftKey = t.shiftKey;
1826
1865
  }
1827
- onKeyDown(e) {
1828
- this.updateModifiers(e);
1866
+ dispatchActivate(t, e) {
1867
+ t.closest(":disabled") || t.dispatchEvent(new CustomEvent("uiactivate", { detail: e }));
1829
1868
  }
1830
- onKeyUp(e) {
1831
- this.updateModifiers(e);
1869
+ isDragAllowed(t) {
1870
+ return t instanceof Element ? !t.closest(us.join(",")) : !1;
1832
1871
  }
1833
- updateModifiers(e) {
1834
- this.altKey = e.altKey, this.ctrlKey = e.ctrlKey, this.metaKey = e.metaKey, this.shiftKey = e.shiftKey;
1872
+ cloneMouseEvent(t, e) {
1873
+ return new MouseEvent(t, {
1874
+ bubbles: !0,
1875
+ cancelable: !0,
1876
+ clientX: e.clientX,
1877
+ clientY: e.clientY,
1878
+ screenX: e.screenX,
1879
+ screenY: e.screenY,
1880
+ button: e.button,
1881
+ buttons: e.buttons,
1882
+ ctrlKey: e.ctrlKey,
1883
+ shiftKey: e.shiftKey,
1884
+ altKey: e.altKey,
1885
+ metaKey: e.metaKey
1886
+ });
1835
1887
  }
1836
1888
  }
1837
- ds([
1838
- he()
1839
- ], ee.prototype, "init");
1840
- class Ye {
1889
+ class Ft {
1841
1890
  constructor() {
1842
- this.config = b(this, J), this.inputState = b(this, ee), this.objectRegistry = b(this, ce), this.selection = b(this, Q), this.space = b(this, L), this.selectionOriginPos = null, this.initialSelectionIds = /* @__PURE__ */ new Set(), this.objectBoxes = [];
1891
+ this.config = b(this, J), this.inputStateManager = b(this, rt), this.objectRegistry = b(this, ct), this.selection = b(this, Q), this.space = b(this, V), this.selectionOriginPos = null, this.initialSelectionIds = /* @__PURE__ */ new Set(), this.objectBoxes = [];
1843
1892
  }
1844
1893
  isSelecting() {
1845
1894
  return this.selectionOriginPos != null;
1846
1895
  }
1847
- onUiDragStart(e) {
1848
- this.config.allowMultiSelect && (this.isSelecting() || (this.selectionOriginPos = { x: e.pageX, y: e.pageY }, e.shiftKey ? this.initialSelectionIds = new Set(this.selection.getSelectedIds()) : (this.initialSelectionIds.clear(), this.selection.deselectAll()), this.captureObjectBoxes()));
1896
+ onUiDragStart(t) {
1897
+ this.config.allowMultiSelect && (this.isSelecting() || (this.selectionOriginPos = { x: t.pageX, y: t.pageY }, t.shiftKey ? this.initialSelectionIds = new Set(this.selection.getSelectedIds()) : (this.initialSelectionIds.clear(), this.selection.deselectAll()), this.captureObjectBoxes()));
1849
1898
  }
1850
- onUiDragMove(e) {
1851
- this.isSelecting() && (e.preventDefault(), this.updateSelection(e));
1899
+ onUiDragMove(t) {
1900
+ this.isSelecting() && (t.preventDefault(), this.updateSelection(t));
1852
1901
  }
1853
- onUiDragEnd(e) {
1854
- this.isSelecting() && this.updateSelection(e), this.stopSelecting();
1902
+ onUiDragEnd(t) {
1903
+ this.isSelecting() && this.updateSelection(t), this.stopSelecting();
1855
1904
  }
1856
1905
  getSelectionBox() {
1857
- return this.selectionOriginPos ? ie(
1906
+ return this.selectionOriginPos ? nt(
1858
1907
  this.space.pageToLocal(this.selectionOriginPos),
1859
- this.space.pageToLocal(this.inputState.lastMousePos)
1908
+ this.space.pageToLocal(this.inputStateManager.lastMousePos)
1860
1909
  ) : null;
1861
1910
  }
1862
1911
  getSelectionStyle() {
1863
1912
  if (!this.selectionOriginPos)
1864
1913
  return null;
1865
- const e = ie(this.selectionOriginPos, this.inputState.lastMousePos), t = this.space.pageToCanvas(e[0]), n = this.space.pageToCanvas(e[1]);
1914
+ const t = nt(this.selectionOriginPos, this.inputStateManager.lastMousePos), e = this.space.pageToCanvas(t[0]), n = this.space.pageToCanvas(t[1]);
1866
1915
  return {
1867
- left: `${t.x}px`,
1868
- top: `${t.y}px`,
1869
- width: `${n.x - t.x}px`,
1870
- height: `${n.y - t.y}px`
1916
+ left: `${e.x}px`,
1917
+ top: `${e.y}px`,
1918
+ width: `${n.x - e.x}px`,
1919
+ height: `${n.y - e.y}px`
1871
1920
  };
1872
1921
  }
1873
1922
  stopSelecting() {
@@ -1875,57 +1924,57 @@ class Ye {
1875
1924
  }
1876
1925
  captureObjectBoxes() {
1877
1926
  this.objectBoxes = [];
1878
- const e = this.space.viewportBox;
1879
- for (const t of this.objectRegistry.getAll()) {
1880
- if (!t.isSelectable())
1927
+ const t = this.space.viewportBox;
1928
+ for (const e of this.objectRegistry.getAll()) {
1929
+ if (!e.isSelectable())
1881
1930
  continue;
1882
- const n = t.element;
1931
+ const n = e.element;
1883
1932
  if (!n)
1884
1933
  continue;
1885
- const r = n.getBoundingClientRect(), c = ie(
1886
- { x: r.left, y: r.top },
1887
- { x: r.right, y: r.bottom }
1934
+ const o = n.getBoundingClientRect(), l = nt(
1935
+ { x: o.left, y: o.top },
1936
+ { x: o.right, y: o.bottom }
1888
1937
  );
1889
- if (!Le(c, e))
1938
+ if (!$t(l, t))
1890
1939
  continue;
1891
- const p = ie(
1892
- this.space.pageToLocal(c[0]),
1893
- this.space.pageToLocal(c[1])
1940
+ const g = nt(
1941
+ this.space.pageToLocal(l[0]),
1942
+ this.space.pageToLocal(l[1])
1894
1943
  );
1895
- this.objectBoxes.push([t.objectId, p]);
1944
+ this.objectBoxes.push([e.objectId, g]);
1896
1945
  }
1897
1946
  }
1898
- updateSelection(e) {
1899
- const t = this.getSelectionBox();
1900
- if (!t)
1947
+ updateSelection(t) {
1948
+ const e = this.getSelectionBox();
1949
+ if (!e)
1901
1950
  return;
1902
1951
  const n = new Set(this.initialSelectionIds);
1903
- for (const [r, c] of this.objectBoxes)
1904
- Le(t, c) && n.add(r);
1952
+ for (const [o, l] of this.objectBoxes)
1953
+ $t(e, l) && n.add(o);
1905
1954
  this.selection.setSelectedIds(n);
1906
1955
  }
1907
1956
  }
1908
- class le {
1957
+ class lt {
1909
1958
  constructor() {
1910
- this.viewportEl = null, this.windowEvents = new ue(window), this.config = b(this, J), this.space = b(this, L);
1959
+ this.viewportEl = null, this.windowEvents = new Xt(window), this.config = b(this, J), this.space = b(this, V);
1911
1960
  }
1912
- mount(e) {
1913
- 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());
1961
+ mount(t) {
1962
+ this.viewportEl = t, 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());
1914
1963
  }
1915
1964
  destroy() {
1916
1965
  this.windowEvents.removeAll(), this.viewportEl = null, this.space.viewportBox = [{ x: 0, y: 0 }, { x: 0, y: 0 }];
1917
1966
  }
1918
1967
  getCanvasStyle() {
1919
- const e = $e(this.viewportEl, "--canvas-grid-major-color", "#ddd"), t = $e(this.viewportEl, "--canvas-grid-minor-color", "#eee"), n = W(this.viewportEl, "--canvas-grid-subdivisions", 4), r = W(this.viewportEl, "--canvas-grid-major-radius", 2), c = W(this.viewportEl, "--canvas-grid-minor-radius", 1), p = Lt(
1968
+ const t = Bt(this.viewportEl, "--canvas-grid-major-color", "#ddd"), e = Bt(this.viewportEl, "--canvas-grid-minor-color", "#eee"), n = W(this.viewportEl, "--canvas-grid-subdivisions", 4), o = W(this.viewportEl, "--canvas-grid-major-radius", 2), l = W(this.viewportEl, "--canvas-grid-minor-radius", 1), g = Ve(
1920
1969
  this.space.cellSize,
1921
1970
  n,
1922
- e,
1923
- r,
1924
1971
  t,
1925
- c
1972
+ o,
1973
+ e,
1974
+ l
1926
1975
  );
1927
1976
  return {
1928
- background: `url(${`data:image/svg+xml;base64,${window.btoa(p)}`}) repeat`,
1977
+ background: `url(${`data:image/svg+xml;base64,${window.btoa(g)}`}) repeat`,
1929
1978
  width: `${this.space.canvasSize.x}px`,
1930
1979
  height: `${this.space.canvasSize.y}px`,
1931
1980
  transformOrigin: "0 0",
@@ -1953,29 +2002,29 @@ class le {
1953
2002
  centerOnOrigin() {
1954
2003
  if (!this.viewportEl)
1955
2004
  return;
1956
- const e = this.getViewportSize();
2005
+ const t = this.getViewportSize();
1957
2006
  this.setViewportScroll({
1958
- x: this.space.canvasOrigin.x * this.space.zoom - e.x * 0.5,
1959
- y: this.space.canvasOrigin.y * this.space.zoom - e.y * 0.5
2007
+ x: this.space.canvasOrigin.x * this.space.zoom - t.x * 0.5,
2008
+ y: this.space.canvasOrigin.y * this.space.zoom - t.y * 0.5
1960
2009
  });
1961
2010
  }
1962
- scrollBy(e, t) {
2011
+ scrollBy(t, e) {
1963
2012
  this.viewportEl && this.setViewportScroll({
1964
- x: this.viewportEl.scrollLeft + e,
1965
- y: this.viewportEl.scrollTop + t
2013
+ x: this.viewportEl.scrollLeft + t,
2014
+ y: this.viewportEl.scrollTop + e
1966
2015
  });
1967
2016
  }
1968
- scrollToLocalPoint(e) {
1969
- const t = this.getViewportSize(), n = this.space.localToCanvas(e);
2017
+ scrollToLocalPoint(t) {
2018
+ const e = this.getViewportSize(), n = this.space.localToCanvas(t);
1970
2019
  this.setViewportScroll({
1971
- x: n.x * this.space.zoom - t.x * 0.5,
1972
- y: n.y * this.space.zoom - t.y * 0.5
2020
+ x: n.x * this.space.zoom - e.x * 0.5,
2021
+ y: n.y * this.space.zoom - e.y * 0.5
1973
2022
  });
1974
2023
  }
1975
- setViewportScroll(e) {
2024
+ setViewportScroll(t) {
1976
2025
  this.viewportEl && (this.viewportEl.scrollTo({
1977
- left: Math.max(0, e.x),
1978
- top: Math.max(0, e.y),
2026
+ left: Math.max(0, t.x),
2027
+ top: Math.max(0, t.y),
1979
2028
  behavior: "auto"
1980
2029
  }), this.onScroll());
1981
2030
  }
@@ -1984,10 +2033,10 @@ class le {
1984
2033
  this.space.viewportBox = [{ x: 0, y: 0 }, { x: 0, y: 0 }];
1985
2034
  return;
1986
2035
  }
1987
- const e = this.viewportEl.getBoundingClientRect();
2036
+ const t = this.viewportEl.getBoundingClientRect();
1988
2037
  this.space.viewportBox = [
1989
- { x: e.left, y: e.top },
1990
- { x: e.right, y: e.bottom }
2038
+ { x: t.left, y: t.top },
2039
+ { x: t.right, y: t.bottom }
1991
2040
  ];
1992
2041
  }
1993
2042
  getViewportSize() {
@@ -1997,175 +2046,100 @@ class le {
1997
2046
  };
1998
2047
  }
1999
2048
  recalcCanvasMetrics() {
2000
- const e = W(this.viewportEl, "--canvas-margin-cells", 64);
2049
+ const t = W(this.viewportEl, "--canvas-margin-cells", 64);
2001
2050
  this.space.cellSize = W(this.viewportEl, "--canvas-grid-cell-size", 32);
2002
- const t = e * this.space.cellSize;
2003
- this.space.canvasSize = { x: t * 2, y: t * 2 }, this.space.canvasOrigin = { x: t, y: t };
2051
+ const e = t * this.space.cellSize;
2052
+ this.space.canvasSize = { x: e * 2, y: e * 2 }, this.space.canvasOrigin = { x: e, y: e };
2004
2053
  }
2005
2054
  }
2006
- var fs = Object.defineProperty, vs = Object.getOwnPropertyDescriptor, ps = (o, e, t, n) => {
2007
- for (var r = vs(e, t), c = o.length - 1, p; c >= 0; c--)
2008
- (p = o[c]) && (r = p(e, t, r) || r);
2009
- return r && fs(e, t, r), r;
2055
+ var hs = Object.defineProperty, ds = Object.getOwnPropertyDescriptor, fs = (r, t, e, n) => {
2056
+ for (var o = ds(t, e), l = r.length - 1, g; l >= 0; l--)
2057
+ (g = r[l]) && (o = g(t, e, o) || o);
2058
+ return o && hs(t, e, o), o;
2010
2059
  };
2011
- class me {
2060
+ class gt {
2012
2061
  constructor() {
2013
- this.viewport = b(this, le), this.events = b(this, k), this.windowEvents = new ue(window), this.isPanning = !1;
2062
+ this.viewport = b(this, lt), this.events = b(this, K), this.windowEvents = new Xt(window), this.isPanning = !1;
2014
2063
  }
2015
2064
  init() {
2016
2065
  this.events.unmounted.on(() => this.stopPanning());
2017
2066
  }
2018
- onMouseDown(e) {
2019
- e.button === 1 && (e.preventDefault(), this.isPanning = !0, this.windowEvents.add("mousemove", (t) => this.onMouseMove(t)), this.windowEvents.add("mouseup", (t) => this.onMouseUp(t)));
2067
+ onMouseDown(t) {
2068
+ t.button === 1 && (t.preventDefault(), this.isPanning = !0, this.windowEvents.add("mousemove", (e) => this.onMouseMove(e)), this.windowEvents.add("mouseup", (e) => this.onMouseUp(e)));
2020
2069
  }
2021
2070
  stopPanning() {
2022
2071
  this.isPanning = !1, this.windowEvents.removeAll();
2023
2072
  }
2024
- onMouseMove(e) {
2025
- this.isPanning && this.viewport.scrollBy(-e.movementX, -e.movementY);
2026
- }
2027
- onMouseUp(e) {
2028
- e.button === 1 && this.stopPanning();
2073
+ onMouseMove(t) {
2074
+ this.isPanning && this.viewport.scrollBy(-t.movementX, -t.movementY);
2029
2075
  }
2030
- }
2031
- ps([
2032
- he()
2033
- ], me.prototype, "init");
2034
- var ys = Object.defineProperty, gs = Object.getOwnPropertyDescriptor, ws = (o, e, t, n) => {
2035
- for (var r = gs(e, t), c = o.length - 1, p; c >= 0; c--)
2036
- (p = o[c]) && (r = p(e, t, r) || r);
2037
- return r && ys(e, t, r), r;
2038
- };
2039
- const ms = [
2040
- "button",
2041
- "a",
2042
- "input",
2043
- "textarea",
2044
- "select",
2045
- '[role="textbox"]',
2046
- '[role="button"]',
2047
- "[nodrag]"
2048
- ];
2049
- class be {
2050
- constructor() {
2051
- this.events = b(this, k), this.inputState = b(this, ee), this.windowEvents = new ue(window), this.lastMouseDownPos = { x: window.innerWidth * 0.5, y: window.innerHeight * 0.5 }, this.lastMouseDownTarget = null, this.dragTarget = null, this.inClickVicinity = !1, this.dragDistance = 4;
2052
- }
2053
- init() {
2054
- this.events.mounted.on(() => {
2055
- 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));
2056
- }), this.events.unmounted.on(() => {
2057
- this.windowEvents.removeAll();
2058
- });
2059
- }
2060
- onMouseDown(e) {
2061
- e.button === 0 && (this.lastMouseDownPos = { x: e.pageX, y: e.pageY }, this.lastMouseDownTarget = e.target, this.inClickVicinity = !0);
2062
- }
2063
- onMouseMove(e) {
2064
- if (!this.inputState.lmbPressed)
2065
- return;
2066
- if (this.dragTarget) {
2067
- this.dragTarget.dispatchEvent(this.cloneMouseEvent("uidragmove", e));
2068
- return;
2069
- }
2070
- if (!this.inClickVicinity || !this.lastMouseDownTarget)
2071
- return;
2072
- const t = e.pageX - this.lastMouseDownPos.x, n = e.pageY - this.lastMouseDownPos.y;
2073
- Math.hypot(t, n) < this.dragDistance || (this.inClickVicinity = !1, this.isDragAllowed(this.lastMouseDownTarget) && (this.dragTarget = this.lastMouseDownTarget, this.dragTarget.dispatchEvent(this.cloneMouseEvent("uidragstart", e))));
2074
- }
2075
- onMouseUp(e) {
2076
- if (e.button !== 0)
2077
- return;
2078
- const t = this.dragTarget, n = this.inClickVicinity, r = this.lastMouseDownTarget;
2079
- 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));
2080
- }
2081
- onKeyDown(e) {
2082
- (e.key === "Enter" || e.key === " ") && e.target && (e.target === document.body && e.key === " " && e.preventDefault(), this.dispatchActivate(e.target, e));
2083
- }
2084
- dispatchActivate(e, t) {
2085
- e.closest(":disabled") || e.dispatchEvent(new CustomEvent("uiactivate", { detail: t }));
2086
- }
2087
- isDragAllowed(e) {
2088
- return e instanceof Element ? !e.closest(ms.join(",")) : !1;
2089
- }
2090
- cloneMouseEvent(e, t) {
2091
- return new MouseEvent(e, {
2092
- bubbles: !0,
2093
- cancelable: !0,
2094
- clientX: t.clientX,
2095
- clientY: t.clientY,
2096
- screenX: t.screenX,
2097
- screenY: t.screenY,
2098
- button: t.button,
2099
- buttons: t.buttons,
2100
- ctrlKey: t.ctrlKey,
2101
- shiftKey: t.shiftKey,
2102
- altKey: t.altKey,
2103
- metaKey: t.metaKey
2104
- });
2076
+ onMouseUp(t) {
2077
+ t.button === 1 && this.stopPanning();
2105
2078
  }
2106
2079
  }
2107
- ws([
2108
- he()
2109
- ], be.prototype, "init");
2110
- const B = [0.33, 0.5, 0.6, 0.75, 0.85, 1, 1.15, 1.25, 1.5, 1.75, 2], bs = Math.min(...B), xs = Math.max(...B);
2111
- class He {
2080
+ fs([
2081
+ qt()
2082
+ ], gt.prototype, "init");
2083
+ const k = [0.33, 0.5, 0.6, 0.75, 0.85, 1, 1.15, 1.25, 1.5, 1.75, 2], vs = Math.min(...k), ps = Math.max(...k);
2084
+ class Kt {
2112
2085
  constructor() {
2113
- this.viewport = b(this, le), this.space = b(this, L);
2086
+ this.viewport = b(this, lt), this.space = b(this, V);
2114
2087
  }
2115
- onWheel(e) {
2116
- if (!e.ctrlKey)
2088
+ onWheel(t) {
2089
+ if (!t.ctrlKey)
2117
2090
  return;
2118
- e.preventDefault();
2119
- const t = z(e.deltaY, -40, 40) / 400, n = Math.exp(-t);
2091
+ t.preventDefault();
2092
+ const e = z(t.deltaY, -40, 40) / 400, n = Math.exp(-e);
2120
2093
  this.setZoom(this.space.zoom * n);
2121
2094
  }
2122
- setZoom(e) {
2123
- const t = this.space.getViewportCenterInLocal();
2124
- this.space.zoom = z(e, bs, xs), this.viewport.scrollToLocalPoint(t);
2095
+ setZoom(t) {
2096
+ const e = this.space.getViewportCenterInLocal();
2097
+ this.space.zoom = z(t, vs, ps), this.viewport.scrollToLocalPoint(e);
2125
2098
  }
2126
2099
  zoomIn() {
2127
- const e = this.getClosestZoomStepIndex();
2128
- e < B.length - 1 && this.setZoom(B[e + 1]);
2100
+ const t = this.getClosestZoomStepIndex();
2101
+ t < k.length - 1 && this.setZoom(k[t + 1]);
2129
2102
  }
2130
2103
  zoomOut() {
2131
- const e = this.getClosestZoomStepIndex();
2132
- e > 0 && this.setZoom(B[e - 1]);
2104
+ const t = this.getClosestZoomStepIndex();
2105
+ t > 0 && this.setZoom(k[t - 1]);
2133
2106
  }
2134
2107
  getClosestZoomStepIndex() {
2135
- let e = 0, t = Number.POSITIVE_INFINITY;
2136
- for (let n = 0; n < B.length; n++) {
2137
- const r = Math.abs(B[n] - this.space.zoom);
2138
- r < t && (t = r, e = n);
2108
+ let t = 0, e = Number.POSITIVE_INFINITY;
2109
+ for (let n = 0; n < k.length; n++) {
2110
+ const o = Math.abs(k[n] - this.space.zoom);
2111
+ o < e && (e = o, t = n);
2139
2112
  }
2140
- return e;
2113
+ return t;
2141
2114
  }
2142
2115
  }
2143
- class _s {
2144
- constructor(e = {}) {
2145
- this.mesh = new ae(), this.boxSelect = b(this, Ye), this.config = b(this, J), this.space = b(this, L), this.viewport = b(this, le), this.pan = b(this, me), this.events = b(this, k), this.inputState = b(this, ee), this.objectRegistry = b(this, ce), this.selection = b(this, Q), this.uiEvents = b(this, be), this.zoom = b(this, He), this.mesh.connect(this), this.mesh.use((t) => Tt(t)), this.mesh.service(Ye), this.mesh.service(le), this.mesh.service(me), this.mesh.service(J), this.mesh.service(L), this.mesh.service(k), this.mesh.service(ee), this.mesh.service(xe), this.mesh.service(ce), this.mesh.service(Q), this.mesh.service(be), this.mesh.service(He), this.config.set(e);
2116
+ class xs {
2117
+ constructor(t = {}) {
2118
+ this.mesh = new at(), this.boxSelect = b(this, Ft), this.config = b(this, J), this.space = b(this, V), this.viewport = b(this, lt), this.pan = b(this, gt), this.events = b(this, K), this.inputStateManager = b(this, rt), this.objectRegistry = b(this, ct), this.selection = b(this, Q), this.zoom = b(this, Kt);
2119
+ const e = t.inputStateManager ?? new rt();
2120
+ this.ownsInputStateManager = t.inputStateManager == null, this.mesh.connect(this), this.mesh.use((n) => Ie(n)), this.mesh.constant(rt, e), this.mesh.service(Ft), this.mesh.service(lt), this.mesh.service(gt), this.mesh.service(J), this.mesh.service(V), this.mesh.service(K), this.mesh.service(wt), this.mesh.service(ct), this.mesh.service(Q), this.mesh.service(Kt), this.config.set(t);
2146
2121
  }
2147
- mount(e) {
2148
- Ne(this.mesh), this.viewport.mount(e), this.events.mounted.emit();
2122
+ mount(t) {
2123
+ Gt(this.mesh), this.viewport.mount(t), this.events.mounted.emit(), this.ownsInputStateManager && this.inputStateManager.mount();
2149
2124
  }
2150
2125
  unmount() {
2151
- Ne(this.mesh), this.viewport.destroy(), this.events.unmounted.emit();
2126
+ Gt(this.mesh), this.viewport.destroy(), this.ownsInputStateManager && this.inputStateManager.unmount(), this.events.unmounted.emit();
2152
2127
  }
2153
2128
  }
2154
2129
  export {
2155
- kt as CanvasBoxSelect,
2130
+ Re as CanvasBoxSelect,
2156
2131
  J as CanvasConfig,
2157
- _s as CanvasController,
2158
- Ms as CanvasDebugCoords,
2159
- k as CanvasEvents,
2160
- ee as CanvasInputState,
2161
- Os as CanvasObject,
2132
+ xs as CanvasController,
2133
+ gs as CanvasDebugCoords,
2134
+ K as CanvasEvents,
2135
+ ms as CanvasObject,
2162
2136
  ts as CanvasObjectController,
2163
- ce as CanvasObjectRegistry,
2164
- me as CanvasPan,
2137
+ ct as CanvasObjectRegistry,
2138
+ gt as CanvasPan,
2165
2139
  Q as CanvasSelection,
2166
- L as CanvasSpace,
2167
- be as CanvasUiEvents,
2168
- Ps as CanvasView,
2169
- le as CanvasViewport,
2170
- He as CanvasZoom
2140
+ V as CanvasSpace,
2141
+ bs as CanvasView,
2142
+ lt as CanvasViewport,
2143
+ Kt as CanvasZoom,
2144
+ rt as InputStateManager
2171
2145
  };