@synnaxlabs/x 0.24.1 → 0.26.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.
Files changed (165) hide show
  1. package/.turbo/turbo-build.log +43 -42
  2. package/dist/binary.cjs +1 -3
  3. package/dist/binary.js +2 -98
  4. package/dist/bounds-CpboA0q6.js +127 -0
  5. package/dist/bounds-ZZc1c-_Z.cjs +1 -0
  6. package/dist/bounds.cjs +1 -1
  7. package/dist/bounds.js +1 -1
  8. package/dist/{box-C92jYSNY.js → box-B5SaODGu.js} +5 -8
  9. package/dist/{box-m3dlc1kR.cjs → box-C6r0YnKB.cjs} +1 -1
  10. package/dist/box.cjs +1 -1
  11. package/dist/box.js +1 -1
  12. package/dist/caseconv.cjs +1 -1
  13. package/dist/caseconv.js +1 -1
  14. package/dist/compare.cjs +1 -1
  15. package/dist/compare.js +1 -1
  16. package/dist/deep.cjs +1 -1
  17. package/dist/deep.js +35 -51
  18. package/dist/{dimensions-BAuHfd-b.js → dimensions-D-1PnJVI.js} +1 -2
  19. package/dist/dimensions.js +1 -1
  20. package/dist/{external-DI9122wF.js → external-CO221aaF.js} +4 -8
  21. package/dist/index-BGz7XJIe.cjs +1 -0
  22. package/dist/index-C9i674Sf.js +41 -0
  23. package/dist/{index-BhEWuRmo.cjs → index-CvHP07Bs.cjs} +1 -1
  24. package/dist/index-CzjnpuXF.js +101 -0
  25. package/dist/{index-IGDDLWef.js → index-DCwgKLH_.js} +7 -13
  26. package/dist/index-tYmAULd8.cjs +3 -0
  27. package/dist/index.cjs +2 -2
  28. package/dist/index.js +135 -120
  29. package/dist/{location-c3g6WKs-.cjs → location-55G2uRZN.cjs} +1 -1
  30. package/dist/{location-CfP9TAnW.js → location-C6sCnzhU.js} +1 -1
  31. package/dist/location.cjs +1 -1
  32. package/dist/location.js +1 -1
  33. package/dist/observe.cjs +1 -1
  34. package/dist/observe.js +2 -3
  35. package/dist/path-Coj1BKMh.cjs +1 -0
  36. package/dist/path-DH9iaDDf.js +58 -0
  37. package/dist/{position-B_aphAR0.js → position-BY9oBMZB.js} +4 -6
  38. package/dist/{position-BBnkwGX1.cjs → position-BwmbckCe.cjs} +1 -1
  39. package/dist/position.cjs +1 -1
  40. package/dist/position.js +1 -1
  41. package/dist/runtime.js +1 -1
  42. package/dist/{scale-CgtgqlYU.js → scale-BgCpxgAk.js} +42 -40
  43. package/dist/scale-COuYv97b.cjs +1 -0
  44. package/dist/scale.cjs +1 -1
  45. package/dist/scale.js +1 -1
  46. package/dist/search.js +1 -2
  47. package/dist/series-CNcMldp_.cjs +11 -0
  48. package/dist/{series-w7kOJP17.js → series-CaeAWaDJ.js} +247 -269
  49. package/dist/spatial.cjs +1 -1
  50. package/dist/spatial.js +7 -7
  51. package/dist/src/binary/encoder.d.ts +11 -11
  52. package/dist/src/binary/encoder.d.ts.map +1 -1
  53. package/dist/src/caseconv/caseconv.d.ts +41 -4
  54. package/dist/src/caseconv/caseconv.d.ts.map +1 -1
  55. package/dist/src/caseconv/caseconv.spec.d.ts +2 -0
  56. package/dist/src/caseconv/caseconv.spec.d.ts.map +1 -0
  57. package/dist/src/change/change.d.ts.map +1 -1
  58. package/dist/src/clamp/clamp.d.ts +3 -1
  59. package/dist/src/clamp/clamp.d.ts.map +1 -1
  60. package/dist/src/compare/compare.d.ts +1 -1
  61. package/dist/src/compare/compare.d.ts.map +1 -1
  62. package/dist/src/control/control.d.ts.map +1 -1
  63. package/dist/src/debounce/debounce.d.ts.map +1 -1
  64. package/dist/src/deep/copy.d.ts.map +1 -1
  65. package/dist/src/deep/delete.d.ts.map +1 -1
  66. package/dist/src/deep/difference.d.ts.map +1 -1
  67. package/dist/src/deep/equal.d.ts +8 -2
  68. package/dist/src/deep/equal.d.ts.map +1 -1
  69. package/dist/src/deep/merge.d.ts +1 -1
  70. package/dist/src/deep/merge.d.ts.map +1 -1
  71. package/dist/src/deep/path.d.ts +1 -3
  72. package/dist/src/deep/path.d.ts.map +1 -1
  73. package/dist/src/errors/errors.d.ts +12 -0
  74. package/dist/src/errors/errors.d.ts.map +1 -0
  75. package/dist/src/errors/index.d.ts +2 -0
  76. package/dist/src/errors/index.d.ts.map +1 -0
  77. package/dist/src/id/id.d.ts +4 -0
  78. package/dist/src/id/id.d.ts.map +1 -0
  79. package/dist/src/id/index.d.ts +2 -0
  80. package/dist/src/id/index.d.ts.map +1 -0
  81. package/dist/src/identity.d.ts.map +1 -1
  82. package/dist/src/index.d.ts +2 -0
  83. package/dist/src/index.d.ts.map +1 -1
  84. package/dist/src/math/math.d.ts.map +1 -1
  85. package/dist/src/migrate/migrate.d.ts +3 -3
  86. package/dist/src/migrate/migrate.d.ts.map +1 -1
  87. package/dist/src/mock/MockGLBufferController.d.ts +1 -1
  88. package/dist/src/numeric/index.d.ts +2 -0
  89. package/dist/src/numeric/index.d.ts.map +1 -0
  90. package/dist/src/numeric/numeric.d.ts +3 -0
  91. package/dist/src/numeric/numeric.d.ts.map +1 -0
  92. package/dist/src/record.d.ts +1 -1
  93. package/dist/src/record.d.ts.map +1 -1
  94. package/dist/src/runtime/os.d.ts.map +1 -1
  95. package/dist/src/search.d.ts +1 -1
  96. package/dist/src/search.d.ts.map +1 -1
  97. package/dist/src/shallowCopy.d.ts.map +1 -1
  98. package/dist/src/spatial/bounds/bounds.d.ts +19 -17
  99. package/dist/src/spatial/bounds/bounds.d.ts.map +1 -1
  100. package/dist/src/spatial/box/box.d.ts +1 -14
  101. package/dist/src/spatial/box/box.d.ts.map +1 -1
  102. package/dist/src/spatial/dimensions/dimensions.d.ts +1 -1
  103. package/dist/src/spatial/direction/direction.d.ts +1 -1
  104. package/dist/src/spatial/direction/direction.d.ts.map +1 -1
  105. package/dist/src/spatial/location/location.d.ts +3 -3
  106. package/dist/src/spatial/location/location.d.ts.map +1 -1
  107. package/dist/src/spatial/position/position.d.ts +2 -2
  108. package/dist/src/spatial/position/position.d.ts.map +1 -1
  109. package/dist/src/spatial/scale/scale.d.ts +27 -23
  110. package/dist/src/spatial/scale/scale.d.ts.map +1 -1
  111. package/dist/src/spatial/xy/xy.d.ts +1 -1
  112. package/dist/src/spatial/xy/xy.d.ts.map +1 -1
  113. package/dist/src/telem/series.d.ts +3 -3
  114. package/dist/src/telem/series.d.ts.map +1 -1
  115. package/dist/src/telem/telem.d.ts +2 -2
  116. package/dist/src/telem/telem.d.ts.map +1 -1
  117. package/dist/src/toArray.d.ts.map +1 -1
  118. package/dist/src/unique.d.ts.map +1 -1
  119. package/dist/src/url/url.d.ts.map +1 -1
  120. package/dist/src/zodutil/zodutil.d.ts +1 -1
  121. package/dist/telem.cjs +1 -1
  122. package/dist/telem.js +1 -1
  123. package/dist/url.cjs +1 -1
  124. package/dist/url.js +1 -1
  125. package/dist/worker.cjs +1 -1
  126. package/dist/worker.js +1 -1
  127. package/dist/{xy-D1ZbIqpT.js → xy-CrgPnICw.js} +1 -2
  128. package/dist/xy.js +1 -1
  129. package/dist/zodutil.cjs +1 -1
  130. package/dist/zodutil.js +2 -3
  131. package/package.json +8 -8
  132. package/src/binary/encoder.spec.ts +13 -13
  133. package/src/binary/encoder.ts +15 -13
  134. package/src/caseconv/caseconv.spec.ts +121 -0
  135. package/src/caseconv/caseconv.ts +117 -14
  136. package/src/clamp/clamp.ts +5 -3
  137. package/src/compare/compare.ts +2 -2
  138. package/src/deep/delete.spec.ts +38 -1
  139. package/src/deep/delete.ts +1 -2
  140. package/src/deep/path.ts +0 -7
  141. package/src/errors/errors.ts +17 -0
  142. package/src/errors/index.ts +1 -0
  143. package/src/id/id.ts +14 -0
  144. package/src/id/index.ts +10 -0
  145. package/src/index.ts +2 -0
  146. package/src/numeric/index.ts +1 -0
  147. package/src/numeric/numeric.ts +6 -0
  148. package/src/record.ts +1 -1
  149. package/src/spatial/bounds/bounds.spec.ts +47 -0
  150. package/src/spatial/bounds/bounds.ts +36 -20
  151. package/src/spatial/scale/scale.spec.ts +5 -5
  152. package/src/spatial/scale/scale.ts +75 -59
  153. package/src/telem/series.spec.ts +17 -3
  154. package/src/telem/series.ts +12 -8
  155. package/src/telem/telem.spec.ts +25 -2
  156. package/src/telem/telem.ts +1 -1
  157. package/tsconfig.tsbuildinfo +1 -1
  158. package/dist/bounds-Bh_QBZZK.cjs +0 -1
  159. package/dist/bounds-Dmn-hd_-.js +0 -129
  160. package/dist/index-BpCPHf78.cjs +0 -1
  161. package/dist/index-BwkQTA-j.js +0 -360
  162. package/dist/path-BO4pyGZf.cjs +0 -1
  163. package/dist/path-nTHmt_4i.js +0 -65
  164. package/dist/scale-C8axypQ2.cjs +0 -1
  165. package/dist/series-Cgjkfl5S.cjs +0 -11
package/dist/index.js CHANGED
@@ -1,62 +1,76 @@
1
1
  var $ = Object.defineProperty;
2
- var h = (e, r, t) => r in e ? $(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
- var p = (e, r, t) => (h(e, typeof r != "symbol" ? r + "" : r, t), t);
4
- import { binary as L } from "./binary.js";
5
- import { b as _ } from "./index-BwkQTA-j.js";
6
- import { c as q } from "./change-DLl6DccR.js";
7
- import { c as I, s as K } from "./scale-CgtgqlYU.js";
8
- import { i as S, a as w } from "./index-IGDDLWef.js";
9
- import { c as U, b as F, p as H } from "./index-IGDDLWef.js";
2
+ var M = (e, r, t) => r in e ? $(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
+ var m = (e, r, t) => M(e, typeof r != "symbol" ? r + "" : r, t);
4
+ import { e as _ } from "./index-CzjnpuXF.js";
5
+ import { a as I } from "./index-C9i674Sf.js";
6
+ import { c as Q } from "./change-DLl6DccR.js";
7
+ import { c as F, s as H } from "./scale-BgCpxgAk.js";
8
+ import { i as w, a as E } from "./index-DCwgKLH_.js";
9
+ import { c as X, b as Y, p as ee } from "./index-DCwgKLH_.js";
10
10
  import { z as i } from "zod";
11
- import { debounce as X, throttle as Y } from "./debounce.js";
12
- import { deep as re } from "./deep.js";
13
- import { isObject as te } from "./identity.js";
14
- import { kv as ne } from "./kv.js";
15
- import { b as ae, m as ce } from "./bounds-Dmn-hd_-.js";
16
- import { observe as fe } from "./observe.js";
17
- import { getEntries as pe, unknownRecordZ as ue } from "./record.js";
18
- import { e as xe } from "./external-DI9122wF.js";
19
- import { Search as be } from "./search.js";
20
- import { b as ve } from "./box-C92jYSNY.js";
21
- import { d as he } from "./dimensions-BAuHfd-b.js";
22
- import { d as we } from "./direction-CScbfCdT.js";
23
- import { l as Me } from "./location-CfP9TAnW.js";
24
- import { p as je } from "./position-B_aphAR0.js";
25
- import { s as Re } from "./spatial-DozyssiN.js";
26
- import { x as ze } from "./xy-D1ZbIqpT.js";
27
- import { d as De, D as Ne, M as Ae, R as Ee, S as Pe, e as Ce, c as Le, b as We, T as _e, a as Be, g as qe, i as Ge, f as Ie, t as Ke } from "./series-w7kOJP17.js";
28
- import { nullToArr as Ue, toArray as Fe } from "./toArray.js";
29
- import { unique as Je } from "./unique.js";
30
- import { URL as Ye, buildQueryString as er } from "./url.js";
31
- import { RoutedWorker as or, TypedWorker as tr, createMockWorkers as sr } from "./worker.js";
11
+ import { debounce as oe, throttle as te } from "./debounce.js";
12
+ import { deep as ne } from "./deep.js";
13
+ import { d as ae, D as ce, M as le, R as fe, S as me, e as pe, c as ue, b as ge, T as de, a as xe, g as be, h as ye, i as Se, f as ve, t as he } from "./series-CaeAWaDJ.js";
14
+ import { isObject as Me } from "./identity.js";
15
+ import { kv as Ee } from "./kv.js";
16
+ import { b as je, m as ke } from "./bounds-CpboA0q6.js";
17
+ import { observe as Ae } from "./observe.js";
18
+ import { getEntries as ze, unknownRecordZ as Ve } from "./record.js";
19
+ import { e as Ne } from "./external-CO221aaF.js";
20
+ import { Search as Ge } from "./search.js";
21
+ import { b as Le } from "./box-B5SaODGu.js";
22
+ import { d as We } from "./dimensions-D-1PnJVI.js";
23
+ import { d as _e } from "./direction-CScbfCdT.js";
24
+ import { l as Ie } from "./location-C6sCnzhU.js";
25
+ import { p as Qe } from "./position-BY9oBMZB.js";
26
+ import { s as Fe } from "./spatial-DozyssiN.js";
27
+ import { x as Je } from "./xy-CrgPnICw.js";
28
+ import { nullToArr as Ye, toArray as er } from "./toArray.js";
29
+ import { unique as or } from "./unique.js";
30
+ import { URL as sr, buildQueryString as nr } from "./url.js";
31
+ import { RoutedWorker as ar, TypedWorker as cr, createMockWorkers as lr } from "./worker.js";
32
32
  const a = class a extends Number {
33
33
  };
34
- p(a, "Absolute", 255), p(a, "Default", 1), p(a, "z", i.union([
34
+ m(a, "Absolute", 255), m(a, "Default", 1), m(a, "z", i.union([
35
35
  i.instanceof(a),
36
36
  i.number().int().min(0).max(255).transform((r) => new a(r)),
37
37
  i.instanceof(Number).transform((r) => new a(r))
38
38
  ]));
39
- let u = a;
40
- const d = i.object({
39
+ let g = a;
40
+ const y = i.object({
41
41
  name: i.string(),
42
42
  key: i.string()
43
43
  }), T = (e) => i.object({
44
- subject: d,
44
+ subject: y,
45
45
  resource: e,
46
- authority: u.z
47
- }), M = (...e) => (r) => r.filter((t) => {
46
+ authority: g.z
47
+ }), j = (...e) => (r) => r.filter((t) => {
48
48
  let o = !1;
49
49
  return t.to != null && (o = e.includes(t.to.resource)), t.from != null && !o && (o = e.includes(t.from.resource)), o;
50
- }), Z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
50
+ }), N = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
51
51
  __proto__: null,
52
- Authority: u,
53
- filterTransfersByChannelKey: M,
52
+ Authority: g,
53
+ filterTransfersByChannelKey: j,
54
54
  stateZ: T,
55
- subjectZ: d
56
- }, Symbol.toStringTag, { value: "Module" })), D = (e) => e ? -1 : 1, x = i.string().regex(/^\d+\.\d+\.\d+$/), g = (e, r) => {
57
- const t = x.parse(e), o = x.parse(r), [c, f, m] = t.split(".").map(Number), [l, s, n] = o.split(".").map(Number);
58
- return c !== l ? c - l : f !== s ? f - s : m - n;
59
- }, b = (e, r) => S(g(e, r)), k = (e, r) => w(g(e, r)), j = ({
55
+ subjectZ: y
56
+ }, Symbol.toStringTag, { value: "Module" })), c = class c extends Error {
57
+ constructor() {
58
+ super(c.MESSAGE);
59
+ }
60
+ /** Returns true if the error or message is a cancellation error" */
61
+ matches(r) {
62
+ return typeof r == "string" ? r.includes(c.MESSAGE) : r instanceof c || r.message.includes(c.MESSAGE);
63
+ }
64
+ };
65
+ m(c, "MESSAGE", "canceled");
66
+ let x = c;
67
+ const k = new x(), Z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
68
+ __proto__: null,
69
+ CANCELED: k
70
+ }, Symbol.toStringTag, { value: "Module" })), G = (e) => e ? -1 : 1, b = i.string().regex(/^\d+\.\d+\.\d+$/), d = (e, r) => {
71
+ const t = b.parse(e), o = b.parse(r), [l, p, u] = t.split(".").map(Number), [f, s, n] = o.split(".").map(Number);
72
+ return l !== f ? l - f : p !== s ? p - s : u - n;
73
+ }, S = (e, r) => w(d(e, r)), O = (e, r) => E(d(e, r)), A = ({
60
74
  name: e,
61
75
  migrate: r
62
76
  }) => (t) => {
@@ -66,14 +80,14 @@ const d = i.object({
66
80
  } catch (o) {
67
81
  throw console.log(`${e} failed to migrate from ${t.version}`), console.error(o), o;
68
82
  }
69
- }, O = ({
83
+ }, R = ({
70
84
  name: e,
71
85
  migrations: r,
72
86
  targetSchema: t,
73
87
  def: o
74
88
  }) => {
75
- const c = Object.keys(r).sort(g).pop();
76
- if (c == null)
89
+ const l = Object.keys(r).sort(d).pop();
90
+ if (l == null)
77
91
  return (s) => {
78
92
  if (s.version !== o.version)
79
93
  return console.log(
@@ -87,95 +101,96 @@ const d = i.object({
87
101
  return console.log(`${e} failed to parse default. Exiting with default`), console.error(n), o;
88
102
  }
89
103
  };
90
- const f = Object.keys(r).length;
91
- let m = !1;
92
- const l = (s) => {
104
+ const p = Object.keys(r).length;
105
+ let u = !1;
106
+ const f = (s) => {
93
107
  try {
94
- if (f === 0 || b(s.version, c))
95
- return console.log(m ? `${e} ${s.version} now up to date` : `${e} version ${s.version} is up to date with target version ${o.version}`), s;
96
- const n = s.version, y = r[n], v = y(s);
97
- return m = !0, l(v);
108
+ if (p === 0 || S(s.version, l))
109
+ return console.log(u ? `${e} ${s.version} now up to date` : `${e} version ${s.version} is up to date with target version ${o.version}`), s;
110
+ const n = s.version, v = r[n], h = v(s);
111
+ return u = !0, f(h);
98
112
  } catch (n) {
99
113
  return console.log(
100
- `${e} failed to migrate from ${s.version} to ${c}`
114
+ `${e} failed to migrate from ${s.version} to ${l}`
101
115
  ), console.error(n), o;
102
116
  }
103
117
  };
104
118
  return (s) => {
105
119
  try {
106
- return l(s);
120
+ return f(s);
107
121
  } catch (n) {
108
122
  return console.log(`${e} failed to parse final result. Exiting with default`), console.error(n), o;
109
123
  }
110
124
  };
111
- }, N = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
125
+ }, P = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
112
126
  __proto__: null,
113
- compareSemVer: g,
114
- createMigration: j,
115
- migrator: O,
116
- semVerNewer: b,
117
- semVerOlder: k,
118
- semVerZ: x
119
- }, Symbol.toStringTag, { value: "Module" })), A = (e) => {
127
+ compareSemVer: d,
128
+ createMigration: A,
129
+ migrator: R,
130
+ semVerNewer: S,
131
+ semVerOlder: O,
132
+ semVerZ: b
133
+ }, Symbol.toStringTag, { value: "Module" })), L = (e) => {
120
134
  if (e === void 0 || typeof e == "string" || typeof e == "number")
121
135
  return e;
122
- if (e.toString === void 0)
123
- throw new Error("invalid renderer");
136
+ if (e.toString === void 0) throw new Error("invalid renderer");
124
137
  return e.toString();
125
- }, E = (e) => Array.isArray(e) ? [...e] : typeof e == "object" && e !== null ? { ...e } : e;
138
+ }, C = (e) => Array.isArray(e) ? [...e] : typeof e == "object" && e !== null ? { ...e } : e;
126
139
  export {
127
- De as DataType,
128
- Ne as Density,
129
- Ae as MultiSeries,
130
- Ee as Rate,
131
- or as RoutedWorker,
132
- be as Search,
133
- Pe as Series,
134
- Ce as Size,
135
- Le as TimeRange,
136
- We as TimeSpan,
137
- _e as TimeStamp,
138
- tr as TypedWorker,
139
- Ye as URL,
140
- Be as addSamples,
141
- L as binary,
142
- ae as bounds,
143
- ve as box,
144
- er as buildQueryString,
145
- _ as caseconv,
146
- q as change,
147
- I as clamp,
148
- U as compare,
149
- Z as control,
150
- qe as convertDataType,
151
- A as convertRenderV,
152
- sr as createMockWorkers,
153
- X as debounce,
154
- re as deep,
155
- he as dimensions,
156
- we as direction,
157
- pe as getEntries,
158
- D as invert,
159
- Ge as isCrudeSeries,
160
- te as isObject,
161
- F as isStringer,
162
- Ie as isTelemValue,
163
- ne as kv,
164
- Me as location,
165
- ce as math,
166
- N as migrate,
167
- Ue as nullToArr,
168
- fe as observe,
169
- je as position,
170
- H as primitiveIsZero,
171
- xe as runtime,
172
- K as scale,
173
- E as shallowCopy,
174
- Re as spatial,
175
- Y as throttle,
176
- Fe as toArray,
177
- Ke as typedArrayZ,
178
- Je as unique,
179
- ue as unknownRecordZ,
180
- ze as xy
140
+ ae as DataType,
141
+ ce as Density,
142
+ le as MultiSeries,
143
+ fe as Rate,
144
+ ar as RoutedWorker,
145
+ Ge as Search,
146
+ me as Series,
147
+ pe as Size,
148
+ ue as TimeRange,
149
+ ge as TimeSpan,
150
+ de as TimeStamp,
151
+ cr as TypedWorker,
152
+ sr as URL,
153
+ xe as addSamples,
154
+ _ as binary,
155
+ je as bounds,
156
+ Le as box,
157
+ nr as buildQueryString,
158
+ I as caseconv,
159
+ Q as change,
160
+ F as clamp,
161
+ X as compare,
162
+ N as control,
163
+ be as convertDataType,
164
+ L as convertRenderV,
165
+ lr as createMockWorkers,
166
+ oe as debounce,
167
+ ne as deep,
168
+ We as dimensions,
169
+ _e as direction,
170
+ Z as errors,
171
+ ze as getEntries,
172
+ ye as id,
173
+ G as invert,
174
+ Se as isCrudeSeries,
175
+ Me as isObject,
176
+ Y as isStringer,
177
+ ve as isTelemValue,
178
+ Ee as kv,
179
+ Ie as location,
180
+ ke as math,
181
+ P as migrate,
182
+ Ye as nullToArr,
183
+ Ae as observe,
184
+ Qe as position,
185
+ ee as primitiveIsZero,
186
+ Ne as runtime,
187
+ H as scale,
188
+ C as shallowCopy,
189
+ Fe as spatial,
190
+ te as throttle,
191
+ er as toArray,
192
+ he as typedArrayZ,
193
+ or as unique,
194
+ Ve as unknownRecordZ,
195
+ Je as xy
181
196
  };
@@ -1 +1 @@
1
- "use strict";const u=require("zod"),I=require("./index-BpCPHf78.cjs"),c=require("./base-B48bPNx5.cjs"),R=c.xLocation,g=c.yLocation,h={top:"bottom",right:"left",bottom:"top",left:"right",center:"center"},d={top:"left",right:"top",bottom:"right",left:"bottom",center:"center"},m=c.crudeLocation,s=t=>t instanceof String?t:c.DIRECTIONS.includes(t)?t==="x"?"left":"top":t,_=t=>h[s(t)],A=t=>d[s(t)],i=t=>{const o=s(t);return o==="top"||o==="bottom"?"y":"x"},l=u.z.object({x:c.xLocation.or(c.centerLocation),y:c.yLocation.or(c.centerLocation)}),E=u.z.object({x:c.xLocation,y:c.yLocation}),O=Object.freeze({x:"left",y:"top"}),f=Object.freeze({x:"right",y:"top"}),x=Object.freeze({x:"left",y:"bottom"}),a=Object.freeze({x:"right",y:"bottom"}),T=Object.freeze({x:"center",y:"center"}),b=Object.freeze({x:"center",y:"top"}),L=Object.freeze({x:"center",y:"bottom"}),p=Object.freeze({x:"right",y:"center"}),C=Object.freeze({x:"left",y:"center"}),N=Object.freeze([C,p,b,L,O,f,x,a,T]),j=(t,o)=>t.x===o.x&&t.y===o.y,S=(t,o)=>{if(typeof o=="object"){let e=!0;return"x"in o&&(t.x===o.x||(e=!1)),"y"in o&&(t.y===o.y||(e=!1)),e}return t.x===o||t.y===o},z=t=>[t.x,t.y],y=t=>i(s(t))==="x",M=t=>i(s(t))==="y",P=t=>`${t.x}${I.capitalize(t.y)}`,X=(t,o)=>{let e,n;if(typeof t=="object"&&"x"in t?(e=t.x,n=t.y):(e=s(t),n=s(o??t)),i(e)===i(n)&&e!=="center"&&n!=="center")throw new Error(`[XYLocation] - encountered two locations with the same direction: ${e.toString()} - ${n.toString()}`);const r={...T};return e==="center"?y(n)?[r.x,r.y]=[n,e]:[r.x,r.y]=[e,n]:n==="center"?y(e)?[r.x,r.y]=[e,n]:[r.x,r.y]=[n,e]:y(e)?[r.x,r.y]=[e,n]:[r.x,r.y]=[n,e],r},Y=Object.freeze(Object.defineProperty({__proto__:null,BOTTOM_CENTER:L,BOTTOM_LEFT:x,BOTTOM_RIGHT:a,CENTER:T,CENTER_LOCATIONS:c.CENTER_LOCATIONS,LEFT_CENTER:C,RIGHT_CENTER:p,TOP_CENTER:b,TOP_LEFT:O,TOP_RIGHT:f,XY_LOCATIONS:N,X_LOCATIONS:c.X_LOCATIONS,Y_LOCATIONS:c.Y_LOCATIONS,construct:s,constructXY:X,corner:E,crude:m,direction:i,isX:y,isY:M,location:c.location,outer:c.outerLocation,rotate90:A,swap:_,x:R,xy:l,xyCouple:z,xyEquals:j,xyMatches:S,xyToString:P,y:g},Symbol.toStringTag,{value:"Module"}));exports.BOTTOM_LEFT=x;exports.BOTTOM_RIGHT=a;exports.CENTER=T;exports.TOP_LEFT=O;exports.TOP_RIGHT=f;exports.XY_LOCATIONS=N;exports.corner=E;exports.location=Y;exports.swap=_;exports.xy=l;exports.xyCouple=z;exports.xyEquals=j;exports.xyMatches=S;
1
+ "use strict";const u=require("zod"),I=require("./index-BGz7XJIe.cjs"),c=require("./base-B48bPNx5.cjs"),R=c.xLocation,g=c.yLocation,h={top:"bottom",right:"left",bottom:"top",left:"right",center:"center"},d={top:"left",right:"top",bottom:"right",left:"bottom",center:"center"},m=c.crudeLocation,s=t=>t instanceof String?t:c.DIRECTIONS.includes(t)?t==="x"?"left":"top":t,_=t=>h[s(t)],A=t=>d[s(t)],i=t=>{const o=s(t);return o==="top"||o==="bottom"?"y":"x"},l=u.z.object({x:c.xLocation.or(c.centerLocation),y:c.yLocation.or(c.centerLocation)}),E=u.z.object({x:c.xLocation,y:c.yLocation}),O=Object.freeze({x:"left",y:"top"}),f=Object.freeze({x:"right",y:"top"}),x=Object.freeze({x:"left",y:"bottom"}),a=Object.freeze({x:"right",y:"bottom"}),T=Object.freeze({x:"center",y:"center"}),b=Object.freeze({x:"center",y:"top"}),L=Object.freeze({x:"center",y:"bottom"}),p=Object.freeze({x:"right",y:"center"}),C=Object.freeze({x:"left",y:"center"}),N=Object.freeze([C,p,b,L,O,f,x,a,T]),j=(t,o)=>t.x===o.x&&t.y===o.y,S=(t,o)=>{if(typeof o=="object"){let e=!0;return"x"in o&&(t.x===o.x||(e=!1)),"y"in o&&(t.y===o.y||(e=!1)),e}return t.x===o||t.y===o},z=t=>[t.x,t.y],y=t=>i(s(t))==="x",M=t=>i(s(t))==="y",P=t=>`${t.x}${I.capitalize(t.y)}`,X=(t,o)=>{let e,n;if(typeof t=="object"&&"x"in t?(e=t.x,n=t.y):(e=s(t),n=s(o??t)),i(e)===i(n)&&e!=="center"&&n!=="center")throw new Error(`[XYLocation] - encountered two locations with the same direction: ${e.toString()} - ${n.toString()}`);const r={...T};return e==="center"?y(n)?[r.x,r.y]=[n,e]:[r.x,r.y]=[e,n]:n==="center"?y(e)?[r.x,r.y]=[e,n]:[r.x,r.y]=[n,e]:y(e)?[r.x,r.y]=[e,n]:[r.x,r.y]=[n,e],r},Y=Object.freeze(Object.defineProperty({__proto__:null,BOTTOM_CENTER:L,BOTTOM_LEFT:x,BOTTOM_RIGHT:a,CENTER:T,CENTER_LOCATIONS:c.CENTER_LOCATIONS,LEFT_CENTER:C,RIGHT_CENTER:p,TOP_CENTER:b,TOP_LEFT:O,TOP_RIGHT:f,XY_LOCATIONS:N,X_LOCATIONS:c.X_LOCATIONS,Y_LOCATIONS:c.Y_LOCATIONS,construct:s,constructXY:X,corner:E,crude:m,direction:i,isX:y,isY:M,location:c.location,outer:c.outerLocation,rotate90:A,swap:_,x:R,xy:l,xyCouple:z,xyEquals:j,xyMatches:S,xyToString:P,y:g},Symbol.toStringTag,{value:"Module"}));exports.BOTTOM_LEFT=x;exports.BOTTOM_RIGHT=a;exports.CENTER=T;exports.TOP_LEFT=O;exports.TOP_RIGHT=f;exports.XY_LOCATIONS=N;exports.corner=E;exports.location=Y;exports.swap=_;exports.xy=l;exports.xyCouple=z;exports.xyEquals=j;exports.xyMatches=S;
@@ -1,5 +1,5 @@
1
1
  import { z as O } from "zod";
2
- import { c as m } from "./index-BwkQTA-j.js";
2
+ import { c as m } from "./index-C9i674Sf.js";
3
3
  import { e as f, f as x, y as a, g, D as C, C as z, X as L, Y as h, l as S, h as d } from "./base-DnZzEvvz.js";
4
4
  const N = f, R = a, I = {
5
5
  top: "bottom",
package/dist/location.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./location-c3g6WKs-.cjs");exports.location=o.location;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./location-55G2uRZN.cjs");exports.location=o.location;
package/dist/location.js CHANGED
@@ -1,4 +1,4 @@
1
- import { l } from "./location-CfP9TAnW.js";
1
+ import { l } from "./location-C6sCnzhU.js";
2
2
  export {
3
3
  l as location
4
4
  };
package/dist/observe.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var l=Object.defineProperty;var a=(t,e,r)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var n=(t,e,r)=>(a(t,typeof e!="symbol"?e+"":e,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class h{constructor(e,r){n(this,"handlers");n(this,"transform");this.transform=e,this.handlers=r??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){let r=e;if(this.transform!=null){const[s,o]=this.transform(e);if(!o)return;r=s}this.handlers.forEach((s,o)=>o(r))}}class i{constructor(e){n(this,"handlers");this.handlers=e??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){this.handlers.forEach((r,s)=>s(e))}}const c=Object.freeze(Object.defineProperty({__proto__:null,BaseObserver:i,Observer:h},Symbol.toStringTag,{value:"Module"}));exports.observe=c;
1
+ "use strict";var l=Object.defineProperty;var a=(t,e,r)=>e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var n=(t,e,r)=>a(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class h{constructor(e,r){n(this,"handlers");n(this,"transform");this.transform=e,this.handlers=r??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){let r=e;if(this.transform!=null){const[s,o]=this.transform(e);if(!o)return;r=s}this.handlers.forEach((s,o)=>o(r))}}class i{constructor(e){n(this,"handlers");this.handlers=e??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){this.handlers.forEach((r,s)=>s(e))}}const c=Object.freeze(Object.defineProperty({__proto__:null,BaseObserver:i,Observer:h},Symbol.toStringTag,{value:"Module"}));exports.observe=c;
package/dist/observe.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var h = Object.defineProperty;
2
2
  var l = (s, e, r) => e in s ? h(s, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[e] = r;
3
- var n = (s, e, r) => (l(s, typeof e != "symbol" ? e + "" : e, r), r);
3
+ var n = (s, e, r) => l(s, typeof e != "symbol" ? e + "" : e, r);
4
4
  class o {
5
5
  constructor(e, r) {
6
6
  n(this, "handlers");
@@ -14,8 +14,7 @@ class o {
14
14
  let r = e;
15
15
  if (this.transform != null) {
16
16
  const [t, a] = this.transform(e);
17
- if (!a)
18
- return;
17
+ if (!a) return;
19
18
  r = t;
20
19
  }
21
20
  this.handlers.forEach((t, a) => a(r));
@@ -0,0 +1 @@
1
+ "use strict";const c=(r,t)=>{const s=r.split(".");return s.map((n,o)=>{const e=t(n,o,s);return e==null?null:typeof e=="string"?e:e.join(".")}).filter(n=>n!=null).join(".")},a=(r,t,s={optional:!1})=>{const{optional:l,getter:n=(i,u)=>i[u]}=s,o=t.split(".");if(o.length===1&&o[0]==="")return r;let e=r;for(const i of o){const u=n(e,i);if(u==null){if(l)return null;throw new Error(`Path ${t} does not exist. ${i} is null`)}e=u}return e},f=(r,t,s)=>{const l=t.split(".");let n=r;for(let o=0;o<l.length-1;o++){const e=l[o];if(n[e]==null)throw new Error(`Path ${t} does not exist`);n=n[e]}n[l[l.length-1]]=s},h=(r,t)=>{const s=r.split(".");return t<0?s[s.length+t]:s[t]},p=r=>r.join("."),g=(r,t)=>{try{return a(r,t),!0}catch{return!1}},m=(r,t)=>{if(t.length===0)return!0;const s=r.split("."),l=t.split(".");if(l.length>s.length)return!1;for(let n=0;n<l.length;n++){const o=s[n],e=l[n];if(e!=="*"&&o!==e)return!1}return!0};exports.element=h;exports.get=a;exports.has=g;exports.join=p;exports.pathsMatch=m;exports.set=f;exports.transformPath=c;
@@ -0,0 +1,58 @@
1
+ const c = (r, t) => {
2
+ const e = r.split(".");
3
+ return e.map((n, o) => {
4
+ const s = t(n, o, e);
5
+ return s == null ? null : typeof s == "string" ? s : s.join(".");
6
+ }).filter((n) => n != null).join(".");
7
+ }, i = (r, t, e = { optional: !1 }) => {
8
+ const { optional: l, getter: n = (u, a) => u[a] } = e, o = t.split(".");
9
+ if (o.length === 1 && o[0] === "") return r;
10
+ let s = r;
11
+ for (const u of o) {
12
+ const a = n(s, u);
13
+ if (a == null) {
14
+ if (l) return null;
15
+ throw new Error(`Path ${t} does not exist. ${u} is null`);
16
+ }
17
+ s = a;
18
+ }
19
+ return s;
20
+ }, f = (r, t, e) => {
21
+ const l = t.split(".");
22
+ let n = r;
23
+ for (let o = 0; o < l.length - 1; o++) {
24
+ const s = l[o];
25
+ if (n[s] == null)
26
+ throw new Error(`Path ${t} does not exist`);
27
+ n = n[s];
28
+ }
29
+ n[l[l.length - 1]] = e;
30
+ }, p = (r, t) => {
31
+ const e = r.split(".");
32
+ return t < 0 ? e[e.length + t] : e[t];
33
+ }, h = (r) => r.join("."), g = (r, t) => {
34
+ try {
35
+ return i(r, t), !0;
36
+ } catch {
37
+ return !1;
38
+ }
39
+ }, j = (r, t) => {
40
+ if (t.length === 0) return !0;
41
+ const e = r.split("."), l = t.split(".");
42
+ if (l.length > e.length) return !1;
43
+ for (let n = 0; n < l.length; n++) {
44
+ const o = e[n], s = l[n];
45
+ if (s !== "*" && o !== s)
46
+ return !1;
47
+ }
48
+ return !0;
49
+ };
50
+ export {
51
+ p as e,
52
+ i as g,
53
+ g as h,
54
+ h as j,
55
+ j as p,
56
+ f as s,
57
+ c as t
58
+ };
@@ -1,13 +1,11 @@
1
- import { c as g, x as v, a as I, h as M, w as N, d as X, i as j } from "./box-C92jYSNY.js";
1
+ import { c as g, x as v, a as I, h as M, w as N, d as X, i as j } from "./box-B5SaODGu.js";
2
2
  import { c as w } from "./direction-CScbfCdT.js";
3
- import { x as B, a as h, b as C, C as O, T as R, s as m, X as S } from "./location-CfP9TAnW.js";
3
+ import { x as B, a as h, b as C, C as O, T as R, s as m, X as S } from "./location-C6sCnzhU.js";
4
4
  import { l as Y } from "./base-DnZzEvvz.js";
5
5
  const P = (t) => {
6
- if (t == null)
7
- return { x: void 0, y: void 0 };
6
+ if (t == null) return { x: void 0, y: void 0 };
8
7
  const s = B.safeParse(t);
9
- if (s.success)
10
- return s.data;
8
+ if (s.success) return s.data;
11
9
  const o = Y.safeParse(t);
12
10
  return o.success ? w(o.data) === "x" ? { x: o.data, y: void 0 } : { x: void 0, y: o.data } : t;
13
11
  }, D = ({
@@ -1 +1 @@
1
- "use strict";const n=require("./box-m3dlc1kR.cjs"),T=require("./direction-DZbN47uL.cjs"),r=require("./location-c3g6WKs-.cjs"),b=require("./base-B48bPNx5.cjs"),P=t=>{if(t==null)return{x:void 0,y:void 0};const s=r.xy.safeParse(t);if(s.success)return s.data;const e=b.location.safeParse(t);return e.success?T.construct(e.data)==="x"?{x:e.data,y:void 0}:{x:void 0,y:e.data}:t},N=({container:t,target:s,dialog:e,initial:u,prefer:a,alignments:l=["start"],disable:f=[]})=>{const i=P(u);let x=r.XY_LOCATIONS;if(a!=null){const o=a.map(c=>P(c));x=x.slice().sort((c,p)=>{const d=o.findIndex(g=>r.xyMatches(c,g)),h=o.findIndex(g=>r.xyMatches(p,g));return d>-1&&h>-1?d-h:d>-1?-1:h>-1?1:0})}const O=x.filter(o=>!r.xyEquals(o,r.CENTER)&&(i.x==null||o.x===i.x)&&(i.y==null||o.y===i.y)&&!f.some(c=>r.xyMatches(o,c))).map(o=>l==null?void 0:l.map(c=>[o,c])).flat(),A=n.construct(t),M=n.construct(s),_=n.construct(e);let E=-1/0;const y={location:r.CENTER,adjustedDialog:_};return O.forEach(([o,c])=>{const[p,d]=v({option:o,alignment:c,container:A,target:M,dialog:_});d>E&&(E=d,y.location=o,y.adjustedDialog=p)}),y},v=({option:t,alignment:s,container:e,target:u,dialog:a})=>{const l=L(t,s),f=n.xyLoc(u,t),i=n.constructWithAlternateRoot(f.x,f.y,n.width(a),n.height(a),l,r.TOP_LEFT),x=n.area(n.intersection(i,e));return[i,x]},I={start:"left",center:"center",end:"right"},j={start:"bottom",center:"center",end:"top"},L=(t,s)=>{const e={x:"center",y:"center"};if(t.y!=="center"){e.y=r.swap(t.y);const u=t.x==="left"?r.swap:a=>a;e.x=u(I[s])}else e.x=r.swap(t.x),e.y=j[s];return e},q=Object.freeze(Object.defineProperty({__proto__:null,dialog:N,getRoot:L,parseLocationOptions:P},Symbol.toStringTag,{value:"Module"}));exports.position=q;
1
+ "use strict";const n=require("./box-C6r0YnKB.cjs"),T=require("./direction-DZbN47uL.cjs"),r=require("./location-55G2uRZN.cjs"),b=require("./base-B48bPNx5.cjs"),P=t=>{if(t==null)return{x:void 0,y:void 0};const s=r.xy.safeParse(t);if(s.success)return s.data;const e=b.location.safeParse(t);return e.success?T.construct(e.data)==="x"?{x:e.data,y:void 0}:{x:void 0,y:e.data}:t},N=({container:t,target:s,dialog:e,initial:u,prefer:a,alignments:l=["start"],disable:f=[]})=>{const i=P(u);let x=r.XY_LOCATIONS;if(a!=null){const o=a.map(c=>P(c));x=x.slice().sort((c,p)=>{const d=o.findIndex(g=>r.xyMatches(c,g)),h=o.findIndex(g=>r.xyMatches(p,g));return d>-1&&h>-1?d-h:d>-1?-1:h>-1?1:0})}const O=x.filter(o=>!r.xyEquals(o,r.CENTER)&&(i.x==null||o.x===i.x)&&(i.y==null||o.y===i.y)&&!f.some(c=>r.xyMatches(o,c))).map(o=>l==null?void 0:l.map(c=>[o,c])).flat(),A=n.construct(t),M=n.construct(s),_=n.construct(e);let E=-1/0;const y={location:r.CENTER,adjustedDialog:_};return O.forEach(([o,c])=>{const[p,d]=v({option:o,alignment:c,container:A,target:M,dialog:_});d>E&&(E=d,y.location=o,y.adjustedDialog=p)}),y},v=({option:t,alignment:s,container:e,target:u,dialog:a})=>{const l=L(t,s),f=n.xyLoc(u,t),i=n.constructWithAlternateRoot(f.x,f.y,n.width(a),n.height(a),l,r.TOP_LEFT),x=n.area(n.intersection(i,e));return[i,x]},I={start:"left",center:"center",end:"right"},j={start:"bottom",center:"center",end:"top"},L=(t,s)=>{const e={x:"center",y:"center"};if(t.y!=="center"){e.y=r.swap(t.y);const u=t.x==="left"?r.swap:a=>a;e.x=u(I[s])}else e.x=r.swap(t.x),e.y=j[s];return e},q=Object.freeze(Object.defineProperty({__proto__:null,dialog:N,getRoot:L,parseLocationOptions:P},Symbol.toStringTag,{value:"Module"}));exports.position=q;
package/dist/position.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./position-BBnkwGX1.cjs");exports.position=o.position;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./position-BwmbckCe.cjs");exports.position=o.position;
package/dist/position.js CHANGED
@@ -1,4 +1,4 @@
1
- import { p as i } from "./position-B_aphAR0.js";
1
+ import { p as i } from "./position-BY9oBMZB.js";
2
2
  export {
3
3
  i as position
4
4
  };
package/dist/runtime.js CHANGED
@@ -1,4 +1,4 @@
1
- import { e as m } from "./external-DI9122wF.js";
1
+ import { e as m } from "./external-CO221aaF.js";
2
2
  export {
3
3
  m as runtime
4
4
  };
@@ -1,30 +1,32 @@
1
- var B = Object.defineProperty;
2
- var R = (r, t, e) => t in r ? B(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var i = (r, t, e) => (R(r, typeof t != "symbol" ? t + "" : t, e), e);
4
- import { z as v } from "zod";
5
- import { c as y } from "./bounds-Dmn-hd_-.js";
6
- import { e as T, f as x, y as h, c as E } from "./box-C92jYSNY.js";
7
- import { b as I } from "./location-CfP9TAnW.js";
8
- import { b as w, c as M } from "./xy-D1ZbIqpT.js";
9
- const Y = (r, t, e) => (t != null && (r = Math.max(r, t)), e != null && (r = Math.min(r, e)), r), j = v.object({ offset: w, scale: w }), z = (r) => (t, e, s, n) => e === "dimension" ? [t, s] : [t, n ? s - r : s + r], D = (r) => (t, e, s, n) => [t, n ? s / r : s * r], L = (r) => (t, e, s) => {
10
- if (t === null)
11
- return [r, s];
12
- const { lower: n, upper: o } = t, { lower: u, upper: p } = r, m = o - n, d = p - u;
13
- if (e === "dimension")
14
- return [r, s * (d / m)];
15
- const g = (s - n) * (d / m) + u;
16
- return [r, g];
1
+ var g = Object.defineProperty;
2
+ var B = (r, t, e) => t in r ? g(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var i = (r, t, e) => B(r, typeof t != "symbol" ? t + "" : t, e);
4
+ import { z as R } from "zod";
5
+ import { c as l } from "./bounds-CpboA0q6.js";
6
+ import { e as T, f as x, y as h, c as E } from "./box-B5SaODGu.js";
7
+ import { b as I } from "./location-C6sCnzhU.js";
8
+ import { b as w, c as Y } from "./xy-CrgPnICw.js";
9
+ const j = (r, t, e) => t !== void 0 && r < t ? t : e !== void 0 && r > e ? e : r, z = R.object({ offset: w, scale: w }), D = (r) => (t, e, s, n) => e === "dimension" ? [t, s] : [
10
+ t,
11
+ n ? s - r : s + r
12
+ ], L = (r) => (t, e, s, n) => [
13
+ t,
14
+ n ? s / r : s * r
15
+ ], M = (r) => (t, e, s) => {
16
+ if (t === null) return [r, s];
17
+ const { lower: n, upper: o } = t, { lower: a, upper: p } = r, d = o - n, m = p - a;
18
+ if (e === "dimension") return [r, s * (m / d)];
19
+ const v = (s - n) * (m / d) + a;
20
+ return [r, v];
17
21
  }, N = (r) => (t, e, s) => [r, s], O = () => (r, t, e) => {
18
- if (r === null)
19
- throw new Error("cannot invert without bounds");
20
- if (t === "dimension")
21
- return [r, e];
22
+ if (r === null) throw new Error("cannot invert without bounds");
23
+ if (t === "dimension") return [r, e];
22
24
  const { lower: s, upper: n } = r;
23
25
  return [r, n - (e - s)];
24
26
  }, U = (r) => (t, e, s) => {
25
27
  const { lower: n, upper: o } = r;
26
- return s = Y(s, n, o), [t, s];
27
- }, a = class a {
28
+ return s = j(s, n, o), [t, s];
29
+ }, u = class u {
28
30
  constructor() {
29
31
  i(this, "ops", []);
30
32
  i(this, "currBounds", null);
@@ -33,32 +35,32 @@ const Y = (r, t, e) => (t != null && (r = Math.max(r, t)), e != null && (r = Mat
33
35
  this.ops = [];
34
36
  }
35
37
  static translate(t) {
36
- return new a().translate(t);
38
+ return new u().translate(t);
37
39
  }
38
40
  static magnify(t) {
39
- return new a().magnify(t);
41
+ return new u().magnify(t);
40
42
  }
41
43
  static scale(t, e) {
42
- return new a().scale(t, e);
44
+ return new u().scale(t, e);
43
45
  }
44
46
  translate(t) {
45
- const e = this.new(), s = z(t);
47
+ const e = this.new(), s = D(t);
46
48
  return s.type = "translate", e.ops.push(s), e;
47
49
  }
48
50
  magnify(t) {
49
- const e = this.new(), s = D(t);
51
+ const e = this.new(), s = L(t);
50
52
  return s.type = "magnify", e.ops.push(s), e;
51
53
  }
52
54
  scale(t, e) {
53
- const s = y(t, e), n = this.new(), o = L(s);
55
+ const s = l(t, e), n = this.new(), o = M(s);
54
56
  return o.type = "scale", n.ops.push(o), n;
55
57
  }
56
58
  clamp(t, e) {
57
- const s = y(t, e), n = this.new(), o = U(s);
59
+ const s = l(t, e), n = this.new(), o = U(s);
58
60
  return o.type = "clamp", n.ops.push(o), n;
59
61
  }
60
62
  reBound(t, e) {
61
- const s = y(t, e), n = this.new(), o = N(s);
63
+ const s = l(t, e), n = this.new(), o = N(s);
62
64
  return o.type = "re-bound", n.ops.push(o), n;
63
65
  }
64
66
  invert() {
@@ -74,7 +76,7 @@ const Y = (r, t, e) => (t != null && (r = Math.max(r, t)), e != null && (r = Mat
74
76
  return this.exec("dimension", t);
75
77
  }
76
78
  new() {
77
- const t = new a();
79
+ const t = new u();
78
80
  return t.ops = this.ops.slice(), t.reversed = this.reversed, t;
79
81
  }
80
82
  exec(t, e) {
@@ -88,9 +90,9 @@ const Y = (r, t, e) => (t != null && (r = Math.max(r, t)), e != null && (r = Mat
88
90
  t.ops.reverse();
89
91
  const e = [];
90
92
  return t.ops.forEach((s, n) => {
91
- if (s.type === "scale" || e.some(([u, p]) => n >= u && n <= p))
93
+ if (s.type === "scale" || e.some(([a, p]) => n >= a && n <= p))
92
94
  return;
93
- const o = t.ops.findIndex((u, p) => u.type === "scale" && p > n);
95
+ const o = t.ops.findIndex((a, p) => a.type === "scale" && p > n);
94
96
  o !== -1 && e.push([n, o]);
95
97
  }), e.forEach(([s, n]) => {
96
98
  const o = t.ops.slice(s, n);
@@ -98,8 +100,8 @@ const Y = (r, t, e) => (t != null && (r = Math.max(r, t)), e != null && (r = Mat
98
100
  }), t.reversed = !t.reversed, t;
99
101
  }
100
102
  };
101
- i(a, "IDENTITY", new a());
102
- let l = a;
103
+ i(u, "IDENTITY", new u());
104
+ let y = u;
103
105
  const X = (r) => ({
104
106
  scale: {
105
107
  x: r.x.dim(1),
@@ -110,7 +112,7 @@ const X = (r) => ({
110
112
  y: r.y.pos(0)
111
113
  }
112
114
  }), c = class c {
113
- constructor(t = new l(), e = new l(), s = null) {
115
+ constructor(t = new y(), e = new y(), s = null) {
114
116
  i(this, "x");
115
117
  i(this, "y");
116
118
  i(this, "currRoot");
@@ -138,7 +140,7 @@ const X = (r) => ({
138
140
  return new c().reBound(t);
139
141
  }
140
142
  translate(t, e) {
141
- const s = M(t, e), n = this.copy();
143
+ const s = Y(t, e), n = this.copy();
142
144
  return n.x = this.x.translate(s.x), n.y = this.y.translate(s.y), n;
143
145
  }
144
146
  translateX(t) {
@@ -194,12 +196,12 @@ i(c, "IDENTITY", new c());
194
196
  let f = c;
195
197
  const k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
196
198
  __proto__: null,
197
- Scale: l,
199
+ Scale: y,
198
200
  XY: f,
199
- crudeXYTransform: j,
201
+ crudeXYTransform: z,
200
202
  xyScaleToTransform: X
201
203
  }, Symbol.toStringTag, { value: "Module" }));
202
204
  export {
203
- Y as c,
205
+ j as c,
204
206
  k as s
205
207
  };