@dineug/erd-editor 3.9.1 → 3.9.2

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.
@@ -9235,10 +9235,10 @@ var US = fe((e) => !!e.length), WS = (e) => {
9235
9235
  let t = [];
9236
9236
  for (let n of Object.keys(Gp)) Gp[n]([], t, e);
9237
9237
  return t.length ? t : e;
9238
- })), $S = QS();
9238
+ }));
9239
9239
  //#endregion
9240
9240
  //#region src/engine/store.ts
9241
- function eC(e, t) {
9241
+ function $S(e, t) {
9242
9242
  return $t({
9243
9243
  context: e,
9244
9244
  state: {
@@ -9261,18 +9261,18 @@ function eC(e, t) {
9261
9261
  }
9262
9262
  //#endregion
9263
9263
  //#region src/utils/draw-relationship/incremental.ts
9264
- var tC = 40, nC = 64, rC = 16, iC = 64, aC = 64, oC = /* @__PURE__ */ new WeakMap(), sC = () => ({
9264
+ var eC = 40, tC = 64, nC = 16, rC = 64, iC = 64, aC = /* @__PURE__ */ new WeakMap(), oC = () => ({
9265
9265
  boxes: /* @__PURE__ */ new Map(),
9266
9266
  entries: /* @__PURE__ */ new Map()
9267
9267
  });
9268
- function cC(e, t = "document") {
9269
- let n = oC.get(e);
9268
+ function sC(e, t = "document") {
9269
+ let n = aC.get(e);
9270
9270
  return n || (n = {
9271
- document: sC(),
9272
- flow: sC()
9273
- }, oC.set(e, n)), n[t];
9271
+ document: oC(),
9272
+ flow: oC()
9273
+ }, aC.set(e, n)), n[t];
9274
9274
  }
9275
- function lC(e, t) {
9275
+ function cC(e, t) {
9276
9276
  return {
9277
9277
  left: e.left[t],
9278
9278
  top: e.top[t],
@@ -9280,7 +9280,7 @@ function lC(e, t) {
9280
9280
  bottom: e.bottom[t]
9281
9281
  };
9282
9282
  }
9283
- function uC(e, t) {
9283
+ function lC(e, t) {
9284
9284
  return {
9285
9285
  left: Math.min(e.left, t.left),
9286
9286
  top: Math.min(e.top, t.top),
@@ -9288,10 +9288,10 @@ function uC(e, t) {
9288
9288
  bottom: Math.max(e.bottom, t.bottom)
9289
9289
  };
9290
9290
  }
9291
- function dC(e, t) {
9291
+ function uC(e, t) {
9292
9292
  return e.left === t.left && e.top === t.top && e.right === t.right && e.bottom === t.bottom;
9293
9293
  }
9294
- function fC(e) {
9294
+ function dC(e) {
9295
9295
  let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity;
9296
9296
  for (let { x: a, y: o } of e) a < t && (t = a), a > r && (r = a), o < n && (n = o), o > i && (i = o);
9297
9297
  return {
@@ -9301,22 +9301,22 @@ function fC(e) {
9301
9301
  bottom: i
9302
9302
  };
9303
9303
  }
9304
- function pC(e, t) {
9304
+ function fC(e, t) {
9305
9305
  return e.left <= t.right && e.right >= t.left && e.top <= t.bottom && e.bottom >= t.top;
9306
9306
  }
9307
- function mC(e, t) {
9307
+ function pC(e, t) {
9308
9308
  let n = {
9309
- left: e.left - tC,
9310
- top: e.top - tC,
9311
- right: e.right + tC,
9312
- bottom: e.bottom + tC
9309
+ left: e.left - eC,
9310
+ top: e.top - eC,
9311
+ right: e.right + eC,
9312
+ bottom: e.bottom + eC
9313
9313
  };
9314
- for (let e of t) if (pC(n, e)) return !0;
9314
+ for (let e of t) if (fC(n, e)) return !0;
9315
9315
  return !1;
9316
9316
  }
9317
- function hC() {
9317
+ function mC() {
9318
9318
  let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = (n, r, i, a, o) => {
9319
- let s = n ? e : t, c = Math.floor(Math.min(r, i) / iC), l = Math.floor(Math.max(r, i) / iC);
9319
+ let s = n ? e : t, c = Math.floor(Math.min(r, i) / rC), l = Math.floor(Math.max(r, i) / rC);
9320
9320
  for (let e = c; e <= l; e++) {
9321
9321
  let t = s.get(e);
9322
9322
  t ? t.push(r, i, a, o) : s.set(e, [
@@ -9335,33 +9335,33 @@ function hC() {
9335
9335
  hits(n, r, i, a, o) {
9336
9336
  let s = n ? e : t;
9337
9337
  if (!s.size) return !1;
9338
- let c = Math.min(r, i) - nC, l = Math.max(r, i) + nC, u = Math.floor(c / iC), d = Math.floor(l / iC);
9338
+ let c = Math.min(r, i) - tC, l = Math.max(r, i) + tC, u = Math.floor(c / rC), d = Math.floor(l / rC);
9339
9339
  for (let e = u; e <= d; e++) {
9340
9340
  let t = s.get(e);
9341
9341
  if (t) {
9342
- for (let e = 0; e < t.length; e += 4) if (!(t[e + 1] < c || t[e] > l) && !(t[e + 3] < a - rC) && !(t[e + 2] > o + rC)) return !0;
9342
+ for (let e = 0; e < t.length; e += 4) if (!(t[e + 1] < c || t[e] > l) && !(t[e + 3] < a - nC) && !(t[e + 2] > o + nC)) return !0;
9343
9343
  }
9344
9344
  }
9345
9345
  return !1;
9346
9346
  }
9347
9347
  };
9348
9348
  }
9349
- function gC(e, t) {
9349
+ function hC(e, t) {
9350
9350
  for (let n = 1; n < t.length; n++) {
9351
9351
  let r = t[n - 1], i = t[n];
9352
9352
  Math.abs(r.x - i.x) < .5 ? e.markSpan(!0, r.x, i.x, Math.min(r.y, i.y), Math.max(r.y, i.y)) : e.markSpan(!1, r.y, i.y, Math.min(r.x, i.x), Math.max(r.x, i.x));
9353
9353
  }
9354
9354
  }
9355
- function _C(e, t) {
9355
+ function gC(e, t) {
9356
9356
  let n = e.boxes, r = /* @__PURE__ */ new Map(), i = [], a = !1;
9357
9357
  for (let e = 0; e < t.ids.length; e++) {
9358
- let o = t.ids[e], s = lC(t, e);
9358
+ let o = t.ids[e], s = cC(t, e);
9359
9359
  if (r.set(o, s), a) continue;
9360
9360
  let c = n.get(o);
9361
- c ? dC(c, s) || i.push(uC(c, s)) : i.push(s), i.length > aC && (a = !0);
9361
+ c ? uC(c, s) || i.push(lC(c, s)) : i.push(s), i.length > iC && (a = !0);
9362
9362
  }
9363
9363
  if (!a) {
9364
- for (let [e, t] of n) if (!r.has(e) && (i.push(t), i.length > aC)) {
9364
+ for (let [e, t] of n) if (!r.has(e) && (i.push(t), i.length > iC)) {
9365
9365
  a = !0;
9366
9366
  break;
9367
9367
  }
@@ -9370,24 +9370,24 @@ function _C(e, t) {
9370
9370
  }
9371
9371
  //#endregion
9372
9372
  //#region src/utils/draw-relationship/stub.ts
9373
- function vC(e) {
9373
+ function _C(e) {
9374
9374
  return 50 + e % 4 * 12;
9375
9375
  }
9376
- function yC(e, t) {
9376
+ function vC(e, t) {
9377
9377
  return e.tableId === t.tableId ? null : e.direction === k.right && t.direction === k.left ? t.x - e.x : e.direction === k.left && t.direction === k.right ? e.x - t.x : e.direction === k.bottom && t.direction === k.top ? t.y - e.y : e.direction === k.top && t.direction === k.bottom ? e.y - t.y : null;
9378
9378
  }
9379
- function bC(e, t) {
9379
+ function yC(e, t) {
9380
9380
  return t === null || t <= 0 ? e : Math.max(36, Math.min(e, t / 2 - 1));
9381
9381
  }
9382
- function xC(e) {
9382
+ function bC(e) {
9383
9383
  return e === k.left || e === k.right;
9384
9384
  }
9385
- function SC(e) {
9385
+ function xC(e) {
9386
9386
  return e === k.right || e === k.bottom ? 1 : -1;
9387
9387
  }
9388
- function CC(e, t, n) {
9389
- let r = SC(t);
9390
- return xC(t) ? {
9388
+ function SC(e, t, n) {
9389
+ let r = xC(t);
9390
+ return bC(t) ? {
9391
9391
  x: e.x + r * n,
9392
9392
  y: e.y
9393
9393
  } : {
@@ -9395,19 +9395,19 @@ function CC(e, t, n) {
9395
9395
  y: e.y + r * n
9396
9396
  };
9397
9397
  }
9398
- function wC({ start: e, end: t }, [n, r]) {
9399
- let i = yC(e, t), a = bC(vC(n), i), o = bC(vC(r), i);
9398
+ function CC({ start: e, end: t }, [n, r]) {
9399
+ let i = vC(e, t), a = yC(_C(n), i), o = yC(_C(r), i);
9400
9400
  return {
9401
- m: CC(e, e.direction, a),
9402
- l: CC(t, t.direction, o),
9401
+ m: SC(e, e.direction, a),
9402
+ l: SC(t, t.direction, o),
9403
9403
  startStub: a,
9404
9404
  endStub: o
9405
9405
  };
9406
9406
  }
9407
9407
  //#endregion
9408
9408
  //#region src/utils/draw-relationship/route.ts
9409
- var TC = 16, EC = 2, DC = 36, OC = 1e5, kC = 6, AC = 4;
9410
- function jC(e, t = "document") {
9409
+ var wC = 16, TC = 2, EC = 36, DC = 1e5, OC = 6, kC = 4;
9410
+ function AC(e, t = "document") {
9411
9411
  let { tableIds: n } = ko(e, t), r = C(e.collections).collection("tableEntities").selectByIds(n), i = r.length, a = {
9412
9412
  ids: Array(i),
9413
9413
  left: new Float64Array(i),
@@ -9417,10 +9417,10 @@ function jC(e, t = "document") {
9417
9417
  };
9418
9418
  return r.forEach((n, r) => {
9419
9419
  let i = ps(e, n, t);
9420
- a.ids[r] = n.id, a.left[r] = i.lt.x + EC, a.top[r] = i.lt.y + EC, a.right[r] = i.rb.x - EC, a.bottom[r] = i.rb.y - EC;
9420
+ a.ids[r] = n.id, a.left[r] = i.lt.x + TC, a.top[r] = i.lt.y + TC, a.right[r] = i.rb.x - TC, a.bottom[r] = i.rb.y - TC;
9421
9421
  }), a;
9422
9422
  }
9423
- function MC(e, t, n, r, i, a, o, s) {
9423
+ function jC(e, t, n, r, i, a, o, s) {
9424
9424
  let c = 0, l = 1, u = n - e, d = r - t, f = (e, t) => {
9425
9425
  if (e === 0) return t >= 0;
9426
9426
  let n = t / e;
@@ -9435,7 +9435,7 @@ function MC(e, t, n, r, i, a, o, s) {
9435
9435
  };
9436
9436
  return f(-u, e - i) && f(u, o - e) && f(-d, t - a) && f(d, s - t) && c <= l;
9437
9437
  }
9438
- function NC(e, t, n, r) {
9438
+ function MC(e, t, n, r) {
9439
9439
  let i = 0, a = Infinity, o = -Infinity, s = Infinity, c = -Infinity;
9440
9440
  for (let t = 0; t < e.length; t++) {
9441
9441
  let n = e[t];
@@ -9447,7 +9447,7 @@ function NC(e, t, n, r) {
9447
9447
  let m = t.ids[l];
9448
9448
  if (m !== n && m !== r) for (let t = 1; t < e.length; t++) {
9449
9449
  let n = e[t - 1], r = e[t];
9450
- if (!(Math.max(n.x, r.x) < u || Math.min(n.x, r.x) > d) && !(Math.max(n.y, r.y) < f || Math.min(n.y, r.y) > p) && MC(n.x, n.y, r.x, r.y, u, f, d, p)) {
9450
+ if (!(Math.max(n.x, r.x) < u || Math.min(n.x, r.x) > d) && !(Math.max(n.y, r.y) < f || Math.min(n.y, r.y) > p) && jC(n.x, n.y, r.x, r.y, u, f, d, p)) {
9451
9451
  i++;
9452
9452
  break;
9453
9453
  }
@@ -9455,18 +9455,18 @@ function NC(e, t, n, r) {
9455
9455
  }
9456
9456
  return i;
9457
9457
  }
9458
- function PC(e) {
9458
+ function NC(e) {
9459
9459
  let t = 0;
9460
9460
  for (let n = 1; n < e.length; n++) t += Math.abs(e[n].x - e[n - 1].x) + Math.abs(e[n].y - e[n - 1].y);
9461
9461
  return t;
9462
9462
  }
9463
- function FC(e, t, n, r, i, a) {
9463
+ function PC(e, t, n, r, i, a) {
9464
9464
  let o = (e + t) / 2, s = n[r ? "left" : "top"], c = n[r ? "right" : "bottom"], l = n[r ? "top" : "left"], u = n[r ? "bottom" : "right"], d = [];
9465
- for (let e = 0; e < n.ids.length; e++) u[e] < i || l[e] > a || d.push(s[e] - TC, c[e] + TC);
9466
- return d.sort((e, t) => Math.abs(e - o) - Math.abs(t - o)), [o, ...d.slice(0, kC)];
9465
+ for (let e = 0; e < n.ids.length; e++) u[e] < i || l[e] > a || d.push(s[e] - wC, c[e] + wC);
9466
+ return d.sort((e, t) => Math.abs(e - o) - Math.abs(t - o)), [o, ...d.slice(0, OC)];
9467
9467
  }
9468
- function IC(e, t, n, r, i) {
9469
- let a = xC(t), o = xC(r), s = SC(t), c = SC(r), l = Math.min(e.x, n.x, e.y, n.y), u = Math.max(e.x, n.x, e.y, n.y), d = [], f = (e) => {
9468
+ function FC(e, t, n, r, i) {
9469
+ let a = bC(t), o = bC(r), s = xC(t), c = xC(r), l = Math.min(e.x, n.x, e.y, n.y), u = Math.max(e.x, n.x, e.y, n.y), d = [], f = (e) => {
9470
9470
  let t = [e[0]];
9471
9471
  for (let n = 1; n < e.length; n++) {
9472
9472
  let r = t[t.length - 1], i = e[n];
@@ -9478,7 +9478,7 @@ function IC(e, t, n, r, i) {
9478
9478
  });
9479
9479
  };
9480
9480
  if (a && o) {
9481
- let t = FC(e.x, n.x, i, !0, l, u);
9481
+ let t = PC(e.x, n.x, i, !0, l, u);
9482
9482
  for (let r of t) (r - e.x) * s < 0 || (r - n.x) * c < 0 || f([
9483
9483
  e,
9484
9484
  {
@@ -9491,9 +9491,9 @@ function IC(e, t, n, r, i) {
9491
9491
  },
9492
9492
  n
9493
9493
  ]);
9494
- let r = FC(e.y, n.y, i, !1, l, u);
9494
+ let r = PC(e.y, n.y, i, !1, l, u);
9495
9495
  for (let t of r) {
9496
- let r = e.x + s * TC, i = n.x + c * TC;
9496
+ let r = e.x + s * wC, i = n.x + c * wC;
9497
9497
  f([
9498
9498
  e,
9499
9499
  {
@@ -9516,7 +9516,7 @@ function IC(e, t, n, r, i) {
9516
9516
  ]);
9517
9517
  }
9518
9518
  } else if (!a && !o) {
9519
- let t = FC(e.y, n.y, i, !1, l, u);
9519
+ let t = PC(e.y, n.y, i, !1, l, u);
9520
9520
  for (let r of t) (r - e.y) * s < 0 || (r - n.y) * c < 0 || f([
9521
9521
  e,
9522
9522
  {
@@ -9529,9 +9529,9 @@ function IC(e, t, n, r, i) {
9529
9529
  },
9530
9530
  n
9531
9531
  ]);
9532
- let r = FC(e.x, n.x, i, !0, l, u);
9532
+ let r = PC(e.x, n.x, i, !0, l, u);
9533
9533
  for (let t of r) {
9534
- let r = e.y + s * TC, i = n.y + c * TC;
9534
+ let r = e.y + s * wC, i = n.y + c * wC;
9535
9535
  f([
9536
9536
  e,
9537
9537
  {
@@ -9562,7 +9562,7 @@ function IC(e, t, n, r, i) {
9562
9562
  },
9563
9563
  n
9564
9564
  ]);
9565
- let t = FC(e.x, n.x, i, !0, l, u).filter((t) => (t - e.x) * s >= 0).slice(0, AC), r = FC(e.y, n.y, i, !1, l, u).filter((e) => (e - n.y) * c >= 0).slice(0, AC);
9565
+ let t = PC(e.x, n.x, i, !0, l, u).filter((t) => (t - e.x) * s >= 0).slice(0, kC), r = PC(e.y, n.y, i, !1, l, u).filter((e) => (e - n.y) * c >= 0).slice(0, kC);
9566
9566
  for (let i of t) for (let t of r) f([
9567
9567
  e,
9568
9568
  {
@@ -9588,7 +9588,7 @@ function IC(e, t, n, r, i) {
9588
9588
  },
9589
9589
  n
9590
9590
  ]);
9591
- let t = FC(e.y, n.y, i, !1, l, u).filter((t) => (t - e.y) * s >= 0).slice(0, AC), r = FC(e.x, n.x, i, !0, l, u).filter((e) => (e - n.x) * c >= 0).slice(0, AC);
9591
+ let t = PC(e.y, n.y, i, !1, l, u).filter((t) => (t - e.y) * s >= 0).slice(0, kC), r = PC(e.x, n.x, i, !0, l, u).filter((e) => (e - n.x) * c >= 0).slice(0, kC);
9592
9592
  for (let i of t) for (let t of r) f([
9593
9593
  e,
9594
9594
  {
@@ -9608,13 +9608,13 @@ function IC(e, t, n, r, i) {
9608
9608
  }
9609
9609
  return d;
9610
9610
  }
9611
- function LC(e, t, n, r, i, a, o) {
9612
- let s = IC(e, t, n, r, i), c = null, l = Infinity;
9611
+ function IC(e, t, n, r, i, a, o) {
9612
+ let s = FC(e, t, n, r, i), c = null, l = Infinity;
9613
9613
  for (let e of s) {
9614
- let t = NC(e.points, i, a, o) * OC + e.bends * DC + PC(e.points);
9614
+ let t = MC(e.points, i, a, o) * DC + e.bends * EC + NC(e.points);
9615
9615
  t < l && (l = t, c = e.points);
9616
9616
  }
9617
- return c || (xC(t) ? [
9617
+ return c || (bC(t) ? [
9618
9618
  e,
9619
9619
  {
9620
9620
  x: (e.x + n.x) / 2,
@@ -9640,12 +9640,12 @@ function LC(e, t, n, r, i, a, o) {
9640
9640
  }
9641
9641
  //#endregion
9642
9642
  //#region src/utils/draw-relationship/nudge.ts
9643
- var RC = 10, zC = [
9644
- RC,
9643
+ var LC = 10, RC = [
9644
+ LC,
9645
9645
  7,
9646
9646
  4
9647
- ], BC = zC[zC.length - 1] - .5, VC = 3;
9648
- function HC(e) {
9647
+ ], zC = RC[RC.length - 1] - .5, BC = 3;
9648
+ function VC(e) {
9649
9649
  let t = [];
9650
9650
  for (let [n, r] of e) for (let e = 0; e < r.length - 1; e++) {
9651
9651
  let i = r[e], a = r[e + 1], o = Math.abs(i.x - a.x) < .5;
@@ -9662,33 +9662,33 @@ function HC(e) {
9662
9662
  }
9663
9663
  return t;
9664
9664
  }
9665
- function UC(e, t) {
9665
+ function HC(e, t) {
9666
9666
  return e.relationshipId === t.relationshipId ? e.index - t.index : e.relationshipId < t.relationshipId ? -1 : 1;
9667
9667
  }
9668
- function WC(e) {
9668
+ function UC(e) {
9669
9669
  let t = e.points[e.index - 1];
9670
9670
  return e.vertical ? t.y : t.x;
9671
9671
  }
9672
- function GC(e) {
9672
+ function WC(e) {
9673
9673
  for (let t of e) {
9674
9674
  let e = t.points[t.index], n = t.points[t.index + 1];
9675
9675
  t.low = t.vertical ? Math.min(e.y, n.y) : Math.min(e.x, n.x), t.high = t.vertical ? Math.max(e.y, n.y) : Math.max(e.x, n.x);
9676
9676
  }
9677
9677
  }
9678
- function KC(e, t) {
9678
+ function GC(e, t) {
9679
9679
  let n = e.points[e.index], r = e.points[e.index + 1];
9680
9680
  e.vertical ? (n.x = t, r.x = t) : (n.y = t, r.y = t);
9681
9681
  }
9682
- function qC(e, t, n, r) {
9682
+ function KC(e, t, n, r) {
9683
9683
  let i = [], a = [];
9684
- for (let t of HC(e)) (t.vertical ? i : a).push(t);
9684
+ for (let t of VC(e)) (t.vertical ? i : a).push(t);
9685
9685
  for (let e of [i, a]) {
9686
- GC(e);
9686
+ WC(e);
9687
9687
  let i = e.filter((e) => e.movable);
9688
9688
  if (i.length < 2) continue;
9689
- i.sort((e, t) => e.coordinate - t.coordinate || UC(e, t));
9689
+ i.sort((e, t) => e.coordinate - t.coordinate || HC(e, t));
9690
9690
  let a = [], o = () => {
9691
- a.length > 1 && JC(a, e, t, n, r), a = [];
9691
+ a.length > 1 && qC(a, e, t, n, r), a = [];
9692
9692
  };
9693
9693
  for (let e of i) {
9694
9694
  let t = a[a.length - 1];
@@ -9697,77 +9697,77 @@ function qC(e, t, n, r) {
9697
9697
  o();
9698
9698
  }
9699
9699
  }
9700
- function JC(e, t, n, r, i) {
9701
- e.sort((e, t) => e.low - t.low || UC(e, t));
9700
+ function qC(e, t, n, r, i) {
9701
+ e.sort((e, t) => e.low - t.low || HC(e, t));
9702
9702
  let a = [], o = -Infinity, s = () => {
9703
- a.length > 1 && ew(a, t, n, r, i), a = [], o = -Infinity;
9703
+ a.length > 1 && $C(a, t, n, r, i), a = [], o = -Infinity;
9704
9704
  };
9705
9705
  for (let t of e) a.length && t.low >= o && s(), a.push(t), o = Math.max(o, t.high);
9706
9706
  s();
9707
9707
  }
9708
+ function JC(e, t) {
9709
+ return e.high + LC > t.low && t.high + LC > e.low;
9710
+ }
9708
9711
  function YC(e, t) {
9709
- return e.high + RC > t.low && t.high + RC > e.low;
9712
+ return Math.abs(e.coordinate - t.coordinate) >= zC ? 0 : Math.max(0, Math.min(e.high, t.high) - Math.max(e.low, t.low));
9710
9713
  }
9711
9714
  function XC(e, t) {
9712
- return Math.abs(e.coordinate - t.coordinate) >= BC ? 0 : Math.max(0, Math.min(e.high, t.high) - Math.max(e.low, t.low));
9713
- }
9714
- function ZC(e, t) {
9715
9715
  let n = 0;
9716
9716
  for (let r = 0; r < e.length; r++) {
9717
9717
  let i = e[r];
9718
- for (let t = r + 1; t < e.length; t++) n += XC(i, e[t]);
9719
- for (let e of t) n += XC(i, e);
9718
+ for (let t = r + 1; t < e.length; t++) n += YC(i, e[t]);
9719
+ for (let e of t) n += YC(i, e);
9720
9720
  }
9721
9721
  return n;
9722
9722
  }
9723
- function QC(e, t) {
9723
+ function ZC(e, t) {
9724
9724
  let n = new Set(e), r = Infinity, i = -Infinity;
9725
9725
  for (let t of e) t.coordinate < r && (r = t.coordinate), t.coordinate > i && (i = t.coordinate);
9726
- let a = RC * (e.length - 1) / 2 + BC, o = [];
9726
+ let a = LC * (e.length - 1) / 2 + zC, o = [];
9727
9727
  for (let e of t) e.coordinate < r - a || e.coordinate > i + a || n.has(e) || o.push(e);
9728
9728
  return o;
9729
9729
  }
9730
- function $C(e) {
9730
+ function QC(e) {
9731
9731
  let t = [];
9732
9732
  for (let n of e) {
9733
- let e = t.find((e) => !YC(e[e.length - 1], n));
9733
+ let e = t.find((e) => !JC(e[e.length - 1], n));
9734
9734
  e ? e.push(n) : t.push([n]);
9735
9735
  }
9736
9736
  return t;
9737
9737
  }
9738
- function ew(e, t, n, r, i) {
9738
+ function $C(e, t, n, r, i) {
9739
9739
  if (!i) {
9740
- tw(e, t, n, r);
9740
+ ew(e, t, n, r);
9741
9741
  return;
9742
9742
  }
9743
- if (nw(e, i)) return;
9743
+ if (tw(e, i)) return;
9744
9744
  let a = e.map((e) => e.coordinate);
9745
- tw(e, t, n, r), rw(e, a, i);
9745
+ ew(e, t, n, r), nw(e, a, i);
9746
9746
  }
9747
- function tw(e, t, n, r) {
9748
- let i = QC(e, t), a = ZC(e, i);
9747
+ function ew(e, t, n, r) {
9748
+ let i = ZC(e, t), a = XC(e, i);
9749
9749
  if (!a) return;
9750
- let o = /* @__PURE__ */ new Map(), s = e.map((e) => (o.set(e, uw(e, n, r)), e.coordinate)), c = s.reduce((e, t) => e + t, 0) / s.length, l = iw(e), u = null, d = Infinity;
9751
- for (let t of zC) {
9750
+ let o = /* @__PURE__ */ new Map(), s = e.map((e) => (o.set(e, lw(e, n, r)), e.coordinate)), c = s.reduce((e, t) => e + t, 0) / s.length, l = rw(e), u = null, d = Infinity;
9751
+ for (let t of RC) {
9752
9752
  let a = null, f = Infinity;
9753
9753
  for (let p of l) {
9754
- lw(p, t, c, o, n, r);
9755
- let l = ZC(e, i);
9754
+ cw(p, t, c, o, n, r);
9755
+ let l = XC(e, i);
9756
9756
  if (l) l < d && (u = e.map((e) => e.coordinate), d = l);
9757
9757
  else {
9758
- let t = sw(e, s);
9758
+ let t = ow(e, s);
9759
9759
  t < f && (f = t, a = e.map((e) => e.coordinate));
9760
9760
  }
9761
- cw(e, s);
9761
+ sw(e, s);
9762
9762
  }
9763
9763
  if (a) {
9764
- cw(e, a);
9764
+ sw(e, a);
9765
9765
  return;
9766
9766
  }
9767
9767
  }
9768
- u && d < a && cw(e, u);
9768
+ u && d < a && sw(e, u);
9769
9769
  }
9770
- function nw(e, t) {
9770
+ function tw(e, t) {
9771
9771
  let n = [];
9772
9772
  for (let r of e) {
9773
9773
  if (t.dirty.has(r.relationshipId)) return !1;
@@ -9775,9 +9775,9 @@ function nw(e, t) {
9775
9775
  if (e === void 0 || t.lanes.hits(r.vertical, r.coordinate, e, r.low, r.high)) return !1;
9776
9776
  n.push(e);
9777
9777
  }
9778
- return cw(e, n), !0;
9778
+ return sw(e, n), !0;
9779
9779
  }
9780
- function rw(e, t, n) {
9780
+ function nw(e, t, n) {
9781
9781
  e.forEach((e, r) => {
9782
9782
  let i = t[r], a = e.coordinate;
9783
9783
  if (Math.abs(a - i) < .5) return;
@@ -9786,70 +9786,70 @@ function rw(e, t, n) {
9786
9786
  n.lanes.markSpan(!e.vertical, u, u, c, l), n.lanes.markSpan(!e.vertical, d, d, c, l);
9787
9787
  });
9788
9788
  }
9789
- function iw(e) {
9790
- let t = $C(e), n = aw(t);
9791
- return t.length === e.length ? n : [...n, ...aw(e.map((e) => [e]))];
9789
+ function rw(e) {
9790
+ let t = QC(e), n = iw(t);
9791
+ return t.length === e.length ? n : [...n, ...iw(e.map((e) => [e]))];
9792
9792
  }
9793
- function aw(e) {
9794
- let t = (e, t) => e.reduce((e, n) => e + t(n), 0) / e.length, n = [...e].sort((e, n) => t(e, WC) - t(n, WC) || t(e, ow) - t(n, ow) || UC(e[0], n[0])), r = [...e].sort((e, n) => t(e, ow) - t(n, ow) || t(e, WC) - t(n, WC) || UC(e[0], n[0]));
9793
+ function iw(e) {
9794
+ let t = (e, t) => e.reduce((e, n) => e + t(n), 0) / e.length, n = [...e].sort((e, n) => t(e, UC) - t(n, UC) || t(e, aw) - t(n, aw) || HC(e[0], n[0])), r = [...e].sort((e, n) => t(e, aw) - t(n, aw) || t(e, UC) - t(n, UC) || HC(e[0], n[0]));
9795
9795
  return n.every((e, t) => e === r[t]) ? [n] : [n, r];
9796
9796
  }
9797
- function ow(e) {
9797
+ function aw(e) {
9798
9798
  return e.coordinate;
9799
9799
  }
9800
- function sw(e, t) {
9800
+ function ow(e, t) {
9801
9801
  return e.reduce((e, n, r) => e + Math.abs(n.coordinate - t[r]), 0);
9802
9802
  }
9803
- function cw(e, t) {
9803
+ function sw(e, t) {
9804
9804
  e.forEach((e, n) => {
9805
- KC(e, t[n]), e.coordinate = t[n];
9805
+ GC(e, t[n]), e.coordinate = t[n];
9806
9806
  });
9807
9807
  }
9808
- function lw(e, t, n, r, i, a) {
9808
+ function cw(e, t, n, r, i, a) {
9809
9809
  let o = n - t * (e.length - 1) / 2, s = e.map(() => []);
9810
9810
  e.forEach((n, c) => {
9811
9811
  for (let l of n) {
9812
9812
  let n = r.get(l);
9813
9813
  if (!n) continue;
9814
9814
  let u = (r) => {
9815
- if (r < 0 || r >= e.length || s[r].some((e) => YC(l, e))) return !1;
9815
+ if (r < 0 || r >= e.length || s[r].some((e) => JC(l, e))) return !1;
9816
9816
  let c = o + r * t;
9817
- return KC(l, c), mw(l, i, a, n) ? (l.coordinate = c, s[r].push(l), !0) : !1;
9817
+ return GC(l, c), pw(l, i, a, n) ? (l.coordinate = c, s[r].push(l), !0) : !1;
9818
9818
  }, d = !1;
9819
- for (let e = 0; e <= VC && !d; e++) d = u(c - e) || e > 0 && u(c + e);
9820
- d || KC(l, l.coordinate);
9819
+ for (let e = 0; e <= BC && !d; e++) d = u(c - e) || e > 0 && u(c + e);
9820
+ d || GC(l, l.coordinate);
9821
9821
  }
9822
9822
  });
9823
9823
  }
9824
- function uw(e, t, n) {
9824
+ function lw(e, t, n) {
9825
9825
  let r = n.get(e.relationshipId), i = [];
9826
9826
  for (let e = 0; e < t.ids.length; e++) {
9827
9827
  let n = t.ids[e];
9828
9828
  (n === r?.[0] || n === r?.[1]) && i.push(e);
9829
9829
  }
9830
9830
  return {
9831
- blocked: NC(e.points, t, r?.[0] ?? "", r?.[1] ?? ""),
9832
- crossed: hw(e.points),
9831
+ blocked: MC(e.points, t, r?.[0] ?? "", r?.[1] ?? ""),
9832
+ crossed: mw(e.points),
9833
9833
  own: i,
9834
- intruded: pw(e.points, t, i),
9835
- beforeDelta: dw(e, -1),
9836
- afterDelta: dw(e, 1)
9834
+ intruded: fw(e.points, t, i),
9835
+ beforeDelta: uw(e, -1),
9836
+ afterDelta: uw(e, 1)
9837
9837
  };
9838
9838
  }
9839
- function dw(e, t) {
9839
+ function uw(e, t) {
9840
9840
  let n = e.points[t < 0 ? e.index : e.index + 1], r = e.points[t < 0 ? e.index - 1 : e.index + 2];
9841
9841
  return e.vertical ? r.x - n.x : r.y - n.y;
9842
9842
  }
9843
- function fw(e, t) {
9843
+ function dw(e, t) {
9844
9844
  return Math.abs(t) >= .5 && e * t <= 0;
9845
9845
  }
9846
- function pw(e, t, n) {
9846
+ function fw(e, t, n) {
9847
9847
  let r = 0;
9848
9848
  for (let i of n) {
9849
9849
  let n = t.left[i], a = t.top[i], o = t.right[i], s = t.bottom[i];
9850
9850
  for (let t = 1; t < e.length; t++) {
9851
9851
  let i = e[t - 1], c = e[t];
9852
- if (MC(i.x, i.y, c.x, c.y, n, a, o, s)) {
9852
+ if (jC(i.x, i.y, c.x, c.y, n, a, o, s)) {
9853
9853
  r++;
9854
9854
  break;
9855
9855
  }
@@ -9857,17 +9857,17 @@ function pw(e, t, n) {
9857
9857
  }
9858
9858
  return r;
9859
9859
  }
9860
- function mw(e, t, n, r) {
9860
+ function pw(e, t, n, r) {
9861
9861
  let i = e.points[e.index - 1], a = e.points[e.index], o = e.points[e.index + 1], s = e.points[e.index + 2];
9862
- if ((e.vertical ? Math.abs(i.x - a.x) < .5 || Math.abs(s.x - o.x) < .5 : Math.abs(i.y - a.y) < .5 || Math.abs(s.y - o.y) < .5) || e.index === 1 && fw(dw(e, -1), r.beforeDelta) || e.index + 2 === e.points.length - 1 && fw(dw(e, 1), r.afterDelta) || pw(e.points, t, r.own) > r.intruded || !r.crossed && hw(e.points)) return !1;
9862
+ if ((e.vertical ? Math.abs(i.x - a.x) < .5 || Math.abs(s.x - o.x) < .5 : Math.abs(i.y - a.y) < .5 || Math.abs(s.y - o.y) < .5) || e.index === 1 && dw(uw(e, -1), r.beforeDelta) || e.index + 2 === e.points.length - 1 && dw(uw(e, 1), r.afterDelta) || fw(e.points, t, r.own) > r.intruded || !r.crossed && mw(e.points)) return !1;
9863
9863
  let c = n.get(e.relationshipId);
9864
- return NC(e.points, t, c?.[0] ?? "", c?.[1] ?? "") <= r.blocked;
9864
+ return MC(e.points, t, c?.[0] ?? "", c?.[1] ?? "") <= r.blocked;
9865
9865
  }
9866
- function hw(e) {
9867
- for (let t = 0; t + 1 < e.length; t++) for (let n = t + 2; n + 1 < e.length; n++) if (gw(e[t], e[t + 1], e[n], e[n + 1])) return !0;
9866
+ function mw(e) {
9867
+ for (let t = 0; t + 1 < e.length; t++) for (let n = t + 2; n + 1 < e.length; n++) if (hw(e[t], e[t + 1], e[n], e[n + 1])) return !0;
9868
9868
  return !1;
9869
9869
  }
9870
- function gw(e, t, n, r) {
9870
+ function hw(e, t, n, r) {
9871
9871
  let i = Math.abs(e.x - t.x) < .5;
9872
9872
  if (i === Math.abs(n.x - r.x) < .5) return !1;
9873
9873
  let a = i ? e : n, o = i ? t : r, s = i ? n : e, c = i ? r : t;
@@ -9875,68 +9875,68 @@ function gw(e, t, n, r) {
9875
9875
  }
9876
9876
  //#endregion
9877
9877
  //#region src/utils/draw-relationship/sort.ts
9878
- var _w = {
9878
+ var gw = {
9879
9879
  [N.top]: k.top,
9880
9880
  [N.bottom]: k.bottom,
9881
9881
  [N.left]: k.left,
9882
9882
  [N.right]: k.right
9883
- }, vw = Math.PI * 2, yw = .15, bw = 20, xw = 60, Sw = 14, Cw = 8, ww = {
9883
+ }, _w = Math.PI * 2, vw = .15, yw = 20, bw = 60, xw = 14, Sw = 8, Cw = {
9884
9884
  [N.top]: -Math.PI,
9885
9885
  [N.right]: -Math.PI / 2,
9886
9886
  [N.bottom]: 0,
9887
9887
  [N.left]: Math.PI / 2
9888
- }, Tw = {
9888
+ }, ww = {
9889
9889
  [N.top]: !1,
9890
9890
  [N.right]: !1,
9891
9891
  [N.bottom]: !0,
9892
9892
  [N.left]: !0
9893
9893
  };
9894
- function Ew(e, t = "document") {
9894
+ function Tw(e, t = "document") {
9895
9895
  $i(t);
9896
- let { tableIds: n, relationshipIds: r } = ko(e, t), { collections: i } = e, a = M(n), o = C(i).collection("tableEntities"), s = C(i).collection("relationshipEntities").selectByIds(r).filter(({ start: e, end: t }) => a(e.tableId) && a(t.tableId)), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = Rw(s);
9896
+ let { tableIds: n, relationshipIds: r } = ko(e, t), { collections: i } = e, a = M(n), o = C(i).collection("tableEntities"), s = C(i).collection("relationshipEntities").selectByIds(r).filter(({ start: e, end: t }) => a(e.tableId) && a(t.tableId)), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = Lw(s);
9897
9897
  for (let n of s) {
9898
- let r = Lw(n), { start: i, end: a } = r, s = o.selectById(i.tableId), f = o.selectById(a.tableId);
9898
+ let r = Iw(n), { start: i, end: a } = r, s = o.selectById(i.tableId), f = o.selectById(a.tableId);
9899
9899
  if (!(!s || !f)) {
9900
- if (l.set(n, r), u.set(r.id, [0, 0]), i.tableId === a.tableId) Nw(Mw(e, c, s, t), r);
9900
+ if (l.set(n, r), u.set(r.id, [0, 0]), i.tableId === a.tableId) Mw(jw(e, c, s, t), r);
9901
9901
  else {
9902
- let n = Mw(e, c, s, t), o = Mw(e, c, f, t), [l, u] = Hw(n.objectPoint, o.objectPoint, r);
9902
+ let n = jw(e, c, s, t), o = jw(e, c, f, t), [l, u] = Vw(n.objectPoint, o.objectPoint, r);
9903
9903
  n[l].push({
9904
9904
  id: r.id,
9905
9905
  isStart: !0,
9906
9906
  point: i,
9907
- angle: Vw(l, n, o),
9907
+ angle: Bw(l, n, o),
9908
9908
  tie: d.tieAt(r.id, i.tableId, a.tableId)
9909
9909
  }), o[u].push({
9910
9910
  id: r.id,
9911
9911
  isStart: !1,
9912
9912
  point: a,
9913
- angle: Vw(u, o, n),
9913
+ angle: Bw(u, o, n),
9914
9914
  tie: d.tieAt(r.id, a.tableId, i.tableId)
9915
9915
  });
9916
9916
  }
9917
9917
  }
9918
9918
  }
9919
- for (let e of c.values()) for (let t of Ii) Uw(t, e, u);
9919
+ for (let e of c.values()) for (let t of Ii) Hw(t, e, u);
9920
9920
  for (let [e, n] of l.entries()) Yi(e, u.get(n.id) ?? [0, 0], t), ta(e, n, t);
9921
- t === "document" ? Ow(e, l, u) : Dw(l, u, t);
9921
+ t === "document" ? Dw(e, l, u) : Ew(l, u, t);
9922
9922
  }
9923
- function Dw(e, t, n) {
9923
+ function Ew(e, t, n) {
9924
9924
  for (let [r, i] of e.entries()) {
9925
9925
  let { id: e, start: a, end: o } = i;
9926
9926
  if (a.tableId === o.tableId) continue;
9927
- let { m: s, l: c } = wC(i, t.get(e) ?? [0, 0]);
9927
+ let { m: s, l: c } = CC(i, t.get(e) ?? [0, 0]);
9928
9928
  Zi(r, [s, c], n);
9929
9929
  }
9930
9930
  }
9931
- function Ow(e, t, n) {
9932
- let r = jC(e), i = cC(e), a = _C(i, r), o = i.entries, s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), l = hC();
9931
+ function Dw(e, t, n) {
9932
+ let r = AC(e), i = sC(e), a = gC(i, r), o = i.entries, s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), l = mC();
9933
9933
  if (a) for (let e of a) l.markBox(e);
9934
9934
  let u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
9935
9935
  for (let [e, i] of t.entries()) {
9936
9936
  let { id: t, start: p, end: m } = i;
9937
9937
  if (p.tableId === m.tableId) continue;
9938
- let { m: h, l: g } = wC(i, n.get(t) ?? [0, 0]), ee = o.get(t), te, ne;
9939
- a !== null && ee !== void 0 && jw(ee, h, g, p, m) && !mC(ee.bounds, a) ? (te = ee.pristine, ne = kw(te)) : (ne = LC(h, p.direction, g, m.direction, r, p.tableId, m.tableId), te = kw(ne), c.add(t), ee && gC(l, ee.nudged), gC(l, te)), u.set(t, ne), d.set(t, [p.tableId, m.tableId]), f.set(t, e), s.set(t, {
9938
+ let { m: h, l: g } = CC(i, n.get(t) ?? [0, 0]), ee = o.get(t), te, ne;
9939
+ a !== null && ee !== void 0 && Aw(ee, h, g, p, m) && !pC(ee.bounds, a) ? (te = ee.pristine, ne = Ow(te)) : (ne = IC(h, p.direction, g, m.direction, r, p.tableId, m.tableId), te = Ow(ne), c.add(t), ee && hC(l, ee.nudged), hC(l, te)), u.set(t, ne), d.set(t, [p.tableId, m.tableId]), f.set(t, e), s.set(t, {
9940
9940
  mx: h.x,
9941
9941
  my: h.y,
9942
9942
  mDirection: p.direction,
@@ -9947,24 +9947,24 @@ function Ow(e, t, n) {
9947
9947
  endTableId: m.tableId,
9948
9948
  pristine: te,
9949
9949
  nudged: ne,
9950
- bounds: fC(te)
9950
+ bounds: dC(te)
9951
9951
  });
9952
9952
  }
9953
- if (a) for (let [e, t] of o) s.has(e) || gC(l, t.nudged);
9954
- qC(u, r, d, a === null ? void 0 : Aw(o, c, l));
9953
+ if (a) for (let [e, t] of o) s.has(e) || hC(l, t.nudged);
9954
+ KC(u, r, d, a === null ? void 0 : kw(o, c, l));
9955
9955
  for (let [e, t] of u) {
9956
9956
  let n = f.get(e);
9957
9957
  n && Zi(n, t);
9958
9958
  }
9959
9959
  i.entries = s;
9960
9960
  }
9961
- function kw(e) {
9961
+ function Ow(e) {
9962
9962
  return e.map(({ x: e, y: t }) => ({
9963
9963
  x: e,
9964
9964
  y: t
9965
9965
  }));
9966
9966
  }
9967
- function Aw(e, t, n) {
9967
+ function kw(e, t, n) {
9968
9968
  return {
9969
9969
  dirty: t,
9970
9970
  lanes: n,
@@ -9974,10 +9974,10 @@ function Aw(e, t, n) {
9974
9974
  }
9975
9975
  };
9976
9976
  }
9977
- function jw(e, t, n, r, i) {
9977
+ function Aw(e, t, n, r, i) {
9978
9978
  return e.mx === t.x && e.my === t.y && e.lx === n.x && e.ly === n.y && e.mDirection === r.direction && e.lDirection === i.direction && e.startTableId === r.tableId && e.endTableId === i.tableId;
9979
9979
  }
9980
- function Mw(e, t, n, r) {
9980
+ function jw(e, t, n, r) {
9981
9981
  let i = t.get(n.id);
9982
9982
  if (!i) {
9983
9983
  let a = ps(e, n, r);
@@ -9995,31 +9995,31 @@ function Mw(e, t, n, r) {
9995
9995
  }
9996
9996
  return i;
9997
9997
  }
9998
- function Nw(e, t) {
9999
- let { rt: n, width: r, height: i } = e.objectPoint, a = e.selfCount++, o = Iw(Math.min(r, i) * yw, bw, xw) + a * Sw;
9998
+ function Mw(e, t) {
9999
+ let { rt: n, width: r, height: i } = e.objectPoint, a = e.selfCount++, o = Fw(Math.min(r, i) * vw, yw, bw) + a * xw;
10000
10000
  t.start.direction = k.top, t.start.x = n.x - o, t.start.y = n.y, t.end.direction = k.right, t.end.x = n.x, t.end.y = n.y + o;
10001
10001
  }
10002
- function Pw(e, t) {
10002
+ function Nw(e, t) {
10003
10003
  let { width: n, height: r } = e.objectPoint;
10004
- return Iw(Math.min(n, r) * yw, bw, xw) + t * Sw;
10004
+ return Fw(Math.min(n, r) * vw, yw, bw) + t * xw;
10005
10005
  }
10006
- function Fw(e) {
10007
- return e.selfCount ? Pw(e, e.selfCount - 1) + Cw : 0;
10006
+ function Pw(e) {
10007
+ return e.selfCount ? Nw(e, e.selfCount - 1) + Sw : 0;
10008
10008
  }
10009
- function Iw(e, t, n) {
10009
+ function Fw(e, t, n) {
10010
10010
  return Math.min(Math.max(e, t), n);
10011
10011
  }
10012
- function Lw({ id: e, start: t, end: n }) {
10012
+ function Iw({ id: e, start: t, end: n }) {
10013
10013
  return {
10014
10014
  id: e,
10015
10015
  start: Ri(t),
10016
10016
  end: Ri(n)
10017
10017
  };
10018
10018
  }
10019
- function Rw(e) {
10019
+ function Lw(e) {
10020
10020
  let t = /* @__PURE__ */ new Map();
10021
10021
  for (let { id: n, start: r, end: i } of e) {
10022
- let e = zw(r.tableId, i.tableId), a = t.get(e);
10022
+ let e = Rw(r.tableId, i.tableId), a = t.get(e);
10023
10023
  a ? a.push(n) : t.set(e, [n]);
10024
10024
  }
10025
10025
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = !1;
@@ -10032,37 +10032,37 @@ function Rw(e) {
10032
10032
  return t <= a ? o : (r.get(e) ?? 1) - 1 - o;
10033
10033
  } };
10034
10034
  }
10035
- function zw(e, t) {
10035
+ function Rw(e, t) {
10036
10036
  return e < t ? `${e}|${t}` : `${t}|${e}`;
10037
10037
  }
10038
- function Bw(e) {
10039
- let t = e % vw;
10040
- return t < 0 ? t + vw : t;
10038
+ function zw(e) {
10039
+ let t = e % _w;
10040
+ return t < 0 ? t + _w : t;
10041
10041
  }
10042
- function Vw(e, t, n) {
10043
- return Bw(Math.atan2(n.centerY - t.centerY, n.centerX - t.centerX) - ww[e]);
10042
+ function Bw(e, t, n) {
10043
+ return zw(Math.atan2(n.centerY - t.centerY, n.centerX - t.centerX) - Cw[e]);
10044
10044
  }
10045
- function Hw(e, t, n) {
10045
+ function Vw(e, t, n) {
10046
10046
  let r = [N.bottom, N.bottom], i = ms(e.bottom, t.bottom);
10047
10047
  n.start.x = e.bottom.x, n.start.y = e.bottom.y, n.end.x = t.bottom.x, n.end.y = t.bottom.y, n.start.direction = k.bottom, n.end.direction = k.bottom;
10048
10048
  for (let a of Ii) for (let o of Ii) {
10049
10049
  let s = a, c = o, l = ms(e[s], t[c]);
10050
- i <= l || (i = l, r[0] = s, r[1] = c, n.start.x = e[s].x, n.start.y = e[s].y, n.start.direction = _w[s], n.end.x = t[c].x, n.end.y = t[c].y, n.end.direction = _w[c]);
10050
+ i <= l || (i = l, r[0] = s, r[1] = c, n.start.x = e[s].x, n.start.y = e[s].y, n.start.direction = gw[s], n.end.x = t[c].x, n.end.y = t[c].y, n.end.direction = gw[c]);
10051
10051
  }
10052
10052
  return r;
10053
10053
  }
10054
- function Uw(e, t, n) {
10054
+ function Hw(e, t, n) {
10055
10055
  let r = t[e];
10056
10056
  if (!r.length) return;
10057
10057
  r.sort((e, t) => e.angle - t.angle || e.tie - t.tie || (e.id < t.id ? -1 : 1));
10058
- let { objectPoint: i } = t, a = e === N.top || e === N.bottom, o = (a ? i.lt.x : i.lt.y) + 12, s = (a ? i.rb.x : i.rb.y) - 12, c = Fw(t);
10058
+ let { objectPoint: i } = t, a = e === N.top || e === N.bottom, o = (a ? i.lt.x : i.lt.y) + 12, s = (a ? i.rb.x : i.rb.y) - 12, c = Pw(t);
10059
10059
  if (c && (e === N.top ? s -= c : e === N.right && (o += c)), s < o) {
10060
10060
  let e = (o + s) / 2;
10061
10061
  o = e, s = e;
10062
10062
  }
10063
10063
  let l = s - o, u = (o + s) / 2, d = r.length, f = d > 1 ? Math.min(l / (d - 1), 120) : 0, p = u - f * (d - 1) / 2;
10064
10064
  r.forEach((t, r) => {
10065
- let o = Tw[e] ? d - 1 - r : r, s = p + o * f;
10065
+ let o = ww[e] ? d - 1 - r : r, s = p + o * f;
10066
10066
  a ? (t.point.x = s, t.point.y = e === N.top ? i.top.y : i.bottom.y) : (t.point.y = s, t.point.x = e === N.left ? i.left.x : i.right.x);
10067
10067
  let c = n.get(t.id);
10068
10068
  c && (c[+!t.isStart] = r);
@@ -10070,7 +10070,7 @@ function Uw(e, t, n) {
10070
10070
  }
10071
10071
  //#endregion
10072
10072
  //#region src/engine/modules/relationship/hooks.ts
10073
- var Ww = (e, t) => e.pipe(ve(10, void 0, {
10073
+ var Uw = (e, t) => e.pipe(ve(10, void 0, {
10074
10074
  leading: !1,
10075
10075
  trailing: !0
10076
10076
  })).subscribe(() => {
@@ -10083,7 +10083,7 @@ var Ww = (e, t) => e.pipe(ve(10, void 0, {
10083
10083
  let s = o.every((e) => R(e.options, A.primaryKey));
10084
10084
  s !== r && (e.identification = s);
10085
10085
  }
10086
- }), Gw = (e, t) => e.pipe(ve(10, void 0, {
10086
+ }), Ww = (e, t) => e.pipe(ve(10, void 0, {
10087
10087
  leading: !1,
10088
10088
  trailing: !0
10089
10089
  })).subscribe(() => {
@@ -10096,79 +10096,79 @@ var Ww = (e, t) => e.pipe(ve(10, void 0, {
10096
10096
  let s = o.every((e) => R(e.options, A.notNull)) ? di.dash : di.ring;
10097
10097
  s !== r && (e.startRelationshipType = s);
10098
10098
  }
10099
- }), Kw = M([
10099
+ }), Gw = M([
10100
10100
  Mf.type,
10101
10101
  Pf.type,
10102
10102
  Fd.type
10103
- ]), qw = ({ tags: e }) => !u(e) && R(e, ho.drag) ? ye(5) : ye(0, le), Jw = (e, t) => e.pipe(v((e) => {
10104
- Kw(e.type) || qo();
10105
- }), _e(qw, {
10103
+ ]), Kw = ({ tags: e }) => !u(e) && R(e, ho.drag) ? ye(5) : ye(0, le), qw = (e, t) => e.pipe(v((e) => {
10104
+ Gw(e.type) || qo();
10105
+ }), _e(Kw, {
10106
10106
  leading: !1,
10107
10107
  trailing: !0
10108
10108
  })).subscribe(() => {
10109
- Ew(t());
10110
- }), Yw = M([
10109
+ Tw(t());
10110
+ }), Jw = M([
10111
10111
  mc.type,
10112
10112
  Pc.type,
10113
10113
  Fd.type
10114
- ]), Xw = M([
10114
+ ]), Yw = M([
10115
10115
  Ja.type,
10116
10116
  Xa.type,
10117
10117
  Qa.type,
10118
10118
  eo.type
10119
- ]), Zw = ({ id: e }) => [e], Qw = ({ ids: e }) => e, $w = ({ tableId: e }) => [e], eT = (e, { kind: t }) => t, tT = () => ka.flow, nT = (e, { kind: t }) => t ?? La(e)?.kind ?? null, rT = {
10120
- [Wa.type]: eT,
10121
- [Ka.type]: eT,
10122
- [io.type]: eT,
10123
- [co.type]: tT,
10124
- [oo.type]: nT,
10125
- [no.type]: nT
10126
- }, iT = {
10127
- [Af.type]: Zw,
10128
- [If.type]: Zw,
10129
- [Pf.type]: Zw,
10130
- [Rf.type]: Zw,
10131
- [Bf.type]: Zw,
10132
- [uf.type]: Zw,
10133
- [ff.type]: Zw,
10134
- [Mf.type]: Qw,
10135
- [no.type]: Qw,
10136
- [sp.type]: $w,
10137
- [lp.type]: $w,
10138
- [dp.type]: $w,
10139
- [pp.type]: $w,
10140
- [hp.type]: $w,
10141
- [_p.type]: $w,
10142
- [xp.type]: $w
10119
+ ]), Xw = ({ id: e }) => [e], Zw = ({ ids: e }) => e, Qw = ({ tableId: e }) => [e], $w = (e, { kind: t }) => t, eT = () => ka.flow, tT = (e, { kind: t }) => t ?? La(e)?.kind ?? null, nT = {
10120
+ [Wa.type]: $w,
10121
+ [Ka.type]: $w,
10122
+ [io.type]: $w,
10123
+ [co.type]: eT,
10124
+ [oo.type]: tT,
10125
+ [no.type]: tT
10126
+ }, rT = {
10127
+ [Af.type]: Xw,
10128
+ [If.type]: Xw,
10129
+ [Pf.type]: Xw,
10130
+ [Rf.type]: Xw,
10131
+ [Bf.type]: Xw,
10132
+ [uf.type]: Xw,
10133
+ [ff.type]: Xw,
10134
+ [Mf.type]: Zw,
10135
+ [no.type]: Zw,
10136
+ [sp.type]: Qw,
10137
+ [lp.type]: Qw,
10138
+ [dp.type]: Qw,
10139
+ [pp.type]: Qw,
10140
+ [hp.type]: Qw,
10141
+ [_p.type]: Qw,
10142
+ [xp.type]: Qw
10143
10143
  };
10144
- function aT(e, t) {
10144
+ function iT(e, t) {
10145
10145
  let { tableIds: n, relationshipIds: r } = ko(e, t);
10146
10146
  return /* @__PURE__ */ new Set([...n, ...r]);
10147
10147
  }
10148
- function oT(e, t, n, r) {
10149
- if (Yw(t.type) || Xw(t.type)) return !1;
10150
- let i = rT[t.type];
10148
+ function aT(e, t, n, r) {
10149
+ if (Jw(t.type) || Yw(t.type)) return !1;
10150
+ let i = nT[t.type];
10151
10151
  if (i && i(e, t.payload) !== r) return !1;
10152
- let a = iT[t.type];
10152
+ let a = rT[t.type];
10153
10153
  if (!a) return !0;
10154
- let o = aT(e, r);
10154
+ let o = iT(e, r);
10155
10155
  return a(t.payload).some((e) => o.has(e) || n.has(e));
10156
10156
  }
10157
- var sT = [ka.flow], cT = (e, t) => {
10157
+ var oT = [ka.flow], sT = (e, t) => {
10158
10158
  let n = { flow: /* @__PURE__ */ new Set() }, r = /* @__PURE__ */ new Set();
10159
10159
  return e.pipe(fe((e) => {
10160
10160
  let i = t(), a = !1;
10161
- for (let t of sT) Ra(i, t) && oT(i, e, n[t], t) && (r.add(t), a = !0);
10161
+ for (let t of oT) Ra(i, t) && aT(i, e, n[t], t) && (r.add(t), a = !0);
10162
10162
  return a;
10163
- }), _e(qw, {
10163
+ }), _e(Kw, {
10164
10164
  leading: !1,
10165
10165
  trailing: !0
10166
10166
  })).subscribe(() => {
10167
10167
  let e = t(), i = [...r];
10168
10168
  r.clear();
10169
- for (let t of i) Ra(e, t) && (Ew(e, t), n[t] = aT(e, t));
10169
+ for (let t of i) Ra(e, t) && (Tw(e, t), n[t] = iT(e, t));
10170
10170
  });
10171
- }, lT = [
10171
+ }, cT = [
10172
10172
  mc,
10173
10173
  Pc,
10174
10174
  uf,
@@ -10187,7 +10187,7 @@ var sT = [ka.flow], cT = (e, t) => {
10187
10187
  hp,
10188
10188
  _p,
10189
10189
  Kf
10190
- ], uT = [xp], dT = [
10190
+ ], lT = [xp], uT = [
10191
10191
  Wa,
10192
10192
  Ka,
10193
10193
  Ja,
@@ -10198,46 +10198,46 @@ var sT = [ka.flow], cT = (e, t) => {
10198
10198
  io,
10199
10199
  oo,
10200
10200
  co
10201
- ], fT = [
10201
+ ], dT = [
10202
10202
  [[
10203
10203
  lp,
10204
10204
  xp,
10205
10205
  Il,
10206
10206
  Bl
10207
- ], Ww],
10207
+ ], Uw],
10208
10208
  [[
10209
10209
  lp,
10210
10210
  Tp,
10211
10211
  Il,
10212
10212
  Bl
10213
- ], Gw],
10214
- [lT, Jw],
10213
+ ], Ww],
10214
+ [cT, qw],
10215
10215
  [[
10216
+ ...cT,
10216
10217
  ...lT,
10217
- ...uT,
10218
- ...dT
10219
- ], cT]
10220
- ], pT = [[[Il, Bl], (e, t, n) => e.pipe(ve(5, void 0, {
10218
+ ...uT
10219
+ ], sT]
10220
+ ], fT = [[[Il, Bl], (e, t, n) => e.pipe(ve(5, void 0, {
10221
10221
  leading: !1,
10222
10222
  trailing: !0
10223
10223
  })).subscribe(() => {
10224
10224
  let e = t();
10225
- ss(e, n), Ew(e);
10225
+ ss(e, n), Tw(e);
10226
10226
  })], [[If], (e, t) => e.pipe(ge(le)).subscribe(() => {
10227
10227
  let { doc: e, editor: n } = t(), r = n.drawRelationship?.start;
10228
10228
  !r || e.tableIds.includes(r.tableId) || (n.drawRelationship = null);
10229
- })]], mT = (e) => e.pipe(ge(le)), hT = [
10230
- [[xp], (e, t) => mT(e).subscribe(({ payload: { id: e } }) => {
10229
+ })]], pT = (e) => e.pipe(ge(le)), mT = [
10230
+ [[xp], (e, t) => pT(e).subscribe(({ payload: { id: e } }) => {
10231
10231
  let { collections: n } = t(), r = C(n).collection("tableColumnEntities").selectById(e);
10232
10232
  r && R(r.options, A.primaryKey) && (R(r.options, A.notNull) || (r.options |= A.notNull));
10233
10233
  })],
10234
- [[uf], (e, t) => mT(e).subscribe(({ payload: { id: e, end: n } }) => {
10234
+ [[uf], (e, t) => pT(e).subscribe(({ payload: { id: e, end: n } }) => {
10235
10235
  let { doc: { relationshipIds: r }, collections: i } = t();
10236
10236
  if (!r.includes(e)) return;
10237
10237
  let a = C(i).collection("tableColumnEntities").selectByIds(n.columnIds);
10238
10238
  for (let e of a) e.ui.keys = e.ui.keys | j.foreignKey;
10239
10239
  })],
10240
- [[ff], (e, t) => mT(e).subscribe(({ payload: { id: e } }) => {
10240
+ [[ff], (e, t) => pT(e).subscribe(({ payload: { id: e } }) => {
10241
10241
  let { doc: { relationshipIds: n }, collections: r } = t();
10242
10242
  if (n.includes(e)) return;
10243
10243
  let i = C(r).collection("relationshipEntities").selectById(e);
@@ -10245,7 +10245,7 @@ var sT = [ka.flow], cT = (e, t) => {
10245
10245
  let a = C(r).collection("tableColumnEntities").selectByIds(i.end.columnIds);
10246
10246
  for (let e of a) e.ui.keys = e.ui.keys & ~j.foreignKey;
10247
10247
  })],
10248
- [[Il, Bl], (e, t) => mT(e).subscribe(() => {
10248
+ [[Il, Bl], (e, t) => pT(e).subscribe(() => {
10249
10249
  let { doc: e, collections: n } = t(), r = C(n).collection("relationshipEntities").selectByIds(e.relationshipIds), i = C(n).collection("tableEntities").selectByIds(e.tableIds), a = /* @__PURE__ */ new Set(), o = C(n).collection("tableColumnEntities");
10250
10250
  for (let { end: e } of r) {
10251
10251
  let t = o.selectByIds(e.columnIds);
@@ -10256,13 +10256,13 @@ var sT = [ka.flow], cT = (e, t) => {
10256
10256
  for (let e of t) R(e.ui.keys, j.foreignKey) && !a.has(e.id) && (e.ui.keys = e.ui.keys & ~j.foreignKey);
10257
10257
  }
10258
10258
  })]
10259
- ], gT = [
10260
- ...pT,
10261
- ...hT,
10262
- ...fT
10259
+ ], hT = [
10260
+ ...fT,
10261
+ ...mT,
10262
+ ...dT
10263
10263
  ];
10264
- function _T(e) {
10265
- let t = () => e.state, n = gT.map(([n, r]) => {
10264
+ function gT(e) {
10265
+ let t = () => e.state, n = hT.map(([n, r]) => {
10266
10266
  let i = new ce();
10267
10267
  return {
10268
10268
  pattern: M(n.map(String)),
@@ -10279,4 +10279,4 @@ function _T(e) {
10279
10279
  } };
10280
10280
  }
10281
10281
  //#endregion
10282
- export { Fx as $, Ue as $a, Di as $i, zc as $n, bo as $r, Yp as $t, SS as A, gt as Aa, Pa as Ai, fu as An, Ls as Ar, Bm as At, cS as B, rt as Ba, ha as Bi, Hu as Bn, vs as Br, vm as Bt, wS as C, b as Ca, ja as Ci, Cl as Cn, Bs as Cr, Im as Ct, DS as D, Pt as Da, Aa as Di, Nl as Dn, Os as Dr, Rm as Dt, kS as E, Ot as Ea, ka as Ei, wu as En, Ms as Er, Lm as Et, mS as F, at as Fa, ga as Fi, Ql as Fn, xs as Fr, Am as Ft, tS as G, Ze as Ga, ea as Gi, Tl as Gn, ps as Gr, _m as Gt, iS as H, Ke as Ha, ca as Hi, Rl as Hn, gs as Hr, ym as Ht, uS as I, ct as Ia, ua as Ii, Wl as In, ws as Ir, wm as It, $x as J, Ve as Ja, Xi as Ji, Mu as Jn, cs as Jr, rm as Jt, Gx as K, Be as Ka, Qi as Ki, ou as Kn, is as Kr, gm as Kt, lS as L, ot as La, F as Li, Jl as Ln, Cs as Lr, Dm as Lt, gS as M, pt as Ma, Da as Mi, eu as Mn, Is as Mr, Em as Mt, pS as N, dt as Na, Ta as Ni, nu as Nn, js as Nr, km as Nt, ES as O, bt as Oa, Ma as Oi, Ru as On, Es as Or, Wm as Ot, hS as P, ut as Pa, pa as Pi, Xl as Pn, As as Pr, jm as Pt, Ux as Q, Qe as Qa, Ci as Qi, Kc as Qn, es as Qr, Qp as Qt, aS as R, st as Ra, _a as Ri, Hl as Rn, Ss as Rr, Om as Rt, bS as S, Yt as Sa, L as Si, Su as Sn, Ws as Sr, Fm as St, CS as T, Nt as Ta, Oa as Ti, jl as Tn, Ps as Tr, Hm as Tt, nS as U, Xe as Ua, N as Ui, Wu as Un, _s as Ur, bm as Ut, oS as V, Ye as Va, sa as Vi, gu as Vn, ys as Vr, xm as Vt, rS as W, et as Wa, Ii as Wi, iu as Wn, ms as Wr, hm as Wt, Qx as X, tt as Xa, Pi as Xi, Pu as Xn, ns as Xr, im as Xt, Bx as Y, Ge as Ya, ia as Yi, Au as Yn, ss as Yr, em as Yt, Xx as Z, Je as Za, M as Zi, Bu as Zn, rs as Zr, sm as Zt, RS as _, di as _a, Wa as _i, cd as _n, pc as _r, dx as _t, xC as a, A as aa, ko as ai, W as an, ke as ao, Ys as ar, qx as at, vS as b, C as ba, io as bi, Sl as bn, z as br, Um as bt, eC as c, j as ca, zo as ci, Rf as cn, Ee as co, Pc as cr, Px as ct, YS as d, ai as da, go as di, mf as dn, Ne as do, Sc as dr, Tx as dt, Ei as ea, Po as ei, Xp as en, He as eo, Ec as er, Hx as et, JS as f, si as fa, _o as fi, ff as fn, Zs as fr, Ex as ft, HS as g, T as ga, Qa as gi, Ed as gn, fc as gr, lx as gt, US as h, pi as ha, oo as hi, Gd as hn, nc as hr, ux as ht, yC as i, ti as ia, Eo as ii, Ap as in, Oe as io, gc as ir, Jx as it, _S as j, ht as ja, Ca as ji, mu as jn, Rs as jr, Mm as jt, OS as k, yt as ka, Na as ki, Ou as kn, Ds as kr, zm as kt, $S as l, D as la, R as li, Pf as ln, Le as lo, Oc as lr, Nx as lt, WS as m, O as ma, uo as mi, Vd as mn, oc as mr, ax as mt, Ew as n, gi as na, Ho as ni, Jp as nn, Re as no, wc as nr, Ax as nt, SC as o, E as oa, To as oi, Yf as on, Pe as oo, Ic as or, Kx as ot, GS as p, fi as pa, vo as pi, Xd as pn, sc as pr, cx as pt, eS as q, qe as qa, aa as qi, Iu as qn, Jo as qr, nm as qt, bC as r, _i as ra, Oo as ri, Up as rn, Fe as ro, Mc as rr, Yx as rt, vC as s, yi as sa, No as si, Bf as sn, Ie as so, bc as sr, Mx as st, _T as t, li as ta, Bo as ti, Zp as tn, We as to, vc as tr, jx as tt, QS as u, k as ua, ho as ui, _f as un, je as uo, mc as ur, Vx as ut, IS as v, w as va, Ja as vi, rd as vn, cc as vr, rx as vt, TS as w, Ht as wa, I as wi, bu as wn, Us as wr, Vm as wt, AS as x, er as xa, La as xi, xl as xn, Hs as xr, Pm as xt, MS as y, ei as ya, co as yi, td as yn, uc as yr, nx as yt, sS as z, lt as za, fa as zi, Kl as zn, bs as zr, Sm as zt };
10282
+ export { Hx as $, He as $a, Ei as $i, Ec as $n, Po as $r, Xp as $t, _S as A, ht as Aa, Ca as Ai, mu as An, Rs as Ar, Mm as At, oS as B, Ye as Ba, sa as Bi, gu as Bn, ys as Br, xm as Bt, TS as C, Ht as Ca, I as Ci, bu as Cn, Us as Cr, Vm as Ct, ES as D, bt as Da, Ma as Di, Ru as Dn, Es as Dr, Wm as Dt, DS as E, Pt as Ea, Aa as Ei, Nl as En, Os as Er, Rm as Et, uS as F, ct as Fa, ua as Fi, Wl as Fn, ws as Fr, wm as Ft, Gx as G, Be as Ga, Qi as Gi, ou as Gn, is as Gr, gm as Gt, nS as H, Xe as Ha, N as Hi, Wu as Hn, _s as Hr, bm as Ht, lS as I, ot as Ia, F as Ii, Jl as In, Cs as Ir, Dm as It, Bx as J, Ge as Ja, ia as Ji, Au as Jn, ss as Jr, em as Jt, eS as K, qe as Ka, aa as Ki, Iu as Kn, Jo as Kr, nm as Kt, aS as L, st as La, _a as Li, Hl as Ln, Ss as Lr, Om as Lt, pS as M, dt as Ma, Ta as Mi, nu as Mn, js as Mr, km as Mt, hS as N, ut as Na, pa as Ni, Xl as Nn, As as Nr, jm as Nt, OS as O, yt as Oa, Na as Oi, Ou as On, Ds as Or, zm as Ot, mS as P, at as Pa, ga as Pi, Ql as Pn, xs as Pr, Am as Pt, Fx as Q, Ue as Qa, Di as Qi, zc as Qn, bo as Qr, Yp as Qt, sS as R, lt as Ra, fa as Ri, Kl as Rn, bs as Rr, Sm as Rt, wS as S, b as Sa, ja as Si, Cl as Sn, Bs as Sr, Im as St, kS as T, Ot as Ta, ka as Ti, wu as Tn, Ms as Tr, Lm as Tt, rS as U, et as Ua, Ii as Ui, iu as Un, ms as Ur, hm as Ut, iS as V, Ke as Va, ca as Vi, Rl as Vn, gs as Vr, ym as Vt, tS as W, Ze as Wa, ea as Wi, Tl as Wn, ps as Wr, _m as Wt, Xx as X, Je as Xa, M as Xi, Bu as Xn, rs as Xr, sm as Xt, Qx as Y, tt as Ya, Pi as Yi, Pu as Yn, ns as Yr, im as Yt, Ux as Z, Qe as Za, Ci as Zi, Kc as Zn, es as Zr, Qp as Zt, IS as _, w as _a, Ja as _i, rd as _n, cc as _r, rx as _t, bC as a, E as aa, To as ai, Yf as an, Pe as ao, Ic as ar, Kx as at, AS as b, er as ba, La as bi, xl as bn, Hs as br, Pm as bt, $S as c, D as ca, R as ci, Pf as cn, Le as co, Oc as cr, Nx as ct, JS as d, si as da, _o as di, ff as dn, Zs as dr, Ex as dt, li as ea, Bo as ei, Zp as en, We as eo, vc as er, jx as et, GS as f, fi as fa, vo as fi, Xd as fn, sc as fr, cx as ft, RS as g, di as ga, Wa as gi, cd as gn, pc as gr, dx as gt, HS as h, T as ha, Qa as hi, Ed as hn, fc as hr, lx as ht, vC as i, A as ia, ko as ii, W as in, ke as io, Ys as ir, qx as it, gS as j, pt as ja, Da as ji, eu as jn, Is as jr, Em as jt, SS as k, gt as ka, Pa as ki, fu as kn, Ls as kr, Bm as kt, QS as l, k as la, ho as li, _f as ln, je as lo, mc as lr, Vx as lt, US as m, pi as ma, oo as mi, Gd as mn, nc as mr, ux as mt, Tw as n, _i as na, Oo as ni, Up as nn, Fe as no, Mc as nr, Yx as nt, xC as o, yi as oa, No as oi, Bf as on, Ie as oo, bc as or, Mx as ot, WS as p, O as pa, uo as pi, Vd as pn, oc as pr, ax as pt, $x as q, Ve as qa, Xi as qi, Mu as qn, cs as qr, rm as qt, yC as r, ti as ra, Eo as ri, Ap as rn, Oe as ro, gc as rr, Jx as rt, _C as s, j as sa, zo as si, Rf as sn, Ee as so, Pc as sr, Px as st, gT as t, gi as ta, Ho as ti, Jp as tn, Re as to, wc as tr, Ax as tt, YS as u, ai as ua, go as ui, mf as un, Ne as uo, Sc as ur, Tx as ut, MS as v, ei as va, co as vi, td as vn, uc as vr, nx as vt, CS as w, Nt as wa, Oa as wi, jl as wn, Ps as wr, Hm as wt, bS as x, Yt as xa, L as xi, Su as xn, Ws as xr, Fm as xt, vS as y, C as ya, io as yi, Sl as yn, z as yr, Um as yt, cS as z, rt as za, ha as zi, Hu as zn, vs as zr, vm as zt };