@datagouv/components-next 1.0.2-dev.208 → 1.0.2-dev.209

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 (28) hide show
  1. package/dist/{Control-B9WQxlpJ.js → Control-DMgMzWnv.js} +1 -1
  2. package/dist/{Datafair.client-CZhPt853.js → Datafair.client-DpdHdQSx.js} +1 -1
  3. package/dist/{Event-iXDrp-fy.js → Event-CfA33G1K.js} +9 -9
  4. package/dist/{Image-mNMBOofs.js → Image-Dueb7njC.js} +12 -12
  5. package/dist/{ImagePreview.client-CTF6hyMR.js → ImagePreview.client-CtbvW_Q_.js} +1 -1
  6. package/dist/{JsonPreview.client-BwsgTnR7.js → JsonPreview.client-CboMjF2M.js} +2 -2
  7. package/dist/{Map-BfqKMw0S.js → Map-B4L0JtRr.js} +1113 -1025
  8. package/dist/{MapContainer.client-C95seuim.js → MapContainer.client-BPAbtzkr.js} +7 -7
  9. package/dist/{OSM-CcrUhItr.js → OSM-BUakwXg7.js} +1 -1
  10. package/dist/{PdfPreview.client-DaXPl9xc.js → PdfPreview.client-DQF8gS3o.js} +2 -2
  11. package/dist/{Pmtiles.client-PSLUkGmF.js → Pmtiles.client-B-X5pTXq.js} +5788 -5737
  12. package/dist/{PreviewWrapper.vue_vue_type_script_setup_true_lang-McCfJHd3.js → PreviewWrapper.vue_vue_type_script_setup_true_lang-CzFj5TX2.js} +1 -1
  13. package/dist/{ScaleLine-VGQ7nkMS.js → ScaleLine-4id_Lp0T.js} +2 -2
  14. package/dist/{Tile-CSpn0Ca8.js → Tile-DI5PtNs-.js} +375 -325
  15. package/dist/{TileImage-CpbaEFwd.js → TileImage-DFTatxB8.js} +83 -63
  16. package/dist/{View-BYBpt-AU.js → View-CwG9s9BF.js} +108 -101
  17. package/dist/{XmlPreview.client-BOVVyHXW.js → XmlPreview.client-BvlwpV00.js} +3 -3
  18. package/dist/{common-BoeTUnDZ.js → common-C3bYhKiN.js} +71 -70
  19. package/dist/components-next.css +1 -1
  20. package/dist/components-next.js +1 -1
  21. package/dist/components.css +2 -2
  22. package/dist/{index-CeH9i6IP.js → index-D2eZ5uVt.js} +5683 -5785
  23. package/dist/{leaflet-src-D1Cl1V-1.js → leaflet-src-CM7H_PEp.js} +1 -1
  24. package/dist/{main-DADRUTDs.js → main-D1VXLvop.js} +12531 -13523
  25. package/dist/{proj-DxGbobp7.js → proj-DQrI7bbu.js} +302 -282
  26. package/dist/{tilecoord-DvX7WWiA.js → tilecoord-xLae1hR5.js} +106 -106
  27. package/dist/{vue3-xml-viewer.common-BzsQ7xw8.js → vue3-xml-viewer.common-D8NyU_-4.js} +1 -1
  28. package/package.json +25 -25
@@ -1,18 +1,18 @@
1
- import { T as De, b as Oe, d as _e, g as ee, I as Pe, R as Ke } from "./tilecoord-DvX7WWiA.js";
2
- import { T as y, g as pe, d as j, l as Me, i as ze, j as Ae, c as Ce, t as be } from "./Image-mNMBOofs.js";
3
- import { aH as je, aJ as ke, al as te, E as Fe, Z as Ne, an as Ee, aK as Ze, aA as Ue, aL as qe, I as Ge, z as Be, v as Ve, e as We, U as He, a as k, aM as Xe, j as me, d as re, a1 as Ye, i as Qe, C as $e } from "./proj-DxGbobp7.js";
4
- import { a as ne, e as ie, p as Je, g as S, d as oe, n as et, q as tt } from "./common-BoeTUnDZ.js";
5
- import { a as ye, c as nt, R as X, L as it } from "./Event-iXDrp-fy.js";
6
- function ae(u) {
1
+ import { T as De, b as Oe, d as ye, g as te, I as Pe, R as Ke } from "./tilecoord-xLae1hR5.js";
2
+ import { T as E, g as Me, d as j, k as xe, i as ze, j as Ae, c as me, t as je } from "./Image-Dueb7njC.js";
3
+ import { aJ as be, aL as ke, am as ne, E as Fe, _ as Ne, ao as we, aM as Ze, aC as Ue, aN as qe, J as Ge, z as Be, v as We, e as Ve, W as He, a as b, aO as Xe, j as ve, d as oe, a2 as Ye, i as Qe, ap as $e, C as Je } from "./proj-DQrI7bbu.js";
4
+ import { a as ie, e as se, p as et, g as S, d as ae, n as tt, q as nt } from "./common-C3bYhKiN.js";
5
+ import { a as Te, c as it, R as V, L as st } from "./Event-CfA33G1K.js";
6
+ function le(u) {
7
7
  return u instanceof Image || u instanceof HTMLCanvasElement || u instanceof HTMLVideoElement || u instanceof ImageBitmap ? u : null;
8
8
  }
9
- const st = new Error("disposed"), rt = [256, 256];
10
- class Te extends De {
9
+ const rt = new Error("disposed"), ot = [256, 256];
10
+ class Re extends De {
11
11
  /**
12
12
  * @param {Options} options Tile options.
13
13
  */
14
14
  constructor(e) {
15
- const t = y.IDLE;
15
+ const t = E.IDLE;
16
16
  super(e.tileCoord, t, {
17
17
  transition: e.transition,
18
18
  interpolate: e.interpolate
@@ -25,8 +25,8 @@ class Te extends De {
25
25
  getSize() {
26
26
  if (this.size_)
27
27
  return this.size_;
28
- const e = ae(this.data_);
29
- return e ? [e.width, e.height] : rt;
28
+ const e = le(this.data_);
29
+ return e ? [e.width, e.height] : ot;
30
30
  }
31
31
  /**
32
32
  * Get the data for the tile.
@@ -50,14 +50,14 @@ class Te extends De {
50
50
  * @override
51
51
  */
52
52
  load() {
53
- if (this.state !== y.IDLE && this.state !== y.ERROR)
53
+ if (this.state !== E.IDLE && this.state !== E.ERROR)
54
54
  return;
55
- this.state = y.LOADING, this.changed();
55
+ this.state = E.LOADING, this.changed();
56
56
  const e = this;
57
57
  this.loader_().then(function(t) {
58
- e.data_ = t, e.state = y.LOADED, e.changed();
58
+ e.data_ = t, e.state = E.LOADED, e.changed();
59
59
  }).catch(function(t) {
60
- e.error_ = t, e.state = y.ERROR, e.changed();
60
+ e.error_ = t, e.state = E.ERROR, e.changed();
61
61
  });
62
62
  }
63
63
  /**
@@ -65,10 +65,10 @@ class Te extends De {
65
65
  * @override
66
66
  */
67
67
  disposeInternal() {
68
- this.controller_ && (this.controller_.abort(st), this.controller_ = null), super.disposeInternal();
68
+ this.controller_ && (this.controller_.abort(rt), this.controller_ = null), super.disposeInternal();
69
69
  }
70
70
  }
71
- class xe {
71
+ class Ce {
72
72
  /**
73
73
  * @param {number} [highWaterMark] High water mark.
74
74
  */
@@ -77,7 +77,7 @@ class xe {
77
77
  }
78
78
  deleteOldest() {
79
79
  const e = this.pop();
80
- e instanceof je && e.dispose();
80
+ e instanceof be && e.dispose();
81
81
  }
82
82
  /**
83
83
  * @return {boolean} Can expire cache.
@@ -126,7 +126,7 @@ class xe {
126
126
  */
127
127
  get(e, t) {
128
128
  const n = this.entries_[e];
129
- return ne(
129
+ return ie(
130
130
  n !== void 0,
131
131
  "Tried to get a value for a key that does not exist in the cache"
132
132
  ), n === this.newest_ || (n === this.oldest_ ? (this.oldest_ = /** @type {Entry} */
@@ -139,7 +139,7 @@ class xe {
139
139
  */
140
140
  remove(e) {
141
141
  const t = this.entries_[e];
142
- return ne(
142
+ return ie(
143
143
  t !== void 0,
144
144
  "Tried to get a value for a key that does not exist in the cache"
145
145
  ), t === this.newest_ ? (this.newest_ = /** @type {Entry} */
@@ -219,7 +219,7 @@ class xe {
219
219
  * @param {T} value Value.
220
220
  */
221
221
  set(e, t) {
222
- ne(
222
+ ie(
223
223
  !(e in this.entries_),
224
224
  "Tried to set a value for a key that is used already"
225
225
  );
@@ -240,14 +240,14 @@ class xe {
240
240
  this.highWaterMark = e;
241
241
  }
242
242
  }
243
- class ot {
243
+ class at {
244
244
  constructor() {
245
- this.instructions_ = [], this.zIndex = 0, this.offset_ = 0, this.context_ = /** @type {ZIndexContextProxy} */
246
- new Proxy(pe(), {
245
+ this.instructions_ = [], this.zIndex = 0, this.offset_ = 0, this.pendingMethod_, this.context_ = /** @type {ZIndexContextProxy} */
246
+ new Proxy(Me(), {
247
247
  get: (e, t) => {
248
248
  if (typeof /** @type {*} */
249
- pe()[t] == "function")
250
- return this.push_(t), this.pushMethodArgs_;
249
+ e[t] == "function")
250
+ return this.pendingMethod_ = t, this.pushMethodArgs_;
251
251
  },
252
252
  set: (e, t, n) => (this.push_(t, n), !0)
253
253
  });
@@ -261,11 +261,14 @@ class ot {
261
261
  t[n] || (t[n] = []), t[n].push(...e);
262
262
  }
263
263
  /**
264
- * @private
264
+ * Pushes the method name captured at access time together with the arguments
265
+ * passed at call time. Reused across all proxied method calls.
265
266
  * @param {...*} args Args.
266
- * @return {ZIndexContext} This.
267
+ * @private
267
268
  */
268
- pushMethodArgs_ = (...e) => (this.push_(e), this);
269
+ pushMethodArgs_ = (...e) => {
270
+ this.push_(this.pendingMethod_, e);
271
+ };
269
272
  /**
270
273
  * Push a function that renders to the context directly.
271
274
  * @param {function(CanvasRenderingContext2D): void} render Function.
@@ -288,23 +291,15 @@ class ot {
288
291
  */
289
292
  draw(e) {
290
293
  this.instructions_.forEach((t) => {
291
- for (let n = 0, i = t.length; n < i; ++n) {
292
- const r = t[n];
293
- if (typeof r == "function") {
294
- r(e);
294
+ for (let n = 0, s = t.length; n < s; ++n) {
295
+ const l = t[n];
296
+ if (typeof l == "function") {
297
+ l(e);
295
298
  continue;
296
299
  }
297
- const a = t[++n];
298
- if (typeof /** @type {*} */
299
- e[r] == "function")
300
- e[r](...a);
301
- else {
302
- if (typeof a == "function") {
303
- e[r] = a(e);
304
- continue;
305
- }
306
- e[r] = a;
307
- }
300
+ const c = t[++n];
301
+ typeof /** @type {*} */
302
+ e[l] == "function" ? e[l](...c) : typeof c == "function" ? e[l] = c(e) : e[l] = c;
308
303
  }
309
304
  });
310
305
  }
@@ -319,13 +314,13 @@ class ot {
319
314
  this.offset_ = this.instructions_.length, this.zIndex = 0;
320
315
  }
321
316
  }
322
- const at = 5;
323
- class lt extends ke {
317
+ const lt = 5;
318
+ class ct extends ke {
324
319
  /**
325
320
  * @param {LayerType} layer Layer.
326
321
  */
327
322
  constructor(e) {
328
- super(), this.ready = !0, this.boundHandleImageChange_ = this.handleImageChange_.bind(this), this.layer_ = e, this.staleKeys_ = new Array(), this.maxStaleKeys = at;
323
+ super(), this.ready = !0, this.boundHandleImageChange_ = this.handleImageChange_.bind(this), this.layer_ = e, this.staleKeys_ = new Array(), this.maxStaleKeys = lt, this.renderedSourceKey_;
329
324
  }
330
325
  /**
331
326
  * @return {Array<string>} Get the list of stale keys.
@@ -339,6 +334,14 @@ class lt extends ke {
339
334
  prependStaleKey(e) {
340
335
  this.staleKeys_.unshift(e), this.staleKeys_.length > this.maxStaleKeys && (this.staleKeys_.length = this.maxStaleKeys);
341
336
  }
337
+ /**
338
+ * Remember the previous source key as stale when the key changes.
339
+ * @param {string} sourceKey The current source key.
340
+ * @protected
341
+ */
342
+ updateStaleKeys(e) {
343
+ this.renderedSourceKey_ ? this.renderedSourceKey_ !== e && (this.prependStaleKey(this.renderedSourceKey_), this.renderedSourceKey_ = e) : this.renderedSourceKey_ = e;
344
+ }
342
345
  /**
343
346
  * Asynchronous layer level hit detection.
344
347
  * @param {import("../pixel.js").Pixel} pixel Pixel.
@@ -346,7 +349,7 @@ class lt extends ke {
346
349
  * an array of features.
347
350
  */
348
351
  getFeatures(e) {
349
- return te();
352
+ return ne();
350
353
  }
351
354
  /**
352
355
  * @param {import("../pixel.js").Pixel} pixel Pixel.
@@ -362,7 +365,7 @@ class lt extends ke {
362
365
  * @return {boolean} Layer is ready to be rendered.
363
366
  */
364
367
  prepareFrame(e) {
365
- return te();
368
+ return ne();
366
369
  }
367
370
  /**
368
371
  * Render the layer.
@@ -372,7 +375,7 @@ class lt extends ke {
372
375
  * @return {HTMLElement} The rendered element.
373
376
  */
374
377
  renderFrame(e, t) {
375
- return te();
378
+ return ne();
376
379
  }
377
380
  /**
378
381
  * @abstract
@@ -384,7 +387,7 @@ class lt extends ke {
384
387
  * @return {T|undefined} Callback result.
385
388
  * @template T
386
389
  */
387
- forEachFeatureAtCoordinate(e, t, n, i, r) {
390
+ forEachFeatureAtCoordinate(e, t, n, s, l) {
388
391
  }
389
392
  /**
390
393
  * @return {LayerType} Layer.
@@ -441,19 +444,19 @@ class lt extends ke {
441
444
  delete this.layer_, super.disposeInternal();
442
445
  }
443
446
  }
444
- const Rt = [];
445
- let F = null;
446
- function ct() {
447
- F = Ce(1, 1, void 0, {
447
+ const Ct = [];
448
+ let k = null;
449
+ function ht() {
450
+ k = me(1, 1, void 0, {
448
451
  willReadFrequently: !0
449
452
  });
450
453
  }
451
- class ht extends lt {
454
+ class dt extends ct {
452
455
  /**
453
456
  * @param {LayerType} layer Layer.
454
457
  */
455
458
  constructor(e) {
456
- super(e), this.container = null, this.renderedResolution, this.tempTransform = ie(), this.pixelTransform = ie(), this.inversePixelTransform = ie(), this.context = null, this.deferredContext_ = null, this.containerReused = !1, this.frameState = null;
459
+ super(e), this.container = null, this.renderedResolution, this.tempTransform = se(), this.pixelTransform = se(), this.inversePixelTransform = se(), this.context = null, this.deferredContext_ = null, this.containerReused = !1, this.frameState = null;
457
460
  }
458
461
  /**
459
462
  * @param {import('../../DataTile.js').ImageLike} image Image.
@@ -462,14 +465,14 @@ class ht extends lt {
462
465
  * @return {Uint8ClampedArray|null} The image data.
463
466
  */
464
467
  getImageData(e, t, n) {
465
- F || ct(), F.clearRect(0, 0, 1, 1);
466
- let i;
468
+ k || ht(), k.clearRect(0, 0, 1, 1);
469
+ let s;
467
470
  try {
468
- F.drawImage(e, t, n, 1, 1, 0, 0, 1, 1), i = F.getImageData(0, 0, 1, 1).data;
471
+ k.drawImage(e, t, n, 1, 1, 0, 0, 1, 1), s = k.getImageData(0, 0, 1, 1).data;
469
472
  } catch {
470
- return F = null, null;
473
+ return k = null, null;
471
474
  }
472
- return i;
475
+ return s;
473
476
  }
474
477
  /**
475
478
  * @param {import('../../Map.js').FrameState} frameState Frame state.
@@ -484,26 +487,38 @@ class ht extends lt {
484
487
  * @param {HTMLElement} target Potential render target.
485
488
  * @param {string} transform CSS transform matrix.
486
489
  * @param {string} [backgroundColor] Background color.
490
+ * @param {number} [width] Physical pixel width of the rendering canvas.
491
+ * @param {number} [height] Physical pixel height of the rendering canvas.
487
492
  */
488
- useContainer(e, t, n) {
489
- const i = this.getLayer().getClassName();
490
- let r, a;
491
- if (e && e.className === i && (!n || e && e.style.backgroundColor && Ne(
492
- ye(e.style.backgroundColor),
493
- ye(n)
493
+ useContainer(e, t, n, s, l) {
494
+ if (xe(e) && this.pixelTransform[1] === 0 && this.pixelTransform[2] === 0 && this.pixelTransform[4] === 0 && this.pixelTransform[5] === 0 && e.width === s && e.height === l) {
495
+ const a = (
496
+ /** @type {HTMLCanvasElement} */
497
+ e
498
+ ), i = a.getContext("2d");
499
+ if (i) {
500
+ this.container = e, this.context = i, this.containerReused = !0, n && (i.fillStyle = n, i.fillRect(0, 0, a.width, a.height));
501
+ return;
502
+ }
503
+ }
504
+ const c = this.getLayer().getClassName();
505
+ let r, o;
506
+ if (e && e.className === c && (!n || e && e.style.backgroundColor && Ne(
507
+ Te(e.style.backgroundColor),
508
+ Te(n)
494
509
  ))) {
495
- const s = e.firstElementChild;
496
- Me(s) && (a = s.getContext("2d"));
510
+ const a = e.firstElementChild;
511
+ xe(a) && (o = a.getContext("2d"));
497
512
  }
498
- if (a && Je(a.canvas.style.transform, t) ? (this.container = e, this.context = a, this.containerReused = !0) : this.containerReused ? (this.container = null, this.context = null, this.containerReused = !1) : this.container && (this.container.style.backgroundColor = null), !this.container) {
499
- r = ze ? Ae() : document.createElement("div"), r.className = i;
500
- let s = r.style;
501
- s.position = "absolute", s.width = "100%", s.height = "100%", a = Ce();
502
- const l = (
513
+ if (o && et(o.canvas.style.transform, t) ? (this.container = e, this.context = o, this.containerReused = !0) : this.containerReused ? (this.container = null, this.context = null, this.containerReused = !1) : this.container && (this.container.style.backgroundColor = null), !this.container) {
514
+ r = ze ? Ae() : document.createElement("div"), r.className = c;
515
+ let a = r.style;
516
+ a.position = "absolute", a.width = "100%", a.height = "100%", o = me();
517
+ const i = (
503
518
  /** @type {HTMLCanvasElement} */
504
- a.canvas
519
+ o.canvas
505
520
  );
506
- r.appendChild(l), s = l.style, s.position = "absolute", s.left = "0", s.transformOrigin = "top left", this.container = r, this.context = a;
521
+ r.appendChild(i), a = i.style, a.position = "absolute", a.left = "0", a.transformOrigin = "top left", this.container = r, this.context = o;
507
522
  }
508
523
  !this.containerReused && n && !this.container.style.backgroundColor && (this.container.style.backgroundColor = n);
509
524
  }
@@ -514,10 +529,10 @@ class ht extends lt {
514
529
  * @protected
515
530
  */
516
531
  clipUnrotated(e, t, n) {
517
- const i = Ee(n), r = Ze(n), a = Ue(n), s = qe(n);
518
- S(t.coordinateToPixelTransform, i), S(t.coordinateToPixelTransform, r), S(t.coordinateToPixelTransform, a), S(t.coordinateToPixelTransform, s);
519
- const l = this.inversePixelTransform;
520
- S(l, i), S(l, r), S(l, a), S(l, s), e.save(), e.beginPath(), e.moveTo(Math.round(i[0]), Math.round(i[1])), e.lineTo(Math.round(r[0]), Math.round(r[1])), e.lineTo(Math.round(a[0]), Math.round(a[1])), e.lineTo(Math.round(s[0]), Math.round(s[1])), e.clip();
532
+ const s = we(n), l = Ze(n), c = Ue(n), r = qe(n);
533
+ S(t.coordinateToPixelTransform, s), S(t.coordinateToPixelTransform, l), S(t.coordinateToPixelTransform, c), S(t.coordinateToPixelTransform, r);
534
+ const o = this.inversePixelTransform;
535
+ S(o, s), S(o, l), S(o, c), S(o, r), e.save(), e.beginPath(), e.moveTo(Math.round(s[0]), Math.round(s[1])), e.lineTo(Math.round(l[0]), Math.round(l[1])), e.lineTo(Math.round(c[0]), Math.round(c[1])), e.lineTo(Math.round(r[0]), Math.round(r[1])), e.clip();
521
536
  }
522
537
  /**
523
538
  * @param {import("../../Map.js").FrameState} frameState Frame state.
@@ -525,22 +540,22 @@ class ht extends lt {
525
540
  * @protected
526
541
  */
527
542
  prepareContainer(e, t) {
528
- const n = e.extent, i = e.viewState.resolution, r = e.viewState.rotation, a = e.pixelRatio, s = Math.round(Ge(n) / i * a), l = Math.round(Be(n) / i * a);
529
- oe(
543
+ const n = e.extent, s = e.viewState.resolution, l = e.viewState.rotation, c = e.pixelRatio, r = Math.round(Ge(n) / s * c), o = Math.round(Be(n) / s * c);
544
+ ae(
530
545
  this.pixelTransform,
531
546
  e.size[0] / 2,
532
547
  e.size[1] / 2,
533
- 1 / a,
534
- 1 / a,
535
- r,
536
- -s / 2,
537
- -l / 2
538
- ), et(this.inversePixelTransform, this.pixelTransform);
539
- const c = tt(this.pixelTransform);
540
- if (this.useContainer(t, c, this.getBackground(e)), !this.containerReused) {
541
- const o = this.context.canvas;
542
- o.width != s || o.height != l ? (o.width = s, o.height = l) : this.context.clearRect(0, 0, s, l), c !== /** @type {HTMLCanvasElement} */
543
- o.style.transform && (o.style.transform = c);
548
+ 1 / c,
549
+ 1 / c,
550
+ l,
551
+ -r / 2,
552
+ -o / 2
553
+ ), tt(this.inversePixelTransform, this.pixelTransform);
554
+ const a = nt(this.pixelTransform), i = this.getBackground(e);
555
+ if (this.useContainer(t, a, i, r, o), !this.containerReused) {
556
+ const h = this.context.canvas;
557
+ h.width != r || h.height != o ? (h.width = r, h.height = o) : this.context.clearRect(0, 0, r, o), a !== /** @type {HTMLCanvasElement} */
558
+ h.style.transform && (h.style.transform = a);
544
559
  }
545
560
  }
546
561
  /**
@@ -550,15 +565,15 @@ class ht extends lt {
550
565
  * @private
551
566
  */
552
567
  dispatchRenderEvent_(e, t, n) {
553
- const i = this.getLayer();
554
- if (i.hasListener(e)) {
555
- const r = new nt(
568
+ const s = this.getLayer();
569
+ if (s.hasListener(e)) {
570
+ const l = new it(
556
571
  e,
557
572
  this.inversePixelTransform,
558
573
  n,
559
574
  t
560
575
  );
561
- i.dispatchEvent(r);
576
+ s.dispatchEvent(l);
562
577
  }
563
578
  }
564
579
  /**
@@ -567,7 +582,7 @@ class ht extends lt {
567
582
  * @protected
568
583
  */
569
584
  preRender(e, t) {
570
- this.frameState = t, !t.declutter && this.dispatchRenderEvent_(X.PRERENDER, e, t);
585
+ this.frameState = t, !t.declutter && this.dispatchRenderEvent_(V.PRERENDER, e, t);
571
586
  }
572
587
  /**
573
588
  * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.
@@ -575,7 +590,7 @@ class ht extends lt {
575
590
  * @protected
576
591
  */
577
592
  postRender(e, t) {
578
- t.declutter || this.dispatchRenderEvent_(X.POSTRENDER, e, t);
593
+ t.declutter || this.dispatchRenderEvent_(V.POSTRENDER, e, t);
579
594
  }
580
595
  /**
581
596
  * @param {import("../../Map.js").FrameState} frameState Frame state.
@@ -587,7 +602,7 @@ class ht extends lt {
587
602
  * @return {import('../../render/canvas/ZIndexContext.js').ZIndexContextProxy} Context.
588
603
  */
589
604
  getRenderContext(e) {
590
- return e.declutter && !this.deferredContext_ && (this.deferredContext_ = new ot()), e.declutter ? this.deferredContext_.getContext() : this.context;
605
+ return e.declutter && !this.deferredContext_ && (this.deferredContext_ = new at()), e.declutter ? this.deferredContext_.getContext() : this.context;
591
606
  }
592
607
  /**
593
608
  * @param {import("../../Map.js").FrameState} frameState Frame state.
@@ -595,11 +610,11 @@ class ht extends lt {
595
610
  */
596
611
  renderDeferred(e) {
597
612
  e.declutter && (this.dispatchRenderEvent_(
598
- X.PRERENDER,
613
+ V.PRERENDER,
599
614
  this.context,
600
615
  e
601
616
  ), e.declutter && this.deferredContext_ && (this.deferredContext_.draw(this.context), this.deferredContext_.clear()), this.renderDeferredInternal(e), this.dispatchRenderEvent_(
602
- X.POSTRENDER,
617
+ V.POSTRENDER,
603
618
  this.context,
604
619
  e
605
620
  ));
@@ -616,13 +631,13 @@ class ht extends lt {
616
631
  * @protected
617
632
  * @return {!import("../../transform.js").Transform} Transform.
618
633
  */
619
- getRenderTransform(e, t, n, i, r, a, s) {
620
- const l = r / 2, c = a / 2, o = i / t, h = -o, d = -e[0] + s, g = -e[1];
621
- return oe(
634
+ getRenderTransform(e, t, n, s, l, c, r) {
635
+ const o = l / 2, a = c / 2, i = s / t, h = -i, d = -e[0] + r, g = -e[1];
636
+ return ae(
622
637
  this.tempTransform,
623
- l,
624
- c,
625
638
  o,
639
+ a,
640
+ i,
626
641
  h,
627
642
  -n,
628
643
  d,
@@ -637,41 +652,41 @@ class ht extends lt {
637
652
  delete this.frameState, super.disposeInternal();
638
653
  }
639
654
  }
640
- function se(u, e, t) {
655
+ function re(u, e, t) {
641
656
  if (!(t in u))
642
657
  return u[t] = /* @__PURE__ */ new Set([e]), !0;
643
- const n = u[t], i = n.has(e);
644
- return i || n.add(e), !i;
658
+ const n = u[t], s = n.has(e);
659
+ return s || n.add(e), !s;
645
660
  }
646
- function dt(u, e, t) {
661
+ function ut(u, e, t) {
647
662
  const n = u[t];
648
663
  return n ? n.delete(e) : !1;
649
664
  }
650
- function Re(u, e) {
665
+ function Ee(u, e) {
651
666
  const t = u.layerStatesArray[u.layerIndex];
652
- t.extent && (e = re(
667
+ t.extent && (e = oe(
653
668
  e,
654
- me(t.extent, u.viewState.projection)
669
+ ve(t.extent, u.viewState.projection)
655
670
  ));
656
671
  const n = (
657
672
  /** @type {import("../../source/Tile.js").default} */
658
673
  t.layer.getRenderSource()
659
674
  );
660
675
  if (!n.getWrapX()) {
661
- const i = n.getTileGridForProjection(u.viewState.projection).getExtent();
662
- i && (e = re(e, i));
676
+ const s = n.getTileGridForProjection(u.viewState.projection).getExtent();
677
+ s && (e = oe(e, s));
663
678
  }
664
679
  return e;
665
680
  }
666
- class ut extends ht {
681
+ class gt extends dt {
667
682
  /**
668
683
  * @param {LayerType} tileLayer Tile layer.
669
684
  * @param {Options} [options] Options.
670
685
  */
671
686
  constructor(e, t) {
672
- super(e), t = t || {}, this.extentChanged = !0, this.renderComplete = !1, this.renderedExtent_ = null, this.renderedPixelRatio, this.renderedProjection = null, this.renderedTiles = [], this.renderedSourceKey_, this.renderedSourceRevision_, this.tempExtent = Ve(), this.tempTileRange_ = new Oe(0, 0, 0, 0), this.tempTileCoord_ = _e(0, 0, 0);
687
+ super(e), t = t || {}, this.extentChanged = !0, this.renderComplete = !1, this.renderedExtent_ = null, this.renderedPixelRatio, this.renderedProjection = null, this.renderedTiles = [], this.renderedSourceRevision_, this.tempExtent = We(), this.tempTileRange_ = new Oe(0, 0, 0, 0), this.tempTileCoord_ = ye(0, 0, 0);
673
688
  const n = t.cacheSize !== void 0 ? t.cacheSize : 512;
674
- this.tileCache_ = new xe(n), this.sourceTileCache_ = null, this.layerExtent = null, this.maxStaleKeys = n * 0.5;
689
+ this.tileCache_ = new Ce(n), this.sourceTileCache_ = null, this.layerExtent = null, this.maxStaleKeys = n * 0.5;
675
690
  }
676
691
  /**
677
692
  * @return {LRUCache} Tile cache.
@@ -683,7 +698,7 @@ class ut extends ht {
683
698
  * @return {LRUCache} Tile cache.
684
699
  */
685
700
  getSourceTileCache() {
686
- return this.sourceTileCache_ || (this.sourceTileCache_ = new xe(512)), this.sourceTileCache_;
701
+ return this.sourceTileCache_ || (this.sourceTileCache_ = new Ce(512)), this.sourceTileCache_;
687
702
  }
688
703
  /**
689
704
  * Get a tile from the cache or create one if needed.
@@ -695,25 +710,25 @@ class ut extends ht {
695
710
  * @return {import("../../Tile.js").default|null} Tile (or null if outside source extent).
696
711
  * @protected
697
712
  */
698
- getOrCreateTile(e, t, n, i) {
699
- const r = this.tileCache_, s = this.getLayer().getSource(), l = ee(s, s.getKey(), e, t, n);
700
- let c;
701
- if (r.containsKey(l))
702
- c = r.get(l);
713
+ getOrCreateTile(e, t, n, s) {
714
+ const l = this.tileCache_, r = this.getLayer().getSource(), o = te(r, r.getKey(), e, t, n);
715
+ let a;
716
+ if (l.containsKey(o))
717
+ a = l.get(o);
703
718
  else {
704
- const o = i.viewState.projection, h = s.getProjection();
705
- if (c = s.getTile(
719
+ const i = s.viewState.projection, h = r.getProjection();
720
+ if (a = r.getTile(
706
721
  e,
707
722
  t,
708
723
  n,
709
- i.pixelRatio,
710
- o,
711
- !h || We(h, o) ? void 0 : this.getSourceTileCache()
712
- ), !c)
724
+ s.pixelRatio,
725
+ i,
726
+ !h || Ve(h, i) ? void 0 : this.getSourceTileCache()
727
+ ), !a)
713
728
  return null;
714
- r.set(l, c);
729
+ l.set(o, a);
715
730
  }
716
- return c;
731
+ return a;
717
732
  }
718
733
  /**
719
734
  * @param {number} z Tile coordinate z.
@@ -723,9 +738,9 @@ class ut extends ht {
723
738
  * @return {import("../../Tile.js").default|null} Tile (or null if outside source extent).
724
739
  * @protected
725
740
  */
726
- getTile(e, t, n, i) {
727
- const r = this.getOrCreateTile(e, t, n, i);
728
- return r || null;
741
+ getTile(e, t, n, s) {
742
+ const l = this.getOrCreateTile(e, t, n, s);
743
+ return l || null;
729
744
  }
730
745
  /**
731
746
  * @param {import("../../pixel.js").Pixel} pixel Pixel.
@@ -736,34 +751,34 @@ class ut extends ht {
736
751
  const t = this.frameState;
737
752
  if (!t)
738
753
  return null;
739
- const n = this.getLayer(), i = S(
754
+ const n = this.getLayer(), s = S(
740
755
  t.pixelToCoordinateTransform,
741
756
  e.slice()
742
- ), r = n.getExtent();
743
- if (r && !He(r, i))
757
+ ), l = n.getExtent();
758
+ if (l && !He(l, s))
744
759
  return null;
745
- const a = t.viewState, s = n.getRenderSource(), l = s.getTileGridForProjection(a.projection), c = s.getTilePixelRatio(t.pixelRatio);
746
- for (let o = l.getZForResolution(a.resolution); o >= l.getMinZoom(); --o) {
747
- const h = l.getTileCoordForCoordAndZ(i, o), d = this.getTile(o, h[1], h[2], t);
748
- if (!d || d.getState() !== y.LOADED)
760
+ const c = t.viewState, r = n.getRenderSource(), o = r.getTileGridForProjection(c.projection), a = r.getTilePixelRatio(t.pixelRatio);
761
+ for (let i = o.getZForResolution(c.resolution); i >= o.getMinZoom(); --i) {
762
+ const h = o.getTileCoordForCoordAndZ(s, i), d = this.getTile(i, h[1], h[2], t);
763
+ if (!d || d.getState() !== E.LOADED)
749
764
  continue;
750
- const g = l.getOrigin(o), p = be(l.getTileSize(o)), I = l.getResolution(o);
765
+ const g = o.getOrigin(i), p = je(o.getTileSize(i)), R = o.getResolution(i);
751
766
  let f;
752
767
  if (d instanceof Pe || d instanceof Ke)
753
768
  f = d.getImage();
754
- else if (d instanceof Te) {
755
- if (f = ae(d.getData()), !f)
769
+ else if (d instanceof Re) {
770
+ if (f = le(d.getData()), !f)
756
771
  continue;
757
772
  } else
758
773
  continue;
759
- const v = Math.floor(
760
- c * ((i[0] - g[0]) / I - h[1] * p[0])
761
- ), K = Math.floor(
762
- c * ((g[1] - i[1]) / I - h[2] * p[1])
763
- ), E = Math.round(
764
- c * s.getGutterForProjection(a.projection)
774
+ const m = Math.floor(
775
+ a * ((s[0] - g[0]) / R - h[1] * p[0])
776
+ ), I = Math.floor(
777
+ a * ((g[1] - s[1]) / R - h[2] * p[1])
778
+ ), C = Math.round(
779
+ a * r.getGutterForProjection(c.projection)
765
780
  );
766
- return this.getImageData(f, v + E, K + E);
781
+ return this.getImageData(f, m + C, I + C);
767
782
  }
768
783
  return null;
769
784
  }
@@ -796,46 +811,46 @@ class ut extends ht {
796
811
  * @param {TileLookup} tilesByZ Lookup of tiles by zoom level.
797
812
  * @param {number} preload Number of additional levels to load.
798
813
  */
799
- enqueueTiles(e, t, n, i, r) {
800
- const a = e.viewState, s = this.getLayer(), l = s.getRenderSource(), c = l.getTileGridForProjection(a.projection), o = k(l);
801
- o in e.wantedTiles || (e.wantedTiles[o] = {});
802
- const h = e.wantedTiles[o], d = s.getMapInternal(), g = Math.max(
803
- n - r,
804
- c.getMinZoom(),
805
- c.getZForResolution(
814
+ enqueueTiles(e, t, n, s, l) {
815
+ const c = e.viewState, r = this.getLayer(), o = r.getRenderSource(), a = o.getTileGridForProjection(c.projection), i = b(o);
816
+ i in e.wantedTiles || (e.wantedTiles[i] = {});
817
+ const h = e.wantedTiles[i], d = r.getMapInternal(), g = Math.max(
818
+ n - l,
819
+ a.getMinZoom(),
820
+ a.getZForResolution(
806
821
  Math.min(
807
- s.getMaxResolution(),
808
- d ? d.getView().getResolutionForZoom(Math.max(s.getMinZoom(), 0)) : c.getResolution(0)
822
+ r.getMaxResolution(),
823
+ d ? d.getView().getResolutionForZoom(Math.max(r.getMinZoom(), 0)) : a.getResolution(0)
809
824
  ),
810
- l.zDirection
825
+ o.zDirection
811
826
  )
812
- ), p = a.rotation, I = p ? Xe(
813
- a.center,
814
- a.resolution,
827
+ ), p = c.rotation, R = p ? Xe(
828
+ c.center,
829
+ c.resolution,
815
830
  p,
816
831
  e.size
817
832
  ) : void 0;
818
833
  for (let f = n; f >= g; --f) {
819
- const v = c.getTileRangeForExtentAndZ(
834
+ const m = a.getTileRangeForExtentAndZ(
820
835
  t,
821
836
  f,
822
837
  this.tempTileRange_
823
- ), K = c.getResolution(f);
824
- for (let E = v.minX; E <= v.maxX; ++E)
825
- for (let L = v.minY; L <= v.maxY; ++L) {
826
- if (p && !c.tileCoordIntersectsViewport([f, E, L], I))
838
+ ), I = a.getResolution(f);
839
+ for (let C = m.minX; C <= m.maxX; ++C)
840
+ for (let T = m.minY; T <= m.maxY; ++T) {
841
+ if (p && !a.tileCoordIntersectsViewport([f, C, T], R))
827
842
  continue;
828
- const m = this.getTile(f, E, L, e);
829
- if (!m || !se(i, m, f))
843
+ const _ = this.getTile(f, C, T, e);
844
+ if (!_ || !re(s, _, f))
830
845
  continue;
831
- const z = m.getKey();
832
- if (h[z] = !0, m.getState() === y.IDLE && !e.tileQueue.isKeyQueued(z)) {
833
- const Z = _e(f, E, L, this.tempTileCoord_);
846
+ const O = _.getKey();
847
+ if (h[O] = !0, _.getState() === E.IDLE && !e.tileQueue.isKeyQueued(O)) {
848
+ const P = ye(f, C, T, this.tempTileCoord_);
834
849
  e.tileQueue.enqueue([
835
- m,
836
- o,
837
- c.getTileCoordCenter(Z),
838
- K
850
+ _,
851
+ i,
852
+ a.getTileCoordCenter(P),
853
+ I
839
854
  ]);
840
855
  }
841
856
  }
@@ -850,19 +865,19 @@ class ut extends ht {
850
865
  * @private
851
866
  */
852
867
  findStaleTile_(e, t) {
853
- const n = this.tileCache_, i = e[0], r = e[1], a = e[2], s = this.getStaleKeys();
854
- for (let l = 0; l < s.length; ++l) {
855
- const c = ee(
868
+ const n = this.tileCache_, s = e[0], l = e[1], c = e[2], r = this.getStaleKeys();
869
+ for (let o = 0; o < r.length; ++o) {
870
+ const a = te(
856
871
  this.getLayer().getSource(),
857
- s[l],
858
- i,
859
- r,
860
- a
872
+ r[o],
873
+ s,
874
+ l,
875
+ c
861
876
  );
862
- if (n.containsKey(c)) {
863
- const o = n.peek(c);
864
- if (o.getState() === y.LOADED)
865
- return o.endTransition(k(this)), se(t, o, i), !0;
877
+ if (n.containsKey(a)) {
878
+ const i = n.peek(a);
879
+ if (i.getState() === E.LOADED)
880
+ return i.endTransition(b(this)), re(t, i, s), !0;
866
881
  }
867
882
  }
868
883
  return !1;
@@ -877,27 +892,27 @@ class ut extends ht {
877
892
  * @return {boolean} The tile coordinate is covered by loaded tiles at the alternate zoom level.
878
893
  * @private
879
894
  */
880
- findAltTiles_(e, t, n, i) {
881
- const r = e.getTileRangeForTileCoordAndZ(
895
+ findAltTiles_(e, t, n, s) {
896
+ const l = e.getTileRangeForTileCoordAndZ(
882
897
  t,
883
898
  n,
884
899
  this.tempTileRange_
885
900
  );
886
- if (!r)
901
+ if (!l)
887
902
  return !1;
888
- let a = !0;
889
- const s = this.tileCache_, l = this.getLayer().getRenderSource(), c = l.getKey();
890
- for (let o = r.minX; o <= r.maxX; ++o)
891
- for (let h = r.minY; h <= r.maxY; ++h) {
892
- const d = ee(l, c, n, o, h);
903
+ let c = !0;
904
+ const r = this.tileCache_, o = this.getLayer().getRenderSource(), a = o.getKey();
905
+ for (let i = l.minX; i <= l.maxX; ++i)
906
+ for (let h = l.minY; h <= l.maxY; ++h) {
907
+ const d = te(o, a, n, i, h);
893
908
  let g = !1;
894
- if (s.containsKey(d)) {
895
- const p = s.peek(d);
896
- p.getState() === y.LOADED && (se(i, p, n), g = !0);
909
+ if (r.containsKey(d)) {
910
+ const p = r.peek(d);
911
+ p.getState() === E.LOADED && (re(s, p, n), g = !0);
897
912
  }
898
- g || (a = !1);
913
+ g || (c = !1);
899
914
  }
900
- return a;
915
+ return c;
901
916
  }
902
917
  /**
903
918
  * Render the layer.
@@ -915,119 +930,130 @@ class ut extends ht {
915
930
  */
916
931
  renderFrame(e, t) {
917
932
  this.renderComplete = !0;
918
- const n = e.layerStatesArray[e.layerIndex], i = e.viewState, r = i.projection, a = i.resolution, s = i.center, l = e.pixelRatio, c = this.getLayer(), o = c.getSource(), h = o.getTileGridForProjection(r), d = h.getZForResolution(a, o.zDirection), g = h.getResolution(d), p = o.getKey();
919
- this.renderedSourceKey_ ? this.renderedSourceKey_ !== p && (this.prependStaleKey(this.renderedSourceKey_), this.renderedSourceKey_ = p) : this.renderedSourceKey_ = p;
920
- let I = e.extent;
921
- const f = o.getTilePixelRatio(l);
933
+ const n = e.layerStatesArray[e.layerIndex], s = e.viewState, l = s.projection, c = s.resolution, r = s.center, o = e.pixelRatio, a = this.getLayer(), i = a.getSource(), h = i.getTileGridForProjection(l), d = h.getZForResolution(c, i.zDirection), g = h.getResolution(d);
934
+ this.updateStaleKeys(i.getKey());
935
+ let p = e.extent;
936
+ const R = i.getTilePixelRatio(o);
922
937
  this.prepareContainer(e, t);
923
- const v = this.context.canvas.width, K = this.context.canvas.height;
924
- this.layerExtent = n.extent ? me(n.extent) : null, this.layerExtent && (I = re(I, this.layerExtent));
925
- const E = g * v / 2 / f, L = g * K / 2 / f, m = [
926
- s[0] - E,
927
- s[1] - L,
928
- s[0] + E,
929
- s[1] + L
930
- ], R = {};
938
+ const f = this.context.canvas.width, m = this.context.canvas.height;
939
+ this.layerExtent = n.extent ? ve(n.extent) : null, this.layerExtent && (p = oe(p, this.layerExtent));
940
+ const I = g * f / 2 / R, C = g * m / 2 / R, T = [
941
+ r[0] - I,
942
+ r[1] - C,
943
+ r[0] + I,
944
+ r[1] + C
945
+ ], _ = {};
931
946
  this.renderedTiles.length = 0;
932
- const z = c.getPreload();
947
+ const w = a.getPreload();
933
948
  if (e.nextExtent && this.enqueueTilesForNextExtent()) {
934
- const T = h.getZForResolution(
935
- i.nextResolution,
936
- o.zDirection
937
- ), x = Re(e, e.nextExtent);
938
- this.enqueueTiles(e, x, T, R, z);
949
+ const y = h.getZForResolution(
950
+ s.nextResolution,
951
+ i.zDirection
952
+ ), x = Ee(e, e.nextExtent);
953
+ this.enqueueTiles(e, x, y, _, w);
939
954
  }
940
- const Z = Re(e, I);
941
- if (this.enqueueTiles(e, Z, d, R, 0), z > 0 && setTimeout(() => {
955
+ const O = Ee(e, p);
956
+ if (this.enqueueTiles(e, O, d, _, 0), w > 0 && setTimeout(() => {
942
957
  this.enqueueTiles(
943
958
  e,
944
- Z,
959
+ O,
945
960
  d - 1,
946
- R,
947
- z - 1
961
+ _,
962
+ w - 1
948
963
  );
949
- }, 0), !(d in R))
964
+ }, 0), !(d in _))
950
965
  return this.container;
951
- const le = k(this), ve = e.time;
952
- for (const T of R[d]) {
953
- const x = T.getState();
954
- if (x === y.EMPTY)
966
+ const P = b(this), G = e.time;
967
+ for (const y of _[d]) {
968
+ const x = y.getState();
969
+ if (x === E.EMPTY)
955
970
  continue;
956
- const D = T.tileCoord;
957
- if (x === y.LOADED && T.getAlpha(le, ve) === 1) {
958
- T.endTransition(le);
971
+ const v = y.tileCoord;
972
+ if (x === E.LOADED && y.getAlpha(P, G) === 1) {
973
+ y.endTransition(P);
959
974
  continue;
960
975
  }
961
- if (x !== y.ERROR && (this.renderComplete = !1), this.findStaleTile_(D, R)) {
962
- dt(R, T, d), e.animate = !0;
976
+ if (x !== E.ERROR && (this.renderComplete = !1), this.findStaleTile_(v, _)) {
977
+ ut(_, y, d), e.animate = !0;
963
978
  continue;
964
979
  }
965
980
  if (this.findAltTiles_(
966
981
  h,
967
- D,
982
+ v,
968
983
  d + 1,
969
- R
984
+ _
970
985
  ))
971
986
  continue;
972
- const b = h.getMinZoom();
973
- for (let M = d - 1; M >= b && !this.findAltTiles_(
987
+ const M = h.getMinZoom();
988
+ for (let L = d - 1; L >= M && !this.findAltTiles_(
974
989
  h,
975
- D,
976
- M,
977
- R
978
- ); --M)
990
+ v,
991
+ L,
992
+ _
993
+ ); --L)
979
994
  ;
980
995
  }
981
- const U = g / a * l / f, _ = this.getRenderContext(e);
982
- oe(
996
+ const z = g / c * o / R, F = this.getRenderContext(e);
997
+ ae(
983
998
  this.tempTransform,
984
- v / 2,
985
- K / 2,
986
- U,
987
- U,
999
+ f / 2,
1000
+ m / 2,
1001
+ z,
1002
+ z,
988
1003
  0,
989
- -v / 2,
990
- -K / 2
991
- ), this.layerExtent && this.clipUnrotated(_, e, this.layerExtent), o.getInterpolate() || (_.imageSmoothingEnabled = !1), this.preRender(_, e);
992
- const q = Object.keys(R).map(Number);
993
- q.sort(Ye);
994
- let w;
995
- const Q = [], ce = [];
996
- for (let T = q.length - 1; T >= 0; --T) {
997
- const x = q[T], D = o.getTilePixelSize(
1004
+ -f / 2,
1005
+ -m / 2
1006
+ ), this.layerExtent && this.clipUnrotated(F, e, this.layerExtent), i.getInterpolate() || (F.imageSmoothingEnabled = !1), this.preRender(F, e);
1007
+ const X = Object.keys(_).map(Number);
1008
+ X.sort(Ye);
1009
+ const B = [], ce = [], Y = [];
1010
+ for (let y = X.length - 1; y >= 0; --y) {
1011
+ const x = X[y], v = i.getTilePixelSize(
998
1012
  x,
999
- l,
1000
- r
1001
- ), A = h.getResolution(x) / g, b = D[0] * A * U, M = D[1] * A * U, G = h.getTileCoordForCoordAndZ(
1002
- Ee(m),
1013
+ o,
1014
+ l
1015
+ ), K = h.getResolution(x) / g, M = v[0] * K * z, L = v[1] * K * z, A = h.getTileCoordForCoordAndZ(
1016
+ we(T),
1003
1017
  x
1004
- ), he = h.getTileCoordExtent(G), B = S(this.tempTransform, [
1005
- f * (he[0] - m[0]) / g,
1006
- f * (m[3] - he[3]) / g
1007
- ]), we = f * o.getGutterForProjection(r);
1008
- for (const N of R[x]) {
1009
- if (N.getState() !== y.LOADED)
1018
+ ), he = h.getTileCoordExtent(A), W = S(this.tempTransform, [
1019
+ R * (he[0] - T[0]) / g,
1020
+ R * (T[3] - he[3]) / g
1021
+ ]), de = R * i.getGutterForProjection(l);
1022
+ for (const D of _[x]) {
1023
+ if (D.getState() !== E.LOADED)
1010
1024
  continue;
1011
- const de = N.tileCoord, ue = G[1] - de[1], Se = Math.round(B[0] - (ue - 1) * b), ge = G[2] - de[2], Ie = Math.round(B[1] - (ge - 1) * M), O = Math.round(B[0] - ue * b), P = Math.round(B[1] - ge * M), V = Se - O, W = Ie - P, fe = q.length === 1;
1012
- let J = !1;
1013
- w = [O, P, O + V, P, O + V, P + W, O, P + W];
1014
- for (let H = 0, Le = Q.length; H < Le; ++H)
1015
- if (!fe && x < ce[H]) {
1016
- const C = Q[H];
1017
- Qe(
1018
- [O, P, O + V, P + W],
1019
- [C[0], C[3], C[4], C[7]]
1020
- ) && (J || (_.save(), J = !0), _.beginPath(), _.moveTo(w[0], w[1]), _.lineTo(w[2], w[3]), _.lineTo(w[4], w[5]), _.lineTo(w[6], w[7]), _.moveTo(C[6], C[7]), _.lineTo(C[4], C[5]), _.lineTo(C[2], C[3]), _.lineTo(C[0], C[1]), _.clip());
1021
- }
1022
- Q.push(w), ce.push(x), this.drawTile(N, e, O, P, V, W, we, fe), J && _.restore(), this.renderedTiles.unshift(N), this.updateUsedTiles(e.usedTiles, o, N);
1025
+ const ue = D.tileCoord, ge = A[1] - ue[1], Se = Math.round(W[0] - (ge - 1) * M), fe = A[2] - ue[2], Ie = Math.round(W[1] - (fe - 1) * L), Z = Math.round(W[0] - ge * M), U = Math.round(W[1] - fe * L), Q = Se - Z, $ = Ie - U, _e = x === d;
1026
+ if (_e && D.inTransition(P)) {
1027
+ Y.push({ tile: D, x: Z, y: U, w: Q, h: $, gutter: de }), this.renderedTiles.unshift(D), this.updateUsedTiles(e.usedTiles, i, D);
1028
+ continue;
1029
+ }
1030
+ const J = [Z, U, Z + Q, U + $], ee = [];
1031
+ for (let q = 0, Le = B.length; q < Le; ++q)
1032
+ x < ce[q] && Qe(J, B[q]) && ee.push(B[q]);
1033
+ let pe;
1034
+ ee.length > 0 && (pe = $e(J, ee)), B.push(J), ce.push(x), this.drawTile(
1035
+ D,
1036
+ e,
1037
+ Z,
1038
+ U,
1039
+ Q,
1040
+ $,
1041
+ de,
1042
+ _e,
1043
+ pe
1044
+ ), this.renderedTiles.unshift(D), this.updateUsedTiles(e.usedTiles, i, D);
1023
1045
  }
1024
1046
  }
1025
- if (this.renderedResolution = g, this.extentChanged = !this.renderedExtent_ || !$e(this.renderedExtent_, m), this.renderedExtent_ = m, this.renderedPixelRatio = l, this.postRender(this.context, e), this.layerExtent && _.restore(), _.imageSmoothingEnabled = !0, this.renderComplete) {
1026
- const T = (x, D) => {
1027
- const $ = k(o), A = D.wantedTiles[$], b = A ? Object.keys(A).length : 0;
1028
- this.updateCacheSize(b), this.tileCache_.expireCache(), this.sourceTileCache_?.expireCache();
1047
+ for (let y = 0, x = Y.length; y < x; ++y) {
1048
+ const { tile: v, x: N, y: K, w: M, h: L, gutter: A } = Y[y];
1049
+ this.drawTile(v, e, N, K, M, L, A, !0, void 0);
1050
+ }
1051
+ if (this.renderedResolution = g, this.extentChanged = !this.renderedExtent_ || !Je(this.renderedExtent_, T), this.renderedExtent_ = T, this.renderedPixelRatio = o, this.postRender(this.context, e), this.layerExtent && F.restore(), F.imageSmoothingEnabled = !0, this.renderComplete) {
1052
+ const y = (x, v) => {
1053
+ const N = b(i), K = v.wantedTiles[N], M = K ? Object.keys(K).length : 0;
1054
+ this.updateCacheSize(M), this.tileCache_.expireCache(), this.sourceTileCache_?.expireCache();
1029
1055
  };
1030
- e.postRenderFunctions.push(T);
1056
+ e.postRenderFunctions.push(y);
1031
1057
  }
1032
1058
  return this.container;
1033
1059
  }
@@ -1050,32 +1076,56 @@ class ut extends ht {
1050
1076
  * @param {number} h Height of the tile.
1051
1077
  * @param {number} gutter Tile gutter.
1052
1078
  * @param {boolean} transition Apply an alpha transition.
1079
+ * @param {Array<import("../../extent.js").Extent>} [clipRects] Sub-rectangles
1080
+ * of the tile to draw. When not provided, the whole tile is drawn; when an
1081
+ * empty array is provided, nothing is drawn (the tile is fully covered by
1082
+ * higher-z tiles).
1053
1083
  * @protected
1054
1084
  */
1055
- drawTile(e, t, n, i, r, a, s, l) {
1056
- let c;
1057
- if (e instanceof Te) {
1058
- if (c = ae(e.getData()), !c)
1085
+ drawTile(e, t, n, s, l, c, r, o, a) {
1086
+ let i;
1087
+ if (e instanceof Re) {
1088
+ if (i = le(e.getData()), !i)
1059
1089
  throw new Error("Rendering array data is not yet supported");
1060
1090
  } else
1061
- c = this.getTileImage(
1091
+ i = this.getTileImage(
1062
1092
  /** @type {import("../../ImageTile.js").default} */
1063
1093
  e
1064
1094
  );
1065
- if (!c)
1095
+ if (!i)
1066
1096
  return;
1067
- const o = this.getRenderContext(t), h = k(this), d = t.layerStatesArray[t.layerIndex], g = d.opacity * (l ? e.getAlpha(h, t.time) : 1), p = g !== o.globalAlpha;
1068
- p && (o.save(), o.globalAlpha = g), o.drawImage(
1069
- c,
1070
- s,
1071
- s,
1072
- c.width - 2 * s,
1073
- c.height - 2 * s,
1074
- n,
1075
- i,
1076
- r,
1077
- a
1078
- ), p && o.restore(), g !== d.opacity ? t.animate = !0 : l && e.endTransition(h);
1097
+ const h = this.getRenderContext(t), d = b(this), g = t.layerStatesArray[t.layerIndex], p = g.opacity * (o ? e.getAlpha(d, t.time) : 1), R = p !== h.globalAlpha;
1098
+ R && (h.save(), h.globalAlpha = p);
1099
+ const f = i.width - 2 * r, m = i.height - 2 * r;
1100
+ if (a) {
1101
+ const I = f / l, C = m / c;
1102
+ for (let T = 0, _ = a.length; T < _; ++T) {
1103
+ const w = a[T], O = w[0], P = w[1], G = w[2] - w[0], z = w[3] - w[1];
1104
+ h.drawImage(
1105
+ i,
1106
+ r + (O - n) * I,
1107
+ r + (P - s) * C,
1108
+ G * I,
1109
+ z * C,
1110
+ O,
1111
+ P,
1112
+ G,
1113
+ z
1114
+ );
1115
+ }
1116
+ } else
1117
+ h.drawImage(
1118
+ i,
1119
+ r,
1120
+ r,
1121
+ f,
1122
+ m,
1123
+ n,
1124
+ s,
1125
+ l,
1126
+ c
1127
+ );
1128
+ R && h.restore(), p !== g.opacity ? t.animate = !0 : o && e.endTransition(d);
1079
1129
  }
1080
1130
  /**
1081
1131
  * @return {HTMLCanvasElement|OffscreenCanvas} Image
@@ -1100,15 +1150,15 @@ class ut extends ht {
1100
1150
  * @protected
1101
1151
  */
1102
1152
  updateUsedTiles(e, t, n) {
1103
- const i = k(t);
1104
- i in e || (e[i] = {}), e[i][n.getKey()] = !0;
1153
+ const s = b(t);
1154
+ s in e || (e[s] = {}), e[s][n.getKey()] = !0;
1105
1155
  }
1106
1156
  }
1107
- const Y = {
1157
+ const H = {
1108
1158
  PRELOAD: "preload",
1109
1159
  USE_INTERIM_TILES_ON_ERROR: "useInterimTilesOnError"
1110
1160
  };
1111
- class gt extends it {
1161
+ class ft extends st {
1112
1162
  /**
1113
1163
  * @param {Options<TileSourceType>} [options] Tile layer options.
1114
1164
  */
@@ -1135,7 +1185,7 @@ class gt extends it {
1135
1185
  getPreload() {
1136
1186
  return (
1137
1187
  /** @type {number} */
1138
- this.get(Y.PRELOAD)
1188
+ this.get(H.PRELOAD)
1139
1189
  );
1140
1190
  }
1141
1191
  /**
@@ -1145,7 +1195,7 @@ class gt extends it {
1145
1195
  * @api
1146
1196
  */
1147
1197
  setPreload(e) {
1148
- this.set(Y.PRELOAD, e);
1198
+ this.set(H.PRELOAD, e);
1149
1199
  }
1150
1200
  /**
1151
1201
  * Deprecated. Whether we use interim tiles on error.
@@ -1156,7 +1206,7 @@ class gt extends it {
1156
1206
  getUseInterimTilesOnError() {
1157
1207
  return (
1158
1208
  /** @type {boolean} */
1159
- this.get(Y.USE_INTERIM_TILES_ON_ERROR)
1209
+ this.get(H.USE_INTERIM_TILES_ON_ERROR)
1160
1210
  );
1161
1211
  }
1162
1212
  /**
@@ -1166,7 +1216,7 @@ class gt extends it {
1166
1216
  * @api
1167
1217
  */
1168
1218
  setUseInterimTilesOnError(e) {
1169
- this.set(Y.USE_INTERIM_TILES_ON_ERROR, e);
1219
+ this.set(H.USE_INTERIM_TILES_ON_ERROR, e);
1170
1220
  }
1171
1221
  /**
1172
1222
  * Get data for a pixel location. The return type depends on the source data. For image tiles,
@@ -1189,7 +1239,7 @@ class gt extends it {
1189
1239
  return super.getData(e);
1190
1240
  }
1191
1241
  }
1192
- class ft extends gt {
1242
+ class _t extends ft {
1193
1243
  /**
1194
1244
  * @param {import("./BaseTile.js").Options<TileSourceType>} [options] Tile layer options.
1195
1245
  */
@@ -1200,21 +1250,21 @@ class ft extends gt {
1200
1250
  * @override
1201
1251
  */
1202
1252
  createRenderer() {
1203
- return new ut(this, {
1253
+ return new gt(this, {
1204
1254
  cacheSize: this.getCacheSize()
1205
1255
  });
1206
1256
  }
1207
1257
  }
1208
- const Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1258
+ const Et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1209
1259
  __proto__: null,
1210
- default: ft
1260
+ default: _t
1211
1261
  }, Symbol.toStringTag, { value: "Module" }));
1212
1262
  export {
1213
- ht as C,
1214
- ft as T,
1215
- ot as Z,
1216
- ut as a,
1217
- Y as b,
1218
- Rt as c,
1219
- Ct as d
1263
+ dt as C,
1264
+ _t as T,
1265
+ at as Z,
1266
+ gt as a,
1267
+ H as b,
1268
+ Ct as c,
1269
+ Et as d
1220
1270
  };