@genome-spy/app 1.1.1 → 1.3.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 (96) hide show
  1. package/dist/{SharedReadCache-Ey5QIiPM.js → SharedReadCache-9sT2aIxW.js} +6 -12
  2. package/dist/__vite-browser-external-Dgu_Ldik.js +7 -0
  3. package/dist/{agentApi-sPuuT0KS.js → agentApi-BclFF9zB.js} +9981 -8914
  4. package/dist/agentApi.es.js +6783 -5135
  5. package/dist/agentShared.es.js +433 -460
  6. package/dist/arrayUtils-Bm7QnzhN.js +1306 -0
  7. package/dist/{blosc-JROzDOnd.js → blosc-C-W97QwH.js} +3 -3
  8. package/dist/{canvas2d-iDK4BC5j.js → canvas2d-8MSf70d4.js} +141 -134
  9. package/dist/{canvas2d-MXaFeZnP.js → canvas2d-BwGNI_Rx.js} +147 -141
  10. package/dist/clipOptions-SrrxeAEU.js +4316 -0
  11. package/dist/clipOptions-clBEbkjv.js +4326 -0
  12. package/dist/{layoutResult-D50MSHXR.js → color-jETn8xK_.js} +29 -10
  13. package/dist/color-uTRRsy8i.js +116 -0
  14. package/dist/{componentStyles-DGtQXvwc.js → componentStyles-C7FbjS-a.js} +1 -1
  15. package/dist/{viewIdentityRegistry-BIYd4TE0.js → containerView-BItRtKqu.js} +28 -31
  16. package/dist/{viewIdentityRegistry-BDKkEjXl.js → containerView-CWa6ZIJW.js} +28 -31
  17. package/dist/{debug-DbigmdrK.js → debug-23s-jja_.js} +10 -9
  18. package/dist/{debug-BlqDxTw3.js → debug-CWRxvAss.js} +9 -10
  19. package/dist/dialog.es.js +1 -1
  20. package/dist/dist-CmY6iewb.js +1501 -0
  21. package/dist/dist-D6xbz5Ks.js +1501 -0
  22. package/dist/{esm-CjkeZi__.js → esm-BFwBAnbO.js} +25 -25
  23. package/dist/esm-BUkWqSr2.js +299 -0
  24. package/dist/{esm-C-6g-SkZ.js → esm-C0xXMLsR.js} +37 -41
  25. package/dist/{esm-CJeszW-t.js → esm-C2xhhXs0.js} +7 -7
  26. package/dist/esm-C6erfjPM.js +252 -0
  27. package/dist/{esm-DFHFX1sH.js → esm-CVjC7qA4.js} +34 -38
  28. package/dist/esm-CqY5ezGz.js +1249 -0
  29. package/dist/esm-DfMIJ_N2.js +1522 -0
  30. package/dist/esm-Dls41IbZ.js +787 -0
  31. package/dist/{esm-Bv7Frz7C.js → esm-DzQDfrsZ.js} +7 -10
  32. package/dist/esm-aGLCvYRP.js +238 -0
  33. package/dist/{esm-VFJeyk9i.js → esm-nzwgJFGz.js} +40 -36
  34. package/dist/figWigMetadataSourceAdapter-8Kf_vZRf.js +36 -0
  35. package/dist/figWigMetadataSourceAdapter-DdDMZpYO.js +36 -0
  36. package/dist/flowNode-BSjy0Wz3.js +1306 -0
  37. package/dist/flowOutput-D5qpxWe0.js +183 -0
  38. package/dist/index.es.js +4766 -5522
  39. package/dist/index.js +1089 -685
  40. package/dist/inflate-BdC5KvHn.js +886 -0
  41. package/dist/{lz4-CUYSbVey.js → lz4-BLPgBOlE.js} +1 -1
  42. package/dist/markUtils-RaatLEa-.js +78 -0
  43. package/dist/{metadataChannels-DV62inJh.js → metadataChannels-DLSmx7kU.js} +6 -3
  44. package/dist/metadataUtils-DxEPe0vj.js +879 -0
  45. package/dist/order-BnKzKjt4.js +1151 -0
  46. package/dist/order-BpJnq_nV.js +1150 -0
  47. package/dist/{parquetRead-0hFIa3Cc.js → parquetRead-D-yY8njE.js} +3 -11
  48. package/dist/{rasterExport-B62RmAK1.js → rasterExport-B-WrX1pa.js} +5 -5
  49. package/dist/{rasterExport-DQH3hVg_.js → rasterExport-C_vx4Jwd.js} +4 -4
  50. package/dist/{rasterization-B05bDo5e.js → rasterization-QktH8Sn2.js} +26 -19
  51. package/dist/rectangle-BAdoDPXu.js +194 -0
  52. package/dist/{rectangle-DE98gIxF.js → rectangle-DZTR6NFQ.js} +10 -1
  53. package/dist/renderCanvas2D-CsRO78Pq.js +291 -0
  54. package/dist/{renderCanvas2D-Bdv-B4wj.js → renderCanvas2D-Y7pkRzbC.js} +98 -92
  55. package/dist/{rolldown-runtime-DF993M8W.js → rolldown-runtime-DeIk2rA4.js} +1 -1
  56. package/dist/{indexer-DbFTKGlm.js → scaleNull-CVzag4z8.js} +2 -12
  57. package/dist/{indexer-En7gpvLN.js → scaleNull-Pbz7QGnl.js} +2 -12
  58. package/dist/{scalePosition-ByvlXaML.js → scalePosition-CRXa0rCC.js} +8 -1
  59. package/dist/schema.json +33403 -16929
  60. package/dist/style.css +1 -1
  61. package/dist/{svg-N3tj05-e.js → svg-BBMtLgtM.js} +445 -362
  62. package/dist/{svg-DHsq1RpV.js → svg-JjWL6U-T.js} +464 -381
  63. package/dist/{svgRasterizer-CYVDlt5z.js → svgRasterizer-6OcftuoI.js} +3 -3
  64. package/dist/{svgRasterizer-CvCBlxLj.js → svgRasterizer-DkNRaCPs.js} +4 -4
  65. package/dist/tableMetadataSourceAdapter-CUNwLsdi.js +291 -0
  66. package/dist/tableMetadataSourceAdapter-DQrEXCo6.js +1283 -0
  67. package/dist/url-DeOdSRrv.js +183 -0
  68. package/dist/viewError-B0TMfOpB.js +33 -0
  69. package/dist/viewError-D9aO90cI.js +33 -0
  70. package/dist/{viewSelectors-DDLW-byr.js → viewSelectors-DkFvo33d.js} +914 -752
  71. package/dist/{viewSelectors-j-F9XwsE.js → viewSelectors-lM93fHAq.js} +942 -780
  72. package/dist/viewUtils-0SJOewM6.js +6195 -0
  73. package/dist/webgl-CXIO3OQz.js +5782 -0
  74. package/dist/webgl-Pdvfhio5.js +5783 -0
  75. package/package.json +7 -5
  76. package/src/agentApi/index.d.ts +3 -2
  77. package/src/agentShared/index.d.ts +2 -0
  78. package/src/appTypes.d.ts +1 -6
  79. package/src/embedTypes.d.ts +36 -1
  80. package/src/index.d.ts +6 -0
  81. package/src/spec/sampleView.d.ts +68 -13
  82. package/src/spec/view.d.ts +44 -5
  83. package/src/state/paramProvenanceTypes.d.ts +25 -2
  84. package/src/state.d.ts +14 -52
  85. package/dist/clipOptions-B5PibDq3.js +0 -2923
  86. package/dist/clipOptions-Cba4I0AO.js +0 -2903
  87. package/dist/esm-Dndm-NaA.js +0 -1193
  88. package/dist/order-B4uR9Q04.js +0 -1062
  89. package/dist/order-BSPy5DI8.js +0 -1062
  90. package/dist/renderCanvas2D-ChdoHGrU.js +0 -285
  91. package/dist/vega-scale-Byaw1K8O.js +0 -2446
  92. package/dist/vega-scale-Ctz_wa3z.js +0 -2443
  93. package/dist/viewError-BiR9VCgL.js +0 -29
  94. package/dist/viewUtils-JX6CMEYH.js +0 -6664
  95. package/dist/webgl-DdmOwEH0.js +0 -5544
  96. package/dist/webgl-Dw8xqZpX.js +0 -5544
@@ -1,16 +1,16 @@
1
- import { Kt as e, ct as t, et as n, o as r, s as i } from "./clipOptions-B5PibDq3.js";
2
- import { v as a } from "./vega-scale-Ctz_wa3z.js";
1
+ import { ln as e, mt as t, o as n, ot as r, s as i } from "./clipOptions-clBEbkjv.js";
2
+ import { s as a } from "./flowNode-BSjy0Wz3.js";
3
3
  import { t as o } from "./warning-CpIIpk8e.js";
4
- import { t as s } from "./rectangle-DE98gIxF.js";
5
- import { n as c, r as l, t as u } from "./performanceProfiler-CPLEjApa.js";
6
- import { n as d, t as f } from "./layoutResult-D50MSHXR.js";
7
- import { C as p, E as m, F as h, I as g, M as _, N as v, S as y, T as b, _ as x, b as S, c as C, d as w, f as T, g as E, h as ee, i as D, j as O, k, l as te, n as ne, p as re, u as ie, v as ae, x as A } from "./order-BSPy5DI8.js";
8
- import { n as j, t as M } from "./renderCanvas2D-ChdoHGrU.js";
9
- import { t as N } from "./canvasSizeHelper-foL2YvGL.js";
10
- import { exportCanvas as P, exportRaster as F } from "./rasterExport-B62RmAK1.js";
11
- import { createCanvas2DSvgRasterizer as I } from "./svgRasterizer-CvCBlxLj.js";
4
+ import { t as s, u as c } from "./rectangle-BAdoDPXu.js";
5
+ import { n as l, r as u, t as d } from "./performanceProfiler-CPLEjApa.js";
6
+ import { n as f, r as p } from "./color-uTRRsy8i.js";
7
+ import { C as m, D as h, E as g, F as _, L as v, N as y, P as b, R as x, S, _ as C, c as w, d as T, f as E, g as D, i as O, j as k, l as ee, m as te, n as ne, p as re, u as ie, v as ae, w as A, x as j, y as M } from "./order-BpJnq_nV.js";
8
+ import { n as N, t as P } from "./renderCanvas2D-CsRO78Pq.js";
9
+ import { t as F } from "./canvasSizeHelper-foL2YvGL.js";
10
+ import { exportCanvas as I, exportRaster as L } from "./rasterExport-B-WrX1pa.js";
11
+ import { createCanvas2DSvgRasterizer as R } from "./svgRasterizer-DkNRaCPs.js";
12
12
  //#region ../core/src/rendering/canvas2d/picking/softwarePickingRasterizer.js
13
- var L = 12, R = .5, z = class {
13
+ var z = 12, B = .5, V = class {
14
14
  #e = [];
15
15
  #t = [];
16
16
  #n = [
@@ -50,7 +50,7 @@ var L = 12, R = .5, z = class {
50
50
  }
51
51
  setClip(e, t, n, r) {
52
52
  if (!Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r)) throw RangeError("Software picking clip must be finite.");
53
- this.#r = U(Math.floor(Math.min(e, n)), 0, this.buffer.width), this.#i = U(Math.floor(Math.min(t, r)), 0, this.buffer.height), this.#a = U(Math.ceil(Math.max(e, n)), this.#r, this.buffer.width), this.#o = U(Math.ceil(Math.max(t, r)), this.#i, this.buffer.height);
53
+ this.#r = W(Math.floor(Math.min(e, n)), 0, this.buffer.width), this.#i = W(Math.floor(Math.min(t, r)), 0, this.buffer.height), this.#a = W(Math.ceil(Math.max(e, n)), this.#r, this.buffer.width), this.#o = W(Math.ceil(Math.max(t, r)), this.#i, this.buffer.height);
54
54
  }
55
55
  fillRect(e, t, n, r, i) {
56
56
  this.#s++, this.#p(e, t, n, r, i);
@@ -95,24 +95,21 @@ var L = 12, R = .5, z = class {
95
95
  if (!(a > 0) || !Number.isFinite(a)) return;
96
96
  this.#u++;
97
97
  let s = a / 2, c = this.#n;
98
- if (!B(t, n, r, i, this.#r - s, this.#i - s, this.#a + s, this.#o + s, c)) return;
98
+ if (!E(t, n, r, i, this.#r - s, this.#i - s, this.#a + s, this.#o + s, c)) return;
99
99
  let l = c[2] - c[0], u = c[3] - c[1], d = Math.ceil(Math.max(Math.abs(l), Math.abs(u)));
100
- if (d == 0) {
101
- this.#h(e, c[0], c[1], s, o);
102
- return;
103
- }
104
- for (let t = 0; t <= d; t++) {
100
+ if (d == 0) this.#h(e, c[0], c[1], s, o);
101
+ else for (let t = 0; t <= d; t++) {
105
102
  let n = t / d;
106
103
  this.#h(e, c[0] + l * n, c[1] + u * n, s, o);
107
104
  }
108
105
  }
109
- strokeCubic(e, t, n, r, i, a, o, s, c, l, u = R, d) {
106
+ strokeCubic(e, t, n, r, i, a, o, s, c, l, u = B, d) {
110
107
  if (!(l > 0) || !Number.isFinite(l) || !(u > 0) || !Number.isFinite(u) || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r) || !Number.isFinite(i) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c)) return;
111
108
  this.#d++;
112
109
  let f = this.#e;
113
110
  for (f.length = 0, f.push(t, n, r, i, a, o, s, c, 0); f.length;) {
114
111
  let t = f.pop(), n = f.pop(), r = f.pop(), i = f.pop(), a = f.pop(), o = f.pop(), s = f.pop(), c = f.pop(), p = f.pop();
115
- if (t >= L || V(p, c, s, o, a, i, r, n, u)) {
112
+ if (t >= z || H(p, c, s, o, a, i, r, n, u)) {
116
113
  this.strokeSegment(e, p, c, r, n, l, d);
117
114
  continue;
118
115
  }
@@ -138,106 +135,108 @@ var L = 12, R = .5, z = class {
138
135
  }
139
136
  }
140
137
  };
141
- function B(e, t, n, r, i, a, o, s, c) {
142
- if (!Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(r)) return !1;
143
- let l = n - e, u = r - t, d = 0, f = 1;
144
- if (l == 0) {
145
- if (e < i || e > o) return !1;
146
- } else {
147
- let t = (i - e) / l, n = (o - e) / l;
148
- d = Math.max(d, Math.min(t, n)), f = Math.min(f, Math.max(t, n));
149
- }
150
- if (u == 0) {
151
- if (t < a || t > s) return !1;
152
- } else {
153
- let e = (a - t) / u, n = (s - t) / u;
154
- d = Math.max(d, Math.min(e, n)), f = Math.min(f, Math.max(e, n));
155
- }
156
- return d > f ? !1 : (c[0] = e + d * l, c[1] = t + d * u, c[2] = e + f * l, c[3] = t + f * u, !0);
157
- }
158
- function V(e, t, n, r, i, a, o, s, c) {
138
+ function H(e, t, n, r, i, a, o, s, c) {
159
139
  let l = o - e, u = s - t, d = l * l + u * u, f = c * c;
160
140
  if (d == 0) {
161
- let o = H(e, t, n, r), s = H(e, t, i, a);
141
+ let o = U(e, t, n, r), s = U(e, t, i, a);
162
142
  return Math.max(o, s) <= f;
163
143
  }
164
144
  let p = u * (n - e) - l * (r - t), m = u * (i - e) - l * (a - t);
165
145
  return Math.max(p * p, m * m) <= f * d;
166
146
  }
167
- function H(e, t, n, r) {
147
+ function U(e, t, n, r) {
168
148
  let i = n - e, a = r - t;
169
149
  return i * i + a * a;
170
150
  }
171
- function U(e, t, n) {
151
+ function W(e, t, n) {
172
152
  return Math.max(t, Math.min(n, e));
173
153
  }
174
154
  //#endregion
175
155
  //#region ../core/src/rendering/canvas2d/picking/renderers/index.js
176
- var W = 1;
177
- function G(e, t) {
156
+ var G = 1;
157
+ function K(e, t) {
178
158
  let n = e.getType();
179
- return n == "arrow" ? q(e, t) : n == "rect" ? J(e, t) : n == "point" ? oe(e, t) : n == "rule" || n == "tick" ? se(e, t) : n == "link" ? ce(e, t) : n == "text" ? le(e, t) : 0;
159
+ return n == "arrow" ? J(e, t) : n == "rect" ? oe(e, t) : n == "point" ? se(e, t) : n == "rule" || n == "tick" ? ce(e, t) : n == "link" ? le(e, t) : n == "text" ? ue(e, t) : 0;
180
160
  }
181
- function K(e) {
161
+ function q(e) {
182
162
  let t = e.getType();
183
163
  return t == "rect" || t == "arrow" || t == "point" || t == "rule" || t == "tick" || t == "link" || t == "text";
184
164
  }
185
- function q(e, t) {
186
- let n = e, r = y(n), i = Array(8).fill(0);
187
- return b(n, r, t, (e) => {
165
+ function J(e, t) {
166
+ let n = e, r = m(n), i = Array(8).fill(0);
167
+ return g(n, r, t, (e) => {
188
168
  let a = Y(n, e.datum), o = e.strokeWidth / 2;
189
- r.stem && t.rasterizer.strokeSegment(a, e.tail.x, e.tail.y, e.tip.x, e.tip.y, e.stemHalfWidth * 2 + e.strokeWidth), p(e, (n, r, s, c) => {
169
+ r.stem && t.rasterizer.strokeSegment(a, e.tail.x, e.tail.y, e.tip.x, e.tip.y, e.stemHalfWidth * 2 + e.strokeWidth), A(e, (n, r, s, c) => {
190
170
  let l = e.headHalfWidth + o, u = n + s.x * o, d = r + s.y * o, f = e.headRepeatFootprint + o, p = n - s.x * f, m = r - s.y * f;
191
- ue(i, u, d, p, m, c.x, c.y, l), t.rasterizer.fillConvexPolygon(a, i);
171
+ de(i, u, d, p, m, c.x, c.y, l), t.rasterizer.fillConvexPolygon(a, i);
192
172
  });
193
173
  });
194
174
  }
195
- function J(e, t) {
196
- let n = e;
197
- return re(n, T(n), t, (e) => t.rasterizer.fillRect(Y(n, e.datum), e.x, e.y, e.width, e.height));
198
- }
199
175
  function oe(e, t) {
200
- let n = e, r = k(n, n.properties.minPickingSize);
201
- return E(n, ee(n), t, (e) => t.rasterizer.fillSquare(Y(n, e.datum), e.x, e.y, Math.max(e.boundsRadius, r / 2)));
176
+ let n = e;
177
+ return te(n, re(n), t, (e) => t.rasterizer.fillRect(Y(n, e.datum), e.x, e.y, e.width, e.height));
202
178
  }
203
179
  function se(e, t) {
204
- let n = e;
205
- return w(n, ie(n), t, (e) => t.rasterizer.strokeSegment(Y(n, e.datum), e.x1, e.y1, e.x2, e.y2, Math.max(e.strokeWidth, W)));
180
+ let n = e, r = k(n, n.properties.minPickingSize);
181
+ return C(n, D(n), t, (e) => t.rasterizer.fillSquare(Y(n, e.datum), e.x, e.y, Math.max(e.boundsRadius, r / 2)));
206
182
  }
207
183
  function ce(e, t) {
208
- let n = e, r = k(n, n.properties.minPickingSize), i = x(n), a = A(n, i.shape);
209
- return ae(n, i, t, (e) => {
210
- let [i, o, s, c] = e.points, l = a && S(i, c, a);
211
- t.rasterizer.strokeCubic(Y(n, e.datum), i[0], i[1], o[0], o[1], s[0], s[1], c[0], c[1], Math.max(e.strokeWidth, r), void 0, l ? (e, t) => Math.abs(l.normalX * e + l.normalY * t - l.offset) < l.end : void 0);
184
+ let n = e, r = ie(n);
185
+ return T(n, r, t, (e) => {
186
+ let i = e.x2 - e.x1, a = e.y2 - e.y1, o = r.strokeCap === "square" && e.strokeWidth > 0 ? (e.size / 2 + e.strokeWidth) / Math.hypot(i, a) : 0;
187
+ t.rasterizer.strokeSegment(Y(n, e.datum), e.x1 - i * o, e.y1 - a * o, e.x2 + i * o, e.y2 + a * o, Math.max(e.size + 2 * e.strokeWidth, G));
212
188
  });
213
189
  }
214
190
  function le(e, t) {
215
- let n = e, r = t.textMetrics ?? n.unitView.context.textMetrics, i = r.requestFont(n.properties), a = D(r, n.properties);
216
- return te(n, C(n), {
191
+ let n = e, r = k(n, n.properties.minPickingSize), i = ae(n), a = S(n, i.shape);
192
+ return M(n, i, {
193
+ ...t,
194
+ minPickingSize: r
195
+ }, (e) => {
196
+ let { geometry: i } = e;
197
+ if (i.type == "orthogonal") {
198
+ let [a, o, s] = i.points, c = Y(n, e.datum), l = Math.max(e.strokeWidth, r) / 2;
199
+ for (let e = 0; e < 2; e++) {
200
+ let n = i.points[e], r = i.points[e + 1], a = Math.abs(r[0] - n[0]), o = Math.abs(r[1] - n[1]);
201
+ (a != 0 || o != 0) && t.rasterizer.fillRect(c, Math.min(n[0], r[0]) - (a == 0 ? l : 0), Math.min(n[1], r[1]) - (o == 0 ? l : 0), a + (a == 0 ? 2 * l : 0), o + (o == 0 ? 2 * l : 0));
202
+ }
203
+ if ((a[0] != o[0] || a[1] != o[1]) && (s[0] != o[0] || s[1] != o[1])) {
204
+ let e = o[0] + l * (Math.sign(o[0] - a[0]) - Math.sign(s[0] - o[0])), n = o[1] + l * (Math.sign(o[1] - a[1]) - Math.sign(s[1] - o[1]));
205
+ t.rasterizer.fillRect(c, Math.min(o[0], e), Math.min(o[1], n), l, l);
206
+ }
207
+ return;
208
+ }
209
+ let [o, s, c, l] = i.points, u = a && j(o, l, a);
210
+ t.rasterizer.strokeCubic(Y(n, e.datum), o[0], o[1], s[0], s[1], c[0], c[1], l[0], l[1], Math.max(e.strokeWidth, r), void 0, u ? (e, t) => Math.abs(u.normalX * e + u.normalY * t - u.offset) < u.end : void 0);
211
+ });
212
+ }
213
+ function ue(e, t) {
214
+ let n = e, r = t.textMetrics ?? n.unitView.context.textMetrics, i = r.requestFont(n.properties), a = O(r, n.properties);
215
+ return ee(n, w(n), {
217
216
  ...t,
218
217
  fontMeasurement: i,
219
218
  measureLogoInkBounds: a
220
219
  }, (e) => t.rasterizer.fillConvexPolygon(Y(n, e.datum), e.boundsQuad));
221
220
  }
222
- function ue(e, t, n, r, i, a, o, s) {
221
+ function de(e, t, n, r, i, a, o, s) {
223
222
  let c = a * s, l = o * s;
224
223
  e[0] = t + c, e[1] = n + l, e[2] = r + c, e[3] = i + l, e[4] = r - c, e[5] = i - l, e[6] = t - c, e[7] = n - l;
225
224
  }
226
225
  function Y(e, t) {
227
226
  let n = e.encoders;
228
- return m(n.uniqueId, t);
227
+ return h(n.uniqueId, t);
229
228
  }
230
229
  //#endregion
231
230
  //#region ../core/src/rendering/canvas2d/picking/softwarePickingViewRenderingContext.js
232
- var de = class extends d {
231
+ var fe = class extends p {
233
232
  #e = [];
234
233
  #t = /* @__PURE__ */ new Set();
235
234
  #n;
236
- #r = new h();
235
+ #r = new v();
237
236
  #i;
238
237
  #a = [0, 0];
239
238
  constructor(e) {
240
- super({ picking: !0 }), this.width = e.width, this.height = e.height, this.devicePixelRatio = e.devicePixelRatio, this.getRasterizer = e.getRasterizer, this.textMetrics = e.textMetrics, this.#n = c(), this.#i = e.xIndexManager;
239
+ super({ picking: !0 }), this.width = e.width, this.height = e.height, this.devicePixelRatio = e.devicePixelRatio, this.getRasterizer = e.getRasterizer, this.textMetrics = e.textMetrics, this.#n = l(), this.#i = e.xIndexManager;
241
240
  }
242
241
  getDevicePixelRatio() {
243
242
  return this.devicePixelRatio;
@@ -252,23 +251,23 @@ var de = class extends d {
252
251
  if (this.#e.pop()?.view !== e) throw Error("Unbalanced software picking view rendering context stack.");
253
252
  }
254
253
  renderMark(e, t) {
255
- if (!e.isPickingParticipant() || !K(e)) return;
256
- let n = t.sampleFacetRenderingOptions;
257
- if (n && !e.encoders.facetIndex && (this.#n?.addCount("canvasSampleFacetOccurrences"), !j(n))) {
254
+ if (!e.isPickingParticipant() || !q(e)) return;
255
+ let r = t.sampleFacetRenderingOptions;
256
+ if (r && !e.encoders.facetIndex && (this.#n?.addCount("canvasSampleFacetOccurrences"), !N(r))) {
258
257
  this.#n?.addCount("canvasCulledSampleFacetOccurrences");
259
258
  return;
260
259
  }
261
260
  let a = e.unitView.getEffectiveOpacity();
262
261
  if (a <= 0) return;
263
- let s = this.currentCoords, c = r(t), l = i(c, e.properties.clip, s), u = _(this.width, this.height, l);
264
- if (!v(u)) return;
265
- let d = O(s, c, e.properties.cullByVisibleRange), f = this.#i?.prepare(e) ?? !1;
266
- g(e, t, s, this.#r, (t, n) => {
262
+ let s = this.currentCoords, c = n(t), l = i(c, e.properties.clip, s), u = b(this.width, this.height, l);
263
+ if (!_(u)) return;
264
+ let d = y(s, c, e.properties.cullByVisibleRange), f = this.#i?.prepare(e) ?? !1;
265
+ x(e, t, s, this.#r, (t, n) => {
267
266
  if (n.length == 0) return;
268
267
  let r = 0, i = n.length;
269
268
  if (f && this.#i.query(n, this.#a) && (r = this.#a[0], i = this.#a[1], r === i)) return;
270
269
  let o = this.getRasterizer();
271
- o.setClip(u.x1, u.y1, u.x2, u.y2), G(e, {
270
+ o.setClip(u.x1, u.y1, u.x2, u.y2), K(e, {
272
271
  rasterizer: o,
273
272
  coords: t,
274
273
  data: n,
@@ -282,59 +281,51 @@ var de = class extends d {
282
281
  }, (t) => o(`Canvas2D picking could not resolve sample facet index ${t}. View: ${e.unitView.getPathString()}`));
283
282
  }
284
283
  get currentCoords() {
285
- let t = e(this.#e);
286
- if (!t) throw Error("No current view in software picking rendering context.");
287
- return t.coords;
284
+ let e = a(this.#e);
285
+ if (!e) throw Error("No current view in software picking rendering context.");
286
+ return e.coords;
288
287
  }
289
- }, X = 2 ** 31 - 1, fe = -(2 ** 31);
290
- function pe(e, t, r, i = r) {
288
+ }, X = 2 ** 31 - 1, pe = -(2 ** 31);
289
+ function me(e, t, n, i = n) {
291
290
  let a = Array(e);
292
291
  a.fill(X);
293
- let o = fe, s = -Infinity, c = !1, l = Array(e);
292
+ let o = pe, s = -Infinity, c = !1, l = Array(e);
294
293
  l.fill(0);
295
- let u = t[0], d = (t[1] - t[0]) / e, f = (t, r) => {
294
+ let u = t[0], d = (t[1] - t[0]) / e, f = (t, n) => {
296
295
  let i = (t - u) / d, a = Math.floor(i);
297
- return n(r && a == i ? a - 1 : a, 0, e - 1);
296
+ return r(n && a == i ? a - 1 : a, 0, e - 1);
298
297
  };
299
- function p(e, t, n) {
298
+ function p(e, t, r) {
300
299
  if (c) return;
301
300
  if (t > o) o = t;
302
301
  else {
303
302
  c = !0;
304
303
  return;
305
304
  }
306
- let i = r(e);
305
+ let i = n(e);
307
306
  if (!Number.isFinite(i) || i < s) {
308
307
  c = !0;
309
308
  return;
310
309
  }
311
310
  s = i;
312
311
  let u = f(i, !1);
313
- a[u] > t && (a[u] = t), l[u] < n && (l[u] = n);
312
+ a[u] > t && (a[u] = t), l[u] < r && (l[u] = r);
314
313
  }
315
- function m(e, t, n) {
314
+ function m(e, t, r) {
316
315
  if (c) return;
317
316
  if (t > o) o = t;
318
317
  else {
319
318
  c = !0, console.debug("Items (vertices) are not ordered properly. Disabling binned index.");
320
319
  return;
321
320
  }
322
- let u = r(e), d = i(e);
323
- if (!Number.isFinite(u) || !Number.isFinite(d)) {
324
- c = !0;
325
- return;
326
- }
327
- if (u < s) {
328
- c = !0;
329
- return;
330
- }
331
- if (d < u) {
321
+ let u = n(e), d = i(e);
322
+ if (!Number.isFinite(u) || !Number.isFinite(d) || u < s || d < u) {
332
323
  c = !0;
333
324
  return;
334
325
  }
335
326
  s = u;
336
327
  let p = f(u, !1), m = u === d ? p : f(d, !0);
337
- for (let e = p; e <= m; e++) a[e] > t && (a[e] = t), l[e] < n && (l[e] = n);
328
+ for (let e = p; e <= m; e++) a[e] > t && (a[e] = t), l[e] < r && (l[e] = r);
338
329
  }
339
330
  let h = (e, t, n = [0, 0]) => {
340
331
  let r = f(e, !1), i = f(t, !0), o = a[r], s = Math.max(l[i], o);
@@ -346,31 +337,46 @@ function pe(e, t, r, i = r) {
346
337
  for (let t = a.length - 1; t > 0; t--) e && a[t] == X ? (a[t] = l[t], e = !1) : a[t - 1] > a[t] && (a[t - 1] = a[t]);
347
338
  return h;
348
339
  };
349
- return p.getIndex = g, m.getIndex = g, r == i ? p : m;
340
+ return p.getIndex = g, m.getIndex = g, n == i ? p : m;
341
+ }
342
+ //#endregion
343
+ //#region ../core/src/utils/forEachInBatch.js
344
+ var he = 0;
345
+ function ge(e, t) {
346
+ if (e.length > 1e4) Function("data", "visit", `
347
+ // batch loop ${he++}
348
+ for (let i = 0; i < data.length; i++) {
349
+ visit(data[i], i);
350
+ }
351
+ `)(e, t);
352
+ else for (let n = 0; n < e.length; n++) t(e[n], n);
350
353
  }
351
354
  //#endregion
352
355
  //#region ../core/src/rendering/xIndex/markXIndex.js
353
- function me(e, t, n = 0) {
356
+ function _e(e, t, n = 0) {
354
357
  if (!t.length) return;
355
- let r = pe(Math.min(256, Math.ceil(Math.sqrt(t.length))), e.indexDomain, e.xAccessor, e.x2Accessor);
356
- return t.forEach((e, t) => r(e, n + t, n + t + 1)), r.getIndex();
358
+ let r = me(Math.min(256, Math.ceil(Math.sqrt(t.length))), e.indexDomain, e.xAccessor, e.x2Accessor);
359
+ return ge(t, (e, t) => {
360
+ let i = n + t;
361
+ r(e, i, i + 1);
362
+ }), r.getIndex();
357
363
  }
358
- function he(e) {
359
- let n = e.encoders?.x, r = e.encoders?.x2;
360
- if (!n?.channelDef || !("buildIndex" in n.channelDef) || !n.channelDef.buildIndex || !n.scale || !a(n.scale.type) && !["index", "locus"].includes(n.scale.type) || n.branches.length !== 1) return;
361
- let i = e.getType();
362
- if (i !== "point" && i !== "rect") return;
363
- let o = t(n)?.asNumberAccessor();
364
+ function ve(n) {
365
+ let r = n.encoders?.x, i = n.encoders?.x2;
366
+ if (!r?.channelDef || !("buildIndex" in r.channelDef) || !r.channelDef.buildIndex || !r.scale || !e(r.scale.type) && !["index", "locus"].includes(r.scale.type) || r.branches.length !== 1) return;
367
+ let a = n.getType();
368
+ if (a === "point" && c(n, "x") || a !== "point" && a !== "rect") return;
369
+ let o = t(r)?.asNumberAccessor();
364
370
  if (!o) return;
365
371
  let s;
366
- if (r && (r.scale !== n.scale || r.branches.length !== 1 || (s = t(r)?.asNumberAccessor(), !s))) return;
367
- let c = e.unitView.getScaleResolution("x"), l = c?.zoomExtent;
368
- if (!(!c || !l || !Number.isFinite(l[0]) || !Number.isFinite(l[1]) || l[1] <= l[0])) return {
372
+ if (i && (i.scale !== r.scale || i.branches.length !== 1 || (s = t(i)?.asNumberAccessor(), !s))) return;
373
+ let l = n.unitView.getScaleResolution("x"), u = l?.zoomExtent;
374
+ if (!(!l || !u || !Number.isFinite(u[0]) || !Number.isFinite(u[1]) || u[1] <= u[0])) return {
369
375
  xAccessor: o,
370
376
  x2Accessor: s,
371
- scaleResolution: c,
372
- indexDomain: [l[0], l[1]],
373
- domainStartOffset: ["index", "locus"].includes(n.scale.type) ? -1 : 0
377
+ scaleResolution: l,
378
+ indexDomain: [u[0], u[1]],
379
+ domainStartOffset: ["index", "locus"].includes(r.scale.type) ? -1 : 0
374
380
  };
375
381
  }
376
382
  function Z(e, t) {
@@ -381,7 +387,7 @@ function Z(e, t) {
381
387
  }
382
388
  //#endregion
383
389
  //#region ../core/src/rendering/canvas2d/canvasXIndexManager.js
384
- var ge = class {
390
+ var ye = class {
385
391
  #e = /* @__PURE__ */ new WeakMap();
386
392
  #t = [0, 0];
387
393
  #n;
@@ -389,7 +395,7 @@ var ge = class {
389
395
  if (this.#n = void 0, e.encoders.facetIndex) return this.#r();
390
396
  let t = e.unitView.getCollector(), n = e.unitView.getScaleResolution("x"), r = n?.zoomExtent, i = this.#e.get(e);
391
397
  if (!i || i.collector !== t || i.dataRevision !== t.dataRevision || i.xEncoder !== e.encoders.x || i.x2Encoder !== e.encoders.x2 || i.xScaleResolution !== n || i.xIndexDomainStart !== r?.[0] || i.xIndexDomainEnd !== r?.[1]) {
392
- let a = he(e);
398
+ let a = ve(e);
393
399
  i = {
394
400
  collector: t,
395
401
  dataRevision: t.dataRevision,
@@ -408,16 +414,16 @@ var ge = class {
408
414
  query(e, t) {
409
415
  let n = this.#n;
410
416
  if (!n?.spec) throw Error("Canvas x-index query was not prepared.");
411
- u("canvasXIndexNativeItems", e.length);
417
+ d("canvasXIndexNativeItems", e.length);
412
418
  let r = n.batches.get(e);
413
- return r === void 0 && (r = me(n.spec, e) ?? null, n.batches.set(e, r), u("canvasXIndexBuilds"), r || u("canvasXIndexRejectedBuilds")), r ? (r(this.#t[0], this.#t[1], t), u("canvasXIndexQueries"), u("canvasXIndexCandidateItems", t[1] - t[0]), t[0] === t[1] && u("canvasXIndexEmptyRanges"), !0) : this.#r();
419
+ return r === void 0 && (r = _e(n.spec, e) ?? null, n.batches.set(e, r), d("canvasXIndexBuilds"), r || d("canvasXIndexRejectedBuilds")), r ? (r(this.#t[0], this.#t[1], t), d("canvasXIndexQueries"), d("canvasXIndexCandidateItems", t[1] - t[0]), t[0] === t[1] && d("canvasXIndexEmptyRanges"), !0) : this.#r();
414
420
  }
415
421
  #r() {
416
- return u("canvasXIndexFallbackQueries"), !1;
422
+ return d("canvasXIndexFallbackQueries"), !1;
417
423
  }
418
- }, _e = class {
424
+ }, be = class {
419
425
  constructor(e) {
420
- this.viewRoot = e.viewRoot, this.context = e.context, this.surface = e.surface, this.textMetrics = e.textMetrics, this.getBackground = e.getBackground, this.broadcast = e.broadcast, this.onLayoutComputed = e.onLayoutComputed, this.layoutResult = void 0, this.pickingRasterizer = void 0, this.dirtyPickingBuffer = !0, this.xIndexManager = new ge(), this.opacityLayers = [];
426
+ this.viewRoot = e.viewRoot, this.context = e.context, this.surface = e.surface, this.textMetrics = e.textMetrics, this.getBackground = e.getBackground, this.broadcast = e.broadcast, this.onLayoutComputed = e.onLayoutComputed, this.layoutResult = void 0, this.pickingRasterizer = void 0, this.dirtyPickingBuffer = !0, this.xIndexManager = new ye(), this.opacityLayers = [];
421
427
  }
422
428
  computeLayout() {
423
429
  this.broadcast("layout"), this.surface.invalidateSize();
@@ -437,10 +443,10 @@ var ge = class {
437
443
  if (!e) return;
438
444
  let t = this.surface.getLogicalCanvasSize();
439
445
  if (isNaN(t.width) || isNaN(t.height)) return;
440
- let n = c();
446
+ let n = l();
441
447
  n?.beginFrame("canvas");
442
448
  try {
443
- l("render", () => M({
449
+ u("render", () => P({
444
450
  layoutResult: e,
445
451
  context: this.context,
446
452
  width: t.width,
@@ -462,17 +468,17 @@ var ge = class {
462
468
  let t = this.surface.getLogicalCanvasSize();
463
469
  if (isNaN(t.width) || isNaN(t.height)) return;
464
470
  this.surface.clearPickingBuffer();
465
- let n = this.pickingRasterizer, r = !1, i = new de({
471
+ let n = this.pickingRasterizer, r = !1, i = new fe({
466
472
  width: t.width,
467
473
  height: t.height,
468
474
  devicePixelRatio: this.surface.getDevicePixelRatio(),
469
475
  textMetrics: this.textMetrics,
470
- getRasterizer: () => (n || (n = new z(this.surface.getPickingBuffer()), this.pickingRasterizer = n), r ||= (n.resetClip(), n.resetStatistics(), !0), n),
476
+ getRasterizer: () => (n || (n = new V(this.surface.getPickingBuffer()), this.pickingRasterizer = n), r ||= (n.resetClip(), n.resetStatistics(), !0), n),
471
477
  xIndexManager: this.xIndexManager
472
- }), a = c();
478
+ }), a = l();
473
479
  a?.beginFrame("canvas", "picking");
474
480
  try {
475
- l("picking", () => e.collectRenderCommands(i)), this.dirtyPickingBuffer = !1, r && ve(n, a);
481
+ u("picking", () => e.collectRenderCommands(i)), this.dirtyPickingBuffer = !1, r && xe(n, a);
476
482
  } finally {
477
483
  a?.endFrame();
478
484
  }
@@ -488,14 +494,14 @@ var ge = class {
488
494
  });
489
495
  }
490
496
  };
491
- function ve(e, t) {
497
+ function xe(e, t) {
492
498
  if (!t) return;
493
499
  let n = e.getStatistics();
494
500
  t.addCount("pickingRectangles", n.rectangles), t.addCount("pickingSquares", n.squares), t.addCount("pickingPolygons", n.polygons), t.addCount("pickingSegments", n.segments), t.addCount("pickingCubics", n.cubics), t.addCount("pickingSpans", n.spans);
495
501
  }
496
502
  //#endregion
497
503
  //#region ../core/src/rendering/canvas2d/picking/softwarePickingBuffer.js
498
- var Q = /* @__PURE__ */ new Uint32Array(), ye = class {
504
+ var Q = /* @__PURE__ */ new Uint32Array(), Se = class {
499
505
  #e = Q;
500
506
  width = 0;
501
507
  height = 0;
@@ -530,7 +536,7 @@ function $(e, t) {
530
536
  }
531
537
  //#endregion
532
538
  //#region ../core/src/rendering/canvas2d/canvas2DSurface.js
533
- var be = class {
539
+ var Ce = class {
534
540
  #e;
535
541
  #t;
536
542
  #n;
@@ -540,7 +546,7 @@ var be = class {
540
546
  if (!n) throw Error("Unable to initialize a Canvas2D rendering context.");
541
547
  this.canvas = t, this.context = n, e.container.appendChild(t);
542
548
  try {
543
- this.#e = new N(e.container, t, e.sizeSource, () => {
549
+ this.#e = new F(e.container, t, e.sizeSource, () => {
544
550
  this.#i() && e.onCanvasResize();
545
551
  }), this.#i();
546
552
  } catch (e) {
@@ -568,7 +574,7 @@ var be = class {
568
574
  getPickingBuffer() {
569
575
  if (this.#r) throw Error("Canvas2D surface has been finalized.");
570
576
  let e = this.getLogicalCanvasSize();
571
- return this.#n ??= new ye(e.width, e.height), this.#n;
577
+ return this.#n ??= new Se(e.width, e.height), this.#n;
572
578
  }
573
579
  clearPickingBuffer() {
574
580
  this.#n?.clear();
@@ -602,32 +608,32 @@ var be = class {
602
608
  };
603
609
  //#endregion
604
610
  //#region ../core/src/rendering/canvas2d/index.js
605
- function xe(e) {
606
- let t = new be(e), n = ne(e.container.ownerDocument);
611
+ function we(e) {
612
+ let t = new Ce(e), n = ne(e.container.ownerDocument);
607
613
  return {
608
614
  surface: t,
609
615
  textMetrics: n,
610
- createRenderCoordinator: (e) => new _e({
616
+ createRenderCoordinator: (e) => new be({
611
617
  ...e,
612
618
  surface: t,
613
619
  context: t.context,
614
620
  textMetrics: n
615
621
  }),
616
- exportCanvas: (e) => P({
622
+ exportCanvas: (e) => I({
617
623
  ...e,
618
624
  liveSize: t.getLogicalCanvasSize(),
619
625
  liveDevicePixelRatio: t.getDevicePixelRatio(),
620
626
  textMetrics: n
621
627
  }),
622
- exportRaster: (e) => F({
628
+ exportRaster: (e) => L({
623
629
  ...e,
624
630
  liveSize: t.getLogicalCanvasSize(),
625
631
  liveDevicePixelRatio: t.getDevicePixelRatio(),
626
632
  textMetrics: n
627
633
  }),
628
- rasterizeSvgRuns: (e) => I()(e),
634
+ rasterizeSvgRuns: (e) => R()(e),
629
635
  readPickingId: (e, n) => t.readPickingId(e, n)
630
636
  };
631
637
  }
632
638
  //#endregion
633
- export { xe as createCanvas2DRenderingBackend };
639
+ export { we as createCanvas2DRenderingBackend };