@expofp/floorplan 3.24.2 → 3.25.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 (81) hide show
  1. package/dist/browser/{Button-CT9Bti9C.js → Button-_J1eNxua.js} +5 -5
  2. package/dist/browser/{CookieConsent-BUaaCjVv.js → CookieConsent-j0awTNGB.js} +7 -7
  3. package/dist/browser/{Debug-CuT7wVcD.js → Debug-BAPQwOXG.js} +7 -7
  4. package/dist/browser/{Demo-CypZUOYb.js → Demo-B0TxEACn.js} +9 -9
  5. package/dist/browser/{Free-Cpbw3FP6.js → Free-81RG6a4l.js} +9 -9
  6. package/dist/browser/{GalleryContainer-DX9JoE1-.js → GalleryContainer-CVplb5Pc.js} +10 -10
  7. package/dist/browser/{GpsLoader-BMBhGhOH.js → GpsLoader-oni76hrd.js} +10 -10
  8. package/dist/browser/{KioskStore-BKn-AB-4.js → KioskStore-Cdb5PpF9.js} +4 -4
  9. package/dist/browser/{MaplibreAdapter-C7PhujTO.js → MaplibreAdapter-BfpIMgGx.js} +292 -245
  10. package/dist/browser/{ModalContainer-Bwo9p8q9.js → ModalContainer-pEV9ZmkZ.js} +10 -10
  11. package/dist/browser/{PermissionNotice-Dyrq3hyS.js → PermissionNotice-CoXJjFWX.js} +6 -6
  12. package/dist/browser/{SetKioskMode-CcoLQ3g5.js → SetKioskMode-BUFIP2qd.js} +8 -8
  13. package/dist/browser/{ShowKiosk-1PcWb3Yn.js → ShowKiosk-BHGX8mhm.js} +10 -10
  14. package/dist/browser/{ViewerMenuPanel-CF8_jUkV.js → ViewerMenuPanel-Cr826oJ6.js} +9 -9
  15. package/dist/browser/{add-debug-secret-listener-DtSLeszR.js → add-debug-secret-listener-C0cY_TFM.js} +1 -1
  16. package/dist/browser/{adopt-global-settings-jN08Mvz2.js → adopt-global-settings-Dq8ryk31.js} +9 -9
  17. package/dist/browser/{boolean-editor-BbQkdkV8.js → boolean-editor-CRK3sDV3.js} +9 -9
  18. package/dist/browser/{bootIntercom-tmWxI34Q.js → bootIntercom-CHy1kgnP.js} +2 -2
  19. package/dist/browser/{booth-by-xy-Bn7vAiW7.js → booth-by-xy-BQVcyNx8.js} +6 -6
  20. package/dist/browser/bundle.json +65 -65
  21. package/dist/browser/{classnames-z85nK_ce.js → classnames-_GyL4GDv.js} +2 -2
  22. package/dist/browser/{client-BzyumV4c.js → client-B5zwzSQP.js} +4 -4
  23. package/dist/browser/{components-tvzV2Bmo.js → components-CBQYRwuC.js} +36 -36
  24. package/dist/browser/{debug-overlay-C3yeye6L.js → debug-overlay-DiLNtKlz.js} +10 -10
  25. package/dist/browser/{debug-ui-CVhF-KaS.js → debug-ui-gigsjIuv.js} +6 -6
  26. package/dist/browser/{dist-BvldLH3X.js → dist-B0X-IEcM.js} +5 -5
  27. package/dist/browser/{dist-DhmiIFdt.js → dist-jT3iIwH-.js} +6 -6
  28. package/dist/browser/{dist-4gxnxibz.js → dist-yT7nNd5R.js} +3 -3
  29. package/dist/browser/{efp-debug-init-XDZpnwBR.js → efp-debug-init-B5YMdXnN.js} +3 -3
  30. package/dist/browser/{enum-editor-CO0TOOg_.js → enum-editor-DvCO-CYQ.js} +4 -4
  31. package/dist/browser/{es5-BONrcV9Q.js → es5-BmsIRBXA.js} +2 -2
  32. package/dist/browser/{event-not-found-BNlgAobh.js → event-not-found-fcpAoExJ.js} +1 -1
  33. package/dist/browser/{exports-CahN8vwa.js → exports-CnuKa6hu.js} +1 -1
  34. package/dist/browser/{favicon-BEwJyQw4.js → favicon-CZw845Nj.js} +1 -1
  35. package/dist/browser/{fetch-retry.umd-BvmmPMO4.js → fetch-retry.umd-CBMEcoUE.js} +2 -2
  36. package/dist/browser/{flex-Bhy5-dRM.js → flex-DixRjO_F.js} +5 -5
  37. package/dist/browser/{floorplan.loader-Bm0C_zg8.js → floorplan.loader-CsKKZnNp.js} +683 -662
  38. package/dist/browser/{floorplan.ready-DHOYde8O.js → floorplan.ready-Bf3GEi21.js} +325 -339
  39. package/dist/browser/{fuse-BjPDB9cu.js → fuse-DFd9yKfL.js} +2 -2
  40. package/dist/browser/{i18n-Bsa4AB8X.js → i18n-BexA6ZBP.js} +5 -5
  41. package/dist/browser/index.js +16 -16
  42. package/dist/browser/{index.module-DkCBvLVi.js → index.module-hIW18pWv.js} +4 -4
  43. package/dist/browser/{integrateKiosk-BCZ-cnik.js → integrateKiosk-CHM4p0lX.js} +4 -4
  44. package/dist/browser/{is-webview-BAAplPh1.js → is-webview-8nXIDYh1.js} +1 -1
  45. package/dist/browser/{jsx-runtime-DkDpaV-S.js → jsx-runtime-D38XzQ2p.js} +2 -2
  46. package/dist/browser/{kiosk-record-x3W__3xS.js → kiosk-record-De-vXYCY.js} +1 -1
  47. package/dist/browser/{lib-BpicJGKy.js → lib-D8TLRwKe.js} +3 -3
  48. package/dist/browser/{loadImage-4_-hyOhx.js → loadImage-COkvpk1U.js} +4 -4
  49. package/dist/browser/{logDeviceInfo-ChUkf64r.js → logDeviceInfo-CfoVdcPV.js} +9 -9
  50. package/dist/browser/{main-CD7xHGU2.js → main-DOWrZS6x.js} +1 -1
  51. package/dist/browser/{mobx-BKpyIsVh.js → mobx-CCEGS5Bv.js} +4 -4
  52. package/dist/browser/{optional-boolean-editor-B4R2CbJ8.js → optional-boolean-editor-DNZEf74O.js} +3 -3
  53. package/dist/browser/{optional-enum-editor-ChNfPhsB.js → optional-enum-editor-CGnDO1mh.js} +4 -4
  54. package/dist/browser/{optional-string-editor-D8tXuwta.js → optional-string-editor-C4uY45q3.js} +4 -4
  55. package/dist/browser/{particles.min-FpEw6-hB.js → particles.min-orMOzlvG.js} +2 -2
  56. package/dist/browser/{react-Q3vwxMD4.js → react-D4oi2zZ_.js} +2 -2
  57. package/dist/browser/{react-dom-CwvsoFuP.js → react-dom-CLXWzmt1.js} +3 -3
  58. package/dist/browser/{rolldown-runtime-D85GpSbU.js → rolldown-runtime-C1NynmuH.js} +1 -1
  59. package/dist/browser/{select-IG7dubaJ.js → select-D6Y0QY_4.js} +10 -10
  60. package/dist/browser/{settings-DmxMI46b.js → settings-CI7KY77P.js} +2 -2
  61. package/dist/browser/{settings-item-yCIWkzxL.js → settings-item-CSNxKqBD.js} +6 -6
  62. package/dist/browser/{store-lvPK1tXK.js → store-CVqBbCq4.js} +11 -11
  63. package/dist/browser/{string-editor-HCbCYvjk.js → string-editor-AyKbVKjB.js} +4 -4
  64. package/dist/browser/{text-field-ZCkMcWLU.js → text-field-DKJXuGm9.js} +5 -5
  65. package/dist/browser/{theme-BwOMq2a4.js → theme-yzBklex5.js} +8 -8
  66. package/dist/browser/{ui-CxwXSxPR.js → ui-Dq3Q-Rqt.js} +8 -8
  67. package/dist/browser/{useRenderTarget-D3FPy6Mq.js → useRenderTarget-BYqw3tDW.js} +4 -4
  68. package/dist/esm/components/Maplibre/MaplibreWrapper.d.ts +6 -0
  69. package/dist/esm/components/Maplibre/MaplibreWrapper.js +1 -1
  70. package/dist/esm/components/Maplibre/utils/map-helpers.js +1 -1
  71. package/dist/esm/components/Maplibre/utils/pmtiles-range-fallback.d.ts +53 -0
  72. package/dist/esm/components/Maplibre/utils/pmtiles-range-fallback.js +1 -0
  73. package/dist/esm/components/Maplibre/utils/resolve-map-style.d.ts +1 -1
  74. package/dist/esm/components/Maplibre/utils/resolve-map-style.js +1 -1
  75. package/dist/esm/floorplan.loader.d.ts +30 -0
  76. package/dist/esm/floorplan.loader.js +1 -1
  77. package/dist/esm/floorplan.ready.d.ts +1 -1
  78. package/dist/esm/floorplan.ready.js +1 -1
  79. package/dist/esm/load.js +2 -2
  80. package/dist/esm/types.d.ts +29 -0
  81. package/package.json +9 -9
@@ -1,17 +1,17 @@
1
1
  (function() {
2
2
  try {
3
3
  var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
4
- e.SENTRY_RELEASE = { id: "3.24.2" };
4
+ e.SENTRY_RELEASE = { id: "3.25.0" };
5
5
  var t = new e.Error().stack;
6
6
  t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "3c34ab8b-5d65-4c06-8595-6ed371acabc5", e._sentryDebugIdIdentifier = "sentry-dbid-3c34ab8b-5d65-4c06-8595-6ed371acabc5");
7
7
  } catch {}
8
8
  })();
9
- import { r as e } from "./rolldown-runtime-D85GpSbU.js";
10
- import { a as t, i as n, s as r } from "./efp-debug-init-XDZpnwBR.js";
11
- import { a as i, i as a } from "./adopt-global-settings-jN08Mvz2.js";
12
- import { t as o } from "./jsx-runtime-DkDpaV-S.js";
13
- import "./settings-DmxMI46b.js";
14
- import { t as s } from "./add-debug-secret-listener-DtSLeszR.js";
9
+ import { r as e } from "./rolldown-runtime-C1NynmuH.js";
10
+ import { a as t, i as n, s as r } from "./efp-debug-init-B5YMdXnN.js";
11
+ import { a as i, i as a } from "./adopt-global-settings-Dq8ryk31.js";
12
+ import { t as o } from "./jsx-runtime-D38XzQ2p.js";
13
+ import "./settings-CI7KY77P.js";
14
+ import { t as s } from "./add-debug-secret-listener-C0cY_TFM.js";
15
15
  //#region ../debug/src/lib/ui/render-debug-ui.tsx
16
16
  var c = /* @__PURE__ */ e(r(), 1), l = o(), u = !1;
17
17
  function d() {
@@ -26,7 +26,7 @@ function d() {
26
26
  }
27
27
  });
28
28
  let o = async (t) => {
29
- let { DebugUi: n } = await import("./debug-ui-CVhF-KaS.js"), { createRoot: i } = await import("./client-BzyumV4c.js").then((t) => /* @__PURE__ */ e(t.default, 1)), a = document.createElement("div");
29
+ let { DebugUi: n } = await import("./debug-ui-gigsjIuv.js"), { createRoot: i } = await import("./client-B5zwzSQP.js").then((t) => /* @__PURE__ */ e(t.default, 1)), a = document.createElement("div");
30
30
  document.body.appendChild(a), i(a).render(/* @__PURE__ */ (0, l.jsx)(n, {
31
31
  useDebugButtonState: r.useState,
32
32
  open: t
@@ -1,14 +1,14 @@
1
1
  (function() {
2
2
  try {
3
3
  var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
4
- e.SENTRY_RELEASE = { id: "3.24.2" };
4
+ e.SENTRY_RELEASE = { id: "3.25.0" };
5
5
  var t = new e.Error().stack;
6
6
  t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "7407e64e-4c4e-4bfb-b2ef-80063ad22998", e._sentryDebugIdIdentifier = "sentry-dbid-7407e64e-4c4e-4bfb-b2ef-80063ad22998");
7
7
  } catch {}
8
8
  })();
9
- import { r as e } from "./rolldown-runtime-D85GpSbU.js";
10
- import { t } from "./react-Q3vwxMD4.js";
11
- import { l as n } from "./store-lvPK1tXK.js";
9
+ import { r as e } from "./rolldown-runtime-C1NynmuH.js";
10
+ import { t } from "./react-D4oi2zZ_.js";
11
+ import { l as n } from "./store-CVqBbCq4.js";
12
12
  //#region ../ui/src/shared/activeElement.ts
13
13
  var r = (e) => !!e && "activeElement" in e;
14
14
  function i(e) {
@@ -10,6 +10,12 @@ export declare const MAP_DIM_LAYER_ID = "expofp-map-dim";
10
10
  export interface TileSourceConfig {
11
11
  /** Maplibre style URL or inline style JSON object */
12
12
  style: string | StyleSpecification;
13
+ /**
14
+ * The style and everything it references ship inside the plan archive. Local
15
+ * hosts serve those files themselves, so PMTiles archives get a source that
16
+ * tolerates a host without Range support.
17
+ */
18
+ offline?: boolean;
13
19
  }
14
20
  export interface CameraPaddingOptions {
15
21
  top: number;
@@ -1 +1 @@
1
- import{jsx as B}from"react/jsx-runtime";import"maplibre-gl/dist/maplibre-gl.css";import{Renderer as N}from"@expofp/renderer";import{addProtocol as G,Map as Y}from"maplibre-gl";import{Protocol as k}from"pmtiles";import{useEffect as E,useRef as l}from"react";import{createStyleTransform as q}from"./utils/resolve-map-style";import{createUpdatePump as H}from"./utils/update-pump";export const MAP_DIM_LAYER_ID="expofp-map-dim";const y="expofp-map-dim-source",J="3d-expofp";let g=null;const Q=["coalesce",["get","name:en"],["get","name_en"],["get","name:latin"],["get","name"]],V={type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,-85],[180,-85],[180,85],[-180,85],[-180,-85]]]},properties:{}};function I(e){if(!e||typeof e!="object")return!1;const r=e.length;if(typeof r!="number"||r<16)return!1;const o=e[0];return typeof o=="number"&&Number.isFinite(o)}function W(e){if(I(e))return Array.from(e);const o=e?.defaultProjectionData?.mainMatrix;return I(o)?Array.from(o):(console.warn("Maplibre custom layer received an unsupported projection matrix payload.",e),null)}function b(e){return typeof e=="string"?e.includes("name"):Array.isArray(e)?e.some(r=>b(r)):!e||typeof e!="object"?!1:Object.values(e).some(r=>b(r))}function X(e){return e.type!=="symbol"||!e.id||!e.layout?!1:b(e.layout["text-field"])}function K(e){const r=e.getStyle();for(const o of r.layers??[])X(o)&&e.setLayoutProperty(o.id,"text-field",Q)}function $(){if(!g){g=new k;try{G("pmtiles",g.tile)}catch(e){console.warn("Maplibre PMTiles protocol registration failed.",e)}}}export default function v({sceneDef:e,geoConfig:r,staticTransform:o,tileSource:w,mapOptions:O,onRendererReady:h,onMapDimLayerReady:x,onMapLoadError:M}){const d=l(null),P=l(null),a=l(null),L=l(h),S=l(x),_=l(M),C=l({sceneDef:e,geoConfig:r,staticTransform:o,tileSource:w,mapOptions:O});return E(()=>{L.current=h,S.current=x,_.current=M}),E(()=>{if(!d.current)return;const{sceneDef:m,geoConfig:n,staticTransform:F,tileSource:A,mapOptions:f}=C.current;let p=!1;const u={...m};u.rootLayer={...m.rootLayer};const T=m.rootLayer.children;u.rootLayer.children=T.filter(i=>i?.name?.toString().toLowerCase()!=="areamap"),u.background=void 0,u.staticTransform=F,$();const z=n.bounds?{bounds:n.bounds,fitBoundsOptions:{padding:n.fitPadding,bearing:n.bearing}}:{center:n.center,zoom:n.zoom},j=q(A.style),t=new Y({container:d.current,...z,bearing:n.bearing,pitch:f?.pitch??30,maxPitch:f?.maxPitch??70,minZoom:f?.minZoom,maxZoom:f?.maxZoom,maxBounds:f?.maxBounds,bearingSnap:0,canvasContextAttributes:{antialias:!0}});n.zoomAdjustment&&t.jumpTo({zoom:t.getZoom()+n.zoomAdjustment}),P.current=t,t.once("error",i=>{t.isStyleLoaded()||_.current?.(i?.error??i)});const R=i=>{const s=i?.id;!s||t.hasImage(s)||t.addImage(s,{width:1,height:1,data:new Uint8Array(4)})};t.on("styleimagemissing",R);const U=H({requestFrame:()=>t.triggerRepaint()}),Z={id:J,type:"custom",renderingMode:"3d",onAdd(i,s){if(p)return;const c=new N({canvas:t.getCanvas(),gl:s});if(p){c.dispose();return}c.init(u),a.current=c,L.current?.(c,t,u,()=>t.triggerRepaint())},render(i,s){if(!a.current||a.current.isDisposed)return;const c=W(s??i);c&&(a.current.render(c),U(a.current))}},D=()=>{K(t),t.getSource(y)||t.addSource(y,{type:"geojson",data:V}),t.getLayer(MAP_DIM_LAYER_ID)||t.addLayer({id:MAP_DIM_LAYER_ID,type:"fill",source:y,paint:{"fill-color":"#000000","fill-opacity":0,"fill-opacity-transition":{duration:0,delay:0}}}),S.current?.(t),t.addLayer(Z)};return t.on("style.load",D),t.setStyle(A.style,j?{transformStyle:j}:void 0),()=>{p=!0,t.off("style.load",D),t.off("styleimagemissing",R),a.current?.dispose(),a.current=null,t.remove(),P.current=null}},[]),B("div",{ref:d,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"}})}
1
+ import{jsx as N}from"react/jsx-runtime";import"maplibre-gl/dist/maplibre-gl.css";import{Renderer as G}from"@expofp/renderer";import{addProtocol as Y,Map as k}from"maplibre-gl";import{Protocol as q}from"pmtiles";import{useEffect as E,useRef as l}from"react";import{registerPmtilesArchive as H}from"./utils/pmtiles-range-fallback";import{createStyleTransform as J}from"./utils/resolve-map-style";import{createUpdatePump as Q}from"./utils/update-pump";export const MAP_DIM_LAYER_ID="expofp-map-dim";const g="expofp-map-dim-source",V="3d-expofp";let b=null;const W=["coalesce",["get","name:en"],["get","name_en"],["get","name:latin"],["get","name"]],X={type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,-85],[180,-85],[180,85],[-180,85],[-180,-85]]]},properties:{}};function I(e){if(!e||typeof e!="object")return!1;const r=e.length;if(typeof r!="number"||r<16)return!1;const n=e[0];return typeof n=="number"&&Number.isFinite(n)}function K(e){if(I(e))return Array.from(e);const n=e?.defaultProjectionData?.mainMatrix;return I(n)?Array.from(n):(console.warn("Maplibre custom layer received an unsupported projection matrix payload.",e),null)}function h(e){return typeof e=="string"?e.includes("name"):Array.isArray(e)?e.some(r=>h(r)):!e||typeof e!="object"?!1:Object.values(e).some(r=>h(r))}function $(e){return e.type!=="symbol"||!e.id||!e.layout?!1:h(e.layout["text-field"])}function v(e){const r=e.getStyle();for(const n of r.layers??[])$(n)&&e.setLayoutProperty(n.id,"text-field",W)}function ee(){if(b)return b;const e=new q;b=e;try{Y("pmtiles",e.tile)}catch(r){console.warn("Maplibre PMTiles protocol registration failed.",r)}return e}export default function te({sceneDef:e,geoConfig:r,staticTransform:n,tileSource:w,mapOptions:O,onRendererReady:x,onMapDimLayerReady:P,onMapLoadError:M}){const m=l(null),L=l(null),a=l(null),S=l(x),A=l(P),_=l(M),C=l({sceneDef:e,geoConfig:r,staticTransform:n,tileSource:w,mapOptions:O});return E(()=>{S.current=x,A.current=P,_.current=M}),E(()=>{if(!m.current)return;const{sceneDef:d,geoConfig:i,staticTransform:F,tileSource:p,mapOptions:f}=C.current;let y=!1;const u={...d};u.rootLayer={...d.rootLayer};const T=d.rootLayer.children;u.rootLayer.children=T.filter(o=>o?.name?.toString().toLowerCase()!=="areamap"),u.background=void 0,u.staticTransform=F;const z=ee(),U=i.bounds?{bounds:i.bounds,fitBoundsOptions:{padding:i.fitPadding,bearing:i.bearing}}:{center:i.center,zoom:i.zoom},j=J(p.style,p.offline?o=>H(z,o):void 0),t=new k({container:m.current,...U,bearing:i.bearing,pitch:f?.pitch??30,maxPitch:f?.maxPitch??70,minZoom:f?.minZoom,maxZoom:f?.maxZoom,maxBounds:f?.maxBounds,bearingSnap:0,canvasContextAttributes:{antialias:!0}});i.zoomAdjustment&&t.jumpTo({zoom:t.getZoom()+i.zoomAdjustment}),L.current=t,t.once("error",o=>{t.isStyleLoaded()||_.current?.(o?.error??o)});const R=o=>{const s=o?.id;!s||t.hasImage(s)||t.addImage(s,{width:1,height:1,data:new Uint8Array(4)})};t.on("styleimagemissing",R);const Z=Q({requestFrame:()=>t.triggerRepaint()}),B={id:V,type:"custom",renderingMode:"3d",onAdd(o,s){if(y)return;const c=new G({canvas:t.getCanvas(),gl:s});if(y){c.dispose();return}c.init(u),a.current=c,S.current?.(c,t,u,()=>t.triggerRepaint())},render(o,s){if(!a.current||a.current.isDisposed)return;const c=K(s??o);c&&(a.current.render(c),Z(a.current))}},D=()=>{v(t),t.getSource(g)||t.addSource(g,{type:"geojson",data:X}),t.getLayer(MAP_DIM_LAYER_ID)||t.addLayer({id:MAP_DIM_LAYER_ID,type:"fill",source:g,paint:{"fill-color":"#000000","fill-opacity":0,"fill-opacity-transition":{duration:0,delay:0}}}),A.current?.(t),t.addLayer(B)};return t.on("style.load",D),t.setStyle(p.style,j?{transformStyle:j}:void 0),()=>{y=!0,t.off("style.load",D),t.off("styleimagemissing",R),a.current?.dispose(),a.current=null,t.remove(),L.current=null}},[]),N("div",{ref:m,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"}})}
@@ -1 +1 @@
1
- import{fpGeo as u}from"../../../data/fpGeo.js";import a from"../../../store/index.js";import m from"../../../tools/settings.js";import{MAP_DIM_LAYER_ID as s}from"../MaplibreWrapper.js";import{resolveMapTheme as f}from"./map-theme.js";export const LIGHT_TILE_SOURCE={style:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json"},DARK_TILE_SOURCE={style:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"};const c=12;export const DEFAULT_MAP_OPTIONS={pitch:30,maxPitch:70,minZoom:c},MAP_2D_OPTIONS={pitch:0,maxPitch:0,minZoom:c};export function applyMapDimValue(t,e){t?.getLayer(s)&&(t.setPaintProperty(s,"fill-opacity",p(e)),t.triggerRepaint())}function p(t){return Math.min(Math.max(t,0),1)}export function applyMapOptions(t,e,n=!1){if(!t)return;t.setMinZoom(e.minZoom??null),t.setMaxZoom(e.maxZoom??null),t.setMaxBounds(e.maxBounds??null);const o=e.pitch,r=e.maxPitch,l=t.getPitch(),i=!!(n&&o!=null&&r!=null&&r<l);r!=null&&!i&&t.setMaxPitch(e.maxPitch),!(o==null||l===o)&&(n?(t.easeTo({pitch:o,duration:300}),i&&t.once("moveend",()=>t.setMaxPitch(r))):t.jumpTo({pitch:o}))}export function getTileSource(){const t=a.fp?.maplibre??window.__efpMaplibre;return t?.style?{style:t.style}:t?.styleUrl?{style:t.styleUrl}:f(u?.properties?.config?.style,m.backgroundColor)==="dark"?DARK_TILE_SOURCE:LIGHT_TILE_SOURCE}
1
+ import{fpGeo as f}from"../../../data/fpGeo.js";import u from"../../../store/index.js";import a from"../../../tools/settings.js";import{MAP_DIM_LAYER_ID as s}from"../MaplibreWrapper.js";import{resolveMapTheme as m}from"./map-theme.js";export const LIGHT_TILE_SOURCE={style:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json"},DARK_TILE_SOURCE={style:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"};const c=12;export const DEFAULT_MAP_OPTIONS={pitch:30,maxPitch:70,minZoom:c},MAP_2D_OPTIONS={pitch:0,maxPitch:0,minZoom:c};export function applyMapDimValue(t,e){t?.getLayer(s)&&(t.setPaintProperty(s,"fill-opacity",p(e)),t.triggerRepaint())}function p(t){return Math.min(Math.max(t,0),1)}export function applyMapOptions(t,e,n=!1){if(!t)return;t.setMinZoom(e.minZoom??null),t.setMaxZoom(e.maxZoom??null),t.setMaxBounds(e.maxBounds??null);const o=e.pitch,r=e.maxPitch,l=t.getPitch(),i=!!(n&&o!=null&&r!=null&&r<l);r!=null&&!i&&t.setMaxPitch(e.maxPitch),!(o==null||l===o)&&(n?(t.easeTo({pitch:o,duration:300}),i&&t.once("moveend",()=>t.setMaxPitch(r))):t.jumpTo({pitch:o}))}export function getTileSource(){const t=u.fp?.maplibre??window.__efpMaplibre;return t?.style?{style:t.style,offline:t.offline}:t?.styleUrl?{style:t.styleUrl,offline:t.offline}:m(f?.properties?.config?.style,a.backgroundColor)==="dark"?DARK_TILE_SOURCE:LIGHT_TILE_SOURCE}
@@ -0,0 +1,53 @@
1
+ import { type Protocol, type RangeResponse, type Source } from 'pmtiles';
2
+ /**
3
+ * A PMTiles source that also works against hosts which accept a `Range` header
4
+ * and then answer `200` with something other than the requested slice.
5
+ *
6
+ * The Android SDK serves offline archives through `WebViewAssetLoader`, whose
7
+ * path handlers never see request headers: Chromium applies the range's start
8
+ * offset to the file stream and then streams to EOF, answering `200` with a
9
+ * `Content-Length` that merely echoes the request. PMTiles' own guard compares
10
+ * that header against the requested length and so lets it through — every tile
11
+ * read then silently receives the rest of the archive instead of one tile,
12
+ * which decodes into a mostly blank basemap and no error anywhere.
13
+ *
14
+ * So probe once, at offset 0, and decide from the status:
15
+ *
16
+ * - `206` — a well-behaved host. Everything is delegated to {@link FetchSource},
17
+ * which keeps its 416 retry and ETag-mismatch handling intact.
18
+ * - `200` — the host ignored the range, which means the body it just returned
19
+ * *is* the archive from byte 0. Keep it and slice locally.
20
+ *
21
+ * The body is held as a `Blob` rather than an `ArrayBuffer` so the browser can
22
+ * back it with a temp file instead of the JS heap — an offline basemap runs to
23
+ * tens of megabytes and the SDK still has to survive older Android WebViews.
24
+ */
25
+ export declare class RangeTolerantSource implements Source {
26
+ private readonly url;
27
+ private readonly ranged;
28
+ /** Memoised probe: the whole archive, or `null` when ranges are honoured. */
29
+ private archive;
30
+ constructor(url: string);
31
+ getKey(): string;
32
+ getBytes(offset: number, length: number, signal?: AbortSignal, etag?: string): Promise<RangeResponse>;
33
+ /**
34
+ * Read the head of the archive and work out which kind of host this is.
35
+ *
36
+ * The probe deliberately ignores the caller's `AbortSignal`. It is memoised
37
+ * for the source's lifetime, so a first tile that gets cancelled mid-flight
38
+ * must not leave every later read awaiting a rejected promise.
39
+ */
40
+ private probe;
41
+ }
42
+ /**
43
+ * Point the protocol at {@link RangeTolerantSource} for one archive URL.
44
+ *
45
+ * Registering ahead of the first tile request is what makes this take effect:
46
+ * `Protocol` creates a plain {@link FetchSource} for any `pmtiles://` URL it
47
+ * has not already been given an instance for.
48
+ *
49
+ * Only string-URL styles are covered. An inline style object carries absolute
50
+ * URLs the SDK never resolves, so its PMTiles sources keep the stock source.
51
+ */
52
+ export declare function registerPmtilesArchive(protocol: Protocol, url: string): void;
53
+ //# sourceMappingURL=pmtiles-range-fallback.d.ts.map
@@ -0,0 +1 @@
1
+ import{FetchSource as s,PMTiles as u}from"pmtiles";const i=16384;export class RangeTolerantSource{constructor(r){this.url=r,this.ranged=new s(r)}getKey(){return this.url}async getBytes(r,n,t,o){this.archive||(this.archive=this.probe());const a=await this.archive;return a?(c(t),{data:await h(a.slice(r,r+n))}):this.ranged.getBytes(r,n,t,o)}async probe(){let r;try{r=await fetch(this.url,{headers:{Range:`bytes=0-${i-1}`}})}catch{return null}if(r.status!==200)return null;const n=await r.blob();return n.size===i?null:n}}export function registerPmtilesArchive(e,r){e.get(r)||e.add(new u(new RangeTolerantSource(r)))}function c(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted.","AbortError")}async function h(e){return typeof e.arrayBuffer=="function"?e.arrayBuffer():new Promise((r,n)=>{const t=new FileReader;t.onload=()=>r(t.result),t.onerror=()=>n(t.error),t.readAsArrayBuffer(e)})}
@@ -11,5 +11,5 @@ import { type StyleSpecification, type TransformStyleFunction } from 'maplibre-g
11
11
  * Inline style objects have no style URL to resolve against; callers must pass
12
12
  * already-absolute internals for those.
13
13
  */
14
- export declare function createStyleTransform(style: string | StyleSpecification): TransformStyleFunction | undefined;
14
+ export declare function createStyleTransform(style: string | StyleSpecification, onPmtilesArchive?: (url: string) => void): TransformStyleFunction | undefined;
15
15
  //# sourceMappingURL=resolve-map-style.d.ts.map
@@ -1 +1 @@
1
- export function createStyleTransform(c){if(typeof c!="string")return;const p=new URL(c,window.location.href).href,o=i=>new URL(i,p).href.replace(/%7B/g,"{").replace(/%7D/g,"}"),l=i=>i.startsWith("pmtiles://")?`pmtiles://${o(i.slice(10))}`:o(i);return(i,u)=>{const e={...u};typeof e.sprite=="string"?e.sprite=o(e.sprite):Array.isArray(e.sprite)&&(e.sprite=e.sprite.map(t=>{if(!t||typeof t!="object")return t;const r=t;return typeof r.url!="string"?t:{...r,url:o(r.url)}})),typeof e.glyphs=="string"&&(e.glyphs=o(e.glyphs));const n=e.sources;if(n){e.sources={...n};for(const[t,r]of Object.entries(n)){if(!r||typeof r!="object")continue;const s={...r};typeof s.url=="string"&&(s.url=l(s.url)),Array.isArray(s.tiles)&&(s.tiles=s.tiles.map(f=>typeof f=="string"?l(f):f)),e.sources[t]=s}}return e}}
1
+ export function createStyleTransform(l,p){if(typeof l!="string")return;const y=new URL(l,window.location.href).href,o=i=>new URL(i,y).href.replace(/%7B/g,"{").replace(/%7D/g,"}"),u=i=>{if(!i.startsWith("pmtiles://"))return o(i);const n=o(i.slice(10));return p?.(n),`pmtiles://${n}`};return(i,n)=>{const e={...n};typeof e.sprite=="string"?e.sprite=o(e.sprite):Array.isArray(e.sprite)&&(e.sprite=e.sprite.map(r=>{if(!r||typeof r!="object")return r;const t=r;return typeof t.url!="string"?r:{...t,url:o(t.url)}})),typeof e.glyphs=="string"&&(e.glyphs=o(e.glyphs));const c=e.sources;if(c){e.sources={...c};for(const[r,t]of Object.entries(c)){if(!t||typeof t!="object")continue;const s={...t};typeof s.url=="string"&&(s.url=u(s.url)),Array.isArray(s.tiles)&&(s.tiles=s.tiles.map(f=>typeof f=="string"?u(f):f)),e.sources[r]=s}}return e}}
@@ -3,6 +3,16 @@ import { type Camera, type ListPanel, type PlannerOptions } from '@expofp/schema
3
3
  import { type InternalSettings } from './internal-settings.js';
4
4
  import type { CurrentPosition, Floor, FloorPlan, FloorPlanBookmarkClickEvent, FloorPlanBoothClickEvent, FloorPlanCategory, FloorPlanCustomButtonEvent, FloorPlanDetailsEvent, FloorPlanDirectionEvent, FloorPlanGetCoordsEvent, FloorPlanIcon, FloorPlanMarkerEvent, FloorPlanOptions, FloorPlanVisitedClickEvent, GeoConfig, MaplibreOptions, MarkersData, RouteInfo, RouteWaypoint, Visibility } from './types';
5
5
  import { type Bounds, type POISelectors } from './types/sdk.types';
6
+ /**
7
+ * A host element carries the plan occupying it, so a second `load()` into the
8
+ * same container can be refused and {@link FloorPlan.destroy} can hand the
9
+ * element back by clearing the mark.
10
+ */
11
+ export type FloorPlanHostElement = HTMLDivElement & {
12
+ __expofp?: FloorPlan;
13
+ };
14
+ /** Rejection reason for {@link FloorPlan.ready} when the plan is destroyed mid-load. */
15
+ export declare const DESTROYED_BEFORE_READY = "FloorPlan destroyed before it finished loading";
6
16
  export default class FloorPlanLoader implements FloorPlan {
7
17
  protected readonly renderTarget: HTMLDivElement;
8
18
  private readonly _ready;
@@ -19,9 +29,13 @@ export default class FloorPlanLoader implements FloorPlan {
19
29
  /** Called with an event by the `__efpStyleLoad` listener, and bare to drain the registry on construction. */
20
30
  protected efpStyleLoadHandler: (e?: Event) => void;
21
31
  protected resolveReady: () => void;
32
+ /** Counterpart of {@link resolveReady}, called by {@link destroy}; same assignment caveat. */
33
+ protected rejectReady: (reason: Error) => void;
22
34
  readonly icons: Map<FloorPlanIcon, HTMLImageElement>;
23
35
  enableRotation: boolean;
24
36
  alwaysShowSidebar: boolean;
37
+ /** Set by {@link destroy}; checked by `init()` so a plan destroyed mid-load never mounts. */
38
+ protected destroyed: boolean;
25
39
  get ready(): Promise<void>;
26
40
  get previewMode(): boolean;
27
41
  /** @deprecated The consent decision lives on the config — set the `consent` option instead. */
@@ -91,7 +105,23 @@ export default class FloorPlanLoader implements FloorPlan {
91
105
  getBoothRect(name: string): any;
92
106
  convertToGeo(x: number, y: number): any;
93
107
  getGeoConfig(): GeoConfig | null;
108
+ /**
109
+ * Raises the `destroyed` flag — which the pending `init()` checks before it
110
+ * mounts anything — settles {@link ready}, then hands the state-specific
111
+ * teardown to {@link releaseResources}. The guard lives here so both states
112
+ * are idempotent through one implementation.
113
+ */
114
+ destroy(): void;
115
+ /** @deprecated Renamed to {@link destroy}. */
94
116
  unstable_destroy(): void;
117
+ /**
118
+ * Undoes the constructor's side effects — the teardown for a plan destroyed
119
+ * while still loading, where there is no mounted UI yet.
120
+ *
121
+ * `FloorPlanReady` overrides this to unwind the mounted plan first, then
122
+ * calls back here through `super`.
123
+ */
124
+ protected releaseResources(): void;
95
125
  highlightExhibitors(externalIds: string[]): void;
96
126
  highlightBooths(externalIds: string[]): void;
97
127
  onCurrentPositionChanged(point: CurrentPosition): void;
@@ -1 +1 @@
1
- import{getConfig as b}from"@expofp/config";import{PREVIEW_MODE_ATTRIBUTE as j}from"./constants";import{toInternalSettings as D}from"./internal-settings.js";import d from"./tools/base-runtime-url";import{loadCss as x,loadFont as f}from"./tools/loaders";import R from"./tools/logger";import{initSentry as F}from"./tools/sentry";import{heatmapEnabled as A}from"./utils/heatmap-enabled";import{initI18n as V}from"./utils/i18n";import z from"./utils/is-debug";import H from"./utils/is-localhost";import _ from"./utils/is-webview";import{loadCustomCss as G}from"./utils/loadCustomCss";import{loadIcons as N}from"./utils/loadIcons";import I from"./utils/use-shadow";function e(){throw new Error("FloorPlan not ready")}export default class Q{get ready(){return this._ready}get previewMode(){return b().previewMode||this.element.hasAttribute(j)}get allowConsent(){return this.consent==="ask"?void 0:this.consent==="granted"}getInternalSettings(){return D(b())}selectBooth(t){e()}selectExhibitor(t){e()}selectRoute(t,i){e()}getOptimizedRoutes(t){e()}selectCurrentPosition(t,i,s){e()}setBookmarks(t){e()}setEntitiesBookmarks(t){e()}setEntitiesVisited(t){e()}setMarkers(t){e()}updateLayerVisibility(t,i){e()}getCenterCoordinates(){e()}applyParameters(t){e()}exhibitorsList(){e()}boothsList(){e()}categoriesList(){e()}selectCategory(t){e()}select(t){e()}showList(t){e()}selectTour(t){e()}openPlanner(t){e()}startBuildRoute(){e()}getVisibility(){e()}setVisibility(t){e()}findLocation(){e()}zoomIn(){e()}zoomOut(){e()}zoomTo(t,i){e()}switchView(){e()}setCamera(t){e()}getCamera(){e()}fitBounds(){e()}getBounds(t){e()}getBoothRect(t){e()}convertToGeo(t,i){e()}getGeoConfig(){e()}unstable_destroy(){e()}highlightExhibitors(t){e()}highlightBooths(t){e()}onCurrentPositionChanged(t){e()}search(t){e()}getFloors(){e()}onFloorActivated(t){e()}activateFloor(t){e()}showPathway(t,i){e()}showPathwayOnly(t,i){e()}hidePathways(){e()}showSearch(){e()}changeLanguage(t){e()}isGpsTrackingEnabled(){e()}setGpsTrackingEnabled(t){e()}deselectCurrentPosition(){e()}deselectRoute(){e()}reset(){e()}selectAccessibleRoute(t){e()}constructor(t,i){this.resolveReady=()=>{},this.icons=new Map,this.enableRotation=!0,this.alwaysShowSidebar=!1;const s=b();this.noOverlay=!!s.noOverlay,this.offHistory=!!s.offHistory,this.ignoreQuery=s.ignoreQuery,this.consent=s.consent,this.consent==="ask"&&(_?this.consent="granted":H&&!z&&(this.consent="denied")),this.onBoothClick=t.onBoothClick,this.onBookmarkClick=t.onBookmarkClick,this.onVisitedClick=t.onVisitedClick,this.onCategoryClick=t.onCategoryClick,this.onDetails=t.onDetails,this.onExhibitorCustomButtonClick=t.onExhibitorCustomButtonClick,this.onGetCoordsClick=t.onGetCoordsClick,this.onMarkerClick=t.onMarkerClick,this.onFpConfigured=t.onFpConfigured,this.onDirection=t.onDirection,this.onInit=t.onInit,this.onCurrentPositionChanged=t.onCurrentPositionChanged,this.onFloorActivated=t.onFloorActivated,this.onLeaveEvent=t.onLeaveEvent,this.viewerMode=!!s.viewerMode,this.disableRuntimeAlerts=s.disableRuntimeAlerts,this.maplibre=s.maplibre,window.__efpMaplibre=s.maplibre,this._ready=new Promise((c,r)=>{this.resolveReady=c}),this.element=i;const E=i;if(E.__expofp)throw new Error("Element already in use");E.__expofp=this;const g=s.expo;F({eventId:g||"",isWebview:_}),this.eventId=g,window.__efpEvent=g,window.__efpElement=i;const m=document.createElement("div");m.style.height="100%",m.style.width="100%",i.appendChild(m);let n;if(I){n=m.attachShadow({mode:"open"});const c=n,r=document;c.createElement=(...a)=>r.createElement(...a),c.createElementNS=(...a)=>r.createElementNS(...a),c.createTextNode=(...a)=>r.createTextNode(...a)}else n=m;const w=document.createElement("div");w.style.height="100%",w.style.width="100%",n.appendChild(w),I&&Object.defineProperty(w,"ownerDocument",{value:n}),window.__efpShadowDOMStyleParent=I?n:void 0,this.renderTarget=w,R.log("Instantiating ExpoFP floorplan",i,g);let k=0;this.efpStyleLoadHandler=function(c){const r=window.__efpStyleElements??[];for(;k<r.length;){const a=r[k];n.appendChild(a),k++}},window.addEventListener("__efpStyleLoad",this.efpStyleLoadHandler),this.efpStyleLoadHandler();const y=this;(async function(){const r=b();await V();const a=new URLSearchParams(window.location.search);let h,p;if(r?.trackerUrl)try{h=new URL(r.trackerUrl),p=h.searchParams.get("expoId")}catch(o){console.error(o)}const P=async o=>{if(!h||!p)return Promise.reject(new Error("trackerUrl or expoId is missing"));const l=new URL(o.dataUrl,h.origin),u=await fetch(l.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expoId:p,token:decodeURIComponent(a.get("t")??"")})});let C=[];u.ok&&(C=(await u.json()).map(o.dataMapper)),window.__heatmapDataYah={yah:C}},v=r?.heatmap??{},O=A(v)||a.get("heatmap")==="true",L=v.variant==="yah"||a.get("type")==="yah",U=v.kiosk===!0||a.get("subtype")==="kiosk";if(O)try{if(L)U?await P({dataUrl:"/api/kiosks/list/viewer",dataMapper:o=>({...o,id:o.key,name:`Kiosk ${o.key}`})}):await P({dataUrl:"/api/v1/you-are-here/qr-code/list/viewer",dataMapper:(o,l)=>({...o,name:`QR Code #${l+1}`})});else{if(!h||!p)throw new Error("trackerUrl or expoId is missing");const o=new URL("/api/fp-stats/get",h.origin);o.searchParams.set("expoId",p),o.searchParams.set("type","booview"),o.searchParams.set("t",decodeURIComponent(a.get("t")??""));const l=new URL("api/fp-stats/get",h.origin);l.searchParams.set("expoId",p),l.searchParams.set("type","exview"),l.searchParams.set("t",decodeURIComponent(a.get("t")??""));const[u,C]=await Promise.all([fetch(o.toString()),fetch(l.toString())]),[S,T]=await Promise.all([u.json(),C.json()]);window.__heatmapData={booths:S,exhibitors:T}}}catch(o){console.error("Heatmap: Initialization error",o)}const B=[x(d+"vendor/sanitize-css/sanitize.css",n),x(d+"vendor/perfect-scrollbar/css/perfect-scrollbar.css",n),f("Oswald",d+"fonts/oswald-v17-cyrillic_latin-300.woff",{weight:300}),f("Oswald",d+"fonts/oswald-v17-cyrillic_latin-500.woff",{weight:500}),f("Inter",d+"fonts/inter-400.woff2",{weight:400}),f("Inter",d+"fonts/inter-500.woff2",{weight:500}),f("Inter",d+"fonts/inter-600.woff2",{weight:600}),f("efp-symbols",d+"fonts/efp-symbols.woff",{weight:400}),G(r,n),N(y.icons)];await Promise.all(B),y.enableRotation=r?.enableRotation??!1,y.alwaysShowSidebar=r?.alwaysShowSidebar??!1,R.log("Data loaded"),window.__storeInitAllowed=!0;const{default:M}=await import("./floorplan.ready");for(document.querySelectorAll(".expofp-floorplan-loader").forEach(o=>o.remove());i.firstChild&&i.firstChild!==m;)i.removeChild(i.firstChild);Object.setPrototypeOf(y,M.prototype).init()})()}}
1
+ import{getConfig as b}from"@expofp/config";import{PREVIEW_MODE_ATTRIBUTE as F}from"./constants";import{toInternalSettings as M}from"./internal-settings.js";import d from"./tools/base-runtime-url";import{loadCss as P,loadFont as w}from"./tools/loaders";import S from"./tools/logger";import{resetGlobalVariables as T}from"./tools/reset";import{initSentry as A}from"./tools/sentry";import{heatmapEnabled as V}from"./utils/heatmap-enabled";import{initI18n as H}from"./utils/i18n";import z from"./utils/is-debug";import G from"./utils/is-localhost";import x from"./utils/is-webview";import{loadCustomCss as N}from"./utils/loadCustomCss";import{loadIcons as Y}from"./utils/loadIcons";import E from"./utils/use-shadow";function e(){throw new Error("FloorPlan not ready")}export const DESTROYED_BEFORE_READY="FloorPlan destroyed before it finished loading";export default class Q{get ready(){return this._ready}get previewMode(){return b().previewMode||this.element.hasAttribute(F)}get allowConsent(){return this.consent==="ask"?void 0:this.consent==="granted"}getInternalSettings(){return M(b())}selectBooth(t){e()}selectExhibitor(t){e()}selectRoute(t,i){e()}getOptimizedRoutes(t){e()}selectCurrentPosition(t,i,a){e()}setBookmarks(t){e()}setEntitiesBookmarks(t){e()}setEntitiesVisited(t){e()}setMarkers(t){e()}updateLayerVisibility(t,i){e()}getCenterCoordinates(){e()}applyParameters(t){e()}exhibitorsList(){e()}boothsList(){e()}categoriesList(){e()}selectCategory(t){e()}select(t){e()}showList(t){e()}selectTour(t){e()}openPlanner(t){e()}startBuildRoute(){e()}getVisibility(){e()}setVisibility(t){e()}findLocation(){e()}zoomIn(){e()}zoomOut(){e()}zoomTo(t,i){e()}switchView(){e()}setCamera(t){e()}getCamera(){e()}fitBounds(){e()}getBounds(t){e()}getBoothRect(t){e()}convertToGeo(t,i){e()}getGeoConfig(){e()}destroy(){this.destroyed||(this.destroyed=!0,this.rejectReady(new Error(DESTROYED_BEFORE_READY)),this.releaseResources())}unstable_destroy(){this.destroy()}releaseResources(){for(window.removeEventListener("__efpStyleLoad",this.efpStyleLoadHandler);this.element.firstChild;)this.element.removeChild(this.element.firstChild);delete this.element.__expofp,T()}highlightExhibitors(t){e()}highlightBooths(t){e()}onCurrentPositionChanged(t){e()}search(t){e()}getFloors(){e()}onFloorActivated(t){e()}activateFloor(t){e()}showPathway(t,i){e()}showPathwayOnly(t,i){e()}hidePathways(){e()}showSearch(){e()}changeLanguage(t){e()}isGpsTrackingEnabled(){e()}setGpsTrackingEnabled(t){e()}deselectCurrentPosition(){e()}deselectRoute(){e()}reset(){e()}selectAccessibleRoute(t){e()}constructor(t,i){this.resolveReady=()=>{},this.rejectReady=()=>{},this.icons=new Map,this.enableRotation=!0,this.alwaysShowSidebar=!1,this.destroyed=!1;const a=b();this.noOverlay=!!a.noOverlay,this.offHistory=!!a.offHistory,this.ignoreQuery=a.ignoreQuery,this.consent=a.consent,this.consent==="ask"&&(x?this.consent="granted":G&&!z&&(this.consent="denied")),this.onBoothClick=t.onBoothClick,this.onBookmarkClick=t.onBookmarkClick,this.onVisitedClick=t.onVisitedClick,this.onCategoryClick=t.onCategoryClick,this.onDetails=t.onDetails,this.onExhibitorCustomButtonClick=t.onExhibitorCustomButtonClick,this.onGetCoordsClick=t.onGetCoordsClick,this.onMarkerClick=t.onMarkerClick,this.onFpConfigured=t.onFpConfigured,this.onDirection=t.onDirection,this.onInit=t.onInit,this.onCurrentPositionChanged=t.onCurrentPositionChanged,this.onFloorActivated=t.onFloorActivated,this.onLeaveEvent=t.onLeaveEvent,this.viewerMode=!!a.viewerMode,this.disableRuntimeAlerts=a.disableRuntimeAlerts,this.maplibre=a.maplibre,window.__efpMaplibre=a.maplibre,this._ready=new Promise((c,r)=>{this.resolveReady=c,this.rejectReady=r}),this._ready.catch(()=>{}),this.element=i;const I=i;if(I.__expofp)throw new Error("Element already in use");I.__expofp=this;const g=a.expo;A({eventId:g||"",isWebview:x}),this.eventId=g,window.__efpEvent=g,window.__efpElement=i;const m=document.createElement("div");m.style.height="100%",m.style.width="100%",i.appendChild(m);let n;if(E){n=m.attachShadow({mode:"open"});const c=n,r=document;c.createElement=(...s)=>r.createElement(...s),c.createElementNS=(...s)=>r.createElementNS(...s),c.createTextNode=(...s)=>r.createTextNode(...s)}else n=m;const y=document.createElement("div");y.style.height="100%",y.style.width="100%",n.appendChild(y),E&&Object.defineProperty(y,"ownerDocument",{value:n}),window.__efpShadowDOMStyleParent=E?n:void 0,this.renderTarget=y,S.log("Instantiating ExpoFP floorplan",i,g);let k=0;this.efpStyleLoadHandler=function(c){const r=window.__efpStyleElements??[];for(;k<r.length;){const s=r[k];n.appendChild(s),k++}},window.addEventListener("__efpStyleLoad",this.efpStyleLoadHandler),this.efpStyleLoadHandler();const h=this;(async function(){const r=b();if(await H(),h.destroyed)return;const s=new URLSearchParams(window.location.search);let f,p;if(r?.trackerUrl)try{f=new URL(r.trackerUrl),p=f.searchParams.get("expoId")}catch(o){console.error(o)}const R=async o=>{if(!f||!p)return Promise.reject(new Error("trackerUrl or expoId is missing"));const l=new URL(o.dataUrl,f.origin),u=await fetch(l.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expoId:p,token:decodeURIComponent(s.get("t")??"")})});let C=[];u.ok&&(C=(await u.json()).map(o.dataMapper)),window.__heatmapDataYah={yah:C}},v=r?.heatmap??{},L=V(v)||s.get("heatmap")==="true",O=v.variant==="yah"||s.get("type")==="yah",U=v.kiosk===!0||s.get("subtype")==="kiosk";if(L)try{if(O)U?await R({dataUrl:"/api/kiosks/list/viewer",dataMapper:o=>({...o,id:o.key,name:`Kiosk ${o.key}`})}):await R({dataUrl:"/api/v1/you-are-here/qr-code/list/viewer",dataMapper:(o,l)=>({...o,name:`QR Code #${l+1}`})});else{if(!f||!p)throw new Error("trackerUrl or expoId is missing");const o=new URL("/api/fp-stats/get",f.origin);o.searchParams.set("expoId",p),o.searchParams.set("type","booview"),o.searchParams.set("t",decodeURIComponent(s.get("t")??""));const l=new URL("api/fp-stats/get",f.origin);l.searchParams.set("expoId",p),l.searchParams.set("type","exview"),l.searchParams.set("t",decodeURIComponent(s.get("t")??""));const[u,C]=await Promise.all([fetch(o.toString()),fetch(l.toString())]),[_,j]=await Promise.all([u.json(),C.json()]);window.__heatmapData={booths:_,exhibitors:j}}}catch(o){console.error("Heatmap: Initialization error",o)}const B=[P(d+"vendor/sanitize-css/sanitize.css",n),P(d+"vendor/perfect-scrollbar/css/perfect-scrollbar.css",n),w("Oswald",d+"fonts/oswald-v17-cyrillic_latin-300.woff",{weight:300}),w("Oswald",d+"fonts/oswald-v17-cyrillic_latin-500.woff",{weight:500}),w("Inter",d+"fonts/inter-400.woff2",{weight:400}),w("Inter",d+"fonts/inter-500.woff2",{weight:500}),w("Inter",d+"fonts/inter-600.woff2",{weight:600}),w("efp-symbols",d+"fonts/efp-symbols.woff",{weight:400}),N(r,n),Y(h.icons)];if(await Promise.all(B),h.destroyed)return;h.enableRotation=r?.enableRotation??!1,h.alwaysShowSidebar=r?.alwaysShowSidebar??!1,S.log("Data loaded"),window.__storeInitAllowed=!0;const{default:D}=await import("./floorplan.ready");for(document.querySelectorAll(".expofp-floorplan-loader").forEach(o=>o.remove());i.firstChild&&i.firstChild!==m;)i.removeChild(i.firstChild);if(h.destroyed)return;Object.setPrototypeOf(h,D.prototype).init()})()}}
@@ -73,7 +73,7 @@ export default class FloorPlanReady extends FloorPlanLoader {
73
73
  getBoothRect(name: string): BoothRect;
74
74
  convertToGeo(x: number, y: number): [number, number] | never;
75
75
  getGeoConfig(): GeoConfig | null;
76
- unstable_destroy(): void;
76
+ protected releaseResources(): void;
77
77
  search(term: string): Promise<{
78
78
  item: unknown;
79
79
  score: number;
@@ -1 +1 @@
1
- import{Fragment as A,jsx as x,jsxs as T}from"react/jsx-runtime";import{Box as E}from"@expofp/geometry";import{CameraSchema as I}from"@expofp/schema";import{optimizeWaypointOrder as M}from"@expofp/wayfinding";import{ErrorBoundary as R}from"@sentry/react";import $ from"debug";import{reaction as V}from"mobx";import{createRoot as z}from"react-dom/client";import{install as j}from"resize-observer";import G from"./components/Layout";import{MAX_ROUTE_WAYPOINTS as d}from"./constants";import N from"./data";import{fpGeo as b}from"./data/fpGeo";import q from"./floorplan.loader";import{shouldLoadIntercom as O}from"./intercom";import{BoundsSchema as U,POISelectorsSchema as w,ZoomToOptionsSchema as P}from"./schemas/sdk.schemas";import{applyDeclarativeConfig as H,applyParameters as Y,applyPathway as _,initUrlRouting as D}from"./services/url-dispatch";import{destroyUrlSync as W}from"./services/url-sync";import r from"./store";import{bindRootElement as X,destroyUiHandlers as K}from"./store/init/init-ui";import{findBooth as S,Route as v,separateExternalIds as B}from"./store/RouteStore";import{destroyGtag as Q,GaEventActions as k,sendEventToGa as F,setConsentSettings as Z}from"./tools/gtag";import J from"./tools/report-error";import{resetGlobalVariables as ee}from"./tools/reset";import te from"./tools/track-event";import{cameraToMapSettings as re,mapSettingsToCamera as oe}from"./utils/camera-map-settings";import{getStorage as L}from"./utils/entity-storage";import{getMostFrequent as ie}from"./utils/getMostFrequent";import{convertLocalToGps as se,isValidPointCoords as y}from"./utils/gps";import{getLocales as ne,hasLocale as ae,setLocale as he}from"./utils/i18n";import{mapEntity as g}from"./utils/mapEntity";const p=$("efp:api");j();export default class ce extends q{init(){H(),this.ignoreQuery||D(this.offHistory),te("load"),X(r),r.fp=this,Z(this.consent),F(k.Load,""),this.root=z(this.renderTarget),this.root.render(x(R,{children:x(G,{offHistory:this.offHistory,consent:this.consent})})),F(k.Rendered,""),V(()=>r.layerStore.layersLoaded,()=>{this.resolveReady(),r.initialized||this.onInit?.(this),r.initialized=!0});const e=O(N);e&&import("./intercom/bootIntercom").then(({bootIntercom:t})=>t(e)).catch(()=>{})}selectBooth(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectBooth","Parameter must be a string or an array of strings.","EFP000000");return}const t=r.boothStore.booths.filter(o=>typeof e=="string"?o.name===e||o.externalId===e:e.includes(o.name)||e.includes(o.externalId));r.selectBooth(t)}selectExhibitor(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectExhibitor","Parameter must be a string or an array of strings.","EFP000100");return}if(!e?.length){r.uiState.menu=!1,r.searchStore.resetSearchBox(),r.uiState.details=null;return}const t=r.exhibitorStore.exhibitors.filter(s=>typeof e=="string"?s.name===e||s.externalId===e:e.includes(s.name)||e.includes(s.externalId));if(!t?.length)return;if(typeof e=="string"){r.selectExhibitor(t[0]),r.moveToList([t[0]]);return}const o=t.flatMap(s=>s.booths.map(i=>i.layer)),n=ie(o.map(s=>s.description));n&&r.layerStore.updateVisibility(n,!0),r.uiState.menu=!1,r.searchStore.resetSearchBox(),r.uiState.details=null,r.uiState.list={type:"filter",items:t,query:{key:"exhibitors",value:t.map(s=>s.name).join(",")}},r.moveToList()}highlightExhibitors(e){Array.isArray(e)||a("highlightExhibitors","Parameter must be an array of strings.","EFP000200"),r.boothStore.highlightedByExternalIds=[],r.exhibitorStore.highlightedByExternalIds=[...e]}highlightBooths(e){Array.isArray(e)||a("highlightBooths","Parameter must be an array of strings.","EFP000300"),r.exhibitorStore.highlightedByExternalIds=[],r.boothStore.highlightedByExternalIds=[...e]}highlightEntities(e){Array.isArray(e)||a("highlightEntities","Parameter must be an array of strings.","EFP000400");const{boothExternalIds:t,exhibitorExternalIds:o}=B(e);r.boothStore.highlightedByExternalIds=[...t],r.exhibitorStore.highlightedByExternalIds=[...o]}selectRoute(e,t){if(Array.isArray(e)){let o=[...e];const n=o.shift(),s=o.pop();if(o.length>d)throw new Error(`The maximum number of waypoints is ${d}.`);if(!n||!s){a("selectRoute","Invalid route format: When providing an array, it must include at least two points: a start and a destination.","EFP000401");return}r.routeStore.selectRoute(new v(m(n),m(s),o.map(m)));return}e||a("selectRoute","At a minimum, the starting point must be passed.","EFP000402"),r.routeStore.selectRoute(new v(m(e),m(t)))}getOptimizedRoutes(e){if(!Array.isArray(e))return a("getOptimizedRoutes","Parameter must be an array.","EFP000500"),[];if(e.length>d)throw new Error(`The maximum number of waypoints is ${d}.`);const t=e.map(m).filter(n=>!!n);if(!t.length)throw new Error("No booths found for the provided waypoints.");const o=new Map;for(const n of t){const s=n.layer?.name??"",i=o.get(s);i?i.push(n):o.set(s,[n])}return Array.from(o.values()).map(n=>({waypoints:M(n.map(s=>[s.name,{x:s.rect.center.x,y:s.rect.center.y}]))}))}selectCurrentPosition(e,t,o){const n=y(e.x)&&y(e.y),s=y(e.lng)&&y(e.lat);!n&&!s&&a("selectCurrentPosition","A point must be passed. Either (x,y) or (lat,lng) are required.","EFP000600"),r.routeStore.selectCurrentPosition(e,t,o),this.onCurrentPositionChanged?.(e)}setBookmarks(e){(!Array.isArray(e)||!e.length)&&a("setBookmarks","Parameter must be an array.","EFP000700"),e.forEach(t=>{const o=r.exhibitorStore.exhibitors.find(n=>n.name===t.name||n.externalId===t.externalId);o&&(o.bookmarked=t.bookmarked)})}setEntitiesBookmarks(e){if(!Array.isArray(e)||!e.length){a("setEntitiesBookmarks","Parameter must be an array.","EFP000701");return}const t=["exhibitor","event","speaker","booth"],o=e.find(i=>!i.type||!t.includes(i.type));if(o){a("setEntitiesBookmarks",`Invalid entity type: ${o.type}. Must be one of: ${t.join(", ")}.`,"EFP000702");return}const n=L("bookmarked"),s={exhibitor:{existingIds:new Set(n.exhibitors||[]),finder:i=>r.exhibitorStore.findExhibitor(i),replacer:i=>r.exhibitorStore.replaceBookmarked(i)},event:{existingIds:new Set(n.events||[]),finder:i=>r.eventStore.findByNameOrSlug(i),replacer:i=>r.eventStore.replaceBookmarked(i)},speaker:{existingIds:new Set(n.speakers||[]),finder:i=>r.speakerStore.speakers.find(h=>h.name===i||h.externalId===i||h.slug===i),replacer:i=>r.speakerStore.replaceBookmarked(i)},booth:{existingIds:new Set(n.booths||[]),finder:i=>{const h=r.boothStore.findBooth(i);return h?.exhibitors.length===0?h:void 0},replacer:i=>r.boothStore.replaceBookmarked(i)}};e.forEach(i=>{const h=s[i.type],u=i.name||i.externalId||"",c=h.finder(u);c?i.bookmarked?h.existingIds.add(c.id):h.existingIds.delete(c.id):console.warn(`Entity not found: ${i.type} with query "${u}"`)}),Object.values(s).forEach(i=>{i.replacer(Array.from(i.existingIds))})}setEntitiesVisited(e){if(!Array.isArray(e)||!e.length){a("setEntitiesVisited","Parameter must be an array.","EFP000703");return}const t=["exhibitor","event"],o=e.find(i=>!i.type||!t.includes(i.type));if(o){a("setEntitiesVisited",`Invalid entity type: ${o.type}. Must be one of: ${t.join(", ")}.`,"EFP000704");return}const n=L("visited"),s={exhibitor:{existingIds:new Set(n.exhibitors||[]),finder:i=>r.exhibitorStore.findExhibitor(i),replacer:i=>r.exhibitorStore.replaceVisited(i)},event:{existingIds:new Set(n.events||[]),finder:i=>r.eventStore.findByNameOrSlug(i),replacer:i=>r.eventStore.replaceVisited(i)}};e.forEach(i=>{const h=s[i.type],u=i.name||i.externalId||"",c=h.finder(u);c?i.visited?h.existingIds.add(c.id):h.existingIds.delete(c.id):console.warn(`Entity not found: ${i.type} with query "${u}"`)}),Object.values(s).forEach(i=>{i.replacer(Array.from(i.existingIds))})}setMarkers(e){if(!e||!Array.isArray(e.icons)||!Array.isArray(e.markers)){a("setMarkers","Invalid input.","EFP000800");return}r.routeStore.setMarkers(e)}selectMarker(e,t=!0){return typeof e!="string"&&a("selectMarker","The identifier must be passed.","EFP000900"),r.routeStore.selectMarker(e,t)}drawCircles(e){Array.isArray(e)||a("drawCircles","Invalid input.","EFP000A00"),r.uiState.debugCircles=e}checkRoutes(){r.routeStore.checkRoutes()}updateLayerVisibility(e,t){typeof e!="string"&&a("updateLayerVisibility","The layer name (string) must be passed.","EFP000B00"),t||a("updateLayerVisibility","Passing a false value to visible will have no effect.","EFP000B01"),r.layerStore.updateVisibility(e,t)}getCenterCoordinates(){return r.fp.getCenterCoordinates()}exhibitorsList(){return r.exhibitorStore.exhibitors.map(e=>g(e))}boothsList(){return r.boothStore.booths.map(e=>g(e))}categoriesList(){return r.categoryStore.categories.map(e=>g(e))}selectCategory(e){if(e==null||typeof e!="string"){r.searchStore.selectSearch();return}const t=e?.toLowerCase(),o=r.categoryStore.categories.find(({name:n,slug:s})=>n?.toLowerCase()===t||s?.toLowerCase()===t);if(!o){a("selectCategory",`Category ${e} not found.`,"EFP000C01");return}r.selectCategory(o)}select(e){if(typeof e!="string"){a("select","Parameter must be a string.","EFP001700");return}const t=e,o=t?.toLowerCase(),n=r.boothStore.booths.find(c=>c.slug?.toLowerCase()===o||c.externalId?.toLowerCase()===o||c.externalId?.toLowerCase()?.replace(/\s+/g,"")===o);if(n){setTimeout(()=>r.selectBooth(n),250);return}const s=r.eventStore.eventItems.find(c=>c.slug?.toLowerCase()===o||c.externalId?.toLowerCase()===o);if(s){r.selectEventItem(s,!0);return}const i=r.exhibitorStore.exhibitors.find(c=>c.slug?.toLowerCase()===o||c.externalId?.toLowerCase()===o);if(i){setTimeout(()=>r.clickExhibitor(i),250);return}const h=r.categoryStore.categories.find(c=>c.slug===t);if(h){r.selectCategory(h);return}const u=r.speakerStore.findBySlug(t);if(u){r.selectSpeaker(u,!0);return}t.includes("heatmap=true")||r.searchStore.selectSearch(t)}showList(e){const t={bookmarks:()=>r.selectBookmarks(),visited:()=>r.selectVisited(),sessions:()=>r.selectSessions(),exhibitors:()=>r.selectExhibitors(),speakers:()=>r.selectSpeakers(),tours:()=>r.selectTours(),language:()=>r.selectLanguage()},o=t[e];if(!o){a("showList",`Unknown list "${e}". Must be one of: ${Object.keys(t).join(", ")}.`,"EFP001800");return}o()}selectTour(e){if(typeof e!="string"||!e){a("selectTour","A tour id must be passed.","EFP001900");return}const t=r.toursStore.getTourById(e);t?r.toursStore.launchTour(t,t.name,t.description):(console.warn(`Route with id "${e}" not found`),r.selectTours())}openPlanner(e={}){if(typeof e!="object"||e===null){a("openPlanner","An options object must be passed.","EFP001A00");return}const t=e.from?S(e.from):null;e.fromBookmarks?r.routePlannerStore.launchFromBookmarks(t??void 0):r.routePlannerStore.launchFromSlugs(e.items??[],t??void 0)}startBuildRoute(){r.uiState.startBuildRoute()}applyParameters(e){typeof e!="string"&&a("applyParameters","A query string must be passed.","EFP000D00"),Y(e)}getVisibility(){return r.uiState.visibility}setVisibility(e){(typeof e!="object"||!Object.keys(e).length)&&a("setVisibility","The parameter must be passed.","EFP000E00"),r.uiState.setVisibility(e)}findLocation(){r.routeStore.findLocation()}zoomIn(){r.uiState.zoomIn()}zoomOut(){r.uiState.zoomOut()}switchView(){r.maplibreStore.activateMaplibre()}setCamera(e){p("setCamera called with camera=%O",e);const t=I.safeParse(e);if(!t.success){a("setCamera",t.error.message,"EFP001B00");return}r.uiState.setMapSettings(re(t.data))}getCamera(){return oe(r.uiState.mapSettings)}zoomTo(e,t){p("zoomTo called with selectors=%O options=%O",e,t);const o=w.safeParse(e);if(!o.success){a("zoomTo",o.error.message,"EFP001600");return}const n=P.safeParse(t);if(!n.success){a("zoomTo",n.error.message,"EFP001601");return}const s=this.getBounds(e);s&&this.fitBounds(s,t)}getBounds(e){p("getBounds called with selectors=%O",e);const t=w.safeParse(e);if(!t.success){a("getBounds",t.error.message,"EFP001400");return}const o=[];if(e.booths?.forEach(s=>{let i;s.externalId?i=r.boothStore.boothByExternalId.get(s.externalId):s.name&&(i=r.boothStore.boothByName.get(s.name.toLowerCase())),i?.rect&&o.push(i.rect)}),e.exhibitors?.forEach(s=>{let i;s.externalId?i=r.exhibitorStore.exhibitorByExternalId.get(s.externalId):s.name&&(i=r.exhibitorStore.exhibitorByName.get(s.name.toLowerCase())),i?.booths?.forEach(h=>{h.rect&&o.push(h.rect)})}),o.length===0)return;const n=E.fromUnion(...o);return{leftTop:{x:n.min.x,y:n.min.y},rightBottom:{x:n.max.x,y:n.max.y}}}fitBounds(e,t){if(p("fitBounds called with bounds=%O options=%O",e,t),!e){r.uiState.fitBounds();return}const o=U.safeParse(e);if(!o.success){a("fitBounds",o.error.message,"EFP001500");return}const n=P.safeParse(t);if(!n.success){a("fitBounds",n.error.message,"EFP001501");return}const s=E.fromMinMax({x:e.leftTop.x,y:e.leftTop.y},{x:e.rightBottom.x,y:e.rightBottom.y});r.uiState.moveToRect=t?.padding?s.expand(t.padding):s}getBoothRect(e){typeof e!="string"&&a("getBoothRect","A booth name must be passed.","EFP000F00");const t=S(e)?.rect;return t?l.fromBox(t):void 0}convertToGeo(e,t){if(!b?.properties?.config){a("convertToGeo","The coordinates cannot be converted because the GPS configuration is not defined.","EFP001000");return}if(!e||!t){a("convertToGeo","Both coordinates must be passed.","EFP001001");return}return se(e,t,b.properties.config)}getGeoConfig(){const e=b?.properties?.config;return e?{bearing:e.bearing??0,p0:e.p0,p1:e.p1,p2:e.p2}:null}unstable_destroy(){let e=window.__efpElement.firstChild;ee(),window.removeEventListener("__efpStyleLoad",this.efpStyleLoadHandler),window.removeEventListener("error",J),r.maplibreStore.dispose(),W(),K(),Q(),this.root.unmount(),e.remove()}search(e){return typeof e!="string"&&a("search","A search string must be passed.","EFP001100"),r.fuzzySearchEngineStore.loadEngine().then(()=>(r.searchStore.selectSearch(e),r.uiState.fuzzySearchItems.map(t=>({item:g(t.item),score:t.score}))))}getFloors(){return r.layerStore.floors.map(e=>({name:e.name,shortName:e.shortName,description:e.description,active:e.active,disabled:e.disabled,index:e.index}))}activateFloor(e){if(!e?.name&&e?.index==null){a("activateFloor","Invalid floorId. It must contain either a name or an index.","EFP001200");return}const t=this.getFloors();if(e.name){const o=t.find(n=>n.name===e.name||n.shortName===e.name);if(!o){a("activateFloor",`Floor with name "${e.name}" not found.`,"EFP001201");return}if(o.active)return;this.updateLayerVisibility(o.name,!0);return}if(e.index!==null){const o=t.find(s=>s.index===e.index),n=o?.name;if(!n){a("activateFloor",`Floor at index ${e.index} does not exist.`,"EFP001203");return}if(o.active)return;this.updateLayerVisibility(n,!0);return}}showPathway(e,t){const{boothExternalIds:o,exhibitorExternalIds:n}=t?.length?B(t):{boothExternalIds:[],exhibitorExternalIds:[]};_({pathwayId:e,boothIds:o,exhibitorIds:n})}showPathwayOnly(e,t){this.activateFloor({name:t}),r.layerStore.showPathWay(e),r.uiState.setPathwayOnlyMode(!0);const o=r.layerStore.findLayer(e),n=r.layerStore.findLayer(t),s=o?.rect||o?.viewbox?o:n;if(s?.rect||s?.viewbox){const i=s.viewbox??s.rect;r.uiState.moveToRect=i.clone()}}hidePathways(){this.highlightBooths([]),r.layerStore.hidePathways(),r.uiState.setPathwayOnlyMode(!1)}showSearch(){r.selectSearch("")}changeLanguage(e){const t=e?.toLowerCase?.();if(!ae(t)){a("changeLanguage",`Language "${e}" was not found. Available languages: ${ne().map(o=>o.id).join(",")}`,"EFP001300");return}he(t)}isGpsTrackingEnabled(){return r.routeStore.gpsEnabled}setGpsTrackingEnabled(e){r.routeStore.setGpsTrackingEnabled(e)}deselectCurrentPosition(){r.routeStore.selectCurrentPosition(null,!1)}deselectRoute(){r.routeStore.selectRoute(null),r.routeStore.setOnlyAccessible(!1)}reset(){this.selectBooth(""),this.selectExhibitor(""),this.selectCategory(),this.deselectCurrentPosition(),this.deselectRoute(),this.highlightEntities([]),r.uiState.kioskData&&r.resetCameraFn?r.resetCameraFn?.():this.fitBounds()}selectAccessibleRoute(e){r.routeStore.setOnlyAccessible(!0),this.selectRoute(e)}}function m(f){return typeof f=="string"?S(f):r.routeStore.getNearestBooth(f)}let C=0;function a(f,e,t){const o=`Error calling "${f}" SDK method.`,n=`${e.endsWith(".")?e:e+"."} More information at`;let s="https://js-sdk.expofp.com/api/packages";if(t&&(s+=`#error-${t}`),console.error(`${o} ${n} ${s}`),r.fp.disableRuntimeAlerts)return;r.uiState.setGlobalErrorMessage({title:o,body:T(A,{children:[n," ",x("a",{href:s,target:"_blank",rel:"noreferrer",children:s})]})}),clearTimeout(C);const i=8e3;C=window.setTimeout(()=>{const h=async()=>{r.uiState.globalErrorMessages.length>0&&(r.uiState.popGlobalErrorMessage(),await new Promise(u=>setTimeout(u,i/2)),h())};h()},i)}class l{get h(){return Math.abs(this.y2-this.y1)}get w(){return Math.abs(this.x2-this.x1)}get cx(){return(this.x1+this.x2)/2}get cy(){return(this.y1+this.y2)/2}constructor(e,t,o,n){if(e>o){const s=e;e=o,o=s}if(t>n){const s=t;t=n,n=s}this.x1=e,this.y1=t,this.x2=o,this.y2=n}static fromBox(e){return new l(e.min.x,e.min.y,e.max.x,e.max.y)}static fromCxcywh(e,t,o,n){return new l(e-o/2,t-n/2,e+o/2,t+n/2)}contains(e){return e.x1>=this.x1&&e.x2<=this.x2&&e.y1>=this.y1&&e.y2<=this.y2}intersects(e){const t=Math.max(this.x1,e.x1),o=Math.min(this.x2,e.x2),n=Math.max(this.y1,e.y1),s=Math.min(this.y2,e.y2);return o>=t&&s>=n}getIntersection(e){const t=Math.max(this.x1,e.x1),o=Math.min(this.x2,e.x2),n=Math.max(this.y1,e.y1),s=Math.min(this.y2,e.y2);return o>=t&&s>=n?new l(t,n,o,s):new l(0,0,0,0)}getRotated90(){return l.fromCxcywh(this.cx,this.cy,this.h,this.w)}normalize(e,t){return new l(this.x1/e,this.y1/t,this.x2/e,this.y2/t)}withPadding(e,t=e){return this.w<e*2||this.h<t*2?this:l.fromCxcywh(this.cx,this.cy,this.w-e*2,this.h-t*2)}scale(e){return new l(this.x1*e,this.y1*e,this.x2*e,this.y2*e)}getArea(){return this.w*this.h}clone(){return new l(this.x1,this.y1,this.x2,this.y2)}translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this}equals(e){return e.x1===this.x1&&e.x2===this.x2&&e.y1===this.y1&&e.y2===this.y2}toString(){return this.x1+","+this.y1+","+this.w+","+this.h}containsPoint(e,t){return e>=this.x1&&e<=this.x2&&t>=this.y1&&t<=this.y2}}
1
+ import{Fragment as A,jsx as x,jsxs as T}from"react/jsx-runtime";import{Box as E}from"@expofp/geometry";import{CameraSchema as I}from"@expofp/schema";import{optimizeWaypointOrder as M}from"@expofp/wayfinding";import{ErrorBoundary as R}from"@sentry/react";import $ from"debug";import{reaction as V}from"mobx";import{createRoot as z}from"react-dom/client";import{install as j}from"resize-observer";import G from"./components/Layout";import{MAX_ROUTE_WAYPOINTS as d}from"./constants";import N from"./data";import{fpGeo as b}from"./data/fpGeo";import q from"./floorplan.loader";import{shouldLoadIntercom as O}from"./intercom";import{BoundsSchema as U,POISelectorsSchema as P,ZoomToOptionsSchema as w}from"./schemas/sdk.schemas";import{applyDeclarativeConfig as Y,applyParameters as D,applyPathway as H,initUrlRouting as W}from"./services/url-dispatch";import{destroyUrlSync as X}from"./services/url-sync";import r from"./store";import{bindRootElement as K,destroyUiHandlers as Q}from"./store/init/init-ui";import{findBooth as S,Route as B,separateExternalIds as k}from"./store/RouteStore";import{destroyGtag as Z,GaEventActions as v,sendEventToGa as F,setConsentSettings as J}from"./tools/gtag";import _ from"./tools/report-error";import ee from"./tools/track-event";import{cameraToMapSettings as te,mapSettingsToCamera as re}from"./utils/camera-map-settings";import{getStorage as C}from"./utils/entity-storage";import{getMostFrequent as oe}from"./utils/getMostFrequent";import{convertLocalToGps as ie,isValidPointCoords as y}from"./utils/gps";import{getLocales as se,hasLocale as ne,setLocale as ae}from"./utils/i18n";import{mapEntity as g}from"./utils/mapEntity";const p=$("efp:api");j();export default class he extends q{init(){Y(),this.ignoreQuery||W(this.offHistory),ee("load"),K(r),r.fp=this,J(this.consent),F(v.Load,""),this.root=z(this.renderTarget),this.root.render(x(R,{children:x(G,{offHistory:this.offHistory,consent:this.consent})})),F(v.Rendered,""),V(()=>r.layerStore.layersLoaded,()=>{this.resolveReady(),r.initialized||this.onInit?.(this),r.initialized=!0});const e=O(N);e&&import("./intercom/bootIntercom").then(({bootIntercom:t})=>t(e)).catch(()=>{})}selectBooth(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectBooth","Parameter must be a string or an array of strings.","EFP000000");return}const t=r.boothStore.booths.filter(o=>typeof e=="string"?o.name===e||o.externalId===e:e.includes(o.name)||e.includes(o.externalId));r.selectBooth(t)}selectExhibitor(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectExhibitor","Parameter must be a string or an array of strings.","EFP000100");return}if(!e?.length){r.uiState.menu=!1,r.searchStore.resetSearchBox(),r.uiState.details=null;return}const t=r.exhibitorStore.exhibitors.filter(s=>typeof e=="string"?s.name===e||s.externalId===e:e.includes(s.name)||e.includes(s.externalId));if(!t?.length)return;if(typeof e=="string"){r.selectExhibitor(t[0]),r.moveToList([t[0]]);return}const o=t.flatMap(s=>s.booths.map(i=>i.layer)),n=oe(o.map(s=>s.description));n&&r.layerStore.updateVisibility(n,!0),r.uiState.menu=!1,r.searchStore.resetSearchBox(),r.uiState.details=null,r.uiState.list={type:"filter",items:t,query:{key:"exhibitors",value:t.map(s=>s.name).join(",")}},r.moveToList()}highlightExhibitors(e){Array.isArray(e)||a("highlightExhibitors","Parameter must be an array of strings.","EFP000200"),r.boothStore.highlightedByExternalIds=[],r.exhibitorStore.highlightedByExternalIds=[...e]}highlightBooths(e){Array.isArray(e)||a("highlightBooths","Parameter must be an array of strings.","EFP000300"),r.exhibitorStore.highlightedByExternalIds=[],r.boothStore.highlightedByExternalIds=[...e]}highlightEntities(e){Array.isArray(e)||a("highlightEntities","Parameter must be an array of strings.","EFP000400");const{boothExternalIds:t,exhibitorExternalIds:o}=k(e);r.boothStore.highlightedByExternalIds=[...t],r.exhibitorStore.highlightedByExternalIds=[...o]}selectRoute(e,t){if(Array.isArray(e)){let o=[...e];const n=o.shift(),s=o.pop();if(o.length>d)throw new Error(`The maximum number of waypoints is ${d}.`);if(!n||!s){a("selectRoute","Invalid route format: When providing an array, it must include at least two points: a start and a destination.","EFP000401");return}r.routeStore.selectRoute(new B(m(n),m(s),o.map(m)));return}e||a("selectRoute","At a minimum, the starting point must be passed.","EFP000402"),r.routeStore.selectRoute(new B(m(e),m(t)))}getOptimizedRoutes(e){if(!Array.isArray(e))return a("getOptimizedRoutes","Parameter must be an array.","EFP000500"),[];if(e.length>d)throw new Error(`The maximum number of waypoints is ${d}.`);const t=e.map(m).filter(n=>!!n);if(!t.length)throw new Error("No booths found for the provided waypoints.");const o=new Map;for(const n of t){const s=n.layer?.name??"",i=o.get(s);i?i.push(n):o.set(s,[n])}return Array.from(o.values()).map(n=>({waypoints:M(n.map(s=>[s.name,{x:s.rect.center.x,y:s.rect.center.y}]))}))}selectCurrentPosition(e,t,o){const n=y(e.x)&&y(e.y),s=y(e.lng)&&y(e.lat);!n&&!s&&a("selectCurrentPosition","A point must be passed. Either (x,y) or (lat,lng) are required.","EFP000600"),r.routeStore.selectCurrentPosition(e,t,o),this.onCurrentPositionChanged?.(e)}setBookmarks(e){(!Array.isArray(e)||!e.length)&&a("setBookmarks","Parameter must be an array.","EFP000700"),e.forEach(t=>{const o=r.exhibitorStore.exhibitors.find(n=>n.name===t.name||n.externalId===t.externalId);o&&(o.bookmarked=t.bookmarked)})}setEntitiesBookmarks(e){if(!Array.isArray(e)||!e.length){a("setEntitiesBookmarks","Parameter must be an array.","EFP000701");return}const t=["exhibitor","event","speaker","booth"],o=e.find(i=>!i.type||!t.includes(i.type));if(o){a("setEntitiesBookmarks",`Invalid entity type: ${o.type}. Must be one of: ${t.join(", ")}.`,"EFP000702");return}const n=C("bookmarked"),s={exhibitor:{existingIds:new Set(n.exhibitors||[]),finder:i=>r.exhibitorStore.findExhibitor(i),replacer:i=>r.exhibitorStore.replaceBookmarked(i)},event:{existingIds:new Set(n.events||[]),finder:i=>r.eventStore.findByNameOrSlug(i),replacer:i=>r.eventStore.replaceBookmarked(i)},speaker:{existingIds:new Set(n.speakers||[]),finder:i=>r.speakerStore.speakers.find(h=>h.name===i||h.externalId===i||h.slug===i),replacer:i=>r.speakerStore.replaceBookmarked(i)},booth:{existingIds:new Set(n.booths||[]),finder:i=>{const h=r.boothStore.findBooth(i);return h?.exhibitors.length===0?h:void 0},replacer:i=>r.boothStore.replaceBookmarked(i)}};e.forEach(i=>{const h=s[i.type],u=i.name||i.externalId||"",c=h.finder(u);c?i.bookmarked?h.existingIds.add(c.id):h.existingIds.delete(c.id):console.warn(`Entity not found: ${i.type} with query "${u}"`)}),Object.values(s).forEach(i=>{i.replacer(Array.from(i.existingIds))})}setEntitiesVisited(e){if(!Array.isArray(e)||!e.length){a("setEntitiesVisited","Parameter must be an array.","EFP000703");return}const t=["exhibitor","event"],o=e.find(i=>!i.type||!t.includes(i.type));if(o){a("setEntitiesVisited",`Invalid entity type: ${o.type}. Must be one of: ${t.join(", ")}.`,"EFP000704");return}const n=C("visited"),s={exhibitor:{existingIds:new Set(n.exhibitors||[]),finder:i=>r.exhibitorStore.findExhibitor(i),replacer:i=>r.exhibitorStore.replaceVisited(i)},event:{existingIds:new Set(n.events||[]),finder:i=>r.eventStore.findByNameOrSlug(i),replacer:i=>r.eventStore.replaceVisited(i)}};e.forEach(i=>{const h=s[i.type],u=i.name||i.externalId||"",c=h.finder(u);c?i.visited?h.existingIds.add(c.id):h.existingIds.delete(c.id):console.warn(`Entity not found: ${i.type} with query "${u}"`)}),Object.values(s).forEach(i=>{i.replacer(Array.from(i.existingIds))})}setMarkers(e){if(!e||!Array.isArray(e.icons)||!Array.isArray(e.markers)){a("setMarkers","Invalid input.","EFP000800");return}r.routeStore.setMarkers(e)}selectMarker(e,t=!0){return typeof e!="string"&&a("selectMarker","The identifier must be passed.","EFP000900"),r.routeStore.selectMarker(e,t)}drawCircles(e){Array.isArray(e)||a("drawCircles","Invalid input.","EFP000A00"),r.uiState.debugCircles=e}checkRoutes(){r.routeStore.checkRoutes()}updateLayerVisibility(e,t){typeof e!="string"&&a("updateLayerVisibility","The layer name (string) must be passed.","EFP000B00"),t||a("updateLayerVisibility","Passing a false value to visible will have no effect.","EFP000B01"),r.layerStore.updateVisibility(e,t)}getCenterCoordinates(){return r.fp.getCenterCoordinates()}exhibitorsList(){return r.exhibitorStore.exhibitors.map(e=>g(e))}boothsList(){return r.boothStore.booths.map(e=>g(e))}categoriesList(){return r.categoryStore.categories.map(e=>g(e))}selectCategory(e){if(e==null||typeof e!="string"){r.searchStore.selectSearch();return}const t=e?.toLowerCase(),o=r.categoryStore.categories.find(({name:n,slug:s})=>n?.toLowerCase()===t||s?.toLowerCase()===t);if(!o){a("selectCategory",`Category ${e} not found.`,"EFP000C01");return}r.selectCategory(o)}select(e){if(typeof e!="string"){a("select","Parameter must be a string.","EFP001700");return}const t=e,o=t?.toLowerCase(),n=r.boothStore.booths.find(c=>c.slug?.toLowerCase()===o||c.externalId?.toLowerCase()===o||c.externalId?.toLowerCase()?.replace(/\s+/g,"")===o);if(n){setTimeout(()=>r.selectBooth(n),250);return}const s=r.eventStore.eventItems.find(c=>c.slug?.toLowerCase()===o||c.externalId?.toLowerCase()===o);if(s){r.selectEventItem(s,!0);return}const i=r.exhibitorStore.exhibitors.find(c=>c.slug?.toLowerCase()===o||c.externalId?.toLowerCase()===o);if(i){setTimeout(()=>r.clickExhibitor(i),250);return}const h=r.categoryStore.categories.find(c=>c.slug===t);if(h){r.selectCategory(h);return}const u=r.speakerStore.findBySlug(t);if(u){r.selectSpeaker(u,!0);return}t.includes("heatmap=true")||r.searchStore.selectSearch(t)}showList(e){const t={bookmarks:()=>r.selectBookmarks(),visited:()=>r.selectVisited(),sessions:()=>r.selectSessions(),exhibitors:()=>r.selectExhibitors(),speakers:()=>r.selectSpeakers(),tours:()=>r.selectTours(),language:()=>r.selectLanguage()},o=t[e];if(!o){a("showList",`Unknown list "${e}". Must be one of: ${Object.keys(t).join(", ")}.`,"EFP001800");return}o()}selectTour(e){if(typeof e!="string"||!e){a("selectTour","A tour id must be passed.","EFP001900");return}const t=r.toursStore.getTourById(e);t?r.toursStore.launchTour(t,t.name,t.description):(console.warn(`Route with id "${e}" not found`),r.selectTours())}openPlanner(e={}){if(typeof e!="object"||e===null){a("openPlanner","An options object must be passed.","EFP001A00");return}const t=e.from?S(e.from):null;e.fromBookmarks?r.routePlannerStore.launchFromBookmarks(t??void 0):r.routePlannerStore.launchFromSlugs(e.items??[],t??void 0)}startBuildRoute(){r.uiState.startBuildRoute()}applyParameters(e){typeof e!="string"&&a("applyParameters","A query string must be passed.","EFP000D00"),D(e)}getVisibility(){return r.uiState.visibility}setVisibility(e){(typeof e!="object"||!Object.keys(e).length)&&a("setVisibility","The parameter must be passed.","EFP000E00"),r.uiState.setVisibility(e)}findLocation(){r.routeStore.findLocation()}zoomIn(){r.uiState.zoomIn()}zoomOut(){r.uiState.zoomOut()}switchView(){r.maplibreStore.activateMaplibre()}setCamera(e){p("setCamera called with camera=%O",e);const t=I.safeParse(e);if(!t.success){a("setCamera",t.error.message,"EFP001B00");return}r.uiState.setMapSettings(te(t.data))}getCamera(){return re(r.uiState.mapSettings)}zoomTo(e,t){p("zoomTo called with selectors=%O options=%O",e,t);const o=P.safeParse(e);if(!o.success){a("zoomTo",o.error.message,"EFP001600");return}const n=w.safeParse(t);if(!n.success){a("zoomTo",n.error.message,"EFP001601");return}const s=this.getBounds(e);s&&this.fitBounds(s,t)}getBounds(e){p("getBounds called with selectors=%O",e);const t=P.safeParse(e);if(!t.success){a("getBounds",t.error.message,"EFP001400");return}const o=[];if(e.booths?.forEach(s=>{let i;s.externalId?i=r.boothStore.boothByExternalId.get(s.externalId):s.name&&(i=r.boothStore.boothByName.get(s.name.toLowerCase())),i?.rect&&o.push(i.rect)}),e.exhibitors?.forEach(s=>{let i;s.externalId?i=r.exhibitorStore.exhibitorByExternalId.get(s.externalId):s.name&&(i=r.exhibitorStore.exhibitorByName.get(s.name.toLowerCase())),i?.booths?.forEach(h=>{h.rect&&o.push(h.rect)})}),o.length===0)return;const n=E.fromUnion(...o);return{leftTop:{x:n.min.x,y:n.min.y},rightBottom:{x:n.max.x,y:n.max.y}}}fitBounds(e,t){if(p("fitBounds called with bounds=%O options=%O",e,t),!e){r.uiState.fitBounds();return}const o=U.safeParse(e);if(!o.success){a("fitBounds",o.error.message,"EFP001500");return}const n=w.safeParse(t);if(!n.success){a("fitBounds",n.error.message,"EFP001501");return}const s=E.fromMinMax({x:e.leftTop.x,y:e.leftTop.y},{x:e.rightBottom.x,y:e.rightBottom.y});r.uiState.moveToRect=t?.padding?s.expand(t.padding):s}getBoothRect(e){typeof e!="string"&&a("getBoothRect","A booth name must be passed.","EFP000F00");const t=S(e)?.rect;return t?l.fromBox(t):void 0}convertToGeo(e,t){if(!b?.properties?.config){a("convertToGeo","The coordinates cannot be converted because the GPS configuration is not defined.","EFP001000");return}if(!e||!t){a("convertToGeo","Both coordinates must be passed.","EFP001001");return}return ie(e,t,b.properties.config)}getGeoConfig(){const e=b?.properties?.config;return e?{bearing:e.bearing??0,p0:e.p0,p1:e.p1,p2:e.p2}:null}releaseResources(){window.removeEventListener("error",_),r.maplibreStore.dispose(),X(),Q(),Z(),this.root.unmount(),super.releaseResources()}search(e){return typeof e!="string"&&a("search","A search string must be passed.","EFP001100"),r.fuzzySearchEngineStore.loadEngine().then(()=>(r.searchStore.selectSearch(e),r.uiState.fuzzySearchItems.map(t=>({item:g(t.item),score:t.score}))))}getFloors(){return r.layerStore.floors.map(e=>({name:e.name,shortName:e.shortName,description:e.description,active:e.active,disabled:e.disabled,index:e.index}))}activateFloor(e){if(!e?.name&&e?.index==null){a("activateFloor","Invalid floorId. It must contain either a name or an index.","EFP001200");return}const t=this.getFloors();if(e.name){const o=t.find(n=>n.name===e.name||n.shortName===e.name);if(!o){a("activateFloor",`Floor with name "${e.name}" not found.`,"EFP001201");return}if(o.active)return;this.updateLayerVisibility(o.name,!0);return}if(e.index!==null){const o=t.find(s=>s.index===e.index),n=o?.name;if(!n){a("activateFloor",`Floor at index ${e.index} does not exist.`,"EFP001203");return}if(o.active)return;this.updateLayerVisibility(n,!0);return}}showPathway(e,t){const{boothExternalIds:o,exhibitorExternalIds:n}=t?.length?k(t):{boothExternalIds:[],exhibitorExternalIds:[]};H({pathwayId:e,boothIds:o,exhibitorIds:n})}showPathwayOnly(e,t){this.activateFloor({name:t}),r.layerStore.showPathWay(e),r.uiState.setPathwayOnlyMode(!0);const o=r.layerStore.findLayer(e),n=r.layerStore.findLayer(t),s=o?.rect||o?.viewbox?o:n;if(s?.rect||s?.viewbox){const i=s.viewbox??s.rect;r.uiState.moveToRect=i.clone()}}hidePathways(){this.highlightBooths([]),r.layerStore.hidePathways(),r.uiState.setPathwayOnlyMode(!1)}showSearch(){r.selectSearch("")}changeLanguage(e){const t=e?.toLowerCase?.();if(!ne(t)){a("changeLanguage",`Language "${e}" was not found. Available languages: ${se().map(o=>o.id).join(",")}`,"EFP001300");return}ae(t)}isGpsTrackingEnabled(){return r.routeStore.gpsEnabled}setGpsTrackingEnabled(e){r.routeStore.setGpsTrackingEnabled(e)}deselectCurrentPosition(){r.routeStore.selectCurrentPosition(null,!1)}deselectRoute(){r.routeStore.selectRoute(null),r.routeStore.setOnlyAccessible(!1)}reset(){this.selectBooth(""),this.selectExhibitor(""),this.selectCategory(),this.deselectCurrentPosition(),this.deselectRoute(),this.highlightEntities([]),r.uiState.kioskData&&r.resetCameraFn?r.resetCameraFn?.():this.fitBounds()}selectAccessibleRoute(e){r.routeStore.setOnlyAccessible(!0),this.selectRoute(e)}}function m(f){return typeof f=="string"?S(f):r.routeStore.getNearestBooth(f)}let L=0;function a(f,e,t){const o=`Error calling "${f}" SDK method.`,n=`${e.endsWith(".")?e:e+"."} More information at`;let s="https://js-sdk.expofp.com/api/packages";if(t&&(s+=`#error-${t}`),console.error(`${o} ${n} ${s}`),r.fp.disableRuntimeAlerts)return;r.uiState.setGlobalErrorMessage({title:o,body:T(A,{children:[n," ",x("a",{href:s,target:"_blank",rel:"noreferrer",children:s})]})}),clearTimeout(L);const i=8e3;L=window.setTimeout(()=>{const h=async()=>{r.uiState.globalErrorMessages.length>0&&(r.uiState.popGlobalErrorMessage(),await new Promise(u=>setTimeout(u,i/2)),h())};h()},i)}class l{get h(){return Math.abs(this.y2-this.y1)}get w(){return Math.abs(this.x2-this.x1)}get cx(){return(this.x1+this.x2)/2}get cy(){return(this.y1+this.y2)/2}constructor(e,t,o,n){if(e>o){const s=e;e=o,o=s}if(t>n){const s=t;t=n,n=s}this.x1=e,this.y1=t,this.x2=o,this.y2=n}static fromBox(e){return new l(e.min.x,e.min.y,e.max.x,e.max.y)}static fromCxcywh(e,t,o,n){return new l(e-o/2,t-n/2,e+o/2,t+n/2)}contains(e){return e.x1>=this.x1&&e.x2<=this.x2&&e.y1>=this.y1&&e.y2<=this.y2}intersects(e){const t=Math.max(this.x1,e.x1),o=Math.min(this.x2,e.x2),n=Math.max(this.y1,e.y1),s=Math.min(this.y2,e.y2);return o>=t&&s>=n}getIntersection(e){const t=Math.max(this.x1,e.x1),o=Math.min(this.x2,e.x2),n=Math.max(this.y1,e.y1),s=Math.min(this.y2,e.y2);return o>=t&&s>=n?new l(t,n,o,s):new l(0,0,0,0)}getRotated90(){return l.fromCxcywh(this.cx,this.cy,this.h,this.w)}normalize(e,t){return new l(this.x1/e,this.y1/t,this.x2/e,this.y2/t)}withPadding(e,t=e){return this.w<e*2||this.h<t*2?this:l.fromCxcywh(this.cx,this.cy,this.w-e*2,this.h-t*2)}scale(e){return new l(this.x1*e,this.y1*e,this.x2*e,this.y2*e)}getArea(){return this.w*this.h}clone(){return new l(this.x1,this.y1,this.x2,this.y2)}translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this}equals(e){return e.x1===this.x1&&e.x2===this.x2&&e.y1===this.y1&&e.y2===this.y2}toString(){return this.x1+","+this.y1+","+this.w+","+this.h}containsPoint(e,t){return e>=this.x1&&e<=this.x2&&t>=this.y1&&t<=this.y2}}
package/dist/esm/load.js CHANGED
@@ -1,4 +1,4 @@
1
- import"./utils/silence-mobx-react-lite-warning";import{applyIntents as c,loadConfig as p,setConfig as m}from"@expofp/config";import{safeLocalStorage as u}from"@expofp/utils";import l from"debug";import{initHtmlHead as y}from"./_misc_to_move/initHtmlHead";import{logBuildInfo as h}from"./_misc_to_move/logBuildInfo";import g from"./floorplan.loader";import{migrateLegacyStorageKeys as v}from"./utils/legacy-storage-keys";const d=l("efp:load");export async function load(r,e={}){y(),h(),l("efp:device").enabled&&import("./_misc_to_move/logDeviceInfo").then(o=>o.logDeviceInfo()).catch(()=>{});const a=e.element;let t;if(typeof a=="string"){const o=document.querySelector(a);if(!o)throw new Error(`Element not found for selector: ${a}`);t=o}else a?t=a:(t=document.getElementById("floorplan"),t||(t=document.createElement("div"),S(t),document.body.appendChild(t)));w(),t.setAttribute("data-efp-floorplan-defaults",""),document.documentElement.style.overscrollBehavior||="none",document.body.style.overscrollBehavior||="none",requestAnimationFrame(()=>{t.style.backgroundColor="#ebebeb"}),v();let i;try{if(i=await p(r,e,window.location.search,u()??void 0),!i.fpSvgJsRef)throw new Error("No floor plan drawing: the manifest must set `legacyDataUrlBase` (live event) or `fpSvgJsRef` (offline copy)")}catch(o){const{showEventNotFound:f}=await import("./tools/event-not-found");throw f(t),o}d("config",i),m(i);const n=new g(e,t),s=window.___fpResolve;return window.___fp=n,s&&(n.ready.then(()=>s(n)),delete window.___fpResolve),n.ready.then(()=>{const o=new CustomEvent("expofp:ready",{detail:{floorplan:n}});window.__expofpReady=o,window.dispatchEvent(o)}),n.ready.then(()=>c(n,i.intents)).catch(o=>d("config intents skipped:",o)),n}function w(){const r="efp-floorplan-defaults";if(document.getElementById(r))return;const e=document.createElement("style");e.id=r,e.textContent=`
1
+ import"./utils/silence-mobx-react-lite-warning";import{applyIntents as f,loadConfig as p,setConfig as m}from"@expofp/config";import{safeLocalStorage as u}from"@expofp/utils";import d from"debug";import{initHtmlHead as h}from"./_misc_to_move/initHtmlHead";import{logBuildInfo as y}from"./_misc_to_move/logBuildInfo";import v from"./floorplan.loader";import{migrateLegacyStorageKeys as g}from"./utils/legacy-storage-keys";const s=d("efp:load");export async function load(r,e={}){h(),y(),d("efp:device").enabled&&import("./_misc_to_move/logDeviceInfo").then(t=>t.logDeviceInfo()).catch(()=>{});const a=e.element;let o;if(typeof a=="string"){const t=document.querySelector(a);if(!t)throw new Error(`Element not found for selector: ${a}`);o=t}else a?o=a:(o=document.getElementById("floorplan"),o||(o=document.createElement("div"),S(o),document.body.appendChild(o)));w(),o.setAttribute("data-efp-floorplan-defaults",""),document.documentElement.style.overscrollBehavior||="none",document.body.style.overscrollBehavior||="none",requestAnimationFrame(()=>{o.style.backgroundColor="#ebebeb"}),g();let i;try{if(i=await p(r,e,window.location.search,u()??void 0),!i.fpSvgJsRef)throw new Error("No floor plan drawing: the manifest must set `legacyDataUrlBase` (live event) or `fpSvgJsRef` (offline copy)")}catch(t){const{showEventNotFound:c}=await import("./tools/event-not-found");throw c(o),t}s("config",i),m(i);const n=new v(e,o),l=window.___fpResolve;return window.___fp=n,l&&(n.ready.then(()=>l(n)).catch(t=>s("placeholder resolve skipped:",t)),delete window.___fpResolve),n.ready.then(()=>{const t=new CustomEvent("expofp:ready",{detail:{floorplan:n}});window.__expofpReady=t,window.dispatchEvent(t)}).catch(t=>s("ready event skipped:",t)),n.ready.then(()=>f(n,i.intents)).catch(t=>s("config intents skipped:",t)),n}function w(){const r="efp-floorplan-defaults";if(document.getElementById(r))return;const e=document.createElement("style");e.id=r,e.textContent=`
2
2
  [data-efp-floorplan-defaults] {
3
3
  position: fixed;
4
4
  top: 0;
@@ -61,7 +61,7 @@ import"./utils/silence-mobx-react-lite-warning";import{applyIntents as c,loadCon
61
61
  100% {
62
62
  stroke-dashoffset: -125px;
63
63
  }
64
- }`,t=new CSSStyleSheet;t.replaceSync(a),document.adoptedStyleSheets=[...document.adoptedStyleSheets,t],r.innerHTML=`<div class="${e}">
64
+ }`,o=new CSSStyleSheet;o.replaceSync(a),document.adoptedStyleSheets=[...document.adoptedStyleSheets,o],r.innerHTML=`<div class="${e}">
65
65
  <svg viewBox="25 25 50 50">
66
66
  <circle r="20" cy="50" cx="50"></circle>
67
67
  </svg>
@@ -4,6 +4,15 @@ import { type Camera, type ListPanel, type PlannerOptions } from '@expofp/schema
4
4
  * Represents a floor plan.
5
5
  */
6
6
  export interface FloorPlan {
7
+ /**
8
+ * Resolves once the plan has mounted and its API is live.
9
+ *
10
+ * Rejects if {@link destroy} is called first: the initialization it was
11
+ * waiting on has been cancelled, so awaiting it any longer would never
12
+ * return. Await it inside the same chain that owns the teardown, or attach a
13
+ * `catch` — an unhandled rejection here is a destroyed plan, not a failure
14
+ * to load.
15
+ */
7
16
  readonly ready: Promise<void>;
8
17
  readonly element: HTMLDivElement;
9
18
  readonly eventId: string;
@@ -109,6 +118,26 @@ export interface FloorPlan {
109
118
  getBoothRect(name: string): Rect;
110
119
  convertToGeo(x: number, y: number): [number, number] | never;
111
120
  getGeoConfig(): GeoConfig | null;
121
+ /**
122
+ * Tears the floor plan down: unmounts the UI, drops the window listeners,
123
+ * analytics, URL sync and map resources it installed, and empties the
124
+ * container element — the element itself is left in the document, ready to
125
+ * be passed to a new {@link load} call.
126
+ *
127
+ * Safe at any point in the lifecycle: calling it before {@link ready}
128
+ * resolves cancels the pending initialization instead of throwing, so a
129
+ * single-page app can unmount a route while the plan is still loading. That
130
+ * cancellation rejects {@link ready} rather than leaving it pending forever.
131
+ * Calling it more than once does nothing after the first.
132
+ *
133
+ * The instance is spent once destroyed — call {@link load} again for a new
134
+ * plan rather than reusing it.
135
+ */
136
+ destroy(): void;
137
+ /**
138
+ * @deprecated Renamed to {@link destroy}, which carries the same behaviour
139
+ * plus a stable contract. This alias will be removed in a future major.
140
+ */
112
141
  unstable_destroy(): void;
113
142
  highlightExhibitors(externalIds: string[]): void;
114
143
  highlightBooths(externalIds: string[]): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expofp/floorplan",
3
- "version": "3.24.2",
3
+ "version": "3.25.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/expofp/efp-app.git",
@@ -70,14 +70,14 @@
70
70
  "tslib": "^2.3.0",
71
71
  "uuid": "^9.0.1",
72
72
  "zod": "4.4.3",
73
- "@expofp/config": "3.24.2",
74
- "@expofp/resolve": "3.24.2",
75
- "@expofp/schema": "3.24.2",
76
- "@expofp/geometry": "3.24.2",
77
- "@expofp/ui": "3.24.2",
78
- "@expofp/utils": "3.24.2",
79
- "@expofp/wayfinding": "3.24.2",
80
- "@expofp/debug": "3.24.2"
73
+ "@expofp/config": "3.25.0",
74
+ "@expofp/debug": "3.25.0",
75
+ "@expofp/geometry": "3.25.0",
76
+ "@expofp/schema": "3.25.0",
77
+ "@expofp/resolve": "3.25.0",
78
+ "@expofp/ui": "3.25.0",
79
+ "@expofp/utils": "3.25.0",
80
+ "@expofp/wayfinding": "3.25.0"
81
81
  },
82
82
  "devDependencies": {
83
83
  "@babel/plugin-proposal-decorators": "^8.0.2",