@expofp/floorplan 3.0.0-alpha.15 → 3.0.0-alpha.16

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 (93) hide show
  1. package/dist/browser/Debug-DazuGIJc.js +40 -0
  2. package/dist/browser/{Demo-pwpeopeB.js → Demo-CXdISYQf.js} +6 -6
  3. package/dist/browser/{Free-CeZSHheC.js → Free-CVgHQ8yt.js} +10 -10
  4. package/dist/browser/{Gallery-BTasOfWx.js → Gallery-BMcvPLO_.js} +31 -31
  5. package/dist/browser/{GpsLoader-BS8b-Aif.js → GpsLoader-BiwFO3QG.js} +25 -25
  6. package/dist/browser/{KioskStore-_Zcv0Bc0.js → KioskStore-NqUeUutQ.js} +9 -9
  7. package/dist/browser/{Mapbox-Cl59-8BN.js → Mapbox-PHCrBnx5.js} +14 -14
  8. package/dist/browser/{SetKioskMode-CjjAW8SI.js → SetKioskMode-DMQej1ec.js} +35 -35
  9. package/dist/browser/{ShowKiosk-DUcthTIK.js → ShowKiosk-BWlBMcI7.js} +9 -9
  10. package/dist/browser/{ThreeComponent-CdelmApV.js → ThreeComponent-Dmt2HPyX.js} +7 -7
  11. package/dist/browser/ViewerMenuPanel-CuqRZ7m1.js +77 -0
  12. package/dist/browser/{boolean-editor-HetrPeeC.js → boolean-editor-zsvPcNpX.js} +6 -6
  13. package/dist/browser/bundle.json +32 -29
  14. package/dist/browser/{client-BMgLu7eB.js → client-B2kCMH8A.js} +4 -4
  15. package/dist/browser/{data-eO9H1gMa.js → data-BtD6blv7.js} +4 -4
  16. package/dist/browser/{debug-overlay-DqIeCuHo.js → debug-overlay-CF0imHRX.js} +7 -7
  17. package/dist/browser/{debug-ui-6t_iunMd.js → debug-ui-Zt7T7T-N.js} +14 -14
  18. package/dist/browser/{favicon-CoF9H4Pb.js → favicon-Dj8hNa7i.js} +1 -1
  19. package/dist/browser/{fetch-retry.umd-GcX1W9qV.js → fetch-retry.umd-B-swKpFA.js} +26 -26
  20. package/dist/browser/{flex-BC_JSvaB.js → flex-COa6XN1F.js} +5 -5
  21. package/dist/browser/{floorplan.ready-CZn5dvsU.js → floorplan.ready-CNnM_Yyc.js} +12197 -14235
  22. package/dist/browser/fonts/efp-symbols.woff +0 -0
  23. package/dist/browser/{index-sNwIhVDZ.js → index-B1P-x0sk.js} +5 -5
  24. package/dist/browser/{index-C1Rwmp91.js → index-BEcZnTgd.js} +14 -14
  25. package/dist/browser/{index-Dba8EyWF.js → index-BeS6l0j-.js} +24 -24
  26. package/dist/browser/index-C04zJbbt.js +12475 -0
  27. package/dist/browser/{index-Dp-WygGH.js → index-CgWDjED_.js} +12 -12
  28. package/dist/browser/{index-CEVUHq8g.js → index-CqICVJZO.js} +5 -5
  29. package/dist/browser/{index-uGr-_9rk.js → index-atMSRNM1.js} +3 -3
  30. package/dist/browser/index.js +3 -3
  31. package/dist/browser/{jsx-runtime-BHfPvO9I.js → jsx-runtime-DAY7g56y.js} +1 -1
  32. package/dist/browser/locales/ar.json +3 -1
  33. package/dist/browser/locales/de.json +3 -1
  34. package/dist/browser/locales/es.json +3 -1
  35. package/dist/browser/locales/fr.json +3 -1
  36. package/dist/browser/locales/he.json +3 -1
  37. package/dist/browser/locales/it.json +3 -1
  38. package/dist/browser/locales/kk.json +3 -1
  39. package/dist/browser/locales/ko.json +3 -1
  40. package/dist/browser/locales/mn.json +3 -1
  41. package/dist/browser/locales/nl.json +3 -1
  42. package/dist/browser/locales/pl.json +3 -1
  43. package/dist/browser/locales/pt.json +3 -1
  44. package/dist/browser/locales/ru.json +3 -1
  45. package/dist/browser/locales/sv.json +3 -1
  46. package/dist/browser/locales/th.json +3 -1
  47. package/dist/browser/locales/tr.json +3 -1
  48. package/dist/browser/locales/uk.json +3 -1
  49. package/dist/browser/locales/vi.json +3 -1
  50. package/dist/browser/locales/zh.json +3 -1
  51. package/dist/browser/{main-DYasSc7U.js → main-DZpmA53N.js} +1 -1
  52. package/dist/browser/{particles.min-B6O6_M_h.js → particles.min-DXab_WLN.js} +3 -3
  53. package/dist/esm/components/Alert.d.ts +2 -0
  54. package/dist/esm/components/Alert.js +1 -1
  55. package/dist/esm/components/Badge.d.ts +3 -2
  56. package/dist/esm/components/Badge.js +1 -1
  57. package/dist/esm/components/CookieConsent.js +1 -1
  58. package/dist/esm/components/Kiosk/SetKiosk/storage.d.ts +1 -1
  59. package/dist/esm/components/Kiosk/SetKiosk/storage.js +1 -1
  60. package/dist/esm/components/Kiosk/ShowKiosk.js +1 -1
  61. package/dist/esm/components/Menu.js +1 -1
  62. package/dist/esm/components/Overlay.d.ts +2 -0
  63. package/dist/esm/components/Overlay.js +1 -1
  64. package/dist/esm/components/OverlayContainer.js +1 -1
  65. package/dist/esm/components/RoutePlanner/RoutePlanner.js +1 -1
  66. package/dist/esm/components/RoutePlanner/RoutePlannerHeader.js +1 -1
  67. package/dist/esm/components/RoutePlanner/RoutePlannerStopItem.js +1 -1
  68. package/dist/esm/components/Schedule.js +1 -1
  69. package/dist/esm/components/SearchBox.js +1 -1
  70. package/dist/esm/components/ViewerMenuPanel.d.ts +5 -0
  71. package/dist/esm/components/ViewerMenuPanel.js +1 -0
  72. package/dist/esm/constants.d.ts +2 -0
  73. package/dist/esm/constants.js +1 -1
  74. package/dist/esm/floorplan.loader.d.ts +2 -0
  75. package/dist/esm/floorplan.loader.js +1 -1
  76. package/dist/esm/floorplan.ready.js +1 -1
  77. package/dist/esm/services/routing.js +1 -1
  78. package/dist/esm/store/LayerStore.d.ts +1 -0
  79. package/dist/esm/store/LayerStore.js +1 -1
  80. package/dist/esm/store/RoutePlannerStore.d.ts +16 -0
  81. package/dist/esm/store/RoutePlannerStore.js +1 -1
  82. package/dist/esm/store/UIState.d.ts +1 -0
  83. package/dist/esm/store/UIState.js +1 -1
  84. package/dist/esm/store/init/init-layers.js +1 -1
  85. package/dist/esm/tools/telemetry.d.ts +35 -0
  86. package/dist/esm/tools/telemetry.js +1 -0
  87. package/dist/esm/tools/track-event.d.ts +3 -1
  88. package/dist/esm/tools/track-event.js +1 -1
  89. package/dist/esm/utils/i18n.d.ts +2 -2
  90. package/dist/esm/utils/i18n.js +1 -1
  91. package/package.json +3 -3
  92. package/dist/browser/Debug-Bn7mmuWl.js +0 -40
  93. package/dist/browser/index-DnV82MKb.js +0 -10233
@@ -0,0 +1 @@
1
+ import{jsx as e,Fragment as w,jsxs as s}from"react/jsx-runtime";import{observer as _}from"mobx-react-lite";import a from"../data";import o,{uiState as x}from"../store";import{t as r}from"../utils/i18n";import{Button as l}from"./";import"./ViewerMenuPanel.scss";function N(n){if(!n)return{venue:"",dateRange:""};const t=n.split(" | ");return{venue:t[0]?.trim()||"",dateRange:t[1]?.trim()||""}}function D(n,t){if(!n||!t)return!1;const c=Date.now();return c>=new Date(n).getTime()&&c<=new Date(t+"T23:59:59").getTime()}const S=_(()=>{const{venue:n,dateRange:t}=N(a.subtitle),u=!(!!a.startDate&&!!a.endDate),d=D(a.startDate,a.endDate),m=o.eventStore.eventItems.length>0,v=o.toursStore.hasTours;function p(i){i.preventDefault(),x.menu=!1}function h(i){i.preventDefault(),o.selectExhibitors()}function f(i){i.preventDefault(),o.selectSessions()}function g(i){i.preventDefault(),o.selectTours()}return s("div",{className:"viewer-panel",children:[s("div",{className:"viewer-panel__info",children:[e("div",{className:"viewer-panel__title",children:a.title}),s("div",{className:"viewer-panel__row",children:[e("i",{className:"viewer-panel__icon icon-schedule"}),u?e("span",{children:r("Ongoing")}):s(w,{children:[e("span",{children:t}),d&&e("div",{className:"viewer-panel__now-badge",children:r("Now")})]})]}),n&&s("div",{className:"viewer-panel__row",children:[e("i",{className:"viewer-panel__icon icon-marker-pin"}),e("span",{children:n})]})]}),s("div",{className:"viewer-panel__buttons",children:[e(l,{variant:"gray",size:"lg",text:r("Map"),onClick:p}),e(l,{variant:"gray",size:"lg",text:r("Exhibitors"),onClick:h}),m&&e(l,{variant:"gray",size:"lg",text:r("Sessions"),onClick:f}),v&&e(l,{variant:"gray",size:"lg",text:r("Guided tours"),onClick:g})]})]})});export default S;
@@ -32,4 +32,6 @@ export declare const FONT_WEIGHT_PRIMARY_EXHIBITOR = "--expofp-exhibitor-main-we
32
32
  export declare const FONT_WEIGHT_SECONDARY_EXHIBITOR = "--expofp-exhibitor-details-weight";
33
33
  export declare const FONT_WEIGHT_PRIMARY_SPECIAL = "--expofp-booth-special-weight";
34
34
  export declare const ORIENTATION_GRANTED_KEY = "efp-compass-permission-granted";
35
+ export declare const VIEWER_MODE_QUERY = "viewermode";
36
+ export declare const VIEWER_MODE_STORAGE_KEY = "___viewer_mode";
35
37
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- export const VISIBILITY_STORAGE_KEY="___visibility",PREVIEW_MODE_QUERY="previewMode",PREVIEW_MODE_STORAGE_KEY="___preview_mode",PREVIEW_MODE_ATTRIBUTE="data-preview-mode",BOOTHS_PAINTER_MARKER="booths",SEPARATOR=":",LAYER_LOGOS_MARKER="logos",LAYER_ICONS_MARKER="icons",STRING_META_DELIMITER="$$",KIOSK_ENABLE_KEY="kiosk",SET_KIOSK_KEY="setkiosk",BOOKMARK_PAINTER_MARKER="booth-bookmark",MAP_SETTINGS_KEY="expofp-map-settings",DEBUG_KEY="debug",DEFAULT_UNITS="ft",BUILD_ROUTE_KEY="build-route",PLANNER_KEY="planner",PLANNER_SOURCE_KEY="source",PLANNER_FROM_KEY="from",PATHWAY_KEY="pathway",CACHE_DURATION=1e3,MOBILE_BREAKPOINT=768,LANG_KEY="lang",UI_SCALE_PARAM_KEY="uiscale",UI_SCALE_RESET_PARAM_KEY="resetuiscale",UI_SCALE_STORAGE_KEY="___ui-scale",MAX_ROUTE_WAYPOINTS=8,FONT_FACE="--expofp-font-face",FONT_WEIGHT_PRIMARY_BOOTH="--expofp-booth-main-weight",FONT_WEIGHT_SECONDARY_BOOTH="--expofp-booth-details-weight",FONT_WEIGHT_PRIMARY_EXHIBITOR="--expofp-exhibitor-main-weight",FONT_WEIGHT_SECONDARY_EXHIBITOR="--expofp-exhibitor-details-weight",FONT_WEIGHT_PRIMARY_SPECIAL="--expofp-booth-special-weight",ORIENTATION_GRANTED_KEY="efp-compass-permission-granted";
1
+ export const VISIBILITY_STORAGE_KEY="___visibility",PREVIEW_MODE_QUERY="previewMode",PREVIEW_MODE_STORAGE_KEY="___preview_mode",PREVIEW_MODE_ATTRIBUTE="data-preview-mode",BOOTHS_PAINTER_MARKER="booths",SEPARATOR=":",LAYER_LOGOS_MARKER="logos",LAYER_ICONS_MARKER="icons",STRING_META_DELIMITER="$$",KIOSK_ENABLE_KEY="kiosk",SET_KIOSK_KEY="setkiosk",BOOKMARK_PAINTER_MARKER="booth-bookmark",MAP_SETTINGS_KEY="expofp-map-settings",DEBUG_KEY="debug",DEFAULT_UNITS="ft",BUILD_ROUTE_KEY="build-route",PLANNER_KEY="planner",PLANNER_SOURCE_KEY="source",PLANNER_FROM_KEY="from",PATHWAY_KEY="pathway",CACHE_DURATION=1e3,MOBILE_BREAKPOINT=768,LANG_KEY="lang",UI_SCALE_PARAM_KEY="uiscale",UI_SCALE_RESET_PARAM_KEY="resetuiscale",UI_SCALE_STORAGE_KEY="___ui-scale",MAX_ROUTE_WAYPOINTS=8,FONT_FACE="--expofp-font-face",FONT_WEIGHT_PRIMARY_BOOTH="--expofp-booth-main-weight",FONT_WEIGHT_SECONDARY_BOOTH="--expofp-booth-details-weight",FONT_WEIGHT_PRIMARY_EXHIBITOR="--expofp-exhibitor-main-weight",FONT_WEIGHT_SECONDARY_EXHIBITOR="--expofp-exhibitor-details-weight",FONT_WEIGHT_PRIMARY_SPECIAL="--expofp-booth-special-weight",ORIENTATION_GRANTED_KEY="efp-compass-permission-granted",VIEWER_MODE_QUERY="viewermode",VIEWER_MODE_STORAGE_KEY="___viewer_mode";
@@ -15,6 +15,7 @@ export default class FloorPlanLoader implements FloorPlan {
15
15
  readonly allowConsent: boolean | undefined;
16
16
  readonly onInit: (fp: FloorPlan) => void;
17
17
  readonly disableRuntimeAlerts: boolean;
18
+ readonly viewerMode: boolean;
18
19
  protected efpStyleLoadHandler: (e: Event) => void;
19
20
  protected resolveReady: () => void;
20
21
  readonly icons: Map<FloorPlanIcon, HTMLImageElement>;
@@ -32,6 +33,7 @@ export default class FloorPlanLoader implements FloorPlan {
32
33
  onExhibitorCustomButtonClick: (e: FloorPlanCustomButtonEvent) => void;
33
34
  onGetCoordsClick: (e: FloorPlanGetCoordsEvent) => void;
34
35
  onMarkerClick: (e: FloorPlanMarkerEvent) => void;
36
+ onLeaveEvent: () => void;
35
37
  selectBooth(nameOrExternalId: string | string[]): void;
36
38
  selectExhibitor(nameOrExternalId: string | string[]): void;
37
39
  selectRoute(startOrWaypoints: RouteWaypoint | RouteWaypoint[], to?: RouteWaypoint): void;
@@ -1 +1 @@
1
- import{PREVIEW_MODE_ATTRIBUTE as M}from"./constants";import l from"./tools/base-runtime-url";import{buildRebookingUrl as V,getRebookingToken as H,retainRebookingToken as z}from"./tools/rebookingUrl";import{loadCss as x,loadFont as g,loadJs as b}from"./tools/loaders";import U from"./tools/logger";import{sleep as G}from"./utils";import{initI18n as N}from"./utils/i18n";import S from"./utils/is-webview";import{loadCustomCss as Q}from"./utils/loadCustomCss";import{loadIcons as q}from"./utils/loadIcons";import W from"./utils/mergeExhibitors";import L from"./utils/use-shadow";import $ from"./utils/is-debug";import J from"./utils/is-localhost";import{initSentry as K}from"./tools/sentry";function t(){throw new Error("FloorPlan not ready")}export default class Y{options;renderTarget;_ready;element;eventId;dataUrl;noOverlay;offHistory;ignoreQuery;allowConsent;onInit;disableRuntimeAlerts;efpStyleLoadHandler;resolveReady;icons=new Map;enableRotation=!0;alwaysShowSidebar=!1;get ready(){return this._ready}get previewMode(){return this.options.previewMode||this.element.hasAttribute(M)}onBoothClick;onBookmarkClick;onVisitedClick;onCategoryClick;onFpConfigured;onDirection;onDetails;onExhibitorCustomButtonClick;onGetCoordsClick;onMarkerClick;selectBooth(e){t()}selectExhibitor(e){t()}selectRoute(e,a){t()}getOptimizedRoutes(e){t()}selectCurrentPosition(e,a,h){t()}setBookmarks(e){t()}setEntitiesBookmarks(e){t()}setEntitiesVisited(e){t()}setMarkers(e){t()}updateLayerVisibility(e,a){t()}getCenterCoordinates(){t()}applyParameters(e){t()}exhibitorsList(){t()}boothsList(){t()}categoriesList(){t()}selectCategory(e){t()}getVisibility(){t()}setVisibility(e){t()}findLocation(){t()}zoomIn(){t()}zoomOut(){t()}zoomTo(e,a){t()}switchView(){t()}fitBounds(){t()}getBounds(e){t()}getBoothRect(e){t()}convertToGeo(e,a){t()}unstable_destroy(){t()}highlightExhibitors(e){t()}highlightBooths(e){t()}onCurrentPositionChanged(e){t()}search(e){t()}getFloors(){t()}onFloorActivated(e){t()}activateFloor(e){t()}showPathway(e,a){t()}showPathwayOnly(e,a){t()}hidePathways(){t()}showSearch(){t()}changeLanguage(e){t()}isGpsTrackingEnabled(){t()}setGpsTrackingEnabled(e){t()}deselectCurrentPosition(){t()}deselectRoute(){t()}reset(){t()}constructor(e){this.options=e,this.noOverlay=!!e.noOverlay,this.offHistory=!!e.offHistory,this.ignoreQuery=e.ignoreQuery,this.allowConsent=J&&!$?!1:e.allowConsent,this.onBoothClick=e.onBoothClick,this.onBookmarkClick=e.onBookmarkClick,this.onVisitedClick=e.onVisitedClick,this.onCategoryClick=e.onCategoryClick,this.onDetails=e.onDetails,this.onExhibitorCustomButtonClick=e.onExhibitorCustomButtonClick,this.onGetCoordsClick=e.onGetCoordsClick,this.onMarkerClick=e.onMarkerClick,this.onFpConfigured=e.onFpConfigured,this.onDirection=e.onDirection,this.onInit=e.onInit,this.onCurrentPositionChanged=e.onCurrentPositionChanged,this.onFloorActivated=e.onFloorActivated,this.disableRuntimeAlerts=e.disableRuntimeAlerts??!0,this._ready=new Promise((d,i)=>{this.resolveReady=d});const a=e.element;if(this.element=a,a.__expofp)throw new Error("Element already in use");if(a.__expofp=this,a.getAttribute("data-event-id")||a.getAttribute("data-event"))throw new Error("data-xxx attributes are removed, use options instead");const h=e.expo||e.event;if(!h)throw new Error("`expo` option is required");K({eventId:h||"",isWebview:S}),this.eventId=h,window.__efpEvent=h,window.__efpElement=a;const E=[...a.classList];a.classList.remove(...E),a.classList.add("expofp-floorplan-default",...E);const B=document.head||document.getElementsByTagName("head")[0],P=document.createElement("style");B.prepend(P),P.textContent=".expofp-floorplan-default { width: 100%; height: 100%;}";const m=document.createElement("div");m.style.height="100%",m.style.width="100%",a.appendChild(m);let s;if(S&&(this.allowConsent=!0),e.allowConsent===void 0){const i=new URL(window.location.href).searchParams.get("allowConsent");i&&(this.allowConsent=i==="true")}if(L){s=m.attachShadow({mode:"open"});const d=s,i=document;d.createElement=(...r)=>i.createElement(...r),d.createElementNS=(...r)=>i.createElementNS(...r),d.createTextNode=(...r)=>i.createTextNode(...r)}else s=m;const y=document.createElement("div");if(y.style.height="100%",y.style.width="100%",s.appendChild(y),L&&Object.defineProperty(y,"ownerDocument",{value:s}),this.renderTarget=y,a.getAttribute("data-data-url"))throw new Error("data-xxx attributes are removed, use options instead");const u=e.legacyDataUrlBase;window.__dataUrlBase=u,this.dataUrl=u,U.log("Instantiating ExpoFP floorplan",e.element,h);const O=u+"data.js",j=u+"wf.data.js",R=u+"fp.svg.js",D=[b(j),b(O),b(R)];let v=0;this.efpStyleLoadHandler=function(d){const i=window.__efpStyleElements;for(;v<i.length;){const r=i[v];s.appendChild(r),v++}},window.addEventListener("__efpStyleLoad",this.efpStyleLoadHandler);const k=this;(async function(){await Promise.all(D);let i=0;for(;window.__fpPending&&!window.__fp;)await G(2e3),await b(R+`?v=${++i}`);const r=window.__data;await N();const f=new URLSearchParams(window.location.search);let w,C;if(r?.trackerUrl)try{w=new URL(r.trackerUrl),C=w.searchParams.get("expoId")}catch(o){console.error(o)}const I=async o=>{if(!w||!C)return Promise.reject(new Error("trackerUrl or expoId is missing"));const n=new URL(o.dataUrl,w.origin),c=await fetch(n.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expoId:C,token:decodeURIComponent(f.get("t"))})});let p=[];c.ok&&(p=(await c.json()).map(o.dataMapper)),window.__heatmapDataYah={yah:p}};if(f.get("heatmap")==="true")try{if(f.get("type")==="yah")f.get("subtype")==="kiosk"?await I({dataUrl:"/api/kiosks/list/viewer",dataMapper:o=>({...o,id:o.key,name:`Kiosk ${o.key}`})}):await I({dataUrl:"/api/v1/you-are-here/qr-code/list/viewer",dataMapper:(o,n)=>({...o,name:`QR Code #${n+1}`})});else{const o=new URL("/api/fp-stats/get",w.origin);o.searchParams.set("expoId",C),o.searchParams.set("type","booview"),o.searchParams.set("t",decodeURIComponent(f.get("t")));const n=new URL("api/fp-stats/get",w.origin);n.searchParams.set("expoId",C),n.searchParams.set("type","exview"),n.searchParams.set("t",decodeURIComponent(f.get("t")));const[c,p]=await Promise.all([fetch(o.toString()),fetch(n.toString())]),[_,A]=await Promise.all([c.json(),p.json()]);window.__heatmapData={booths:_,exhibitors:A}}}catch(o){console.error("Heatmap: Initialization error",o)}try{const o=H();if(o){z(o);const n=V("api/rebooking-data",{rt:o,expoKey:h}),c=await fetch(n);if(c.ok){const p=await c.json();W(r,p)}r.isRebooking=c.ok}else r.isRebooking=!1}catch(o){console.error(o)}const T=[x(l+"vendor/sanitize-css/sanitize.css",s),x(l+"vendor/perfect-scrollbar/css/perfect-scrollbar.css",s),x(l+"vendor/mapbox/mapbox-gl.css",s),g("Oswald",l+"fonts/oswald-v17-cyrillic_latin-300.woff",{weight:300}),g("Oswald",l+"fonts/oswald-v17-cyrillic_latin-500.woff",{weight:500}),g("Inter",l+"fonts/inter-400.woff2",{weight:400}),g("Inter",l+"fonts/inter-500.woff2",{weight:500}),g("Inter",l+"fonts/inter-600.woff2",{weight:600}),g("efp-symbols",l+"fonts/efp-symbols.woff",{weight:400}),Q(r),q(k.icons)];await Promise.all(T),k.enableRotation=r?.enableRotation??!1,k.alwaysShowSidebar=r?.alwaysShowSidebar??!1,U.log("Data loaded");const{default:F}=await import("./floorplan.ready");for(document.querySelectorAll(".expofp-floorplan-loader").forEach(o=>o.remove());a.firstChild&&a.firstChild!==m;)a.removeChild(a.firstChild);Object.setPrototypeOf(k,F.prototype).init()})()}}
1
+ import{PREVIEW_MODE_ATTRIBUTE as A}from"./constants";import l from"./tools/base-runtime-url";import{buildRebookingUrl as V,getRebookingToken as H,retainRebookingToken as z}from"./tools/rebookingUrl";import{loadCss as x,loadFont as g,loadJs as b}from"./tools/loaders";import U from"./tools/logger";import{sleep as G}from"./utils";import{initI18n as N}from"./utils/i18n";import S from"./utils/is-webview";import{loadCustomCss as Q}from"./utils/loadCustomCss";import{loadIcons as q}from"./utils/loadIcons";import W from"./utils/mergeExhibitors";import L from"./utils/use-shadow";import $ from"./utils/is-debug";import J from"./utils/is-localhost";import{initSentry as K}from"./tools/sentry";function t(){throw new Error("FloorPlan not ready")}export default class Y{options;renderTarget;_ready;element;eventId;dataUrl;noOverlay;offHistory;ignoreQuery;allowConsent;onInit;disableRuntimeAlerts;viewerMode;efpStyleLoadHandler;resolveReady;icons=new Map;enableRotation=!0;alwaysShowSidebar=!1;get ready(){return this._ready}get previewMode(){return this.options.previewMode||this.element.hasAttribute(A)}onBoothClick;onBookmarkClick;onVisitedClick;onCategoryClick;onFpConfigured;onDirection;onDetails;onExhibitorCustomButtonClick;onGetCoordsClick;onMarkerClick;onLeaveEvent;selectBooth(e){t()}selectExhibitor(e){t()}selectRoute(e,a){t()}getOptimizedRoutes(e){t()}selectCurrentPosition(e,a,h){t()}setBookmarks(e){t()}setEntitiesBookmarks(e){t()}setEntitiesVisited(e){t()}setMarkers(e){t()}updateLayerVisibility(e,a){t()}getCenterCoordinates(){t()}applyParameters(e){t()}exhibitorsList(){t()}boothsList(){t()}categoriesList(){t()}selectCategory(e){t()}getVisibility(){t()}setVisibility(e){t()}findLocation(){t()}zoomIn(){t()}zoomOut(){t()}zoomTo(e,a){t()}switchView(){t()}fitBounds(){t()}getBounds(e){t()}getBoothRect(e){t()}convertToGeo(e,a){t()}unstable_destroy(){t()}highlightExhibitors(e){t()}highlightBooths(e){t()}onCurrentPositionChanged(e){t()}search(e){t()}getFloors(){t()}onFloorActivated(e){t()}activateFloor(e){t()}showPathway(e,a){t()}showPathwayOnly(e,a){t()}hidePathways(){t()}showSearch(){t()}changeLanguage(e){t()}isGpsTrackingEnabled(){t()}setGpsTrackingEnabled(e){t()}deselectCurrentPosition(){t()}deselectRoute(){t()}reset(){t()}constructor(e){this.options=e,this.noOverlay=!!e.noOverlay,this.offHistory=!!e.offHistory,this.ignoreQuery=e.ignoreQuery,this.allowConsent=J&&!$?!1:e.allowConsent,this.onBoothClick=e.onBoothClick,this.onBookmarkClick=e.onBookmarkClick,this.onVisitedClick=e.onVisitedClick,this.onCategoryClick=e.onCategoryClick,this.onDetails=e.onDetails,this.onExhibitorCustomButtonClick=e.onExhibitorCustomButtonClick,this.onGetCoordsClick=e.onGetCoordsClick,this.onMarkerClick=e.onMarkerClick,this.onFpConfigured=e.onFpConfigured,this.onDirection=e.onDirection,this.onInit=e.onInit,this.onCurrentPositionChanged=e.onCurrentPositionChanged,this.onFloorActivated=e.onFloorActivated,this.onLeaveEvent=e.onLeaveEvent,this.viewerMode=!!e.viewerMode,this.disableRuntimeAlerts=e.disableRuntimeAlerts??!0,this._ready=new Promise((d,i)=>{this.resolveReady=d});const a=e.element;if(this.element=a,a.__expofp)throw new Error("Element already in use");if(a.__expofp=this,a.getAttribute("data-event-id")||a.getAttribute("data-event"))throw new Error("data-xxx attributes are removed, use options instead");const h=e.expo||e.event;if(!h)throw new Error("`expo` option is required");K({eventId:h||"",isWebview:S}),this.eventId=h,window.__efpEvent=h,window.__efpElement=a;const E=[...a.classList];a.classList.remove(...E),a.classList.add("expofp-floorplan-default",...E);const B=document.head||document.getElementsByTagName("head")[0],P=document.createElement("style");B.prepend(P),P.textContent=".expofp-floorplan-default { width: 100%; height: 100%;}";const m=document.createElement("div");m.style.height="100%",m.style.width="100%",a.appendChild(m);let s;if(S&&(this.allowConsent=!0),e.allowConsent===void 0){const i=new URL(window.location.href).searchParams.get("allowConsent");i&&(this.allowConsent=i==="true")}if(L){s=m.attachShadow({mode:"open"});const d=s,i=document;d.createElement=(...r)=>i.createElement(...r),d.createElementNS=(...r)=>i.createElementNS(...r),d.createTextNode=(...r)=>i.createTextNode(...r)}else s=m;const y=document.createElement("div");if(y.style.height="100%",y.style.width="100%",s.appendChild(y),L&&Object.defineProperty(y,"ownerDocument",{value:s}),this.renderTarget=y,a.getAttribute("data-data-url"))throw new Error("data-xxx attributes are removed, use options instead");const u=e.legacyDataUrlBase;window.__dataUrlBase=u,this.dataUrl=u,U.log("Instantiating ExpoFP floorplan",e.element,h);const O=u+"data.js",j=u+"wf.data.js",R=u+"fp.svg.js",D=[b(j),b(O),b(R)];let v=0;this.efpStyleLoadHandler=function(d){const i=window.__efpStyleElements;for(;v<i.length;){const r=i[v];s.appendChild(r),v++}},window.addEventListener("__efpStyleLoad",this.efpStyleLoadHandler);const k=this;(async function(){await Promise.all(D);let i=0;for(;window.__fpPending&&!window.__fp;)await G(2e3),await b(R+`?v=${++i}`);const r=window.__data;await N();const f=new URLSearchParams(window.location.search);let w,C;if(r?.trackerUrl)try{w=new URL(r.trackerUrl),C=w.searchParams.get("expoId")}catch(o){console.error(o)}const I=async o=>{if(!w||!C)return Promise.reject(new Error("trackerUrl or expoId is missing"));const n=new URL(o.dataUrl,w.origin),c=await fetch(n.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expoId:C,token:decodeURIComponent(f.get("t"))})});let p=[];c.ok&&(p=(await c.json()).map(o.dataMapper)),window.__heatmapDataYah={yah:p}};if(f.get("heatmap")==="true")try{if(f.get("type")==="yah")f.get("subtype")==="kiosk"?await I({dataUrl:"/api/kiosks/list/viewer",dataMapper:o=>({...o,id:o.key,name:`Kiosk ${o.key}`})}):await I({dataUrl:"/api/v1/you-are-here/qr-code/list/viewer",dataMapper:(o,n)=>({...o,name:`QR Code #${n+1}`})});else{const o=new URL("/api/fp-stats/get",w.origin);o.searchParams.set("expoId",C),o.searchParams.set("type","booview"),o.searchParams.set("t",decodeURIComponent(f.get("t")));const n=new URL("api/fp-stats/get",w.origin);n.searchParams.set("expoId",C),n.searchParams.set("type","exview"),n.searchParams.set("t",decodeURIComponent(f.get("t")));const[c,p]=await Promise.all([fetch(o.toString()),fetch(n.toString())]),[_,F]=await Promise.all([c.json(),p.json()]);window.__heatmapData={booths:_,exhibitors:F}}}catch(o){console.error("Heatmap: Initialization error",o)}try{const o=H();if(o){z(o);const n=V("api/rebooking-data",{rt:o,expoKey:h}),c=await fetch(n);if(c.ok){const p=await c.json();W(r,p)}r.isRebooking=c.ok}else r.isRebooking=!1}catch(o){console.error(o)}const T=[x(l+"vendor/sanitize-css/sanitize.css",s),x(l+"vendor/perfect-scrollbar/css/perfect-scrollbar.css",s),x(l+"vendor/mapbox/mapbox-gl.css",s),g("Oswald",l+"fonts/oswald-v17-cyrillic_latin-300.woff",{weight:300}),g("Oswald",l+"fonts/oswald-v17-cyrillic_latin-500.woff",{weight:500}),g("Inter",l+"fonts/inter-400.woff2",{weight:400}),g("Inter",l+"fonts/inter-500.woff2",{weight:500}),g("Inter",l+"fonts/inter-600.woff2",{weight:600}),g("efp-symbols",l+"fonts/efp-symbols.woff",{weight:400}),Q(r),q(k.icons)];await Promise.all(T),k.enableRotation=r?.enableRotation??!1,k.alwaysShowSidebar=r?.alwaysShowSidebar??!1,U.log("Data loaded");const{default:M}=await import("./floorplan.ready");for(document.querySelectorAll(".expofp-floorplan-loader").forEach(o=>o.remove());a.firstChild&&a.firstChild!==m;)a.removeChild(a.firstChild);Object.setPrototypeOf(k,M.prototype).init()})()}}
@@ -1 +1 @@
1
- import{jsx as p,Fragment as L,jsxs as T}from"react/jsx-runtime";import{reaction as C}from"mobx";import{createRoot as R}from"react-dom/client";import{install as I}from"resize-observer";import V from"./components/Layout";import $ from"./floorplan.loader";import{applyParameters as M,destroyHistory as j,initRouting as z}from"./services/routing";import t from"./store";import{Route as S,findBooth as x,separateExternalIds as E}from"./store/RouteStore";import{destroyUiHandlers as G}from"./store/init/init-ui";import{GaEventActions as P,destroyGtag as _,sendEventToGa as w,setConsentSettings as q}from"./tools/gtag";import N from"./tools/report-error";import{resetGlobalVariables as Y}from"./tools/reset";import H from"./tools/track-event";import{fpGeo as v}from"./components/Mapbox/utils/fpGeo";import{convertLocalToGps as O,isValidPointCoords as d}from"./utils/gps";import m from"./core/Rect";import{mapEntity as y}from"./utils/mapEntity";import{LANG_KEY as X,MAX_ROUTE_WAYPOINTS as g,PATHWAY_KEY as U}from"./constants";import{getStorage as B}from"./utils/entity-storage";import{ErrorBoundary as K}from"@sentry/react";import{POISelectorsSchema as F,BoundsSchema as D,ZoomToOptionsSchema as A}from"./schemas/sdk.schemas";import W from"debug";import{buildOptimizedRoute as Q}from"./utils/buildOptimizedRoute";const b=W("efp:api");I();export default class Z extends ${root;init(){this.ignoreQuery||z(this.offHistory),H("load"),t.fp=this,q(this.allowConsent),w(P.Load,""),this.root=R(this.renderTarget),this.root.render(p(K,{children:p(V,{offHistory:this.offHistory,allowConsent:this.allowConsent})})),w(P.Rendered,""),C(()=>t.layerStore.layersLoaded,()=>{this.resolveReady(),t.initialized||this.onInit?.(this),t.initialized=!0})}selectBooth(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectBooth","Parameter must be a string or an array of strings.","EFP000000");return}const i=t.boothStore.booths.filter(o=>typeof e=="string"?o.name===e||o.externalId===e:e.includes(o.name)||e.includes(o.externalId));t.selectBooth(i)}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){t.uiState.menu=!1,t.searchStore.resetSearchBox(),t.uiState.details=null;return}const i=t.exhibitorStore.exhibitors.filter(s=>typeof e=="string"?s.name===e||s.externalId===e:e.includes(s.name)||e.includes(s.externalId));if(!i?.length)return;if(typeof e=="string"){t.selectExhibitor(i[0]),t.moveToList([i[0]]);return}const o=i.flatMap(s=>s.booths.map(r=>r.layer)),{description:n}=o.reduce((s,r)=>(s.freq[r.description]=(s.freq[r.description]||0)+1,s.freq[r.description]>s.maxCount&&(s.maxCount=s.freq[r.description],s.mostFrequent=r),s),{freq:{},mostFrequent:o[0],maxCount:0}).mostFrequent;t.layerStore.updateVisibility(n,!0),t.uiState.menu=!1,t.searchStore.resetSearchBox(),t.uiState.details=null,t.uiState.list={type:"filter",items:i,query:{key:"exhibitors",value:i.map(s=>s.externalId).join(",")}},t.moveToList()}highlightExhibitors(e){Array.isArray(e)||a("highlightExhibitors","Parameter must be an array of strings.","EFP000200"),t.boothStore.highlightedByExternalIds=[],t.exhibitorStore.highlightedByExternalIds=[...e]}highlightBooths(e){Array.isArray(e)||a("highlightBooths","Parameter must be an array of strings.","EFP000300"),t.exhibitorStore.highlightedByExternalIds=[],t.boothStore.highlightedByExternalIds=[...e]}highlightEntities(e){Array.isArray(e)||a("highlightEntities","Parameter must be an array of strings.","EFP000400");const{boothExternalIds:i,exhibitorExternalIds:o}=E(e);t.boothStore.highlightedByExternalIds=[...i],t.exhibitorStore.highlightedByExternalIds=[...o]}selectRoute(e,i){if(Array.isArray(e)){let o=[...e];const n=o.shift(),s=o.pop();if(o.length>g)throw new Error(`The maximum number of waypoints is ${g}.`);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}t.routeStore.selectRoute(new S(f(n),f(s),o.map(f)));return}e||a("selectRoute","At a minimum, the starting point must be passed.","EFP000402"),t.routeStore.selectRoute(new S(f(e),f(i)))}getOptimizedRoutes(e){if(!Array.isArray(e))return a("getOptimizedRoutes","Parameter must be an array.","EFP000500"),[];if(e.length>g)throw new Error(`The maximum number of waypoints is ${g}.`);const i=e.map(f).filter(n=>!!n);if(!i.length)throw new Error("No booths found for the provided waypoints.");const o=new Map;for(const n of i){const s=n.layer?.name??"",r=o.get(s);r?r.push(n):o.set(s,[n])}return Array.from(o.values()).map(n=>({waypoints:Q(n.map(s=>[s.name,{cx:s.rect.cx,cy:s.rect.cy}]))}))}selectCurrentPosition(e,i,o){const n=d(e.x)&&d(e.y),s=d(e.lng)&&d(e.lat);!n&&!s&&a("selectCurrentPosition","A point must be passed. Either (x,y) or (lat,lng) are required.","EFP000600"),t.routeStore.selectCurrentPosition(e,i,o),this.onCurrentPositionChanged?.(e)}setBookmarks(e){(!Array.isArray(e)||!e.length)&&a("setBookmarks","Parameter must be an array.","EFP000700"),e.forEach(i=>{const o=t.exhibitorStore.exhibitors.find(n=>n.name===i.name||n.externalId===i.externalId);o&&(o.bookmarked=i.bookmarked)})}setEntitiesBookmarks(e){if(!Array.isArray(e)||!e.length){a("setEntitiesBookmarks","Parameter must be an array.","EFP000701");return}const i=["exhibitor","event","speaker","booth"],o=e.find(r=>!r.type||!i.includes(r.type));if(o){a("setEntitiesBookmarks",`Invalid entity type: ${o.type}. Must be one of: ${i.join(", ")}.`,"EFP000702");return}const n=B("bookmarked"),s={exhibitor:{existingIds:new Set(n.exhibitors||[]),finder:r=>t.exhibitorStore.findExhibitor(r),replacer:r=>t.exhibitorStore.replaceBookmarked(r)},event:{existingIds:new Set(n.events||[]),finder:r=>t.eventStore.findByNameOrSlug(r),replacer:r=>t.eventStore.replaceBookmarked(r)},speaker:{existingIds:new Set(n.speakers||[]),finder:r=>t.speakerStore.speakers.find(l=>l.name===r||l.externalId===r||l.slug===r),replacer:r=>t.speakerStore.replaceBookmarked(r)},booth:{existingIds:new Set(n.booths||[]),finder:r=>{const l=t.boothStore.findBooth(r);return l?.exhibitors.length===0?l:void 0},replacer:r=>t.boothStore.replaceBookmarked(r)}};e.forEach(r=>{const l=s[r.type],h=r.name||r.externalId||"",c=l.finder(h);c?r.bookmarked?l.existingIds.add(c.id):l.existingIds.delete(c.id):console.warn(`Entity not found: ${r.type} with query "${h}"`)}),Object.values(s).forEach(r=>{r.replacer(Array.from(r.existingIds))})}setEntitiesVisited(e){if(!Array.isArray(e)||!e.length){a("setEntitiesVisited","Parameter must be an array.","EFP000703");return}const i=["exhibitor","event"],o=e.find(r=>!r.type||!i.includes(r.type));if(o){a("setEntitiesVisited",`Invalid entity type: ${o.type}. Must be one of: ${i.join(", ")}.`,"EFP000704");return}const n=B("visited"),s={exhibitor:{existingIds:new Set(n.exhibitors||[]),finder:r=>t.exhibitorStore.findExhibitor(r),replacer:r=>t.exhibitorStore.replaceVisited(r)},event:{existingIds:new Set(n.events||[]),finder:r=>t.eventStore.findByNameOrSlug(r),replacer:r=>t.eventStore.replaceVisited(r)}};e.forEach(r=>{const l=s[r.type],h=r.name||r.externalId||"",c=l.finder(h);c?r.visited?l.existingIds.add(c.id):l.existingIds.delete(c.id):console.warn(`Entity not found: ${r.type} with query "${h}"`)}),Object.values(s).forEach(r=>{r.replacer(Array.from(r.existingIds))})}setMarkers(e){if(!e||!Array.isArray(e.icons)||!Array.isArray(e.markers)){a("setMarkers","Invalid input.","EFP000800");return}t.routeStore.setMarkers(e)}selectMarker(e,i=!0){return typeof e!="string"&&a("selectMarker","The identifier must be passed.","EFP000900"),t.routeStore.selectMarker(e,i)}drawCircles(e){Array.isArray(e)||a("drawCircles","Invalid input.","EFP000A00"),t.uiState.debugCircles=e}checkRoutes(){t.routeStore.checkRoutes()}updateLayerVisibility(e,i){typeof e!="string"&&a("updateLayerVisibility","The layer name (string) must be passed.","EFP000B00"),i||a("updateLayerVisibility","Passing a false value to visible will have no effect.","EFP000B01"),t.layerStore.updateVisibility(e,i)}getCenterCoordinates(){return t.fp.getCenterCoordinates()}exhibitorsList(){return t.exhibitorStore.exhibitors.map(e=>y(e))}boothsList(){return t.boothStore.booths.map(e=>y(e))}categoriesList(){return t.categoryStore.categories.map(e=>y(e))}selectCategory(e){if(e==null||typeof e!="string"){t.searchStore.selectSearch();return}const i=e?.toLowerCase(),o=t.categoryStore.categories.find(({name:n,slug:s})=>n?.toLowerCase()===i||s?.toLowerCase()===i);if(!o){a("selectCategory",`Category ${e} not found.`,"EFP000C01");return}t.selectCategory(o)}applyParameters(e){typeof e!="string"&&a("applyParameters","A query string must be passed.","EFP000D00"),M(e)}getVisibility(){return t.uiState.visibility}setVisibility(e){(typeof e!="object"||!Object.keys(e).length)&&a("setVisibility","The parameter must be passed.","EFP000E00"),t.uiState.setVisibility(e)}findLocation(){t.routeStore.findLocation()}zoomIn(){t.uiState.zoomIn()}zoomOut(){t.uiState.zoomOut()}switchView(){t.mapboxStore.activateMapbox()}zoomTo(e,i){b("zoomTo called with selectors=%O options=%O",e,i);const o=F.safeParse(e);if(!o.success){a("zoomTo",o.error.message,"EFP001600");return}const n=A.safeParse(i);if(!n.success){a("zoomTo",n.error.message,"EFP001601");return}const s=this.getBounds(e);s&&this.fitBounds(s,i)}getBounds(e){b("getBounds called with selectors=%O",e);const i=F.safeParse(e);if(!i.success){a("getBounds",i.error.message,"EFP001400");return}const o=[];if(e.booths?.forEach(s=>{let r;s.externalId?r=t.boothStore.boothByExternalId.get(s.externalId):s.name&&(r=t.boothStore.boothByName.get(s.name.toLowerCase())),r?.rect&&o.push(r.rect)}),e.exhibitors?.forEach(s=>{let r;s.externalId?r=t.exhibitorStore.exhibitorByExternalId.get(s.externalId):s.name&&(r=t.exhibitorStore.exhibitorByName.get(s.name.toLowerCase())),r?.booths?.forEach(l=>{l.rect&&o.push(l.rect)})}),o.length===0)return;const n=m.fromMultiple(o);return{leftTop:{x:n.x1,y:n.y1},rightBottom:{x:n.x2,y:n.y2}}}fitBounds(e,i){if(b("fitBounds called with bounds=%O options=%O",e,i),!e){t.uiState.fitBounds();return}const o=D.safeParse(e);if(!o.success){a("fitBounds",o.error.message,"EFP001500");return}const n=A.safeParse(i);if(!n.success){a("fitBounds",n.error.message,"EFP001501");return}let s;if(i?.padding){const r=i.padding;s=m.fromX1y1x2y2(e.leftTop.x-r,e.leftTop.y-r,e.rightBottom.x+r,e.rightBottom.y+r)}else s=m.fromX1y1x2y2(e.leftTop.x,e.leftTop.y,e.rightBottom.x,e.rightBottom.y);t.uiState.moveToRect=s}getBoothRect(e){return typeof e!="string"&&a("getBoothRect","A booth name must be passed.","EFP000F00"),x(e)?.rect}convertToGeo(e,i){if(!v?.properties?.config){a("convertToGeo","The coordinates cannot be converted because the GPS configuration is not defined.","EFP001000");return}if(!e||!i){a("convertToGeo","Both coordinates must be passed.","EFP001001");return}return O(e,i,v.properties.config)}unstable_destroy(){let e=window.__efpElement.firstChild;Y(),window.removeEventListener("__efpStyleLoad",this.efpStyleLoadHandler),window.removeEventListener("error",N),j(),G(),_(),[...document.getElementsByTagName("script")].filter(o=>o.src.indexOf("/fp.svg")>-1||o.src.indexOf("/wf.data.js")>-1||o.src.indexOf("/data.js")>-1).forEach(o=>o.remove()),this.root.unmount(),e.remove()}search(e){return typeof e!="string"&&a("search","A search string must be passed.","EFP001100"),t.fuzzySearchEngineStore.loadEngine().then(()=>(t.searchStore.selectSearch(e),t.uiState.fuzzySearchItems.map(i=>({item:y(i.item),score:i.score}))))}getFloors(){return t.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 i=this.getFloors();if(e.name){const o=i.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=i.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,i){const o=new URLSearchParams;if(o.set(U,e),i?.length){const{boothExternalIds:n,exhibitorExternalIds:s}=E(i);n.length>0&&o.set("booths",n.join(",")),s.length>0&&o.set("exhibitors",s.join(","))}this.applyParameters(o.toString())}showPathwayOnly(e,i){this.activateFloor({name:i}),t.layerStore.showPathWay(e),t.uiState.setPathwayOnlyMode(!0);const o=t.layerStore.findLayer(e),n=t.layerStore.findLayer(i),s=o?.rect||o?.viewbox?o:n;if(s?.rect||s?.viewbox){const r=s.viewbox??s.rect;t.uiState.moveToRect=m.fromX1y1x2y2(r.x1,r.y1,r.x2,r.y2)}}hidePathways(){this.highlightBooths([]),t.layerStore.hidePathways(),t.uiState.setPathwayOnlyMode(!1)}showSearch(){t.selectSearch("")}changeLanguage(e){const i=e?.toLowerCase?.();if(!t.languageStore.languageIds.has(i)){a("changeLanguage",`Language "${e}" was not found. Available languages: ${[...t.languageStore.languageIds].join(",")}`,"EFP001300");return}const o=new URLSearchParams;o.set(X,i),this.applyParameters(o.toString())}isGpsTrackingEnabled(){return t.routeStore.gpsEnabled}setGpsTrackingEnabled(e){t.routeStore.setGpsTrackingEnabled(e)}deselectCurrentPosition(){t.routeStore.selectCurrentPosition(null,!1)}deselectRoute(){t.routeStore.selectRoute(null)}reset(){this.selectBooth(""),this.selectExhibitor(""),this.selectCategory(),this.deselectCurrentPosition(),this.deselectRoute(),this.highlightEntities([]),this.fitBounds()}}function f(u){return typeof u=="string"?x(u):t.routeStore.getNearestBooth(u)}let k=0;function a(u,e,i){const o=`Error calling "${u}" SDK method.`,n=`${e.endsWith(".")?e:e+"."} More information at`;let s="https://developer.expofp.com/guide/java-script-api-reference";if(i&&(s+=`#error-${i}`),console.error(`${o} ${n} ${s}`),t.fp.disableRuntimeAlerts)return;t.uiState.setGlobalErrorMessage({title:o,body:T(L,{children:[n," ",p("a",{href:s,target:"_blank",children:s})]})}),clearTimeout(k);const r=8e3;k=window.setTimeout(()=>{const l=async()=>{t.uiState.globalErrorMessages.length>0&&(t.uiState.popGlobalErrorMessage(),await new Promise(h=>setTimeout(h,r/2)),l())};l()},r)}
1
+ import{jsx as p,Fragment as L,jsxs as C}from"react/jsx-runtime";import{reaction as T}from"mobx";import{createRoot as R}from"react-dom/client";import{install as I}from"resize-observer";import V from"./components/Layout";import $ from"./floorplan.loader";import{applyParameters as M,destroyHistory as j,initRouting as z}from"./services/routing";import t from"./store";import{Route as S,findBooth as x,separateExternalIds as E}from"./store/RouteStore";import{destroyUiHandlers as G}from"./store/init/init-ui";import{GaEventActions as P,destroyGtag as _,sendEventToGa as w,setConsentSettings as q}from"./tools/gtag";import N from"./tools/report-error";import{resetGlobalVariables as Y}from"./tools/reset";import H from"./tools/track-event";import{fpGeo as v}from"./components/Mapbox/utils/fpGeo";import{convertLocalToGps as O,isValidPointCoords as d}from"./utils/gps";import m from"./core/Rect";import{mapEntity as y}from"./utils/mapEntity";import{LANG_KEY as X,MAX_ROUTE_WAYPOINTS as g,PATHWAY_KEY as U}from"./constants";import{getStorage as B}from"./utils/entity-storage";import{ErrorBoundary as D}from"@sentry/react";import{POISelectorsSchema as F,BoundsSchema as K,ZoomToOptionsSchema as A}from"./schemas/sdk.schemas";import W from"debug";import{buildOptimizedRoute as Q}from"./utils/buildOptimizedRoute";const b=W("efp:api");I();export default class Z extends ${root;init(){this.ignoreQuery||z(this.offHistory),H("load"),t.fp=this,q(this.allowConsent),w(P.Load,""),this.root=R(this.renderTarget),this.root.render(p(D,{children:p(V,{offHistory:this.offHistory,allowConsent:this.allowConsent})})),w(P.Rendered,""),T(()=>t.layerStore.layersLoaded,()=>{this.resolveReady(),t.initialized||this.onInit?.(this),t.initialized=!0})}selectBooth(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectBooth","Parameter must be a string or an array of strings.","EFP000000");return}const i=t.boothStore.booths.filter(o=>typeof e=="string"?o.name===e||o.externalId===e:e.includes(o.name)||e.includes(o.externalId));t.selectBooth(i)}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){t.uiState.menu=!1,t.searchStore.resetSearchBox(),t.uiState.details=null;return}const i=t.exhibitorStore.exhibitors.filter(s=>typeof e=="string"?s.name===e||s.externalId===e:e.includes(s.name)||e.includes(s.externalId));if(!i?.length)return;if(typeof e=="string"){t.selectExhibitor(i[0]),t.moveToList([i[0]]);return}const o=i.flatMap(s=>s.booths.map(r=>r.layer)),{description:n}=o.reduce((s,r)=>(s.freq[r.description]=(s.freq[r.description]||0)+1,s.freq[r.description]>s.maxCount&&(s.maxCount=s.freq[r.description],s.mostFrequent=r),s),{freq:{},mostFrequent:o[0],maxCount:0}).mostFrequent;t.layerStore.updateVisibility(n,!0),t.uiState.menu=!1,t.searchStore.resetSearchBox(),t.uiState.details=null,t.uiState.list={type:"filter",items:i,query:{key:"exhibitors",value:i.map(s=>s.externalId).join(",")}},t.moveToList()}highlightExhibitors(e){Array.isArray(e)||a("highlightExhibitors","Parameter must be an array of strings.","EFP000200"),t.boothStore.highlightedByExternalIds=[],t.exhibitorStore.highlightedByExternalIds=[...e]}highlightBooths(e){Array.isArray(e)||a("highlightBooths","Parameter must be an array of strings.","EFP000300"),t.exhibitorStore.highlightedByExternalIds=[],t.boothStore.highlightedByExternalIds=[...e]}highlightEntities(e){Array.isArray(e)||a("highlightEntities","Parameter must be an array of strings.","EFP000400");const{boothExternalIds:i,exhibitorExternalIds:o}=E(e);t.boothStore.highlightedByExternalIds=[...i],t.exhibitorStore.highlightedByExternalIds=[...o]}selectRoute(e,i){if(Array.isArray(e)){let o=[...e];const n=o.shift(),s=o.pop();if(o.length>g)throw new Error(`The maximum number of waypoints is ${g}.`);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}t.routeStore.selectRoute(new S(f(n),f(s),o.map(f)));return}e||a("selectRoute","At a minimum, the starting point must be passed.","EFP000402"),t.routeStore.selectRoute(new S(f(e),f(i)))}getOptimizedRoutes(e){if(!Array.isArray(e))return a("getOptimizedRoutes","Parameter must be an array.","EFP000500"),[];if(e.length>g)throw new Error(`The maximum number of waypoints is ${g}.`);const i=e.map(f).filter(n=>!!n);if(!i.length)throw new Error("No booths found for the provided waypoints.");const o=new Map;for(const n of i){const s=n.layer?.name??"",r=o.get(s);r?r.push(n):o.set(s,[n])}return Array.from(o.values()).map(n=>({waypoints:Q(n.map(s=>[s.name,{cx:s.rect.cx,cy:s.rect.cy}]))}))}selectCurrentPosition(e,i,o){const n=d(e.x)&&d(e.y),s=d(e.lng)&&d(e.lat);!n&&!s&&a("selectCurrentPosition","A point must be passed. Either (x,y) or (lat,lng) are required.","EFP000600"),t.routeStore.selectCurrentPosition(e,i,o),this.onCurrentPositionChanged?.(e)}setBookmarks(e){(!Array.isArray(e)||!e.length)&&a("setBookmarks","Parameter must be an array.","EFP000700"),e.forEach(i=>{const o=t.exhibitorStore.exhibitors.find(n=>n.name===i.name||n.externalId===i.externalId);o&&(o.bookmarked=i.bookmarked)})}setEntitiesBookmarks(e){if(!Array.isArray(e)||!e.length){a("setEntitiesBookmarks","Parameter must be an array.","EFP000701");return}const i=["exhibitor","event","speaker","booth"],o=e.find(r=>!r.type||!i.includes(r.type));if(o){a("setEntitiesBookmarks",`Invalid entity type: ${o.type}. Must be one of: ${i.join(", ")}.`,"EFP000702");return}const n=B("bookmarked"),s={exhibitor:{existingIds:new Set(n.exhibitors||[]),finder:r=>t.exhibitorStore.findExhibitor(r),replacer:r=>t.exhibitorStore.replaceBookmarked(r)},event:{existingIds:new Set(n.events||[]),finder:r=>t.eventStore.findByNameOrSlug(r),replacer:r=>t.eventStore.replaceBookmarked(r)},speaker:{existingIds:new Set(n.speakers||[]),finder:r=>t.speakerStore.speakers.find(l=>l.name===r||l.externalId===r||l.slug===r),replacer:r=>t.speakerStore.replaceBookmarked(r)},booth:{existingIds:new Set(n.booths||[]),finder:r=>{const l=t.boothStore.findBooth(r);return l?.exhibitors.length===0?l:void 0},replacer:r=>t.boothStore.replaceBookmarked(r)}};e.forEach(r=>{const l=s[r.type],h=r.name||r.externalId||"",c=l.finder(h);c?r.bookmarked?l.existingIds.add(c.id):l.existingIds.delete(c.id):console.warn(`Entity not found: ${r.type} with query "${h}"`)}),Object.values(s).forEach(r=>{r.replacer(Array.from(r.existingIds))})}setEntitiesVisited(e){if(!Array.isArray(e)||!e.length){a("setEntitiesVisited","Parameter must be an array.","EFP000703");return}const i=["exhibitor","event"],o=e.find(r=>!r.type||!i.includes(r.type));if(o){a("setEntitiesVisited",`Invalid entity type: ${o.type}. Must be one of: ${i.join(", ")}.`,"EFP000704");return}const n=B("visited"),s={exhibitor:{existingIds:new Set(n.exhibitors||[]),finder:r=>t.exhibitorStore.findExhibitor(r),replacer:r=>t.exhibitorStore.replaceVisited(r)},event:{existingIds:new Set(n.events||[]),finder:r=>t.eventStore.findByNameOrSlug(r),replacer:r=>t.eventStore.replaceVisited(r)}};e.forEach(r=>{const l=s[r.type],h=r.name||r.externalId||"",c=l.finder(h);c?r.visited?l.existingIds.add(c.id):l.existingIds.delete(c.id):console.warn(`Entity not found: ${r.type} with query "${h}"`)}),Object.values(s).forEach(r=>{r.replacer(Array.from(r.existingIds))})}setMarkers(e){if(!e||!Array.isArray(e.icons)||!Array.isArray(e.markers)){a("setMarkers","Invalid input.","EFP000800");return}t.routeStore.setMarkers(e)}selectMarker(e,i=!0){return typeof e!="string"&&a("selectMarker","The identifier must be passed.","EFP000900"),t.routeStore.selectMarker(e,i)}drawCircles(e){Array.isArray(e)||a("drawCircles","Invalid input.","EFP000A00"),t.uiState.debugCircles=e}checkRoutes(){t.routeStore.checkRoutes()}updateLayerVisibility(e,i){typeof e!="string"&&a("updateLayerVisibility","The layer name (string) must be passed.","EFP000B00"),i||a("updateLayerVisibility","Passing a false value to visible will have no effect.","EFP000B01"),t.layerStore.updateVisibility(e,i)}getCenterCoordinates(){return t.fp.getCenterCoordinates()}exhibitorsList(){return t.exhibitorStore.exhibitors.map(e=>y(e))}boothsList(){return t.boothStore.booths.map(e=>y(e))}categoriesList(){return t.categoryStore.categories.map(e=>y(e))}selectCategory(e){if(e==null||typeof e!="string"){t.searchStore.selectSearch();return}const i=e?.toLowerCase(),o=t.categoryStore.categories.find(({name:n,slug:s})=>n?.toLowerCase()===i||s?.toLowerCase()===i);if(!o){a("selectCategory",`Category ${e} not found.`,"EFP000C01");return}t.selectCategory(o)}applyParameters(e){typeof e!="string"&&a("applyParameters","A query string must be passed.","EFP000D00"),M(e)}getVisibility(){return t.uiState.visibility}setVisibility(e){(typeof e!="object"||!Object.keys(e).length)&&a("setVisibility","The parameter must be passed.","EFP000E00"),t.uiState.setVisibility(e)}findLocation(){t.routeStore.findLocation()}zoomIn(){t.uiState.zoomIn()}zoomOut(){t.uiState.zoomOut()}switchView(){t.mapboxStore.activateMapbox()}zoomTo(e,i){b("zoomTo called with selectors=%O options=%O",e,i);const o=F.safeParse(e);if(!o.success){a("zoomTo",o.error.message,"EFP001600");return}const n=A.safeParse(i);if(!n.success){a("zoomTo",n.error.message,"EFP001601");return}const s=this.getBounds(e);s&&this.fitBounds(s,i)}getBounds(e){b("getBounds called with selectors=%O",e);const i=F.safeParse(e);if(!i.success){a("getBounds",i.error.message,"EFP001400");return}const o=[];if(e.booths?.forEach(s=>{let r;s.externalId?r=t.boothStore.boothByExternalId.get(s.externalId):s.name&&(r=t.boothStore.boothByName.get(s.name.toLowerCase())),r?.rect&&o.push(r.rect)}),e.exhibitors?.forEach(s=>{let r;s.externalId?r=t.exhibitorStore.exhibitorByExternalId.get(s.externalId):s.name&&(r=t.exhibitorStore.exhibitorByName.get(s.name.toLowerCase())),r?.booths?.forEach(l=>{l.rect&&o.push(l.rect)})}),o.length===0)return;const n=m.fromMultiple(o);return{leftTop:{x:n.x1,y:n.y1},rightBottom:{x:n.x2,y:n.y2}}}fitBounds(e,i){if(b("fitBounds called with bounds=%O options=%O",e,i),!e){t.uiState.fitBounds();return}const o=K.safeParse(e);if(!o.success){a("fitBounds",o.error.message,"EFP001500");return}const n=A.safeParse(i);if(!n.success){a("fitBounds",n.error.message,"EFP001501");return}let s;if(i?.padding){const r=i.padding;s=m.fromX1y1x2y2(e.leftTop.x-r,e.leftTop.y-r,e.rightBottom.x+r,e.rightBottom.y+r)}else s=m.fromX1y1x2y2(e.leftTop.x,e.leftTop.y,e.rightBottom.x,e.rightBottom.y);t.uiState.moveToRect=s}getBoothRect(e){return typeof e!="string"&&a("getBoothRect","A booth name must be passed.","EFP000F00"),x(e)?.rect}convertToGeo(e,i){if(!v?.properties?.config){a("convertToGeo","The coordinates cannot be converted because the GPS configuration is not defined.","EFP001000");return}if(!e||!i){a("convertToGeo","Both coordinates must be passed.","EFP001001");return}return O(e,i,v.properties.config)}unstable_destroy(){let e=window.__efpElement.firstChild;Y(),window.removeEventListener("__efpStyleLoad",this.efpStyleLoadHandler),window.removeEventListener("error",N),j(),G(),_(),[...document.getElementsByTagName("script")].filter(o=>o.src.indexOf("/fp.svg")>-1||o.src.indexOf("/wf.data.js")>-1||o.src.indexOf("/data.js")>-1).forEach(o=>o.remove()),this.root.unmount(),e.remove()}search(e){return typeof e!="string"&&a("search","A search string must be passed.","EFP001100"),t.fuzzySearchEngineStore.loadEngine().then(()=>(t.searchStore.selectSearch(e),t.uiState.fuzzySearchItems.map(i=>({item:y(i.item),score:i.score}))))}getFloors(){return t.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 i=this.getFloors();if(e.name){const o=i.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=i.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,i){const o=new URLSearchParams;if(o.set(U,e),i?.length){const{boothExternalIds:n,exhibitorExternalIds:s}=E(i);n.length>0&&o.set("booths",n.join(",")),s.length>0&&o.set("exhibitors",s.join(","))}this.applyParameters(o.toString())}showPathwayOnly(e,i){this.activateFloor({name:i}),t.layerStore.showPathWay(e),t.uiState.setPathwayOnlyMode(!0);const o=t.layerStore.findLayer(e),n=t.layerStore.findLayer(i),s=o?.rect||o?.viewbox?o:n;if(s?.rect||s?.viewbox){const r=s.viewbox??s.rect;t.uiState.moveToRect=m.fromX1y1x2y2(r.x1,r.y1,r.x2,r.y2)}}hidePathways(){this.highlightBooths([]),t.layerStore.hidePathways(),t.uiState.setPathwayOnlyMode(!1)}showSearch(){t.selectSearch("")}changeLanguage(e){const i=e?.toLowerCase?.();if(!t.languageStore.languageIds.has(i)){a("changeLanguage",`Language "${e}" was not found. Available languages: ${[...t.languageStore.languageIds].join(",")}`,"EFP001300");return}const o=new URLSearchParams;o.set(X,i),this.applyParameters(o.toString())}isGpsTrackingEnabled(){return t.routeStore.gpsEnabled}setGpsTrackingEnabled(e){t.routeStore.setGpsTrackingEnabled(e)}deselectCurrentPosition(){t.routeStore.selectCurrentPosition(null,!1)}deselectRoute(){t.routeStore.selectRoute(null)}reset(){this.selectBooth(""),this.selectExhibitor(""),this.selectCategory(),this.deselectCurrentPosition(),this.deselectRoute(),this.highlightEntities([]),t.uiState.kioskData&&t.resetCameraFn?t.resetCameraFn?.():this.fitBounds()}}function f(u){return typeof u=="string"?x(u):t.routeStore.getNearestBooth(u)}let k=0;function a(u,e,i){const o=`Error calling "${u}" SDK method.`,n=`${e.endsWith(".")?e:e+"."} More information at`;let s="https://developer.expofp.com/guide/java-script-api-reference";if(i&&(s+=`#error-${i}`),console.error(`${o} ${n} ${s}`),t.fp.disableRuntimeAlerts)return;t.uiState.setGlobalErrorMessage({title:o,body:C(L,{children:[n," ",p("a",{href:s,target:"_blank",children:s})]})}),clearTimeout(k);const r=8e3;k=window.setTimeout(()=>{const l=async()=>{t.uiState.globalErrorMessages.length>0&&(t.uiState.popGlobalErrorMessage(),await new Promise(h=>setTimeout(h,r/2)),l())};l()},r)}
@@ -1 +1 @@
1
- import{createBrowserHistory as Z}from"history";import{autorun as _,reaction as k}from"mobx";import{handleCustomCommand as M}from"../utils/customCommands";import{BUILD_ROUTE_KEY as ee,KIOSK_ENABLE_KEY as O,MAP_SETTINGS_KEY as te,PREVIEW_MODE_QUERY as L,PREVIEW_MODE_STORAGE_KEY as A,SEPARATOR as x,PATHWAY_KEY as F,PLANNER_KEY as P,PLANNER_SOURCE_KEY as $,PLANNER_FROM_KEY as N,LANG_KEY as K,UI_SCALE_PARAM_KEY as W,UI_SCALE_RESET_PARAM_KEY as Y}from"../constants";import E from"../data";import s,{uiState as i}from"../store";import{CurrentPosition as oe,extractRoute as se,findBooth as re}from"../store/RouteStore";import{setConsentSettings as H}from"../tools/gtag";import I from"../tools/logger";import{isLocalStorageAvailable as V}from"../utils/localStorage";import{yahKey as ae}from"../utils/yah";import{areLayersEnabled as ie}from"../utils/areLayersEnabled";import ne from"../core/Rect";import{getMostFrequent as le}from"../utils/getMostFrequent";import{runInAction as R}from"mobx";import{recoverKioskFromUrlPrams as ce}from"../components/Kiosk/recoverKioskFromUrlPrams";let m=!1,v=!1,G=null,z=null,D=null,j;const h=Z(),U=window.location.pathname,S=[];export function getLocationHistory(){return S}function b(t){return U+t}function ue(t){m||h.push(b(t))}export function historyReplace(t){m||h.push(b(t))}function f(t){return t.replace(/=&/g,"&").replace(/=$/,"")}function q(){let t="";const n=i.selectedExhibitor,a=i.selectedBooth,e=i.selectedEventItem,o=i.selectedRoute,r=i.selectedSpeaker,l=i.setKioskModeEnabled;if(i.list.type==="route-planner"){const d=s.routePlannerStore;if(d.source==="bookmarks")t=`${P}&${$}=bookmarks`;else{const w=d.items.map(g=>g.entity.slug).filter(Boolean).join(x);t=`${P}=${w}`}const p=d.startPoint?.slug;p&&(t+=`&${N}=${p}`)}else if(o&&!i.isMultiPointRoute){const d=o.from?`:${o.from.slug}`:"",p=o.to?`:${o.to.slug}`:"",w=s.routeStore.onlyAccessible?":true":":false",g=o.waypoints?.map(u=>`:${u.slug}`).join("");t=`route${p}${d}${w}${g||""}`}else if(n)t=n.slug;else if(a)t=a.slug;else if(e)t=e.slug;else if(r)t=r.slug;else if(l)t="";else switch(i.list.type){case"bookmarks":t="bookmarks";break;case"visited":t="visited";break;case"category":t=i.selectedCategory.slug;break;case"search":t=i.list.text||"";break;case"language":t=i.list.type;break;case"filter":t=`${i.list.query.key}=${i.list.query.value}`;break;case"sessions":t="sessions";break;case"exhibitors":t="exhibitors";break;case"speakers":t="speakers";break;case"tours":t="tours";break;case"multi-point-tour":t=`tour=${i.list.tourId}`;break;default:throw new Error("Unkown list.type")}if(v)return;const c=t?"?"+encodeURIComponent(t):"";h.location.search!==c&&(n!==G||a!==z||e!==D?ue(c):historyReplace(c),G=n,z=a,D=e)}function Q(){const t=i.selectedExhibitor,n=i.selectedEventItem,a=i.selectedSpeaker;let e="";t?e=t.name:n?e=n.name:a?e=a.name:i.list.type==="search"&&i.list.text?e="`"+(i.list.text||"")+"`":i.list.type==="multi-point-tour"&&i.tourTitle&&(e=i.tourTitle),e.length&&(e+=" \u2013 "),e+=E.title,E.subtitle&&(e+=" \u2013 "+E.subtitle),e+=" \u2013 Expo Floor Plan by ExpoFP",document.title=e}function C(){const t=h.location.search.length>1?decodeURIComponent(h.location.search.substring(1)):"";return M(t,!1)}function y(){const t=h.location.search.length>1?decodeURIComponent(h.location.search.substring(1)):"";v=!0;const n=s.boothStore.booths.find(e=>e.slug?.toLowerCase()===t?.toLowerCase()||e.externalId?.toLowerCase()===t?.toLowerCase()||e.externalId?.toLowerCase()?.replace(/\s+/g,"")===t?.toLowerCase()),a=new URLSearchParams(decodeURIComponent(window.location.search));if(ce(a),he(a),!C())if(a.has("yah")){const e=a.get("yah");M(`${ae} ${e}`,!0)}else if(a.has(O)){const e=a.get(O);e==="1"?i.kiosk=!0:e==="0"&&(i.kiosk=!1,i.resetUIScale())}else if(t==="tours")s.selectTours();else if(t.startsWith("tour=")){const e=t.split("=")[1],o=s.toursStore.getTourById(e);o?s.toursStore.launchTour(o,o.name,o.description):(console.warn(`Route with id "${e}" not found`),s.selectTours())}else if(a.has(P)){const e=a.get($),o=a.get(N),r=o?re(o):null;if(e==="bookmarks")s.routePlannerStore.launchFromBookmarks(r??void 0);else{const l=(a.get(P)||"").split(x).filter(Boolean);s.routePlannerStore.launchFromSlugs(l,r??void 0)}}else if(t.startsWith("route")){const e=t.split(x);R(()=>{s.routeStore.onlyAccessible=e[3]==="true"});const o=se(e[2],e[1],e.slice(4));s.routeStore.selectRoute(o);const l=e.slice(4).length>0;s.uiState.setIsMultiPointRoute(l);const d=new URLSearchParams(window.location.search).get("title");d&&s.uiState.setRouteTitle(d)}else if(t==="bookmarks")s.selectBookmarks();else if(t==="visited")s.selectVisited();else if(t==="language")s.selectLanguage();else if(a.has(K)){const e=a.get(K)?.toLowerCase();s.languageStore.languageIds.has(e)&&s.languageStore.changeLanguage(e)}else if(t==="sessions")s.selectSessions();else if(t==="exhibitors")s.selectExhibitors();else if(t==="speakers")s.selectSpeakers();else if(t==="-pdf")s.uiState.printingPdf=!0;else if(t.startsWith("hide"))s.uiState.setVisibility(new URLSearchParams(t).get("hide").split(",").filter(Boolean).reduce((e,o)=>({...e,[o]:!1}),{}));else if(n)setTimeout(()=>s.selectBooth(n),250);else if(t===ee)s.uiState.startBuildRoute();else if(a.get(F)){const e=a.get(F),o=a.get("booths")?.split(",")||[],r=a.get("exhibitors")?.split(",")||[],l=a.get("tour");if(l){const u=s.toursStore.getTourById(l);u&&R(()=>{s.uiState.setTourTitle(u.name),s.uiState.setTourDescription(u.description),s.uiState.setIsMultiPointTour(!0),s.uiState.setMultiPointTourList(u.id)})}const c=s.boothStore.booths,d=s.exhibitorStore.exhibitors,p=c.filter(u=>o.includes(u.externalId)),w=d.filter(u=>r.includes(u.externalId)).flatMap(u=>u.booths),g=[...p,...w];if(ie()){const u=g.map(X=>X.layer.name),T=le(u);T&&s.fp.activateFloor({name:T})}(o.length>0||r.length>0)&&s.fp.highlightEntities([...o,...r]),s.layerStore.showPathWay(e),g.length>0&&R(()=>{s.uiState.moveToRect=ne.fromMultiple(g.map(u=>u.rect).filter(Boolean)),s.uiState.rollReset=!0})}else{const e=s.eventStore.eventItems.find(o=>o.slug?.toLowerCase()===t?.toLowerCase()||o.externalId?.toLowerCase()===t?.toLowerCase());if(e)s.selectEventItem(e,!0);else{const o=s.exhibitorStore.exhibitors.find(r=>r.slug?.toLowerCase()===t?.toLowerCase()||r.externalId?.toLowerCase()===t?.toLowerCase());if(t.startsWith("exhibitors")){const r=t.split("=")[1].split(",");setTimeout(()=>s.fp.selectExhibitor(r),250)}else if(o)setTimeout(()=>s.clickExhibitor(o),250);else if(t.includes("=")&&(t.startsWith("categories=")||t.startsWith("poiType=")))I.log("Skipping filter parameter in dispatchFromUrl:",t);else{const l=s.categoryStore.categories.find(c=>c.slug===t);if(l)s.selectCategory(l);else{const c=s.speakerStore.findBySlug(t);c?s.selectSpeaker(c,!0):t.includes("heatmap=true")||s.searchStore.selectSearch(t)}}}}v=!1,q(),Q()}function B(){const t=h.location.search;if(t.includes("heatmap")){const e=new URL(window.location.href);if(e.searchParams.get("heatmap")==="true")if(e.searchParams.get("type")==="yah"){let r=f(e.search);m=!0,historyReplace(r),s.uiState.heatmapYah=!0,s.uiState.monochrome=!0,s.uiState.hideLogoInBooth=!0,s.uiState.hideHeaderLogo=!0,s.uiState.disableBookmarked=!0}else{e.searchParams.delete("heatmap");let r=f(e.search);m=!0,historyReplace(r),s.uiState.heatmap=!0}}if(t.startsWith("?preview="))historyReplace("?");else if(t.startsWith("?b="))historyReplace("?bookmarks");else if(t.startsWith("?ba=")){const e=new URL(window.location.href),o=parseInt(e.searchParams.get("ba")),r=s.exhibitorStore.exhibitorById.get(o);historyReplace(r?"?"+r.slug:"?bookmarks")}else t.startsWith("?mapbox=false")&&(s.mapboxStore.isMapbox=!1,historyReplace("?"));if(t.includes("blue-dot")){const e=new URL(window.location.href),o=e.searchParams.get("blue-dot").split(",");if(e.searchParams.delete("blue-dot"),o.length>1){const l=s.layerStore.findLayer(o[2])?.name,c=new oe(Number(o[0])||void 0,Number(o[1])||void 0,l,void 0,Number(o[3])||void 0,Number(o[4])||void 0);s.layerStore.layersLoaded?s.routeStore.selectCurrentPosition(c,!1,1):k(()=>s.layerStore.layersLoaded,()=>{s.routeStore.selectCurrentPosition(c,!1,1)})}let r=f(e.search);historyReplace(r)}if(t.includes("copy_exh")){const e=new URL(window.location.href),o=e.searchParams.get("copy_exh");e.searchParams.delete("copy_exh"),historyReplace("?")}if(t.includes("noOverlay")){const e=new URL(window.location.href),o=e.searchParams.get("noOverlay");e.searchParams.delete("noOverlay");let r=f(e.search);o==="true"?s.uiState.hideOverlay=!0:o==="false"&&(s.uiState.hideOverlay=!1),historyReplace(r)}if(t.includes("allowConsent")){const e=new URL(window.location.href),o=e.searchParams.get("allowConsent");e.searchParams.delete("allowConsent");const r=f(e.search);o==="true"?H(!0):o==="false"&&H(!1),historyReplace(r)}if(t.includes("hideHeaderLogo")){const e=new URL(window.location.href),o=e.searchParams.get("hideHeaderLogo");e.searchParams.delete("hideHeaderLogo");const r=f(e.search);o==="true"&&(i.hideHeaderLogo=!0),historyReplace(r)}if(t.includes("hideLogoInBooth")){const e=new URL(window.location.href),o=e.searchParams.get("hideLogoInBooth");e.searchParams.delete("hideLogoInBooth");const r=f(e.search);o==="true"&&(i.hideLogoInBooth=!0),historyReplace(r)}if(t.includes("disableFeatured")){const e=new URL(window.location.href),o=e.searchParams.get("disableFeatured");e.searchParams.delete("disableFeatured");const r=f(e.search);o==="true"&&s.exhibitorStore.exhibitors.forEach(l=>l.featured=!1),historyReplace(r)}if(t.includes("disableBookmarked")){const e=new URL(window.location.href),o=e.searchParams.get("disableBookmarked");e.searchParams.delete("disableBookmarked");const r=f(e.search);o==="true"&&(i.disableBookmarked=!0),historyReplace(r)}if(t.includes("disableGps")){const e=new URL(window.location.href),o=e.searchParams.get("disableGps");e.searchParams.delete("disableGps");const r=f(e.search);o==="true"&&s.routeStore.setGpsTrackingEnabled(!1),historyReplace(r)}if(t.includes("monochrome")){const e=new URL(window.location.href),o=e.searchParams.get("monochrome");e.searchParams.delete("monochrome");const r=f(e.search);o==="true"&&(i.monochrome=!0),historyReplace(r)}if((t.startsWith("?fbclid")||t.startsWith("?_ga"))&&historyReplace("?"),t.includes(L)){const e=new URL(window.location.href),o=e.searchParams.get(L);o==="true"?V&&localStorage.setItem(A,"1"):o==="false"&&V&&localStorage.removeItem(A),e.searchParams.delete(L),historyReplace(f(e.search))}if(i.previewExhibitor&&historyReplace("?"+i.previewExhibitor.slug),h.location.search.includes("&")||h.location.search.includes("%26")){let e=h.location.search;e=e.startsWith("?")?e.slice(1):e;const o=e.includes("&")?"&":"%26",l=e.split(o).map(c=>{const d=s.exhibitorStore.exhibitors.find(p=>p.slug===c||p.externalId===c);return d?d.name:c}).join("&");historyReplace("?"+l)}const n=new URLSearchParams(window.location.search);if(n.has(Y)){s.uiState.resetUIScale();const e=new URL(window.location.href);e.searchParams.delete(Y);let o=f(e.search);m=!0,historyReplace(o),m=!1}const a=n.get(W);if(a){const e=a.replace(",","."),o=parseFloat(e);!isNaN(o)&&o>=.8&&o<=1.4?s.uiState.setUIScale(o,!0):I.warn(`Invalid ui-scale parameter: ${a}. Must be a number between 0.8 and 1.4.`);const r=new URL(window.location.href);r.searchParams.delete(W);let l=f(r.search);m=!0,historyReplace(l),m=!1}}export function initRouting(t=!1){m=t,!m&&b(h.location.search)===U&&S.push(b(h.location.search)),j=h.listen((n,a)=>{m||(S.push(b(n.search)),I.log("history",a,n),a==="POP"&&y())}),B(),C(),k(()=>s.layerStore.layersLoaded,()=>{s.urlFilterManager&&!s.urlFilterManager.isInitialized&&s.urlFilterManager.initialize(),y(),_(Q),_(q)})}export function applyParameters(t=""){historyReplace("?"+decodeURIComponent(t.toString())),s.layerStore.layersLoaded?(B(),y()):(C(),k(()=>s.layerStore.layersLoaded,()=>{B(),y()}))}export function destroyHistory(){j()}export function goBack(){if(console.log("goBack"),S.length>1){S.pop();const n=S[S.length-1].replace(U,"");return m=!0,h.replace(n),m=!1,y(),!0}else return h.go(-1),!1}function he(t){try{let n={};const a=i.defaultMapSettings;if(new Set(t.keys()).size)n=J(Object.fromEntries(t.entries()),a);else{const e=sessionStorage.getItem(te);e&&(n=J(JSON.parse(e),a))}if(i.setMapSettings(n),n.z){const e=s.layerStore.layers.find(o=>o.name===n.z);e&&s.layerStore.updateVisibility(e,!0)}}catch(n){console.error("Failed to process or save map settings.",n)}}function J(t,n){const a={};for(const e in t){if(!Object.prototype.hasOwnProperty.call(n,e)||!Object.prototype.hasOwnProperty.call(t,e))continue;const o=t[e];typeof n[e]=="number"&&typeof o=="string"?a[e]=parseFloat(o):a[e]=o}return a}
1
+ import{createBrowserHistory as te}from"history";import{autorun as O,reaction as k}from"mobx";import{handleCustomCommand as A}from"../utils/customCommands";import{BUILD_ROUTE_KEY as oe,KIOSK_ENABLE_KEY as F,MAP_SETTINGS_KEY as se,PREVIEW_MODE_QUERY as E,PREVIEW_MODE_STORAGE_KEY as $,SEPARATOR as I,PATHWAY_KEY as N,PLANNER_KEY as P,PLANNER_SOURCE_KEY as W,PLANNER_FROM_KEY as K,LANG_KEY as Y,UI_SCALE_PARAM_KEY as V,UI_SCALE_RESET_PARAM_KEY as H,VIEWER_MODE_QUERY as R,VIEWER_MODE_STORAGE_KEY as G}from"../constants";import x from"../data";import s,{uiState as i}from"../store";import{CurrentPosition as re,extractRoute as ae,findBooth as ie}from"../store/RouteStore";import{setConsentSettings as D}from"../tools/gtag";import v from"../tools/logger";import{isLocalStorageAvailable as L}from"../utils/localStorage";import{yahKey as ne}from"../utils/yah";import{areLayersEnabled as le}from"../utils/areLayersEnabled";import ce from"../core/Rect";import{getMostFrequent as ue}from"../utils/getMostFrequent";import{runInAction as U}from"mobx";import{recoverKioskFromUrlPrams as he}from"../components/Kiosk/recoverKioskFromUrlPrams";let m=!1,C=!1,z=null,j=null,q=null,Q;const h=te(),B=window.location.pathname,S=[];export function getLocationHistory(){return S}function b(t){return B+t}function fe(t){m||h.push(b(t))}export function historyReplace(t){m||h.push(b(t))}function f(t){return t.replace(/=&/g,"&").replace(/=$/,"")}function J(){let t="";const n=i.selectedExhibitor,a=i.selectedBooth,e=i.selectedEventItem,o=i.selectedRoute,r=i.selectedSpeaker,l=i.setKioskModeEnabled;if(i.list.type==="route-planner"&&!n&&!a&&!e){const d=s.routePlannerStore;if(d.source==="bookmarks")t=`${P}&${W}=bookmarks`;else{const w=d.items.map(g=>g.entity.slug).filter(Boolean).join(I);t=`${P}=${w}`}const p=d.startPoint?.slug;p&&(t+=`&${K}=${p}`)}else if(o&&!i.isMultiPointRoute){const d=o.from?`:${o.from.slug}`:"",p=o.to?`:${o.to.slug}`:"",w=s.routeStore.onlyAccessible?":true":":false",g=o.waypoints?.map(u=>`:${u.slug}`).join("");t=`route${p}${d}${w}${g||""}`}else if(n)t=n.slug;else if(a)t=a.slug;else if(e)t=e.slug;else if(r)t=r.slug;else if(l)t="";else switch(i.list.type){case"bookmarks":t="bookmarks";break;case"visited":t="visited";break;case"category":t=i.selectedCategory.slug;break;case"search":t=i.list.text||"";break;case"language":t=i.list.type;break;case"filter":t=`${i.list.query.key}=${i.list.query.value}`;break;case"sessions":t="sessions";break;case"exhibitors":t="exhibitors";break;case"speakers":t="speakers";break;case"tours":t="tours";break;case"multi-point-tour":t=`tour=${i.list.tourId}`;break;default:throw new Error("Unkown list.type")}if(C)return;const c=t?"?"+encodeURIComponent(t):"";h.location.search!==c&&(n!==z||a!==j||e!==q?fe(c):historyReplace(c),z=n,j=a,q=e)}function X(){const t=i.selectedExhibitor,n=i.selectedEventItem,a=i.selectedSpeaker;let e="";t?e=t.name:n?e=n.name:a?e=a.name:i.list.type==="search"&&i.list.text?e="`"+(i.list.text||"")+"`":i.list.type==="multi-point-tour"&&i.tourTitle&&(e=i.tourTitle),e.length&&(e+=" \u2013 "),e+=x.title,x.subtitle&&(e+=" \u2013 "+x.subtitle),e+=" \u2013 Expo Floor Plan by ExpoFP",document.title=e}function _(){const t=h.location.search.length>1?decodeURIComponent(h.location.search.substring(1)):"";return A(t,!1)}function y(){const t=h.location.search.length>1?decodeURIComponent(h.location.search.substring(1)):"";C=!0;const n=s.boothStore.booths.find(e=>e.slug?.toLowerCase()===t?.toLowerCase()||e.externalId?.toLowerCase()===t?.toLowerCase()||e.externalId?.toLowerCase()?.replace(/\s+/g,"")===t?.toLowerCase()),a=new URLSearchParams(decodeURIComponent(window.location.search));if(he(a),de(a),!_())if(a.has("yah")){const e=a.get("yah");A(`${ne} ${e}`,!0)}else if(a.has(F)){const e=a.get(F);e==="1"?i.kiosk=!0:e==="0"&&(i.kiosk=!1,i.resetUIScale())}else if(t==="tours")s.selectTours();else if(t.startsWith("tour=")){const e=t.split("=")[1],o=s.toursStore.getTourById(e);o?s.toursStore.launchTour(o,o.name,o.description):(console.warn(`Route with id "${e}" not found`),s.selectTours())}else if(a.has(P)){const e=a.get(W),o=a.get(K),r=o?ie(o):null;if(e==="bookmarks")s.routePlannerStore.launchFromBookmarks(r??void 0);else{const l=(a.get(P)||"").split(I).filter(Boolean);s.routePlannerStore.launchFromSlugs(l,r??void 0)}}else if(t.startsWith("route")){const e=t.split(I);U(()=>{s.routeStore.onlyAccessible=e[3]==="true"});const o=ae(e[2],e[1],e.slice(4));s.routeStore.selectRoute(o);const l=e.slice(4).length>0;s.uiState.setIsMultiPointRoute(l);const d=new URLSearchParams(window.location.search).get("title");d&&s.uiState.setRouteTitle(d)}else if(t==="bookmarks")s.selectBookmarks();else if(t==="visited")s.selectVisited();else if(t==="language")s.selectLanguage();else if(a.has(Y)){const e=a.get(Y)?.toLowerCase();s.languageStore.languageIds.has(e)&&s.languageStore.changeLanguage(e)}else if(t==="sessions")s.selectSessions();else if(t==="exhibitors")s.selectExhibitors();else if(t==="speakers")s.selectSpeakers();else if(t==="-pdf")s.uiState.printingPdf=!0;else if(t.startsWith("hide"))s.uiState.setVisibility(new URLSearchParams(t).get("hide").split(",").filter(Boolean).reduce((e,o)=>({...e,[o]:!1}),{}));else if(n)setTimeout(()=>s.selectBooth(n),250);else if(t===oe)s.uiState.startBuildRoute();else if(a.get(N)){const e=a.get(N),o=a.get("booths")?.split(",")||[],r=a.get("exhibitors")?.split(",")||[],l=a.get("tour");if(l){const u=s.toursStore.getTourById(l);u&&U(()=>{s.uiState.setTourTitle(u.name),s.uiState.setTourDescription(u.description),s.uiState.setIsMultiPointTour(!0),s.uiState.setMultiPointTourList(u.id)})}const c=s.boothStore.booths,d=s.exhibitorStore.exhibitors,p=c.filter(u=>o.includes(u.externalId)),w=d.filter(u=>r.includes(u.externalId)).flatMap(u=>u.booths),g=[...p,...w];if(le()){const u=g.map(ee=>ee.layer.name),M=ue(u);M&&s.fp.activateFloor({name:M})}(o.length>0||r.length>0)&&s.fp.highlightEntities([...o,...r]),s.layerStore.showPathWay(e),g.length>0&&U(()=>{s.uiState.moveToRect=ce.fromMultiple(g.map(u=>u.rect).filter(Boolean)),s.uiState.rollReset=!0})}else{const e=s.eventStore.eventItems.find(o=>o.slug?.toLowerCase()===t?.toLowerCase()||o.externalId?.toLowerCase()===t?.toLowerCase());if(e)s.selectEventItem(e,!0);else{const o=s.exhibitorStore.exhibitors.find(r=>r.slug?.toLowerCase()===t?.toLowerCase()||r.externalId?.toLowerCase()===t?.toLowerCase());if(t.startsWith("exhibitors")){const r=t.split("=")[1].split(",");setTimeout(()=>s.fp.selectExhibitor(r),250)}else if(o)setTimeout(()=>s.clickExhibitor(o),250);else if(t.includes("=")&&(t.startsWith("categories=")||t.startsWith("poiType=")))v.log("Skipping filter parameter in dispatchFromUrl:",t);else{const l=s.categoryStore.categories.find(c=>c.slug===t);if(l)s.selectCategory(l);else{const c=s.speakerStore.findBySlug(t);c?s.selectSpeaker(c,!0):t.includes("heatmap=true")||s.searchStore.selectSearch(t)}}}}C=!1,J(),X()}function T(){const t=h.location.search;if(t.includes("heatmap")){const e=new URL(window.location.href);if(e.searchParams.get("heatmap")==="true")if(e.searchParams.get("type")==="yah"){let r=f(e.search);m=!0,historyReplace(r),s.uiState.heatmapYah=!0,s.uiState.monochrome=!0,s.uiState.hideLogoInBooth=!0,s.uiState.hideHeaderLogo=!0,s.uiState.disableBookmarked=!0}else{e.searchParams.delete("heatmap");let r=f(e.search);m=!0,historyReplace(r),s.uiState.heatmap=!0}}if(t.startsWith("?preview="))historyReplace("?");else if(t.startsWith("?b="))historyReplace("?bookmarks");else if(t.startsWith("?ba=")){const e=new URL(window.location.href),o=parseInt(e.searchParams.get("ba")),r=s.exhibitorStore.exhibitorById.get(o);historyReplace(r?"?"+r.slug:"?bookmarks")}else t.startsWith("?mapbox=false")&&(s.mapboxStore.isMapbox=!1,historyReplace("?"));if(t.includes("blue-dot")){const e=new URL(window.location.href),o=e.searchParams.get("blue-dot").split(",");if(e.searchParams.delete("blue-dot"),o.length>1){const l=s.layerStore.findLayer(o[2])?.name,c=new re(Number(o[0])||void 0,Number(o[1])||void 0,l,void 0,Number(o[3])||void 0,Number(o[4])||void 0);s.layerStore.layersLoaded?s.routeStore.selectCurrentPosition(c,!1,1):k(()=>s.layerStore.layersLoaded,()=>{s.routeStore.selectCurrentPosition(c,!1,1)})}let r=f(e.search);historyReplace(r)}if(t.includes("copy_exh")){const e=new URL(window.location.href),o=e.searchParams.get("copy_exh");e.searchParams.delete("copy_exh"),historyReplace("?")}if(t.includes("noOverlay")){const e=new URL(window.location.href),o=e.searchParams.get("noOverlay");e.searchParams.delete("noOverlay");let r=f(e.search);o==="true"?s.uiState.hideOverlay=!0:o==="false"&&(s.uiState.hideOverlay=!1),historyReplace(r)}if(t.includes("allowConsent")){const e=new URL(window.location.href),o=e.searchParams.get("allowConsent");e.searchParams.delete("allowConsent");const r=f(e.search);o==="true"?D(!0):o==="false"&&D(!1),historyReplace(r)}if(t.includes("hideHeaderLogo")){const e=new URL(window.location.href),o=e.searchParams.get("hideHeaderLogo");e.searchParams.delete("hideHeaderLogo");const r=f(e.search);o==="true"&&(i.hideHeaderLogo=!0),historyReplace(r)}if(t.includes("hideLogoInBooth")){const e=new URL(window.location.href),o=e.searchParams.get("hideLogoInBooth");e.searchParams.delete("hideLogoInBooth");const r=f(e.search);o==="true"&&(i.hideLogoInBooth=!0),historyReplace(r)}if(t.includes("disableFeatured")){const e=new URL(window.location.href),o=e.searchParams.get("disableFeatured");e.searchParams.delete("disableFeatured");const r=f(e.search);o==="true"&&s.exhibitorStore.exhibitors.forEach(l=>l.featured=!1),historyReplace(r)}if(t.includes("disableBookmarked")){const e=new URL(window.location.href),o=e.searchParams.get("disableBookmarked");e.searchParams.delete("disableBookmarked");const r=f(e.search);o==="true"&&(i.disableBookmarked=!0),historyReplace(r)}if(t.includes("disableGps")){const e=new URL(window.location.href),o=e.searchParams.get("disableGps");e.searchParams.delete("disableGps");const r=f(e.search);o==="true"&&s.routeStore.setGpsTrackingEnabled(!1),historyReplace(r)}if(t.includes("monochrome")){const e=new URL(window.location.href),o=e.searchParams.get("monochrome");e.searchParams.delete("monochrome");const r=f(e.search);o==="true"&&(i.monochrome=!0),historyReplace(r)}if((t.startsWith("?fbclid")||t.startsWith("?_ga"))&&historyReplace("?"),t.includes(R)){const e=new URL(window.location.href),o=e.searchParams.get(R);o==="1"||o==="true"?L&&localStorage.setItem(G,"1"):(o==="0"||o==="false")&&L&&localStorage.removeItem(G),e.searchParams.delete(R),historyReplace(f(e.search))}if(t.includes(E)){const e=new URL(window.location.href),o=e.searchParams.get(E);o==="true"?L&&localStorage.setItem($,"1"):o==="false"&&L&&localStorage.removeItem($),e.searchParams.delete(E),historyReplace(f(e.search))}if(i.previewExhibitor&&historyReplace("?"+i.previewExhibitor.slug),h.location.search.includes("&")||h.location.search.includes("%26")){let e=h.location.search;e=e.startsWith("?")?e.slice(1):e;const o=e.includes("&")?"&":"%26",l=e.split(o).map(c=>{const d=s.exhibitorStore.exhibitors.find(p=>p.slug===c||p.externalId===c);return d?d.name:c}).join("&");historyReplace("?"+l)}const n=new URLSearchParams(window.location.search);if(n.has(H)){s.uiState.resetUIScale();const e=new URL(window.location.href);e.searchParams.delete(H);let o=f(e.search);m=!0,historyReplace(o),m=!1}const a=n.get(V);if(a){const e=a.replace(",","."),o=parseFloat(e);!isNaN(o)&&o>=.8&&o<=1.4?s.uiState.setUIScale(o,!0):v.warn(`Invalid ui-scale parameter: ${a}. Must be a number between 0.8 and 1.4.`);const r=new URL(window.location.href);r.searchParams.delete(V);let l=f(r.search);m=!0,historyReplace(l),m=!1}}export function initRouting(t=!1){m=t,!m&&b(h.location.search)===B&&S.push(b(h.location.search)),Q=h.listen((n,a)=>{m||(S.push(b(n.search)),v.log("history",a,n),a==="POP"&&y())}),T(),_(),k(()=>s.layerStore.layersLoaded,()=>{s.urlFilterManager&&!s.urlFilterManager.isInitialized&&s.urlFilterManager.initialize(),y(),O(X),O(J),i.viewerMode&&(i.menu=!0)})}export function applyParameters(t=""){historyReplace("?"+decodeURIComponent(t.toString())),s.layerStore.layersLoaded?(T(),y()):(_(),k(()=>s.layerStore.layersLoaded,()=>{T(),y()}))}export function destroyHistory(){Q()}export function goBack(){if(console.log("goBack"),S.length>1){S.pop();const n=S[S.length-1].replace(B,"");return m=!0,h.replace(n),m=!1,y(),!0}else return h.go(-1),!1}function de(t){try{let n={};const a=i.defaultMapSettings;if(new Set(t.keys()).size)n=Z(Object.fromEntries(t.entries()),a);else{const e=sessionStorage.getItem(se);e&&(n=Z(JSON.parse(e),a))}if(i.setMapSettings(n),n.z){const e=s.layerStore.layers.find(o=>o.name===n.z);e&&s.layerStore.updateVisibility(e,!0)}}catch(n){console.error("Failed to process or save map settings.",n)}}function Z(t,n){const a={};for(const e in t){if(!Object.prototype.hasOwnProperty.call(n,e)||!Object.prototype.hasOwnProperty.call(t,e))continue;const o=t[e];typeof n[e]=="number"&&typeof o=="string"?a[e]=parseFloat(o):a[e]=o}return a}
@@ -26,6 +26,7 @@ export declare class Layer {
26
26
  mode: LayerMode;
27
27
  children: LayerDef[];
28
28
  pathway?: boolean;
29
+ floorIndex?: number;
29
30
  loaded: boolean;
30
31
  visible: boolean;
31
32
  get shortName(): string;
@@ -1 +1 @@
1
- import{__esDecorate as l,__runInitializers as o}from"tslib";import{action as w,computed as v,observable as u,runInAction as C}from"mobx";import n from".";import I from"../components/Map/drawing/config/config-load-layer";import W from"../core/Rect";import{shortenName as j}from"../utils/shortenName";import{areLayersEnabled as D}from"../utils/areLayersEnabled";export var LayersMode;(function(i){i[i.Default=0]="Default",i[i.Separated=1]="Separated",i[i.Radio=2]="Radio",i[i.CheckBox=3]="CheckBox"})(LayersMode||(LayersMode={}));export var LayerMode;(function(i){i[i.Unset=0]="Unset",i[i.AlwaysVisible=1]="AlwaysVisible",i[i.AlwaysHidden=2]="AlwaysHidden",i[i.TurnedOn=3]="TurnedOn",i[i.TurnedOff=4]="TurnedOff"})(LayerMode||(LayerMode={}));let O=(()=>{let i,h=[],y=[],m,p=[],_=[];return class{static{const c=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;i=[u],m=[u],l(null,null,i,{kind:"field",name:"loaded",static:!1,private:!1,access:{has:s=>"loaded"in s,get:s=>s.loaded,set:(s,f)=>{s.loaded=f}},metadata:c},h,y),l(null,null,m,{kind:"field",name:"visible",static:!1,private:!1,access:{has:s=>"visible"in s,get:s=>s.visible,set:(s,f)=>{s.visible=f}},metadata:c},p,_),c&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:c})}basePriority;name;description;frozen;rect=null;viewbox=null;configured;childLayers=[];rootParent=null;mode;children=[];pathway;loaded=o(this,h,void 0);visible=(o(this,y),o(this,p,void 0));get shortName(){return j(this.description)}constructor(){o(this,_)}}})();export{O as Layer};let N=(()=>{let i=[],h,y=[],m=[],p,_=[],b=[],c,s=[],f=[],L,S=[],P=[],k,x,A,R,T,V,z,E;return class{static{const t=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;h=[u],p=[u],c=[u],L=[u],k=[v({keepAlive:!0})],x=[v({keepAlive:!0})],A=[v({keepAlive:!0})],R=[v],T=[v],V=[w],z=[w],E=[w],l(this,null,k,{kind:"getter",name:"visible",static:!1,private:!1,access:{has:e=>"visible"in e,get:e=>e.visible},metadata:t},null,i),l(this,null,x,{kind:"getter",name:"loaded",static:!1,private:!1,access:{has:e=>"loaded"in e,get:e=>e.loaded},metadata:t},null,i),l(this,null,A,{kind:"getter",name:"rectangle",static:!1,private:!1,access:{has:e=>"rectangle"in e,get:e=>e.rectangle},metadata:t},null,i),l(this,null,R,{kind:"getter",name:"pathwayLayers",static:!1,private:!1,access:{has:e=>"pathwayLayers"in e,get:e=>e.pathwayLayers},metadata:t},null,i),l(this,null,T,{kind:"getter",name:"floors",static:!1,private:!1,access:{has:e=>"floors"in e,get:e=>e.floors},metadata:t},null,i),l(this,null,V,{kind:"method",name:"updateVisibility",static:!1,private:!1,access:{has:e=>"updateVisibility"in e,get:e=>e.updateVisibility},metadata:t},null,i),l(this,null,z,{kind:"method",name:"showPathWay",static:!1,private:!1,access:{has:e=>"showPathWay"in e,get:e=>e.showPathWay},metadata:t},null,i),l(this,null,E,{kind:"method",name:"hidePathways",static:!1,private:!1,access:{has:e=>"hidePathways"in e,get:e=>e.hidePathways},metadata:t},null,i),l(null,null,h,{kind:"field",name:"layers",static:!1,private:!1,access:{has:e=>"layers"in e,get:e=>e.layers,set:(e,a)=>{e.layers=a}},metadata:t},y,m),l(null,null,p,{kind:"field",name:"defaultLayer",static:!1,private:!1,access:{has:e=>"defaultLayer"in e,get:e=>e.defaultLayer,set:(e,a)=>{e.defaultLayer=a}},metadata:t},_,b),l(null,null,c,{kind:"field",name:"mode",static:!1,private:!1,access:{has:e=>"mode"in e,get:e=>e.mode,set:(e,a)=>{e.mode=a}},metadata:t},s,f),l(null,null,L,{kind:"field",name:"layersLoaded",static:!1,private:!1,access:{has:e=>"layersLoaded"in e,get:e=>e.layersLoaded,set:(e,a)=>{e.layersLoaded=a}},metadata:t},S,P),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}layers=(o(this,i),o(this,y,[]));defaultLayer=(o(this,m),o(this,_,void 0));mode=(o(this,b),o(this,s,void 0));layersLoaded=(o(this,f),o(this,S,!1));updateVisibilityTimeout=(o(this,P),0);get visible(){return this.layers.filter(t=>t.frozen||t.visible)}get loaded(){return this.layers.filter(t=>t.loaded)}get rectangle(){var t=this.visible.filter(e=>!e.frozen).map(e=>e.viewbox??e.rect);return this.mode!==LayersMode.Radio||!t.length?null:W.fromMultiple(t)||null}get pathwayLayers(){return this.layers.filter(t=>t.pathway)}get floors(){if(!D())return[];const t=new Set(this.layers.filter(a=>a&&!a.frozen&&!a.rootParent&&!a.pathway).concat(n.routeStore.layers.filter(a=>a&&a.mode!==LayerMode.AlwaysHidden&&a.mode!==LayerMode.AlwaysVisible))),e=Array.from(t).reverse();return e.map((a,r)=>{const d=n.routeStore.layers.length>0&&n.routeStore.layers.indexOf(a)===-1,g=n.toursStore.tourLayers.length>0&&n.toursStore.tourLayers.indexOf(a)===-1;return{layer:a,name:a.name,shortName:a.shortName,description:a.description,active:a.visible,disabled:!!(d||g),index:e.length-r-1}})}updateVisibility(t,e){if(this.mode===LayersMode.Radio&&!e)return;const a=t instanceof O?t:this.findLayer(t);if(!a||a.visible===e){a&&n.routeStore.currentRouteLayer!==a&&(n.routeStore.currentRouteLayer=a);return}I(a,n.rendererService).then(()=>{this.mode===LayersMode.Radio&&this.layers.filter(r=>!r.pathway).forEach(r=>{r.name!==a.name&&!r.frozen&&r.visible&&(r.visible=!1,r.childLayers.forEach(d=>{d.visible=!1}))}),a&&(a.visible=e,a.childLayers.forEach(r=>{r.visible=e}),e&&(n.routeStore.currentRouteLayer=a),typeof n.fp.onFloorActivated=="function"&&(clearTimeout(this.updateVisibilityTimeout),this.updateVisibilityTimeout=setTimeout(()=>{const r=n.fp.getFloors();n.fp.onFloorActivated(r.find(d=>d.name===a.name))})))})}findLayer(t){if(t==null)return null;const e=this.layers.filter(r=>!r.rootParent);if(typeof t=="number"&&(a=e.filter(r=>!r.frozen)[t],a))return a;t=t.toString().toLowerCase();var a=e.find(r=>{const d=(r.name.match(/(-?[0-9]+)/)||"")[0];return t===r?.name.toLowerCase()||t===r?.description.toLowerCase()||t===r?.shortName.toLowerCase()||t===d});return!a&&!/\D/.test(t)&&(a=e.filter(r=>!r.frozen)[parseInt(t)]),a}getPathwayList(){return this.layers.filter(t=>t.pathway)}async showPathWay(t){try{const e=this.findLayer(t);if(!e)throw new Error(`There is no pathway with this name. ${t}`);await I(e,n.rendererService);const a=this.getPathwayList();C(()=>{a.forEach(r=>{const d=r.name===t;r.visible=d,r.childLayers.forEach(g=>{g.visible=d})})})}catch(e){console.error("showPathWay",e)}}hidePathways(){this.getPathwayList().forEach(e=>{e.visible=!1,e.childLayers.forEach(a=>{a.visible=!1})})}}})();export default N;
1
+ import{__esDecorate as l,__runInitializers as o}from"tslib";import{action as w,computed as v,observable as u,runInAction as C}from"mobx";import n from".";import E from"../components/Map/drawing/config/config-load-layer";import W from"../core/Rect";import{shortenName as j}from"../utils/shortenName";import{areLayersEnabled as D}from"../utils/areLayersEnabled";export var LayersMode;(function(i){i[i.Default=0]="Default",i[i.Separated=1]="Separated",i[i.Radio=2]="Radio",i[i.CheckBox=3]="CheckBox"})(LayersMode||(LayersMode={}));export var LayerMode;(function(i){i[i.Unset=0]="Unset",i[i.AlwaysVisible=1]="AlwaysVisible",i[i.AlwaysHidden=2]="AlwaysHidden",i[i.TurnedOn=3]="TurnedOn",i[i.TurnedOff=4]="TurnedOff"})(LayerMode||(LayerMode={}));let O=(()=>{let i,h=[],y=[],m,p=[],_=[];return class{static{const c=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;i=[u],m=[u],l(null,null,i,{kind:"field",name:"loaded",static:!1,private:!1,access:{has:s=>"loaded"in s,get:s=>s.loaded,set:(s,f)=>{s.loaded=f}},metadata:c},h,y),l(null,null,m,{kind:"field",name:"visible",static:!1,private:!1,access:{has:s=>"visible"in s,get:s=>s.visible,set:(s,f)=>{s.visible=f}},metadata:c},p,_),c&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:c})}basePriority;name;description;frozen;rect=null;viewbox=null;configured;childLayers=[];rootParent=null;mode;children=[];pathway;floorIndex;loaded=o(this,h,void 0);visible=(o(this,y),o(this,p,void 0));get shortName(){return j(this.description)}constructor(){o(this,_)}}})();export{O as Layer};let N=(()=>{let i=[],h,y=[],m=[],p,_=[],b=[],c,s=[],f=[],L,S=[],x=[],P,k,A,I,R,T,V,z;return class{static{const t=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;h=[u],p=[u],c=[u],L=[u],P=[v({keepAlive:!0})],k=[v({keepAlive:!0})],A=[v({keepAlive:!0})],I=[v],R=[v],T=[w],V=[w],z=[w],l(this,null,P,{kind:"getter",name:"visible",static:!1,private:!1,access:{has:e=>"visible"in e,get:e=>e.visible},metadata:t},null,i),l(this,null,k,{kind:"getter",name:"loaded",static:!1,private:!1,access:{has:e=>"loaded"in e,get:e=>e.loaded},metadata:t},null,i),l(this,null,A,{kind:"getter",name:"rectangle",static:!1,private:!1,access:{has:e=>"rectangle"in e,get:e=>e.rectangle},metadata:t},null,i),l(this,null,I,{kind:"getter",name:"pathwayLayers",static:!1,private:!1,access:{has:e=>"pathwayLayers"in e,get:e=>e.pathwayLayers},metadata:t},null,i),l(this,null,R,{kind:"getter",name:"floors",static:!1,private:!1,access:{has:e=>"floors"in e,get:e=>e.floors},metadata:t},null,i),l(this,null,T,{kind:"method",name:"updateVisibility",static:!1,private:!1,access:{has:e=>"updateVisibility"in e,get:e=>e.updateVisibility},metadata:t},null,i),l(this,null,V,{kind:"method",name:"showPathWay",static:!1,private:!1,access:{has:e=>"showPathWay"in e,get:e=>e.showPathWay},metadata:t},null,i),l(this,null,z,{kind:"method",name:"hidePathways",static:!1,private:!1,access:{has:e=>"hidePathways"in e,get:e=>e.hidePathways},metadata:t},null,i),l(null,null,h,{kind:"field",name:"layers",static:!1,private:!1,access:{has:e=>"layers"in e,get:e=>e.layers,set:(e,a)=>{e.layers=a}},metadata:t},y,m),l(null,null,p,{kind:"field",name:"defaultLayer",static:!1,private:!1,access:{has:e=>"defaultLayer"in e,get:e=>e.defaultLayer,set:(e,a)=>{e.defaultLayer=a}},metadata:t},_,b),l(null,null,c,{kind:"field",name:"mode",static:!1,private:!1,access:{has:e=>"mode"in e,get:e=>e.mode,set:(e,a)=>{e.mode=a}},metadata:t},s,f),l(null,null,L,{kind:"field",name:"layersLoaded",static:!1,private:!1,access:{has:e=>"layersLoaded"in e,get:e=>e.layersLoaded,set:(e,a)=>{e.layersLoaded=a}},metadata:t},S,x),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}layers=(o(this,i),o(this,y,[]));defaultLayer=(o(this,m),o(this,_,void 0));mode=(o(this,b),o(this,s,void 0));layersLoaded=(o(this,f),o(this,S,!1));updateVisibilityTimeout=(o(this,x),0);get visible(){return this.layers.filter(t=>t.frozen||t.visible)}get loaded(){return this.layers.filter(t=>t.loaded)}get rectangle(){var t=this.visible.filter(e=>!e.frozen).map(e=>e.viewbox??e.rect);return this.mode!==LayersMode.Radio||!t.length?null:W.fromMultiple(t)||null}get pathwayLayers(){return this.layers.filter(t=>t.pathway)}get floors(){if(!D())return[];const t=new Set(this.layers.filter(a=>a&&!a.frozen&&!a.rootParent&&!a.pathway).concat(n.routeStore.layers.filter(a=>a&&a.mode!==LayerMode.AlwaysHidden&&a.mode!==LayerMode.AlwaysVisible))),e=Array.from(t).reverse();return e.map((a,r)=>{const d=n.routeStore.layers.length>0&&n.routeStore.layers.indexOf(a)===-1,g=n.toursStore.tourLayers.length>0&&n.toursStore.tourLayers.indexOf(a)===-1;return{layer:a,name:a.name,shortName:a.shortName,description:a.description,active:a.visible,disabled:!!(d||g),index:a.floorIndex??e.length-r-1}})}updateVisibility(t,e){if(this.mode===LayersMode.Radio&&!e)return;const a=t instanceof O?t:this.findLayer(t);if(!a||a.visible===e){a&&n.routeStore.currentRouteLayer!==a&&(n.routeStore.currentRouteLayer=a);return}E(a,n.rendererService).then(()=>{this.mode===LayersMode.Radio&&this.layers.filter(r=>!r.pathway).forEach(r=>{r.name!==a.name&&!r.frozen&&r.visible&&(r.visible=!1,r.childLayers.forEach(d=>{d.visible=!1}))}),a&&(a.visible=e,a.childLayers.forEach(r=>{r.visible=e}),e&&(n.routeStore.currentRouteLayer=a),typeof n.fp.onFloorActivated=="function"&&(clearTimeout(this.updateVisibilityTimeout),this.updateVisibilityTimeout=setTimeout(()=>{const r=n.fp.getFloors();n.fp.onFloorActivated(r.find(d=>d.name===a.name))})))})}findLayer(t){if(t==null)return null;const e=this.layers.filter(r=>!r.rootParent);if(typeof t=="number"&&(a=e.filter(r=>!r.frozen)[t],a))return a;t=t.toString().toLowerCase();var a=e.find(r=>{const d=(r.name.match(/(-?[0-9]+)/)||"")[0];return t===r?.name.toLowerCase()||t===r?.description.toLowerCase()||t===r?.shortName.toLowerCase()||t===d});return!a&&!/\D/.test(t)&&(a=e.filter(r=>!r.frozen)[parseInt(t)]),a}getPathwayList(){return this.layers.filter(t=>t.pathway)}async showPathWay(t){try{const e=this.findLayer(t);if(!e)throw new Error(`There is no pathway with this name. ${t}`);await E(e,n.rendererService);const a=this.getPathwayList();C(()=>{a.forEach(r=>{const d=r.name===t;r.visible=d,r.childLayers.forEach(g=>{g.visible=d})})})}catch(e){console.error("showPathWay",e)}}hidePathways(){this.getPathwayList().forEach(e=>{e.visible=!1,e.childLayers.forEach(a=>{a.visible=!1})})}}})();export default N;
@@ -13,6 +13,7 @@ export default class RoutePlannerStore {
13
13
  items: PlannerItem[];
14
14
  startPoint: Booth | null;
15
15
  source: PlannerSource | null;
16
+ excludedVisitedCount: number;
16
17
  constructor(rootStore: RootStore);
17
18
  get resolvedBooths(): Booth[];
18
19
  get stopsCount(): number;
@@ -26,7 +27,22 @@ export default class RoutePlannerStore {
26
27
  stops: string;
27
28
  from: string | undefined;
28
29
  distance: string | undefined;
30
+ travelTime: string | undefined;
29
31
  };
32
+ get routeFloors(): {
33
+ id: number;
34
+ name: string;
35
+ description?: string;
36
+ basePriority?: number;
37
+ }[];
38
+ get currentRouteFloor(): {
39
+ id: number;
40
+ name: string;
41
+ } | undefined;
42
+ setRouteFloor(floor: {
43
+ id: number;
44
+ name: string;
45
+ }): void;
30
46
  launch(items: PlannerItem[], source?: PlannerSource, initialStartPoint?: Booth | null): void;
31
47
  launchFromBookmarks(initialStartPoint?: Booth | null): void;
32
48
  launchFromSlugs(slugs: string[], initialStartPoint?: Booth | null): void;
@@ -1 +1 @@
1
- import{__esDecorate as r,__runInitializers as c}from"tslib";import{action as h,computed as m,observable as p}from"mobx";import{findBooth as $,Route as G}from"./RouteStore";import{t as b}from"../utils/i18n";let H=(()=>{let n=[],S,g=[],_=[],P,v=[],k=[],y,B=[],I=[],R,x,w,O,F,z,C,E,A,N,L,M,T,j;return class{static{const e=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;S=[p],P=[p],y=[p],R=[m],x=[m],w=[m],O=[m],F=[m],z=[m],C=[h],E=[h],A=[h],N=[h],L=[h],M=[h],T=[h],j=[h],r(this,null,R,{kind:"getter",name:"resolvedBooths",static:!1,private:!1,access:{has:t=>"resolvedBooths"in t,get:t=>t.resolvedBooths},metadata:e},null,n),r(this,null,x,{kind:"getter",name:"stopsCount",static:!1,private:!1,access:{has:t=>"stopsCount"in t,get:t=>t.stopsCount},metadata:e},null,n),r(this,null,w,{kind:"getter",name:"startPointBoothOptions",static:!1,private:!1,access:{has:t=>"startPointBoothOptions"in t,get:t=>t.startPointBoothOptions},metadata:e},null,n),r(this,null,O,{kind:"getter",name:"startPointAutocompleteOptions",static:!1,private:!1,access:{has:t=>"startPointAutocompleteOptions"in t,get:t=>t.startPointAutocompleteOptions},metadata:e},null,n),r(this,null,F,{kind:"getter",name:"title",static:!1,private:!1,access:{has:t=>"title"in t,get:t=>t.title},metadata:e},null,n),r(this,null,z,{kind:"getter",name:"subtitleParts",static:!1,private:!1,access:{has:t=>"subtitleParts"in t,get:t=>t.subtitleParts},metadata:e},null,n),r(this,null,C,{kind:"method",name:"launch",static:!1,private:!1,access:{has:t=>"launch"in t,get:t=>t.launch},metadata:e},null,n),r(this,null,E,{kind:"method",name:"launchFromBookmarks",static:!1,private:!1,access:{has:t=>"launchFromBookmarks"in t,get:t=>t.launchFromBookmarks},metadata:e},null,n),r(this,null,A,{kind:"method",name:"launchFromSlugs",static:!1,private:!1,access:{has:t=>"launchFromSlugs"in t,get:t=>t.launchFromSlugs},metadata:e},null,n),r(this,null,N,{kind:"method",name:"buildRoute",static:!1,private:!1,access:{has:t=>"buildRoute"in t,get:t=>t.buildRoute},metadata:e},null,n),r(this,null,L,{kind:"method",name:"setStartPoint",static:!1,private:!1,access:{has:t=>"setStartPoint"in t,get:t=>t.setStartPoint},metadata:e},null,n),r(this,null,M,{kind:"method",name:"removeItem",static:!1,private:!1,access:{has:t=>"removeItem"in t,get:t=>t.removeItem},metadata:e},null,n),r(this,null,T,{kind:"method",name:"reorderItems",static:!1,private:!1,access:{has:t=>"reorderItems"in t,get:t=>t.reorderItems},metadata:e},null,n),r(this,null,j,{kind:"method",name:"close",static:!1,private:!1,access:{has:t=>"close"in t,get:t=>t.close},metadata:e},null,n),r(null,null,S,{kind:"field",name:"items",static:!1,private:!1,access:{has:t=>"items"in t,get:t=>t.items,set:(t,s)=>{t.items=s}},metadata:e},g,_),r(null,null,P,{kind:"field",name:"startPoint",static:!1,private:!1,access:{has:t=>"startPoint"in t,get:t=>t.startPoint,set:(t,s)=>{t.startPoint=s}},metadata:e},v,k),r(null,null,y,{kind:"field",name:"source",static:!1,private:!1,access:{has:t=>"source"in t,get:t=>t.source,set:(t,s)=>{t.source=s}},metadata:e},B,I),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}rootStore=c(this,n);items=c(this,g,[]);startPoint=(c(this,_),c(this,v,null));source=(c(this,k),c(this,B,null));constructor(e){c(this,I),this.rootStore=e}get resolvedBooths(){const e=new Map;return this.startPoint&&e.set(this.startPoint.id,this.startPoint),this.items.forEach(t=>{t.booth&&e.set(t.booth.id,t.booth)}),Array.from(e.values())}get stopsCount(){return this.items.length}get startPointBoothOptions(){const e=this.rootStore.boothStore.booths,t=this.rootStore.routeStore.defaultFrom;return t?[...e,t]:e}get startPointAutocompleteOptions(){const{exhibitorStore:e}=this.rootStore,t=this.startPointBoothOptions,s=[],i=new Set;return e.exhibitors.forEach(o=>{o.booths.forEach(l=>{i.add(l.id),s.push({value:l.id.toString(),label:`${o.name} - ${l.name}`})})}),t.filter(o=>!i.has(o.id)).forEach(o=>{s.push({value:o.id.toString(),label:o.name})}),s.sort((o,l)=>o.label.localeCompare(l.label,void 0,{sensitivity:"base"}))}get title(){return this.source==="bookmarks"?b("Bookmarks route"):""}get subtitleParts(){const{routeInfo:e}=this.rootStore.routeStore;return{stops:b("{{count}} stops",{count:this.stopsCount}),from:this.startPoint?b("From {{name}}",{name:this.startPoint.name}):void 0,distance:e?e.distance:void 0}}launch(e,t="custom",s){this.items=e.filter(a=>a.type==="exhibitor"?!a.entity.visited:!0),this.source=t,this.startPoint=s!==void 0?s:this.detectStartPoint();const{uiState:i}=this.rootStore;i.list={type:"route-planner",source:t},i.details=null,i.menu=!1,this.buildRoute()}launchFromBookmarks(e){const{exhibitorStore:t,eventStore:s,boothStore:i}=this.rootStore,a=[];t.bookmarked.forEach(o=>{a.push({type:"exhibitor",entity:o,booth:o.booths[0]||null})}),i.booths.filter(o=>o.exhibitors.length===0&&o.bookmarkedDirectly).forEach(o=>{a.push({type:"booth",entity:o,booth:o})}),this.launch(a,"bookmarks",e)}launchFromSlugs(e,t){const s=this.resolveSlugs(e);this.launch(s,"custom",t)}resolveSlugs(e){const{exhibitorStore:t,eventStore:s,boothStore:i}=this.rootStore;return e.filter(Boolean).map(a=>{const o=a.toLowerCase(),l=t.exhibitors.find(f=>f.slug?.toLowerCase()===o||f.externalId?.toLowerCase()===o);if(l)return{type:"exhibitor",entity:l,booth:l.booths[0]||null};const d=$(a);return d?{type:"booth",entity:d,booth:d}:null}).filter(a=>a!==null)}buildRoute(){const e=[];if(this.startPoint&&this.startPoint.name&&e.push(this.startPoint.name),this.items.forEach(u=>{u.booth&&u.booth.name&&e.push(u.booth.name)}),e.length<2){this.rootStore.routeStore.updateRoute([]);return}let t;try{const u=this.rootStore.fp?.getOptimizedRoutes?.(e);t=Array.isArray(u)?u.flatMap(D=>D?.waypoints??[]):[]}catch{t=[]}const s=new Set(e),i=new Set(t),a=e.length>0&&[...s].every(u=>i.has(u));(!t.length||!a)&&(t=e.slice()),this.reorderItemsByNames(t);const o=this.resolvedBooths;if(o.length<2){this.rootStore.routeStore.updateRoute([]);return}const l=o[0],d=o[o.length-1],f=o.slice(1,-1),q=new G(l,d,f);this.rootStore.routeStore.selectRoute(q,!1),this.rootStore.uiState.setIsMultiPointRoute(f.length>0)}reorderItemsByNames(e){const t=this.startPoint?this.startPoint.name:null,s=new Map;this.items.forEach(a=>{const o=a.booth?a.booth.name:null;o&&(s.has(o)||s.set(o,[]),s.get(o).push(a))});const i=[];e.forEach(a=>{if(a!==t){const o=s.get(a);o&&o.length>0&&i.push(...o.splice(0))}}),this.items=i}detectStartPoint(){const{boothStore:e,poiTypeStore:t}=this.rootStore,s=["entrance","entrances"],i=t.poiTypes.find(a=>s.includes(a.name.toLowerCase()));return i&&e.booths.find(a=>a.poiTypeId===i.id)||null}setStartPoint(e){this.startPoint=e,this.buildRoute()}removeItem(e){this.items.splice(e,1),this.buildRoute()}reorderItems(e,t){const[s]=this.items.splice(e,1);this.items.splice(t,0,s),this.buildRoute()}close(){this.items=[],this.startPoint=null,this.source=null,this.rootStore.uiState.details=null,this.rootStore.uiState.list={type:"search",text:"",focused:!1},this.rootStore.routeStore.selectRoute(null,!1)}}})();export default H;
1
+ import{__esDecorate as r,__runInitializers as u}from"tslib";import{action as c,computed as d,observable as g}from"mobx";import{findBooth as Q,Route as U}from"./RouteStore";import{t as p}from"../utils/i18n";let W=(()=>{let n=[],_,S=[],b=[],P,v=[],y=[],k,R=[],x=[],F,B=[],I=[],C,w,O,z,V,E,L,A,N,M,T,j,q,D,$,G,H;return class{static{const e=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;_=[g],P=[g],k=[g],F=[g],C=[d],w=[d],O=[d],z=[d],V=[d],E=[d],L=[d],A=[d],N=[c],M=[c],T=[c],j=[c],q=[c],D=[c],$=[c],G=[c],H=[c],r(this,null,C,{kind:"getter",name:"resolvedBooths",static:!1,private:!1,access:{has:t=>"resolvedBooths"in t,get:t=>t.resolvedBooths},metadata:e},null,n),r(this,null,w,{kind:"getter",name:"stopsCount",static:!1,private:!1,access:{has:t=>"stopsCount"in t,get:t=>t.stopsCount},metadata:e},null,n),r(this,null,O,{kind:"getter",name:"startPointBoothOptions",static:!1,private:!1,access:{has:t=>"startPointBoothOptions"in t,get:t=>t.startPointBoothOptions},metadata:e},null,n),r(this,null,z,{kind:"getter",name:"startPointAutocompleteOptions",static:!1,private:!1,access:{has:t=>"startPointAutocompleteOptions"in t,get:t=>t.startPointAutocompleteOptions},metadata:e},null,n),r(this,null,V,{kind:"getter",name:"title",static:!1,private:!1,access:{has:t=>"title"in t,get:t=>t.title},metadata:e},null,n),r(this,null,E,{kind:"getter",name:"subtitleParts",static:!1,private:!1,access:{has:t=>"subtitleParts"in t,get:t=>t.subtitleParts},metadata:e},null,n),r(this,null,L,{kind:"getter",name:"routeFloors",static:!1,private:!1,access:{has:t=>"routeFloors"in t,get:t=>t.routeFloors},metadata:e},null,n),r(this,null,A,{kind:"getter",name:"currentRouteFloor",static:!1,private:!1,access:{has:t=>"currentRouteFloor"in t,get:t=>t.currentRouteFloor},metadata:e},null,n),r(this,null,N,{kind:"method",name:"setRouteFloor",static:!1,private:!1,access:{has:t=>"setRouteFloor"in t,get:t=>t.setRouteFloor},metadata:e},null,n),r(this,null,M,{kind:"method",name:"launch",static:!1,private:!1,access:{has:t=>"launch"in t,get:t=>t.launch},metadata:e},null,n),r(this,null,T,{kind:"method",name:"launchFromBookmarks",static:!1,private:!1,access:{has:t=>"launchFromBookmarks"in t,get:t=>t.launchFromBookmarks},metadata:e},null,n),r(this,null,j,{kind:"method",name:"launchFromSlugs",static:!1,private:!1,access:{has:t=>"launchFromSlugs"in t,get:t=>t.launchFromSlugs},metadata:e},null,n),r(this,null,q,{kind:"method",name:"buildRoute",static:!1,private:!1,access:{has:t=>"buildRoute"in t,get:t=>t.buildRoute},metadata:e},null,n),r(this,null,D,{kind:"method",name:"setStartPoint",static:!1,private:!1,access:{has:t=>"setStartPoint"in t,get:t=>t.setStartPoint},metadata:e},null,n),r(this,null,$,{kind:"method",name:"removeItem",static:!1,private:!1,access:{has:t=>"removeItem"in t,get:t=>t.removeItem},metadata:e},null,n),r(this,null,G,{kind:"method",name:"reorderItems",static:!1,private:!1,access:{has:t=>"reorderItems"in t,get:t=>t.reorderItems},metadata:e},null,n),r(this,null,H,{kind:"method",name:"close",static:!1,private:!1,access:{has:t=>"close"in t,get:t=>t.close},metadata:e},null,n),r(null,null,_,{kind:"field",name:"items",static:!1,private:!1,access:{has:t=>"items"in t,get:t=>t.items,set:(t,o)=>{t.items=o}},metadata:e},S,b),r(null,null,P,{kind:"field",name:"startPoint",static:!1,private:!1,access:{has:t=>"startPoint"in t,get:t=>t.startPoint,set:(t,o)=>{t.startPoint=o}},metadata:e},v,y),r(null,null,k,{kind:"field",name:"source",static:!1,private:!1,access:{has:t=>"source"in t,get:t=>t.source,set:(t,o)=>{t.source=o}},metadata:e},R,x),r(null,null,F,{kind:"field",name:"excludedVisitedCount",static:!1,private:!1,access:{has:t=>"excludedVisitedCount"in t,get:t=>t.excludedVisitedCount,set:(t,o)=>{t.excludedVisitedCount=o}},metadata:e},B,I),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}rootStore=u(this,n);items=u(this,S,[]);startPoint=(u(this,b),u(this,v,null));source=(u(this,y),u(this,R,null));excludedVisitedCount=(u(this,x),u(this,B,0));constructor(e){u(this,I),this.rootStore=e}get resolvedBooths(){const e=new Map;return this.startPoint&&e.set(this.startPoint.id,this.startPoint),this.items.forEach(t=>{t.booth&&e.set(t.booth.id,t.booth)}),Array.from(e.values())}get stopsCount(){return this.items.length}get startPointBoothOptions(){const e=this.rootStore.boothStore.booths,t=this.rootStore.routeStore.defaultFrom;return t?[...e,t]:e}get startPointAutocompleteOptions(){const{exhibitorStore:e}=this.rootStore,t=this.startPointBoothOptions,o=[],a=new Set;return e.exhibitors.forEach(s=>{s.booths.forEach(l=>{a.add(l.id),o.push({value:l.id.toString(),label:`${s.name} - ${l.name}`})})}),t.filter(s=>!a.has(s.id)).forEach(s=>{o.push({value:s.id.toString(),label:s.name})}),o.sort((s,l)=>s.label.localeCompare(l.label,void 0,{sensitivity:"base"}))}get title(){return this.source==="bookmarks"?p("Bookmarks route"):""}get subtitleParts(){const{routeInfo:e}=this.rootStore.routeStore;let t;if(e?.time){const o=e.time;t=o<60?p("< 1 min"):p("~ {{n}} min",{n:Math.round(o/60)})}return{stops:p("{{count}} stops",{count:this.stopsCount}),from:this.startPoint?p("From {{name}}",{name:this.startPoint.name}):void 0,distance:e?e.distance:void 0,travelTime:t}}get routeFloors(){return this.rootStore.routeStore.pathLayers.map(e=>({id:e.id,name:e.layer?.shortName,description:e.layer?.description,basePriority:e.layer?.basePriority??0}))}get currentRouteFloor(){const e=this.routeFloors,t=this.rootStore.routeStore.currentRouteLayer;if(!e.length)return;if(!t)return e[0]?{id:e[0].id,name:e[0].name}:void 0;const o=e.find(a=>a.description?.toLowerCase()===t.description?.toLowerCase());return o?{id:o.id,name:o.name}:{id:e[0].id,name:e[0].name}}setRouteFloor(e){const t=this.rootStore.routeStore.pathLayers.find(o=>o.id===e.id);t?.layer&&this.rootStore.layerStore.updateVisibility(t.layer,!0)}launch(e,t="custom",o){this.excludedVisitedCount=e.filter(i=>i.type==="exhibitor"&&i.entity.visited).length,this.items=e.filter(i=>i.type==="exhibitor"?!i.entity.visited:!0),this.source=t,this.startPoint=o!==void 0?o:this.detectStartPoint();const{uiState:a}=this.rootStore;a.list={type:"route-planner",source:t},a.details=null,a.menu=!1,this.buildRoute()}launchFromBookmarks(e){const{exhibitorStore:t,eventStore:o,boothStore:a}=this.rootStore,i=[];t.bookmarked.forEach(s=>{i.push({type:"exhibitor",entity:s,booth:s.booths[0]||null})}),a.booths.filter(s=>s.exhibitors.length===0&&s.bookmarkedDirectly).forEach(s=>{i.push({type:"booth",entity:s,booth:s})}),this.launch(i,"bookmarks",e)}launchFromSlugs(e,t){const o=this.resolveSlugs(e);this.launch(o,"custom",t)}resolveSlugs(e){const{exhibitorStore:t,eventStore:o,boothStore:a}=this.rootStore;return e.filter(Boolean).map(i=>{const s=i.toLowerCase(),l=t.exhibitors.find(f=>f.slug?.toLowerCase()===s||f.externalId?.toLowerCase()===s);if(l)return{type:"exhibitor",entity:l,booth:l.booths[0]||null};const m=Q(i);return m?{type:"booth",entity:m,booth:m}:null}).filter(i=>i!==null)}buildRoute(){const e=[];if(this.startPoint&&this.startPoint.name&&e.push(this.startPoint.name),this.items.forEach(h=>{h.booth&&h.booth.name&&e.push(h.booth.name)}),e.length<2){this.rootStore.routeStore.updateRoute([]);return}let t;try{const h=this.rootStore.fp?.getOptimizedRoutes?.(e);t=Array.isArray(h)?h.flatMap(K=>K?.waypoints??[]):[]}catch{t=[]}const o=new Set(e),a=new Set(t),i=e.length>0&&[...o].every(h=>a.has(h));(!t.length||!i)&&(t=e.slice()),this.reorderItemsByNames(t);const s=this.resolvedBooths;if(s.length<2){this.rootStore.routeStore.updateRoute([]);return}const l=s[0],m=s[s.length-1],f=s.slice(1,-1),J=new U(l,m,f);this.rootStore.routeStore.selectRoute(J,!1),this.rootStore.uiState.setIsMultiPointRoute(f.length>0)}reorderItemsByNames(e){const t=this.startPoint?this.startPoint.name:null,o=new Map;this.items.forEach(i=>{const s=i.booth?i.booth.name:null;s&&(o.has(s)||o.set(s,[]),o.get(s).push(i))});const a=[];e.forEach(i=>{if(i!==t){const s=o.get(i);s&&s.length>0&&a.push(...s.splice(0))}}),this.items=a}detectStartPoint(){const{boothStore:e,poiTypeStore:t}=this.rootStore,o=["entrance","entrances"],a=t.poiTypes.find(i=>o.includes(i.name.toLowerCase()));return a&&e.booths.find(i=>i.poiTypeId===a.id)||null}setStartPoint(e){this.startPoint=e,this.buildRoute()}removeItem(e){this.items.splice(e,1),this.buildRoute()}reorderItems(e,t){const[o]=this.items.splice(e,1);this.items.splice(t,0,o),this.buildRoute()}close(){this.items=[],this.startPoint=null,this.source=null,this.excludedVisitedCount=0,this.rootStore.uiState.details=null,this.rootStore.uiState.list={type:"search",text:"",focused:!1},this.rootStore.routeStore.selectRoute(null,!1)}}})();export default W;
@@ -192,6 +192,7 @@ export default class UIState {
192
192
  zoomOut(): void;
193
193
  fitBounds(): void;
194
194
  get previewMode(): boolean;
195
+ get viewerMode(): boolean;
195
196
  get selectedEventItem(): EventItem | null;
196
197
  /**
197
198
  * @warning If the property is of a numeric type, set the default value to be numeric, otherwise they will be cast incorrectly.