UNPKG

@smartrep/web-widget

Version:

Client side library to load the web widget

2 lines 51.6 kB
/*! For license information please see 121.index.js.LICENSE.txt */ "use strict";(self.webpackChunkWebChat=self.webpackChunkWebChat||[]).push([[121],{5121:(e,t,r)=>{r.r(t),r.d(t,{InnerWidgetMap:()=>se,default:()=>pe});var n=r(6540),o=r(4550);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t,r){return(t=function(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}const s=function(){var e,t,r=(e=(0,n.useState)({lat:null,lng:null,location:null,error:null,loading:!0}),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=r[0],a=r[1];return(0,n.useEffect)((function(){navigator.geolocation?navigator.geolocation.getCurrentPosition((function(e){var t=e.coords.latitude,r=e.coords.longitude;a({lat:t,lng:r,location:{lat:t,lng:r},error:null,loading:!1})}),(function(e){var t;switch(e.code){case e.PERMISSION_DENIED:t="User denied the request for geolocation";break;case e.POSITION_UNAVAILABLE:t="Location information is unavailable";break;case e.TIMEOUT:t="The request to get user location timed out";break;default:t="An unknown error occurred"}a((function(e){return l(l({},e),{},{error:t,loading:!1})}))}),{enableHighAccuracy:!0}):a((function(e){return l(l({},e),{},{error:"Geolocation is not supported by this browser",loading:!1})}))}),[]),o};function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function f(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var c=n&&n.prototype instanceof l?n:l,u=Object.create(c.prototype);return d(u,"_invoke",function(r,n,o){var a,l,c,u=0,s=o||[],p=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,l=0,c=e,f.n=r,i}};function d(r,n){for(l=r,c=n,t=0;!p&&u&&!o&&t<s.length;t++){var o,a=s[t],d=f.p,m=a[2];r>3?(o=m===n)&&(l=a[4]||3,c=a[5]===e?a[3]:a[5],a[4]=3,a[5]=e):a[0]<=d&&((o=r<2&&d<a[1])?(l=0,f.v=n,f.n=a[1]):d<m&&(o=r<3||a[0]>n||n>m)&&(a[4]=r,a[5]=n,f.n=m,l=0))}if(o||r>1)return i;throw p=!0,n}return function(o,s,m){if(u>1)throw TypeError("Generator is already running");for(p&&1===s&&d(s,m),l=s,c=m;(t=l<2?e:c)||!p;){a||(l?l<3?(l>1&&(f.n=-1),d(l,c)):f.n=c:f.v=c);try{if(u=2,a){if(l||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,l<2&&(l=0)}else 1===l&&(t=a.return)&&t.call(a),l<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),l=1);a=e}else if((t=(p=f.n<0)?c:r.call(n,f))!==i)break}catch(t){a=e,l=1,c=t}finally{u=1}}return{value:t,done:p}}}(r,o,a),!0),u}var i={};function l(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][n]?t(t([][n]())):(d(t={},n,(function(){return this})),t),p=u.prototype=l.prototype=Object.create(s);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,d(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return c.prototype=u,d(p,"constructor",u),d(u,"constructor",c),c.displayName="GeneratorFunction",d(u,o,"GeneratorFunction"),d(p),d(p,o,"Generator"),d(p,n,(function(){return this})),d(p,"toString",(function(){return"[object Generator]"})),(f=function(){return{w:a,m}})()}function d(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}d=function(e,t,r,n){if(t)o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r;else{var a=function(t,r){d(e,t,(function(e){return this._invoke(t,r,e)}))};a("next",0),a("throw",1),a("return",2)}},d(e,t,r,n)}function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){b(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function b(e,t,r){return(t=function(e){var t=function(e){if("object"!=p(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=p(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==p(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function v(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){y(a,n,o,i,l,"next",e)}function l(e){y(a,n,o,i,l,"throw",e)}i(void 0)}))}}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return w(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function k(e){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k(e)}function S(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?S(Object(r),!0).forEach((function(t){x(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function x(e,t,r){return(t=function(e){var t=function(e){if("object"!=k(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=k(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==k(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return E(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function P(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach((function(t){C(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function C(e,t,r){return(t=function(e){var t=function(e){if("object"!=N(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==N(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_.apply(null,arguments)}function N(e){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},N(e)}function T(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var c=n&&n.prototype instanceof l?n:l,u=Object.create(c.prototype);return L(u,"_invoke",function(r,n,o){var a,l,c,u=0,s=o||[],p=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,l=0,c=e,f.n=r,i}};function d(r,n){for(l=r,c=n,t=0;!p&&u&&!o&&t<s.length;t++){var o,a=s[t],d=f.p,m=a[2];r>3?(o=m===n)&&(l=a[4]||3,c=a[5]===e?a[3]:a[5],a[4]=3,a[5]=e):a[0]<=d&&((o=r<2&&d<a[1])?(l=0,f.v=n,f.n=a[1]):d<m&&(o=r<3||a[0]>n||n>m)&&(a[4]=r,a[5]=n,f.n=m,l=0))}if(o||r>1)return i;throw p=!0,n}return function(o,s,m){if(u>1)throw TypeError("Generator is already running");for(p&&1===s&&d(s,m),l=s,c=m;(t=l<2?e:c)||!p;){a||(l?l<3?(l>1&&(f.n=-1),d(l,c)):f.n=c:f.v=c);try{if(u=2,a){if(l||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,l<2&&(l=0)}else 1===l&&(t=a.return)&&t.call(a),l<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),l=1);a=e}else if((t=(p=f.n<0)?c:r.call(n,f))!==i)break}catch(t){a=e,l=1,c=t}finally{u=1}}return{value:t,done:p}}}(r,o,a),!0),u}var i={};function l(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][n]?t(t([][n]())):(L(t={},n,(function(){return this})),t),p=u.prototype=l.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,L(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return c.prototype=u,L(p,"constructor",u),L(u,"constructor",c),c.displayName="GeneratorFunction",L(u,o,"GeneratorFunction"),L(p),L(p,o,"Generator"),L(p,n,(function(){return this})),L(p,"toString",(function(){return"[object Generator]"})),(T=function(){return{w:a,m:f}})()}function L(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}L=function(e,t,r,n){if(t)o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r;else{var a=function(t,r){L(e,t,(function(e){return this._invoke(t,r,e)}))};a("next",0),a("throw",1),a("return",2)}},L(e,t,r,n)}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(e,t)||D(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(e,t){if(e){if("string"==typeof e)return M(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?M(e,t):void 0}}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function U(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function F(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){U(a,n,o,i,l,"next",e)}function l(e){U(a,n,o,i,l,"throw",e)}i(void 0)}))}}function B(e,t){return R.apply(this,arguments)}function R(){return(R=F(T().m((function e(t,r){var n,o,a,i;return T().w((function(e){for(;;)switch(e.n){case 0:return e.n=1,fetch("https://webservices.acscourier.net/ACSRestServices/api/ACSAutoRest",{method:"POST",headers:P({"Content-Type":"application/json"},r&&{AcsApiKey:r}),body:JSON.stringify({ACSAlias:"ACS_GEOCODING_API",ACSInputParameters:{inputAddress:t,language:"",provider:"default",locatorRole:"Lite",key:""}})});case 1:return a=e.v,e.n=2,a.json();case 2:if(!(i=e.v).ACSExecution_HasError){e.n=3;break}throw new Error(i.ACSExecutionErrorMessage);case 3:return e.a(2,null!==(n=null===(o=i.ACSOutputResponce)||void 0===o||null===(o=o.ACSValueOutput)||void 0===o||null===(o=o[0])||void 0===o?void 0:o.ACSObjectOutput)&&void 0!==n?n:null)}}),e)})))).apply(this,arguments)}var z=function(e){var t=e.value,r=e.onChange,a=e.onPlaceSelect,i=e.inputProps,l=void 0===i?{}:i,c=e.searchLabel,u=e.details,s=void 0===u?{}:u,p=e.suggestions,d=void 0===p?{}:p,m=e.customMapsApiKey,b=void 0===m?"":m,y=e.fallbackSwitchLabel,w=e.onFallbackClick,k=e.children,S=(0,o.ST)("places"),x=I((0,n.useState)(!b),2),E=x[0],j=x[1],P=I((0,n.useState)(-1),2),C=P[0],L=P[1],U=I((0,n.useState)(!0),2),R=U[0],z=U[1],G=I((0,n.useState)(!0),2),H=G[0],K=G[1],Y=(0,n.useRef)(!1),V=function(e){var t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=h((0,n.useState)([]),2),a=o[0],i=o[1],l=h((0,n.useState)(!1),2),c=l[0],u=l[1],s=h((0,n.useState)(!1),2),p=s[0],d=s[1],m=(0,n.useRef)(null),b=(0,n.useRef)(null);return(0,n.useEffect)((function(){if(m.current&&clearTimeout(m.current),b.current&&b.current.abort(),d(!1),t&&!(e.length<3))return m.current=setTimeout(v(f().m((function t(){var n,o,a,l,c,s,p;return f().w((function(t){for(;;)switch(t.n){case 0:return n=new AbortController,b.current=n,u(!0),t.p=1,t.n=2,fetch("https://webservices.acscourier.net/ACSRestServices/api/ACSAutoRest",{method:"POST",headers:g({"Content-Type":"application/json"},r&&{AcsApiKey:r}),body:JSON.stringify({ACSAlias:"ACS_INTERACTIVE_ADDR_SEARCH_API",ACSInputParameters:{inputAddress:e,provider:"default",locatorRole:"Lite"}}),signal:n.signal});case 2:return o=t.v,t.n=3,o.json();case 3:a=t.v,n.signal.aborted||(a.ACSExecution_HasError?(console.error("ACS suggestions error:",a.ACSExecutionErrorMessage),i([])):(s=null!==(l=null===(c=a.ACSOutputResponce)||void 0===c||null===(c=c.ACSValueOutput)||void 0===c||null===(c=c[0])||void 0===c?void 0:c.ACSObjectOutput)&&void 0!==l?l:[],i(s))),t.n=5;break;case 4:t.p=4,"AbortError"!==(p=t.v).name&&(console.error("ACS suggestions fetch error:",p),i([]));case 5:return t.p=5,n.signal.aborted||(u(!1),d(!0)),t.f(5);case 6:return t.a(2)}}),t,null,[[1,4,5,6]])}))),500),function(){m.current&&clearTimeout(m.current),b.current&&b.current.abort()};i([])}),[e,t,r]),{suggestions:a,isLoading:c,hasFetched:p,resetSession:(0,n.useCallback)((function(){i([])}),[])}}(t,d,R&&!E,b),J=V.suggestions,Q=V.hasFetched,X=V.resetSession,q=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=(0,o.ST)("places"),i=(0,n.useRef)(null),l=A((0,n.useState)([]),2),c=l[0],u=l[1],s=A((0,n.useState)(!1),2),p=s[0],f=s[1];return(0,n.useEffect)((function(){if(a)if(r){var n=a.AutocompleteSessionToken,o=a.AutocompleteSuggestion;i.current||(i.current=new n);var l=O(O({},t),{},{input:e,sessionToken:i.current});""!==e?(f(!0),o.fetchAutocompleteSuggestions(l).then((function(e){u(e.suggestions),f(!1)}))):c.length>0&&u([])}else c.length>0&&u([])}),[a,e,r]),{suggestions:c,isLoading:p,resetSession:function(){i.current=null,u([])}}}(t,d,R&&E),W=q.suggestions,Z=q.resetSession,$=E?W:J,ee=(0,n.useMemo)((function(){return H?$:[]}),[H,$]);(0,n.useEffect)((function(){L(-1)}),[ee]);var te=(0,n.useCallback)((function(e){Y.current||(z(!0),K(!0)),r(e.target.value)}),[r]),re=(0,n.useCallback)((function(e){Y.current=!0,z(!1),K(!1),ne.current=e.trim(),r(e),setTimeout((function(){Y.current&&(z(!0),Y.current=!1)}),300)}),[r]),ne=(0,n.useRef)(""),oe=(0,n.useCallback)(function(){var e=F(T().m((function e(t){var n,o,i;return T().w((function(e){for(;;)switch(e.n){case 0:return K(!1),z(!1),L(-1),X(),Y.current=!0,r(t.suggestionLabel),e.p=1,e.n=2,B(t.suggestionLabel,b);case 2:(n=e.v)&&null!=n.latitude&&null!=n.longitude&&(o=n.fullAddress||t.suggestionLabel,ne.current=o.trim(),a({lat:n.latitude,lng:n.longitude,address:o}),n.fullAddress&&r(n.fullAddress)),e.n=4;break;case 3:e.p=3,i=e.v,console.error("ACS geocoding error:",i);case 4:setTimeout((function(){Y.current=!1}),300);case 5:return e.a(2)}}),e,null,[[1,3]])})));return function(t){return e.apply(this,arguments)}}(),[a,r,X,b]),ae=(0,n.useCallback)(function(){var e=F(T().m((function e(t){var n,o,i,l;return T().w((function(e){for(;;)switch(e.n){case 0:if(S&&t.placePrediction){e.n=1;break}return e.a(2);case 1:return K(!1),z(!1),L(-1),Z(),Y.current=!0,r(t.placePrediction.text.text),n=t.placePrediction.toPlace(),e.n=2,n.fetchFields({fields:[].concat((c=s.fields||["location"],function(e){if(Array.isArray(e))return M(e)}(c)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(c)||D(c)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),["types"])});case 2:o=n.location.lat(),i=n.location.lng(),l=t.placePrediction.text.text,ne.current=l.trim(),a({lat:o,lng:i,address:l}),setTimeout((function(){Y.current=!1}),300);case 3:return e.a(2)}var c}),e)})));return function(t){return e.apply(this,arguments)}}(),[S,a,r,Z,s]),ie=E?ae:oe,le=(0,n.useCallback)((function(e){if(0!==ee.length)switch(e.key){case"ArrowDown":e.preventDefault(),L((function(e){return e<ee.length-1?e+1:0}));break;case"ArrowUp":e.preventDefault(),L((function(e){return e>0?e-1:ee.length-1}));break;case"Enter":C>=0&&C<ee.length&&(e.preventDefault(),ie(ee[C]));break;case"Escape":L(-1),K(!1),setTimeout((function(){return K(!0)}),100)}}),[ee,C,ie]),ce=(0,n.useCallback)(function(){var e=F(T().m((function e(n){var o,i,l,c;return T().w((function(e){for(;;)switch(e.n){case 0:if(n.preventDefault(),t.trim()){e.n=1;break}return e.a(2);case 1:if(t.trim()!==ne.current){e.n=2;break}return e.a(2);case 2:if(!(o=ee[0])){e.n=4;break}return ne.current=t.trim(),e.n=3,ie(o);case 3:return e.a(2);case 4:return K(!1),z(!1),X(),e.p=5,e.n=6,B(t,b);case 6:(i=e.v)&&null!=i.latitude&&null!=i.longitude&&(ne.current=t.trim(),l=i.fullAddress||t,a({lat:i.latitude,lng:i.longitude,address:l}),i.fullAddress&&(Y.current=!0,r(i.fullAddress),setTimeout((function(){Y.current=!1}),300))),e.n=8;break;case 7:e.p=7,c=e.v,console.error("ACS geocoding error:",c);case 8:return e.a(2)}}),e,null,[[5,7]])})));return function(t){return e.apply(this,arguments)}}(),[t,ee,ie,a,r,X,b]),ue=(0,n.useCallback)((function(){j(!0),X(),z(!0),K(!0)}),[X]);return(0,n.useEffect)((function(){l.ref&&"object"===N(l.ref)&&(l.ref.current={updateValueProgrammatically:re})}),[re,l.ref]),n.createElement("div",{className:"gplaces-container"},n.createElement("form",{className:"gplaces-input",onSubmit:ce},n.createElement("div",{className:"gplaces-input__input-wrapper"},n.createElement("input",_({value:t,onInput:function(e){return te(e)},onKeyDown:le,className:"gplaces-input__input"},l)),t&&n.createElement("button",{type:"button",className:"gplaces-input__clear-button",onClick:function(){r(""),ne.current=""},"aria-label":"Clear input"},"×")),n.createElement("button",{type:"submit",onClick:ce,className:"gplaces-input__button"},c),k),(ee.length>0||!E&&y&&H&&t.trim().length>=3)&&n.createElement("ul",{className:"gplaces-list"},ee.map((function(e,t){return n.createElement("button",{key:t,className:"gplaces-list__item ".concat(t===C?"gplaces-list__item--selected":""),onClick:function(){return ie(e)},onKeyDown:function(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),ie(e))},style:{borderBottom:t===ee.length-1?"none":""}},function(e){var t;return E?null===(t=e.placePrediction)||void 0===t?void 0:t.text.text:e.suggestionLabel}(e))})),!E&&y&&Q&&n.createElement("footer",{className:"gplaces-footer"},n.createElement("button",{type:"button",className:"gplaces-footer__fallback-btn",onClick:function(){ue(),w&&w()}},y)),E&&n.createElement("footer",{className:"gplaces-footer"},n.createElement("img",{src:"data:image/png;base64,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",className:"gplaces-logo",alt:"Powered by Google"}))))},G=r(5899),H=r(961),K=r(9418),Y=r(3861);function V(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function J(e){var t,r,o=e.marker,a=e.isOpen,i=e.onClose,l=e.containerClassName,c=e.selectMarker,u=(t=(0,n.useState)(null),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(t,r)||function(e,t){if(e){if("string"==typeof e)return V(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?V(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=u[0],p=u[1];if((0,n.useEffect)((function(){var e=document.querySelector(".".concat(l));e?("static"===window.getComputedStyle(e).position&&(e.style.position="relative"),p(e)):Y.A.info('Container with class "'.concat(l,'" not found'))}),[l]),(0,n.useEffect)((function(){var e=function(e){"Escape"===e.key&&a&&i()};if(a&&s){document.addEventListener("keydown",e),document.body.style.overflow="hidden";var t=s.style.overflow;s.style.overflow="hidden",s._originalOverflow=t}return function(){document.removeEventListener("keydown",e),document.body.style.overflow="",s&&void 0!==s._originalOverflow&&(s.style.overflow=s._originalOverflow,delete s._originalOverflow)}}),[a,i,s]),!a||!o||!s)return null;if(!o.popup)return null;var f=n.createElement("div",{className:"marker-popup-overlay"},n.createElement("div",{className:"marker-popup-backdrop",onClick:i,onKeyDown:function(e){return"Escape"===e.key&&i()},tabIndex:0,role:"button","aria-label":"Close popup"}),n.createElement("div",{className:"marker-popup-content"},n.createElement("div",{className:"marker-popup-cover ".concat(o.popup.cover?"":"marker-popup-cover--no-cover"),style:o.popup.cover?{}:{height:60}},o.popup.cover&&n.createElement("img",{src:o.popup.cover,alt:o.storeDescription,onError:function(e){e.target.style.display="none"}}),n.createElement("button",{className:"marker-popup-close-btn",onClick:i},"×")),n.createElement("div",{className:"marker-popup-header"},n.createElement("h1",{className:"marker-popup-title"},o.popup.title),n.createElement("button",{className:"marker-popup-select-btn".concat(o.popup.buttonDisabled?" marker-popup-select-btn--disabled":""),onClick:function(){c(o.popup.buttonPayload,o.popup.title)},disabled:o.popup.buttonDisabled},o.popup.button)),n.createElement("div",{className:"marker-popup-body ".concat(o.coverPhotoUrl?"marker-popup-body--with-cover":"marker-popup-body--no-cover")},n.createElement("div",{className:"marker-popup-details"},o.popup.rows.map((function(e){return n.createElement("div",{className:"marker-detail-item",key:e.label},n.createElement("span",{className:"marker-detail-icon",dangerouslySetInnerHTML:{__html:K.A.sanitize(e.icon)}}),n.createElement("span",{className:"marker-detail-text",dangerouslySetInnerHTML:{__html:K.A.sanitize(e.label,{ADD_ATTR:["target"]})}}))}))))));return(0,H.createPortal)(f,s)}var Q=r(9689),X=r(5072),q=r.n(X),W=r(9809);function Z(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var c=n&&n.prototype instanceof l?n:l,u=Object.create(c.prototype);return $(u,"_invoke",function(r,n,o){var a,l,c,u=0,s=o||[],p=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,l=0,c=e,f.n=r,i}};function d(r,n){for(l=r,c=n,t=0;!p&&u&&!o&&t<s.length;t++){var o,a=s[t],d=f.p,m=a[2];r>3?(o=m===n)&&(l=a[4]||3,c=a[5]===e?a[3]:a[5],a[4]=3,a[5]=e):a[0]<=d&&((o=r<2&&d<a[1])?(l=0,f.v=n,f.n=a[1]):d<m&&(o=r<3||a[0]>n||n>m)&&(a[4]=r,a[5]=n,f.n=m,l=0))}if(o||r>1)return i;throw p=!0,n}return function(o,s,m){if(u>1)throw TypeError("Generator is already running");for(p&&1===s&&d(s,m),l=s,c=m;(t=l<2?e:c)||!p;){a||(l?l<3?(l>1&&(f.n=-1),d(l,c)):f.n=c:f.v=c);try{if(u=2,a){if(l||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,l<2&&(l=0)}else 1===l&&(t=a.return)&&t.call(a),l<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),l=1);a=e}else if((t=(p=f.n<0)?c:r.call(n,f))!==i)break}catch(t){a=e,l=1,c=t}finally{u=1}}return{value:t,done:p}}}(r,o,a),!0),u}var i={};function l(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][n]?t(t([][n]())):($(t={},n,(function(){return this})),t),p=u.prototype=l.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,$(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return c.prototype=u,$(p,"constructor",u),$(u,"constructor",c),c.displayName="GeneratorFunction",$(u,o,"GeneratorFunction"),$(p),$(p,o,"Generator"),$(p,n,(function(){return this})),$(p,"toString",(function(){return"[object Generator]"})),(Z=function(){return{w:a,m:f}})()}function $(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}$=function(e,t,r,n){if(t)o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r;else{var a=function(t,r){$(e,t,(function(e){return this._invoke(t,r,e)}))};a("next",0),a("throw",1),a("return",2)}},$(e,t,r,n)}function ee(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){return void r(e)}l.done?t(c):Promise.resolve(c).then(n,o)}function te(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){ee(a,n,o,i,l,"next",e)}function l(e){ee(a,n,o,i,l,"throw",e)}i(void 0)}))}}function re(){return re=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},re.apply(null,arguments)}function ne(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return oe(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?oe(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ae(e){var t=e.id,r=e.label,o=e.icon;return n.createElement("div",{id:t,className:"map-header-icon"},n.createElement("img",{src:o,alt:r,className:"map-header-icon__icon"}),n.createElement("span",{className:"map-header-icon__label"},r))}function ie(e){var t=e.legend,r=e.myLocation,o=e.handleMyLocationClick,a=e.geolocationIsLoading,i=e.geolocationError,l=r&&!i&&!a;return n.createElement("header",{className:"map-header"},t.length&&n.createElement("div",{className:"map-header__icons"},t.map((function(e){return n.createElement(ae,{key:e.id,id:e.id,label:e.label,icon:e.icon})}))),l&&n.createElement("button",{type:"button",onClick:o,className:"map-header__my-location-button"},n.createElement(ae,{id:"my-location",label:r.label,icon:r.src})))}function le(e){var t=e.popupConfig,r=(e.markersConfig,e.selectMarker),a=e.markers,i=(e.markersLoading,e.markersError,e.zoom),l=e.markersUrl,c=e.gmapsLogsUrl,u=e.sessionId,s=ne((0,n.useState)([]),2),p=s[0],f=s[1],d=ne((0,n.useState)(null),2),m=d[0],g=d[1],b=ne((0,n.useState)(!1),2),y=b[0],v=b[1],h=(0,o.ko)(),w=(0,n.useRef)(new window.Map),k=(0,n.useRef)(null),S=(0,n.useRef)(null),O=(0,n.useCallback)((function(e,t){if(!t)return!0;var r=parseFloat(e.latitude),n=parseFloat(e.longtitude),o=t.getNorthEast(),a=t.getSouthWest(),i=.5*(o.lat()-a.lat())/2,l=.5*(o.lng()-a.lng())/2,c=o.lat()+i,u=o.lng()+l,s=a.lat()-i,p=a.lng()-l;return r>=s&&r<=c&&n>=p&&n<=u}),[]),x=(0,n.useCallback)((function(){if(h)if(a.length){var e,t,r=h.getBounds(),n=a.filter((function(e){return O(e,r)}));c&&(e={bounds:r,zoom:i,totalMarkers:a.length,visibleMarkers:n.length,markersUrl:l,sessionId:u,hostname:window.location.hostname},t=new Blob([JSON.stringify(e)],{type:"text/plain"}),navigator.sendBeacon(c,t)),f(n)}else f([])}),[h,a,O,c,i,l,u]),A=(0,n.useCallback)((function(){S.current&&clearTimeout(S.current),S.current=setTimeout((function(){x()}),300)}),[x]);(0,n.useEffect)((function(){if(h){x();var e=h.addListener("bounds_changed",A);return function(){var t;S.current&&clearTimeout(S.current),e&&null!==(t=window.google)&&void 0!==t&&null!==(t=t.maps)&&void 0!==t&&t.event&&window.google.maps.event.removeListener(e)}}}),[h,x,A]);var E=(0,n.useCallback)((function(e){g(e),v(!0)}),[]),j=(0,n.useCallback)((function(){v(!1),g(null)}),[]);(0,n.useEffect)((function(){if(h){var e=setTimeout((function(){k.current&&(k.current.clearMarkers(),k.current=null);var e=Array.from(w.current.values()).filter(Boolean);if(0!==e.length)try{var t=new G.w1({markers:e,map:h,renderer:{render:function(e){var t=e.count,r=e.position,n=document.createElement("div");return n.className="gplaces-result-cluster",n.textContent=t.toString(),new window.google.maps.marker.AdvancedMarkerElement({position:r,content:n,zIndex:1e3})}}});k.current=t}catch(e){console.error("Error creating clusterer:",e)}}),100);return function(){clearTimeout(e),k.current&&k.current.clearMarkers()}}}),[h,p]);var P=(0,n.useCallback)((function(e,t){t?w.current.set(e,t):w.current.delete(e)}),[]);return n.createElement(n.Fragment,null,p.map((function(e){var t=function(e){return"marker-".concat(e.id)}(e),r=parseFloat(e.latitude),a=parseFloat(e.longtitude);return isNaN(r)||isNaN(a)?null:n.createElement(o.J8,{key:t,ref:function(e){return P(t,e)},position:{lat:r,lng:a},onClick:function(){return E(e)},title:e.storeDescription},n.createElement("img",{src:e.markerUrl,alt:e.storeDescription,width:30,style:{cursor:"pointer"}}))})),n.createElement(J,{marker:m,isOpen:y,onClose:j,containerClassName:t.containerClassName,selectMarker:r}))}function ce(e){var t=e.options,r=void 0===t?{}:t,a=e.currentLocation,i=e.currentCenter,l=e.setCurrentCenter,c=e.zoom,u=e.setZoom,s=e.handleMarkerDragEnd,p=e.selectMarker,f=e.markers,d=e.markersLoading,m=e.markersError,g=e.markersUrl,b=e.gmapsLogsUrl,y=e.sessionId,v=r.map.config||{},h=r.mode;return n.createElement(n.Fragment,null,n.createElement(o.T5,re({mapId:r.id,className:"rw-gmaps-map",center:i,zoom:c,onCameraChanged:function(e){var t=e.detail,r=t.center,n=t.zoom;l(r),u(n)},gestureHandling:"greedy"},v.map),(a||"address-search-selection"===h&&i)&&n.createElement(o.J8,{position:"address-search-selection"===h?i:a,draggable:"address-search"===h,onDragEnd:"address-search"===h?s:void 0},n.createElement("img",{src:r.header.myLocation.src,alt:r.header.myLocation.label,className:"location-marker_icon"})),n.createElement(le,{currentLocation:a,popupConfig:r.popup,markersConfig:r.results,selectMarker:p,markers:f,markersLoading:d,markersError:m,zoom:c,markersUrl:g,gmapsLogsUrl:b,sessionId:y})))}function ue(e){var t=e.loading;return n.createElement("div",{className:"loading-indicator",style:{opacity:t?1:0}},n.createElement("div",{className:"loading-indicator__bar"},n.createElement("div",{className:"loading-indicator__progress"})))}function se(e){var t,r,o=e.options,a=e.selectMarker,i=e.selectPlace,l=e.fetchMarkers,c=e.messageId,u=e.markers,p=e.markersLoading,f=e.markersError,d=e.markersUrl,m=e.gmapsLogsUrl,g=e.customMapsApiKey,b=e.gmapsFallbackIntent,y=e.sendFallbackIntent,v=e.sessionId,h=(0,n.useMemo)((function(){return{lat:parseFloat(o.map.defaultCenter.lat),lng:parseFloat(o.map.defaultCenter.lng)}}),[o.map.defaultCenter]),w=o.mode,k="address-search"===w,S="address-search-selection"===w,O=s(),x=O.location,A=O.error,E=O.loading,j=ne((0,n.useState)(null),2),P=j[0],C=j[1],_=ne((0,n.useState)(h),2),N=_[0],T=_[1],L=ne((0,n.useState)(o.map.zoom),2),I=L[0],D=L[1],M=ne((0,n.useState)(""),2),U=M[0],F=M[1],B=ne((0,n.useState)(null),2),R=B[0],G=B[1],H=(0,n.useRef)(null),K=(0,n.useRef)(null),V=(0,n.useRef)(null);function J(e){C(e),T(e)}var Q=(0,n.useCallback)(function(){var e=te(Z().m((function e(t,r){var n,o,a,i,l,c,u,s;return Z().w((function(e){for(;;)switch(e.n){case 0:if(null!==(n=window.google)&&void 0!==n&&n.maps){e.n=1;break}return e.a(2,null);case 1:return o=new window.google.maps.Geocoder,a=new window.google.maps.LatLng(t,r),e.p=2,e.n=3,o.geocode({location:a});case 3:if(!((i=e.v).results&&i.results.length>0)){e.n=4;break}return c=i.results[0],u=null===(l=c.types)||void 0===l?void 0:l.includes("plus_code"),e.a(2,{address:u?"":c.formatted_address,isPlusCode:u});case 4:e.n=6;break;case 5:e.p=5,s=e.v,console.error("Error reverse geocoding:",s);case 6:return e.a(2,null)}}),e,null,[[2,5]])})));return function(t,r){return e.apply(this,arguments)}}(),[]);(0,n.useEffect)((function(){E||A||setTimeout((function(){C(x),T(x),k&&!S&&x&&Q(x.lat,x.lng).then((function(e){var t;e&&!e.isPlusCode&&(F(e.address),G({address:e.address,lat:x.lat,lng:x.lng}),null!==(t=K.current)&&void 0!==t&&t.updateValueProgrammatically&&K.current.updateValueProgrammatically(e.address))}))}),100)}),[E,A,x,k,S,Q]),(0,n.useEffect)((function(){if(S&&N)return V.current&&clearTimeout(V.current),V.current=setTimeout(te(Z().m((function e(){var t,r,n,o,a;return Z().w((function(e){for(;;)switch(e.n){case 0:return e.n=1,Q(N.lat,N.lng);case 1:(t=e.v)&&!t.isPlusCode?(F(t.address),G({address:t.address,lat:N.lat,lng:N.lng}),null!==(r=K.current)&&void 0!==r&&r.updateValueProgrammatically&&K.current.updateValueProgrammatically(t.address),d&&l&&(n=d.includes("?")?"&":"?",o="".concat(d).concat(n,"address=").concat(encodeURIComponent(t.address)),l(c,o))):(F(""),G(null),null!==(a=K.current)&&void 0!==a&&a.updateValueProgrammatically&&K.current.updateValueProgrammatically(""));case 2:return e.a(2)}}),e)}))),1e3),function(){V.current&&clearTimeout(V.current)}}),[S,N,Q,d,l,c]);var X=(0,n.useCallback)(function(){var e=te(Z().m((function e(t){var r,n,o,a,i;return Z().w((function(e){for(;;)switch(e.n){case 0:if(t.latLng){e.n=1;break}return e.a(2);case 1:if(r=t.latLng.lat(),n=t.latLng.lng(),C({lat:r,lng:n}),!S){e.n=2;break}return e.a(2);case 2:return e.n=3,Q(r,n);case 3:(o=e.v)&&!o.isPlusCode?(F(o.address),G({address:o.address,lat:r,lng:n}),null!==(a=K.current)&&void 0!==a&&a.updateValueProgrammatically&&K.current.updateValueProgrammatically(o.address)):(F(""),G(null),null!==(i=K.current)&&void 0!==i&&i.updateValueProgrammatically&&K.current.updateValueProgrammatically(""));case 4:return e.a(2)}}),e)})));return function(t){return e.apply(this,arguments)}}(),[Q,S]),q=(0,n.useCallback)((function(){R&&i&&i({address:R.address,location:{lat:R.lat,lng:R.lng}})}),[R,i]);return(0,n.useLayoutEffect)((function(){setTimeout((function(){if(H.current){var e=document.getElementById("rw-messages");if(e){var t=H.current.getBoundingClientRect(),r=e.getBoundingClientRect(),n=e.scrollTop+(t.top-r.top);e.scrollTop=n}}}),100)}),[]),n.createElement("div",{ref:H,className:"rw-gmaps"},n.createElement(ie,{handleMyLocationClick:function(){E||(navigator.geolocation?navigator.geolocation.getCurrentPosition(function(){var e=te(Z().m((function e(t){var r,n,o,a;return Z().w((function(e){for(;;)switch(e.n){case 0:if(J(r={lat:t.coords.latitude,lng:t.coords.longitude}),!k||S){e.n=2;break}return e.n=1,Q(r.lat,r.lng);case 1:(n=e.v)&&!n.isPlusCode?(F(n.address),G({address:n.address,lat:r.lat,lng:r.lng}),null!==(o=K.current)&&void 0!==o&&o.updateValueProgrammatically&&K.current.updateValueProgrammatically(n.address)):(F(""),G(null),null!==(a=K.current)&&void 0!==a&&a.updateValueProgrammatically&&K.current.updateValueProgrammatically("")),e.n=3;break;case 2:F("");case 3:return e.a(2)}}),e)})));return function(t){return e.apply(this,arguments)}}(),(function(e){Y.A.info("Error getting location:",e)}),{enableHighAccuracy:!0}):Y.A.info("Geolocation is not supported by this browser"))},legend:o.header.legend,myLocation:o.header.myLocation,geolocationIsLoading:E,geolocationError:A}),n.createElement(z,{value:U,onChange:F,onPlaceSelect:function(e){var t=e.lat,r=e.lng,n=e.address;if(k||S){if(J({lat:t,lng:r}),G({address:n||"",lat:t,lng:r}),S&&d&&n&&l){var a=d.includes("?")?"&":"?",i="".concat(d).concat(a,"address=").concat(encodeURIComponent(n));l(c,i)}}else T({lat:t,lng:r}),D(o.map.zoom)},inputProps:{placeholder:o.autocomplete.placeholder,ref:K},searchLabel:o.autocomplete.searchLabel,suggestions:o.autocomplete.options.suggestions,details:o.autocomplete.options.details,customMapsApiKey:g,fallbackSwitchLabel:o.autocomplete.fallbackSwitchLabel,onFallbackClick:b?function(){return y(b)}:void 0},k&&n.createElement("button",{type:"button",className:"gplaces-input__select-button",disabled:!R,onClick:q},null!==(t=null===(r=o.autocomplete)||void 0===r?void 0:r.selectLabel)&&void 0!==t?t:"")),S&&n.createElement(ue,{loading:p}),n.createElement("div",{id:"map-wrapper",className:"map-wrapper"},n.createElement(ce,{options:o,currentLocation:P,currentCenter:N,setCurrentCenter:T,handleMarkerDragEnd:X,zoom:I,setZoom:D,selectMarker:a,markers:u,markersLoading:p,markersError:f,markersUrl:d,gmapsLogsUrl:m,sessionId:v})))}q()(W.A,{insert:"head",singleton:!1}),W.A.locals;const pe=(0,r(1225).Ng)((function(e,t){var r=e.messages,n=r.get(t.id+2),o=r.get(t.id),a=o?o.get("markers"):null,i=!!o&&o.get("markersLoading"),l=o?o.get("markersError"):null;return{isDisabled:!!n&&"client"===n.get("sender")&&!n.get("hidden"),markers:a?a.toJS():[],markersLoading:i,markersError:l}}),(function(e){return{selectMarker:function(t,r){e((0,Q.GB)(r)),e((0,Q.cR)(t))},selectPlace:function(t){var r=t.address||"Selected location";e((0,Q.GB)(r)),e((0,Q.cR)(JSON.stringify(t)))},sendFallbackIntent:function(t){e((0,Q.cR)(t))},fetchMarkers:(t=te(Z().m((function t(r,n){var o,a,i;return Z().w((function(t){for(;;)switch(t.n){case 0:return e((0,Q.bq)(r)),t.p=1,t.n=2,fetch(n);case 2:return o=t.v,t.n=3,o.json();case 3:a=t.v,e((0,Q._y)(r,a.items)),t.n=5;break;case 4:t.p=4,i=t.v,e((0,Q.Dp)(r,i.message));case 5:return t.a(2)}}),t,null,[[1,4]])}))),function(e,r){return t.apply(this,arguments)})};var t}))((function(e){var t=e.id,r=e.message,a=e.selectMarker,i=e.selectPlace,l=e.fetchMarkers,c=e.isDisabled,u=e.markers,s=e.markersLoading,p=e.markersError,f=e.gmapsApiKey,d=e.gmapsLogsUrl,m=e.customMapsApiKey,g=e.gmapsFallbackIntent,b=e.sendFallbackIntent,y=e.sessionId,v=n.useMemo((function(){var e,t,n,o=r.toJS(),a=null!==(e=null==o||null===(t=o.config)||void 0===t||null===(t=t.results)||void 0===t?void 0:t.url)&&void 0!==e?e:null;return{options:null!==(n=o.config)&&void 0!==n?n:null,markersUrl:a}}),[r]),h=v.options,w=v.markersUrl;return c?null:h?n.createElement(o.c4,{apiKey:f?atob(f):h.apiKey,language:h.map.locale},n.createElement(se,{options:h,selectMarker:a,selectPlace:i,fetchMarkers:l,messageId:t,markers:u,markersLoading:s,markersError:p,markersUrl:w,gmapsLogsUrl:d,customMapsApiKey:m,gmapsFallbackIntent:g,sendFallbackIntent:b,sessionId:y})):null}))},9809:(e,t,r)=>{r.d(t,{A:()=>l});var n=r(1601),o=r.n(n),a=r(6314),i=r.n(a)()(o());i.push([e.id,"@import url(https://fonts.googleapis.com/css?family=Inter:400,500,700&display=swap);"]),i.push([e.id,".rw-gmaps{width:100%;display:flex;flex-direction:column;position:relative}.rw-gmaps .map-wrapper{position:relative;flex:1;background-color:#f5f5f5}.rw-gmaps .map-header{width:100%;display:flex;justify-content:space-between;align-items:center;margin-bottom:5px}.rw-gmaps .map-header__icons{display:flex;gap:4px}.rw-gmaps .map-header-icon{display:flex;align-items:center;gap:2px}.rw-gmaps .map-header-icon__label{font-size:11px;line-height:1.15;user-select:none;text-align:left}.rw-gmaps .map-header-icon__icon{width:24px}.rw-gmaps .map-header__my-location-button{background-color:rgba(0,0,0,0);border:none;cursor:pointer;transition:background-color .3s ease;font-weight:600}.rw-gmaps .map-header__my-location-button:hover{background-color:#f5f5f5}.rw-gmaps .gplaces-container{width:100%;position:relative;margin-bottom:6px}.rw-gmaps .gplaces-input{display:flex;justify-content:space-between;gap:2px}.rw-gmaps .gplaces-input__input-wrapper{position:relative;flex:1;display:flex;align-items:center}.rw-gmaps .gplaces-input__input{width:100%;padding:8px;padding-right:24px;font-size:12px;border:1px solid #ccc;outline:none}.rw-gmaps .gplaces-input__clear-button{position:absolute;right:4px;background:none;border:none;font-size:16px;color:#999;cursor:pointer;padding:0 4px;line-height:1}.rw-gmaps .gplaces-input__clear-button:hover{color:#333}.rw-gmaps .gplaces-input__button{background-color:#666;color:#fff;border:none;font-size:12px;padding:8px}.rw-gmaps .gplaces-list{position:absolute;top:100%;left:0;width:100%;background-color:#fff;border:1px solid #ccc;list-style:none;padding:0 !important;margin:0;margin-top:4px;z-index:1}.rw-gmaps .gplaces-list__item{width:100%;padding:5px;cursor:pointer;border-bottom:1px solid #ccc;background-color:#fff;font-size:12px;border:none;text-align:left}.rw-gmaps .gplaces-list__item:hover{background-color:#f5f5f5}.rw-gmaps .gplaces-list__item--selected{background-color:#e3f2fd;font-weight:bold}.rw-gmaps .gplaces-footer{display:flex;justify-content:flex-end;padding:6px}.rw-gmaps .gplaces-footer .gplaces-logo{width:100px}.rw-gmaps .gplaces-footer__fallback-btn{width:100%;padding:8px 12px;background-color:#e8f0fe;border:1px solid #c2d7f2;border-radius:4px;color:#1a56db;font-size:12px;font-weight:600;cursor:pointer;text-align:center;transition:background-color .2s ease,border-color .2s ease}.rw-gmaps .gplaces-footer__fallback-btn:hover{background-color:#d4e4fc;border-color:#a8c4eb}.rw-gmaps .gplaces-input__select-button{background-color:#666;color:#fff;border:none;font-size:12px;padding:8px;cursor:pointer;transition:background-color .2s ease}.rw-gmaps .gplaces-input__select-button:hover:not(:disabled){background-color:#444}.rw-gmaps .gplaces-input__select-button:disabled{opacity:.5;cursor:not-allowed}.rw-gmaps .loading-indicator{width:100%;height:3px;background-color:#f0f0f0;overflow:hidden;position:relative}.rw-gmaps .loading-indicator__bar{width:100%;height:100%;background-color:#e0e0e0;position:relative}.rw-gmaps .loading-indicator__progress{position:absolute;top:0;left:0;height:100%;width:30%;background:linear-gradient(90deg, #4152a3, #6173b4, #8194c5, #a1b5d6);animation:loading-slide 2s infinite ease-in-out}@keyframes loading-slide{0%{left:-30%}50%{left:100%}100%{left:-30%}}.rw-gmaps .rw-gmaps-map{width:100%;height:275px;background-color:#f5f5f5}@media screen and (max-width: 800px){.rw-gmaps .rw-gmaps-map{height:350px}}.rw-gmaps .gplaces-result-cluster{display:flex;align-items:center;justify-content:center;background-color:#666;border:1px solid #fff;border-radius:50%;color:#fff;font-size:10px;font-weight:bold;text-align:center;line-height:1;width:30px;height:30px;cursor:pointer}.location-marker_icon{width:24px;height:24px}.marker-popup-overlay{position:fixed;top:0;left:0;width:100%;height:100%;z-index:10000;display:flex;align-items:center;justify-content:center;overflow:hidden}.marker-popup-backdrop{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.6)}.marker-popup-content{position:relative;width:90%;max-width:400px;background:#fff;border-radius:12px;overflow:hidden;box-shadow:0 10px 40px rgba(0,0,0,.2);animation:popupSlideIn .3s ease-out;max-height:85%;display:flex;flex-direction:column}.marker-popup-cover{position:relative;width:100%;height:120px;overflow:hidden;flex-shrink:0;background-color:#f5f5f5}.marker-popup-cover img{width:100%;height:100%;object-fit:cover;object-position:center}.marker-popup-close-btn{position:absolute;top:12px;right:12px;width:32px;height:32px;border:none;background:hsla(0,0%,100%,.9);border-radius:50%;fon