MapPress Easy Google Maps - Version 2.62.11

Version Description

  • Fixed: default POI zoom setting not saving
Download this release

Release Info

Developer chrisvrichardson
Plugin Icon 128x128 MapPress Easy Google Maps
Version 2.62.11
Comparing to
See all releases

Code changes from version 2.62.10 to 2.62.11

build/index_mappress_admin.js CHANGED
@@ -1 +1 @@
1
- !function(){var e={215:function(e,t,n){"use strict";n.r(t);var o=n(525),a=n(143);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c,s=window.mapp||{},p=wp.element.createElement;c=jQuery,s.Editor=function(e){this.drawingManager=null,this.map=e,this.poiEditor=null;var t=this;this.initialize=function(){this.map.display(),this.poiEditor=new s.PoiEditor(this.map),this.initDrawingManager(),c(this.map.places).off("search.mapp"),c(this.map.places).on("search.mapp",(function(e,n){t.insert(n)}))},this.insert=function(e){if(e)if(this.drawingManager&&this.drawingManager.setDrawingMode(null),this.map.poiClose(),e.geometry){var n=e.formatted_address?e.formatted_address.replace(/, United States of America/i,"").replace(/, United States/i,"").replace(/, USA/i,""):null,o=e.name==n?"":n,a=new s.Poi({address:n,body:o,iconid:this.poiEditor.lastIcon,point:e.geometry.location,title:e.name,viewport:e.geometry.viewport?e.geometry.viewport:null});this.map.poiInsert(a),a.center()}else e.overlay?(this.map.poiHover(null),"marker"==e.type?(a=new s.Poi({body:"",iconid:null,overlay:null,point:e.overlay.getPosition().toJSON(),title:e.overlay.getPosition().toUrlValue(6),type:null}),e.overlay.setMap(null)):a=new s.Poi({body:"",iconid:null,overlay:e.overlay,title:mappl10n.shape,type:e.type}),this.map.poiInsert(a)):"string"==typeof e&&"http"==e.substring(0,4)&&(a=new s.Poi({iconid:this.poiEditor.lastIcon,kml:{url:e},title:"KML",type:"kml"}),t.map.poiInsert(a),s.event.addListenerOnce(a.overlay,"ready defaultviewport_changed",(function(){a.center()})))},this.initDrawingManager=function(){var e={fillColor:"#0000FF",fillOpacity:.4,strokeColor:"#0000FF",strokeOpacity:1,strokeWeight:2};"leaflet"==mappl10n.options.engine||google.maps.drawing&&(this.drawingManager=new google.maps.drawing.DrawingManager({drawingControlOptions:{position:google.maps.ControlPosition.TOP_CENTER,drawingModes:[google.maps.drawing.OverlayType.MARKER,google.maps.drawing.OverlayType.POLYGON,google.maps.drawing.OverlayType.POLYLINE,google.maps.drawing.OverlayType.RECTANGLE,google.maps.drawing.OverlayType.CIRCLE]},circleOptions:e,polygonOptions:e,polylineOptions:e,rectangleOptions:e}),this.drawingManager.setMap(this.map.getMap()),s.event.addListener(this.drawingManager,"overlaycomplete",(function(e){t.drawingManager.get("drawingMode")&&t.insert(e)})))},this.initialize.apply(this)},s.PoiEditor=function(e){this.map=e,this.poi=null,this.sel=null,this.lastIcon=null;var t=this;this.initialize=function(){this.sel=c(this.map.iw.getContent()),c(this.map).on("mapp.open",(function(e,n){t.render(n)})),c(this.map).on("mapp.close",(function(){t.mce(!1)})),this.sel.on("click","[data-mapp-poi]",(function(e){e.preventDefault();var n=c(this).attr("data-mapp-poi");t[n]()})),this.sel.on("click",".mapp-poi-visual, .mapp-poi-html",(function(e){var n=c(this).hasClass("mapp-poi-visual");t.mce(n)})),this.sel.on("keydown",(function(e){13==e.which&&"mapp-poi-body"!=e.target.id&&(e.preventDefault(),t.save())}))},this.cancel=function(){this.map.poiClose()},this.initMCE=function(){if("undefined"!=typeof tinyMCE&&void 0!==tinyMCE.init){var e="en";if(void 0!==window.tinyMCEPreInit&&void 0!==window.tinyMCEPreInit.mceInit&&void 0!==window.tinyMCEPreInit.mceInit.content){var t=window.tinyMCEPreInit.mceInit.content;e=void 0!==t.language?t.language:"en"}var n={mode:"none",height:"100%",convert_urls:!1,language:e,menubar:!1,plugins:"image,paste,textcolor,wordpress,wpeditimage,wplink,wpview",relative_urls:!1,remove_script_host:!1,statusbar:!1,theme:"modern",toolbar1:"bold,italic,link",toolbar2:"",toolbar3:"",toolbar4:""};tinyMCE.init(n),this.mce(!0)}},this.mce=function(e){var n=e?"mceAddEditor":"mceRemoveEditor";"undefined"!=typeof tinyMCE&&tinyMCE.execCommand(n,!1,"mapp-poi-body"),c(".mapp-poi-visual, .mapp-poi-html",t.sel).removeClass("mapp-active"),e?c(".mapp-poi-visual",t.sel).addClass("mapp-active"):c(".mapp-poi-html",t.sel).addClass("mapp-active")},this.remove=function(){confirm(mappl10n.delete_prompt)&&(this.map.poiClose(),this.map.poiRemove(this.poi))},this.render=function(e){this.poi=e,this.renderColorPicker(this.poi),this.renderIconPicker(this.poi),this.initMCE()},this.renderColorPicker=function(e){var t=this;document.getElementById("mapp-poi-colorpicker")&&wp.element.render(p(o.MappColorPicker,i(i({},e.getTemplateColors()),{},{isExtended:!0,onChange:function(n){e.set({dirty:!0}),e.setTemplateColors(n),t.map.renderList(),t.renderColorPicker(e)}})),document.getElementById("mapp-poi-colorpicker"))},this.renderIconPicker=function(e){var t=this;document.getElementById("mapp-poi-iconpicker")&&wp.element.render(p(a.MappIconPicker,{iconid:e.iconid,onChange:function(n){e.set({dirty:!0,iconid:n}),t.lastIcon=n,t.map.renderList(),t.renderIconPicker(e)}}),document.getElementById("mapp-poi-iconpicker"))},this.save=function(){"undefined"!=typeof tinyMCE&&tinyMCE.get("mapp-poi-body")&&tinyMCE.get("mapp-poi-body").save(),this.poi.set({dirty:!0,title:c(".mapp-poi-title").val(),body:c(".mapp-poi-body").val()}),this.map.renderList(),this.map.poiClose()},this.initialize.apply(this)}},713:function(e,t,n){"use strict";function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}(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 l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}n.r(t),n.d(t,{default:function(){return y}});var c=wp.element.createElement,s=wp.url.addQueryArgs,p=wp.element,u=p.useCallback,m=p.useEffect,d=p.useState,f=wp.components,h=(f.Button,f.Dropdown),g=f.Spinner,b=f.TextControl,__=function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")};function y(e){var t=i(d({isFetching:!1,results:[],search:"",searchTerm:""}),2),n=t[0],o=t[1];function r(e){o((function(t){return a(a({},t),e)}))}m((function(){n.isOpen&&(r({isFetching:!0}),wp.apiFetch({path:s("/wp/v2/search",{search:n.search,per_page:20})}).then((function(e){r({results:e,isFetching:!1})})))}),[n.search,n.isOpen]);var l=u(_.debounce((function(e){r({search:e})}),1e3),[]);function p(t,o){return c("div",{className:"mapp-attach-control"},c("div",{className:"mapp-attach-control-toolbar"},c(b,{autoComplete:"false",value:n.searchTerm,onChange:function(e){r({searchTerm:e}),l(e)},placeholder:__("Search")})),function(){if(n.isFetching)return c(g,null);if(n.results)return n.results.length?c("div",{className:"mapp-attach-items"},n.results.map((function(t){return c("div",{key:t.id,className:"mapp-attach-item",onClick:function(){e.onChange(t.id,t.title)}},c("div",{className:"mapp-attach-item-title"},t.title?t.title:__("Untitled")),c("div",{className:"mapp-attach-item-type"},t.type))}))):c("div",{},__("No posts found"))}())}return c("div",{onClick:function(e){return e.stopPropagation()}},c(h,{onToggle:function(e){return r({isOpen:e})},renderToggle:function(e){e.isOpen;var t=e.onToggle;return c("a",{href:"#",onClick:t},__("Attach"))},renderContent:function(e){e.isOpen,e.onToggle;return p()}}))}},525:function(e,t,n){"use strict";n.r(t),n.d(t,{MappColorPicker:function(){return y}});var o=n(824);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(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 c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var s=wp.element.createElement,p=wp.element,u=p.Fragment,m=p.useEffect,d=(p.useLayoutEffect,p.useCallback,p.useRef,p.useState),f=(wp.data.useSelect,wp.compose.withState,wp.components),h=f.Button,g=(f.ColorPalette,f.ColorPicker),b=(f.Dashicon,f.Dropdown,f.ExternalLink,f.Modal),__=(f.Panel,f.PanelBody,f.PanelRow,f.Popover,f.RadioControl,f.Spinner,f.TabPanel,function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")});function y(e){var t=l(d({isCustomOpen:!1,isOpen:!1}),2),n=t[0],a=t[1];function i(e){a((function(t){return r(r({},t),e)}))}function c(t,n){switch(t){case"close":i({isOpen:!1});break;case"open":i({isOpen:!0});break;case"select":e.onChange(n),c("close");break;case"set":e.onChange(n)}}return m((function(){}),[]),s(u,null,s("span",{className:"mapp-colors-toggle",onClick:function(){return c("open",null)},style:{backgroundColor:e.color,border:e.isExtended?"1px solid "+e.color:"1px solid gray",opacity:e.isExtended&&e.opacity?e.opacity/100:1},tabIndex:0}),function(){if(!n.isOpen)return null;var t=_.map([100,90,80,70,60,50,40,30,20,10,0],(function(e){return{label:e+"%",value:e}})),a=_.map([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],(function(e){return{label:e+"px",value:e}}));return s(b,{title:__("Select a color"),className:"mapp-colors-modal",onRequestClose:function(e){return c("close")}},s("div",{className:"mapp-colors"},s("div",{className:"mapp-colors-list"},_.map([["yellow","yellowgreen","green","seagreen","blue","cornflowerblue","darkslateblue","purple","firebrick","red","darkorange","orange","saddlebrown"],["lightyellow","greenyellow","lightgreen","darkseagreen","lightblue","skyblue","slateblue","orchid","plum","pink","sandybrown","goldenrod","peru"],["white","lightgray","gray","black"]],(function(t,n){return s("div",{key:n},_.map(t,(function(t){return s("span",{className:"mapp-color"+(t==e.color?" mapp-selected":""),key:t,onClick:function(){i({isCustomOpen:!1}),c("select",{color:t})},style:{backgroundColor:t},title:t})})))}))),n.isCustomOpen&&s(g,{color:e.color,onChangeComplete:function(e){return c("set",{color:e.hex})},disableAlpha:!0}),e.isExtended&&s(o.Select,{label:__("Opacity"),options:t,value:e.opacity?e.opacity:"",onChange:function(e){return c("set",{opacity:e})}}),e.isExtended&&s(o.Select,{label:__("Stroke"),options:a,value:e.weight?e.weight:"",onChange:function(e){return c("set",{weight:e})}}),s("div",{className:"mapp-colors-toolbar"},s(h,{isPrimary:!0,onClick:function(){return c("close")}},__("Done")),s(h,{isLink:!0,onClick:function(){return i({isCustomOpen:!n.isCustomOpen})}},__("Custom color")))))}())}},999:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return v}});var o=n(429);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(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 c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var s=window.mapp||{},p=wp.element.createElement,u=wp.element,m=(u.Fragment,u.useEffect),d=(u.useLayoutEffect,u.useRef),f=u.useState,h=wp.components,g=h.Button,b=(h.Dropdown,h.Modal,h.Panel,h.PanelBody),y=(h.Popover,h.Spinner,h.TextControl),__=function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")};function v(e){var t,n,a=l(f({dragging:null,dragover:null,isFetchingMap:!!e.mapid,isPoiListOpen:!0,isSavingMap:!1,map:null,mapdata:null}),2),i=a[0],c=a[1],u=d(null);function h(e){c((function(t){return r(r({},t),e)}))}function v(e){h({map:i.map})}function w(t,n){switch(t){case"change-settings":i.map.set(n),h({map:i.map});break;case"change-title":i.map.set({dirty:!0,title:n}),h({map:i.map});break;case"close":e.onAction("edit-close");break;case"destroy":confirm(mappl10n.delete_map_prompt)&&(s.store.destroyMap({mapid:e.mapid}),e.onAction("edit-destroy"));break;case"save":s.store.saveMap({mapdata:i.map.toJSON(),success:function(t){i.map.set({dirty:!1}),e.onAction("edit-save",t.mapid)}})}}return m((function(){i.map&&(jQuery(i.map.div.list).off("render",v),jQuery(i.map.div.list).on("render",(function(e){return v()})))}),[i.map]),m((function(){var t=function(t){h({isFetchingMap:t.isFetchingMap,isSavingMap:t.isSavingMap,mapdata:t.maps[e.mapid]})};return s.store.subscribe(t),function(){return s.store.unsubscribe(t)}})),m((function(){e.mapid&&s.store.fetchMap({mapid:e.mapid})}),[e.mapid]),m((function(){if(!i.isFetchingMap){var t={editable:!0,embed:!0,layout:"left",mapOpts:{mapTypeControl:!0,streetViewControl:!1},menu:!1,name:"media-map",poiList:!1,sel:jQuery(u.current)};"map"!=e.context&&"mashup"!=e.context||(t.center=null,t.zoom=null);var n=new s.Map(i.mapdata,t);new s.Editor(n);h({map:n})}}),[i.mapdata]),m((function(){i.map&&setTimeout((function(){return i.map.resize()}),100)}),[i.isPoiListOpen]),p("div",{className:"mapp-edit"},(t=i.map&&!i.isFetchingMap&&i.map.title?i.map.title:"",n=i.map&&!i.isFetchingMap?__("Untitled"):"",p("div",{className:"mapp-gt-modal-header"},p(y,{className:"mapp-edit-title",placeholder:n,value:t,onChange:function(e){return w("change-title",e)}}))),p("div",{className:"mapp-edit-main"},p("div",{className:"mapp-list mapp-edit-list"+(i.isPoiListOpen?" mapp-list-open":"")},function(){if("mce"!=e.context&&"library"!=e.context)return null;if(!i.map)return null;var t=i.map,n=t.center,a=t.height,r=t.poiList,l=t.width,c=t.zoom;return p("div",{className:"mapp-gt-inspector"},p(b,{initialOpen:!1,title:__("Map settings")},p(o.MappSettings,{map:i.map,context:e.context,onAction:w,center:n,height:a,poiList:r,width:l,zoom:c})))}(),function(){if(i.map){var e=function(e,t){var n=i.dragging,o=n<o?t-1:t;i.map.pois_.splice(o,0,i.map.pois_.splice(n,1)[0]),h({map:i.map,dragover:null})};return p("div",{className:"mapp-items"},_.map(i.map.pois_,(function(t,n){return p("div",{className:i.dragover==n?"mapp-item mapp-edit-dragover":"mapp-item",draggable:!0,key:n,onClick:function(){return i.map.poiOpen(i.map.pois_[n])},onDragOver:function(e){return e.preventDefault()},onDragStart:function(e){return h({dragging:n})},onDragEnter:function(e){return h({dragover:n})},onDragEnd:function(e){return h({dragging:null,dragover:null})},onDrop:function(t){return e(t,n)}},p("img",{className:"mapp-icon",src:s.Icons.getUrl(t.iconid)}),p("div",{className:"mapp-title"},t.title))})))}}(),p("div",{className:"mapp-list-toggle",onClick:function(){return h({isPoiListOpen:!i.isPoiListOpen})}})),p("div",{className:"mapp-edit-map",key:e.mapid,ref:u,onKeyDown:function(e){return e.stopPropagation()},tabIndex:-1})),p("div",{className:"mapp-edit-toolbar",tabIndex:-1,onKeyDown:function(e){return e.stopPropagation()}},p(g,{isPrimary:!0,isBusy:i.isSavingMap,onClick:function(){return w("save")}},__("Save")),p(g,{disabled:i.isSavingMap,onClick:function(){return w("close")}},__("Cancel")),p(g,{disabled:!e.mapid||i.isSavingMap,isDestructive:!0,className:"mapp-edit-delete",onClick:function(){return w("destroy")}},__("Delete"))))}},143:function(e,t,n){"use strict";n.r(t),n.d(t,{MappIconPicker:function(){return w}});var o=n(525),a=n(824);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(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 s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var p=wp.element.createElement,u=wp.element,m=u.Fragment,d=u.useEffect,f=(u.useLayoutEffect,u.useCallback,u.useRef,u.useState),h=(wp.data.useSelect,wp.compose.withState,wp.components),g=h.Button,b=(h.ColorPicker,h.DropZone,h.DropZoneProvider,h.FormFileUpload),y=h.Modal,__=(h.Popover,h.Spinner,h.TabPanel,function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")}),v={"mapp-icons":{label:"Map icons",glyphs:[{name:"abseiling",codepoint:59392},{name:"accounting",codepoint:59393},{name:"airport",codepoint:59394},{name:"amusement-park",codepoint:59395},{name:"aquarium",codepoint:59396},{name:"archery",codepoint:59397},{name:"art-gallery",codepoint:59398},{name:"assistive-listening-system",codepoint:59399},{name:"atm",codepoint:59400},{name:"audio-description",codepoint:59401},{name:"bakery",codepoint:59402},{name:"bank",codepoint:59403},{name:"bar",codepoint:59404},{name:"baseball",codepoint:59405},{name:"beauty-salon",codepoint:59406},{name:"bicycle-store",codepoint:59407},{name:"bicycling",codepoint:59408},{name:"boat-ramp",codepoint:59409},{name:"boat-tour",codepoint:59410},{name:"boating",codepoint:59411},{name:"book-store",codepoint:59412},{name:"bowling-alley",codepoint:59413},{name:"braille",codepoint:59414},{name:"bus-station",codepoint:59415},{name:"cafe",codepoint:59416},{name:"campground",codepoint:59417},{name:"canoe",codepoint:59418},{name:"car-dealer",codepoint:59419},{name:"car-rental",codepoint:59420},{name:"car-repair",codepoint:59421},{name:"car-wash",codepoint:59422},{name:"casino",codepoint:59423},{name:"cemetery",codepoint:59424},{name:"chairlift",codepoint:59425},{name:"church",codepoint:59426},{name:"skip",codepoint:59427},{name:"city-hall",codepoint:59428},{name:"climbing",codepoint:59429},{name:"closed-captioning",codepoint:59430},{name:"clothing-store",codepoint:59431},{name:"compass",codepoint:59432},{name:"convenience-store",codepoint:59433},{name:"courthouse",codepoint:59434},{name:"cross-country-skiing",codepoint:59435},{name:"crosshairs",codepoint:59436},{name:"dentist",codepoint:59437},{name:"department-store",codepoint:59438},{name:"diving",codepoint:59439},{name:"doctor",codepoint:59440},{name:"electrician",codepoint:59441},{name:"electronics-store",codepoint:59442},{name:"embassy",codepoint:59443},{name:"expand",codepoint:59444},{name:"female",codepoint:59445},{name:"finance",codepoint:59446},{name:"fire-station",codepoint:59447},{name:"fish-cleaning",codepoint:59448},{name:"fishing-pier",codepoint:59449},{name:"fishing",codepoint:59450},{name:"florist",codepoint:59451},{name:"food",codepoint:59452},{name:"fullscreen",codepoint:59453},{name:"funeral-home",codepoint:59454},{name:"furniture-store",codepoint:59455},{name:"gas-station",codepoint:59456},{name:"general-contractor",codepoint:59457},{name:"golf",codepoint:59458},{name:"grocery-or-supermarket",codepoint:59459},{name:"gym",codepoint:59460},{name:"hair-care",codepoint:59461},{name:"hang-gliding",codepoint:59462},{name:"hardware-store",codepoint:59463},{name:"health",codepoint:59464},{name:"hindu-temple",codepoint:59465},{name:"horse-riding",codepoint:59466},{name:"hospital",codepoint:59467},{name:"ice-fishing",codepoint:59468},{name:"ice-skating",codepoint:59469},{name:"inline-skating",codepoint:59470},{name:"insurance-agency",codepoint:59471},{name:"jet-skiing",codepoint:59472},{name:"jewelry-store",codepoint:59473},{name:"kayaking",codepoint:59474},{name:"laundry",codepoint:59475},{name:"lawyer",codepoint:59476},{name:"library",codepoint:59477},{name:"liquor-store",codepoint:59478},{name:"local-government",codepoint:59479},{name:"location-arrow",codepoint:59480},{name:"locksmith",codepoint:59481},{name:"lodging",codepoint:59482},{name:"low-vision-access",codepoint:59483},{name:"male",codepoint:59484},{name:"skip",codepoint:59485},{name:"marina",codepoint:59486},{name:"mosque",codepoint:59487},{name:"motobike-trail",codepoint:59488},{name:"movie-rental",codepoint:59489},{name:"movie-theater",codepoint:59490},{name:"moving-company",codepoint:59491},{name:"museum",codepoint:59492},{name:"natural-feature",codepoint:59493},{name:"night-club",codepoint:59494},{name:"open-captioning",codepoint:59495},{name:"painter",codepoint:59496},{name:"park",codepoint:59497},{name:"parking",codepoint:59498},{name:"pet-store",codepoint:59499},{name:"pharmacy",codepoint:59500},{name:"physiotherapist",codepoint:59501},{name:"place-of-worship",codepoint:59502},{name:"playground",codepoint:59503},{name:"plumber",codepoint:59504},{name:"point-of-interest",codepoint:59505},{name:"police",codepoint:59506},{name:"political",codepoint:59507},{name:"post-box",codepoint:59508},{name:"post-office",codepoint:59509},{name:"skip",codepoint:59510},{name:"skip",codepoint:59511},{name:"rafting",codepoint:59512},{name:"real-estate-agency",codepoint:59513},{name:"restaurant",codepoint:59514},{name:"roofing-contractor",codepoint:59515},{name:"skip",codepoint:59516},{name:"route",codepoint:59517},{name:"rv-park",codepoint:59518},{name:"sailing",codepoint:59519},{name:"school",codepoint:59520},{name:"scuba-diving",codepoint:59521},{name:"search",codepoint:59522},{name:"skip",codepoint:59523},{name:"shopping-mall",codepoint:59524},{name:"sign-language",codepoint:59525},{name:"skateboarding",codepoint:59526},{name:"ski-jumping",codepoint:59527},{name:"skiing",codepoint:59528},{name:"sledding",codepoint:59529},{name:"snow-shoeing",codepoint:59530},{name:"snow",codepoint:59531},{name:"snowboarding",codepoint:59532},{name:"snowmobile",codepoint:59533},{name:"spa",codepoint:59534},{name:"skip",codepoint:59535},{name:"skip",codepoint:59536},{name:"skip",codepoint:59537},{name:"stadium",codepoint:59538},{name:"storage",codepoint:59539},{name:"store",codepoint:59540},{name:"subway-station",codepoint:59541},{name:"surfing",codepoint:59542},{name:"swimming",codepoint:59543},{name:"synagogue",codepoint:59544},{name:"taxi-stand",codepoint:59545},{name:"tennis",codepoint:59546},{name:"toilet",codepoint:59547},{name:"trail-walking",codepoint:59548},{name:"train-station",codepoint:59549},{name:"transit-station",codepoint:59550},{name:"travel-agency",codepoint:59551},{name:"unisex",codepoint:59552},{name:"university",codepoint:59553},{name:"veterinary-care",codepoint:59554},{name:"viewing",codepoint:59555},{name:"volume-control-telephone",codepoint:59556},{name:"walking",codepoint:59557},{name:"waterskiing",codepoint:59558},{name:"whale-watching",codepoint:59559},{name:"wheelchair",codepoint:59560},{name:"wind-surfing",codepoint:59561},{name:"zoo",codepoint:59562}]},"mapp-shapes":{label:"Map shapes",glyphs:[{name:"circle",codepoint:59648,center:[16,16]},{name:"widepin",codepoint:59649,center:[16,14]},{name:"route",codepoint:59650,center:[16,14]},{name:"shield",codepoint:59651,center:[16,14]},{name:"squarepin",codepoint:59653,center:[16,14]},{name:"square",codepoint:59652,center:[16,16]},{name:"squarerounded",codepoint:59654,center:[16,16]},{name:"roundpin",codepoint:59657,center:[16,13]},{name:"pin",codepoint:59655,center:null},{name:"pindot",codepoint:59656,center:null}]}};function w(e){var t,n,r,l=c(f({defaultIcon:mappl10n.options.defaultIcon,filename:null,fillColor:"gray",filter:"",glyph:"",glyphColor:"white",glyphFont:"mapp-icons",isFontLoaded:!1,isOpen:!1,mode:"list",shape:"circle",shapeFont:"mapp-shapes",showNames:!0,strokeColor:"black",strokeWidth:4,urls:{},userIcons:mappl10n.options.userIcons}),2),s=l[0],u=l[1];function h(e){u((function(t){return i(i({},t),e)}))}function w(t,n){switch(t){case"close":h({isOpen:!1});break;case"edit-cancel":h({mode:"list"});break;case"edit-save":!function(e){s.glyphFont;var t=2,n=32*t,o=16*t,a=document.createElement("canvas");a.width=n,a.height=n,a.style.imageRendering="pixelated";var r=a.getContext("2d");r.font=n+"px "+s.shapeFont,r.fillStyle=s.fillColor,r.textBaseline="bottom";var i=_.findWhere(v[s.shapeFont].glyphs,{name:s.shape});r.fillText(String.fromCharCode(i.codepoint),0,n);var l=1,c=l*t;if(r.strokeStyle="white",r.lineWidth=c,r.font=n-l*t+"px "+s.shapeFont,r.strokeText(String.fromCharCode(i.codepoint),l,n-l),i.center){r.imageSmoothingEnabled=!1,r.font=o+"px "+s.glyphFont,r.fillStyle=s.glyphColor;var p=[i.center[0]*t,i.center[1]*t],u=_.findWhere(v[s.glyphFont].glyphs,{name:s.glyph});r.fillText(String.fromCharCode(u.codepoint),p[0]-o/2,p[1]+o/2)}"undefined"!=typeof debug?document.getElementById("mapp-edit-debug").append(a):a.toBlob((function(e){var t=new FormData;t.append("image0",e,s.filename),k(t)}),"image/png",100)}();break;case"edit-upload":o=n,a=new FormData,_.map(o,(function(e,t){e.type.match("image.*")?a.append("image"+t,e):alert("File "+e.name+" is not an image.")})),k(a);break;case"list-clear":e.onChange&&e.onChange(null),w("close");break;case"list-delete":e.iconid&&confirm(mappl10n.delete_prompt)&&mapp.lib.ajax({type:"POST",data:{action:"mapp_icon_delete",iconids:e.iconid,nonce:mappl10n.options.nonce},callback:function(t){if(t&&"OK"==t.status){var n=mappl10n.options.userIcons.indexOf(e.iconid);n>=0&&void 0!==mappl10n.options.userIcons[n+1]?e.onChange(mappl10n.options.userIcons[n+1]):e.onChange(null),mappl10n.options.userIcons=t.data,h({userIcons:mappl10n.options.userIcons})}else alert("Delete error: "+t.status)}});break;case"list-select":e.onChange&&(n==e.iconid?e.onChange(null):e.onChange(n));break;case"mode":h({mode:n});break;case"open":h({isOpen:!0})}var o,a}function O(t){var n="user"==t?mappl10n.options.userIcons:mappl10n.options.standardIcons;return _.map(n,(function(t){return p("div",{alt:t,className:e.iconid==t?"mapp-icon-wrapper mapp-selected":"mapp-icon-wrapper",key:t,onClick:function(){return w("list-select",t)}},p("img",{className:"mapp-icon",src:mapp.Icons.getUrl(t),title:t}))}))}function k(e){e.append("action","mapp_icon_save"),e.append("nonce",mappl10n.options.nonce),mapp.lib.ajax({type:"POST",contentType:!1,processData:!1,data:e,success:function(e){e&&"OK"==e.status?(mappl10n.options.userIcons=e.data.icons,h({userIcons:mappl10n.options.userIcons}),h({mode:"list"}),w("list-select",e.data.filename)):alert("Upload error: "+e.status)}})}return d((function(){var e=[];_.map(v,(function(t,n){var o=new FontFace(n,"url("+mappl10n.options.baseurl+"/pro/fonts/"+n+".woff?"+mappl10n.options.version+")");document.fonts.add(o),e.push(o.loaded)})),Promise.all(e).then((function(){h({isFontLoaded:!0})}))}),[]),d((function(){h({filename:s.shape+"_"+s.fillColor.replace("#","")+(s.glyph?"_"+s.glyph:"")+".png"})}),[s.shape,s.fillColor,s.glyph]),p(m,null,p("img",{className:"mapp-icon",onClick:function(){return w("open",null)},src:mapp.Icons.getUrl(e.iconid)}),"list"==s.mode&&function(){if(!s.isOpen)return null;var t=e.iconid&&mappl10n.options.userIcons.indexOf(e.iconid)>=0;return p(y,{title:p("div",{className:"mapp-icons-header"},__("Select an icon"),p(g,{isSecondary:!0,onClick:function(){return w("mode","edit")}},__("New icon"))),className:"mapp-icons-modal",onRequestClose:function(){return w("close")}},p("div",{className:"mapp-icons"},p("div",{className:"mapp-icons-list"},p("div",{className:"mapp-icons-user"},O("user")),p("div",{className:"mapp-icons-standard"},O("standard"))),p("div",{className:"mapp-icons-edit-filename"},e.iconid?e.iconid:__("No icon selected")),p("div",{className:"mapp-icons-toolbar"},p("div",null,p(g,{isPrimary:!0,onClick:function(){return w("close")}},__("Select")),p(g,{isSecondary:!0,onClick:function(){return w("list-clear")}},__("Use default icon"))),p(g,{isDestructive:!0,onClick:function(){return w("list-delete")},disabled:!t},__("Delete")))))}(),"edit"==s.mode&&p(y,{title:__("Create new icon"),className:"mapp-icons-edit-modal",onRequestClose:function(){return w("edit-cancel")},shouldCloseOnClickOutside:!1},p("div",{className:"mapp-icons-edit"},p("div",{id:"mapp-edit-debug"}),p("div",{className:"mapp-icons-edit-shape-section"},p("div",{className:"mapp-icons-shape-heading"},__("Shape and color"),p(o.MappColorPicker,{color:s.fillColor,isExtended:!1,onChange:function(e){return h({fillColor:e.color})}})),(t=v[s.shapeFont],n=_.findWhere(v[s.glyphFont].glyphs,{name:s.glyph}),r=n?String.fromCharCode(n.codepoint):null,p("div",{className:"mapp-icons-edit-shapes",style:{color:s.fillColor,fontFamily:s.shapeFont}},_.map(t.glyphs,(function(e,t){var o=s.shape==e.name;return p("span",{className:"mapp-icons-edit-shape-wrapper"+(o?" mapp-selected":""),key:e.name,onClick:function(){return h({shape:e.name})},title:e.name},p("span",{className:"mapp-icons-edit-shape"},String.fromCharCode(e.codepoint),e.center&&n&&p("span",{className:"mapp-icons-edit-glyph",style:{left:e.center[0],top:e.center[1],color:s.glyphColor,fontFamily:s.glyphFont}},r)))}))))),p("div",{className:"mapp-icons-edit-glyph-section"},p("div",{className:"mapp-icons-glyph-heading"},__("Glyph"),p("div",null,__("Search"),p(a.Input,{onChange:function(e){return h({filter:e})}}))),function(){s.glyphFont;var e=_.filter(v[s.glyphFont].glyphs,(function(e){return(!s.filter||e.name.includes(s.filter))&&"skip"!=e.name}));return p("div",{className:"mapp-icons-edit-glyph-list",style:{color:s.glyphColor,fontFamily:s.glyphFont}},_.map(e,(function(e,t){return p("div",{className:"mapp-icons-edit-glyph-wrapper"+(s.glyph==e.name?" mapp-selected":""),key:t,onClick:function(){return h({glyph:s.glyph==e.name?null:e.name})}},p("span",{className:"mapp-icons-edit-glyph"},String.fromCharCode(e.codepoint)),p("div",{className:"mapp-icons-edit-glyph-title"},e.name))})))}()),p("div",{className:"mapp-icons-edit-toolbar"},p("div",null,p(g,{isPrimary:!0,onClick:function(){return w("edit-save")}},__("Save")),p(g,{isSecondary:!0,onClick:function(){return w("edit-cancel")}},__("Cancel"))),p(b,{accept:"image/*",icon:"upload",multiple:!0,onChange:function(e){w("edit-upload",e.target.files)}},__("Upload icons"))))))}},800:function(e,t,n){"use strict";n.r(t);var o=n(966);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(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 c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}window.mapp;var s=wp.element.createElement,p=wp.element,u=(p.Fragment,p.useEffect,p.useLayoutEffect,p.useRef,p.useState),m=wp.components;m.Button,m.Dashicon,m.Modal;function d(e){var t=l(u({mapid:null}),2),n=t[0],a=t[1];return s(o.default,{context:"mce",mapid:n.mapid,onAction:function(t,n){switch(t){case"pick-close":o={mapid:null},a((function(e){return r(r({},e),o)})),e.onAction("pick-close",n);break;case"pick-insert":e.onAction("pick-insert",n)}var o}})}window.parent&&(window.mappIframeRender=function(e){wp.element.render(s(d,e),document.getElementById("mapp-iframe-react"))}),function(e){function t(){var t=this;this.contentWindow=null,this.iframe=null;e(".mapp-iframe-button").on("click",(function(e){e.preventDefault(),t.open()}))}t.prototype={load:function(t){var n=this;if(this.iframe)return this.iframe.show(),void t();this.iframe=e('<iframe class="mapp-iframe" allowtransparency="true"></iframe>').appendTo("body"),e("iframe").on("load",(function(){t()})),e.get(mappl10n.options.ajaxurl,{action:"mapp_iframe",nonce:mappl10n.options.nonce},(function(e){n.contentWindow=n.iframe.get(0).contentWindow,n.contentWindow.document.open("text/html","replace"),n.contentWindow.document.write(e),n.contentWindow.document.close()}))},open:function(){var e=this;this.load((function(){e.contentWindow&&e.contentWindow.mappIframeRender&&e.contentWindow.mappIframeRender({onAction:function(t,n){return e.onAction(t,n)}})}))},onAction:function(e,t){switch(e){case"pick-close":this.iframe.hide();break;case"pick-insert":var n='[mappress mapid="'+t+'"]';"undefined"==typeof wpActiveEditor?alert(mappl10n.need_classic):send_to_editor(n),this.iframe.hide()}}},e(".mapp-iframe-button").length&&new t(this)}(jQuery)},938:function(e,t,n){"use strict";n.r(t);var o=n(966);function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(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 r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}window.mapp;var i=wp.element.createElement,l=wp.element,c=(l.Fragment,l.render,l.useEffect),s=(l.useLayoutEffect,l.useRef,l.useState),p=wp.components;p.Button,p.Modal;document.getElementById("mapp-library")&&(mappl10n.options.postid=0,wp.element.render(i((function(e){var t=a(s({mapid:null}),2),n=t[0];return t[1],c((function(){}),[]),i(o.default,{context:"library",mapid:n.mapid,onAction:function(e,t){switch(e){case"pick-shortcode":var n=jQuery("<input>");jQuery("body").append(n),n.val('[mappress mapid="'+t+'"]').select(),document.execCommand("copy"),n.remove(),alert((o="Shortcode copied",wp.i18n.__(o,"mappress-google-maps-for-wordpress")))}var o}})})),document.getElementById("mapp-library")))},816:function(e,t,n){"use strict";n.r(t);var o=n(429),a=n(966);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(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 s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var p=window.mapp||{},u=wp.element.createElement,m=wp.element,d=m.Fragment,f=m.useEffect,h=(m.useLayoutEffect,m.useRef),g=m.useState,__=function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")};function b(e){var t=wp.components,n=(t.BaseControl,t.Button),r=(t.ButtonGroup,t.CheckboxControl,t.Dropdown,t.Modal,t.Panel,t.PanelBody),l=(t.PanelRow,t.Placeholder),s=(t.RadioControl,t.SelectControl,t.TextControl,t.ToggleControl,t.Toolbar),m=t.ToolbarButton,b=(t.ToolbarGroup,wp.blockEditor),y=b.BlockControls,v=b.InspectorControls,w=c(g({isOpen:!1,map:null,mapdata:null,pickerMode:"list",pickerMapid:null}),2),O=w[0],k=w[1],C=h(null);function S(e){k((function(t){return i(i({},t),e)}))}function P(t,n){switch(t){case"add":S({isOpen:!0,pickerMapid:null,pickerMode:"edit"}),e.setAttributes({center:void 0,zoom:void 0});break;case"change-settings":e.setAttributes(n);break;case"edit":S({isOpen:!0,pickerMapid:e.attributes.mapid,pickerMode:"edit"});break;case"edit-close":S({isOpen:!1});break;case"pick-destroy":e.setAttributes({mapid:void 0,center:void 0,zoom:void 0,width:void 0,height:void 0}),S({isOpen:!1});break;case"pick-close":S({isOpen:!1});break;case"pick-insert":case"pick-duplicate":n!=e.attributes.mapid&&e.setAttributes({center:void 0,mapid:n,zoom:void 0}),S({isOpen:!1});break;case"open":S({isOpen:!0,pickerMapid:e.attributes.mapid,pickerMode:"list"})}}function j(){var t=void 0!==t?t:s;return u(y,null,u(t,null,e.attributes.mapid&&u(m,{icon:"edit",label:__("Edit map"),onClick:function(){return P("edit")}}),u(m,{icon:"portfolio",label:__("Map Library"),onClick:function(){return P("open")}})))}function M(){if(O.isOpen)return u(a.default,{mapid:O.pickerMapid,mode:O.pickerMode,onAction:P,type:"post"})}return f((function(){var t=function(t){var n=t.maps[e.attributes.mapid];n&&S({mapdata:n})};return p.store.subscribe(t),function(){return p.store.unsubscribe(t)}})),f((function(){e.attributes.mapid&&p.store.fetchMap({mapid:e.attributes.mapid,failure:function(){return S({mapdata:void 0})}})}),[e.attributes.mapid]),f((function(){var t;e.attributes.mapid&&C.current&&O.mapdata&&((t=new p.Map(O.mapdata,{alignment:e.attributes.align,center:e.attributes.center,height:e.attributes.height,mapOpts:{mapTypeControl:!1,streetViewControl:!1},poiList:e.attributes.poiList,sel:jQuery(C.current),width:e.attributes.width,zoom:e.attributes.zoom})).display(),S({map:t}))}),[O.mapdata]),f((function(){"wide"!=e.attributes.align&&"full"!=e.attributes.align||(e.setAttributes({width:"100%"}),O.map&&O.map.setSize({width:"100%"}))}),[e.attributes.align]),e.attributes.preview?u("img",{className:"mapp-gt-preview",src:mappl10n.options.baseurl+"/images/preview.png",width:"100%"}):e.attributes.mapid&&void 0!==O.mapdata?u(d,null,j(),function(){if(!O.map)return null;var t=e.attributes,n=t.align,a=t.center,i=t.height,l=t.poiList,c=t.width,s=t.zoom;return u(v,null,u("div",{className:"mapp-gt-inspector"},u(r,{title:__("Map settings")},u(o.MappSettings,{map:O.map,alignment:n,context:"map",onAction:P,center:a,height:i,poiList:l,width:c,zoom:s}))))}(),u("div",{className:"mapp-gt",ref:C}),M()):u(d,null,u(d,null,j(),u(l,{className:"mapp-gt-placeholder",icon:"location",label:__("MapPress Map"),instructions:__("Use the map library to create a new map or insert an existing map.")},u(n,{icon:"portfolio",isSecondary:!0,onClick:function(){return P("open")}},__("Map Library")))),M())}wp.blocks.registerBlockType("mappress/map",{title:__("MapPress Map"),icon:"location",description:__("Insert a map"),category:"mappress",attributes:{center:{type:"string"},height:{type:"string",default:""},initialOpenDirections:{type:"boolean"},mapid:{type:"string"},mapOpts:{type:"object"},poiList:{type:"boolean"},preview:{type:"boolean",default:!1},width:{type:"string",default:""},zoom:{type:"number"}},supports:{align:["full","wide","center","left","right"]},transforms:{from:[{type:"shortcode",tag:"mappress",attributes:{center:{type:"string",shortcode:function(e){return e.named.center}},height:{type:"string",shortcode:function(e){return e.named.height}},initialOpenDirections:{type:"boolean",shortcode:function(e){return"true"==e.named.initialOpenDirections||"true"==e.named.initialopendirections}},mapid:{type:"string",shortcode:function(e){return e.named.mapid}},poiList:{type:"boolean",shortcode:function(e){return"true"==e.named.poiList||"true"==e.named.poilist}},width:{type:"string",shortcode:function(e){return e.named.width}},zoom:{type:"number",shortcode:function(e){return parseInt(e.named.zoom)?parseInt(e.named.zoom):null}}}},{type:"block",blocks:["core/shortcode"],isMatch:function(e){var t=e.text,n=wp.shortcode.regexp("mappress");return n.lastIndex=0,n.test(t)},transform:function(e){var t=e.text;return wp.blocks.rawHandler({HTML:"<p>"+t+"</p>",mode:"BLOCKS"})}}]},edit:function(e){return u(b,e)},save:function(e){return e},example:{attributes:{preview:!0}}})},378:function(e,t,n){"use strict";n.r(t);n(429),n(670),n(308);window.mapp,wp.element.createElement;var o=wp.element,a=(o.Fragment,o.useEffect,o.useLayoutEffect,o.useRef,o.useState,wp.components);a.BaseControl,a.Button,a.ButtonGroup,a.Card,a.CardBody,a.CardFooter,a.CardHeader,a.CheckboxControl,a.ExternalLink,a.HorizontalRule,a.Panel,a.PanelBody,a.PanelRow,a.Placeholder,a.RadioControl,a.SelectControl,a.TabPanel,a.TextControl,a.TextareaControl,a.ToggleControl,a.Toolbar,wp.data.useSelect},498:function(e,t,n){"use strict";n.r(t);var o=n(966);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(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 c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}window.mapp;var s=wp.element.createElement,p=wp.element,u=p.Fragment,m=(p.useEffect,p.useLayoutEffect,p.useRef,p.useState),d=wp.components,f=(d.Button,d.Dashicon),__=(d.Modal,function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")});function h(){var e=l(m({isOpen:!1,mapid:null}),2),t=e[0],n=e[1];function a(e){n((function(t){return r(r({},t),e)}))}function i(e,t){switch(e){case"pick-close":a({isOpen:!1,mapid:null});break;case"pick-insert":a({isOpen:!1});var n='[mappress mapid="'+t+'"]';"undefined"==typeof wpActiveEditor?__("Please select the post content to insert the map into."):send_to_editor(n);break;case"open":a({isOpen:!0,mapid:c()})}}function c(){var e=tinyMCE?tinyMCE.get("content"):null,t=e&&e.selection?e.selection.getSel():null;if(!t||void 0===t.anchorOffset||!t.anchorNode||!t.anchorNode.data)return null;for(var n=null,o=t.anchorNode.data,a=-1,r=t.anchorOffset-1;r>=0;r--){var i=o[r];if("["==i){a=r;break}if("]"==i||"<"==i||">"==i)break}return a>=0&&(n=wp.shortcode.next("mappress",o,a))?n.shortcode.attrs.named.mapid:null}return s(u,null,s("button",{className:"button",type:"button",onClick:function(e){e.preventDefault(),i("open")}},s(f,{className:"wp-media-buttons-icon",icon:"location"}),__("MapPress")),t.isOpen&&s(o.default,{context:"mce",mapid:t.mapid,onAction:i}))}Array.from(document.getElementsByClassName("mapp-mce")).forEach((function(e,t){return wp.element.render(s(h),e)}))},670:function(e,t,n){"use strict";function o(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||c(e)||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.")}()}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||c(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 c(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}n.r(t),n.d(t,{MappMultiSelect:function(){return v}});var p=wp.element.createElement,u=wp.element,m=(u.Fragment,u.useEffect),d=(u.useLayoutEffect,u.useRef),f=u.useState,h=wp.components,g=h.BaseControl,b=(h.Button,h.CheckboxControl),y=(h.Panel,h.PanelBody,h.PanelRow,h.Spinner,h.TextControl),__=function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")};function v(e){var t,n=d(null),a=d(null),i=l(f({isOpen:!1,filter:"",filteredOptions:[]}),2),c=i[0],s=i[1];function u(e){s((function(t){return r(r({},t),e)}))}function h(t){var n=_.findWhere(e.options,{value:t});return n?n.label:t}function v(){var t;return e.values instanceof Array?t=o(e.values):e.values&&(t=[e.values]),t||[]}function w(t,n){var o=v(),a=o.indexOf(t);(n=void 0!==n?n:-1==a)?o.push(t):o.splice(a,1),e.onChange(o)}function O(){return c.isOpen?p("div",{className:"mapp-select-dropdown-wrapper"},p("div",{className:"mapp-select-dropdown"},!c.isOpen||!e.options||e.options.length<10?null:p("div",{className:"mapp-select-filter",ref:a},p(y,{autoComplete:"off",placeholder:__("Search"),value:c.filter,onChange:function(e){return u({filter:e})}})),p("div",{className:"mapp-select-dropdown-list"},(t=v(),0==c.filteredOptions.length?p("div",{className:"mapp-select-dropdown-item"},__("No results")):c.filteredOptions.map((function(e){return p(b,{className:"mapp-select-dropdown-item",checked:t.includes(e.value),key:e.value,onChange:function(t){return w(e.value,t)},label:e.label})})))))):null;var t}return m((function(){if(e.options)if(c.filter){var t=c.filter.toUpperCase();u({filteredOptions:e.options.filter((function(e){return 0==e.label.toUpperCase().indexOf(t)}))})}else u({filteredOptions:e.options})}),[e.options,c.filter]),m((function(){c.isOpen&&a.current&&(jQuery("input",jQuery(a.current)).focus(),u({filter:""}))}),[c.isOpen]),p(g,{className:"mapp-select",label:e.label},p("div",{ref:n,tabIndex:0,onBlur:function(e){return function(e){event.relatedTarget||document.activeElement,n.current.contains(e.relatedTarget)||u({isOpen:!1})}(e)}},((t=v())instanceof Array&&t.map((function(e){return h(e)})),void 0===e.options?p("div",{className:"mapp-select-input"},p("div",{className:"mapp-select-tokens"}),p("span",{className:"dashicons dashicons-arrow-down-alt2"})):p("div",{className:"mapp-select-input",onClick:function(){return u({isOpen:!c.isOpen})}},p("div",{className:"mapp-select-tokens"},t.map((function(e){return p("span",{className:"mapp-select-token",key:e,onClick:function(t){t.stopPropagation(),w(e,!1)}},h(e))}))),p("span",{className:"dashicons "+(c.isOpen?"dashicons-arrow-up-alt2":"dashicons-arrow-down-alt2")}))),O()))}},218:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return C}});var o=n(824),a=n(143);function r(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||p(e)||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.")}()}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||p(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 p(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var m=wp.element.createElement,d=wp.element,f=d.Fragment,h=d.useEffect,g=(d.useLayoutEffect,d.useCallback,d.useRef),b=d.useState,y=wp.data.useSelect,v=wp.components,w=v.Button,O=v.Dashicon,k=v.ExternalLink,__=(v.Modal,v.Panel,v.PanelBody,v.PanelRow,v.Popover,v.RadioControl,v.Spinner,v.TabPanel,function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")});function C(e){var t=s(b(l({},mappress_options_state)),2),n=t[0],i=t[1];function c(e){i((function(t){return l(l({},t),e)}))}h((function(){S.current&&new mapp.Map(n.helpers.demo_map,{sel:jQuery(S.current)}).display()}),[]);var p,u,d,v,C,S=g(null);function P(e){return _.map(e,(function(e,t){return{value:t,label:e}}))}function j(e,t){switch(e){case"license-check":mapp.lib.ajax({type:"POST",data:{action:"mapp_license_check",nonce:mappl10n.options.nonce,license:n.license},callback:function(e){e&&"OK"==e.status&&window.location.reload()}});break;case"reset":mapp.lib.ajax({type:"POST",data:{action:"mapp_options_reset",nonce:mappl10n.options.nonce},callback:function(e){e&&"OK"==e.status&&window.location.reload()}});break;case"save":var o=l({},n);delete o.helpers,mapp.lib.ajax({type:"POST",data:{action:"mapp_options_save",nonce:mappl10n.options.nonce,settings:o},callback:function(e){e&&"OK"==e.status&&window.location.reload()}})}}return m("div",{className:"mapp-options"},m("form",{onSubmit:function(e){e.preventDefault(),j("save")}},m(o.Section,{title:__("Sample Map"),className:"mapp-demo-section"},m("div",{className:"mapp-options-demo",ref:S})),m(o.Section,{title:__("Basic Settings")},m(o.Radios,{title:__("Mapping API"),options:[{label:"Leaflet",value:"leaflet"},{label:"Google",value:"google"}],onChange:function(e){return c({engine:e,geocoder:"google"==e?"google":""})},checked:n.engine,help:{href:"#toc-picking-a-mapping-api",text:__("Leaflet is free and requires no API key. Google requires an API key and has strict usage limits.")}}),"leaflet"==n.engine&&m(o.Input,{title:__("Mapbox access token"),value:n.mapbox,onChange:function(e){c({mapbox:e}),"mapbox"!=n.geocoder||e||c({geocoder:""})},size:50,placeholder:__("Enter token to use Mapbox features"),help:{href:"https://www.mapbox.com/help/define-access-token/"}}),"google"==n.engine&&m(o.Input,{title:__("Google API key"),name:"apiKey",value:n.apiKey,onChange:function(e){return c({apiKey:e})},size:50,help:{href:"https://mappresspro.com/mappress-faq/#toc-google-maps-api-keys"}}),"leaflet"==n.engine&&(C=[{value:"",label:__("Algolia")},{value:"nominatim",label:"Nominatim"},{value:"mapbox",label:"MapBox",disabled:!n.mapbox}],m(o.Radios,{title:__("Geocoder"),options:C,checked:n.geocoder,onChange:function(e){return c({geocoder:e})},help:{href:"#toc-picking-a-geocoder"}}))),mappl10n.options.pro&&(!n.helpers.is_multisite||n.helpers.is_super_admin||n.helpers.is_main_site)&&m(o.Section,{title:__("License")},m(o.Option,{title:__("MapPress license key")},m(o.Input,{value:n.license,onChange:function(e){return c({license:e})},size:37,placeholder:__("Enter license to enable automatic updates")}),(v=m("a",{className:"mapp-license-status",href:"https://mappresspro.com/account",target:"_blank"},__("Get license")),n.license&&n.helpers.license_status?"active"==n.helpers.license_status?m("span",{className:"mapp-license-status"},m(O,{icon:"yes"}),__("Active")):m(f,null,m(w,{className:"mapp-options-check-license",isSecondary:!0,onClick:function(){return j("license-check")}},__("Check now")),m("div",null,m(O,{icon:"no"}),n.helpers.license_message)):v)),m(o.Checkbox,{title:__("Beta versions"),label:__("Enable updates for beta versions"),checked:n.betas,onChange:function(e){return c({betas:e})}})),m(o.Section,{title:__("Map Settings")},m(o.Checkboxes,{title:__("Post types"),values:n.postTypes,options:P(n.helpers.post_types),onChange:function(e){return c({postTypes:e})}}),m(o.Radios,{title:__("Automatic display"),options:[{value:"",label:__("None")},{value:"top",label:__("Top of post")},{value:"bottom",label:__("Bottom of post")}],checked:n.autodisplay,onChange:function(e){return c({autodisplay:e})}}),m(o.Radios,{title:__("Map alignment"),options:[{value:"",label:__("Default")},{value:"center",label:__("Center")},{value:"left",label:__("Left")},{value:"right",label:__("Right")}],checked:n.alignment,onChange:function(e){return c({alignment:e})}}),m(o.Radios,{title:__("Directions"),checked:n.directions,options:[{value:"google",label:"Google"},{value:"inline",label:__("Inline")}],onChange:function(e){return c({directions:e})}}),m(o.Checkbox,{title:__("POI list"),checked:n.poiList,label:__("Show a list of POIs with each map"),onChange:function(e){return c({poiList:e})}}),mappl10n.options.pro&&m(o.Radios,{title:__("POI list layout"),checked:n.layout,options:[{value:"left",label:"Left of map"},{value:"inline",label:__("Below map")}],onChange:function(e){return c({layout:e})}}),m(o.Input,{title:__("Mini width"),value:n.mini,onChange:function(e){return c({mini:e})},size:3,label:__("Width (px) to hide the POI list")}),m(o.Checkbox,{title:__("Sort"),checked:n.sort,label:__("Sort POI list by title"),onChange:function(e){return c({sort:e})}})),m(o.Section,{title:__("POI Settings")},m(o.Select,{title:__("Default zoom"),label:__("Default zoom when displaying a single POI"),value:n.poiZoom,options:_.map([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],(function(e){return{value:e,label:e}})),onChange:function(e){return c({zoom:e})}}),m(o.Checkbox,{title:__("Hover"),checked:n.tooltips,label:__("Open POIs on hover"),onChange:function(e){return c({tooltips:e})}}),m(o.Checkbox,{title:__("Open first POI"),checked:n.initialOpenInfo,onChange:function(e){return c({initialOpenInfo:e})},label:__("Open first POI")}),m(o.Checkbox,{title:__("Clustering"),checked:n.clustering,label:__("Enable marker clustering"),onChange:function(e){return c({clustering:e})}})),mappl10n.options.pro&&m(o.Section,{title:__("Mashups")},m(o.Checkbox,{title:__("Search"),checked:n.search,label:__("Enable search"),onChange:function(e){return c({search:e})}}),m(o.Select,{title:__("Filter"),value:n.filter,options:P(n.helpers.taxonomies),onChange:function(e){return c({filter:e})},placeholder:""}),m(o.Radios,{title:__("Marker click"),checked:n.mashupClick,options:[{value:"poi",label:__("Open popup")},{value:"post",label:__("Open post")},{value:"postnew",label:__("Post in new tab")},{value:"postmodal",label:__("Post in modal")}],onChange:function(e){return c({mashupClick:e})}}),m(o.Radios,{title:__("Popup content"),checked:n.mashupBody,options:[{value:"poi",label:__("POI title + POI body")},{value:"post",label:__("Post title + post excerpt")}],onChange:function(e){return updatestate({mashupBody:mashupBody,val:e})}}),m(o.Checkbox,{title:__("KMLs"),checked:n.mashupKml,label:__("Include KML POIs in mashups"),onChange:function(e){return c({mashupKml:e})}})),mappl10n.options.pro&&m(o.Section,{title:__("Icons")},m(o.Option,{title:__("Default icon")},m(a.MappIconPicker,{iconid:n.defaultIcon,onChange:function(e){mappl10n.options.defaultIcon=e,c({defaultIcon:e})}})),m(o.Option,{title:__("Icon directory")},m("code",null,n.helpers.icon_directory)),m(o.Option,{title:__("Highlight selected POI")},m(o.Radios,{checked:n.highlight,options:[{value:"",label:__("None")},{value:"circle",label:__("Circle")},{value:"scale",label:__("Scale")},{value:"icon",label:__("Icon")}],onChange:function(e){return c({highlight:e})}}),"icon"==n.highlight&&m(a.MappIconPicker,{defaultIcon:n.defaultIcon,iconid:n.highlightIcon,onChange:function(e){return c({highlightIcon:e})}})),(d=n.iconScale&&Array.isArray(n.iconScale)?r(n.iconScale):[0,0],m(o.Option,{title:__("Icon scaling")},m(o.Input,{value:d[0]?d[0]:"",onChange:function(e){e<=64&&(d[0]=e,c({iconScale:d}))},type:"number",min:0,max:64}),m("span",null," X "),m(o.Input,{value:d[1]?d[1]:"",onChange:function(e){e<=64&&(d[1]=e,c({iconScale:d}))},type:"number",min:0,max:64}),m("span",null," (px) "))),function(){var e=P(n.helpers.taxonomies);e.unshift({value:"post_type",label:__("Post type")});var t=y((function(e){if("post_type"==n.autoicons.key)return P(n.helpers.post_types);var t=wp.data.select("core").getEntityRecords("taxonomy",n.autoicons.key,{per_page:-1,_fields:"id,name"});return t?t.map((function(e){return{value:e.id,label:e.name}})):null}),[n.autoicons.key]);return m(o.Option,{title:__("Automatic icons")},m(o.Select,{value:n.autoicons?n.autoicons.key:null,options:e,onChange:function(e){var t=n.autoicons?l({},n.autoicons):[];t.key=e,t.values=[],c({autoicons:t})},placeholder:""}),m(o.MappGrid,{cols:[{id:"key",label:__("Key"),type:"select",options:t},{id:"value",label:__("Icon"),type:"icon"}],data:n.autoicons.values,onChange:function(e){var t=n.autoicons?l({},n.autoicons):[];t.values=e,c({autoicons:t})}}))}()),mappl10n.options.pro&&m(o.Section,{title:__("Styled Maps")},"leaflet"==n.engine&&m(o.Option,{title:__("Styled maps")},m("div",null,__("Enter styles from Mapbox Studio"),m(k,{href:"https://www.mapbox.com/mapbox-studio/"})),m(o.MappGrid,{cols:[{id:"key",label:__("Style name"),size:10},{id:"value",label:__("MapBox Share URL")}],data:n.mapboxStyles,onChange:function(e,t){return c({mapboxStyles:e,style:t})},selectionColumn:"key",selectionType:"checkbox",selected:n.style})),"google"==n.engine&&m(o.Option,{title:__("Styled maps")},m("div",null,__("Enter styles from Snazzy Maps"),m(k,{href:"https://snazzymaps.com/explore"})),m(o.MappGrid,{cols:[{id:"key",label:__("Style name"),size:10},{id:"value",label:__("JSON"),type:"textarea"}],data:n.styles,className:"mapp-grid-styles",onChange:function(e,t){return c({styles:e,style:t})},selectionColumn:"key",selectionType:"checkbox",selected:n.style}))),mappl10n.options.pro&&m(o.Section,{title:__("Geocoding")},m(o.Option,{title:__("Geocoding fields")},m(o.MappGrid,{cols:[{id:"key",label:__("Map field"),type:"select",options:P(n.helpers.meta_fields)},{id:"value",label:__("Custom field"),type:"select",options:P(n.helpers.meta_keys)}],data:n.metaKeys,onChange:function(e){return c({metaKeys:e})}})),m(o.Checkbox,{title:__("Overwrite"),label:__("Overwrite maps when posts are saved"),checked:n.metaSyncSave,onChange:function(e){c({metaSyncSave:e})}}),(u=__("No errors found"),n.helpers.geocoding_errors&&n.helpers.geocoding_errors.length>0&&(u=_.map(n.helpers.geocoding_errors,(function(e){return m("div",{key:e.ID},m("a",{href:mappl10n.options.editurl+"?post="+e.ID+"&action=edit"},e.post_title),m("span",null," : "+e.error))}))),m(o.Option,{title:__("Geocoding errors")},u)),"google"==n.engine&&m(o.Input,{title:__("Google Server API key"),name:"apiKeyServer",value:n.apiKeyServer,onChange:function(e){return c({apiKeyServer:e})},size:50,help:{text:__("Key secured by IP address for geocoding custom fields (optional)"),href:"https://mappresspro.com/mappress-faq"}})),mappl10n.options.pro&&m(o.Section,{title:__("Templates")},m(o.Option,{title:__("Custom templates")},m(o.MappTemplateEditor)),m(o.Checkbox,{title:__("Mashup thumbnails"),checked:n.thumbs,label:__("Show featured image thumbnails in mashup popups and lists"),onChange:function(e){return c({thumbs:e})}}),m(o.Option,{title:__("Thumbnail size")},m(o.Select,{onChange:function(e){return c({thumbSize:e})},options:P(n.helpers.thumbnail_sizes),value:n.thumbSize}),m("span",null," "+__("or")+" "),m(o.Input,{value:n.thumbWidth,onChange:function(e){return c({thumbWidth:e})},type:"number",min:0,max:9999}),m("span",null," X "),m(o.Input,{value:n.thumbHeight,onChange:function(e){return c({thumbHeight:e})},type:"number",min:0,max:9999}),m("span",null," (px) "))),m(o.Section,{title:__("Localization")},(p="leaflet"==n.engine?"https://en.wikipedia.org/wiki/ISO_639-1":"http://code.google.com/apis/maps/faq.html#languagesupport",m(o.Select,{title:__("Search language"),value:n.language,options:P(n.helpers.languages),onChange:function(e){return c({language:e})},help:{text:__("Language for searches and Google map controls"),href:p}})),m(o.Select,{title:__("Search country"),label:__("Country code for searches"),value:n.country,options:_.map(["","AF","AX","AL","DZ","AS","AD","AO","AI","AQ","AG","AR","AM","AW","AU","AT","AZ","BS","BH","BD","BB","BY","BE","BZ","BJ","BM","BT","BO","BQ","BA","BW","BV","BR","IO","VG","BN","BG","BF","BI","KH","CM","CA","CV","KY","CF","TD","CL","CN","CX","CC","CO","KM","CK","CR","HR","CU","CW","CY","CZ","CD","DK","DJ","DM","DO","EC","EG","SV","GQ","ER","EE","ET","FK","FO","FJ","FI","FR","GF","PF","TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GG","GN","GW","GY","HT","HM","HN","HK","HU","IS","IN","ID","IR","IQ","IE","IM","IL","IT","CI","JM","JP","JE","JO","KZ","KE","KI","XK","KW","KG","LA","LV","LB","LS","LR","LY","LI","LT","LU","MO","MK","MG","MW","MY","MV","ML","MT","MH","MQ","MR","MU","YT","MX","FM","MD","MC","MN","ME","MS","MA","MZ","MM","NA","NR","NP","NL","AN","NC","NZ","NI","NE","NG","NU","NF","KP","MP","NO","OM","PK","PW","PS","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","CG","RE","RO","RU","RW","BL","SH","KN","LC","MF","PM","VC","WS","SM","ST","SA","SN","RS","SC","SL","SG","SX","SK","SI","SB","SO","ZA","GS","KR","SS","ES","LK","SD","SR","SJ","SZ","SE","CH","SY","TW","TJ","TZ","TH","TL","TG","TK","TO","TT","TN","TR","TM","TC","TV","VI","UG","UA","AE","GB","US","UM","UY","UZ","VU","VA","VE","VN","WF","EH","YE","ZM","ZW"],(function(e){return{value:e,label:e}})),onChange:function(e){return c({country:e})},help:{href:"https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements"}}),m(o.Input,{title:__("Directions server"),value:n.directionsServer,onChange:function(e){return c({directionsServer:directionsServer,val:e})},size:25})),m(o.Section,{title:__("Miscellaneous")},m(o.Option,{title:__("Map sizes")},m(o.MappGrid,{cols:[{id:"width",label:__("Width")+" (px, %, vw)",size:4},{id:"height",label:__("Height")+" (px, %, vh)"}],data:n.sizes,onChange:function(e,t){return c({sizes:e,size:t})},selectionColumn:"rowid",selected:n.size})),n.helpers.jetpack?null:m(o.Checkbox,{title:__("Scripts"),checked:n.footer,label:__("Output scripts in footer"),onChange:function(e){return c({footer:e})},help:{text:__("Disable footer scripts if maps are output using AJAX")}}),m(o.Checkbox,{title:"WPML",checked:n.wpml,label:__("Copy maps when overwriting a translation"),onChange:function(e){return c({wpml:e})},help:{href:"https://mappresspro.com/mappress-documentation#wpml"}}),"google"==n.engine&&m(o.Checkbox,{title:__("Compatiblity"),checked:n.deregister,label:__("Prevent other plugins/themes from loading the Google Maps API"),onChange:function(e){return c({deregister:e})}})),m("div",{className:"mapp-options-toolbar"},m(w,{className:"mapp-options-save",type:"submit",isPrimary:!0},__("Save")),m(w,{isSecondary:!0,onClick:function(){return j("reset")}},__("Reset Defaults")))))}document.getElementById("mapp-options-settings")&&wp.element.render(m(C),document.getElementById("mapp-options-settings"))},824:function(e,t,n){"use strict";n.r(t),n.d(t,{Checkbox:function(){return C},Checkboxes:function(){return S},Help:function(){return P},Input:function(){return j},Radios:function(){return I},Select:function(){return N},Textarea:function(){return A},Section:function(){return E},Option:function(){return x},MappGrid:function(){return D},MappTemplateEditor:function(){return T}});var o=n(143);function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||i(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 r(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||i(e)||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.")}()}function i(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){p(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){if(null==e)return{};var n,o,a=function(e,t){if(null==e)return{};var n,o,a={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var m=wp.element.createElement,d=wp.element,f=d.Fragment,h=d.useEffect,g=(d.useLayoutEffect,d.useCallback),b=(d.useRef,d.useState),y=(wp.data.useSelect,wp.components),v=y.Button,w=(y.ColorPicker,y.Dashicon),O=(y.Dropdown,y.ExternalLink,y.Modal),k=(y.Panel,y.PanelBody,y.PanelRow,y.Popover,y.RadioControl,y.Spinner,y.TabPanel),__=function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")};function C(e){var t=e.title,n=e.label,o=e.onChange,a=e.help,r=u(e,["title","label","onChange","help"]),i=m(f,null,m("label",null,m("input",s({type:"checkbox",onChange:function(e){o&&o(e.target.checked)}},r)),n&&m("span",{className:"mapp-option-label"},n)),a&&m(P,a));return t?m(x,{title:t},i):i}function S(e){var t=m(f,null,_.map(e.options,(function(t,n){var o=e.values?e.values.indexOf(t.value):-1;return m(C,{key:n,label:t.label,value:t.value,checked:o>=0,onChange:function(n){var a=r(e.values);n&&-1==o&&e.onChange(a.concat(t.value)),!n&&o>=0&&(a.splice(o,1),e.onChange(a))}})})),e.help&&m(P,e.help));return e.title?m(x,{title:e.title},t):t}function P(e){var t=null;return e.href&&(t="#"==e.href.substr(0,1)?"https://mappresspro.com/mappress-documentation/"+e.href:e.href),m(f,null,t&&m("a",{className:"mapp-help-link",href:t,target:"_blank"},m(w,{icon:"editor-help"})),e.text&&m("div",{className:"mapp-help-text"},e.text))}function j(e){var t=e.title,n=e.value,o=e.label,a=e.onChange,r=e.help,i=e.type,l=u(e,["title","value","label","onChange","help","type"]);if(!a)return"Missing onChange handler in Input component";var c=m(f,null,m("input",s({value:null!==n?n:"",onChange:function(e){return a(e.target.value.trim())},type:i||"text"},l)),o&&m("span",{className:"mapp-option-label"},o),r&&m(P,r));return t?m(x,{title:t},c):c}var M=function(e){var t=e.onChange,n=e.label,o=u(e,["onChange","label"]);return m("label",null,m("input",s({type:"radio",onChange:function(e){return t(e.target.value)}},o)),n&&m("span",{className:"mapp-option-label"},n))};function I(e){var t=m(f,null,_.map(e.options,(function(t,n){return m(M,{key:n,value:t.value,checked:e.checked==t.value,onChange:function(t){return e.onChange(t)},disabled:t.disabled,label:t.label})})),e.help&&m(P,e.help));return e.title?m(x,{title:e.title},t):t}function N(e){var t=e.title,n=e.value,o=e.label,a=e.onChange,r=e.options,i=e.help,l=e.placeholder,c=u(e,["title","value","label","onChange","options","help","placeholder"]);void 0!==l&&r.unshift({value:"",label:l});var p=m(f,null,m("select",s({value:null!==n?n:"",onChange:function(e){return a(e.target.value)}},c),_.map(r,(function(e,t){return m("option",{key:t,value:e.value},e.label)}))),o&&m("span",{className:"mapp-option-label"},o),i&&m(P,i));return t?m(x,{title:t},p):p}function A(e){var t=e.title,n=e.onChange,o=e.label,a=e.help,r=u(e,["title","onChange","label","help"]),i=m(f,null,m("textarea",s({onChange:function(e){return n(e.target.value)}},r)),o&&m("span",{className:"mapp-option-label"},o),a&&m(P,a));return t?m(x,{title:t},i):i}function E(e){var t=e.className?" "+e.className:"";return m("div",{className:"mapp-option-section"+t},m("h2",null,e.title),e.children)}function x(e){return m("div",{className:"mapp-option"},m("div",{className:"mapp-option-title"},e.title),m("div",{className:"mapp-option-value"},e.children))}function D(e){var t,n,i=a(b({dragging:null,dragover:null}),2),l=i[0],c=i[1];function p(e){c((function(t){return s(s({},t),e)}))}function u(t,n){var o=r(e.data);switch(t){case"add":var a={};_.map(e.cols,(function(e){a[e.id]=""})),o.push(a),e.onChange(o,e.selected);break;case"change":o[n.i][n.id]=n.value,e.onChange(o,e.selected);break;case"delete":var i;o.splice(n,1),i=n==e.selected?null:n<e.selected?e.selected-1:e.selected,e.onChange(o,i);break;case"select":p({selected:n}),e.onChange(o,n);break;case"sort":var c=l.dragging,s=c<s?n-1:n;o.splice(s,0,o.splice(c,1)[0]),e.onChange(o,s),p({dragover:null})}}return h((function(){}),[]),m("div",{className:e.className?"mapp-grid "+e.className:"mapp-grid"},e.data&&!!e.data.length&&m("div",{className:"mapp-grid-table"},(t=e.selectionColumn?m("div",{className:"mapp-grid-cell",key:"select"},__("Default")):null,n=m("div",{className:"mapp-grid-cell",key:"actions"},""),m("div",{className:"mapp-grid-header"},m("div",{className:"mapp-grid-row"},t,_.map(e.cols,(function(e){return m("div",{className:"mapp-grid-cell",key:e.id},e.label)})),n))),m("div",{className:"mapp-grid-body"},_.map(e.data,(function(t,n){return function(t,n){return m("div",{className:"mapp-grid-row"+(l.dragover==n?" mapp-dragover":""),draggable:!0,key:n,onDragOver:function(e){return e.preventDefault()},onDragStart:function(e){return p({dragging:n})},onDragEnter:function(e){return p({dragover:n})},onDragEnd:function(e){return p({dragging:null,dragover:null})},onDrop:function(e){return u("sort",n)}},function(t,n){if(!e.selectionColumn)return null;var o,a;switch("rowid"==e.selectionColumn?o=n:t[e.selectionColumn]?o=t[e.selectionColumn]:a=!0,e.selectionType){case"checkbox":return m("div",{className:"mapp-grid-cell"},m(C,{value:o,checked:e.selected==o,disabled:a,onChange:function(e){u("select",e?o:null)}}));case"radio":default:return m("div",{className:"mapp-grid-cell"},m(M,{checked:e.selected==o,onChange:function(){return u("select",o)}}))}}(t,n),_.map(e.cols,(function(t,a){return m("div",{className:"mapp-grid-cell mapp-grid-cell-"+t.id,key:n+"-"+a},function(t,n){switch(n.type){case"icon":return m(o.MappIconPicker,{iconid:e.data[t][n.id],onChange:function(e){return u("change",{i:t,id:n.id,value:e})}});case"input":default:return m(j,{key:t+"-"+n.id,size:e.data[t][n.size],value:e.data[t][n.id],onChange:function(e){return u("change",{i:t,id:n.id,value:e})}});case"select":return m(N,{key:t+"-"+n.id,value:e.data[t][n.id],options:n.options,onChange:function(e){u("change",{i:t,id:n.id,value:e})}});case"textarea":return m(A,{className:"mapp-option-expando",value:e.data[t][n.id],onChange:function(e){return u("change",{i:t,id:n.id,value:e})}})}}(n,t))})),function(e){return m("div",{className:"mapp-grid-cell",key:"delete"},m(v,{icon:"trash",onClick:function(){return u("delete",e)}}))}(n))}(t,n)})))),m("div",{className:"mapp-grid-toolbar"},m(v,{isSecondary:!0,onClick:function(){return u("add")}},__("Add"))))}function T(e){var t=a(b({codeEditor:null,isOpen:!1,name:null,tab:"editor",template:null,tokens:null}),2),n=t[0],o=t[1];function r(e){o((function(t){return s(s({},t),e)}))}var i,l,c=g((function(e){if(null!=e){var t=wp.codeEditor.initialize(e);t.codemirror.setSize("auto","auto"),t.codemirror.setOption("readOnly","editor"!=n.tab),r({codeEditor:t})}}),[]);function p(e,t){switch(e){case"close":r({isOpen:!1});break;case"delete":confirm(mappl10n.delete_prompt)&&(mapp.lib.ajax({type:"POST",data:{action:"mapp_tpl_delete",name:n.template.name,nonce:mappl10n.options.nonce}}),r({isOpen:!1}));break;case"insert":var o=n.codeEditor.codemirror.getDoc(),a=o.getCursor();o.replaceRange("{{{poi."+t+"}}}",a);break;case"open":mapp.lib.ajax({type:"GET",data:{action:"mapp_tpl_get",name:t,nonce:mappl10n.options.nonce},callback:function(e){e&&"OK"==e.status&&r({isOpen:!0,name:t,tab:"editor",template:e.data.template,tokens:e.data.tokens})}});break;case"save":var i="editor"==n.tab?n.codeEditor.codemirror.getValue():n.template.content;mapp.lib.ajax({type:"POST",data:{action:"mapp_tpl_save",content:i,name:n.template.name,nonce:mappl10n.options.nonce},callback:function(e){e&&"OK"==e.status&&r({isOpen:!1,template:null,tokens:null})}});break;case"tab-select":if("editor"!=t){var l=s({},n.template);l.content=n.codeEditor.codemirror.getValue(),r({template:l})}r({tab:t})}}return m("div",{className:"mapp-templates"},(l=[{name:"map-popup",label:__("Map popup")},{name:"map-item",label:__("Map list item")},{name:"mashup-popup",label:__("Mashup popup")},{name:"mashup-item",label:__("Mashup list item")}],m("div",{className:"mapp-templates-list"},_.map(l,(function(e,t){return m("a",{href:"#",key:e.name,className:"mapp-templates-item",onClick:function(t){t.preventDefault(),p("open",e.name)}},e.label)})))),n.isOpen&&n.template?m(O,{title:(i=n.template.name+" ("+(n.template.exists?__("Custom"):__("New"))+")",m("div",{className:"mapp-templates-name"},i)),className:"mapp-templates-modal",onRequestClose:function(){return p("close")},shouldCloseOnClickOutside:!1},m(k,{className:"mapp-templates-tabs",onSelect:function(e){return p("tab-select",e)},tabs:[{name:"editor",title:__("Editor")},{name:"standard",title:__("Default")}]},(function(e){return t=m("div",{className:"mapp-templates-tokens"},_.map(n.tokens,(function(e,t){return m("code",{onClick:function(){return p("insert",e)},key:t,title:e},e)}))),o=m("div",{className:"mapp-templates-path"},n.template.path),m(f,null,"editor"==n.tab&&o,"editor"==n.tab&&t,m("div",{className:"editor"==n.tab?"mapp-templates-editor":"mapp-templates-standard"},m("textarea",{ref:c,defaultValue:"editor"==n.tab?n.template.content:n.template.standard})));var t,o})),m("div",{className:"mapp-templates-toolbar"},m(v,{isPrimary:!0,onClick:function(){return p("save")}},__("Save")),m(v,{isSecondary:!0,onClick:function(){return p("close")}},__("Cancel")),n.template.exists&&m("a",{onClick:function(e){e.preventDefault(),p("delete")}},__("Delete")))):null)}},966:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return A}});var o=n(713),a=n(999),r=wp.element.createElement,i=(wp.data.select,wp.element),l=(i.Fragment,i.useEffect,i.useLayoutEffect,i.useRef,i.useState,wp.components),c=(l.BaseControl,l.Button),sprintf=(l.Dashicon,l.Modal,l.PanelBody,l.RadioControl,l.Spinner,l.TextControl,wp.i18n.sprintf);function s(e){function t(t,n){var o=Math.ceil(e.count/e.pageSize);switch(t){case"first":e.onChange(1);break;case"last":e.onChange(o);break;case"next":e.onChange(e.page+1);break;case"prev":e.onChange(e.page-1)}}return o=Math.ceil(e.count/e.pageSize),a=e.page<=1,i=e.page>=o,r("div",{className:"mapp-paginate"},r(c,{disabled:a,onClick:function(){return t("first")},isSecondary:!0},"«"),r(c,{disabled:a,onClick:function(){return t("prev")},isSecondary:!0},"‹"),r("div",{className:"mapp-paginate-count"},sprintf((n="%d of %d",wp.i18n.__(n,"mappress-google-maps-for-wordpress")),e.page,o)),r(c,{disabled:i,onClick:function(){return t("next")},isSecondary:!0},"›"),r(c,{disabled:i,onClick:function(){return t("last")},isSecondary:!0},"»"));var n,o,a,i}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(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 f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var h=window.mapp||{},g=wp.element.createElement,b=wp.data.select,y=wp.element,v=(y.Fragment,y.useEffect),w=(y.useLayoutEffect,y.useRef),O=y.useState,k=wp.components,C=(k.BaseControl,k.Button),S=k.Dashicon,P=k.Modal,j=(k.PanelBody,k.RadioControl),M=k.Spinner,I=k.TextControl,N=function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")};function A(e){var t=d(O({isFetchingItems:!0,items:null,mode:e.mode?e.mode:"list",mapid:e.mapid?e.mapid:null,page:1,search:"",type:mappl10n.options.postid?"post":"all"}),2),n=t[0],r=t[1],i=w(null),l=w(null);function c(e){r((function(t){return u(u({},t),e)}))}function p(t,o){switch(t){case"attach":h.store.mutateMap({mapdata:o});break;case"add-new":c({mode:"edit",mapid:null});break;case"change-type":c({type:o});break;case"close":e.onAction("pick-close");break;case"duplicate":h.store.duplicateMap({mapid:o,success:function(e){alert(N("Map copied")),c({mapid:e.mapid}),jQuery(".mapp-pick-items").scrollTop(0)}});break;case"destroy":confirm(mappl10n.delete_map_prompt)&&(h.store.destroyMap({mapid:o}),o==n.mapid&&e.onAction("pick-destroy",o)),i.current.focus();break;case"edit":c({mode:"edit",mapid:o});break;case"edit-close":"edit"==e.mode?e.onAction("pick-close"):c({mode:"list"});break;case"edit-destroy":c({mode:"list",mapid:null}),e.onAction("pick-destroy",o);break;case"edit-save":"edit"==e.mode?e.onAction("pick-close",o):c({mode:"list",mapid:o});break;case"insert":e.onAction("pick-insert",o);break;case"shortcode":e.onAction("pick-shortcode",o);break;case"sort":h.store.setSort({sortBy:o,sortAsc:h.store.state.sortBy!=o||!h.store.state.sortAsc})}}function m(t){var a,r=t.mapid==n.mapid;a=t.map_title?t.map_title:N("Untitled");var i=function(t){var n;return n=(n="map"==e.context||"mashup"==e.context&&t.postid==mappl10n.options.postid?b("core/editor").getEditedPostAttribute("title"):t.post_title)||N("Untitled"),t.postid>0&&t.postid==mappl10n.options.postid&&(n=N("Current post")),t.postid>0?t.postid==mappl10n.options.postid?n:g("a",{href:mappl10n.options.editurl+"?post="+t.postid+"&action=edit",target:"_blank",title:N("Edit post")},n):N("Unattached")}(t),c=[{action:"edit",label:N("Edit")},{action:"insert",label:N("Insert into post")},{action:"duplicate",label:N("Copy")},{action:"shortcode",label:N("Shortcode")},{action:"destroy",label:N("Delete")}];"library"==e.context?c.splice(1,1):c.splice(3,1),c=g("div",{className:"mapp-pick-actions"},c.map((function(e){return g("a",{href:"#",key:e.action,onClick:function(n){n.stopPropagation(),n.preventDefault(),p(e.action,t.mapid)}},e.label)})));var s=null;return s=t.postid>0?g("a",{href:"#",onClick:function(){return p("attach",{mapid:t.mapid,postid:0})}},N("Detach")):"library"==e.context?g(o.default,{onChange:function(e,n){return p("attach",{mapid:t.mapid,postid:e,post_title:n})}},N("Attach")):g("a",{href:"#",onClick:function(){return p("attach",{mapid:t.mapid,postid:mappl10n.options.postid,post_title:null})}},N("Attach")),g("div",{className:"mapp-pick-item"+(r?" mapp-selected":""),key:t.mapid+"|"+t.postid,ref:r?l:null},g("div",{className:"mapp-pick-col-map_title",onClick:function(e){return p("edit",t.mapid)}},g("div",null,a),g("div",null,c)),g("div",{className:"mapp-pick-col-mapid"},t.mapid),g("div",{className:"mapp-pick-col-post_title"},i,g("div",null,s)))}v((function(){var e=function(e){c({isFetchingItems:e.isFetchingItems,isSavingMap:e.isSavingMap,items:e.items})};return h.store.subscribe(e),function(){return h.store.unsubscribe(e)}})),v((function(){i.current&&i.current.focus(),h.store.fetchItems()}),[]),v((function(){c({page:1})}),[n.type,n.search]),v((function(){l.current&&h.lib.scrollTo(jQuery(".mapp-pick-items"),jQuery(l.current))}),[n.type,n.items]);var f=_.filter(n.items,(function(t){if("post"==n.type&&t.postid!=mappl10n.options.postid)return!1;if("current"==n.type&&t.mapid!=e.mapid)return!1;var o=n.search.toLowerCase();return!o||(t.mapid.indexOf(o)>=0||(!!(t.post_title&&t.post_title.toLowerCase().indexOf(o)>=0)||!!(t.map_title&&t.map_title.toLowerCase().indexOf(o)>=0)))})),y=g("div",{className:"mapp-list-panel"},g("div",{className:"mapp-gt-modal-header"},g("div",{className:"mapp-gt-modal-header-title"},g("h1",null,N("Select a map")),g(C,{isPrimary:!0,onClick:function(){return p("add-new")}},N("Add New"))),g(C,{onClick:function(){return p("close")},icon:"no-alt"})),function(){var t=[{label:N("Attached to post"),value:"post"},{label:N("All maps"),value:"all"}];e.mapid&&t.unshift({label:N("Current map"),value:"current"});var o="library"==e.context?null:g(j,{className:"mapp-pick-type",options:t,onChange:function(e){return p("change-type",e)},selected:n.type}),a=n.isFetchingItems||n.isAttaching&&"library"!=e.context;return g("div",{className:"mapp-pick-filter"},a&&g(M,null),g(I,{ref:i,className:"mapp-pick-search",tabIndex:1,label:N("Search"),placeholder:N("post title, map title, or map id"),onChange:function(e){return c({search:e})}}),o)}(),function(e){if(e){var t=20*(n.page-1),o=t+20;e=e.slice(t,o)}var a,r="";return r=n.isFetchingItems?null:e.length?_.map(e,m):g("div",{className:"mapp-pick-message"},N("No maps found")),g("div",{className:"mapp-pick-items-section"},g("div",{className:"mapp-pick-items"},(a={map_title:N("Map title"),mapid:N("Map ID"),post_title:N("Attached to")},g("div",{className:"mapp-pick-items-header"},_.map(a,(function(e,t){return g("div",{className:"mapp-pick-col-"+t,onClick:function(){return p("sort",t)},key:t},e,h.store.state.sortBy==t&&g(S,{icon:h.store.state.sortAsc?"arrow-up":"arrow-down"}))})))),r))}(f),function(t){return g("div",{className:"mapp-pick-toolbar"},"library"!=e.context?g(C,{onClick:function(){return p("close")}},N("Cancel")):null,function(e){return e&&e.length?g(s,{count:e?e.length:0,onChange:function(e){return c({page:e})},page:n.page,pageSize:20}):null}(t))}(f)),k=null;if("edit"==n.mode){var A=g("div",{className:"mapp-edit-panel"},g(a.default,{context:e.context,mapid:n.mapid,onAction:p}));k="library"==e.context?g(P,{className:"mapp-gt-modal",isDismissible:!1},A):A}var E="mapp-pick mapp-mode-"+n.mode+" mapp-context-"+e.context;return"library"==e.context?g("div",{className:E},y,k):g(P,{className:"mapp-gt-modal "+E,isDismissible:"list"==n.mode,onRequestClose:function(){return p("close")},shouldCloseOnEsc:"list"==n.mode,shouldCloseOnClickOutside:"list"==n.mode},y,k)}},429:function(e,t,n){"use strict";function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(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 a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}n.r(t),n.d(t,{MappSettings:function(){return g}});window.mapp;var r=wp.element.createElement,i=wp.element,l=i.Fragment,c=(i.useEffect,i.useLayoutEffect,i.useRef,i.useState),s=wp.components,p=s.BaseControl,u=s.Button,m=s.ButtonGroup,d=(s.Dashicon,s.Dropdown,s.ExternalLink,s.Panel,s.PanelBody,s.PanelRow),f=(s.RadioControl,s.SelectControl),h=s.TextControl,__=function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")};function g(e){var t,n=o(c({}),2);n[0],n[1];function a(e){if(!e||"string"!=typeof e)return e;var t={px:2048,vw:100,vh:100,"%":100},n=parseInt(e),o=2048,a="";for(var r in t)e.includes(r)&&(a=r,o=t[r]);return n>o?o+a:e}function i(t,n){var o=null;switch(t){case"mapTypeId":e.map.set({mapTypeId:n}),o={mapTypeId:n};break;case"poiList":e.map.set({poiList:n}),o={poiList:n};break;case"size":n.hasOwnProperty("height")&&(n.height=a(n.height)),n.hasOwnProperty("width")&&(n.width=a(n.width)),e.map.setSize(n),o=n;break;case"viewport-reset":e.map.center=e.map.zoom=null,e.map.recenter(),o={center:void 0,zoom:void 0};break;case"viewport-set":var r=e.map.getCenter().toJSON();e.map.center=r,e.map.zoom=e.map.getZoom(),o={center:r.lat+","+r.lng,zoom:e.map.getZoom()},"mce"==e.context||"library"==e.context?alert(__("Viewport set")):wp.data.dispatch("core/notices").createNotice("success",__("Viewport set"),{type:"snackbar",isDismissible:!0})}o&&e.onAction("change-settings",o)}return r("div",{className:"mapp-settings"},null,(t=e.map.title?e.map.title:__("Untitled"),r(d,null,"map"==e.context&&r(p,{className:"mapp-settings-title"},t),r(p,{className:"mapp-settings-id",label:__("Map ID")},e.map.mapid))),"mashup"==e.context&&function(){var t=[];if("leaflet"==mappl10n.options.engine)t=mappl10n.options.baseLayers.map((function(e){return{label:e.label,value:e.name}}));else{var n=mappl10n.options.styles?_.keys(mappl10n.options.styles):[];t=["roadmap","satellite","terrain","hybrid"].concat(n).map((function(e){return{label:e.charAt(0).toUpperCase()+e.slice(1),value:e}}))}return t.unshift({label:__("Default"),value:null}),r(f,{className:"mapp-settings-type",help:"",label:__("Map type"),value:e.map.mapTypeId,options:t,onChange:function(e){return i("mapTypeId",e)}})}(),function(){var t=mappl10n.options.sizes[mappl10n.options.size]?mappl10n.options.sizes[mappl10n.options.size]:mappl10n.options.sizes[0],n=mappl10n.options.sizes.map((function(e,t){return{label:e.width+" X "+e.height,height:e.height,width:e.width,value:t+1}}));n.unshift({height:"",label:__("Default"),value:0,width:""}),n.push({label:__("Custom"),value:"custom",disabled:!0});for(var o="custom",a=0;a<n.length-1;a++)n[a].width==e.width&&n[a].height==e.height&&(o=a);return r(l,null,r(f,{className:"mapp-settings-dims-select",help:"",label:__("Size"),value:o,options:n,onChange:function(e){return i("size",{width:n[e].width,height:n[e].height})}}),r(d,null,r(h,{className:"mapp-settings-dims-custom",help:__("px, %, vw"),label:__("Width"),onChange:function(e){return i("size",{width:e})},placeholder:t.width,value:e.width?e.width:""}),r(h,{className:"mapp-settings-dims-custom",help:__("px, %, vh"),label:__("Height"),onChange:function(e){return i("size",{height:e})},placeholder:t.height,value:e.height?e.height:""})))}(),(e.center&&(e.center.lat,e.center.lng,__("Zoom"),e.zoom),r(l,null,r(p,{className:"mapp-settings-viewport",label:__("Center/Zoom")},r(m,{label:__("Center/Zoom")},r(u,{onClick:function(){return i("viewport-reset")},isPressed:!e.center,isSmall:!0},__("Automatic")),r(u,{onClick:function(){return i("viewport-set")},isPressed:e.center,isSmall:!0},__("Set")))))))}},787:function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||o(e)||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.")}()}function o(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var r=window.mapp||{};r.Store=function(){this.subs=new Set,this.state={isFetchingMap:!1,isFetchingItems:!1,isSavingMap:!1,itemsFetched:!1,sortBy:"map_title",sortAsc:!0,maps:{},items:[]}},r.Store.prototype={createMap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.success,n=void 0===t?function(){}:t;this.state.isFetchingMap=!1,this.publish(),n()},destroyMap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mapid,n=e.success,o=void 0===n?function(){}:n,a=e.failure,i=void 0===a?function(){}:a,l=this;r.lib.ajax({type:"POST",data:{action:"mapp_delete",mapid:t,nonce:mappl10n.options.nonce},callback:function(e){e&&"OK"==e.status?(delete l.state.maps[t],l.destroyItem(t),o(t)):i(),l.publish()}})},duplicateMap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mapid,n=e.success,o=void 0===n?function(){}:n,a=e.failure,i=void 0===a?function(){}:a,l=this;this.state.isSavingMap=!0,this.publish(),r.lib.ajax({type:"POST",data:{action:"mapp_duplicate",mapid:t,postid:mappl10n.options.postid,nonce:mappl10n.options.nonce},callback:function(e){if(e&&"OK"==e.status){var t=e.data,n=t.mapid;l.state.maps[n]=t,l.saveItem(t),o(t)}else i();l.state.isSavingMap=!1,l.publish()}})},fetchMap:function(e){var t=e.mapid,n=e.success,o=void 0===n?function(){}:n,a=e.failure,i=void 0===a?function(){}:a,l=this;if(void 0!==this.state.maps[t])return l.publish(),void o(this.state.maps[t]);this.state.isFetchingMap=!0,l.publish(),r.lib.ajax({type:"GET",data:{action:"mapp_get",mapid:t,nonce:mappl10n.options.nonce},callback:function(e){e&&"OK"==e.status?(l.state.maps[t]=e.data,o(e.data)):i(),l.state.isFetchingMap=!1,l.publish()}})},mutateMap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mapdata,n=e.success,o=void 0===n?function(){}:n,a=e.failure,i=void 0===a?function(){}:a,l=this;this.state.isSavingMap=!0,this.saveItem(t),this.publish(),r.lib.ajax({type:"POST",data:{action:"mapp_mutate",mapdata:t,nonce:mappl10n.options.nonce},callback:function(e){e&&"OK"==e.status?(l.state.maps[e.data.mapid]=e.data,o(t)):i(),l.state.isSavingMap=!1,l.publish()}})},saveMap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mapdata,n=e.success,o=void 0===n?function(){}:n,a=e.failure,i=void 0===a?function(){}:a,l=this;this.state.isSavingMap=!0,this.publish(),r.lib.ajax({type:"POST",data:{action:"mapp_save",mapdata:JSON.stringify(t),nonce:mappl10n.options.nonce},callback:function(e){if(e&&"OK"==e.status){var t=e.data,n=t.mapid;l.state.maps[n]=t,l.saveItem(t),o(t)}else i();l.state.isSavingMap=!1,l.publish()}})},destroyItem:function(e){var t=this.state.items?this.state.items:[],o=_.findIndex(t,{mapid:e});o>-1&&t.splice(o,1),this.state.items=n(t),this.publish()},fetchItems:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.success,n=void 0===t?function(){}:t,o=e.failure,a=void 0===o?function(){}:o,i=this;if(this.state.itemsFetched)return n(this.state.items),void i.publish();this.state.isFetchingItems=!0,i.publish(),r.lib.ajax({type:"GET",data:{action:"mapp_find",nonce:mappl10n.options.nonce},callback:function(e){e&&"OK"==e.status?(i.state.items=e.data,i.sort(),n(i.state.items),i.state.itemsFetched=!0):a(),i.state.isFetchingItems=!1,i.sort(),i.publish()}})},saveItem:function(n){var o=this.state.items?this.state.items:[],a=_.findWhere(o,{mapid:n.mapid});a?(a.mapid=void 0!==n.mapid?n.mapid:a.mapid,a.map_title=void 0!==n.title?n.title:a.map_title,a.postid=void 0!==n.postid?n.postid:a.postid,a.post_title=void 0!==n.post_title?n.post_title:a.post_title,a=function(n){for(var o=1;o<arguments.length;o++){var a=null!=arguments[o]?arguments[o]:{};o%2?e(Object(a),!0).forEach((function(e){t(n,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):e(Object(a)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(a,e))}))}return n}({},a)):(a={mapid:n.mapid,map_title:n.title,postid:mappl10n.options.postid,post_title:null},o.unshift(a))},setSort:function(e){e.sortBy&&(this.state.sortBy=e.sortBy),void 0!==e.sortAsc&&(this.state.sortAsc=e.sortAsc),this.sort(),this.publish()},sort:function(e,t){var n,o=this,a=(n="untitled",wp.i18n.__(n,"mappress-google-maps-for-wordpress"));this.state.items.sort((function(e,t){return function(e,t,n,o){if(o=o?1:-1,"mapid"==n)return o*(Number(e.mapid)-Number(t.mapid));var r=e[n]?e[n]:a,i=t[n]?t[n]:a,l=o*r.localeCompare(i);return 0==l?Number(e.mapid)-Number(t.mapid):l}(e,t,o.state.sortBy,o.state.sortAsc)}))},subscribe:function(e){this.subs.add(e)},unsubscribe:function(e){this.subs.delete(e)},publish:function(){var e,t=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=o(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var a=0,r=function(){};return{s:r,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(_e){throw _e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return l=e.done,e},e:function(e){c=!0,i=e},f:function(){try{l||null==n.return||n.return()}finally{if(c)throw i}}}}(n(this.subs));try{for(t.s();!(e=t.n()).done;){(0,e.value)(this.state)}}catch(e){t.e(e)}finally{t.f()}}},r.store=new r.Store},308:function(e,t,n){"use strict";e.exports=function(e,t){var o,a,r,i,l,c,s,p,u,m,d,f,h,g=String(e).replace(/^&/,"").replace(/&$/,"").split("&"),b=g.length,y=function(e){return decodeURIComponent(e.replace(/\+/g,"%20"))},v="undefined"!=typeof window?window:n.g;v.$locutus=v.$locutus||{};var w=v.$locutus;for(w.php=w.php||{},t||(t=v),o=0;o<b&&(u=y((p=g[o].split("="))[0]),m=p.length<2?"":y(p[1]),!(u.includes("__proto__")||u.includes("constructor")||u.includes("prototype")));o++){for(;" "===u.charAt(0);)u=u.slice(1);if(u.indexOf("\0")>-1&&(u=u.slice(0,u.indexOf("\0"))),u&&"["!==u.charAt(0)){for(f=[],d=0,a=0;a<u.length;a++)if("["!==u.charAt(a)||d){if("]"===u.charAt(a)&&d&&(f.length||f.push(u.slice(0,d-1)),f.push(u.substr(d,a-d)),d=0,"["!==u.charAt(a+1)))break}else d=a+1;for(f.length||(f=[u]),a=0;a<f[0].length&&(" "!==(s=f[0].charAt(a))&&"."!==s&&"["!==s||(f[0]=f[0].substr(0,a)+"_"+f[0].substr(a+1)),"["!==s);a++);for(c=t,a=0,h=f.length;a<h;a++){if(l=c,(""===(u=f[a].replace(/^['"]/,"").replace(/['"]$/,""))||" "===u)&&0!==a){for(i in r=-1,c)c.hasOwnProperty(i)&&+i>r&&i.match(/^\d+$/g)&&(r=+i);u=r+1}Object(c[u])!==c[u]&&(c[u]={}),c=c[u]}l[u]=m}}}}},t={};function n(o){if(t[o])return t[o].exports;var a=t[o]={exports:{}};return e[o](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(787),n(215),n(713),n(525),n(999),n(143),n(800),n(938),n(816),n(378),n(498),n(670),n(218),n(824),n(966),n(429)}();
1
+ !function(){var e={215:function(e,t,n){"use strict";n.r(t);var o=n(525),a=n(143);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c,p=window.mapp||{},s=wp.element.createElement;c=jQuery,p.Editor=function(e){this.drawingManager=null,this.map=e,this.poiEditor=null;var t=this;this.initialize=function(){this.map.display(),this.poiEditor=new p.PoiEditor(this.map),this.initDrawingManager(),c(this.map.places).off("search.mapp"),c(this.map.places).on("search.mapp",(function(e,n){t.insert(n)}))},this.insert=function(e){if(e)if(this.drawingManager&&this.drawingManager.setDrawingMode(null),this.map.poiClose(),e.geometry){var n=e.formatted_address?e.formatted_address.replace(/, United States of America/i,"").replace(/, United States/i,"").replace(/, USA/i,""):null,o=e.name==n?"":n,a=new p.Poi({address:n,body:o,iconid:this.poiEditor.lastIcon,point:e.geometry.location,title:e.name,viewport:e.geometry.viewport?e.geometry.viewport:null});this.map.poiInsert(a),a.center()}else e.overlay?(this.map.poiHover(null),"marker"==e.type?(a=new p.Poi({body:"",iconid:null,overlay:null,point:e.overlay.getPosition().toJSON(),title:e.overlay.getPosition().toUrlValue(6),type:null}),e.overlay.setMap(null)):a=new p.Poi({body:"",iconid:null,overlay:e.overlay,title:mappl10n.shape,type:e.type}),this.map.poiInsert(a)):"string"==typeof e&&"http"==e.substring(0,4)&&(a=new p.Poi({iconid:this.poiEditor.lastIcon,kml:{url:e},title:"KML",type:"kml"}),t.map.poiInsert(a),p.event.addListenerOnce(a.overlay,"ready defaultviewport_changed",(function(){a.center()})))},this.initDrawingManager=function(){var e={fillColor:"#0000FF",fillOpacity:.4,strokeColor:"#0000FF",strokeOpacity:1,strokeWeight:2};"leaflet"==mappl10n.options.engine||google.maps.drawing&&(this.drawingManager=new google.maps.drawing.DrawingManager({drawingControlOptions:{position:google.maps.ControlPosition.TOP_CENTER,drawingModes:[google.maps.drawing.OverlayType.MARKER,google.maps.drawing.OverlayType.POLYGON,google.maps.drawing.OverlayType.POLYLINE,google.maps.drawing.OverlayType.RECTANGLE,google.maps.drawing.OverlayType.CIRCLE]},circleOptions:e,polygonOptions:e,polylineOptions:e,rectangleOptions:e}),this.drawingManager.setMap(this.map.getMap()),p.event.addListener(this.drawingManager,"overlaycomplete",(function(e){t.drawingManager.get("drawingMode")&&t.insert(e)})))},this.initialize.apply(this)},p.PoiEditor=function(e){this.map=e,this.poi=null,this.sel=null,this.lastIcon=null;var t=this;this.initialize=function(){this.sel=c(this.map.iw.getContent()),c(this.map).on("mapp.open",(function(e,n){t.render(n)})),c(this.map).on("mapp.close",(function(){t.mce(!1)})),this.sel.on("click","[data-mapp-poi]",(function(e){e.preventDefault();var n=c(this).attr("data-mapp-poi");t[n]()})),this.sel.on("click",".mapp-poi-visual, .mapp-poi-html",(function(e){var n=c(this).hasClass("mapp-poi-visual");t.mce(n)})),this.sel.on("keydown",(function(e){13==e.which&&"mapp-poi-body"!=e.target.id&&(e.preventDefault(),t.save())}))},this.cancel=function(){this.map.poiClose()},this.initMCE=function(){if("undefined"!=typeof tinyMCE&&void 0!==tinyMCE.init){var e="en";if(void 0!==window.tinyMCEPreInit&&void 0!==window.tinyMCEPreInit.mceInit&&void 0!==window.tinyMCEPreInit.mceInit.content){var t=window.tinyMCEPreInit.mceInit.content;e=void 0!==t.language?t.language:"en"}var n={mode:"none",height:"100%",convert_urls:!1,language:e,menubar:!1,plugins:"image,paste,textcolor,wordpress,wpeditimage,wplink,wpview",relative_urls:!1,remove_script_host:!1,statusbar:!1,theme:"modern",toolbar1:"bold,italic,link",toolbar2:"",toolbar3:"",toolbar4:""};tinyMCE.init(n),this.mce(!0)}},this.mce=function(e){var n=e?"mceAddEditor":"mceRemoveEditor";"undefined"!=typeof tinyMCE&&tinyMCE.execCommand(n,!1,"mapp-poi-body"),c(".mapp-poi-visual, .mapp-poi-html",t.sel).removeClass("mapp-active"),e?c(".mapp-poi-visual",t.sel).addClass("mapp-active"):c(".mapp-poi-html",t.sel).addClass("mapp-active")},this.remove=function(){confirm(mappl10n.delete_prompt)&&(this.map.poiClose(),this.map.poiRemove(this.poi))},this.render=function(e){this.poi=e,this.renderColorPicker(this.poi),this.renderIconPicker(this.poi),this.initMCE()},this.renderColorPicker=function(e){var t=this;document.getElementById("mapp-poi-colorpicker")&&wp.element.render(s(o.MappColorPicker,i(i({},e.getTemplateColors()),{},{isExtended:!0,onChange:function(n){e.set({dirty:!0}),e.setTemplateColors(n),t.map.renderList(),t.renderColorPicker(e)}})),document.getElementById("mapp-poi-colorpicker"))},this.renderIconPicker=function(e){var t=this;document.getElementById("mapp-poi-iconpicker")&&wp.element.render(s(a.MappIconPicker,{iconid:e.iconid,onChange:function(n){e.set({dirty:!0,iconid:n}),t.lastIcon=n,t.map.renderList(),t.renderIconPicker(e)}}),document.getElementById("mapp-poi-iconpicker"))},this.save=function(){"undefined"!=typeof tinyMCE&&tinyMCE.get("mapp-poi-body")&&tinyMCE.get("mapp-poi-body").save(),this.poi.set({dirty:!0,title:c(".mapp-poi-title").val(),body:c(".mapp-poi-body").val()}),this.map.renderList(),this.map.poiClose()},this.initialize.apply(this)}},713:function(e,t,n){"use strict";function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}(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 l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}n.r(t),n.d(t,{default:function(){return y}});var c=wp.element.createElement,p=wp.url.addQueryArgs,s=wp.element,u=s.useCallback,m=s.useEffect,d=s.useState,f=wp.components,h=(f.Button,f.Dropdown),g=f.Spinner,b=f.TextControl,__=function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")};function y(e){var t=i(d({isFetching:!1,results:[],search:"",searchTerm:""}),2),n=t[0],o=t[1];function r(e){o((function(t){return a(a({},t),e)}))}m((function(){n.isOpen&&(r({isFetching:!0}),wp.apiFetch({path:p("/wp/v2/search",{search:n.search,per_page:20})}).then((function(e){r({results:e,isFetching:!1})})))}),[n.search,n.isOpen]);var l=u(_.debounce((function(e){r({search:e})}),1e3),[]);function s(t,o){return c("div",{className:"mapp-attach-control"},c("div",{className:"mapp-attach-control-toolbar"},c(b,{autoComplete:"false",value:n.searchTerm,onChange:function(e){r({searchTerm:e}),l(e)},placeholder:__("Search")})),function(){if(n.isFetching)return c(g,null);if(n.results)return n.results.length?c("div",{className:"mapp-attach-items"},n.results.map((function(t){return c("div",{key:t.id,className:"mapp-attach-item",onClick:function(){e.onChange(t.id,t.title)}},c("div",{className:"mapp-attach-item-title"},t.title?t.title:__("Untitled")),c("div",{className:"mapp-attach-item-type"},t.type))}))):c("div",{},__("No posts found"))}())}return c("div",{onClick:function(e){return e.stopPropagation()}},c(h,{onToggle:function(e){return r({isOpen:e})},renderToggle:function(e){e.isOpen;var t=e.onToggle;return c("a",{href:"#",onClick:t},__("Attach"))},renderContent:function(e){e.isOpen,e.onToggle;return s()}}))}},525:function(e,t,n){"use strict";n.r(t),n.d(t,{MappColorPicker:function(){return y}});var o=n(824);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(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 c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var p=wp.element.createElement,s=wp.element,u=s.Fragment,m=s.useEffect,d=(s.useLayoutEffect,s.useCallback,s.useRef,s.useState),f=(wp.data.useSelect,wp.compose.withState,wp.components),h=f.Button,g=(f.ColorPalette,f.ColorPicker),b=(f.Dashicon,f.Dropdown,f.ExternalLink,f.Modal),__=(f.Panel,f.PanelBody,f.PanelRow,f.Popover,f.RadioControl,f.Spinner,f.TabPanel,function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")});function y(e){var t=l(d({isCustomOpen:!1,isOpen:!1}),2),n=t[0],a=t[1];function i(e){a((function(t){return r(r({},t),e)}))}function c(t,n){switch(t){case"close":i({isOpen:!1});break;case"open":i({isOpen:!0});break;case"select":e.onChange(n),c("close");break;case"set":e.onChange(n)}}return m((function(){}),[]),p(u,null,p("span",{className:"mapp-colors-toggle",onClick:function(){return c("open",null)},style:{backgroundColor:e.color,border:e.isExtended?"1px solid "+e.color:"1px solid gray",opacity:e.isExtended&&e.opacity?e.opacity/100:1},tabIndex:0}),function(){if(!n.isOpen)return null;var t=_.map([100,90,80,70,60,50,40,30,20,10,0],(function(e){return{label:e+"%",value:e}})),a=_.map([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],(function(e){return{label:e+"px",value:e}}));return p(b,{title:__("Select a color"),className:"mapp-colors-modal",onRequestClose:function(e){return c("close")}},p("div",{className:"mapp-colors"},p("div",{className:"mapp-colors-list"},_.map([["yellow","yellowgreen","green","seagreen","blue","cornflowerblue","darkslateblue","purple","firebrick","red","darkorange","orange","saddlebrown"],["lightyellow","greenyellow","lightgreen","darkseagreen","lightblue","skyblue","slateblue","orchid","plum","pink","sandybrown","goldenrod","peru"],["white","lightgray","gray","black"]],(function(t,n){return p("div",{key:n},_.map(t,(function(t){return p("span",{className:"mapp-color"+(t==e.color?" mapp-selected":""),key:t,onClick:function(){i({isCustomOpen:!1}),c("select",{color:t})},style:{backgroundColor:t},title:t})})))}))),n.isCustomOpen&&p(g,{color:e.color,onChangeComplete:function(e){return c("set",{color:e.hex})},disableAlpha:!0}),e.isExtended&&p(o.Select,{label:__("Opacity"),options:t,value:e.opacity?e.opacity:"",onChange:function(e){return c("set",{opacity:e})}}),e.isExtended&&p(o.Select,{label:__("Stroke"),options:a,value:e.weight?e.weight:"",onChange:function(e){return c("set",{weight:e})}}),p("div",{className:"mapp-colors-toolbar"},p(h,{isPrimary:!0,onClick:function(){return c("close")}},__("Done")),p(h,{isLink:!0,onClick:function(){return i({isCustomOpen:!n.isCustomOpen})}},__("Custom color")))))}())}},999:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return v}});var o=n(429);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(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 c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var p=window.mapp||{},s=wp.element.createElement,u=wp.element,m=(u.Fragment,u.useEffect),d=(u.useLayoutEffect,u.useRef),f=u.useState,h=wp.components,g=h.Button,b=(h.Dropdown,h.Modal,h.Panel,h.PanelBody),y=(h.Popover,h.Spinner,h.TextControl),__=function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")};function v(e){var t,n,a=l(f({dragging:null,dragover:null,isFetchingMap:!!e.mapid,isPoiListOpen:!0,isSavingMap:!1,map:null,mapdata:null}),2),i=a[0],c=a[1],u=d(null);function h(e){c((function(t){return r(r({},t),e)}))}function v(e){h({map:i.map})}function w(t,n){switch(t){case"change-settings":i.map.set(n),h({map:i.map});break;case"change-title":i.map.set({dirty:!0,title:n}),h({map:i.map});break;case"close":e.onAction("edit-close");break;case"destroy":confirm(mappl10n.delete_map_prompt)&&(p.store.destroyMap({mapid:e.mapid}),e.onAction("edit-destroy"));break;case"save":p.store.saveMap({mapdata:i.map.toJSON(),success:function(t){i.map.set({dirty:!1}),e.onAction("edit-save",t.mapid)}})}}return m((function(){i.map&&(jQuery(i.map.div.list).off("render",v),jQuery(i.map.div.list).on("render",(function(e){return v()})))}),[i.map]),m((function(){var t=function(t){h({isFetchingMap:t.isFetchingMap,isSavingMap:t.isSavingMap,mapdata:t.maps[e.mapid]})};return p.store.subscribe(t),function(){return p.store.unsubscribe(t)}})),m((function(){e.mapid&&p.store.fetchMap({mapid:e.mapid})}),[e.mapid]),m((function(){if(!i.isFetchingMap){var t={editable:!0,embed:!0,layout:"left",mapOpts:{mapTypeControl:!0,streetViewControl:!1},menu:!1,name:"media-map",poiList:!1,sel:jQuery(u.current)};"map"!=e.context&&"mashup"!=e.context||(t.center=null,t.zoom=null);var n=new p.Map(i.mapdata,t);new p.Editor(n);h({map:n})}}),[i.mapdata]),m((function(){i.map&&setTimeout((function(){return i.map.resize()}),100)}),[i.isPoiListOpen]),s("div",{className:"mapp-edit"},(t=i.map&&!i.isFetchingMap&&i.map.title?i.map.title:"",n=i.map&&!i.isFetchingMap?__("Untitled"):"",s("div",{className:"mapp-gt-modal-header"},s(y,{className:"mapp-edit-title",placeholder:n,value:t,onChange:function(e){return w("change-title",e)}}))),s("div",{className:"mapp-edit-main"},s("div",{className:"mapp-list mapp-edit-list"+(i.isPoiListOpen?" mapp-list-open":"")},function(){if("mce"!=e.context&&"library"!=e.context)return null;if(!i.map)return null;var t=i.map,n=t.center,a=t.height,r=t.poiList,l=t.width,c=t.zoom;return s("div",{className:"mapp-gt-inspector"},s(b,{initialOpen:!1,title:__("Map settings")},s(o.MappSettings,{map:i.map,context:e.context,onAction:w,center:n,height:a,poiList:r,width:l,zoom:c})))}(),function(){if(i.map){var e=function(e,t){var n=i.dragging,o=n<o?t-1:t;i.map.pois_.splice(o,0,i.map.pois_.splice(n,1)[0]),h({map:i.map,dragover:null})};return s("div",{className:"mapp-items"},_.map(i.map.pois_,(function(t,n){return s("div",{className:i.dragover==n?"mapp-item mapp-edit-dragover":"mapp-item",draggable:!0,key:n,onClick:function(){return i.map.poiOpen(i.map.pois_[n])},onDragOver:function(e){return e.preventDefault()},onDragStart:function(e){return h({dragging:n})},onDragEnter:function(e){return h({dragover:n})},onDragEnd:function(e){return h({dragging:null,dragover:null})},onDrop:function(t){return e(t,n)}},s("img",{className:"mapp-icon",src:p.Icons.getUrl(t.iconid)}),s("div",{className:"mapp-title"},t.title))})))}}(),s("div",{className:"mapp-list-toggle",onClick:function(){return h({isPoiListOpen:!i.isPoiListOpen})}})),s("div",{className:"mapp-edit-map",key:e.mapid,ref:u,onKeyDown:function(e){return e.stopPropagation()},tabIndex:-1})),s("div",{className:"mapp-edit-toolbar",tabIndex:-1,onKeyDown:function(e){return e.stopPropagation()}},s(g,{isPrimary:!0,isBusy:i.isSavingMap,onClick:function(){return w("save")}},__("Save")),s(g,{disabled:i.isSavingMap,onClick:function(){return w("close")}},__("Cancel")),s(g,{disabled:!e.mapid||i.isSavingMap,isDestructive:!0,className:"mapp-edit-delete",onClick:function(){return w("destroy")}},__("Delete"))))}},143:function(e,t,n){"use strict";n.r(t),n.d(t,{MappIconPicker:function(){return w}});var o=n(525),a=n(824);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}(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 p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var s=wp.element.createElement,u=wp.element,m=u.Fragment,d=u.useEffect,f=(u.useLayoutEffect,u.useCallback,u.useRef,u.useState),h=(wp.data.useSelect,wp.compose.withState,wp.components),g=h.Button,b=(h.ColorPicker,h.DropZone,h.DropZoneProvider,h.FormFileUpload),y=h.Modal,__=(h.Popover,h.Spinner,h.TabPanel,function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")}),v={"mapp-icons":{label:"Map icons",glyphs:[{name:"abseiling",codepoint:59392},{name:"accounting",codepoint:59393},{name:"airport",codepoint:59394},{name:"amusement-park",codepoint:59395},{name:"aquarium",codepoint:59396},{name:"archery",codepoint:59397},{name:"art-gallery",codepoint:59398},{name:"assistive-listening-system",codepoint:59399},{name:"atm",codepoint:59400},{name:"audio-description",codepoint:59401},{name:"bakery",codepoint:59402},{name:"bank",codepoint:59403},{name:"bar",codepoint:59404},{name:"baseball",codepoint:59405},{name:"beauty-salon",codepoint:59406},{name:"bicycle-store",codepoint:59407},{name:"bicycling",codepoint:59408},{name:"boat-ramp",codepoint:59409},{name:"boat-tour",codepoint:59410},{name:"boating",codepoint:59411},{name:"book-store",codepoint:59412},{name:"bowling-alley",codepoint:59413},{name:"braille",codepoint:59414},{name:"bus-station",codepoint:59415},{name:"cafe",codepoint:59416},{name:"campground",codepoint:59417},{name:"canoe",codepoint:59418},{name:"car-dealer",codepoint:59419},{name:"car-rental",codepoint:59420},{name:"car-repair",codepoint:59421},{name:"car-wash",codepoint:59422},{name:"casino",codepoint:59423},{name:"cemetery",codepoint:59424},{name:"chairlift",codepoint:59425},{name:"church",codepoint:59426},{name:"skip",codepoint:59427},{name:"city-hall",codepoint:59428},{name:"climbing",codepoint:59429},{name:"closed-captioning",codepoint:59430},{name:"clothing-store",codepoint:59431},{name:"compass",codepoint:59432},{name:"convenience-store",codepoint:59433},{name:"courthouse",codepoint:59434},{name:"cross-country-skiing",codepoint:59435},{name:"crosshairs",codepoint:59436},{name:"dentist",codepoint:59437},{name:"department-store",codepoint:59438},{name:"diving",codepoint:59439},{name:"doctor",codepoint:59440},{name:"electrician",codepoint:59441},{name:"electronics-store",codepoint:59442},{name:"embassy",codepoint:59443},{name:"expand",codepoint:59444},{name:"female",codepoint:59445},{name:"finance",codepoint:59446},{name:"fire-station",codepoint:59447},{name:"fish-cleaning",codepoint:59448},{name:"fishing-pier",codepoint:59449},{name:"fishing",codepoint:59450},{name:"florist",codepoint:59451},{name:"food",codepoint:59452},{name:"fullscreen",codepoint:59453},{name:"funeral-home",codepoint:59454},{name:"furniture-store",codepoint:59455},{name:"gas-station",codepoint:59456},{name:"general-contractor",codepoint:59457},{name:"golf",codepoint:59458},{name:"grocery-or-supermarket",codepoint:59459},{name:"gym",codepoint:59460},{name:"hair-care",codepoint:59461},{name:"hang-gliding",codepoint:59462},{name:"hardware-store",codepoint:59463},{name:"health",codepoint:59464},{name:"hindu-temple",codepoint:59465},{name:"horse-riding",codepoint:59466},{name:"hospital",codepoint:59467},{name:"ice-fishing",codepoint:59468},{name:"ice-skating",codepoint:59469},{name:"inline-skating",codepoint:59470},{name:"insurance-agency",codepoint:59471},{name:"jet-skiing",codepoint:59472},{name:"jewelry-store",codepoint:59473},{name:"kayaking",codepoint:59474},{name:"laundry",codepoint:59475},{name:"lawyer",codepoint:59476},{name:"library",codepoint:59477},{name:"liquor-store",codepoint:59478},{name:"local-government",codepoint:59479},{name:"location-arrow",codepoint:59480},{name:"locksmith",codepoint:59481},{name:"lodging",codepoint:59482},{name:"low-vision-access",codepoint:59483},{name:"male",codepoint:59484},{name:"skip",codepoint:59485},{name:"marina",codepoint:59486},{name:"mosque",codepoint:59487},{name:"motobike-trail",codepoint:59488},{name:"movie-rental",codepoint:59489},{name:"movie-theater",codepoint:59490},{name:"moving-company",codepoint:59491},{name:"museum",codepoint:59492},{name:"natural-feature",codepoint:59493},{name:"night-club",codepoint:59494},{name:"open-captioning",codepoint:59495},{name:"painter",codepoint:59496},{name:"park",codepoint:59497},{name:"parking",codepoint:59498},{name:"pet-store",codepoint:59499},{name:"pharmacy",codepoint:59500},{name:"physiotherapist",codepoint:59501},{name:"place-of-worship",codepoint:59502},{name:"playground",codepoint:59503},{name:"plumber",codepoint:59504},{name:"point-of-interest",codepoint:59505},{name:"police",codepoint:59506},{name:"political",codepoint:59507},{name:"post-box",codepoint:59508},{name:"post-office",codepoint:59509},{name:"skip",codepoint:59510},{name:"skip",codepoint:59511},{name:"rafting",codepoint:59512},{name:"real-estate-agency",codepoint:59513},{name:"restaurant",codepoint:59514},{name:"roofing-contractor",codepoint:59515},{name:"skip",codepoint:59516},{name:"route",codepoint:59517},{name:"rv-park",codepoint:59518},{name:"sailing",codepoint:59519},{name:"school",codepoint:59520},{name:"scuba-diving",codepoint:59521},{name:"search",codepoint:59522},{name:"skip",codepoint:59523},{name:"shopping-mall",codepoint:59524},{name:"sign-language",codepoint:59525},{name:"skateboarding",codepoint:59526},{name:"ski-jumping",codepoint:59527},{name:"skiing",codepoint:59528},{name:"sledding",codepoint:59529},{name:"snow-shoeing",codepoint:59530},{name:"snow",codepoint:59531},{name:"snowboarding",codepoint:59532},{name:"snowmobile",codepoint:59533},{name:"spa",codepoint:59534},{name:"skip",codepoint:59535},{name:"skip",codepoint:59536},{name:"skip",codepoint:59537},{name:"stadium",codepoint:59538},{name:"storage",codepoint:59539},{name:"store",codepoint:59540},{name:"subway-station",codepoint:59541},{name:"surfing",codepoint:59542},{name:"swimming",codepoint:59543},{name:"synagogue",codepoint:59544},{name:"taxi-stand",codepoint:59545},{name:"tennis",codepoint:59546},{name:"toilet",codepoint:59547},{name:"trail-walking",codepoint:59548},{name:"train-station",codepoint:59549},{name:"transit-station",codepoint:59550},{name:"travel-agency",codepoint:59551},{name:"unisex",codepoint:59552},{name:"university",codepoint:59553},{name:"veterinary-care",codepoint:59554},{name:"viewing",codepoint:59555},{name:"volume-control-telephone",codepoint:59556},{name:"walking",codepoint:59557},{name:"waterskiing",codepoint:59558},{name:"whale-watching",codepoint:59559},{name:"wheelchair",codepoint:59560},{name:"wind-surfing",codepoint:59561},{name:"zoo",codepoint:59562}]},"mapp-shapes":{label:"Map shapes",glyphs:[{name:"circle",codepoint:59648,center:[16,16]},{name:"widepin",codepoint:59649,center:[16,14]},{name:"route",codepoint:59650,center:[16,14]},{name:"shield",codepoint:59651,center:[16,14]},{name:"squarepin",codepoint:59653,center:[16,14]},{name:"square",codepoint:59652,center:[16,16]},{name:"squarerounded",codepoint:59654,center:[16,16]},{name:"roundpin",codepoint:59657,center:[16,13]},{name:"pin",codepoint:59655,center:null},{name:"pindot",codepoint:59656,center:null}]}};function w(e){var t,n,r,l=c(f({defaultIcon:mappl10n.options.defaultIcon,filename:null,fillColor:"gray",filter:"",glyph:"",glyphColor:"white",glyphFont:"mapp-icons",isFontLoaded:!1,isOpen:!1,mode:"list",shape:"circle",shapeFont:"mapp-shapes",showNames:!0,strokeColor:"black",strokeWidth:4,urls:{},userIcons:mappl10n.options.userIcons}),2),p=l[0],u=l[1];function h(e){u((function(t){return i(i({},t),e)}))}function w(t,n){switch(t){case"close":h({isOpen:!1});break;case"edit-cancel":h({mode:"list"});break;case"edit-save":!function(e){p.glyphFont;var t=2,n=32*t,o=16*t,a=document.createElement("canvas");a.width=n,a.height=n,a.style.imageRendering="pixelated";var r=a.getContext("2d");r.font=n+"px "+p.shapeFont,r.fillStyle=p.fillColor,r.textBaseline="bottom";var i=_.findWhere(v[p.shapeFont].glyphs,{name:p.shape});r.fillText(String.fromCharCode(i.codepoint),0,n);var l=1,c=l*t;if(r.strokeStyle="white",r.lineWidth=c,r.font=n-l*t+"px "+p.shapeFont,r.strokeText(String.fromCharCode(i.codepoint),l,n-l),i.center){r.imageSmoothingEnabled=!1,r.font=o+"px "+p.glyphFont,r.fillStyle=p.glyphColor;var s=[i.center[0]*t,i.center[1]*t],u=_.findWhere(v[p.glyphFont].glyphs,{name:p.glyph});r.fillText(String.fromCharCode(u.codepoint),s[0]-o/2,s[1]+o/2)}"undefined"!=typeof debug?document.getElementById("mapp-edit-debug").append(a):a.toBlob((function(e){var t=new FormData;t.append("image0",e,p.filename),k(t)}),"image/png",100)}();break;case"edit-upload":o=n,a=new FormData,_.map(o,(function(e,t){e.type.match("image.*")?a.append("image"+t,e):alert("File "+e.name+" is not an image.")})),k(a);break;case"list-clear":e.onChange&&e.onChange(null),w("close");break;case"list-delete":e.iconid&&confirm(mappl10n.delete_prompt)&&mapp.lib.ajax({type:"POST",data:{action:"mapp_icon_delete",iconids:e.iconid,nonce:mappl10n.options.nonce},callback:function(t){if(t&&"OK"==t.status){var n=mappl10n.options.userIcons.indexOf(e.iconid);n>=0&&void 0!==mappl10n.options.userIcons[n+1]?e.onChange(mappl10n.options.userIcons[n+1]):e.onChange(null),mappl10n.options.userIcons=t.data,h({userIcons:mappl10n.options.userIcons})}else alert("Delete error: "+t.status)}});break;case"list-select":e.onChange&&(n==e.iconid?e.onChange(null):e.onChange(n));break;case"mode":h({mode:n});break;case"open":h({isOpen:!0})}var o,a}function O(t){var n="user"==t?mappl10n.options.userIcons:mappl10n.options.standardIcons;return _.map(n,(function(t){return s("div",{alt:t,className:e.iconid==t?"mapp-icon-wrapper mapp-selected":"mapp-icon-wrapper",key:t,onClick:function(){return w("list-select",t)}},s("img",{className:"mapp-icon",src:mapp.Icons.getUrl(t),title:t}))}))}function k(e){e.append("action","mapp_icon_save"),e.append("nonce",mappl10n.options.nonce),mapp.lib.ajax({type:"POST",contentType:!1,processData:!1,data:e,success:function(e){e&&"OK"==e.status?(mappl10n.options.userIcons=e.data.icons,h({userIcons:mappl10n.options.userIcons}),h({mode:"list"}),w("list-select",e.data.filename)):alert("Upload error: "+e.status)}})}return d((function(){var e=[];_.map(v,(function(t,n){var o=new FontFace(n,"url("+mappl10n.options.baseurl+"/pro/fonts/"+n+".woff?"+mappl10n.options.version+")");document.fonts.add(o),e.push(o.loaded)})),Promise.all(e).then((function(){h({isFontLoaded:!0})}))}),[]),d((function(){h({filename:p.shape+"_"+p.fillColor.replace("#","")+(p.glyph?"_"+p.glyph:"")+".png"})}),[p.shape,p.fillColor,p.glyph]),s(m,null,s("img",{className:"mapp-icon",onClick:function(){return w("open",null)},src:mapp.Icons.getUrl(e.iconid)}),"list"==p.mode&&function(){if(!p.isOpen)return null;var t=e.iconid&&mappl10n.options.userIcons.indexOf(e.iconid)>=0;return s(y,{title:s("div",{className:"mapp-icons-header"},__("Select an icon"),s(g,{isSecondary:!0,onClick:function(){return w("mode","edit")}},__("New icon"))),className:"mapp-icons-modal",onRequestClose:function(){return w("close")}},s("div",{className:"mapp-icons"},s("div",{className:"mapp-icons-list"},s("div",{className:"mapp-icons-user"},O("user")),s("div",{className:"mapp-icons-standard"},O("standard"))),s("div",{className:"mapp-icons-edit-filename"},e.iconid?e.iconid:__("No icon selected")),s("div",{className:"mapp-icons-toolbar"},s("div",null,s(g,{isPrimary:!0,onClick:function(){return w("close")}},__("Select")),s(g,{isSecondary:!0,onClick:function(){return w("list-clear")}},__("Use default icon"))),s(g,{isDestructive:!0,onClick:function(){return w("list-delete")},disabled:!t},__("Delete")))))}(),"edit"==p.mode&&s(y,{title:__("Create new icon"),className:"mapp-icons-edit-modal",onRequestClose:function(){return w("edit-cancel")},shouldCloseOnClickOutside:!1},s("div",{className:"mapp-icons-edit"},s("div",{id:"mapp-edit-debug"}),s("div",{className:"mapp-icons-edit-shape-section"},s("div",{className:"mapp-icons-shape-heading"},__("Shape and color"),s(o.MappColorPicker,{color:p.fillColor,isExtended:!1,onChange:function(e){return h({fillColor:e.color})}})),(t=v[p.shapeFont],n=_.findWhere(v[p.glyphFont].glyphs,{name:p.glyph}),r=n?String.fromCharCode(n.codepoint):null,s("div",{className:"mapp-icons-edit-shapes",style:{color:p.fillColor,fontFamily:p.shapeFont}},_.map(t.glyphs,(function(e,t){var o=p.shape==e.name;return s("span",{className:"mapp-icons-edit-shape-wrapper"+(o?" mapp-selected":""),key:e.name,onClick:function(){return h({shape:e.name})},title:e.name},s("span",{className:"mapp-icons-edit-shape"},String.fromCharCode(e.codepoint),e.center&&n&&s("span",{className:"mapp-icons-edit-glyph",style:{left:e.center[0],top:e.center[1],color:p.glyphColor,fontFamily:p.glyphFont}},r)))}))))),s("div",{className:"mapp-icons-edit-glyph-section"},s("div",{className:"mapp-icons-glyph-heading"},__("Glyph"),s("div",null,__("Search"),s(a.Input,{onChange:function(e){return h({filter:e})}}))),function(){p.glyphFont;var e=_.filter(v[p.glyphFont].glyphs,(function(e){return(!p.filter||e.name.includes(p.filter))&&"skip"!=e.name}));return s("div",{className:"mapp-icons-edit-glyph-list",style:{color:p.glyphColor,fontFamily:p.glyphFont}},_.map(e,(function(e,t){return s("div",{className:"mapp-icons-edit-glyph-wrapper"+(p.glyph==e.name?" mapp-selected":""),key:t,onClick:function(){return h({glyph:p.glyph==e.name?null:e.name})}},s("span",{className:"mapp-icons-edit-glyph"},String.fromCharCode(e.codepoint)),s("div",{className:"mapp-icons-edit-glyph-title"},e.name))})))}()),s("div",{className:"mapp-icons-edit-toolbar"},s("div",null,s(g,{isPrimary:!0,onClick:function(){return w("edit-save")}},__("Save")),s(g,{isSecondary:!0,onClick:function(){return w("edit-cancel")}},__("Cancel"))),s(b,{accept:"image/*",icon:"upload",multiple:!0,onChange:function(e){w("edit-upload",e.target.files)}},__("Upload icons"))))))}},800:function(e,t,n){"use strict";n.r(t);var o=n(966);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(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 c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}window.mapp;var p=wp.element.createElement,s=wp.element,u=(s.Fragment,s.useEffect,s.useLayoutEffect,s.useRef,s.useState),m=wp.components;m.Button,m.Dashicon,m.Modal;function d(e){var t=l(u({mapid:null}),2),n=t[0],a=t[1];return p(o.default,{context:"mce",mapid:n.mapid,onAction:function(t,n){switch(t){case"pick-close":o={mapid:null},a((function(e){return r(r({},e),o)})),e.onAction("pick-close",n);break;case"pick-insert":e.onAction("pick-insert",n)}var o}})}window.parent&&(window.mappIframeRender=function(e){wp.element.render(p(d,e),document.getElementById("mapp-iframe-react"))}),function(e){function t(){var t=this;this.contentWindow=null,this.iframe=null;e(".mapp-iframe-button").on("click",(function(e){e.preventDefault(),t.open()}))}t.prototype={load:function(t){var n=this;if(this.iframe)return this.iframe.show(),void t();this.iframe=e('<iframe class="mapp-iframe" allowtransparency="true"></iframe>').appendTo("body"),e("iframe").on("load",(function(){t()})),e.get(mappl10n.options.ajaxurl,{action:"mapp_iframe",nonce:mappl10n.options.nonce},(function(e){n.contentWindow=n.iframe.get(0).contentWindow,n.contentWindow.document.open("text/html","replace"),n.contentWindow.document.write(e),n.contentWindow.document.close()}))},open:function(){var e=this;this.load((function(){e.contentWindow&&e.contentWindow.mappIframeRender&&e.contentWindow.mappIframeRender({onAction:function(t,n){return e.onAction(t,n)}})}))},onAction:function(e,t){switch(e){case"pick-close":this.iframe.hide();break;case"pick-insert":var n='[mappress mapid="'+t+'"]';"undefined"==typeof wpActiveEditor?alert(mappl10n.need_classic):send_to_editor(n),this.iframe.hide()}}},e(".mapp-iframe-button").length&&new t(this)}(jQuery)},938:function(e,t,n){"use strict";n.r(t);var o=n(966);function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(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 r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}window.mapp;var i=wp.element.createElement,l=wp.element,c=(l.Fragment,l.render,l.useEffect),p=(l.useLayoutEffect,l.useRef,l.useState),s=wp.components;s.Button,s.Modal;document.getElementById("mapp-library")&&(mappl10n.options.postid=0,wp.element.render(i((function(e){var t=a(p({mapid:null}),2),n=t[0];return t[1],c((function(){}),[]),i(o.default,{context:"library",mapid:n.mapid,onAction:function(e,t){switch(e){case"pick-shortcode":var n=jQuery("<input>");jQuery("body").append(n),n.val('[mappress mapid="'+t+'"]').select(),document.execCommand("copy"),n.remove(),alert((o="Shortcode copied",wp.i18n.__(o,"mappress-google-maps-for-wordpress")))}var o}})})),document.getElementById("mapp-library")))},816:function(e,t,n){"use strict";n.r(t);var o=n(429),a=n(966);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}(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 p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var s=window.mapp||{},u=wp.element.createElement,m=wp.element,d=m.Fragment,f=m.useEffect,h=(m.useLayoutEffect,m.useRef),g=m.useState,__=function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")};function b(e){var t=wp.components,n=(t.BaseControl,t.Button),r=(t.ButtonGroup,t.CheckboxControl,t.Dropdown,t.Modal,t.Panel,t.PanelBody),l=(t.PanelRow,t.Placeholder),p=(t.RadioControl,t.SelectControl,t.TextControl,t.ToggleControl,t.Toolbar),m=t.ToolbarButton,b=(t.ToolbarGroup,wp.blockEditor),y=b.BlockControls,v=b.InspectorControls,w=c(g({isOpen:!1,map:null,mapdata:null,pickerMode:"list",pickerMapid:null}),2),O=w[0],k=w[1],C=h(null);function S(e){k((function(t){return i(i({},t),e)}))}function P(t,n){switch(t){case"add":S({isOpen:!0,pickerMapid:null,pickerMode:"edit"}),e.setAttributes({center:void 0,zoom:void 0});break;case"change-settings":e.setAttributes(n);break;case"edit":S({isOpen:!0,pickerMapid:e.attributes.mapid,pickerMode:"edit"});break;case"edit-close":S({isOpen:!1});break;case"pick-destroy":e.setAttributes({mapid:void 0,center:void 0,zoom:void 0,width:void 0,height:void 0}),S({isOpen:!1});break;case"pick-close":S({isOpen:!1});break;case"pick-insert":case"pick-duplicate":n!=e.attributes.mapid&&e.setAttributes({center:void 0,mapid:n,zoom:void 0}),S({isOpen:!1});break;case"open":S({isOpen:!0,pickerMapid:e.attributes.mapid,pickerMode:"list"})}}function j(){var t=void 0!==t?t:p;return u(y,null,u(t,null,e.attributes.mapid&&u(m,{icon:"edit",label:__("Edit map"),onClick:function(){return P("edit")}}),u(m,{icon:"portfolio",label:__("Map Library"),onClick:function(){return P("open")}})))}function M(){if(O.isOpen)return u(a.default,{mapid:O.pickerMapid,mode:O.pickerMode,onAction:P,type:"post"})}return f((function(){var t=function(t){var n=t.maps[e.attributes.mapid];n&&S({mapdata:n})};return s.store.subscribe(t),function(){return s.store.unsubscribe(t)}})),f((function(){e.attributes.mapid&&s.store.fetchMap({mapid:e.attributes.mapid,failure:function(){return S({mapdata:void 0})}})}),[e.attributes.mapid]),f((function(){var t;e.attributes.mapid&&C.current&&O.mapdata&&((t=new s.Map(O.mapdata,{alignment:e.attributes.align,center:e.attributes.center,height:e.attributes.height,mapOpts:{mapTypeControl:!1,streetViewControl:!1},poiList:e.attributes.poiList,sel:jQuery(C.current),width:e.attributes.width,zoom:e.attributes.zoom})).display(),S({map:t}))}),[O.mapdata]),f((function(){"wide"!=e.attributes.align&&"full"!=e.attributes.align||(e.setAttributes({width:"100%"}),O.map&&O.map.setSize({width:"100%"}))}),[e.attributes.align]),e.attributes.preview?u("img",{className:"mapp-gt-preview",src:mappl10n.options.baseurl+"/images/preview.png",width:"100%"}):e.attributes.mapid&&void 0!==O.mapdata?u(d,null,j(),function(){if(!O.map)return null;var t=e.attributes,n=t.align,a=t.center,i=t.height,l=t.poiList,c=t.width,p=t.zoom;return u(v,null,u("div",{className:"mapp-gt-inspector"},u(r,{title:__("Map settings")},u(o.MappSettings,{map:O.map,alignment:n,context:"map",onAction:P,center:a,height:i,poiList:l,width:c,zoom:p}))))}(),u("div",{className:"mapp-gt",ref:C}),M()):u(d,null,u(d,null,j(),u(l,{className:"mapp-gt-placeholder",icon:"location",label:__("MapPress Map"),instructions:__("Use the map library to create a new map or insert an existing map.")},u(n,{icon:"portfolio",isSecondary:!0,onClick:function(){return P("open")}},__("Map Library")))),M())}wp.blocks.registerBlockType("mappress/map",{title:__("MapPress Map"),icon:"location",description:__("Insert a map"),category:"mappress",attributes:{center:{type:"string"},height:{type:"string",default:""},initialOpenDirections:{type:"boolean"},mapid:{type:"string"},mapOpts:{type:"object"},poiList:{type:"boolean"},preview:{type:"boolean",default:!1},width:{type:"string",default:""},zoom:{type:"number"}},supports:{align:["full","wide","center","left","right"]},transforms:{from:[{type:"shortcode",tag:"mappress",attributes:{center:{type:"string",shortcode:function(e){return e.named.center}},height:{type:"string",shortcode:function(e){return e.named.height}},initialOpenDirections:{type:"boolean",shortcode:function(e){return"true"==e.named.initialOpenDirections||"true"==e.named.initialopendirections}},mapid:{type:"string",shortcode:function(e){return e.named.mapid}},poiList:{type:"boolean",shortcode:function(e){return"true"==e.named.poiList||"true"==e.named.poilist}},width:{type:"string",shortcode:function(e){return e.named.width}},zoom:{type:"number",shortcode:function(e){return parseInt(e.named.zoom)?parseInt(e.named.zoom):null}}}},{type:"block",blocks:["core/shortcode"],isMatch:function(e){var t=e.text,n=wp.shortcode.regexp("mappress");return n.lastIndex=0,n.test(t)},transform:function(e){var t=e.text;return wp.blocks.rawHandler({HTML:"<p>"+t+"</p>",mode:"BLOCKS"})}}]},edit:function(e){return u(b,e)},save:function(e){return e},example:{attributes:{preview:!0}}})},378:function(e,t,n){"use strict";n.r(t);n(429),n(670),n(308);window.mapp,wp.element.createElement;var o=wp.element,a=(o.Fragment,o.useEffect,o.useLayoutEffect,o.useRef,o.useState,wp.components);a.BaseControl,a.Button,a.ButtonGroup,a.Card,a.CardBody,a.CardFooter,a.CardHeader,a.CheckboxControl,a.ExternalLink,a.HorizontalRule,a.Panel,a.PanelBody,a.PanelRow,a.Placeholder,a.RadioControl,a.SelectControl,a.TabPanel,a.TextControl,a.TextareaControl,a.ToggleControl,a.Toolbar,wp.data.useSelect},498:function(e,t,n){"use strict";n.r(t);var o=n(966);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(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 c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}window.mapp;var p=wp.element.createElement,s=wp.element,u=s.Fragment,m=(s.useEffect,s.useLayoutEffect,s.useRef,s.useState),d=wp.components,f=(d.Button,d.Dashicon),__=(d.Modal,function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")});function h(){var e=l(m({isOpen:!1,mapid:null}),2),t=e[0],n=e[1];function a(e){n((function(t){return r(r({},t),e)}))}function i(e,t){switch(e){case"pick-close":a({isOpen:!1,mapid:null});break;case"pick-insert":a({isOpen:!1});var n='[mappress mapid="'+t+'"]';"undefined"==typeof wpActiveEditor?__("Please select the post content to insert the map into."):send_to_editor(n);break;case"open":a({isOpen:!0,mapid:c()})}}function c(){var e=tinyMCE?tinyMCE.get("content"):null,t=e&&e.selection?e.selection.getSel():null;if(!t||void 0===t.anchorOffset||!t.anchorNode||!t.anchorNode.data)return null;for(var n=null,o=t.anchorNode.data,a=-1,r=t.anchorOffset-1;r>=0;r--){var i=o[r];if("["==i){a=r;break}if("]"==i||"<"==i||">"==i)break}return a>=0&&(n=wp.shortcode.next("mappress",o,a))?n.shortcode.attrs.named.mapid:null}return p(u,null,p("button",{className:"button",type:"button",onClick:function(e){e.preventDefault(),i("open")}},p(f,{className:"wp-media-buttons-icon",icon:"location"}),__("MapPress")),t.isOpen&&p(o.default,{context:"mce",mapid:t.mapid,onAction:i}))}Array.from(document.getElementsByClassName("mapp-mce")).forEach((function(e,t){return wp.element.render(p(h),e)}))},670:function(e,t,n){"use strict";function o(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||c(e)||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.")}()}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||c(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 c(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}n.r(t),n.d(t,{MappMultiSelect:function(){return v}});var s=wp.element.createElement,u=wp.element,m=(u.Fragment,u.useEffect),d=(u.useLayoutEffect,u.useRef),f=u.useState,h=wp.components,g=h.BaseControl,b=(h.Button,h.CheckboxControl),y=(h.Panel,h.PanelBody,h.PanelRow,h.Spinner,h.TextControl),__=function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")};function v(e){var t,n=d(null),a=d(null),i=l(f({isOpen:!1,filter:"",filteredOptions:[]}),2),c=i[0],p=i[1];function u(e){p((function(t){return r(r({},t),e)}))}function h(t){var n=_.findWhere(e.options,{value:t});return n?n.label:t}function v(){var t;return e.values instanceof Array?t=o(e.values):e.values&&(t=[e.values]),t||[]}function w(t,n){var o=v(),a=o.indexOf(t);(n=void 0!==n?n:-1==a)?o.push(t):o.splice(a,1),e.onChange(o)}function O(){return c.isOpen?s("div",{className:"mapp-select-dropdown-wrapper"},s("div",{className:"mapp-select-dropdown"},!c.isOpen||!e.options||e.options.length<10?null:s("div",{className:"mapp-select-filter",ref:a},s(y,{autoComplete:"off",placeholder:__("Search"),value:c.filter,onChange:function(e){return u({filter:e})}})),s("div",{className:"mapp-select-dropdown-list"},(t=v(),0==c.filteredOptions.length?s("div",{className:"mapp-select-dropdown-item"},__("No results")):c.filteredOptions.map((function(e){return s(b,{className:"mapp-select-dropdown-item",checked:t.includes(e.value),key:e.value,onChange:function(t){return w(e.value,t)},label:e.label})})))))):null;var t}return m((function(){if(e.options)if(c.filter){var t=c.filter.toUpperCase();u({filteredOptions:e.options.filter((function(e){return 0==e.label.toUpperCase().indexOf(t)}))})}else u({filteredOptions:e.options})}),[e.options,c.filter]),m((function(){c.isOpen&&a.current&&(jQuery("input",jQuery(a.current)).focus(),u({filter:""}))}),[c.isOpen]),s(g,{className:"mapp-select",label:e.label},s("div",{ref:n,tabIndex:0,onBlur:function(e){return function(e){event.relatedTarget||document.activeElement,n.current.contains(e.relatedTarget)||u({isOpen:!1})}(e)}},((t=v())instanceof Array&&t.map((function(e){return h(e)})),void 0===e.options?s("div",{className:"mapp-select-input"},s("div",{className:"mapp-select-tokens"}),s("span",{className:"dashicons dashicons-arrow-down-alt2"})):s("div",{className:"mapp-select-input",onClick:function(){return u({isOpen:!c.isOpen})}},s("div",{className:"mapp-select-tokens"},t.map((function(e){return s("span",{className:"mapp-select-token",key:e,onClick:function(t){t.stopPropagation(),w(e,!1)}},h(e))}))),s("span",{className:"dashicons "+(c.isOpen?"dashicons-arrow-up-alt2":"dashicons-arrow-down-alt2")}))),O()))}},218:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return C}});var o=n(824),a=n(143);function r(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||s(e)||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.")}()}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||s(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 s(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var m=wp.element.createElement,d=wp.element,f=d.Fragment,h=d.useEffect,g=(d.useLayoutEffect,d.useCallback,d.useRef),b=d.useState,y=wp.data.useSelect,v=wp.components,w=v.Button,O=v.Dashicon,k=v.ExternalLink,__=(v.Modal,v.Panel,v.PanelBody,v.PanelRow,v.Popover,v.RadioControl,v.Spinner,v.TabPanel,function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")});function C(e){var t=p(b(l({},mappress_options_state)),2),n=t[0],i=t[1];function c(e){i((function(t){return l(l({},t),e)}))}h((function(){S.current&&new mapp.Map(n.helpers.demo_map,{sel:jQuery(S.current)}).display()}),[]);var s,u,d,v,C,S=g(null);function P(e){return _.map(e,(function(e,t){return{value:t,label:e}}))}function j(e,t){switch(e){case"license-check":mapp.lib.ajax({type:"POST",data:{action:"mapp_license_check",nonce:mappl10n.options.nonce,license:n.license},callback:function(e){e&&"OK"==e.status&&window.location.reload()}});break;case"reset":mapp.lib.ajax({type:"POST",data:{action:"mapp_options_reset",nonce:mappl10n.options.nonce},callback:function(e){e&&"OK"==e.status&&window.location.reload()}});break;case"save":var o=l({},n);delete o.helpers,mapp.lib.ajax({type:"POST",data:{action:"mapp_options_save",nonce:mappl10n.options.nonce,settings:o},callback:function(e){e&&"OK"==e.status&&window.location.reload()}})}}return m("div",{className:"mapp-options"},m("form",{onSubmit:function(e){e.preventDefault(),j("save")}},m(o.Section,{title:__("Sample Map"),className:"mapp-demo-section"},m("div",{className:"mapp-options-demo",ref:S})),m(o.Section,{title:__("Basic Settings")},m(o.Radios,{title:__("Mapping API"),options:[{label:"Leaflet",value:"leaflet"},{label:"Google",value:"google"}],onChange:function(e){return c({engine:e,geocoder:"google"==e?"google":""})},checked:n.engine,help:{href:"#toc-picking-a-mapping-api",text:__("Leaflet is free and requires no API key. Google requires an API key and has strict usage limits.")}}),"leaflet"==n.engine&&m(o.Input,{title:__("Mapbox access token"),value:n.mapbox,onChange:function(e){c({mapbox:e}),"mapbox"!=n.geocoder||e||c({geocoder:""})},size:50,placeholder:__("Enter token to use Mapbox features"),help:{href:"https://www.mapbox.com/help/define-access-token/"}}),"google"==n.engine&&m(o.Input,{title:__("Google API key"),name:"apiKey",value:n.apiKey,onChange:function(e){return c({apiKey:e})},size:50,help:{href:"https://mappresspro.com/mappress-faq/#toc-google-maps-api-keys"}}),"leaflet"==n.engine&&(C=[{value:"",label:__("Algolia")},{value:"nominatim",label:"Nominatim"},{value:"mapbox",label:"MapBox",disabled:!n.mapbox}],m(o.Radios,{title:__("Geocoder"),options:C,checked:n.geocoder,onChange:function(e){return c({geocoder:e})},help:{href:"#toc-picking-a-geocoder"}}))),mappl10n.options.pro&&(!n.helpers.is_multisite||n.helpers.is_super_admin||n.helpers.is_main_site)&&m(o.Section,{title:__("License")},m(o.Option,{title:__("MapPress license key")},m(o.Input,{value:n.license,onChange:function(e){return c({license:e})},size:37,placeholder:__("Enter license to enable automatic updates")}),(v=m("a",{className:"mapp-license-status",href:"https://mappresspro.com/account",target:"_blank"},__("Get license")),n.license&&n.helpers.license_status?"active"==n.helpers.license_status?m("span",{className:"mapp-license-status"},m(O,{icon:"yes"}),__("Active")):m(f,null,m(w,{className:"mapp-options-check-license",isSecondary:!0,onClick:function(){return j("license-check")}},__("Check now")),m("div",null,m(O,{icon:"no"}),n.helpers.license_message)):v)),m(o.Checkbox,{title:__("Beta versions"),label:__("Enable updates for beta versions"),checked:n.betas,onChange:function(e){return c({betas:e})}})),m(o.Section,{title:__("Map Settings")},m(o.Checkboxes,{title:__("Post types"),values:n.postTypes,options:P(n.helpers.post_types),onChange:function(e){return c({postTypes:e})}}),m(o.Radios,{title:__("Automatic display"),options:[{value:"",label:__("None")},{value:"top",label:__("Top of post")},{value:"bottom",label:__("Bottom of post")}],checked:n.autodisplay,onChange:function(e){return c({autodisplay:e})}}),m(o.Radios,{title:__("Map alignment"),options:[{value:"",label:__("Default")},{value:"center",label:__("Center")},{value:"left",label:__("Left")},{value:"right",label:__("Right")}],checked:n.alignment,onChange:function(e){return c({alignment:e})}}),m(o.Radios,{title:__("Directions"),checked:n.directions,options:[{value:"google",label:"Google"},{value:"inline",label:__("Inline")}],onChange:function(e){return c({directions:e})}}),m(o.Checkbox,{title:__("POI list"),checked:n.poiList,label:__("Show a list of POIs with each map"),onChange:function(e){return c({poiList:e})}}),mappl10n.options.pro&&m(o.Radios,{title:__("POI list layout"),checked:n.layout,options:[{value:"left",label:"Left of map"},{value:"inline",label:__("Below map")}],onChange:function(e){return c({layout:e})}}),m(o.Input,{title:__("Mini width"),value:n.mini,onChange:function(e){return c({mini:e})},size:3,label:__("Width (px) to hide the POI list")}),m(o.Checkbox,{title:__("Sort"),checked:n.sort,label:__("Sort POI list by title"),onChange:function(e){return c({sort:e})}})),m(o.Section,{title:__("POI Settings")},m(o.Select,{title:__("Default zoom"),label:__("Default zoom when displaying a single POI"),value:n.poiZoom,options:_.map([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],(function(e){return{value:e,label:e}})),onChange:function(e){return c({poiZoom:e})}}),m(o.Checkbox,{title:__("Hover"),checked:n.tooltips,label:__("Open POIs on hover"),onChange:function(e){return c({tooltips:e})}}),m(o.Checkbox,{title:__("Open first POI"),checked:n.initialOpenInfo,onChange:function(e){return c({initialOpenInfo:e})},label:__("Open first POI")}),m(o.Checkbox,{title:__("Clustering"),checked:n.clustering,label:__("Enable marker clustering"),onChange:function(e){return c({clustering:e})}})),mappl10n.options.pro&&m(o.Section,{title:__("Mashups")},m(o.Checkbox,{title:__("Search"),checked:n.search,label:__("Enable search"),onChange:function(e){return c({search:e})}}),m(o.Select,{title:__("Filter"),value:n.filter,options:P(n.helpers.taxonomies),onChange:function(e){return c({filter:e})},placeholder:""}),m(o.Radios,{title:__("Marker click"),checked:n.mashupClick,options:[{value:"poi",label:__("Open popup")},{value:"post",label:__("Open post")},{value:"postnew",label:__("Post in new tab")},{value:"postmodal",label:__("Post in modal")}],onChange:function(e){return c({mashupClick:e})}}),m(o.Radios,{title:__("Popup content"),checked:n.mashupBody,options:[{value:"poi",label:__("POI title + POI body")},{value:"post",label:__("Post title + post excerpt")}],onChange:function(e){return updatestate({mashupBody:mashupBody,val:e})}}),m(o.Checkbox,{title:__("KMLs"),checked:n.mashupKml,label:__("Include KML POIs in mashups"),onChange:function(e){return c({mashupKml:e})}})),mappl10n.options.pro&&m(o.Section,{title:__("Icons")},m(o.Option,{title:__("Default icon")},m(a.MappIconPicker,{iconid:n.defaultIcon,onChange:function(e){mappl10n.options.defaultIcon=e,c({defaultIcon:e})}})),m(o.Option,{title:__("Icon directory")},m("code",null,n.helpers.icon_directory)),m(o.Option,{title:__("Highlight selected POI")},m(o.Radios,{checked:n.highlight,options:[{value:"",label:__("None")},{value:"circle",label:__("Circle")},{value:"scale",label:__("Scale")},{value:"icon",label:__("Icon")}],onChange:function(e){return c({highlight:e})}}),"icon"==n.highlight&&m(a.MappIconPicker,{defaultIcon:n.defaultIcon,iconid:n.highlightIcon,onChange:function(e){return c({highlightIcon:e})}})),(d=n.iconScale&&Array.isArray(n.iconScale)?r(n.iconScale):[0,0],m(o.Option,{title:__("Icon scaling")},m(o.Input,{value:d[0]?d[0]:"",onChange:function(e){e<=64&&(d[0]=e,c({iconScale:d}))},type:"number",min:0,max:64}),m("span",null," X "),m(o.Input,{value:d[1]?d[1]:"",onChange:function(e){e<=64&&(d[1]=e,c({iconScale:d}))},type:"number",min:0,max:64}),m("span",null," (px) "))),function(){var e=P(n.helpers.taxonomies);e.unshift({value:"post_type",label:__("Post type")});var t=y((function(e){if("post_type"==n.autoicons.key)return P(n.helpers.post_types);var t=wp.data.select("core").getEntityRecords("taxonomy",n.autoicons.key,{per_page:-1,_fields:"id,name"});return t?t.map((function(e){return{value:e.id,label:e.name}})):null}),[n.autoicons.key]);return m(o.Option,{title:__("Automatic icons")},m(o.Select,{value:n.autoicons?n.autoicons.key:null,options:e,onChange:function(e){var t=n.autoicons?l({},n.autoicons):[];t.key=e,t.values=[],c({autoicons:t})},placeholder:""}),m(o.MappGrid,{cols:[{id:"key",label:__("Key"),type:"select",options:t},{id:"value",label:__("Icon"),type:"icon"}],data:n.autoicons.values,onChange:function(e){var t=n.autoicons?l({},n.autoicons):[];t.values=e,c({autoicons:t})}}))}()),mappl10n.options.pro&&m(o.Section,{title:__("Styled Maps")},"leaflet"==n.engine&&m(o.Option,{title:__("Styled maps")},m("div",null,__("Enter styles from Mapbox Studio"),m(k,{href:"https://www.mapbox.com/mapbox-studio/"})),m(o.MappGrid,{cols:[{id:"key",label:__("Style name"),size:10},{id:"value",label:__("MapBox Share URL")}],data:n.mapboxStyles,onChange:function(e,t){return c({mapboxStyles:e,style:t})},selectionColumn:"key",selectionType:"checkbox",selected:n.style})),"google"==n.engine&&m(o.Option,{title:__("Styled maps")},m("div",null,__("Enter styles from Snazzy Maps"),m(k,{href:"https://snazzymaps.com/explore"})),m(o.MappGrid,{cols:[{id:"key",label:__("Style name"),size:10},{id:"value",label:__("JSON"),type:"textarea"}],data:n.styles,className:"mapp-grid-styles",onChange:function(e,t){return c({styles:e,style:t})},selectionColumn:"key",selectionType:"checkbox",selected:n.style}))),mappl10n.options.pro&&m(o.Section,{title:__("Geocoding")},m(o.Option,{title:__("Geocoding fields")},m(o.MappGrid,{cols:[{id:"key",label:__("Map field"),type:"select",options:P(n.helpers.meta_fields)},{id:"value",label:__("Custom field"),type:"select",options:P(n.helpers.meta_keys)}],data:n.metaKeys,onChange:function(e){return c({metaKeys:e})}})),m(o.Checkbox,{title:__("Overwrite"),label:__("Overwrite maps when posts are saved"),checked:n.metaSyncSave,onChange:function(e){c({metaSyncSave:e})}}),(u=__("No errors found"),n.helpers.geocoding_errors&&n.helpers.geocoding_errors.length>0&&(u=_.map(n.helpers.geocoding_errors,(function(e){return m("div",{key:e.ID},m("a",{href:mappl10n.options.editurl+"?post="+e.ID+"&action=edit"},e.post_title),m("span",null," : "+e.error))}))),m(o.Option,{title:__("Geocoding errors")},u)),"google"==n.engine&&m(o.Input,{title:__("Google Server API key"),name:"apiKeyServer",value:n.apiKeyServer,onChange:function(e){return c({apiKeyServer:e})},size:50,help:{text:__("Key secured by IP address for geocoding custom fields (optional)"),href:"https://mappresspro.com/mappress-faq"}})),mappl10n.options.pro&&m(o.Section,{title:__("Templates")},m(o.Option,{title:__("Custom templates")},m(o.MappTemplateEditor)),m(o.Checkbox,{title:__("Mashup thumbnails"),checked:n.thumbs,label:__("Show featured image thumbnails in mashup popups and lists"),onChange:function(e){return c({thumbs:e})}}),m(o.Option,{title:__("Thumbnail size")},m(o.Select,{onChange:function(e){return c({thumbSize:e})},options:P(n.helpers.thumbnail_sizes),value:n.thumbSize}),m("span",null," "+__("or")+" "),m(o.Input,{value:n.thumbWidth,onChange:function(e){return c({thumbWidth:e})},type:"number",min:0,max:9999}),m("span",null," X "),m(o.Input,{value:n.thumbHeight,onChange:function(e){return c({thumbHeight:e})},type:"number",min:0,max:9999}),m("span",null," (px) "))),m(o.Section,{title:__("Localization")},(s="leaflet"==n.engine?"https://en.wikipedia.org/wiki/ISO_639-1":"http://code.google.com/apis/maps/faq.html#languagesupport",m(o.Select,{title:__("Search language"),value:n.language,options:P(n.helpers.languages),onChange:function(e){return c({language:e})},help:{text:__("Language for searches and Google map controls"),href:s}})),m(o.Select,{title:__("Search country"),label:__("Country code for searches"),value:n.country,options:_.map(["","AF","AX","AL","DZ","AS","AD","AO","AI","AQ","AG","AR","AM","AW","AU","AT","AZ","BS","BH","BD","BB","BY","BE","BZ","BJ","BM","BT","BO","BQ","BA","BW","BV","BR","IO","VG","BN","BG","BF","BI","KH","CM","CA","CV","KY","CF","TD","CL","CN","CX","CC","CO","KM","CK","CR","HR","CU","CW","CY","CZ","CD","DK","DJ","DM","DO","EC","EG","SV","GQ","ER","EE","ET","FK","FO","FJ","FI","FR","GF","PF","TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GG","GN","GW","GY","HT","HM","HN","HK","HU","IS","IN","ID","IR","IQ","IE","IM","IL","IT","CI","JM","JP","JE","JO","KZ","KE","KI","XK","KW","KG","LA","LV","LB","LS","LR","LY","LI","LT","LU","MO","MK","MG","MW","MY","MV","ML","MT","MH","MQ","MR","MU","YT","MX","FM","MD","MC","MN","ME","MS","MA","MZ","MM","NA","NR","NP","NL","AN","NC","NZ","NI","NE","NG","NU","NF","KP","MP","NO","OM","PK","PW","PS","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","CG","RE","RO","RU","RW","BL","SH","KN","LC","MF","PM","VC","WS","SM","ST","SA","SN","RS","SC","SL","SG","SX","SK","SI","SB","SO","ZA","GS","KR","SS","ES","LK","SD","SR","SJ","SZ","SE","CH","SY","TW","TJ","TZ","TH","TL","TG","TK","TO","TT","TN","TR","TM","TC","TV","VI","UG","UA","AE","GB","US","UM","UY","UZ","VU","VA","VE","VN","WF","EH","YE","ZM","ZW"],(function(e){return{value:e,label:e}})),onChange:function(e){return c({country:e})},help:{href:"https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements"}}),m(o.Input,{title:__("Directions server"),value:n.directionsServer,onChange:function(e){return c({directionsServer:directionsServer,val:e})},size:25})),m(o.Section,{title:__("Miscellaneous")},m(o.Option,{title:__("Map sizes")},m(o.MappGrid,{cols:[{id:"width",label:__("Width")+" (px, %, vw)",size:4},{id:"height",label:__("Height")+" (px, %, vh)"}],data:n.sizes,onChange:function(e,t){return c({sizes:e,size:t})},selectionColumn:"rowid",selected:n.size})),n.helpers.jetpack?null:m(o.Checkbox,{title:__("Scripts"),checked:n.footer,label:__("Output scripts in footer"),onChange:function(e){return c({footer:e})},help:{text:__("Disable footer scripts if maps are output using AJAX")}}),m(o.Checkbox,{title:"WPML",checked:n.wpml,label:__("Copy maps when overwriting a translation"),onChange:function(e){return c({wpml:e})},help:{href:"https://mappresspro.com/mappress-documentation#wpml"}}),"google"==n.engine&&m(o.Checkbox,{title:__("Compatiblity"),checked:n.deregister,label:__("Prevent other plugins/themes from loading the Google Maps API"),onChange:function(e){return c({deregister:e})}})),m("div",{className:"mapp-options-toolbar"},m(w,{className:"mapp-options-save",type:"submit",isPrimary:!0},__("Save")),m(w,{isSecondary:!0,onClick:function(){return j("reset")}},__("Reset Defaults")))))}document.getElementById("mapp-options-settings")&&wp.element.render(m(C),document.getElementById("mapp-options-settings"))},824:function(e,t,n){"use strict";n.r(t),n.d(t,{Checkbox:function(){return C},Checkboxes:function(){return S},Help:function(){return P},Input:function(){return j},Radios:function(){return I},Select:function(){return N},Textarea:function(){return A},Section:function(){return E},Option:function(){return x},MappGrid:function(){return D},MappTemplateEditor:function(){return T}});var o=n(143);function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||i(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 r(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||i(e)||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.")}()}function i(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){if(null==e)return{};var n,o,a=function(e,t){if(null==e)return{};var n,o,a={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var m=wp.element.createElement,d=wp.element,f=d.Fragment,h=d.useEffect,g=(d.useLayoutEffect,d.useCallback),b=(d.useRef,d.useState),y=(wp.data.useSelect,wp.components),v=y.Button,w=(y.ColorPicker,y.Dashicon),O=(y.Dropdown,y.ExternalLink,y.Modal),k=(y.Panel,y.PanelBody,y.PanelRow,y.Popover,y.RadioControl,y.Spinner,y.TabPanel),__=function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")};function C(e){var t=e.title,n=e.label,o=e.onChange,a=e.help,r=u(e,["title","label","onChange","help"]),i=m(f,null,m("label",null,m("input",p({type:"checkbox",onChange:function(e){o&&o(e.target.checked)}},r)),n&&m("span",{className:"mapp-option-label"},n)),a&&m(P,a));return t?m(x,{title:t},i):i}function S(e){var t=m(f,null,_.map(e.options,(function(t,n){var o=e.values?e.values.indexOf(t.value):-1;return m(C,{key:n,label:t.label,value:t.value,checked:o>=0,onChange:function(n){var a=r(e.values);n&&-1==o&&e.onChange(a.concat(t.value)),!n&&o>=0&&(a.splice(o,1),e.onChange(a))}})})),e.help&&m(P,e.help));return e.title?m(x,{title:e.title},t):t}function P(e){var t=null;return e.href&&(t="#"==e.href.substr(0,1)?"https://mappresspro.com/mappress-documentation/"+e.href:e.href),m(f,null,t&&m("a",{className:"mapp-help-link",href:t,target:"_blank"},m(w,{icon:"editor-help"})),e.text&&m("div",{className:"mapp-help-text"},e.text))}function j(e){var t=e.title,n=e.value,o=e.label,a=e.onChange,r=e.help,i=e.type,l=u(e,["title","value","label","onChange","help","type"]);if(!a)return"Missing onChange handler in Input component";var c=m(f,null,m("input",p({value:null!==n?n:"",onChange:function(e){return a(e.target.value.trim())},type:i||"text"},l)),o&&m("span",{className:"mapp-option-label"},o),r&&m(P,r));return t?m(x,{title:t},c):c}var M=function(e){var t=e.onChange,n=e.label,o=u(e,["onChange","label"]);return m("label",null,m("input",p({type:"radio",onChange:function(e){return t(e.target.value)}},o)),n&&m("span",{className:"mapp-option-label"},n))};function I(e){var t=m(f,null,_.map(e.options,(function(t,n){return m(M,{key:n,value:t.value,checked:e.checked==t.value,onChange:function(t){return e.onChange(t)},disabled:t.disabled,label:t.label})})),e.help&&m(P,e.help));return e.title?m(x,{title:e.title},t):t}function N(e){var t=e.title,n=e.value,o=e.label,a=e.onChange,r=e.options,i=e.help,l=e.placeholder,c=u(e,["title","value","label","onChange","options","help","placeholder"]);void 0!==l&&r.unshift({value:"",label:l});var s=m(f,null,m("select",p({value:null!==n?n:"",onChange:function(e){return a(e.target.value)}},c),_.map(r,(function(e,t){return m("option",{key:t,value:e.value},e.label)}))),o&&m("span",{className:"mapp-option-label"},o),i&&m(P,i));return t?m(x,{title:t},s):s}function A(e){var t=e.title,n=e.onChange,o=e.label,a=e.help,r=u(e,["title","onChange","label","help"]),i=m(f,null,m("textarea",p({onChange:function(e){return n(e.target.value)}},r)),o&&m("span",{className:"mapp-option-label"},o),a&&m(P,a));return t?m(x,{title:t},i):i}function E(e){var t=e.className?" "+e.className:"";return m("div",{className:"mapp-option-section"+t},m("h2",null,e.title),e.children)}function x(e){return m("div",{className:"mapp-option"},m("div",{className:"mapp-option-title"},e.title),m("div",{className:"mapp-option-value"},e.children))}function D(e){var t,n,i=a(b({dragging:null,dragover:null}),2),l=i[0],c=i[1];function s(e){c((function(t){return p(p({},t),e)}))}function u(t,n){var o=r(e.data);switch(t){case"add":var a={};_.map(e.cols,(function(e){a[e.id]=""})),o.push(a),e.onChange(o,e.selected);break;case"change":o[n.i][n.id]=n.value,e.onChange(o,e.selected);break;case"delete":var i;o.splice(n,1),i=n==e.selected?null:n<e.selected?e.selected-1:e.selected,e.onChange(o,i);break;case"select":s({selected:n}),e.onChange(o,n);break;case"sort":var c=l.dragging,p=c<p?n-1:n;o.splice(p,0,o.splice(c,1)[0]),e.onChange(o,p),s({dragover:null})}}return h((function(){}),[]),m("div",{className:e.className?"mapp-grid "+e.className:"mapp-grid"},e.data&&!!e.data.length&&m("div",{className:"mapp-grid-table"},(t=e.selectionColumn?m("div",{className:"mapp-grid-cell",key:"select"},__("Default")):null,n=m("div",{className:"mapp-grid-cell",key:"actions"},""),m("div",{className:"mapp-grid-header"},m("div",{className:"mapp-grid-row"},t,_.map(e.cols,(function(e){return m("div",{className:"mapp-grid-cell",key:e.id},e.label)})),n))),m("div",{className:"mapp-grid-body"},_.map(e.data,(function(t,n){return function(t,n){return m("div",{className:"mapp-grid-row"+(l.dragover==n?" mapp-dragover":""),draggable:!0,key:n,onDragOver:function(e){return e.preventDefault()},onDragStart:function(e){return s({dragging:n})},onDragEnter:function(e){return s({dragover:n})},onDragEnd:function(e){return s({dragging:null,dragover:null})},onDrop:function(e){return u("sort",n)}},function(t,n){if(!e.selectionColumn)return null;var o,a;switch("rowid"==e.selectionColumn?o=n:t[e.selectionColumn]?o=t[e.selectionColumn]:a=!0,e.selectionType){case"checkbox":return m("div",{className:"mapp-grid-cell"},m(C,{value:o,checked:e.selected==o,disabled:a,onChange:function(e){u("select",e?o:null)}}));case"radio":default:return m("div",{className:"mapp-grid-cell"},m(M,{checked:e.selected==o,onChange:function(){return u("select",o)}}))}}(t,n),_.map(e.cols,(function(t,a){return m("div",{className:"mapp-grid-cell mapp-grid-cell-"+t.id,key:n+"-"+a},function(t,n){switch(n.type){case"icon":return m(o.MappIconPicker,{iconid:e.data[t][n.id],onChange:function(e){return u("change",{i:t,id:n.id,value:e})}});case"input":default:return m(j,{key:t+"-"+n.id,size:e.data[t][n.size],value:e.data[t][n.id],onChange:function(e){return u("change",{i:t,id:n.id,value:e})}});case"select":return m(N,{key:t+"-"+n.id,value:e.data[t][n.id],options:n.options,onChange:function(e){u("change",{i:t,id:n.id,value:e})}});case"textarea":return m(A,{className:"mapp-option-expando",value:e.data[t][n.id],onChange:function(e){return u("change",{i:t,id:n.id,value:e})}})}}(n,t))})),function(e){return m("div",{className:"mapp-grid-cell",key:"delete"},m(v,{icon:"trash",onClick:function(){return u("delete",e)}}))}(n))}(t,n)})))),m("div",{className:"mapp-grid-toolbar"},m(v,{isSecondary:!0,onClick:function(){return u("add")}},__("Add"))))}function T(e){var t=a(b({codeEditor:null,isOpen:!1,name:null,tab:"editor",template:null,tokens:null}),2),n=t[0],o=t[1];function r(e){o((function(t){return p(p({},t),e)}))}var i,l,c=g((function(e){if(null!=e){var t=wp.codeEditor.initialize(e);t.codemirror.setSize("auto","auto"),t.codemirror.setOption("readOnly","editor"!=n.tab),r({codeEditor:t})}}),[]);function s(e,t){switch(e){case"close":r({isOpen:!1});break;case"delete":confirm(mappl10n.delete_prompt)&&(mapp.lib.ajax({type:"POST",data:{action:"mapp_tpl_delete",name:n.template.name,nonce:mappl10n.options.nonce}}),r({isOpen:!1}));break;case"insert":var o=n.codeEditor.codemirror.getDoc(),a=o.getCursor();o.replaceRange("{{{poi."+t+"}}}",a);break;case"open":mapp.lib.ajax({type:"GET",data:{action:"mapp_tpl_get",name:t,nonce:mappl10n.options.nonce},callback:function(e){e&&"OK"==e.status&&r({isOpen:!0,name:t,tab:"editor",template:e.data.template,tokens:e.data.tokens})}});break;case"save":var i="editor"==n.tab?n.codeEditor.codemirror.getValue():n.template.content;mapp.lib.ajax({type:"POST",data:{action:"mapp_tpl_save",content:i,name:n.template.name,nonce:mappl10n.options.nonce},callback:function(e){e&&"OK"==e.status&&r({isOpen:!1,template:null,tokens:null})}});break;case"tab-select":if("editor"!=t){var l=p({},n.template);l.content=n.codeEditor.codemirror.getValue(),r({template:l})}r({tab:t})}}return m("div",{className:"mapp-templates"},(l=[{name:"map-popup",label:__("Map popup")},{name:"map-item",label:__("Map list item")},{name:"mashup-popup",label:__("Mashup popup")},{name:"mashup-item",label:__("Mashup list item")}],m("div",{className:"mapp-templates-list"},_.map(l,(function(e,t){return m("a",{href:"#",key:e.name,className:"mapp-templates-item",onClick:function(t){t.preventDefault(),s("open",e.name)}},e.label)})))),n.isOpen&&n.template?m(O,{title:(i=n.template.name+" ("+(n.template.exists?__("Custom"):__("New"))+")",m("div",{className:"mapp-templates-name"},i)),className:"mapp-templates-modal",onRequestClose:function(){return s("close")},shouldCloseOnClickOutside:!1},m(k,{className:"mapp-templates-tabs",onSelect:function(e){return s("tab-select",e)},tabs:[{name:"editor",title:__("Editor")},{name:"standard",title:__("Default")}]},(function(e){return t=m("div",{className:"mapp-templates-tokens"},_.map(n.tokens,(function(e,t){return m("code",{onClick:function(){return s("insert",e)},key:t,title:e},e)}))),o=m("div",{className:"mapp-templates-path"},n.template.path),m(f,null,"editor"==n.tab&&o,"editor"==n.tab&&t,m("div",{className:"editor"==n.tab?"mapp-templates-editor":"mapp-templates-standard"},m("textarea",{ref:c,defaultValue:"editor"==n.tab?n.template.content:n.template.standard})));var t,o})),m("div",{className:"mapp-templates-toolbar"},m(v,{isPrimary:!0,onClick:function(){return s("save")}},__("Save")),m(v,{isSecondary:!0,onClick:function(){return s("close")}},__("Cancel")),n.template.exists&&m("a",{onClick:function(e){e.preventDefault(),s("delete")}},__("Delete")))):null)}},966:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return A}});var o=n(713),a=n(999),r=wp.element.createElement,i=(wp.data.select,wp.element),l=(i.Fragment,i.useEffect,i.useLayoutEffect,i.useRef,i.useState,wp.components),c=(l.BaseControl,l.Button),sprintf=(l.Dashicon,l.Modal,l.PanelBody,l.RadioControl,l.Spinner,l.TextControl,wp.i18n.sprintf);function p(e){function t(t,n){var o=Math.ceil(e.count/e.pageSize);switch(t){case"first":e.onChange(1);break;case"last":e.onChange(o);break;case"next":e.onChange(e.page+1);break;case"prev":e.onChange(e.page-1)}}return o=Math.ceil(e.count/e.pageSize),a=e.page<=1,i=e.page>=o,r("div",{className:"mapp-paginate"},r(c,{disabled:a,onClick:function(){return t("first")},isSecondary:!0},"«"),r(c,{disabled:a,onClick:function(){return t("prev")},isSecondary:!0},"‹"),r("div",{className:"mapp-paginate-count"},sprintf((n="%d of %d",wp.i18n.__(n,"mappress-google-maps-for-wordpress")),e.page,o)),r(c,{disabled:i,onClick:function(){return t("next")},isSecondary:!0},"›"),r(c,{disabled:i,onClick:function(){return t("last")},isSecondary:!0},"»"));var n,o,a,i}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(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 f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var h=window.mapp||{},g=wp.element.createElement,b=wp.data.select,y=wp.element,v=(y.Fragment,y.useEffect),w=(y.useLayoutEffect,y.useRef),O=y.useState,k=wp.components,C=(k.BaseControl,k.Button),S=k.Dashicon,P=k.Modal,j=(k.PanelBody,k.RadioControl),M=k.Spinner,I=k.TextControl,N=function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")};function A(e){var t=d(O({isFetchingItems:!0,items:null,mode:e.mode?e.mode:"list",mapid:e.mapid?e.mapid:null,page:1,search:"",type:mappl10n.options.postid?"post":"all"}),2),n=t[0],r=t[1],i=w(null),l=w(null);function c(e){r((function(t){return u(u({},t),e)}))}function s(t,o){switch(t){case"attach":h.store.mutateMap({mapdata:o});break;case"add-new":c({mode:"edit",mapid:null});break;case"change-type":c({type:o});break;case"close":e.onAction("pick-close");break;case"duplicate":h.store.duplicateMap({mapid:o,success:function(e){alert(N("Map copied")),c({mapid:e.mapid}),jQuery(".mapp-pick-items").scrollTop(0)}});break;case"destroy":confirm(mappl10n.delete_map_prompt)&&(h.store.destroyMap({mapid:o}),o==n.mapid&&e.onAction("pick-destroy",o)),i.current.focus();break;case"edit":c({mode:"edit",mapid:o});break;case"edit-close":"edit"==e.mode?e.onAction("pick-close"):c({mode:"list"});break;case"edit-destroy":c({mode:"list",mapid:null}),e.onAction("pick-destroy",o);break;case"edit-save":"edit"==e.mode?e.onAction("pick-close",o):c({mode:"list",mapid:o});break;case"insert":e.onAction("pick-insert",o);break;case"shortcode":e.onAction("pick-shortcode",o);break;case"sort":h.store.setSort({sortBy:o,sortAsc:h.store.state.sortBy!=o||!h.store.state.sortAsc})}}function m(t){var a,r=t.mapid==n.mapid;a=t.map_title?t.map_title:N("Untitled");var i=function(t){var n;return n=(n="map"==e.context||"mashup"==e.context&&t.postid==mappl10n.options.postid?b("core/editor").getEditedPostAttribute("title"):t.post_title)||N("Untitled"),t.postid>0&&t.postid==mappl10n.options.postid&&(n=N("Current post")),t.postid>0?t.postid==mappl10n.options.postid?n:g("a",{href:mappl10n.options.editurl+"?post="+t.postid+"&action=edit",target:"_blank",title:N("Edit post")},n):N("Unattached")}(t),c=[{action:"edit",label:N("Edit")},{action:"insert",label:N("Insert into post")},{action:"duplicate",label:N("Copy")},{action:"shortcode",label:N("Shortcode")},{action:"destroy",label:N("Delete")}];"library"==e.context?c.splice(1,1):c.splice(3,1),c=g("div",{className:"mapp-pick-actions"},c.map((function(e){return g("a",{href:"#",key:e.action,onClick:function(n){n.stopPropagation(),n.preventDefault(),s(e.action,t.mapid)}},e.label)})));var p=null;return p=t.postid>0?g("a",{href:"#",onClick:function(){return s("attach",{mapid:t.mapid,postid:0})}},N("Detach")):"library"==e.context?g(o.default,{onChange:function(e,n){return s("attach",{mapid:t.mapid,postid:e,post_title:n})}},N("Attach")):g("a",{href:"#",onClick:function(){return s("attach",{mapid:t.mapid,postid:mappl10n.options.postid,post_title:null})}},N("Attach")),g("div",{className:"mapp-pick-item"+(r?" mapp-selected":""),key:t.mapid+"|"+t.postid,ref:r?l:null},g("div",{className:"mapp-pick-col-map_title",onClick:function(e){return s("edit",t.mapid)}},g("div",null,a),g("div",null,c)),g("div",{className:"mapp-pick-col-mapid"},t.mapid),g("div",{className:"mapp-pick-col-post_title"},i,g("div",null,p)))}v((function(){var e=function(e){c({isFetchingItems:e.isFetchingItems,isSavingMap:e.isSavingMap,items:e.items})};return h.store.subscribe(e),function(){return h.store.unsubscribe(e)}})),v((function(){i.current&&i.current.focus(),h.store.fetchItems()}),[]),v((function(){c({page:1})}),[n.type,n.search]),v((function(){l.current&&h.lib.scrollTo(jQuery(".mapp-pick-items"),jQuery(l.current))}),[n.type,n.items]);var f=_.filter(n.items,(function(t){if("post"==n.type&&t.postid!=mappl10n.options.postid)return!1;if("current"==n.type&&t.mapid!=e.mapid)return!1;var o=n.search.toLowerCase();return!o||(t.mapid.indexOf(o)>=0||(!!(t.post_title&&t.post_title.toLowerCase().indexOf(o)>=0)||!!(t.map_title&&t.map_title.toLowerCase().indexOf(o)>=0)))})),y=g("div",{className:"mapp-list-panel"},g("div",{className:"mapp-gt-modal-header"},g("div",{className:"mapp-gt-modal-header-title"},g("h1",null,N("Select a map")),g(C,{isPrimary:!0,onClick:function(){return s("add-new")}},N("Add New"))),g(C,{onClick:function(){return s("close")},icon:"no-alt"})),function(){var t=[{label:N("Attached to post"),value:"post"},{label:N("All maps"),value:"all"}];e.mapid&&t.unshift({label:N("Current map"),value:"current"});var o="library"==e.context?null:g(j,{className:"mapp-pick-type",options:t,onChange:function(e){return s("change-type",e)},selected:n.type}),a=n.isFetchingItems||n.isAttaching&&"library"!=e.context;return g("div",{className:"mapp-pick-filter"},a&&g(M,null),g(I,{ref:i,className:"mapp-pick-search",tabIndex:1,label:N("Search"),placeholder:N("post title, map title, or map id"),onChange:function(e){return c({search:e})}}),o)}(),function(e){if(e){var t=20*(n.page-1),o=t+20;e=e.slice(t,o)}var a,r="";return r=n.isFetchingItems?null:e.length?_.map(e,m):g("div",{className:"mapp-pick-message"},N("No maps found")),g("div",{className:"mapp-pick-items-section"},g("div",{className:"mapp-pick-items"},(a={map_title:N("Map title"),mapid:N("Map ID"),post_title:N("Attached to")},g("div",{className:"mapp-pick-items-header"},_.map(a,(function(e,t){return g("div",{className:"mapp-pick-col-"+t,onClick:function(){return s("sort",t)},key:t},e,h.store.state.sortBy==t&&g(S,{icon:h.store.state.sortAsc?"arrow-up":"arrow-down"}))})))),r))}(f),function(t){return g("div",{className:"mapp-pick-toolbar"},"library"!=e.context?g(C,{onClick:function(){return s("close")}},N("Cancel")):null,function(e){return e&&e.length?g(p,{count:e?e.length:0,onChange:function(e){return c({page:e})},page:n.page,pageSize:20}):null}(t))}(f)),k=null;if("edit"==n.mode){var A=g("div",{className:"mapp-edit-panel"},g(a.default,{context:e.context,mapid:n.mapid,onAction:s}));k="library"==e.context?g(P,{className:"mapp-gt-modal",isDismissible:!1},A):A}var E="mapp-pick mapp-mode-"+n.mode+" mapp-context-"+e.context;return"library"==e.context?g("div",{className:E},y,k):g(P,{className:"mapp-gt-modal "+E,isDismissible:"list"==n.mode,onRequestClose:function(){return s("close")},shouldCloseOnEsc:"list"==n.mode,shouldCloseOnClickOutside:"list"==n.mode},y,k)}},429:function(e,t,n){"use strict";function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],_n=!0,o=!1,_e=void 0;try{for(var a,r=e[Symbol.iterator]();!(_n=(a=r.next()).done)&&(n.push(a.value),!t||n.length!==t);_n=!0);}catch(e){o=!0,_e=e}finally{try{_n||null==r.return||r.return()}finally{if(o)throw _e}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(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 a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}n.r(t),n.d(t,{MappSettings:function(){return g}});window.mapp;var r=wp.element.createElement,i=wp.element,l=i.Fragment,c=(i.useEffect,i.useLayoutEffect,i.useRef,i.useState),p=wp.components,s=p.BaseControl,u=p.Button,m=p.ButtonGroup,d=(p.Dashicon,p.Dropdown,p.ExternalLink,p.Panel,p.PanelBody,p.PanelRow),f=(p.RadioControl,p.SelectControl),h=p.TextControl,__=function(e){return wp.i18n.__(e,"mappress-google-maps-for-wordpress")};function g(e){var t,n=o(c({}),2);n[0],n[1];function a(e){if(!e||"string"!=typeof e)return e;var t={px:2048,vw:100,vh:100,"%":100},n=parseInt(e),o=2048,a="";for(var r in t)e.includes(r)&&(a=r,o=t[r]);return n>o?o+a:e}function i(t,n){var o=null;switch(t){case"mapTypeId":e.map.set({mapTypeId:n}),o={mapTypeId:n};break;case"poiList":e.map.set({poiList:n}),o={poiList:n};break;case"size":n.hasOwnProperty("height")&&(n.height=a(n.height)),n.hasOwnProperty("width")&&(n.width=a(n.width)),e.map.setSize(n),o=n;break;case"viewport-reset":e.map.center=e.map.zoom=null,e.map.recenter(),o={center:void 0,zoom:void 0};break;case"viewport-set":var r=e.map.getCenter().toJSON();e.map.center=r,e.map.zoom=e.map.getZoom(),o={center:r.lat+","+r.lng,zoom:e.map.getZoom()},"mce"==e.context||"library"==e.context?alert(__("Viewport set")):wp.data.dispatch("core/notices").createNotice("success",__("Viewport set"),{type:"snackbar",isDismissible:!0})}o&&e.onAction("change-settings",o)}return r("div",{className:"mapp-settings"},null,(t=e.map.title?e.map.title:__("Untitled"),r(d,null,"map"==e.context&&r(s,{className:"mapp-settings-title"},t),r(s,{className:"mapp-settings-id",label:__("Map ID")},e.map.mapid))),"mashup"==e.context&&function(){var t=[];if("leaflet"==mappl10n.options.engine)t=mappl10n.options.baseLayers.map((function(e){return{label:e.label,value:e.name}}));else{var n=mappl10n.options.styles?_.keys(mappl10n.options.styles):[];t=["roadmap","satellite","terrain","hybrid"].concat(n).map((function(e){return{label:e.charAt(0).toUpperCase()+e.slice(1),value:e}}))}return t.unshift({label:__("Default"),value:null}),r(f,{className:"mapp-settings-type",help:"",label:__("Map type"),value:e.map.mapTypeId,options:t,onChange:function(e){return i("mapTypeId",e)}})}(),function(){var t=mappl10n.options.sizes[mappl10n.options.size]?mappl10n.options.sizes[mappl10n.options.size]:mappl10n.options.sizes[0],n=mappl10n.options.sizes.map((function(e,t){return{label:e.width+" X "+e.height,height:e.height,width:e.width,value:t+1}}));n.unshift({height:"",label:__("Default"),value:0,width:""}),n.push({label:__("Custom"),value:"custom",disabled:!0});for(var o="custom",a=0;a<n.length-1;a++)n[a].width==e.width&&n[a].height==e.height&&(o=a);return r(l,null,r(f,{className:"mapp-settings-dims-select",help:"",label:__("Size"),value:o,options:n,onChange:function(e){return i("size",{width:n[e].width,height:n[e].height})}}),r(d,null,r(h,{className:"mapp-settings-dims-custom",help:__("px, %, vw"),label:__("Width"),onChange:function(e){return i("size",{width:e})},placeholder:t.width,value:e.width?e.width:""}),r(h,{className:"mapp-settings-dims-custom",help:__("px, %, vh"),label:__("Height"),onChange:function(e){return i("size",{height:e})},placeholder:t.height,value:e.height?e.height:""})))}(),(e.center&&(e.center.lat,e.center.lng,__("Zoom"),e.zoom),r(l,null,r(s,{className:"mapp-settings-viewport",label:__("Center/Zoom")},r(m,{label:__("Center/Zoom")},r(u,{onClick:function(){return i("viewport-reset")},isPressed:!e.center,isSmall:!0},__("Automatic")),r(u,{onClick:function(){return i("viewport-set")},isPressed:e.center,isSmall:!0},__("Set")))))))}},787:function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||o(e)||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.")}()}function o(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var r=window.mapp||{};r.Store=function(){this.subs=new Set,this.state={isFetchingMap:!1,isFetchingItems:!1,isSavingMap:!1,itemsFetched:!1,sortBy:"map_title",sortAsc:!0,maps:{},items:[]}},r.Store.prototype={createMap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.success,n=void 0===t?function(){}:t;this.state.isFetchingMap=!1,this.publish(),n()},destroyMap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mapid,n=e.success,o=void 0===n?function(){}:n,a=e.failure,i=void 0===a?function(){}:a,l=this;r.lib.ajax({type:"POST",data:{action:"mapp_delete",mapid:t,nonce:mappl10n.options.nonce},callback:function(e){e&&"OK"==e.status?(delete l.state.maps[t],l.destroyItem(t),o(t)):i(),l.publish()}})},duplicateMap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mapid,n=e.success,o=void 0===n?function(){}:n,a=e.failure,i=void 0===a?function(){}:a,l=this;this.state.isSavingMap=!0,this.publish(),r.lib.ajax({type:"POST",data:{action:"mapp_duplicate",mapid:t,postid:mappl10n.options.postid,nonce:mappl10n.options.nonce},callback:function(e){if(e&&"OK"==e.status){var t=e.data,n=t.mapid;l.state.maps[n]=t,l.saveItem(t),o(t)}else i();l.state.isSavingMap=!1,l.publish()}})},fetchMap:function(e){var t=e.mapid,n=e.success,o=void 0===n?function(){}:n,a=e.failure,i=void 0===a?function(){}:a,l=this;if(void 0!==this.state.maps[t])return l.publish(),void o(this.state.maps[t]);this.state.isFetchingMap=!0,l.publish(),r.lib.ajax({type:"GET",data:{action:"mapp_get",mapid:t,nonce:mappl10n.options.nonce},callback:function(e){e&&"OK"==e.status?(l.state.maps[t]=e.data,o(e.data)):i(),l.state.isFetchingMap=!1,l.publish()}})},mutateMap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mapdata,n=e.success,o=void 0===n?function(){}:n,a=e.failure,i=void 0===a?function(){}:a,l=this;this.state.isSavingMap=!0,this.saveItem(t),this.publish(),r.lib.ajax({type:"POST",data:{action:"mapp_mutate",mapdata:t,nonce:mappl10n.options.nonce},callback:function(e){e&&"OK"==e.status?(l.state.maps[e.data.mapid]=e.data,o(t)):i(),l.state.isSavingMap=!1,l.publish()}})},saveMap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mapdata,n=e.success,o=void 0===n?function(){}:n,a=e.failure,i=void 0===a?function(){}:a,l=this;this.state.isSavingMap=!0,this.publish(),r.lib.ajax({type:"POST",data:{action:"mapp_save",mapdata:JSON.stringify(t),nonce:mappl10n.options.nonce},callback:function(e){if(e&&"OK"==e.status){var t=e.data,n=t.mapid;l.state.maps[n]=t,l.saveItem(t),o(t)}else i();l.state.isSavingMap=!1,l.publish()}})},destroyItem:function(e){var t=this.state.items?this.state.items:[],o=_.findIndex(t,{mapid:e});o>-1&&t.splice(o,1),this.state.items=n(t),this.publish()},fetchItems:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.success,n=void 0===t?function(){}:t,o=e.failure,a=void 0===o?function(){}:o,i=this;if(this.state.itemsFetched)return n(this.state.items),void i.publish();this.state.isFetchingItems=!0,i.publish(),r.lib.ajax({type:"GET",data:{action:"mapp_find",nonce:mappl10n.options.nonce},callback:function(e){e&&"OK"==e.status?(i.state.items=e.data,i.sort(),n(i.state.items),i.state.itemsFetched=!0):a(),i.state.isFetchingItems=!1,i.sort(),i.publish()}})},saveItem:function(n){var o=this.state.items?this.state.items:[],a=_.findWhere(o,{mapid:n.mapid});a?(a.mapid=void 0!==n.mapid?n.mapid:a.mapid,a.map_title=void 0!==n.title?n.title:a.map_title,a.postid=void 0!==n.postid?n.postid:a.postid,a.post_title=void 0!==n.post_title?n.post_title:a.post_title,a=function(n){for(var o=1;o<arguments.length;o++){var a=null!=arguments[o]?arguments[o]:{};o%2?e(Object(a),!0).forEach((function(e){t(n,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):e(Object(a)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(a,e))}))}return n}({},a)):(a={mapid:n.mapid,map_title:n.title,postid:mappl10n.options.postid,post_title:null},o.unshift(a))},setSort:function(e){e.sortBy&&(this.state.sortBy=e.sortBy),void 0!==e.sortAsc&&(this.state.sortAsc=e.sortAsc),this.sort(),this.publish()},sort:function(e,t){var n,o=this,a=(n="untitled",wp.i18n.__(n,"mappress-google-maps-for-wordpress"));this.state.items.sort((function(e,t){return function(e,t,n,o){if(o=o?1:-1,"mapid"==n)return o*(Number(e.mapid)-Number(t.mapid));var r=e[n]?e[n]:a,i=t[n]?t[n]:a,l=o*r.localeCompare(i);return 0==l?Number(e.mapid)-Number(t.mapid):l}(e,t,o.state.sortBy,o.state.sortAsc)}))},subscribe:function(e){this.subs.add(e)},unsubscribe:function(e){this.subs.delete(e)},publish:function(){var e,t=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=o(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var a=0,r=function(){};return{s:r,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(_e){throw _e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return l=e.done,e},e:function(e){c=!0,i=e},f:function(){try{l||null==n.return||n.return()}finally{if(c)throw i}}}}(n(this.subs));try{for(t.s();!(e=t.n()).done;){(0,e.value)(this.state)}}catch(e){t.e(e)}finally{t.f()}}},r.store=new r.Store},308:function(e,t,n){"use strict";e.exports=function(e,t){var o,a,r,i,l,c,p,s,u,m,d,f,h,g=String(e).replace(/^&/,"").replace(/&$/,"").split("&"),b=g.length,y=function(e){return decodeURIComponent(e.replace(/\+/g,"%20"))},v="undefined"!=typeof window?window:n.g;v.$locutus=v.$locutus||{};var w=v.$locutus;for(w.php=w.php||{},t||(t=v),o=0;o<b&&(u=y((s=g[o].split("="))[0]),m=s.length<2?"":y(s[1]),!(u.includes("__proto__")||u.includes("constructor")||u.includes("prototype")));o++){for(;" "===u.charAt(0);)u=u.slice(1);if(u.indexOf("\0")>-1&&(u=u.slice(0,u.indexOf("\0"))),u&&"["!==u.charAt(0)){for(f=[],d=0,a=0;a<u.length;a++)if("["!==u.charAt(a)||d){if("]"===u.charAt(a)&&d&&(f.length||f.push(u.slice(0,d-1)),f.push(u.substr(d,a-d)),d=0,"["!==u.charAt(a+1)))break}else d=a+1;for(f.length||(f=[u]),a=0;a<f[0].length&&(" "!==(p=f[0].charAt(a))&&"."!==p&&"["!==p||(f[0]=f[0].substr(0,a)+"_"+f[0].substr(a+1)),"["!==p);a++);for(c=t,a=0,h=f.length;a<h;a++){if(l=c,(""===(u=f[a].replace(/^['"]/,"").replace(/['"]$/,""))||" "===u)&&0!==a){for(i in r=-1,c)c.hasOwnProperty(i)&&+i>r&&i.match(/^\d+$/g)&&(r=+i);u=r+1}Object(c[u])!==c[u]&&(c[u]={}),c=c[u]}l[u]=m}}}}},t={};function n(o){if(t[o])return t[o].exports;var a=t[o]={exports:{}};return e[o](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(787),n(215),n(713),n(525),n(999),n(143),n(800),n(938),n(816),n(378),n(498),n(670),n(218),n(824),n(966),n(429)}();
languages/mappress-google-maps-for-wordpress.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the MapPress Maps for WordPress plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: MapPress Maps for WordPress 2.62.10\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mappress-google-maps-for-wordpress\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2021-05-05T21:11:34+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
 
@@ -34,7 +34,7 @@ msgid "https://www.mappresspro.com/chris-contact"
34
  msgstr ""
35
 
36
  #: mappress.php:200
37
- #: mappress.php:742
38
  msgid "Settings"
39
  msgstr ""
40
 
@@ -58,110 +58,110 @@ msgstr ""
58
  msgid "MapPress Settings"
59
  msgstr ""
60
 
61
- #: mappress.php:492
62
  msgid "renew your license"
63
  msgstr ""
64
 
65
- #: mappress.php:493
66
  msgid "Your MapPress license has expired. Please %s to get the latest updates and prevent errors."
67
  msgstr ""
68
 
69
- #: mappress.php:502
70
  msgid "Please enter your MapPress license key to enable plugin updates"
71
  msgstr ""
72
 
73
- #: mappress.php:506
74
  msgid "MapPress Gutenberg blocks require WordPress 5.3 or the latest Gutenberg Plugin. Please update if using the block editor."
75
  msgstr ""
76
 
77
- #: mappress.php:510
78
  msgid "MapPress has many new features! %s."
79
  msgstr ""
80
 
81
- #: mappress.php:510
82
- #: mappress.php:514
83
  msgid "Learn more"
84
  msgstr ""
85
 
86
- #: mappress.php:514
87
  msgid "MapPress popup templates have changed! Please update custom templates to the new format. %s."
88
  msgstr ""
89
 
90
- #: mappress.php:557
91
  msgid "Are you sure you want to delete?"
92
  msgstr ""
93
 
94
- #: mappress.php:558
95
  msgid "Permanently delete this map from the map library?"
96
  msgstr ""
97
 
98
- #: mappress.php:559
99
  msgid "Error reading KML file"
100
  msgstr ""
101
 
102
- #: mappress.php:560
103
  msgid "URL for KML file"
104
  msgstr ""
105
 
106
- #: mappress.php:561
107
  msgid "Loading"
108
  msgstr ""
109
 
110
- #: mappress.php:562
111
  msgid "Please select an editor to insert into."
112
  msgstr ""
113
 
114
- #: mappress.php:563
115
  msgid "Unable to get your location"
116
  msgstr ""
117
 
118
- #: mappress.php:564
119
  msgid "No results"
120
  msgstr ""
121
 
122
- #: mappress.php:565
123
  msgid "Save changes?"
124
  msgstr ""
125
 
126
- #: mappress.php:566
127
  msgid "Shape"
128
  msgstr ""
129
 
130
- #: mappress.php:596
131
  msgid "Improve this map"
132
  msgstr ""
133
 
134
- #: mappress.php:612
135
- #: mappress.php:631
136
  msgid "Streets"
137
  msgstr ""
138
 
139
- #: mappress.php:613
140
  msgid "Outdoors"
141
  msgstr ""
142
 
143
- #: mappress.php:614
144
  msgid "Light"
145
  msgstr ""
146
 
147
- #: mappress.php:615
148
  msgid "Dark"
149
  msgstr ""
150
 
151
- #: mappress.php:616
152
  msgid "Satellite"
153
  msgstr ""
154
 
155
- #: mappress.php:617
156
  msgid "Satellite Streets"
157
  msgstr ""
158
 
159
- #: mappress.php:743
160
  #: mappress_settings.php:370
161
  msgid "What's new"
162
  msgstr ""
163
 
164
- #: mappress.php:992
165
  msgid "Version"
166
  msgstr ""
167
 
2
  # This file is distributed under the same license as the MapPress Maps for WordPress plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: MapPress Maps for WordPress 2.62.11\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mappress-google-maps-for-wordpress\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2021-05-07T01:11:57+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
 
34
  msgstr ""
35
 
36
  #: mappress.php:200
37
+ #: mappress.php:758
38
  msgid "Settings"
39
  msgstr ""
40
 
58
  msgid "MapPress Settings"
59
  msgstr ""
60
 
61
+ #: mappress.php:508
62
  msgid "renew your license"
63
  msgstr ""
64
 
65
+ #: mappress.php:509
66
  msgid "Your MapPress license has expired. Please %s to get the latest updates and prevent errors."
67
  msgstr ""
68
 
69
+ #: mappress.php:518
70
  msgid "Please enter your MapPress license key to enable plugin updates"
71
  msgstr ""
72
 
73
+ #: mappress.php:522
74
  msgid "MapPress Gutenberg blocks require WordPress 5.3 or the latest Gutenberg Plugin. Please update if using the block editor."
75
  msgstr ""
76
 
77
+ #: mappress.php:526
78
  msgid "MapPress has many new features! %s."
79
  msgstr ""
80
 
81
+ #: mappress.php:526
82
+ #: mappress.php:530
83
  msgid "Learn more"
84
  msgstr ""
85
 
86
+ #: mappress.php:530
87
  msgid "MapPress popup templates have changed! Please update custom templates to the new format. %s."
88
  msgstr ""
89
 
90
+ #: mappress.php:573
91
  msgid "Are you sure you want to delete?"
92
  msgstr ""
93
 
94
+ #: mappress.php:574
95
  msgid "Permanently delete this map from the map library?"
96
  msgstr ""
97
 
98
+ #: mappress.php:575
99
  msgid "Error reading KML file"
100
  msgstr ""
101
 
102
+ #: mappress.php:576
103
  msgid "URL for KML file"
104
  msgstr ""
105
 
106
+ #: mappress.php:577
107
  msgid "Loading"
108
  msgstr ""
109
 
110
+ #: mappress.php:578
111
  msgid "Please select an editor to insert into."
112
  msgstr ""
113
 
114
+ #: mappress.php:579
115
  msgid "Unable to get your location"
116
  msgstr ""
117
 
118
+ #: mappress.php:580
119
  msgid "No results"
120
  msgstr ""
121
 
122
+ #: mappress.php:581
123
  msgid "Save changes?"
124
  msgstr ""
125
 
126
+ #: mappress.php:582
127
  msgid "Shape"
128
  msgstr ""
129
 
130
+ #: mappress.php:612
131
  msgid "Improve this map"
132
  msgstr ""
133
 
134
+ #: mappress.php:628
135
+ #: mappress.php:647
136
  msgid "Streets"
137
  msgstr ""
138
 
139
+ #: mappress.php:629
140
  msgid "Outdoors"
141
  msgstr ""
142
 
143
+ #: mappress.php:630
144
  msgid "Light"
145
  msgstr ""
146
 
147
+ #: mappress.php:631
148
  msgid "Dark"
149
  msgstr ""
150
 
151
+ #: mappress.php:632
152
  msgid "Satellite"
153
  msgstr ""
154
 
155
+ #: mappress.php:633
156
  msgid "Satellite Streets"
157
  msgstr ""
158
 
159
+ #: mappress.php:759
160
  #: mappress_settings.php:370
161
  msgid "What's new"
162
  msgstr ""
163
 
164
+ #: mappress.php:1008
165
  msgid "Version"
166
  msgstr ""
167
 
mappress.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: MapPress Maps for WordPress
4
  Plugin URI: https://www.mappresspro.com/mappress
5
  Author URI: https://www.mappresspro.com/chris-contact
6
  Description: MapPress makes it easy to add Google and Leaflet Maps to WordPress
7
- Version: 2.62.10
8
  Author: Chris Richardson
9
  Text Domain: mappress-google-maps-for-wordpress
10
  Thanks to all the translators and to Matthias Stasiak for his wonderful icons (http://code.google.com/p/google-maps-icons/)
@@ -35,7 +35,7 @@ if (is_dir(dirname( __FILE__ ) . '/pro')) {
35
  }
36
 
37
  class Mappress {
38
- const VERSION = '2.62.10';
39
 
40
  static
41
  $baseurl,
@@ -273,7 +273,23 @@ class Mappress {
273
  die ($response);
274
  }
275
 
276
- // Exclude CSS from AO
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  static function autoptimize_filter_css_exclude($exclude_css, $content) {
278
  if ($exclude_css)
279
  $exclude_css .= ',';
4
  Plugin URI: https://www.mappresspro.com/mappress
5
  Author URI: https://www.mappresspro.com/chris-contact
6
  Description: MapPress makes it easy to add Google and Leaflet Maps to WordPress
7
+ Version: 2.62.11
8
  Author: Chris Richardson
9
  Text Domain: mappress-google-maps-for-wordpress
10
  Thanks to all the translators and to Matthias Stasiak for his wonderful icons (http://code.google.com/p/google-maps-icons/)
35
  }
36
 
37
  class Mappress {
38
+ const VERSION = '2.62.11';
39
 
40
  static
41
  $baseurl,
273
  die ($response);
274
  }
275
 
276
+ static function ajax_start($args = array(), $auth = 'manage_options') {
277
+ check_ajax_referer('mappress', 'nonce');
278
+
279
+ if (!current_user_can($auth))
280
+ Mappress::ajax_response('Not authorized');
281
+
282
+ $parsed_args = array();
283
+ foreach($args as $arg) {
284
+ if (isset($_REQUEST[$arg]))
285
+ $parsed_args[$arg] = $_REQUEST[$arg];
286
+ else
287
+ Mappress::ajax_response('Internal error - missing ' . $arg);
288
+ }
289
+ ob_start();
290
+ return (object) $parsed_args;
291
+ }
292
+
293
  static function autoptimize_filter_css_exclude($exclude_css, $content) {
294
  if ($exclude_css)
295
  $exclude_css .= ',';
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: maps, google maps, map, map markers, google map, leaflet maps, leaflet map
5
  Requires at least: 5.3
6
  Requires PHP: 5.6
7
  Tested up to: 5.7
8
- Stable tag: 2.62.10
9
 
10
  == Description ==
11
  MapPress is the easiest way to add beautiful interfactive Google and Leaflet maps to WordPress.
@@ -84,6 +84,9 @@ Please see the plugin documentation pages:
84
 
85
  == Changelog ==
86
 
 
 
 
87
  = 2.62.10 =
88
  * Changed: pagination moved to map list toolbar
89
  * Fixed: compatibility fix for autoptimize
5
  Requires at least: 5.3
6
  Requires PHP: 5.6
7
  Tested up to: 5.7
8
+ Stable tag: 2.62.11
9
 
10
  == Description ==
11
  MapPress is the easiest way to add beautiful interfactive Google and Leaflet maps to WordPress.
84
 
85
  == Changelog ==
86
 
87
+ = 2.62.11 =
88
+ * Fixed: default POI zoom setting not saving
89
+
90
  = 2.62.10 =
91
  * Changed: pagination moved to map list toolbar
92
  * Fixed: compatibility fix for autoptimize