UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

1,226 lines (1,225 loc) • 39.6 kB
(function() { try { var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}; e.SENTRY_RELEASE = { id: "3.47.0" }; var t = new e.Error().stack; t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "d432a101-96fe-45a4-9b1e-197edfc51d28", e._sentryDebugIdIdentifier = "sentry-dbid-d432a101-96fe-45a4-9b1e-197edfc51d28"); } catch {} })(); import { X as e, kt as t } from "./i18n-DlquqKCP.js"; import { a as n, o as r, t as i } from "./is-debug-IkNSAGo8.js"; import { a, c as o, h as s, i as c, n as l } from "./mobx.module-BTnTbXnp.js"; import { c as u, o as d, r as f, t as p } from "./kioskApi-CG3QGuUx.js"; import { a as m, l as h, u as g } from "./store-DTvNQcN7.js"; import { n as _ } from "./event-scoped-cache-CUHa0QyF.js"; import { $t as v, Bt as y, Ht as ee, Jt as b, Ut as x, Vt as S, Xt as te, an as C, en as w, et as T, r as ne } from "./LayerStore-DCg-juRT.js"; import { a as E, c as D, d as O, f as re, g as k, h as A, i as ie, o as ae, r as oe, s as se, t as ce, v as le } from "./wayfinding-BUQns13Y.js"; //#region src/components/Kiosk/SetKiosk/getName.ts var ue = () => d; //#endregion //#region ../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/extends.js function j() { return j = Object.assign ? Object.assign.bind() : function(e) { for (var t = 1; t < arguments.length; t++) { var n = arguments[t]; for (var r in n) ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]); } return e; }, j.apply(null, arguments); } //#endregion //#region ../../node_modules/.pnpm/resolve-pathname@3.0.0/node_modules/resolve-pathname/esm/resolve-pathname.js function M(e) { return e.charAt(0) === "/"; } function de(e, t) { for (var n = t, r = n + 1, i = e.length; r < i; n += 1, r += 1) e[n] = e[r]; e.pop(); } function fe(e, t) { t === void 0 && (t = ""); var n = e && e.split("/") || [], r = t && t.split("/") || [], i = e && M(e), a = t && M(t), o = i || a; if (e && M(e) ? r = n : n.length && (r.pop(), r = r.concat(n)), !r.length) return "/"; var s; if (r.length) { var c = r[r.length - 1]; s = c === "." || c === ".." || c === ""; } else s = !1; for (var l = 0, u = r.length; u >= 0; u--) { var d = r[u]; d === "." ? de(r, u) : d === ".." ? (de(r, u), l++) : l && (de(r, u), l--); } if (!o) for (; l--;) r.unshift(".."); o && r[0] !== "" && (!r[0] || !M(r[0])) && r.unshift(""); var f = r.join("/"); return s && f.substr(-1) !== "/" && (f += "/"), f; } //#endregion //#region ../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js var pe = "Invariant failed"; function me(e, t) { if (!e) throw Error(pe); } //#endregion //#region ../../node_modules/.pnpm/history@4.10.1/node_modules/history/esm/history.js function he(e) { return e.charAt(0) === "/" ? e : "/" + e; } function ge(e, t) { return e.toLowerCase().indexOf(t.toLowerCase()) === 0 && "/?#".indexOf(e.charAt(t.length)) !== -1; } function _e(e, t) { return ge(e, t) ? e.substr(t.length) : e; } function ve(e) { return e.charAt(e.length - 1) === "/" ? e.slice(0, -1) : e; } function ye(e) { var t = e || "/", n = "", r = "", i = t.indexOf("#"); i !== -1 && (r = t.substr(i), t = t.substr(0, i)); var a = t.indexOf("?"); return a !== -1 && (n = t.substr(a), t = t.substr(0, a)), { pathname: t, search: n === "?" ? "" : n, hash: r === "#" ? "" : r }; } function be(e) { var t = e.pathname, n = e.search, r = e.hash, i = t || "/"; return n && n !== "?" && (i += n.charAt(0) === "?" ? n : "?" + n), r && r !== "#" && (i += r.charAt(0) === "#" ? r : "#" + r), i; } function xe(e, t, n, r) { var i; typeof e == "string" ? (i = ye(e), i.state = t) : (i = j({}, e), i.pathname === void 0 && (i.pathname = ""), i.search ? i.search.charAt(0) !== "?" && (i.search = "?" + i.search) : i.search = "", i.hash ? i.hash.charAt(0) !== "#" && (i.hash = "#" + i.hash) : i.hash = "", t !== void 0 && i.state === void 0 && (i.state = t)); try { i.pathname = decodeURI(i.pathname); } catch (e) { throw e instanceof URIError ? URIError("Pathname \"" + i.pathname + "\" could not be decoded. This is likely caused by an invalid percent-encoding.") : e; } return n && (i.key = n), r ? i.pathname ? i.pathname.charAt(0) !== "/" && (i.pathname = fe(i.pathname, r.pathname)) : i.pathname = r.pathname : i.pathname || (i.pathname = "/"), i; } function Se() { var e = null; function t(t) { return e = t, function() { e === t && (e = null); }; } function n(t, n, r, i) { if (e != null) { var a = typeof e == "function" ? e(t, n) : e; typeof a == "string" ? typeof r == "function" ? r(a, i) : i(!0) : i(a !== !1); } else i(!0); } var r = []; function i(e) { var t = !0; function n() { t && e.apply(void 0, arguments); } return r.push(n), function() { t = !1, r = r.filter(function(e) { return e !== n; }); }; } function a() { var e = [...arguments]; r.forEach(function(t) { return t.apply(void 0, e); }); } return { setPrompt: t, confirmTransitionTo: n, appendListener: i, notifyListeners: a }; } var Ce = !!(typeof window < "u" && window.document && window.document.createElement); function we(e, t) { t(window.confirm(e)); } function Te() { var e = window.navigator.userAgent; return (e.indexOf("Android 2.") !== -1 || e.indexOf("Android 4.0") !== -1) && e.indexOf("Mobile Safari") !== -1 && e.indexOf("Chrome") === -1 && e.indexOf("Windows Phone") === -1 ? !1 : window.history && "pushState" in window.history; } function Ee() { return window.navigator.userAgent.indexOf("Trident") === -1; } function De(e) { return e.state === void 0 && navigator.userAgent.indexOf("CriOS") === -1; } var Oe = "popstate", ke = "hashchange"; function Ae() { try { return window.history.state || {}; } catch { return {}; } } function je(e) { e === void 0 && (e = {}), !Ce && me(!1); var t = window.history, n = Te(), r = !Ee(), i = e, a = i.forceRefresh, o = a !== void 0 && a, s = i.getUserConfirmation, c = s === void 0 ? we : s, l = i.keyLength, u = l === void 0 ? 6 : l, d = e.basename ? ve(he(e.basename)) : ""; function f(e) { var t = e || {}, n = t.key, r = t.state, i = window.location, a = i.pathname, o = i.search, s = i.hash, c = a + o + s; return d && (c = _e(c, d)), xe(c, r, n); } function p() { return Math.random().toString(36).substr(2, u); } var m = Se(); function h(e) { j(A, e), A.length = t.length, m.notifyListeners(A.location, A.action); } function g(e) { De(e) || y(f(e.state)); } function _() { y(f(Ae())); } var v = !1; function y(e) { if (v) v = !1, h(); else { var t = "POP"; m.confirmTransitionTo(e, t, c, function(n) { n ? h({ action: t, location: e }) : ee(e); }); } } function ee(e) { var t = A.location, n = x.indexOf(t.key); n === -1 && (n = 0); var r = x.indexOf(e.key); r === -1 && (r = 0); var i = n - r; i && (v = !0, w(i)); } var b = f(Ae()), x = [b.key]; function S(e) { return d + be(e); } function te(e, r) { var i = "PUSH", a = xe(e, r, p(), A.location); m.confirmTransitionTo(a, i, c, function(e) { if (e) { var r = S(a), s = a.key, c = a.state; if (n) if (t.pushState({ key: s, state: c }, null, r), o) window.location.href = r; else { var l = x.indexOf(A.location.key), u = x.slice(0, l + 1); u.push(a.key), x = u, h({ action: i, location: a }); } else window.location.href = r; } }); } function C(e, r) { var i = "REPLACE", a = xe(e, r, p(), A.location); m.confirmTransitionTo(a, i, c, function(e) { if (e) { var r = S(a), s = a.key, c = a.state; if (n) if (t.replaceState({ key: s, state: c }, null, r), o) window.location.replace(r); else { var l = x.indexOf(A.location.key); l !== -1 && (x[l] = a.key), h({ action: i, location: a }); } else window.location.replace(r); } }); } function w(e) { t.go(e); } function T() { w(-1); } function ne() { w(1); } var E = 0; function D(e) { E += e, E === 1 && e === 1 ? (window.addEventListener(Oe, g), r && window.addEventListener(ke, _)) : E === 0 && (window.removeEventListener(Oe, g), r && window.removeEventListener(ke, _)); } var O = !1; function re(e) { e === void 0 && (e = !1); var t = m.setPrompt(e); return O || (D(1), O = !0), function() { return O && (O = !1, D(-1)), t(); }; } function k(e) { var t = m.appendListener(e); return D(1), function() { D(-1), t(); }; } var A = { length: t.length, action: "POP", location: b, createHref: S, push: te, replace: C, go: w, goBack: T, goForward: ne, block: re, listen: k }; return A; } //#endregion //#region src/services/url-sync.ts var N = je(); function P() { return window.location.pathname; } var F = _(() => []), I = "", L = !1, R = !1, Me = 0, z = () => void 0, B; function Ne() { return F(); } function Pe(t) { if (!I) return P() + t; let n = e(t).search, r = n === "?" ? "" : n; return P() + (r ? `${r}&${I}` : `?${I}`); } function Fe() { return e(N.location.search).search; } function Ie(e) { !L && !R && N.push(Pe(e)); } function Le(e) { return L || R ? !1 : (N.replace(Pe(e)), !0); } function Re() { n(Be), L = !0; } function ze(t) { n(Be), L || (L = t.offHistory), z = t.onNavigate, I = e(N.location.search).platform, L || F().push(P() + N.location.search), B = N.listen((e, t) => { if (V(), L) return; let n = F(), i = P() + e.search; n[n.length - 1] !== i && n.push(i), r.log("history", t, e), t === "POP" && z(); }); } function Be() { L = !1, I = "", z = () => void 0, F().length = 0, V(), B == null || B(), B = void 0; } function V() { R = !1, window.clearTimeout(Me); } function Ve() { R = !0, window.clearTimeout(Me), Me = window.setTimeout(V, 1e3), N.goBack(); } //#endregion //#region src/tools/telemetry.ts var He = "efp-telemetry", Ue = 300 * 1e3, We = 1e3, Ge = 63e3; function Ke(e) { return e ? `${He}:${e}` : He; } function qe(e = He) { return { get() { try { let t = localStorage.getItem(e); return t ? JSON.parse(t) : null; } catch { return null; } }, set(t) { try { localStorage.setItem(e, JSON.stringify(t)); } catch (e) { console.error("Failed to persist telemetry data", e); } }, clear() { try { localStorage.removeItem(e); } catch (e) { console.error("Failed to clear telemetry data", e); } } }; } function Je(e, t) { if (!t) return e; let n = e.indexOf("#"), r = n === -1 ? e : e.slice(0, n), i = n === -1 ? "" : e.slice(n), a = "?"; return r.includes("?") && (a = r.endsWith("?") || r.endsWith("&") ? "" : "&"), `${r}${a}expo=${encodeURIComponent(t)}${i}`; } function Ye(e) { let t = new TextEncoder(), n = [], r = t.encode(JSON.stringify({ ...e, items: [] })).byteLength; for (let i of e.items) { let e = t.encode(JSON.stringify(i)).byteLength, a = n.length > 0 ? e + 1 : e; if (n.length > 0 && r + a > Ge) break; r += a, n.push(i); } let i = n.length === e.items.length ? e : { ...e, items: n }; return { payload: i, body: JSON.stringify(i), bytes: r }; } function Xe(e) { return e >= 400 && e < 500 && e !== 408 && e !== 429; } function Ze(e) { return e.length <= We ? e : (console.warn(`Telemetry queue full: dropping ${e.length - We} oldest events`), e.slice(-1e3)); } function Qe(e) { let t = e.headers.get("Retry-After"); if (!t) return 0; let n = 0, r = Number(t); if (Number.isFinite(r)) n = r * 1e3; else { let e = Date.parse(t); isNaN(e) || (n = Math.max(0, e - Date.now())); } return Math.min(n, Ue); } function $e(e) { var t; let { url: n, expo: r, expoId: i, storage: a = qe(Ke(r)) } = e, o = Je(n, r), s = (t = e.kioskId) == null ? "" : t; function c() { let e = a.get(); return e ? (e.expo = r, e.expoId = i, e.kioskId = s, e) : { expo: r, expoId: i, kioskId: s, items: [] }; } function l(e) { s = e; } let u = !1, d = !1, f = 0; async function p() { if (u) { d = !0; return; } u = !0; try { do { if (d = !1, performance.now() < f) break; let e = null; try { let t = c().items.length; for (; t > 0;) { let n = c(); if (n.items.length === 0) break; let { payload: r, body: i, bytes: a } = Ye(n), s = r.items.length; m(n, n.items.slice(s)), e = r.items, t -= s; let l = await fetch(o, { method: "POST", body: i, headers: { "Content-Type": "application/json" }, credentials: "omit", keepalive: a <= Ge }); if (await l.text().catch(() => void 0), e = null, !l.ok) { if (Xe(l.status)) { console.error(`Telemetry batch refused by the endpoint: HTTP ${l.status} (dropped: ${s})`); continue; } if (l.status === 429 || l.status === 503) { let e = Qe(l); e > 0 && (f = performance.now() + e); } h(r.items), console.error(`Failed to send telemetry: HTTP ${l.status} (requeued: ${s})`); break; } } } catch (t) { e && h(e), console.error("Failed to send telemetry", t); } } while (d); } finally { u = !1; } } function m(e, t) { t.length === 0 ? a.clear() : a.set({ ...e, items: t }); } function h(e) { if (e.length === 0) return; let t = c(); m(t, Ze([...e, ...t.items])); } function g(e) { let t = c(); t.items.push(e), m(t, Ze(t.items)); } async function _(e) { g(e), await p(); } return { enqueue: g, send: _, flush: p, setKioskId: l }; } //#endregion //#region src/tools/track-event.ts var H, et; function tt() { let e = window.__efpEvent; if (H && et === e) return H; H == null || H.flush(); let i; try { var a, o; let e = new URL((a = (o = t()) == null ? void 0 : o.trackerUrl) == null ? "" : a).searchParams.get("expoId"); i = e ? Number(e) : void 0; } catch (e) { r.error(e); } return H = $e({ url: "https://app.expofp.com/api/telemetry", expo: e, expoId: i }), et = e, n(at), H; } function nt(e, t, n) { let r = Ne(), i = r[r.length - 2]; return { type: e, subtype: n, value: t == null ? "" : String(t), timestamp: (/* @__PURE__ */ new Date()).toISOString(), url: window.location.href, referrer: i ? window.location.origin + i : "" }; } function rt() { var e; return !!window.__efpEvent && !!((e = t()) != null && e.trackerUrl) && !g.heatmap; } async function U(e, t, n) { if (r.log("trackEvent", e, t, n), rt()) try { var i; let r = nt(e, t, n), a = f(), o = null; if (a ? o = await it(a) : localStorage.removeItem(u), !rt()) return; let s = tt(); if (a && !o) { s.enqueue(r); return; } s.setKioskId((i = o) == null ? "" : i), ot(s), await s.send(r); } catch (e) { r.error("trackEvent", String(e)); } } var W; async function it(e) { if (!e) return null; let t = localStorage.getItem(u); if (t) return t; if (!W) { let t = window.__efpEvent; W = p(e, "https://app.expofp.com/").then((e) => !e || window.__efpEvent !== t ? null : (localStorage.setItem(u, e), e)).finally(() => { W = void 0; }); } return W; } var G = !1; function at() { H == null || H.flush(), H = void 0, et = void 0, G = !1; } function ot(e) { if (G) return; G = !0; let t = "efp-track-events"; try { let r = localStorage.getItem(t); if (!r) return; let i = JSON.parse(r); if (!Array.isArray(i)) { localStorage.removeItem(t); return; } for (let t of i) { var n; !t || typeof t != "object" || !t.headers || e.enqueue({ type: t.type, value: t.value == null ? "" : String(t.value), timestamp: t.timeStamp, url: t.headers["X-href"], referrer: (n = t.headers["X-ref"]) == null ? "" : n }); } localStorage.removeItem(t); } catch (e) { localStorage.removeItem(t), r.error("Failed to migrate old events.", String(e)); } } //#endregion //#region src/tools/gtag.ts var K = "G-78CKLYWFJK"; window.dataLayer = window.dataLayer || []; function q(...e) { var t, n; ((n = (t = window).dataLayer) == null ? t.dataLayer = [] : n).push(arguments); } var J = /*#__PURE__*/ function(e) { return e.Load = "Load floor plan", e.ViewBooth = "View booth", e.ViewExhibitor = "View exhibitor", e.ViewCategory = "View category", e.Search = "Search", e.ClickCustomButton = "Click custom button", e.ViewVideo = "View video", e.ViewGallery = "View gallery", e.ClickPhone = "Click phone", e.ClickEmail = "Click email", e.ClickWebsite = "Click website", e.ClickFacebook = "Click Facebook", e.ClickInstagaram = "Click Instagram", e.ClickLinkedin = "Click Linkedin", e.ClickTwitter = "Click Twitter", e.ClickGooglePlus = "Click Google Plus", e.ClickXing = "Click Xing", e.ClickYoutube = "Click Youtube", e.ClickBookmark = "Click bookmark", e.ClickDirections = "Click Directions", e.Rendered = "Floor plan rendered", e.WsExhibitorClick = "ws_exhibitor_click", e; }({}); async function st() { try { let e = fetch("https://consent.expofp.com/api/verify-ip/is-in-gdpr"), t = new Promise((e) => { setTimeout(() => { e(null); }, 5e3); }), n = await Promise.race([e, t]); return n instanceof Response && n.ok ? (await n.json()).result : null; } catch (e) { return console.error(e), null; } } function ct(e) { if (e === "granted" || e === "denied") return e; let t = document.cookie.split("; ").find((e) => e.startsWith("cookie_consent=")); if (t) return t === "cookie_consent=true" ? "granted" : "denied"; } function lt(e) { let t = 2592e3, n = i ? "localhost" : ".expofp.com"; document.cookie = `cookie_consent=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${n}`, document.cookie = "cookie_consent=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/", document.cookie = e ? `cookie_consent=${e}; max-age=${t}; domain=${n}; path=/` : `cookie_consent=${e}; max-age=${t}; path=/`; } function ut() { let e = document.cookie.split(";"), t = i ? "localhost" : ".expofp.com"; for (let n = 0; n < e.length; n++) { let r = e[n], i = r.indexOf("="), a = i > -1 ? r.substr(0, i).trim() : r.trim(); a.startsWith("_ga") && (document.cookie = `${a}=;expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${t}`); } } function dt(e) { let t = ct(e); t && (t === "denied" ? (ut(), b.gtag && (window[`ga-disable-${b.gtag}`] = !0), window[`ga-disable-${K}`] = !0) : (b.gtag && (window[`ga-disable-${b.gtag}`] = !1), window[`ga-disable-${K}`] = !1), q("consent", "update", { analytics_storage: t, ad_personalization: t })); } function ft(e, t, n) { switch (e) { case J.ViewBooth: q("event", "select_content", { content_type: e, content_id: t }), U("booview", t); break; case J.ViewCategory: q("event", "select_content", { content_type: e, content_id: t }), U("catview", t); break; case J.ViewExhibitor: case J.ViewGallery: case J.ViewVideo: q("event", "select_content", { content_type: e, content_id: t }); break; case J.Search: q("event", "search", { search_term: t }), U("search", t); break; case J.ClickCustomButton: case J.ClickPhone: case J.ClickEmail: case J.ClickWebsite: case J.ClickFacebook: case J.ClickInstagaram: case J.ClickLinkedin: case J.ClickTwitter: case J.ClickGooglePlus: case J.ClickXing: case J.ClickYoutube: q("event", "share", { content_type: e, content_id: t }), U("share", t); break; case J.ClickBookmark: q("event", "share", { content_type: J.ClickCustomButton, content_id: t }); break; case J.ClickDirections: q("event", "route", { content_type: e, content_id: t }), U("route", t); break; default: q("event", e, { content_type: n, content_id: t }); } } function pt(e, t) { q("event", e, { ...t, fp_key: S.EXPO }); } function mt(e) { pt(J.WsExhibitorClick, { exhibitor_id: e.id, exhibitor_name: e.name, exhibitor_external_id: e.externalId, creative_slot: "ws_slider" }), U("ws_exhibitor_click", e.id); } window.gtag = q; function ht(e) { let t = document.createElement("script"); t.type = "text/javascript", t.async = !0, t.src = `https://www.googletagmanager.com/gtag/js?id=${e}`; let n = document.getElementsByTagName("script")[0]; return n != null && n.parentNode ? n.parentNode.insertBefore(t, n) : document.head.appendChild(t), t; } var gt; function _t() { if (gt || (gt = ht(K), q("js", /* @__PURE__ */ new Date())), b.gtag) { let e = ht(b.gtag); q("config", b.gtag, { fp_key: S.EXPO }), n(() => e.remove()); } q("config", K, { fp_key: S.EXPO }); } q("consent", "default", { ad_storage: "denied", analytics_storage: "denied", region: /* @__PURE__ */ "BE.BG.CZ.DK.DE.EE.IE.EL.ES.FR.HR.IT.CY.LV.LT.LU.HU.MT.NL.AT.PL.PT.RO.SI.SK.FI.SE.UK.IS.NO.LI.CH.MK.AL.RS.TR".split("."), functionality_storage: "denied", personalization_storage: "denied", security_storage: "denied", ad_personalization: "denied" }); //#endregion //#region src/utils/calcSpeed.ts var vt = 1.4, yt = 4.2; function bt(e) { var t; return (e == null || (t = e.toLowerCase) == null ? void 0 : t.call(e).trim()) === "m" ? vt : yt; } //#endregion //#region src/utils/calcTravelTime.ts function xt(e, t) { return Math.round(e / t); } //#endregion //#region src/store/reveal-layer.ts var St = () => void 0; function Ct({ layer: e, show: t, then: n }) { return !e || e.visible ? (n(), St) : (t(e), s(() => e.visible, n)); } //#endregion //#region src/store/RouteStore.ts var wt, Tt, Et, Dt, Y, Ot, kt, At, jt, Mt, Nt, Pt, Ft, It, Lt, Rt, zt, Bt, Vt, Ht, Ut; function X(e, t, n, r) { n && Object.defineProperty(e, t, { enumerable: n.enumerable, configurable: n.configurable, writable: n.writable, value: n.initializer ? n.initializer.call(r) : void 0 }); } function Z(e, t, n, r, i) { var a = {}; return Object.keys(r).forEach(function(e) { a[e] = r[e]; }), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = !0), a = n.slice().reverse().reduce(function(n, r) { return r(e, t, n) || n; }, a), i && a.initializer !== void 0 && (a.value = a.initializer ? a.initializer.call(i) : void 0, a.initializer = void 0), a.initializer === void 0 ? (Object.defineProperty(e, t, a), null) : a; } var Wt = (wt = a({ keepAlive: !0 }), Tt = a({ keepAlive: !0 }), Et = a({ keepAlive: !0 }), Dt = a({ keepAlive: !0 }), Y = class { constructor(e) { this.rootStore = void 0, this.cpTimeout = void 0, X(this, "routeLines", Ot, this), X(this, "routeDistance", kt, this), X(this, "currentPosition", At, this), X(this, "requestCompass", jt, this), X(this, "iconType", Mt, this), X(this, "tappedBooth", Nt, this), X(this, "focusEnabled", Pt, this), X(this, "prevZ", Ft, this), X(this, "markersData", It, this), X(this, "prevMarkers", Lt, this), this.pendingReveal = null, this.lastDirection = void 0, this.directionScheduled = !1, this.pendingDetails = void 0, X(this, "showAccessible", Rt, this), X(this, "onlyAccessible", zt, this), X(this, "currentRouteLayer", Bt, this), X(this, "currentRouteExhibitor", Vt, this), X(this, "routeUnits", Ht, this), X(this, "isGpsTrackingEnabled", Ut, this), this.rootStore = e, this.focusEnabled = !window.location.search; } get tempToBooth() { let e = this.tappedBooth; return e != null && e.exhibitors.some((e) => e === g.details) ? e : null; } set tempToBooth(e) { this.tappedBooth = e; } get canFindLocation() { return !!g.kioskData || !!this.currentPosition; } selectRoute(e, t = !0, n = !1) { if (t && (g.list = { type: "search", text: "", focused: !1 }), e && !e.from && e.to) { let t = this.resolveFallbackFrom(); t && (e = new $(t, e.to, e.waypoints)); } e != null && e.from && e != null && e.to && e.from === e.to && (e = null); let r = []; e != null && e.from && e != null && e.to && window.setTimeout(() => { this.rootStore.showMap(); }, navigator.userAgent.toLowerCase().indexOf("android") > -1 ? 400 : 50), (e == null ? void 0 : e.from) instanceof T && e.from.visible && r.push(e.from), (e == null ? void 0 : e.to) instanceof T && e.to.visible && (this.tempToBooth = null, r.push(e.to)), e || this.emitDirection(null); let i = l(() => { if (this.rootStore.moveToList(r), g.details = e, e && (this.lastDirection = void 0), e && (!e.from || !e.to) && g.overlayBottom && (g.desiredOverlaySize = "medium"), e != null && e.to && e != null && e.from) { let t = Gt(e.from); t && this.rootStore.layerStore.updateVisibility(t, !0); } if (!this.currentRouteLayer) { let t = Kt(this.rootStore.layerStore, e == null ? void 0 : e.from), n = Kt(this.rootStore.layerStore, e == null ? void 0 : e.to); t ? this.currentRouteLayer = t : n && (this.currentRouteLayer = n); } t && e != null && e.from && e != null && e.to && ft(J.ClickDirections, `${e != null && e.from ? "From " + e.from.name : ""} ${e != null && e.to ? "To " + e.to.name : ""}`); }); if (clearTimeout(this.pendingDetails), this.pendingDetails = void 0, n || !e) { i(); return; } let a = g.details; this.pendingDetails = window.setTimeout(() => { this.pendingDetails = void 0, g.details === a && i(); }, 200); } rebuildRouteFromPosition(e) { if (this.pendingDetails !== void 0) return; let t = g.selectedRoute; t != null && t.to && this.selectRoute(new $(e, t.to, t.waypoints), !1, !0); } resolveFallbackFrom() { var e; if (this.currentPosition) return se(this.currentPosition, E, D); let t = g.kioskData; return t ? se({ x: t.x, y: t.y, z: (e = t.z) == null ? void 0 : e }, ue(), ae) : null; } setStartPoint(e) { let t = g.selectedRoute; if (t != null && t.to && !(t != null && t.from) && e) { let n = new $(e, t.to, t.waypoints); this.selectRoute(n); } } get pathLayers() { var e; return (e = h.routeStore.routeLines) == null || (e = e.map((e) => e.p0.layer)) == null ? void 0 : e.filter((e, t, n) => n.indexOf(e) === t).map((e, t) => ({ id: t + 1, layer: h.layerStore.findLayer(e) })); } getNearestBooth(e) { var t; if (!e) return null; let n = this.rootStore.layerStore.findLayer(e.z), r = (t = le()) == null ? void 0 : t.properties.config, i = !!(e.lat && e.lng), a = r && i ? re(e, r) : e; return !a || !A(a.x) || !A(a.y) ? null : this.rootStore.boothStore.booths.filter((t) => { if (m.mode === ne.Default || !n) return t.visible && t.rect; var r; return t.rect && (typeof e.z != "number" && !e.z && t.visible || n.name === ((r = t.layer) == null ? void 0 : r.name)); }).sort((e, t) => C(a, e.rect.center) - C(a, t.rect.center))[0] || null; } setMarkers(e) { var t, n; this.markersData.markers = ((t = e == null ? void 0 : e.markers) == null ? [] : t).map(qt), this.markersData.icons = (n = e == null ? void 0 : e.icons) == null ? [] : n; } selectMarker(e, t) { let n = this.markersData.markers.find((t) => t.id === e); this.markersData.markers.forEach((e) => e.active = !1), n && (n.active = !0); let i = h.layerStore.findLayer(n == null ? void 0 : n.z); if (t && n) { i && !(i != null && i.visible) && m.updateVisibility(i, !0); let e = te(); return e ? e.api.panTo({ x: n.x, y: n.y }) : (r.warn("Map camera is not mounted. Cannot pan to marker."), Promise.resolve()); } return Promise.resolve(); } get selectedMarkers() { return this.markersData.markers.filter((e) => e.active); } get layers() { var e; let t = []; return (e = h.routeStore.routeLines) == null || e.map((e) => e.p0.layer).forEach((e) => { t.indexOf(e) === -1 && t.push(e); }), t.map((e) => h.layerStore.layers.find((t) => t.name === e)).filter((e) => !!e); } clickRoute(e, t) { window.__resett && window.__resett(), this.rootStore.uiState.menu = !1, g.list.type === "route-planner" && (g.list = { type: "search", text: "", focused: !1 }), this.selectRoute(new $(e, t)); } selectCurrentPosition(e, t = !0, n) { var r, i, a, o, s; clearTimeout(this.cpTimeout), e && (e.x = k(e.x), e.y = k(e.y), e.lat !== void 0 && (e.lat = k(e.lat)), e.lng !== void 0 && (e.lng = k(e.lng)), y() || (e.z = void 0)); let c = t && this.rootStore.uiState.details && !(this.rootStore.uiState.details instanceof $), l = t && !c && (this.focusEnabled || this.prevZ != (e == null ? void 0 : e.z)); this.focusEnabled && (this.focusEnabled = !1), this.prevZ = (r = e == null || (i = e.z) == null ? void 0 : i.toString()) == null ? null : r, this.iconType = +!!n; let u = e ? Jt(e) : null; if (!e || !u) { this.currentPosition = null; return; } let d = h.layerStore.findLayer(e.z), f = new en(u.x, u.y, (d == null ? void 0 : d.name) || ((a = this.currentRouteLayer) == null ? void 0 : a.name), O(u), e.lat, e.lng), p = !((o = this.routeLines) != null && o.length); d && (s = this.routeLines) != null && s.length && (p = !!this.routeLines.find((e) => e.p0.layer === d.name || e.p1.layer === d.name)); let m = l && p; this.currentPosition = f, m && this.focusOnPosition(f, d), this.gpsEnabled || (this.cpTimeout = setTimeout(() => { this.currentPosition && this.selectCurrentPosition(null, !1); }, 30 * 1e3)); } findLocation() { var e, t; if (!this.canFindLocation) return; let n = (e = this.currentPosition) == null ? g.kioskData : e; n && (this.currentPosition && localStorage.getItem("efp-compass-permission-granted") === "false" && (h.routeStore.requestCompass = !0), (t = this.pendingReveal) == null || t.call(this), this.pendingReveal = Ct({ layer: h.layerStore.findLayer(n.z), show: (e) => m.updateVisibility(e, !0), then: () => { g.moveToRect = this.findLocationRect(n); } })); } findLocationRect(e) { let t = v.fromCenter(e, { x: 100, y: 100 }), n = x(); if (t.intersects(n)) return t; let r = Math.max(n.min.x, Math.min(e.x, n.max.x)), i = Math.max(n.min.y, Math.min(e.y, n.max.y)), a = Math.min(n.size.width, n.size.height) * .3, o = v.fromCenter({ x: r, y: i }, { x: a, y: a }).intersection(n); return o ? v.fromUnion(t, o) : t; } focusOnPosition(e, t) { var n; (n = this.pendingReveal) == null || n.call(this), this.pendingReveal = Ct({ layer: t, show: (e) => m.updateVisibility(e, !0), then: () => { if (h.maplibreStore.showMaplibre) { g.moveToLocation = !0; return; } let t = te(); if (t) { t.api.panTo({ x: e.x, y: e.y }); return; } r.warn("Map camera is not mounted. Cannot pan to current position."); } }); } get routeInfo() { let e = this.routeDistance, t = this.routeUnits; return e ? { distance: `${e}${t}`, units: t, time: xt(e, bt(t)) } : null; } updateRoute(e, t) { !(e != null && e.length) && !this.routeLines.length || (this.routeLines = e, this.scheduleDirection()); } updateRouteDistance(e) { var t, n, r, i; if (e == null) return; let a = ee(), o = (t = (n = a.getAttribute("units") || "ft").toLowerCase) == null ? void 0 : t.call(n).trim(), s = (r = (i = a.getAttribute("fp-ver")) == null ? void 0 : i.startsWith("5")) != null && r; this.routeDistance = Math.round(e / (s ? 1 : 10)), this.routeUnits = o, this.scheduleDirection(); } scheduleDirection() { this.directionScheduled || (this.directionScheduled = !0, Promise.resolve().then(() => { this.directionScheduled = !1, this.emitDirection(this.directionPayload()); })); } directionPayload() { var e, t; let n = g.selectedRoute, r = this.routeDistance, i = this.routeUnits; return { from: Qt((e = n == null ? void 0 : n.from) == null ? null : e), to: Qt((t = n == null ? void 0 : n.to) == null ? null : t), lines: this.routeLines, distance: r == null ? "" : `${r}${i}`, units: i, time: xt(r == null ? 0 : r, bt(i)) }; } emitDirection(e) { var t, n; e && $t(this.lastDirection, e) || (this.lastDirection = e, (t = (n = this.rootStore.fp).onDirection) == null || t.call(n, e)); } checkRoutes() { if (!oe()) { console.warn("checkRoutes: wayfinding is not initialized — call createWayfinding() first. Skipping route check."); return; } let e = h.boothStore.booths; console.info(`Route check started ${e.length}.... `); for (let t = 0; t < e.length; t++) { let n = e[t]; for (let r = t + 1; r < e.length; r++) { let t = e[r]; ce(ie(n), ie(t)).lines.length || console.warn(`No route found from ${n.name} to ${t.name}`); } } console.info("Route check done...."); } setGpsTrackingEnabled(e) { this.isGpsTrackingEnabled = e; } get gpsEnabled() { return b.autoTrackingGps && this.isGpsTrackingEnabled && !b.enableIPS; } setOnlyAccessible(e) { this.onlyAccessible = e; } }, Ot = Z(Y.prototype, "routeLines", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return []; } }), kt = Z(Y.prototype, "routeDistance", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return null; } }), At = Z(Y.prototype, "currentPosition", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return null; } }), jt = Z(Y.prototype, "requestCompass", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return !1; } }), Mt = Z(Y.prototype, "iconType", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return 0; } }), Nt = Z(Y.prototype, "tappedBooth", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return null; } }), Pt = Z(Y.prototype, "focusEnabled", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return !0; } }), Ft = Z(Y.prototype, "prevZ", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return null; } }), It = Z(Y.prototype, "markersData", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return { icons: [], markers: [] }; } }), Lt = Z(Y.prototype, "prevMarkers", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return []; } }), Rt = Z(Y.prototype, "showAccessible", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return !1; } }), zt = Z(Y.prototype, "onlyAccessible", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return !1; } }), Bt = Z(Y.prototype, "currentRouteLayer", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return null; } }), Vt = Z(Y.prototype, "currentRouteExhibitor", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return null; } }), Z(Y.prototype, "canFindLocation", [a], Object.getOwnPropertyDescriptor(Y.prototype, "canFindLocation"), Y.prototype), Z(Y.prototype, "selectRoute", [l], Object.getOwnPropertyDescriptor(Y.prototype, "selectRoute"), Y.prototype), Z(Y.prototype, "rebuildRouteFromPosition", [l], Object.getOwnPropertyDescriptor(Y.prototype, "rebuildRouteFromPosition"), Y.prototype), Z(Y.prototype, "setStartPoint", [l], Object.getOwnPropertyDescriptor(Y.prototype, "setStartPoint"), Y.prototype), Z(Y.prototype, "pathLayers", [wt], Object.getOwnPropertyDescriptor(Y.prototype, "pathLayers"), Y.prototype), Z(Y.prototype, "setMarkers", [l], Object.getOwnPropertyDescriptor(Y.prototype, "setMarkers"), Y.prototype), Z(Y.prototype, "selectMarker", [l], Object.getOwnPropertyDescriptor(Y.prototype, "selectMarker"), Y.prototype), Z(Y.prototype, "selectedMarkers", [Tt], Object.getOwnPropertyDescriptor(Y.prototype, "selectedMarkers"), Y.prototype), Z(Y.prototype, "layers", [Et], Object.getOwnPropertyDescriptor(Y.prototype, "layers"), Y.prototype), Z(Y.prototype, "clickRoute", [l], Object.getOwnPropertyDescriptor(Y.prototype, "clickRoute"), Y.prototype), Z(Y.prototype, "selectCurrentPosition", [l], Object.getOwnPropertyDescriptor(Y.prototype, "selectCurrentPosition"), Y.prototype), Z(Y.prototype, "findLocation", [l], Object.getOwnPropertyDescriptor(Y.prototype, "findLocation"), Y.prototype), Ht = Z(Y.prototype, "routeUnits", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return "ft"; } }), Z(Y.prototype, "routeInfo", [a], Object.getOwnPropertyDescriptor(Y.prototype, "routeInfo"), Y.prototype), Z(Y.prototype, "updateRoute", [l], Object.getOwnPropertyDescriptor(Y.prototype, "updateRoute"), Y.prototype), Z(Y.prototype, "updateRouteDistance", [l], Object.getOwnPropertyDescriptor(Y.prototype, "updateRouteDistance"), Y.prototype), Z(Y.prototype, "checkRoutes", [l], Object.getOwnPropertyDescriptor(Y.prototype, "checkRoutes"), Y.prototype), Ut = Z(Y.prototype, "isGpsTrackingEnabled", [o], { configurable: !0, enumerable: !0, writable: !0, initializer: function() { return !0; } }), Z(Y.prototype, "setGpsTrackingEnabled", [l], Object.getOwnPropertyDescriptor(Y.prototype, "setGpsTrackingEnabled"), Y.prototype), Z(Y.prototype, "gpsEnabled", [Dt], Object.getOwnPropertyDescriptor(Y.prototype, "gpsEnabled"), Y.prototype), Z(Y.prototype, "setOnlyAccessible", [l], Object.getOwnPropertyDescriptor(Y.prototype, "setOnlyAccessible"), Y.prototype), Y); function Gt(e) { var t; if (e) return e instanceof T ? (t = e.layer) == null ? void 0 : t.name : e.layer; } function Kt(e, t) { var n; return t ? t instanceof T ? (n = t.layer) == null ? null : n : e.findLayer(t.layer) : null; } function qt(e) { return { ...e, x: k(e.x), y: k(e.y), lat: e.lat === void 0 ? void 0 : k(e.lat), lng: e.lng === void 0 ? void 0 : k(e.lng) }; } function Jt(e) { var t, n; let r = (t = (n = le()) == null ? void 0 : n.properties.config) == null ? null : t, i = null; return r && w({ min: r.p0, max: r.p2 }, e) ? i = { ...e } : r && A(e.lat) && A(e.lng) ? i = re(e, r) : r || (i = e), i || null; } function Q(e) { var t; return h.boothStore.findBooth(e) || ((t = h.exhibitorStore.findExhibitor(e)) == null ? void 0 : t.booths[0]); } function Yt(e) { let t = h.boothStore.boothByExternalId.get(e); if (t) return { type: "booth", entity: t }; let n = h.exhibitorStore.exhibitorByExternalId.get(e); if (n) return { type: "exhibitor", entity: n }; } function Xt(e) { let t = [], n = []; for (let r of e) { let e = Yt(r); e && (e.type === "booth" ? t.push(r) : n.push(r)); } return { boothExternalIds: t, exhibitorExternalIds: n }; } function Zt(e, t, n) { var r, i; return new $((r = Q(e)) == null ? null : r, (i = Q(t)) == null ? null : i, n == null ? void 0 : n.map((e) => Q(e)).filter((e) => !!e)); } var $ = class { constructor(e, t, n) { this.from = e, this.to = t, this.waypoints = n; let r = e instanceof T ? e.id : void 0, i = t instanceof T ? t.id : void 0; this.waypoints = n == null ? void 0 : n.filter((e) => e && e.id !== r && e.id !== i); } }; function Qt(e) { var t, n; return e ? e instanceof T ? { id: e.id, name: e.name, externalId: e.externalId, layer: { name: (t = e.layer) == null ? void 0 : t.name, description: (n = e.layer) == null ? void 0 : n.description } } : { id: 2 ** 53 - 1, name: e.name, externalId: void 0, layer: { name: e.layer, description: void 0 } } : null; } function $t(e, t) { return e === void 0 ? !1 : e === null ? !t.from && !t.to && !t.lines.length : c.structural(e, t); } var en = class { constructor(e, t, n, r, i, a) { this.x = e, this.y = t, this.z = n, this.angle = r, this.lat = i, this.lng = a; } }; //#endregion export { Ie as C, ze as S, mt as _, Q as a, Re as b, xt as c, st as d, ct as f, lt as g, dt as h, Zt as i, bt as l, ft as m, $ as n, Yt as o, _t as p, Wt as r, Xt as s, en as t, J as u, U as v, Le as w, Ve as x, Fe as y };