js-cloudimage-hotspot 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +294 -0
  3. package/dist/a11y/aria.d.ts +7 -0
  4. package/dist/a11y/aria.d.ts.map +1 -0
  5. package/dist/a11y/focus.d.ts +9 -0
  6. package/dist/a11y/focus.d.ts.map +1 -0
  7. package/dist/a11y/keyboard.d.ts +14 -0
  8. package/dist/a11y/keyboard.d.ts.map +1 -0
  9. package/dist/core/CIHotspot.d.ts +48 -0
  10. package/dist/core/CIHotspot.d.ts.map +1 -0
  11. package/dist/core/ci-hotspot.d.ts +95 -0
  12. package/dist/core/ci-hotspot.d.ts.map +1 -0
  13. package/dist/core/config.d.ts +15 -0
  14. package/dist/core/config.d.ts.map +1 -0
  15. package/dist/core/types.d.ts +227 -0
  16. package/dist/core/types.d.ts.map +1 -0
  17. package/dist/editor/ci-hotspot-editor.d.ts +58 -0
  18. package/dist/editor/ci-hotspot-editor.d.ts.map +1 -0
  19. package/dist/editor/drag-manager.d.ts +18 -0
  20. package/dist/editor/drag-manager.d.ts.map +1 -0
  21. package/dist/editor/editor-toolbar.d.ts +26 -0
  22. package/dist/editor/editor-toolbar.d.ts.map +1 -0
  23. package/dist/editor/index.d.ts +3 -0
  24. package/dist/editor/index.d.ts.map +1 -0
  25. package/dist/editor/js-cloudimage-hotspot-editor.cjs.js +4 -0
  26. package/dist/editor/js-cloudimage-hotspot-editor.cjs.js.map +1 -0
  27. package/dist/editor/js-cloudimage-hotspot-editor.esm.js +1981 -0
  28. package/dist/editor/js-cloudimage-hotspot-editor.esm.js.map +1 -0
  29. package/dist/editor/js-cloudimage-hotspot-editor.min.js +4 -0
  30. package/dist/editor/js-cloudimage-hotspot-editor.min.js.map +1 -0
  31. package/dist/editor/property-panel.d.ts +17 -0
  32. package/dist/editor/property-panel.d.ts.map +1 -0
  33. package/dist/editor/selection-manager.d.ts +15 -0
  34. package/dist/editor/selection-manager.d.ts.map +1 -0
  35. package/dist/editor/types.d.ts +32 -0
  36. package/dist/editor/types.d.ts.map +1 -0
  37. package/dist/editor/undo-manager.d.ts +16 -0
  38. package/dist/editor/undo-manager.d.ts.map +1 -0
  39. package/dist/fullscreen/fullscreen.d.ts +14 -0
  40. package/dist/fullscreen/fullscreen.d.ts.map +1 -0
  41. package/dist/index.d.ts +6 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/js-cloudimage-hotspot.cjs.js +2 -0
  44. package/dist/js-cloudimage-hotspot.cjs.js.map +1 -0
  45. package/dist/js-cloudimage-hotspot.esm.js +1408 -0
  46. package/dist/js-cloudimage-hotspot.esm.js.map +1 -0
  47. package/dist/js-cloudimage-hotspot.min.js +2 -0
  48. package/dist/js-cloudimage-hotspot.min.js.map +1 -0
  49. package/dist/markers/Marker.d.ts +10 -0
  50. package/dist/markers/Marker.d.ts.map +1 -0
  51. package/dist/markers/pulse.d.ts +9 -0
  52. package/dist/markers/pulse.d.ts.map +1 -0
  53. package/dist/popover/Popover.d.ts +41 -0
  54. package/dist/popover/Popover.d.ts.map +1 -0
  55. package/dist/popover/position.d.ts +6 -0
  56. package/dist/popover/position.d.ts.map +1 -0
  57. package/dist/popover/sanitize.d.ts +6 -0
  58. package/dist/popover/sanitize.d.ts.map +1 -0
  59. package/dist/popover/template.d.ts +9 -0
  60. package/dist/popover/template.d.ts.map +1 -0
  61. package/dist/react/index.cjs +2 -0
  62. package/dist/react/index.cjs.map +1 -0
  63. package/dist/react/index.js +1617 -0
  64. package/dist/react/index.js.map +1 -0
  65. package/dist/utils/cloudimage.d.ts +16 -0
  66. package/dist/utils/cloudimage.d.ts.map +1 -0
  67. package/dist/utils/coordinates.d.ts +17 -0
  68. package/dist/utils/coordinates.d.ts.map +1 -0
  69. package/dist/utils/dom.d.ts +13 -0
  70. package/dist/utils/dom.d.ts.map +1 -0
  71. package/dist/utils/events.d.ts +15 -0
  72. package/dist/utils/events.d.ts.map +1 -0
  73. package/dist/zoom/ScrollHint.d.ts +8 -0
  74. package/dist/zoom/ScrollHint.d.ts.map +1 -0
  75. package/dist/zoom/ZoomPan.d.ts +51 -0
  76. package/dist/zoom/ZoomPan.d.ts.map +1 -0
  77. package/dist/zoom/controls.d.ts +14 -0
  78. package/dist/zoom/controls.d.ts.map +1 -0
  79. package/dist/zoom/gestures.d.ts +28 -0
  80. package/dist/zoom/gestures.d.ts.map +1 -0
  81. package/dist/zoom/scroll-hint.d.ts +8 -0
  82. package/dist/zoom/scroll-hint.d.ts.map +1 -0
  83. package/dist/zoom/zoom-pan.d.ts +53 -0
  84. package/dist/zoom/zoom-pan.d.ts.map +1 -0
  85. package/package.json +97 -0
@@ -0,0 +1,1408 @@
1
+ const et = {
2
+ alt: "",
3
+ trigger: "hover",
4
+ zoom: !1,
5
+ zoomMax: 4,
6
+ zoomMin: 1,
7
+ theme: "light",
8
+ pulse: !0,
9
+ zoomControls: !0,
10
+ placement: "top",
11
+ lazyLoad: !0,
12
+ sceneTransition: "fade",
13
+ scrollHint: !0,
14
+ invertMarkerTheme: !1,
15
+ fullscreenButton: !0,
16
+ zoomControlsPosition: "bottom-right"
17
+ }, ot = {
18
+ "data-ci-hotspot-src": { key: "src", type: "string" },
19
+ "data-ci-hotspot-alt": { key: "alt", type: "string" },
20
+ "data-ci-hotspot-items": { key: "hotspots", type: "json" },
21
+ "data-ci-hotspot-trigger": { key: "trigger", type: "string" },
22
+ "data-ci-hotspot-zoom": { key: "zoom", type: "boolean" },
23
+ "data-ci-hotspot-zoom-max": { key: "zoomMax", type: "number" },
24
+ "data-ci-hotspot-zoom-min": { key: "zoomMin", type: "number" },
25
+ "data-ci-hotspot-theme": { key: "theme", type: "string" },
26
+ "data-ci-hotspot-pulse": { key: "pulse", type: "boolean" },
27
+ "data-ci-hotspot-placement": { key: "placement", type: "string" },
28
+ "data-ci-hotspot-lazy-load": { key: "lazyLoad", type: "boolean" },
29
+ "data-ci-hotspot-zoom-controls": { key: "zoomControls", type: "boolean" },
30
+ "data-ci-hotspot-scroll-hint": { key: "scrollHint", type: "boolean" },
31
+ "data-ci-hotspot-ci-token": { key: "token", type: "string", nested: "cloudimage" },
32
+ "data-ci-hotspot-ci-api-version": { key: "apiVersion", type: "string", nested: "cloudimage" },
33
+ "data-ci-hotspot-ci-domain": { key: "domain", type: "string", nested: "cloudimage" },
34
+ "data-ci-hotspot-ci-limit-factor": { key: "limitFactor", type: "number", nested: "cloudimage" },
35
+ "data-ci-hotspot-ci-params": { key: "params", type: "string", nested: "cloudimage" },
36
+ "data-ci-hotspot-scenes": { key: "scenes", type: "json" },
37
+ "data-ci-hotspot-initial-scene": { key: "initialScene", type: "string" },
38
+ "data-ci-hotspot-scene-transition": { key: "sceneTransition", type: "string" },
39
+ "data-ci-hotspot-scene-aspect-ratio": { key: "sceneAspectRatio", type: "string" },
40
+ "data-ci-hotspot-invert-marker-theme": { key: "invertMarkerTheme", type: "boolean" },
41
+ "data-ci-hotspot-fullscreen-button": { key: "fullscreenButton", type: "boolean" },
42
+ "data-ci-hotspot-zoom-controls-position": { key: "zoomControlsPosition", type: "string" }
43
+ };
44
+ function it(s) {
45
+ const t = {}, e = {};
46
+ for (const [o, i] of Object.entries(ot)) {
47
+ const a = s.getAttribute(o);
48
+ if (a === null) continue;
49
+ const n = st(a, i.type);
50
+ i.nested === "cloudimage" ? e[i.key] = n : t[i.key] = n;
51
+ }
52
+ return Object.keys(e).length > 0 && (t.cloudimage = e), t;
53
+ }
54
+ function st(s, t) {
55
+ switch (t) {
56
+ case "boolean":
57
+ return s === "true";
58
+ case "number": {
59
+ const e = parseFloat(s);
60
+ if (isNaN(e)) {
61
+ console.warn(`CIHotspot: invalid number value "${s}"`);
62
+ return;
63
+ }
64
+ return e;
65
+ }
66
+ case "json":
67
+ try {
68
+ return JSON.parse(s);
69
+ } catch {
70
+ console.warn(`CIHotspot: failed to parse JSON value "${s}"`);
71
+ return;
72
+ }
73
+ default:
74
+ return s;
75
+ }
76
+ }
77
+ function Z(s) {
78
+ return {
79
+ ...et,
80
+ ...s,
81
+ src: s.src || "",
82
+ hotspots: s.hotspots || []
83
+ };
84
+ }
85
+ function O(s) {
86
+ if (s.scenes && s.scenes.length > 0) {
87
+ const t = /* @__PURE__ */ new Set();
88
+ for (const e of s.scenes) {
89
+ if (!e.id) throw new Error('CIHotspot: each scene must have an "id"');
90
+ if (t.has(e.id))
91
+ throw new Error(`CIHotspot: duplicate scene ID "${e.id}"`);
92
+ if (t.add(e.id), !e.src) throw new Error(`CIHotspot: scene "${e.id}" must have a "src"`);
93
+ }
94
+ for (const e of s.scenes)
95
+ for (const o of e.hotspots || [])
96
+ if (o.navigateTo && !t.has(o.navigateTo))
97
+ throw new Error(`CIHotspot: hotspot "${o.id}" navigateTo "${o.navigateTo}" is not a valid scene ID`);
98
+ if (s.initialScene && !t.has(s.initialScene))
99
+ throw new Error(`CIHotspot: initialScene "${s.initialScene}" not found in scenes`);
100
+ } else if (!s.src)
101
+ throw new Error('CIHotspot: "src" is required');
102
+ }
103
+ const X = "ci-hotspot-styles";
104
+ function K() {
105
+ return typeof window < "u" && typeof document < "u";
106
+ }
107
+ function nt(s) {
108
+ if (typeof s == "string") {
109
+ const t = document.querySelector(s);
110
+ if (!t) throw new Error(`CIHotspot: element "${s}" not found`);
111
+ return t;
112
+ }
113
+ return s;
114
+ }
115
+ function g(s, t, e) {
116
+ const o = document.createElement(s);
117
+ if (t && (o.className = t), e)
118
+ for (const [i, a] of Object.entries(e))
119
+ o.setAttribute(i, a);
120
+ return o;
121
+ }
122
+ function m(s, ...t) {
123
+ s.classList.add(...t);
124
+ }
125
+ function b(s, ...t) {
126
+ s.classList.remove(...t);
127
+ }
128
+ function rt(s) {
129
+ if (!K() || document.getElementById(X)) return;
130
+ const t = document.createElement("style");
131
+ t.id = X, t.textContent = s, document.head.appendChild(t);
132
+ }
133
+ function $(s) {
134
+ if (typeof s == "string") {
135
+ const t = s.trim();
136
+ return t.endsWith("%") ? { value: parseFloat(t), isPercent: !0 } : { value: parseFloat(t), isPercent: !1 };
137
+ }
138
+ return { value: s, isPercent: !1 };
139
+ }
140
+ function W(s, t, e, o) {
141
+ const i = $(s), a = $(t);
142
+ return {
143
+ x: i.isPercent ? i.value : i.value / e * 100,
144
+ y: a.isPercent ? a.value : a.value / o * 100
145
+ };
146
+ }
147
+ function f(s, t, e, o) {
148
+ return s.addEventListener(t, e, o), () => s.removeEventListener(t, e, o);
149
+ }
150
+ function at(s, t) {
151
+ const e = g("button", "ci-hotspot-marker", {
152
+ "aria-label": s.label,
153
+ "aria-expanded": "false",
154
+ "data-hotspot-id": s.id,
155
+ tabindex: "0"
156
+ });
157
+ if (e.style.left = `${s.x}%`, e.style.top = `${s.y}%`, s.className) {
158
+ const o = s.className.trim().split(/\s+/).filter(Boolean);
159
+ o.length && m(e, ...o);
160
+ }
161
+ return s.hidden && m(e, "ci-hotspot-marker--hidden"), t && m(e, "ci-hotspot-marker--pulse"), s.icon && ht(e, s.icon), e;
162
+ }
163
+ function ct(s) {
164
+ if (typeof DOMParser > "u") return "";
165
+ const e = new DOMParser().parseFromString(s, "image/svg+xml").documentElement;
166
+ return e.querySelector("parsererror") ? "" : (J(e), new XMLSerializer().serializeToString(e));
167
+ }
168
+ const lt = /* @__PURE__ */ new Set([
169
+ "script",
170
+ "foreignobject",
171
+ "iframe",
172
+ "object",
173
+ "embed",
174
+ "animate",
175
+ "animatetransform",
176
+ "animatemotion",
177
+ "set",
178
+ "style",
179
+ "a",
180
+ "use",
181
+ "image",
182
+ "feimage"
183
+ ]);
184
+ function J(s) {
185
+ for (const t of Array.from(s.attributes)) {
186
+ const e = t.name.toLowerCase();
187
+ (e.startsWith("on") || e === "style" || (e === "href" || e === "xlink:href") && /^\s*javascript\s*:/i.test(t.value)) && s.removeAttribute(t.name);
188
+ }
189
+ for (const t of Array.from(s.children)) {
190
+ if (lt.has(t.tagName.toLowerCase())) {
191
+ t.remove();
192
+ continue;
193
+ }
194
+ J(t);
195
+ }
196
+ }
197
+ function ht(s, t) {
198
+ const e = t.trim();
199
+ if (/^<svg[\s>]/i.test(e) || /^<\?xml/i.test(e))
200
+ s.innerHTML = ct(t);
201
+ else if (t.match(/\.(png|jpg|jpeg|gif|svg|webp)$/i) || t.startsWith("http") || t.startsWith("/")) {
202
+ const o = g("img", void 0, {
203
+ src: t,
204
+ alt: "",
205
+ "aria-hidden": "true"
206
+ });
207
+ o.style.width = "100%", o.style.height = "100%", o.style.objectFit = "contain", s.appendChild(o);
208
+ } else {
209
+ const o = g("span", t, { "aria-hidden": "true" });
210
+ s.appendChild(o);
211
+ }
212
+ }
213
+ function u(s, t) {
214
+ t ? (m(s, "ci-hotspot-marker--active"), s.setAttribute("aria-expanded", "true")) : (b(s, "ci-hotspot-marker--active"), s.setAttribute("aria-expanded", "false"));
215
+ }
216
+ function pt(s, t) {
217
+ t ? m(s, "ci-hotspot-marker--hidden") : b(s, "ci-hotspot-marker--hidden");
218
+ }
219
+ function H(s) {
220
+ s.remove();
221
+ }
222
+ function dt(s, t, e, o) {
223
+ const i = s.getBoundingClientRect(), a = e.getBoundingClientRect(), n = t.offsetWidth, r = t.offsetHeight, c = i.left + i.width / 2 - a.left, l = i.top + i.height / 2 - a.top, h = i.top - a.top, d = i.bottom - a.top, p = i.left - a.left, v = i.right - a.left, E = e.offsetWidth, k = e.offsetHeight, w = 8, R = {
224
+ top: h - w,
225
+ bottom: k - d - w,
226
+ left: p - w,
227
+ right: E - v - w
228
+ };
229
+ let x = o.placement;
230
+ x === "auto" && (x = ut(R)), x = ft(x, n, r, R);
231
+ let T, z, Y = 0;
232
+ switch (x) {
233
+ case "top":
234
+ T = c - n / 2, z = h - w - r;
235
+ break;
236
+ case "bottom":
237
+ T = c - n / 2, z = d + w;
238
+ break;
239
+ case "left":
240
+ T = p - w - n, z = l - r / 2;
241
+ break;
242
+ case "right":
243
+ T = v + w, z = l - r / 2;
244
+ break;
245
+ default:
246
+ T = c - n / 2, z = h - w - r;
247
+ }
248
+ const P = mt(T, z, n, r, E, k);
249
+ return Y = x === "top" || x === "bottom" ? T - P.x : z - P.y, {
250
+ x: P.x,
251
+ y: P.y,
252
+ placement: x,
253
+ arrowOffset: Y
254
+ };
255
+ }
256
+ function ut(s) {
257
+ const t = Math.max(s.top, s.bottom, s.left, s.right);
258
+ return t === s.top ? "top" : t === s.bottom ? "bottom" : t === s.right ? "right" : "left";
259
+ }
260
+ function ft(s, t, e, o) {
261
+ const i = s;
262
+ switch (i) {
263
+ case "top":
264
+ if (o.top < e && o.bottom > o.top) return "bottom";
265
+ break;
266
+ case "bottom":
267
+ if (o.bottom < e && o.top > o.bottom) return "top";
268
+ break;
269
+ case "left":
270
+ if (o.left < t && o.right > o.left) return "right";
271
+ break;
272
+ case "right":
273
+ if (o.right < t && o.left > o.right) return "left";
274
+ break;
275
+ }
276
+ return i;
277
+ }
278
+ function mt(s, t, e, o, i, a) {
279
+ let r = s, c = t;
280
+ return e > i - 2 * 4 ? r = (i - e) / 2 : (r < 4 && (r = 4), r + e > i - 4 && (r = i - 4 - e)), o > a - 2 * 4 ? c = (a - o) / 2 : (c < 4 && (c = 4), c + o > a - 4 && (c = a - 4 - o)), { x: r, y: c };
281
+ }
282
+ const gt = /* @__PURE__ */ new Set([
283
+ "a",
284
+ "b",
285
+ "br",
286
+ "div",
287
+ "em",
288
+ "h1",
289
+ "h2",
290
+ "h3",
291
+ "h4",
292
+ "h5",
293
+ "h6",
294
+ "i",
295
+ "img",
296
+ "li",
297
+ "ol",
298
+ "p",
299
+ "span",
300
+ "strong",
301
+ "ul"
302
+ ]), vt = /* @__PURE__ */ new Set([
303
+ "class",
304
+ "href",
305
+ "src",
306
+ "alt",
307
+ "title",
308
+ "target",
309
+ "rel"
310
+ ]), bt = /^(?:https?:|mailto:)/i, yt = /^(?:https?:|data:image\/(?!svg[+%]))/i, wt = /* @__PURE__ */ new Set([
311
+ "noopener",
312
+ "noreferrer",
313
+ "nofollow",
314
+ "external",
315
+ "author",
316
+ "help",
317
+ "license",
318
+ "next",
319
+ "prev",
320
+ "search",
321
+ "tag",
322
+ "bookmark"
323
+ ]);
324
+ function kt(s) {
325
+ const o = new DOMParser().parseFromString(`<body>${s}</body>`, "text/html").body;
326
+ return Q(o), o.innerHTML;
327
+ }
328
+ function Q(s) {
329
+ const t = Array.from(s.childNodes);
330
+ for (const e of t)
331
+ if (e.nodeType !== Node.TEXT_NODE)
332
+ if (e.nodeType === Node.ELEMENT_NODE) {
333
+ const o = e, i = o.tagName.toLowerCase();
334
+ if (!gt.has(i)) {
335
+ o.remove();
336
+ continue;
337
+ }
338
+ const a = Array.from(o.attributes);
339
+ for (const n of a) {
340
+ const r = n.name.toLowerCase();
341
+ if (r.startsWith("on")) {
342
+ o.removeAttribute(n.name);
343
+ continue;
344
+ }
345
+ if (!vt.has(r)) {
346
+ o.removeAttribute(n.name);
347
+ continue;
348
+ }
349
+ if (r === "href" && !bt.test(n.value.trim()))
350
+ o.removeAttribute(n.name);
351
+ else if (r === "src" && !yt.test(n.value.trim()))
352
+ o.removeAttribute(n.name);
353
+ else if (r === "rel") {
354
+ const c = n.value.trim().toLowerCase().split(/\s+/).filter((l) => wt.has(l));
355
+ c.length === 0 ? o.removeAttribute(n.name) : o.setAttribute(n.name, c.join(" "));
356
+ }
357
+ }
358
+ Q(o);
359
+ } else
360
+ e.remove();
361
+ }
362
+ function xt(s) {
363
+ const t = [];
364
+ s.image && t.push(`<img class="ci-hotspot-popover-image" src="${I(s.image)}" alt="${I(s.title || "")}">`);
365
+ const e = [];
366
+ if (s.title && e.push(`<h3 class="ci-hotspot-popover-title">${L(s.title)}</h3>`), s.price && e.push(`<span class="ci-hotspot-popover-price">${L(s.price)}</span>`), s.description && e.push(`<p class="ci-hotspot-popover-description">${L(s.description)}</p>`), s.url && Tt(s.url)) {
367
+ const o = s.ctaText || "View details";
368
+ e.push(
369
+ `<a class="ci-hotspot-popover-cta" href="${I(s.url)}">${L(String(o))}</a>`
370
+ );
371
+ }
372
+ return e.length > 0 && t.push(`<div class="ci-hotspot-popover-body">${e.join("")}</div>`), t.join("");
373
+ }
374
+ function Et(s, t) {
375
+ return t ? t(s) : s.content ? kt(s.content) : s.data ? xt(s.data) : "";
376
+ }
377
+ function L(s) {
378
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
379
+ }
380
+ function Tt(s) {
381
+ const t = s.replace(/[\s\x00-\x1f]/g, "");
382
+ return /^https?:\/\//i.test(t) || /^\/(?!\/)/.test(t) || /^#/.test(t);
383
+ }
384
+ function I(s) {
385
+ return s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
386
+ }
387
+ class N {
388
+ constructor(t, e) {
389
+ this.visible = !1, this.markerEl = null, this.containerEl = null, this.hoverCleanups = [], this.hotspot = t, this.options = e;
390
+ const o = e.triggerMode === "click" || e.triggerMode === "load";
391
+ this.element = g("div", "ci-hotspot-popover", {
392
+ role: o ? "dialog" : "tooltip",
393
+ id: `ci-hotspot-popover-${t.id}`,
394
+ "aria-hidden": "true",
395
+ "data-placement": e.placement === "auto" ? "top" : e.placement,
396
+ ...o && t.label ? { "aria-label": t.label } : {}
397
+ }), this.arrowEl = g("div", "ci-hotspot-popover-arrow"), this.contentEl = g("div", "ci-hotspot-popover-content"), this.element.appendChild(this.arrowEl), this.element.appendChild(this.contentEl);
398
+ const i = Et(t, e.renderFn);
399
+ if (typeof i == "string" ? this.contentEl.innerHTML = i : i instanceof HTMLElement && this.contentEl.appendChild(i), e.triggerMode === "hover") {
400
+ const a = () => this.clearHideTimer(), n = () => this.scheduleHide();
401
+ this.element.addEventListener("mouseenter", a), this.element.addEventListener("mouseleave", n), this.hoverCleanups.push(
402
+ () => this.element.removeEventListener("mouseenter", a),
403
+ () => this.element.removeEventListener("mouseleave", n)
404
+ );
405
+ }
406
+ }
407
+ /** Mount the popover to a container, associating it with a marker */
408
+ mount(t, e) {
409
+ this.containerEl = t, this.markerEl = e, t.appendChild(this.element), this.options.triggerMode === "click" || this.options.triggerMode === "load" ? (e.setAttribute("aria-haspopup", "dialog"), e.setAttribute("aria-controls", this.element.id)) : e.setAttribute("aria-describedby", this.element.id);
410
+ }
411
+ /** Show the popover */
412
+ show() {
413
+ var t, e;
414
+ this.clearHideTimer(), !this.visible && (this.visible = !0, m(this.element, "ci-hotspot-popover--visible"), this.element.setAttribute("aria-hidden", "false"), this.updatePosition(), (e = (t = this.options).onOpen) == null || e.call(t, this.hotspot));
415
+ }
416
+ /** Schedule hide with delay (for hover mode) */
417
+ scheduleHide(t = 200) {
418
+ this.clearHideTimer(), this.hideTimer = setTimeout(() => {
419
+ this.hide();
420
+ }, t);
421
+ }
422
+ /** Hide the popover immediately */
423
+ hide() {
424
+ var t, e;
425
+ this.clearHideTimer(), this.visible && (this.visible = !1, b(this.element, "ci-hotspot-popover--visible"), this.element.setAttribute("aria-hidden", "true"), (e = (t = this.options).onClose) == null || e.call(t, this.hotspot));
426
+ }
427
+ /** Clear any pending hide timer */
428
+ clearHideTimer() {
429
+ this.hideTimer !== void 0 && (clearTimeout(this.hideTimer), this.hideTimer = void 0);
430
+ }
431
+ /** Update popover position relative to marker */
432
+ updatePosition() {
433
+ if (!this.markerEl || !this.containerEl || !this.visible) return;
434
+ const t = dt(
435
+ this.markerEl,
436
+ this.element,
437
+ this.containerEl,
438
+ { placement: this.options.placement }
439
+ );
440
+ this.element.style.left = `${t.x}px`, this.element.style.top = `${t.y}px`, this.element.setAttribute("data-placement", t.placement), this.positionArrow(t.placement, t.arrowOffset);
441
+ }
442
+ positionArrow(t, e) {
443
+ const o = this.arrowEl;
444
+ o.style.left = "", o.style.top = "", t === "top" || t === "bottom" ? o.style.left = `calc(50% - var(--ci-hotspot-arrow-size) + ${e}px)` : o.style.top = `calc(50% - var(--ci-hotspot-arrow-size) + ${e}px)`;
445
+ }
446
+ /** Check if popover is currently visible */
447
+ isVisible() {
448
+ return this.visible;
449
+ }
450
+ /** Get the hotspot associated with this popover */
451
+ getHotspot() {
452
+ return this.hotspot;
453
+ }
454
+ /** Destroy the popover and clean up */
455
+ destroy() {
456
+ var t, e, o;
457
+ this.clearHideTimer(), this.hoverCleanups.forEach((i) => i()), this.hoverCleanups = [], (t = this.markerEl) == null || t.removeAttribute("aria-describedby"), (e = this.markerEl) == null || e.removeAttribute("aria-controls"), (o = this.markerEl) == null || o.removeAttribute("aria-haspopup"), this.element.remove(), this.markerEl = null, this.containerEl = null;
458
+ }
459
+ }
460
+ class zt {
461
+ constructor(t, e, o) {
462
+ this.lastTouchEnd = 0, this.initialPinchDistance = 0, this.initialPinchScale = 1, this.panStartX = 0, this.panStartY = 0, this.isPinching = !1, this.isPanning = !1, this.wasPinching = !1, this.cleanups = [], this.el = t, this.callbacks = e, this.initialPinchScale = o();
463
+ const i = (r) => this.handleTouchStart(r, o), a = (r) => this.handleTouchMove(r), n = (r) => this.handleTouchEnd(r);
464
+ t.addEventListener("touchstart", i, { passive: !1 }), t.addEventListener("touchmove", a, { passive: !1 }), t.addEventListener("touchend", n, { passive: !0 }), this.cleanups.push(
465
+ () => t.removeEventListener("touchstart", i),
466
+ () => t.removeEventListener("touchmove", a),
467
+ () => t.removeEventListener("touchend", n)
468
+ );
469
+ }
470
+ handleTouchStart(t, e) {
471
+ t.touches.length === 2 ? (t.preventDefault(), this.isPinching = !0, this.wasPinching = !1, this.initialPinchDistance = this.getTouchDistance(t.touches), this.initialPinchScale = e()) : t.touches.length === 1 && (this.panStartX = t.touches[0].clientX, this.panStartY = t.touches[0].clientY, this.wasPinching = !1);
472
+ }
473
+ handleTouchMove(t) {
474
+ var e, o, i, a, n, r;
475
+ if (t.touches.length === 2 && this.isPinching) {
476
+ t.preventDefault();
477
+ const c = this.getTouchDistance(t.touches), l = this.initialPinchScale * (c / this.initialPinchDistance), h = (t.touches[0].clientX + t.touches[1].clientX) / 2, d = (t.touches[0].clientY + t.touches[1].clientY) / 2;
478
+ (o = (e = this.callbacks).onPinch) == null || o.call(e, l, h, d);
479
+ } else if (t.touches.length === 1 && !this.isPinching && !this.wasPinching) {
480
+ this.isPanning || (this.isPanning = !0, (a = (i = this.callbacks).onPanStart) == null || a.call(i));
481
+ const c = t.touches[0].clientX - this.panStartX, l = t.touches[0].clientY - this.panStartY;
482
+ (r = (n = this.callbacks).onPan) == null || r.call(n, c, l);
483
+ }
484
+ }
485
+ handleTouchEnd(t) {
486
+ var e, o, i, a;
487
+ if (this.isPinching && t.touches.length < 2 && (this.isPinching = !1, this.wasPinching = !0, t.touches.length === 1 && (this.panStartX = t.touches[0].clientX, this.panStartY = t.touches[0].clientY)), this.isPanning && (this.isPanning = !1, (o = (e = this.callbacks).onPanEnd) == null || o.call(e)), t.changedTouches.length === 1 && t.touches.length === 0) {
488
+ if (this.wasPinching) {
489
+ this.wasPinching = !1, this.lastTouchEnd = 0;
490
+ return;
491
+ }
492
+ const n = Date.now();
493
+ if (n - this.lastTouchEnd < 300) {
494
+ const r = t.changedTouches[0];
495
+ (a = (i = this.callbacks).onDoubleTap) == null || a.call(i, r.clientX, r.clientY);
496
+ }
497
+ this.lastTouchEnd = n;
498
+ }
499
+ }
500
+ getTouchDistance(t) {
501
+ const e = t[0].clientX - t[1].clientX, o = t[0].clientY - t[1].clientY;
502
+ return Math.sqrt(e * e + o * o);
503
+ }
504
+ destroy() {
505
+ this.cleanups.forEach((t) => t()), this.cleanups = [];
506
+ }
507
+ }
508
+ class Ct {
509
+ constructor(t, e, o) {
510
+ this.zoom = 1, this.panX = 0, this.panY = 0, this.enabled = !0, this.isDragging = !1, this.dragStartX = 0, this.dragStartY = 0, this.lastPanX = 0, this.lastPanY = 0, this.gestures = null, this.isGesturing = !1, this.gestureStartZoom = 1, this.touchStartPanX = 0, this.touchStartPanY = 0, this.cleanups = [], this.viewport = t, this.container = e, this.options = o, this.bindEvents();
511
+ }
512
+ bindEvents() {
513
+ const t = (n) => {
514
+ var p, v;
515
+ if (!this.enabled) return;
516
+ if (this.isGesturing) {
517
+ n.preventDefault();
518
+ return;
519
+ }
520
+ if (!n.ctrlKey) {
521
+ (v = (p = this.options).onScrollWithoutZoom) == null || v.call(p);
522
+ return;
523
+ }
524
+ n.preventDefault();
525
+ const r = this.container.getBoundingClientRect(), c = n.clientX - r.left, l = n.clientY - r.top;
526
+ let h = n.deltaY;
527
+ n.deltaMode === 1 && (h *= 20);
528
+ const d = -h * 0.01;
529
+ this.setZoom(this.zoom + d, c, l);
530
+ };
531
+ this.container.addEventListener("wheel", t, { passive: !1 }), this.cleanups.push(() => this.container.removeEventListener("wheel", t)), this.bindSafariGestures();
532
+ const e = (n) => {
533
+ if (!this.enabled) return;
534
+ const r = this.container.getBoundingClientRect(), c = n.clientX - r.left, l = n.clientY - r.top;
535
+ this.zoom > 1 ? this.resetZoom() : this.setZoom(2, c, l);
536
+ };
537
+ this.container.addEventListener("dblclick", e), this.cleanups.push(() => this.container.removeEventListener("dblclick", e));
538
+ const o = (n) => {
539
+ !this.enabled || this.zoom <= 1 || n.button === 0 && (this.isDragging = !0, this.dragStartX = n.clientX, this.dragStartY = n.clientY, this.lastPanX = this.panX, this.lastPanY = this.panY, m(this.viewport, "ci-hotspot-viewport--dragging"), this.container.style.cursor = "grabbing", n.preventDefault());
540
+ }, i = (n) => {
541
+ if (!this.isDragging) return;
542
+ const r = (n.clientX - this.dragStartX) / this.zoom, c = (n.clientY - this.dragStartY) / this.zoom;
543
+ this.panX = this.lastPanX + r, this.panY = this.lastPanY + c, this.clampPan(), this.applyTransform();
544
+ }, a = () => {
545
+ this.isDragging && (this.isDragging = !1, b(this.viewport, "ci-hotspot-viewport--dragging"), this.container.style.cursor = this.zoom > 1 ? "grab" : "");
546
+ };
547
+ this.container.addEventListener("mousedown", o), document.addEventListener("mousemove", i), document.addEventListener("mouseup", a), this.cleanups.push(
548
+ () => this.container.removeEventListener("mousedown", o),
549
+ () => document.removeEventListener("mousemove", i),
550
+ () => document.removeEventListener("mouseup", a)
551
+ ), this.gestures = new zt(
552
+ this.container,
553
+ {
554
+ onPinch: (n, r, c) => {
555
+ const l = this.container.getBoundingClientRect();
556
+ this.setZoom(n, r - l.left, c - l.top);
557
+ },
558
+ onPanStart: () => {
559
+ this.touchStartPanX = this.panX, this.touchStartPanY = this.panY;
560
+ },
561
+ onPan: (n, r) => {
562
+ this.zoom <= 1 || (this.panX = this.touchStartPanX + n / this.zoom, this.panY = this.touchStartPanY + r / this.zoom, this.clampPan(), this.applyTransform());
563
+ },
564
+ onDoubleTap: (n, r) => {
565
+ const c = this.container.getBoundingClientRect();
566
+ this.zoom > 1 ? this.resetZoom() : this.setZoom(2, n - c.left, r - c.top);
567
+ }
568
+ },
569
+ () => this.zoom
570
+ );
571
+ }
572
+ bindSafariGestures() {
573
+ if (typeof window > "u" || !("GestureEvent" in window)) return;
574
+ const t = (i) => {
575
+ i.preventDefault(), this.isGesturing = !0, this.gestureStartZoom = this.zoom;
576
+ }, e = (i) => {
577
+ if (i.preventDefault(), !this.enabled) return;
578
+ const a = i, n = this.container.getBoundingClientRect(), r = i, c = r.clientX != null ? r.clientX - n.left : n.width / 2, l = r.clientY != null ? r.clientY - n.top : n.height / 2;
579
+ this.setZoom(this.gestureStartZoom * a.scale, c, l);
580
+ }, o = (i) => {
581
+ i.preventDefault(), this.isGesturing = !1;
582
+ };
583
+ this.container.addEventListener("gesturestart", t), this.container.addEventListener("gesturechange", e), this.container.addEventListener("gestureend", o), this.cleanups.push(
584
+ () => this.container.removeEventListener("gesturestart", t),
585
+ () => this.container.removeEventListener("gesturechange", e),
586
+ () => this.container.removeEventListener("gestureend", o)
587
+ );
588
+ }
589
+ setZoom(t, e, o) {
590
+ var a, n;
591
+ const i = this.zoom;
592
+ if (this.zoom = Math.max(this.options.zoomMin, Math.min(this.options.zoomMax, t)), e !== void 0 && o !== void 0 && i !== this.zoom) {
593
+ const r = this.container.offsetWidth, c = this.container.offsetHeight, l = this.zoom / i, h = e / r, d = o / c;
594
+ this.panX = this.panX - r * h * (l - 1) / this.zoom, this.panY = this.panY - c * d * (l - 1) / this.zoom;
595
+ }
596
+ this.clampPan(), this.applyTransform(), this.updateCursor(), (n = (a = this.options).onZoom) == null || n.call(a, this.zoom);
597
+ }
598
+ getZoom() {
599
+ return this.zoom;
600
+ }
601
+ resetZoom() {
602
+ var t, e;
603
+ this.zoom = 1, this.panX = 0, this.panY = 0, this.applyTransform(), this.updateCursor(), (e = (t = this.options).onZoom) == null || e.call(t, 1);
604
+ }
605
+ pan(t, e) {
606
+ this.zoom <= 1 || (this.panX += t / this.zoom, this.panY += e / this.zoom, this.clampPan(), this.applyTransform());
607
+ }
608
+ enable() {
609
+ this.enabled = !0;
610
+ }
611
+ disable() {
612
+ this.enabled = !1;
613
+ }
614
+ clampPan() {
615
+ const t = this.container.offsetWidth, e = this.container.offsetHeight, o = t * (this.zoom - 1) / this.zoom, i = e * (this.zoom - 1) / this.zoom;
616
+ this.panX = Math.max(-o, Math.min(0, this.panX)), this.panY = Math.max(-i, Math.min(0, this.panY)), this.zoom <= 1 && (this.panX = 0, this.panY = 0);
617
+ }
618
+ applyTransform() {
619
+ this.viewport.style.transform = `scale(${this.zoom}) translate(${this.panX}px, ${this.panY}px)`, this.viewport.style.setProperty("--zoom", String(this.zoom));
620
+ }
621
+ updateCursor() {
622
+ this.isDragging || (this.container.style.cursor = this.zoom > 1 ? "grab" : "");
623
+ }
624
+ destroy() {
625
+ var t;
626
+ this.cleanups.forEach((e) => e()), this.cleanups = [], (t = this.gestures) == null || t.destroy(), this.gestures = null, this.viewport.style.transform = "", this.viewport.style.removeProperty("--zoom"), this.container.style.cursor = "";
627
+ }
628
+ }
629
+ function St(s, t, e) {
630
+ const o = e.zoomStep || 0.5, i = g("div", "ci-hotspot-zoom-controls");
631
+ i.dataset.position = e.position || "bottom-right";
632
+ const a = g("button", "ci-hotspot-zoom-in", {
633
+ "aria-label": "Zoom in",
634
+ type: "button"
635
+ });
636
+ a.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/></svg>';
637
+ const n = g("button", "ci-hotspot-zoom-out", {
638
+ "aria-label": "Zoom out",
639
+ type: "button"
640
+ });
641
+ n.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>';
642
+ const r = g("button", "ci-hotspot-zoom-reset", {
643
+ "aria-label": "Reset zoom",
644
+ type: "button"
645
+ });
646
+ r.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>', i.appendChild(a), i.appendChild(n), i.appendChild(r), a.addEventListener("click", (l) => {
647
+ l.stopPropagation(), t.setZoom(t.getZoom() + o), c();
648
+ }), n.addEventListener("click", (l) => {
649
+ l.stopPropagation(), t.setZoom(t.getZoom() - o), c();
650
+ }), r.addEventListener("click", (l) => {
651
+ l.stopPropagation(), t.resetZoom(), c();
652
+ });
653
+ function c() {
654
+ const l = t.getZoom();
655
+ a.disabled = l >= e.zoomMax, n.disabled = l <= e.zoomMin, r.disabled = Math.abs(l - 1) < 1e-3;
656
+ }
657
+ return s.appendChild(i), c(), {
658
+ element: i,
659
+ update: c,
660
+ destroy: () => i.remove()
661
+ };
662
+ }
663
+ const Pt = typeof navigator < "u" && /Mac|iPhone|iPad|iPod/i.test(navigator.userAgent), Ht = Pt ? "⌘ Scroll or pinch to zoom" : "Ctrl + scroll to zoom", Lt = 1500;
664
+ class Mt {
665
+ constructor(t) {
666
+ this.hideTimer = null, this.el = document.createElement("div"), this.el.className = "ci-hotspot-scroll-hint", this.el.textContent = Ht, this.el.setAttribute("aria-hidden", "true"), t.appendChild(this.el);
667
+ }
668
+ show() {
669
+ this.hideTimer !== null && clearTimeout(this.hideTimer), this.el.classList.add("ci-hotspot-scroll-hint--visible"), this.hideTimer = setTimeout(() => {
670
+ this.el.classList.remove("ci-hotspot-scroll-hint--visible"), this.hideTimer = null;
671
+ }, Lt);
672
+ }
673
+ destroy() {
674
+ this.hideTimer !== null && (clearTimeout(this.hideTimer), this.hideTimer = null), this.el.remove();
675
+ }
676
+ }
677
+ const At = "cloudimg.io", Dt = "v7", D = 100;
678
+ function It(s, t = D) {
679
+ return Math.ceil(s / t) * t;
680
+ }
681
+ function tt(s, t = 1, e = 1, o = D) {
682
+ const i = s * t * e;
683
+ return It(i, o);
684
+ }
685
+ function C(s, t, e, o = 1, i = 1) {
686
+ const a = t.domain || At, n = t.apiVersion || Dt, r = t.limitFactor || D, c = tt(e, i, o, r), l = encodeURI(s);
687
+ let h = `https://${t.token}.${a}/${n}/${l}?width=${c}`;
688
+ return t.params && (h += `&${t.params}`), h;
689
+ }
690
+ function Ft(s, t, e, o) {
691
+ const i = e.limitFactor || D;
692
+ let a = 0;
693
+ const n = new ResizeObserver((r) => {
694
+ for (const c of r) {
695
+ const l = c.contentRect.width;
696
+ if (l === 0) continue;
697
+ const h = typeof window < "u" && window.devicePixelRatio || 1, d = tt(l, h, o(), i);
698
+ d !== a && (a = d, s.src = C(t, e, l, o(), h));
699
+ }
700
+ });
701
+ return {
702
+ observer: n,
703
+ destroy: () => n.disconnect()
704
+ };
705
+ }
706
+ const M = 50, j = 0.5;
707
+ class Rt {
708
+ constructor(t) {
709
+ this.cleanups = [];
710
+ const { container: e, getZoomPan: o, onEscape: i, onFullscreenToggle: a } = t, n = f(e, "keydown", (r) => {
711
+ const c = r.target;
712
+ if (c.tagName === "INPUT" || c.tagName === "TEXTAREA" || c.tagName === "SELECT")
713
+ return;
714
+ const l = o();
715
+ switch (r.key) {
716
+ case "Escape":
717
+ i == null || i();
718
+ break;
719
+ case "ArrowUp":
720
+ l && l.getZoom() > 1 && (r.preventDefault(), l.pan(0, M));
721
+ break;
722
+ case "ArrowDown":
723
+ l && l.getZoom() > 1 && (r.preventDefault(), l.pan(0, -M));
724
+ break;
725
+ case "ArrowLeft":
726
+ l && l.getZoom() > 1 && (r.preventDefault(), l.pan(M, 0));
727
+ break;
728
+ case "ArrowRight":
729
+ l && l.getZoom() > 1 && (r.preventDefault(), l.pan(-M, 0));
730
+ break;
731
+ case "+":
732
+ case "=":
733
+ l && (r.preventDefault(), l.setZoom(l.getZoom() + j));
734
+ break;
735
+ case "-":
736
+ l && (r.preventDefault(), l.setZoom(l.getZoom() - j));
737
+ break;
738
+ case "0":
739
+ l && (r.preventDefault(), l.resetZoom());
740
+ break;
741
+ case "f":
742
+ a && (r.preventDefault(), a());
743
+ break;
744
+ }
745
+ });
746
+ this.cleanups.push(n);
747
+ }
748
+ destroy() {
749
+ this.cleanups.forEach((t) => t()), this.cleanups = [];
750
+ }
751
+ }
752
+ const Yt = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
753
+ function V(s) {
754
+ return Array.from(s.querySelectorAll(Yt));
755
+ }
756
+ function _(s, t) {
757
+ let e = !1, o = null;
758
+ function i() {
759
+ if (e) return;
760
+ e = !0;
761
+ const r = V(s);
762
+ r.length !== 0 && (r[0].focus(), o = f(s, "keydown", (c) => {
763
+ if (c.key !== "Tab") return;
764
+ const l = V(s);
765
+ if (l.length === 0) return;
766
+ const h = l[0], d = l[l.length - 1];
767
+ c.shiftKey && document.activeElement === h ? (c.preventDefault(), d.focus()) : !c.shiftKey && document.activeElement === d && (c.preventDefault(), h.focus());
768
+ }));
769
+ }
770
+ function a() {
771
+ e && (e = !1, o == null || o(), o = null, t.focus());
772
+ }
773
+ function n() {
774
+ a();
775
+ }
776
+ return { activate: i, deactivate: a, destroy: n };
777
+ }
778
+ let y = null, A = 0;
779
+ function Zt(s) {
780
+ K() && (y || (y = g("div", void 0, {
781
+ "aria-live": "polite",
782
+ "aria-atomic": "true",
783
+ role: "status"
784
+ }), y.style.cssText = "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0", document.body.appendChild(y)), y.textContent = "", requestAnimationFrame(() => {
785
+ y && (y.textContent = s);
786
+ }));
787
+ }
788
+ function B() {
789
+ A++;
790
+ }
791
+ function Ot() {
792
+ A = Math.max(0, A - 1), A === 0 && y && (y.remove(), y = null);
793
+ }
794
+ const G = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><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>', Xt = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 14 10 14 10 20"/><polyline points="20 10 14 10 14 4"/><line x1="14" x2="21" y1="10" y2="3"/><line x1="3" x2="10" y1="21" y2="14"/></svg>';
795
+ function $t() {
796
+ return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled);
797
+ }
798
+ function Wt() {
799
+ return document.fullscreenElement || document.webkitFullscreenElement || null;
800
+ }
801
+ function q(s) {
802
+ return s.requestFullscreen ? s.requestFullscreen() : s.webkitRequestFullscreen ? (s.webkitRequestFullscreen(), Promise.resolve()) : Promise.reject(new Error("Fullscreen API not supported"));
803
+ }
804
+ function F() {
805
+ return document.exitFullscreen ? document.exitFullscreen() : document.webkitExitFullscreen ? (document.webkitExitFullscreen(), Promise.resolve()) : Promise.reject(new Error("Fullscreen API not supported"));
806
+ }
807
+ function Nt(s, t = {}) {
808
+ if (!$t()) return null;
809
+ const e = g("button", "ci-hotspot-fullscreen-btn", {
810
+ "aria-label": "Enter fullscreen",
811
+ "aria-pressed": "false",
812
+ type: "button"
813
+ });
814
+ e.innerHTML = G;
815
+ const o = [];
816
+ function i() {
817
+ return Wt() === s;
818
+ }
819
+ function a() {
820
+ var v;
821
+ const p = i();
822
+ e.innerHTML = p ? Xt : G, e.setAttribute("aria-label", p ? "Exit fullscreen" : "Enter fullscreen"), e.setAttribute("aria-pressed", String(p)), p ? m(s, "ci-hotspot-container--fullscreen") : b(s, "ci-hotspot-container--fullscreen"), (v = t.onChange) == null || v.call(t, p);
823
+ }
824
+ function n() {
825
+ i() ? F().catch(() => {
826
+ }) : q(s).catch(() => {
827
+ });
828
+ }
829
+ function r() {
830
+ i() || q(s).catch(() => {
831
+ });
832
+ }
833
+ function c() {
834
+ i() && F().catch(() => {
835
+ });
836
+ }
837
+ const l = f(document, "fullscreenchange", a);
838
+ o.push(l), document.addEventListener("webkitfullscreenchange", a), o.push(() => document.removeEventListener("webkitfullscreenchange", a));
839
+ const h = f(e, "click", (p) => {
840
+ p.stopPropagation(), n();
841
+ });
842
+ o.push(h), s.appendChild(e);
843
+ function d() {
844
+ i() && F().catch(() => {
845
+ }), b(s, "ci-hotspot-container--fullscreen"), o.forEach((p) => p()), o.length = 0, e.remove();
846
+ }
847
+ return {
848
+ element: e,
849
+ isFullscreen: i,
850
+ toggle: n,
851
+ enter: r,
852
+ exit: c,
853
+ destroy: d
854
+ };
855
+ }
856
+ const jt = '.ci-hotspot-container{--ci-hotspot-marker-size: 24px;--ci-hotspot-marker-color: #ffffff;--ci-hotspot-marker-bg: rgba(0, 0, 0, .6);--ci-hotspot-marker-border-width: 2px;--ci-hotspot-marker-border-color: rgba(255, 255, 255, .8);--ci-hotspot-marker-border: var(--ci-hotspot-marker-border-width) solid var(--ci-hotspot-marker-border-color);--ci-hotspot-marker-border-radius: 50%;--ci-hotspot-marker-shadow: 0 2px 8px rgba(0, 0, 0, .3);--ci-hotspot-pulse-color: rgba(0, 0, 0, .2);--ci-hotspot-pulse-size: 40px;--ci-hotspot-pulse-duration: 1.8s;--ci-hotspot-popover-bg: #ffffff;--ci-hotspot-popover-color: #1a1a1a;--ci-hotspot-popover-border: 1px solid rgba(0, 0, 0, .1);--ci-hotspot-popover-border-radius: 12px;--ci-hotspot-popover-shadow: 0 8px 32px rgba(0, 0, 0, .12);--ci-hotspot-popover-padding: 16px;--ci-hotspot-popover-max-width: 320px;--ci-hotspot-popover-max-height: 400px;--ci-hotspot-popover-font-family: inherit;--ci-hotspot-popover-font-size: 14px;--ci-hotspot-popover-line-height: 1.5;--ci-hotspot-popover-z-index: 1000;--ci-hotspot-arrow-size: 8px;--ci-hotspot-arrow-color: var(--ci-hotspot-popover-bg);--ci-hotspot-title-font-size: 16px;--ci-hotspot-title-font-weight: 600;--ci-hotspot-title-color: #1a1a1a;--ci-hotspot-price-color: #2d8c3c;--ci-hotspot-price-font-size: 18px;--ci-hotspot-price-font-weight: 700;--ci-hotspot-description-color: #666666;--ci-hotspot-cta-bg: #0058a3;--ci-hotspot-cta-color: #ffffff;--ci-hotspot-cta-border-radius: 8px;--ci-hotspot-cta-padding: 8px 16px;--ci-hotspot-hover-transition: .2s ease;--ci-hotspot-popover-transition: .3s ease;--ci-hotspot-scene-transition-duration: .4s;--ci-hotspot-zoom-controls-bg: rgba(255, 255, 255, .9);--ci-hotspot-zoom-controls-color: #333333;--ci-hotspot-zoom-controls-border-radius: 8px;--ci-hotspot-zoom-controls-shadow: 0 2px 8px rgba(0, 0, 0, .15)}.ci-hotspot-container *,.ci-hotspot-container *:before,.ci-hotspot-container *:after{box-sizing:border-box}.ci-hotspot-container{position:relative;overflow:hidden;width:100%;line-height:0;user-select:none;-webkit-user-select:none}.ci-hotspot-viewport{position:relative;width:100%;transform-origin:0 0;will-change:transform;transition:transform .3s ease}.ci-hotspot-viewport--dragging{transition:none}.ci-hotspot-image{display:block;width:100%;height:auto;pointer-events:none}.ci-hotspot-markers{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none}.ci-hotspot-marker{position:absolute;width:var(--ci-hotspot-marker-size);height:var(--ci-hotspot-marker-size);padding:0;border:var(--ci-hotspot-marker-border);border-radius:var(--ci-hotspot-marker-border-radius);background:var(--ci-hotspot-marker-bg);color:var(--ci-hotspot-marker-color);box-shadow:var(--ci-hotspot-marker-shadow);cursor:pointer;pointer-events:auto;transform:translate(-50%,-50%) scale(calc(1 / var(--zoom, 1)));transition:transform var(--ci-hotspot-hover-transition),box-shadow var(--ci-hotspot-hover-transition);z-index:1;display:flex;align-items:center;justify-content:center;font-size:12px;line-height:1;outline:none}.ci-hotspot-marker:hover{transform:translate(-50%,-50%) scale(calc(1.2 / var(--zoom, 1)));box-shadow:0 4px 12px #0006}.ci-hotspot-marker:focus-visible{outline:3px solid var(--ci-hotspot-focus-ring, #4A90D9);outline-offset:2px}.ci-hotspot-marker--active{transform:translate(-50%,-50%) scale(calc(1.2 / var(--zoom, 1)));z-index:2}.ci-hotspot-marker--hidden{display:none}.ci-hotspot-marker--pulse:before{content:"";position:absolute;top:50%;left:50%;width:var(--ci-hotspot-pulse-size);height:var(--ci-hotspot-pulse-size);border-radius:50%;background:var(--ci-hotspot-pulse-color);transform:translate(-50%,-50%) scale(1);animation:ci-hotspot-pulse var(--ci-hotspot-pulse-duration) ease-out infinite;pointer-events:none}@keyframes ci-hotspot-pulse{0%{transform:translate(-50%,-50%) scale(1);opacity:1}to{transform:translate(-50%,-50%) scale(1.8);opacity:0}}.ci-hotspot-marker--pulse{animation:ci-hotspot-breathe 2.4s ease-in-out infinite}.ci-hotspot-marker--pulse:hover,.ci-hotspot-marker--pulse.ci-hotspot-marker--active{animation:none}@keyframes ci-hotspot-breathe{0%,to{transform:translate(-50%,-50%) scale(calc(1 / var(--zoom, 1)))}50%{transform:translate(-50%,-50%) scale(calc(1.15 / var(--zoom, 1)))}}.ci-hotspot-popover{position:absolute;z-index:var(--ci-hotspot-popover-z-index);max-width:var(--ci-hotspot-popover-max-width);background:var(--ci-hotspot-popover-bg);color:var(--ci-hotspot-popover-color);border:var(--ci-hotspot-popover-border);border-radius:var(--ci-hotspot-popover-border-radius);box-shadow:var(--ci-hotspot-popover-shadow);font-family:var(--ci-hotspot-popover-font-family);font-size:var(--ci-hotspot-popover-font-size);line-height:var(--ci-hotspot-popover-line-height);opacity:0;pointer-events:none;transform:translateY(4px);transition:opacity var(--ci-hotspot-popover-transition),transform var(--ci-hotspot-popover-transition)}.ci-hotspot-popover--visible{opacity:1;pointer-events:auto;transform:translateY(0);animation:ci-hotspot-popover-in var(--ci-hotspot-popover-transition) forwards}@keyframes ci-hotspot-popover-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.ci-hotspot-popover-arrow{position:absolute;width:calc(var(--ci-hotspot-arrow-size) * 2);height:calc(var(--ci-hotspot-arrow-size) * 2);background:var(--ci-hotspot-arrow-color);transform:rotate(45deg);pointer-events:none}.ci-hotspot-popover[data-placement=top] .ci-hotspot-popover-arrow{bottom:calc(var(--ci-hotspot-arrow-size) * -1)}.ci-hotspot-popover[data-placement=bottom] .ci-hotspot-popover-arrow{top:calc(var(--ci-hotspot-arrow-size) * -1)}.ci-hotspot-popover[data-placement=left] .ci-hotspot-popover-arrow{right:calc(var(--ci-hotspot-arrow-size) * -1)}.ci-hotspot-popover[data-placement=right] .ci-hotspot-popover-arrow{left:calc(var(--ci-hotspot-arrow-size) * -1)}.ci-hotspot-popover-content{padding:var(--ci-hotspot-popover-padding);max-height:var(--ci-hotspot-popover-max-height);overflow-y:auto;overflow-x:hidden;border-radius:var(--ci-hotspot-popover-border-radius)}.ci-hotspot-popover-image{display:block;width:100%;height:auto;border-radius:calc(var(--ci-hotspot-popover-border-radius) - 4px) calc(var(--ci-hotspot-popover-border-radius) - 4px) 0 0;margin:calc(var(--ci-hotspot-popover-padding) * -1);margin-bottom:12px;width:calc(100% + var(--ci-hotspot-popover-padding) * 2)}.ci-hotspot-popover-body{line-height:1.5}.ci-hotspot-popover-title{margin:0 0 4px;font-size:var(--ci-hotspot-title-font-size);font-weight:var(--ci-hotspot-title-font-weight);color:var(--ci-hotspot-title-color)}.ci-hotspot-popover-price{display:inline-block;margin-bottom:8px;font-size:var(--ci-hotspot-price-font-size);font-weight:var(--ci-hotspot-price-font-weight);color:var(--ci-hotspot-price-color)}.ci-hotspot-popover-description{margin:0 0 12px;color:var(--ci-hotspot-description-color)}.ci-hotspot-popover-cta{display:inline-block;padding:var(--ci-hotspot-cta-padding);background:var(--ci-hotspot-cta-bg);color:var(--ci-hotspot-cta-color);border-radius:var(--ci-hotspot-cta-border-radius);text-decoration:none;font-weight:600;font-size:14px;transition:opacity .2s ease}.ci-hotspot-popover-cta:hover{opacity:.9}.ci-hotspot-popover-cta:focus-visible{outline:3px solid var(--ci-hotspot-focus-ring, #4A90D9);outline-offset:2px}.ci-hotspot-zoom-controls{position:absolute;display:flex;gap:2px;background:var(--ci-hotspot-zoom-controls-bg);border-radius:var(--ci-hotspot-zoom-controls-border-radius);box-shadow:var(--ci-hotspot-zoom-controls-shadow);z-index:10;overflow:hidden}.ci-hotspot-zoom-controls button{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border:none;background:transparent;color:var(--ci-hotspot-zoom-controls-color);cursor:pointer;font-size:18px;line-height:1;padding:0;transition:background .15s ease}.ci-hotspot-zoom-controls button:hover{background:#0000000d}.ci-hotspot-zoom-controls button:disabled{opacity:.3;cursor:default}.ci-hotspot-zoom-controls button:disabled:hover{background:transparent}.ci-hotspot-zoom-controls button svg{width:18px;height:18px}.ci-hotspot-zoom-controls button:focus-visible{outline:3px solid var(--ci-hotspot-focus-ring, #4A90D9);outline-offset:-3px}.ci-hotspot-zoom-controls[data-position=bottom-right]{bottom:16px;right:16px}.ci-hotspot-zoom-controls[data-position=bottom-left]{bottom:16px;left:16px}.ci-hotspot-zoom-controls[data-position=bottom-center]{bottom:16px;left:50%;transform:translate(-50%)}.ci-hotspot-zoom-controls[data-position=top-right]{top:16px;right:16px}.ci-hotspot-zoom-controls[data-position=top-left]{top:16px;left:16px}.ci-hotspot-zoom-controls[data-position=top-center]{top:16px;left:50%;transform:translate(-50%)}.ci-hotspot-cluster{position:absolute;display:flex;align-items:center;justify-content:center;min-width:32px;height:32px;padding:0 8px;border-radius:16px;border:2px solid rgba(255,255,255,.8);background:var(--ci-hotspot-marker-bg);color:var(--ci-hotspot-marker-color);font-size:13px;font-weight:700;cursor:pointer;pointer-events:auto;transform:translate(-50%,-50%) scale(calc(1 / var(--zoom, 1)));box-shadow:var(--ci-hotspot-marker-shadow)}.ci-hotspot-loading .ci-hotspot-image{opacity:0;transition:opacity .3s ease}.ci-hotspot-loading .ci-hotspot-markers{display:none}.ci-hotspot-theme-dark{--ci-hotspot-marker-bg: rgba(255, 255, 255, .8);--ci-hotspot-marker-color: #1a1a1a;--ci-hotspot-marker-border-color: rgba(255, 255, 255, .4);--ci-hotspot-pulse-color: rgba(255, 255, 255, .2);--ci-hotspot-popover-bg: #1a1a1a;--ci-hotspot-popover-color: #f0f0f0;--ci-hotspot-popover-border: 1px solid rgba(255, 255, 255, .1);--ci-hotspot-popover-shadow: 0 8px 32px rgba(0, 0, 0, .4);--ci-hotspot-title-color: #f0f0f0;--ci-hotspot-description-color: #aaaaaa;--ci-hotspot-zoom-controls-bg: rgba(30, 30, 30, .9);--ci-hotspot-zoom-controls-color: #f0f0f0}.ci-hotspot-marker-inverted{--ci-hotspot-marker-bg: rgba(255, 255, 255, .8);--ci-hotspot-marker-color: #1a1a1a;--ci-hotspot-marker-border-color: rgba(0, 0, 0, .3);--ci-hotspot-marker-shadow: 0 2px 8px rgba(0, 0, 0, .15);--ci-hotspot-pulse-color: rgba(0, 0, 0, .15)}.ci-hotspot-theme-dark.ci-hotspot-marker-inverted{--ci-hotspot-marker-bg: rgba(0, 0, 0, .6);--ci-hotspot-marker-color: #ffffff;--ci-hotspot-marker-border-color: rgba(255, 255, 255, .3);--ci-hotspot-pulse-color: rgba(255, 255, 255, .15)}.ci-hotspot-scroll-hint{position:absolute;bottom:16px;left:50%;transform:translate(-50%) translateY(4px);padding:8px 16px;border-radius:20px;background:#000000b3;color:#fff;font-size:13px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;line-height:1;white-space:nowrap;z-index:100;opacity:0;pointer-events:none;transition:opacity .3s ease,transform .3s ease}.ci-hotspot-scroll-hint--visible{opacity:1;transform:translate(-50%) translateY(0)}.ci-hotspot-container--fixed-ratio .ci-hotspot-viewport{overflow:hidden}.ci-hotspot-container--fixed-ratio .ci-hotspot-image{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:contain}.ci-hotspot-container--fixed-ratio .ci-hotspot-markers{z-index:1}.ci-hotspot-scene-incoming{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:contain;pointer-events:none;z-index:0}.ci-hotspot-scene-fade-in{animation:ci-hotspot-scene-fade-in var(--ci-hotspot-scene-transition-duration) ease forwards;z-index:1}.ci-hotspot-scene-fade-out{animation:ci-hotspot-scene-fade-out var(--ci-hotspot-scene-transition-duration) ease forwards}@keyframes ci-hotspot-scene-fade-in{0%{opacity:0}to{opacity:1}}@keyframes ci-hotspot-scene-fade-out{0%{opacity:1}to{opacity:0}}.ci-hotspot-scene-slide-in{animation:ci-hotspot-scene-slide-in var(--ci-hotspot-scene-transition-duration) ease forwards;z-index:1}.ci-hotspot-scene-slide-out{animation:ci-hotspot-scene-slide-out var(--ci-hotspot-scene-transition-duration) ease forwards}@keyframes ci-hotspot-scene-slide-in{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes ci-hotspot-scene-slide-out{0%{transform:translate(0)}to{transform:translate(-100%)}}.ci-hotspot-scene-slide-in-reverse{animation:ci-hotspot-scene-slide-in-reverse var(--ci-hotspot-scene-transition-duration) ease forwards;z-index:1}.ci-hotspot-scene-slide-out-reverse{animation:ci-hotspot-scene-slide-out-reverse var(--ci-hotspot-scene-transition-duration) ease forwards}@keyframes ci-hotspot-scene-slide-in-reverse{0%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes ci-hotspot-scene-slide-out-reverse{0%{transform:translate(0)}to{transform:translate(100%)}}.ci-hotspot-marker--navigate{--ci-hotspot-marker-bg: rgba(0, 88, 163, .7)}.ci-hotspot-navigate-icon{width:75%;height:75%;display:block}.ci-hotspot-scene-transitioning .ci-hotspot-markers{opacity:0;pointer-events:none;transition:opacity .1s ease}.ci-hotspot-scene-loading:after{content:"";position:absolute;top:50%;left:50%;width:32px;height:32px;margin:-16px 0 0 -16px;border:3px solid rgba(0,0,0,.1);border-top-color:#00000080;border-radius:50%;animation:ci-hotspot-spin .6s linear infinite;z-index:10;pointer-events:none}.ci-hotspot-theme-dark .ci-hotspot-scene-loading:after,.ci-hotspot-scene-loading.ci-hotspot-theme-dark:after{border-color:#ffffff1a;border-top-color:#ffffff80}@keyframes ci-hotspot-spin{to{transform:rotate(360deg)}}.ci-hotspot-fullscreen-btn{position:absolute;top:16px;right:16px;display:flex;align-items:center;justify-content:center;width:36px;height:36px;border:none;border-radius:var(--ci-hotspot-zoom-controls-border-radius);background:var(--ci-hotspot-zoom-controls-bg);color:var(--ci-hotspot-zoom-controls-color);box-shadow:var(--ci-hotspot-zoom-controls-shadow);cursor:pointer;padding:0;z-index:10;transition:background .15s ease}.ci-hotspot-fullscreen-btn:hover{background:#0000000d}.ci-hotspot-fullscreen-btn svg{width:18px;height:18px}.ci-hotspot-fullscreen-btn:focus-visible{outline:3px solid var(--ci-hotspot-focus-ring, #4A90D9);outline-offset:2px}.ci-hotspot-container--fullscreen{background:#000;width:100vw;height:100vh;display:flex;align-items:center;justify-content:center}.ci-hotspot-container--fullscreen .ci-hotspot-viewport{width:fit-content;max-width:100%;max-height:100%}.ci-hotspot-container--fullscreen .ci-hotspot-image{max-height:100vh;width:auto;max-width:100%;object-fit:contain}.ci-hotspot-container--fullscreen.ci-hotspot-container--fixed-ratio .ci-hotspot-viewport{width:100%;height:100%}.ci-hotspot-container--fullscreen.ci-hotspot-container--fixed-ratio .ci-hotspot-image{width:100%;height:100%;max-height:none}.ci-hotspot-theme-dark .ci-hotspot-fullscreen-btn,.ci-hotspot-container--fullscreen .ci-hotspot-fullscreen-btn{background:#1e1e1ee6;color:#f0f0f0}.ci-hotspot-theme-dark .ci-hotspot-fullscreen-btn:hover,.ci-hotspot-container--fullscreen .ci-hotspot-fullscreen-btn:hover{background:#ffffff1a}@media (prefers-reduced-motion: reduce){.ci-hotspot-marker,.ci-hotspot-marker:before,.ci-hotspot-popover{animation:none!important;transition-duration:.01ms!important}.ci-hotspot-viewport,.ci-hotspot-scroll-hint{transition-duration:.01ms!important}.ci-hotspot-scene-fade-in,.ci-hotspot-scene-fade-out,.ci-hotspot-scene-slide-in,.ci-hotspot-scene-slide-out,.ci-hotspot-scene-slide-in-reverse,.ci-hotspot-scene-slide-out-reverse{animation-duration:.01ms!important}.ci-hotspot-scene-transitioning .ci-hotspot-markers{transition-duration:.01ms!important}.ci-hotspot-scene-loading:after{animation-duration:.01ms!important}.ci-hotspot-fullscreen-btn{transition-duration:.01ms!important}}', S = class S {
857
+ constructor(t, e) {
858
+ this.markers = /* @__PURE__ */ new Map(), this.popovers = /* @__PURE__ */ new Map(), this.normalizedHotspots = /* @__PURE__ */ new Map(), this.scrollHint = null, this.zoomPan = null, this.zoomControls = null, this.cloudimageHandler = null, this.resizeObserver = null, this.keyboardHandler = null, this.fullscreenControl = null, this.focusTraps = /* @__PURE__ */ new Map(), this.cleanups = [], this.hotspotCleanups = /* @__PURE__ */ new Map(), this.imageLoaded = !1, this.destroyed = !1, this.scenesMap = /* @__PURE__ */ new Map(), this.isTransitioning = !1, this.activeTimers = /* @__PURE__ */ new Set(), this.sceneHotspotOverrides = /* @__PURE__ */ new Map(), this.preloadedScenes = /* @__PURE__ */ new Set(), this.rootEl = nt(t), this.config = Z(e), O(this.config), this.config.scenes && this.config.scenes.length > 0 && this.initScenes(), B(), rt(jt), this.buildDOM(), this.applyTheme(), this.setupImage(), this.initHotspots(), this.config.zoom && this.initZoom(), this.initKeyboard(), this.initFullscreen(), this.setupResponsive();
859
+ }
860
+ /** Auto-initialize all elements with data-ci-hotspot-src or data-ci-hotspot-scenes attribute */
861
+ static autoInit(t) {
862
+ const o = (t || document).querySelectorAll(
863
+ "[data-ci-hotspot-src], [data-ci-hotspot-scenes]"
864
+ ), i = [];
865
+ return o.forEach((a) => {
866
+ const n = it(a);
867
+ (n.src || n.scenes) && i.push(new S(a, n));
868
+ }), i;
869
+ }
870
+ buildDOM() {
871
+ this.containerEl = g("div", "ci-hotspot-container"), this.viewportEl = g("div", "ci-hotspot-viewport"), this.imgEl = g("img", "ci-hotspot-image", {
872
+ alt: this.config.alt || "",
873
+ draggable: "false"
874
+ }), this.markersEl = g("div", "ci-hotspot-markers"), this.viewportEl.appendChild(this.imgEl), this.viewportEl.appendChild(this.markersEl), this.containerEl.appendChild(this.viewportEl), this.containerEl.setAttribute("role", "group"), this.containerEl.setAttribute("aria-label", this.config.alt || "Image with hotspots"), this.config.sceneAspectRatio && (m(this.containerEl, "ci-hotspot-container--fixed-ratio"), this.viewportEl.style.aspectRatio = this.config.sceneAspectRatio), this.rootEl.innerHTML = "", this.rootEl.appendChild(this.containerEl), this.config.lazyLoad && m(this.containerEl, "ci-hotspot-loading");
875
+ }
876
+ applyTheme() {
877
+ this.config.theme === "dark" && m(this.containerEl, "ci-hotspot-theme-dark"), this.config.invertMarkerTheme && m(this.containerEl, "ci-hotspot-marker-inverted");
878
+ }
879
+ setupImage() {
880
+ const t = () => {
881
+ b(this.containerEl, "ci-hotspot-loading"), this.imageLoaded = !0, this.renormalizePixelCoordinates(), this.syncMarkersToImage(), this.showLoadTriggerPopovers();
882
+ };
883
+ if (this.imgEl.addEventListener("load", t), this.cleanups.push(() => this.imgEl.removeEventListener("load", t)), this.config.lazyLoad && typeof IntersectionObserver < "u") {
884
+ const e = new IntersectionObserver(
885
+ (o) => {
886
+ var i;
887
+ (i = o[0]) != null && i.isIntersecting && (this.loadImage(), e.disconnect());
888
+ },
889
+ { threshold: 0.1 }
890
+ );
891
+ e.observe(this.containerEl), this.cleanups.push(() => e.disconnect());
892
+ } else
893
+ this.loadImage();
894
+ }
895
+ loadImage() {
896
+ var t, e;
897
+ if ((t = this.config.cloudimage) != null && t.token) {
898
+ const o = this.containerEl.offsetWidth || 300, i = window.devicePixelRatio || 1, a = ((e = this.zoomPan) == null ? void 0 : e.getZoom()) || 1;
899
+ this.imgEl.src = C(
900
+ this.config.src,
901
+ this.config.cloudimage,
902
+ o,
903
+ a,
904
+ i
905
+ ), this.cloudimageHandler = Ft(
906
+ this.imgEl,
907
+ this.config.src,
908
+ this.config.cloudimage,
909
+ () => {
910
+ var n;
911
+ return ((n = this.zoomPan) == null ? void 0 : n.getZoom()) || 1;
912
+ }
913
+ ), this.cloudimageHandler.observer.observe(this.containerEl), this.cleanups.push(() => {
914
+ var n;
915
+ return (n = this.cloudimageHandler) == null ? void 0 : n.destroy();
916
+ });
917
+ } else
918
+ this.imgEl.src = this.config.src;
919
+ }
920
+ initHotspots() {
921
+ for (const t of this.config.hotspots)
922
+ this.addHotspotInternal(t);
923
+ }
924
+ addHotspotInternal(t) {
925
+ var h, d;
926
+ if (this.markers.has(t.id)) {
927
+ const p = this.markers.get(t.id);
928
+ H(p), this.markers.delete(t.id), (h = this.popovers.get(t.id)) == null || h.destroy(), this.popovers.delete(t.id);
929
+ const v = this.hotspotCleanups.get(t.id);
930
+ v && (v.forEach((k) => k()), this.hotspotCleanups.delete(t.id));
931
+ const E = this.focusTraps.get(t.id);
932
+ E && (E.destroy(), this.focusTraps.delete(t.id));
933
+ }
934
+ const { x: e, y: o } = W(
935
+ t.x,
936
+ t.y,
937
+ this.imgEl.naturalWidth || 1e3,
938
+ this.imgEl.naturalHeight || 1e3
939
+ ), i = { ...t, x: e, y: o };
940
+ this.normalizedHotspots.set(t.id, i);
941
+ const a = this.config.pulse !== !1, n = at(i, a);
942
+ this.markers.set(t.id, n), this.markersEl.appendChild(n);
943
+ const r = t.trigger || this.config.trigger || "hover";
944
+ if (t.navigateTo) {
945
+ const p = this.enrichNavigateHotspot(t);
946
+ if (!!(p.data || p.content || this.config.renderPopover)) {
947
+ const E = t.placement || this.config.placement || "top", k = new N(p, {
948
+ placement: E,
949
+ triggerMode: "hover",
950
+ renderFn: this.config.renderPopover,
951
+ onOpen: this.config.onOpen,
952
+ onClose: this.config.onClose
953
+ });
954
+ this.popovers.set(t.id, k), k.mount(this.containerEl, n), this.bindNavigateTrigger(t, n, k);
955
+ } else
956
+ this.bindNavigateTrigger(t, n);
957
+ return;
958
+ }
959
+ const c = t.placement || this.config.placement || "top", l = new N(t, {
960
+ placement: c,
961
+ triggerMode: r,
962
+ renderFn: this.config.renderPopover,
963
+ onOpen: this.config.onOpen,
964
+ onClose: this.config.onClose
965
+ });
966
+ this.popovers.set(t.id, l), l.mount(this.containerEl, n), this.bindTrigger(t, n, l, r), r === "load" && this.imageLoaded && (this.closeAll(), l.show(), u(n, !0), this.ensureFocusTrap(t.id, l.element, n), (d = this.focusTraps.get(t.id)) == null || d.activate());
967
+ }
968
+ /** For navigateTo hotspots without explicit data/content, generate popover content from the destination scene */
969
+ enrichNavigateHotspot(t) {
970
+ if (t.data || t.content) return t;
971
+ const e = this.scenesMap.get(t.navigateTo);
972
+ return e ? {
973
+ ...t,
974
+ data: { title: t.label || e.alt || e.id }
975
+ } : t;
976
+ }
977
+ bindNavigateTrigger(t, e, o) {
978
+ if (m(e, "ci-hotspot-marker--navigate"), e.innerHTML = S.NAVIGATE_ARROW_SVG, t.arrowDirection != null) {
979
+ const r = e.querySelector("svg");
980
+ r && (r.style.transform = `rotate(${t.arrowDirection}deg)`);
981
+ }
982
+ const i = t.label || t.navigateTo;
983
+ if (e.setAttribute("aria-label", `Navigate to ${i}`), e.setAttribute("aria-roledescription", "navigation hotspot"), o) {
984
+ const r = f(e, "mouseenter", () => {
985
+ this.preloadSceneImage(t.navigateTo), o.clearHideTimer(), o.show(), u(e, !0);
986
+ }), c = f(e, "mouseleave", () => {
987
+ o.scheduleHide(200), this.trackedTimeout(() => {
988
+ o.isVisible() || u(e, !1);
989
+ }, 250);
990
+ }), l = f(e, "focus", () => {
991
+ this.preloadSceneImage(t.navigateTo), o.clearHideTimer(), o.show(), u(e, !0);
992
+ }), h = f(e, "blur", () => {
993
+ o.scheduleHide(200), this.trackedTimeout(() => {
994
+ o.isVisible() || u(e, !1);
995
+ }, 250);
996
+ });
997
+ this.addHotspotCleanups(t.id, r, c, l, h);
998
+ } else {
999
+ const r = f(e, "mouseenter", () => {
1000
+ this.preloadSceneImage(t.navigateTo);
1001
+ }), c = f(e, "focus", () => {
1002
+ this.preloadSceneImage(t.navigateTo);
1003
+ });
1004
+ this.addHotspotCleanups(t.id, r, c);
1005
+ }
1006
+ const a = f(e, "click", (r) => {
1007
+ var c, l, h;
1008
+ r.stopPropagation(), o == null || o.hide(), u(e, !1), (l = (c = this.config).onClick) == null || l.call(c, r, t), (h = t.onClick) == null || h.call(t, r, t), this.goToScene(t.navigateTo);
1009
+ }), n = f(e, "keydown", (r) => {
1010
+ var c, l, h;
1011
+ (r.key === "Enter" || r.key === " ") && (r.preventDefault(), o == null || o.hide(), u(e, !1), (l = (c = this.config).onClick) == null || l.call(c, r, t), (h = t.onClick) == null || h.call(t, r, t), this.goToScene(t.navigateTo));
1012
+ });
1013
+ this.addHotspotCleanups(t.id, a, n);
1014
+ }
1015
+ bindTrigger(t, e, o, i) {
1016
+ i === "hover" ? this.bindHoverTrigger(t, e, o) : (i === "click" || i === "load") && this.bindClickTrigger(t, e, o), this.bindKeyboardTrigger(t, e, o, i);
1017
+ }
1018
+ bindHoverTrigger(t, e, o) {
1019
+ const i = f(e, "mouseenter", () => {
1020
+ o.clearHideTimer(), o.show(), u(e, !0);
1021
+ }), a = f(e, "mouseleave", () => {
1022
+ o.scheduleHide(200), this.trackedTimeout(() => {
1023
+ o.isVisible() || u(e, !1);
1024
+ }, 250);
1025
+ });
1026
+ this.addHotspotCleanups(t.id, i, a);
1027
+ }
1028
+ bindClickTrigger(t, e, o) {
1029
+ const i = _(o.element, e);
1030
+ this.focusTraps.set(t.id, i);
1031
+ const a = f(e, "click", (r) => {
1032
+ var c, l, h;
1033
+ r.stopPropagation(), (l = (c = this.config).onClick) == null || l.call(c, r, t), (h = t.onClick) == null || h.call(t, r, t), o.isVisible() ? (o.hide(), u(e, !1), i.deactivate()) : (this.closeAll(), o.show(), u(e, !0), i.activate());
1034
+ }), n = f(document, "click", (r) => {
1035
+ o.isVisible() && !t.keepOpen && !o.element.contains(r.target) && !e.contains(r.target) && (o.hide(), u(e, !1), i.deactivate());
1036
+ });
1037
+ this.addHotspotCleanups(t.id, a, n);
1038
+ }
1039
+ bindKeyboardTrigger(t, e, o, i) {
1040
+ const a = f(e, "focus", () => {
1041
+ i === "hover" && (o.clearHideTimer(), o.show(), u(e, !0));
1042
+ }), n = f(e, "blur", () => {
1043
+ i === "hover" && (o.scheduleHide(200), this.trackedTimeout(() => {
1044
+ o.isVisible() || u(e, !1);
1045
+ }, 250));
1046
+ }), r = f(e, "keydown", (c) => {
1047
+ var l, h, d, p, v;
1048
+ c.key === "Enter" || c.key === " " ? (c.preventDefault(), (h = (l = this.config).onClick) == null || h.call(l, c, t), o.isVisible() ? (o.hide(), u(e, !1), (d = this.focusTraps.get(t.id)) == null || d.deactivate()) : (this.closeAll(), o.show(), u(e, !0), this.ensureFocusTrap(t.id, o.element, e), (p = this.focusTraps.get(t.id)) == null || p.activate())) : c.key === "Escape" && o.isVisible() && (o.hide(), u(e, !1), (v = this.focusTraps.get(t.id)) == null || v.deactivate(), e.focus());
1049
+ });
1050
+ this.addHotspotCleanups(t.id, a, n, r);
1051
+ }
1052
+ renormalizePixelCoordinates() {
1053
+ const t = this.imgEl.naturalWidth, e = this.imgEl.naturalHeight;
1054
+ if (!(!t || !e)) {
1055
+ for (const o of this.config.hotspots)
1056
+ if (typeof o.x == "number" || typeof o.y == "number") {
1057
+ const { x: i, y: a } = W(o.x, o.y, t, e), n = this.markers.get(o.id);
1058
+ n && (n.style.left = `${i}%`, n.style.top = `${a}%`);
1059
+ const r = this.normalizedHotspots.get(o.id);
1060
+ r && (r.x = i, r.y = a);
1061
+ }
1062
+ }
1063
+ }
1064
+ showLoadTriggerPopovers() {
1065
+ var t;
1066
+ for (const [e, o] of this.popovers) {
1067
+ const i = this.normalizedHotspots.get(e);
1068
+ if (((i == null ? void 0 : i.trigger) || this.config.trigger || "hover") === "load" && !o.isVisible()) {
1069
+ o.show();
1070
+ const n = this.markers.get(e);
1071
+ n && (u(n, !0), this.ensureFocusTrap(e, o.element, n), (t = this.focusTraps.get(e)) == null || t.activate());
1072
+ break;
1073
+ }
1074
+ }
1075
+ }
1076
+ initZoom() {
1077
+ this.config.scrollHint !== !1 && (this.scrollHint = new Mt(this.containerEl)), this.zoomPan = new Ct(this.viewportEl, this.containerEl, {
1078
+ zoomMin: this.config.zoomMin || 1,
1079
+ zoomMax: this.config.zoomMax || 4,
1080
+ onZoom: (t) => {
1081
+ var e, o, i;
1082
+ (o = (e = this.config).onZoom) == null || o.call(e, t), (i = this.zoomControls) == null || i.update();
1083
+ for (const [, a] of this.popovers)
1084
+ a.isVisible() && a.updatePosition();
1085
+ },
1086
+ onScrollWithoutZoom: () => {
1087
+ var t;
1088
+ return (t = this.scrollHint) == null ? void 0 : t.show();
1089
+ }
1090
+ }), this.config.zoomControls !== !1 && (this.zoomControls = St(this.containerEl, this.zoomPan, {
1091
+ zoomMin: this.config.zoomMin || 1,
1092
+ zoomMax: this.config.zoomMax || 4,
1093
+ position: this.config.zoomControlsPosition
1094
+ }));
1095
+ }
1096
+ setupResponsive() {
1097
+ if (typeof ResizeObserver > "u") return;
1098
+ let t = 0;
1099
+ this.resizeObserver = new ResizeObserver(() => {
1100
+ t || (t = requestAnimationFrame(() => {
1101
+ if (t = 0, this.destroyed) return;
1102
+ this.syncMarkersToImage();
1103
+ const e = this.containerEl.offsetWidth;
1104
+ for (const [o, i] of this.normalizedHotspots)
1105
+ if (i.responsive) {
1106
+ const a = this.markers.get(o);
1107
+ if (!a) continue;
1108
+ const n = i.responsive.maxWidth && e > i.responsive.maxWidth || i.responsive.minWidth && e < i.responsive.minWidth;
1109
+ pt(a, !!n);
1110
+ }
1111
+ }));
1112
+ }), this.cleanups.push(() => {
1113
+ t && cancelAnimationFrame(t);
1114
+ }), this.resizeObserver.observe(this.containerEl), this.cleanups.push(() => {
1115
+ var e;
1116
+ return (e = this.resizeObserver) == null ? void 0 : e.disconnect();
1117
+ });
1118
+ }
1119
+ /** Position the markers layer to match the rendered image area within a fixed-ratio viewport */
1120
+ syncMarkersToImage() {
1121
+ if (!this.config.sceneAspectRatio) return;
1122
+ const t = this.viewportEl.offsetWidth, e = this.viewportEl.offsetHeight, o = this.imgEl.naturalWidth, i = this.imgEl.naturalHeight;
1123
+ if (!t || !e || !o || !i) return;
1124
+ const a = t / e, n = o / i;
1125
+ let r, c, l, h;
1126
+ n > a ? (r = t, c = t / n, l = 0, h = (e - c) / 2) : (c = e, r = e * n, l = (t - r) / 2, h = 0), this.markersEl.style.left = `${l}px`, this.markersEl.style.top = `${h}px`, this.markersEl.style.width = `${r}px`, this.markersEl.style.height = `${c}px`, this.markersEl.style.right = "auto", this.markersEl.style.bottom = "auto";
1127
+ }
1128
+ initScenes() {
1129
+ for (const o of this.config.scenes)
1130
+ this.scenesMap.set(o.id, o);
1131
+ const t = this.config.initialScene || this.config.scenes[0].id, e = this.scenesMap.get(t);
1132
+ this.config.src = e.src, this.config.alt = e.alt || "", this.config.hotspots = [...e.hotspots], this.currentSceneId = t;
1133
+ }
1134
+ initKeyboard() {
1135
+ this.keyboardHandler = new Rt({
1136
+ container: this.containerEl,
1137
+ getZoomPan: () => this.zoomPan,
1138
+ onEscape: () => {
1139
+ var t;
1140
+ if ((t = this.fullscreenControl) != null && t.isFullscreen()) {
1141
+ this.fullscreenControl.exit();
1142
+ return;
1143
+ }
1144
+ this.closeAll();
1145
+ },
1146
+ onFullscreenToggle: () => {
1147
+ var t;
1148
+ (t = this.fullscreenControl) == null || t.toggle();
1149
+ }
1150
+ });
1151
+ }
1152
+ initFullscreen() {
1153
+ this.config.fullscreenButton !== !1 && (this.fullscreenControl = Nt(this.containerEl, {
1154
+ onChange: (t) => {
1155
+ var e, o;
1156
+ requestAnimationFrame(() => {
1157
+ for (const [, i] of this.popovers)
1158
+ i.isVisible() && i.updatePosition();
1159
+ }), (o = (e = this.config).onFullscreenChange) == null || o.call(e, t);
1160
+ }
1161
+ }));
1162
+ }
1163
+ preloadSceneImage(t) {
1164
+ var i;
1165
+ if (this.preloadedScenes.has(t)) return;
1166
+ const e = this.scenesMap.get(t);
1167
+ if (!e) return;
1168
+ this.preloadedScenes.add(t);
1169
+ const o = new Image();
1170
+ if ((i = this.config.cloudimage) != null && i.token) {
1171
+ const a = this.containerEl.offsetWidth || 300, n = typeof window < "u" && window.devicePixelRatio || 1;
1172
+ o.src = C(e.src, this.config.cloudimage, a, 1, n);
1173
+ } else
1174
+ o.src = e.src;
1175
+ }
1176
+ ensureFocusTrap(t, e, o) {
1177
+ this.focusTraps.has(t) || this.focusTraps.set(t, _(e, o));
1178
+ }
1179
+ /** Create a setTimeout that is automatically cleared on destroy */
1180
+ trackedTimeout(t, e) {
1181
+ const o = setTimeout(() => {
1182
+ this.activeTimers.delete(o), t();
1183
+ }, e);
1184
+ this.activeTimers.add(o);
1185
+ }
1186
+ /** Sync current hotspots back to scene override map so navigating away and back preserves changes */
1187
+ syncCurrentSceneHotspots() {
1188
+ !this.currentSceneId || this.isTransitioning || this.sceneHotspotOverrides.set(this.currentSceneId, [...this.config.hotspots]);
1189
+ }
1190
+ addHotspotCleanups(t, ...e) {
1191
+ let o = this.hotspotCleanups.get(t);
1192
+ o || (o = [], this.hotspotCleanups.set(t, o)), o.push(...e);
1193
+ }
1194
+ clearHotspots() {
1195
+ for (const t of this.hotspotCleanups.values())
1196
+ t.forEach((e) => e());
1197
+ this.hotspotCleanups.clear();
1198
+ for (const [, t] of this.popovers)
1199
+ t.destroy();
1200
+ this.popovers.clear();
1201
+ for (const [, t] of this.markers)
1202
+ H(t);
1203
+ this.markers.clear(), this.normalizedHotspots.clear();
1204
+ for (const [, t] of this.focusTraps)
1205
+ t.destroy();
1206
+ this.focusTraps.clear();
1207
+ }
1208
+ /** Read scene transition duration from CSS variable (handles both ms and s units) */
1209
+ getSceneTransitionDuration() {
1210
+ if (typeof getComputedStyle > "u") return 400;
1211
+ const t = getComputedStyle(this.containerEl).getPropertyValue("--ci-hotspot-scene-transition-duration").trim(), e = parseFloat(t);
1212
+ return isNaN(e) ? 400 : t.endsWith("s") && !t.endsWith("ms") ? e * 1e3 : e;
1213
+ }
1214
+ performSceneTransition(t, e, o, i) {
1215
+ var c;
1216
+ if (e === "none") {
1217
+ this.clearHotspots(), this.switchToScene(t), i();
1218
+ return;
1219
+ }
1220
+ const a = this.getSceneTransitionDuration();
1221
+ m(this.containerEl, "ci-hotspot-scene-transitioning");
1222
+ const n = g("img", "ci-hotspot-scene-incoming", {
1223
+ alt: t.alt || "",
1224
+ draggable: "false"
1225
+ });
1226
+ if ((c = this.config.cloudimage) != null && c.token) {
1227
+ const l = this.containerEl.offsetWidth || 300, h = typeof window < "u" && window.devicePixelRatio || 1;
1228
+ n.src = C(t.src, this.config.cloudimage, l, 1, h);
1229
+ } else
1230
+ n.src = t.src;
1231
+ const r = () => {
1232
+ if (!this.destroyed) {
1233
+ if (e === "fade")
1234
+ m(n, "ci-hotspot-scene-fade-in"), m(this.imgEl, "ci-hotspot-scene-fade-out");
1235
+ else if (e === "slide") {
1236
+ const l = o ? "-reverse" : "";
1237
+ m(n, `ci-hotspot-scene-slide-in${l}`), m(this.imgEl, `ci-hotspot-scene-slide-out${l}`);
1238
+ }
1239
+ this.viewportEl.insertBefore(n, this.markersEl), this.transitionTimer = setTimeout(() => {
1240
+ if (this.transitionTimer = void 0, this.destroyed) return;
1241
+ this.clearHotspots(), this.switchToScene(t);
1242
+ const l = () => {
1243
+ n.remove(), b(this.imgEl, "ci-hotspot-scene-fade-out"), b(this.imgEl, "ci-hotspot-scene-slide-out"), b(this.imgEl, "ci-hotspot-scene-slide-out-reverse"), b(this.containerEl, "ci-hotspot-scene-transitioning"), i();
1244
+ };
1245
+ this.imgEl.complete && this.imgEl.naturalWidth > 0 ? l() : (this.imgEl.addEventListener("load", l, { once: !0 }), this.imgEl.addEventListener("error", l, { once: !0 }));
1246
+ }, a);
1247
+ }
1248
+ };
1249
+ n.complete ? r() : (m(this.containerEl, "ci-hotspot-scene-loading"), n.onload = () => {
1250
+ b(this.containerEl, "ci-hotspot-scene-loading"), r();
1251
+ }, n.onerror = () => {
1252
+ this.destroyed || (b(this.containerEl, "ci-hotspot-scene-loading"), n.remove(), b(this.containerEl, "ci-hotspot-scene-transitioning"), this.clearHotspots(), this.switchToScene(t), i());
1253
+ });
1254
+ }
1255
+ switchToScene(t) {
1256
+ var o;
1257
+ this.config.src = t.src, this.config.alt = t.alt || "", this.config.hotspots = this.sceneHotspotOverrides.get(t.id) ?? [...t.hotspots], this.imgEl.alt = t.alt || "", this.containerEl.setAttribute("aria-label", t.alt || "Image with hotspots"), this.imageLoaded = !1;
1258
+ const e = () => {
1259
+ this.imageLoaded = !0, this.renormalizePixelCoordinates(), this.syncMarkersToImage(), this.showLoadTriggerPopovers();
1260
+ };
1261
+ if (this.imgEl.addEventListener("load", e, { once: !0 }), (o = this.config.cloudimage) != null && o.token) {
1262
+ const i = this.containerEl.offsetWidth || 300, a = typeof window < "u" && window.devicePixelRatio || 1;
1263
+ this.imgEl.src = C(t.src, this.config.cloudimage, i, 1, a);
1264
+ } else
1265
+ this.imgEl.src = t.src;
1266
+ this.imgEl.complete && this.imgEl.naturalWidth > 0 && !this.imageLoaded && (this.imgEl.removeEventListener("load", e), e()), this.initHotspots();
1267
+ }
1268
+ // === Public API ===
1269
+ /** Get references to the internal DOM elements */
1270
+ getElements() {
1271
+ return {
1272
+ container: this.containerEl,
1273
+ viewport: this.viewportEl,
1274
+ image: this.imgEl,
1275
+ markers: this.markersEl
1276
+ };
1277
+ }
1278
+ open(t) {
1279
+ var i;
1280
+ if (this.destroyed) return;
1281
+ const e = this.popovers.get(t), o = this.markers.get(t);
1282
+ !e || !o || e.isVisible() || (this.closeAll(), e.show(), u(o, !0), (i = this.focusTraps.get(t)) == null || i.activate());
1283
+ }
1284
+ close(t) {
1285
+ var i;
1286
+ if (this.destroyed) return;
1287
+ const e = this.popovers.get(t), o = this.markers.get(t);
1288
+ e && o && (e.hide(), u(o, !1), (i = this.focusTraps.get(t)) == null || i.deactivate());
1289
+ }
1290
+ closeAll() {
1291
+ var t;
1292
+ if (!this.destroyed) {
1293
+ for (const [e, o] of this.popovers)
1294
+ if (o.isVisible()) {
1295
+ o.hide();
1296
+ const i = this.markers.get(e);
1297
+ i && u(i, !1), (t = this.focusTraps.get(e)) == null || t.deactivate();
1298
+ }
1299
+ }
1300
+ }
1301
+ setZoom(t) {
1302
+ var e;
1303
+ this.destroyed || (e = this.zoomPan) == null || e.setZoom(t);
1304
+ }
1305
+ getZoom() {
1306
+ var t;
1307
+ return ((t = this.zoomPan) == null ? void 0 : t.getZoom()) || 1;
1308
+ }
1309
+ resetZoom() {
1310
+ var t;
1311
+ this.destroyed || (t = this.zoomPan) == null || t.resetZoom();
1312
+ }
1313
+ goToScene(t) {
1314
+ if (this.destroyed || this.isTransitioning || !this.scenesMap.size || t === this.currentSceneId) return;
1315
+ const e = this.scenesMap.get(t);
1316
+ if (!e) return;
1317
+ const o = this.config.sceneTransition || "fade";
1318
+ this.isTransitioning = !0, this.zoomPan && this.zoomPan.getZoom() > 1 && this.zoomPan.resetZoom();
1319
+ let i = !1;
1320
+ if (o === "slide") {
1321
+ for (const a of this.config.hotspots)
1322
+ if (a.navigateTo === t) {
1323
+ const n = this.normalizedHotspots.get(a.id);
1324
+ n && n.x <= 50 && (i = !0);
1325
+ break;
1326
+ }
1327
+ }
1328
+ this.syncCurrentSceneHotspots(), this.currentSceneId = t, this.performSceneTransition(e, o, i, () => {
1329
+ var n, r;
1330
+ this.isTransitioning = !1, Zt(`Navigated to ${e.alt || t}`), (r = (n = this.config).onSceneChange) == null || r.call(n, t, e);
1331
+ const a = e.hotspots[0];
1332
+ if (a) {
1333
+ const c = this.markers.get(a.id);
1334
+ c && document.activeElement && this.containerEl.contains(document.activeElement) && c.focus();
1335
+ }
1336
+ });
1337
+ }
1338
+ getCurrentScene() {
1339
+ return this.currentSceneId;
1340
+ }
1341
+ getScenes() {
1342
+ return Array.from(this.scenesMap.keys());
1343
+ }
1344
+ enterFullscreen() {
1345
+ var t;
1346
+ this.destroyed || (t = this.fullscreenControl) == null || t.enter();
1347
+ }
1348
+ exitFullscreen() {
1349
+ var t;
1350
+ this.destroyed || (t = this.fullscreenControl) == null || t.exit();
1351
+ }
1352
+ isFullscreen() {
1353
+ var t;
1354
+ return ((t = this.fullscreenControl) == null ? void 0 : t.isFullscreen()) ?? !1;
1355
+ }
1356
+ addHotspot(t) {
1357
+ this.destroyed || (this.config.hotspots.push(t), this.addHotspotInternal(t), this.syncCurrentSceneHotspots());
1358
+ }
1359
+ removeHotspot(t) {
1360
+ if (this.destroyed) return;
1361
+ const e = this.hotspotCleanups.get(t);
1362
+ e && (e.forEach((n) => n()), this.hotspotCleanups.delete(t));
1363
+ const o = this.focusTraps.get(t);
1364
+ o && (o.destroy(), this.focusTraps.delete(t));
1365
+ const i = this.markers.get(t), a = this.popovers.get(t);
1366
+ a && (a.destroy(), this.popovers.delete(t)), i && (H(i), this.markers.delete(t)), this.normalizedHotspots.delete(t), this.config.hotspots = this.config.hotspots.filter((n) => n.id !== t), this.syncCurrentSceneHotspots();
1367
+ }
1368
+ updateHotspot(t, e) {
1369
+ if (this.destroyed) return;
1370
+ const o = this.config.hotspots.findIndex((l) => l.id === t);
1371
+ if (o === -1) return;
1372
+ const i = this.markers.get(t), a = (i == null ? void 0 : i.nextElementSibling) || null, r = { ...this.config.hotspots[o], ...e };
1373
+ this.removeHotspot(t), this.config.hotspots.splice(o, 0, r), this.addHotspotInternal(r);
1374
+ const c = this.markers.get(t);
1375
+ c && a && this.markersEl.contains(a) && this.markersEl.insertBefore(c, a), this.syncCurrentSceneHotspots();
1376
+ }
1377
+ update(t) {
1378
+ this.destroyed || (this.destroyInternal(), B(), this.config = Z({ ...this.config, ...t }), O(this.config), this.config.scenes && this.config.scenes.length > 0 && this.initScenes(), this.buildDOM(), this.applyTheme(), this.setupImage(), this.initHotspots(), this.config.zoom && this.initZoom(), this.initKeyboard(), this.initFullscreen(), this.setupResponsive());
1379
+ }
1380
+ destroy() {
1381
+ this.destroyed || (this.destroyed = !0, this.destroyInternal(), this.rootEl.innerHTML = "");
1382
+ }
1383
+ destroyInternal() {
1384
+ var t, e, o, i, a, n, r;
1385
+ this.imageLoaded = !1;
1386
+ for (const c of this.activeTimers) clearTimeout(c);
1387
+ this.activeTimers.clear();
1388
+ for (const c of this.hotspotCleanups.values())
1389
+ c.forEach((l) => l());
1390
+ this.hotspotCleanups.clear(), this.cleanups.forEach((c) => c()), this.cleanups = [];
1391
+ for (const [, c] of this.popovers)
1392
+ c.destroy();
1393
+ this.popovers.clear();
1394
+ for (const [, c] of this.markers)
1395
+ H(c);
1396
+ this.markers.clear(), this.normalizedHotspots.clear();
1397
+ for (const [, c] of this.focusTraps)
1398
+ c.destroy();
1399
+ this.focusTraps.clear(), this.scenesMap.clear(), this.preloadedScenes.clear(), this.sceneHotspotOverrides.clear(), this.currentSceneId = void 0, this.isTransitioning = !1, this.transitionTimer !== void 0 && (clearTimeout(this.transitionTimer), this.transitionTimer = void 0), (t = this.fullscreenControl) == null || t.destroy(), this.fullscreenControl = null, (e = this.keyboardHandler) == null || e.destroy(), this.keyboardHandler = null, (o = this.zoomPan) == null || o.destroy(), this.zoomPan = null, (i = this.zoomControls) == null || i.destroy(), this.zoomControls = null, (a = this.scrollHint) == null || a.destroy(), this.scrollHint = null, (n = this.cloudimageHandler) == null || n.destroy(), this.cloudimageHandler = null, (r = this.resizeObserver) == null || r.disconnect(), this.resizeObserver = null, Ot();
1400
+ }
1401
+ };
1402
+ S.NAVIGATE_ARROW_SVG = '<svg class="ci-hotspot-navigate-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>';
1403
+ let U = S;
1404
+ export {
1405
+ U as CIHotspot,
1406
+ U as default
1407
+ };
1408
+ //# sourceMappingURL=js-cloudimage-hotspot.esm.js.map