(self.webpackChunklswebuicore=self.webpackChunklswebuicore||[]).push([[7982],{48167:function(e,t,r){"use strict";r.a(e,(async function(e,n){try{r.r(t),r.d(t,{initGeofencesLayer:function(){return h},setGeofencesData:function(){return l}});var a=r(78181),o=r(99601),i=r(87905),u=r.n(i),s=e([a,o]);[a,o]=s.then?(await s)():s;var c=r.n(o),p="geofencing",f="geofencing",d=function(e,t){t||(t=64);var r={IGeoFenceProperties:!0,radiusMeters:e.radiusMeters,latitude:e.latitude,longitude:e.longitude,message:e.message,venueId:e.venueId};return e.customCTA&&(r.customCTAUrl=e.customCTA.url,r.customCTAText=e.customCTA.text),{type:"Feature",geometry:u()([e.longitude,e.latitude],e.radiusMeters,t),properties:r}};function l(e,t){var r;null===(r=e.getSource(p))||void 0===r||r.setData({type:"FeatureCollection",features:t.map((function(e){return d(e)}))})}function h(e,t){var r={type:"geojson",data:{type:"FeatureCollection",features:t.map((function(e){return d(e)}))}};e.addSource(p,r),e.addLayer({id:f,type:"fill",source:p,layout:{},paint:{"fill-antialias":!0,"fill-color":"rgba(255, 141, 107, 0.20)","fill-opacity":1,"fill-outline-color":"#FF8D6B"}});var n=e.getCanvasContainer(),o=document.createElement("div");o.className="hq_popup",o.id="hq_popup";var i=document.createElement("div");i.className="hq_popup-anchor",n.append(i);var u,s=c()(i,{arrow:!0,interactiveBorder:0,interactive:!0,maxWidth:"none",content:o,offset:[0,0],placement:"top",appendTo:document.body,theme:"liquidspace"});e.on("mousemove",f,(function(t){var r,n=null===(r=t.features)||void 0===r?void 0:r.filter((function(e){return e.properties&&e.properties.IGeoFenceProperties})).map((function(e){return e.properties})).sort((function(e,t){return e.radiusMeters-t.radiusMeters}))[0];if(n){var c;if(n.venueId!=u){if(o.innerHTML="",o.append(n.message),n.customCTAUrl&&n.customCTAText){var p=document.createElement("a");p.className="hq_popup-CTA",p.href=n.customCTAUrl,p.innerText=n.customCTAText,p.target="_blank",o.append(p)}s.setContent(o),u=n.venueId}var f=new a.LngLat(n.longitude,n.latitude).wrap().toBounds(n.radiusMeters),d=e.project(f.getNorthEast()),l=e.project(f.getSouthWest()),h=e.getBounds(),m=e.project(h.getNorthEast()),y=e.project(h.getSouthWest()),b=Math.max(l.x,y.x),g=Math.min(d.x,m.x)-b,v=Math.max(d.y,m.y),w=Math.min(l.y,y.y)-v;i.style.top="".concat(v,"px"),i.style.left="".concat(b,"px"),i.style.height="".concat(w,"px"),i.style.width="".concat(g,"px"),null===(c=s.popperInstance)||void 0===c||c.update()}}))}n()}catch(m){n(m)}}))},87905:function(e,t,r){"use strict";var{validateInput:n}=r(40901);const a=6378137;function o(e){return e*Math.PI/180}function i(e){return 180*e/Math.PI}function u(e,t,r,n){var a=o(e[1]),u=o(e[0]),s=t/r,c=Math.asin(Math.sin(a)*Math.cos(s)+Math.cos(a)*Math.sin(s)*Math.cos(n));return[i(u+Math.atan2(Math.sin(n)*Math.sin(s)*Math.cos(a),Math.cos(s)-Math.sin(a)*Math.sin(c))),i(c)]}function s(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function c(e){return null==e}e.exports=function(e,t,r){var i=function(e){if(c(e))return 32;if(s(e)){var t=e.numberOfEdges;return void 0===t?32:t}return e}(r),p=function(e){if(c(e))return a;if(s(e)){var t=e.earthRadius;return void 0===t?a:t}return a}(r),f=function(e){if(c(e))return 0;if(s(e)){var t=e.bearing;return void 0===t?0:t}return 0}(r),d=function(e){return s(e)&&e.rightHandRule?-1:1}(r);n({center:e,radius:t,numberOfEdges:i,earthRadius:p,bearing:f});for(var l=o(f),h=[],m=0;m<i;++m)h.push(u(e,t,p,l+2*d*Math.PI*-m/i));return h.push(h[0]),{type:"Polygon",coordinates:[h]}}},40901:function(e,t,r){var n=r(26568).Z,a=r(25455).d,o=r(49472).m,i=r(79148).j,u=r(2240).M;t.validateCenter=n,t.validateRadius=a,t.validateNumberOfEdges=o,t.validateEarthRadius=i,t.validateBearing=u,t.validateInput=function({center:e,radius:t,numberOfEdges:r,earthRadius:s,bearing:c}){n(e),a(t),o(r),i(s),u(c)}},2240:function(e,t){t.M=function(e){if("number"!=typeof e){const t=Array.isArray(e)?"array":typeof e;throw new Error(`ERROR! Bearing has to be a number but was: ${t}`)}}},26568:function(e,t){t.Z=function(e){if(!Array.isArray(e)||![2,3].includes(e.length))throw new Error("ERROR! Center has to be an array of length two or three");var[t,r]=e;if("number"!=typeof t||"number"!=typeof r)throw new Error(`ERROR! Longitude and Latitude has to be numbers but where ${typeof t} and ${typeof r}`);if(t>180||t<-180)throw new Error(`ERROR! Longitude has to be between -180 and 180 but was ${t}`);if(r>90||r<-90)throw new Error(`ERROR! Latitude has to be between -90 and 90 but was ${r}`)}},79148:function(e,t){t.j=function(e){if("number"!=typeof e){const t=Array.isArray(e)?"array":typeof e;throw new Error(`ERROR! Earth radius has to be a number but was: ${t}`)}if(e<=0)throw new Error(`ERROR! Earth radius has to be a positive number but was: ${e}`)}},49472:function(e,t){t.m=function(e){if("number"!=typeof e){const t=Array.isArray(e)?"array":typeof e;throw new Error(`ERROR! Number of edges has to be a number but was: ${t}`)}if(e<3)throw new Error(`ERROR! Number of edges has to be at least 3 but was: ${e}`)}},25455:function(e,t){t.d=function(e){if("number"!=typeof e)throw new Error("ERROR! Radius has to be a positive number but was: "+typeof e);if(e<=0)throw new Error(`ERROR! Radius has to be a positive number but was: ${e}`)}},78181:function(e,t,r){"use strict";var n=new Error;e.exports=new Promise((function(e,t){if("undefined"!=typeof mapboxgl)return e();r.l("https://api.mapbox.com/mapbox-gl-js/v2.1.1/mapbox-gl.js",(function(r){if("undefined"!=typeof mapboxgl)return e();var a=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;n.message="Loading script failed.\n("+a+": "+o+")",n.name="ScriptExternalLoadError",n.type=a,n.request=o,t(n)}),"mapboxgl")})).then((function(){return mapboxgl}))},99601:function(e,t,r){"use strict";var n=new Error;e.exports=new Promise((function(e,t){if("undefined"!=typeof tippy)return e();r.l("https://cdn.jsdelivr.net/npm/tippy.js@6/dist/tippy.umd.min.js",(function(r){if("undefined"!=typeof tippy)return e();var a=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;n.message="Loading script failed.\n("+a+": "+o+")",n.name="ScriptExternalLoadError",n.type=a,n.request=o,t(n)}),"tippy")})).then((function(){return tippy}))}},function(e){var t=(48167,e(e.s=48167));MapGeofenceLib=t}]);
//# sourceMappingURL=MapGeofence.a75d02e0f442a1a085e8.js.map