js-cloudimage-360-view 4.1.0-beta.0 → 4.1.1

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.
@@ -1,405 +1,5 @@
1
- import './js-cloudimage-360-view.min.css';var qe = Object.defineProperty;
2
- var ti = (e, t, i) => t in e ? qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
3
- var le = (e, t, i) => ti(e, typeof t != "symbol" ? t + "" : t, i);
4
- var Mt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
- function ei(e) {
6
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
7
- }
8
- var Ze = "Expected a function", ce = NaN, ii = "[object Symbol]", ni = /^\s+|\s+$/g, oi = /^[-+]0x[0-9a-f]+$/i, si = /^0b[01]+$/i, ri = /^0o[0-7]+$/i, ai = parseInt, li = typeof Mt == "object" && Mt && Mt.Object === Object && Mt, ci = typeof self == "object" && self && self.Object === Object && self, hi = li || ci || Function("return this")(), di = Object.prototype, ui = di.toString, pi = Math.max, fi = Math.min, _t = function() {
9
- return hi.Date.now();
10
- };
11
- function mi(e, t, i) {
12
- var n, o, s, l, r, a, c = 0, h = !1, p = !1, f = !0;
13
- if (typeof e != "function")
14
- throw new TypeError(Ze);
15
- t = he(t) || 0, Bt(i) && (h = !!i.leading, p = "maxWait" in i, s = p ? pi(he(i.maxWait) || 0, t) : s, f = "trailing" in i ? !!i.trailing : f);
16
- function u(y) {
17
- var O = n, S = o;
18
- return n = o = void 0, c = y, l = e.apply(S, O), l;
19
- }
20
- function I(y) {
21
- return c = y, r = setTimeout(m, t), h ? u(y) : l;
22
- }
23
- function g(y) {
24
- var O = y - a, S = y - c, E = t - O;
25
- return p ? fi(E, s - S) : E;
26
- }
27
- function v(y) {
28
- var O = y - a, S = y - c;
29
- return a === void 0 || O >= t || O < 0 || p && S >= s;
30
- }
31
- function m() {
32
- var y = _t();
33
- if (v(y))
34
- return b(y);
35
- r = setTimeout(m, g(y));
36
- }
37
- function b(y) {
38
- return r = void 0, f && n ? u(y) : (n = o = void 0, l);
39
- }
40
- function x() {
41
- r !== void 0 && clearTimeout(r), c = 0, n = a = o = r = void 0;
42
- }
43
- function w() {
44
- return r === void 0 ? l : b(_t());
45
- }
46
- function C() {
47
- var y = _t(), O = v(y);
48
- if (n = arguments, o = this, a = y, O) {
49
- if (r === void 0)
50
- return I(a);
51
- if (p)
52
- return r = setTimeout(m, t), u(a);
53
- }
54
- return r === void 0 && (r = setTimeout(m, t)), l;
55
- }
56
- return C.cancel = x, C.flush = w, C;
57
- }
58
- function vi(e, t, i) {
59
- var n = !0, o = !0;
60
- if (typeof e != "function")
61
- throw new TypeError(Ze);
62
- return Bt(i) && (n = "leading" in i ? !!i.leading : n, o = "trailing" in i ? !!i.trailing : o), mi(e, t, {
63
- leading: n,
64
- maxWait: t,
65
- trailing: o
66
- });
67
- }
68
- function Bt(e) {
69
- var t = typeof e;
70
- return !!e && (t == "object" || t == "function");
71
- }
72
- function gi(e) {
73
- return !!e && typeof e == "object";
74
- }
75
- function yi(e) {
76
- return typeof e == "symbol" || gi(e) && ui.call(e) == ii;
77
- }
78
- function he(e) {
79
- if (typeof e == "number")
80
- return e;
81
- if (yi(e))
82
- return ce;
83
- if (Bt(e)) {
84
- var t = typeof e.valueOf == "function" ? e.valueOf() : e;
85
- e = Bt(t) ? t + "" : t;
86
- }
87
- if (typeof e != "string")
88
- return e === 0 ? e : +e;
89
- e = e.replace(ni, "");
90
- var i = si.test(e);
91
- return i || ri.test(e) ? ai(e.slice(2), i ? 2 : 8) : oi.test(e) ? ce : +e;
92
- }
93
- var bi = vi;
94
- const de = /* @__PURE__ */ ei(bi), M = {
95
- SPIN_X: "spin-x",
96
- SPIN_Y: "spin-y",
97
- SPIN_XY: "spin-xy",
98
- SPIN_YX: "spin-yx"
99
- }, wi = [!1, 0, null, void 0, "false", "0", "null", "undefined"], P = {
100
- X: "x-axis",
101
- Y: "y-axis"
102
- }, Ii = [37, 39], xi = [38, 40], ue = 10, Ci = 150, pe = 800, Oi = 150, Ei = 200, fe = 50, Si = 50, Ai = 5, me = 5, Li = "https://scaleflex.cloudimg.io/v7/filerobot/js-cloudimage-360-view/360_view.svg", d = {
103
- folder: "/",
104
- apiVersion: "v7",
105
- filenameX: "image-{index}.jpg",
106
- filenameY: null,
107
- imageListX: null,
108
- imageListY: null,
109
- indexZeroBase: 0,
110
- amountX: 0,
111
- amountY: 0,
112
- speed: 80,
113
- dragSpeed: 150,
114
- draggable: !0,
115
- swipeable: !0,
116
- keys: !1,
117
- keysReverse: !1,
118
- autoplay: !1,
119
- autoplayBehavior: M.SPIN_X,
120
- playOnce: !1,
121
- autoplayReverse: !1,
122
- pointerZoom: 0,
123
- fullscreen: !1,
124
- magnifier: null,
125
- bottomCircle: !0,
126
- bottomCircleOffset: 5,
127
- ciToken: null,
128
- ciFilters: null,
129
- ciTransformation: null,
130
- lazyload: !0,
131
- dragReverse: !1,
132
- stopAtEdges: !1,
133
- imageInfo: !1,
134
- initialIconShown: !0,
135
- hotspots: null,
136
- hide360Logo: !1,
137
- logoSrc: Li,
138
- inertia: !1,
139
- pinchZoom: !0,
140
- hints: !0,
141
- theme: null,
142
- hotspotTimelineOnClick: !0,
143
- // Event callbacks
144
- onReady: null,
145
- onLoad: null,
146
- onSpin: null,
147
- onAutoplayStart: null,
148
- onAutoplayStop: null,
149
- onFullscreenOpen: null,
150
- onFullscreenClose: null,
151
- onZoomIn: null,
152
- onZoomOut: null,
153
- onDragStart: null,
154
- onDragEnd: null
155
- }, ki = (e) => ({
156
- folder: k(e, "folder", d.folder),
157
- apiVersion: k(e, "api-version", d.apiVersion),
158
- filenameX: k(e, "filename") || k(e, "filename-x") || d.filenameX,
159
- filenameY: k(e, "filename-y", d.filenameY),
160
- imageListX: k(e, "image-list-x", d.imageListX),
161
- imageListY: k(e, "image-list-y", d.imageListY),
162
- indexZeroBase: parseInt(k(e, "index-zero-base", d.indexZeroBase), 10),
163
- amountX: parseInt(k(e, "amount-x", d.amountX), 10),
164
- amountY: parseInt(k(e, "amount-y", d.amountY), 10),
165
- speed: parseInt(k(e, "speed", d.speed), 10),
166
- dragSpeed: parseInt(k(e, "drag-speed", d.dragSpeed), 10),
167
- draggable: X(e, "draggable", d.draggable),
168
- swipeable: X(e, "swipeable", d.swipeable),
169
- keys: X(e, "keys", d.keys),
170
- keysReverse: X(e, "keys-reverse", d.keysReverse),
171
- autoplay: X(e, "autoplay", d.autoplay),
172
- autoplayBehavior: k(e, "autoplay-behavior", d.autoplayBehavior),
173
- playOnce: X(e, "play-once", d.playOnce),
174
- autoplayReverse: X(e, "autoplay-reverse", d.autoplayReverse),
175
- pointerZoom: parseFloat(k(e, "pointer-zoom", d.pointerZoom)),
176
- fullscreen: X(e, "fullscreen") || X(e, "full-screen", d.fullscreen),
177
- magnifier: parseFloat(k(e, "magnifier", d.magnifier)),
178
- bottomCircleOffset: parseInt(
179
- k(e, "bottom-circle-offset", d.bottomCircleOffset),
180
- 10
181
- ),
182
- ciToken: k(e, "responsive", d.ciToken),
183
- ciFilters: k(e, "filters", d.ciFilters),
184
- ciTransformation: k(e, "transformation", d.ciTransformation),
185
- lazyload: X(e, "lazyload", d.lazyload),
186
- dragReverse: X(e, "drag-reverse", d.dragReverse),
187
- stopAtEdges: X(e, "stop-at-edges", d.stopAtEdges),
188
- imageInfo: X(e, "info", d.imageInfo),
189
- initialIconShown: !Ht(e, "initial-icon"),
190
- bottomCircle: !Ht(e, "bottom-circle"),
191
- hide360Logo: X(e, "hide-360-logo", d.hide360Logo),
192
- logoSrc: k(e, "logo-src", d.logoSrc),
193
- inertia: X(e, "inertia", d.inertia),
194
- pinchZoom: X(e, "pinch-zoom", d.pinchZoom),
195
- hints: !Ht(e, "hints"),
196
- theme: k(e, "theme", d.theme),
197
- hotspotTimelineOnClick: !Ht(e, "hotspot-timeline-on-click")
198
- }), Ti = (e) => {
199
- const t = [];
200
- e.amountX !== void 0 && e.amountX < 0 && t.push("amountX should be a positive number"), e.amountY !== void 0 && e.amountY < 0 && t.push("amountY should be a positive number"), e.speed !== void 0 && e.speed <= 0 && t.push("speed should be a positive number"), e.dragSpeed !== void 0 && e.dragSpeed <= 0 && t.push("dragSpeed should be a positive number"), e.pointerZoom !== void 0 && e.pointerZoom !== 0 && (e.pointerZoom < 1 || e.pointerZoom > 5) && t.push("pointerZoom should be between 1 and 5 (or 0 to disable)"), e.magnifier !== void 0 && e.magnifier !== null && e.magnifier !== 0 && (e.magnifier < 1 || e.magnifier > 5) && t.push("magnifier should be between 1 and 5 (or 0/null to disable)"), !e.folder && !e.imageListX && !e.imageListY && t.push("Either folder or imageListX/imageListY is required"), e.folder && !e.amountX && !e.imageListX && t.push("amountX is required when using folder (unless imageListX is provided)");
201
- const i = ["spin-x", "spin-y", "spin-xy", "spin-yx"];
202
- return e.autoplayBehavior && !i.includes(e.autoplayBehavior) && t.push(`autoplayBehavior should be one of: ${i.join(", ")}`), t.forEach((n) => {
203
- console.warn(`CloudImage 360: ${n}`);
204
- }), t.length === 0;
205
- }, Yi = (e) => (Ti(e), {
206
- folder: e.folder || d.folder,
207
- apiVersion: e.apiVersion || d.apiVersion,
208
- filenameX: e.filenameX || e.filename || d.filenameX,
209
- filenameY: e.filenameY || d.filenameY,
210
- imageListX: e.imageListX || d.imageListX,
211
- imageListY: e.imageListY || d.imageListY,
212
- indexZeroBase: parseInt(e.indexZeroBase ?? d.indexZeroBase, 10),
213
- amountX: parseInt(e.amountX ?? d.amountX, 10),
214
- amountY: parseInt(e.amountY ?? d.amountY, 10),
215
- speed: parseInt(e.speed ?? d.speed, 10),
216
- draggable: e.draggable ?? d.draggable,
217
- swipeable: e.swipeable ?? d.swipeable,
218
- dragSpeed: parseInt(e.dragSpeed ?? d.dragSpeed, 10),
219
- keys: e.keys ?? d.keys,
220
- keysReverse: e.keysReverse ?? d.keysReverse,
221
- autoplay: e.autoplay ?? d.autoplay,
222
- autoplayBehavior: e.autoplayBehavior || d.autoplayBehavior,
223
- playOnce: e.playOnce ?? d.playOnce,
224
- autoplayReverse: e.autoplayReverse ?? d.autoplayReverse,
225
- pointerZoom: parseFloat(e.pointerZoom ?? d.pointerZoom),
226
- fullscreen: e.fullscreen ?? d.fullscreen,
227
- magnifier: parseFloat(e.magnifier ?? d.magnifier),
228
- bottomCircleOffset: parseInt(e.bottomCircleOffset ?? d.bottomCircleOffset, 10),
229
- ciToken: e.ciToken || d.ciToken,
230
- ciFilters: e.ciFilters || d.ciFilters,
231
- ciTransformation: e.ciTransformation || d.ciTransformation,
232
- lazyload: e.lazyload ?? d.lazyload,
233
- dragReverse: e.dragReverse ?? d.dragReverse,
234
- stopAtEdges: e.stopAtEdges ?? d.stopAtEdges,
235
- imageInfo: e.imageInfo ?? d.imageInfo,
236
- initialIconShown: e.initialIconShown ?? d.initialIconShown,
237
- bottomCircle: e.bottomCircle ?? d.bottomCircle,
238
- hotspots: e.hotspots ?? d.hotspots,
239
- hide360Logo: e.hide360Logo ?? d.hide360Logo,
240
- logoSrc: e.logoSrc || d.logoSrc,
241
- inertia: e.inertia ?? d.inertia,
242
- pinchZoom: e.pinchZoom ?? d.pinchZoom,
243
- hints: e.hints ?? d.hints,
244
- theme: e.theme || d.theme,
245
- hotspotTimelineOnClick: e.hotspotTimelineOnClick ?? d.hotspotTimelineOnClick,
246
- // Event callbacks
247
- onReady: e.onReady ?? d.onReady,
248
- onLoad: e.onLoad ?? d.onLoad,
249
- onSpin: e.onSpin ?? d.onSpin,
250
- onAutoplayStart: e.onAutoplayStart ?? d.onAutoplayStart,
251
- onAutoplayStop: e.onAutoplayStop ?? d.onAutoplayStop,
252
- onFullscreenOpen: e.onFullscreenOpen ?? d.onFullscreenOpen,
253
- onFullscreenClose: e.onFullscreenClose ?? d.onFullscreenClose,
254
- onZoomIn: e.onZoomIn ?? d.onZoomIn,
255
- onZoomOut: e.onZoomOut ?? d.onZoomOut,
256
- onDragStart: e.onDragStart ?? d.onDragStart,
257
- onDragEnd: e.onDragEnd ?? d.onDragEnd
258
- }), k = (e, t, i) => e.getAttribute(t) || e.getAttribute(`data-${t}`) || i, X = (e, t, i) => {
259
- if (!(e.hasAttribute(t) || e.hasAttribute(`data-${t}`))) return i;
260
- const o = k(e, t, null);
261
- return o !== "false" && o !== "0";
262
- }, Ht = (e, t) => k(e, t, null) === "false", Xi = (e = 1) => {
263
- const t = Math.round(window.devicePixelRatio || 1);
264
- return parseInt(e) * t;
265
- }, Pi = (e, t, i) => new URL(e).origin.includes("cloudimg") ? e : `https://${t}.cloudimg.io/${i}${e}`, Ri = ({ ciTransformation: e, responsiveWidth: t, ciFilters: i }) => {
266
- const n = `width=${t}`, o = e || n, s = i ? `&f=${i}` : "";
267
- return `${o}${s}`;
268
- }, Ot = (e, t) => {
269
- const { folder: i, apiVersion: n, filename: o = "", ciParams: s } = e, { ciToken: l, ciFilters: r, ciTransformation: a } = s || {}, c = `${i}${o}`;
270
- if (!l) return c;
271
- const h = wi.includes(n) ? null : n, p = h ? `${h}/` : "", f = Xi(t), u = Pi(c, l, p), I = Ri({
272
- ciTransformation: a,
273
- responsiveWidth: f,
274
- ciFilters: r
275
- });
276
- return `${u}${I ? "?" : ""}${I}`;
277
- }, Mi = (e, t, i) => {
278
- const [n, o] = e.split("?"), s = `${t}=${encodeURIComponent(i)}`;
279
- if (!o)
280
- return `${n}?${s}`;
281
- const l = new URLSearchParams(o);
282
- return l.set(t, i), `${n}?${l.toString()}`;
283
- }, Hi = (e, t) => Mi(e, "width", t), Be = (e, t = 0) => (e += "", e.length >= t ? e : new Array(t - e.length + 1).join("0") + e), Di = (e, { amount: t = 0, indexZeroBase: i = 0 } = {}) => Array.from({ length: t }, (n, o) => e.replace("{index}", Be(o + 1, i))), Zi = ({
284
- imagesUrls: e,
285
- onFirstImageLoad: t,
286
- onImageLoad: i,
287
- onAllImagesLoad: n,
288
- onError: o,
289
- autoplayReverse: s
290
- }) => {
291
- let l = 0, r = 0;
292
- const a = e.length, c = [], h = [], p = (m, b, x = !1) => {
293
- const w = {
294
- message: `Failed to load image: ${m}`,
295
- url: m,
296
- index: b,
297
- isFirstImage: x
298
- };
299
- h.push(w), r++, o == null || o({
300
- error: w,
301
- errorCount: r,
302
- totalImages: a,
303
- errors: h
304
- });
305
- }, f = () => {
306
- l === a && (n == null || n(c, { errorCount: r, errors: h }));
307
- }, u = (m, b) => {
308
- const x = new Image();
309
- x.crossOrigin = "anonymous", x.src = m, x.onload = async () => {
310
- try {
311
- const w = await createImageBitmap(x), C = {
312
- src: m,
313
- bitmapImage: w,
314
- naturalWidth: x.naturalWidth,
315
- naturalHeight: x.naturalHeight
316
- };
317
- l++, c[b] = C, i == null || i(C, b), f();
318
- } catch {
319
- l++, p(m, b), f();
320
- }
321
- }, x.onerror = () => {
322
- l++, p(m, b), f();
323
- };
324
- }, I = new Image(), g = s ? e.length - 1 : 0, v = e[g];
325
- I.crossOrigin = "anonymous", I.src = v, I.onload = async () => {
326
- try {
327
- const m = await createImageBitmap(I), b = {
328
- src: v,
329
- bitmapImage: m,
330
- naturalWidth: I.naturalWidth,
331
- naturalHeight: I.naturalHeight
332
- };
333
- c[g] = b, l++, t == null || t(b), i == null || i(b, g);
334
- for (let x = 0; x < e.length; x++)
335
- x !== g && u(e[x], x);
336
- f();
337
- } catch {
338
- l++, p(v, g, !0);
339
- for (let b = 0; b < e.length; b++)
340
- b !== g && u(e[b], b);
341
- f();
342
- }
343
- }, I.onerror = () => {
344
- l++, p(v, g, !0);
345
- for (let m = 0; m < e.length; m++)
346
- m !== g && u(e[m], m);
347
- f();
348
- };
349
- }, ve = ({
350
- cdnPathX: e,
351
- cdnPathY: t,
352
- configX: i,
353
- configY: n,
354
- onFirstImageLoad: o,
355
- onImageLoad: s,
356
- onAllImagesLoad: l,
357
- onError: r
358
- }) => {
359
- let a = { x: !1, y: !1 }, c = [], h = [], p = { errorCount: 0, errors: [] }, f = { errorCount: 0, errors: [] };
360
- const u = e || i.imageList.length, I = t || n.imageList.length, g = () => {
361
- if (a.x && a.y) {
362
- const m = {
363
- errorCount: p.errorCount + f.errorCount,
364
- errors: [...p.errors, ...f.errors]
365
- };
366
- l == null || l(c, h, m);
367
- }
368
- }, v = ({ cdnPath: m, config: b, orientation: x, loadedImages: w, loadStats: C, onFirstImageLoad: y }) => {
369
- const O = x === P.X, S = b.imageList.length ? b.imageList : Di(m, b);
370
- Zi({
371
- imagesUrls: S,
372
- onFirstImageLoad: y,
373
- onImageLoad: (E, A) => {
374
- s == null || s(E, A, x), w[A] = E;
375
- },
376
- onError: (E) => {
377
- r == null || r({ ...E, orientation: x });
378
- },
379
- onAllImagesLoad: (E, A) => {
380
- w.length = 0, E.forEach((L, R) => {
381
- L && (w[R] = L);
382
- }), C.errorCount = A.errorCount, C.errors = A.errors.map((L) => ({ ...L, orientation: x })), a[O ? "x" : "y"] = !0, g();
383
- },
384
- autoplayReverse: b.autoplayReverse
385
- });
386
- };
387
- u ? v({
388
- cdnPath: e,
389
- config: i,
390
- orientation: P.X,
391
- loadedImages: c,
392
- loadStats: p,
393
- onFirstImageLoad: o
394
- }) : a.x = !0, I ? v({
395
- cdnPath: t,
396
- config: n,
397
- orientation: P.Y,
398
- loadedImages: h,
399
- loadStats: f,
400
- onFirstImageLoad: u ? void 0 : o
401
- }) : a.y = !0, !u && !I && g();
402
- }, Bi = `
1
+ var CI360=function(){"use strict";var Kn=Object.defineProperty;var Jn=(q,W,lt)=>W in q?Kn(q,W,{enumerable:!0,configurable:!0,writable:!0,value:lt}):q[W]=lt;var qe=(q,W,lt)=>Jn(q,typeof W!="symbol"?W+"":W,lt);var q=document.createElement("style");q.textContent=`:root{--ci360-button-bg: rgba(255, 255, 255, .9);--ci360-button-bg-hover: rgba(255, 255, 255, 1);--ci360-button-size: 40px;--ci360-button-border-radius: 6px;--ci360-button-shadow: 0 2px 8px rgba(0, 0, 0, .15);--ci360-icon-color: #505050;--ci360-icon-color-hover: #333333;--ci360-icon-size: 20px;--ci360-initial-icon-bg: rgba(255, 255, 255, .9);--ci360-initial-icon-color: #505050;--ci360-initial-icon-size: 80px;--ci360-initial-icon-shadow: 0 4px 20px rgba(0, 0, 0, .15);--ci360-spinner-color: rgba(0, 0, 0, .2);--ci360-spinner-accent: #505050;--ci360-spinner-size: 30px;--ci360-fullscreen-bg: #ffffff;--ci360-magnifier-size: 250px;--ci360-magnifier-border: 2px solid rgba(0, 0, 0, .2);--ci360-magnifier-shadow: 0 8px 16px rgba(0, 0, 0, .3);--ci360-focus-color: #0066cc;--ci360-overlay-bg: rgba(255, 255, 255, 1);--ci360-hotspot-color: #00aaff;--ci360-hotspot-border: 2px solid #fff;--ci360-hotspot-size: 18px;--ci360-popper-bg: rgba(255, 255, 255, .95);--ci360-popper-color: #333;--ci360-popper-shadow: 0px 4px 16px rgba(0, 0, 0, .15);--ci360-popper-border-radius: 8px;--ci360-hints-bg: rgba(255, 255, 255, .9);--ci360-hints-color: #333333;--ci360-hints-font-size: 13px;--ci360-hints-border-radius: 20px;--ci360-hints-shadow: 0 2px 12px rgba(0, 0, 0, .1);--ci360-circle-color: #888888;--ci360-timeline-height: 6px;--ci360-timeline-track-bg: rgba(0, 0, 0, .12);--ci360-timeline-dot-size: 18px;--ci360-timeline-dot-color: var(--ci360-hotspot-color);--ci360-timeline-dot-border: 2px solid #fff;--ci360-timeline-indicator-size: 12px;--ci360-timeline-indicator-color: #333333;--ci360-timeline-tooltip-bg: rgba(255, 255, 255, .95);--ci360-timeline-tooltip-color: #333333}.ci360-theme-dark{--ci360-button-bg: rgba(40, 40, 45, .9);--ci360-button-bg-hover: rgba(55, 55, 60, .95);--ci360-button-shadow: 0 2px 8px rgba(0, 0, 0, .4);--ci360-icon-color: #e0e0e0;--ci360-icon-color-hover: #ffffff;--ci360-initial-icon-bg: rgba(40, 40, 45, .9);--ci360-initial-icon-color: #f5f5f5;--ci360-initial-icon-shadow: 0 4px 20px rgba(0, 0, 0, .4);--ci360-spinner-color: rgba(255, 255, 255, .2);--ci360-spinner-accent: #e0e0e0;--ci360-fullscreen-bg: #1a1a1f;--ci360-overlay-bg: rgba(26, 26, 31, 1);--ci360-magnifier-border: 2px solid rgba(255, 255, 255, .2);--ci360-magnifier-shadow: 0 8px 16px rgba(0, 0, 0, .5);--ci360-popper-bg: rgba(40, 40, 45, .95);--ci360-popper-color: #e0e0e0;--ci360-popper-shadow: 0px 4px 16px rgba(0, 0, 0, .4);--ci360-hints-bg: rgba(40, 40, 45, .9);--ci360-hints-color: #e0e0e0;--ci360-hints-shadow: 0 2px 12px rgba(0, 0, 0, .3);--ci360-circle-color: #b0b0b0;--ci360-timeline-track-bg: rgba(255, 255, 255, .15);--ci360-timeline-dot-border: 2px solid rgba(255, 255, 255, .9);--ci360-timeline-indicator-color: #e0e0e0;--ci360-timeline-tooltip-bg: rgba(40, 40, 45, .95);--ci360-timeline-tooltip-color: #e0e0e0}@keyframes rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.cloudimage-360{width:100%;position:relative}.cloudimage-360-inner-box{width:100%;height:100%;position:relative}.cloudimage-360-icons-container{position:absolute;display:flex;top:15px;right:10px;height:100%;flex-direction:column;align-items:center;z-index:100;gap:8px}.cloudimage-360-transition-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--ci360-overlay-bg);opacity:0;transition:all 1s ease-out;z-index:10}.cloudimage-360-button{width:var(--ci360-button-size);height:var(--ci360-button-size);cursor:pointer;transition:transform .15s ease-out,background-color .15s ease-out,box-shadow .15s ease-out;display:flex;align-items:center;justify-content:center;border-radius:var(--ci360-button-border-radius);border:none;background-color:var(--ci360-button-bg);box-shadow:var(--ci360-button-shadow);padding:6px;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}.cloudimage-360-button:hover{transform:scale(1.05);background-color:var(--ci360-button-bg-hover)}.cloudimage-360-button:focus{outline:none}.cloudimage-360-button:focus-visible{outline:2px solid var(--ci360-focus-color);outline-offset:2px}.cloudimage-360-button svg{width:var(--ci360-icon-size);height:var(--ci360-icon-size);stroke:var(--ci360-icon-color);transition:stroke .15s ease-out}.cloudimage-360-button:hover svg{stroke:var(--ci360-icon-color-hover)}.cloudimage-initial-icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--ci360-initial-icon-size);height:var(--ci360-initial-icon-size);border-radius:50%;background-color:var(--ci360-initial-icon-bg);box-shadow:var(--ci360-initial-icon-shadow);transition:all .3s ease;color:var(--ci360-initial-icon-color);display:flex;align-items:center;justify-content:center;z-index:2;-webkit-user-select:none;-moz-user-select:none;user-select:none;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}.cloudimage-initial-icon svg{width:70%;height:70%;color:var(--ci360-initial-icon-color);fill:var(--ci360-initial-icon-color);stroke:var(--ci360-initial-icon-color)}.cloudimage-initial-icon svg path{stroke:var(--ci360-initial-icon-color)}.cloudimage-initial-icon svg text{fill:var(--ci360-initial-icon-color)}.cloudimage-initial-icon:hover{transform:translate(-50%,-50%) scale(1.08)}.cloudimage-loading-spinner{width:var(--ci360-spinner-size);height:var(--ci360-spinner-size);transform:translate(-50%,-50%);border:3px solid var(--ci360-spinner-color);position:absolute;top:15px;left:15px;border-bottom-color:var(--ci360-spinner-accent);border-radius:50%;display:inline-block;box-sizing:border-box;opacity:0;animation:rotation .7s linear infinite}.cloudimage-360-view-360-circle{position:absolute;left:0;bottom:0;width:100%;height:auto;margin:auto;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;transition:.2s all;z-index:2;color:var(--ci360-circle-color)}.cloudimage-360-view-360-circle svg{display:block;width:100%;height:auto}.cloudimage-360-fullscreen-modal{position:fixed;top:0;bottom:0;left:0;right:0;width:100%;height:100%;z-index:999;background-color:var(--ci360-fullscreen-bg)}.cloudimage-360-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.cloudimage-360-hints-overlay{position:absolute;bottom:0;left:0;width:100%;display:flex;align-items:flex-end;justify-content:center;padding-bottom:16px;z-index:50;pointer-events:none;opacity:0;transition:opacity .3s ease}.cloudimage-360-hints-overlay.visible{opacity:1}.cloudimage-360-hints-overlay.hiding{opacity:0}.cloudimage-360-hints-container{display:flex;flex-direction:row;gap:20px;padding:10px 20px;background:var(--ci360-hints-bg);border-radius:var(--ci360-hints-border-radius);box-shadow:var(--ci360-hints-shadow);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}.cloudimage-360-hint-item{display:flex;align-items:center;gap:8px;color:var(--ci360-hints-color);font-size:var(--ci360-hints-font-size);font-family:system-ui,-apple-system,sans-serif;white-space:nowrap}.cloudimage-360-hint-item svg{width:16px;height:16px;flex-shrink:0;stroke:var(--ci360-hints-color)}.cloudimage-360-hint-item span{opacity:.9}@media (max-width: 480px){.cloudimage-360-hints-container{flex-direction:column;gap:8px;padding:12px 16px;border-radius:12px}.cloudimage-360-hint-item{font-size:12px}.cloudimage-360-hint-item svg{width:14px;height:14px}.cloudimage-360-initial-icon{width:calc(var(--ci360-initial-icon-size) * .8);height:calc(var(--ci360-initial-icon-size) * .8)}}.cloudimage-360-img-magnifier-glass{background-color:#fff;background-image:radial-gradient(circle at center,#fffc,#f0f0f0e6);background-repeat:no-repeat;position:absolute;border:var(--ci360-magnifier-border);border-radius:50%;line-height:200px;text-align:center;z-index:1000;width:var(--ci360-magnifier-size);height:var(--ci360-magnifier-size);top:-75px;right:-85px;box-shadow:var(--ci360-magnifier-shadow);transition:box-shadow .2s ease;overflow:hidden;pointer-events:none}.cloudimage-360-hotspot-timeline{width:100%;max-width:500px;margin:16px auto 8px;padding:12px 20px;opacity:0;transition:opacity .3s ease;pointer-events:none}.cloudimage-360-hotspot-timeline.visible{opacity:1;pointer-events:auto}.cloudimage-360-hotspot-timeline-track{position:relative;width:100%;height:var(--ci360-timeline-height);background:var(--ci360-timeline-track-bg);border-radius:calc(var(--ci360-timeline-height) / 2)}.cloudimage-360-hotspot-timeline-indicator{position:absolute;top:50%;left:0;width:var(--ci360-timeline-indicator-size);height:var(--ci360-timeline-indicator-size);background:var(--ci360-timeline-indicator-color);border-radius:50%;transform:translate(-50%,-50%);transition:left .1s ease-out;pointer-events:none;box-shadow:0 2px 4px #0003}.cloudimage-360-hotspot-timeline-dot{position:absolute;top:50%;width:var(--ci360-timeline-dot-size);height:var(--ci360-timeline-dot-size);background:var(--ci360-timeline-dot-color);border:var(--ci360-timeline-dot-border);border-radius:50%;transform:translate(-50%,-50%);cursor:pointer;transition:transform .15s ease,box-shadow .15s ease;box-shadow:0 2px 6px #00000040;padding:0;font:inherit;outline:none}.cloudimage-360-hotspot-timeline-dot:hover{transform:translate(-50%,-50%) scale(1.25);box-shadow:0 3px 10px #0000004d}.cloudimage-360-hotspot-timeline-dot:focus-visible{outline:2px solid var(--ci360-focus-color);outline-offset:2px}.cloudimage-360-hotspot-timeline-tooltip{position:absolute;bottom:calc(100% + 10px);left:50%;transform:translate(-50%);background:var(--ci360-timeline-tooltip-bg);color:var(--ci360-timeline-tooltip-color);padding:6px 12px;border-radius:6px;font-size:13px;font-weight:500;white-space:nowrap;opacity:0;visibility:hidden;transition:opacity .2s ease,visibility .2s ease;pointer-events:none;box-shadow:0 2px 8px #00000026;z-index:10}.cloudimage-360-hotspot-timeline-tooltip:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);border:6px solid transparent;border-top-color:var(--ci360-timeline-tooltip-bg)}.cloudimage-360-hotspot-timeline-tooltip.visible{opacity:1;visibility:visible}@media (max-width: 480px){.cloudimage-360-hotspot-timeline{max-width:none;padding:10px 16px;margin:12px auto 6px}}.cloudimage-360-hotspot-container{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;z-index:20}.cloudimage-360-popper{opacity:1;transition:opacity .2s ease-in-out}.cloudimage-360-hotspot{display:inline-block;position:absolute;top:0;right:0;bottom:0;left:0;transform:translate(-50%,-50%);background:var(--ci360-hotspot-color);border:var(--ci360-hotspot-border);border-radius:50%;height:var(--ci360-hotspot-size);width:var(--ci360-hotspot-size);box-shadow:0 0 #0af9,0 2px 6px #0003;opacity:0;animation:pulse 2s infinite;transition:transform .2s ease,box-shadow .2s ease;padding:0;cursor:pointer;font:inherit;outline:none}.cloudimage-360-hotspot:focus-visible{outline:2px solid var(--ci360-focus-color, #0066cc);outline-offset:2px;animation:none}.cloudimage-360-hotspot.visible{opacity:1}@keyframes pulse{0%{transform:scale(1);box-shadow:0 0 #0af9,0 0 0 10px #0af6,0 0 0 20px #0af3}50%{transform:scale(1.1);box-shadow:0 0 0 10px #0af0,0 0 0 20px #00aaff1a,0 0 0 30px #0af0}to{transform:scale(1);box-shadow:0 0 #0af0,0 0 0 10px #0af0,0 0 0 20px #0af0}}.cloudimage-360-hotspot:hover{transform:scale(1.2);box-shadow:0 0 0 5px #00aaff80,0 4px 12px #0000004d}.cloudimage-360-popper{background-color:var(--ci360-popper-bg);color:var(--ci360-popper-color);padding:10px 15px;border-radius:var(--ci360-popper-border-radius);box-shadow:var(--ci360-popper-shadow);font-size:14px;max-width:220px;z-index:9999;text-align:center;transition:opacity .2s ease,translate .2s ease;opacity:0;translate:0 -10px}.cloudimage-360-popper[data-show]{opacity:1;translate:0}
2
+ /*$vite$:1*/`,document.head.appendChild(q);var W=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function lt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var he="Expected a function",de=NaN,ti="[object Symbol]",ei=/^\s+|\s+$/g,ii=/^[-+]0x[0-9a-f]+$/i,oi=/^0b[01]+$/i,ni=/^0o[0-7]+$/i,si=parseInt,ri=typeof W=="object"&&W&&W.Object===Object&&W,ai=typeof self=="object"&&self&&self.Object===Object&&self,li=ri||ai||Function("return this")(),ci=Object.prototype,hi=ci.toString,di=Math.max,pi=Math.min,jt=function(){return li.Date.now()};function ui(e,t,i){var o,n,s,l,r,a,c=0,h=!1,u=!1,f=!0;if(typeof e!="function")throw new TypeError(he);t=pe(t)||0,Rt(i)&&(h=!!i.leading,u="maxWait"in i,s=u?di(pe(i.maxWait)||0,t):s,f="trailing"in i?!!i.trailing:f);function p(b){var k=o,E=n;return o=n=void 0,c=b,l=e.apply(E,k),l}function x(b){return c=b,r=setTimeout(m,t),h?p(b):l}function g(b){var k=b-a,E=b-c,O=t-k;return u?pi(O,s-E):O}function v(b){var k=b-a,E=b-c;return a===void 0||k>=t||k<0||u&&E>=s}function m(){var b=jt();if(v(b))return y(b);r=setTimeout(m,g(b))}function y(b){return r=void 0,f&&o?p(b):(o=n=void 0,l)}function I(){r!==void 0&&clearTimeout(r),c=0,o=a=n=r=void 0}function w(){return r===void 0?l:y(jt())}function C(){var b=jt(),k=v(b);if(o=arguments,n=this,a=b,k){if(r===void 0)return x(a);if(u)return r=setTimeout(m,t),p(a)}return r===void 0&&(r=setTimeout(m,t)),l}return C.cancel=I,C.flush=w,C}function fi(e,t,i){var o=!0,n=!0;if(typeof e!="function")throw new TypeError(he);return Rt(i)&&(o="leading"in i?!!i.leading:o,n="trailing"in i?!!i.trailing:n),ui(e,t,{leading:o,maxWait:t,trailing:n})}function Rt(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function mi(e){return!!e&&typeof e=="object"}function vi(e){return typeof e=="symbol"||mi(e)&&hi.call(e)==ti}function pe(e){if(typeof e=="number")return e;if(vi(e))return de;if(Rt(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Rt(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(ei,"");var i=oi.test(e);return i||ni.test(e)?si(e.slice(2),i?2:8):ii.test(e)?de:+e}var gi=fi;const ue=lt(gi),R={SPIN_X:"spin-x",SPIN_Y:"spin-y",SPIN_XY:"spin-xy",SPIN_YX:"spin-yx"},bi=[!1,0,null,void 0,"false","0","null","undefined"],Y={X:"x-axis",Y:"y-axis"},yi=[37,39],wi=[38,40],fe=10,xi=150,me=800,Ii=150,Ci=200,ve=50,ki=50,Oi=5,ge=5,d={folder:"/",apiVersion:"v7",filenameX:"image-{index}.jpg",filenameY:null,imageListX:null,imageListY:null,indexZeroBase:0,amountX:0,amountY:0,speed:80,dragSpeed:150,draggable:!0,swipeable:!0,keys:!1,keysReverse:!1,autoplay:!1,autoplayBehavior:R.SPIN_X,playOnce:!1,autoplayReverse:!1,pointerZoom:0,fullscreen:!1,magnifier:null,bottomCircle:!0,bottomCircleOffset:5,ciToken:null,ciFilters:null,ciTransformation:null,lazyload:!0,dragReverse:!1,stopAtEdges:!1,imageInfo:!1,initialIconShown:!0,hotspots:null,hide360Logo:!1,logoSrc:"https://scaleflex.cloudimg.io/v7/filerobot/js-cloudimage-360-view/360_view.svg",inertia:!1,pinchZoom:!0,hints:!0,theme:null,hotspotTimelineOnClick:!0,onReady:null,onLoad:null,onSpin:null,onAutoplayStart:null,onAutoplayStop:null,onFullscreenOpen:null,onFullscreenClose:null,onZoomIn:null,onZoomOut:null,onDragStart:null,onDragEnd:null},Ei=e=>({folder:A(e,"folder",d.folder),apiVersion:A(e,"api-version",d.apiVersion),filenameX:A(e,"filename")||A(e,"filename-x")||d.filenameX,filenameY:A(e,"filename-y",d.filenameY),imageListX:A(e,"image-list-x",d.imageListX),imageListY:A(e,"image-list-y",d.imageListY),indexZeroBase:parseInt(A(e,"index-zero-base",d.indexZeroBase),10),amountX:parseInt(A(e,"amount-x",d.amountX),10),amountY:parseInt(A(e,"amount-y",d.amountY),10),speed:parseInt(A(e,"speed",d.speed),10),dragSpeed:parseInt(A(e,"drag-speed",d.dragSpeed),10),draggable:X(e,"draggable",d.draggable),swipeable:X(e,"swipeable",d.swipeable),keys:X(e,"keys",d.keys),keysReverse:X(e,"keys-reverse",d.keysReverse),autoplay:X(e,"autoplay",d.autoplay),autoplayBehavior:A(e,"autoplay-behavior",d.autoplayBehavior),playOnce:X(e,"play-once",d.playOnce),autoplayReverse:X(e,"autoplay-reverse",d.autoplayReverse),pointerZoom:parseFloat(A(e,"pointer-zoom",d.pointerZoom)),fullscreen:X(e,"fullscreen")||X(e,"full-screen",d.fullscreen),magnifier:parseFloat(A(e,"magnifier",d.magnifier)),bottomCircleOffset:parseInt(A(e,"bottom-circle-offset",d.bottomCircleOffset),10),ciToken:A(e,"responsive",d.ciToken),ciFilters:A(e,"filters",d.ciFilters),ciTransformation:A(e,"transformation",d.ciTransformation),lazyload:X(e,"lazyload",d.lazyload),dragReverse:X(e,"drag-reverse",d.dragReverse),stopAtEdges:X(e,"stop-at-edges",d.stopAtEdges),imageInfo:X(e,"info",d.imageInfo),initialIconShown:!Mt(e,"initial-icon"),bottomCircle:!Mt(e,"bottom-circle"),hide360Logo:X(e,"hide-360-logo",d.hide360Logo),logoSrc:A(e,"logo-src",d.logoSrc),inertia:X(e,"inertia",d.inertia),pinchZoom:X(e,"pinch-zoom",d.pinchZoom),hints:!Mt(e,"hints"),theme:A(e,"theme",d.theme),hotspotTimelineOnClick:!Mt(e,"hotspot-timeline-on-click")}),Si=e=>{const t=[];e.amountX!==void 0&&e.amountX<0&&t.push("amountX should be a positive number"),e.amountY!==void 0&&e.amountY<0&&t.push("amountY should be a positive number"),e.speed!==void 0&&e.speed<=0&&t.push("speed should be a positive number"),e.dragSpeed!==void 0&&e.dragSpeed<=0&&t.push("dragSpeed should be a positive number"),e.pointerZoom!==void 0&&e.pointerZoom!==0&&(e.pointerZoom<1||e.pointerZoom>5)&&t.push("pointerZoom should be between 1 and 5 (or 0 to disable)"),e.magnifier!==void 0&&e.magnifier!==null&&e.magnifier!==0&&(e.magnifier<1||e.magnifier>5)&&t.push("magnifier should be between 1 and 5 (or 0/null to disable)"),!e.folder&&!e.imageListX&&!e.imageListY&&t.push("Either folder or imageListX/imageListY is required"),e.folder&&!e.amountX&&!e.imageListX&&t.push("amountX is required when using folder (unless imageListX is provided)");const i=["spin-x","spin-y","spin-xy","spin-yx"];return e.autoplayBehavior&&!i.includes(e.autoplayBehavior)&&t.push(`autoplayBehavior should be one of: ${i.join(", ")}`),t.forEach(o=>{console.warn(`CloudImage 360: ${o}`)}),t.length===0},Ai=e=>(Si(e),{folder:e.folder||d.folder,apiVersion:e.apiVersion||d.apiVersion,filenameX:e.filenameX||e.filename||d.filenameX,filenameY:e.filenameY||d.filenameY,imageListX:e.imageListX||d.imageListX,imageListY:e.imageListY||d.imageListY,indexZeroBase:parseInt(e.indexZeroBase??d.indexZeroBase,10),amountX:parseInt(e.amountX??d.amountX,10),amountY:parseInt(e.amountY??d.amountY,10),speed:parseInt(e.speed??d.speed,10),draggable:e.draggable??d.draggable,swipeable:e.swipeable??d.swipeable,dragSpeed:parseInt(e.dragSpeed??d.dragSpeed,10),keys:e.keys??d.keys,keysReverse:e.keysReverse??d.keysReverse,autoplay:e.autoplay??d.autoplay,autoplayBehavior:e.autoplayBehavior||d.autoplayBehavior,playOnce:e.playOnce??d.playOnce,autoplayReverse:e.autoplayReverse??d.autoplayReverse,pointerZoom:parseFloat(e.pointerZoom??d.pointerZoom),fullscreen:e.fullscreen??d.fullscreen,magnifier:parseFloat(e.magnifier??d.magnifier),bottomCircleOffset:parseInt(e.bottomCircleOffset??d.bottomCircleOffset,10),ciToken:e.ciToken||d.ciToken,ciFilters:e.ciFilters||d.ciFilters,ciTransformation:e.ciTransformation||d.ciTransformation,lazyload:e.lazyload??d.lazyload,dragReverse:e.dragReverse??d.dragReverse,stopAtEdges:e.stopAtEdges??d.stopAtEdges,imageInfo:e.imageInfo??d.imageInfo,initialIconShown:e.initialIconShown??d.initialIconShown,bottomCircle:e.bottomCircle??d.bottomCircle,hotspots:e.hotspots??d.hotspots,hide360Logo:e.hide360Logo??d.hide360Logo,logoSrc:e.logoSrc||d.logoSrc,inertia:e.inertia??d.inertia,pinchZoom:e.pinchZoom??d.pinchZoom,hints:e.hints??d.hints,theme:e.theme||d.theme,hotspotTimelineOnClick:e.hotspotTimelineOnClick??d.hotspotTimelineOnClick,onReady:e.onReady??d.onReady,onLoad:e.onLoad??d.onLoad,onSpin:e.onSpin??d.onSpin,onAutoplayStart:e.onAutoplayStart??d.onAutoplayStart,onAutoplayStop:e.onAutoplayStop??d.onAutoplayStop,onFullscreenOpen:e.onFullscreenOpen??d.onFullscreenOpen,onFullscreenClose:e.onFullscreenClose??d.onFullscreenClose,onZoomIn:e.onZoomIn??d.onZoomIn,onZoomOut:e.onZoomOut??d.onZoomOut,onDragStart:e.onDragStart??d.onDragStart,onDragEnd:e.onDragEnd??d.onDragEnd}),A=(e,t,i)=>e.getAttribute(t)||e.getAttribute(`data-${t}`)||i,X=(e,t,i)=>{if(!(e.hasAttribute(t)||e.hasAttribute(`data-${t}`)))return i;const n=A(e,t,null);return n!=="false"&&n!=="0"},Mt=(e,t)=>A(e,t,null)==="false",Li=(e=1)=>{const t=Math.round(window.devicePixelRatio||1);return parseInt(e)*t},Ti=(e,t,i)=>new URL(e).origin.includes("cloudimg")?e:`https://${t}.cloudimg.io/${i}${e}`,Yi=({ciTransformation:e,responsiveWidth:t,ciFilters:i})=>{const o=`width=${t}`,n=e||o,s=i?`&f=${i}`:"";return`${n}${s}`},yt=(e,t)=>{const{folder:i,apiVersion:o,filename:n="",ciParams:s}=e,{ciToken:l,ciFilters:r,ciTransformation:a}=s||{},c=`${i}${n}`;if(!l)return c;const h=bi.includes(o)?null:o,u=h?`${h}/`:"",f=Li(t),p=Ti(c,l,u),x=Yi({ciTransformation:a,responsiveWidth:f,ciFilters:r});return`${p}${x?"?":""}${x}`},Xi=(e,t,i)=>{const[o,n]=e.split("?"),s=`${t}=${encodeURIComponent(i)}`;if(!n)return`${o}?${s}`;const l=new URLSearchParams(n);return l.set(t,i),`${o}?${l.toString()}`},Pi=(e,t)=>Xi(e,"width",t),be=(e,t=0)=>(e+="",e.length>=t?e:new Array(t-e.length+1).join("0")+e),Ri=(e,{amount:t=0,indexZeroBase:i=0}={})=>Array.from({length:t},(o,n)=>e.replace("{index}",be(n+1,i))),Mi=({imagesUrls:e,onFirstImageLoad:t,onImageLoad:i,onAllImagesLoad:o,onError:n,autoplayReverse:s})=>{let l=0,r=0;const a=e.length,c=[],h=[],u=(m,y,I=!1)=>{const w={message:`Failed to load image: ${m}`,url:m,index:y,isFirstImage:I};h.push(w),r++,n==null||n({error:w,errorCount:r,totalImages:a,errors:h})},f=()=>{l===a&&(o==null||o(c,{errorCount:r,errors:h}))},p=(m,y)=>{const I=new Image;I.crossOrigin="anonymous",I.src=m,I.onload=async()=>{try{const w=await createImageBitmap(I),C={src:m,bitmapImage:w,naturalWidth:I.naturalWidth,naturalHeight:I.naturalHeight};l++,c[y]=C,i==null||i(C,y),f()}catch{l++,u(m,y),f()}},I.onerror=()=>{l++,u(m,y),f()}},x=new Image,g=s?e.length-1:0,v=e[g];x.crossOrigin="anonymous",x.src=v,x.onload=async()=>{try{const m=await createImageBitmap(x),y={src:v,bitmapImage:m,naturalWidth:x.naturalWidth,naturalHeight:x.naturalHeight};c[g]=y,l++,t==null||t(y),i==null||i(y,g);for(let I=0;I<e.length;I++)I!==g&&p(e[I],I);f()}catch{l++,u(v,g,!0);for(let y=0;y<e.length;y++)y!==g&&p(e[y],y);f()}},x.onerror=()=>{l++,u(v,g,!0);for(let m=0;m<e.length;m++)m!==g&&p(e[m],m);f()}},ye=({cdnPathX:e,cdnPathY:t,configX:i,configY:o,onFirstImageLoad:n,onImageLoad:s,onAllImagesLoad:l,onError:r})=>{let a={x:!1,y:!1},c=[],h=[],u={errorCount:0,errors:[]},f={errorCount:0,errors:[]};const p=e||i.imageList.length,x=t||o.imageList.length,g=()=>{if(a.x&&a.y){const m={errorCount:u.errorCount+f.errorCount,errors:[...u.errors,...f.errors]};l==null||l(c,h,m)}},v=({cdnPath:m,config:y,orientation:I,loadedImages:w,loadStats:C,onFirstImageLoad:b})=>{const k=I===Y.X,E=y.imageList.length?y.imageList:Ri(m,y);Mi({imagesUrls:E,onFirstImageLoad:b,onImageLoad:(O,S)=>{s==null||s(O,S,I),w[S]=O},onError:O=>{r==null||r({...O,orientation:I})},onAllImagesLoad:(O,S)=>{w.length=0,O.forEach((L,M)=>{L&&(w[M]=L)}),C.errorCount=S.errorCount,C.errors=S.errors.map(L=>({...L,orientation:I})),a[k?"x":"y"]=!0,g()},autoplayReverse:y.autoplayReverse})};p?v({cdnPath:e,config:i,orientation:Y.X,loadedImages:c,loadStats:u,onFirstImageLoad:n}):a.x=!0,x?v({cdnPath:t,config:o,orientation:Y.Y,loadedImages:h,loadStats:f,onFirstImageLoad:p?void 0:n}):a.y=!0,!p&&!x&&g()},Hi=`
403
3
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1052 156" aria-hidden="true">
404
4
  <path fill="currentColor" d="M409.9,145.6c-42.7-1.7-85.5-4.4-128.1-8.4c-21.3-2-42.6-4.3-63.8-7.1c-21.2-2.8-42.4-5.9-63.4-9.7c-21.1-3.8-42-8.2-62.7-13.7c-10.3-2.8-20.6-5.8-30.7-9.4c-10.1-3.5-20.1-7.6-29.5-12.7c-4.7-2.6-9.3-5.4-13.5-8.8c-2.1-1.7-4-3.6-5.8-5.6c-1.8-2-3.3-4.3-4.3-6.8c-1.1-2.5-1.6-5.3-1.4-8c0.2-2.7,1.1-5.4,2.4-7.7c2.7-4.8,6.7-8.5,11-11.7c8.6-6.4,18.4-10.9,28.3-15c9.9-4,20.1-7.3,30.4-10.3c-10.2,3.1-20.4,6.5-30.3,10.5c-9.8,4.1-19.6,8.7-28.1,15.1c-4.2,3.2-8.2,6.9-10.7,11.6c-1.2,2.3-2.1,4.8-2.3,7.5c-0.1,2.6,0.4,5.2,1.4,7.6c2.1,4.8,5.9,8.7,10,12.1c4.1,3.3,8.7,6.1,13.4,8.6c9.4,5,19.4,8.9,29.4,12.4c10.1,3.5,20.4,6.4,30.7,9.1c20.7,5.3,41.6,9.5,62.7,13.2c21,3.6,42.2,6.6,63.4,9.2c21.2,2.6,42.5,4.8,63.7,6.6c42.6,3.7,85.2,6,127.9,7.4L409.9,145.6z"/>
405
5
  <path fill="currentColor" d="M977.1,11.6c13.8,4.1,27.4,8.8,40.4,15.2c6.4,3.2,12.7,6.9,18.3,11.5c2.7,2.4,5.3,5,7.3,8c2,3,3.3,6.6,3.3,10.3c0,3.7-1.4,7.2-3.3,10.3c-2,3.1-4.5,5.7-7.3,8.1c-2.7,2.4-5.7,4.4-8.8,6.3c-1.6,0.9-3.1,1.9-4.7,2.7l-2.4,1.3l-2.4,1.2C1004.5,93,990.8,97.8,977,102c-6.9,2.1-13.8,4-20.8,5.8c-7,1.8-14,3.5-21,5c-14.1,3.1-28.2,5.9-42.4,8.3c-28.4,4.9-57,8.8-85.6,12c-57.3,6.4-114.8,10.2-172.4,12.2c-57.6,2-115.2,2.3-172.9,0.8l0.1-4c57.5,1.8,115.1,1.9,172.6,0.2c57.5-1.7,115-5.2,172.3-11.2c28.6-3.1,57.2-6.7,85.6-11.5c14.2-2.4,28.3-5,42.4-8.1c7-1.5,14-3.1,21-4.9c7-1.7,13.9-3.6,20.8-5.7c13.8-4.1,27.4-8.8,40.3-15.2l2.4-1.2l2.4-1.3c1.6-0.8,3.1-1.8,4.7-2.7c3-1.9,6-3.9,8.7-6.2c2.7-2.3,5.2-4.9,7.2-7.9c1.9-3,3.2-6.4,3.3-10c0-3.6-1.2-7-3.1-10c-1.9-3-4.4-5.6-7.1-8c-5.5-4.7-11.7-8.3-18.1-11.6C1004.5,20.6,990.8,15.8,977.1,11.6z"/>
@@ -410,10 +10,7 @@ const de = /* @__PURE__ */ ei(bi), M = {
410
10
  <path fill="currentColor" d="M10.9,9.7c0-1.1-0.8-2-2.5-2.5c1.3-0.5,1.9-1.3,1.9-2.3c0-1.7-1.7-2.8-4.6-2.8c-1.5,0-2.7,0.3-3.6,0.8v1.7c0.9-0.4,2.3-0.7,3.4-0.7C7,3.9,8,4.4,8,5.1c0,0.8-0.7,1.3-2.4,1.3H4.3v1.6h1.3c2,0,2.9,0.8,2.9,1.6c0,0.8-1,1.5-2.8,1.5c-1.5,0-2.8-0.3-3.7-0.6v1.7c0.9,0.3,2.1,0.6,3.8,0.6C9.2,12.8,10.9,11.4,10.9,9.7"/>
411
11
  </g>
412
12
  </svg>
413
- `, Wi = (e) => {
414
- const t = document.createElement("div");
415
- return t.innerHTML = Bi, t.style.bottom = `${e}%`, t.className = "cloudimage-360-view-360-circle", t;
416
- }, Fi = `
13
+ `,Di=e=>{const t=document.createElement("div");return t.innerHTML=Hi,t.style.bottom=`${e}%`,t.className="cloudimage-360-view-360-circle",t},Zi=`
417
14
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
418
15
  <!-- Circular arrows -->
419
16
  <path d="M 75 50 A 25 25 0 1 1 50 25" stroke="currentColor" stroke-width="3"/>
@@ -424,2277 +21,15 @@ const de = /* @__PURE__ */ ei(bi), M = {
424
21
  <!-- 360 text -->
425
22
  <text x="50" y="54" text-anchor="middle" font-size="16" font-weight="600" fill="currentColor" stroke="none" font-family="system-ui, -apple-system, sans-serif">360°</text>
426
23
  </svg>
427
- `, Ni = (e) => {
428
- const t = document.createElement("div");
429
- return t.className = "cloudimage-initial-icon", t.setAttribute("aria-label", "360 degree view - drag to rotate"), e ? (t.style.backgroundImage = `url('${e}')`, t.style.backgroundPosition = "50% 50%", t.style.backgroundSize = "contain", t.style.backgroundRepeat = "no-repeat") : t.innerHTML = Fi, t;
430
- }, Vi = (e, t) => {
431
- const { width: i, height: n } = t, o = document.createElement("canvas");
432
- return o.width = i, o.height = n, o.style.width = "100%", o.style.height = "auto", e.appendChild(o), o;
433
- }, ji = () => {
434
- const e = document.createElement("button");
435
- return e.className = "cloudimage-360-button cloudimage-360-close-icon", e.setAttribute("aria-label", "Close fullscreen"), e.setAttribute("type", "button"), e.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>', e;
436
- }, $i = () => {
437
- const e = document.createElement("button");
438
- return e.className = "cloudimage-360-button cloudimage-360-fullscreen-button", e.setAttribute("aria-label", "View fullscreen"), e.setAttribute("type", "button"), e.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" x2="14" y1="3" y2="10"/><line x1="3" x2="10" y1="21" y2="14"/></svg>', e;
439
- }, ge = (e) => {
440
- const t = document.createElement("div");
441
- return t.className = "cloudimage-360-icons-container", e.appendChild(t), t;
442
- }, Gi = (e) => {
443
- const t = document.createElement("div");
444
- return t.className = "cloudimage-360-inner-box", t.setAttribute("role", "img"), t.setAttribute("aria-label", "360 degree product view. Use mouse drag or arrow keys to rotate."), e.appendChild(t), t;
445
- }, zi = () => {
446
- const e = document.createElement("button");
447
- return e.className = "cloudimage-360-button cloudimage-360-magnifier-button", e.setAttribute("aria-label", "Magnify image"), e.setAttribute("type", "button"), e.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/><path d="M11 8v6"/><path d="M8 11h6"/></svg>', e;
448
- }, Ui = (e) => {
449
- const t = document.createElement("div");
450
- t.className = "cloudimage-initial-icon";
451
- const i = document.createElement("span");
452
- return i.className = "percentage", i.innerText = "0%", t.appendChild(i), e.appendChild(t), t;
453
- }, _i = (e) => {
454
- const t = document.createElement("div");
455
- t.className = "cloudimage-360-fullscreen-modal";
456
- const i = e.cloneNode();
457
- return i.style.width = "100%", i.style.maxWidth = "100%", i.style.height = "100vh", i.style.maxHeight = "100%", t.appendChild(i), window.document.body.appendChild(t), i;
458
- }, Jt = (e, t) => {
459
- const i = e.querySelector(t);
460
- i && i.parentNode.removeChild(i);
461
- }, Ki = () => {
462
- const e = document.createElement("div");
463
- return e.className = "cloudimage-loading-spinner", e;
464
- }, Ji = () => {
465
- const e = document.createElement("div");
466
- return e.className = "cloudimage-360-transition-overlay", e;
467
- }, Qi = (e) => {
468
- const t = document.createElement("div");
469
- return t.className = "cloudimage-360-hotspot-container", e.appendChild(t), t;
470
- }, qi = (e) => {
471
- const t = document.createElement("div");
472
- return t.className = "cloudimage-360-sr-only", t.setAttribute("role", "status"), t.setAttribute("aria-live", "polite"), t.setAttribute("aria-atomic", "true"), e.appendChild(t), t;
473
- }, tn = (e, t) => {
474
- e && (e.textContent = "", setTimeout(() => {
475
- e.textContent = t;
476
- }, 50));
477
- }, We = {
478
- drag: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"/><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/></svg>',
479
- swipe: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m18 16 4-4-4-4"/><path d="m6 8-4 4 4 4"/><path d="M8 12h8"/></svg>',
480
- click: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 9 5 12 1.8-5.2L21 14Z"/><path d="M7.2 2.2 8 5.1"/><path d="m5.1 8-2.9-.8"/><path d="M14 4.1 12 6"/><path d="m6 12-1.9 2"/></svg>',
481
- pinch: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l4 4"/><path d="M18 6l-4 4"/><path d="M6 18l4-4"/><path d="M18 18l-4-4"/><circle cx="12" cy="12" r="2"/></svg>',
482
- keys: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="20" height="16" x="2" y="4" rx="2"/><path d="m9 10 3 3 3-3"/></svg>',
483
- fullscreen: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" x2="14" y1="3" y2="10"/><line x1="3" x2="10" y1="21" y2="14"/></svg>'
484
- }, en = {
485
- drag: "Drag to rotate",
486
- swipe: "Swipe to rotate",
487
- click: "Click to zoom",
488
- pinch: "Pinch to zoom",
489
- keys: "Use arrow keys",
490
- fullscreen: "Click for fullscreen"
491
- }, nn = (e) => {
492
- const t = document.createElement("div");
493
- return t.className = "cloudimage-360-hint-item", t.innerHTML = `
494
- ${We[e]}
495
- <span>${en[e]}</span>
496
- `, t;
497
- }, ye = (e, t = []) => {
498
- if (!t || t.length === 0) return null;
499
- const i = document.createElement("div");
500
- i.className = "cloudimage-360-hints-overlay", i.setAttribute("role", "tooltip"), i.setAttribute("aria-label", "Interaction hints");
501
- const n = document.createElement("div");
502
- return n.className = "cloudimage-360-hints-container", t.forEach((o) => {
503
- We[o] && n.appendChild(nn(o));
504
- }), i.appendChild(n), e.appendChild(i), i;
505
- }, be = (e, t) => t ? ["swipe"] : ["drag", "click"], we = (e) => {
506
- e && e.classList.add("visible");
507
- }, on = (e) => {
508
- e && (e.classList.remove("visible"), e.classList.add("hiding"), setTimeout(() => {
509
- e.classList.remove("hiding");
510
- }, 300));
511
- }, sn = (e) => {
512
- if (!e || typeof e != "object") return null;
513
- const t = Object.keys(e).map((n) => parseInt(n, 10)).filter((n) => !isNaN(n)).sort((n, o) => n - o);
514
- if (t.length === 0) return null;
515
- const i = Math.floor(t.length / 2);
516
- return t[i];
517
- }, rn = (e) => {
518
- const t = [];
519
- return !e || !Array.isArray(e) || e.forEach((i, n) => {
520
- const o = sn(i.positions);
521
- o !== null && t.push({
522
- id: i.id || `hotspot-${n}`,
523
- frame: o,
524
- label: i.label || null
525
- });
526
- }), t;
527
- }, an = 400, ln = (e, t, i, n) => {
528
- const o = document.createElement("button");
529
- o.className = "cloudimage-360-hotspot-timeline-dot", o.setAttribute("type", "button"), o.setAttribute("aria-label", n || `Go to hotspot at frame ${t + 1}`), o.setAttribute("data-frame", t.toString()), o.setAttribute("data-hotspot-id", e);
530
- const s = i > 1 ? t / (i - 1) * 100 : 0;
531
- if (o.style.left = `${s}%`, n) {
532
- const l = document.createElement("span");
533
- l.className = "cloudimage-360-hotspot-timeline-tooltip", l.textContent = n, o.appendChild(l);
534
- let r = null;
535
- o.addEventListener("mouseenter", () => {
536
- r = setTimeout(() => {
537
- l.classList.add("visible");
538
- }, an);
539
- }), o.addEventListener("mouseleave", () => {
540
- r && (clearTimeout(r), r = null), l.classList.remove("visible");
541
- }), o.addEventListener("click", () => {
542
- r && (clearTimeout(r), r = null), l.classList.remove("visible");
543
- });
544
- }
545
- return o;
546
- }, cn = (e, t, i) => {
547
- const n = rn(i);
548
- if (n.length === 0) return null;
549
- const o = document.createElement("div");
550
- o.className = "cloudimage-360-hotspot-timeline", o.setAttribute("role", "navigation"), o.setAttribute("aria-label", "Hotspot timeline navigation");
551
- const s = document.createElement("div");
552
- s.className = "cloudimage-360-hotspot-timeline-track";
553
- const l = document.createElement("div");
554
- return l.className = "cloudimage-360-hotspot-timeline-indicator", n.forEach(({ id: r, frame: a, label: c }) => {
555
- const h = ln(r, a, t, c);
556
- s.appendChild(h);
557
- }), s.appendChild(l), o.appendChild(s), e.appendChild(o), {
558
- element: o,
559
- indicator: l,
560
- hotspotFrames: n
561
- };
562
- }, hn = (e, t, i) => {
563
- if (!e) return;
564
- const n = i > 1 ? t / (i - 1) * 100 : 0;
565
- e.style.left = `${n}%`;
566
- }, dn = (e) => {
567
- e && e.classList.add("visible");
568
- }, un = (e) => {
569
- e && e.classList.remove("visible");
570
- }, Qt = (e, t = []) => {
571
- if (!e) return t;
572
- try {
573
- return JSON.parse(e);
574
- } catch (i) {
575
- return console.warn("CloudImage 360: Failed to parse JSON:", i.message), t;
576
- }
577
- }, pn = (e, t) => {
578
- const [i, n] = e.split("?");
579
- if (!n) return e;
580
- const o = new RegExp(`^${t}=|&${t}=`), s = n.split("&").filter((l) => !o.test(l)).join("&");
581
- return s ? `${i}?${s}` : i;
582
- }, fn = (e) => {
583
- const t = pn(e, "width"), i = t.includes("?") ? "&" : "?";
584
- return `${t}${i}width=${150 * devicePixelRatio}`;
585
- }, mn = (e) => {
586
- const t = {
587
- root: null,
588
- rootMargin: "0px",
589
- threshold: 0.1
590
- }, i = (o) => {
591
- const s = o.getAttribute("data-src");
592
- s && (o.src = s);
593
- };
594
- new IntersectionObserver((o, s) => {
595
- o.forEach((l) => {
596
- l.isIntersecting && (i(l.target), s.unobserve(l.target));
597
- });
598
- }, t).observe(e);
599
- }, vn = (e, t) => {
600
- const i = Be(1, t);
601
- return e.replace("{index}", i);
602
- }, gn = (e, t) => {
603
- const [i] = e, n = /(https?):\/\//i.test(i);
604
- return Ot({
605
- ...t,
606
- folder: n ? "" : t.folder,
607
- filename: i
608
- });
609
- }, yn = (e, t) => {
610
- const { imageList: i, indexZeroBase: n } = t;
611
- if (i.length) {
612
- const o = Qt(i, null);
613
- if (o)
614
- return gn(o, t);
615
- }
616
- return vn(e, n);
617
- }, Ie = (e, t, i) => {
618
- const n = new Image();
619
- return n.setAttribute(t ? "data-src" : "src", e), n.className = i, n.style.cssText = `
620
- position: ${t ? "absolute" : "static"};
24
+ `,Bi=e=>{const t=document.createElement("div");return t.className="cloudimage-initial-icon",t.setAttribute("aria-label","360 degree view - drag to rotate"),e?(t.style.backgroundImage=`url('${e}')`,t.style.backgroundPosition="50% 50%",t.style.backgroundSize="contain",t.style.backgroundRepeat="no-repeat"):t.innerHTML=Zi,t},Wi=(e,t)=>{const{width:i,height:o}=t,n=document.createElement("canvas");return n.width=i,n.height=o,n.style.width="100%",n.style.height="auto",e.appendChild(n),n},Fi=()=>{const e=document.createElement("button");return e.className="cloudimage-360-button cloudimage-360-close-icon",e.setAttribute("aria-label","Close fullscreen"),e.setAttribute("type","button"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',e},zi=()=>{const e=document.createElement("button");return e.className="cloudimage-360-button cloudimage-360-fullscreen-button",e.setAttribute("aria-label","View fullscreen"),e.setAttribute("type","button"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" x2="14" y1="3" y2="10"/><line x1="3" x2="10" y1="21" y2="14"/></svg>',e},we=e=>{const t=document.createElement("div");return t.className="cloudimage-360-icons-container",e.appendChild(t),t},Ni=e=>{const t=document.createElement("div");return t.className="cloudimage-360-inner-box",t.setAttribute("role","img"),t.setAttribute("aria-label","360 degree product view. Use mouse drag or arrow keys to rotate."),e.appendChild(t),t},Vi=()=>{const e=document.createElement("button");return e.className="cloudimage-360-button cloudimage-360-magnifier-button",e.setAttribute("aria-label","Magnify image"),e.setAttribute("type","button"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/><path d="M11 8v6"/><path d="M8 11h6"/></svg>',e},ji=e=>{const t=document.createElement("div");t.className="cloudimage-initial-icon";const i=document.createElement("span");return i.className="percentage",i.innerText="0%",t.appendChild(i),e.appendChild(t),t},$i=e=>{const t=document.createElement("div");t.className="cloudimage-360-fullscreen-modal";const i=e.cloneNode();return i.style.width="100%",i.style.maxWidth="100%",i.style.height="100vh",i.style.maxHeight="100%",t.appendChild(i),window.document.body.appendChild(t),i},$t=(e,t)=>{const i=e.querySelector(t);i&&i.parentNode.removeChild(i)},Gi=()=>{const e=document.createElement("div");return e.className="cloudimage-loading-spinner",e},Ui=()=>{const e=document.createElement("div");return e.className="cloudimage-360-transition-overlay",e},_i=e=>{const t=document.createElement("div");return t.className="cloudimage-360-hotspot-container",e.appendChild(t),t},Ki=e=>{const t=document.createElement("div");return t.className="cloudimage-360-sr-only",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),e.appendChild(t),t},Ji=(e,t)=>{e&&(e.textContent="",setTimeout(()=>{e.textContent=t},50))},xe={drag:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"/><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/></svg>',swipe:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m18 16 4-4-4-4"/><path d="m6 8-4 4 4 4"/><path d="M8 12h8"/></svg>',click:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 9 5 12 1.8-5.2L21 14Z"/><path d="M7.2 2.2 8 5.1"/><path d="m5.1 8-2.9-.8"/><path d="M14 4.1 12 6"/><path d="m6 12-1.9 2"/></svg>',pinch:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l4 4"/><path d="M18 6l-4 4"/><path d="M6 18l4-4"/><path d="M18 18l-4-4"/><circle cx="12" cy="12" r="2"/></svg>',keys:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="20" height="16" x="2" y="4" rx="2"/><path d="m9 10 3 3 3-3"/></svg>',fullscreen:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" x2="14" y1="3" y2="10"/><line x1="3" x2="10" y1="21" y2="14"/></svg>'},Qi={drag:"Drag to rotate",swipe:"Swipe to rotate",click:"Click to zoom",pinch:"Pinch to zoom",keys:"Use arrow keys",fullscreen:"Click for fullscreen"},qi=e=>{const t=document.createElement("div");return t.className="cloudimage-360-hint-item",t.innerHTML=`
25
+ ${xe[e]}
26
+ <span>${Qi[e]}</span>
27
+ `,t},Ie=(e,t=[])=>{if(!t||t.length===0)return null;const i=document.createElement("div");i.className="cloudimage-360-hints-overlay",i.setAttribute("role","tooltip"),i.setAttribute("aria-label","Interaction hints");const o=document.createElement("div");return o.className="cloudimage-360-hints-container",t.forEach(n=>{xe[n]&&o.appendChild(qi(n))}),i.appendChild(o),e.appendChild(i),i},Ce=(e,t)=>t?["swipe"]:["drag","click"],ke=e=>{e&&e.classList.add("visible")},to=e=>{e&&(e.classList.remove("visible"),e.classList.add("hiding"),setTimeout(()=>{e.classList.remove("hiding")},300))},eo=e=>{if(!e||typeof e!="object")return null;const t=Object.keys(e).map(o=>parseInt(o,10)).filter(o=>!isNaN(o)).sort((o,n)=>o-n);if(t.length===0)return null;const i=Math.floor(t.length/2);return t[i]},io=e=>{const t=[];return!e||!Array.isArray(e)||e.forEach((i,o)=>{const n=eo(i.positions);n!==null&&t.push({id:i.id||`hotspot-${o}`,frame:n,label:i.label||null})}),t},oo=400,no=(e,t,i,o)=>{const n=document.createElement("button");n.className="cloudimage-360-hotspot-timeline-dot",n.setAttribute("type","button"),n.setAttribute("aria-label",o||`Go to hotspot at frame ${t+1}`),n.setAttribute("data-frame",t.toString()),n.setAttribute("data-hotspot-id",e);const s=i>1?t/(i-1)*100:0;if(n.style.left=`${s}%`,o){const l=document.createElement("span");l.className="cloudimage-360-hotspot-timeline-tooltip",l.textContent=o,n.appendChild(l);let r=null;n.addEventListener("mouseenter",()=>{r=setTimeout(()=>{l.classList.add("visible")},oo)}),n.addEventListener("mouseleave",()=>{r&&(clearTimeout(r),r=null),l.classList.remove("visible")}),n.addEventListener("click",()=>{r&&(clearTimeout(r),r=null),l.classList.remove("visible")})}return n},so=(e,t,i)=>{const o=io(i);if(o.length===0)return null;const n=document.createElement("div");n.className="cloudimage-360-hotspot-timeline",n.setAttribute("role","navigation"),n.setAttribute("aria-label","Hotspot timeline navigation");const s=document.createElement("div");s.className="cloudimage-360-hotspot-timeline-track";const l=document.createElement("div");return l.className="cloudimage-360-hotspot-timeline-indicator",o.forEach(({id:r,frame:a,label:c})=>{const h=no(r,a,t,c);s.appendChild(h)}),s.appendChild(l),n.appendChild(s),e.appendChild(n),{element:n,indicator:l,hotspotFrames:o}},ro=(e,t,i)=>{if(!e)return;const o=i>1?t/(i-1)*100:0;e.style.left=`${o}%`},ao=e=>{e&&e.classList.add("visible")},lo=e=>{e&&e.classList.remove("visible")},Gt=(e,t=[])=>{if(!e)return t;try{return JSON.parse(e)}catch(i){return console.warn("CloudImage 360: Failed to parse JSON:",i.message),t}},co=(e,t)=>{const[i,o]=e.split("?");if(!o)return e;const n=new RegExp(`^${t}=|&${t}=`),s=o.split("&").filter(l=>!n.test(l)).join("&");return s?`${i}?${s}`:i},ho=e=>{const t=co(e,"width"),i=t.includes("?")?"&":"?";return`${t}${i}width=${150*devicePixelRatio}`},po=e=>{const t={root:null,rootMargin:"0px",threshold:.1},i=n=>{const s=n.getAttribute("data-src");s&&(n.src=s)};new IntersectionObserver((n,s)=>{n.forEach(l=>{l.isIntersecting&&(i(l.target),s.unobserve(l.target))})},t).observe(e)},uo=(e,t)=>{const i=be(1,t);return e.replace("{index}",i)},fo=(e,t)=>{const[i]=e,o=/(https?):\/\//i.test(i);return yt({...t,folder:o?"":t.folder,filename:i})},mo=(e,t)=>{const{imageList:i,indexZeroBase:o}=t;if(i.length){const n=Gt(i,null);if(n)return fo(n,t)}return uo(e,o)},Oe=(e,t,i)=>{const o=new Image;return o.setAttribute(t?"data-src":"src",e),o.className=i,o.style.cssText=`
28
+ position: ${t?"absolute":"static"};
621
29
  width: 100%;
622
30
  inset: 0;
623
31
  height: 100%;
624
32
  object-fit: contain;
625
33
  object-position: center;
626
34
  filter: blur(10px);
627
- `, n;
628
- }, xe = (e, t, i) => {
629
- const { innerBox: n, imageList: o, lazyload: s } = t || {}, [l] = o, r = l || yn(e, t), a = fn(r), c = Ie(a, s, "cloudimage-lazy"), h = Ie(a, !1, "cloudimage-360-placeholder"), p = (f) => {
630
- Jt(n, ".cloudimage-lazy"), i && i({
631
- event: f,
632
- width: c.width,
633
- height: c.height,
634
- naturalWidth: c.naturalWidth,
635
- naturalHeight: c.naturalHeight,
636
- src: a
637
- });
638
- };
639
- c.onload = p, n.appendChild(c), n.appendChild(h), mn(c);
640
- }, bn = (e, t, i) => {
641
- const n = new Image();
642
- n.src = e, n.onload = (o) => {
643
- t && t({
644
- event: o,
645
- width: n.width,
646
- height: n.height,
647
- naturalWidth: n.naturalWidth,
648
- naturalHeight: n.naturalHeight,
649
- src: e
650
- });
651
- }, n.onerror = (o) => {
652
- const s = new Error(`Failed to load image: ${e}`);
653
- s.url = e, s.event = o, i ? i(s) : console.error(s.message);
654
- };
655
- }, wn = (e, t) => {
656
- const i = t.getBoundingClientRect(), n = e.touches ? e.touches[0].clientX : e.clientX, o = e.touches ? e.touches[0].clientY : e.clientY;
657
- return {
658
- x: n - i.left,
659
- y: o - i.top
660
- };
661
- }, Kt = (e, t, i) => {
662
- const { container: n, w: o, h: s, zoom: l, bw: r, offsetX: a, offsetY: c } = t, h = wn(e, n);
663
- let p = h.x, f = h.y;
664
- p = Math.max(o / l, Math.min(p, n.offsetWidth - o / l)), f = Math.max(s / l, Math.min(f, n.offsetHeight - s / l)), i.style.left = `${p - o}px`, i.style.top = `${f - s}px`;
665
- const u = (p - a) * l - o + r, I = (f - c) * l - s + r;
666
- i.style.backgroundPosition = `-${u}px -${I}px`;
667
- }, In = (e, t, i, n, o, s) => {
668
- const { x: l = 0, y: r = 0 } = i || {}, a = (t.offsetWidth - l * 2) * s, c = (t.offsetHeight - r * 2) * s;
669
- if (!o) return;
670
- o.setAttribute("class", "cloudimage-360-img-magnifier-glass"), t.prepend(o), o.style.backgroundImage = `url('${n.src}')`, o.style.backgroundSize = `${a}px ${c}px`;
671
- const h = 3, p = o.offsetWidth / 2, f = o.offsetHeight / 2, u = {
672
- container: t,
673
- w: p,
674
- h: f,
675
- zoom: s,
676
- bw: h,
677
- offsetX: l,
678
- offsetY: r
679
- };
680
- Kt(e, u, o);
681
- const I = (v) => {
682
- Kt(v, u, o);
683
- }, g = (v) => {
684
- v.preventDefault(), Kt(v, u, o);
685
- };
686
- o.addEventListener("mousemove", I), t.addEventListener("mousemove", I), t.addEventListener("touchmove", g);
687
- }, xn = (e, t, i) => {
688
- const { clientX: n, clientY: o } = e, s = t.getBoundingClientRect(), l = t.width / (s.width * i), r = t.height / (s.height * i), a = (n - s.left) * l, c = (o - s.top) * r;
689
- return { offsetX: a, offsetY: c };
690
- }, Ce = (e, { bottom: t, top: i }) => {
691
- e ? t() : i();
692
- }, Oe = (e, { left: t, right: i }) => {
693
- e ? t() : i();
694
- }, Cn = ({ autoplayBehavior: e, spinY: t, reversed: i, loopTriggers: n }) => {
695
- switch (e) {
696
- case M.SPIN_XY:
697
- case M.SPIN_YX:
698
- t ? Ce(i, n) : Oe(i, n);
699
- break;
700
- case M.SPIN_Y:
701
- Ce(i, n);
702
- break;
703
- case M.SPIN_X:
704
- default:
705
- Oe(i, n);
706
- }
707
- }, On = ({
708
- autoplayBehavior: e,
709
- activeImageX: t,
710
- activeImageY: i,
711
- amountX: n,
712
- amountY: o,
713
- autoplayReverse: s
714
- }) => {
715
- const l = (r, a) => {
716
- const c = a - 1;
717
- return s ? r === 0 : r === c;
718
- };
719
- switch (e) {
720
- case M.SPIN_XY:
721
- case M.SPIN_Y:
722
- return l(i, o);
723
- case M.SPIN_X:
724
- case M.SPIN_YX:
725
- default:
726
- return l(t, n);
727
- }
728
- }, En = ({
729
- autoplayBehavior: e,
730
- activeImageX: t,
731
- activeImageY: i,
732
- amountX: n,
733
- amountY: o,
734
- autoplayReverse: s,
735
- spinDirection: l
736
- }) => {
737
- const r = t === (s ? 0 : n - 1), a = i === (s ? 0 : o - 1);
738
- return e === M.SPIN_XY || e === M.SPIN_YX ? l === "x" && r || l === "y" && a : !1;
739
- }, Sn = (e, t, i) => {
740
- if (!i) return "x";
741
- if (!t) return "y";
742
- switch (e) {
743
- case M.SPIN_XY:
744
- return "x";
745
- case M.SPIN_YX:
746
- return "y";
747
- case M.SPIN_Y:
748
- return "y";
749
- case M.SPIN_X:
750
- default:
751
- return "x";
752
- }
753
- }, An = (e) => e === "x" ? "y" : "x", Ee = (e, t) => {
754
- const i = [...Ii];
755
- return t ? [...i, ...xi].includes(e) : i.includes(e);
756
- }, Se = ({ deltaX: e, deltaY: t, reversed: i, allowSpinX: n, allowSpinY: o, threshold: s = 0 }) => {
757
- const l = n && !o || o && !n ? 0 : s, r = Math.abs(e), a = Math.abs(t);
758
- return n && r - l > a ? i ? e > 0 ? "left" : "right" : e > 0 ? "right" : "left" : o && a - l > r ? i ? t > 0 ? "up" : "down" : t > 0 ? "down" : "up" : null;
759
- }, Ln = () => "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0, kn = (e, t = 150) => {
760
- let i;
761
- return function(...n) {
762
- clearTimeout(i), i = setTimeout(() => {
763
- e.apply(this, n);
764
- }, t);
765
- };
766
- }, Fe = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IHY9KHQsYSxlKT0+e2NvbnN0IHM9dC9lLG49YS9lO3JldHVybnt6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpufX0sej0oe3BvaW50ZXJYOnQscG9pbnRlclk6YSxpbWFnZURhdGE6ZSx6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpuLGRyYXdXaWR0aDppLGRyYXdIZWlnaHQ6Y30pPT57Y29uc3R7bmF0dXJhbFdpZHRoOmcsbmF0dXJhbEhlaWdodDp1fT1lO2xldCBmPXQvaSpnLXMvMixtPWEvYyp1LW4vMjtjb25zdCB4PU1hdGgubWF4KDAsZy1zKSxPPU1hdGgubWF4KDAsdS1uKTtyZXR1cm4gZj1NYXRoLm1heCgwLE1hdGgubWluKGYseCkpLG09TWF0aC5tYXgoMCxNYXRoLm1pbihtLE8pKSx7em9vbU9mZnNldFg6Zix6b29tT2Zmc2V0WTptfX07bGV0IG8saCxyLGQsbCx3O3NlbGYub25tZXNzYWdlPWFzeW5jIHQ9Pntjb25zdHthY3Rpb246YSxvZmZzY3JlZW46ZSxkZXZpY2VQaXhlbFJhdGlvOnMsaW1hZ2VEYXRhOm4sem9vbVNjYWxlOmkscG9pbnRlclg6Yyxwb2ludGVyWTpnLGltYWdlQXNwZWN0UmF0aW86dSxjb250YWluZXJXaWR0aDpmLGNvbnRhaW5lckhlaWdodDptfT10LmRhdGE7c3dpdGNoKGEpe2Nhc2UiaW5pdENhbnZhcyI6QyhlLHMpO2JyZWFrO2Nhc2UiYWRhcHRDYW52YXNTaXplIjpwKHUsZixtKTticmVhaztjYXNlImRyYXdJbWFnZU9uQ2FudmFzIjpJKG4saSxjLGcpO2JyZWFrfX07Y29uc3QgQz0odCxhKT0+e289dCxoPW8uZ2V0Q29udGV4dCgiMmQiKSxyPWF9LHA9KHQsYSxlKT0+e2NvbnN0IHM9YS9lO3c9dD5zLG8ud2lkdGg9YSpyLG8uaGVpZ2h0PWUqcixoLnNjYWxlKHIsciksdz8oZD1hLGw9YS90KToobD1lLGQ9ZSp0KSxoLmltYWdlU21vb3RoaW5nRW5hYmxlZD0hMCxoLmltYWdlU21vb3RoaW5nUXVhbGl0eT0iaGlnaCJ9LEk9KHQ9e30sYT0xLGU9MCxzPTApPT57Y29uc3R7Yml0bWFwSW1hZ2U6bn09dDtpZighb3x8IW4pcmV0dXJuO2xldCBpLGM7aWYodz8oaT0wLGM9KG8uaGVpZ2h0L3ItbCkvMik6KGk9KG8ud2lkdGgvci1kKS8yLGM9MCksaC5jbGVhclJlY3QoMCwwLG8ud2lkdGgsby5oZWlnaHQpLGEhPT0xKXtjb25zdHtuYXR1cmFsV2lkdGg6ZyxuYXR1cmFsSGVpZ2h0OnV9PXQse3pvb21lZFdpZHRoOmYsem9vbWVkSGVpZ2h0Om19PXYoZyx1LGEpLHt6b29tT2Zmc2V0WDp4LHpvb21PZmZzZXRZOk99PXooe3BvaW50ZXJYOmUscG9pbnRlclk6cyxpbWFnZURhdGE6dCx6b29tZWRXaWR0aDpmLHpvb21lZEhlaWdodDptLGRyYXdXaWR0aDpkLGRyYXdIZWlnaHQ6bH0pO2guZHJhd0ltYWdlKG4seCxPLGYsbSxpLGMsZCxsKX1lbHNlIGguZHJhd0ltYWdlKG4saSxjLGQsbCl9fSkoKTsK", Tn = (e) => Uint8Array.from(atob(e), (t) => t.charCodeAt(0)), Ae = typeof self < "u" && self.Blob && new Blob([Tn(Fe)], { type: "text/javascript;charset=utf-8" });
767
- function Yn(e) {
768
- let t;
769
- try {
770
- if (t = Ae && (self.URL || self.webkitURL).createObjectURL(Ae), !t) throw "";
771
- const i = new Worker(t, {
772
- name: e == null ? void 0 : e.name
773
- });
774
- return i.addEventListener("error", () => {
775
- (self.URL || self.webkitURL).revokeObjectURL(t);
776
- }), i;
777
- } catch {
778
- return new Worker(
779
- "data:text/javascript;base64," + Fe,
780
- {
781
- name: e == null ? void 0 : e.name
782
- }
783
- );
784
- } finally {
785
- t && (self.URL || self.webkitURL).revokeObjectURL(t);
786
- }
787
- }
788
- const Xn = /* @__PURE__ */ new Set([
789
- // Basic HTML
790
- "p",
791
- "span",
792
- "div",
793
- "br",
794
- "hr",
795
- "strong",
796
- "em",
797
- "b",
798
- "i",
799
- "u",
800
- "s",
801
- "h1",
802
- "h2",
803
- "h3",
804
- "h4",
805
- "h5",
806
- "h6",
807
- "ul",
808
- "ol",
809
- "li",
810
- "a",
811
- "img",
812
- "button",
813
- "table",
814
- "thead",
815
- "tbody",
816
- "tr",
817
- "th",
818
- "td",
819
- "blockquote",
820
- "pre",
821
- "code",
822
- "label",
823
- "input",
824
- "select",
825
- "option",
826
- "textarea",
827
- // SVG elements
828
- "svg",
829
- "path",
830
- "circle",
831
- "rect",
832
- "line",
833
- "polyline",
834
- "polygon",
835
- "ellipse",
836
- "g",
837
- "text",
838
- "tspan",
839
- "defs",
840
- "use",
841
- "symbol",
842
- "clippath",
843
- "mask",
844
- "lineargradient",
845
- "radialgradient",
846
- "stop"
847
- ]), Le = {
848
- a: ["href", "title", "target", "rel"],
849
- img: ["src", "alt", "title", "width", "height"],
850
- button: ["type", "disabled", "name", "value"],
851
- input: ["type", "name", "value", "placeholder", "disabled", "readonly", "checked", "min", "max", "step"],
852
- select: ["name", "disabled", "multiple"],
853
- option: ["value", "disabled", "selected"],
854
- textarea: ["name", "placeholder", "disabled", "readonly", "rows", "cols"],
855
- label: ["for"],
856
- // SVG attributes
857
- svg: ["viewbox", "width", "height", "fill", "stroke", "xmlns", "preserveaspectratio"],
858
- path: ["d", "fill", "stroke", "stroke-width", "stroke-linecap", "stroke-linejoin", "transform"],
859
- circle: ["cx", "cy", "r", "fill", "stroke", "stroke-width"],
860
- rect: ["x", "y", "width", "height", "rx", "ry", "fill", "stroke", "stroke-width"],
861
- line: ["x1", "y1", "x2", "y2", "stroke", "stroke-width"],
862
- polyline: ["points", "fill", "stroke", "stroke-width"],
863
- polygon: ["points", "fill", "stroke", "stroke-width"],
864
- ellipse: ["cx", "cy", "rx", "ry", "fill", "stroke", "stroke-width"],
865
- g: ["transform", "fill", "stroke"],
866
- text: ["x", "y", "dx", "dy", "text-anchor", "fill", "font-size", "font-family", "font-weight"],
867
- tspan: ["x", "y", "dx", "dy"],
868
- use: ["href", "xlink:href", "x", "y", "width", "height"],
869
- lineargradient: ["id", "x1", "y1", "x2", "y2", "gradientunits"],
870
- radialgradient: ["id", "cx", "cy", "r", "fx", "fy", "gradientunits"],
871
- stop: ["offset", "stop-color", "stop-opacity"],
872
- clippath: ["id"],
873
- mask: ["id"],
874
- "*": ["class", "id", "style"]
875
- }, Pn = [
876
- /javascript:/gi,
877
- /vbscript:/gi,
878
- /data:/gi,
879
- /on\w+\s*=/gi
880
- ], Rn = (e) => {
881
- if (typeof e != "string")
882
- return "";
883
- const t = document.createElement("template");
884
- t.innerHTML = e;
885
- const i = (n) => {
886
- if (Array.from(n.childNodes).forEach(i), n.nodeType === Node.ELEMENT_NODE) {
887
- const s = n.tagName.toLowerCase();
888
- if (!Xn.has(s)) {
889
- if (s === "script" || s === "style") {
890
- n.remove();
891
- return;
892
- }
893
- const a = document.createTextNode(n.textContent);
894
- n.parentNode.replaceChild(a, n);
895
- return;
896
- }
897
- const l = [
898
- ...Le[s] || [],
899
- ...Le["*"] || []
900
- ];
901
- if (Array.from(n.attributes).forEach((a) => {
902
- const c = a.name.toLowerCase();
903
- if (c.startsWith("on")) {
904
- n.removeAttribute(a.name);
905
- return;
906
- }
907
- if (!l.includes(c)) {
908
- n.removeAttribute(a.name);
909
- return;
910
- }
911
- let h = a.value;
912
- Pn.forEach((p) => {
913
- p.test(h) && n.removeAttribute(a.name);
914
- });
915
- }), s === "a") {
916
- const a = n.getAttribute("href");
917
- a && (/^(https?:|mailto:|tel:|#|\/)/i.test(a.trim()) || n.removeAttribute("href")), n.getAttribute("target") === "_blank" && n.setAttribute("rel", "noopener noreferrer");
918
- }
919
- if (s === "img") {
920
- const a = n.getAttribute("src");
921
- a && (/^(https?:|\/|data:image\/)/i.test(a.trim()) || n.removeAttribute("src"));
922
- }
923
- }
924
- };
925
- return i(t.content), t.innerHTML;
926
- }, Mn = (e) => e === "x" ? P.X : P.Y, Hn = (e, t, i) => e.filter(
927
- (n) => Mn(n.orientation) === i && t in n.positions
928
- ), Dn = (e, t) => {
929
- const i = document.createElement("button");
930
- return i.id = e, i.className = "cloudimage-360-hotspot", i.dataset.hotspotId = e, i.setAttribute("type", "button"), i.setAttribute("aria-label", t || `Hotspot ${e}`), i.setAttribute("aria-haspopup", "true"), i.setAttribute("aria-expanded", "false"), i;
931
- }, Zn = (e) => {
932
- const t = Object.entries(e).sort(([s], [l]) => Number(s) - Number(l));
933
- let i = null, n = null;
934
- const o = {};
935
- for (const [s, l] of t)
936
- if (!l)
937
- o[s] = { x: i, y: n };
938
- else {
939
- const { x: r, y: a } = l;
940
- r != null && (i = r), a != null && (n = a), o[s] = {
941
- x: r || i,
942
- y: a || n
943
- };
944
- }
945
- return o;
946
- }, Bn = (e) => [
947
- {
948
- name: "offset",
949
- options: {
950
- offset: [0, 10]
951
- }
952
- },
953
- {
954
- name: "preventOverflow",
955
- options: {
956
- boundary: e
957
- }
958
- }
959
- ], Wn = (e, t) => {
960
- const i = document.createElement("div");
961
- return i.className = "cloudimage-360-popper", i.id = `cloudimage-360-popper-${t}`, i.dataset.popperId = t, i.setAttribute("role", "tooltip"), i.setAttribute("aria-hidden", "false"), typeof e == "string" && /<\/?[a-z][\s\S]*>/i.test(e) ? i.innerHTML = Rn(e) : i.textContent = e, document.body.appendChild(i), i;
962
- }, Fn = (e) => {
963
- const t = [...e];
964
- return t.forEach((i, n) => {
965
- const o = { ...Zn(i.positions) };
966
- t[n].initialPositions = o, t[n].positions = o;
967
- }), t;
968
- }, Nn = ({
969
- newWidth: e,
970
- newHeight: t,
971
- initialContainerSize: i,
972
- imageAspectRatio: n,
973
- hotspotsConfig: o
974
- }) => {
975
- const [s, l] = i;
976
- let r = e, a = t, c = 0, h = 0;
977
- const p = e / t;
978
- n > p ? (a = e / n, h = (t - a) / 2) : (r = t * n, c = (e - r) / 2);
979
- const u = r / s, I = a / l;
980
- return o.map((g) => {
981
- const v = {};
982
- return Object.entries(g.initialPositions).forEach(([m, b]) => {
983
- v[m] = {
984
- x: b.x * u + c,
985
- y: b.y * I + h
986
- };
987
- }), { ...g, positions: v };
988
- });
989
- };
990
- var H = "top", F = "bottom", N = "right", D = "left", ee = "auto", kt = [H, F, N, D], ut = "start", At = "end", Vn = "clippingParents", Ne = "viewport", Ct = "popper", jn = "reference", ke = /* @__PURE__ */ kt.reduce(function(e, t) {
991
- return e.concat([t + "-" + ut, t + "-" + At]);
992
- }, []), Ve = /* @__PURE__ */ [].concat(kt, [ee]).reduce(function(e, t) {
993
- return e.concat([t, t + "-" + ut, t + "-" + At]);
994
- }, []), $n = "beforeRead", Gn = "read", zn = "afterRead", Un = "beforeMain", _n = "main", Kn = "afterMain", Jn = "beforeWrite", Qn = "write", qn = "afterWrite", to = [$n, Gn, zn, Un, _n, Kn, Jn, Qn, qn];
995
- function $(e) {
996
- return e ? (e.nodeName || "").toLowerCase() : null;
997
- }
998
- function B(e) {
999
- if (e == null)
1000
- return window;
1001
- if (e.toString() !== "[object Window]") {
1002
- var t = e.ownerDocument;
1003
- return t && t.defaultView || window;
1004
- }
1005
- return e;
1006
- }
1007
- function st(e) {
1008
- var t = B(e).Element;
1009
- return e instanceof t || e instanceof Element;
1010
- }
1011
- function W(e) {
1012
- var t = B(e).HTMLElement;
1013
- return e instanceof t || e instanceof HTMLElement;
1014
- }
1015
- function ie(e) {
1016
- if (typeof ShadowRoot > "u")
1017
- return !1;
1018
- var t = B(e).ShadowRoot;
1019
- return e instanceof t || e instanceof ShadowRoot;
1020
- }
1021
- function eo(e) {
1022
- var t = e.state;
1023
- Object.keys(t.elements).forEach(function(i) {
1024
- var n = t.styles[i] || {}, o = t.attributes[i] || {}, s = t.elements[i];
1025
- !W(s) || !$(s) || (Object.assign(s.style, n), Object.keys(o).forEach(function(l) {
1026
- var r = o[l];
1027
- r === !1 ? s.removeAttribute(l) : s.setAttribute(l, r === !0 ? "" : r);
1028
- }));
1029
- });
1030
- }
1031
- function io(e) {
1032
- var t = e.state, i = {
1033
- popper: {
1034
- position: t.options.strategy,
1035
- left: "0",
1036
- top: "0",
1037
- margin: "0"
1038
- },
1039
- arrow: {
1040
- position: "absolute"
1041
- },
1042
- reference: {}
1043
- };
1044
- return Object.assign(t.elements.popper.style, i.popper), t.styles = i, t.elements.arrow && Object.assign(t.elements.arrow.style, i.arrow), function() {
1045
- Object.keys(t.elements).forEach(function(n) {
1046
- var o = t.elements[n], s = t.attributes[n] || {}, l = Object.keys(t.styles.hasOwnProperty(n) ? t.styles[n] : i[n]), r = l.reduce(function(a, c) {
1047
- return a[c] = "", a;
1048
- }, {});
1049
- !W(o) || !$(o) || (Object.assign(o.style, r), Object.keys(s).forEach(function(a) {
1050
- o.removeAttribute(a);
1051
- }));
1052
- });
1053
- };
1054
- }
1055
- const no = {
1056
- name: "applyStyles",
1057
- enabled: !0,
1058
- phase: "write",
1059
- fn: eo,
1060
- effect: io,
1061
- requires: ["computeStyles"]
1062
- };
1063
- function j(e) {
1064
- return e.split("-")[0];
1065
- }
1066
- var ot = Math.max, Wt = Math.min, pt = Math.round;
1067
- function qt() {
1068
- var e = navigator.userAgentData;
1069
- return e != null && e.brands && Array.isArray(e.brands) ? e.brands.map(function(t) {
1070
- return t.brand + "/" + t.version;
1071
- }).join(" ") : navigator.userAgent;
1072
- }
1073
- function je() {
1074
- return !/^((?!chrome|android).)*safari/i.test(qt());
1075
- }
1076
- function ft(e, t, i) {
1077
- t === void 0 && (t = !1), i === void 0 && (i = !1);
1078
- var n = e.getBoundingClientRect(), o = 1, s = 1;
1079
- t && W(e) && (o = e.offsetWidth > 0 && pt(n.width) / e.offsetWidth || 1, s = e.offsetHeight > 0 && pt(n.height) / e.offsetHeight || 1);
1080
- var l = st(e) ? B(e) : window, r = l.visualViewport, a = !je() && i, c = (n.left + (a && r ? r.offsetLeft : 0)) / o, h = (n.top + (a && r ? r.offsetTop : 0)) / s, p = n.width / o, f = n.height / s;
1081
- return {
1082
- width: p,
1083
- height: f,
1084
- top: h,
1085
- right: c + p,
1086
- bottom: h + f,
1087
- left: c,
1088
- x: c,
1089
- y: h
1090
- };
1091
- }
1092
- function ne(e) {
1093
- var t = ft(e), i = e.offsetWidth, n = e.offsetHeight;
1094
- return Math.abs(t.width - i) <= 1 && (i = t.width), Math.abs(t.height - n) <= 1 && (n = t.height), {
1095
- x: e.offsetLeft,
1096
- y: e.offsetTop,
1097
- width: i,
1098
- height: n
1099
- };
1100
- }
1101
- function $e(e, t) {
1102
- var i = t.getRootNode && t.getRootNode();
1103
- if (e.contains(t))
1104
- return !0;
1105
- if (i && ie(i)) {
1106
- var n = t;
1107
- do {
1108
- if (n && e.isSameNode(n))
1109
- return !0;
1110
- n = n.parentNode || n.host;
1111
- } while (n);
1112
- }
1113
- return !1;
1114
- }
1115
- function J(e) {
1116
- return B(e).getComputedStyle(e);
1117
- }
1118
- function oo(e) {
1119
- return ["table", "td", "th"].indexOf($(e)) >= 0;
1120
- }
1121
- function q(e) {
1122
- return ((st(e) ? e.ownerDocument : (
1123
- // $FlowFixMe[prop-missing]
1124
- e.document
1125
- )) || window.document).documentElement;
1126
- }
1127
- function Nt(e) {
1128
- return $(e) === "html" ? e : (
1129
- // this is a quicker (but less type safe) way to save quite some bytes from the bundle
1130
- // $FlowFixMe[incompatible-return]
1131
- // $FlowFixMe[prop-missing]
1132
- e.assignedSlot || // step into the shadow DOM of the parent of a slotted node
1133
- e.parentNode || // DOM Element detected
1134
- (ie(e) ? e.host : null) || // ShadowRoot detected
1135
- // $FlowFixMe[incompatible-call]: HTMLElement is a Node
1136
- q(e)
1137
- );
1138
- }
1139
- function Te(e) {
1140
- return !W(e) || // https://github.com/popperjs/popper-core/issues/837
1141
- J(e).position === "fixed" ? null : e.offsetParent;
1142
- }
1143
- function so(e) {
1144
- var t = /firefox/i.test(qt()), i = /Trident/i.test(qt());
1145
- if (i && W(e)) {
1146
- var n = J(e);
1147
- if (n.position === "fixed")
1148
- return null;
1149
- }
1150
- var o = Nt(e);
1151
- for (ie(o) && (o = o.host); W(o) && ["html", "body"].indexOf($(o)) < 0; ) {
1152
- var s = J(o);
1153
- if (s.transform !== "none" || s.perspective !== "none" || s.contain === "paint" || ["transform", "perspective"].indexOf(s.willChange) !== -1 || t && s.willChange === "filter" || t && s.filter && s.filter !== "none")
1154
- return o;
1155
- o = o.parentNode;
1156
- }
1157
- return null;
1158
- }
1159
- function Tt(e) {
1160
- for (var t = B(e), i = Te(e); i && oo(i) && J(i).position === "static"; )
1161
- i = Te(i);
1162
- return i && ($(i) === "html" || $(i) === "body" && J(i).position === "static") ? t : i || so(e) || t;
1163
- }
1164
- function oe(e) {
1165
- return ["top", "bottom"].indexOf(e) >= 0 ? "x" : "y";
1166
- }
1167
- function Et(e, t, i) {
1168
- return ot(e, Wt(t, i));
1169
- }
1170
- function ro(e, t, i) {
1171
- var n = Et(e, t, i);
1172
- return n > i ? i : n;
1173
- }
1174
- function Ge() {
1175
- return {
1176
- top: 0,
1177
- right: 0,
1178
- bottom: 0,
1179
- left: 0
1180
- };
1181
- }
1182
- function ze(e) {
1183
- return Object.assign({}, Ge(), e);
1184
- }
1185
- function Ue(e, t) {
1186
- return t.reduce(function(i, n) {
1187
- return i[n] = e, i;
1188
- }, {});
1189
- }
1190
- var ao = function(t, i) {
1191
- return t = typeof t == "function" ? t(Object.assign({}, i.rects, {
1192
- placement: i.placement
1193
- })) : t, ze(typeof t != "number" ? t : Ue(t, kt));
1194
- };
1195
- function lo(e) {
1196
- var t, i = e.state, n = e.name, o = e.options, s = i.elements.arrow, l = i.modifiersData.popperOffsets, r = j(i.placement), a = oe(r), c = [D, N].indexOf(r) >= 0, h = c ? "height" : "width";
1197
- if (!(!s || !l)) {
1198
- var p = ao(o.padding, i), f = ne(s), u = a === "y" ? H : D, I = a === "y" ? F : N, g = i.rects.reference[h] + i.rects.reference[a] - l[a] - i.rects.popper[h], v = l[a] - i.rects.reference[a], m = Tt(s), b = m ? a === "y" ? m.clientHeight || 0 : m.clientWidth || 0 : 0, x = g / 2 - v / 2, w = p[u], C = b - f[h] - p[I], y = b / 2 - f[h] / 2 + x, O = Et(w, y, C), S = a;
1199
- i.modifiersData[n] = (t = {}, t[S] = O, t.centerOffset = O - y, t);
1200
- }
1201
- }
1202
- function co(e) {
1203
- var t = e.state, i = e.options, n = i.element, o = n === void 0 ? "[data-popper-arrow]" : n;
1204
- o != null && (typeof o == "string" && (o = t.elements.popper.querySelector(o), !o) || $e(t.elements.popper, o) && (t.elements.arrow = o));
1205
- }
1206
- const ho = {
1207
- name: "arrow",
1208
- enabled: !0,
1209
- phase: "main",
1210
- fn: lo,
1211
- effect: co,
1212
- requires: ["popperOffsets"],
1213
- requiresIfExists: ["preventOverflow"]
1214
- };
1215
- function mt(e) {
1216
- return e.split("-")[1];
1217
- }
1218
- var uo = {
1219
- top: "auto",
1220
- right: "auto",
1221
- bottom: "auto",
1222
- left: "auto"
1223
- };
1224
- function po(e, t) {
1225
- var i = e.x, n = e.y, o = t.devicePixelRatio || 1;
1226
- return {
1227
- x: pt(i * o) / o || 0,
1228
- y: pt(n * o) / o || 0
1229
- };
1230
- }
1231
- function Ye(e) {
1232
- var t, i = e.popper, n = e.popperRect, o = e.placement, s = e.variation, l = e.offsets, r = e.position, a = e.gpuAcceleration, c = e.adaptive, h = e.roundOffsets, p = e.isFixed, f = l.x, u = f === void 0 ? 0 : f, I = l.y, g = I === void 0 ? 0 : I, v = typeof h == "function" ? h({
1233
- x: u,
1234
- y: g
1235
- }) : {
1236
- x: u,
1237
- y: g
1238
- };
1239
- u = v.x, g = v.y;
1240
- var m = l.hasOwnProperty("x"), b = l.hasOwnProperty("y"), x = D, w = H, C = window;
1241
- if (c) {
1242
- var y = Tt(i), O = "clientHeight", S = "clientWidth";
1243
- if (y === B(i) && (y = q(i), J(y).position !== "static" && r === "absolute" && (O = "scrollHeight", S = "scrollWidth")), y = y, o === H || (o === D || o === N) && s === At) {
1244
- w = F;
1245
- var E = p && y === C && C.visualViewport ? C.visualViewport.height : (
1246
- // $FlowFixMe[prop-missing]
1247
- y[O]
1248
- );
1249
- g -= E - n.height, g *= a ? 1 : -1;
1250
- }
1251
- if (o === D || (o === H || o === F) && s === At) {
1252
- x = N;
1253
- var A = p && y === C && C.visualViewport ? C.visualViewport.width : (
1254
- // $FlowFixMe[prop-missing]
1255
- y[S]
1256
- );
1257
- u -= A - n.width, u *= a ? 1 : -1;
1258
- }
1259
- }
1260
- var L = Object.assign({
1261
- position: r
1262
- }, c && uo), R = h === !0 ? po({
1263
- x: u,
1264
- y: g
1265
- }, B(i)) : {
1266
- x: u,
1267
- y: g
1268
- };
1269
- if (u = R.x, g = R.y, a) {
1270
- var T;
1271
- return Object.assign({}, L, (T = {}, T[w] = b ? "0" : "", T[x] = m ? "0" : "", T.transform = (C.devicePixelRatio || 1) <= 1 ? "translate(" + u + "px, " + g + "px)" : "translate3d(" + u + "px, " + g + "px, 0)", T));
1272
- }
1273
- return Object.assign({}, L, (t = {}, t[w] = b ? g + "px" : "", t[x] = m ? u + "px" : "", t.transform = "", t));
1274
- }
1275
- function fo(e) {
1276
- var t = e.state, i = e.options, n = i.gpuAcceleration, o = n === void 0 ? !0 : n, s = i.adaptive, l = s === void 0 ? !0 : s, r = i.roundOffsets, a = r === void 0 ? !0 : r, c = {
1277
- placement: j(t.placement),
1278
- variation: mt(t.placement),
1279
- popper: t.elements.popper,
1280
- popperRect: t.rects.popper,
1281
- gpuAcceleration: o,
1282
- isFixed: t.options.strategy === "fixed"
1283
- };
1284
- t.modifiersData.popperOffsets != null && (t.styles.popper = Object.assign({}, t.styles.popper, Ye(Object.assign({}, c, {
1285
- offsets: t.modifiersData.popperOffsets,
1286
- position: t.options.strategy,
1287
- adaptive: l,
1288
- roundOffsets: a
1289
- })))), t.modifiersData.arrow != null && (t.styles.arrow = Object.assign({}, t.styles.arrow, Ye(Object.assign({}, c, {
1290
- offsets: t.modifiersData.arrow,
1291
- position: "absolute",
1292
- adaptive: !1,
1293
- roundOffsets: a
1294
- })))), t.attributes.popper = Object.assign({}, t.attributes.popper, {
1295
- "data-popper-placement": t.placement
1296
- });
1297
- }
1298
- const mo = {
1299
- name: "computeStyles",
1300
- enabled: !0,
1301
- phase: "beforeWrite",
1302
- fn: fo,
1303
- data: {}
1304
- };
1305
- var Dt = {
1306
- passive: !0
1307
- };
1308
- function vo(e) {
1309
- var t = e.state, i = e.instance, n = e.options, o = n.scroll, s = o === void 0 ? !0 : o, l = n.resize, r = l === void 0 ? !0 : l, a = B(t.elements.popper), c = [].concat(t.scrollParents.reference, t.scrollParents.popper);
1310
- return s && c.forEach(function(h) {
1311
- h.addEventListener("scroll", i.update, Dt);
1312
- }), r && a.addEventListener("resize", i.update, Dt), function() {
1313
- s && c.forEach(function(h) {
1314
- h.removeEventListener("scroll", i.update, Dt);
1315
- }), r && a.removeEventListener("resize", i.update, Dt);
1316
- };
1317
- }
1318
- const go = {
1319
- name: "eventListeners",
1320
- enabled: !0,
1321
- phase: "write",
1322
- fn: function() {
1323
- },
1324
- effect: vo,
1325
- data: {}
1326
- };
1327
- var yo = {
1328
- left: "right",
1329
- right: "left",
1330
- bottom: "top",
1331
- top: "bottom"
1332
- };
1333
- function Zt(e) {
1334
- return e.replace(/left|right|bottom|top/g, function(t) {
1335
- return yo[t];
1336
- });
1337
- }
1338
- var bo = {
1339
- start: "end",
1340
- end: "start"
1341
- };
1342
- function Xe(e) {
1343
- return e.replace(/start|end/g, function(t) {
1344
- return bo[t];
1345
- });
1346
- }
1347
- function se(e) {
1348
- var t = B(e), i = t.pageXOffset, n = t.pageYOffset;
1349
- return {
1350
- scrollLeft: i,
1351
- scrollTop: n
1352
- };
1353
- }
1354
- function re(e) {
1355
- return ft(q(e)).left + se(e).scrollLeft;
1356
- }
1357
- function wo(e, t) {
1358
- var i = B(e), n = q(e), o = i.visualViewport, s = n.clientWidth, l = n.clientHeight, r = 0, a = 0;
1359
- if (o) {
1360
- s = o.width, l = o.height;
1361
- var c = je();
1362
- (c || !c && t === "fixed") && (r = o.offsetLeft, a = o.offsetTop);
1363
- }
1364
- return {
1365
- width: s,
1366
- height: l,
1367
- x: r + re(e),
1368
- y: a
1369
- };
1370
- }
1371
- function Io(e) {
1372
- var t, i = q(e), n = se(e), o = (t = e.ownerDocument) == null ? void 0 : t.body, s = ot(i.scrollWidth, i.clientWidth, o ? o.scrollWidth : 0, o ? o.clientWidth : 0), l = ot(i.scrollHeight, i.clientHeight, o ? o.scrollHeight : 0, o ? o.clientHeight : 0), r = -n.scrollLeft + re(e), a = -n.scrollTop;
1373
- return J(o || i).direction === "rtl" && (r += ot(i.clientWidth, o ? o.clientWidth : 0) - s), {
1374
- width: s,
1375
- height: l,
1376
- x: r,
1377
- y: a
1378
- };
1379
- }
1380
- function ae(e) {
1381
- var t = J(e), i = t.overflow, n = t.overflowX, o = t.overflowY;
1382
- return /auto|scroll|overlay|hidden/.test(i + o + n);
1383
- }
1384
- function _e(e) {
1385
- return ["html", "body", "#document"].indexOf($(e)) >= 0 ? e.ownerDocument.body : W(e) && ae(e) ? e : _e(Nt(e));
1386
- }
1387
- function St(e, t) {
1388
- var i;
1389
- t === void 0 && (t = []);
1390
- var n = _e(e), o = n === ((i = e.ownerDocument) == null ? void 0 : i.body), s = B(n), l = o ? [s].concat(s.visualViewport || [], ae(n) ? n : []) : n, r = t.concat(l);
1391
- return o ? r : (
1392
- // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
1393
- r.concat(St(Nt(l)))
1394
- );
1395
- }
1396
- function te(e) {
1397
- return Object.assign({}, e, {
1398
- left: e.x,
1399
- top: e.y,
1400
- right: e.x + e.width,
1401
- bottom: e.y + e.height
1402
- });
1403
- }
1404
- function xo(e, t) {
1405
- var i = ft(e, !1, t === "fixed");
1406
- return i.top = i.top + e.clientTop, i.left = i.left + e.clientLeft, i.bottom = i.top + e.clientHeight, i.right = i.left + e.clientWidth, i.width = e.clientWidth, i.height = e.clientHeight, i.x = i.left, i.y = i.top, i;
1407
- }
1408
- function Pe(e, t, i) {
1409
- return t === Ne ? te(wo(e, i)) : st(t) ? xo(t, i) : te(Io(q(e)));
1410
- }
1411
- function Co(e) {
1412
- var t = St(Nt(e)), i = ["absolute", "fixed"].indexOf(J(e).position) >= 0, n = i && W(e) ? Tt(e) : e;
1413
- return st(n) ? t.filter(function(o) {
1414
- return st(o) && $e(o, n) && $(o) !== "body";
1415
- }) : [];
1416
- }
1417
- function Oo(e, t, i, n) {
1418
- var o = t === "clippingParents" ? Co(e) : [].concat(t), s = [].concat(o, [i]), l = s[0], r = s.reduce(function(a, c) {
1419
- var h = Pe(e, c, n);
1420
- return a.top = ot(h.top, a.top), a.right = Wt(h.right, a.right), a.bottom = Wt(h.bottom, a.bottom), a.left = ot(h.left, a.left), a;
1421
- }, Pe(e, l, n));
1422
- return r.width = r.right - r.left, r.height = r.bottom - r.top, r.x = r.left, r.y = r.top, r;
1423
- }
1424
- function Ke(e) {
1425
- var t = e.reference, i = e.element, n = e.placement, o = n ? j(n) : null, s = n ? mt(n) : null, l = t.x + t.width / 2 - i.width / 2, r = t.y + t.height / 2 - i.height / 2, a;
1426
- switch (o) {
1427
- case H:
1428
- a = {
1429
- x: l,
1430
- y: t.y - i.height
1431
- };
1432
- break;
1433
- case F:
1434
- a = {
1435
- x: l,
1436
- y: t.y + t.height
1437
- };
1438
- break;
1439
- case N:
1440
- a = {
1441
- x: t.x + t.width,
1442
- y: r
1443
- };
1444
- break;
1445
- case D:
1446
- a = {
1447
- x: t.x - i.width,
1448
- y: r
1449
- };
1450
- break;
1451
- default:
1452
- a = {
1453
- x: t.x,
1454
- y: t.y
1455
- };
1456
- }
1457
- var c = o ? oe(o) : null;
1458
- if (c != null) {
1459
- var h = c === "y" ? "height" : "width";
1460
- switch (s) {
1461
- case ut:
1462
- a[c] = a[c] - (t[h] / 2 - i[h] / 2);
1463
- break;
1464
- case At:
1465
- a[c] = a[c] + (t[h] / 2 - i[h] / 2);
1466
- break;
1467
- }
1468
- }
1469
- return a;
1470
- }
1471
- function Lt(e, t) {
1472
- t === void 0 && (t = {});
1473
- var i = t, n = i.placement, o = n === void 0 ? e.placement : n, s = i.strategy, l = s === void 0 ? e.strategy : s, r = i.boundary, a = r === void 0 ? Vn : r, c = i.rootBoundary, h = c === void 0 ? Ne : c, p = i.elementContext, f = p === void 0 ? Ct : p, u = i.altBoundary, I = u === void 0 ? !1 : u, g = i.padding, v = g === void 0 ? 0 : g, m = ze(typeof v != "number" ? v : Ue(v, kt)), b = f === Ct ? jn : Ct, x = e.rects.popper, w = e.elements[I ? b : f], C = Oo(st(w) ? w : w.contextElement || q(e.elements.popper), a, h, l), y = ft(e.elements.reference), O = Ke({
1474
- reference: y,
1475
- element: x,
1476
- placement: o
1477
- }), S = te(Object.assign({}, x, O)), E = f === Ct ? S : y, A = {
1478
- top: C.top - E.top + m.top,
1479
- bottom: E.bottom - C.bottom + m.bottom,
1480
- left: C.left - E.left + m.left,
1481
- right: E.right - C.right + m.right
1482
- }, L = e.modifiersData.offset;
1483
- if (f === Ct && L) {
1484
- var R = L[o];
1485
- Object.keys(A).forEach(function(T) {
1486
- var G = [N, F].indexOf(T) >= 0 ? 1 : -1, z = [H, F].indexOf(T) >= 0 ? "y" : "x";
1487
- A[T] += R[z] * G;
1488
- });
1489
- }
1490
- return A;
1491
- }
1492
- function Eo(e, t) {
1493
- t === void 0 && (t = {});
1494
- var i = t, n = i.placement, o = i.boundary, s = i.rootBoundary, l = i.padding, r = i.flipVariations, a = i.allowedAutoPlacements, c = a === void 0 ? Ve : a, h = mt(n), p = h ? r ? ke : ke.filter(function(I) {
1495
- return mt(I) === h;
1496
- }) : kt, f = p.filter(function(I) {
1497
- return c.indexOf(I) >= 0;
1498
- });
1499
- f.length === 0 && (f = p);
1500
- var u = f.reduce(function(I, g) {
1501
- return I[g] = Lt(e, {
1502
- placement: g,
1503
- boundary: o,
1504
- rootBoundary: s,
1505
- padding: l
1506
- })[j(g)], I;
1507
- }, {});
1508
- return Object.keys(u).sort(function(I, g) {
1509
- return u[I] - u[g];
1510
- });
1511
- }
1512
- function So(e) {
1513
- if (j(e) === ee)
1514
- return [];
1515
- var t = Zt(e);
1516
- return [Xe(e), t, Xe(t)];
1517
- }
1518
- function Ao(e) {
1519
- var t = e.state, i = e.options, n = e.name;
1520
- if (!t.modifiersData[n]._skip) {
1521
- for (var o = i.mainAxis, s = o === void 0 ? !0 : o, l = i.altAxis, r = l === void 0 ? !0 : l, a = i.fallbackPlacements, c = i.padding, h = i.boundary, p = i.rootBoundary, f = i.altBoundary, u = i.flipVariations, I = u === void 0 ? !0 : u, g = i.allowedAutoPlacements, v = t.options.placement, m = j(v), b = m === v, x = a || (b || !I ? [Zt(v)] : So(v)), w = [v].concat(x).reduce(function(Q, V) {
1522
- return Q.concat(j(V) === ee ? Eo(t, {
1523
- placement: V,
1524
- boundary: h,
1525
- rootBoundary: p,
1526
- padding: c,
1527
- flipVariations: I,
1528
- allowedAutoPlacements: g
1529
- }) : V);
1530
- }, []), C = t.rects.reference, y = t.rects.popper, O = /* @__PURE__ */ new Map(), S = !0, E = w[0], A = 0; A < w.length; A++) {
1531
- var L = w[A], R = j(L), T = mt(L) === ut, G = [H, F].indexOf(R) >= 0, z = G ? "width" : "height", Y = Lt(t, {
1532
- placement: L,
1533
- boundary: h,
1534
- rootBoundary: p,
1535
- altBoundary: f,
1536
- padding: c
1537
- }), Z = G ? T ? N : D : T ? F : H;
1538
- C[z] > y[z] && (Z = Zt(Z));
1539
- var rt = Zt(Z), U = [];
1540
- if (s && U.push(Y[R] <= 0), r && U.push(Y[Z] <= 0, Y[rt] <= 0), U.every(function(Q) {
1541
- return Q;
1542
- })) {
1543
- E = L, S = !1;
1544
- break;
1545
- }
1546
- O.set(L, U);
1547
- }
1548
- if (S)
1549
- for (var at = I ? 3 : 1, vt = function(V) {
1550
- var et = w.find(function(it) {
1551
- var _ = O.get(it);
1552
- if (_)
1553
- return _.slice(0, V).every(function(gt) {
1554
- return gt;
1555
- });
1556
- });
1557
- if (et)
1558
- return E = et, "break";
1559
- }, tt = at; tt > 0; tt--) {
1560
- var lt = vt(tt);
1561
- if (lt === "break") break;
1562
- }
1563
- t.placement !== E && (t.modifiersData[n]._skip = !0, t.placement = E, t.reset = !0);
1564
- }
1565
- }
1566
- const Lo = {
1567
- name: "flip",
1568
- enabled: !0,
1569
- phase: "main",
1570
- fn: Ao,
1571
- requiresIfExists: ["offset"],
1572
- data: {
1573
- _skip: !1
1574
- }
1575
- };
1576
- function Re(e, t, i) {
1577
- return i === void 0 && (i = {
1578
- x: 0,
1579
- y: 0
1580
- }), {
1581
- top: e.top - t.height - i.y,
1582
- right: e.right - t.width + i.x,
1583
- bottom: e.bottom - t.height + i.y,
1584
- left: e.left - t.width - i.x
1585
- };
1586
- }
1587
- function Me(e) {
1588
- return [H, N, F, D].some(function(t) {
1589
- return e[t] >= 0;
1590
- });
1591
- }
1592
- function ko(e) {
1593
- var t = e.state, i = e.name, n = t.rects.reference, o = t.rects.popper, s = t.modifiersData.preventOverflow, l = Lt(t, {
1594
- elementContext: "reference"
1595
- }), r = Lt(t, {
1596
- altBoundary: !0
1597
- }), a = Re(l, n), c = Re(r, o, s), h = Me(a), p = Me(c);
1598
- t.modifiersData[i] = {
1599
- referenceClippingOffsets: a,
1600
- popperEscapeOffsets: c,
1601
- isReferenceHidden: h,
1602
- hasPopperEscaped: p
1603
- }, t.attributes.popper = Object.assign({}, t.attributes.popper, {
1604
- "data-popper-reference-hidden": h,
1605
- "data-popper-escaped": p
1606
- });
1607
- }
1608
- const To = {
1609
- name: "hide",
1610
- enabled: !0,
1611
- phase: "main",
1612
- requiresIfExists: ["preventOverflow"],
1613
- fn: ko
1614
- };
1615
- function Yo(e, t, i) {
1616
- var n = j(e), o = [D, H].indexOf(n) >= 0 ? -1 : 1, s = typeof i == "function" ? i(Object.assign({}, t, {
1617
- placement: e
1618
- })) : i, l = s[0], r = s[1];
1619
- return l = l || 0, r = (r || 0) * o, [D, N].indexOf(n) >= 0 ? {
1620
- x: r,
1621
- y: l
1622
- } : {
1623
- x: l,
1624
- y: r
1625
- };
1626
- }
1627
- function Xo(e) {
1628
- var t = e.state, i = e.options, n = e.name, o = i.offset, s = o === void 0 ? [0, 0] : o, l = Ve.reduce(function(h, p) {
1629
- return h[p] = Yo(p, t.rects, s), h;
1630
- }, {}), r = l[t.placement], a = r.x, c = r.y;
1631
- t.modifiersData.popperOffsets != null && (t.modifiersData.popperOffsets.x += a, t.modifiersData.popperOffsets.y += c), t.modifiersData[n] = l;
1632
- }
1633
- const Po = {
1634
- name: "offset",
1635
- enabled: !0,
1636
- phase: "main",
1637
- requires: ["popperOffsets"],
1638
- fn: Xo
1639
- };
1640
- function Ro(e) {
1641
- var t = e.state, i = e.name;
1642
- t.modifiersData[i] = Ke({
1643
- reference: t.rects.reference,
1644
- element: t.rects.popper,
1645
- placement: t.placement
1646
- });
1647
- }
1648
- const Mo = {
1649
- name: "popperOffsets",
1650
- enabled: !0,
1651
- phase: "read",
1652
- fn: Ro,
1653
- data: {}
1654
- };
1655
- function Ho(e) {
1656
- return e === "x" ? "y" : "x";
1657
- }
1658
- function Do(e) {
1659
- var t = e.state, i = e.options, n = e.name, o = i.mainAxis, s = o === void 0 ? !0 : o, l = i.altAxis, r = l === void 0 ? !1 : l, a = i.boundary, c = i.rootBoundary, h = i.altBoundary, p = i.padding, f = i.tether, u = f === void 0 ? !0 : f, I = i.tetherOffset, g = I === void 0 ? 0 : I, v = Lt(t, {
1660
- boundary: a,
1661
- rootBoundary: c,
1662
- padding: p,
1663
- altBoundary: h
1664
- }), m = j(t.placement), b = mt(t.placement), x = !b, w = oe(m), C = Ho(w), y = t.modifiersData.popperOffsets, O = t.rects.reference, S = t.rects.popper, E = typeof g == "function" ? g(Object.assign({}, t.rects, {
1665
- placement: t.placement
1666
- })) : g, A = typeof E == "number" ? {
1667
- mainAxis: E,
1668
- altAxis: E
1669
- } : Object.assign({
1670
- mainAxis: 0,
1671
- altAxis: 0
1672
- }, E), L = t.modifiersData.offset ? t.modifiersData.offset[t.placement] : null, R = {
1673
- x: 0,
1674
- y: 0
1675
- };
1676
- if (y) {
1677
- if (s) {
1678
- var T, G = w === "y" ? H : D, z = w === "y" ? F : N, Y = w === "y" ? "height" : "width", Z = y[w], rt = Z + v[G], U = Z - v[z], at = u ? -S[Y] / 2 : 0, vt = b === ut ? O[Y] : S[Y], tt = b === ut ? -S[Y] : -O[Y], lt = t.elements.arrow, Q = u && lt ? ne(lt) : {
1679
- width: 0,
1680
- height: 0
1681
- }, V = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : Ge(), et = V[G], it = V[z], _ = Et(0, O[Y], Q[Y]), gt = x ? O[Y] / 2 - at - _ - et - A.mainAxis : vt - _ - et - A.mainAxis, Vt = x ? -O[Y] / 2 + at + _ + it + A.mainAxis : tt + _ + it + A.mainAxis, yt = t.elements.arrow && Tt(t.elements.arrow), jt = yt ? w === "y" ? yt.clientTop || 0 : yt.clientLeft || 0 : 0, Yt = (T = L == null ? void 0 : L[w]) != null ? T : 0, $t = Z + gt - Yt - jt, Gt = Z + Vt - Yt, Xt = Et(u ? Wt(rt, $t) : rt, Z, u ? ot(U, Gt) : U);
1682
- y[w] = Xt, R[w] = Xt - Z;
1683
- }
1684
- if (r) {
1685
- var Pt, zt = w === "x" ? H : D, Ut = w === "x" ? F : N, K = y[C], nt = C === "y" ? "height" : "width", ct = K + v[zt], ht = K - v[Ut], dt = [H, D].indexOf(m) !== -1, bt = (Pt = L == null ? void 0 : L[C]) != null ? Pt : 0, wt = dt ? ct : K - O[nt] - S[nt] - bt + A.altAxis, It = dt ? K + O[nt] + S[nt] - bt - A.altAxis : ht, Rt = u && dt ? ro(wt, K, It) : Et(u ? wt : ct, K, u ? It : ht);
1686
- y[C] = Rt, R[C] = Rt - K;
1687
- }
1688
- t.modifiersData[n] = R;
1689
- }
1690
- }
1691
- const Zo = {
1692
- name: "preventOverflow",
1693
- enabled: !0,
1694
- phase: "main",
1695
- fn: Do,
1696
- requiresIfExists: ["offset"]
1697
- };
1698
- function Bo(e) {
1699
- return {
1700
- scrollLeft: e.scrollLeft,
1701
- scrollTop: e.scrollTop
1702
- };
1703
- }
1704
- function Wo(e) {
1705
- return e === B(e) || !W(e) ? se(e) : Bo(e);
1706
- }
1707
- function Fo(e) {
1708
- var t = e.getBoundingClientRect(), i = pt(t.width) / e.offsetWidth || 1, n = pt(t.height) / e.offsetHeight || 1;
1709
- return i !== 1 || n !== 1;
1710
- }
1711
- function No(e, t, i) {
1712
- i === void 0 && (i = !1);
1713
- var n = W(t), o = W(t) && Fo(t), s = q(t), l = ft(e, o, i), r = {
1714
- scrollLeft: 0,
1715
- scrollTop: 0
1716
- }, a = {
1717
- x: 0,
1718
- y: 0
1719
- };
1720
- return (n || !n && !i) && (($(t) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
1721
- ae(s)) && (r = Wo(t)), W(t) ? (a = ft(t, !0), a.x += t.clientLeft, a.y += t.clientTop) : s && (a.x = re(s))), {
1722
- x: l.left + r.scrollLeft - a.x,
1723
- y: l.top + r.scrollTop - a.y,
1724
- width: l.width,
1725
- height: l.height
1726
- };
1727
- }
1728
- function Vo(e) {
1729
- var t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), n = [];
1730
- e.forEach(function(s) {
1731
- t.set(s.name, s);
1732
- });
1733
- function o(s) {
1734
- i.add(s.name);
1735
- var l = [].concat(s.requires || [], s.requiresIfExists || []);
1736
- l.forEach(function(r) {
1737
- if (!i.has(r)) {
1738
- var a = t.get(r);
1739
- a && o(a);
1740
- }
1741
- }), n.push(s);
1742
- }
1743
- return e.forEach(function(s) {
1744
- i.has(s.name) || o(s);
1745
- }), n;
1746
- }
1747
- function jo(e) {
1748
- var t = Vo(e);
1749
- return to.reduce(function(i, n) {
1750
- return i.concat(t.filter(function(o) {
1751
- return o.phase === n;
1752
- }));
1753
- }, []);
1754
- }
1755
- function $o(e) {
1756
- var t;
1757
- return function() {
1758
- return t || (t = new Promise(function(i) {
1759
- Promise.resolve().then(function() {
1760
- t = void 0, i(e());
1761
- });
1762
- })), t;
1763
- };
1764
- }
1765
- function Go(e) {
1766
- var t = e.reduce(function(i, n) {
1767
- var o = i[n.name];
1768
- return i[n.name] = o ? Object.assign({}, o, n, {
1769
- options: Object.assign({}, o.options, n.options),
1770
- data: Object.assign({}, o.data, n.data)
1771
- }) : n, i;
1772
- }, {});
1773
- return Object.keys(t).map(function(i) {
1774
- return t[i];
1775
- });
1776
- }
1777
- var He = {
1778
- placement: "bottom",
1779
- modifiers: [],
1780
- strategy: "absolute"
1781
- };
1782
- function De() {
1783
- for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++)
1784
- t[i] = arguments[i];
1785
- return !t.some(function(n) {
1786
- return !(n && typeof n.getBoundingClientRect == "function");
1787
- });
1788
- }
1789
- function zo(e) {
1790
- e === void 0 && (e = {});
1791
- var t = e, i = t.defaultModifiers, n = i === void 0 ? [] : i, o = t.defaultOptions, s = o === void 0 ? He : o;
1792
- return function(r, a, c) {
1793
- c === void 0 && (c = s);
1794
- var h = {
1795
- placement: "bottom",
1796
- orderedModifiers: [],
1797
- options: Object.assign({}, He, s),
1798
- modifiersData: {},
1799
- elements: {
1800
- reference: r,
1801
- popper: a
1802
- },
1803
- attributes: {},
1804
- styles: {}
1805
- }, p = [], f = !1, u = {
1806
- state: h,
1807
- setOptions: function(m) {
1808
- var b = typeof m == "function" ? m(h.options) : m;
1809
- g(), h.options = Object.assign({}, s, h.options, b), h.scrollParents = {
1810
- reference: st(r) ? St(r) : r.contextElement ? St(r.contextElement) : [],
1811
- popper: St(a)
1812
- };
1813
- var x = jo(Go([].concat(n, h.options.modifiers)));
1814
- return h.orderedModifiers = x.filter(function(w) {
1815
- return w.enabled;
1816
- }), I(), u.update();
1817
- },
1818
- // Sync update – it will always be executed, even if not necessary. This
1819
- // is useful for low frequency updates where sync behavior simplifies the
1820
- // logic.
1821
- // For high frequency updates (e.g. `resize` and `scroll` events), always
1822
- // prefer the async Popper#update method
1823
- forceUpdate: function() {
1824
- if (!f) {
1825
- var m = h.elements, b = m.reference, x = m.popper;
1826
- if (De(b, x)) {
1827
- h.rects = {
1828
- reference: No(b, Tt(x), h.options.strategy === "fixed"),
1829
- popper: ne(x)
1830
- }, h.reset = !1, h.placement = h.options.placement, h.orderedModifiers.forEach(function(A) {
1831
- return h.modifiersData[A.name] = Object.assign({}, A.data);
1832
- });
1833
- for (var w = 0; w < h.orderedModifiers.length; w++) {
1834
- if (h.reset === !0) {
1835
- h.reset = !1, w = -1;
1836
- continue;
1837
- }
1838
- var C = h.orderedModifiers[w], y = C.fn, O = C.options, S = O === void 0 ? {} : O, E = C.name;
1839
- typeof y == "function" && (h = y({
1840
- state: h,
1841
- options: S,
1842
- name: E,
1843
- instance: u
1844
- }) || h);
1845
- }
1846
- }
1847
- }
1848
- },
1849
- // Async and optimistically optimized update – it will not be executed if
1850
- // not necessary (debounced to run at most once-per-tick)
1851
- update: $o(function() {
1852
- return new Promise(function(v) {
1853
- u.forceUpdate(), v(h);
1854
- });
1855
- }),
1856
- destroy: function() {
1857
- g(), f = !0;
1858
- }
1859
- };
1860
- if (!De(r, a))
1861
- return u;
1862
- u.setOptions(c).then(function(v) {
1863
- !f && c.onFirstUpdate && c.onFirstUpdate(v);
1864
- });
1865
- function I() {
1866
- h.orderedModifiers.forEach(function(v) {
1867
- var m = v.name, b = v.options, x = b === void 0 ? {} : b, w = v.effect;
1868
- if (typeof w == "function") {
1869
- var C = w({
1870
- state: h,
1871
- name: m,
1872
- instance: u,
1873
- options: x
1874
- }), y = function() {
1875
- };
1876
- p.push(C || y);
1877
- }
1878
- });
1879
- }
1880
- function g() {
1881
- p.forEach(function(v) {
1882
- return v();
1883
- }), p = [];
1884
- }
1885
- return u;
1886
- };
1887
- }
1888
- var Uo = [go, Mo, mo, no, Po, Lo, Zo, ho, To], _o = /* @__PURE__ */ zo({
1889
- defaultModifiers: Uo
1890
- });
1891
- class Ko {
1892
- constructor(t, i, n) {
1893
- le(this, "updateHotspotPosition", (t, i) => {
1894
- this.currentActiveIndex = t, this.currentOrientation = i;
1895
- const n = Hn(this.hotspotsConfig, t, i);
1896
- this.hideHotspots(), n.forEach((o) => this.updateAndShowHotspot(o, t));
1897
- });
1898
- this.container = i, this.popper = null, this.popperInstance = null, this.hotspotsContainer = Qi(this.container), this.hotspotsConfig = Fn(t), this.shouldHidePopper = !0, this.hidePopper = this.hidePopper.bind(this), this.imageAspectRatio = n, this.hotspotElements = /* @__PURE__ */ new Map(), this.popperListeners = [];
1899
- const { containerSize: o } = t[0];
1900
- this.initialContainerSize = o || [i.offsetWidth, i.offsetHeight], this.initHotspots(), this.observeContainerResize();
1901
- }
1902
- observeContainerResize() {
1903
- this.resizeObserver = new ResizeObserver(() => {
1904
- const t = this.container.offsetWidth, i = this.container.offsetHeight;
1905
- this.updateHotspotsForResize(t, i);
1906
- }), this.resizeObserver.observe(this.container);
1907
- }
1908
- updateHotspotsForResize(t, i) {
1909
- this.hotspotsConfig = Nn({
1910
- newWidth: t,
1911
- newHeight: i,
1912
- initialContainerSize: this.initialContainerSize,
1913
- imageAspectRatio: this.imageAspectRatio,
1914
- hotspotsConfig: this.hotspotsConfig
1915
- }), this.updateHotspotPosition(this.currentActiveIndex, this.currentOrientation);
1916
- }
1917
- cleanupPopperListeners() {
1918
- this.popperListeners.forEach(({ element: t, event: i, handler: n }) => {
1919
- t.removeEventListener(i, n);
1920
- }), this.popperListeners = [];
1921
- }
1922
- showPopper({ hotspotElement: t, content: i, id: n, keepOpen: o }) {
1923
- this.popperInstance && this.popperInstance.instanceId !== n && this.hidePopper();
1924
- const s = {
1925
- placement: "top",
1926
- modifiers: Bn(this.container)
1927
- };
1928
- this.popper = Wn(i, n), this.popper.setAttribute("data-show", ""), this.currentHotspotElement = t, t.setAttribute("aria-expanded", "true"), t.setAttribute("aria-describedby", `cloudimage-360-popper-${n}`);
1929
- const l = () => {
1930
- this.shouldHidePopper = !1;
1931
- }, r = () => {
1932
- this.shouldHidePopper = !0, this.checkAndHidePopper();
1933
- }, a = () => {
1934
- this.shouldHidePopper = !0, this.checkAndHidePopper();
1935
- }, c = () => {
1936
- this.shouldHidePopper = !1, this.hidePopperTimeout && clearTimeout(this.hidePopperTimeout);
1937
- };
1938
- this.popper.addEventListener("mouseenter", l), this.popper.addEventListener("mouseleave", r), t.addEventListener("mouseleave", a), t.addEventListener("mouseenter", c), this.popperListeners.push(
1939
- { element: this.popper, event: "mouseenter", handler: l },
1940
- { element: this.popper, event: "mouseleave", handler: r },
1941
- { element: t, event: "mouseleave", handler: a },
1942
- { element: t, event: "mouseenter", handler: c }
1943
- ), this.popperInstance = {
1944
- ..._o(t, this.popper, s),
1945
- keepOpen: o,
1946
- instanceId: n
1947
- };
1948
- }
1949
- checkAndHidePopper() {
1950
- var t;
1951
- this.shouldHidePopper && !((t = this.popperInstance) != null && t.keepOpen) && (this.hidePopperTimeout = setTimeout(() => {
1952
- this.shouldHidePopper && this.hidePopper();
1953
- }, Oi));
1954
- }
1955
- hidePopper() {
1956
- if (this.cleanupPopperListeners(), this.currentHotspotElement && (this.currentHotspotElement.setAttribute("aria-expanded", "false"), this.currentHotspotElement.removeAttribute("aria-describedby"), this.currentHotspotElement = null), this.popperInstance && (this.popperInstance.destroy(), this.popperInstance = null), this.popper) {
1957
- this.popper.removeAttribute("data-show"), this.popper.setAttribute("aria-hidden", "true");
1958
- const t = this.popper;
1959
- this.popper = null, setTimeout(() => {
1960
- t.remove();
1961
- }, Ei);
1962
- }
1963
- }
1964
- createHotspot(t) {
1965
- const { id: i, content: n, keepOpen: o, onClick: s, label: l } = t, r = Dn(i, l);
1966
- s && (r.style.cursor = "pointer"), r.onclick = (a) => {
1967
- a.stopPropagation(), s == null || s(a, this.popperInstance, i);
1968
- }, n && (r.addEventListener(
1969
- "mouseenter",
1970
- () => this.showPopper({ hotspotElement: r, content: n, id: i, keepOpen: o })
1971
- ), r.addEventListener(
1972
- "focus",
1973
- () => this.showPopper({ hotspotElement: r, content: n, id: i, keepOpen: o })
1974
- ), r.addEventListener("blur", () => {
1975
- this.shouldHidePopper = !0, this.checkAndHidePopper();
1976
- })), this.hotspotsContainer.appendChild(r);
1977
- }
1978
- hideHotspots() {
1979
- this.hotspotsContainer.querySelectorAll(".cloudimage-360-hotspot").forEach((t) => {
1980
- t.style.opacity = 0, t.style.pointerEvents = "none";
1981
- });
1982
- }
1983
- updateAndShowHotspot(t, i) {
1984
- const { positions: n, id: o } = t, { x: s, y: l } = n[i] ?? {}, r = this.hotspotsContainer.querySelector(`[data-hotspot-id="${o}"]`);
1985
- r && (r.style.translate = `${s}px ${l}px`, r.style.opacity = 1, r.style.pointerEvents = "all");
1986
- }
1987
- /**
1988
- * Shows the popper for a specific hotspot by ID
1989
- * @param {string} hotspotId - The ID of the hotspot to show
1990
- */
1991
- showHotspotById(t) {
1992
- const i = this.hotspotsConfig.find((o) => o.id === t);
1993
- if (!i || !i.content) return;
1994
- const n = this.hotspotsContainer.querySelector(`[data-hotspot-id="${t}"]`);
1995
- n && n.style.opacity === "1" && this.showPopper({
1996
- hotspotElement: n,
1997
- content: i.content,
1998
- id: t,
1999
- keepOpen: i.keepOpen
2000
- });
2001
- }
2002
- createAllHotspots() {
2003
- this.hotspotsConfig.forEach((t) => this.createHotspot(t));
2004
- }
2005
- initHotspots() {
2006
- this.createAllHotspots();
2007
- }
2008
- destroy() {
2009
- this.hidePopperTimeout && clearTimeout(this.hidePopperTimeout), this.resizeObserver.disconnect(), this.hidePopper(), this.hotspotElements.clear(), this.hotspotsContainer.innerHTML = "";
2010
- }
2011
- }
2012
- class Ft {
2013
- constructor(t, i, n) {
2014
- this.container = t, this.isClicked = !1, this.fullscreenView = !!n, this.imagesX = [], this.imagesY = [], this.devicePixelRatio = Math.round(window.devicePixelRatio || 1), this.id = t.id, this.movementStart = { x: 0, y: 0 }, this.draggingDirection = null, this.isReady = !1, this.velocityX = 0, this.velocityY = 0, this.lastDragTime = 0, this.lastDragX = 0, this.lastDragY = 0, this.inertiaAnimationId = null, this.hasInteracted = !1, this.currentZoomScale = 1, this.touchDevice = Ln(), this.dragJustEnded = !1, this.isPinching = !1, this.initialPinchDistance = 0, this.pinchZoomLevel = 1, this.pinchZoomEmitted = !1, this.lastEmittedZoom = 1, this.panOffsetX = 0, this.panOffsetY = 0, this.canvasWorker = new Yn(), this.hotspotTimeline = null, this.hotspotTimelineIndicator = null, this.isAnimatingToFrame = !1, this.onMoveHandler = this.onMoveHandler.bind(this), this.destroy = this.destroy.bind(this), this.init(this.container, i);
2015
- }
2016
- emit(t, i = {}) {
2017
- const n = this[t];
2018
- typeof n == "function" && n({ ...i, viewerId: this.id });
2019
- }
2020
- announce(t) {
2021
- tn(this.ariaLiveRegion, t);
2022
- }
2023
- mouseDown(t) {
2024
- if (!this.isReady || this.glass) return;
2025
- const { pageX: i, pageY: n } = t;
2026
- this.hideHints(), this.hideHotspotPopper(), this.inertiaAnimationId && (cancelAnimationFrame(this.inertiaAnimationId), this.inertiaAnimationId = null), this.autoplayJustStopped = !1, (this.autoplay || this.loopTimeoutId) && (this.stopAutoplay(), this.autoplay = !1, this.autoplayJustStopped = !0), this.movementStart = { x: i, y: n }, this.isClicked = !0, this.isDragging = !1, this.inertia && (this.velocityX = 0, this.velocityY = 0, this.lastDragTime = performance.now(), this.lastDragX = i, this.lastDragY = n);
2027
- }
2028
- mouseUp() {
2029
- this.isReady && (!this.isZoomed && !this.autoplayJustStopped && this.showAllIcons(), this.inertia && this.isDragging && (Math.abs(this.velocityX) > 0.1 || Math.abs(this.velocityY) > 0.1) && this.startInertia(), this.isDragging && (this.emit("onDragEnd"), this.dragJustEnded = !0), this.movementStart = { x: 0, y: 0 }, this.isClicked = !1, this.isDragging = !1, this.innerBox.style.cursor = "grab");
2030
- }
2031
- startInertia() {
2032
- const n = this.fullscreenView ? document.body : this.container, o = this.dragSpeed / fe, s = o * (this.amountX / n.offsetWidth), l = o * (this.amountY / n.offsetHeight), r = () => {
2033
- if (this.velocityX *= 0.95, this.velocityY *= 0.95, Math.abs(this.velocityX) < 0.01 && Math.abs(this.velocityY) < 0.01) {
2034
- this.inertiaAnimationId = null;
2035
- return;
2036
- }
2037
- const a = this.velocityX * 16, c = this.velocityY * 16, h = Se({
2038
- deltaX: a,
2039
- deltaY: c,
2040
- reversed: this.dragReverse,
2041
- allowSpinX: this.allowSpinX,
2042
- allowSpinY: this.allowSpinY
2043
- });
2044
- if (h) {
2045
- const p = this.allowSpinX ? Math.max(1, Math.abs(Math.round(a * s))) : 0, f = this.allowSpinY ? Math.max(1, Math.abs(Math.round(c * l))) : 0;
2046
- (p > 0 || f > 0) && this.onMoveHandler(h, p, f);
2047
- }
2048
- this.inertiaAnimationId = requestAnimationFrame(r);
2049
- };
2050
- this.inertiaAnimationId = requestAnimationFrame(r);
2051
- }
2052
- drag(t, i) {
2053
- if (!this.isReady || !this.isClicked) return;
2054
- const n = t - this.movementStart.x, o = i - this.movementStart.y;
2055
- if (this.inertia) {
2056
- const f = performance.now(), u = f - this.lastDragTime;
2057
- u > 0 && u < 100 && (this.velocityX = (t - this.lastDragX) / u, this.velocityY = (i - this.lastDragY) / u), this.lastDragTime = f, this.lastDragX = t, this.lastDragY = i;
2058
- }
2059
- this.draggingDirection = Se({
2060
- deltaX: n,
2061
- deltaY: o,
2062
- reversed: this.dragReverse,
2063
- allowSpinX: this.allowSpinX,
2064
- allowSpinY: this.allowSpinY
2065
- }) || this.draggingDirection;
2066
- const s = this.fullscreenView ? document.body : this.container, l = this.dragSpeed / fe, r = l * (this.amountX / s.offsetWidth), a = l * (this.amountY / s.offsetHeight), c = this.allowSpinX ? Math.abs(Math.round(n * r)) : 0, h = this.allowSpinY ? Math.abs(Math.round(o * a)) : 0;
2067
- (this.allowSpinX && c !== 0 || this.allowSpinY && h !== 0) && (this.hasInteracted = !0, this.hideHotspotPopper(), this.onMoveHandler(this.draggingDirection, c, h), this.movementStart = { x: t, y: i }, setTimeout(() => {
2068
- this.isDragging || (this.isDragging = !0, this.emit("onDragStart"));
2069
- }, Ci));
2070
- }
2071
- mouseMove(t) {
2072
- !this.isReady || !this.isClicked && !this.isZoomed || this.glass || (this.hideAllIcons(), this.drag(t.pageX, t.pageY), this.isZoomed && this.applyZoom(t));
2073
- }
2074
- mouseClick(t) {
2075
- if (!(!this.isReady || this.isDragging)) {
2076
- if (this.dragJustEnded) {
2077
- this.dragJustEnded = !1;
2078
- return;
2079
- }
2080
- if (this.autoplayJustStopped) {
2081
- this.autoplayJustStopped = !1;
2082
- return;
2083
- }
2084
- if (this.glass && this.magnified) {
2085
- this.removeGlass();
2086
- return;
2087
- }
2088
- this.pointerZoom && !this.glass && !this.touchDevice && this.toggleZoom(t);
2089
- }
2090
- }
2091
- loadHigherQualityImages(t, i) {
2092
- const n = Ot(this.srcXConfig, t), o = this.allowSpinY ? Ot(this.srcYConfig, t) : null;
2093
- ve({
2094
- cdnPathX: n,
2095
- cdnPathY: o,
2096
- configX: this.srcXConfig,
2097
- configY: this.srcYConfig,
2098
- onAllImagesLoad: (s, l) => {
2099
- this.imagesX = s, this.imagesY = l, i();
2100
- },
2101
- onError: (s) => this.emit("onError", s)
2102
- });
2103
- }
2104
- hideHotspots() {
2105
- this.hotspotsInstance && this.hotspotsInstance.hideHotspots();
2106
- }
2107
- hideHotspotPopper() {
2108
- this.hotspotsInstance && this.hotspotsInstance.hidePopper();
2109
- }
2110
- toggleZoom(t) {
2111
- if (this.isZoomed)
2112
- this.showTransitionOverlay(), setTimeout(() => {
2113
- this.removeZoom();
2114
- }, pe);
2115
- else {
2116
- let i = (this.fullscreenView || this.pointerZoom ? document.body : this.container).offsetWidth;
2117
- this.hideHotspots(), this.showLoadingSpinner(), this.loadHigherQualityImages(i, () => {
2118
- this.showTransitionOverlay(), setTimeout(() => {
2119
- this.applyZoom(t);
2120
- }, pe);
2121
- });
2122
- }
2123
- }
2124
- removeZoom() {
2125
- this.isZoomed = !1, this.updateView(), this.showAllIcons(), this.hideTransitionOverlay(), this.emit("onZoomOut"), this.announce("Zoomed out");
2126
- }
2127
- mouseLeave() {
2128
- this.isZoomed && this.removeZoom();
2129
- }
2130
- applyZoom(t) {
2131
- const { offsetX: i, offsetY: n } = xn(t, this.canvas, this.devicePixelRatio);
2132
- this.isZoomed = !0, this.hideAllIcons(), this.hideLoadingSpinner(), this.hideTransitionOverlay(), this.updateView(this.pointerZoom, i, n), this.emit("onZoomIn", { zoomLevel: this.pointerZoom }), this.announce("Zoomed in. Move mouse to pan. Click to zoom out.");
2133
- }
2134
- touchOutside(t) {
2135
- if (!this.glass) return;
2136
- !this.canvas.contains(t.target) && this.removeGlass();
2137
- }
2138
- touchStart(t) {
2139
- if (!this.isReady || this.glass || !t.touches || !t.touches.length) return;
2140
- const i = t.target;
2141
- if (i && i.closest && i.closest(".cloudimage-360-button")) return;
2142
- if (this.hideHints(), t.touches.length === 2 && this.pinchZoom && !this.isDragging) {
2143
- t.preventDefault(), this.isPinching = !0, this.isClicked = !1, this.inertiaAnimationId && (cancelAnimationFrame(this.inertiaAnimationId), this.inertiaAnimationId = null);
2144
- const s = t.touches[0], l = t.touches[1];
2145
- if (this.initialPinchDistance = this.getPinchDistance(s, l), (this.autoplay || this.loopTimeoutId) && (this.stopAutoplay(), this.autoplay = !1), !this.isZoomed && this.pinchZoomLevel === 1) {
2146
- const r = (this.fullscreenView ? document.body : this.container).offsetWidth;
2147
- this.hideHotspots(), this.loadHigherQualityImages(r, () => {
2148
- });
2149
- }
2150
- return;
2151
- }
2152
- if (t.touches.length > 1) return;
2153
- const { pageX: n, pageY: o } = t.touches[0];
2154
- this.inertiaAnimationId && (cancelAnimationFrame(this.inertiaAnimationId), this.inertiaAnimationId = null), (this.autoplay || this.loopTimeoutId) && (this.stopAutoplay(), this.autoplay = !1), this.hideAllIcons(), this.hideHotspotPopper(), this.movementStart = { x: n, y: o }, this.isClicked = !0, this.isDragging = !1, this.inertia && (this.velocityX = 0, this.velocityY = 0, this.lastDragTime = performance.now(), this.lastDragX = n, this.lastDragY = o);
2155
- }
2156
- getPinchDistance(t, i) {
2157
- const n = t.pageX - i.pageX, o = t.pageY - i.pageY;
2158
- return Math.sqrt(n * n + o * o);
2159
- }
2160
- getPinchCenter(t, i) {
2161
- return {
2162
- x: (t.pageX + i.pageX) / 2,
2163
- y: (t.pageY + i.pageY) / 2
2164
- };
2165
- }
2166
- touchEnd(t) {
2167
- if (this.isReady) {
2168
- if (this.isPinching) {
2169
- if (!t.touches || t.touches.length < 2) {
2170
- if (this.isPinching = !1, this.initialPinchDistance = 0, this.pinchZoomLevel <= 1) {
2171
- const i = this.pinchZoomEmitted;
2172
- this.pinchZoomLevel = 1, this.pinchZoomEmitted = !1, this.lastEmittedZoom = 1, this.isZoomed = !1, this.panOffsetX = 0, this.panOffsetY = 0, this.showAllIcons(), this.updateView(), i && this.emit("onZoomOut");
2173
- } else if (this.canvas) {
2174
- const i = this.canvas.getBoundingClientRect();
2175
- this.panOffsetX = i.width / 2 * this.devicePixelRatio, this.panOffsetY = i.height / 2 * this.devicePixelRatio;
2176
- }
2177
- }
2178
- return;
2179
- }
2180
- this.showAllIcons(), this.inertia && this.isDragging && (Math.abs(this.velocityX) > 0.1 || Math.abs(this.velocityY) > 0.1) && this.startInertia(), this.movementStart = { x: 0, y: 0 }, this.isClicked = !1, this.isDragging = !1;
2181
- }
2182
- }
2183
- touchMove(t) {
2184
- if (!this.isReady || this.glass) return;
2185
- if (this.isPinching && t.touches.length === 2) {
2186
- t.preventDefault();
2187
- const o = t.touches[0], s = t.touches[1], l = this.getPinchDistance(o, s);
2188
- if (this.initialPinchDistance === 0) {
2189
- this.initialPinchDistance = l;
2190
- return;
2191
- }
2192
- const r = l / this.initialPinchDistance, a = Math.max(1, Math.min(this.pinchZoomLevel * r, me));
2193
- if (this.initialPinchDistance = l, this.pinchZoomLevel = a, !this.canvas) return;
2194
- const c = this.canvas.getBoundingClientRect(), h = c.width / 2 * this.devicePixelRatio, p = c.height / 2 * this.devicePixelRatio;
2195
- a > 1 ? (this.isZoomed = !0, this.hideAllIcons(), this.updateView(a, h, p), (!this.pinchZoomEmitted || a > this.lastEmittedZoom) && (this.emit("onZoomIn", { zoomLevel: a }), this.pinchZoomEmitted = !0, this.lastEmittedZoom = a)) : (this.isZoomed = !1, this.panOffsetX = 0, this.panOffsetY = 0, this.updateView());
2196
- return;
2197
- }
2198
- if (!this.isClicked || !t.touches || !t.touches[0]) return;
2199
- const { pageX: i, pageY: n } = t.touches[0];
2200
- if (t.preventDefault(), this.isZoomed && this.pinchZoomLevel > 1) {
2201
- const o = i - this.movementStart.x, s = n - this.movementStart.y;
2202
- this.panOffsetX -= o * this.devicePixelRatio, this.panOffsetY -= s * this.devicePixelRatio, this.movementStart = { x: i, y: n }, this.updateView(this.pinchZoomLevel, this.panOffsetX, this.panOffsetY);
2203
- return;
2204
- }
2205
- this.drag(i, n);
2206
- }
2207
- keyDown(t) {
2208
- if (!this.isReady) return;
2209
- const { keyCode: i } = t, n = this.keysReverse;
2210
- switch (this.autoplay && this.stopAutoplay(), Ee(i, this.allowSpinY) && (this.hasInteracted = !0, this.hideAllIcons(), this.hideHints()), i) {
2211
- case 37:
2212
- n ? this.moveLeft() : this.moveRight();
2213
- break;
2214
- case 39:
2215
- n ? this.moveRight() : this.moveLeft();
2216
- break;
2217
- case 38:
2218
- this.allowSpinY && (t.preventDefault(), n ? this.moveTop() : this.moveBottom());
2219
- break;
2220
- case 40:
2221
- this.allowSpinY && (t.preventDefault(), n ? this.moveBottom() : this.moveTop());
2222
- break;
2223
- }
2224
- }
2225
- keyUp(t) {
2226
- const { keyCode: i } = t;
2227
- Ee(i, this.allowSpinY) && this.showAllIcons();
2228
- }
2229
- moveActiveXIndexUp(t) {
2230
- this.orientation = P.X, this.activeImageX = (this.activeImageX + t) % this.amountX;
2231
- }
2232
- moveActiveXIndexDown(t) {
2233
- this.orientation = P.X, this.activeImageX = (this.activeImageX - t + this.amountX) % this.amountX;
2234
- }
2235
- moveActiveYIndexUp(t) {
2236
- this.orientation = P.Y, this.activeImageY = (this.activeImageY + t) % this.amountY;
2237
- }
2238
- moveActiveYIndexDown(t) {
2239
- this.orientation = P.Y, this.activeImageY = (this.activeImageY - t + this.amountY) % this.amountY;
2240
- }
2241
- moveRight(t, i = 1) {
2242
- t && this.activeImageX >= this.imagesX.length - 1 || (this.moveActiveXIndexUp(i), this.isZoomed || this.updateView());
2243
- }
2244
- moveLeft(t, i = 1) {
2245
- t && this.activeImageX <= 0 || (this.moveActiveXIndexDown(i), this.isZoomed || this.updateView());
2246
- }
2247
- moveTop(t, i = 1) {
2248
- t && this.activeImageY >= this.imagesY.length - 1 || (this.moveActiveYIndexUp(i), this.isZoomed || this.updateView());
2249
- }
2250
- moveBottom(t, i = 1) {
2251
- t && this.activeImageY <= 0 || (this.moveActiveYIndexDown(i), this.isZoomed || this.updateView());
2252
- }
2253
- onMoveHandler(t, i = 1, n = 1) {
2254
- t === "right" ? this.moveRight(this.stopAtEdges, i) : t === "left" ? this.moveLeft(this.stopAtEdges, i) : t === "up" ? this.moveTop(this.stopAtEdges, n) : t === "down" && this.moveBottom(this.stopAtEdges, n), this.emit("onSpin", {
2255
- direction: t,
2256
- activeImageX: this.activeImageX,
2257
- activeImageY: this.activeImageY,
2258
- amountX: this.amountX,
2259
- amountY: this.amountY
2260
- });
2261
- }
2262
- updateView(t, i, n) {
2263
- const o = this.orientation === P.X ? this.activeImageX : this.activeImageY, s = this.orientation === P.X ? this.imagesX[this.activeImageX] : this.imagesY[this.activeImageY];
2264
- this.hotspotsInstance && !this.isZoomed && !this.autoplay && this.hotspotsInstance.updateHotspotPosition(o, this.orientation), this.hotspotTimelineIndicator && this.orientation === P.X && this.updateHotspotTimelinePosition(), this.drawImageOnCanvas(s, t, i, n);
2265
- }
2266
- updatePercentageInLoader(t = 0) {
2267
- this.loader && (this.loader.innerText = t + "%");
2268
- }
2269
- adaptCanvasSize(t) {
2270
- const { naturalWidth: i, naturalHeight: n } = t;
2271
- this.imageAspectRatio = i / n;
2272
- const o = this.fullscreenView ? window.innerWidth : this.canvas.clientWidth, s = this.fullscreenView ? window.innerHeight : this.canvas.clientHeight;
2273
- this.canvasWorker.postMessage({
2274
- action: "adaptCanvasSize",
2275
- devicePixelRatio: this.devicePixelRatio,
2276
- imageAspectRatio: this.imageAspectRatio,
2277
- containerWidth: o,
2278
- containerHeight: s
2279
- });
2280
- }
2281
- drawImageOnCanvas(t, i = 1, n = 0, o = 0) {
2282
- this.canvasWorker.postMessage({
2283
- action: "drawImageOnCanvas",
2284
- imageData: t,
2285
- zoomScale: i,
2286
- pointerX: n,
2287
- pointerY: o
2288
- });
2289
- }
2290
- pushImageToSet(t, i, n) {
2291
- n === P.X ? this.imagesX[i] = t : this.imagesY[i] = t;
2292
- }
2293
- calculatePercentage() {
2294
- const t = this.amountX + this.amountY, i = this.imagesX.length + this.imagesY.length;
2295
- return Math.round(i / t * 100);
2296
- }
2297
- onImageLoad(t, i, n) {
2298
- this.pushImageToSet(t, i, n), this.updatePercentageInLoader(this.calculatePercentage());
2299
- }
2300
- onFirstImageLoaded(t, i) {
2301
- this.createContainers(t), this.adaptCanvasSize(i), this.drawImageOnCanvas(i);
2302
- }
2303
- onAllImagesLoaded() {
2304
- if (this.addAllIcons(), this.isReady = !0, this.amountX = this.imagesX.length, this.amountY = this.imagesY.length, this.activeImageX = this.autoplayReverse ? this.amountX - 1 : 0, this.activeImageY = this.autoplayReverse ? this.amountY - 1 : 0, this.hotspots && (this.hotspotsInstance = new Ko(this.hotspots, this.innerBox, this.imageAspectRatio), this.addHotspotTimeline(), this.showHotspotTimeline()), this.emit("onLoad", { imagesX: this.imagesX.length, imagesY: this.imagesY.length }), this.emit("onReady"), this.announce("360 degree view loaded. Use mouse drag or arrow keys to rotate."), this.hints !== !1 && !this.autoplay) {
2305
- const t = this.hints === !0 || this.hints === void 0 ? be(this.viewerConfig, this.touchDevice) : this.hints;
2306
- t && t.length > 0 && (this.hintsOverlay = ye(this.innerBox, t), we(this.hintsOverlay));
2307
- }
2308
- this.autoplay && (this.hideAllIcons(), kn(this.play.bind(this))());
2309
- }
2310
- magnify(t) {
2311
- t.stopPropagation();
2312
- const { src: i } = this.orientation === P.Y ? this.imagesY[this.activeImageY] : this.imagesX[this.activeImageX], o = (this.fullscreenView ? document.body : this.container).offsetWidth * this.magnifier, s = Hi(i, o);
2313
- this.showLoadingSpinner(), this.createGlass(), bn(s, (a) => {
2314
- this.hideLoadingSpinner(), this.magnified = !0, In(t, this.innerBox, this.offset, a, this.glass, this.magnifier);
2315
- }, (a) => {
2316
- this.hideLoadingSpinner(), this.removeGlass(), this.emit("onError", {
2317
- error: { message: a.message, url: a.url },
2318
- errorCount: 1,
2319
- totalImages: 1,
2320
- errors: [{ message: a.message, url: a.url }]
2321
- });
2322
- });
2323
- }
2324
- openFullscreenModal(t) {
2325
- t.stopPropagation(), window.document.body.style.overflow = "hidden";
2326
- const i = _i(this.container);
2327
- new Ft(i, this.viewerConfig, !0), this.emit("onFullscreenOpen"), this.announce("Opened fullscreen mode. Press Escape to exit.");
2328
- }
2329
- closeFullscreenModal(t) {
2330
- t.stopPropagation(), document.body.removeChild(this.container.parentNode), window.document.body.style.overflow = "visible", this.emit("onFullscreenClose"), this.announce("Exited fullscreen mode");
2331
- }
2332
- play() {
2333
- if (this.isClicked) return;
2334
- this.hide360ViewCircleIcon(), this.emit("onAutoplayStart");
2335
- const t = this.speed * 36 / (this.amountX + this.amountY), i = {
2336
- left: this.moveLeft.bind(this),
2337
- right: this.moveRight.bind(this),
2338
- top: this.moveTop.bind(this),
2339
- bottom: this.moveBottom.bind(this)
2340
- };
2341
- this.loopTimeoutId = window.setInterval(() => {
2342
- if (this.playOnce && On({
2343
- autoplayBehavior: this.autoplayBehavior,
2344
- activeImageX: this.activeImageX,
2345
- activeImageY: this.activeImageY,
2346
- amountX: this.amountX,
2347
- amountY: this.amountY,
2348
- autoplayReverse: this.autoplayReverse
2349
- })) {
2350
- this.stopAutoplay();
2351
- return;
2352
- }
2353
- En({
2354
- autoplayBehavior: this.autoplayBehavior,
2355
- activeImageX: this.activeImageX,
2356
- activeImageY: this.activeImageY,
2357
- amountX: this.amountX,
2358
- amountY: this.amountY,
2359
- autoplayReverse: this.autoplayReverse,
2360
- spinDirection: this.spinDirection
2361
- }) && (this.spinDirection = An(this.spinDirection));
2362
- const s = this.spinDirection === "y";
2363
- Cn({
2364
- autoplayBehavior: this.autoplayBehavior,
2365
- spinY: s,
2366
- reversed: this.autoplayReverse,
2367
- loopTriggers: i
2368
- });
2369
- }, t);
2370
- }
2371
- stopAutoplay() {
2372
- if (this.showAllIcons(), this.autoplay = !1, window.clearTimeout(this.loopTimeoutId), this.loopTimeoutId = null, this.emit("onAutoplayStop"), this.hints !== !1 && !this.hintsOverlay && !this.hintsHidden) {
2373
- const t = this.hints === !0 ? be(this.viewerConfig, this.touchDevice) : this.hints;
2374
- t && t.length > 0 && (this.hintsOverlay = ye(this.innerBox, t), we(this.hintsOverlay));
2375
- }
2376
- }
2377
- destroy() {
2378
- this.stopAutoplay(), this.inertiaAnimationId && (cancelAnimationFrame(this.inertiaAnimationId), this.inertiaAnimationId = null), this.removeEvents(), this.canvasWorker && (this.canvasWorker.terminate(), this.canvasWorker = null), this.hotspotsInstance && this.hotspotsInstance.destroy(), this.hintsOverlay && this.hintsOverlay.parentNode && (this.hintsOverlay.parentNode.removeChild(this.hintsOverlay), this.hintsOverlay = null), this.hotspotTimeline && this.hotspotTimeline.parentNode && (this.hotspotTimeline.parentNode.removeChild(this.hotspotTimeline), this.hotspotTimeline = null, this.hotspotTimelineIndicator = null), this.container && (this.container.classList.remove("ci360-theme-dark"), this.container.innerHTML = "");
2379
- }
2380
- addInitialIcon() {
2381
- this.initialIcon || this.hide360Logo || (this.initialIcon = Ni(this.logoSrc), this.innerBox.appendChild(this.initialIcon));
2382
- }
2383
- showInitialIcon() {
2384
- !this.initialIcon || this.hasInteracted || (this.initialIcon.style.opacity = 1);
2385
- }
2386
- hideInitialIcon() {
2387
- this.initialIcon && (this.initialIcon.style.opacity = 0);
2388
- }
2389
- createGlass() {
2390
- this.hideAllIcons(), this.glass = document.createElement("div"), this.innerBox.appendChild(this.glass), this.innerBox.style.cursor = "default";
2391
- }
2392
- removeGlass() {
2393
- this.showAllIcons(), this.innerBox.removeChild(this.glass), this.glass = null, this.magnified = !1;
2394
- }
2395
- addMagnifierIcon() {
2396
- this.magnifier && (this.magnifierIcon = zi(), this.magnifierIcon.onclick = this.magnify.bind(this), this.iconsContainer.appendChild(this.magnifierIcon));
2397
- }
2398
- showMagnifierIcon() {
2399
- this.magnifierIcon && (this.magnifierIcon.style.visibility = "visible", this.magnifierIcon.style.opacity = 1);
2400
- }
2401
- hideMagnifierIcon() {
2402
- this.magnifierIcon && (this.magnifierIcon.style.visibility = "hidden", this.magnifierIcon.style.opacity = 0);
2403
- }
2404
- addFullscreenIcon() {
2405
- this.fullscreen && (this.fullscreenIcon = $i(), this.fullscreenIcon.onclick = this.openFullscreenModal.bind(this), this.iconsContainer.appendChild(this.fullscreenIcon));
2406
- }
2407
- addCloseFullscreenIcon() {
2408
- this.fullscreenCloseIcon = ji(), this.fullscreenCloseIcon.onclick = this.closeFullscreenModal.bind(this), this.iconsContainer.appendChild(this.fullscreenCloseIcon);
2409
- }
2410
- showFullscreenIcon() {
2411
- this.fullscreenIcon && (this.fullscreenIcon.style.opacity = 1);
2412
- }
2413
- hideFullscreenIcon() {
2414
- this.fullscreenIcon && (this.fullscreenIcon.style.opacity = 0);
2415
- }
2416
- add360ViewCircleIcon() {
2417
- this.view360CircleIcon || (this.view360CircleIcon = Wi(this.bottomCircleOffset), this.innerBox.appendChild(this.view360CircleIcon));
2418
- }
2419
- show360ViewCircleIcon() {
2420
- this.view360CircleIcon && (this.view360CircleIcon.style.opacity = 1);
2421
- }
2422
- hide360ViewCircleIcon() {
2423
- this.view360CircleIcon && (this.view360CircleIcon.style.opacity = 0);
2424
- }
2425
- addLoadingSpinner() {
2426
- this.loadingSpinner = Ki(), this.innerBox.appendChild(this.loadingSpinner);
2427
- }
2428
- showLoadingSpinner() {
2429
- this.loadingSpinner && (this.hideAllIcons(), this.loadingSpinner.style.opacity = 1);
2430
- }
2431
- createTransitionOverlay() {
2432
- this.transitionOverlay = Ji(), this.innerBox.appendChild(this.transitionOverlay);
2433
- }
2434
- showTransitionOverlay() {
2435
- this.transitionOverlay && (this.hideAllIcons(), this.transitionOverlay.style.opacity = 1);
2436
- }
2437
- hideTransitionOverlay() {
2438
- this.transitionOverlay && (this.transitionOverlay.style.opacity = 0);
2439
- }
2440
- hideLoadingSpinner() {
2441
- this.loadingSpinner && (this.loadingSpinner.style.opacity = 0);
2442
- }
2443
- hideHints() {
2444
- !this.hintsOverlay || this.hintsHidden || (this.hintsHidden = !0, on(this.hintsOverlay));
2445
- }
2446
- addHotspotTimeline() {
2447
- if (!this.hotspots || this.hotspotTimeline) return;
2448
- const t = cn(this.container, this.amountX, this.hotspots);
2449
- if (!t) return;
2450
- this.hotspotTimeline = t.element, this.hotspotTimelineIndicator = t.indicator, this.hotspotTimeline.querySelectorAll(".cloudimage-360-hotspot-timeline-dot").forEach((n) => {
2451
- n.addEventListener("click", (o) => {
2452
- o.stopPropagation();
2453
- const s = parseInt(n.getAttribute("data-frame"), 10), l = n.getAttribute("data-hotspot-id");
2454
- isNaN(s) || this.animateToFrame(s, l);
2455
- });
2456
- }), this.updateHotspotTimelinePosition();
2457
- }
2458
- showHotspotTimeline() {
2459
- dn(this.hotspotTimeline);
2460
- }
2461
- hideHotspotTimeline() {
2462
- un(this.hotspotTimeline);
2463
- }
2464
- updateHotspotTimelinePosition() {
2465
- hn(this.hotspotTimelineIndicator, this.activeImageX, this.amountX);
2466
- }
2467
- /**
2468
- * Animates the viewer to a target frame, optionally showing a hotspot popup on arrival
2469
- * @param {number} targetFrame - The frame to animate to
2470
- * @param {string} [hotspotId] - Optional hotspot ID to show popup for after animation
2471
- */
2472
- animateToFrame(t, i) {
2473
- if (this.isAnimatingToFrame || t === this.activeImageX) {
2474
- t === this.activeImageX && i && this.hotspotsInstance && this.hotspotTimelineOnClick && this.hotspotsInstance.showHotspotById(i);
2475
- return;
2476
- }
2477
- this.isAnimatingToFrame = !0, this.hasInteracted = !0, (this.autoplay || this.loopTimeoutId) && (this.stopAutoplay(), this.autoplay = !1), this.inertiaAnimationId && (cancelAnimationFrame(this.inertiaAnimationId), this.inertiaAnimationId = null);
2478
- const n = this.activeImageX, o = (t - n + this.amountX) % this.amountX, s = (n - t + this.amountX) % this.amountX, l = o <= s, r = l ? o : s;
2479
- if (r === 0) {
2480
- this.isAnimatingToFrame = !1;
2481
- return;
2482
- }
2483
- const a = 30;
2484
- let c = r;
2485
- const h = () => {
2486
- if (c <= 0) {
2487
- this.isAnimatingToFrame = !1, i && this.hotspotsInstance && this.hotspotTimelineOnClick && setTimeout(() => {
2488
- this.hotspotsInstance.showHotspotById(i);
2489
- }, 50);
2490
- return;
2491
- }
2492
- l ? this.moveRight() : this.moveLeft(), c--, c > 0 ? setTimeout(h, a) : (this.isAnimatingToFrame = !1, i && this.hotspotsInstance && this.hotspotTimelineOnClick && setTimeout(() => {
2493
- this.hotspotsInstance.showHotspotById(i);
2494
- }, 50));
2495
- };
2496
- h();
2497
- }
2498
- remove360ViewCircleIcon() {
2499
- this.view360CircleIcon && (this.innerBox.removeChild(this.view360CircleIcon), this.view360CircleIcon = null);
2500
- }
2501
- addAllIcons() {
2502
- this.removeLoader(), this.innerBox.style.cursor = "grab", this.pointerZoom && (this.createTransitionOverlay(), this.addLoadingSpinner()), !this.fullscreenView && !this.touchDevice && this.addMagnifierIcon(), this.fullscreenView || this.addFullscreenIcon(), this.initialIconShown && this.addInitialIcon(), this.bottomCircle && this.add360ViewCircleIcon();
2503
- }
2504
- showAllIcons() {
2505
- this.showInitialIcon(), this.show360ViewCircleIcon(), this.showMagnifierIcon(), this.showFullscreenIcon(), this.showHotspotTimeline();
2506
- }
2507
- hideAllIcons() {
2508
- this.hideInitialIcon(), this.hide360ViewCircleIcon(), this.hideMagnifierIcon(), this.hideFullscreenIcon(), this.hideHotspotTimeline();
2509
- }
2510
- removeLoader() {
2511
- this.loader && (this.innerBox.removeChild(this.loader), this.loader = null);
2512
- }
2513
- attachEvents(t, i, n) {
2514
- t && this.addMouseEvents(), i && this.addTouchEvents(), n && this.addKeyboardEvents(), this.addEscKeyHandler();
2515
- }
2516
- removeEvents() {
2517
- this.removeMouseEvents(), this.removeTouchEvents(), this.removeKeyboardEvents(), this.removeEscKeyHandler();
2518
- }
2519
- addMouseEvents() {
2520
- this.boundMouseClick = this.mouseClick.bind(this), this.boundMouseDown = this.mouseDown.bind(this), this.boundMouseMove = de(this.mouseMove.bind(this), ue), this.boundMouseUp = this.mouseUp.bind(this), this.boundMouseLeave = this.mouseLeave.bind(this), this.innerBox.addEventListener("click", this.boundMouseClick), this.innerBox.addEventListener("mousedown", this.boundMouseDown), this.innerBox.addEventListener("mouseleave", this.boundMouseLeave), document.addEventListener("mousemove", this.boundMouseMove), document.addEventListener("mouseup", this.boundMouseUp);
2521
- }
2522
- addTouchEvents() {
2523
- this.boundTouchOutside = this.touchOutside.bind(this), this.boundTouchStart = this.touchStart.bind(this), this.boundTouchEnd = this.touchEnd.bind(this), this.boundTouchMove = de(this.touchMove.bind(this), ue), document.addEventListener("touchstart", this.boundTouchOutside), this.container.addEventListener("touchstart", this.boundTouchStart), this.container.addEventListener("touchend", this.boundTouchEnd), this.container.addEventListener("touchmove", this.boundTouchMove);
2524
- }
2525
- addKeyboardEvents() {
2526
- this.boundKeyDown = this.keyDown.bind(this), this.boundKeyUp = this.keyUp.bind(this), document.addEventListener("keydown", this.boundKeyDown), document.addEventListener("keyup", this.boundKeyUp);
2527
- }
2528
- addEscKeyHandler() {
2529
- this.boundEscHandler = (t) => {
2530
- t.keyCode === 27 && (this.fullscreenView ? this.closeFullscreenModal(t) : this.isZoomed ? this.removeZoom() : this.glass && this.removeGlass());
2531
- }, document.addEventListener("keydown", this.boundEscHandler);
2532
- }
2533
- removeEscKeyHandler() {
2534
- document.removeEventListener("keydown", this.boundEscHandler);
2535
- }
2536
- removeMouseEvents() {
2537
- this.innerBox.removeEventListener("click", this.boundMouseClick), this.innerBox.removeEventListener("mousedown", this.boundMouseDown), this.innerBox.removeEventListener("mouseleave", this.boundMouseLeave), document.removeEventListener("mousemove", this.boundMouseMove), document.removeEventListener("mouseup", this.boundMouseUp);
2538
- }
2539
- removeTouchEvents() {
2540
- document.removeEventListener("touchstart", this.boundTouchOutside), this.container.removeEventListener("touchstart", this.boundTouchStart), this.container.removeEventListener("touchend", this.boundTouchEnd), this.container.removeEventListener("touchmove", this.boundTouchMove);
2541
- }
2542
- removeKeyboardEvents() {
2543
- document.removeEventListener("keydown", this.boundKeyDown), document.removeEventListener("keyup", this.boundKeyUp);
2544
- }
2545
- createContainers(t) {
2546
- this.iconsContainer = ge(this.innerBox), this.canvas = Vi(this.innerBox, t), this.loader = Ui(this.innerBox), this.ariaLiveRegion = qi(this.innerBox);
2547
- const i = this.canvas.transferControlToOffscreen();
2548
- this.canvasWorker.postMessage(
2549
- {
2550
- action: "initCanvas",
2551
- offscreen: i,
2552
- devicePixelRatio: this.devicePixelRatio
2553
- },
2554
- [i]
2555
- ), this.fullscreenView && this.addCloseFullscreenIcon(), Jt(this.innerBox, ".cloudimage-360-placeholder");
2556
- }
2557
- update(t) {
2558
- this.isReady && (this.stopAutoplay(), Jt(this.innerBox, ".cloudimage-360-icons-container"), this.init(this.container, t, !0), this.iconsContainer = ge(this.innerBox), this.onAllImagesLoaded());
2559
- }
2560
- init(t, i, n) {
2561
- const o = i ? Yi(i) : ki(t), {
2562
- folder: s,
2563
- apiVersion: l,
2564
- filenameX: r,
2565
- filenameY: a,
2566
- imageListX: c,
2567
- imageListY: h,
2568
- indexZeroBase: p,
2569
- amountX: f,
2570
- amountY: u,
2571
- draggable: I = !0,
2572
- swipeable: g = !0,
2573
- keys: v,
2574
- keysReverse: m,
2575
- bottomCircleOffset: b,
2576
- autoplay: x,
2577
- autoplayBehavior: w,
2578
- playOnce: C,
2579
- speed: y,
2580
- autoplayReverse: O,
2581
- fullscreen: S,
2582
- magnifier: E,
2583
- ciToken: A,
2584
- ciFilters: L,
2585
- ciTransformation: R,
2586
- lazyload: T,
2587
- dragSpeed: G,
2588
- stopAtEdges: z,
2589
- pointerZoom: Y,
2590
- imageInfo: Z = "black",
2591
- initialIconShown: rt,
2592
- bottomCircle: U,
2593
- hotspots: at,
2594
- dragReverse: vt,
2595
- hide360Logo: tt,
2596
- logoSrc: lt,
2597
- inertia: Q,
2598
- pinchZoom: V,
2599
- hints: et,
2600
- theme: it,
2601
- hotspotTimelineOnClick: _ = !0,
2602
- // Event callbacks
2603
- onReady: gt,
2604
- onLoad: Vt,
2605
- onSpin: yt,
2606
- onAutoplayStart: jt,
2607
- onAutoplayStop: Yt,
2608
- onFullscreenOpen: $t,
2609
- onFullscreenClose: Gt,
2610
- onZoomIn: Xt,
2611
- onZoomOut: Pt,
2612
- onDragStart: zt,
2613
- onDragEnd: Ut,
2614
- onError: K
2615
- } = o, nt = { ciToken: A, ciFilters: L, ciTransformation: R }, ct = Qt(c, []), ht = Qt(h, []);
2616
- if (this.viewerConfig = o, this.amountX = ct.length || f, this.amountY = ht.length || u, this.allowSpinX = !!this.amountX, this.allowSpinY = !!this.amountY, this.activeImageX = O ? this.amountX - 1 : 0, this.activeImageY = O ? this.amountY - 1 : 0, this.bottomCircleOffset = b, this.autoplay = x, this.autoplayBehavior = w, this.playOnce = C, this.speed = y, this.autoplayReverse = O, this.fullscreen = S, this.magnifier = E > 1 ? Math.min(E, Ai) : 0, this.dragSpeed = Math.max(G, Si), this.stopAtEdges = z, this.ciParams = nt, this.apiVersion = l, this.pointerZoom = Y > 1 ? Math.min(Y, me) : null, this.keysReverse = m, this.info = Z, this.keys = v, this.innerBox = this.innerBox ?? Gi(this.container), this.initialIconShown = rt, this.bottomCircle = U, this.spinDirection = Sn(this.autoplayBehavior, this.allowSpinX, this.allowSpinY), this.dragReverse = vt, this.hotspots = at, this.hide360Logo = tt, this.logoSrc = lt, this.inertia = Q, this.pinchZoom = V, this.hints = et, this.hotspotTimelineOnClick = _, it === "dark" ? this.container.classList.add("ci360-theme-dark") : it === "light" && this.container.classList.remove("ci360-theme-dark"), this.onReady = gt, this.onLoad = Vt, this.onSpin = yt, this.onAutoplayStart = jt, this.onAutoplayStop = Yt, this.onFullscreenOpen = $t, this.onFullscreenClose = Gt, this.onZoomIn = Xt, this.onZoomOut = Pt, this.onDragStart = zt, this.onDragEnd = Ut, this.onError = K, this.srcXConfig = {
2617
- folder: s,
2618
- filename: r,
2619
- imageList: ct,
2620
- container: t,
2621
- innerBox: this.innerBox,
2622
- apiVersion: l,
2623
- ciParams: nt,
2624
- lazyload: T,
2625
- amount: this.amountX,
2626
- indexZeroBase: p,
2627
- autoplayReverse: O,
2628
- orientation: P.X
2629
- }, this.srcYConfig = {
2630
- ...this.srcXConfig,
2631
- filename: a,
2632
- imageList: ht,
2633
- orientation: P.Y,
2634
- amount: this.amountY
2635
- }, n && this.removeEvents(), this.attachEvents(I, g, v), n) return;
2636
- const dt = (this.fullscreenView ? document.body : this.container).offsetWidth, bt = this.allowSpinX && !ct.length ? Ot(this.srcXConfig, dt) : null, wt = this.allowSpinY && !ht.length ? Ot(this.srcYConfig, dt) : null, It = (Rt) => {
2637
- ve({
2638
- cdnPathX: bt,
2639
- cdnPathY: wt,
2640
- configX: this.srcXConfig,
2641
- configY: this.srcYConfig,
2642
- onImageLoad: (xt, Je, Qe) => this.onImageLoad(xt, Je, Qe),
2643
- onFirstImageLoad: (xt) => this.onFirstImageLoaded(Rt, xt),
2644
- onAllImagesLoad: this.onAllImagesLoaded.bind(this),
2645
- onError: (xt) => this.emit("onError", xt)
2646
- });
2647
- };
2648
- this.allowSpinX ? xe(bt, this.srcXConfig, It) : this.allowSpinY && xe(wt, this.srcYConfig, It);
2649
- }
2650
- }
2651
- class Jo {
2652
- constructor() {
2653
- this.views = /* @__PURE__ */ new Map(), this.initAll = this.initAll.bind(this), this.getViews = this.getViews.bind(this);
2654
- }
2655
- generateId() {
2656
- return `ci360-${Math.random().toString(36).slice(2, 11)}`;
2657
- }
2658
- init(t, i, n) {
2659
- if (!t) return;
2660
- const o = t.id || this.generateId();
2661
- t.id || (t.id = o);
2662
- const s = new Ft(t, i, n);
2663
- return this.views.set(o, s), s;
2664
- }
2665
- initAll(t = "cloudimage-360") {
2666
- [...document.querySelectorAll(`.${t}`)].filter(Boolean).forEach((n) => {
2667
- const o = n.id || this.generateId();
2668
- n.id || (n.id = o);
2669
- const s = new Ft(n);
2670
- this.views.set(o, s);
2671
- });
2672
- }
2673
- destroy(t) {
2674
- const i = this.getViewById(t);
2675
- i && (i.destroy(), this.views.delete(t));
2676
- }
2677
- destroyAll() {
2678
- this.views.forEach((t) => {
2679
- t.destroy();
2680
- }), this.views.clear();
2681
- }
2682
- getViewById(t) {
2683
- return this.views.get(t);
2684
- }
2685
- getViews() {
2686
- return Array.from(this.views.values());
2687
- }
2688
- updateView(t, i) {
2689
- const n = this.getViewById(t);
2690
- if (!n) return null;
2691
- const o = { ...n.viewerConfig, ...i };
2692
- n.destroy();
2693
- const s = document.getElementById(t);
2694
- return this.init(s, o);
2695
- }
2696
- }
2697
- window.CI360 = Jo;
2698
- export {
2699
- Jo as default
2700
- };
35
+ `,o},Ee=(e,t,i)=>{const{innerBox:o,imageList:n,lazyload:s}=t||{},[l]=n,r=l||mo(e,t),a=ho(r),c=Oe(a,s,"cloudimage-lazy"),h=Oe(a,!1,"cloudimage-360-placeholder"),u=f=>{$t(o,".cloudimage-lazy"),i&&i({event:f,width:c.width,height:c.height,naturalWidth:c.naturalWidth,naturalHeight:c.naturalHeight,src:a})};c.onload=u,o.appendChild(c),o.appendChild(h),po(c)},vo=(e,t,i)=>{const o=new Image;o.src=e,o.onload=n=>{t&&t({event:n,width:o.width,height:o.height,naturalWidth:o.naturalWidth,naturalHeight:o.naturalHeight,src:e})},o.onerror=n=>{const s=new Error(`Failed to load image: ${e}`);s.url=e,s.event=n,i?i(s):console.error(s.message)}},go=(e,t)=>{const i=t.getBoundingClientRect(),o=e.touches?e.touches[0].clientX:e.clientX,n=e.touches?e.touches[0].clientY:e.clientY;return{x:o-i.left,y:n-i.top}},Ut=(e,t,i)=>{const{container:o,w:n,h:s,zoom:l,bw:r,offsetX:a,offsetY:c}=t,h=go(e,o);let u=h.x,f=h.y;u=Math.max(n/l,Math.min(u,o.offsetWidth-n/l)),f=Math.max(s/l,Math.min(f,o.offsetHeight-s/l)),i.style.left=`${u-n}px`,i.style.top=`${f-s}px`;const p=(u-a)*l-n+r,x=(f-c)*l-s+r;i.style.backgroundPosition=`-${p}px -${x}px`},bo=(e,t,i,o,n,s)=>{const{x:l=0,y:r=0}=i||{},a=(t.offsetWidth-l*2)*s,c=(t.offsetHeight-r*2)*s;if(!n)return;n.setAttribute("class","cloudimage-360-img-magnifier-glass"),t.prepend(n),n.style.backgroundImage=`url('${o.src}')`,n.style.backgroundSize=`${a}px ${c}px`;const h=3,u=n.offsetWidth/2,f=n.offsetHeight/2,p={container:t,w:u,h:f,zoom:s,bw:h,offsetX:l,offsetY:r};Ut(e,p,n);const x=v=>{Ut(v,p,n)},g=v=>{v.preventDefault(),Ut(v,p,n)};n.addEventListener("mousemove",x),t.addEventListener("mousemove",x),t.addEventListener("touchmove",g)},yo=(e,t,i)=>{const{clientX:o,clientY:n}=e,s=t.getBoundingClientRect(),l=t.width/(s.width*i),r=t.height/(s.height*i),a=(o-s.left)*l,c=(n-s.top)*r;return{offsetX:a,offsetY:c}},Se=(e,{bottom:t,top:i})=>{e?t():i()},Ae=(e,{left:t,right:i})=>{e?t():i()},wo=({autoplayBehavior:e,spinY:t,reversed:i,loopTriggers:o})=>{switch(e){case R.SPIN_XY:case R.SPIN_YX:t?Se(i,o):Ae(i,o);break;case R.SPIN_Y:Se(i,o);break;case R.SPIN_X:default:Ae(i,o)}},xo=({autoplayBehavior:e,activeImageX:t,activeImageY:i,amountX:o,amountY:n,autoplayReverse:s})=>{const l=(r,a)=>{const c=a-1;return s?r===0:r===c};switch(e){case R.SPIN_XY:case R.SPIN_Y:return l(i,n);case R.SPIN_X:case R.SPIN_YX:default:return l(t,o)}},Io=({autoplayBehavior:e,activeImageX:t,activeImageY:i,amountX:o,amountY:n,autoplayReverse:s,spinDirection:l})=>{const r=t===(s?0:o-1),a=i===(s?0:n-1);return e===R.SPIN_XY||e===R.SPIN_YX?l==="x"&&r||l==="y"&&a:!1},Co=(e,t,i)=>{if(!i)return"x";if(!t)return"y";switch(e){case R.SPIN_XY:return"x";case R.SPIN_YX:return"y";case R.SPIN_Y:return"y";case R.SPIN_X:default:return"x"}},ko=e=>e==="x"?"y":"x",Le=(e,t)=>{const i=[...yi];return t?[...i,...wi].includes(e):i.includes(e)},Te=({deltaX:e,deltaY:t,reversed:i,allowSpinX:o,allowSpinY:n,threshold:s=0})=>{const l=o&&!n||n&&!o?0:s,r=Math.abs(e),a=Math.abs(t);return o&&r-l>a?i?e>0?"left":"right":e>0?"right":"left":n&&a-l>r?i?t>0?"up":"down":t>0?"down":"up":null},Oo=()=>"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,Eo=(e,t=150)=>{let i;return function(...o){clearTimeout(i),i=setTimeout(()=>{e.apply(this,o)},t)}},Ye="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IHY9KHQsYSxlKT0+e2NvbnN0IHM9dC9lLG49YS9lO3JldHVybnt6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpufX0sej0oe3BvaW50ZXJYOnQscG9pbnRlclk6YSxpbWFnZURhdGE6ZSx6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpuLGRyYXdXaWR0aDppLGRyYXdIZWlnaHQ6Y30pPT57Y29uc3R7bmF0dXJhbFdpZHRoOmcsbmF0dXJhbEhlaWdodDp1fT1lO2xldCBmPXQvaSpnLXMvMixtPWEvYyp1LW4vMjtjb25zdCB4PU1hdGgubWF4KDAsZy1zKSxPPU1hdGgubWF4KDAsdS1uKTtyZXR1cm4gZj1NYXRoLm1heCgwLE1hdGgubWluKGYseCkpLG09TWF0aC5tYXgoMCxNYXRoLm1pbihtLE8pKSx7em9vbU9mZnNldFg6Zix6b29tT2Zmc2V0WTptfX07bGV0IG8saCxyLGQsbCx3O3NlbGYub25tZXNzYWdlPWFzeW5jIHQ9Pntjb25zdHthY3Rpb246YSxvZmZzY3JlZW46ZSxkZXZpY2VQaXhlbFJhdGlvOnMsaW1hZ2VEYXRhOm4sem9vbVNjYWxlOmkscG9pbnRlclg6Yyxwb2ludGVyWTpnLGltYWdlQXNwZWN0UmF0aW86dSxjb250YWluZXJXaWR0aDpmLGNvbnRhaW5lckhlaWdodDptfT10LmRhdGE7c3dpdGNoKGEpe2Nhc2UiaW5pdENhbnZhcyI6QyhlLHMpO2JyZWFrO2Nhc2UiYWRhcHRDYW52YXNTaXplIjpwKHUsZixtKTticmVhaztjYXNlImRyYXdJbWFnZU9uQ2FudmFzIjpJKG4saSxjLGcpO2JyZWFrfX07Y29uc3QgQz0odCxhKT0+e289dCxoPW8uZ2V0Q29udGV4dCgiMmQiKSxyPWF9LHA9KHQsYSxlKT0+e2NvbnN0IHM9YS9lO3c9dD5zLG8ud2lkdGg9YSpyLG8uaGVpZ2h0PWUqcixoLnNjYWxlKHIsciksdz8oZD1hLGw9YS90KToobD1lLGQ9ZSp0KSxoLmltYWdlU21vb3RoaW5nRW5hYmxlZD0hMCxoLmltYWdlU21vb3RoaW5nUXVhbGl0eT0iaGlnaCJ9LEk9KHQ9e30sYT0xLGU9MCxzPTApPT57Y29uc3R7Yml0bWFwSW1hZ2U6bn09dDtpZighb3x8IW4pcmV0dXJuO2xldCBpLGM7aWYodz8oaT0wLGM9KG8uaGVpZ2h0L3ItbCkvMik6KGk9KG8ud2lkdGgvci1kKS8yLGM9MCksaC5jbGVhclJlY3QoMCwwLG8ud2lkdGgsby5oZWlnaHQpLGEhPT0xKXtjb25zdHtuYXR1cmFsV2lkdGg6ZyxuYXR1cmFsSGVpZ2h0OnV9PXQse3pvb21lZFdpZHRoOmYsem9vbWVkSGVpZ2h0Om19PXYoZyx1LGEpLHt6b29tT2Zmc2V0WDp4LHpvb21PZmZzZXRZOk99PXooe3BvaW50ZXJYOmUscG9pbnRlclk6cyxpbWFnZURhdGE6dCx6b29tZWRXaWR0aDpmLHpvb21lZEhlaWdodDptLGRyYXdXaWR0aDpkLGRyYXdIZWlnaHQ6bH0pO2guZHJhd0ltYWdlKG4seCxPLGYsbSxpLGMsZCxsKX1lbHNlIGguZHJhd0ltYWdlKG4saSxjLGQsbCl9fSkoKTsK",So=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),Xe=typeof self<"u"&&self.Blob&&new Blob([So(Ye)],{type:"text/javascript;charset=utf-8"});function Ao(e){let t;try{if(t=Xe&&(self.URL||self.webkitURL).createObjectURL(Xe),!t)throw"";const i=new Worker(t,{name:e==null?void 0:e.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),i}catch{return new Worker("data:text/javascript;base64,"+Ye,{name:e==null?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}const Lo=new Set(["p","span","div","br","hr","strong","em","b","i","u","s","h1","h2","h3","h4","h5","h6","ul","ol","li","a","img","button","table","thead","tbody","tr","th","td","blockquote","pre","code","label","input","select","option","textarea","svg","path","circle","rect","line","polyline","polygon","ellipse","g","text","tspan","defs","use","symbol","clippath","mask","lineargradient","radialgradient","stop"]),Pe={a:["href","title","target","rel"],img:["src","alt","title","width","height"],button:["type","disabled","name","value"],input:["type","name","value","placeholder","disabled","readonly","checked","min","max","step"],select:["name","disabled","multiple"],option:["value","disabled","selected"],textarea:["name","placeholder","disabled","readonly","rows","cols"],label:["for"],svg:["viewbox","width","height","fill","stroke","xmlns","preserveaspectratio"],path:["d","fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","transform"],circle:["cx","cy","r","fill","stroke","stroke-width"],rect:["x","y","width","height","rx","ry","fill","stroke","stroke-width"],line:["x1","y1","x2","y2","stroke","stroke-width"],polyline:["points","fill","stroke","stroke-width"],polygon:["points","fill","stroke","stroke-width"],ellipse:["cx","cy","rx","ry","fill","stroke","stroke-width"],g:["transform","fill","stroke"],text:["x","y","dx","dy","text-anchor","fill","font-size","font-family","font-weight"],tspan:["x","y","dx","dy"],use:["href","xlink:href","x","y","width","height"],lineargradient:["id","x1","y1","x2","y2","gradientunits"],radialgradient:["id","cx","cy","r","fx","fy","gradientunits"],stop:["offset","stop-color","stop-opacity"],clippath:["id"],mask:["id"],"*":["class","id","style"]},To=[/javascript:/gi,/vbscript:/gi,/data:/gi,/on\w+\s*=/gi],Yo=e=>{if(typeof e!="string")return"";const t=document.createElement("template");t.innerHTML=e;const i=o=>{if(Array.from(o.childNodes).forEach(i),o.nodeType===Node.ELEMENT_NODE){const s=o.tagName.toLowerCase();if(!Lo.has(s)){if(s==="script"||s==="style"){o.remove();return}const a=document.createTextNode(o.textContent);o.parentNode.replaceChild(a,o);return}const l=[...Pe[s]||[],...Pe["*"]||[]];if(Array.from(o.attributes).forEach(a=>{const c=a.name.toLowerCase();if(c.startsWith("on")){o.removeAttribute(a.name);return}if(!l.includes(c)){o.removeAttribute(a.name);return}let h=a.value;To.forEach(u=>{u.test(h)&&o.removeAttribute(a.name)})}),s==="a"){const a=o.getAttribute("href");a&&(/^(https?:|mailto:|tel:|#|\/)/i.test(a.trim())||o.removeAttribute("href")),o.getAttribute("target")==="_blank"&&o.setAttribute("rel","noopener noreferrer")}if(s==="img"){const a=o.getAttribute("src");a&&(/^(https?:|\/|data:image\/)/i.test(a.trim())||o.removeAttribute("src"))}}};return i(t.content),t.innerHTML},Xo=e=>e==="x"?Y.X:Y.Y,Po=(e,t,i)=>e.filter(o=>Xo(o.orientation)===i&&t in o.positions),Ro=(e,t)=>{const i=document.createElement("button");return i.id=e,i.className="cloudimage-360-hotspot",i.dataset.hotspotId=e,i.setAttribute("type","button"),i.setAttribute("aria-label",t||`Hotspot ${e}`),i.setAttribute("aria-haspopup","true"),i.setAttribute("aria-expanded","false"),i},Mo=e=>{const t=Object.entries(e).sort(([s],[l])=>Number(s)-Number(l));let i=null,o=null;const n={};for(const[s,l]of t)if(!l)n[s]={x:i,y:o};else{const{x:r,y:a}=l;r!=null&&(i=r),a!=null&&(o=a),n[s]={x:r||i,y:a||o}}return n},Ho=e=>[{name:"offset",options:{offset:[0,10]}},{name:"preventOverflow",options:{boundary:e}}],Do=(e,t)=>{const i=document.createElement("div");return i.className="cloudimage-360-popper",i.id=`cloudimage-360-popper-${t}`,i.dataset.popperId=t,i.setAttribute("role","tooltip"),i.setAttribute("aria-hidden","false"),typeof e=="string"&&/<\/?[a-z][\s\S]*>/i.test(e)?i.innerHTML=Yo(e):i.textContent=e,document.body.appendChild(i),i},Zo=e=>{const t=[...e];return t.forEach((i,o)=>{const n={...Mo(i.positions)};t[o].initialPositions=n,t[o].positions=n}),t},Bo=({newWidth:e,newHeight:t,initialContainerSize:i,imageAspectRatio:o,hotspotsConfig:n})=>{const[s,l]=i;let r=e,a=t,c=0,h=0;const u=e/t;o>u?(a=e/o,h=(t-a)/2):(r=t*o,c=(e-r)/2);const p=r/s,x=a/l;return n.map(g=>{const v={};return Object.entries(g.initialPositions).forEach(([m,y])=>{v[m]={x:y.x*p+c,y:y.y*x+h}}),{...g,positions:v}})};var H="top",F="bottom",z="right",D="left",_t="auto",wt=[H,F,z,D],ct="start",xt="end",Wo="clippingParents",Re="viewport",It="popper",Fo="reference",Me=wt.reduce(function(e,t){return e.concat([t+"-"+ct,t+"-"+xt])},[]),He=[].concat(wt,[_t]).reduce(function(e,t){return e.concat([t,t+"-"+ct,t+"-"+xt])},[]),zo="beforeRead",No="read",Vo="afterRead",jo="beforeMain",$o="main",Go="afterMain",Uo="beforeWrite",_o="write",Ko="afterWrite",Jo=[zo,No,Vo,jo,$o,Go,Uo,_o,Ko];function V(e){return e?(e.nodeName||"").toLowerCase():null}function Z(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function it(e){var t=Z(e).Element;return e instanceof t||e instanceof Element}function N(e){var t=Z(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Kt(e){if(typeof ShadowRoot>"u")return!1;var t=Z(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function Qo(e){var t=e.state;Object.keys(t.elements).forEach(function(i){var o=t.styles[i]||{},n=t.attributes[i]||{},s=t.elements[i];!N(s)||!V(s)||(Object.assign(s.style,o),Object.keys(n).forEach(function(l){var r=n[l];r===!1?s.removeAttribute(l):s.setAttribute(l,r===!0?"":r)}))})}function qo(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow),function(){Object.keys(t.elements).forEach(function(o){var n=t.elements[o],s=t.attributes[o]||{},l=Object.keys(t.styles.hasOwnProperty(o)?t.styles[o]:i[o]),r=l.reduce(function(a,c){return a[c]="",a},{});!N(n)||!V(n)||(Object.assign(n.style,r),Object.keys(s).forEach(function(a){n.removeAttribute(a)}))})}}const tn={name:"applyStyles",enabled:!0,phase:"write",fn:Qo,effect:qo,requires:["computeStyles"]};function j(e){return e.split("-")[0]}var ot=Math.max,Ht=Math.min,ht=Math.round;function Jt(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function De(){return!/^((?!chrome|android).)*safari/i.test(Jt())}function dt(e,t,i){t===void 0&&(t=!1),i===void 0&&(i=!1);var o=e.getBoundingClientRect(),n=1,s=1;t&&N(e)&&(n=e.offsetWidth>0&&ht(o.width)/e.offsetWidth||1,s=e.offsetHeight>0&&ht(o.height)/e.offsetHeight||1);var l=it(e)?Z(e):window,r=l.visualViewport,a=!De()&&i,c=(o.left+(a&&r?r.offsetLeft:0))/n,h=(o.top+(a&&r?r.offsetTop:0))/s,u=o.width/n,f=o.height/s;return{width:u,height:f,top:h,right:c+u,bottom:h+f,left:c,x:c,y:h}}function Qt(e){var t=dt(e),i=e.offsetWidth,o=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-o)<=1&&(o=t.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:o}}function Ze(e,t){var i=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(i&&Kt(i)){var o=t;do{if(o&&e.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function G(e){return Z(e).getComputedStyle(e)}function en(e){return["table","td","th"].indexOf(V(e))>=0}function tt(e){return((it(e)?e.ownerDocument:e.document)||window.document).documentElement}function Dt(e){return V(e)==="html"?e:e.assignedSlot||e.parentNode||(Kt(e)?e.host:null)||tt(e)}function Be(e){return!N(e)||G(e).position==="fixed"?null:e.offsetParent}function on(e){var t=/firefox/i.test(Jt()),i=/Trident/i.test(Jt());if(i&&N(e)){var o=G(e);if(o.position==="fixed")return null}var n=Dt(e);for(Kt(n)&&(n=n.host);N(n)&&["html","body"].indexOf(V(n))<0;){var s=G(n);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return n;n=n.parentNode}return null}function Ct(e){for(var t=Z(e),i=Be(e);i&&en(i)&&G(i).position==="static";)i=Be(i);return i&&(V(i)==="html"||V(i)==="body"&&G(i).position==="static")?t:i||on(e)||t}function qt(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function kt(e,t,i){return ot(e,Ht(t,i))}function nn(e,t,i){var o=kt(e,t,i);return o>i?i:o}function We(){return{top:0,right:0,bottom:0,left:0}}function Fe(e){return Object.assign({},We(),e)}function ze(e,t){return t.reduce(function(i,o){return i[o]=e,i},{})}var sn=function(t,i){return t=typeof t=="function"?t(Object.assign({},i.rects,{placement:i.placement})):t,Fe(typeof t!="number"?t:ze(t,wt))};function rn(e){var t,i=e.state,o=e.name,n=e.options,s=i.elements.arrow,l=i.modifiersData.popperOffsets,r=j(i.placement),a=qt(r),c=[D,z].indexOf(r)>=0,h=c?"height":"width";if(!(!s||!l)){var u=sn(n.padding,i),f=Qt(s),p=a==="y"?H:D,x=a==="y"?F:z,g=i.rects.reference[h]+i.rects.reference[a]-l[a]-i.rects.popper[h],v=l[a]-i.rects.reference[a],m=Ct(s),y=m?a==="y"?m.clientHeight||0:m.clientWidth||0:0,I=g/2-v/2,w=u[p],C=y-f[h]-u[x],b=y/2-f[h]/2+I,k=kt(w,b,C),E=a;i.modifiersData[o]=(t={},t[E]=k,t.centerOffset=k-b,t)}}function an(e){var t=e.state,i=e.options,o=i.element,n=o===void 0?"[data-popper-arrow]":o;n!=null&&(typeof n=="string"&&(n=t.elements.popper.querySelector(n),!n)||Ze(t.elements.popper,n)&&(t.elements.arrow=n))}const ln={name:"arrow",enabled:!0,phase:"main",fn:rn,effect:an,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function pt(e){return e.split("-")[1]}var cn={top:"auto",right:"auto",bottom:"auto",left:"auto"};function hn(e,t){var i=e.x,o=e.y,n=t.devicePixelRatio||1;return{x:ht(i*n)/n||0,y:ht(o*n)/n||0}}function Ne(e){var t,i=e.popper,o=e.popperRect,n=e.placement,s=e.variation,l=e.offsets,r=e.position,a=e.gpuAcceleration,c=e.adaptive,h=e.roundOffsets,u=e.isFixed,f=l.x,p=f===void 0?0:f,x=l.y,g=x===void 0?0:x,v=typeof h=="function"?h({x:p,y:g}):{x:p,y:g};p=v.x,g=v.y;var m=l.hasOwnProperty("x"),y=l.hasOwnProperty("y"),I=D,w=H,C=window;if(c){var b=Ct(i),k="clientHeight",E="clientWidth";if(b===Z(i)&&(b=tt(i),G(b).position!=="static"&&r==="absolute"&&(k="scrollHeight",E="scrollWidth")),b=b,n===H||(n===D||n===z)&&s===xt){w=F;var O=u&&b===C&&C.visualViewport?C.visualViewport.height:b[k];g-=O-o.height,g*=a?1:-1}if(n===D||(n===H||n===F)&&s===xt){I=z;var S=u&&b===C&&C.visualViewport?C.visualViewport.width:b[E];p-=S-o.width,p*=a?1:-1}}var L=Object.assign({position:r},c&&cn),M=h===!0?hn({x:p,y:g},Z(i)):{x:p,y:g};if(p=M.x,g=M.y,a){var T;return Object.assign({},L,(T={},T[w]=y?"0":"",T[I]=m?"0":"",T.transform=(C.devicePixelRatio||1)<=1?"translate("+p+"px, "+g+"px)":"translate3d("+p+"px, "+g+"px, 0)",T))}return Object.assign({},L,(t={},t[w]=y?g+"px":"",t[I]=m?p+"px":"",t.transform="",t))}function dn(e){var t=e.state,i=e.options,o=i.gpuAcceleration,n=o===void 0?!0:o,s=i.adaptive,l=s===void 0?!0:s,r=i.roundOffsets,a=r===void 0?!0:r,c={placement:j(t.placement),variation:pt(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:n,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Ne(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:l,roundOffsets:a})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Ne(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const pn={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:dn,data:{}};var Zt={passive:!0};function un(e){var t=e.state,i=e.instance,o=e.options,n=o.scroll,s=n===void 0?!0:n,l=o.resize,r=l===void 0?!0:l,a=Z(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&c.forEach(function(h){h.addEventListener("scroll",i.update,Zt)}),r&&a.addEventListener("resize",i.update,Zt),function(){s&&c.forEach(function(h){h.removeEventListener("scroll",i.update,Zt)}),r&&a.removeEventListener("resize",i.update,Zt)}}const fn={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:un,data:{}};var mn={left:"right",right:"left",bottom:"top",top:"bottom"};function Bt(e){return e.replace(/left|right|bottom|top/g,function(t){return mn[t]})}var vn={start:"end",end:"start"};function Ve(e){return e.replace(/start|end/g,function(t){return vn[t]})}function te(e){var t=Z(e),i=t.pageXOffset,o=t.pageYOffset;return{scrollLeft:i,scrollTop:o}}function ee(e){return dt(tt(e)).left+te(e).scrollLeft}function gn(e,t){var i=Z(e),o=tt(e),n=i.visualViewport,s=o.clientWidth,l=o.clientHeight,r=0,a=0;if(n){s=n.width,l=n.height;var c=De();(c||!c&&t==="fixed")&&(r=n.offsetLeft,a=n.offsetTop)}return{width:s,height:l,x:r+ee(e),y:a}}function bn(e){var t,i=tt(e),o=te(e),n=(t=e.ownerDocument)==null?void 0:t.body,s=ot(i.scrollWidth,i.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),l=ot(i.scrollHeight,i.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),r=-o.scrollLeft+ee(e),a=-o.scrollTop;return G(n||i).direction==="rtl"&&(r+=ot(i.clientWidth,n?n.clientWidth:0)-s),{width:s,height:l,x:r,y:a}}function ie(e){var t=G(e),i=t.overflow,o=t.overflowX,n=t.overflowY;return/auto|scroll|overlay|hidden/.test(i+n+o)}function je(e){return["html","body","#document"].indexOf(V(e))>=0?e.ownerDocument.body:N(e)&&ie(e)?e:je(Dt(e))}function Ot(e,t){var i;t===void 0&&(t=[]);var o=je(e),n=o===((i=e.ownerDocument)==null?void 0:i.body),s=Z(o),l=n?[s].concat(s.visualViewport||[],ie(o)?o:[]):o,r=t.concat(l);return n?r:r.concat(Ot(Dt(l)))}function oe(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function yn(e,t){var i=dt(e,!1,t==="fixed");return i.top=i.top+e.clientTop,i.left=i.left+e.clientLeft,i.bottom=i.top+e.clientHeight,i.right=i.left+e.clientWidth,i.width=e.clientWidth,i.height=e.clientHeight,i.x=i.left,i.y=i.top,i}function $e(e,t,i){return t===Re?oe(gn(e,i)):it(t)?yn(t,i):oe(bn(tt(e)))}function wn(e){var t=Ot(Dt(e)),i=["absolute","fixed"].indexOf(G(e).position)>=0,o=i&&N(e)?Ct(e):e;return it(o)?t.filter(function(n){return it(n)&&Ze(n,o)&&V(n)!=="body"}):[]}function xn(e,t,i,o){var n=t==="clippingParents"?wn(e):[].concat(t),s=[].concat(n,[i]),l=s[0],r=s.reduce(function(a,c){var h=$e(e,c,o);return a.top=ot(h.top,a.top),a.right=Ht(h.right,a.right),a.bottom=Ht(h.bottom,a.bottom),a.left=ot(h.left,a.left),a},$e(e,l,o));return r.width=r.right-r.left,r.height=r.bottom-r.top,r.x=r.left,r.y=r.top,r}function Ge(e){var t=e.reference,i=e.element,o=e.placement,n=o?j(o):null,s=o?pt(o):null,l=t.x+t.width/2-i.width/2,r=t.y+t.height/2-i.height/2,a;switch(n){case H:a={x:l,y:t.y-i.height};break;case F:a={x:l,y:t.y+t.height};break;case z:a={x:t.x+t.width,y:r};break;case D:a={x:t.x-i.width,y:r};break;default:a={x:t.x,y:t.y}}var c=n?qt(n):null;if(c!=null){var h=c==="y"?"height":"width";switch(s){case ct:a[c]=a[c]-(t[h]/2-i[h]/2);break;case xt:a[c]=a[c]+(t[h]/2-i[h]/2);break}}return a}function Et(e,t){t===void 0&&(t={});var i=t,o=i.placement,n=o===void 0?e.placement:o,s=i.strategy,l=s===void 0?e.strategy:s,r=i.boundary,a=r===void 0?Wo:r,c=i.rootBoundary,h=c===void 0?Re:c,u=i.elementContext,f=u===void 0?It:u,p=i.altBoundary,x=p===void 0?!1:p,g=i.padding,v=g===void 0?0:g,m=Fe(typeof v!="number"?v:ze(v,wt)),y=f===It?Fo:It,I=e.rects.popper,w=e.elements[x?y:f],C=xn(it(w)?w:w.contextElement||tt(e.elements.popper),a,h,l),b=dt(e.elements.reference),k=Ge({reference:b,element:I,placement:n}),E=oe(Object.assign({},I,k)),O=f===It?E:b,S={top:C.top-O.top+m.top,bottom:O.bottom-C.bottom+m.bottom,left:C.left-O.left+m.left,right:O.right-C.right+m.right},L=e.modifiersData.offset;if(f===It&&L){var M=L[n];Object.keys(S).forEach(function(T){var U=[z,F].indexOf(T)>=0?1:-1,_=[H,F].indexOf(T)>=0?"y":"x";S[T]+=M[_]*U})}return S}function In(e,t){t===void 0&&(t={});var i=t,o=i.placement,n=i.boundary,s=i.rootBoundary,l=i.padding,r=i.flipVariations,a=i.allowedAutoPlacements,c=a===void 0?He:a,h=pt(o),u=h?r?Me:Me.filter(function(x){return pt(x)===h}):wt,f=u.filter(function(x){return c.indexOf(x)>=0});f.length===0&&(f=u);var p=f.reduce(function(x,g){return x[g]=Et(e,{placement:g,boundary:n,rootBoundary:s,padding:l})[j(g)],x},{});return Object.keys(p).sort(function(x,g){return p[x]-p[g]})}function Cn(e){if(j(e)===_t)return[];var t=Bt(e);return[Ve(e),t,Ve(t)]}function kn(e){var t=e.state,i=e.options,o=e.name;if(!t.modifiersData[o]._skip){for(var n=i.mainAxis,s=n===void 0?!0:n,l=i.altAxis,r=l===void 0?!0:l,a=i.fallbackPlacements,c=i.padding,h=i.boundary,u=i.rootBoundary,f=i.altBoundary,p=i.flipVariations,x=p===void 0?!0:p,g=i.allowedAutoPlacements,v=t.options.placement,m=j(v),y=m===v,I=a||(y||!x?[Bt(v)]:Cn(v)),w=[v].concat(I).reduce(function(et,$){return et.concat(j($)===_t?In(t,{placement:$,boundary:h,rootBoundary:u,padding:c,flipVariations:x,allowedAutoPlacements:g}):$)},[]),C=t.rects.reference,b=t.rects.popper,k=new Map,E=!0,O=w[0],S=0;S<w.length;S++){var L=w[S],M=j(L),T=pt(L)===ct,U=[H,F].indexOf(M)>=0,_=U?"width":"height",P=Et(t,{placement:L,boundary:h,rootBoundary:u,altBoundary:f,padding:c}),B=U?T?z:D:T?F:H;C[_]>b[_]&&(B=Bt(B));var ut=Bt(B),K=[];if(s&&K.push(P[M]<=0),r&&K.push(P[B]<=0,P[ut]<=0),K.every(function(et){return et})){O=L,E=!1;break}k.set(L,K)}if(E)for(var ft=x?3:1,St=function($){var st=w.find(function(rt){var J=k.get(rt);if(J)return J.slice(0,$).every(function(At){return At})});if(st)return O=st,"break"},nt=ft;nt>0;nt--){var mt=St(nt);if(mt==="break")break}t.placement!==O&&(t.modifiersData[o]._skip=!0,t.placement=O,t.reset=!0)}}const On={name:"flip",enabled:!0,phase:"main",fn:kn,requiresIfExists:["offset"],data:{_skip:!1}};function Ue(e,t,i){return i===void 0&&(i={x:0,y:0}),{top:e.top-t.height-i.y,right:e.right-t.width+i.x,bottom:e.bottom-t.height+i.y,left:e.left-t.width-i.x}}function _e(e){return[H,z,F,D].some(function(t){return e[t]>=0})}function En(e){var t=e.state,i=e.name,o=t.rects.reference,n=t.rects.popper,s=t.modifiersData.preventOverflow,l=Et(t,{elementContext:"reference"}),r=Et(t,{altBoundary:!0}),a=Ue(l,o),c=Ue(r,n,s),h=_e(a),u=_e(c);t.modifiersData[i]={referenceClippingOffsets:a,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":u})}const Sn={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:En};function An(e,t,i){var o=j(e),n=[D,H].indexOf(o)>=0?-1:1,s=typeof i=="function"?i(Object.assign({},t,{placement:e})):i,l=s[0],r=s[1];return l=l||0,r=(r||0)*n,[D,z].indexOf(o)>=0?{x:r,y:l}:{x:l,y:r}}function Ln(e){var t=e.state,i=e.options,o=e.name,n=i.offset,s=n===void 0?[0,0]:n,l=He.reduce(function(h,u){return h[u]=An(u,t.rects,s),h},{}),r=l[t.placement],a=r.x,c=r.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=a,t.modifiersData.popperOffsets.y+=c),t.modifiersData[o]=l}const Tn={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Ln};function Yn(e){var t=e.state,i=e.name;t.modifiersData[i]=Ge({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const Xn={name:"popperOffsets",enabled:!0,phase:"read",fn:Yn,data:{}};function Pn(e){return e==="x"?"y":"x"}function Rn(e){var t=e.state,i=e.options,o=e.name,n=i.mainAxis,s=n===void 0?!0:n,l=i.altAxis,r=l===void 0?!1:l,a=i.boundary,c=i.rootBoundary,h=i.altBoundary,u=i.padding,f=i.tether,p=f===void 0?!0:f,x=i.tetherOffset,g=x===void 0?0:x,v=Et(t,{boundary:a,rootBoundary:c,padding:u,altBoundary:h}),m=j(t.placement),y=pt(t.placement),I=!y,w=qt(m),C=Pn(w),b=t.modifiersData.popperOffsets,k=t.rects.reference,E=t.rects.popper,O=typeof g=="function"?g(Object.assign({},t.rects,{placement:t.placement})):g,S=typeof O=="number"?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),L=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,M={x:0,y:0};if(b){if(s){var T,U=w==="y"?H:D,_=w==="y"?F:z,P=w==="y"?"height":"width",B=b[w],ut=B+v[U],K=B-v[_],ft=p?-E[P]/2:0,St=y===ct?k[P]:E[P],nt=y===ct?-E[P]:-k[P],mt=t.elements.arrow,et=p&&mt?Qt(mt):{width:0,height:0},$=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:We(),st=$[U],rt=$[_],J=kt(0,k[P],et[P]),At=I?k[P]/2-ft-J-st-S.mainAxis:St-J-st-S.mainAxis,ne=I?-k[P]/2+ft+J+rt+S.mainAxis:nt+J+rt+S.mainAxis,Lt=t.elements.arrow&&Ct(t.elements.arrow),se=Lt?w==="y"?Lt.clientTop||0:Lt.clientLeft||0:0,Ft=(T=L==null?void 0:L[w])!=null?T:0,re=B+At-Ft-se,ae=B+ne-Ft,zt=kt(p?Ht(ut,re):ut,B,p?ot(K,ae):K);b[w]=zt,M[w]=zt-B}if(r){var Nt,le=w==="x"?H:D,ce=w==="x"?F:z,Q=b[C],at=C==="y"?"height":"width",vt=Q+v[le],gt=Q-v[ce],bt=[H,D].indexOf(m)!==-1,Tt=(Nt=L==null?void 0:L[C])!=null?Nt:0,Yt=bt?vt:Q-k[at]-E[at]-Tt+S.altAxis,Xt=bt?Q+k[at]+E[at]-Tt-S.altAxis:gt,Vt=p&&bt?nn(Yt,Q,Xt):kt(p?Yt:vt,Q,p?Xt:gt);b[C]=Vt,M[C]=Vt-Q}t.modifiersData[o]=M}}const Mn={name:"preventOverflow",enabled:!0,phase:"main",fn:Rn,requiresIfExists:["offset"]};function Hn(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Dn(e){return e===Z(e)||!N(e)?te(e):Hn(e)}function Zn(e){var t=e.getBoundingClientRect(),i=ht(t.width)/e.offsetWidth||1,o=ht(t.height)/e.offsetHeight||1;return i!==1||o!==1}function Bn(e,t,i){i===void 0&&(i=!1);var o=N(t),n=N(t)&&Zn(t),s=tt(t),l=dt(e,n,i),r={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(o||!o&&!i)&&((V(t)!=="body"||ie(s))&&(r=Dn(t)),N(t)?(a=dt(t,!0),a.x+=t.clientLeft,a.y+=t.clientTop):s&&(a.x=ee(s))),{x:l.left+r.scrollLeft-a.x,y:l.top+r.scrollTop-a.y,width:l.width,height:l.height}}function Wn(e){var t=new Map,i=new Set,o=[];e.forEach(function(s){t.set(s.name,s)});function n(s){i.add(s.name);var l=[].concat(s.requires||[],s.requiresIfExists||[]);l.forEach(function(r){if(!i.has(r)){var a=t.get(r);a&&n(a)}}),o.push(s)}return e.forEach(function(s){i.has(s.name)||n(s)}),o}function Fn(e){var t=Wn(e);return Jo.reduce(function(i,o){return i.concat(t.filter(function(n){return n.phase===o}))},[])}function zn(e){var t;return function(){return t||(t=new Promise(function(i){Promise.resolve().then(function(){t=void 0,i(e())})})),t}}function Nn(e){var t=e.reduce(function(i,o){var n=i[o.name];return i[o.name]=n?Object.assign({},n,o,{options:Object.assign({},n.options,o.options),data:Object.assign({},n.data,o.data)}):o,i},{});return Object.keys(t).map(function(i){return t[i]})}var Ke={placement:"bottom",modifiers:[],strategy:"absolute"};function Je(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return!t.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function Vn(e){e===void 0&&(e={});var t=e,i=t.defaultModifiers,o=i===void 0?[]:i,n=t.defaultOptions,s=n===void 0?Ke:n;return function(r,a,c){c===void 0&&(c=s);var h={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ke,s),modifiersData:{},elements:{reference:r,popper:a},attributes:{},styles:{}},u=[],f=!1,p={state:h,setOptions:function(m){var y=typeof m=="function"?m(h.options):m;g(),h.options=Object.assign({},s,h.options,y),h.scrollParents={reference:it(r)?Ot(r):r.contextElement?Ot(r.contextElement):[],popper:Ot(a)};var I=Fn(Nn([].concat(o,h.options.modifiers)));return h.orderedModifiers=I.filter(function(w){return w.enabled}),x(),p.update()},forceUpdate:function(){if(!f){var m=h.elements,y=m.reference,I=m.popper;if(Je(y,I)){h.rects={reference:Bn(y,Ct(I),h.options.strategy==="fixed"),popper:Qt(I)},h.reset=!1,h.placement=h.options.placement,h.orderedModifiers.forEach(function(S){return h.modifiersData[S.name]=Object.assign({},S.data)});for(var w=0;w<h.orderedModifiers.length;w++){if(h.reset===!0){h.reset=!1,w=-1;continue}var C=h.orderedModifiers[w],b=C.fn,k=C.options,E=k===void 0?{}:k,O=C.name;typeof b=="function"&&(h=b({state:h,options:E,name:O,instance:p})||h)}}}},update:zn(function(){return new Promise(function(v){p.forceUpdate(),v(h)})}),destroy:function(){g(),f=!0}};if(!Je(r,a))return p;p.setOptions(c).then(function(v){!f&&c.onFirstUpdate&&c.onFirstUpdate(v)});function x(){h.orderedModifiers.forEach(function(v){var m=v.name,y=v.options,I=y===void 0?{}:y,w=v.effect;if(typeof w=="function"){var C=w({state:h,name:m,instance:p,options:I}),b=function(){};u.push(C||b)}})}function g(){u.forEach(function(v){return v()}),u=[]}return p}}var jn=[fn,Xn,pn,tn,Tn,On,Mn,ln,Sn],$n=Vn({defaultModifiers:jn});class Gn{constructor(t,i,o){qe(this,"updateHotspotPosition",(t,i)=>{this.currentActiveIndex=t,this.currentOrientation=i;const o=Po(this.hotspotsConfig,t,i);this.hideHotspots(),o.forEach(n=>this.updateAndShowHotspot(n,t))});this.container=i,this.popper=null,this.popperInstance=null,this.hotspotsContainer=_i(this.container),this.hotspotsConfig=Zo(t),this.shouldHidePopper=!0,this.hidePopper=this.hidePopper.bind(this),this.imageAspectRatio=o,this.hotspotElements=new Map,this.popperListeners=[];const{containerSize:n}=t[0];this.initialContainerSize=n||[i.offsetWidth,i.offsetHeight],this.initHotspots(),this.observeContainerResize()}observeContainerResize(){this.resizeObserver=new ResizeObserver(()=>{const t=this.container.offsetWidth,i=this.container.offsetHeight;this.updateHotspotsForResize(t,i)}),this.resizeObserver.observe(this.container)}updateHotspotsForResize(t,i){this.hotspotsConfig=Bo({newWidth:t,newHeight:i,initialContainerSize:this.initialContainerSize,imageAspectRatio:this.imageAspectRatio,hotspotsConfig:this.hotspotsConfig}),this.updateHotspotPosition(this.currentActiveIndex,this.currentOrientation)}cleanupPopperListeners(){this.popperListeners.forEach(({element:t,event:i,handler:o})=>{t.removeEventListener(i,o)}),this.popperListeners=[]}showPopper({hotspotElement:t,content:i,id:o,keepOpen:n}){this.popperInstance&&this.popperInstance.instanceId!==o&&this.hidePopper();const s={placement:"top",modifiers:Ho(this.container)};this.popper=Do(i,o),this.popper.setAttribute("data-show",""),this.currentHotspotElement=t,t.setAttribute("aria-expanded","true"),t.setAttribute("aria-describedby",`cloudimage-360-popper-${o}`);const l=()=>{this.shouldHidePopper=!1},r=()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()},a=()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()},c=()=>{this.shouldHidePopper=!1,this.hidePopperTimeout&&clearTimeout(this.hidePopperTimeout)};this.popper.addEventListener("mouseenter",l),this.popper.addEventListener("mouseleave",r),t.addEventListener("mouseleave",a),t.addEventListener("mouseenter",c),this.popperListeners.push({element:this.popper,event:"mouseenter",handler:l},{element:this.popper,event:"mouseleave",handler:r},{element:t,event:"mouseleave",handler:a},{element:t,event:"mouseenter",handler:c}),this.popperInstance={...$n(t,this.popper,s),keepOpen:n,instanceId:o}}checkAndHidePopper(){var t;this.shouldHidePopper&&!((t=this.popperInstance)!=null&&t.keepOpen)&&(this.hidePopperTimeout=setTimeout(()=>{this.shouldHidePopper&&this.hidePopper()},Ii))}hidePopper(){if(this.cleanupPopperListeners(),this.currentHotspotElement&&(this.currentHotspotElement.setAttribute("aria-expanded","false"),this.currentHotspotElement.removeAttribute("aria-describedby"),this.currentHotspotElement=null),this.popperInstance&&(this.popperInstance.destroy(),this.popperInstance=null),this.popper){this.popper.removeAttribute("data-show"),this.popper.setAttribute("aria-hidden","true");const t=this.popper;this.popper=null,setTimeout(()=>{t.remove()},Ci)}}createHotspot(t){const{id:i,content:o,keepOpen:n,onClick:s,label:l}=t,r=Ro(i,l);s&&(r.style.cursor="pointer"),r.onclick=a=>{a.stopPropagation(),s==null||s(a,this.popperInstance,i)},o&&(r.addEventListener("mouseenter",()=>this.showPopper({hotspotElement:r,content:o,id:i,keepOpen:n})),r.addEventListener("focus",()=>this.showPopper({hotspotElement:r,content:o,id:i,keepOpen:n})),r.addEventListener("blur",()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()})),this.hotspotsContainer.appendChild(r)}hideHotspots(){this.hotspotsContainer.querySelectorAll(".cloudimage-360-hotspot").forEach(t=>{t.style.opacity=0,t.style.pointerEvents="none"})}updateAndShowHotspot(t,i){const{positions:o,id:n}=t,{x:s,y:l}=o[i]??{},r=this.hotspotsContainer.querySelector(`[data-hotspot-id="${n}"]`);r&&(r.style.translate=`${s}px ${l}px`,r.style.opacity=1,r.style.pointerEvents="all")}showHotspotById(t){const i=this.hotspotsConfig.find(n=>n.id===t);if(!i||!i.content)return;const o=this.hotspotsContainer.querySelector(`[data-hotspot-id="${t}"]`);o&&o.style.opacity==="1"&&this.showPopper({hotspotElement:o,content:i.content,id:t,keepOpen:i.keepOpen})}createAllHotspots(){this.hotspotsConfig.forEach(t=>this.createHotspot(t))}initHotspots(){this.createAllHotspots()}destroy(){this.hidePopperTimeout&&clearTimeout(this.hidePopperTimeout),this.resizeObserver.disconnect(),this.hidePopper(),this.hotspotElements.clear(),this.hotspotsContainer.innerHTML=""}}class Wt{constructor(t,i,o){this.container=t,this.isClicked=!1,this.fullscreenView=!!o,this.imagesX=[],this.imagesY=[],this.devicePixelRatio=Math.round(window.devicePixelRatio||1),this.id=t.id,this.movementStart={x:0,y:0},this.draggingDirection=null,this.isReady=!1,this.velocityX=0,this.velocityY=0,this.lastDragTime=0,this.lastDragX=0,this.lastDragY=0,this.inertiaAnimationId=null,this.hasInteracted=!1,this.currentZoomScale=1,this.touchDevice=Oo(),this.dragJustEnded=!1,this.isPinching=!1,this.initialPinchDistance=0,this.pinchZoomLevel=1,this.pinchZoomEmitted=!1,this.lastEmittedZoom=1,this.panOffsetX=0,this.panOffsetY=0,this.canvasWorker=new Ao,this.hotspotTimeline=null,this.hotspotTimelineIndicator=null,this.isAnimatingToFrame=!1,this.onMoveHandler=this.onMoveHandler.bind(this),this.destroy=this.destroy.bind(this),this.init(this.container,i)}emit(t,i={}){const o=this[t];typeof o=="function"&&o({...i,viewerId:this.id})}announce(t){Ji(this.ariaLiveRegion,t)}mouseDown(t){if(!this.isReady||this.glass)return;const{pageX:i,pageY:o}=t;this.hideHints(),this.hideHotspotPopper(),this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),this.autoplayJustStopped=!1,(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1,this.autoplayJustStopped=!0),this.movementStart={x:i,y:o},this.isClicked=!0,this.isDragging=!1,this.inertia&&(this.velocityX=0,this.velocityY=0,this.lastDragTime=performance.now(),this.lastDragX=i,this.lastDragY=o)}mouseUp(){this.isReady&&(!this.isZoomed&&!this.autoplayJustStopped&&this.showAllIcons(),this.inertia&&this.isDragging&&(Math.abs(this.velocityX)>.1||Math.abs(this.velocityY)>.1)&&this.startInertia(),this.isDragging&&(this.emit("onDragEnd"),this.dragJustEnded=!0),this.movementStart={x:0,y:0},this.isClicked=!1,this.isDragging=!1,this.innerBox.style.cursor="grab")}startInertia(){const o=this.fullscreenView?document.body:this.container,n=this.dragSpeed/ve,s=n*(this.amountX/o.offsetWidth),l=n*(this.amountY/o.offsetHeight),r=()=>{if(this.velocityX*=.95,this.velocityY*=.95,Math.abs(this.velocityX)<.01&&Math.abs(this.velocityY)<.01){this.inertiaAnimationId=null;return}const a=this.velocityX*16,c=this.velocityY*16,h=Te({deltaX:a,deltaY:c,reversed:this.dragReverse,allowSpinX:this.allowSpinX,allowSpinY:this.allowSpinY});if(h){const u=this.allowSpinX?Math.max(1,Math.abs(Math.round(a*s))):0,f=this.allowSpinY?Math.max(1,Math.abs(Math.round(c*l))):0;(u>0||f>0)&&this.onMoveHandler(h,u,f)}this.inertiaAnimationId=requestAnimationFrame(r)};this.inertiaAnimationId=requestAnimationFrame(r)}drag(t,i){if(!this.isReady||!this.isClicked)return;const o=t-this.movementStart.x,n=i-this.movementStart.y;if(this.inertia){const f=performance.now(),p=f-this.lastDragTime;p>0&&p<100&&(this.velocityX=(t-this.lastDragX)/p,this.velocityY=(i-this.lastDragY)/p),this.lastDragTime=f,this.lastDragX=t,this.lastDragY=i}this.draggingDirection=Te({deltaX:o,deltaY:n,reversed:this.dragReverse,allowSpinX:this.allowSpinX,allowSpinY:this.allowSpinY})||this.draggingDirection;const s=this.fullscreenView?document.body:this.container,l=this.dragSpeed/ve,r=l*(this.amountX/s.offsetWidth),a=l*(this.amountY/s.offsetHeight),c=this.allowSpinX?Math.abs(Math.round(o*r)):0,h=this.allowSpinY?Math.abs(Math.round(n*a)):0;(this.allowSpinX&&c!==0||this.allowSpinY&&h!==0)&&(this.hasInteracted=!0,this.hideHotspotPopper(),this.onMoveHandler(this.draggingDirection,c,h),this.movementStart={x:t,y:i},setTimeout(()=>{this.isDragging||(this.isDragging=!0,this.emit("onDragStart"))},xi))}mouseMove(t){!this.isReady||!this.isClicked&&!this.isZoomed||this.glass||(this.hideAllIcons(),this.drag(t.pageX,t.pageY),this.isZoomed&&this.applyZoom(t))}mouseClick(t){if(!(!this.isReady||this.isDragging)){if(this.dragJustEnded){this.dragJustEnded=!1;return}if(this.autoplayJustStopped){this.autoplayJustStopped=!1;return}if(this.glass&&this.magnified){this.removeGlass();return}this.pointerZoom&&!this.glass&&!this.touchDevice&&this.toggleZoom(t)}}loadHigherQualityImages(t,i){const o=yt(this.srcXConfig,t),n=this.allowSpinY?yt(this.srcYConfig,t):null;ye({cdnPathX:o,cdnPathY:n,configX:this.srcXConfig,configY:this.srcYConfig,onAllImagesLoad:(s,l)=>{this.imagesX=s,this.imagesY=l,i()},onError:s=>this.emit("onError",s)})}hideHotspots(){this.hotspotsInstance&&this.hotspotsInstance.hideHotspots()}hideHotspotPopper(){this.hotspotsInstance&&this.hotspotsInstance.hidePopper()}toggleZoom(t){if(this.isZoomed)this.showTransitionOverlay(),setTimeout(()=>{this.removeZoom()},me);else{let i=(this.fullscreenView||this.pointerZoom?document.body:this.container).offsetWidth;this.hideHotspots(),this.showLoadingSpinner(),this.loadHigherQualityImages(i,()=>{this.showTransitionOverlay(),setTimeout(()=>{this.applyZoom(t)},me)})}}removeZoom(){this.isZoomed=!1,this.updateView(),this.showAllIcons(),this.hideTransitionOverlay(),this.emit("onZoomOut"),this.announce("Zoomed out")}mouseLeave(){this.isZoomed&&this.removeZoom()}applyZoom(t){const{offsetX:i,offsetY:o}=yo(t,this.canvas,this.devicePixelRatio);this.isZoomed=!0,this.hideAllIcons(),this.hideLoadingSpinner(),this.hideTransitionOverlay(),this.updateView(this.pointerZoom,i,o),this.emit("onZoomIn",{zoomLevel:this.pointerZoom}),this.announce("Zoomed in. Move mouse to pan. Click to zoom out.")}touchOutside(t){if(!this.glass)return;!this.canvas.contains(t.target)&&this.removeGlass()}touchStart(t){if(!this.isReady||this.glass||!t.touches||!t.touches.length)return;const i=t.target;if(i&&i.closest&&i.closest(".cloudimage-360-button"))return;if(this.hideHints(),t.touches.length===2&&this.pinchZoom&&!this.isDragging){t.preventDefault(),this.isPinching=!0,this.isClicked=!1,this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null);const s=t.touches[0],l=t.touches[1];if(this.initialPinchDistance=this.getPinchDistance(s,l),(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1),!this.isZoomed&&this.pinchZoomLevel===1){const r=(this.fullscreenView?document.body:this.container).offsetWidth;this.hideHotspots(),this.loadHigherQualityImages(r,()=>{})}return}if(t.touches.length>1)return;const{pageX:o,pageY:n}=t.touches[0];this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1),this.hideAllIcons(),this.hideHotspotPopper(),this.movementStart={x:o,y:n},this.isClicked=!0,this.isDragging=!1,this.inertia&&(this.velocityX=0,this.velocityY=0,this.lastDragTime=performance.now(),this.lastDragX=o,this.lastDragY=n)}getPinchDistance(t,i){const o=t.pageX-i.pageX,n=t.pageY-i.pageY;return Math.sqrt(o*o+n*n)}getPinchCenter(t,i){return{x:(t.pageX+i.pageX)/2,y:(t.pageY+i.pageY)/2}}touchEnd(t){if(this.isReady){if(this.isPinching){if(!t.touches||t.touches.length<2){if(this.isPinching=!1,this.initialPinchDistance=0,this.pinchZoomLevel<=1){const i=this.pinchZoomEmitted;this.pinchZoomLevel=1,this.pinchZoomEmitted=!1,this.lastEmittedZoom=1,this.isZoomed=!1,this.panOffsetX=0,this.panOffsetY=0,this.showAllIcons(),this.updateView(),i&&this.emit("onZoomOut")}else if(this.canvas){const i=this.canvas.getBoundingClientRect();this.panOffsetX=i.width/2*this.devicePixelRatio,this.panOffsetY=i.height/2*this.devicePixelRatio}}return}this.showAllIcons(),this.inertia&&this.isDragging&&(Math.abs(this.velocityX)>.1||Math.abs(this.velocityY)>.1)&&this.startInertia(),this.movementStart={x:0,y:0},this.isClicked=!1,this.isDragging=!1}}touchMove(t){if(!this.isReady||this.glass)return;if(this.isPinching&&t.touches.length===2){t.preventDefault();const n=t.touches[0],s=t.touches[1],l=this.getPinchDistance(n,s);if(this.initialPinchDistance===0){this.initialPinchDistance=l;return}const r=l/this.initialPinchDistance,a=Math.max(1,Math.min(this.pinchZoomLevel*r,ge));if(this.initialPinchDistance=l,this.pinchZoomLevel=a,!this.canvas)return;const c=this.canvas.getBoundingClientRect(),h=c.width/2*this.devicePixelRatio,u=c.height/2*this.devicePixelRatio;a>1?(this.isZoomed=!0,this.hideAllIcons(),this.updateView(a,h,u),(!this.pinchZoomEmitted||a>this.lastEmittedZoom)&&(this.emit("onZoomIn",{zoomLevel:a}),this.pinchZoomEmitted=!0,this.lastEmittedZoom=a)):(this.isZoomed=!1,this.panOffsetX=0,this.panOffsetY=0,this.updateView());return}if(!this.isClicked||!t.touches||!t.touches[0])return;const{pageX:i,pageY:o}=t.touches[0];if(t.preventDefault(),this.isZoomed&&this.pinchZoomLevel>1){const n=i-this.movementStart.x,s=o-this.movementStart.y;this.panOffsetX-=n*this.devicePixelRatio,this.panOffsetY-=s*this.devicePixelRatio,this.movementStart={x:i,y:o},this.updateView(this.pinchZoomLevel,this.panOffsetX,this.panOffsetY);return}this.drag(i,o)}keyDown(t){if(!this.isReady)return;const{keyCode:i}=t,o=this.keysReverse;switch(this.autoplay&&this.stopAutoplay(),Le(i,this.allowSpinY)&&(this.hasInteracted=!0,this.hideAllIcons(),this.hideHints()),i){case 37:o?this.moveLeft():this.moveRight();break;case 39:o?this.moveRight():this.moveLeft();break;case 38:this.allowSpinY&&(t.preventDefault(),o?this.moveTop():this.moveBottom());break;case 40:this.allowSpinY&&(t.preventDefault(),o?this.moveBottom():this.moveTop());break}}keyUp(t){const{keyCode:i}=t;Le(i,this.allowSpinY)&&this.showAllIcons()}moveActiveXIndexUp(t){this.orientation=Y.X,this.activeImageX=(this.activeImageX+t)%this.amountX}moveActiveXIndexDown(t){this.orientation=Y.X,this.activeImageX=(this.activeImageX-t+this.amountX)%this.amountX}moveActiveYIndexUp(t){this.orientation=Y.Y,this.activeImageY=(this.activeImageY+t)%this.amountY}moveActiveYIndexDown(t){this.orientation=Y.Y,this.activeImageY=(this.activeImageY-t+this.amountY)%this.amountY}moveRight(t,i=1){t&&this.activeImageX>=this.imagesX.length-1||(this.moveActiveXIndexUp(i),this.isZoomed||this.updateView())}moveLeft(t,i=1){t&&this.activeImageX<=0||(this.moveActiveXIndexDown(i),this.isZoomed||this.updateView())}moveTop(t,i=1){t&&this.activeImageY>=this.imagesY.length-1||(this.moveActiveYIndexUp(i),this.isZoomed||this.updateView())}moveBottom(t,i=1){t&&this.activeImageY<=0||(this.moveActiveYIndexDown(i),this.isZoomed||this.updateView())}onMoveHandler(t,i=1,o=1){t==="right"?this.moveRight(this.stopAtEdges,i):t==="left"?this.moveLeft(this.stopAtEdges,i):t==="up"?this.moveTop(this.stopAtEdges,o):t==="down"&&this.moveBottom(this.stopAtEdges,o),this.emit("onSpin",{direction:t,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY})}updateView(t,i,o){const n=this.orientation===Y.X?this.activeImageX:this.activeImageY,s=this.orientation===Y.X?this.imagesX[this.activeImageX]:this.imagesY[this.activeImageY];this.hotspotsInstance&&!this.isZoomed&&!this.autoplay&&this.hotspotsInstance.updateHotspotPosition(n,this.orientation),this.hotspotTimelineIndicator&&this.orientation===Y.X&&this.updateHotspotTimelinePosition(),this.drawImageOnCanvas(s,t,i,o)}updatePercentageInLoader(t=0){this.loader&&(this.loader.innerText=t+"%")}adaptCanvasSize(t){const{naturalWidth:i,naturalHeight:o}=t;this.imageAspectRatio=i/o;const n=this.fullscreenView?window.innerWidth:this.canvas.clientWidth,s=this.fullscreenView?window.innerHeight:this.canvas.clientHeight;this.canvasWorker.postMessage({action:"adaptCanvasSize",devicePixelRatio:this.devicePixelRatio,imageAspectRatio:this.imageAspectRatio,containerWidth:n,containerHeight:s})}drawImageOnCanvas(t,i=1,o=0,n=0){this.canvasWorker.postMessage({action:"drawImageOnCanvas",imageData:t,zoomScale:i,pointerX:o,pointerY:n})}pushImageToSet(t,i,o){o===Y.X?this.imagesX[i]=t:this.imagesY[i]=t}calculatePercentage(){const t=this.amountX+this.amountY,i=this.imagesX.length+this.imagesY.length;return Math.round(i/t*100)}onImageLoad(t,i,o){this.pushImageToSet(t,i,o),this.updatePercentageInLoader(this.calculatePercentage())}onFirstImageLoaded(t,i){this.createContainers(t),this.adaptCanvasSize(i),this.drawImageOnCanvas(i)}onAllImagesLoaded(){if(this.addAllIcons(),this.isReady=!0,this.amountX=this.imagesX.length,this.amountY=this.imagesY.length,this.activeImageX=this.autoplayReverse?this.amountX-1:0,this.activeImageY=this.autoplayReverse?this.amountY-1:0,this.hotspots&&(this.hotspotsInstance=new Gn(this.hotspots,this.innerBox,this.imageAspectRatio),this.addHotspotTimeline(),this.showHotspotTimeline()),this.emit("onLoad",{imagesX:this.imagesX.length,imagesY:this.imagesY.length}),this.emit("onReady"),this.announce("360 degree view loaded. Use mouse drag or arrow keys to rotate."),this.hints!==!1&&!this.autoplay){const t=this.hints===!0||this.hints===void 0?Ce(this.viewerConfig,this.touchDevice):this.hints;t&&t.length>0&&(this.hintsOverlay=Ie(this.innerBox,t),ke(this.hintsOverlay))}this.autoplay&&(this.hideAllIcons(),Eo(this.play.bind(this))())}magnify(t){t.stopPropagation();const{src:i}=this.orientation===Y.Y?this.imagesY[this.activeImageY]:this.imagesX[this.activeImageX],n=(this.fullscreenView?document.body:this.container).offsetWidth*this.magnifier,s=Pi(i,n);this.showLoadingSpinner(),this.createGlass(),vo(s,a=>{this.hideLoadingSpinner(),this.magnified=!0,bo(t,this.innerBox,this.offset,a,this.glass,this.magnifier)},a=>{this.hideLoadingSpinner(),this.removeGlass(),this.emit("onError",{error:{message:a.message,url:a.url},errorCount:1,totalImages:1,errors:[{message:a.message,url:a.url}]})})}openFullscreenModal(t){t.stopPropagation(),window.document.body.style.overflow="hidden";const i=$i(this.container);new Wt(i,this.viewerConfig,!0),this.emit("onFullscreenOpen"),this.announce("Opened fullscreen mode. Press Escape to exit.")}closeFullscreenModal(t){t.stopPropagation(),document.body.removeChild(this.container.parentNode),window.document.body.style.overflow="visible",this.emit("onFullscreenClose"),this.announce("Exited fullscreen mode")}play(){if(this.isClicked)return;this.hide360ViewCircleIcon(),this.emit("onAutoplayStart");const t=this.speed*36/(this.amountX+this.amountY),i={left:this.moveLeft.bind(this),right:this.moveRight.bind(this),top:this.moveTop.bind(this),bottom:this.moveBottom.bind(this)};this.loopTimeoutId=window.setInterval(()=>{if(this.playOnce&&xo({autoplayBehavior:this.autoplayBehavior,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,autoplayReverse:this.autoplayReverse})){this.stopAutoplay();return}Io({autoplayBehavior:this.autoplayBehavior,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,autoplayReverse:this.autoplayReverse,spinDirection:this.spinDirection})&&(this.spinDirection=ko(this.spinDirection));const s=this.spinDirection==="y";wo({autoplayBehavior:this.autoplayBehavior,spinY:s,reversed:this.autoplayReverse,loopTriggers:i})},t)}stopAutoplay(){if(this.showAllIcons(),this.autoplay=!1,window.clearTimeout(this.loopTimeoutId),this.loopTimeoutId=null,this.emit("onAutoplayStop"),this.hints!==!1&&!this.hintsOverlay&&!this.hintsHidden){const t=this.hints===!0?Ce(this.viewerConfig,this.touchDevice):this.hints;t&&t.length>0&&(this.hintsOverlay=Ie(this.innerBox,t),ke(this.hintsOverlay))}}destroy(){this.stopAutoplay(),this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),this.removeEvents(),this.canvasWorker&&(this.canvasWorker.terminate(),this.canvasWorker=null),this.hotspotsInstance&&this.hotspotsInstance.destroy(),this.hintsOverlay&&this.hintsOverlay.parentNode&&(this.hintsOverlay.parentNode.removeChild(this.hintsOverlay),this.hintsOverlay=null),this.hotspotTimeline&&this.hotspotTimeline.parentNode&&(this.hotspotTimeline.parentNode.removeChild(this.hotspotTimeline),this.hotspotTimeline=null,this.hotspotTimelineIndicator=null),this.container&&(this.container.classList.remove("ci360-theme-dark"),this.container.innerHTML="")}addInitialIcon(){this.initialIcon||this.hide360Logo||(this.initialIcon=Bi(this.logoSrc),this.innerBox.appendChild(this.initialIcon))}showInitialIcon(){!this.initialIcon||this.hasInteracted||(this.initialIcon.style.opacity=1)}hideInitialIcon(){this.initialIcon&&(this.initialIcon.style.opacity=0)}createGlass(){this.hideAllIcons(),this.glass=document.createElement("div"),this.innerBox.appendChild(this.glass),this.innerBox.style.cursor="default"}removeGlass(){this.showAllIcons(),this.innerBox.removeChild(this.glass),this.glass=null,this.magnified=!1}addMagnifierIcon(){this.magnifier&&(this.magnifierIcon=Vi(),this.magnifierIcon.onclick=this.magnify.bind(this),this.iconsContainer.appendChild(this.magnifierIcon))}showMagnifierIcon(){this.magnifierIcon&&(this.magnifierIcon.style.visibility="visible",this.magnifierIcon.style.opacity=1)}hideMagnifierIcon(){this.magnifierIcon&&(this.magnifierIcon.style.visibility="hidden",this.magnifierIcon.style.opacity=0)}addFullscreenIcon(){this.fullscreen&&(this.fullscreenIcon=zi(),this.fullscreenIcon.onclick=this.openFullscreenModal.bind(this),this.iconsContainer.appendChild(this.fullscreenIcon))}addCloseFullscreenIcon(){this.fullscreenCloseIcon=Fi(),this.fullscreenCloseIcon.onclick=this.closeFullscreenModal.bind(this),this.iconsContainer.appendChild(this.fullscreenCloseIcon)}showFullscreenIcon(){this.fullscreenIcon&&(this.fullscreenIcon.style.opacity=1)}hideFullscreenIcon(){this.fullscreenIcon&&(this.fullscreenIcon.style.opacity=0)}add360ViewCircleIcon(){this.view360CircleIcon||(this.view360CircleIcon=Di(this.bottomCircleOffset),this.innerBox.appendChild(this.view360CircleIcon))}show360ViewCircleIcon(){this.view360CircleIcon&&(this.view360CircleIcon.style.opacity=1)}hide360ViewCircleIcon(){this.view360CircleIcon&&(this.view360CircleIcon.style.opacity=0)}addLoadingSpinner(){this.loadingSpinner=Gi(),this.innerBox.appendChild(this.loadingSpinner)}showLoadingSpinner(){this.loadingSpinner&&(this.hideAllIcons(),this.loadingSpinner.style.opacity=1)}createTransitionOverlay(){this.transitionOverlay=Ui(),this.innerBox.appendChild(this.transitionOverlay)}showTransitionOverlay(){this.transitionOverlay&&(this.hideAllIcons(),this.transitionOverlay.style.opacity=1)}hideTransitionOverlay(){this.transitionOverlay&&(this.transitionOverlay.style.opacity=0)}hideLoadingSpinner(){this.loadingSpinner&&(this.loadingSpinner.style.opacity=0)}hideHints(){!this.hintsOverlay||this.hintsHidden||(this.hintsHidden=!0,to(this.hintsOverlay))}addHotspotTimeline(){if(!this.hotspots||this.hotspotTimeline)return;const t=so(this.container,this.amountX,this.hotspots);if(!t)return;this.hotspotTimeline=t.element,this.hotspotTimelineIndicator=t.indicator,this.hotspotTimeline.querySelectorAll(".cloudimage-360-hotspot-timeline-dot").forEach(o=>{o.addEventListener("click",n=>{n.stopPropagation();const s=parseInt(o.getAttribute("data-frame"),10),l=o.getAttribute("data-hotspot-id");isNaN(s)||this.animateToFrame(s,l)})}),this.updateHotspotTimelinePosition()}showHotspotTimeline(){ao(this.hotspotTimeline)}hideHotspotTimeline(){lo(this.hotspotTimeline)}updateHotspotTimelinePosition(){ro(this.hotspotTimelineIndicator,this.activeImageX,this.amountX)}animateToFrame(t,i){if(this.isAnimatingToFrame||t===this.activeImageX){t===this.activeImageX&&i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&this.hotspotsInstance.showHotspotById(i);return}this.isAnimatingToFrame=!0,this.hasInteracted=!0,(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1),this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null);const o=this.activeImageX,n=(t-o+this.amountX)%this.amountX,s=(o-t+this.amountX)%this.amountX,l=n<=s,r=l?n:s;if(r===0){this.isAnimatingToFrame=!1;return}const a=30;let c=r;const h=()=>{if(c<=0){this.isAnimatingToFrame=!1,i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&setTimeout(()=>{this.hotspotsInstance.showHotspotById(i)},50);return}l?this.moveRight():this.moveLeft(),c--,c>0?setTimeout(h,a):(this.isAnimatingToFrame=!1,i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&setTimeout(()=>{this.hotspotsInstance.showHotspotById(i)},50))};h()}remove360ViewCircleIcon(){this.view360CircleIcon&&(this.innerBox.removeChild(this.view360CircleIcon),this.view360CircleIcon=null)}addAllIcons(){this.removeLoader(),this.innerBox.style.cursor="grab",this.pointerZoom&&(this.createTransitionOverlay(),this.addLoadingSpinner()),!this.fullscreenView&&!this.touchDevice&&this.addMagnifierIcon(),this.fullscreenView||this.addFullscreenIcon(),this.initialIconShown&&this.addInitialIcon(),this.bottomCircle&&this.add360ViewCircleIcon()}showAllIcons(){this.showInitialIcon(),this.show360ViewCircleIcon(),this.showMagnifierIcon(),this.showFullscreenIcon(),this.showHotspotTimeline()}hideAllIcons(){this.hideInitialIcon(),this.hide360ViewCircleIcon(),this.hideMagnifierIcon(),this.hideFullscreenIcon(),this.hideHotspotTimeline()}removeLoader(){this.loader&&(this.innerBox.removeChild(this.loader),this.loader=null)}attachEvents(t,i,o){t&&this.addMouseEvents(),i&&this.addTouchEvents(),o&&this.addKeyboardEvents(),this.addEscKeyHandler()}removeEvents(){this.removeMouseEvents(),this.removeTouchEvents(),this.removeKeyboardEvents(),this.removeEscKeyHandler()}addMouseEvents(){this.boundMouseClick=this.mouseClick.bind(this),this.boundMouseDown=this.mouseDown.bind(this),this.boundMouseMove=ue(this.mouseMove.bind(this),fe),this.boundMouseUp=this.mouseUp.bind(this),this.boundMouseLeave=this.mouseLeave.bind(this),this.innerBox.addEventListener("click",this.boundMouseClick),this.innerBox.addEventListener("mousedown",this.boundMouseDown),this.innerBox.addEventListener("mouseleave",this.boundMouseLeave),document.addEventListener("mousemove",this.boundMouseMove),document.addEventListener("mouseup",this.boundMouseUp)}addTouchEvents(){this.boundTouchOutside=this.touchOutside.bind(this),this.boundTouchStart=this.touchStart.bind(this),this.boundTouchEnd=this.touchEnd.bind(this),this.boundTouchMove=ue(this.touchMove.bind(this),fe),document.addEventListener("touchstart",this.boundTouchOutside),this.container.addEventListener("touchstart",this.boundTouchStart),this.container.addEventListener("touchend",this.boundTouchEnd),this.container.addEventListener("touchmove",this.boundTouchMove)}addKeyboardEvents(){this.boundKeyDown=this.keyDown.bind(this),this.boundKeyUp=this.keyUp.bind(this),document.addEventListener("keydown",this.boundKeyDown),document.addEventListener("keyup",this.boundKeyUp)}addEscKeyHandler(){this.boundEscHandler=t=>{t.keyCode===27&&(this.fullscreenView?this.closeFullscreenModal(t):this.isZoomed?this.removeZoom():this.glass&&this.removeGlass())},document.addEventListener("keydown",this.boundEscHandler)}removeEscKeyHandler(){document.removeEventListener("keydown",this.boundEscHandler)}removeMouseEvents(){this.innerBox.removeEventListener("click",this.boundMouseClick),this.innerBox.removeEventListener("mousedown",this.boundMouseDown),this.innerBox.removeEventListener("mouseleave",this.boundMouseLeave),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("mouseup",this.boundMouseUp)}removeTouchEvents(){document.removeEventListener("touchstart",this.boundTouchOutside),this.container.removeEventListener("touchstart",this.boundTouchStart),this.container.removeEventListener("touchend",this.boundTouchEnd),this.container.removeEventListener("touchmove",this.boundTouchMove)}removeKeyboardEvents(){document.removeEventListener("keydown",this.boundKeyDown),document.removeEventListener("keyup",this.boundKeyUp)}createContainers(t){this.iconsContainer=we(this.innerBox),this.canvas=Wi(this.innerBox,t),this.loader=ji(this.innerBox),this.ariaLiveRegion=Ki(this.innerBox);const i=this.canvas.transferControlToOffscreen();this.canvasWorker.postMessage({action:"initCanvas",offscreen:i,devicePixelRatio:this.devicePixelRatio},[i]),this.fullscreenView&&this.addCloseFullscreenIcon(),$t(this.innerBox,".cloudimage-360-placeholder")}update(t){this.isReady&&(this.stopAutoplay(),$t(this.innerBox,".cloudimage-360-icons-container"),this.init(this.container,t,!0),this.iconsContainer=we(this.innerBox),this.onAllImagesLoaded())}init(t,i,o){const n=i?Ai(i):Ei(t),{folder:s,apiVersion:l,filenameX:r,filenameY:a,imageListX:c,imageListY:h,indexZeroBase:u,amountX:f,amountY:p,draggable:x=!0,swipeable:g=!0,keys:v,keysReverse:m,bottomCircleOffset:y,autoplay:I,autoplayBehavior:w,playOnce:C,speed:b,autoplayReverse:k,fullscreen:E,magnifier:O,ciToken:S,ciFilters:L,ciTransformation:M,lazyload:T,dragSpeed:U,stopAtEdges:_,pointerZoom:P,imageInfo:B="black",initialIconShown:ut,bottomCircle:K,hotspots:ft,dragReverse:St,hide360Logo:nt,logoSrc:mt,inertia:et,pinchZoom:$,hints:st,theme:rt,hotspotTimelineOnClick:J=!0,onReady:At,onLoad:ne,onSpin:Lt,onAutoplayStart:se,onAutoplayStop:Ft,onFullscreenOpen:re,onFullscreenClose:ae,onZoomIn:zt,onZoomOut:Nt,onDragStart:le,onDragEnd:ce,onError:Q}=n,at={ciToken:S,ciFilters:L,ciTransformation:M},vt=Gt(c,[]),gt=Gt(h,[]);if(this.viewerConfig=n,this.amountX=vt.length||f,this.amountY=gt.length||p,this.allowSpinX=!!this.amountX,this.allowSpinY=!!this.amountY,this.activeImageX=k?this.amountX-1:0,this.activeImageY=k?this.amountY-1:0,this.bottomCircleOffset=y,this.autoplay=I,this.autoplayBehavior=w,this.playOnce=C,this.speed=b,this.autoplayReverse=k,this.fullscreen=E,this.magnifier=O>1?Math.min(O,Oi):0,this.dragSpeed=Math.max(U,ki),this.stopAtEdges=_,this.ciParams=at,this.apiVersion=l,this.pointerZoom=P>1?Math.min(P,ge):null,this.keysReverse=m,this.info=B,this.keys=v,this.innerBox=this.innerBox??Ni(this.container),this.initialIconShown=ut,this.bottomCircle=K,this.spinDirection=Co(this.autoplayBehavior,this.allowSpinX,this.allowSpinY),this.dragReverse=St,this.hotspots=ft,this.hide360Logo=nt,this.logoSrc=mt,this.inertia=et,this.pinchZoom=$,this.hints=st,this.hotspotTimelineOnClick=J,rt==="dark"?this.container.classList.add("ci360-theme-dark"):rt==="light"&&this.container.classList.remove("ci360-theme-dark"),this.onReady=At,this.onLoad=ne,this.onSpin=Lt,this.onAutoplayStart=se,this.onAutoplayStop=Ft,this.onFullscreenOpen=re,this.onFullscreenClose=ae,this.onZoomIn=zt,this.onZoomOut=Nt,this.onDragStart=le,this.onDragEnd=ce,this.onError=Q,this.srcXConfig={folder:s,filename:r,imageList:vt,container:t,innerBox:this.innerBox,apiVersion:l,ciParams:at,lazyload:T,amount:this.amountX,indexZeroBase:u,autoplayReverse:k,orientation:Y.X},this.srcYConfig={...this.srcXConfig,filename:a,imageList:gt,orientation:Y.Y,amount:this.amountY},o&&this.removeEvents(),this.attachEvents(x,g,v),o)return;const bt=(this.fullscreenView?document.body:this.container).offsetWidth,Tt=this.allowSpinX&&!vt.length?yt(this.srcXConfig,bt):null,Yt=this.allowSpinY&&!gt.length?yt(this.srcYConfig,bt):null,Xt=Vt=>{ye({cdnPathX:Tt,cdnPathY:Yt,configX:this.srcXConfig,configY:this.srcYConfig,onImageLoad:(Pt,Un,_n)=>this.onImageLoad(Pt,Un,_n),onFirstImageLoad:Pt=>this.onFirstImageLoaded(Vt,Pt),onAllImagesLoad:this.onAllImagesLoaded.bind(this),onError:Pt=>this.emit("onError",Pt)})};this.allowSpinX?Ee(Tt,this.srcXConfig,Xt):this.allowSpinY&&Ee(Yt,this.srcYConfig,Xt)}}class Qe{constructor(){this.views=new Map,this.initAll=this.initAll.bind(this),this.getViews=this.getViews.bind(this)}generateId(){return`ci360-${Math.random().toString(36).slice(2,11)}`}init(t,i,o){if(!t)return;const n=t.id||this.generateId();t.id||(t.id=n);const s=new Wt(t,i,o);return this.views.set(n,s),s}initAll(t="cloudimage-360"){[...document.querySelectorAll(`.${t}`)].filter(Boolean).forEach(o=>{const n=o.id||this.generateId();o.id||(o.id=n);const s=new Wt(o);this.views.set(n,s)})}destroy(t){const i=this.getViewById(t);i&&(i.destroy(),this.views.delete(t))}destroyAll(){this.views.forEach(t=>{t.destroy()}),this.views.clear()}getViewById(t){return this.views.get(t)}getViews(){return Array.from(this.views.values())}updateView(t,i){const o=this.getViewById(t);if(!o)return null;const n={...o.viewerConfig,...i};o.destroy();const s=document.getElementById(t);return this.init(s,n)}}return window.CI360=Qe,Qe}();