@genome-spy/app 0.83.1 → 0.85.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 (45) hide show
  1. package/dist/{agentApi-AxdD95yY.js → agentApi-Cz0hCnVp.js} +6576 -7722
  2. package/dist/agentApi.es.js +3747 -3317
  3. package/dist/agentShared.es.js +18 -18
  4. package/dist/arrayUtils-LJpQOu-U.js +2175 -0
  5. package/dist/bmFontMetrics-CuNB-kNN.js +31 -0
  6. package/dist/canvas2d-DoAXEiF9.js +309 -0
  7. package/dist/canvas2d-f5jl4A5D.js +310 -0
  8. package/dist/canvasSizeHelper-7h_8rOcx.js +56 -0
  9. package/dist/clipOptions-gqdb3fvW.js +43 -0
  10. package/dist/color-W5zffv-z.js +335 -0
  11. package/dist/{componentStyles-BzJWWojD.js → componentStyles-FsNmIb22.js} +5 -1
  12. package/dist/{debug-CI7POTMx.js → debug-BvCZWumf.js} +10 -10
  13. package/dist/{debug-DJKug_38.js → debug-CgDtmspT.js} +7 -5
  14. package/dist/dialog.es.js +1 -1
  15. package/dist/{esm-CGLz7idZ.js → esm-BA6yMcc-.js} +438 -434
  16. package/dist/{esm-D8vvQAP3.js → esm-CcDLRSvC.js} +33 -33
  17. package/dist/{esm-BeV56E_5.js → esm-CfYZhLHN.js} +33 -33
  18. package/dist/{esm-DQ3lJSQN.js → esm-JAiZmFIS.js} +1 -1
  19. package/dist/framebufferReadback-CCLOjStu.js +148 -0
  20. package/dist/framebufferReadback-THWwFqs8.js +1994 -0
  21. package/dist/index.es.js +3735 -3369
  22. package/dist/index.js +743 -616
  23. package/dist/metadataChannels-DV62inJh.js +19 -0
  24. package/dist/nativeText-DMO8gLt7.js +806 -0
  25. package/dist/nativeText-m5AUINMq.js +806 -0
  26. package/dist/paramUtils-BYI4rwyL.js +2195 -0
  27. package/dist/schema.json +2253 -4201
  28. package/dist/style.css +1 -1
  29. package/dist/svg-CCu8kYy2.js +1158 -0
  30. package/dist/svg-yFj875aX.js +1158 -0
  31. package/dist/svgNumber-DNxESJQB.js +11 -0
  32. package/dist/twgl-full.module-DB2UdP1k.js +1849 -0
  33. package/dist/viewIdentityRegistry-BUdkK9zT.js +92 -0
  34. package/dist/{viewIdentityRegistry-CcQdL0Z8.js → viewIdentityRegistry-D3oPbN4O.js} +1 -1
  35. package/dist/viewRenderingContext-HtpqwS_x.js +120 -0
  36. package/dist/viewSelectors-DGCspRN3.js +4198 -0
  37. package/dist/viewSelectors-U5oLCLHV.js +4195 -0
  38. package/dist/{viewUtils-Cybv1tu-.js → viewUtils-Dg4RA40Q.js} +2405 -3983
  39. package/dist/warning-CpIIpk8e.js +7 -0
  40. package/dist/warning-DRGdb6BF.js +59 -0
  41. package/dist/webgl-Ci6ZhCCf.js +54 -0
  42. package/dist/webgl-Dpz8a3TI.js +53 -0
  43. package/package.json +5 -5
  44. package/dist/metadataChannels-fGQOmJj0.js +0 -6732
  45. package/dist/viewIdentityRegistry-EH5-Noyz.js +0 -6827
@@ -1,5 +1,5 @@
1
- import { n as e, r as t } from "./esm-CGLz7idZ.js";
2
- import { t as n } from "./esm-VvpZ9hsq.js";
1
+ import { t as e } from "./esm-VvpZ9hsq.js";
2
+ import { i as t, r as n } from "./esm-BA6yMcc-.js";
3
3
  import { n as r, r as i } from "./esm-BdT7qUL-.js";
4
4
  import { t as a } from "./AbortablePromiseCache-BTmAcN-t.js";
5
5
  //#region ../core/node_modules/@gmod/tabix/esm/chunk.js
@@ -132,13 +132,13 @@ var b = class extends s {
132
132
  coordinateType: i
133
133
  };
134
134
  }
135
- async _parse(t = {}) {
136
- let n = await e(await this.filehandle.readFile(t)), r = new DataView(n.buffer), i;
135
+ async _parse(e = {}) {
136
+ let t = await n(await this.filehandle.readFile(e)), r = new DataView(t.buffer), i;
137
137
  if (r.getUint32(0, !0) === h) i = 1;
138
138
  else if (r.getUint32(0, !0) === g) i = 2;
139
139
  else throw Error("Not a CSI file");
140
140
  this.minShift = r.getInt32(4, !0), this.depth = r.getInt32(8, !0), this.maxBinNumber = ((1 << (this.depth + 1) * 3) - 1) / 7;
141
- let a = 2 ** (this.minShift + this.depth * 3), s = r.getInt32(12, !0), c = s && s >= 30 ? this.parseAuxData(n, 16) : {
141
+ let a = 2 ** (this.minShift + this.depth * 3), s = r.getInt32(12, !0), c = s && s >= 30 ? this.parseAuxData(t, 16) : {
142
142
  refIdToName: [],
143
143
  refNameToId: {},
144
144
  metaChar: void 0,
@@ -152,25 +152,25 @@ var b = class extends s {
152
152
  }, l = r.getInt32(16 + s, !0), u, d = 16 + s + 4, f = Array(l).fill(0).map(() => {
153
153
  let e = r.getInt32(d, !0);
154
154
  d += 4;
155
- let t = {}, i;
155
+ let n = {}, i;
156
156
  for (let a = 0; a < e; a += 1) {
157
157
  let e = r.getUint32(d, !0);
158
- if (e > this.maxBinNumber) i = this.parsePseudoBin(n, d + 4), d += 48;
158
+ if (e > this.maxBinNumber) i = this.parsePseudoBin(t, d + 4), d += 48;
159
159
  else {
160
- let i = m(n, d + 4);
160
+ let i = m(t, d + 4);
161
161
  u = this._findFirstData(u, i);
162
162
  let a = r.getInt32(d + 12, !0);
163
163
  d += 16;
164
164
  let s = Array(a);
165
- for (let t = 0; t < a; t += 1) {
166
- let r = m(n, d), i = m(n, d + 8);
167
- d += 16, s[t] = new o(r, i, e);
165
+ for (let n = 0; n < a; n += 1) {
166
+ let r = m(t, d), i = m(t, d + 8);
167
+ d += 16, s[n] = new o(r, i, e);
168
168
  }
169
- t[e] = s;
169
+ n[e] = s;
170
170
  }
171
171
  }
172
172
  return {
173
- binIndex: t,
173
+ binIndex: n,
174
174
  stats: i
175
175
  };
176
176
  });
@@ -226,8 +226,8 @@ var w = class extends s {
226
226
  let n = await this.parse(t), r = n.refNameToId[e];
227
227
  return r === void 0 || !n.indices[r] ? -1 : n.indices[r].stats?.lineCount ?? -1;
228
228
  }
229
- async _parse(t = {}) {
230
- let n = await e(await this.filehandle.readFile(t)), r = new DataView(n.buffer);
229
+ async _parse(e = {}) {
230
+ let t = await n(await this.filehandle.readFile(e)), r = new DataView(t.buffer);
231
231
  if (r.getUint32(0, !0) !== x) throw Error("Not a TBI file");
232
232
  let i = r.getUint32(4, !0), a = r.getUint32(8, !0), s = a & 65536 ? "zero-based-half-open" : "1-based-closed", c = {
233
233
  0: "generic",
@@ -239,35 +239,35 @@ var w = class extends s {
239
239
  ref: r.getInt32(12, !0),
240
240
  start: r.getInt32(16, !0),
241
241
  end: r.getInt32(20, !0)
242
- }, u = r.getInt32(24, !0), d = 2 ** 29, f = u ? String.fromCharCode(u) : void 0, p = r.getInt32(28, !0), h = r.getInt32(32, !0), { refNameToId: g, refIdToName: _ } = this._parseNameBytes(n.slice(36, 36 + h)), v = 36 + h, y;
242
+ }, u = r.getInt32(24, !0), d = 2 ** 29, f = u ? String.fromCharCode(u) : void 0, p = r.getInt32(28, !0), h = r.getInt32(32, !0), { refNameToId: g, refIdToName: _ } = this._parseNameBytes(t.slice(36, 36 + h)), v = 36 + h, y;
243
243
  return {
244
244
  indices: Array(i).fill(0).map(() => {
245
245
  let e = r.getInt32(v, !0);
246
246
  v += 4;
247
- let t = {}, i;
247
+ let n = {}, i;
248
248
  for (let a = 0; a < e; a += 1) {
249
249
  let e = r.getUint32(v, !0);
250
250
  if (v += 4, e > 37450) throw Error("tabix index contains too many bins, please use a CSI index");
251
251
  if (e === 37450) {
252
252
  let e = r.getInt32(v, !0);
253
- v += 4, e === 2 && (i = this.parsePseudoBin(n, v)), v += 16 * e;
253
+ v += 4, e === 2 && (i = this.parsePseudoBin(t, v)), v += 16 * e;
254
254
  } else {
255
255
  let i = r.getInt32(v, !0);
256
256
  v += 4;
257
257
  let a = Array(i);
258
- for (let t = 0; t < i; t += 1) {
259
- let r = m(n, v), i = m(n, v + 8);
260
- v += 16, y = this._findFirstData(y, r), a[t] = new o(r, i, e);
258
+ for (let n = 0; n < i; n += 1) {
259
+ let r = m(t, v), i = m(t, v + 8);
260
+ v += 16, y = this._findFirstData(y, r), a[n] = new o(r, i, e);
261
261
  }
262
- t[e] = a;
262
+ n[e] = a;
263
263
  }
264
264
  }
265
265
  let a = r.getInt32(v, !0);
266
266
  v += 4;
267
267
  let s = Array(a);
268
- for (let e = 0; e < a; e += 1) s[e] = m(n, v), v += 8, y = this._findFirstData(y, s[e]);
268
+ for (let e = 0; e < a; e += 1) s[e] = m(t, v), v += 8, y = this._findFirstData(y, s[e]);
269
269
  return {
270
- binIndex: t,
270
+ binIndex: n,
271
271
  linearIndex: s,
272
272
  stats: i
273
273
  };
@@ -305,11 +305,11 @@ var w = class extends s {
305
305
  return f(l, d);
306
306
  }
307
307
  }, T = class {
308
- constructor({ path: e, filehandle: t, url: o, tbiPath: s, tbiUrl: c, tbiFilehandle: l, csiPath: u, csiUrl: d, csiFilehandle: f, renameRefSeqs: p, chunkCacheSize: m = 5 * 2 ** 20 }) {
309
- this.cache = new n({ maxSize: 1e3 });
308
+ constructor({ path: t, filehandle: n, url: o, tbiPath: s, tbiUrl: c, tbiFilehandle: l, csiPath: u, csiUrl: d, csiFilehandle: f, renameRefSeqs: p, chunkCacheSize: m = 5 * 2 ** 20 }) {
309
+ this.cache = new e({ maxSize: 1e3 });
310
310
  let h = p ?? ((e) => e);
311
- if (t) this.filehandle = t;
312
- else if (e) this.filehandle = new r(e);
311
+ if (n) this.filehandle = n;
312
+ else if (t) this.filehandle = new r(t);
313
313
  else if (o) this.filehandle = new i(o);
314
314
  else throw TypeError("must provide either filehandle or path");
315
315
  if (l) this.index = new w({
@@ -328,8 +328,8 @@ var w = class extends s {
328
328
  filehandle: new r(u),
329
329
  renameRefSeqs: h
330
330
  });
331
- else if (e) this.index = new w({
332
- filehandle: new r(`${e}.tbi`),
331
+ else if (t) this.index = new w({
332
+ filehandle: new r(`${t}.tbi`),
333
333
  renameRefSeqs: h
334
334
  });
335
335
  else if (d) this.index = new b({ filehandle: new i(d) });
@@ -337,7 +337,7 @@ var w = class extends s {
337
337
  else if (o) this.index = new w({ filehandle: new i(`${o}.tbi`) });
338
338
  else throw TypeError("must provide one of tbiFilehandle, tbiPath, csiFilehandle, csiPath, tbiUrl, csiUrl");
339
339
  this.renameRefSeq = h, this.hasCustomRenameRefSeq = p !== void 0, this.chunkCache = new a({
340
- cache: new n({ maxSize: Math.floor(m / 65536) }),
340
+ cache: new e({ maxSize: Math.floor(m / 65536) }),
341
341
  fill: (e, t) => this.readChunk(e, { signal: t })
342
342
  });
343
343
  }
@@ -386,8 +386,8 @@ var w = class extends s {
386
386
  async getMetadata(e = {}) {
387
387
  return this.index.getMetadata(e);
388
388
  }
389
- async getHeaderBuffer(t = {}) {
390
- let { firstDataLine: n, metaChar: r, maxBlockSize: i } = await this.getMetadata(t), a = (n?.blockPosition || 0) + i, o = await e(await this.filehandle.read(a, 0, t));
389
+ async getHeaderBuffer(e = {}) {
390
+ let { firstDataLine: t, metaChar: r, maxBlockSize: i } = await this.getMetadata(e), a = (t?.blockPosition || 0) + i, o = await n(await this.filehandle.read(a, 0, e));
391
391
  if (r) {
392
392
  let e = -1, t = r.charCodeAt(0);
393
393
  for (let n = 0, r = o.length; n < r; n++) {
@@ -1,5 +1,5 @@
1
- import { n as e, r as t } from "./esm-CGLz7idZ.js";
2
- import { t as n } from "./esm-VvpZ9hsq.js";
1
+ import { t as e } from "./esm-VvpZ9hsq.js";
2
+ import { i as t, r as n } from "./esm-BA6yMcc-.js";
3
3
  import { n as r, r as i } from "./esm-BdT7qUL-.js";
4
4
  //#region ../../node_modules/@gmod/bam/esm/chunk.js
5
5
  var a = class {
@@ -142,12 +142,12 @@ function b(e, t, n, r, i = []) {
142
142
  }
143
143
  //#endregion
144
144
  //#region ../../node_modules/@gmod/bam/esm/indexFile.js
145
- function x(e, t = 5) {
146
- let r = new n({ maxSize: t });
147
- return (t) => {
148
- if (r.has(t)) return r.get(t);
149
- let n = e(t);
150
- return n && r.set(t, n), n;
145
+ function x(t, n = 5) {
146
+ let r = new e({ maxSize: n });
147
+ return (e) => {
148
+ if (r.has(e)) return r.get(e);
149
+ let n = t(e);
150
+ return n && r.set(e, n), n;
151
151
  };
152
152
  }
153
153
  var S = class {
@@ -611,50 +611,50 @@ var L = class extends S {
611
611
  ...m(e.subarray(t + 28, t + 28 + u), this.renameRefSeq)
612
612
  };
613
613
  }
614
- async _parse(t) {
615
- let n = await e(await this.filehandle.readFile(t)), r = new DataView(n.buffer), i, o = r.getUint32(0, !0);
614
+ async _parse(e) {
615
+ let t = await n(await this.filehandle.readFile(e)), r = new DataView(t.buffer), i, o = r.getUint32(0, !0);
616
616
  if (o === M) i = 1;
617
617
  else if (o === N) i = 2;
618
618
  else throw Error(`Not a CSI file ${o}`);
619
619
  this.minShift = r.getInt32(4, !0), this.depth = r.getInt32(8, !0), this.maxBinNumber = ((1 << (this.depth + 1) * 3) - 1) / 7;
620
- let s = this.maxBinNumber, c = r.getInt32(12, !0), l = c >= 30 ? this.parseAuxData(n, 16) : void 0, f = r.getInt32(16 + c, !0), m = 16 + c + 4, h, g = [];
620
+ let s = this.maxBinNumber, c = r.getInt32(12, !0), l = c >= 30 ? this.parseAuxData(t, 16) : void 0, f = r.getInt32(16 + c, !0), m = 16 + c + 4, h, g = [];
621
621
  for (let e = 0; e < f; e++) {
622
622
  g.push(m);
623
623
  let e = r.getInt32(m, !0);
624
624
  m += 4;
625
- for (let t = 0; t < e; t++) {
625
+ for (let n = 0; n < e; n++) {
626
626
  let e = r.getUint32(m, !0);
627
627
  if (m += 4, e > this.maxBinNumber) m += 44;
628
628
  else {
629
629
  m += 8;
630
630
  let e = r.getInt32(m, !0);
631
631
  m += 4;
632
- for (let t = 0; t < e; t += 1) {
633
- let e = w(n, m);
632
+ for (let n = 0; n < e; n += 1) {
633
+ let e = w(t, m);
634
634
  m += 8, m += 8, h = p(h, e);
635
635
  }
636
636
  }
637
637
  }
638
638
  }
639
639
  function _(e) {
640
- let t = g[e];
641
- if (t === void 0) return;
642
- let i = r.getInt32(t, !0);
643
- t += 4;
640
+ let n = g[e];
641
+ if (n === void 0) return;
642
+ let i = r.getInt32(n, !0);
643
+ n += 4;
644
644
  let o = {}, c;
645
645
  for (let e = 0; e < i; e++) {
646
- let e = r.getUint32(t, !0);
647
- if (t += 4, e > s) c = u(n, t + 28), t += 44;
646
+ let e = r.getUint32(n, !0);
647
+ if (n += 4, e > s) c = u(t, n + 28), n += 44;
648
648
  else {
649
- t += 8;
650
- let i = r.getInt32(t, !0);
651
- t += 4;
649
+ n += 8;
650
+ let i = r.getInt32(n, !0);
651
+ n += 4;
652
652
  let s = Array(i);
653
653
  for (let r = 0; r < i; r += 1) {
654
- let i = w(n, t);
655
- t += 8;
656
- let o = w(n, t);
657
- t += 8, s[r] = new a(i, o, e);
654
+ let i = w(t, n);
655
+ n += 8;
656
+ let o = w(t, n);
657
+ n += 8, s[r] = new a(i, o, e);
658
658
  }
659
659
  o[e] = s;
660
660
  }
@@ -1158,7 +1158,7 @@ var Z = class {
1158
1158
  index;
1159
1159
  htsget = !1;
1160
1160
  headerP;
1161
- chunkFeatureCache = new n({ maxSize: 100 });
1161
+ chunkFeatureCache = new e({ maxSize: 100 });
1162
1162
  RecordClass;
1163
1163
  constructor({ bamFilehandle: e, bamPath: t, bamUrl: n, baiPath: r, baiFilehandle: i, baiUrl: a, csiPath: o, csiFilehandle: s, csiUrl: c, htsget: l, renameRefSeqs: u = (e) => e, recordClass: d }) {
1164
1164
  this.renameRefSeq = u, this.RecordClass = d ?? K;
@@ -1171,14 +1171,14 @@ var Z = class {
1171
1171
  else if (m) this.index = new k({ filehandle: m });
1172
1172
  else if (!l) throw Error("no index source: pass csi*/bai* options or a bamPath/bamUrl so the .bai sibling can be inferred");
1173
1173
  }
1174
- async getHeaderPre(t = {}) {
1174
+ async getHeaderPre(e = {}) {
1175
1175
  if (!this.index) return;
1176
- let n = await this.index.parse(t), r = n.firstDataLine === void 0 ? void 0 : n.firstDataLine.blockPosition + J, i = await e(r === void 0 ? await this.bam.readFile() : await this.bam.read(r, 0)), a = new DataView(i.buffer);
1176
+ let t = await this.index.parse(e), r = t.firstDataLine === void 0 ? void 0 : t.firstDataLine.blockPosition + J, i = await n(r === void 0 ? await this.bam.readFile() : await this.bam.read(r, 0)), a = new DataView(i.buffer);
1177
1177
  if (a.getInt32(0, !0) !== 21840194) throw Error("Not a BAM file");
1178
1178
  let o = a.getInt32(4, !0);
1179
1179
  this.header = new TextDecoder("utf8").decode(i.subarray(8, 8 + o));
1180
1180
  let s = o + 8, c = f(i, s, this.renameRefSeq);
1181
- if (c ||= (i = await e(await this.bam.readFile()), f(i, s, this.renameRefSeq)), !c) throw Error("Insufficient data for reference sequences");
1181
+ if (c ||= (i = await n(await this.bam.readFile()), f(i, s, this.renameRefSeq)), !c) throw Error("Insufficient data for reference sequences");
1182
1182
  return this.chrToIndex = c.chrToIndex, this.indexToChr = c.indexToChr, q(this.header);
1183
1183
  }
1184
1184
  getHeader(e) {
@@ -1329,8 +1329,8 @@ async function re({ url: e, headers: t }, n) {
1329
1329
  });
1330
1330
  return new Uint8Array(await a.arrayBuffer());
1331
1331
  }
1332
- async function $(t, n) {
1333
- return h(await Promise.all(t.map(async (t) => e(await re(t, n)))));
1332
+ async function $(e, t) {
1333
+ return h(await Promise.all(e.map(async (e) => n(await re(e, t)))));
1334
1334
  }
1335
1335
  var ie = class extends Z {
1336
1336
  baseUrl;
@@ -1,4 +1,4 @@
1
- import { t as e } from "./esm-CGLz7idZ.js";
1
+ import { n as e } from "./esm-BA6yMcc-.js";
2
2
  import { n as t } from "./esm-BdT7qUL-.js";
3
3
  //#region ../core/node_modules/@gmod/indexedfasta/esm/fetchableSmallFasta.js
4
4
  var n = new TextDecoder("utf8");
@@ -0,0 +1,148 @@
1
+ import { i as e } from "./color-W5zffv-z.js";
2
+ import { y as t } from "./twgl-full.module-DB2UdP1k.js";
3
+ import { a as n, n as r, o as i } from "./clipOptions-gqdb3fvW.js";
4
+ import { t as a } from "./viewRenderingContext-HtpqwS_x.js";
5
+ //#region ../core/src/view/renderingContext/bufferedViewRenderingContext.js
6
+ var o = class extends a {
7
+ #e = [
8
+ 0,
9
+ 0,
10
+ 0,
11
+ 0
12
+ ];
13
+ #t;
14
+ #n = [];
15
+ #r;
16
+ #i;
17
+ #a = /* @__PURE__ */ new Set();
18
+ #o;
19
+ #s = void 0;
20
+ #c = 1;
21
+ #l = {
22
+ width: 0,
23
+ height: 0
24
+ };
25
+ #u;
26
+ constructor(t, n) {
27
+ if (super(t), this.#i = n.webGLHelper, this.#r = n.framebufferInfo, this.#c = n.devicePixelRatio, this.#l = n.canvasSize, this.#o = n.markPredicate ?? (() => !0), this.#u = n.pixelOffset, n.clearColor) {
28
+ let t = e(n.clearColor).rgb();
29
+ this.#e = [
30
+ t.r / 255,
31
+ t.g / 255,
32
+ t.b / 255,
33
+ t.opacity
34
+ ];
35
+ }
36
+ }
37
+ getDevicePixelRatio() {
38
+ return this.#c;
39
+ }
40
+ pushView(e, t) {
41
+ this.#a.add(e), this.#s = t;
42
+ }
43
+ renderMark(e, t) {
44
+ if (!this.#o(e) || this.globalOptions.picking && !e.isPickingParticipant()) return;
45
+ let r = e.render(t);
46
+ if (r) {
47
+ let a = n(t);
48
+ this.#n.push({
49
+ mark: e,
50
+ callback: r,
51
+ coords: this.#s,
52
+ clip: i(a, e.properties.clip, this.#s),
53
+ cullClip: a
54
+ });
55
+ }
56
+ }
57
+ render() {
58
+ if (this.#t || this.#d(), this.#t.length == 0) return;
59
+ let e = this.#i.gl, t = this.#r;
60
+ t ? (e.bindFramebuffer(e.FRAMEBUFFER, t.framebuffer), e.viewport(0, 0, t.width, t.height)) : e.viewport(0, 0, e.drawingBufferWidth, e.drawingBufferHeight), e.disable(e.SCISSOR_TEST), e.clearColor(...this.#e), e.clear(e.COLOR_BUFFER_BIT);
61
+ for (let e of this.#a) e.onBeforeRender();
62
+ for (let e of this.#t) e();
63
+ this.#r && e.bindFramebuffer(e.FRAMEBUFFER, null);
64
+ }
65
+ #d() {
66
+ this.#t = [];
67
+ let e = !0, n = !0, i = (t) => () => {
68
+ e && t();
69
+ }, a = (t) => () => {
70
+ e && n && t();
71
+ }, o = t(this.#n.reverse(), (e) => e.mark);
72
+ for (let [t, s] of [...o.entries()].reverse()) {
73
+ if (!t.isReady()) continue;
74
+ this.#t.push(() => {
75
+ e = t.unitView.getEffectiveOpacity() > 0;
76
+ }), this.#t.push(...t.prepareRender(this.globalOptions).map((e) => i(e)));
77
+ let o, c, l;
78
+ for (let e of s) {
79
+ let s = e.coords;
80
+ (!s.equals(o) || !r(e.clip, c) || !r(e.cullClip, l)) && this.#t.push(i(() => {
81
+ n = t.setViewport(this.#l, this.#c, s, e.clip, e.cullClip, this.#u);
82
+ })), this.#t.push(a(e.callback)), o = e.coords, c = e.clip, l = e.cullClip;
83
+ }
84
+ }
85
+ }
86
+ };
87
+ //#endregion
88
+ //#region ../core/src/gl/framebufferReadback.js
89
+ function s(e, t, n = {}) {
90
+ let r = n.x ?? 0, i = n.y ?? 0, a = n.width ?? t.width, o = n.height ?? t.height;
91
+ f(t, r, i, a, o);
92
+ let s = new Uint8Array(a * o * 4);
93
+ e.bindFramebuffer(e.FRAMEBUFFER, t.framebuffer);
94
+ try {
95
+ e.readPixels(r, t.height - i - o, a, o, e.RGBA, e.UNSIGNED_BYTE, s);
96
+ } finally {
97
+ e.bindFramebuffer(e.FRAMEBUFFER, null);
98
+ }
99
+ return {
100
+ pixels: d(s, a, o, n.unpremultiplyAlpha ?? !1),
101
+ width: a,
102
+ height: o
103
+ };
104
+ }
105
+ function c(e, t, n = "image/png", r = {}) {
106
+ return u(e, t, r).toDataURL(n);
107
+ }
108
+ function l(e, t, n = "image/png", r = {}) {
109
+ let i = u(e, t, r);
110
+ return new Promise((e, t) => {
111
+ i.toBlob((r) => {
112
+ r ? e(r) : t(/* @__PURE__ */ Error(`Could not encode framebuffer as ${n}.`));
113
+ }, n);
114
+ });
115
+ }
116
+ function u(e, t, n) {
117
+ let { pixels: r, width: i, height: a } = s(e, t, n), o = document.createElement("canvas");
118
+ o.width = i, o.height = a;
119
+ let c = o.getContext("2d"), l = c.createImageData(i, a);
120
+ return l.data.set(r), c.putImageData(l, 0, 0), o;
121
+ }
122
+ function d(e, t, n, r) {
123
+ let i = new Uint8ClampedArray(e.length), a = t * 4;
124
+ for (let t = 0; t < n; t++) {
125
+ let r = (n - t - 1) * a, o = t * a;
126
+ i.set(e.subarray(r, r + a), o);
127
+ }
128
+ if (r) for (let e = 0; e < i.length; e += 4) {
129
+ let t = i[e + 3];
130
+ if (t == 0) i[e] = 0, i[e + 1] = 0, i[e + 2] = 0;
131
+ else if (t < 255) {
132
+ let n = 255 / t;
133
+ i[e] = Math.round(i[e] * n), i[e + 1] = Math.round(i[e + 1] * n), i[e + 2] = Math.round(i[e + 2] * n);
134
+ }
135
+ }
136
+ return i;
137
+ }
138
+ function f(e, t, n, r, i) {
139
+ if (![
140
+ t,
141
+ n,
142
+ r,
143
+ i
144
+ ].every(Number.isInteger)) throw RangeError("Framebuffer readback bounds must be integers.");
145
+ if (t < 0 || n < 0 || r <= 0 || i <= 0 || t + r > e.width || n + i > e.height) throw RangeError("Framebuffer readback bounds are out of range.");
146
+ }
147
+ //#endregion
148
+ export { c as n, o as r, l as t };