@arcgis/map-components 5.2.0-next.60 → 5.2.0-next.62

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 (162) hide show
  1. package/dist/cdn/2SZEQV37.js +2 -0
  2. package/dist/cdn/3WTBTYMS.js +2 -0
  3. package/dist/cdn/4ZHTGN7K.js +2 -0
  4. package/dist/cdn/55DP6FNP.js +2 -0
  5. package/dist/cdn/{X6K2RSPI.js → 5IYDETJ3.js} +1 -1
  6. package/dist/cdn/{WYZPOKJF.js → 7MH3SB7P.js} +1 -1
  7. package/dist/cdn/A2T36WPR.js +2 -0
  8. package/dist/cdn/AEIJFBBW.js +2 -0
  9. package/dist/cdn/{NRHOAASJ.js → APOCPBJG.js} +1 -1
  10. package/dist/cdn/AZFN3LR3.js +2 -0
  11. package/dist/cdn/{F3VS53GP.js → B4IHQKAA.js} +1 -1
  12. package/dist/cdn/{AFJW3C3J.js → CZ35ZBQO.js} +1 -1
  13. package/dist/cdn/DBA7NSTP.js +2 -0
  14. package/dist/cdn/{KEV6I36K.js → DJ5IUHJS.js} +1 -1
  15. package/dist/cdn/GU3M4JMW.js +2 -0
  16. package/dist/cdn/HFKN54XG.js +2 -0
  17. package/dist/cdn/{2JV5SN44.js → IDKRMHDS.js} +1 -1
  18. package/dist/cdn/{Y3X3K2RU.js → IYLOUQFV.js} +1 -1
  19. package/dist/cdn/{CJS5I43A.js → MZBHKC3U.js} +1 -1
  20. package/dist/cdn/{OMGRHB7H.js → ND6OMAWU.js} +1 -1
  21. package/dist/cdn/{KKBZEDN4.js → OIYQ43VS.js} +1 -1
  22. package/dist/cdn/{UX6QVJG6.js → ORL32J3S.js} +1 -1
  23. package/dist/cdn/{5W6NJGFF.js → QKCBSK73.js} +1 -1
  24. package/dist/cdn/{SCPSWHG4.js → QU6ARDF6.js} +1 -1
  25. package/dist/cdn/{QVOYYXIU.js → RLA7OC3V.js} +1 -1
  26. package/dist/cdn/{ALUQRMZW.js → RUI2QLEM.js} +1 -1
  27. package/dist/cdn/S3XR7KRN.js +2 -0
  28. package/dist/cdn/{T6CKYPI7.js → SADIYG5D.js} +1 -1
  29. package/dist/cdn/SRTPZO5Z.js +2 -0
  30. package/dist/cdn/U4S4I3VD.js +2 -0
  31. package/dist/cdn/{N2KU7FO4.js → UAA66BVA.js} +1 -1
  32. package/dist/cdn/VDTRRLON.js +2 -0
  33. package/dist/cdn/{CFIH5Y4K.js → YAXMVCUT.js} +1 -1
  34. package/dist/cdn/{5F6Q3XF5.js → ZV5BQFVT.js} +1 -1
  35. package/dist/cdn/assets/oriented-imagery-viewer-panoramic-viewer/t9n/messages.en.json +1 -0
  36. package/dist/cdn/index.js +1 -1
  37. package/dist/cdn/main.css +1 -1
  38. package/dist/chunks/action-utils.js +9 -9
  39. package/dist/chunks/graphicsLayerController.js +74 -0
  40. package/dist/chunks/utils3.js +13 -45
  41. package/dist/chunks/utils4.js +51 -0
  42. package/dist/chunks/zoom.js +32 -0
  43. package/dist/components/arcgis-aggregated-features/customElement.js +11 -11
  44. package/dist/components/arcgis-area-measurement-2d/customElement.d.ts +4 -4
  45. package/dist/components/arcgis-area-measurement-3d/customElement.d.ts +2 -2
  46. package/dist/components/arcgis-basemap-gallery/customElement.d.ts +2 -2
  47. package/dist/components/arcgis-basemap-layer-list/customElement.d.ts +2 -2
  48. package/dist/components/arcgis-basemap-layer-list-next/customElement.d.ts +2 -2
  49. package/dist/components/arcgis-basemap-toggle/customElement.d.ts +2 -2
  50. package/dist/components/arcgis-bookmarks/customElement.d.ts +2 -2
  51. package/dist/components/arcgis-building-explorer/customElement.d.ts +2 -2
  52. package/dist/components/arcgis-catalog-layer-list/customElement.d.ts +2 -2
  53. package/dist/components/arcgis-catalog-layer-list-next/customElement.d.ts +23 -18
  54. package/dist/components/arcgis-catalog-layer-list-next/customElement.js +125 -114
  55. package/dist/components/arcgis-clipboard/customElement.d.ts +2 -2
  56. package/dist/components/arcgis-compass/customElement.d.ts +2 -2
  57. package/dist/components/arcgis-coordinate-conversion/customElement.d.ts +2 -2
  58. package/dist/components/arcgis-coordinate-conversion-next/customElement.d.ts +2 -2
  59. package/dist/components/arcgis-daylight/customElement.d.ts +2 -2
  60. package/dist/components/arcgis-direct-line-measurement-3d/customElement.d.ts +2 -2
  61. package/dist/components/arcgis-directional-pad/customElement.d.ts +2 -2
  62. package/dist/components/arcgis-directions/customElement.d.ts +2 -2
  63. package/dist/components/arcgis-distance-measurement-2d/customElement.d.ts +2 -2
  64. package/dist/components/arcgis-editor/customElement.d.ts +3 -3
  65. package/dist/components/arcgis-elevation-profile/customElement.d.ts +2 -2
  66. package/dist/components/arcgis-expand/customElement.d.ts +2 -2
  67. package/dist/components/arcgis-feature/customElement.d.ts +2 -2
  68. package/dist/components/arcgis-feature-next/customElement.d.ts +2 -2
  69. package/dist/components/arcgis-feature-next/customElement.js +1 -1
  70. package/dist/components/arcgis-feature-relationship/customElement.js +1 -1
  71. package/dist/components/arcgis-feature-table/customElement.d.ts +2 -2
  72. package/dist/components/arcgis-feature-templates/customElement.d.ts +2 -2
  73. package/dist/components/arcgis-feature-utility-network-associations/customElement.js +1 -1
  74. package/dist/components/arcgis-features-next/customElement.d.ts +1 -1
  75. package/dist/components/arcgis-features-next/customElement.js +1 -1
  76. package/dist/components/arcgis-floor-filter/customElement.d.ts +2 -2
  77. package/dist/components/arcgis-grid-controls/customElement.d.ts +2 -2
  78. package/dist/components/arcgis-home/customElement.d.ts +2 -2
  79. package/dist/components/arcgis-layer-list/customElement.d.ts +2 -2
  80. package/dist/components/arcgis-layer-list-next/customElement.d.ts +2 -2
  81. package/dist/components/arcgis-legend/customElement.d.ts +2 -2
  82. package/dist/components/arcgis-line-of-sight/customElement.d.ts +2 -2
  83. package/dist/components/arcgis-link-chart-layout-switcher/customElement.d.ts +2 -2
  84. package/dist/components/arcgis-link-chart-nonspatial-visibility-toggle/customElement.d.ts +2 -2
  85. package/dist/components/arcgis-locate/customElement.d.ts +2 -2
  86. package/dist/components/arcgis-measurement/customElement.d.ts +2 -2
  87. package/dist/components/arcgis-multi-feature-form/customElement.d.ts +2 -2
  88. package/dist/components/arcgis-navigation-toggle/customElement.d.ts +2 -2
  89. package/dist/components/arcgis-oriented-imagery-viewer/customElement.d.ts +2 -2
  90. package/dist/components/arcgis-oriented-imagery-viewer-image-viewer/customElement.js +64 -132
  91. package/dist/components/arcgis-oriented-imagery-viewer-panoramic-viewer/customElement.d.ts +51 -0
  92. package/dist/components/arcgis-oriented-imagery-viewer-panoramic-viewer/customElement.js +1006 -0
  93. package/dist/components/arcgis-oriented-imagery-viewer-panoramic-viewer/index.d.ts +1 -0
  94. package/dist/components/arcgis-oriented-imagery-viewer-panoramic-viewer/index.js +5 -0
  95. package/dist/components/arcgis-oriented-imagery-viewer-panoramic-viewer/support/PanoramicMedia.d.ts +49 -0
  96. package/dist/components/arcgis-oriented-imagery-viewer-panoramic-viewer/support/PanoramicTilePlanner.d.ts +18 -0
  97. package/dist/components/arcgis-oriented-imagery-viewer-panoramic-viewer/support/PanoramicTileSource.d.ts +36 -0
  98. package/dist/components/arcgis-oriented-imagery-viewer-panoramic-viewer-zoom/customElement.d.ts +91 -0
  99. package/dist/components/arcgis-oriented-imagery-viewer-panoramic-viewer-zoom/customElement.js +93 -0
  100. package/dist/components/arcgis-oriented-imagery-viewer-panoramic-viewer-zoom/index.d.ts +1 -0
  101. package/dist/components/arcgis-oriented-imagery-viewer-panoramic-viewer-zoom/index.js +2 -0
  102. package/dist/components/arcgis-paste/customElement.d.ts +2 -2
  103. package/dist/components/arcgis-popup/customElement.d.ts +3 -3
  104. package/dist/components/arcgis-popup/customElement.js +1 -1
  105. package/dist/components/arcgis-presentation/customElement.d.ts +2 -2
  106. package/dist/components/arcgis-print/customElement.d.ts +2 -2
  107. package/dist/components/arcgis-print-dpi-input/customElement.js +1 -1
  108. package/dist/components/arcgis-print-export-button/customElement.js +1 -1
  109. package/dist/components/arcgis-print-format-select/customElement.js +1 -1
  110. package/dist/components/arcgis-print-main-panel/customElement.js +1 -1
  111. package/dist/components/arcgis-print-template-select/customElement.js +1 -1
  112. package/dist/components/arcgis-print-template-selector/customElement.js +1 -1
  113. package/dist/components/arcgis-scale-bar/customElement.d.ts +2 -2
  114. package/dist/components/arcgis-scale-range-slider/customElement.d.ts +2 -2
  115. package/dist/components/arcgis-search/customElement.d.ts +2 -2
  116. package/dist/components/arcgis-shadow-cast/customElement.d.ts +2 -2
  117. package/dist/components/arcgis-sketch/customElement.d.ts +2 -2
  118. package/dist/components/arcgis-slice/customElement.d.ts +2 -2
  119. package/dist/components/arcgis-slider-scale-range/customElement.d.ts +2 -2
  120. package/dist/components/arcgis-snapping-controls/customElement.d.ts +2 -2
  121. package/dist/components/arcgis-swipe/customElement.d.ts +2 -2
  122. package/dist/components/arcgis-table-list/customElement.d.ts +2 -2
  123. package/dist/components/arcgis-table-list-next/customElement.d.ts +2 -2
  124. package/dist/components/arcgis-time-bar/customElement.d.ts +5 -5
  125. package/dist/components/arcgis-time-bar/customElement.js +1 -1
  126. package/dist/components/arcgis-time-bar-slider/customElement.js +11 -11
  127. package/dist/components/arcgis-time-slider/customElement.d.ts +2 -2
  128. package/dist/components/arcgis-time-zone-label/customElement.d.ts +2 -2
  129. package/dist/components/arcgis-track/customElement.d.ts +2 -2
  130. package/dist/components/arcgis-utility-network-associations/customElement.d.ts +2 -2
  131. package/dist/components/arcgis-utility-network-trace/customElement.d.ts +2 -2
  132. package/dist/components/arcgis-utility-network-trace-analysis/customElement.d.ts +2 -2
  133. package/dist/components/arcgis-utility-network-trace-inputs/customElement.d.ts +2 -2
  134. package/dist/components/arcgis-utility-network-trace-location/customElement.d.ts +2 -2
  135. package/dist/components/arcgis-utility-network-trace-location-list/customElement.d.ts +2 -2
  136. package/dist/components/arcgis-utility-network-trace-results/customElement.d.ts +2 -2
  137. package/dist/components/arcgis-utility-network-validate-topology/customElement.d.ts +2 -2
  138. package/dist/components/arcgis-video-player/customElement.d.ts +2 -2
  139. package/dist/components/arcgis-volume-measurement/customElement.d.ts +2 -2
  140. package/dist/components/arcgis-weather/customElement.d.ts +2 -2
  141. package/dist/components/arcgis-zoom/customElement.d.ts +2 -2
  142. package/dist/components/arcgis-zoom/customElement.js +21 -45
  143. package/dist/controllers/useT9n.d.ts +3 -0
  144. package/dist/docs/api.json +1 -1
  145. package/dist/docs/docs.json +1 -1
  146. package/dist/docs/vscode.html-custom-data.json +1 -1
  147. package/dist/docs/web-types.json +1 -1
  148. package/dist/index.d.ts +14 -0
  149. package/dist/loader.js +3 -1
  150. package/dist/types/lumina.d.ts +13 -0
  151. package/dist/types/preact.d.ts +15 -0
  152. package/dist/types/react.d.ts +17 -0
  153. package/dist/types/stencil.d.ts +13 -0
  154. package/package.json +4 -4
  155. package/dist/cdn/A5XIQWD5.js +0 -2
  156. package/dist/cdn/AK62SYBC.js +0 -2
  157. package/dist/cdn/D7DH54CE.js +0 -2
  158. package/dist/cdn/KBBYF7KD.js +0 -2
  159. package/dist/cdn/M4HY5VMM.js +0 -2
  160. package/dist/cdn/MBRWWICI.js +0 -2
  161. package/dist/cdn/OO6NV5GK.js +0 -2
  162. /package/dist/cdn/{MOJH7XEP.js → 3ZXNGXHC.js} +0 -0
@@ -0,0 +1,1006 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { c as re } from "../../chunks/runtime.js";
3
+ import { css as se, html as Z } from "lit";
4
+ import { LitElement as ae } from "@arcgis/lumina";
5
+ import { createRef as j, ref as q } from "lit/directives/ref.js";
6
+ import { G as ne } from "../../chunks/graphicsLayerController.js";
7
+ import { u as le } from "../../chunks/useT9n.js";
8
+ import H from "@arcgis/core/geometry/SpatialReference.js";
9
+ import Q from "@arcgis/core/Graphic.js";
10
+ import "@arcgis/core/Camera.js";
11
+ import he from "@arcgis/core/views/3d/environment/Environment.js";
12
+ import { on as ce, when as me, watch as k } from "@arcgis/core/core/reactiveUtils.js";
13
+ import { once as K, on as J } from "@arcgis/core/applications/Components/baUtils.js";
14
+ import ee from "@arcgis/core/core/Collection.js";
15
+ import de from "@arcgis/core/symbols/FillSymbol3DLayer.js";
16
+ import ue from "@arcgis/core/symbols/MeshSymbol3D.js";
17
+ import pe from "@arcgis/core/Ground.js";
18
+ import fe from "@arcgis/core/core/Accessor.js";
19
+ import { property as C, subclass as _e } from "@arcgis/core/core/accessorSupport/decorators.js";
20
+ import we from "@arcgis/core/core/Error.js";
21
+ import ge from "@arcgis/core/geometry/Mesh.js";
22
+ import { t as z, c as ve, i as ye } from "../../chunks/async-utils.js";
23
+ import { guessExtensionFromURI as be } from "../../chunks/urlUtils.js";
24
+ import Me from "@arcgis/core/geometry/Extent.js";
25
+ import xe from "@arcgis/core/layers/ImageryTileLayer.js";
26
+ import X from "@arcgis/core/geometry/support/MeshComponent.js";
27
+ import Y from "@arcgis/core/geometry/support/MeshMaterialMetallicRoughness.js";
28
+ import U from "@arcgis/core/geometry/support/MeshTexture.js";
29
+ import Ce from "@arcgis/core/geometry/support/MeshVertexAttributes.js";
30
+ import W from "@arcgis/core/geometry/Point.js";
31
+ import { createSphere as Te } from "@arcgis/core/geometry/support/meshUtils.js";
32
+ import Se from "@arcgis/core/symbols/Font.js";
33
+ import { c as ze, b as Ie, f as Pe } from "../../chunks/utils3.js";
34
+ import Le from "@arcgis/core/symbols/TextSymbol.js";
35
+ import { log as Re } from "@arcgis/toolkit/log";
36
+ const Ae = se`:host{height:100%;--arcgis-view-color-focus: none}`;
37
+ function Fe(r, e = !0) {
38
+ const o = ((e ? r : r * 180 / Math.PI) % 360 + 360) % 360;
39
+ return e ? o : o * Math.PI / 180;
40
+ }
41
+ function Ne(r, e = !0) {
42
+ const t = e ? r : r * 180 / Math.PI, o = Math.max(0.5, Math.min(179.5, t));
43
+ return e ? o : o * Math.PI / 180;
44
+ }
45
+ function $e(r, e) {
46
+ return new Promise((t, o) => {
47
+ if (r.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA) {
48
+ t();
49
+ return;
50
+ }
51
+ e(K(r, "canplay", t)), e(K(r, "error", o));
52
+ });
53
+ }
54
+ function Be(r) {
55
+ return new Q({
56
+ geometry: r,
57
+ symbol: new ue({
58
+ symbolLayers: new ee([new de()])
59
+ })
60
+ });
61
+ }
62
+ function O({
63
+ data: r,
64
+ center: e = Ve(),
65
+ size: t = Ee,
66
+ horizonPitch: o = 0,
67
+ horizonYaw: i = 0,
68
+ horizonRoll: a = 0
69
+ }) {
70
+ const s = e.clone();
71
+ s.z = -t / 2;
72
+ const n = Te(s, {
73
+ size: t,
74
+ densificationFactor: 2,
75
+ vertexSpace: "georeferenced",
76
+ material: new Y({
77
+ colorTexture: new U({
78
+ data: r
79
+ }),
80
+ unlit: !0
81
+ })
82
+ });
83
+ if (n.components?.at(0)?.set({
84
+ trustSourceNormals: !0
85
+ }), n.vertexAttributes.uv) {
86
+ const l = n.vertexAttributes.uv.length ?? 0;
87
+ for (let d = 0; d < l; d++)
88
+ n.vertexAttributes.uv[d * 2 + 0] = 1 - n.vertexAttributes.uv[d * 2 + 0];
89
+ }
90
+ return n.rotate(o, a, i, {
91
+ origin: n.extent.center
92
+ }), n.centerAt(s), n;
93
+ }
94
+ const Ve = () => new W({
95
+ x: 0,
96
+ y: 0,
97
+ z: 0,
98
+ spatialReference: H.WebMercator
99
+ }), Ee = 1e3, Ge = 114;
100
+ function ke(r, e, t) {
101
+ const o = /* @__PURE__ */ new Map(), i = Array.from(r.keys()).sort((h, p) => h - p)[0], {
102
+ maxCol: a,
103
+ minCol: s,
104
+ maxRow: n,
105
+ minRow: l
106
+ } = r.get(i), d = a - s + 1, m = n - l + 1, c = d * (t - 1) + 1;
107
+ return De(
108
+ { maximumPyramidLevel: e, blockBoundary: r, baseCols: d, baseRows: m, vertexPerEdge: t, baseVertexPerRow: c },
109
+ o
110
+ ), o;
111
+ }
112
+ function De(r, e) {
113
+ const { maximumPyramidLevel: t, blockBoundary: o, baseCols: i, baseRows: a, vertexPerEdge: s, baseVertexPerRow: n } = r;
114
+ for (let l = 0; l <= t; l += 1) {
115
+ const { maxCol: d, minCol: m, maxRow: c, minRow: h } = o.get(l), p = d - m + 1, u = c - h + 1, _ = i / p, g = a / u, w = s - 1;
116
+ Oe(
117
+ {
118
+ minRow: h,
119
+ minCol: m,
120
+ numberOfRows: u,
121
+ numberOfColumns: p,
122
+ vertexLimit: w,
123
+ rowStep: g,
124
+ colStep: _,
125
+ baseVertexPerRow: n,
126
+ level: l
127
+ },
128
+ e
129
+ );
130
+ }
131
+ }
132
+ function Oe(r, e) {
133
+ const { minRow: t, minCol: o, numberOfRows: i, numberOfColumns: a, vertexLimit: s, rowStep: n, colStep: l, baseVertexPerRow: d, level: m } = r;
134
+ for (let c = 0; c < i; c += 1)
135
+ for (let h = 0; h < a; h += 1) {
136
+ const p = 2 * s * s, u = new Uint32Array(p * 3);
137
+ let _ = 0;
138
+ const g = o + (a - 1 - h), w = t + c;
139
+ for (let v = 0; v < s; v += 1)
140
+ for (let y = 0; y < s; y += 1) {
141
+ const f = c * n * s + v * n, T = h * l * s + y * l, F = Math.round(f * d + T), I = Math.round(F + l), S = Math.round(F + n * d), N = Math.round(S + l);
142
+ u[_++] = F, u[_++] = S, u[_++] = I, u[_++] = I, u[_++] = S, u[_++] = N;
143
+ }
144
+ e.set(`${m}/${w}/${g}`, u);
145
+ }
146
+ }
147
+ function He(r, e) {
148
+ const t = /* @__PURE__ */ new Map(), {
149
+ lods: o,
150
+ origin: i,
151
+ size: [a, s]
152
+ } = r, { xmin: n, ymin: l, xmax: d, ymax: m } = e;
153
+ for (const { resolution: c, level: h } of o) {
154
+ const p = Math.floor((i.y - m) / (s * c)), u = Math.floor((i.y - l) / (s * c)) - 1, _ = Math.floor((n - i.x) / (a * c)), g = Math.ceil((d - i.x) / (a * c)) - 1, w = u - p + 1, v = g - _ + 1;
155
+ if (w <= 0 || v <= 0)
156
+ continue;
157
+ const y = 360 / v, f = 180 / w, T = Math.max(y / a, f / s);
158
+ Number.isFinite(T) && t.set(o.length - 1 - h, {
159
+ minRow: p,
160
+ maxRow: u,
161
+ minCol: _,
162
+ maxCol: g,
163
+ resolution: c,
164
+ pixelAngle: T
165
+ });
166
+ }
167
+ return t;
168
+ }
169
+ function Ke(r) {
170
+ return typeof r == "string" ? Number.parseInt(r, 10) : r;
171
+ }
172
+ function Ye(r) {
173
+ r.set("premultiplyAlpha", !0);
174
+ const e = r.getAsRGBA();
175
+ return new ImageData(e, r.width, r.height);
176
+ }
177
+ function Ue(r, e, t) {
178
+ return (r * (t - 1) + 1) * (e * (t - 1) + 1);
179
+ }
180
+ class We {
181
+ constructor(e) {
182
+ this._componentCache = /* @__PURE__ */ new Map(), this._tileAnchorMap = /* @__PURE__ */ new Map(), this._attachedComponentKeys = /* @__PURE__ */ new Set(), this._remappedFaceMap = /* @__PURE__ */ new Map(), this._levels = [], this._blockBoundaryMap = /* @__PURE__ */ new Map(), this.radius = 500, this.vertexPerEdge = 25, this.imageSize = [0, 0], this.layer = e.layer;
183
+ }
184
+ // Finest level is used to build the shared skeleton mesh so all LOD faces can map onto it.
185
+ get _meshResolutionLevel() {
186
+ let e = this._levels[0], t = Number.POSITIVE_INFINITY;
187
+ for (const o of this._levels) {
188
+ const i = this._blockBoundaryMap.get(o);
189
+ i && i.pixelAngle < t && (t = i.pixelAngle, e = o);
190
+ }
191
+ return e;
192
+ }
193
+ get blockBoundaryMap() {
194
+ return this._blockBoundaryMap;
195
+ }
196
+ get levels() {
197
+ return this._levels;
198
+ }
199
+ get baseLevel() {
200
+ let e = this._levels[0], t = Number.NEGATIVE_INFINITY;
201
+ for (const o of this._levels) {
202
+ const i = this._blockBoundaryMap.get(o);
203
+ i && i.pixelAngle > t && (t = i.pixelAngle, e = o);
204
+ }
205
+ return e;
206
+ }
207
+ get maxLevel() {
208
+ return Math.max(...this._levels);
209
+ }
210
+ async load(e) {
211
+ if (await this.layer.load(e), this._blockBoundaryMap = He(this.layer.tileInfo, this.layer.fullExtent), this._levels = [...this._blockBoundaryMap.keys()].sort((t, o) => t - o), this._levels.length === 0)
212
+ throw new Error("No valid tile levels found for panoramic mesh generation.");
213
+ return this.imageSize = [this.layer.fullExtent.width, this.layer.fullExtent.height], this._baseMesh = this._createBaseMesh(this.radius, this.vertexPerEdge), this;
214
+ }
215
+ get baseMesh() {
216
+ if (!this._baseMesh)
217
+ throw new Error("Base mesh is not created yet.");
218
+ return this._baseMesh;
219
+ }
220
+ destroy() {
221
+ this._faceMap?.clear(), this._remappedFaceMap.clear(), this._componentCache.clear(), this._attachedComponentKeys.clear(), this._tileAnchorMap.clear(), this._baseMesh?.destroy();
222
+ }
223
+ _createBaseMesh(e, t) {
224
+ if (!this._blockBoundaryMap.has(this._meshResolutionLevel))
225
+ throw new Error(`No block boundaries found for mesh resolution level ${this._meshResolutionLevel}`);
226
+ const { maxCol: o, minCol: i, maxRow: a, minRow: s } = this._blockBoundaryMap.get(this._meshResolutionLevel), n = a - s + 1, l = o - i + 1, d = Ue(n, l, t), m = new Float64Array(d * 3), c = new Float32Array(d * 3), h = new Float32Array(d * 2), p = l * (t - 1) + 1, u = l * (t - 1);
227
+ for (let f = 0; f < d; f += 1) {
228
+ const T = Math.floor(f / p), F = f % p, I = 1 - F / (l * (t - 1)), S = T / (n * (t - 1)), N = 180 * (1 - S), E = 360 * (I - 0.5), P = [
229
+ Math.sin(N * Math.PI / 180) * Math.sin(E * Math.PI / 180),
230
+ Math.cos(E * Math.PI / 180) * Math.sin(N * Math.PI / 180),
231
+ -Math.cos(N * Math.PI / 180)
232
+ ];
233
+ m[f * 3] = e * P[0], m[f * 3 + 1] = e * P[1], m[f * 3 + 2] = e * P[2], c[f * 3] = -P[0], c[f * 3 + 1] = -P[1], c[f * 3 + 2] = -P[2];
234
+ const L = T * p;
235
+ F === u && (m[f * 3] = m[L * 3], m[f * 3 + 1] = m[L * 3 + 1], m[f * 3 + 2] = m[L * 3 + 2], c[f * 3] = c[L * 3], c[f * 3 + 1] = c[L * 3 + 1], c[f * 3 + 2] = c[L * 3 + 2]), h[f * 2] = I, h[f * 2 + 1] = S;
236
+ }
237
+ this._faceMap = ke(this._blockBoundaryMap, Math.max(...this._levels), t);
238
+ const { remappedFaceMap: _, splitPosition: g, splitNormals: w, splitUv: v } = this._preSplitTileGeometry(m, c, h);
239
+ this._remappedFaceMap = _;
240
+ const y = new X({
241
+ faces: new Uint32Array([0, 1, 2]),
242
+ name: "__placeholder__"
243
+ });
244
+ return y.set({
245
+ trustSourceNormals: !0
246
+ }), this._baseMesh = new ge({
247
+ components: [
248
+ // Dummy component keeps the mesh valid before any tile component is attached.
249
+ y
250
+ ],
251
+ vertexAttributes: new Ce({ position: g, normal: w, uv: v }),
252
+ spatialReference: { wkid: 3857 }
253
+ }), this._baseMesh;
254
+ }
255
+ _preSplitTileGeometry(e, t, o) {
256
+ let i = 0;
257
+ for (const c of this._faceMap.values()) {
258
+ const h = /* @__PURE__ */ new Set();
259
+ for (let p = 0; p < c.length; p += 1)
260
+ h.add(c[p]);
261
+ i += h.size;
262
+ }
263
+ const a = new Float64Array(i * 3), s = new Float32Array(i * 3), n = new Float32Array(i * 2), l = /* @__PURE__ */ new Map(), d = 1e-8;
264
+ let m = 0;
265
+ for (const [c, h] of this._faceMap) {
266
+ const p = /* @__PURE__ */ new Map();
267
+ let u = 0, _ = 0, g = 0, w = Number.POSITIVE_INFINITY, v = Number.NEGATIVE_INFINITY, y = Number.POSITIVE_INFINITY, f = Number.NEGATIVE_INFINITY;
268
+ for (let R = 0; R < h.length; R += 1) {
269
+ const $ = h[R];
270
+ if (p.has($))
271
+ continue;
272
+ const B = $ * 2, M = o[B], A = o[B + 1];
273
+ M < w && (w = M), M > v && (v = M), A < y && (y = A), A > f && (f = A);
274
+ const V = $ * 3;
275
+ u += e[V], _ += e[V + 1], g += e[V + 2], p.set($, m), m += 1;
276
+ }
277
+ const T = v - w, F = f - y, I = Math.hypot(u, _, g), S = this.radius * 1.01, [N, E] = this.layer.tileInfo?.size ?? [256, 256], P = 0.5 / N, L = 0.5 / E;
278
+ this._tileAnchorMap.set(
279
+ c,
280
+ I > 0 ? [
281
+ u / I * S,
282
+ _ / I * S,
283
+ g / I * S
284
+ ] : [0, 0, S]
285
+ );
286
+ for (const [R, $] of p) {
287
+ const B = R * 3, M = $ * 3;
288
+ a[M] = e[B], a[M + 1] = e[B + 1], a[M + 2] = e[B + 2], s[M] = t[B], s[M + 1] = t[B + 1], s[M + 2] = t[B + 2];
289
+ const A = R * 2, V = $ * 2, G = o[A], te = o[A + 1], ie = T < d ? 0.5 : (G - w) / T, oe = F < d ? 0.5 : (te - y) / F;
290
+ n[V] = P + ie * (1 - 2 * P), n[V + 1] = L + oe * (1 - 2 * L);
291
+ }
292
+ const D = new Uint32Array(h.length);
293
+ for (let R = 0; R < h.length; R += 1) {
294
+ const $ = p.get(h[R]);
295
+ if ($ == null)
296
+ throw new Error(`Failed to remap face index for tile ${c}`);
297
+ D[R] = $;
298
+ }
299
+ l.set(c, D);
300
+ }
301
+ return { remappedFaceMap: l, splitPosition: a, splitNormals: s, splitUv: n };
302
+ }
303
+ getTileAnchor(e, t, o) {
304
+ const i = this._tileAnchorMap.get(`${e}/${t}/${o}`);
305
+ if (!i)
306
+ throw new Error(`No tile anchor found for level ${e}, row ${t}, column ${o}`);
307
+ return i;
308
+ }
309
+ loadComponent(e, t, o, i) {
310
+ const a = `${e}/${t}/${o}`;
311
+ if (this._attachedComponentKeys.has(a))
312
+ return;
313
+ let s = this._componentCache.get(a);
314
+ if (s)
315
+ s.material = new Y({
316
+ unlit: !0,
317
+ colorTexture: new U({
318
+ data: i
319
+ })
320
+ });
321
+ else {
322
+ const l = this._remappedFaceMap.get(a);
323
+ if (!l)
324
+ throw new Error(`No faces found for level ${e}, row ${t}, column ${o}`);
325
+ s = new X({
326
+ faces: l,
327
+ name: a,
328
+ material: new Y({
329
+ unlit: !0,
330
+ colorTexture: new U({
331
+ data: i
332
+ })
333
+ })
334
+ }), s.set({
335
+ trustSourceNormals: !0
336
+ }), this._componentCache.set(`${e}/${t}/${o}`, s);
337
+ }
338
+ s.name = a, this.baseMesh.addComponent(s);
339
+ const n = this.baseMesh.components?.find((l) => l.name === "__placeholder__");
340
+ n && this.baseMesh.removeComponent(n), this._attachedComponentKeys.add(a), this.baseMesh.vertexAttributesChanged();
341
+ }
342
+ getFacesForTile(e, t, o) {
343
+ const i = this._remappedFaceMap.get(`${e}/${t}/${o}`);
344
+ if (!i)
345
+ throw new Error(`No faces found for level ${e}, row ${t}, column ${o}`);
346
+ return i;
347
+ }
348
+ unloadComponent(e, t, o) {
349
+ const i = `${e}/${t}/${o}`, a = this._componentCache.get(i);
350
+ a && this._attachedComponentKeys.has(i) && (this.baseMesh.removeComponent(a), this._attachedComponentKeys.delete(i), this.baseMesh.vertexAttributesChanged());
351
+ }
352
+ }
353
+ class Ze {
354
+ constructor(e) {
355
+ this._baseLevel = e.baseLevel, this._levels = [...e.levels], this._blockBoundaryMap = e.blockBoundaryMap;
356
+ }
357
+ plan(e, t, o) {
358
+ const i = this._selectLevel(e);
359
+ this._lastStableLevel = i;
360
+ const a = this._createHybridDesiredSet(i, e);
361
+ this._retainActiveLevelDetails(a, t, i);
362
+ const s = this._prioritizeDesiredKeys(a, i), n = /* @__PURE__ */ new Set([...t, ...o]), l = s.filter((c) => !n.has(c)), d = s.filter((c) => t.has(c)), m = [...t].filter((c) => !a.has(c));
363
+ return {
364
+ stableLevel: i,
365
+ desiredKeySet: a,
366
+ toFetch: l,
367
+ toKeep: d,
368
+ toDrop: m
369
+ };
370
+ }
371
+ _retainActiveLevelDetails(e, t, o) {
372
+ if (o !== this._baseLevel)
373
+ for (const i of t) {
374
+ const a = this._parseTileKey(i);
375
+ a && a.level === o && e.add(i);
376
+ }
377
+ }
378
+ _createHybridDesiredSet(e, t) {
379
+ const o = /* @__PURE__ */ new Set(), i = this._blockBoundaryMap.get(this._baseLevel);
380
+ if (!i)
381
+ return o;
382
+ for (let s = i.minRow; s <= i.maxRow; s += 1)
383
+ for (let n = i.minCol; n <= i.maxCol; n += 1)
384
+ o.add(`${this._baseLevel}/${s}/${n}`);
385
+ if (e === this._baseLevel)
386
+ return o;
387
+ const a = this._getViewTileKeys(e, t.heading, t.pitch, t.hfov, t.vfov);
388
+ for (const s of a)
389
+ o.add(s);
390
+ return o;
391
+ }
392
+ _getViewTileKeys(e, t, o, i, a) {
393
+ const s = this._blockBoundaryMap.get(e);
394
+ if (!s)
395
+ return [];
396
+ const { minRow: n, maxRow: l, minCol: d, maxCol: m } = s, c = l - n + 1, h = m - d + 1, u = Math.max(0.1, Math.min(179.9, o)) - 90, _ = Math.max(0.01, Math.min(360, i)), g = Math.max(0.01, Math.min(180, a)), w = 360 / h, v = 180 / c, y = Math.min(12, w * 0.35), f = Math.min(8, v * 0.35), T = Math.min(360, _ + y * 2), F = Math.min(180, g + f * 2), I = Math.max(-89.9, Math.min(89.9, u - F / 2)), S = Math.max(-89.9, Math.min(89.9, u + F / 2)), N = (M) => {
397
+ const A = (90 - M) / 180, V = Math.floor(A * c);
398
+ return n + Math.max(0, Math.min(c - 1, V));
399
+ }, E = (M) => {
400
+ const A = this._normalizeHeading(M) / 360, G = (Math.floor(A * h) % h + h) % h;
401
+ return d + G;
402
+ }, P = this._normalizeHeading(t - T / 2), L = this._normalizeHeading(t + T / 2), D = Math.min(N(S), N(I)), R = Math.max(N(S), N(I)), $ = T >= 360 ? [[d, m]] : P <= L ? [[E(P), E(L)]] : [
403
+ [d, E(L)],
404
+ [E(P), m]
405
+ ], B = /* @__PURE__ */ new Set();
406
+ for (let M = D; M <= R; M += 1)
407
+ for (const [A, V] of $)
408
+ for (let G = A; G <= V; G += 1)
409
+ B.add(`${e}/${M}/${G}`);
410
+ return [...B];
411
+ }
412
+ _normalizeHeading(e) {
413
+ const t = e % 360;
414
+ return t < 0 ? t + 360 : t;
415
+ }
416
+ _prioritizeDesiredKeys(e, t) {
417
+ const o = [...e], i = (a) => {
418
+ const s = this._parseTileKey(a);
419
+ return s ? s.level === t ? 0 : s.level === this._baseLevel ? 2 : 1 : Number.POSITIVE_INFINITY;
420
+ };
421
+ return o.sort((a, s) => {
422
+ const n = i(a) - i(s);
423
+ if (n !== 0)
424
+ return n;
425
+ const l = this._parseTileKey(a), d = this._parseTileKey(s);
426
+ return !l || !d ? a.localeCompare(s) : l.level !== d.level ? l.level - d.level : l.row !== d.row ? l.row - d.row : l.col - d.col;
427
+ }), o;
428
+ }
429
+ _parseTileKey(e) {
430
+ const [t, o, i] = e.split("/"), a = Number(t), s = Number(o), n = Number(i);
431
+ if (!(!Number.isFinite(a) || !Number.isFinite(s) || !Number.isFinite(n)))
432
+ return { level: a, row: s, col: n };
433
+ }
434
+ _selectLevel(e) {
435
+ const [t, o] = e.viewportSize, i = Math.max(1, t), a = Math.max(1, o), s = Math.max(e.hfov / i, e.vfov / a), n = 0.25, l = this._levels.map((h) => ({ level: h, boundary: this._blockBoundaryMap.get(h) })).filter((h) => h.boundary != null).sort((h, p) => p.boundary.pixelAngle - h.boundary.pixelAngle);
436
+ if (l.length === 0)
437
+ return this._baseLevel;
438
+ const d = /* @__PURE__ */ new Map();
439
+ for (const h of l)
440
+ d.set(h.level, s / h.boundary.pixelAngle);
441
+ const m = /* @__PURE__ */ new Map();
442
+ l.forEach((h, p) => {
443
+ m.set(h.level, p);
444
+ });
445
+ let c = l[l.length - 1].level;
446
+ for (const h of l)
447
+ if ((d.get(h.level) ?? 0) >= n) {
448
+ c = h.level;
449
+ break;
450
+ }
451
+ if (this._lastStableLevel != null && m.has(this._lastStableLevel)) {
452
+ const h = m.get(this._lastStableLevel), p = m.get(c);
453
+ if (p > h && (d.get(this._lastStableLevel) ?? 0) >= 0.2)
454
+ return this._lastStableLevel;
455
+ if (p < h)
456
+ return this._lastStableLevel;
457
+ }
458
+ return c;
459
+ }
460
+ }
461
+ class je {
462
+ constructor(e) {
463
+ this._layer = e, this._inflightControllers = /* @__PURE__ */ new Map(), this._inflightSet = /* @__PURE__ */ new Set(), this._loadedSet = /* @__PURE__ */ new Set(), this.fetchTileImageData = async (t, o, i, a) => {
464
+ const s = Ke(t), n = a ? { signal: a } : void 0, l = this._meshBuilder.blockBoundaryMap.get(s);
465
+ if (!l)
466
+ throw new Error(`No tile boundary found for level ${t}`);
467
+ const { maxCol: d, maxRow: m, minCol: c, minRow: h } = l, p = d - c + 1, u = m - h + 1, _ = i - c, g = o - h, w = _ * this._meshBuilder.imageSize[0] / p, v = g * this._meshBuilder.imageSize[1] / u, y = Math.min(
468
+ (_ + 1) * this._meshBuilder.imageSize[0] / p,
469
+ this._meshBuilder.imageSize[0]
470
+ ), f = Math.min(
471
+ (g + 1) * this._meshBuilder.imageSize[1] / u,
472
+ this._meshBuilder.imageSize[1]
473
+ ), T = await this._layer.fetchPixels(
474
+ new Me({
475
+ xmin: w - 0.5,
476
+ ymin: 0.5 - f,
477
+ xmax: y - 0.5,
478
+ ymax: 0.5 - v,
479
+ spatialReference: this._layer.fullExtent.spatialReference
480
+ }),
481
+ y - w,
482
+ f - v,
483
+ n
484
+ );
485
+ return Ye(T.pixelBlock);
486
+ }, this.loadComponent = (t, o, i, a) => this._meshBuilder.loadComponent(t, o, i, a), this.unloadComponent = (t, o, i) => this._meshBuilder.unloadComponent(t, o, i), this._meshBuilder = new We({ layer: e });
487
+ }
488
+ get imageSize() {
489
+ return this._meshBuilder.imageSize;
490
+ }
491
+ get baseMesh() {
492
+ return this._meshBuilder.baseMesh;
493
+ }
494
+ get currentLevel() {
495
+ return this._currentLevel;
496
+ }
497
+ getTileAnchor(e, t, o) {
498
+ return this._meshBuilder.getTileAnchor(e, t, o);
499
+ }
500
+ async load() {
501
+ return await this._meshBuilder.load(), this._tilePlanner = new Ze({
502
+ blockBoundaryMap: this._meshBuilder.blockBoundaryMap,
503
+ baseLevel: this._meshBuilder.baseLevel,
504
+ levels: [...this._meshBuilder.levels]
505
+ }), this;
506
+ }
507
+ destroy() {
508
+ for (const e of this._inflightControllers.values())
509
+ e.abort();
510
+ this._inflightControllers.clear(), this._inflightSet.clear(), this._loadedSet.clear(), this._tilePlanner = void 0, this._meshBuilder.destroy();
511
+ }
512
+ planTiles(e) {
513
+ if (!this._tilePlanner)
514
+ throw new Error("PanoramicTileSource is not loaded yet.");
515
+ const t = this._tilePlanner.plan(e, this._loadedSet, this._inflightSet);
516
+ return this._currentLevel = t.stableLevel, t;
517
+ }
518
+ markTileInflight(e, t) {
519
+ this._inflightSet.add(e), this._inflightControllers.set(e, t);
520
+ }
521
+ markTileLoaded(e) {
522
+ this._inflightSet.delete(e), this._inflightControllers.delete(e), this._loadedSet.add(e);
523
+ }
524
+ markTileInflightResolved(e) {
525
+ this._inflightSet.delete(e), this._inflightControllers.delete(e);
526
+ }
527
+ markTileDropped(e) {
528
+ this._loadedSet.delete(e);
529
+ }
530
+ cancelStaleInflight(e) {
531
+ for (const t of this._inflightSet) {
532
+ if (e.has(t))
533
+ continue;
534
+ this._inflightControllers.get(t)?.abort(), this._inflightControllers.delete(t), this._inflightSet.delete(t);
535
+ }
536
+ }
537
+ }
538
+ var qe = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, x = (r, e, t, o) => {
539
+ for (var i = o > 1 ? void 0 : o ? Je(e, t) : e, a = r.length - 1, s; a >= 0; a--)
540
+ (s = r[a]) && (i = (o ? s(e, t, i) : s(i)) || i);
541
+ return o && i && qe(e, t, i), i;
542
+ };
543
+ const Xe = 0, Qe = 0, et = 0, tt = /* @__PURE__ */ new Set(["JPG", "JPEG", "TIFF", "TIF", "MRF"]), it = /* @__PURE__ */ new Set(["MRF", "TIFF", "TIF"]);
544
+ let b = class extends fe {
545
+ //--------------------------------------------------------------------------
546
+ //
547
+ // Lifecycle
548
+ //
549
+ //--------------------------------------------------------------------------
550
+ constructor(r) {
551
+ super(r), this._size = [0, 0], this.autoLoad = !1, this.type = "image", this.uiStrings = {}, this._resolveMedia = async (e) => {
552
+ const t = Promise.withResolvers(), o = e?.signal ? K(e?.signal, "abort", t.resolve) : null, i = this.type === "video" ? document.createElement("video") : document.createElement("img");
553
+ this.type === "video" && (i.setAttribute("playsinline", "true"), i.setAttribute("muted", "true"), i.setAttribute("autoplay", "true")), i.crossOrigin = "anonymous", i.src = this.url;
554
+ let a = null;
555
+ const s = this.type === "video" ? $e(i, (m) => this.addHandles(m)) : await new Promise((m, c) => {
556
+ a = [
557
+ J(i, "error", (h) => {
558
+ c(h);
559
+ }),
560
+ J(i, "load", m)
561
+ ];
562
+ }).finally(() => {
563
+ a?.forEach((m) => m.remove()), a = null;
564
+ }), n = Promise.race([s, t.promise]);
565
+ try {
566
+ await n;
567
+ } finally {
568
+ o?.remove();
569
+ }
570
+ z(e);
571
+ const l = i, d = await O({
572
+ data: i,
573
+ horizonPitch: this.horizonPitch,
574
+ horizonRoll: this.horizonRoll,
575
+ horizonYaw: this.horizonYaw
576
+ }).load(e);
577
+ return z(e), { media: l, mesh: d };
578
+ };
579
+ }
580
+ static isPanoramicMedia(r) {
581
+ return !!r && typeof r == "object" && "declaredClass" in r && typeof r.declaredClass == "string" && r.declaredClass === "components.oriented-imagery-viewer-panoramic-viewer.support.PanoramicMedia";
582
+ }
583
+ destroy() {
584
+ this._cache = void 0;
585
+ }
586
+ get horizonPitch() {
587
+ const { matrix: r } = this;
588
+ return r ? 180 * Math.asin(-r[6]) / Math.PI : Xe;
589
+ }
590
+ get horizonRoll() {
591
+ const { matrix: r } = this;
592
+ return r ? 180 * Math.atan(r[7] / r[8]) / Math.PI : et;
593
+ }
594
+ get horizonYaw() {
595
+ const { matrix: r, cameraHeading: e } = this;
596
+ return r ? 180 * Math.atan2(r[3], r[0]) / Math.PI : e ? -e : Qe;
597
+ }
598
+ get panoramicTileSource() {
599
+ return this._panoramicTileSource;
600
+ }
601
+ get element() {
602
+ return this._cache;
603
+ }
604
+ get size() {
605
+ return this._size;
606
+ }
607
+ //--------------------------------------------------------------------------
608
+ //
609
+ // Public Methods
610
+ //
611
+ //--------------------------------------------------------------------------
612
+ async load(r) {
613
+ if (this.type === "video")
614
+ return await this.loadVideoMesh(r);
615
+ let e = this.extension;
616
+ if (e || (e = be(this.url)), !e || !tt.has(e))
617
+ throw new we(
618
+ "unsupported-format",
619
+ this.uiStrings["unsupported-format"] ?? "Unsupported image format: {extension}",
620
+ {
621
+ datasetFormat: e ?? "UNKNOWN FORMAT"
622
+ }
623
+ );
624
+ return it.has(e) ? await this.loadOptimizedImageMesh(r) : await this.loadImageMesh(r);
625
+ }
626
+ async loadOptimizedImageMesh(r) {
627
+ this._panoramicTileSource?.destroy();
628
+ const e = new xe({
629
+ url: this.url,
630
+ // @ts-ignore - datasetFormat is not part of the official ImageryTileLayer properties, but is used in the custom ioConfig for loading the image and is necessary to pass along the format information.
631
+ datasetFormat: this.extension,
632
+ skipMapInfo: !0,
633
+ skipExtensions: ["aux.xml", "jgw"]
634
+ });
635
+ this._panoramicTileSource = new je(e);
636
+ const { imageSize: t, baseMesh: o } = await this._panoramicTileSource.load();
637
+ return z(r), { mesh: o, size: t };
638
+ }
639
+ async loadVideoMesh(r) {
640
+ if (z(r), this._cache) {
641
+ const o = await O({
642
+ data: this._cache,
643
+ horizonPitch: this.horizonPitch,
644
+ horizonRoll: this.horizonRoll,
645
+ horizonYaw: this.horizonYaw
646
+ }).load(r);
647
+ return z(r), { mesh: o, size: this._size };
648
+ }
649
+ const e = await this._resolveMedia(r);
650
+ z(r), this._cache = e.media, this._size = [this._cache.videoWidth, this._cache.videoHeight];
651
+ const t = await O({
652
+ data: this._cache,
653
+ horizonPitch: this.horizonPitch,
654
+ horizonRoll: this.horizonRoll,
655
+ horizonYaw: this.horizonYaw
656
+ }).load(r);
657
+ return z(r), { mesh: t, size: this._size };
658
+ }
659
+ async loadImageMesh(r) {
660
+ if (this._cache) {
661
+ const o = await O({
662
+ data: this._cache,
663
+ horizonPitch: this.horizonPitch,
664
+ horizonRoll: this.horizonRoll,
665
+ horizonYaw: this.horizonYaw
666
+ }).load(r);
667
+ return z(r), { mesh: o, size: this._size };
668
+ }
669
+ const e = await this._resolveMedia(r);
670
+ z(r), this._cache = e.media;
671
+ const t = e.mesh;
672
+ return this._size = [e.media.width, e.media.height], { mesh: t, size: this._size };
673
+ }
674
+ };
675
+ x([
676
+ C()
677
+ ], b.prototype, "_size", 2);
678
+ x([
679
+ C()
680
+ ], b.prototype, "_cache", 2);
681
+ x([
682
+ C()
683
+ ], b.prototype, "autoLoad", 2);
684
+ x([
685
+ C()
686
+ ], b.prototype, "cameraHeading", 2);
687
+ x([
688
+ C()
689
+ ], b.prototype, "extension", 2);
690
+ x([
691
+ C()
692
+ ], b.prototype, "horizonPitch", 1);
693
+ x([
694
+ C()
695
+ ], b.prototype, "horizonRoll", 1);
696
+ x([
697
+ C()
698
+ ], b.prototype, "horizonYaw", 1);
699
+ x([
700
+ C()
701
+ ], b.prototype, "id", 2);
702
+ x([
703
+ C()
704
+ ], b.prototype, "_panoramicTileSource", 2);
705
+ x([
706
+ C()
707
+ ], b.prototype, "panoramicTileSource", 1);
708
+ x([
709
+ C()
710
+ ], b.prototype, "element", 1);
711
+ x([
712
+ C()
713
+ ], b.prototype, "matrix", 2);
714
+ x([
715
+ C()
716
+ ], b.prototype, "size", 1);
717
+ x([
718
+ C()
719
+ ], b.prototype, "type", 2);
720
+ x([
721
+ C()
722
+ ], b.prototype, "uiStrings", 2);
723
+ x([
724
+ C()
725
+ ], b.prototype, "url", 2);
726
+ b = x([
727
+ _e("components.oriented-imagery-viewer-panoramic-viewer.support.PanoramicMedia")
728
+ ], b);
729
+ const ot = () => new he({
730
+ atmosphereEnabled: !1,
731
+ starsEnabled: !1,
732
+ lighting: {
733
+ type: "virtual"
734
+ }
735
+ }), rt = () => new pe({
736
+ opacity: 0,
737
+ navigationConstraint: null
738
+ }), st = () => new W({
739
+ x: 0,
740
+ y: 0,
741
+ z: 0,
742
+ spatialReference: H.WebMercator
743
+ });
744
+ class at extends ae {
745
+ constructor() {
746
+ super(...arguments), this.#e = ot(), this._graphicsController = new ne(this), this._ground = rt(), this._messages = le(), this._startPosition = null, this.tileCache = /* @__PURE__ */ new Set(), this._currentGraphicsStore = new ee(), this._tileLabelGraphics = /* @__PURE__ */ new Map(), this._handleMouseWheel = (e) => {
747
+ e.detail.stopPropagation(), e.detail.deltaY < 0 ? this._internalZoom.value?.zoomIn() : this._internalZoom.value?.zoomOut();
748
+ }, this._handleDrag = (e) => {
749
+ e.stopPropagation();
750
+ const { x: t, y: o, action: i } = e;
751
+ let a = null, s = null;
752
+ switch (i) {
753
+ case "start":
754
+ this._startPosition = { x: t, y: o };
755
+ break;
756
+ case "update":
757
+ if (!this._startPosition)
758
+ return;
759
+ const n = (l) => {
760
+ if (!this._startPosition || !this.camera)
761
+ return;
762
+ if (s || (s = l), l - s < 16) {
763
+ a = requestAnimationFrame(n);
764
+ return;
765
+ }
766
+ const m = t - this._startPosition.x, c = o - this._startPosition.y, h = Fe(this.camera?.heading - m * 0.1), p = Ne(this.camera.tilt + c * 0.1);
767
+ this.yaw = h, this.pitch = p, this._startPosition = { x: t, y: o }, s = null;
768
+ };
769
+ a = requestAnimationFrame(n);
770
+ break;
771
+ case "end":
772
+ a !== null && cancelAnimationFrame(a), this._startPosition = null;
773
+ break;
774
+ }
775
+ }, this._internalMap = j(), this._internalZoom = j(), this._loading = !1, this.yaw = 0, this.pitch = 90, this.hideLoader = !1, this.hideTitle = !1, this.hideZoomControls = !1, this.hideVideoControls = !1, this.messageOverrides = this._messages._overrides;
776
+ }
777
+ static {
778
+ this.properties = { _media: 16, _internalMap: 16, _internalZoom: 16, _loading: 16, _base: 16, yaw: 9, pitch: 9, hideLoader: 5, hideTitle: 7, hideZoomControls: 5, hideVideoControls: 5, imageSize: 32, media: 0, messageOverrides: 0, hfov: 32, base: 32 };
779
+ }
780
+ static {
781
+ this.styles = [Ae];
782
+ }
783
+ #e;
784
+ get view() {
785
+ return this._internalMap?.value?.view;
786
+ }
787
+ get camera() {
788
+ if (!this.view?.destroyed)
789
+ return this.view?.camera;
790
+ }
791
+ set camera(e) {
792
+ !e || !this.view || this.view.destroyed || (e.position = st(), this.view.camera = e.clone());
793
+ }
794
+ get map() {
795
+ return this._internalMap.value?.view?.map;
796
+ }
797
+ get _fov() {
798
+ return this.camera?.fov;
799
+ }
800
+ set _fov(e) {
801
+ typeof e != "number" || !this._internalZoom.value || this._internalZoom.value?.zoomFOV(e);
802
+ }
803
+ get imageSize() {
804
+ return this._media?.size;
805
+ }
806
+ get media() {
807
+ return this._media;
808
+ }
809
+ set media(e) {
810
+ if (!e) {
811
+ this._mediaAbortController?.abort(), this._media = void 0, this._clearImage();
812
+ return;
813
+ }
814
+ this._media = b.isPanoramicMedia(e) ? e : new b(e);
815
+ }
816
+ get hfov() {
817
+ return this._internalZoom.value?.hfov;
818
+ }
819
+ get base() {
820
+ return this._base?.geometry;
821
+ }
822
+ addGraphic(e) {
823
+ this._graphicsController.addGraphic(e);
824
+ }
825
+ addGraphics(e) {
826
+ this._graphicsController.addGraphics(e);
827
+ }
828
+ clearGraphics() {
829
+ this._graphicsController.clearGraphics();
830
+ }
831
+ async mediaOnLoad() {
832
+ return this._mediaPromise && await this._mediaPromise, this._media;
833
+ }
834
+ removeGraphic(e) {
835
+ this._graphicsController.removeGraphic(e);
836
+ }
837
+ removeGraphics(e) {
838
+ this._graphicsController.removeGraphics(e);
839
+ }
840
+ zoomIn() {
841
+ this._internalZoom.value?.zoomIn();
842
+ }
843
+ zoomOut() {
844
+ this._internalZoom.value?.zoomOut();
845
+ }
846
+ loaded() {
847
+ this.manager.onLifecycle(() => [
848
+ ce(() => this.view, "drag", this._handleDrag),
849
+ me(() => this.camera != null, () => {
850
+ this.camera && (this.camera.heading = this.yaw, this.camera.tilt = this.pitch, this._reloadCamera());
851
+ }),
852
+ k(() => this.yaw, () => {
853
+ this.camera && (this.camera.heading = this.yaw, this._reloadCamera());
854
+ }, { sync: !0, initial: !0 }),
855
+ k(() => this.pitch, () => {
856
+ this.camera && (this.camera.tilt = this.pitch, this._reloadCamera());
857
+ }, { sync: !0, initial: !0 }),
858
+ k(() => this._fov, () => {
859
+ this._reloadCamera();
860
+ }, { sync: !0, initial: !0 }),
861
+ k(() => this._media, (e) => {
862
+ this._mediaAbortController?.abort(), e && (this._mediaAbortController = new AbortController(), this._mediaPromise = this._loadMediaInternal(e, this._mediaAbortController));
863
+ }, { initial: !0, sync: !0 }),
864
+ k(() => {
865
+ if (!this.view?.ready || !this.base)
866
+ return;
867
+ const e = this._media?.panoramicTileSource;
868
+ if (!e)
869
+ return;
870
+ const { camera: { heading: t, tilt: o, fov: i }, width: a, height: s } = this.view, n = a / s;
871
+ return {
872
+ panoramicTileSource: e,
873
+ heading: t,
874
+ pitch: o,
875
+ hfov: Ie(i, n),
876
+ vfov: ze(i, n)
877
+ };
878
+ }, (e) => {
879
+ e && (this._tileUpdateDebounceHandle != null && clearTimeout(this._tileUpdateDebounceHandle), this._tileUpdateDebounceHandle = window.setTimeout(() => {
880
+ this._tileUpdateTask?.abort(), this._tileUpdateTask = ve(async (t) => {
881
+ await this._updateTilesForCurrentView(e, t);
882
+ }), this._tileUpdateDebounceHandle = void 0;
883
+ }, 150));
884
+ }, { initial: !0, sync: !0 })
885
+ ]);
886
+ }
887
+ _reloadCamera() {
888
+ this.camera = this.camera?.clone();
889
+ }
890
+ _clearImage() {
891
+ this._tileUpdateDebounceHandle != null && (clearTimeout(this._tileUpdateDebounceHandle), this._tileUpdateDebounceHandle = void 0), this._tileUpdateTask?.abort(), this._tileUpdateTask = void 0, this.tileCache.clear();
892
+ for (const e of this._tileLabelGraphics.values())
893
+ this.removeGraphic(e);
894
+ this._tileLabelGraphics.clear(), this.clearGraphics(), this._base = void 0, this._currentGraphicsStore.removeAll();
895
+ }
896
+ _parseTileKey(e) {
897
+ const [t, o, i] = e.split("/").map(Number);
898
+ return { level: t, row: o, col: i };
899
+ }
900
+ _createTileLabelGraphic(e, t) {
901
+ const { level: o, row: i, col: a } = this._parseTileKey(t), [s, n, l] = e.getTileAnchor(o, i, a);
902
+ return new Q({
903
+ attributes: { tileKey: t },
904
+ geometry: new W({
905
+ x: s,
906
+ y: n,
907
+ z: l,
908
+ spatialReference: H.WebMercator
909
+ }),
910
+ symbol: new Le({
911
+ color: [255, 255, 255, 0.95],
912
+ font: new Se({
913
+ family: "Avenir Next",
914
+ size: 8,
915
+ weight: "bold"
916
+ }),
917
+ haloColor: [0, 0, 0, 0.9],
918
+ haloSize: 1,
919
+ horizontalAlignment: "center",
920
+ text: t,
921
+ verticalAlignment: "middle"
922
+ })
923
+ });
924
+ }
925
+ _attachTileLabel(e, t) {
926
+ if (this._tileLabelGraphics.has(t))
927
+ return;
928
+ const o = this._createTileLabelGraphic(e, t);
929
+ this._tileLabelGraphics.set(t, o), this._currentGraphicsStore.add(o), this.addGraphic(o);
930
+ }
931
+ _detachTileLabel(e) {
932
+ const t = this._tileLabelGraphics.get(e);
933
+ t && (this.removeGraphic(t), this._currentGraphicsStore.remove(t), this._tileLabelGraphics.delete(e));
934
+ }
935
+ async _updateTilesForCurrentView(e, t) {
936
+ const { base: o } = this;
937
+ if (!o)
938
+ return;
939
+ const { panoramicTileSource: i, heading: a, pitch: s, hfov: n, vfov: l } = e, d = [Math.max(1, this.view?.width ?? 1), Math.max(1, this.view?.height ?? 1)], m = i.planTiles({
940
+ heading: a,
941
+ pitch: s,
942
+ hfov: n,
943
+ vfov: l,
944
+ imageSize: i.imageSize,
945
+ viewportSize: d
946
+ });
947
+ if (z(t), i.cancelStaleInflight(m.desiredKeySet), m.toDrop.length > 0) {
948
+ const p = new Set(m.toDrop);
949
+ for (const u of p) {
950
+ const { level: _, row: g, col: w } = this._parseTileKey(u);
951
+ i.unloadComponent(_, g, w), i.markTileDropped(u), this._detachTileLabel(u), this.tileCache.delete(u);
952
+ }
953
+ }
954
+ const c = async (p) => {
955
+ if (p >= m.toFetch.length)
956
+ return;
957
+ const u = m.toFetch[p];
958
+ if (z(t), !this.tileCache.has(u)) {
959
+ const { level: _, row: g, col: w } = this._parseTileKey(u), v = new AbortController(), y = () => {
960
+ v.abort();
961
+ };
962
+ t.addEventListener("abort", y, { once: !0 }), i.markTileInflight(u, v);
963
+ try {
964
+ const f = await i.fetchTileImageData(_, g, w, v.signal);
965
+ z(t), m.desiredKeySet.has(u) && !this.tileCache.has(u) && (i.loadComponent(_, g, w, f), i.markTileLoaded(u), this._attachTileLabel(i, u), this.tileCache.add(u));
966
+ } catch (f) {
967
+ ye(f) || Re("error", this, "Failed loading panoramic tile component", { detail: { key: u, error: f } });
968
+ } finally {
969
+ t.removeEventListener("abort", y), i.markTileInflightResolved(u);
970
+ }
971
+ }
972
+ await c(p + 1);
973
+ };
974
+ await c(0);
975
+ const h = i.planTiles({
976
+ heading: a,
977
+ pitch: s,
978
+ hfov: n,
979
+ vfov: l,
980
+ imageSize: i.imageSize,
981
+ viewportSize: d
982
+ });
983
+ if (z(t), h.toDrop.length > 0) {
984
+ const p = new Set(h.toDrop);
985
+ for (const u of p) {
986
+ const { level: _, row: g, col: w } = this._parseTileKey(u);
987
+ i.unloadComponent(_, g, w), i.markTileDropped(u), this._detachTileLabel(u), this.tileCache.delete(u);
988
+ }
989
+ }
990
+ }
991
+ async _loadMediaInternal(e, t) {
992
+ if (this._loading = !0, this._clearImage(), !e)
993
+ throw new Error("No media provided");
994
+ const { mesh: o } = await e.load(t).finally(() => {
995
+ this._loading = !1;
996
+ });
997
+ z(t), this._fov = Pe(Ge, this.el.clientWidth / this.el.clientHeight), this._base = Be(o), this.addGraphic(this._base);
998
+ }
999
+ render() {
1000
+ return Z`<calcite-panel .loading=${this.hideLoader ? void 0 : this._loading} .heading=${this.hideTitle ? void 0 : this._messages.title}><arcgis-scene .environment=${this.#e} hide-attribution .spatialReference=${H.WebMercator} viewing-mode=local .ground=${this._ground} @arcgisViewMouseWheel=${this._handleMouseWheel} ${q(this._internalMap)}><arcgis-oriented-imagery-viewer-panoramic-viewer-zoom .hidden=${this.hideZoomControls} slot=top-left ${q(this._internalZoom)}></arcgis-oriented-imagery-viewer-panoramic-viewer-zoom></arcgis-scene>${this.hideVideoControls || this.media?.type !== "video" ? null : Z`<arcgis-oriented-imagery-viewer-video-controls .videoRef=${this._media?.element}></arcgis-oriented-imagery-viewer-video-controls>`}</calcite-panel>`;
1001
+ }
1002
+ }
1003
+ re("arcgis-oriented-imagery-viewer-panoramic-viewer", at);
1004
+ export {
1005
+ at as ArcgisOrientedImageryViewerPanoramicViewer
1006
+ };