@datagouv/components-next 1.0.1 → 1.0.2-dev.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 (33) hide show
  1. package/dist/{Control-BNCDn-8E.js → Control-DuZJdKV_.js} +1 -1
  2. package/dist/{Datafair.client-B5lBpOl8.js → Datafair.client-DpeBuzZZ.js} +1 -1
  3. package/dist/{Event-BOgJUhNR.js → Event--kp8kMdJ.js} +21 -21
  4. package/dist/{Image-BN-4XkIn.js → Image-34hvypZI.js} +114 -58
  5. package/dist/{JsonPreview.client-Doz1Z0BS.js → JsonPreview.client-B3sQR-rW.js} +1 -1
  6. package/dist/{Map-BdT3i2C4.js → Map-BjUnLyj8.js} +1534 -1466
  7. package/dist/{MapContainer.client-oiieO8H-.js → MapContainer.client-BA6GCqKX.js} +7 -7
  8. package/dist/{OSM-CamriM9b.js → OSM-s40W6sQ2.js} +22 -12
  9. package/dist/{PdfPreview.client-CdAhkDFJ.js → PdfPreview.client-CbeSChb8.js} +1 -1
  10. package/dist/Pmtiles.client-D8pFim1L.js +25190 -0
  11. package/dist/{ScaleLine-BiesrgOv.js → ScaleLine-KW-nXqp3.js} +2 -2
  12. package/dist/Swagger.client-B-2Q16qa.js +4 -0
  13. package/dist/{Tile-DCuqwNOI.js → Tile-DbNFNPfU.js} +189 -172
  14. package/dist/{TileImage-CmZf8EdU.js → TileImage-BsXBxMtq.js} +132 -102
  15. package/dist/{View-DcDc7N2K.js → View-BR92hTWP.js} +8 -8
  16. package/dist/{XmlPreview.client-CrjHf74q.js → XmlPreview.client-DWJt61wG.js} +2 -2
  17. package/dist/{common-C4rDcQpp.js → common-PJfpC179.js} +34 -33
  18. package/dist/components-next.css +4 -4
  19. package/dist/components-next.js +1 -1
  20. package/dist/components.css +1 -1
  21. package/dist/{index-Bbu9rOHt.js → index-DVp7Y0Xu.js} +11105 -6743
  22. package/dist/{main-CiH8ZmBI.js → main-CrSRA2X-.js} +22125 -22173
  23. package/dist/{proj-CKwYjU38.js → proj-DsetBcW7.js} +513 -498
  24. package/dist/{tilecoord-YW3qEH_j.js → tilecoord-Db24Px13.js} +242 -224
  25. package/dist/{vue3-xml-viewer.common-Bi_bsV6C.js → vue3-xml-viewer.common-BjA4LdSC.js} +1 -1
  26. package/package.json +2 -1
  27. package/src/components/ResourceExplorer/ResourceExplorerViewer.vue +1 -50
  28. package/src/composables/useResourceCapabilities.ts +1 -15
  29. package/src/functions/api.ts +3 -11
  30. package/src/types/resources.ts +0 -10
  31. package/dist/Pmtiles.client-B0v8tGJQ.js +0 -22812
  32. package/dist/Swagger.client-CsK65JnG.js +0 -4
  33. package/src/functions/resourceCapabilities.ts +0 -55
@@ -1,13 +1,13 @@
1
- import { T as De, b as Oe, d as ye, I as Ke, R as Pe, g as Me } from "./tilecoord-YW3qEH_j.js";
2
- import { T, g as Te, d as j, c as Ee, t as ze } from "./Image-BN-4XkIn.js";
3
- import { aF as be, aH as Ae, ak as ee, E as ke, _ as je, an as Ce, aI as Fe, az as Ze, aJ as Ne, K as Ue, D as Ge, m as Be, W as qe, a as z, aK as He, j as re, d as oe, a1 as Ve, i as We, G as Xe } from "./proj-CKwYjU38.js";
4
- import { a as te, e as ne, o as Ye, g as v, d as ae, n as $e, p as Qe } from "./common-C4rDcQpp.js";
5
- import { a as xe, R as Je, E as X, L as et } from "./Event-BOgJUhNR.js";
6
- function le(d) {
7
- return d instanceof Image || d instanceof HTMLCanvasElement || d instanceof HTMLVideoElement || d instanceof ImageBitmap ? d : null;
1
+ import { T as Oe, b as Pe, d as ye, g as ee, I as Ke, R as Me } from "./tilecoord-Db24Px13.js";
2
+ import { T, h as Te, d as F, l as ze, j as Ae, W as be, c as me, t as Fe } from "./Image-34hvypZI.js";
3
+ import { aF as je, aH as ke, al as te, E as Ne, $ as Ze, an as we, aI as Ue, az as qe, aJ as Ge, L as Be, F as Ve, n as We, e as He, X as Xe, a as j, aK as Ye, j as re, d as oe, a2 as $e, i as Qe, H as Je } from "./proj-DsetBcW7.js";
4
+ import { a as ne, e as ie, p as et, g as v, d as ae, n as tt, q as nt } from "./common-PJfpC179.js";
5
+ import { a as xe, R as it, E as X, L as st } from "./Event--kp8kMdJ.js";
6
+ function le(u) {
7
+ return u instanceof Image || u instanceof HTMLCanvasElement || u instanceof HTMLVideoElement || u instanceof ImageBitmap ? u : null;
8
8
  }
9
- const tt = new Error("disposed"), nt = [256, 256];
10
- class Re extends De {
9
+ const rt = new Error("disposed"), ot = [256, 256];
10
+ class Re extends Oe {
11
11
  /**
12
12
  * @param {Options} options Tile options.
13
13
  */
@@ -26,7 +26,7 @@ class Re extends De {
26
26
  if (this.size_)
27
27
  return this.size_;
28
28
  const e = le(this.data_);
29
- return e ? [e.width, e.height] : nt;
29
+ return e ? [e.width, e.height] : ot;
30
30
  }
31
31
  /**
32
32
  * Get the data for the tile.
@@ -65,10 +65,10 @@ class Re extends De {
65
65
  * @override
66
66
  */
67
67
  disposeInternal() {
68
- this.controller_ && (this.controller_.abort(tt), this.controller_ = null), super.disposeInternal();
68
+ this.controller_ && (this.controller_.abort(rt), this.controller_ = null), super.disposeInternal();
69
69
  }
70
70
  }
71
- class it {
71
+ class Ce {
72
72
  /**
73
73
  * @param {number} [highWaterMark] High water mark.
74
74
  */
@@ -77,7 +77,7 @@ class it {
77
77
  }
78
78
  deleteOldest() {
79
79
  const e = this.pop();
80
- e instanceof be && e.dispose();
80
+ e instanceof je && e.dispose();
81
81
  }
82
82
  /**
83
83
  * @return {boolean} Can expire cache.
@@ -126,7 +126,7 @@ class it {
126
126
  */
127
127
  get(e, t) {
128
128
  const n = this.entries_[e];
129
- return te(
129
+ return ne(
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 it {
139
139
  */
140
140
  remove(e) {
141
141
  const t = this.entries_[e];
142
- return te(
142
+ return ne(
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 it {
219
219
  * @param {T} value Value.
220
220
  */
221
221
  set(e, t) {
222
- te(
222
+ ne(
223
223
  !(e in this.entries_),
224
224
  "Tried to set a value for a key that is used already"
225
225
  );
@@ -240,7 +240,7 @@ class it {
240
240
  this.highWaterMark = e;
241
241
  }
242
242
  }
243
- class st {
243
+ class at {
244
244
  constructor() {
245
245
  this.instructions_ = [], this.zIndex = 0, this.offset_ = 0, this.context_ = /** @type {ZIndexContextProxy} */
246
246
  new Proxy(Te(), {
@@ -284,7 +284,7 @@ class st {
284
284
  return this.context_;
285
285
  }
286
286
  /**
287
- * @param {CanvasRenderingContext2D} context Context.
287
+ * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.
288
288
  */
289
289
  draw(e) {
290
290
  this.instructions_.forEach((t) => {
@@ -319,13 +319,13 @@ class st {
319
319
  this.offset_ = this.instructions_.length, this.zIndex = 0;
320
320
  }
321
321
  }
322
- const rt = 5;
323
- class ot extends Ae {
322
+ const lt = 5;
323
+ class ct extends ke {
324
324
  /**
325
325
  * @param {LayerType} layer Layer.
326
326
  */
327
327
  constructor(e) {
328
- super(), this.ready = !0, this.boundHandleImageChange_ = this.handleImageChange_.bind(this), this.layer_ = e, this.staleKeys_ = new Array(), this.maxStaleKeys = rt;
328
+ super(), this.ready = !0, this.boundHandleImageChange_ = this.handleImageChange_.bind(this), this.layer_ = e, this.staleKeys_ = new Array(), this.maxStaleKeys = lt;
329
329
  }
330
330
  /**
331
331
  * @return {Array<string>} Get the list of stale keys.
@@ -346,7 +346,7 @@ class ot extends Ae {
346
346
  * an array of features.
347
347
  */
348
348
  getFeatures(e) {
349
- return ee();
349
+ return te();
350
350
  }
351
351
  /**
352
352
  * @param {import("../pixel.js").Pixel} pixel Pixel.
@@ -362,7 +362,7 @@ class ot extends Ae {
362
362
  * @return {boolean} Layer is ready to be rendered.
363
363
  */
364
364
  prepareFrame(e) {
365
- return ee();
365
+ return te();
366
366
  }
367
367
  /**
368
368
  * Render the layer.
@@ -372,7 +372,7 @@ class ot extends Ae {
372
372
  * @return {HTMLElement} The rendered element.
373
373
  */
374
374
  renderFrame(e, t) {
375
- return ee();
375
+ return te();
376
376
  }
377
377
  /**
378
378
  * @abstract
@@ -408,7 +408,7 @@ class ot extends Ae {
408
408
  /** @type {import("../Image.js").default} */
409
409
  e.target
410
410
  );
411
- (t.getState() === j.LOADED || t.getState() === j.ERROR) && this.renderIfReadyAndVisible();
411
+ (t.getState() === F.LOADED || t.getState() === F.ERROR) && this.renderIfReadyAndVisible();
412
412
  }
413
413
  /**
414
414
  * Load the image if not already loaded, and register the image change
@@ -419,7 +419,7 @@ class ot extends Ae {
419
419
  */
420
420
  loadImage(e) {
421
421
  let t = e.getState();
422
- return t != j.LOADED && t != j.ERROR && e.addEventListener(ke.CHANGE, this.boundHandleImageChange_), t == j.IDLE && (e.load(), t = e.getState()), t == j.LOADED;
422
+ return t != F.LOADED && t != F.ERROR && e.addEventListener(Ne.CHANGE, this.boundHandleImageChange_), t == F.IDLE && (e.load(), t = e.getState()), t == F.LOADED;
423
423
  }
424
424
  /**
425
425
  * @protected
@@ -441,19 +441,19 @@ class ot extends Ae {
441
441
  delete this.layer_, super.disposeInternal();
442
442
  }
443
443
  }
444
- const Tt = [];
445
- let F = null;
446
- function at() {
447
- F = Ee(1, 1, void 0, {
444
+ const Ct = [];
445
+ let k = null;
446
+ function ht() {
447
+ k = me(1, 1, void 0, {
448
448
  willReadFrequently: !0
449
449
  });
450
450
  }
451
- class lt extends ot {
451
+ class dt extends ct {
452
452
  /**
453
453
  * @param {LayerType} layer Layer.
454
454
  */
455
455
  constructor(e) {
456
- super(e), this.container = null, this.renderedResolution, this.tempTransform = ne(), this.pixelTransform = ne(), this.inversePixelTransform = ne(), this.context = null, this.deferredContext_ = null, this.containerReused = !1, this.frameState = null;
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;
457
457
  }
458
458
  /**
459
459
  * @param {import('../../DataTile.js').ImageLike} image Image.
@@ -462,12 +462,12 @@ class lt extends ot {
462
462
  * @return {Uint8ClampedArray|null} The image data.
463
463
  */
464
464
  getImageData(e, t, n) {
465
- F || at(), F.clearRect(0, 0, 1, 1);
465
+ k || ht(), k.clearRect(0, 0, 1, 1);
466
466
  let i;
467
467
  try {
468
- F.drawImage(e, t, n, 1, 1, 0, 0, 1, 1), i = F.getImageData(0, 0, 1, 1).data;
468
+ k.drawImage(e, t, n, 1, 1, 0, 0, 1, 1), i = k.getImageData(0, 0, 1, 1).data;
469
469
  } catch {
470
- return F = null, null;
470
+ return k = null, null;
471
471
  }
472
472
  return i;
473
473
  }
@@ -488,30 +488,33 @@ class lt extends ot {
488
488
  useContainer(e, t, n) {
489
489
  const i = this.getLayer().getClassName();
490
490
  let r, a;
491
- if (e && e.className === i && (!n || e && e.style.backgroundColor && je(
491
+ if (e && e.className === i && (!n || e && e.style.backgroundColor && Ze(
492
492
  xe(e.style.backgroundColor),
493
493
  xe(n)
494
494
  ))) {
495
495
  const s = e.firstElementChild;
496
- s instanceof HTMLCanvasElement && (a = s.getContext("2d"));
496
+ ze(s) && (a = s.getContext("2d"));
497
497
  }
498
- if (a && Ye(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 = document.createElement("div"), r.className = i;
498
+ if (a && et(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 = be ? Ae() : document.createElement("div"), r.className = i;
500
500
  let s = r.style;
501
- s.position = "absolute", s.width = "100%", s.height = "100%", a = Ee();
502
- const l = a.canvas;
501
+ s.position = "absolute", s.width = "100%", s.height = "100%", a = me();
502
+ const l = (
503
+ /** @type {HTMLCanvasElement} */
504
+ a.canvas
505
+ );
503
506
  r.appendChild(l), s = l.style, s.position = "absolute", s.left = "0", s.transformOrigin = "top left", this.container = r, this.context = a;
504
507
  }
505
508
  !this.containerReused && n && !this.container.style.backgroundColor && (this.container.style.backgroundColor = n);
506
509
  }
507
510
  /**
508
- * @param {CanvasRenderingContext2D} context Context.
511
+ * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.
509
512
  * @param {import("../../Map.js").FrameState} frameState Frame state.
510
513
  * @param {import("../../extent.js").Extent} extent Clip extent.
511
514
  * @protected
512
515
  */
513
516
  clipUnrotated(e, t, n) {
514
- const i = Ce(n), r = Fe(n), a = Ze(n), s = Ne(n);
517
+ const i = we(n), r = Ue(n), a = qe(n), s = Ge(n);
515
518
  v(t.coordinateToPixelTransform, i), v(t.coordinateToPixelTransform, r), v(t.coordinateToPixelTransform, a), v(t.coordinateToPixelTransform, s);
516
519
  const l = this.inversePixelTransform;
517
520
  v(l, i), v(l, r), v(l, a), v(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();
@@ -522,7 +525,7 @@ class lt extends ot {
522
525
  * @protected
523
526
  */
524
527
  prepareContainer(e, t) {
525
- const n = e.extent, i = e.viewState.resolution, r = e.viewState.rotation, a = e.pixelRatio, s = Math.round(Ue(n) / i * a), l = Math.round(Ge(n) / i * a);
528
+ const n = e.extent, i = e.viewState.resolution, r = e.viewState.rotation, a = e.pixelRatio, s = Math.round(Be(n) / i * a), l = Math.round(Ve(n) / i * a);
526
529
  ae(
527
530
  this.pixelTransform,
528
531
  e.size[0] / 2,
@@ -532,23 +535,24 @@ class lt extends ot {
532
535
  r,
533
536
  -s / 2,
534
537
  -l / 2
535
- ), $e(this.inversePixelTransform, this.pixelTransform);
536
- const c = Qe(this.pixelTransform);
538
+ ), tt(this.inversePixelTransform, this.pixelTransform);
539
+ const c = nt(this.pixelTransform);
537
540
  if (this.useContainer(t, c, this.getBackground(e)), !this.containerReused) {
538
541
  const o = this.context.canvas;
539
- o.width != s || o.height != l ? (o.width = s, o.height = l) : this.context.clearRect(0, 0, s, l), c !== o.style.transform && (o.style.transform = c);
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);
540
544
  }
541
545
  }
542
546
  /**
543
547
  * @param {import("../../render/EventType.js").default} type Event type.
544
- * @param {CanvasRenderingContext2D} context Context.
548
+ * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.
545
549
  * @param {import("../../Map.js").FrameState} frameState Frame state.
546
550
  * @private
547
551
  */
548
552
  dispatchRenderEvent_(e, t, n) {
549
553
  const i = this.getLayer();
550
554
  if (i.hasListener(e)) {
551
- const r = new Je(
555
+ const r = new it(
552
556
  e,
553
557
  this.inversePixelTransform,
554
558
  n,
@@ -558,7 +562,7 @@ class lt extends ot {
558
562
  }
559
563
  }
560
564
  /**
561
- * @param {CanvasRenderingContext2D} context Context.
565
+ * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.
562
566
  * @param {import("../../Map.js").FrameState} frameState Frame state.
563
567
  * @protected
564
568
  */
@@ -566,7 +570,7 @@ class lt extends ot {
566
570
  this.frameState = t, !t.declutter && this.dispatchRenderEvent_(X.PRERENDER, e, t);
567
571
  }
568
572
  /**
569
- * @param {CanvasRenderingContext2D} context Context.
573
+ * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} context Context.
570
574
  * @param {import("../../Map.js").FrameState} frameState Frame state.
571
575
  * @protected
572
576
  */
@@ -583,7 +587,7 @@ class lt extends ot {
583
587
  * @return {import('../../render/canvas/ZIndexContext.js').ZIndexContextProxy} Context.
584
588
  */
585
589
  getRenderContext(e) {
586
- return e.declutter && !this.deferredContext_ && (this.deferredContext_ = new st()), e.declutter ? this.deferredContext_.getContext() : this.context;
590
+ return e.declutter && !this.deferredContext_ && (this.deferredContext_ = new at()), e.declutter ? this.deferredContext_.getContext() : this.context;
587
591
  }
588
592
  /**
589
593
  * @param {import("../../Map.js").FrameState} frameState Frame state.
@@ -613,15 +617,15 @@ class lt extends ot {
613
617
  * @return {!import("../../transform.js").Transform} Transform.
614
618
  */
615
619
  getRenderTransform(e, t, n, i, r, a, s) {
616
- const l = r / 2, c = a / 2, o = i / t, u = -o, h = -e[0] + s, g = -e[1];
620
+ const l = r / 2, c = a / 2, o = i / t, h = -o, d = -e[0] + s, g = -e[1];
617
621
  return ae(
618
622
  this.tempTransform,
619
623
  l,
620
624
  c,
621
625
  o,
622
- u,
623
- -n,
624
626
  h,
627
+ -n,
628
+ d,
625
629
  g
626
630
  );
627
631
  }
@@ -633,44 +637,41 @@ class lt extends ot {
633
637
  delete this.frameState, super.disposeInternal();
634
638
  }
635
639
  }
636
- function ie(d, e, t, n, i) {
637
- return `${z(d)},${e},${Me(t, n, i)}`;
638
- }
639
- function se(d, e, t) {
640
- if (!(t in d))
641
- return d[t] = /* @__PURE__ */ new Set([e]), !0;
642
- const n = d[t], i = n.has(e);
640
+ function se(u, e, t) {
641
+ if (!(t in u))
642
+ return u[t] = /* @__PURE__ */ new Set([e]), !0;
643
+ const n = u[t], i = n.has(e);
643
644
  return i || n.add(e), !i;
644
645
  }
645
- function ct(d, e, t) {
646
- const n = d[t];
646
+ function ut(u, e, t) {
647
+ const n = u[t];
647
648
  return n ? n.delete(e) : !1;
648
649
  }
649
- function me(d, e) {
650
- const t = d.layerStatesArray[d.layerIndex];
650
+ function Ee(u, e) {
651
+ const t = u.layerStatesArray[u.layerIndex];
651
652
  t.extent && (e = oe(
652
653
  e,
653
- re(t.extent, d.viewState.projection)
654
+ re(t.extent, u.viewState.projection)
654
655
  ));
655
656
  const n = (
656
657
  /** @type {import("../../source/Tile.js").default} */
657
658
  t.layer.getRenderSource()
658
659
  );
659
660
  if (!n.getWrapX()) {
660
- const i = n.getTileGridForProjection(d.viewState.projection).getExtent();
661
+ const i = n.getTileGridForProjection(u.viewState.projection).getExtent();
661
662
  i && (e = oe(e, i));
662
663
  }
663
664
  return e;
664
665
  }
665
- class ht extends lt {
666
+ class gt extends dt {
666
667
  /**
667
668
  * @param {LayerType} tileLayer Tile layer.
668
669
  * @param {Options} [options] Options.
669
670
  */
670
671
  constructor(e, t) {
671
- 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 = Be(), this.tempTileRange_ = new Oe(0, 0, 0, 0), this.tempTileCoord_ = ye(0, 0, 0);
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 = We(), this.tempTileRange_ = new Pe(0, 0, 0, 0), this.tempTileCoord_ = ye(0, 0, 0);
672
673
  const n = t.cacheSize !== void 0 ? t.cacheSize : 512;
673
- this.tileCache_ = new it(n), this.maxStaleKeys = n * 0.5;
674
+ this.tileCache_ = new Ce(n), this.sourceTileCache_ = null, this.maxStaleKeys = n * 0.5;
674
675
  }
675
676
  /**
676
677
  * @return {LRUCache} Tile cache.
@@ -678,6 +679,12 @@ class ht extends lt {
678
679
  getTileCache() {
679
680
  return this.tileCache_;
680
681
  }
682
+ /**
683
+ * @return {LRUCache} Tile cache.
684
+ */
685
+ getSourceTileCache() {
686
+ return this.sourceTileCache_ || (this.sourceTileCache_ = new Ce(512)), this.sourceTileCache_;
687
+ }
681
688
  /**
682
689
  * Get a tile from the cache or create one if needed.
683
690
  *
@@ -689,17 +696,19 @@ class ht extends lt {
689
696
  * @protected
690
697
  */
691
698
  getOrCreateTile(e, t, n, i) {
692
- const r = this.tileCache_, s = this.getLayer().getSource(), l = ie(s, s.getKey(), e, t, n);
699
+ const r = this.tileCache_, s = this.getLayer().getSource(), l = ee(s, s.getKey(), e, t, n);
693
700
  let c;
694
701
  if (r.containsKey(l))
695
702
  c = r.get(l);
696
703
  else {
704
+ const o = i.viewState.projection, h = s.getProjection();
697
705
  if (c = s.getTile(
698
706
  e,
699
707
  t,
700
708
  n,
701
709
  i.pixelRatio,
702
- i.viewState.projection
710
+ o,
711
+ !h || He(h, o) ? void 0 : this.getSourceTileCache()
703
712
  ), !c)
704
713
  return null;
705
714
  r.set(l, c);
@@ -731,30 +740,30 @@ class ht extends lt {
731
740
  t.pixelToCoordinateTransform,
732
741
  e.slice()
733
742
  ), r = n.getExtent();
734
- if (r && !qe(r, i))
743
+ if (r && !Xe(r, i))
735
744
  return null;
736
745
  const a = t.viewState, s = n.getRenderSource(), l = s.getTileGridForProjection(a.projection), c = s.getTilePixelRatio(t.pixelRatio);
737
746
  for (let o = l.getZForResolution(a.resolution); o >= l.getMinZoom(); --o) {
738
- const u = l.getTileCoordForCoordAndZ(i, o), h = this.getTile(o, u[1], u[2], t);
739
- if (!h || h.getState() !== T.LOADED)
747
+ const h = l.getTileCoordForCoordAndZ(i, o), d = this.getTile(o, h[1], h[2], t);
748
+ if (!d || d.getState() !== T.LOADED)
740
749
  continue;
741
- const g = l.getOrigin(o), p = ze(l.getTileSize(o)), S = l.getResolution(o);
750
+ const g = l.getOrigin(o), p = Fe(l.getTileSize(o)), S = l.getResolution(o);
742
751
  let f;
743
- if (h instanceof Ke || h instanceof Pe)
744
- f = h.getImage();
745
- else if (h instanceof Re) {
746
- if (f = le(h.getData()), !f)
752
+ if (d instanceof Ke || d instanceof Me)
753
+ f = d.getImage();
754
+ else if (d instanceof Re) {
755
+ if (f = le(d.getData()), !f)
747
756
  continue;
748
757
  } else
749
758
  continue;
750
- const C = Math.floor(
751
- c * ((i[0] - g[0]) / S - u[1] * p[0])
752
- ), P = Math.floor(
753
- c * ((g[1] - i[1]) / S - u[2] * p[1])
759
+ const m = Math.floor(
760
+ c * ((i[0] - g[0]) / S - h[1] * p[0])
761
+ ), K = Math.floor(
762
+ c * ((g[1] - i[1]) / S - h[2] * p[1])
754
763
  ), E = Math.round(
755
764
  c * s.getGutterForProjection(a.projection)
756
765
  );
757
- return this.getImageData(f, C + E, P + E);
766
+ return this.getImageData(f, m + E, K + E);
758
767
  }
759
768
  return null;
760
769
  }
@@ -770,7 +779,15 @@ class ht extends lt {
770
779
  if (!t)
771
780
  return !1;
772
781
  const n = t.getRevision();
773
- return this.renderedSourceRevision_ ? this.renderedSourceRevision_ !== n && (this.renderedSourceRevision_ = n, this.renderedSourceKey_ === t.getKey() && this.tileCache_.clear()) : this.renderedSourceRevision_ = n, !0;
782
+ return this.renderedSourceRevision_ ? this.renderedSourceRevision_ !== n && (this.renderedSourceRevision_ = n, this.renderedSourceKey_ === t.getKey() && (this.tileCache_.clear(), this.sourceTileCache_?.clear())) : this.renderedSourceRevision_ = n, !0;
783
+ }
784
+ /**
785
+ * Determine whether tiles for next extent should be enqueued for rendering.
786
+ * @return {boolean} Rendering tiles for next extent is supported.
787
+ * @protected
788
+ */
789
+ enqueueTilesForNextExtent() {
790
+ return !0;
774
791
  }
775
792
  /**
776
793
  * @param {import("../../Map.js").FrameState} frameState Frame state.
@@ -780,45 +797,45 @@ class ht extends lt {
780
797
  * @param {number} preload Number of additional levels to load.
781
798
  */
782
799
  enqueueTiles(e, t, n, i, r) {
783
- const a = e.viewState, s = this.getLayer(), l = s.getRenderSource(), c = l.getTileGridForProjection(a.projection), o = z(l);
800
+ const a = e.viewState, s = this.getLayer(), l = s.getRenderSource(), c = l.getTileGridForProjection(a.projection), o = j(l);
784
801
  o in e.wantedTiles || (e.wantedTiles[o] = {});
785
- const u = e.wantedTiles[o], h = s.getMapInternal(), g = Math.max(
802
+ const h = e.wantedTiles[o], d = s.getMapInternal(), g = Math.max(
786
803
  n - r,
787
804
  c.getMinZoom(),
788
805
  c.getZForResolution(
789
806
  Math.min(
790
807
  s.getMaxResolution(),
791
- h ? h.getView().getResolutionForZoom(Math.max(s.getMinZoom(), 0)) : c.getResolution(0)
808
+ d ? d.getView().getResolutionForZoom(Math.max(s.getMinZoom(), 0)) : c.getResolution(0)
792
809
  ),
793
810
  l.zDirection
794
811
  )
795
- ), p = a.rotation, S = p ? He(
812
+ ), p = a.rotation, S = p ? Ye(
796
813
  a.center,
797
814
  a.resolution,
798
815
  p,
799
816
  e.size
800
817
  ) : void 0;
801
818
  for (let f = n; f >= g; --f) {
802
- const C = c.getTileRangeForExtentAndZ(
819
+ const m = c.getTileRangeForExtentAndZ(
803
820
  t,
804
821
  f,
805
822
  this.tempTileRange_
806
- ), P = c.getResolution(f);
807
- for (let E = C.minX; E <= C.maxX; ++E)
808
- for (let I = C.minY; I <= C.maxY; ++I) {
823
+ ), K = c.getResolution(f);
824
+ for (let E = m.minX; E <= m.maxX; ++E)
825
+ for (let I = m.minY; I <= m.maxY; ++I) {
809
826
  if (p && !c.tileCoordIntersectsViewport([f, E, I], S))
810
827
  continue;
811
828
  const L = this.getTile(f, E, I, e);
812
829
  if (!L || !se(i, L, f))
813
830
  continue;
814
831
  const y = L.getKey();
815
- if (u[y] = !0, L.getState() === T.IDLE && !e.tileQueue.isKeyQueued(y)) {
816
- const Z = ye(f, E, I, this.tempTileCoord_);
832
+ if (h[y] = !0, L.getState() === T.IDLE && !e.tileQueue.isKeyQueued(y)) {
833
+ const N = ye(f, E, I, this.tempTileCoord_);
817
834
  e.tileQueue.enqueue([
818
835
  L,
819
836
  o,
820
- c.getTileCoordCenter(Z),
821
- P
837
+ c.getTileCoordCenter(N),
838
+ K
822
839
  ]);
823
840
  }
824
841
  }
@@ -835,7 +852,7 @@ class ht extends lt {
835
852
  findStaleTile_(e, t) {
836
853
  const n = this.tileCache_, i = e[0], r = e[1], a = e[2], s = this.getStaleKeys();
837
854
  for (let l = 0; l < s.length; ++l) {
838
- const c = ie(
855
+ const c = ee(
839
856
  this.getLayer().getSource(),
840
857
  s[l],
841
858
  i,
@@ -845,7 +862,7 @@ class ht extends lt {
845
862
  if (n.containsKey(c)) {
846
863
  const o = n.peek(c);
847
864
  if (o.getState() === T.LOADED)
848
- return o.endTransition(z(this)), se(t, o, i), !0;
865
+ return o.endTransition(j(this)), se(t, o, i), !0;
849
866
  }
850
867
  }
851
868
  return !1;
@@ -871,11 +888,11 @@ class ht extends lt {
871
888
  let a = !0;
872
889
  const s = this.tileCache_, l = this.getLayer().getRenderSource(), c = l.getKey();
873
890
  for (let o = r.minX; o <= r.maxX; ++o)
874
- for (let u = r.minY; u <= r.maxY; ++u) {
875
- const h = ie(l, c, n, o, u);
891
+ for (let h = r.minY; h <= r.maxY; ++h) {
892
+ const d = ee(l, c, n, o, h);
876
893
  let g = !1;
877
- if (s.containsKey(h)) {
878
- const p = s.peek(h);
894
+ if (s.containsKey(d)) {
895
+ const p = s.peek(d);
879
896
  p.getState() === T.LOADED && (se(i, p, n), g = !0);
880
897
  }
881
898
  g || (a = !1);
@@ -898,66 +915,66 @@ class ht extends lt {
898
915
  */
899
916
  renderFrame(e, t) {
900
917
  this.renderComplete = !0;
901
- 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(), u = o.getTileGridForProjection(r), h = u.getZForResolution(a, o.zDirection), g = u.getResolution(h), p = o.getKey();
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();
902
919
  this.renderedSourceKey_ ? this.renderedSourceKey_ !== p && (this.prependStaleKey(this.renderedSourceKey_), this.renderedSourceKey_ = p) : this.renderedSourceKey_ = p;
903
920
  let S = e.extent;
904
921
  const f = o.getTilePixelRatio(l);
905
922
  this.prepareContainer(e, t);
906
- const C = this.context.canvas.width, P = this.context.canvas.height, E = n.extent && re(n.extent);
923
+ const m = this.context.canvas.width, K = this.context.canvas.height, E = n.extent && re(n.extent);
907
924
  E && (S = oe(
908
925
  S,
909
926
  re(n.extent)
910
927
  ));
911
- const I = g * C / 2 / f, L = g * P / 2 / f, b = [
928
+ const I = g * m / 2 / f, L = g * K / 2 / f, z = [
912
929
  s[0] - I,
913
930
  s[1] - L,
914
931
  s[0] + I,
915
932
  s[1] + L
916
933
  ], y = {};
917
934
  this.renderedTiles.length = 0;
918
- const Z = c.getPreload();
919
- if (e.nextExtent) {
920
- const x = u.getZForResolution(
935
+ const N = c.getPreload();
936
+ if (e.nextExtent && this.enqueueTilesForNextExtent()) {
937
+ const x = h.getZForResolution(
921
938
  i.nextResolution,
922
939
  o.zDirection
923
- ), R = me(e, e.nextExtent);
924
- this.enqueueTiles(e, R, x, y, Z);
940
+ ), R = Ee(e, e.nextExtent);
941
+ this.enqueueTiles(e, R, x, y, N);
925
942
  }
926
- const ce = me(e, S);
927
- if (this.enqueueTiles(e, ce, h, y, 0), Z > 0 && setTimeout(() => {
943
+ const ce = Ee(e, S);
944
+ if (this.enqueueTiles(e, ce, d, y, 0), N > 0 && setTimeout(() => {
928
945
  this.enqueueTiles(
929
946
  e,
930
947
  ce,
931
- h - 1,
948
+ d - 1,
932
949
  y,
933
- Z - 1
950
+ N - 1
934
951
  );
935
- }, 0), !(h in y))
952
+ }, 0), !(d in y))
936
953
  return this.container;
937
- const he = z(this), we = e.time;
938
- for (const x of y[h]) {
954
+ const he = j(this), ve = e.time;
955
+ for (const x of y[d]) {
939
956
  const R = x.getState();
940
957
  if (R === T.EMPTY)
941
958
  continue;
942
959
  const D = x.tileCoord;
943
- if (R === T.LOADED && x.getAlpha(he, we) === 1) {
960
+ if (R === T.LOADED && x.getAlpha(he, ve) === 1) {
944
961
  x.endTransition(he);
945
962
  continue;
946
963
  }
947
964
  if (R !== T.ERROR && (this.renderComplete = !1), this.findStaleTile_(D, y)) {
948
- ct(y, x, h), e.animate = !0;
965
+ ut(y, x, d), e.animate = !0;
949
966
  continue;
950
967
  }
951
968
  if (this.findAltTiles_(
952
- u,
969
+ h,
953
970
  D,
954
- h + 1,
971
+ d + 1,
955
972
  y
956
973
  ))
957
974
  continue;
958
- const k = u.getMinZoom();
959
- for (let M = h - 1; M >= k && !this.findAltTiles_(
960
- u,
975
+ const b = h.getMinZoom();
976
+ for (let M = d - 1; M >= b && !this.findAltTiles_(
977
+ h,
961
978
  D,
962
979
  M,
963
980
  y
@@ -967,51 +984,51 @@ class ht extends lt {
967
984
  const U = g / a * l / f, _ = this.getRenderContext(e);
968
985
  ae(
969
986
  this.tempTransform,
970
- C / 2,
971
- P / 2,
987
+ m / 2,
988
+ K / 2,
972
989
  U,
973
990
  U,
974
991
  0,
975
- -C / 2,
976
- -P / 2
992
+ -m / 2,
993
+ -K / 2
977
994
  ), n.extent && this.clipUnrotated(_, e, E), o.getInterpolate() || (_.imageSmoothingEnabled = !1), this.preRender(_, e);
978
- const G = Object.keys(y).map(Number);
979
- G.sort(Ve);
995
+ const q = Object.keys(y).map(Number);
996
+ q.sort($e);
980
997
  let w;
981
998
  const $ = [], de = [];
982
- for (let x = G.length - 1; x >= 0; --x) {
983
- const R = G[x], D = o.getTilePixelSize(
999
+ for (let x = q.length - 1; x >= 0; --x) {
1000
+ const R = q[x], D = o.getTilePixelSize(
984
1001
  R,
985
1002
  l,
986
1003
  r
987
- ), A = u.getResolution(R) / g, k = D[0] * A * U, M = D[1] * A * U, B = u.getTileCoordForCoordAndZ(
988
- Ce(b),
1004
+ ), A = h.getResolution(R) / g, b = D[0] * A * U, M = D[1] * A * U, G = h.getTileCoordForCoordAndZ(
1005
+ we(z),
989
1006
  R
990
- ), ue = u.getTileCoordExtent(B), q = v(this.tempTransform, [
991
- f * (ue[0] - b[0]) / g,
992
- f * (b[3] - ue[3]) / g
993
- ]), ve = f * o.getGutterForProjection(r);
994
- for (const N of y[R]) {
995
- if (N.getState() !== T.LOADED)
1007
+ ), ue = h.getTileCoordExtent(G), B = v(this.tempTransform, [
1008
+ f * (ue[0] - z[0]) / g,
1009
+ f * (z[3] - ue[3]) / g
1010
+ ]), Se = f * o.getGutterForProjection(r);
1011
+ for (const Z of y[R]) {
1012
+ if (Z.getState() !== T.LOADED)
996
1013
  continue;
997
- const ge = N.tileCoord, fe = B[1] - ge[1], Se = Math.round(q[0] - (fe - 1) * k), _e = B[2] - ge[2], Ie = Math.round(q[1] - (_e - 1) * M), O = Math.round(q[0] - fe * k), K = Math.round(q[1] - _e * M), H = Se - O, V = Ie - K, pe = G.length === 1;
1014
+ const ge = Z.tileCoord, fe = G[1] - ge[1], Ie = Math.round(B[0] - (fe - 1) * b), _e = G[2] - ge[2], Le = Math.round(B[1] - (_e - 1) * M), O = Math.round(B[0] - fe * b), P = Math.round(B[1] - _e * M), V = Ie - O, W = Le - P, pe = q.length === 1;
998
1015
  let J = !1;
999
- w = [O, K, O + H, K, O + H, K + V, O, K + V];
1000
- for (let W = 0, Le = $.length; W < Le; ++W)
1001
- if (!pe && R < de[W]) {
1002
- const m = $[W];
1003
- We(
1004
- [O, K, O + H, K + V],
1005
- [m[0], m[3], m[4], m[7]]
1006
- ) && (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(m[6], m[7]), _.lineTo(m[4], m[5]), _.lineTo(m[2], m[3]), _.lineTo(m[0], m[1]), _.clip());
1016
+ w = [O, P, O + V, P, O + V, P + W, O, P + W];
1017
+ for (let H = 0, De = $.length; H < De; ++H)
1018
+ if (!pe && R < de[H]) {
1019
+ const C = $[H];
1020
+ Qe(
1021
+ [O, P, O + V, P + W],
1022
+ [C[0], C[3], C[4], C[7]]
1023
+ ) && (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());
1007
1024
  }
1008
- $.push(w), de.push(R), this.drawTile(N, e, O, K, H, V, ve, pe), J && _.restore(), this.renderedTiles.unshift(N), this.updateUsedTiles(e.usedTiles, o, N);
1025
+ $.push(w), de.push(R), this.drawTile(Z, e, O, P, V, W, Se, pe), J && _.restore(), this.renderedTiles.unshift(Z), this.updateUsedTiles(e.usedTiles, o, Z);
1009
1026
  }
1010
1027
  }
1011
- if (this.renderedResolution = g, this.extentChanged = !this.renderedExtent_ || !Xe(this.renderedExtent_, b), this.renderedExtent_ = b, this.renderedPixelRatio = l, this.postRender(this.context, e), n.extent && _.restore(), _.imageSmoothingEnabled = !0, this.renderComplete) {
1028
+ if (this.renderedResolution = g, this.extentChanged = !this.renderedExtent_ || !Je(this.renderedExtent_, z), this.renderedExtent_ = z, this.renderedPixelRatio = l, this.postRender(this.context, e), n.extent && _.restore(), _.imageSmoothingEnabled = !0, this.renderComplete) {
1012
1029
  const x = (R, D) => {
1013
- const Q = z(o), A = D.wantedTiles[Q], k = A ? Object.keys(A).length : 0;
1014
- this.updateCacheSize(k), this.tileCache_.expireCache();
1030
+ const Q = j(o), A = D.wantedTiles[Q], b = A ? Object.keys(A).length : 0;
1031
+ this.updateCacheSize(b), this.tileCache_.expireCache(), this.sourceTileCache_?.expireCache();
1015
1032
  };
1016
1033
  e.postRenderFunctions.push(x);
1017
1034
  }
@@ -1050,7 +1067,7 @@ class ht extends lt {
1050
1067
  );
1051
1068
  if (!c)
1052
1069
  return;
1053
- const o = this.getRenderContext(t), u = z(this), h = t.layerStatesArray[t.layerIndex], g = h.opacity * (l ? e.getAlpha(u, t.time) : 1), p = g !== o.globalAlpha;
1070
+ const o = this.getRenderContext(t), h = j(this), d = t.layerStatesArray[t.layerIndex], g = d.opacity * (l ? e.getAlpha(h, t.time) : 1), p = g !== o.globalAlpha;
1054
1071
  p && (o.save(), o.globalAlpha = g), o.drawImage(
1055
1072
  c,
1056
1073
  s,
@@ -1061,10 +1078,10 @@ class ht extends lt {
1061
1078
  i,
1062
1079
  r,
1063
1080
  a
1064
- ), p && o.restore(), g !== h.opacity ? t.animate = !0 : l && e.endTransition(u);
1081
+ ), p && o.restore(), g !== d.opacity ? t.animate = !0 : l && e.endTransition(h);
1065
1082
  }
1066
1083
  /**
1067
- * @return {HTMLCanvasElement} Image
1084
+ * @return {HTMLCanvasElement|OffscreenCanvas} Image
1068
1085
  */
1069
1086
  getImage() {
1070
1087
  const e = this.context;
@@ -1073,7 +1090,7 @@ class ht extends lt {
1073
1090
  /**
1074
1091
  * Get the image from a tile.
1075
1092
  * @param {import("../../ImageTile.js").default} tile Tile.
1076
- * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
1093
+ * @return {HTMLCanvasElement|OffscreenCanvas|HTMLImageElement|HTMLVideoElement} Image.
1077
1094
  * @protected
1078
1095
  */
1079
1096
  getTileImage(e) {
@@ -1086,7 +1103,7 @@ class ht extends lt {
1086
1103
  * @protected
1087
1104
  */
1088
1105
  updateUsedTiles(e, t, n) {
1089
- const i = z(t);
1106
+ const i = j(t);
1090
1107
  i in e || (e[i] = {}), e[i][n.getKey()] = !0;
1091
1108
  }
1092
1109
  }
@@ -1094,7 +1111,7 @@ const Y = {
1094
1111
  PRELOAD: "preload",
1095
1112
  USE_INTERIM_TILES_ON_ERROR: "useInterimTilesOnError"
1096
1113
  };
1097
- class dt extends et {
1114
+ class ft extends st {
1098
1115
  /**
1099
1116
  * @param {Options<TileSourceType>} [options] Tile layer options.
1100
1117
  */
@@ -1175,7 +1192,7 @@ class dt extends et {
1175
1192
  return super.getData(e);
1176
1193
  }
1177
1194
  }
1178
- class ut extends dt {
1195
+ class _t extends ft {
1179
1196
  /**
1180
1197
  * @param {import("./BaseTile.js").Options<TileSourceType>} [options] Tile layer options.
1181
1198
  */
@@ -1186,21 +1203,21 @@ class ut extends dt {
1186
1203
  * @override
1187
1204
  */
1188
1205
  createRenderer() {
1189
- return new ht(this, {
1206
+ return new gt(this, {
1190
1207
  cacheSize: this.getCacheSize()
1191
1208
  });
1192
1209
  }
1193
1210
  }
1194
- const xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1211
+ const Et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1195
1212
  __proto__: null,
1196
- default: ut
1213
+ default: _t
1197
1214
  }, Symbol.toStringTag, { value: "Module" }));
1198
1215
  export {
1199
- lt as C,
1200
- ut as T,
1201
- st as Z,
1202
- ht as a,
1216
+ dt as C,
1217
+ _t as T,
1218
+ at as Z,
1219
+ gt as a,
1203
1220
  Y as b,
1204
- Tt as c,
1205
- xt as d
1221
+ Ct as c,
1222
+ Et as d
1206
1223
  };