Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.108/Geolocation/Geolocation.es",["module","exports","require","dynamic-data-mapping-form-field-type$leaflet/dist/leaflet.css","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$react","../FieldBase/ReactFieldBase.es","./useGeolocation.es"],(function(e,t,a){var n;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,a("dynamic-data-mapping-form-field-type$leaflet/dist/leaflet.css");var l=(n=a("@frontend-taglib-clay$clayui/icon"))&&n.__esModule?n:{default:n},r=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=d();if(t&&t.has(e))return t.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var r=n?Object.getOwnPropertyDescriptor(e,l):null;r&&(r.get||r.set)?Object.defineProperty(a,l,r):a[l]=e[l]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),o=a("../FieldBase/ReactFieldBase.es"),i=a("./useGeolocation.es");function d(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return d=function(){return e},e}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e}).apply(this,arguments)}function s(e,t){if(null==e)return{};var a,n,l=function(e,t){if(null==e)return{};var a,n,l={},r=Object.keys(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||(l[a]=e[a]);return l}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(l[a]=e[a])}return l}const e=Liferay.Language.get("geolocate"),f=Liferay.ThemeDisplay.getPathThemeImages();class p extends r.default.Component{shouldComponentUpdate(){return!1}render(){return r.default.createElement("div",this.props)}}const m=t=>{let{disabled:a,googleMapsAPIKey:n,instanceId:o,mapProviderKey:d,name:u,onChange:m,value:y,viewMode:g}=t,v=s(t,["disabled","googleMapsAPIKey","instanceId","mapProviderKey","name","onChange","value","viewMode"]);const[b,O]=(0,r.useState)(),P=(0,r.useCallback)((({newVal:{address:e,location:t}})=>{O(e),m(JSON.stringify(t))}),[m,O]);return(0,i.useGeolocation)({disabled:a,googleMapsAPIKey:n,instanceId:o,mapProviderKey:d,name:u,onChange:P,value:y,viewMode:g}),r.default.createElement("div",c({},v,{className:"ddm-geolocation field-labels-inline"}),!a||g?r.default.createElement("div",null,r.default.createElement("div",null,r.default.createElement(l.default,{symbol:"geolocation"}),b),r.default.createElement("dl",null,r.default.createElement("dt",{className:"text-capitalize"}),r.default.createElement("dd",null,r.default.createElement(p,{className:"lfr-map",id:"map_".concat(o),style:{height:"280px"}}),r.default.createElement("input",{id:"input_value_".concat(o),name:u,type:"hidden"})))):r.default.createElement("img",{alt:Liferay.Language.get("geolocation"),className:"w-100",src:"".concat(f,"/common/geolocation.png"),style:{maxWidth:"150px"},title:e}))},y=e=>{let{googleMapsAPIKey:t,instanceId:a,mapProviderKey:n=i.MAP_PROVIDER.openStreetMap,name:l,onChange:d,readOnly:u,value:f,viewMode:p}=e,y=s(e,["googleMapsAPIKey","instanceId","mapProviderKey","name","onChange","readOnly","value","viewMode"]);return r.default.createElement(o.FieldBase,c({name:l,readOnly:u},y),r.default.createElement(m,{disabled:u,googleMapsAPIKey:t,instanceId:a,mapProviderKey:n,name:l,onChange:e=>d({},e),value:f,viewMode:p}))};y.displayName="Geolocation";var u=y;t.default=u}}));
//# sourceMappingURL=Geolocation.es.js.map