@minmaps-dev/mm-web-sdk 1.0.0-rc.22 → 1.0.0-rc.24

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.
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("maplibre-gl"),t=require("pmtiles");function o(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(o){if("default"!==o){var i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:function(){return e[o]}})}}),t.default=e,Object.freeze(t)}var i=o(require("@turf/turf"));let n=!1;function r(o,i){const r="string"==typeof o?document.getElementById(o):o;if(!r)throw new Error("Map container not found");return function(){if(n)return;const o=new t.Protocol;e.addProtocol("pmtiles",o.tile),n=!0}(),new e.Map({container:r,style:i,center:[0,0],zoom:16,pitch:45,bearing:0,minPitch:30,maxPitch:55})}const s={ensureGeoJson(e,t){e.getSource(t)||e.addSource(t,{type:"geojson",data:{type:"FeatureCollection",features:[]}})},setData(e,t,o){const i=e.getSource(t);i?.setData?.(o)}},a="indoor-data",l="poi-data",c="unit-walls",d="route-data",u="poi-highlight-data",p="map-labels-data",f=["boundary-fill","boundary-outline","units-fill","units-wall-extrusion","units-wall-custom-extrusion","corridors-fill","corridors-outline","building-extrusion"],h=()=>{};function g(e){const t=Boolean(e?.enabled),o=function(e){const t=String(e||"").trim();return t?`[${t}]`:""}(e?.prefix||"MinuteMapsSDK");return t?{debug:(...e)=>console.debug(o,...e),log:(...e)=>console.log(o,...e),warn:(...e)=>console.warn(o,...e),error:(...e)=>console.error(o,...e)}:{debug:h,log:h,warn:h,error:h}}g({enabled:!0,prefix:"MinuteMapsSDK"});const y={applyFloor(e,t,o=1){y.updateWalls(e,t,o),y.updateIndoor(e,t,o)},updateIndoor(e,t,o=1){const n=function(e,t){if(!e)return{type:"FeatureCollection",features:[]};if(!Number.isFinite(t)||t<=0)return e;const o=(e.features||[]).map(e=>{const o=e?.properties?.featureType;if(!o||!m.has(o))return e;const n=e?.geometry?.type;if("Polygon"!==n&&"MultiPolygon"!==n)return e;try{const o=i.buffer(e,-t,{units:"feet"});return o?.geometry?{...e,geometry:o.geometry}:e}catch{return e}});return{...e,features:o}}(t.geojson,o);s.setData(e,a,n);try{const e=t?.geojson?.features||[],o={};for(const t of e){const e=t?.properties?.featureType,i=null==e?"(missing)":String(e);o[i]=(o[i]||0)+1}Object.entries(o).sort((e,t)=>t[1]-e[1]).slice(0,15)}catch{}},updateWalls(e,t,o=1){const n=function(e,t=1){const o=Math.max(Number(t)||1,.5)/2,n=e=>{try{return i.cleanCoords(e)}catch{return e}},r=e=>{const t=e?.geometry?.type;if("Polygon"!==t&&"MultiPolygon"!==t)return null;try{const t=n(e),r=i.buffer(t,-o,{units:"feet"});if(!r?.geometry)return null;const s=i.area(t),a=i.area(r);if(!Number.isFinite(s)||s<=0)return null;if(a>=s)return null;const l=i.difference(i.featureCollection([t,r]));return l?.geometry?l:null}catch{return null}},s=e=>{if(0===e.length)return null;if(1===e.length)return e[0];try{return i.union(i.featureCollection(e))}catch{return null}},a=[];let l=null;for(const t of e.features||[]){const e=t?.properties?.featureType,o=t?.geometry?.type;if("Polygon"===o||"MultiPolygon"===o)if("Boundary"!==e||l){if("Units"===e){const e=r(t);e&&a.push(e)}}else l=r(t)}const c=s(a);let d=c;if(c?.geometry&&l?.geometry)try{const e=i.difference(i.featureCollection([c,l]));e?.geometry&&(d=e)}catch{}const u=[];l?.geometry&&u.push({type:"Feature",geometry:l.geometry,properties:{featureType:"UnitWalls",wallKind:"perimeter"}});d?.geometry&&u.push({type:"Feature",geometry:d.geometry,properties:{featureType:"UnitWalls",wallKind:"interior"}});return{type:"FeatureCollection",features:u}}(t.geojson,o);s.setData(e,c,n)},boundsFromGeoJson(e){try{const[t,o,n,r]=i.bbox(e),s=Math.min(t,n),a=Math.max(t,n),l=Math.min(o,r);return[[s,l],[a,Math.max(o,r)]]}catch{return null}},selectDefaultFloor:e=>Array.isArray(e)&&0!==e.length&&(e.find(e=>e.isDefault)||e[0])||null,selectInitialFloor(e,t){if(!Array.isArray(e)||0===e.length)return null;if(null!=t){const o=e.find(e=>e.id===t);if(o)return o}return y.selectDefaultFloor(e)},async activateFloor(e,t,o){if(!e)throw new Error("activateFloor requires an initialized map");if(t?.geojson&&y.applyFloor(e,t,o.wallFeet),await o.updatePOIs(t),!t?.geojson)return void(e.getZoom()<o.minIndoorZoom&&e.setZoom(o.minIndoorZoom));const i=y.boundsFromGeoJson(t.geojson);if(!i)return;const n=!o.didFit;let r=n;if(!r){const[[t,o],[n,s]]=i,a=e.getBounds();r=a.getWest()>n||a.getEast()<t||a.getSouth()>s||a.getNorth()<o}r?(e.fitBounds(i,{padding:o.boundsPadding,animate:!n,duration:700,bearing:e.getBearing(),pitch:e.getPitch()}),e.once("moveend",()=>{e.getZoom()<o.minIndoorZoom&&e.setZoom(o.minIndoorZoom)}),o.setDidFit(!0),o.log?.("camera :: fitToFloor",{floorId:t.id,animated:!n})):(e.getZoom()<o.minIndoorZoom&&e.setZoom(o.minIndoorZoom),o.log?.("camera :: fit skipped (floor overlaps viewport)",{floorId:t.id}))}},m=new Set(["Restrooms","Back-of-house","Obstacles","Escalators","Stairs","Elevators"]);class w{floors=[];currentFloor=null;didFit=!1;getMap;getConfig;updatePoiSource;logFn;constructor(e){this.getMap=e.getMap,this.getConfig=e.getConfig,this.updatePoiSource=e.updatePoiSource,this.logFn=e.log}log(...e){this.logFn&&this.logFn(...e)}setFloors(e){this.floors=e}getFloors(){return[...this.floors]}getCurrentFloor(){return this.currentFloor}setDidFit(e){this.didFit=e}getDefaultFloor(){return y.selectDefaultFloor(this.floors)}getInitialFloor(){const e=this.getConfig();return y.selectInitialFloor(this.floors,e.options?.initialFloor)}async setCurrentFloor(e){const t=this.getMap();if(!t)throw new Error("Map is not initialized");this.currentFloor=e,this.log("floor :: setCurrentFloor",{id:e.id,name:e.name,geojsonFeatures:e.geojson?.features?.length??0});const o=this.getConfig(),i=o.options?.wallThickness??1,n=o.options?.boundsPadding??50,r=o.options?.minIndoorZoom??16.5;await y.activateFloor(t,e,{wallFeet:i,updatePOIs:e=>this.updatePoiSource(e),didFit:this.didFit,setDidFit:e=>{this.didFit=e},boundsPadding:n,minIndoorZoom:r,log:(e,t)=>this.log(e,t)})}}const b=g({enabled:!0,prefix:"MinuteMapsSDK"}),I=new Map,F={async getSpriteKeys(e){const t=function(e){if(!e)return;if("string"==typeof e)return e;if(Array.isArray(e)){const t=e[0];if(t&&"string"==typeof t.url)return t.url}if("object"==typeof e&&null!==e){const t=e?.url;if("string"==typeof t)return t}return}(e?.getStyle?.()?.sprite);if(!t||"function"!=typeof fetch)return new Set;const o=t.endsWith(".json")?t:`${t}.json`;if(I.has(o))return I.get(o);try{const e=await fetch(o);if(!e.ok)throw new Error(`Failed to load sprite JSON (${e.status})`);const t=await e.json(),i=new Set(Object.keys(t||{}));return I.set(o,i),i}catch(e){b.warn("sprite fetch failed",o,e);const t=new Set;return I.set(o,t),t}}};const v=g({enabled:!0,prefix:"MinuteMapsSDK amenityIcons"});async function x(e,t,o){const i=await fetch(e,{mode:"cors"});if(!i.ok)throw new Error(`HTTP ${i.status}`);const n=await i.text();let r=n;try{const e=(new DOMParser).parseFromString(n,"image/svg+xml"),i=e.documentElement;!(e.getElementsByTagName("parsererror").length>0)&&i&&"svg"===i.nodeName.toLowerCase()&&(i.hasAttribute("width")||i.setAttribute("width",String(t)),i.hasAttribute("height")||i.setAttribute("height",String(t)),o&&function(e,t){const o=[e,...Array.from(e.querySelectorAll("*"))];for(const e of o){const o=e.getAttribute("fill");"none"===o||"transparent"===o||(o||/^(path|circle|rect|polygon|polyline|ellipse|g|use|symbol)$/i.test(e.tagName))&&e.setAttribute("fill",t);const i=e.getAttribute("stroke");i&&"none"!==i&&"transparent"!==i&&e.setAttribute("stroke",t);const n=e.getAttribute("style");n&&e.setAttribute("style",n.replace(/fill:\s*(?!none|transparent)[^;]+;?/gi,`fill: ${t};`).replace(/stroke:\s*(?!none|transparent)[^;]+;?/gi,`stroke: ${t};`))}}(i,o),r=(new XMLSerializer).serializeToString(i))}catch{}const s=new Blob([r],{type:"image/svg+xml"}),a=URL.createObjectURL(s);return new Promise((e,t)=>{const o=new Image;o.onload=()=>{URL.revokeObjectURL(a),e(o)},o.onerror=e=>{URL.revokeObjectURL(a),t(e)},o.src=a})}const A={async register(e,t,o={}){if(!Array.isArray(t)||0===t.length)return;const i=o.size??64;await Promise.all(t.map(async t=>{const n=function(e,t){const o=e?.uris;if(!Array.isArray(o)||0===o.length)return null;const i=e=>"image/svg+xml"===e?.mimeType||"svg-icon"===e?.resourceType,n=e=>{if(!Array.isArray(e)||0===e.length)return null;if(t){const o=e.find(e=>e?.locale===t);if(o?.uriPath)return o.uriPath}return e.find(e=>e?.uriPath)?.uriPath??null};for(const e of o){if(!i(e))continue;const t=n(e.locales);if(t)return t}for(const e of o){const t=n(e?.locales);if(t)return t}return null}(t,o.preferredLocale);if(!n)return;const r=`amenity-${t.id}`;if(e.hasImage(r))t.iconId=r;else try{const s=await x(n,i,o.recolorToColor);e.hasImage(r)||e.addImage(r,s),t.iconId=r}catch(e){v.warn("icon load failed",{amenityId:t.id,url:n,error:e?.message??String(e)})}}))}},M="units-outline-2d",k=["units-wall-extrusion","units-wall-custom-extrusion"];class S{getMap;is3dEnabled=!0;isUnits2dEnabled=!1;isFlatMode=!1;cachedExtrusionIds=null;extrusionOriginalVisibility=null;unitsExtrusionOriginalVisibility=null;unitsOutlineOriginalVisibility=null;constructor(e){this.getMap=e}onStyleData(){if(this.map){if(this.cachedExtrusionIds=null,!this.is3dEnabled){const e=this.listExtrusionLayerIds();this.setLayersVisibility(e,"none")}this.isUnits2dEnabled&&this.applyUnits2dVisibility(!0)}}set3dEnabled(e){const t=this.map;if(!t)return;const o=this.listExtrusionLayerIds();if(this.cachedExtrusionIds=o,!this.extrusionOriginalVisibility){const e={};o.forEach(o=>{try{const i=t.getLayoutProperty(o,"visibility")||"visible";e[o]=i}catch{e[o]="visible"}}),this.extrusionOriginalVisibility=e}if(e){const e=this.extrusionOriginalVisibility||{};o.forEach(o=>{const i=e[o]??"visible";try{t.getLayer(o)&&t.setLayoutProperty(o,"visibility",i)}catch{}})}else this.setLayersVisibility(o,"none");this.is3dEnabled=e,t.triggerRepaint()}toggle3d(){this.set3dEnabled(!this.is3dEnabled)}getIs3dEnabled(){return this.is3dEnabled}setUnits2dEnabled(e){const t=this.map;t&&(this.applyUnits2dVisibility(e),this.isUnits2dEnabled=e,t.triggerRepaint())}toggleUnits2d(){this.setUnits2dEnabled(!this.isUnits2dEnabled)}getIsUnits2dEnabled(){return this.isUnits2dEnabled}setFlatMode(e){this.map&&(e?(this.set3dEnabled(!1),this.setUnits2dEnabled(!0)):(this.setUnits2dEnabled(!1),this.set3dEnabled(!0)),this.isFlatMode=e)}toggleFlatMode(){this.setFlatMode(!this.isFlatMode)}getIsFlatMode(){return this.isFlatMode}applyUnits2dVisibility(e){const t=this.map;if(t){if(!this.unitsExtrusionOriginalVisibility){const e={};k.forEach(o=>{try{const i=t.getLayoutProperty(o,"visibility")||"visible";e[o]=i}catch{e[o]="visible"}}),this.unitsExtrusionOriginalVisibility=e}if(null==this.unitsOutlineOriginalVisibility)try{const e=t.getLayoutProperty(M,"visibility");this.unitsOutlineOriginalVisibility=e??"none"}catch{this.unitsOutlineOriginalVisibility="none"}if(t.getLayer(M)){const o=e?"visible":this.unitsOutlineOriginalVisibility??"none";try{t.setLayoutProperty(M,"visibility",o)}catch{}}if(e)k.forEach(e=>{if(t.getLayer(e))try{t.setLayoutProperty(e,"visibility","none")}catch{}});else{const e=this.unitsExtrusionOriginalVisibility||{};k.forEach(o=>{const i=e[o]??"visible";if(t.getLayer(o))try{t.setLayoutProperty(o,"visibility",i)}catch{}})}}}listExtrusionLayerIds(){const e=this.map;if(!e)return[];try{const t=e.getStyle(),o=t?.layers||[],i=o.filter(e=>"fill-extrusion"===e?.type).map(e=>e.id),n=Array.isArray(f)?f:[],r=[];return n.forEach(e=>{const t=o.find(t=>t.id===e);t&&"fill-extrusion"===t.type&&r.push(e)}),[...new Set([...i,...r])]}catch{return this.cachedExtrusionIds||[]}}setLayersVisibility(e,t){const o=this.map;o&&e.forEach(e=>{try{o.getLayer(e)&&o.setLayoutProperty(e,"visibility",t)}catch{}})}get map(){return this.getMap()}}function P(e,t){if(!e)return;const{center:o,zoom:i,pitch:n,bearing:r,animate:s,duration:a}=t;if(s){const t=e.getCenter(),s=o||[t.lng,t.lat],l=i??e.getZoom(),c=n??e.getPitch(),d=r??e.getBearing(),u="number"==typeof a?a:900;return void e.flyTo({center:s,zoom:l,pitch:c,bearing:d,duration:u,essential:!0})}o&&e.setCenter(o),void 0!==i&&e.setZoom(i),void 0!==n&&e.setPitch(n),void 0!==r&&e.setBearing(r)}function z(e){if(!e)return null;const t=e.getCenter(),o=(e,t=6)=>function(e,t=6){const o=Number(e.toFixed(t));return Object.is(o,-0)?0:o}(e,t);return{center:[o(t.lng),o(t.lat)],zoom:o(e.getZoom(),4),pitch:o(e.getPitch(),2),bearing:o(e.getBearing(),2)}}const C={async updatePOIs(e,t,o){const[i,n]=await Promise.all([o.getAmenities(t.id),o.getDestinations(t.id)]),r=C.buildPOIs(t,i,n,o.spriteKeys);s.setData(e,l,C.toFeatureCollection(r))},buildPOIs(e,t=[],o=[],i,n){if(!e?.id)return[];const r=e.mapId??e.id,s=[];for(const o of t||[]){if(!o.waypoints)continue;const t=o.iconId||L(o.svg,i)||void 0;for(const i of o.waypoints||[]){if(i.mapId!==r||!j(i.coordinates))continue;const[n,a]=i.coordinates,l=i.id??i._?.id;s.push({id:o.id,type:"amenity",name:o.name||"Amenity",coordinates:[n,a],iconId:t,floorId:e.id,amenityType:o.type,keywords:o.keywords||[],showLabel:!0,waypointId:l,waypoint:i})}}for(const t of o||[])if(t.waypoints)for(const o of t.waypoints||[]){if(o.mapId!==r||!j(o.coordinates))continue;const[i,n]=o.coordinates,a=o.id??o._?.id;s.push({id:t.id,type:"destination",name:t.name||"Destination",coordinates:[i,n],floorId:e.id,showLabel:!0,waypointId:a,waypoint:o})}return n&&String(n.floorId)===String(e.id)&&j(n.coordinates)&&s.push({id:"kiosk-you-are-here",type:"kiosk",name:"You are here",coordinates:n.coordinates,iconId:"YouAreHere",floorId:e.id,showLabel:!0,isYouAreHere:!0,heading:n.heading??null,waypointId:n.waypointId,waypoint:n.waypoint}),s},toFeatureCollection:e=>({type:"FeatureCollection",features:e.map(e=>{const t=e.heading;return{type:"Feature",geometry:{type:"Point",coordinates:e.coordinates},properties:{id:e.id,name:e.name,poiType:e.type,iconId:e.iconId,floorId:e.floorId,keywords:e.keywords,amenityType:e.amenityType,showLabel:!1!==e.showLabel,isYouAreHere:!0===e.isYouAreHere,heading:"number"==typeof t?t:null,hasHeading:"number"==typeof t}}})})};function T(e){return e.find(e=>e.isYouAreHere)||null}function j(e){return Array.isArray(e)&&e.length>=2}function L(e,t){if(!e||!t)return null;const o=/<svg[^>]*\bid\s*=\s*["']([^"']+)["']/i.exec(e),i=o?.[1];return i&&t.has(i)?i:null}function B(e){const t=e=>(e??"").toLowerCase(),o=t(e.name),i=(e.keywords||[]).map(e=>t(e)),n=e.extensors||{},r=t(n.type),s="kiosk"===o||o.includes("kiosk"),a=i.some(e=>e.includes("kiosk"));return s||a||"assistance"===r}class E{deps;routeAnimationFrame=null;routeAnimationStart=null;routeAnimationDurationMs=1200;routeActive=!1;routeBounds=null;constructor(e){this.deps=e}buildWayfindFeatureCollection(e){if(!e)return this.deps.warn?.("wayfind :: no result"),null;const t=[],o=e=>{if(!e)return;const o=e.coordinates||e.xyz||e._?.coordinates;if(Array.isArray(o)&&o.length>=2){const e=Number(o[0]),i=Number(o[1]);Number.isFinite(e)&&Number.isFinite(i)&&t.push([e,i])}};return Array.isArray(e)?e.length>0&&Array.isArray(e[0]?.points)?e[0].points.forEach(o):e.forEach(o):Array.isArray(e.points)?e.points.forEach(o):Array.isArray(e.path)?e.path.forEach(o):Array.isArray(e.paths?.[0]?.points)&&e.paths[0].points.forEach(o),t.length<2?(this.deps.warn?.("wayfind :: not enough coordinates to draw a route",{resultShape:{isArray:Array.isArray(e),hasPoints:Array.isArray(e.points),hasPath:Array.isArray(e.path),hasPaths0Points:Array.isArray(e.paths?.[0]?.points)},extractedCount:t.length}),null):(this.deps.log?.("wayfind :: extracted coordinates for route",{count:t.length,first:t[0],last:t[t.length-1]}),{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:t},properties:{}}]})}async wayfindBetweenWaypoints(e,t,o){const i=this.deps.getMap();if(!this.deps.getVenue()||!i)return this.deps.warn?.("wayfindBetweenWaypoints :: venue or map not ready"),null;const n={accessible:o?.accessible,avoidStairs:o?.avoidStairs};let r=null;try{r=await this.deps.computeRoute(e,t,n)}catch(e){return this.deps.warn?.("wayfind :: computeRoute failed",e),null}this.deps.log?.("wayfind :: result",r);const a=this.buildWayfindFeatureCollection(r);if(!a)return r;s.setData(i,d,a),this.routeBounds=function(e){const t=e.features[0]?.geometry;if(!t||"LineString"!==t.type)return null;const o=t.coordinates;if(0===o.length)return null;let i=1/0,n=1/0,r=-1/0,s=-1/0;for(const[e,t]of o)e<i&&(i=e),e>r&&(r=e),t<n&&(n=t),t>s&&(s=t);return[[i,n],[r,s]]}(a),this.deps.log?.("wayfind :: route source updated",{featureCount:a.features.length}),this.startRouteAnimation();const l=o?.centerMode??"route",c=o?.zoom??19,u=!0===this.deps.getReducedMotion?.();if("none"!==l){const e=a.features[0]?.geometry;if(e&&"LineString"===e.type&&Array.isArray(e.coordinates)){const t=e.coordinates;if("destination"===l){const e=t[t.length-1];i.flyTo({center:e,zoom:c,pitch:45,bearing:0,animate:!u,duration:u?0:900})}else if("route"===l){const e=t.map(e=>e[0]),o=t.map(e=>e[1]),n=[[Math.min(...e),Math.min(...o)],[Math.max(...e),Math.max(...o)]];i.setMinPitch(0);const r=this.deps.getBoundsPadding();let s=null,a=0;for(const e of[1,.66,.4,.2,0])if(s=i.cameraForBounds(n,{padding:U(r,e),bearing:0}),s){a=e;break}const l=i.getContainer();this.deps.log?.("wayfind :: route fit",{requestedPadding:r,paddingScaleApplied:a,canvas:[l.clientWidth,l.clientHeight],camera:s?{zoom:s.zoom}:"no fit at any padding"}),s?i.easeTo({center:s.center,zoom:s.zoom-O,bearing:0,pitch:0,duration:u?0:800}):i.easeTo({pitch:0,bearing:0,duration:u?0:800})}}}return r}async navigateFromKioskToDestination(e){const t=this.deps.getMap(),o=this.deps.getVenue();if(!t||!o)return null;const i=this.deps.getYouAreHerePOI();if(!i||!i.waypoint)return this.deps.warn?.("navigateFromKioskToDestination :: no you-are-here waypoint available",i),null;const n=e.waypoint||e.waypoints?.[0];if(!n)return this.deps.warn?.("navigateFromKioskToDestination :: destination has no waypoint",e),null;this.deps.log?.("navigateFromKioskToDestination :: from kiosk to destination",{kioskWaypoint:i.waypoint,destWaypoint:n});const r=this.deps.getYouAreHereCoordinates()??i.waypoint?.coordinates,s=n.coordinates||n.xyz||n._?.coordinates,a=Array.isArray(s)&&s.length>=2?[Number(s[0]),Number(s[1])]:null;return r&&a?this.showRouteContext(r,a):this.deps.warn?.("navigateFromKioskToDestination :: could not derive endpoint coordinates",{fromCoords:r,rawDest:s}),this.wayfindBetweenWaypoints(i.waypoint,n,{centerMode:"route"})}clearRoute(){const e=this.deps.getMap();if(!e)return;this.stopRouteAnimation();if(s.setData(e,d,{type:"FeatureCollection",features:[]}),this.routeBounds=null,e.getMinPitch()<30){e.setMinPitch(30);const t=!0===this.deps.getReducedMotion?.();e.easeTo({pitch:45,duration:t?0:400})}this.deps.log?.("wayfind :: route cleared")}getActiveRouteBounds(){return this.routeActive?this.routeBounds:null}setPoiLayersVisible(e){const t=this.deps.getMap();if(!t)return;const o=e?"visible":"none";["poi-accessibility-icons","poi-destination-circles","poi-destination-labels","poi-entrance-exit-icons","poi-parking-icons","poi-other-amenity-icons"].forEach(e=>{t.getLayer(e)&&t.setLayoutProperty(e,"visibility",o)})}updateRouteEndpoints(e,t){const o=this.deps.getMap();if(!o)return;const i=o.getSource("route-endpoints");if(!i)return;const n={type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:e},properties:{role:"source"}},{type:"Feature",geometry:{type:"Point",coordinates:t},properties:{role:"destination"}}]};i.setData(n)}clearRouteEndpoints(){const e=this.deps.getMap();if(!e)return;const t=e.getSource("route-endpoints");if(!t)return;t.setData({type:"FeatureCollection",features:[]})}showRouteContext(e,t){this.updateRouteEndpoints(e,t)}hideRouteContext(){this.setPoiLayersVisible(!0),this.clearRouteEndpoints()}startRouteAnimation(){const e=this.deps.getMap();if(!e)return;if("undefined"==typeof window)return;if(null!=this.routeAnimationFrame&&(cancelAnimationFrame(this.routeAnimationFrame),this.routeAnimationFrame=null),this.routeAnimationStart=performance.now(),this.routeActive=!0,!0===this.deps.getReducedMotion?.())return e.getLayer("route-line")&&(e.setPaintProperty("route-line","line-gradient",void 0),e.setPaintProperty("route-line","line-color","#007aff")),void(e.getLayer("route-halo")&&(e.setPaintProperty("route-halo","line-gradient",void 0),e.setPaintProperty("route-halo","line-color","#ffffff")));const t=this.deps.debug,o=e=>{const i=this.deps.getMap();if(!i||!this.routeActive||null==this.routeAnimationStart)return;const n=e-this.routeAnimationStart,r=Math.min(1,n/this.routeAnimationDurationMs),s=Math.max(.001,r);t&&this.deps.log?.("route animation frame",{t:r,clamped:s});const a=.001,l=Math.min(Math.max(s-.01,a),.998),c=Math.min(Math.max(s+.01,l+a),.999),d=["interpolate",["linear"],["line-progress"],0,"rgba(0,122,255,1.0)",l,"rgba(0,122,255,1.0)",c,"rgba(0,122,255,0.0)",1,"rgba(0,122,255,0.0)"],u=["interpolate",["linear"],["line-progress"],0,"rgba(255,255,255,0.7)",l,"rgba(255,255,255,0.7)",c,"rgba(255,255,255,0.0)",1,"rgba(255,255,255,0.0)"];i.getLayer("route-line")&&i.setPaintProperty("route-line","line-gradient",d),i.getLayer("route-halo")&&i.setPaintProperty("route-halo","line-gradient",u),this.routeAnimationFrame=r<1?requestAnimationFrame(o):null};this.routeAnimationFrame=requestAnimationFrame(o)}stopRouteAnimation(){this.routeActive=!1,null!=this.routeAnimationFrame&&"undefined"!=typeof window&&cancelAnimationFrame(this.routeAnimationFrame),this.routeAnimationFrame=null,this.routeAnimationStart=null;const e=this.deps.getMap();e&&(e.getLayer("route-line")&&(e.setPaintProperty("route-line","line-gradient",void 0),e.setPaintProperty("route-line","line-color","#007aff")),e.getLayer("route-halo")&&(e.setPaintProperty("route-halo","line-gradient",void 0),e.setPaintProperty("route-halo","line-color","#ffffff")))}}const O=1;function U(e,t){return"number"==typeof e?e*t:{top:e.top*t,bottom:e.bottom*t,left:e.left*t,right:e.right*t}}function R(e){const[t,o]=e.coordinates??[];return`${e.mapId}|${t}|${o}`}class D{getVenue;getFloors;getFloorById;logFn;constructor(e){this.getVenue=e.getVenue,this.getFloors=e.getFloors,this.getFloorById=e.getFloorById,this.logFn=e.log}get venue(){return this.getVenue()}log(...e){this.logFn&&this.logFn(...e)}loadForFloor(e){if(!e||!this.venue)return[];try{const t=this.venue.amenities?.getByMap(e.id)||[];return Array.isArray(t)?t.map(t=>{const o=t;return o.floorId=e.id,o}):[]}catch{return[]}}getAll(){return this.getFloors().flatMap(e=>this.loadForFloor(e))}getDistinct(){const e=new Map;for(const t of this.getFloors())for(const o of this.loadForFloor(t)){const t=String(o.id),i=e.get(t);if(!i){const i={id:o.id,name:o.name,svg:o.svg,uris:o.uris,iconId:o.iconId,keywords:o.keywords,type:o.type,extensors:o.extensors,waypoints:[...o.waypoints??[]]};e.set(t,i);continue}const n=new Set((i.waypoints??[]).map(R));for(const e of o.waypoints??[]){const t=R(e);n.has(t)||((i.waypoints??=[]).push(e),n.add(t))}}return Array.from(e.values())}getByFloorId(e){const t=this.getFloorById(e);return t?this.loadForFloor(t):[]}getAllKiosks(){return this.getAll().filter(e=>B(e))}getKioskForFloor(e){const t=this.getFloorById(e);if(!t)return null;return this.loadForFloor(t).find(e=>B(e))??null}logKioskForFloor(e){const t=this.getFloorById(e);if(!t)return;const o=this.getKioskForFloor(e);o?this.log("amenity :: kiosk found",{floorId:t.id,id:o.id,name:o.name,keywords:o.keywords,waypoints:o.waypoints,raw:o}):this.log("amenity :: kiosk not found on floor",{floorId:t.id})}}const $="poi-highlight-ring";class N{getMap;log;raf=null;constructor(e){this.getMap=e.getMap,this.log=e.log??(()=>{})}highlight(e){const t=this.getMap();t&&(s.setData(t,u,{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:e},properties:{}}]}),this.log("highlight :: set",e),this.startPulse())}clear(){this.stopPulse();const e=this.getMap();e&&s.setData(e,u,{type:"FeatureCollection",features:[]})}destroy(){this.stopPulse()}startPulse(){const e=this.getMap();if(!e||!e.getLayer($))return;if(this.stopPulse(),"undefined"!=typeof window&&!0===window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return void this.applyRing(e,.35);const t=performance.now(),o=i=>{const n=(i-t)%1600/1600;this.applyRing(e,n),this.raf=requestAnimationFrame(o)};this.raf=requestAnimationFrame(o)}applyRing(e,t){e.getLayer($)&&(e.setPaintProperty($,"circle-radius",14+26*t),e.setPaintProperty($,"circle-opacity",.45*(1-t)))}stopPulse(){null!=this.raf&&(cancelAnimationFrame(this.raf),this.raf=null)}}function V(e){return e?`?locale=${encodeURIComponent(e)}`:""}g({enabled:!0,prefix:"MinuteMapsSDK"});class J{mode;proxyBaseUrl;direct;fetchImpl;tokenCache=null;constructor(e){const t="undefined"!=typeof window?window:globalThis,o=e.fetchImpl??t.fetch;if("function"!=typeof o)throw new Error("Fetch API is not available in this environment");this.fetchImpl=o.bind(t),this.mode=e.mode,this.proxyBaseUrl=("proxy"===e.mode?e.proxyBaseUrl:void 0)||"/api/jacs","direct"===e.mode?this.direct={host:this.normalizeHost(e.host),clientId:e.clientId,username:e.username,password:e.password}:this.direct=null}async getPolygonLayers(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/polygon-layer`,o=await this.getJson(t);return this.extractArray(o)}async getFloorMapTemplate3d(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/building/${encodeURIComponent(String(e.buildingId))}/floor/${encodeURIComponent(String(e.floorId))}/map-template/3d`,o=await this.getJson(t);return this.extractArray(o)}async getFloors(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/building/${encodeURIComponent(String(e.buildingId))}/floor`+V(e.locale),o=await this.getJson(t);return this.extractArray(o)}async getVenueAll(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/all`,o=await this.getJson(t),i=o?.data||o?.result||o;if(!i||"object"!=typeof i)throw new Error("JACS venue/all response was not a JSON object");return i}async getVenue(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}`,o=await this.getJson(t),i=o?.venue||o?.data||o;if(!i||"object"!=typeof i)throw new Error("JACS venue response was not a JSON object");return i}async getFloorMapGeojson(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/building/${encodeURIComponent(String(e.buildingId))}/floor/${encodeURIComponent(String(e.floorId))}/map/geojson`,o=await this.getJson(t),i=o?.geojson||o?.data||o;if(!i||"FeatureCollection"!==i.type||!Array.isArray(i.features))throw new Error("JACS floor geojson did not look like a GeoJSON FeatureCollection");return i}async getBuildingFull(e){const t=new URLSearchParams;t.set("mapProfile",String(e.mapProfile??"public")),t.set("geojson",String(e.geojson??!0));const o=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/building/${encodeURIComponent(String(e.buildingId))}/full?${t.toString()}`,i=await this.getJson(o),n=i?.data||i?.result||i;if(!n||"object"!=typeof n)throw new Error("JACS building full response was not a JSON object");return n}async getDestinations(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/destination`+V(e.locale),o=await this.getJson(t);return this.extractArray(o)}async getAmenities(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/amenity`+V(e.locale),o=await this.getJson(t);return this.extractArray(o)}async getBuildings(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/building`,o=await this.getJson(t);return this.extractArray(o)}async getStylesheet3d(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/building/${encodeURIComponent(String(e.buildingId))}/stylesheet/3d`,o=await this.getJson(t),i=o?.style||o?.data||o;if(!i||"object"!=typeof i)throw new Error("JACS stylesheet response was not a JSON object");return i}invalidateToken(){this.tokenCache=null}async getJson(e){if("proxy"===this.mode){const t=this.proxyBaseUrl.replace(/\/+$/,""),o=e.startsWith("/")?e:`/${e}`,i=await this.fetchImpl(`${t}${o}`,{method:"GET",headers:{Accept:"application/json"}});if(!i.ok){const e=await this.safeReadText(i);throw new Error(`JACS proxy GET failed (${i.status} ${i.statusText}) :: ${e}`)}return await i.json()}const t=this.direct;if(!t)throw new Error("JacsProvider is not configured for direct mode");const o=await this.getJwtToken(),i=this.joinUrl(t.host,e),n=await this.fetchImpl(i,{method:"GET",headers:{Authorization:`Bearer ${o}`,Accept:"application/json"}});if(!n.ok){const e=await this.safeReadText(n);throw new Error(`JACS GET failed (${n.status} ${n.statusText}) :: ${e}`)}return await n.json()}extractArray(e){return(Array.isArray(e)?e:null)||(Array.isArray(e?.data)?e.data:null)||(Array.isArray(e?.items)?e.items:null)||(Array.isArray(e?.results)?e.results:null)||[]}async getJwtToken(){const e=this.direct;if(!e)throw new Error("getJwtToken should not be called in proxy mode");const t=Date.now(),o=this.tokenCache;if(o?.token&&t<o.expiresAtMs-3e4)return o.token;const i=this.joinUrl(e.host,"/auth/token"),n=new URLSearchParams;n.set("grant_type","password"),n.set("client_id",e.clientId),n.set("username",e.username),n.set("password",e.password);const r=await this.fetchImpl(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:n.toString()});if(!r.ok){const e=await this.safeReadText(r);throw new Error(`JACS auth failed (${r.status} ${r.statusText}) :: ${e}`)}const s=await r.json(),a=s?.access_token||s?.token||s?.jwt||s?.accessToken;if(!a)throw new Error("JACS auth response did not contain a token");const l=s?.expires_in??s?.expiresIn??s?.expires??s?.ttl,c="number"==typeof l?l:Number(l),d=Number.isFinite(c)&&c>0?c:600;return this.tokenCache={token:a,expiresAtMs:Date.now()+1e3*d},a}normalizeHost(e){return String(e||"").replace(/\/+$/,"")}joinUrl(e,t){const o=this.normalizeHost(e),i=String(t||"");return i?`${o}${i.startsWith("/")?"":"/"}${i}`:o}async safeReadText(e){try{return await e.text()}catch{return""}}}function H(e,t){return`${e}:${t}`}function K(e,t){const o=e[0]-t[0],i=e[1]-t[1];return Math.sqrt(o*o+i*i)}const W=g({enabled:!0,prefix:"MinuteMapsSDK jacs"});function Y(e){return null!=e&&"object"==typeof e?e.id:e}function G(e,t){const o=[];for(const e of t)"number"==typeof e?.id&&"number"==typeof e?.mapId&&null!=e?.x&&null!=e?.y&&o.push({id:e.id,mapId:e.mapId,status:!1!==e.status,coordinates:[Number(e.x),Number(e.y)],geo:Array.isArray(e.coordinates)?[e.coordinates[0],e.coordinates[1]]:null});const i=[];for(const t of Array.isArray(e?.paths)?e.paths:[]){const e=t?.waypoints??t?.waypointIds;"number"==typeof t?.id&&Array.isArray(e)&&2===e.length&&i.push({id:t.id,pathTypeId:"number"==typeof t.pathTypeId?t.pathTypeId:0,direction:"number"==typeof t.direction?t.direction:0,status:!1!==t.status,waypointIds:[e[0],e[1]],extensors:t.extensors})}return function(e){const t=new Map,o=new Map,i=new Map,n=new Map;for(const t of e.pathTypes)i.set(t.id,t);for(const i of e.waypoints){if(!i.status)continue;const e=H(i.mapId,i.id),r={key:e,waypointId:i.id,mapId:i.mapId,pixel:[i.coordinates[0],i.coordinates[1]],geo:i.geo};t.set(e,r),o.set(e,[]);const s=n.get(i.mapId)??[];s.push(e),n.set(i.mapId,s)}const r=new Map;for(const e of t.values())r.set(e.waypointId,e.key);for(const i of e.paths){if(!i.status)continue;const[e,n]=i.waypointIds;if(e===n)continue;const s=r.get(e),a=r.get(n);if(!s||!a)continue;const l=t.get(s),c=t.get(a),d=K(l.pixel,c.pixel),u={id:i.id,fromKey:s,toKey:a,pathTypeId:i.pathTypeId,pixelLength:d,meta:i.extensors&&Object.keys(i.extensors).length?i.extensors:void 0};o.get(s).push({neighbor:a,edge:u}),0===i.direction&&o.get(a).push({neighbor:s,edge:u})}return{nodes:t,adjacency:o,pathTypes:i,nodesByMapId:n}}({waypoints:o,paths:i,pathTypes:(Array.isArray(e?.pathTypes)?e.pathTypes:[]).filter(e=>"number"==typeof e?.id).map(e=>({id:e.id,name:e.name??"",description:e.description}))})}class _{config;jacs;floors=[];buildingId=null;destinationsByMapId=new Map;amenitiesByMapId=new Map;mapLabelsByMapId=new Map;zonesByMapId=new Map;zonesByDestinationId=new Map;venueLike=null;wayfindingGraph=null;async init(e){this.config=e;const t=e.jacs;if(!t?.mode)throw new Error("config.jacs.mode is required");if("proxy"!==t.mode){if(!t.host)throw new Error("config.jacs.host is required (direct mode)");if(!t.auth?.clientId)throw new Error("config.jacs.auth.clientId is required (direct mode)");if(!t.auth?.username)throw new Error("config.jacs.auth.username is required (direct mode)");if(!t.auth?.password)throw new Error("config.jacs.auth.password is required (direct mode)");this.jacs=new J({mode:"direct",host:t.host,clientId:t.auth.clientId,username:t.auth.username,password:t.auth.password})}else this.jacs=new J({mode:"proxy",proxyBaseUrl:t.proxyBaseUrl||"/api/jacs"})}async loadVenue(){const e=this.config.jmap.customerId,t=this.config.jmap.venueId;if(null==e)throw new Error("config.jmap.customerId is required");if(null==t)throw new Error("config.jmap.venueId is required");const o=await this.jacs.getVenueAll({customerId:e,venueId:t}),i=Array.isArray(o?.buildings)?o.buildings:[],n=i[0],r=n?.id??n?.buildingId;if(!n||!r)throw new Error("No buildings found for this venue in /all response");this.buildingId=r;const s=Array.isArray(o?.waypoints)?o.waypoints:[],a=Array.isArray(o?.destinations)?o.destinations:[],l=Array.isArray(o?.amenities)?o.amenities:[],c=new Map;for(const e of s){const t=e?.mapId;if(null==t)continue;const o=c.get(t)??[];o.push(e),c.set(t,o)}const d=Array.isArray(n?.floors)?n.floors:[],u=n?.defaultFloorId,p=d.map(e=>{const t=e.map?.id??e.mapId;return{id:e.id,mapId:t,name:e.name??e.shortName??String(e.id),sequence:e.level??e.preference,isDefault:e.id===u,geojson:void 0,mapTemplate3d:[],_waypoints:null!=t?c.get(t)??[]:[]}});this.floors=p;const f=new Map;for(const e of p)null!=e.mapId&&f.set(e.mapId,e.id);const h=o?.venue?.coordinates,g=new Map;for(const e of d){const t=e?.map?.id??e?.mapId,o="string"==typeof e?.map?.svg?e.map.svg:"";if(null==t||!o)continue;const i=/viewBox\s*=\s*["']([^"']+)["']/i.exec(o);if(!i)continue;const n=i[1].trim().split(/\s+/).map(Number);if(4!==n.length||n.some(e=>!Number.isFinite(e)))continue;const[,,r,s]=n;r>0&&s>0&&g.set(t,{width:r,height:s})}const y=(e,t,o)=>{if(!h)return null;const i=g.get(e);if(!i)return null;return[h.topLng+t/i.width*(h.bottomLng-h.topLng),h.topLat+o/i.height*(h.bottomLat-h.topLat)]},m=new Map;for(const e of s){const t=e?.id;if(null!=t){if(!Array.isArray(e.coordinates)&&null!=e.x&&null!=e.y&&null!=e.mapId){const t=y(e.mapId,Number(e.x),Number(e.y));t&&(e.coordinates=t)}m.set(t,e)}}this.wayfindingGraph=G(o,s);let w=null;const b=this.config?.jmap?.deviceId,I=Array.isArray(o?.devices)?o.devices:[],F=e=>null==e?.id?null:s.find(t=>Array.isArray(t?.deviceIds)&&t.deviceIds.includes(e.id))??null;let v=null;null!=b&&""!==b&&(v=I.find(e=>String(e?.id)===String(b)||e?.uuid===b)??null,v||W.warn("configured kiosk deviceId not found in this venue; falling back to a placed device",{deviceId:b}));let x=F(v);if(!x){const e=I.find(e=>F(e));e&&(null!=b&&""!==b?W.warn("anchoring You-are-here to a placed device as fallback",{configured:b,using:e.name??e.id}):W.debug("no kiosk deviceId configured; anchoring to placed device",{using:e.name??e.id}),v=e,x=F(e))}if(x&&Array.isArray(x.coordinates)){const e=v?.heading,t="number"==typeof e&&Number.isFinite(e)?e:null;w={waypointId:x.id,floorId:f.get(x.mapId)??x.mapId,coordinates:x.coordinates,deviceName:v?.name,heading:t,waypoint:x}}else I.length>0&&W.warn("venue has device(s) but none are placed on a waypoint; no You-are-here anchor");const A=e=>Array.isArray(e)?e.map(e=>e&&"object"==typeof e?e:m.get(e)).filter(Boolean):[];for(const e of l)e.waypoints=A(e?.waypoints);for(const e of a)e.waypoints=A(e?.waypoints);this.amenitiesByMapId.clear();for(const e of l)for(const t of e?.waypoints??[]){const o=t?.mapId;if(null==o)continue;const i=f.get(o)??o,n=this.amenitiesByMapId.get(i)??[];n.push(e),this.amenitiesByMapId.set(i,n)}this.destinationsByMapId.clear();for(const e of a)for(const t of e?.waypoints??[]){const o=t?.mapId;if(null==o)continue;const i=f.get(o)??o,n=this.destinationsByMapId.get(i)??[];n.push(e),this.destinationsByMapId.set(i,n)}this.mapLabelsByMapId.clear();const M=Array.isArray(o?.mapLabels)?o.mapLabels:[],k=p.map(e=>e.id);for(const e of M){if(!1===e?.status)continue;const t=e?.name??"",o=Array.isArray(e?.instances)?e.instances:[];for(const i of o){const o=i?.mapId,n=Number(i?.xPosition),r=Number(i?.yPosition);if(null==o||!Number.isFinite(n)||!Number.isFinite(r))continue;const s=y(o,n,r);if(!s)continue;const a={id:i.id,labelId:e.id,name:t,coordinates:s,mapId:o,rotation:"number"==typeof i.rotation?i.rotation:0,allLevels:1===i?.allLevels||!0===i?.allLevels},l=a.allLevels?k:[f.get(o)??o];for(const e of l){const t=this.mapLabelsByMapId.get(e)??[];t.push(a),this.mapLabelsByMapId.set(e,t)}}}this.zonesByMapId.clear(),this.zonesByDestinationId.clear();const S=Array.isArray(o?.zones)?o.zones:[];for(const e of S){if(!1===e?.status)continue;const t=e?.mapId;if(null!=t){const o=f.get(t)??t,i=this.zonesByMapId.get(o)??[];i.push(e),this.zonesByMapId.set(o,i)}const o=Array.isArray(e?.destinationIds)?e.destinationIds:Array.isArray(e?.destinations)?e.destinations:[];for(const t of o){const o="object"==typeof t&&null!=t?t.id:t;if(null==o)continue;const i=this.zonesByDestinationId.get(o)??[];i.push(e),this.zonesByDestinationId.set(o,i)}}const P=o?.venue??{};if(this.venueLike={...P,floors:p,polygonLayers:[],destinations:{items:[...a],getByMap:e=>this.destinationsByMapId.get(Y(e))??[]},amenities:{items:[...l],getByMap:e=>this.amenitiesByMapId.get(Y(e))??[]},mapLabels:{items:[...M],getByMap:e=>this.mapLabelsByMapId.get(Y(e))??[]},zones:{items:[...S],getByMap:e=>this.zonesByMapId.get(Y(e))??[],getByDestination:e=>this.zonesByDestinationId.get(Y(e))??[]},buildings:{items:[...i],getAllFloors:()=>this.floors},styleSheet:null,kioskWaypoint:w},this.config?.jmap?.locale)try{await this.applyLocale(this.config.jmap.locale)}catch{}return this.venueLike}async applyLocale(e){if(!e)return;if(!this.venueLike)return;const t=this.config.jmap.customerId,o=this.config.jmap.venueId,i=this.buildingId;if(null!=t&&null!=o&&null!=i)try{const[n,r,s]=await Promise.all([this.jacs.getDestinations({customerId:t,venueId:o,locale:e}),this.jacs.getAmenities({customerId:t,venueId:o,locale:e}),this.jacs.getFloors({customerId:t,venueId:o,buildingId:i,locale:e})]),a=e=>{const t=new Map;for(const o of e)null!=o?.id&&t.set(o.id,o);return t},l=a(n),c=a(r),d=a(s),u=(e,t)=>{t&&(null!=t.name&&(e.name=t.name),null!=t.description&&(e.description=t.description))};for(const e of this.venueLike.destinations?.items??[])u(e,l.get(e?.id));for(const e of this.venueLike.amenities?.items??[])u(e,c.get(e?.id));for(const e of this.floors)u(e,d.get(e.id))}catch(t){throw W.warn("locale merge failed; staying on prior locale",{locale:e,e:t}),t}}async ensureFloorGeojson(e){if(e.geojson)return;const t=this.config.jmap.customerId,o=this.config.jmap.venueId;try{const i=await this.jacs.getFloorMapGeojson({customerId:t,venueId:o,buildingId:this.buildingId,floorId:e.id});e.geojson=function(e){return(e?.type?e:e?.data)??null}(i)}catch(t){W.warn("floor geojson fetch failed",{floorId:e.id,e:t})}}async preloadRemainingFloors(){const e=this.floors.filter(e=>!e.geojson);0!==e.length&&(await Promise.all(e.map(e=>this.ensureFloorGeojson(e))),W.debug("preloaded geojson for remaining floors",{count:e.length}))}async getFloors(){return this.floors}async getAmenities(e){return this.amenitiesByMapId.get(e)??[]}async getDestinations(e){return this.destinationsByMapId.get(e)??[]}getWayfindingGraph(){return this.wayfindingGraph}}class q{compare;data=[];constructor(e){this.compare=e}size(){return this.data.length}push(e){this.data.push(e),this.bubbleUp(this.data.length-1)}pop(){if(0===this.data.length)return;const e=this.data[0],t=this.data.pop();return this.data.length>0&&(this.data[0]=t,this.sinkDown(0)),e}bubbleUp(e){const t=this.data[e];for(;e>0;){const o=e-1>>1;if(this.compare(t,this.data[o])>=0)break;this.data[e]=this.data[o],e=o}this.data[e]=t}sinkDown(e){const t=this.data.length,o=this.data[e];for(;;){const i=2*e+1,n=i+1;let r=-1;if(i<t&&this.compare(this.data[i],o)<0&&(r=i),n<t&&this.compare(this.data[n],-1===r?o:this.data[i])<0&&(r=n),-1===r)break;this.data[e]=this.data[r],e=r}this.data[e]=o}}const Z=new Set([]),X=new Set([]),Q=new Set([]);function ee(e){const t=Boolean(e.accessible),o=Boolean(e.avoidStairs);return e=>{const i=e.pixelLength;if(o&&te(e))return 1/0;if(t&&function(e){return!1===e.meta?.accessible||te(e)}(e))return 1/0;if(te(e))return 1.5*i;if(t){if(function(e){return!!X.has(e.pathTypeId)||!0===e.meta?.ramp}(e))return.95*i;if(function(e){return!!Q.has(e.pathTypeId)||!0===e.meta?.elevator}(e))return.95*i}return i}}function te(e){return!!Z.has(e.pathTypeId)||!0===e.meta?.stairs}function oe(e){if(!e)return null;const t=e.coordinates??e.xyz??e._?.coordinates;if(!Array.isArray(t)||t.length<2)return null;const o=Number(t[0]),i=Number(t[1]);return Number.isFinite(o)&&Number.isFinite(i)?[o,i]:null}class ie{deps;warn;constructor(e){this.deps=e,this.warn=e.warn??((e,t)=>console.warn(`[wayfinding] ${e}`,t??""))}async init(e){}async wayfindBetweenWaypoints(e){const{from:t,to:o,options:i}=e,n=this.deps.getGraph(),r=oe(t),s=oe(o);if(!n)return this.warn("graph not ready"),ne(r,s);const a=re(n,t),l=re(n,o);if(!a||!l)return this.warn("could not resolve start/end waypoint to a graph node",{fromId:t?.id,toId:o?.id}),ne(r,s);const c=function(e,t,o,i){if(!e.nodes.has(t)||!e.nodes.has(o))return null;if(t===o)return{keys:[t],cost:0};const n=new Map,r=new Map;n.set(t,0);const s=new q((e,t)=>e.cost-t.cost);for(s.push({key:t,cost:0});s.size()>0;){const{key:t,cost:a}=s.pop();if(t===o)break;if(a>(n.get(t)??1/0))continue;const l=e.adjacency.get(t);if(l)for(const{neighbor:e,edge:o}of l){const l=i(o);if(!Number.isFinite(l)||l<0)continue;const c=a+l;c<(n.get(e)??1/0)&&(n.set(e,c),r.set(e,t),s.push({key:e,cost:c}))}}if(!n.has(o))return null;const a=[];let l=o;for(;null!=l;)if(a.unshift(l),l=r.get(l),void 0===l&&a[0]!==t)return null;return{keys:a,cost:n.get(o)}}(n,a.key,l.key,ee(i??{}));if(!c)return this.warn("no path found",{from:a.key,to:l.key}),ne(r,s);const d=[],u=c.keys.length-1;for(let e=0;e<=u;e++){const t=n.nodes.get(c.keys[e]);let o=t?.geo??null;0===e&&r&&(o=r),e===u&&s&&(o=s),o&&d.push({coordinates:o})}return d.length<2?(this.warn("route nodes had no projected coordinates",{keys:c.keys.length}),ne(r,s)):{points:d}}}function ne(e,t){return e&&t?{points:[{coordinates:e},{coordinates:t}]}:null}function re(e,t){if(!t||null==t.id)return null;const o="number"==typeof t.id?t.id:Number(t.id);if(!Number.isFinite(o))return null;if("number"==typeof t.mapId){const i=e.nodes.get(H(t.mapId,o));if(i)return i}return function(e,t){for(const o of e.nodes.values())if(o.waypointId===t)return o;return null}(e,o)}class se{handlers=new Map;on(e,t){this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e).add(t)}off(e,t){t?this.handlers.get(e)?.delete(t):this.handlers.delete(e)}emit(e,t){this.handlers.get(e)?.forEach(e=>{try{e(t)}catch{}})}}var ae={version:8,name:"Hospital Indoor Mapping - Hybrid Style Healthcare Compliant",metadata:{description:"Accessibility-focused hospital navigation with proper healthcare standards",author:"Hospital Mapping Team",version:"7.1.0"},sprite:"http://localhost:4000/sprites/sprite",glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",sources:{protomaps:{type:"vector",url:"pmtiles://https://jacsdevtiles-gjgbejbpdzbgcge8.z01.azurefd.net/pmtiles/base/usa.pmtiles",attribution:"© OpenStreetMap contributors"},"indoor-data":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"poi-data":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"accessibility-data":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"unit-walls":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"route-data":{type:"geojson",data:{type:"FeatureCollection",features:[]},lineMetrics:!0},"route-endpoints":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"poi-highlight-data":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"map-labels-data":{type:"geojson",data:{type:"FeatureCollection",features:[]}}},layers:[{id:"background",type:"background",paint:{"background-color":"#f0f0f0"}},{id:"basemap-earth",type:"fill",source:"protomaps","source-layer":"earth",paint:{"fill-color":"#EAE2D0"}},{id:"basemap-landuse-park",type:"fill",source:"protomaps","source-layer":"landuse",filter:["in",["get","kind"],["literal",["park","forest","wood","nature_reserve","grass","garden","playground","cemetery","golf_course"]]],paint:{"fill-color":"#cbe0b6","fill-opacity":["interpolate",["linear"],["zoom"],14,.95,18,.8]}},{id:"basemap-water",type:"fill",source:"protomaps","source-layer":"water",paint:{"fill-color":"#c2dbf2"}},{id:"basemap-roads-minor",type:"line",source:"protomaps","source-layer":"roads",minzoom:13,filter:["in",["get","kind"],["literal",["minor_road","path","service","other"]]],paint:{"line-color":"#FFFFFF","line-width":["interpolate",["linear"],["zoom"],13,.5,16,1.5,19,4],"line-opacity":["interpolate",["linear"],["zoom"],14,.9,18,.5]}},{id:"basemap-roads-major",type:"line",source:"protomaps","source-layer":"roads",minzoom:10,filter:["in",["get","kind"],["literal",["highway","major_road","medium_road"]]],paint:{"line-color":"#ecc97e","line-width":["interpolate",["linear"],["zoom"],10,.5,14,1.5,18,6],"line-opacity":["interpolate",["linear"],["zoom"],14,.9,18,.5]}},{id:"pattern-water",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-Water"],paint:{"fill-color":"#cfe1ec","fill-opacity":.6}},{id:"pattern-grass",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-Grass"],paint:{"fill-color":"#d2e0c6","fill-opacity":.5}},{id:"pattern-trees",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-Trees"],paint:{"fill-color":"#cdd9c9","fill-opacity":.4}},{id:"pattern-pavement",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-Pavement"],paint:{"fill-color":"#E0E0E0","fill-opacity":.6}},{id:"pattern-outdoor-terrace",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-OutdoorTerrace"],paint:{"fill-color":"#cabfb6","fill-opacity":.3}},{id:"parking-lots",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Parking-Lots"],paint:{"fill-color":"#e0e0dd","fill-opacity":.5}},{id:"parking-lots-outline",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Parking-Lots"],paint:{"line-color":"#b0b0ad","line-width":1,"line-dasharray":[3,2]}},{id:"boundary-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Boundary"],paint:{"fill-color":"#FAF3E2","fill-opacity":1}},{id:"building-roof-fill",type:"fill",source:"indoor-data",minzoom:15.8,filter:["==",["get","featureType"],"Boundary"],paint:{"fill-color":"#162e51","fill-opacity":["interpolate",["linear"],["zoom"],15.8,0,16.5,1]}},{id:"corridors-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["any",["==",["get","featureType"],"Corridors"],["==",["get","featureType"],"Corridor"]],paint:{"fill-color":"#F0E6D1"}},{id:"accessible-routes",type:"line",source:"accessibility-data",minzoom:16.5,filter:["==",["get","accessible"],!0],paint:{"line-color":"#2E7D32","line-width":["interpolate",["linear"],["zoom"],15,2,18,3,20,4],"line-dasharray":[.5,1],"line-opacity":.7}},{id:"units-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Units"],paint:{"fill-color":["case",["has","category"],["match",["get","category"],"healthcare","#73b3e7","surgical","#73b3e7","waiting","#73b3e7","diagnostic","#97d4ea","amenities","#97d4ea","emergency","#f2938c","retail","#fee685","fnb","#fee685","admin","#dfe1e2","staff","#dfe1e2","security","#dfe1e2","#73b3e7"],"#73b3e7"],"fill-opacity":["interpolate",["linear"],["zoom"],15,.85,17,.92,19,.95]}},{id:"units-outline-2d",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Units"],layout:{visibility:"none","line-join":"round","line-cap":"round"},paint:{"line-color":"#162e51","line-opacity":.9,"line-width":["interpolate",["linear"],["zoom"],16,.8,18,1.4,20,2.2]}},{id:"backofhouse-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Back-of-house"],paint:{"fill-color":"#e6e6e2","fill-opacity":.7}},{id:"backofhouse-pattern",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Back-of-house"],paint:{"line-color":"#c4c4c4","line-width":.5,"line-opacity":.4}},{id:"backofhouse-outline-2d",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Back-of-house"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#b0b1b5","line-width":["interpolate",["linear"],["zoom"],16,.6,18,1,20,1.4],"line-opacity":.9}},{id:"restrooms-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Restrooms"],paint:{"fill-color":"#5f9070","fill-opacity":1}},{id:"restrooms-outline-2d",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Restrooms"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#3f5d4a","line-width":["interpolate",["linear"],["zoom"],16,.6,18,1,20,1.4],"line-opacity":.9}},{id:"obstacles-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Obstacles"],paint:{"fill-color":"#E8E9ED","fill-opacity":.85}},{id:"obstacles-outline-2d",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Obstacles"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#B0B1B5","line-width":["interpolate",["linear"],["zoom"],16,.5,18,.9,20,1.2],"line-opacity":.9}},{id:"escalators-stairs-elevators",type:"fill",source:"indoor-data",minzoom:16.5,filter:["in",["get","featureType"],["literal",["Escalators","Stairs","Elevators"]]],paint:{"fill-color":"#a9aeb1","fill-opacity":1}},{id:"escalators-stairs-elevators-outline-2d",type:"line",source:"indoor-data",minzoom:16.5,filter:["in",["get","featureType"],["literal",["Escalators","Stairs","Elevators"]]],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#6f7780","line-width":["interpolate",["linear"],["zoom"],16,.6,18,1,20,1.4],"line-opacity":.9}},{id:"exits-doors",type:"fill",source:"indoor-data",minzoom:16.5,filter:["in",["get","featureType"],["literal",["Exits","Doors","Exit","Door"]]],paint:{"fill-color":"#cdd9c9","fill-opacity":.6}},{id:"kiosks-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Kiosks"],paint:{"fill-color":"#ffe396","fill-opacity":.7}},{id:"pattern-lounge",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-Lounge"],paint:{"fill-color":"#ddd2e0","fill-opacity":.5}},{id:"pattern-indoor-foodcourt",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-IndoorFoodcourt"],paint:{"fill-color":"#f3e4c4","fill-opacity":.6}},{id:"corridors-outline",type:"line",source:"indoor-data",minzoom:16.5,filter:["any",["==",["get","featureType"],"Corridors"],["==",["get","featureType"],"Corridor"]],paint:{"line-color":"#BCAAA4","line-width":["interpolate",["linear"],["zoom"],15,.5,18,1,20,1.5]}},{id:"boundary-outline",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Boundary"],paint:{"line-color":"#263238","line-width":["interpolate",["linear"],["zoom"],12,2,15,2.5,18,3,20,3.5],"line-opacity":["interpolate",["linear"],["zoom"],12,.7,17,.85,18,1]}},{id:"building-roof-outline",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Boundary"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#c8a85a","line-width":["interpolate",["linear"],["zoom"],15,1.5,18,2,20,2.5],"line-opacity":.55}},{id:"interior-parking-lots",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Interior-ParkingLots"],paint:{"fill-color":"#757575","fill-opacity":.8}},{id:"interior-parking-lots-outline",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Interior-ParkingLots"],paint:{"line-color":"#616161","line-width":1.5}},{id:"building-extrusion",type:"fill-extrusion",source:"indoor-data",filter:["==",["get","featureType"],"Boundary"],paint:{"fill-extrusion-color":"#162e51","fill-extrusion-height":15,"fill-extrusion-base":0,"fill-extrusion-opacity":["interpolate",["linear"],["zoom"],15.8,1,16.5,0]}},{id:"units-wall-extrusion",type:"fill-extrusion",source:"unit-walls",minzoom:16.5,filter:["all",["==",["get","featureType"],"UnitWalls"],["!",["has","custom_height"]]],paint:{"fill-extrusion-color":"#c4c8cb","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,["case",["==",["get","wallKind"],"interior"],.5,1],17.5,["case",["==",["get","wallKind"],"interior"],.7,1.4],18.2,["case",["==",["get","wallKind"],"interior"],.9,1.6]],"fill-extrusion-base":0,"fill-extrusion-vertical-gradient":!0,"fill-extrusion-opacity":1}},{id:"units-wall-custom-extrusion",type:"fill-extrusion",source:"unit-walls",minzoom:16.5,filter:["has","custom_height"],paint:{"fill-extrusion-color":"#c4c8cb","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,1,17.5,1.4,18.2,1.6],"fill-extrusion-base":0,"fill-extrusion-vertical-gradient":!0,"fill-extrusion-opacity":1}},{id:"corridors-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["any",["==",["get","featureType"],"Corridors"],["==",["get","featureType"],"Corridor"]],layout:{visibility:"none"},paint:{"fill-extrusion-color":"#FFF8E1","fill-extrusion-height":["step",["zoom"],0,18,3.2],"fill-extrusion-base":0,"fill-extrusion-opacity":["step",["zoom"],0,18,.85]}},{id:"backofhouse-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Back-of-house"],paint:{"fill-extrusion-color":"#e6e6e2","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,1,17.5,1.4,18.2,1.6],"fill-extrusion-base":0,"fill-extrusion-opacity":1}},{id:"restrooms-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Restrooms"],paint:{"fill-extrusion-color":"#5f9070","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,1,17.5,1.4,18.2,1.6],"fill-extrusion-base":0,"fill-extrusion-opacity":.95}},{id:"obstacles-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Obstacles"],paint:{"fill-extrusion-color":"#E8E9ED","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,.4,17.5,.6,18.2,.8],"fill-extrusion-base":0,"fill-extrusion-opacity":1}},{id:"escalators-stairs-elevators-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["in",["get","featureType"],["literal",["Escalators","Stairs","Elevators"]]],paint:{"fill-extrusion-color":"#a9aeb1","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,1,17.5,1.4,18.2,1.6],"fill-extrusion-base":0,"fill-extrusion-vertical-gradient":!0,"fill-extrusion-opacity":.9}},{id:"interior-parking-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Interior-ParkingLots"],paint:{"fill-extrusion-color":"#757575","fill-extrusion-height":["interpolate",["linear"],["zoom"],15,0,16,1,17,1.4,18,1.6],"fill-extrusion-base":0,"fill-extrusion-opacity":.85}},{id:"route-line",type:"line",source:"route-data",minzoom:16.5,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#007aff","line-width":["interpolate",["linear"],["zoom"],16.5,3,18,5,20,7],"line-opacity":.9}},{id:"route-halo",type:"line",source:"route-data",minzoom:16.5,paint:{"line-color":"white","line-width":["interpolate",["linear"],["zoom"],16.5,5,18,7,20,9],"line-opacity":.7}},{id:"route-endpoint-source",type:"circle",source:"route-endpoints",minzoom:16.5,filter:["==",["get","role"],"source"],paint:{"circle-radius":6,"circle-color":"#ffffff","circle-stroke-width":3,"circle-stroke-color":"#007aff","circle-opacity":1}},{id:"route-endpoint-destination",type:"circle",source:"route-endpoints",minzoom:16.5,filter:["==",["get","role"],"destination"],paint:{"circle-radius":7,"circle-color":"#007aff","circle-stroke-width":3,"circle-stroke-color":"#ffffff","circle-opacity":1}},{id:"poi-accessibility-icons",type:"symbol",source:"poi-data",filter:["==",["get","accessible"],!0],minzoom:16.5,layout:{"icon-image":"wheelchair-accessible","icon-size":["interpolate",["linear"],["zoom"],15,.4,17,.6,19,.8],"icon-allow-overlap":!1,"icon-padding":4}},{id:"poi-destination-circles",type:"circle",source:"poi-data",filter:["==",["get","poiType"],"destination"],minzoom:16.5,paint:{"circle-radius":["interpolate",["linear"],["zoom"],16,6,18,8,20,10],"circle-color":"#ffffff","circle-stroke-width":3,"circle-stroke-color":"#162e51","circle-opacity":1}},{id:"poi-destination-labels",type:"symbol",source:"poi-data",filter:["all",["==",["get","poiType"],"destination"],["==",["get","showLabel"],!0]],minzoom:16.5,layout:{"symbol-sort-key":0,"text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],16.5,18,18,20,20,23],"text-offset":[0,-.9],"text-anchor":"bottom","text-font":["Noto Sans Bold"],"text-max-width":12,"text-allow-overlap":!1,"text-padding":4,"text-rotation-alignment":"viewport"},paint:{"text-color":"#242930","text-halo-color":"#FFFFFF","text-halo-width":1.5,"text-halo-blur":1}},{id:"map-labels",type:"symbol",source:"map-labels-data",minzoom:15.5,layout:{"symbol-sort-key":10,"text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],15.5,13,16.5,16,18,19,20,22],"text-font":["Noto Sans Bold"],"text-letter-spacing":.04,"text-max-width":10,"text-anchor":"center","text-rotate":["get","rotation"],"text-rotation-alignment":"map","text-allow-overlap":!1,"text-padding":4},paint:{"text-color":"#3d4551","text-halo-color":"#FFFFFF","text-halo-width":1.4,"text-halo-blur":.5}},{id:"poi-amenity-badge",type:"circle",source:"poi-data",filter:["==",["get","poiType"],"amenity"],minzoom:15,paint:{"circle-color":"#fdb81e","circle-radius":["interpolate",["linear"],["zoom"],16,12,16.5,16,18,20,20,24],"circle-stroke-width":1.5,"circle-stroke-color":"#FFFFFF","circle-pitch-alignment":"viewport","circle-translate":[0,-20],"circle-translate-anchor":"viewport"}},{id:"poi-entrance-exit-icons",type:"symbol",source:"poi-data",filter:["all",["==",["get","poiType"],"amenity"],["any",["!=",["index-of","entrance",["get","keywords"]],-1],["!=",["index-of","exit",["get","keywords"]],-1],["!=",["index-of","door",["get","keywords"]],-1]]],minzoom:15,layout:{"symbol-sort-key":1,"icon-image":["get","iconId"],"icon-size":["interpolate",["linear"],["zoom"],16.5,.5,18,.6,20,.8],"icon-allow-overlap":!1,"icon-padding":4,"icon-optional":!1,"icon-rotation-alignment":"viewport","icon-pitch-alignment":"viewport","text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],16,["case",["!=",["coalesce",["get","iconId"],""],""],0,17],19,["case",["!=",["coalesce",["get","iconId"],""],""],0,19],20,["case",["!=",["coalesce",["get","iconId"],""],""],0,22]],"text-offset":[0,1.3],"text-anchor":"top","text-optional":!0,"text-padding":4,"text-font":["Noto Sans Bold"],"text-rotation-alignment":"viewport"},paint:{"icon-halo-color":"#FFFFFF","icon-halo-width":1.5,"icon-halo-blur":.5,"text-color":"#242930","text-halo-color":"#FFFFFF","text-halo-width":1.5,"text-halo-blur":1,"icon-translate":[0,-20],"icon-translate-anchor":"viewport"}},{id:"poi-parking-icons",type:"symbol",source:"poi-data",filter:["all",["==",["get","poiType"],"amenity"],["any",["!=",["index-of","parking",["get","keywords"]],-1],["!=",["index-of","park",["get","keywords"]],-1]]],minzoom:14,layout:{"symbol-sort-key":2,"icon-image":["get","iconId"],"icon-size":["interpolate",["linear"],["zoom"],16.5,.5,18,.6,20,.8],"icon-allow-overlap":!1,"icon-padding":4,"icon-optional":!1,"icon-rotation-alignment":"viewport","icon-pitch-alignment":"viewport","text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],16,["case",["!=",["coalesce",["get","iconId"],""],""],0,17],19,["case",["!=",["coalesce",["get","iconId"],""],""],0,19],20,["case",["!=",["coalesce",["get","iconId"],""],""],0,22]],"text-offset":[0,1.3],"text-anchor":"top","text-optional":!0,"text-padding":4,"text-font":["Noto Sans Bold"],"text-rotation-alignment":"viewport"},paint:{"icon-halo-color":"#FFFFFF","icon-halo-width":1.5,"icon-halo-blur":.5,"text-color":"#242930","text-halo-color":"#FFFFFF","text-halo-width":1.5,"text-halo-blur":1,"icon-translate":[0,-20],"icon-translate-anchor":"viewport"}},{id:"poi-other-amenity-icons",type:"symbol",source:"poi-data",filter:["all",["==",["get","poiType"],"amenity"],["==",["index-of","entrance",["get","keywords"]],-1],["==",["index-of","exit",["get","keywords"]],-1],["==",["index-of","door",["get","keywords"]],-1],["==",["index-of","parking",["get","keywords"]],-1],["==",["index-of","park",["get","keywords"]],-1]],minzoom:16.5,layout:{"symbol-sort-key":3,"icon-image":["get","iconId"],"icon-size":["interpolate",["linear"],["zoom"],16.5,.5,18,.6,20,.8],"icon-allow-overlap":!1,"icon-padding":4,"icon-optional":!1,"icon-rotation-alignment":"viewport","icon-pitch-alignment":"viewport","text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],16,["case",["!=",["coalesce",["get","iconId"],""],""],0,17],19,["case",["!=",["coalesce",["get","iconId"],""],""],0,19],20,["case",["!=",["coalesce",["get","iconId"],""],""],0,22]],"text-offset":[0,1.3],"text-anchor":"top","text-optional":!0,"text-padding":4,"text-font":["Noto Sans Bold"],"text-rotation-alignment":"viewport"},paint:{"icon-halo-color":"#FFFFFF","icon-halo-width":1.5,"icon-halo-blur":.5,"text-color":"#242930","text-halo-color":"#FFFFFF","text-halo-width":1.5,"text-halo-blur":1,"icon-translate":[0,-20],"icon-translate-anchor":"viewport"}},{id:"poi-you-are-here-heading",type:"symbol",source:"poi-data",filter:["all",["==",["get","isYouAreHere"],!0],["==",["get","hasHeading"],!0]],minzoom:16,layout:{"text-field":"▲","text-size":["interpolate",["linear"],["zoom"],16,28,18,34,20,42],"text-font":["Noto Sans Bold"],"text-anchor":"bottom","text-offset":[0,-.45],"text-rotate":["get","heading"],"text-rotation-alignment":"map","text-pitch-alignment":"map","text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"text-color":"#face00","text-halo-color":"#162e51","text-halo-width":2.5,"text-opacity":.9}},{id:"poi-you-are-here-ring",type:"circle",source:"poi-data",filter:["==",["get","isYouAreHere"],!0],minzoom:16,paint:{"circle-radius":["interpolate",["linear"],["zoom"],16,14,18,18,20,24],"circle-color":"#face00","circle-opacity":.25,"circle-pitch-alignment":"map"}},{id:"poi-you-are-here-dot",type:"circle",source:"poi-data",filter:["==",["get","isYouAreHere"],!0],minzoom:16,paint:{"circle-radius":["interpolate",["linear"],["zoom"],16,7,18,9,20,12],"circle-color":"#face00","circle-opacity":1,"circle-stroke-color":"#ffffff","circle-stroke-width":3,"circle-stroke-opacity":1}},{id:"poi-you-are-here",type:"symbol",source:"poi-data",filter:["==",["get","isYouAreHere"],!0],minzoom:16,layout:{"text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],16,17,18,19,20,22],"text-offset":[0,-1.8],"text-anchor":"bottom","text-font":["Noto Sans Bold"],"text-allow-overlap":!0,"text-ignore-placement":!0,"text-optional":!1},paint:{"text-color":"#ffffff","text-halo-color":"#162e51","text-halo-width":2.5,"text-halo-blur":.5}},{id:"poi-highlight-ring",type:"circle",source:"poi-highlight-data",paint:{"circle-radius":14,"circle-color":"#005ea2","circle-opacity":.45,"circle-pitch-alignment":"map"}},{id:"poi-highlight-core",type:"circle",source:"poi-highlight-data",paint:{"circle-radius":9,"circle-color":"#005ea2","circle-opacity":1,"circle-stroke-color":"#ffffff","circle-stroke-width":3,"circle-stroke-opacity":1,"circle-pitch-alignment":"map"}}]};const le={"#162e51":"#000000","#263238":"#000000","#c8a85a":"#ffd600","#face00":"#ffd600","#73b3e7":"#1565c0","#97d4ea":"#1976d2","#f2938c":"#c62828","#fee685":"#f9a825","#dfe1e2":"#757575","#faf3e2":"#ffffff","#f0e6d1":"#f5f5f5","#5f9070":"#2e7d32","#3f5d4a":"#1b5e20","#c4c8cb":"#616161","#a9aeb1":"#424242","#6f7780":"#212121","#e8e9ed":"#bdbdbd","#b0b1b5":"#424242","#e6e6e2":"#9e9e9e","#242930":"#000000","#b0b0ad":"#000000","#cfe1ec":"#b3e5fc","#d2e0c6":"#c8e6c9","#cdd9c9":"#a5d6a7","#e0e0e0":"#eeeeee","#cabfb6":"#bcaaa4","#ddd2e0":"#ce93d8","#f3e4c4":"#ffe082","#e0e0dd":"#bdbdbd","#b0b0ad ":"#000000","#bcaaa4":"#5d4037","#757575":"#424242","#616161":"#212121","#007aff":"#0050b3","#ffffff":"#ffffff","#005ea2":"#0050b3"};function ce(e){if(Array.isArray(e))return e.map(ce);if(e&&"object"==typeof e){const t={};for(const[o,i]of Object.entries(e))t[o]=ce(i);return t}return"string"!=typeof(t=e)?t:le[t.toLowerCase()]??t;var t}const de=function(){const e=structuredClone(ae);for(const t of e.layers??[])if(t.paint&&(t.paint=ce(t.paint)),t.paint&&"text-halo-width"in t.paint){const e=t.paint["text-halo-width"];"number"==typeof e&&(t.paint["text-halo-width"]=e+2)}return e}(),ue=ae;function pe(e){return"high-contrast"===e?de:ue}function fe(e,t,o={}){e.sources||={},e.sources[t]||(e.sources[t]={type:"geojson",data:{type:"FeatureCollection",features:[]},...o})}function he(e){let t=structuredClone(e.style);if(t.sprite=e.customSprite||t.sprite||e.defaultSpriteUrl,fe(t,a),fe(t,c),fe(t,l),fe(t,p),fe(t,d,{lineMetrics:!0}),fe(t,"route-endpoints"),e.floorLayers)for(const o of Object.keys(e.floorLayers))fe(t,`amenity_${o}`),fe(t,`destination_${o}`),fe(t,`pathTypes_${o}`);return t}const ge="https://demotiles.maplibre.org/styles/osm-bright-gl-style/sprite";class ye{config;map=null;data=new _;wayfindingProvider;events=new se;floorsApi;venue=null;spriteKeys=null;debug;logger;defaultCamera=null;viewModes;reducedMotion=!1;activeThemeName="default";currentLocale;amenityManager;wayfinding;highlightManager;static POI_CATEGORY_LAYERS=[{id:"poi-destination-circles",category:"destination"},{id:"poi-destination-labels",category:"destination"},{id:"poi-entrance-exit-icons",category:"amenity"},{id:"poi-parking-icons",category:"amenity"},{id:"poi-other-amenity-icons",category:"amenity"}];poiVisibleTypes=null;constructor(e){this.config=e,this.debug=Boolean(e.debug??e.options?.debug),this.logger=g({enabled:this.debug,prefix:"MinuteMapsSDK"}),this.viewModes=new S(()=>this.map),this.reducedMotion=Boolean(e.options?.reducedMotion),this.activeThemeName="high-contrast"===e.options?.theme?"high-contrast":"default",this.currentLocale=e.jmap?.locale,this.wayfindingProvider=new ie({getGraph:()=>this.data.getWayfindingGraph?.()??null,warn:(...e)=>this.logger.warn(...e)}),this.floorsApi=new w({getMap:()=>this.map,getConfig:()=>this.config,updatePoiSource:async e=>{const t=this.map;if(!t)return;const o=this.getAllPOIs(e),i=C.toFeatureCollection(o);s.setData(t,l,i);const n={type:"FeatureCollection",features:(this.venue?.mapLabels?.getByMap?.(e)??[]).filter(e=>Array.isArray(e?.coordinates)).map(e=>({type:"Feature",geometry:{type:"Point",coordinates:e.coordinates},properties:{name:e.name??"",rotation:"number"==typeof e.rotation?e.rotation:0,allLevels:!!e.allLevels}}))};s.setData(t,p,n)},log:(...e)=>this.logger.debug(...e)}),this.amenityManager=new D({getVenue:()=>this.venue,getFloors:()=>this.floorsApi.getFloors(),getFloorById:e=>this.floorsApi.getFloors().find(t=>t.id===e)??null,log:(...e)=>this.logger.debug(...e)}),this.wayfinding=new E({getMap:()=>this.map,getVenue:()=>this.venue,getYouAreHerePOI:e=>this.getYouAreHerePOI(e),getYouAreHereCoordinates:e=>this.getYouAreHereCoordinates(e),getBoundsPadding:()=>this.getBoundsPadding(),computeRoute:async(e,t,o)=>{const i=this.config.jmap.customerId,n=this.config.jmap.venueId;if(null==i)throw new Error("config.jmap.customerId is required");if(null==n)throw new Error("config.jmap.venueId is required");return this.wayfindingProvider.wayfindBetweenWaypoints({customerId:i,venueId:n,from:e,to:t,options:o})},getReducedMotion:()=>this.reducedMotion,log:(...e)=>this.logger.debug(...e),warn:(...e)=>this.logger.warn(...e),debug:this.debug}),this.highlightManager=new N({getMap:()=>this.map,log:(...e)=>this.logger.debug(...e)})}async init(){const{venueId:e,customerId:t}=this.config?.jmap;if(null==e||null==t)throw new Error("config.jmap.customerId and config.jmap.venueId are required");if(!this.config.container)throw new Error("config.container is required (HTMLElement or element id)");this.logger.debug("init :: starting (JACS)",{venueId:e,customerId:t});try{await this.data.init(this.config),this.logger.debug("providers :: JACS ready"),this.venue=await this.data.loadVenue(),this.logger.debug("JACS :: venue loaded",this.venue.id),this.floorsApi.setFloors(this.venue.floors),this.logger.debug("JACS :: floors loaded",{count:this.venue.floors.length});const e=he({style:pe("custom"===this.activeThemeName?"default":this.activeThemeName),customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:ge});this.ensureFloorLayersFromStyle(e),this.map=r(this.config.container,e),await new Promise(e=>this.map.once("load",()=>e())),this.map.on("error",e=>{const t=e?.error?.message||e?.message||e;this.logger.error("map :: error",{msg:t,sourceId:e?.sourceId,tile:e?.tile})}),this.map.on("styledata",()=>{try{this.viewModes.onStyleData()}catch{}}),this.map.on("move",()=>{if(!this.map)return;const e=z(this.map);e&&this.events.emit("cameraChange",{camera:e})}),this.ensureCoreSources(),this.spriteKeys=await F.getSpriteKeys(this.map);try{await A.register(this.map,this.venue?.amenities?.items,{recolorToColor:this.config.options?.amenityIconColor})}catch(e){this.logger.warn("amenity icon registration failed",e)}const t=this.floorsApi.getInitialFloor();Boolean(t?.geojson?.features?.length)||this.applyInitialViewFromVenue(),t&&await this.setCurrentFloor(t),this.applyInitialFraming(),this.defaultCamera=z(this.map),this.events.emit("ready",{venue:this.venue}),this.events.emit("floorsLoaded",{})}catch(e){throw this.logger.error("init :: failed (JACS)",e),this.events.emit("error",{error:e}),e}}on(e,t){this.events.on(e,t)}off(e,t){this.events.off(e,t)}addControl(e,t){this.map?.addControl(e,t)}setView(e){P(this.map,e)}get amenities(){return this.amenityManager}resetView(e){!function(e,t,o){if(!e||!t)return;const{center:i,zoom:n,pitch:r,bearing:s}=t,a=Boolean(o?.animate),l="number"==typeof o?.duration?o.duration:800;a?e.easeTo({center:i,zoom:n,pitch:r,bearing:s,duration:l}):e.jumpTo({center:i,zoom:n,pitch:r,bearing:s})}(this.map,this.defaultCamera,e)}refit(e){if(!this.map)return;const t=this.wayfinding.getActiveRouteBounds();if(t)return void this.fitToBounds(t,e);const o=this.getCurrentFloor();if(!o?.geojson)return;const i=y.boundsFromGeoJson(o.geojson);i&&this.fitToBounds(i,e)}fitToBounds(e,t){const o=this.map;if(o)try{o.fitBounds(e,{padding:this.getBoundsPadding(),bearing:o.getBearing(),pitch:o.getPitch(),animate:t?.animate??!0,duration:t?.duration??600,maxZoom:21})}catch(e){this.logger.warn("refit :: fitBounds failed",e)}}set3dEnabled(e){this.viewModes.set3dEnabled(e)}toggle3d(){this.viewModes.toggle3d()}getIs3dEnabled(){return this.viewModes.getIs3dEnabled()}async setTheme(e){const t=this.map;if(!t)return void this.logger.warn("setTheme :: map not initialized");const o="default"===e?"default":"high-contrast"===e?"high-contrast":"custom";if("custom"!==o&&o===this.activeThemeName)return void this.logger.debug("setTheme :: noop, theme already active",o);const i=e=>{const o=t.getSource(e);return o?._data??null},n=i(a),r=i(c),s=i(l),f=i(p),h=i(d),g=i("route-endpoints"),y=i(u),m=he({style:"custom"===o?e:pe(o),customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:ge});await new Promise((e,i)=>{const w=()=>{try{const i=(e,o)=>{if(null==o)return;const i=t.getSource(e);i?.setData&&i.setData(o)};i(a,n),i(c,r),i(l,s),i(p,f),i(d,h),i("route-endpoints",g),i(u,y),t.off("style.load",w),this.activeThemeName=o,this.events.emit("themeChanged",{theme:o}),this.logger.debug("setTheme :: applied",o),e()}catch(e){this.logger.warn("setTheme :: restore failed",e),i(e)}};t.on("style.load",w),t.setStyle(m,{diff:!1})})}getActiveTheme(){return this.activeThemeName}setReducedMotion(e){this.reducedMotion=Boolean(e)}getReducedMotion(){return this.reducedMotion}async setLocale(e){const t=e||void 0;if(t===this.currentLocale)return void this.logger.debug("setLocale :: noop, locale already active",t);const o=this.data?.applyLocale?.bind(this.data);if("function"!=typeof o)throw new Error("Active data provider does not support runtime locale switching");if(!t)throw new Error("setLocale requires a non-empty locale code");await o(t),this.currentLocale=t;const i=this.floorsApi.getCurrentFloor();if(i&&this.map){const e=this.getAllPOIs(i),t=C.toFeatureCollection(e);s.setData(this.map,l,t)}this.events.emit("localeChanged",{locale:t}),this.logger.debug("setLocale :: applied",t)}getActiveLocale(){return this.currentLocale}setUnits2dEnabled(e){this.viewModes.setUnits2dEnabled(e)}toggleUnits2d(){this.viewModes.toggleUnits2d()}getIsUnits2dEnabled(){return this.viewModes.getIsUnits2dEnabled()}setFlatMode(e){this.viewModes.setFlatMode(e)}toggleFlatMode(){this.viewModes.toggleFlatMode()}getIsFlatMode(){return this.viewModes.getIsFlatMode()}getFloors(){return this.floorsApi.getFloors()}getCurrentFloor(){return this.floorsApi.getCurrentFloor()}getDefaultFloor(){return this.floorsApi.getDefaultFloor()}getDestinations(e){const t=e||this.getCurrentFloor();return function(e,t){if(!e||!t)return[];try{const o=e.destinations?.getByMap?.({id:t.id})||[];return Array.isArray(o)?o:[]}catch{return[]}}(this.venue,t)}getPolygonLayers(){return this.venue?.polygonLayers??[]}getFloorMapTemplate3d(e){return this.venue?.mapTemplates3d?.[String(e)]??[]}getAllPOIs(e){const t=e||this.getCurrentFloor();if(!t)return[];return function(e,t,o,i,n){return C.buildPOIs(e,t,o,i,n)}(t,this.amenityManager.getByFloorId(t.id),this.getDestinations(t),this.spriteKeys,this.venue?.kioskWaypoint)}getYouAreHerePOI(e){return T(this.getAllPOIs(e))}getYouAreHereCoordinates(e){return function(e){const t=T(e);return t?.coordinates??null}(this.getAllPOIs(e))}getKioskHeading(){const e=this.venue?.kioskWaypoint,t=e?.heading;return"number"==typeof t&&Number.isFinite(t)?t:null}recenterOnKiosk(e){const t=this.map;if(!t)return;const o=this.getYouAreHereCoordinates();if(!o)return void this.logger.warn("recenterOnKiosk :: no You-Are-Here coordinates available");const i=(e?.animate??!0)&&!this.reducedMotion,n=i?e?.duration??600:0,r=!1!==e?.useHeading?this.getKioskHeading():null;P(t,{center:o,zoom:e?.zoom,pitch:e?.pitch,bearing:r??void 0,animate:i,duration:n})}searchPOIs(e,t){return function(e,t){const o=t.trim().toLowerCase();return o?e.filter(e=>{const t=e.name?.toLowerCase().includes(o),i=(e.keywords||[]).some(e=>e.toLowerCase().includes(o));return t||i}):[]}(this.getAllPOIs(t),e)}searchAllPOIs(e){const t=e?.trim();return t?this.getFloors().flatMap(e=>this.searchPOIs(t,e)):[]}async wayfindBetweenWaypoints(e,t,o){return this.wayfinding.wayfindBetweenWaypoints(e,t,o)}async navigateFromKioskToDestination(e){return this.wayfinding.navigateFromKioskToDestination(e)}async navigateFromKioskToPOI(e,t){const o=e?.waypoint;if(!o)return void this.logger.warn("navigateFromKioskToPOI :: POI has no waypoint",e);const i=this.getYouAreHerePOI()?.waypoint;if(i)return this.wayfinding.wayfindBetweenWaypoints(i,o,{centerMode:"route",accessible:t?.accessible,avoidStairs:t?.avoidStairs});this.logger.warn("navigateFromKioskToPOI :: no kiosk waypoint available")}clearRoute(){this.wayfinding.clearRoute()}async highlightPOI(e){let t=null,o=null;for(const i of this.getFloors()){const n=this.getAllPOIs(i).find(t=>String(t.id)===String(e));if(n){t=n,o=i;break}}t&&o?(String(this.getCurrentFloor()?.id)!==String(o.id)&&await this.setCurrentFloor(o),this.setView({center:t.coordinates,animate:!0,duration:600}),this.highlightManager.highlight(t.coordinates)):this.logger.warn("highlightPOI :: no POI found for id",e)}clearHighlight(){this.highlightManager.clear()}setPOIFilter(e){this.poiVisibleTypes=new Set(e),this.applyPOIFilter()}clearPOIFilter(){this.poiVisibleTypes=null,this.applyPOIFilter()}applyPOIFilter(){const e=this.map;if(!e)return;const t=this.poiVisibleTypes;for(const{id:o,category:i}of ye.POI_CATEGORY_LAYERS){if(!e.getLayer(o))continue;const n=null===t||t.has(i);e.setLayoutProperty(o,"visibility",n?"visible":"none")}}findClosestWaypoint(e,t){if(!e?.length)return null;const o=t??this.getYouAreHereCoordinates();if(!o)return e.find(e=>Array.isArray(e.coordinates)&&e.coordinates.length>=2)??null;let i=null,n=1/0;for(const t of e){const e=t.coordinates;if(!Array.isArray(e)||e.length<2)continue;const r=e[0]-o[0],s=e[1]-o[1],a=r*r+s*s;a<n&&(n=a,i=t)}return i}async highlightAmenity(e){const t=this.amenityManager.getDistinct().find(t=>String(t.id)===String(e));if(!t||!t.waypoints?.length)return void this.logger.warn("highlightAmenity :: no waypoints for amenity",e);const o=this.findClosestWaypoint(t.waypoints);if(!o||!Array.isArray(o.coordinates)||o.coordinates.length<2)return void this.logger.warn("highlightAmenity :: no usable waypoint",e);const i=this.findFloorForWaypoint(o);i&&String(this.getCurrentFloor()?.id)!==String(i.id)&&await this.setCurrentFloor(i);const n=[o.coordinates[0],o.coordinates[1]];this.setView({center:n,animate:!0,duration:600}),this.highlightManager.highlight(n)}findFloorForWaypoint(e){const t=e.mapId;return null==t?null:this.getFloors().find(e=>{const o=e.mapId??e.id;return String(o)===String(t)})??null}getCameraPosition(){return z(this.map)}getMap(){return this.map}destroy(){this.highlightManager.destroy(),this.map?.remove(),this.map=null,this.floorsApi.setFloors([]),this.defaultCamera=null,this.viewModes=new S(()=>this.map)}async setCurrentFloor(e){await this.data.ensureFloorGeojson(e),await this.floorsApi.setCurrentFloor(e),this.setFloorLayerVisibility(e.id),this.events.emit("floorChanged",{floor:e})}isReady(){return!!this.map}setFloorLayerVisibility(e){const t=this.map;if(!t)return;const o=this.venue?.styleSheet?.floorLayers;if(o)for(const[i,n]of Object.entries(o)){const o=String(i)===String(e);for(const e of n)t.getLayer(e.id)&&t.setLayoutProperty(e.id,"visibility",o?"visible":"none")}}getBoundsPadding(){const e=this.config.options?.boundsPadding??50;if("number"==typeof e||!this.map)return e;const t=this.map.getContainer();return this.clampPadding(e,t.clientWidth,t.clientHeight)}clampPadding(e,t,o){const i=(e,t,o)=>{if(!(o>0))return[e,t];const i=.8*o,n=e+t;if(n<=i)return[e,t];const r=i/n;return[e*r,t*r]},[n,r]=i(e.top,e.bottom,o),[s,a]=i(e.left,e.right,t);return{top:n,bottom:r,left:s,right:a}}getVenueBounds(){const e=this.venue?.coordinates;if(!e)return null;const{bottomLng:t,bottomLat:o,topLng:i,topLat:n}=e;if(null==t||null==o||null==i||null==n)return null;const r=Math.min(t,i),s=Math.max(t,i);return[[r,Math.min(o,n)],[s,Math.max(o,n)]]}applyInitialFraming(){const e=this.map;if(!e)return;const{initialPitch:t,initialZoom:o,minZoomBelowInitialFit:i}=this.config.options??{},n=this.getYouAreHereCoordinates();("number"==typeof t||"number"==typeof o||n)&&e.easeTo({center:n??e.getCenter(),zoom:"number"==typeof o?o:e.getZoom(),pitch:"number"==typeof t?t:e.getPitch(),bearing:e.getBearing(),duration:0}),"number"==typeof i&&e.setMinZoom(Math.max(0,e.getZoom()-i))}applyInitialViewFromVenue(){const e=this.map;if(!e)return;const t=this.getVenueBounds();if(t)try{e.resize(),e.fitBounds(t,{padding:this.getBoundsPadding(),animate:!1,duration:0,maxZoom:21})}catch(e){this.logger.warn("applyInitialViewFromVenue :: fitBounds failed",e)}}async loadAndPatchVenueStyle(){const e=this.venue?.styleSheet?.styleUrl,t=this.venue?.styleSheet?.floorLayers,o=ue;if("sdkTemplate"===this.config.options?.styleMode)return this.logger.debug("style :: styleMode=sdkTemplate, ignoring venue styleUrl"),he({style:o,floorLayers:t,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:ge});if(!e)return this.logger.warn("style :: venue.styleSheet.styleUrl missing, using baseStyle"),he({style:o,floorLayers:t,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:ge});try{const o=await fetch(e);if(!o.ok)throw new Error(`HTTP ${o.status} ${o.statusText}`);return he({style:await o.json(),floorLayers:t,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:ge})}catch(e){return this.logger.warn("style :: failed to fetch venue styleUrl, using baseStyle",e),he({style:o,floorLayers:t,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:ge})}}ensureFloorLayersFromStyle(e){const t=this.venue?.styleSheet?.floorLayers;if(t&&Object.keys(t).length)return;const o={};for(const t of e.layers||[]){const e=t.id||"",i=/_(\d+)$/.exec(e);if(!i)continue;const n=i[1];o[n]||=[],o[n].push({id:e})}this.venue||={},this.venue.styleSheet||={},this.venue.styleSheet.floorLayers=o}ensureCoreSources(){const e=this.map;if(!e)return;const t={type:"FeatureCollection",features:[]};s.ensureGeoJson(e,a),s.ensureGeoJson(e,c),s.ensureGeoJson(e,l),s.ensureGeoJson(e,u),e.getSource(d)||e.addSource(d,{type:"geojson",data:t,lineMetrics:!0}),e.getSource("route-endpoints")||e.addSource("route-endpoints",{type:"geojson",data:t})}}exports.MinuteMaps=ye,exports.createMinuteMapsSDK=function(e){return new ye(e)};
1
+ "use strict";var t=require("maplibre-gl"),e=require("pmtiles");function o(t){var e=Object.create(null);return t&&Object.keys(t).forEach(function(o){if("default"!==o){var i=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:function(){return t[o]}})}}),e.default=t,Object.freeze(e)}var i=o(require("@turf/turf"));let n=!1;function r(o,i){const r="string"==typeof o?document.getElementById(o):o;if(!r)throw new Error("Map container not found");return function(){if(n)return;const o=new e.Protocol;t.addProtocol("pmtiles",o.tile),n=!0}(),new t.Map({container:r,style:i,center:[0,0],zoom:16,pitch:45,bearing:0,minPitch:30,maxPitch:55})}const s={ensureGeoJson(t,e){t.getSource(e)||t.addSource(e,{type:"geojson",data:{type:"FeatureCollection",features:[]}})},setData(t,e,o){const i=t.getSource(e);i?.setData?.(o)}},a="indoor-data",l="poi-data",c="unit-walls",d="route-data",u="poi-highlight-data",p="map-labels-data",f="route-active-step",h=["boundary-fill","boundary-outline","units-fill","units-wall-extrusion","units-wall-custom-extrusion","corridors-fill","corridors-outline","building-extrusion"],g=()=>{};function y(t){const e=Boolean(t?.enabled),o=function(t){const e=String(t||"").trim();return e?`[${e}]`:""}(t?.prefix||"MinuteMapsSDK");return e?{debug:(...t)=>console.debug(o,...t),log:(...t)=>console.log(o,...t),warn:(...t)=>console.warn(o,...t),error:(...t)=>console.error(o,...t)}:{debug:g,log:g,warn:g,error:g}}y({enabled:!0,prefix:"MinuteMapsSDK"});const m={applyFloor(t,e,o=1){m.updateWalls(t,e,o),m.updateIndoor(t,e,o)},updateIndoor(t,e,o=1){const n=function(t,e){if(!t)return{type:"FeatureCollection",features:[]};if(!Number.isFinite(e)||e<=0)return t;const o=(t.features||[]).map(t=>{const o=t?.properties?.featureType;if(!o||!w.has(o))return t;const n=t?.geometry?.type;if("Polygon"!==n&&"MultiPolygon"!==n)return t;try{const o=i.buffer(t,-e,{units:"feet"});return o?.geometry?{...t,geometry:o.geometry}:t}catch{return t}});return{...t,features:o}}(e.geojson,o);s.setData(t,a,n);try{const t=e?.geojson?.features||[],o={};for(const e of t){const t=e?.properties?.featureType,i=null==t?"(missing)":String(t);o[i]=(o[i]||0)+1}Object.entries(o).sort((t,e)=>e[1]-t[1]).slice(0,15)}catch{}},updateWalls(t,e,o=1){const n=function(t,e=1){const o=Math.max(Number(e)||1,.5)/2,n=t=>{try{return i.cleanCoords(t)}catch{return t}},r=t=>{const e=t?.geometry?.type;if("Polygon"!==e&&"MultiPolygon"!==e)return null;try{const e=n(t),r=i.buffer(e,-o,{units:"feet"});if(!r?.geometry)return null;const s=i.area(e),a=i.area(r);if(!Number.isFinite(s)||s<=0)return null;if(a>=s)return null;const l=i.difference(i.featureCollection([e,r]));return l?.geometry?l:null}catch{return null}},s=t=>{if(0===t.length)return null;if(1===t.length)return t[0];try{return i.union(i.featureCollection(t))}catch{return null}},a=[];let l=null;for(const e of t.features||[]){const t=e?.properties?.featureType,o=e?.geometry?.type;if("Polygon"===o||"MultiPolygon"===o)if("Boundary"!==t||l){if("Units"===t){const t=r(e);t&&a.push(t)}}else l=r(e)}const c=s(a);let d=c;if(c?.geometry&&l?.geometry)try{const t=i.difference(i.featureCollection([c,l]));t?.geometry&&(d=t)}catch{}const u=[];l?.geometry&&u.push({type:"Feature",geometry:l.geometry,properties:{featureType:"UnitWalls",wallKind:"perimeter"}});d?.geometry&&u.push({type:"Feature",geometry:d.geometry,properties:{featureType:"UnitWalls",wallKind:"interior"}});return{type:"FeatureCollection",features:u}}(e.geojson,o);s.setData(t,c,n)},boundsFromGeoJson(t){try{const[e,o,n,r]=i.bbox(t),s=Math.min(e,n),a=Math.max(e,n),l=Math.min(o,r);return[[s,l],[a,Math.max(o,r)]]}catch{return null}},selectDefaultFloor:t=>Array.isArray(t)&&0!==t.length&&(t.find(t=>t.isDefault)||t[0])||null,selectInitialFloor(t,e){if(!Array.isArray(t)||0===t.length)return null;if(null!=e){const o=t.find(t=>t.id===e);if(o)return o}return m.selectDefaultFloor(t)},async activateFloor(t,e,o){if(!t)throw new Error("activateFloor requires an initialized map");if(e?.geojson&&m.applyFloor(t,e,o.wallFeet),await o.updatePOIs(e),!e?.geojson)return void(t.getZoom()<o.minIndoorZoom&&t.setZoom(o.minIndoorZoom));const i=m.boundsFromGeoJson(e.geojson);if(!i)return;const n=!o.didFit;let r=n;if(!r){const[[e,o],[n,s]]=i,a=t.getBounds();r=a.getWest()>n||a.getEast()<e||a.getSouth()>s||a.getNorth()<o}r?(t.fitBounds(i,{padding:o.boundsPadding,animate:!n,duration:700,bearing:t.getBearing(),pitch:t.getPitch()}),t.once("moveend",()=>{t.getZoom()<o.minIndoorZoom&&t.setZoom(o.minIndoorZoom)}),o.setDidFit(!0),o.log?.("camera :: fitToFloor",{floorId:e.id,animated:!n})):(t.getZoom()<o.minIndoorZoom&&t.setZoom(o.minIndoorZoom),o.log?.("camera :: fit skipped (floor overlaps viewport)",{floorId:e.id}))}},w=new Set(["Restrooms","Back-of-house","Obstacles","Escalators","Stairs","Elevators"]);class b{floors=[];currentFloor=null;didFit=!1;getMap;getConfig;updatePoiSource;logFn;constructor(t){this.getMap=t.getMap,this.getConfig=t.getConfig,this.updatePoiSource=t.updatePoiSource,this.logFn=t.log}log(...t){this.logFn&&this.logFn(...t)}setFloors(t){this.floors=t}getFloors(){return[...this.floors]}getCurrentFloor(){return this.currentFloor}setDidFit(t){this.didFit=t}getDefaultFloor(){return m.selectDefaultFloor(this.floors)}getInitialFloor(){const t=this.getConfig();return m.selectInitialFloor(this.floors,t.options?.initialFloor)}async setCurrentFloor(t){const e=this.getMap();if(!e)throw new Error("Map is not initialized");this.currentFloor=t,this.log("floor :: setCurrentFloor",{id:t.id,name:t.name,geojsonFeatures:t.geojson?.features?.length??0});const o=this.getConfig(),i=o.options?.wallThickness??1,n=o.options?.boundsPadding??50,r=o.options?.minIndoorZoom??16.5;await m.activateFloor(e,t,{wallFeet:i,updatePOIs:t=>this.updatePoiSource(t),didFit:this.didFit,setDidFit:t=>{this.didFit=t},boundsPadding:n,minIndoorZoom:r,log:(t,e)=>this.log(t,e)})}}const I=y({enabled:!0,prefix:"MinuteMapsSDK"}),v=new Map,F={async getSpriteKeys(t){const e=function(t){if(!t)return;if("string"==typeof t)return t;if(Array.isArray(t)){const e=t[0];if(e&&"string"==typeof e.url)return e.url}if("object"==typeof t&&null!==t){const e=t?.url;if("string"==typeof e)return e}return}(t?.getStyle?.()?.sprite);if(!e||"function"!=typeof fetch)return new Set;const o=e.endsWith(".json")?e:`${e}.json`;if(v.has(o))return v.get(o);try{const t=await fetch(o);if(!t.ok)throw new Error(`Failed to load sprite JSON (${t.status})`);const e=await t.json(),i=new Set(Object.keys(e||{}));return v.set(o,i),i}catch(t){I.warn("sprite fetch failed",o,t);const e=new Set;return v.set(o,e),e}}};const x=y({enabled:!0,prefix:"MinuteMapsSDK amenityIcons"});async function A(t,e,o){let i;if(t.inlineSvg)i=t.inlineSvg;else{if(!t.url)throw new Error("loadSvgElement: neither url nor inlineSvg provided");{const e=await fetch(t.url,{mode:"cors"});if(!e.ok)throw new Error(`HTTP ${e.status}`);i=await e.text()}}let n=i;try{const t=(new DOMParser).parseFromString(i,"image/svg+xml"),r=t.documentElement;!(t.getElementsByTagName("parsererror").length>0)&&r&&"svg"===r.nodeName.toLowerCase()&&(r.hasAttribute("width")||r.setAttribute("width",String(e)),r.hasAttribute("height")||r.setAttribute("height",String(e)),o&&function(t,e){const o=t.getAttribute("fill"),i="none"===o||"transparent"===o,n=[t,...Array.from(t.querySelectorAll("*"))];for(const t of n){const o=t.getAttribute("fill");"none"===o||"transparent"===o||(o||!i&&/^(path|circle|rect|polygon|polyline|ellipse|g|use|symbol)$/i.test(t.tagName))&&t.setAttribute("fill",e);const n=t.getAttribute("stroke");n&&"none"!==n&&"transparent"!==n&&t.setAttribute("stroke",e);const r=t.getAttribute("style");r&&t.setAttribute("style",r.replace(/fill:\s*(?!none|transparent)[^;]+;?/gi,`fill: ${e};`).replace(/stroke:\s*(?!none|transparent)[^;]+;?/gi,`stroke: ${e};`))}}(r,o),n=(new XMLSerializer).serializeToString(r))}catch{}const r=new Blob([n],{type:"image/svg+xml"}),s=URL.createObjectURL(r);return new Promise((t,e)=>{const o=new Image;o.onload=()=>{URL.revokeObjectURL(s),t(o)},o.onerror=t=>{URL.revokeObjectURL(s),e(t)},o.src=s})}const k={async register(t,e,o={}){if(!Array.isArray(e)||0===e.length)return;const i=o.size??64,n="object"==typeof o.badge&&null!==o.badge?o.badge:void 0,r=!1===o.badge?null:{color:n?.color??"#fdb81e",ringColor:n?.ringColor??"#FFFFFF",ringWidth:n?.ringWidth??2},s=o.iconColor??(r?"#162e51":void 0);await Promise.all(e.map(async e=>{const n=e.svg,a=n?null:function(t,e){const o=t?.uris;if(!Array.isArray(o)||0===o.length)return null;const i=t=>"image/svg+xml"===t?.mimeType||"svg-icon"===t?.resourceType,n=t=>{if(!Array.isArray(t)||0===t.length)return null;if(e){const o=t.find(t=>t?.locale===e);if(o?.uriPath)return o.uriPath}return t.find(t=>t?.uriPath)?.uriPath??null};for(const t of o){if(!i(t))continue;const e=n(t.locales);if(e)return e}for(const t of o){const e=n(t?.locales);if(e)return e}return null}(e,o.preferredLocale);if(!n&&!a)return;const l=e.iconId??`amenity-${e.id}`;if(t.hasImage(l))e.iconId=l;else try{const o=await async function(t,e,o){const i=2*e,n=await A(t,i,o.iconColor),r=document.createElement("canvas");r.width=i,r.height=i;const s=r.getContext("2d");if(!s)throw new Error("2d canvas context unavailable");if(o.badge){const t=i/2,e=i/2,r=2*o.badge.ringWidth,a=i/2-.5,l=Math.max(0,a-r);s.fillStyle=o.badge.ringColor,s.beginPath(),s.arc(t,e,a,0,2*Math.PI),s.fill(),s.fillStyle=o.badge.color,s.beginPath(),s.arc(t,e,l,0,2*Math.PI),s.fill();const c=Math.floor(1.7*l),d=(i-c)/2,u=(i-c)/2;s.drawImage(n,d,u,c,c)}else s.drawImage(n,0,0,i,i);return s.getImageData(0,0,i,i)}({url:a??void 0,inlineSvg:n??void 0},i,{iconColor:s,badge:r});t.hasImage(l)||t.addImage(l,o,{pixelRatio:2}),e.iconId=l}catch(t){x.warn("icon load failed",{amenityId:e.id,url:a,error:t?.message??String(t)})}}))}},M="poi-you-are-here-ring",S=[[16,14],[18,18],[20,24]];class C{map=null;rafId=null;startedAt=0;active=!1;start(t,e){this.active||e?.reducedMotion||(this.map=t,this.startedAt=performance.now(),this.active=!0,this.tick())}stop(){this.active=!1,null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null);const t=this.map;if(this.map=null,t)try{t.getLayer(M)&&(t.setPaintProperty(M,"circle-radius",void 0),t.setPaintProperty(M,"circle-opacity",void 0))}catch{}}tick=()=>{if(!this.active)return;const t=this.map;if(!t)return;const e=(performance.now()-this.startedAt)%2e3/2e3,o=.5-.5*Math.cos(e*Math.PI*2),i=function(t){const e=S;if(t<=e[0][0])return e[0][1];if(t>=e[e.length-1][0])return e[e.length-1][1];for(let o=1;o<e.length;o++){const[i,n]=e[o-1],[r,s]=e[o];if(t<=r)return n+(t-i)/(r-i)*(s-n)}return e[e.length-1][1]}(t.getZoom()),n=1+.55*o,r=.4-.25*o;try{t.getLayer(M)&&(t.setPaintProperty(M,"circle-radius",i*n),t.setPaintProperty(M,"circle-opacity",r))}catch{}this.rafId=requestAnimationFrame(this.tick)}}const P="units-outline-2d",T=["units-wall-extrusion","units-wall-custom-extrusion"];class z{getMap;is3dEnabled=!0;isUnits2dEnabled=!1;isFlatMode=!1;cachedExtrusionIds=null;extrusionOriginalVisibility=null;unitsExtrusionOriginalVisibility=null;unitsOutlineOriginalVisibility=null;constructor(t){this.getMap=t}onStyleData(){if(this.map){if(this.cachedExtrusionIds=null,!this.is3dEnabled){const t=this.listExtrusionLayerIds();this.setLayersVisibility(t,"none")}this.isUnits2dEnabled&&this.applyUnits2dVisibility(!0)}}set3dEnabled(t){const e=this.map;if(!e)return;const o=this.listExtrusionLayerIds();if(this.cachedExtrusionIds=o,!this.extrusionOriginalVisibility){const t={};o.forEach(o=>{try{const i=e.getLayoutProperty(o,"visibility")||"visible";t[o]=i}catch{t[o]="visible"}}),this.extrusionOriginalVisibility=t}if(t){const t=this.extrusionOriginalVisibility||{};o.forEach(o=>{const i=t[o]??"visible";try{e.getLayer(o)&&e.setLayoutProperty(o,"visibility",i)}catch{}})}else this.setLayersVisibility(o,"none");this.is3dEnabled=t,e.triggerRepaint()}toggle3d(){this.set3dEnabled(!this.is3dEnabled)}getIs3dEnabled(){return this.is3dEnabled}setUnits2dEnabled(t){const e=this.map;e&&(this.applyUnits2dVisibility(t),this.isUnits2dEnabled=t,e.triggerRepaint())}toggleUnits2d(){this.setUnits2dEnabled(!this.isUnits2dEnabled)}getIsUnits2dEnabled(){return this.isUnits2dEnabled}setFlatMode(t){this.map&&(t?(this.set3dEnabled(!1),this.setUnits2dEnabled(!0)):(this.setUnits2dEnabled(!1),this.set3dEnabled(!0)),this.isFlatMode=t)}toggleFlatMode(){this.setFlatMode(!this.isFlatMode)}getIsFlatMode(){return this.isFlatMode}applyUnits2dVisibility(t){const e=this.map;if(e){if(!this.unitsExtrusionOriginalVisibility){const t={};T.forEach(o=>{try{const i=e.getLayoutProperty(o,"visibility")||"visible";t[o]=i}catch{t[o]="visible"}}),this.unitsExtrusionOriginalVisibility=t}if(null==this.unitsOutlineOriginalVisibility)try{const t=e.getLayoutProperty(P,"visibility");this.unitsOutlineOriginalVisibility=t??"none"}catch{this.unitsOutlineOriginalVisibility="none"}if(e.getLayer(P)){const o=t?"visible":this.unitsOutlineOriginalVisibility??"none";try{e.setLayoutProperty(P,"visibility",o)}catch{}}if(t)T.forEach(t=>{if(e.getLayer(t))try{e.setLayoutProperty(t,"visibility","none")}catch{}});else{const t=this.unitsExtrusionOriginalVisibility||{};T.forEach(o=>{const i=t[o]??"visible";if(e.getLayer(o))try{e.setLayoutProperty(o,"visibility",i)}catch{}})}}}listExtrusionLayerIds(){const t=this.map;if(!t)return[];try{const e=t.getStyle(),o=e?.layers||[],i=o.filter(t=>"fill-extrusion"===t?.type).map(t=>t.id),n=Array.isArray(h)?h:[],r=[];return n.forEach(t=>{const e=o.find(e=>e.id===t);e&&"fill-extrusion"===e.type&&r.push(t)}),[...new Set([...i,...r])]}catch{return this.cachedExtrusionIds||[]}}setLayersVisibility(t,e){const o=this.map;o&&t.forEach(t=>{try{o.getLayer(t)&&o.setLayoutProperty(t,"visibility",e)}catch{}})}get map(){return this.getMap()}}function L(t,e){if(!t)return;const{center:o,zoom:i,pitch:n,bearing:r,animate:s,duration:a}=e;if(s){const e=t.getCenter(),s=o||[e.lng,e.lat],l=i??t.getZoom(),c=n??t.getPitch(),d=r??t.getBearing(),u="number"==typeof a?a:900;return void t.flyTo({center:s,zoom:l,pitch:c,bearing:d,duration:u,essential:!0})}o&&t.setCenter(o),void 0!==i&&t.setZoom(i),void 0!==n&&t.setPitch(n),void 0!==r&&t.setBearing(r)}function j(t){if(!t)return null;const e=t.getCenter(),o=(t,e=6)=>function(t,e=6){const o=Number(t.toFixed(e));return Object.is(o,-0)?0:o}(t,e);return{center:[o(e.lng),o(e.lat)],zoom:o(t.getZoom(),4),pitch:o(t.getPitch(),2),bearing:o(t.getBearing(),2)}}const B={async updatePOIs(t,e,o){const[i,n]=await Promise.all([o.getAmenities(e.id),o.getDestinations(e.id)]),r=B.buildPOIs(e,i,n,o.spriteKeys);s.setData(t,l,B.toFeatureCollection(r))},buildPOIs(t,e=[],o=[],i,n){if(!t?.id)return[];const r=t.mapId??t.id,s=[];for(const o of e||[]){if(!o.waypoints)continue;const e=o.iconId||O(o.svg,i)||void 0;for(const i of o.waypoints||[]){if(i.mapId!==r||!R(i.coordinates))continue;const[n,a]=i.coordinates,l=i.id??i._?.id;s.push({id:o.id,type:"amenity",name:o.name||"Amenity",coordinates:[n,a],iconId:e,floorId:t.id,amenityType:o.type,keywords:o.keywords||[],showLabel:!0,waypointId:l,waypoint:i})}}for(const e of o||[])if(e.waypoints)for(const o of e.waypoints||[]){if(o.mapId!==r||!R(o.coordinates))continue;const[i,n]=o.coordinates,a=o.id??o._?.id;s.push({id:e.id,type:"destination",name:e.name||"Destination",coordinates:[i,n],floorId:t.id,showLabel:!0,waypointId:a,waypoint:o})}return n&&String(n.floorId)===String(t.id)&&R(n.coordinates)&&s.push({id:"kiosk-you-are-here",type:"kiosk",name:"You are here",coordinates:n.coordinates,iconId:"YouAreHere",floorId:t.id,showLabel:!0,isYouAreHere:!0,heading:n.heading??null,waypointId:n.waypointId,waypoint:n.waypoint}),s},toFeatureCollection:t=>({type:"FeatureCollection",features:t.map(t=>{const e=t.heading;return{type:"Feature",geometry:{type:"Point",coordinates:t.coordinates},properties:{id:t.id,name:t.name,poiType:t.type,iconId:t.iconId,floorId:t.floorId,keywords:t.keywords,amenityType:t.amenityType,showLabel:!1!==t.showLabel,isYouAreHere:!0===t.isYouAreHere,heading:"number"==typeof e?e:null,hasHeading:"number"==typeof e}}})})};function E(t){return t.find(t=>t.isYouAreHere)||null}function R(t){return Array.isArray(t)&&t.length>=2}function O(t,e){if(!t||!e)return null;const o=/<svg[^>]*\bid\s*=\s*["']([^"']+)["']/i.exec(t),i=o?.[1];return i&&e.has(i)?i:null}function U(t){const e=t=>(t??"").toLowerCase(),o=e(t.name),i=(t.keywords||[]).map(t=>e(t)),n=t.extensors||{},r=e(n.type),s="kiosk"===o||o.includes("kiosk"),a=i.some(t=>t.includes("kiosk"));return s||a||"assistance"===r}class ${deps;routeAnimationFrame=null;routeAnimationStart=null;routeAnimationDurationMs=1200;routeActive=!1;routeBounds=null;lastRoutePoints=[];lastRouteFloorIds=[];routeCoordsByFloor=new Map;constructor(t){this.deps=t}buildWayfindFeatureCollection(t){if(!t)return this.deps.warn?.("wayfind :: no result"),null;const e=H(t);if(e.length<2)return this.deps.warn?.("wayfind :: not enough coordinates to draw a route",{extractedCount:e.length}),null;const o=[];let i=null;for(const t of e){const e="number"==typeof t.mapId?t.mapId:null;i&&i.floorId===e?i.coords.push(t.coordinates):(i={floorId:e,coords:[t.coordinates]},o.push(i))}const n=[];for(let t=0;t<o.length;t++){const e=o[t];if(e.coords.length<2)continue;const i={segmentIndex:t,totalSegments:o.length};null!=e.floorId&&(i.floorId=e.floorId),n.push({type:"Feature",geometry:{type:"LineString",coordinates:e.coords},properties:i})}return 0===n.length?(this.deps.warn?.("wayfind :: every floor segment was < 2 points",{segmentCount:o.length}),null):(this.deps.log?.("wayfind :: extracted segments",{featureCount:n.length,floorIds:n.map(t=>t.properties?.floorId),pointCount:e.length}),{type:"FeatureCollection",features:n})}async wayfindBetweenWaypoints(t,e,o){const i=this.deps.getMap();if(!this.deps.getVenue()||!i)return this.deps.warn?.("wayfindBetweenWaypoints :: venue or map not ready"),null;const n={accessible:o?.accessible,avoidStairs:o?.avoidStairs};let r=null;try{r=await this.deps.computeRoute(t,e,n)}catch(t){return this.deps.warn?.("wayfind :: computeRoute failed",t),null}this.deps.log?.("wayfind :: result",r);const a=this.buildWayfindFeatureCollection(r);if(!a)return r;s.setData(i,d,a),this.routeBounds=function(t){let e=1/0,o=1/0,i=-1/0,n=-1/0,r=!1;for(const s of t.features)if("LineString"===s.geometry?.type)for(const[t,a]of s.geometry.coordinates)r=!0,t<e&&(e=t),t>i&&(i=t),a<o&&(o=a),a>n&&(n=a);return r?[[e,o],[i,n]]:null}(a),this.lastRoutePoints=H(r),this.lastRouteFloorIds=(a.features||[]).map(t=>t.properties?.floorId??null),this.routeCoordsByFloor.clear();for(const t of a.features){if("LineString"!==t.geometry?.type)continue;const e=t.geometry.coordinates;if(!Array.isArray(e)||0===e.length)continue;const o=t.properties?.floorId,i="number"==typeof o?o:null,n=this.routeCoordsByFloor.get(i);n?n.push(...e):this.routeCoordsByFloor.set(i,e.slice())}this.deps.log?.("wayfind :: route source updated",{featureCount:a.features.length}),this.startRouteAnimation();const l=o?.centerMode??"route",c=o?.zoom??19,u=!0===this.deps.getReducedMotion?.();if("destination"===l){const t=[];for(const e of a.features)if("LineString"===e.geometry?.type&&Array.isArray(e.geometry.coordinates))for(const o of e.geometry.coordinates)t.push(o);if(t.length>=2){const e=t[t.length-1];i.flyTo({center:e,zoom:c,pitch:45,bearing:0,animate:!u,duration:u?0:900})}}else"route"===l&&this.fitRouteCamera(!0);return r}refitActiveFloorRoute(t){this.routeActive&&this.fitRouteCamera(!1!==t?.animate)}hasActiveRoute(){return this.routeActive}fitRouteCamera(t){const e=this.deps.getMap();if(!e)return;const o=this.deps.getCurrentFloor?.()??null,i=o&&"number"==typeof o.mapId?Number(o.mapId):o&&"number"==typeof o.id?Number(o.id):null,n=this.routeCoordsByFloor.get(null)??[],r=null!=i?this.routeCoordsByFloor.get(i)??[]:[];let s=r.length>=2?r.concat(n):[];if(s.length<2){s=[];for(const t of this.routeCoordsByFloor.values())s.push(...t)}if(s.length<2)return;const a=s.map(t=>t[0]),l=s.map(t=>t[1]),c=[[Math.min(...a),Math.min(...l)],[Math.max(...a),Math.max(...l)]];e.setMinPitch(0);const d=this.deps.getKioskHeading?.()??0,u=this.deps.getBoundsPadding();let p=null,f=0;for(const t of[1,.66,.4,.2,0])if(p=e.cameraForBounds(c,{padding:N(u,t),bearing:d}),p){f=t;break}const h=e.getContainer();this.deps.log?.("wayfind :: route fit",{activeFloorMapId:i,scopedToActiveFloor:r.length>=2,targetBearing:d,requestedPadding:u,paddingScaleApplied:f,canvas:[h.clientWidth,h.clientHeight],camera:p?{zoom:p.zoom}:"no fit at any padding"});const g=!0===this.deps.getReducedMotion?.(),y=t&&!g?800:0;p?e.easeTo({center:p.center,zoom:p.zoom-D,bearing:d,pitch:0,duration:y}):e.easeTo({pitch:0,bearing:d,duration:y})}async navigateFromKioskToDestination(t){const e=this.deps.getMap(),o=this.deps.getVenue();if(!e||!o)return null;const i=this.deps.getYouAreHerePOI();if(!i||!i.waypoint)return this.deps.warn?.("navigateFromKioskToDestination :: no you-are-here waypoint available",i),null;const n=t.waypoint||t.waypoints?.[0];if(!n)return this.deps.warn?.("navigateFromKioskToDestination :: destination has no waypoint",t),null;this.deps.log?.("navigateFromKioskToDestination :: from kiosk to destination",{kioskWaypoint:i.waypoint,destWaypoint:n});const r=this.deps.getYouAreHereCoordinates()??i.waypoint?.coordinates,s=n.coordinates||n.xyz||n._?.coordinates,a=Array.isArray(s)&&s.length>=2?[Number(s[0]),Number(s[1])]:null;return r&&a?this.showRouteContext(r,a):this.deps.warn?.("navigateFromKioskToDestination :: could not derive endpoint coordinates",{fromCoords:r,rawDest:s}),this.wayfindBetweenWaypoints(i.waypoint,n,{centerMode:"route"})}getLastRoutePoints(){return this.lastRoutePoints}getLastRouteFloorIds(){return this.lastRouteFloorIds}clearRoute(){const t=this.deps.getMap();if(!t)return;this.stopRouteAnimation();if(s.setData(t,d,{type:"FeatureCollection",features:[]}),this.routeBounds=null,this.lastRoutePoints=[],this.lastRouteFloorIds=[],this.routeCoordsByFloor.clear(),t.getMinPitch()<30){t.setMinPitch(30);const e=!0===this.deps.getReducedMotion?.();t.easeTo({pitch:45,duration:e?0:400})}this.deps.log?.("wayfind :: route cleared")}getActiveRouteBounds(){return this.routeActive?this.routeBounds:null}setPoiLayersVisible(t){const e=this.deps.getMap();if(!e)return;const o=t?"visible":"none";["poi-accessibility-icons","poi-destination-circles","poi-destination-labels","poi-entrance-exit-icons","poi-parking-icons","poi-other-amenity-icons"].forEach(t=>{e.getLayer(t)&&e.setLayoutProperty(t,"visibility",o)})}updateRouteEndpoints(t,e){const o=this.deps.getMap();if(!o)return;const i=o.getSource("route-endpoints");if(!i)return;const n={type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:t},properties:{role:"source"}},{type:"Feature",geometry:{type:"Point",coordinates:e},properties:{role:"destination"}}]};i.setData(n)}clearRouteEndpoints(){const t=this.deps.getMap();if(!t)return;const e=t.getSource("route-endpoints");if(!e)return;e.setData({type:"FeatureCollection",features:[]})}showRouteContext(t,e){this.updateRouteEndpoints(t,e)}hideRouteContext(){this.setPoiLayersVisible(!0),this.clearRouteEndpoints()}startRouteAnimation(){const t=this.deps.getMap();if(!t)return;if("undefined"==typeof window)return;if(null!=this.routeAnimationFrame&&(cancelAnimationFrame(this.routeAnimationFrame),this.routeAnimationFrame=null),this.routeAnimationStart=performance.now(),this.routeActive=!0,!0===this.deps.getReducedMotion?.())return t.getLayer("route-line")&&(t.setPaintProperty("route-line","line-gradient",void 0),t.setPaintProperty("route-line","line-color","#007aff")),void(t.getLayer("route-halo")&&(t.setPaintProperty("route-halo","line-gradient",void 0),t.setPaintProperty("route-halo","line-color","#ffffff")));const e=this.deps.debug,o=t=>{const i=this.deps.getMap();if(!i||!this.routeActive||null==this.routeAnimationStart)return;const n=t-this.routeAnimationStart,r=Math.min(1,n/this.routeAnimationDurationMs),s=Math.max(.001,r);e&&this.deps.log?.("route animation frame",{t:r,clamped:s});const a=.001,l=Math.min(Math.max(s-.01,a),.998),c=Math.min(Math.max(s+.01,l+a),.999),d=["interpolate",["linear"],["line-progress"],0,"rgba(0,122,255,1.0)",l,"rgba(0,122,255,1.0)",c,"rgba(0,122,255,0.0)",1,"rgba(0,122,255,0.0)"],u=["interpolate",["linear"],["line-progress"],0,"rgba(255,255,255,0.7)",l,"rgba(255,255,255,0.7)",c,"rgba(255,255,255,0.0)",1,"rgba(255,255,255,0.0)"];i.getLayer("route-line")&&i.setPaintProperty("route-line","line-gradient",d),i.getLayer("route-halo")&&i.setPaintProperty("route-halo","line-gradient",u),this.routeAnimationFrame=r<1?requestAnimationFrame(o):null};this.routeAnimationFrame=requestAnimationFrame(o)}stopRouteAnimation(){this.routeActive=!1,null!=this.routeAnimationFrame&&"undefined"!=typeof window&&cancelAnimationFrame(this.routeAnimationFrame),this.routeAnimationFrame=null,this.routeAnimationStart=null;const t=this.deps.getMap();t&&(t.getLayer("route-line")&&(t.setPaintProperty("route-line","line-gradient",void 0),t.setPaintProperty("route-line","line-color","#007aff")),t.getLayer("route-halo")&&(t.setPaintProperty("route-halo","line-gradient",void 0),t.setPaintProperty("route-halo","line-color","#ffffff")))}}const D=0;function N(t,e){return"number"==typeof t?t*e:{top:t.top*e,bottom:t.bottom*e,left:t.left*e,right:t.right*e}}function H(t){const e=[],o=t=>{if(!t)return;const o=t.coordinates||t.xyz||t._?.coordinates;if(!Array.isArray(o)||o.length<2)return;const i=Number(o[0]),n=Number(o[1]);Number.isFinite(i)&&Number.isFinite(n)&&e.push({coordinates:[i,n],mapId:"number"==typeof t.mapId?t.mapId:void 0,waypointId:"number"==typeof t.waypointId?t.waypointId:void 0,pathTypeId:"number"==typeof t.pathTypeId?t.pathTypeId:void 0,isEndpoint:!0===t.isEndpoint})};return Array.isArray(t)?t.length>0&&Array.isArray(t[0]?.points)?t[0].points.forEach(o):t.forEach(o):Array.isArray(t?.points)?t.points.forEach(o):Array.isArray(t?.path)?t.path.forEach(o):Array.isArray(t?.paths?.[0]?.points)&&t.paths[0].points.forEach(o),e}function K(t){const[e,o]=t.coordinates??[];return`${t.mapId}|${e}|${o}`}class V{getVenue;getFloors;getFloorById;logFn;constructor(t){this.getVenue=t.getVenue,this.getFloors=t.getFloors,this.getFloorById=t.getFloorById,this.logFn=t.log}get venue(){return this.getVenue()}log(...t){this.logFn&&this.logFn(...t)}loadForFloor(t){if(!t||!this.venue)return[];try{const e=this.venue.amenities?.getByMap(t.id)||[];return Array.isArray(e)?e.map(e=>{const o=e;return o.floorId=t.id,o}):[]}catch{return[]}}getAll(){return this.getFloors().flatMap(t=>this.loadForFloor(t))}getDistinct(){const t=new Map;for(const e of this.getFloors())for(const o of this.loadForFloor(e)){const e=String(o.id),i=t.get(e);if(!i){const i={id:o.id,name:o.name,svg:o.svg,uris:o.uris,iconId:o.iconId,keywords:o.keywords,type:o.type,extensors:o.extensors,waypoints:[...o.waypoints??[]]};t.set(e,i);continue}const n=new Set((i.waypoints??[]).map(K));for(const t of o.waypoints??[]){const e=K(t);n.has(e)||((i.waypoints??=[]).push(t),n.add(e))}}return Array.from(t.values())}getByFloorId(t){const e=this.getFloorById(t);return e?this.loadForFloor(e):[]}getAllKiosks(){return this.getAll().filter(t=>U(t))}getKioskForFloor(t){const e=this.getFloorById(t);if(!e)return null;return this.loadForFloor(e).find(t=>U(t))??null}logKioskForFloor(t){const e=this.getFloorById(t);if(!e)return;const o=this.getKioskForFloor(t);o?this.log("amenity :: kiosk found",{floorId:e.id,id:o.id,name:o.name,keywords:o.keywords,waypoints:o.waypoints,raw:o}):this.log("amenity :: kiosk not found on floor",{floorId:e.id})}}const J="poi-highlight-ring";class W{getMap;log;raf=null;constructor(t){this.getMap=t.getMap,this.log=t.log??(()=>{})}highlight(t){const e=this.getMap();e&&(s.setData(e,u,{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:t},properties:{}}]}),this.log("highlight :: set",t),this.startPulse())}clear(){this.stopPulse();const t=this.getMap();t&&s.setData(t,u,{type:"FeatureCollection",features:[]})}destroy(){this.stopPulse()}startPulse(){const t=this.getMap();if(!t||!t.getLayer(J))return;if(this.stopPulse(),"undefined"!=typeof window&&!0===window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return void this.applyRing(t,.35);const e=performance.now(),o=i=>{const n=(i-e)%1600/1600;this.applyRing(t,n),this.raf=requestAnimationFrame(o)};this.raf=requestAnimationFrame(o)}applyRing(t,e){t.getLayer(J)&&(t.setPaintProperty(J,"circle-radius",14+26*e),t.setPaintProperty(J,"circle-opacity",.45*(1-e)))}stopPulse(){null!=this.raf&&(cancelAnimationFrame(this.raf),this.raf=null)}}function _(t){return t?`?locale=${encodeURIComponent(t)}`:""}y({enabled:!0,prefix:"MinuteMapsSDK"});class Y{mode;proxyBaseUrl;direct;fetchImpl;tokenCache=null;constructor(t){const e="undefined"!=typeof window?window:globalThis,o=t.fetchImpl??e.fetch;if("function"!=typeof o)throw new Error("Fetch API is not available in this environment");this.fetchImpl=o.bind(e),this.mode=t.mode,this.proxyBaseUrl=("proxy"===t.mode?t.proxyBaseUrl:void 0)||"/api/jacs","direct"===t.mode?this.direct={host:this.normalizeHost(t.host),clientId:t.clientId,username:t.username,password:t.password}:this.direct=null}async getPolygonLayers(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/polygon-layer`,o=await this.getJson(e);return this.extractArray(o)}async getFloorMapTemplate3d(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/building/${encodeURIComponent(String(t.buildingId))}/floor/${encodeURIComponent(String(t.floorId))}/map-template/3d`,o=await this.getJson(e);return this.extractArray(o)}async getFloors(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/building/${encodeURIComponent(String(t.buildingId))}/floor`+_(t.locale),o=await this.getJson(e);return this.extractArray(o)}async getVenueAll(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/all`,o=await this.getJson(e),i=o?.data||o?.result||o;if(!i||"object"!=typeof i)throw new Error("JACS venue/all response was not a JSON object");return i}async getVenue(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}`,o=await this.getJson(e),i=o?.venue||o?.data||o;if(!i||"object"!=typeof i)throw new Error("JACS venue response was not a JSON object");return i}async getFloorMapGeojson(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/building/${encodeURIComponent(String(t.buildingId))}/floor/${encodeURIComponent(String(t.floorId))}/map/geojson`,o=await this.getJson(e),i=o?.geojson||o?.data||o;if(!i||"FeatureCollection"!==i.type||!Array.isArray(i.features))throw new Error("JACS floor geojson did not look like a GeoJSON FeatureCollection");return i}async getBuildingFull(t){const e=new URLSearchParams;e.set("mapProfile",String(t.mapProfile??"public")),e.set("geojson",String(t.geojson??!0));const o=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/building/${encodeURIComponent(String(t.buildingId))}/full?${e.toString()}`,i=await this.getJson(o),n=i?.data||i?.result||i;if(!n||"object"!=typeof n)throw new Error("JACS building full response was not a JSON object");return n}async getDestinations(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/destination`+_(t.locale),o=await this.getJson(e);return this.extractArray(o)}async getAmenities(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/amenity`+_(t.locale),o=await this.getJson(e);return this.extractArray(o)}async getBuildings(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/building`,o=await this.getJson(e);return this.extractArray(o)}async getStylesheet3d(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/building/${encodeURIComponent(String(t.buildingId))}/stylesheet/3d`,o=await this.getJson(e),i=o?.style||o?.data||o;if(!i||"object"!=typeof i)throw new Error("JACS stylesheet response was not a JSON object");return i}invalidateToken(){this.tokenCache=null}async getJson(t){if("proxy"===this.mode){const e=this.proxyBaseUrl.replace(/\/+$/,""),o=t.startsWith("/")?t:`/${t}`,i=await this.fetchImpl(`${e}${o}`,{method:"GET",headers:{Accept:"application/json"}});if(!i.ok){const t=await this.safeReadText(i);throw new Error(`JACS proxy GET failed (${i.status} ${i.statusText}) :: ${t}`)}return await i.json()}const e=this.direct;if(!e)throw new Error("JacsProvider is not configured for direct mode");const o=await this.getJwtToken(),i=this.joinUrl(e.host,t),n=await this.fetchImpl(i,{method:"GET",headers:{Authorization:`Bearer ${o}`,Accept:"application/json"}});if(!n.ok){const t=await this.safeReadText(n);throw new Error(`JACS GET failed (${n.status} ${n.statusText}) :: ${t}`)}return await n.json()}extractArray(t){return(Array.isArray(t)?t:null)||(Array.isArray(t?.data)?t.data:null)||(Array.isArray(t?.items)?t.items:null)||(Array.isArray(t?.results)?t.results:null)||[]}async getJwtToken(){const t=this.direct;if(!t)throw new Error("getJwtToken should not be called in proxy mode");const e=Date.now(),o=this.tokenCache;if(o?.token&&e<o.expiresAtMs-3e4)return o.token;const i=this.joinUrl(t.host,"/auth/token"),n=new URLSearchParams;n.set("grant_type","password"),n.set("client_id",t.clientId),n.set("username",t.username),n.set("password",t.password);const r=await this.fetchImpl(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:n.toString()});if(!r.ok){const t=await this.safeReadText(r);throw new Error(`JACS auth failed (${r.status} ${r.statusText}) :: ${t}`)}const s=await r.json(),a=s?.access_token||s?.token||s?.jwt||s?.accessToken;if(!a)throw new Error("JACS auth response did not contain a token");const l=s?.expires_in??s?.expiresIn??s?.expires??s?.ttl,c="number"==typeof l?l:Number(l),d=Number.isFinite(c)&&c>0?c:600;return this.tokenCache={token:a,expiresAtMs:Date.now()+1e3*d},a}normalizeHost(t){return String(t||"").replace(/\/+$/,"")}joinUrl(t,e){const o=this.normalizeHost(t),i=String(e||"");return i?`${o}${i.startsWith("/")?"":"/"}${i}`:o}async safeReadText(t){try{return await t.text()}catch{return""}}}function G(t){const e=new Map,o=new Map,i=new Map,n=new Map;for(const e of t.pathTypes)i.set(e.id,e);for(const i of t.waypoints){if(!i.status)continue;const t=q(i.mapId,i.id),r={key:t,waypointId:i.id,mapId:i.mapId,pixel:[i.coordinates[0],i.coordinates[1]],geo:i.geo};e.set(t,r),o.set(t,[]);const s=n.get(i.mapId)??[];s.push(t),n.set(i.mapId,s)}const r=new Map;for(const t of e.values())r.set(t.waypointId,t.key);const s=(t,e,i,n,r)=>{const s="boolean"==typeof t.bidirectional?t.bidirectional:0===t.direction,a=function(t,e){const o=t[0]-e[0],i=t[1]-e[1];return Math.sqrt(o*o+i*i)}(n.pixel,r.pixel),l={id:t.id,fromKey:e,toKey:i,pathTypeId:t.pathTypeId,bidirectional:s,pixelLength:a,meta:t.extensors&&Object.keys(t.extensors).length?t.extensors:void 0};o.get(e).push({neighbor:i,edge:l}),s&&o.get(i).push({neighbor:e,edge:l})};for(const o of t.paths){if(!o.status)continue;const t=o.waypointIds;if(!Array.isArray(t)||t.length<2)continue;const i=[];for(const o of t){const t=r.get(o);if(!t)continue;const n=e.get(t);n&&i.push({key:t,node:n})}if(i.length<2)continue;const n=new Set;for(const t of i)n.add(t.node.mapId);if(n.size>1)for(let t=0;t<i.length;t++)for(let e=t+1;e<i.length;e++){const n=i[t],r=i[e];n.key!==r.key&&s(o,n.key,r.key,n.node,r.node)}else for(let t=1;t<i.length;t++){const e=i[t-1],n=i[t];e.key!==n.key&&s(o,e.key,n.key,e.node,n.node)}}return{nodes:e,adjacency:o,pathTypes:i,nodesByMapId:n}}function q(t,e){return`${t}:${e}`}function Z(t,e){for(const o of t.nodes.values())if(o.waypointId===e)return o;return null}function X(t){return`connector-${t}`}const Q={elevator:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <rect x="5" y="3" width="14" height="18" rx="1.5"/>\n <line x1="12" y1="3" x2="12" y2="21"/>\n <polyline points="8.5,8 9.75,6.5 11,8"/>\n <polyline points="13,16 14.25,17.5 15.5,16"/>\n </svg>',stairs:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <polyline points="3,21 7,21 7,17 11,17 11,13 15,13 15,9 19,9 19,5 21,5"/>\n </svg>',escalator:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <line x1="3" y1="21" x2="21" y2="5"/>\n <circle cx="6" cy="19" r="1.25"/>\n <circle cx="12" cy="13" r="1.25"/>\n <circle cx="18" cy="7" r="1.25"/>\n </svg>'};function tt(t){return"elevator"===t?"Elevator":"escalator"===t?"Escalator":"Stairs"}const et=y({enabled:!0,prefix:"MinuteMapsSDK jacs"});function ot(t){return null!=t&&"object"==typeof t?t.id:t}class it{config;jacs;floors=[];buildingId=null;destinationsByMapId=new Map;amenitiesByMapId=new Map;mapLabelsByMapId=new Map;zonesByMapId=new Map;zonesByDestinationId=new Map;venueLike=null;wayfindingGraph=null;async init(t){this.config=t;const e=t.jacs;if(!e?.mode)throw new Error("config.jacs.mode is required");if("proxy"!==e.mode){if(!e.host)throw new Error("config.jacs.host is required (direct mode)");if(!e.auth?.clientId)throw new Error("config.jacs.auth.clientId is required (direct mode)");if(!e.auth?.username)throw new Error("config.jacs.auth.username is required (direct mode)");if(!e.auth?.password)throw new Error("config.jacs.auth.password is required (direct mode)");this.jacs=new Y({mode:"direct",host:e.host,clientId:e.auth.clientId,username:e.auth.username,password:e.auth.password})}else this.jacs=new Y({mode:"proxy",proxyBaseUrl:e.proxyBaseUrl||"/api/jacs"})}async loadVenue(){const t=this.config.jmap.customerId,e=this.config.jmap.venueId;if(null==t)throw new Error("config.jmap.customerId is required");if(null==e)throw new Error("config.jmap.venueId is required");const o=await this.jacs.getVenueAll({customerId:t,venueId:e}),i=Array.isArray(o?.buildings)?o.buildings:[],n=i[0],r=n?.id??n?.buildingId;if(!n||!r)throw new Error("No buildings found for this venue in /all response");this.buildingId=r;const s=Array.isArray(o?.waypoints)?o.waypoints:[],a=Array.isArray(o?.destinations)?o.destinations:[],l=Array.isArray(o?.amenities)?o.amenities:[],c=new Map;for(const t of s){const e=t?.mapId;if(null==e)continue;const o=c.get(e)??[];o.push(t),c.set(e,o)}const d=Array.isArray(n?.floors)?n.floors:[],u=n?.defaultFloorId,p=d.map(t=>{const e=t.map?.id??t.mapId;return{id:t.id,mapId:e,name:t.name??t.shortName??String(t.id),sequence:t.level??t.preference,isDefault:t.id===u,geojson:void 0,mapTemplate3d:[],_waypoints:null!=e?c.get(e)??[]:[]}});this.floors=p;const f=new Map;for(const t of p)null!=t.mapId&&f.set(t.mapId,t.id);const h=o?.venue?.coordinates,g=new Map;for(const t of d){const e=t?.map?.id??t?.mapId,o="string"==typeof t?.map?.svg?t.map.svg:"";if(null==e||!o)continue;const i=/viewBox\s*=\s*["']([^"']+)["']/i.exec(o);if(!i)continue;const n=i[1].trim().split(/\s+/).map(Number);if(4!==n.length||n.some(t=>!Number.isFinite(t)))continue;const[,,r,s]=n;r>0&&s>0&&g.set(e,{width:r,height:s})}const y=(t,e,o)=>{if(!h)return null;const i=g.get(t);if(!i)return null;return[h.topLng+e/i.width*(h.bottomLng-h.topLng),h.topLat+o/i.height*(h.bottomLat-h.topLat)]},m=new Map;for(const t of s){const e=t?.id;if(null!=e){if(!Array.isArray(t.coordinates)&&null!=t.x&&null!=t.y&&null!=t.mapId){const e=y(t.mapId,Number(t.x),Number(t.y));e&&(t.coordinates=e)}m.set(e,t)}}this.wayfindingGraph=function(t,e){const o=[];for(const t of e)"number"==typeof t?.id&&"number"==typeof t?.mapId&&null!=t?.x&&null!=t?.y&&o.push({id:t.id,mapId:t.mapId,status:!1!==t.status,coordinates:[Number(t.x),Number(t.y)],geo:Array.isArray(t.coordinates)?[t.coordinates[0],t.coordinates[1]]:null});const i=[];for(const e of Array.isArray(t?.paths)?t.paths:[]){const t=e?.waypoints??e?.waypointIds;if("number"==typeof e?.id&&Array.isArray(t)&&t.length>=2&&t.every(t=>"number"==typeof t)){const o="number"==typeof e.direction?e.direction:0;i.push({id:e.id,pathTypeId:"number"==typeof e.pathTypeId?e.pathTypeId:0,direction:o,bidirectional:0===o,status:!1!==e.status,waypointIds:t.slice(),extensors:e.extensors})}}return G({waypoints:o,paths:i,pathTypes:(Array.isArray(t?.pathTypes)?t.pathTypes:[]).filter(t=>"number"==typeof t?.id).map(t=>({id:t.id,name:t.name??"",description:t.description}))})}(o,s);let w=null;const b=this.config?.jmap?.deviceId,I=Array.isArray(o?.devices)?o.devices:[],v=t=>null==t?.id?null:s.find(e=>Array.isArray(e?.deviceIds)&&e.deviceIds.includes(t.id))??null;let F=null;null!=b&&""!==b&&(F=I.find(t=>String(t?.id)===String(b)||t?.uuid===b)??null,F||et.warn("configured kiosk deviceId not found in this venue; falling back to a placed device",{deviceId:b}));let x=v(F);if(!x){const t=I.find(t=>v(t));t&&(null!=b&&""!==b?et.warn("anchoring You-are-here to a placed device as fallback",{configured:b,using:t.name??t.id}):et.debug("no kiosk deviceId configured; anchoring to placed device",{using:t.name??t.id}),F=t,x=v(t))}if(x&&Array.isArray(x.coordinates)){const t=F?.heading,e="number"==typeof t&&Number.isFinite(t)?t:null;w={waypointId:x.id,floorId:f.get(x.mapId)??x.mapId,coordinates:x.coordinates,deviceName:F?.name,heading:e,waypoint:x}}else I.length>0&&et.warn("venue has device(s) but none are placed on a waypoint; no You-are-here anchor");const A=t=>Array.isArray(t)?t.map(t=>t&&"object"==typeof t?t:m.get(t)).filter(Boolean):[];for(const t of l)t.waypoints=A(t?.waypoints);for(const t of a)t.waypoints=A(t?.waypoints);const k=new Map;for(const t of Array.isArray(o?.pathTypes)?o.pathTypes:[]){const e=(t?.name??"").toString().toLowerCase();e&&(/elev|lift/.test(e)?k.set(t.id,"elevator"):/escalat/.test(e)?k.set(t.id,"escalator"):/stair|step/.test(e)&&k.set(t.id,"stairs"))}const M=Array.isArray(o?.paths)?o.paths:[];for(const t of M){if(!1===t?.status)continue;const e=(t?.name??"").toString().toLowerCase();let o;if(/elev|lift/.test(e)?o="elevator":/escalat/.test(e)?o="escalator":/stair|step/.test(e)&&(o="stairs"),o||"number"!=typeof t.pathTypeId||(o=k.get(t.pathTypeId)),!o)continue;const i=Array.isArray(t.waypoints)?t.waypoints:t.waypointIds;if(!Array.isArray(i)||0===i.length)continue;const n=A(i);if(0===n.length)continue;const r={id:`connector-${o}-${t.id}`,name:t.name&&String(t.name).trim()?String(t.name):tt(o),type:tt(o),svg:Q[o],iconId:X(o),keywords:[o],waypoints:n,_connector:!0};l.push(r)}this.amenitiesByMapId.clear();for(const t of l)for(const e of t?.waypoints??[]){const o=e?.mapId;if(null==o)continue;const i=f.get(o)??o,n=this.amenitiesByMapId.get(i)??[];n.push(t),this.amenitiesByMapId.set(i,n)}this.destinationsByMapId.clear();for(const t of a)for(const e of t?.waypoints??[]){const o=e?.mapId;if(null==o)continue;const i=f.get(o)??o,n=this.destinationsByMapId.get(i)??[];n.push(t),this.destinationsByMapId.set(i,n)}this.mapLabelsByMapId.clear();const S=Array.isArray(o?.mapLabels)?o.mapLabels:[],C=p.map(t=>t.id);for(const t of S){if(!1===t?.status)continue;const e=t?.name??"",o=Array.isArray(t?.instances)?t.instances:[];for(const i of o){const o=i?.mapId,n=Number(i?.xPosition),r=Number(i?.yPosition);if(null==o||!Number.isFinite(n)||!Number.isFinite(r))continue;const s=y(o,n,r);if(!s)continue;const a={id:i.id,labelId:t.id,name:e,coordinates:s,mapId:o,rotation:"number"==typeof i.rotation?i.rotation:0,allLevels:1===i?.allLevels||!0===i?.allLevels},l=a.allLevels?C:[f.get(o)??o];for(const t of l){const e=this.mapLabelsByMapId.get(t)??[];e.push(a),this.mapLabelsByMapId.set(t,e)}}}this.zonesByMapId.clear(),this.zonesByDestinationId.clear();const P=Array.isArray(o?.zones)?o.zones:[];for(const t of P){if(!1===t?.status)continue;const e=t?.mapId;if(null!=e){const o=f.get(e)??e,i=this.zonesByMapId.get(o)??[];i.push(t),this.zonesByMapId.set(o,i)}const o=Array.isArray(t?.destinationIds)?t.destinationIds:Array.isArray(t?.destinations)?t.destinations:[];for(const e of o){const o="object"==typeof e&&null!=e?e.id:e;if(null==o)continue;const i=this.zonesByDestinationId.get(o)??[];i.push(t),this.zonesByDestinationId.set(o,i)}}const T=o?.venue??{};if(this.venueLike={...T,floors:p,polygonLayers:[],destinations:{items:[...a],getByMap:t=>this.destinationsByMapId.get(ot(t))??[]},amenities:{items:[...l],getByMap:t=>this.amenitiesByMapId.get(ot(t))??[]},mapLabels:{items:[...S],getByMap:t=>this.mapLabelsByMapId.get(ot(t))??[]},zones:{items:[...P],getByMap:t=>this.zonesByMapId.get(ot(t))??[],getByDestination:t=>this.zonesByDestinationId.get(ot(t))??[]},buildings:{items:[...i],getAllFloors:()=>this.floors},styleSheet:null,kioskWaypoint:w},this.config?.jmap?.locale)try{await this.applyLocale(this.config.jmap.locale)}catch{}return this.venueLike}async applyLocale(t){if(!t)return;if(!this.venueLike)return;const e=this.config.jmap.customerId,o=this.config.jmap.venueId,i=this.buildingId;if(null!=e&&null!=o&&null!=i)try{const[n,r,s]=await Promise.all([this.jacs.getDestinations({customerId:e,venueId:o,locale:t}),this.jacs.getAmenities({customerId:e,venueId:o,locale:t}),this.jacs.getFloors({customerId:e,venueId:o,buildingId:i,locale:t})]),a=t=>{const e=new Map;for(const o of t)null!=o?.id&&e.set(o.id,o);return e},l=a(n),c=a(r),d=a(s),u=(t,e)=>{e&&(null!=e.name&&(t.name=e.name),null!=e.description&&(t.description=e.description))};for(const t of this.venueLike.destinations?.items??[])u(t,l.get(t?.id));for(const t of this.venueLike.amenities?.items??[])u(t,c.get(t?.id));for(const t of this.floors)u(t,d.get(t.id))}catch(e){throw et.warn("locale merge failed; staying on prior locale",{locale:t,e:e}),e}}async ensureFloorGeojson(t){if(t.geojson)return;const e=this.config.jmap.customerId,o=this.config.jmap.venueId;try{const i=await this.jacs.getFloorMapGeojson({customerId:e,venueId:o,buildingId:this.buildingId,floorId:t.id});t.geojson=function(t){return(t?.type?t:t?.data)??null}(i)}catch(e){et.warn("floor geojson fetch failed",{floorId:t.id,e:e})}}async preloadRemainingFloors(){const t=this.floors.filter(t=>!t.geojson);0!==t.length&&(await Promise.all(t.map(t=>this.ensureFloorGeojson(t))),et.debug("preloaded geojson for remaining floors",{count:t.length}))}async getFloors(){return this.floors}async getAmenities(t){return this.amenitiesByMapId.get(t)??[]}async getDestinations(t){return this.destinationsByMapId.get(t)??[]}getWayfindingGraph(){return this.wayfindingGraph}}function nt(t,e,o,i){if(!t.nodes.has(e)||!t.nodes.has(o))return null;if(e===o)return{keys:[e],cost:0};const n=new Map,r=new Map;n.set(e,0);const s=new rt((t,e)=>t.cost-e.cost);for(s.push({key:e,cost:0});s.size()>0;){const{key:e,cost:a}=s.pop();if(e===o)break;if(a>(n.get(e)??1/0))continue;const l=t.adjacency.get(e);if(l)for(const{neighbor:t,edge:o}of l){const l=i(o);if(!Number.isFinite(l)||l<0)continue;const c=a+l;c<(n.get(t)??1/0)&&(n.set(t,c),r.set(t,e),s.push({key:t,cost:c}))}}if(!n.has(o))return null;const a=[];let l=o;for(;null!=l;)if(a.unshift(l),l=r.get(l),void 0===l&&a[0]!==e)return null;return{keys:a,cost:n.get(o)}}class rt{compare;data=[];constructor(t){this.compare=t}size(){return this.data.length}push(t){this.data.push(t),this.bubbleUp(this.data.length-1)}pop(){if(0===this.data.length)return;const t=this.data[0],e=this.data.pop();return this.data.length>0&&(this.data[0]=e,this.sinkDown(0)),t}bubbleUp(t){const e=this.data[t];for(;t>0;){const o=t-1>>1;if(this.compare(e,this.data[o])>=0)break;this.data[t]=this.data[o],t=o}this.data[t]=e}sinkDown(t){const e=this.data.length,o=this.data[t];for(;;){const i=2*t+1,n=i+1;let r=-1;if(i<e&&this.compare(this.data[i],o)<0&&(r=i),n<e&&this.compare(this.data[n],-1===r?o:this.data[i])<0&&(r=n),-1===r)break;this.data[t]=this.data[r],t=r}this.data[t]=o}}const st=new Set([]),at=new Set([]),lt=new Set([]);function ct(t){const e=Boolean(t.accessible),o=Boolean(t.avoidStairs);return t=>{const i=t.pixelLength;if(o&&dt(t))return 1/0;if(e&&function(t){return!1===t.meta?.accessible||dt(t)}(t))return 1/0;if(dt(t))return 1.5*i;if(e){if(function(t){return!!at.has(t.pathTypeId)||!0===t.meta?.ramp}(t))return.95*i;if(function(t){return!!lt.has(t.pathTypeId)||!0===t.meta?.elevator}(t))return.95*i}return i}}function dt(t){return!!st.has(t.pathTypeId)||!0===t.meta?.stairs}function ut(t){if(!t)return null;const e=t.coordinates??t.xyz??t._?.coordinates;if(!Array.isArray(e)||e.length<2)return null;const o=Number(e[0]),i=Number(e[1]);return Number.isFinite(o)&&Number.isFinite(i)?[o,i]:null}class pt{deps;warn;constructor(t){this.deps=t,this.warn=t.warn??((t,e)=>console.warn(`[wayfinding] ${t}`,e??""))}async init(t){}async wayfindBetweenWaypoints(t){const{from:e,to:o,options:i}=t,n=this.deps.getGraph(),r=ut(e),s=ut(o);if(!n)return this.warn("graph not ready"),function(t,e){return t&&e?{points:[{coordinates:t,isEndpoint:!0},{coordinates:e,isEndpoint:!0}]}:null}(r,s);const a=ft(n,e),l=ft(n,o);if(!a||!l)return this.warn("could not resolve start/end waypoint to a graph node",{fromId:e?.id,toId:o?.id}),null;const c=nt(n,a.key,l.key,ct(i??{}));if(!c)return this.warn("no path found",{from:a.key,to:l.key}),null;const d=new Map;for(let t=1;t<c.keys.length;t++){const e=c.keys[t-1],o=c.keys[t],i=(n.adjacency.get(e)??[]).find(t=>t.neighbor===o);i&&d.set(o,i.edge.pathTypeId)}const u=[],p=c.keys.length-1;for(let t=0;t<=p;t++){const e=c.keys[t],o=n.nodes.get(e);let i=o?.geo??null;0===t&&r&&(i=r),t===p&&s&&(i=s),i&&u.push({coordinates:i,mapId:o?.mapId,waypointId:o?.waypointId,pathTypeId:0===t?void 0:d.get(e),isEndpoint:0===t||t===p})}return u.length<2?(this.warn("route nodes had no projected coordinates",{keys:c.keys.length}),null):{points:u}}}function ft(t,e){if(!e||null==e.id)return null;const o="number"==typeof e.id?e.id:Number(e.id);if(!Number.isFinite(o))return null;if("number"==typeof e.mapId){const i=t.nodes.get(q(e.mapId,o));if(i)return i}return Z(t,o)}function ht(t){const{graph:e,kiosk:o}=t;if(!e||!o?.id)return null;const n=function(t,e){if(null==e?.id)return null;const o="number"==typeof e.id?e.id:Number(e.id);if(!Number.isFinite(o))return null;if("number"==typeof e.mapId){const i=t.nodes.get(q(e.mapId,o));if(i)return i}return Z(t,o)}(e,o);if(!n)return null;const r=function(t){if(null==t)return null;if("number"==typeof t)return t;if("string"==typeof t){const e=Number(t);return Number.isFinite(e)?e:null}if("id"in t&&null!=t.id){const e="number"==typeof t.id?t.id:Number(t.id);return Number.isFinite(e)?e:null}if("waypoints"in t&&Array.isArray(t.waypoints)&&t.waypoints.length>0){const e=t.waypoints[0];if(null==e)return null;if("number"==typeof e)return e;if("string"==typeof e){const t=Number(e);return Number.isFinite(t)?t:null}if("object"==typeof e&&null!=e.id){const t="number"==typeof e.id?e.id:Number(e.id);return Number.isFinite(t)?t:null}}return null}(t.target);if(null==r)return null;const s=("object"==typeof t.target&&"mapId"in t.target&&"number"==typeof t.target.mapId?e.nodes.get(q(t.target.mapId,r)):null)??Z(e,r);if(!s)return null;const a=nt(e,n.key,s.key,t=>t.pixelLength);if(!a)return null;let l=0;for(let t=1;t<a.keys.length;t++){const o=e.nodes.get(a.keys[t-1])?.geo,n=e.nodes.get(a.keys[t])?.geo;o&&n&&(l+=i.distance(i.point(o),i.point(n),{units:"meters"}))}const c=t.options?.walkingSpeedMps??1.2,d=Math.max(1,Math.round(l/c));return{meters:Math.round(l),seconds:d,pathNodeCount:a.keys.length}}function gt(t,e,o){const{startIdx:n,endIdx:r,floorId:s}=e;if(r<=n)return[];const a=[];for(let e=n;e<r;e++){const o=t[e].coordinates,n=t[e+1].coordinates,r=i.distance(i.point(o),i.point(n),{units:"meters"}),s=i.bearing(i.point(o),i.point(n));a.push({fromIdx:e,toIdx:e+1,meters:r,bearing:s})}if(0===a.length)return[];const l=[];for(let t=0;t<a.length;t++){const e=a[t];if(0===t){l.push({startIdx:e.fromIdx,endIdx:e.toIdx,meters:e.meters,bearing:e.bearing,turnInto:null});continue}const o=l[l.length-1],i=mt(o.bearing,e.bearing);if(null==i){o.endIdx=e.toIdx,o.meters+=e.meters;const t=o.meters;o.bearing=t>0?o.bearing+yt(o.bearing,e.bearing)*(e.meters/t):e.bearing}else l.push({startIdx:e.fromIdx,endIdx:e.toIdx,meters:e.meters,bearing:e.bearing,turnInto:i})}const c=[];for(let e=0;e<l.length;e++){const i=l[e],n=Math.max(0,Math.round(i.meters)),r=0===e,a=e===l.length-1;if(r&&o.isFirstLeg)c.push({type:"depart",floorId:s,pointRange:[i.startIdx,i.endIdx],distanceMeters:n,text:It(n,o.ctx.floorName(s??-1))});else if(i.turnInto){const e=bt(t[i.startIdx],s,o.ctx),r=n,a="uturn"===i.turnInto?"u-turn":"left"===i.turnInto?"turn-left":"turn-right";c.push({type:a,floorId:s,pointRange:[i.startIdx,i.endIdx],distanceMeters:r,landmark:e??void 0,text:Ft(a,e,r)})}else c.push({type:"continue",floorId:s,pointRange:[i.startIdx,i.endIdx],distanceMeters:n,text:vt(n)});if(a&&o.isLastLeg){const e=c.pop(),n=o.ctx.destinationName;wt(t,i.endIdx),c.push({type:"arrive",floorId:s,pointRange:e.pointRange,distanceMeters:e.distanceMeters,landmark:n,text:At(n)})}}return c}function yt(t,e){let o=(e-t+540)%360-180;return-180===o&&(o=180),o}function mt(t,e){const o=yt(t,e),i=Math.abs(o);return i<30?null:i>=150?"uturn":o<0?"left":"right"}function wt(t,e){return"ahead"}function bt(t,e,o){const n=[o.destinations,o.amenities,o.mapLabels];let r=null;const s=i.point(t.coordinates);for(const t of n)if(t?.length){for(const o of t){if(!o?.name)continue;if("number"==typeof o.mapId&&null!=e&&o.mapId!==e)continue;const t=o.coordinates||o.geo;if(!t||t.length<2)continue;const n=i.distance(s,i.point(t),{units:"meters"});n>5||(!r||n<r.distance)&&(r={name:o.name,distance:n})}if(r)return r.name}return null}function It(t,e){return e?`Head out on ${e} — walk ${t} m straight ahead`:`Walk ${t} m straight ahead`}function vt(t){return`Continue ${t} m`}function Ft(t,e,o){return`${"u-turn"===t?"Make a U-turn":"turn-left"===t?"Turn left":"Turn right"}${e?` at ${e}`:""} and continue ${o} m`}function xt(t,e,o){const i="elevator"===t?"Take the elevator":"escalator"===t?"Take the escalator":"Take the stairs";return e?`${i} to ${e}`:i}function At(t,e){return`You've arrived${t?` — ${t}`:""}`}class kt{handlers=new Map;on(t,e){this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(e)}off(t,e){e?this.handlers.get(t)?.delete(e):this.handlers.delete(t)}emit(t,e){this.handlers.get(t)?.forEach(t=>{try{t(e)}catch{}})}}var Mt={version:8,name:"Hospital Indoor Mapping - Hybrid Style Healthcare Compliant",metadata:{description:"Accessibility-focused hospital navigation with proper healthcare standards",author:"Hospital Mapping Team",version:"7.1.0"},sprite:"http://localhost:4000/sprites/sprite",glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",sources:{protomaps:{type:"vector",url:"pmtiles://https://jacsdevtiles-gjgbejbpdzbgcge8.z01.azurefd.net/pmtiles/base/usa.pmtiles",attribution:"© OpenStreetMap contributors"},"indoor-data":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"poi-data":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"accessibility-data":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"unit-walls":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"route-data":{type:"geojson",data:{type:"FeatureCollection",features:[]},lineMetrics:!0},"route-endpoints":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"poi-highlight-data":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"map-labels-data":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"route-active-step":{type:"geojson",data:{type:"FeatureCollection",features:[]}}},layers:[{id:"background",type:"background",paint:{"background-color":"#f0f0f0"}},{id:"basemap-earth",type:"fill",source:"protomaps","source-layer":"earth",paint:{"fill-color":"#EAE2D0"}},{id:"basemap-landuse-park",type:"fill",source:"protomaps","source-layer":"landuse",filter:["in",["get","kind"],["literal",["park","forest","wood","nature_reserve","grass","garden","playground","cemetery","golf_course"]]],paint:{"fill-color":"#cbe0b6","fill-opacity":["interpolate",["linear"],["zoom"],14,.95,18,.8]}},{id:"basemap-water",type:"fill",source:"protomaps","source-layer":"water",paint:{"fill-color":"#c2dbf2"}},{id:"basemap-roads-minor",type:"line",source:"protomaps","source-layer":"roads",minzoom:13,filter:["in",["get","kind"],["literal",["minor_road","path","service","other"]]],paint:{"line-color":"#FFFFFF","line-width":["interpolate",["linear"],["zoom"],13,.5,16,1.5,19,4],"line-opacity":["interpolate",["linear"],["zoom"],14,.9,18,.5]}},{id:"basemap-roads-major",type:"line",source:"protomaps","source-layer":"roads",minzoom:10,filter:["in",["get","kind"],["literal",["highway","major_road","medium_road"]]],paint:{"line-color":"#ecc97e","line-width":["interpolate",["linear"],["zoom"],10,.5,14,1.5,18,6],"line-opacity":["interpolate",["linear"],["zoom"],14,.9,18,.5]}},{id:"pattern-water",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-Water"],paint:{"fill-color":"#cfe1ec","fill-opacity":.6}},{id:"pattern-grass",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-Grass"],paint:{"fill-color":"#d2e0c6","fill-opacity":.5}},{id:"pattern-trees",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-Trees"],paint:{"fill-color":"#cdd9c9","fill-opacity":.4}},{id:"pattern-pavement",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-Pavement"],paint:{"fill-color":"#E0E0E0","fill-opacity":.6}},{id:"pattern-outdoor-terrace",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-OutdoorTerrace"],paint:{"fill-color":"#cabfb6","fill-opacity":.3}},{id:"parking-lots",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Parking-Lots"],paint:{"fill-color":"#e0e0dd","fill-opacity":.5}},{id:"parking-lots-outline",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Parking-Lots"],paint:{"line-color":"#b0b0ad","line-width":1,"line-dasharray":[3,2]}},{id:"boundary-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Boundary"],paint:{"fill-color":"#FAF3E2","fill-opacity":1}},{id:"building-roof-fill",type:"fill",source:"indoor-data",minzoom:15.8,filter:["==",["get","featureType"],"Boundary"],paint:{"fill-color":"#162e51","fill-opacity":["interpolate",["linear"],["zoom"],15.8,0,16.5,1]}},{id:"corridors-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["any",["==",["get","featureType"],"Corridors"],["==",["get","featureType"],"Corridor"]],paint:{"fill-color":"#F0E6D1"}},{id:"accessible-routes",type:"line",source:"accessibility-data",minzoom:16.5,filter:["==",["get","accessible"],!0],paint:{"line-color":"#2E7D32","line-width":["interpolate",["linear"],["zoom"],15,2,18,3,20,4],"line-dasharray":[.5,1],"line-opacity":.7}},{id:"units-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Units"],paint:{"fill-color":["case",["has","category"],["match",["get","category"],"healthcare","#73b3e7","surgical","#73b3e7","waiting","#73b3e7","diagnostic","#97d4ea","amenities","#97d4ea","emergency","#f2938c","retail","#fee685","fnb","#fee685","admin","#dfe1e2","staff","#dfe1e2","security","#dfe1e2","#73b3e7"],"#73b3e7"],"fill-opacity":["interpolate",["linear"],["zoom"],15,.85,17,.92,19,.95]}},{id:"units-outline-2d",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Units"],layout:{visibility:"none","line-join":"round","line-cap":"round"},paint:{"line-color":"#162e51","line-opacity":.9,"line-width":["interpolate",["linear"],["zoom"],16,.8,18,1.4,20,2.2]}},{id:"backofhouse-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Back-of-house"],paint:{"fill-color":"#e6e6e2","fill-opacity":.7}},{id:"backofhouse-pattern",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Back-of-house"],paint:{"line-color":"#c4c4c4","line-width":.5,"line-opacity":.4}},{id:"backofhouse-outline-2d",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Back-of-house"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#b0b1b5","line-width":["interpolate",["linear"],["zoom"],16,.6,18,1,20,1.4],"line-opacity":.9}},{id:"restrooms-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Restrooms"],paint:{"fill-color":"#5f9070","fill-opacity":1}},{id:"restrooms-outline-2d",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Restrooms"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#3f5d4a","line-width":["interpolate",["linear"],["zoom"],16,.6,18,1,20,1.4],"line-opacity":.9}},{id:"obstacles-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Obstacles"],paint:{"fill-color":"#E8E9ED","fill-opacity":.85}},{id:"obstacles-outline-2d",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Obstacles"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#B0B1B5","line-width":["interpolate",["linear"],["zoom"],16,.5,18,.9,20,1.2],"line-opacity":.9}},{id:"escalators-stairs-elevators",type:"fill",source:"indoor-data",minzoom:16.5,filter:["in",["get","featureType"],["literal",["Escalators","Stairs","Elevators"]]],paint:{"fill-color":"#a9aeb1","fill-opacity":1}},{id:"escalators-stairs-elevators-outline-2d",type:"line",source:"indoor-data",minzoom:16.5,filter:["in",["get","featureType"],["literal",["Escalators","Stairs","Elevators"]]],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#6f7780","line-width":["interpolate",["linear"],["zoom"],16,.6,18,1,20,1.4],"line-opacity":.9}},{id:"exits-doors",type:"fill",source:"indoor-data",minzoom:16.5,filter:["in",["get","featureType"],["literal",["Exits","Doors","Exit","Door"]]],paint:{"fill-color":"#cdd9c9","fill-opacity":.6}},{id:"kiosks-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Kiosks"],paint:{"fill-color":"#ffe396","fill-opacity":.7}},{id:"pattern-lounge",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-Lounge"],paint:{"fill-color":"#ddd2e0","fill-opacity":.5}},{id:"pattern-indoor-foodcourt",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-IndoorFoodcourt"],paint:{"fill-color":"#f3e4c4","fill-opacity":.6}},{id:"corridors-outline",type:"line",source:"indoor-data",minzoom:16.5,filter:["any",["==",["get","featureType"],"Corridors"],["==",["get","featureType"],"Corridor"]],paint:{"line-color":"#BCAAA4","line-width":["interpolate",["linear"],["zoom"],15,.5,18,1,20,1.5]}},{id:"boundary-outline",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Boundary"],paint:{"line-color":"#263238","line-width":["interpolate",["linear"],["zoom"],12,2,15,2.5,18,3,20,3.5],"line-opacity":["interpolate",["linear"],["zoom"],12,.7,17,.85,18,1]}},{id:"building-roof-outline",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Boundary"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#c8a85a","line-width":["interpolate",["linear"],["zoom"],15,1.5,18,2,20,2.5],"line-opacity":.55}},{id:"interior-parking-lots",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Interior-ParkingLots"],paint:{"fill-color":"#757575","fill-opacity":.8}},{id:"interior-parking-lots-outline",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Interior-ParkingLots"],paint:{"line-color":"#616161","line-width":1.5}},{id:"building-extrusion",type:"fill-extrusion",source:"indoor-data",filter:["==",["get","featureType"],"Boundary"],paint:{"fill-extrusion-color":"#162e51","fill-extrusion-height":15,"fill-extrusion-base":0,"fill-extrusion-opacity":["interpolate",["linear"],["zoom"],15.8,1,16.5,0]}},{id:"units-wall-extrusion",type:"fill-extrusion",source:"unit-walls",minzoom:16.5,filter:["all",["==",["get","featureType"],"UnitWalls"],["!",["has","custom_height"]]],paint:{"fill-extrusion-color":"#c4c8cb","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,["case",["==",["get","wallKind"],"interior"],.5,1],17.5,["case",["==",["get","wallKind"],"interior"],.7,1.4],18.2,["case",["==",["get","wallKind"],"interior"],.9,1.6]],"fill-extrusion-base":0,"fill-extrusion-vertical-gradient":!0,"fill-extrusion-opacity":1}},{id:"units-wall-custom-extrusion",type:"fill-extrusion",source:"unit-walls",minzoom:16.5,filter:["has","custom_height"],paint:{"fill-extrusion-color":"#c4c8cb","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,1,17.5,1.4,18.2,1.6],"fill-extrusion-base":0,"fill-extrusion-vertical-gradient":!0,"fill-extrusion-opacity":1}},{id:"corridors-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["any",["==",["get","featureType"],"Corridors"],["==",["get","featureType"],"Corridor"]],layout:{visibility:"none"},paint:{"fill-extrusion-color":"#FFF8E1","fill-extrusion-height":["step",["zoom"],0,18,3.2],"fill-extrusion-base":0,"fill-extrusion-opacity":["step",["zoom"],0,18,.85]}},{id:"backofhouse-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Back-of-house"],paint:{"fill-extrusion-color":"#e6e6e2","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,1,17.5,1.4,18.2,1.6],"fill-extrusion-base":0,"fill-extrusion-opacity":1}},{id:"restrooms-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Restrooms"],paint:{"fill-extrusion-color":"#5f9070","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,1,17.5,1.4,18.2,1.6],"fill-extrusion-base":0,"fill-extrusion-opacity":.95}},{id:"obstacles-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Obstacles"],paint:{"fill-extrusion-color":"#E8E9ED","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,.4,17.5,.6,18.2,.8],"fill-extrusion-base":0,"fill-extrusion-opacity":1}},{id:"escalators-stairs-elevators-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["in",["get","featureType"],["literal",["Escalators","Stairs","Elevators"]]],paint:{"fill-extrusion-color":"#a9aeb1","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,1,17.5,1.4,18.2,1.6],"fill-extrusion-base":0,"fill-extrusion-vertical-gradient":!0,"fill-extrusion-opacity":.9}},{id:"interior-parking-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Interior-ParkingLots"],paint:{"fill-extrusion-color":"#757575","fill-extrusion-height":["interpolate",["linear"],["zoom"],15,0,16,1,17,1.4,18,1.6],"fill-extrusion-base":0,"fill-extrusion-opacity":.85}},{id:"route-line",type:"line",source:"route-data",minzoom:16.5,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#007aff","line-width":["interpolate",["linear"],["zoom"],16.5,3,18,5,20,7],"line-opacity":.55}},{id:"route-halo",type:"line",source:"route-data",minzoom:16.5,paint:{"line-color":"white","line-width":["interpolate",["linear"],["zoom"],16.5,5,18,7,20,9],"line-opacity":.45}},{id:"route-line-active-halo",type:"line",source:"route-active-step",minzoom:16.5,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#FFFFFF","line-width":["interpolate",["linear"],["zoom"],16.5,8,18,11,20,14],"line-opacity":.85}},{id:"route-line-active",type:"line",source:"route-active-step",minzoom:16.5,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fdb81e","line-width":["interpolate",["linear"],["zoom"],16.5,5,18,7,20,9],"line-opacity":1}},{id:"route-endpoint-source",type:"circle",source:"route-endpoints",minzoom:16.5,filter:["==",["get","role"],"source"],paint:{"circle-radius":6,"circle-color":"#ffffff","circle-stroke-width":3,"circle-stroke-color":"#007aff","circle-opacity":1}},{id:"route-endpoint-destination",type:"circle",source:"route-endpoints",minzoom:16.5,filter:["==",["get","role"],"destination"],paint:{"circle-radius":7,"circle-color":"#007aff","circle-stroke-width":3,"circle-stroke-color":"#ffffff","circle-opacity":1}},{id:"poi-accessibility-icons",type:"symbol",source:"poi-data",filter:["==",["get","accessible"],!0],minzoom:16.5,layout:{"icon-image":"wheelchair-accessible","icon-size":["interpolate",["linear"],["zoom"],15,.4,17,.6,19,.8],"icon-allow-overlap":!1,"icon-padding":4}},{id:"poi-destination-circles",type:"circle",source:"poi-data",filter:["==",["get","poiType"],"destination"],minzoom:16.5,paint:{"circle-radius":["interpolate",["linear"],["zoom"],16,6,18,8,20,10],"circle-color":"#ffffff","circle-stroke-width":3,"circle-stroke-color":"#162e51","circle-opacity":1}},{id:"poi-destination-labels",type:"symbol",source:"poi-data",filter:["all",["==",["get","poiType"],"destination"],["==",["get","showLabel"],!0]],minzoom:16.5,layout:{"symbol-sort-key":0,"text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],16.5,18,18,20,20,23],"text-offset":[0,-.9],"text-anchor":"bottom","text-font":["Noto Sans Bold"],"text-max-width":12,"text-allow-overlap":!1,"text-padding":4,"text-rotation-alignment":"viewport"},paint:{"text-color":"#242930","text-halo-color":"#FFFFFF","text-halo-width":1.5,"text-halo-blur":1}},{id:"map-labels",type:"symbol",source:"map-labels-data",minzoom:15.5,layout:{"symbol-sort-key":10,"text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],15.5,13,16.5,16,18,19,20,22],"text-font":["Noto Sans Bold"],"text-letter-spacing":.04,"text-max-width":10,"text-anchor":"center","text-rotate":["get","rotation"],"text-rotation-alignment":"map","text-allow-overlap":!1,"text-padding":4},paint:{"text-color":"#3d4551","text-halo-color":"#FFFFFF","text-halo-width":1.4,"text-halo-blur":.5}},{id:"poi-entrance-exit-icons",type:"symbol",source:"poi-data",filter:["all",["==",["get","poiType"],"amenity"],["any",["!=",["index-of","entrance",["get","keywords"]],-1],["!=",["index-of","exit",["get","keywords"]],-1],["!=",["index-of","door",["get","keywords"]],-1]]],minzoom:15,layout:{"symbol-sort-key":1,"icon-image":["get","iconId"],"icon-size":["interpolate",["linear"],["zoom"],16.5,.5,18,.6,20,.8],"icon-allow-overlap":!1,"icon-padding":4,"icon-optional":!1,"icon-rotation-alignment":"viewport","icon-pitch-alignment":"viewport","text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],16,["case",["!=",["coalesce",["get","iconId"],""],""],0,17],19,["case",["!=",["coalesce",["get","iconId"],""],""],0,19],20,["case",["!=",["coalesce",["get","iconId"],""],""],0,22]],"text-offset":[0,1.3],"text-anchor":"top","text-optional":!0,"text-padding":4,"text-font":["Noto Sans Bold"],"text-rotation-alignment":"viewport"},paint:{"icon-halo-color":"#FFFFFF","icon-halo-width":1.5,"icon-halo-blur":.5,"text-color":"#242930","text-halo-color":"#FFFFFF","text-halo-width":1.5,"text-halo-blur":1,"icon-translate":[0,-20],"icon-translate-anchor":"viewport"}},{id:"poi-parking-icons",type:"symbol",source:"poi-data",filter:["all",["==",["get","poiType"],"amenity"],["any",["!=",["index-of","parking",["get","keywords"]],-1],["!=",["index-of","park",["get","keywords"]],-1]]],minzoom:14,layout:{"symbol-sort-key":2,"icon-image":["get","iconId"],"icon-size":["interpolate",["linear"],["zoom"],16.5,.5,18,.6,20,.8],"icon-allow-overlap":!1,"icon-padding":4,"icon-optional":!1,"icon-rotation-alignment":"viewport","icon-pitch-alignment":"viewport","text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],16,["case",["!=",["coalesce",["get","iconId"],""],""],0,17],19,["case",["!=",["coalesce",["get","iconId"],""],""],0,19],20,["case",["!=",["coalesce",["get","iconId"],""],""],0,22]],"text-offset":[0,1.3],"text-anchor":"top","text-optional":!0,"text-padding":4,"text-font":["Noto Sans Bold"],"text-rotation-alignment":"viewport"},paint:{"icon-halo-color":"#FFFFFF","icon-halo-width":1.5,"icon-halo-blur":.5,"text-color":"#242930","text-halo-color":"#FFFFFF","text-halo-width":1.5,"text-halo-blur":1,"icon-translate":[0,-20],"icon-translate-anchor":"viewport"}},{id:"poi-other-amenity-icons",type:"symbol",source:"poi-data",filter:["all",["==",["get","poiType"],"amenity"],["==",["index-of","entrance",["get","keywords"]],-1],["==",["index-of","exit",["get","keywords"]],-1],["==",["index-of","door",["get","keywords"]],-1],["==",["index-of","parking",["get","keywords"]],-1],["==",["index-of","park",["get","keywords"]],-1]],minzoom:16.5,layout:{"symbol-sort-key":3,"icon-image":["get","iconId"],"icon-size":["interpolate",["linear"],["zoom"],16.5,.5,18,.6,20,.8],"icon-allow-overlap":!1,"icon-padding":4,"icon-optional":!1,"icon-rotation-alignment":"viewport","icon-pitch-alignment":"viewport","text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],16,["case",["!=",["coalesce",["get","iconId"],""],""],0,17],19,["case",["!=",["coalesce",["get","iconId"],""],""],0,19],20,["case",["!=",["coalesce",["get","iconId"],""],""],0,22]],"text-offset":[0,1.3],"text-anchor":"top","text-optional":!0,"text-padding":4,"text-font":["Noto Sans Bold"],"text-rotation-alignment":"viewport"},paint:{"icon-halo-color":"#FFFFFF","icon-halo-width":1.5,"icon-halo-blur":.5,"text-color":"#242930","text-halo-color":"#FFFFFF","text-halo-width":1.5,"text-halo-blur":1,"icon-translate":[0,-20],"icon-translate-anchor":"viewport"}},{id:"poi-you-are-here-heading",type:"symbol",source:"poi-data",filter:["all",["==",["get","isYouAreHere"],!0],["==",["get","hasHeading"],!0]],minzoom:16,layout:{"text-field":"▲","text-size":["interpolate",["linear"],["zoom"],16,28,18,34,20,42],"text-font":["Noto Sans Bold"],"text-anchor":"bottom","text-offset":[0,-.45],"text-rotate":["get","heading"],"text-rotation-alignment":"map","text-pitch-alignment":"map","text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"text-color":"#face00","text-halo-color":"#162e51","text-halo-width":2.5,"text-opacity":.9}},{id:"poi-you-are-here-ring",type:"circle",source:"poi-data",filter:["==",["get","isYouAreHere"],!0],minzoom:16,paint:{"circle-radius":["interpolate",["linear"],["zoom"],16,14,18,18,20,24],"circle-color":"#face00","circle-opacity":.25,"circle-pitch-alignment":"map"}},{id:"poi-you-are-here-dot",type:"circle",source:"poi-data",filter:["==",["get","isYouAreHere"],!0],minzoom:16,paint:{"circle-radius":["interpolate",["linear"],["zoom"],16,7,18,9,20,12],"circle-color":"#face00","circle-opacity":1,"circle-stroke-color":"#ffffff","circle-stroke-width":3,"circle-stroke-opacity":1}},{id:"poi-you-are-here",type:"symbol",source:"poi-data",filter:["==",["get","isYouAreHere"],!0],minzoom:16,layout:{"text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],16,17,18,19,20,22],"text-offset":[0,-1.8],"text-anchor":"bottom","text-font":["Noto Sans Bold"],"text-allow-overlap":!0,"text-ignore-placement":!0,"text-optional":!1},paint:{"text-color":"#ffffff","text-halo-color":"#162e51","text-halo-width":2.5,"text-halo-blur":.5}},{id:"poi-highlight-ring",type:"circle",source:"poi-highlight-data",paint:{"circle-radius":14,"circle-color":"#005ea2","circle-opacity":.45,"circle-pitch-alignment":"map"}},{id:"poi-highlight-core",type:"circle",source:"poi-highlight-data",paint:{"circle-radius":9,"circle-color":"#005ea2","circle-opacity":1,"circle-stroke-color":"#ffffff","circle-stroke-width":3,"circle-stroke-opacity":1,"circle-pitch-alignment":"map"}}]};const St={"#162e51":"#000000","#263238":"#000000","#c8a85a":"#ffd600","#face00":"#ffd600","#73b3e7":"#1565c0","#97d4ea":"#1976d2","#f2938c":"#c62828","#fee685":"#f9a825","#dfe1e2":"#757575","#faf3e2":"#ffffff","#f0e6d1":"#f5f5f5","#5f9070":"#2e7d32","#3f5d4a":"#1b5e20","#c4c8cb":"#616161","#a9aeb1":"#424242","#6f7780":"#212121","#e8e9ed":"#bdbdbd","#b0b1b5":"#424242","#e6e6e2":"#9e9e9e","#242930":"#000000","#b0b0ad":"#000000","#cfe1ec":"#b3e5fc","#d2e0c6":"#c8e6c9","#cdd9c9":"#a5d6a7","#e0e0e0":"#eeeeee","#cabfb6":"#bcaaa4","#ddd2e0":"#ce93d8","#f3e4c4":"#ffe082","#e0e0dd":"#bdbdbd","#b0b0ad ":"#000000","#bcaaa4":"#5d4037","#757575":"#424242","#616161":"#212121","#007aff":"#0050b3","#ffffff":"#ffffff","#005ea2":"#0050b3"};function Ct(t){if(Array.isArray(t))return t.map(Ct);if(t&&"object"==typeof t){const e={};for(const[o,i]of Object.entries(t))e[o]=Ct(i);return e}return"string"!=typeof(e=t)?e:St[e.toLowerCase()]??e;var e}const Pt=function(){const t=structuredClone(Mt);for(const e of t.layers??[])if(e.paint&&(e.paint=Ct(e.paint)),e.paint&&"text-halo-width"in e.paint){const t=e.paint["text-halo-width"];"number"==typeof t&&(e.paint["text-halo-width"]=t+2)}return t}(),Tt=Mt;function zt(t){return"high-contrast"===t?Pt:Tt}function Lt(t,e,o={}){t.sources||={},t.sources[e]||(t.sources[e]={type:"geojson",data:{type:"FeatureCollection",features:[]},...o})}function jt(t){let e=structuredClone(t.style);if(e.sprite=t.customSprite||e.sprite||t.defaultSpriteUrl,Lt(e,a),Lt(e,c),Lt(e,l),Lt(e,p),Lt(e,d,{lineMetrics:!0}),Lt(e,f),Lt(e,"route-endpoints"),t.floorLayers)for(const o of Object.keys(t.floorLayers))Lt(e,`amenity_${o}`),Lt(e,`destination_${o}`),Lt(e,`pathTypes_${o}`);return e}const Bt="https://demotiles.maplibre.org/styles/osm-bright-gl-style/sprite";class Et{config;map=null;data=new it;wayfindingProvider;events=new kt;floorsApi;venue=null;spriteKeys=null;debug;logger;defaultCamera=null;viewModes;reducedMotion=!1;activeThemeName="default";currentLocale;amenityManager;wayfinding;highlightManager;youAreHerePulse=new C;static POI_CATEGORY_LAYERS=[{id:"poi-destination-circles",category:"destination"},{id:"poi-destination-labels",category:"destination"},{id:"poi-entrance-exit-icons",category:"amenity"},{id:"poi-parking-icons",category:"amenity"},{id:"poi-other-amenity-icons",category:"amenity"}];poiVisibleTypes=null;constructor(t){this.config=t,this.debug=Boolean(t.debug??t.options?.debug),this.logger=y({enabled:this.debug,prefix:"MinuteMapsSDK"}),this.viewModes=new z(()=>this.map),this.reducedMotion=Boolean(t.options?.reducedMotion),this.activeThemeName="high-contrast"===t.options?.theme?"high-contrast":"default",this.currentLocale=t.jmap?.locale,this.wayfindingProvider=new pt({getGraph:()=>this.data.getWayfindingGraph?.()??null,warn:(...t)=>this.logger.warn(...t)}),this.floorsApi=new b({getMap:()=>this.map,getConfig:()=>this.config,updatePoiSource:async t=>{const e=this.map;if(!e)return;const o=this.getAllPOIs(t),i=B.toFeatureCollection(o);s.setData(e,l,i);const n={type:"FeatureCollection",features:(this.venue?.mapLabels?.getByMap?.(t)??[]).filter(t=>Array.isArray(t?.coordinates)).map(t=>({type:"Feature",geometry:{type:"Point",coordinates:t.coordinates},properties:{name:t.name??"",rotation:"number"==typeof t.rotation?t.rotation:0,allLevels:!!t.allLevels}}))};s.setData(e,p,n)},log:(...t)=>this.logger.debug(...t)}),this.amenityManager=new V({getVenue:()=>this.venue,getFloors:()=>this.floorsApi.getFloors(),getFloorById:t=>this.floorsApi.getFloors().find(e=>e.id===t)??null,log:(...t)=>this.logger.debug(...t)}),this.wayfinding=new $({getMap:()=>this.map,getVenue:()=>this.venue,getYouAreHerePOI:t=>this.getYouAreHerePOI(t),getYouAreHereCoordinates:t=>this.getYouAreHereCoordinates(t),getCurrentFloor:()=>this.getCurrentFloor(),getKioskHeading:()=>this.getKioskHeading(),getBoundsPadding:()=>this.getBoundsPadding(),computeRoute:async(t,e,o)=>{const i=this.config.jmap.customerId,n=this.config.jmap.venueId;if(null==i)throw new Error("config.jmap.customerId is required");if(null==n)throw new Error("config.jmap.venueId is required");return this.wayfindingProvider.wayfindBetweenWaypoints({customerId:i,venueId:n,from:t,to:e,options:o})},getReducedMotion:()=>this.reducedMotion,log:(...t)=>this.logger.debug(...t),warn:(...t)=>this.logger.warn(...t),debug:this.debug}),this.highlightManager=new W({getMap:()=>this.map,log:(...t)=>this.logger.debug(...t)})}async init(){const{venueId:t,customerId:e}=this.config?.jmap;if(null==t||null==e)throw new Error("config.jmap.customerId and config.jmap.venueId are required");if(!this.config.container)throw new Error("config.container is required (HTMLElement or element id)");this.logger.debug("init :: starting (JACS)",{venueId:t,customerId:e});try{await this.data.init(this.config),this.logger.debug("providers :: JACS ready"),this.venue=await this.data.loadVenue(),this.logger.debug("JACS :: venue loaded",this.venue.id),this.floorsApi.setFloors(this.venue.floors),this.logger.debug("JACS :: floors loaded",{count:this.venue.floors.length});const t=jt({style:zt("custom"===this.activeThemeName?"default":this.activeThemeName),customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:Bt});this.ensureFloorLayersFromStyle(t),this.map=r(this.config.container,t),await new Promise(t=>this.map.once("load",()=>t())),this.map.on("error",t=>{const e=t?.error?.message||t?.message||t;this.logger.error("map :: error",{msg:e,sourceId:t?.sourceId,tile:t?.tile})}),this.map.on("styledata",()=>{try{this.viewModes.onStyleData()}catch{}}),this.map.on("move",()=>{if(!this.map)return;const t=j(this.map);t&&this.events.emit("cameraChange",{camera:t})}),this.ensureCoreSources(),this.spriteKeys=await F.getSpriteKeys(this.map);try{await k.register(this.map,this.venue?.amenities?.items,{iconColor:this.config.options?.amenityIconColor,badge:this.config.options?.amenityBadge})}catch(t){this.logger.warn("amenity icon registration failed",t)}const e=this.floorsApi.getInitialFloor();Boolean(e?.geojson?.features?.length)||this.applyInitialViewFromVenue(),e&&await this.setCurrentFloor(e),this.applyInitialFraming(),this.defaultCamera=j(this.map),this.youAreHerePulse.start(this.map,{reducedMotion:this.reducedMotion}),this.events.emit("ready",{venue:this.venue}),this.events.emit("floorsLoaded",{})}catch(t){throw this.logger.error("init :: failed (JACS)",t),this.events.emit("error",{error:t}),t}}on(t,e){this.events.on(t,e)}off(t,e){this.events.off(t,e)}addControl(t,e){this.map?.addControl(t,e)}setView(t){L(this.map,t)}get amenities(){return this.amenityManager}resetView(t){!function(t,e,o){if(!t||!e)return;const{center:i,zoom:n,pitch:r,bearing:s}=e,a=Boolean(o?.animate),l="number"==typeof o?.duration?o.duration:800;a?t.easeTo({center:i,zoom:n,pitch:r,bearing:s,duration:l}):t.jumpTo({center:i,zoom:n,pitch:r,bearing:s})}(this.map,this.defaultCamera,t)}refit(t){if(!this.map)return;const e=this.wayfinding.getActiveRouteBounds();if(e)return void this.fitToBounds(e,t);const o=this.getCurrentFloor();if(!o?.geojson)return;const i=m.boundsFromGeoJson(o.geojson);i&&this.fitToBounds(i,t)}fitToBounds(t,e){const o=this.map;if(o)try{o.fitBounds(t,{padding:this.getBoundsPadding(),bearing:o.getBearing(),pitch:o.getPitch(),animate:e?.animate??!0,duration:e?.duration??600,maxZoom:21})}catch(t){this.logger.warn("refit :: fitBounds failed",t)}}set3dEnabled(t){this.viewModes.set3dEnabled(t)}toggle3d(){this.viewModes.toggle3d()}getIs3dEnabled(){return this.viewModes.getIs3dEnabled()}async setTheme(t){const e=this.map;if(!e)return void this.logger.warn("setTheme :: map not initialized");const o="default"===t?"default":"high-contrast"===t?"high-contrast":"custom";if("custom"!==o&&o===this.activeThemeName)return void this.logger.debug("setTheme :: noop, theme already active",o);const i=t=>{const o=e.getSource(t);return o?._data??null},n=i(a),r=i(c),s=i(l),h=i(p),g=i(d),y=i(f),m=i("route-endpoints"),w=i(u),b=jt({style:"custom"===o?t:zt(o),customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:Bt});await new Promise((t,i)=>{const I=()=>{try{const i=(t,o)=>{if(null==o)return;const i=e.getSource(t);i?.setData&&i.setData(o)};i(a,n),i(c,r),i(l,s),i(p,h),i(d,g),i(f,y),i("route-endpoints",m),i(u,w);const b=this.getCurrentFloor();b&&this.updateRouteFloorFilter(b.id),e.off("style.load",I),this.activeThemeName=o,this.events.emit("themeChanged",{theme:o}),this.logger.debug("setTheme :: applied",o),t()}catch(t){this.logger.warn("setTheme :: restore failed",t),i(t)}};e.on("style.load",I),e.setStyle(b,{diff:!1})})}getActiveTheme(){return this.activeThemeName}setReducedMotion(t){this.reducedMotion=Boolean(t),this.reducedMotion?this.youAreHerePulse.stop():this.map&&this.youAreHerePulse.start(this.map,{reducedMotion:!1})}getReducedMotion(){return this.reducedMotion}async setLocale(t){const e=t||void 0;if(e===this.currentLocale)return void this.logger.debug("setLocale :: noop, locale already active",e);const o=this.data?.applyLocale?.bind(this.data);if("function"!=typeof o)throw new Error("Active data provider does not support runtime locale switching");if(!e)throw new Error("setLocale requires a non-empty locale code");await o(e),this.currentLocale=e;const i=this.floorsApi.getCurrentFloor();if(i&&this.map){const t=this.getAllPOIs(i),e=B.toFeatureCollection(t);s.setData(this.map,l,e)}this.events.emit("localeChanged",{locale:e}),this.logger.debug("setLocale :: applied",e)}getActiveLocale(){return this.currentLocale}setUnits2dEnabled(t){this.viewModes.setUnits2dEnabled(t)}toggleUnits2d(){this.viewModes.toggleUnits2d()}getIsUnits2dEnabled(){return this.viewModes.getIsUnits2dEnabled()}setFlatMode(t){this.viewModes.setFlatMode(t)}toggleFlatMode(){this.viewModes.toggleFlatMode()}getIsFlatMode(){return this.viewModes.getIsFlatMode()}getFloors(){return this.floorsApi.getFloors()}getCurrentFloor(){return this.floorsApi.getCurrentFloor()}getDefaultFloor(){return this.floorsApi.getDefaultFloor()}getDestinations(t){const e=t||this.getCurrentFloor();return function(t,e){if(!t||!e)return[];try{const o=t.destinations?.getByMap?.({id:e.id})||[];return Array.isArray(o)?o:[]}catch{return[]}}(this.venue,e)}getPolygonLayers(){return this.venue?.polygonLayers??[]}getFloorMapTemplate3d(t){return this.venue?.mapTemplates3d?.[String(t)]??[]}getAllPOIs(t){const e=t||this.getCurrentFloor();if(!e)return[];return function(t,e,o,i,n){return B.buildPOIs(t,e,o,i,n)}(e,this.amenityManager.getByFloorId(e.id),this.getDestinations(e),this.spriteKeys,this.venue?.kioskWaypoint)}getYouAreHerePOI(t){return E(this.getAllPOIs(t))}getYouAreHereCoordinates(t){return function(t){const e=E(t);return e?.coordinates??null}(this.getAllPOIs(t))}getKioskHeading(){const t=this.venue?.kioskWaypoint,e=t?.heading;return"number"==typeof e&&Number.isFinite(e)?e:null}getKioskName(){const t=this.venue?.kioskWaypoint?.deviceName;return"string"==typeof t&&t.trim().length>0?t:null}getWalkTimeFromKiosk(t,e){return ht({graph:this.data.getWayfindingGraph?.()??null,kiosk:this.venue?.kioskWaypoint??null,target:t,options:e})}recenterOnKiosk(t){const e=this.map;if(!e)return;const o=this.getYouAreHereCoordinates();if(!o)return void this.logger.warn("recenterOnKiosk :: no You-Are-Here coordinates available");const i=(t?.animate??!0)&&!this.reducedMotion,n=i?t?.duration??600:0,r=!1!==t?.useHeading?this.getKioskHeading():null;L(e,{center:o,zoom:t?.zoom,pitch:t?.pitch,bearing:r??void 0,animate:i,duration:n})}searchPOIs(t,e){return function(t,e){const o=e.trim().toLowerCase();return o?t.filter(t=>{const e=t.name?.toLowerCase().includes(o),i=(t.keywords||[]).some(t=>t.toLowerCase().includes(o));return e||i}):[]}(this.getAllPOIs(e),t)}searchAllPOIs(t){const e=t?.trim();return e?this.getFloors().flatMap(t=>this.searchPOIs(e,t)):[]}async wayfindBetweenWaypoints(t,e,o){return this.wayfinding.wayfindBetweenWaypoints(t,e,o)}async navigateFromKioskToDestination(t){return this.wayfinding.navigateFromKioskToDestination(t)}async navigateFromKioskToPOI(t,e){const o=t?.waypoint;if(!o)return this.logger.warn("navigateFromKioskToPOI :: POI has no waypoint",t),void this.events.emit("routeFailed",{error:"destination_unavailable",poi:t});const i=this.getYouAreHerePOI()?.waypoint;if(!i)return this.logger.warn("navigateFromKioskToPOI :: no kiosk waypoint available"),void this.events.emit("routeFailed",{error:"no_kiosk_anchor",poi:t});const n=await this.wayfinding.wayfindBetweenWaypoints(i,o,{centerMode:"route",accessible:e?.accessible,avoidStairs:e?.avoidStairs}),r=this.wayfinding.getLastRoutePoints(),s=this.wayfinding.getLastRouteFloorIds();if(r.length>=2){const e=function(t,e){if(!Array.isArray(t)||t.length<2)return[];const o=[],i=[];{let e=0;for(;e<t.length;){const o=t[e].mapId??null;let n=e;for(;n+1<t.length&&(t[n+1].mapId??null)===o;)n++;i.push({floorId:o,startIdx:e,endIdx:n}),e=n+1}}for(let n=0;n<i.length;n++){const r=i[n],s=0===n,a=n===i.length-1,l=gt(t,r,{isFirstLeg:s,isLastLeg:a,ctx:e});if(o.push(...l),!a){const s=i[n+1],a=t[s.startIdx],l=(null!=a?.pathTypeId&&e.pathTypeKind?e.pathTypeKind(a.pathTypeId):null)??"elevator",c=null!=s.floorId?e.floorName(s.floorId):null;null!=r.floorId&&e.floorName(r.floorId);const d=xt(l,c);o.push({type:"transition",transition:l,fromFloorId:r.floorId,toFloorId:s.floorId,floorId:null,pointRange:[r.endIdx,s.startIdx],text:d})}}return o}(r,this.buildDirectionsContext(t));e.length>0&&this.writeActiveStepHighlight(e[0]),this.events.emit("routeReady",{route:{points:r,steps:e,floorIds:s}})}else this.events.emit("routeFailed",{error:"no_route",poi:t});return n}buildDirectionsContext(t){const e=this.getFloors(),o=new Map;for(const t of e){const e=t.mapId??t.id;"number"==typeof e&&o.set(e,t.name??`Floor ${t.id}`)}const i=this.venue?.pathTypes;return{floorName:t=>o.get(t)??null,pathTypeKind:t=>{const e=(t=>{if(i instanceof Map)return(i.get(t)?.name??"").toLowerCase();if(Array.isArray(i)){const e=i.find(e=>e?.id===t);return(e?.name??"").toLowerCase()}return""})(t);return e?/elev|lift/.test(e)?"elevator":/escalat/.test(e)?"escalator":/stair|step/.test(e)?"stairs":null:null},destinations:this.venue?.destinations?.items??[],amenities:this.venue?.amenities?.items??[],mapLabels:this.venue?.mapLabels?.items??[],destinationName:t?.name}}async setActiveStep(t){if(t){if(null!=t.floorId){const e=this.getFloors().find(e=>(e.mapId??e.id)===t.floorId);e&&String(this.getCurrentFloor()?.id)!==String(e.id)&&await this.setCurrentFloor(e)}this.writeActiveStepHighlight(t)}else this.clearActiveStepHighlight()}writeActiveStepHighlight(t){const e=this.map;if(!e)return;if("transition"===t.type)return void this.clearActiveStepHighlight();const o=this.wayfinding.getLastRoutePoints(),[i,n]=t.pointRange,r=[];for(let t=i;t<=n&&t<o.length;t++)r.push(o[t].coordinates);if(r.length<2)return void this.clearActiveStepHighlight();const a={type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:r},properties:{stepType:t.type,floorId:t.floorId??null}}]};s.setData(e,f,a)}clearActiveStepHighlight(){const t=this.map;t&&s.setData(t,f,{type:"FeatureCollection",features:[]})}clearRoute(){this.wayfinding.clearRoute(),this.clearActiveStepHighlight()}async highlightPOI(t){let e=null,o=null;for(const i of this.getFloors()){const n=this.getAllPOIs(i).find(e=>String(e.id)===String(t));if(n){e=n,o=i;break}}e&&o?(String(this.getCurrentFloor()?.id)!==String(o.id)&&await this.setCurrentFloor(o),this.setView({center:e.coordinates,animate:!0,duration:600}),this.highlightManager.highlight(e.coordinates)):this.logger.warn("highlightPOI :: no POI found for id",t)}clearHighlight(){this.highlightManager.clear()}setPOIFilter(t){this.poiVisibleTypes=new Set(t),this.applyPOIFilter()}clearPOIFilter(){this.poiVisibleTypes=null,this.applyPOIFilter()}applyPOIFilter(){const t=this.map;if(!t)return;const e=this.poiVisibleTypes;for(const{id:o,category:i}of Et.POI_CATEGORY_LAYERS){if(!t.getLayer(o))continue;const n=null===e||e.has(i);t.setLayoutProperty(o,"visibility",n?"visible":"none")}}findClosestWaypoint(t,e){if(!t?.length)return null;const o=e??this.getYouAreHereCoordinates();if(!o)return t.find(t=>Array.isArray(t.coordinates)&&t.coordinates.length>=2)??null;let i=null,n=1/0;for(const e of t){const t=e.coordinates;if(!Array.isArray(t)||t.length<2)continue;const r=t[0]-o[0],s=t[1]-o[1],a=r*r+s*s;a<n&&(n=a,i=e)}return i}async navigateFromKioskToClosestAmenity(t,e){const o=this.amenityManager.getDistinct().find(e=>String(e.id)===String(t));if(!o||!o.waypoints?.length)return void this.logger.warn("navigateFromKioskToClosestAmenity :: no waypoints for amenity",t);let i=null,n=1/0;for(const t of o.waypoints){if(!Array.isArray(t.coordinates)||t.coordinates.length<2)continue;const e=this.getWalkTimeFromKiosk(t);e&&e.seconds<n&&(n=e.seconds,i=t)}if(i||(i=this.findClosestWaypoint(o.waypoints)),!i||!Array.isArray(i.coordinates)||i.coordinates.length<2)return void this.logger.warn("navigateFromKioskToClosestAmenity :: no usable waypoint",t);const r=this.findFloorForWaypoint(i);r&&String(this.getCurrentFloor()?.id)!==String(r.id)&&await this.setCurrentFloor(r);const s=i.id,a=this.getAllPOIs(r??void 0).find(e=>"amenity"===e.type&&String(e.id)===String(t)&&(null==s||String(e.waypointId)===String(s)))??{id:o.id,type:"amenity",name:o.name||"Amenity",coordinates:[i.coordinates[0],i.coordinates[1]],floorId:r?.id??"",waypointId:s,waypoint:i};return this.navigateFromKioskToPOI(a,e)}async highlightAmenity(t){const e=this.amenityManager.getDistinct().find(e=>String(e.id)===String(t));if(!e||!e.waypoints?.length)return void this.logger.warn("highlightAmenity :: no waypoints for amenity",t);const o=this.findClosestWaypoint(e.waypoints);if(!o||!Array.isArray(o.coordinates)||o.coordinates.length<2)return void this.logger.warn("highlightAmenity :: no usable waypoint",t);const i=this.findFloorForWaypoint(o);i&&String(this.getCurrentFloor()?.id)!==String(i.id)&&await this.setCurrentFloor(i);const n=[o.coordinates[0],o.coordinates[1]];this.setView({center:n,animate:!0,duration:600}),this.highlightManager.highlight(n)}findFloorForWaypoint(t){const e=t.mapId;return null==e?null:this.getFloors().find(t=>{const o=t.mapId??t.id;return String(o)===String(e)})??null}getCameraPosition(){return j(this.map)}getMap(){return this.map}destroy(){this.youAreHerePulse.stop(),this.highlightManager.destroy(),this.map?.remove(),this.map=null,this.floorsApi.setFloors([]),this.defaultCamera=null,this.viewModes=new z(()=>this.map)}async setCurrentFloor(t){await this.data.ensureFloorGeojson(t),await this.floorsApi.setCurrentFloor(t),this.setFloorLayerVisibility(t.id),this.updateRouteFloorFilter(t.id),this.wayfinding.hasActiveRoute()&&this.wayfinding.refitActiveFloorRoute({animate:!0}),this.events.emit("floorChanged",{floor:t})}updateRouteFloorFilter(t){const e=this.map;if(!e)return;const o=this.getFloors().find(e=>String(e.id)===String(t)),i=["any",["!",["has","floorId"]],["==",["get","floorId"],o?.mapId??t]];for(const t of["route-line","route-halo"])if(e.getLayer(t))try{e.setFilter(t,i)}catch{}}isReady(){return!!this.map}setFloorLayerVisibility(t){const e=this.map;if(!e)return;const o=this.venue?.styleSheet?.floorLayers;if(o)for(const[i,n]of Object.entries(o)){const o=String(i)===String(t);for(const t of n)e.getLayer(t.id)&&e.setLayoutProperty(t.id,"visibility",o?"visible":"none")}}getBoundsPadding(){const t=this.config.options?.boundsPadding??50;if("number"==typeof t||!this.map)return t;const e=this.map.getContainer();return this.clampPadding(t,e.clientWidth,e.clientHeight)}clampPadding(t,e,o){const i=(t,e,o)=>{if(!(o>0))return[t,e];const i=.8*o,n=t+e;if(n<=i)return[t,e];const r=i/n;return[t*r,e*r]},[n,r]=i(t.top,t.bottom,o),[s,a]=i(t.left,t.right,e);return{top:n,bottom:r,left:s,right:a}}getVenueBounds(){const t=this.venue?.coordinates;if(!t)return null;const{bottomLng:e,bottomLat:o,topLng:i,topLat:n}=t;if(null==e||null==o||null==i||null==n)return null;const r=Math.min(e,i),s=Math.max(e,i);return[[r,Math.min(o,n)],[s,Math.max(o,n)]]}applyInitialFraming(){const t=this.map;if(!t)return;const{initialPitch:e,initialZoom:o,minZoomBelowInitialFit:i}=this.config.options??{},n=this.getYouAreHereCoordinates(),r=this.getKioskHeading();("number"==typeof e||"number"==typeof o||n||null!=r)&&t.easeTo({center:n??t.getCenter(),zoom:"number"==typeof o?o:t.getZoom(),pitch:"number"==typeof e?e:t.getPitch(),bearing:r??t.getBearing(),duration:0}),"number"==typeof i&&t.setMinZoom(Math.max(0,t.getZoom()-i))}applyInitialViewFromVenue(){const t=this.map;if(!t)return;const e=this.getVenueBounds();if(e)try{t.resize(),t.fitBounds(e,{padding:this.getBoundsPadding(),animate:!1,duration:0,maxZoom:21})}catch(t){this.logger.warn("applyInitialViewFromVenue :: fitBounds failed",t)}}async loadAndPatchVenueStyle(){const t=this.venue?.styleSheet?.styleUrl,e=this.venue?.styleSheet?.floorLayers,o=Tt;if("sdkTemplate"===this.config.options?.styleMode)return this.logger.debug("style :: styleMode=sdkTemplate, ignoring venue styleUrl"),jt({style:o,floorLayers:e,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:Bt});if(!t)return this.logger.warn("style :: venue.styleSheet.styleUrl missing, using baseStyle"),jt({style:o,floorLayers:e,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:Bt});try{const o=await fetch(t);if(!o.ok)throw new Error(`HTTP ${o.status} ${o.statusText}`);return jt({style:await o.json(),floorLayers:e,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:Bt})}catch(t){return this.logger.warn("style :: failed to fetch venue styleUrl, using baseStyle",t),jt({style:o,floorLayers:e,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:Bt})}}ensureFloorLayersFromStyle(t){const e=this.venue?.styleSheet?.floorLayers;if(e&&Object.keys(e).length)return;const o={};for(const e of t.layers||[]){const t=e.id||"",i=/_(\d+)$/.exec(t);if(!i)continue;const n=i[1];o[n]||=[],o[n].push({id:t})}this.venue||={},this.venue.styleSheet||={},this.venue.styleSheet.floorLayers=o}ensureCoreSources(){const t=this.map;if(!t)return;const e={type:"FeatureCollection",features:[]};s.ensureGeoJson(t,a),s.ensureGeoJson(t,c),s.ensureGeoJson(t,l),s.ensureGeoJson(t,u),t.getSource(d)||t.addSource(d,{type:"geojson",data:e,lineMetrics:!0}),t.getSource("route-endpoints")||t.addSource("route-endpoints",{type:"geojson",data:e})}}exports.MinuteMaps=Et,exports.createMinuteMapsSDK=function(t){return new Et(t)};
2
2
  //# sourceMappingURL=index.cjs.map