var MapSVG=function(){};!function(t){MapSVG.templatesLoaded={},"undefined"!=typeof mapsvg_paths?MapSVG.urls=mapsvg_paths:MapSVG.urls={},MapSVG.instances=[],MapSVG.userAgent=navigator.userAgent.toLowerCase(),MapSVG.touchDevice="ontouchstart"in window||0").attr("id","mapsvg-controller-"+this.name).addClass("mapsvg-controller-view"),this.contentWrap=t("
").addClass("mapsvg-controller-view-wrap"),this.contentWrap2=t("
"),this.contentSizer=t("
").addClass("mapsvg-auto-height"),this.contentView=t("
").addClass("mapsvg-controller-view-content"),this.contentSizer.append(this.contentView),this.scrollable&&(this.contentWrap.addClass("nano"),this.contentWrap2.addClass("nano-content")),this.contentWrap.append(this.contentWrap2),this.contentWrap2.append(this.contentSizer),this.withToolbar&&this.templates.toolbar&&(this.toolbarView=t("
").addClass("mapsvg-controller-view-toolbar"),this.view.append(this.toolbarView)),this.view.append(this.contentWrap),this.container.append(this.view),this.container.data("controller",this),this.width&&this.view.css({width:this.width}),this.color&&this.view.css({"background-color":this.color}),e.viewReadyToFill(),this.redraw(),setTimeout(function(){e._viewDidLoad(),e.viewDidLoad(),e.setEventHandlersCommon(),e.setEventHandlers()},1)},MapSVG.Controller.prototype.viewReadyToFill=function(){var e=this;e.autoresize&&(e.resizeSensor=new MapSVG.ResizeSensor(this.contentSizer[0],function(){e.adjustHeight(),e.updateScroll(),e.events.resize&&e.events.resize.call(e,e.mapsvg)}))},MapSVG.Controller.prototype.redraw=function(e){void 0!==e&&(this.data=e);try{this.contentView.html(this.templates.main(this.data))}catch(e){console.error(e),this.contentView.html("")}this.withToolbar&&this.templates.toolbar&&this.toolbarView.html(this.templates.toolbar(this.data)),this.updateTopShift(),this.noPadding&&this.contentView.css({padding:0}),this.updateScroll()},MapSVG.Controller.prototype.updateTopShift=function(){var e=this;this.withToolbar&&(e.contentWrap.css({top:e.toolbarView.outerHeight(!0)+"px"}),setTimeout(function(){e.contentWrap.css({top:e.toolbarView.outerHeight(!0)+"px"})},100),setTimeout(function(){e.contentWrap.css({top:e.toolbarView.outerHeight(!0)+"px"})},200),setTimeout(function(){e.contentWrap.css({top:e.toolbarView.outerHeight(!0)+"px"}),e.updateScroll()},500))},MapSVG.Controller.prototype.setEventHandlersCommon=function(){},MapSVG.Controller.prototype.setEventHandlers=function(){},MapSVG.Controller.prototype.destroy=function(){delete this.resizeSensor,this.view.empty().remove()}}(jQuery),function(c){MapSVG.DatabaseService=function(e,t){var o=this;this.mapsvg=t,this.map_id=e.map_id,this.table=e.table,this.perpage=parseInt(e.perpage)||0,this.sortBy=e.sortBy||null,this.sortDir=e.sortDir||null,this.type=e.type||"mysql",this.loaded=!1,"local"==this.type&&(this.dbObject=e.dbObject),this.server="mysql"==this.type?new MapSVG.ServerMySQL({map_id:this.map_id,table:this.table,perpage:this.perpage,mapsvg:this.mapsvg}):new MapSVG.ServerLocal({storage:this.dbObject}),this.lastChangeTime=Date.now(),this.cols=[],this.schemaDict={},this.index={},this.page=1,this.query=new MapSVG.DatabaseQuery,this.query.set({sort:[{field:this.sortBy,order:this.sortDir}],perpage:this.perpage}),this.events={create:[],update:[],change:[],schemaChange:[],dataLoaded:[],beforeLoad:[]},this.schema=new MapSVG.DatabaseSchema(e,t),this.schema.on("change",function(){o.getAll(),o.trigger("schemaChange")})},MapSVG.DatabaseService.setQuery=function(e){},MapSVG.DatabaseService.prototype.setPerpage=function(e){this.server.perpage=e},MapSVG.DatabaseService.prototype.lastChangeTime=function(){return this.lastChangeTime},MapSVG.DatabaseService.prototype.onFirstPage=function(){return 1===this.query.page},MapSVG.DatabaseService.prototype.onLastPage=function(){return!1===this.server.hasMoreRecords},MapSVG.DatabaseService.prototype.import=function(e,t){var o=this,i=o.getSchemaFieldByType("location"),s="en";return i&&i.language&&(s=i.language),e=this.formatCSV(e),this.server.import(e,s,t).done(function(){o.getAll()})},MapSVG.DatabaseService.prototype.create=function(e){var t=this;return this.server.create(e).done(function(){t.trigger("create",e),t.trigger("change",e)})},MapSVG.DatabaseService.prototype.update=function(e){var t=this;return this.server.update(e).done(function(){t.trigger("update",e),t.trigger("change",e)})},MapSVG.DatabaseService.prototype.delete=function(e){var t=this;return this.server.delete(e).done(function(){t.trigger("delete",e),t.trigger("change",e)})},MapSVG.DatabaseService.prototype.clear=function(e){var t=this;return this.server.clear().done(function(){t.getAll(),t.trigger("delete"),t.trigger("change")})},MapSVG.DatabaseService.prototype.getLoadedObject=function(e){return this.server.getLoadedObject(e)},MapSVG.DatabaseService.prototype.getAll=function(e){var t=this;if(t.trigger("beforeLoad",e),this.mapsvg.options.database.noFiltersNoLoad&&0===Object.keys(t.query.filters).length){defer=c.Deferred();var o=this.rows;return defer.promise(),defer.resolve(o),t.server.fill({objects:[]}),t.trigger("dataLoaded"),defer}"object"==typeof e&&Object.keys(e).length&&!e.page&&(t.query.page=1),t.query.set(e),this.page=e&&e.page?parseInt(e.page):this.page;e=t.query.get();return this.schema.loaded()||(e.with_schema=!0),this.mapsvg.editMode&&void 0!==e.filterout&&delete e.filterout,this.server.get(e).done(function(e){!t.schema.loaded()&&e.schema&&t.schema.set(e.schema),t.loaded=!0,t.trigger("dataLoaded")})},MapSVG.DatabaseService.prototype.fill=function(e){this.server.fill(e),!this.schema.loaded()&&e.schema&&this.schema.set(e.schema),this.loaded=!0,this.trigger("dataLoaded")},MapSVG.DatabaseService.prototype.getLoaded=function(){return this.server.rows},MapSVG.DatabaseService.prototype.formatData=function(e){return e},MapSVG.DatabaseService.prototype.formatCSV=function(r){var l=this;return r.forEach(function(e,t){var o,i={};for(o in e){var s,a=l.schema.getField(o);if(void 0!==(a="post"===o?{type:"post"}:a))switch(a.type){case"region":i[o]=e[o].split(",").map(function(e){return e.trim()}).filter(function(t){return void 0!==l.mapsvg.getRegion(t)||void 0!==l.mapsvg.regions.find(function(e){return e.title===t})}).map(function(t){var e=l.mapsvg.getRegion(t);return{id:(e=void 0===e?l.mapsvg.regions.find(function(e){return e.title===t}):e).id,title:e.title}});break;case"location":var n;e[o].match(/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/g)?2==(n=e[o].split(",").map(function(e){return parseFloat(e)})).length&&-90this.perpage),t.hasMoreRecords&&e.objects.pop(),t.rows=e.objects):(t.hasMoreRecords=!1,t.rows=[]),t.reindex()},MapSVG.ServerMySQL.prototype.get=function(e){var t=this;return void 0!==e.perpage&&(this.perpage=e.perpage),c.getJSON(ajaxurl,this.actionData("mapsvg_data_get_all",e)).done(function(e){t.fill(e)})},MapSVG.ServerMySQL.prototype.import=function(e,o,i){for(var t,s,a,n=this,r=[],l=0,p=e.length;l
':""},MapSVG.DetailsController.prototype.viewDidLoad=function(){this.events&&this.events.shown&&this.events.shown.call(this,this.mapsvg),this.modal&&MapSVG.isPhone&&this.mapsvg.getData().options.detailsView.mobileFullscreen&&!this.mobileCloseBtn&&(this.mobileCloseBtn=e('"),this.view.append(this.mobileCloseBtn))},MapSVG.DetailsController.prototype.setEventHandlers=function(){var t=this;this.view.on("click",".mapsvg-popover-close, .mapsvg-mobile-modal-close",function(e){e.stopPropagation(),t.destroy(),t.events&&t.events.closed&&t.events.closed.call(t,t.mapsvg)})}}(jQuery),function($){MapSVG.DirectoryController=function(e){this.database=e.database,this.noPadding=!0,this.position=e.position,this.search=e.search,this.filters=e.filters,MapSVG.Controller.call(this,e)},MapSVG.extend(MapSVG.DirectoryController,MapSVG.Controller),MapSVG.DirectoryController.prototype.getToolbarTemplate=function(){return'
'},MapSVG.DirectoryController.prototype.viewDidLoad=function(){this.menuBtn=$('
'+this.mapsvg.getData().options.mobileView.labelList+"
"),this.mapBtn=$('
'+this.mapsvg.getData().options.mobileView.labelMap+"
"),MapSVG.isPhone&&this.mapsvg.options.menu.hideOnMobile&&("map"==this.mapsvg.getData().options.menu.showFirst?this.toggle(!1):this.toggle(!0)),this.mobileButtons=$('
'),this.mobileButtons.append(this.menuBtn,this.mapBtn),!1!==this.mapsvg.getData().options.menu.on&&this.mobileButtons.appendTo(this.mapsvg.getData().$wrapAll),this.events&&this.events.shown&&this.events.shown.call(this.view)},MapSVG.DirectoryController.prototype.setEventHandlers=function(){var _this=this,_data=_this.mapsvg.getData();$(window).on("resize",function(){_this.updateTopShift()}),this.menuBtn.on("click",function(){_this.toggle(!0)}),this.mapBtn.on("click",function(){_this.toggle(!1),_this.mapsvg.redraw()}),this.view.on("click.menu.mapsvg",".mapsvg-directory-item",function(e){e.preventDefault();var objID=$(this).data("object-id"),regions,marker,detailsViewObject,eventObject,skipPopover,events;_this.deselectItems(),_this.selectItems(objID),MapSVG.isPhone&&_this.mapsvg.getData().options.menu.showMapOnClick&&_this.toggle(!1),"regions"==_this.mapsvg.getData().options.menu.source?(regions=[_this.mapsvg.getRegion(objID)],eventObject=regions[0],detailsViewObject=regions[0]):(detailsViewObject=_this.database.getLoadedObject(objID),eventObject=detailsViewObject,detailsViewObject.regions&&(regions=detailsViewObject.regions.map(function(e){return _this.mapsvg.getRegion(e.id)}).filter(function(e){return void 0!==e}))),detailsViewObject.location&&detailsViewObject.location.marker&&(marker=detailsViewObject.location.marker),_this.mapsvg.getData().options.actions.directoryItem.click.showDetails&&_this.mapsvg.loadDetailsView(detailsViewObject),regions&&0'+this.mapsvg.getData().options.menu.noResultsText+"
"),o.mapsvg.options.menu.categories.on&&(o.mapsvg.options.menu.categories.collapse&&1
'),this.contentView.find(".mapsvg-pagination-container").html(e)}}(jQuery),jQuery,MapSVG.FiltersController=function(e){MapSVG.DetailsController.call(this,e)},MapSVG.extend(MapSVG.FiltersController,MapSVG.DetailsController),jQuery,MapSVG.Location=function(e,t){this.img=e.img,this.setImage(this.img),this.lat=void 0!==e.lat?parseFloat(e.lat):void 0,this.lng=void 0!==e.lng?parseFloat(e.lng):void 0,this.x=void 0!==e.x?parseFloat(e.x):void 0,this.y=void 0!==e.y?parseFloat(e.y):void 0,this.address=new MapSVG.LocationAddress(e.address)},MapSVG.Location.prototype.setImage=function(e){var t=e.split("/").pop();-1!==e.indexOf("uploads")&&(t="uploads/"+t),this.img=t},MapSVG.Location.prototype.setLatLng=function(e){this.lat=e.lat,this.lng=e.lng},MapSVG.Location.prototype.__defineGetter__("markerImageUrl",function(){return this.img&&0===this.img.indexOf("uploads/")?MapSVG.urls.uploads+"markers/"+this.img.replace("uploads/",""):MapSVG.urls.root+"markers/"+(this.img||"_pin_default.png")}),MapSVG.Location.prototype.toJSON=function(){return{img:this.img,lat:this.lat,lng:this.lng,x:this.x,y:this.y,address:this.address}},jQuery,MapSVG.LocationAddress=function(e){for(var t in e)this[t]=e[t]},MapSVG.LocationAddress.prototype.__defineGetter__("state",function(){return"US"===this.country_short?this.administrative_area_level_1:null}),MapSVG.LocationAddress.prototype.__defineGetter__("state_short",function(){return"US"===this.country_short?this.administrative_area_level_1_short:null}),MapSVG.LocationAddress.prototype.__defineGetter__("county",function(){return"US"===this.country_short?this.administrative_area_level_2:null}),MapSVG.LocationAddress.prototype.__defineGetter__("zip",function(){return this.postal_code}),function($){MapSVG.Map=function(e,t){var o='
\n

This is the demo content of the Region %templateType%.

\n

Click on the following link to edit the content of this window: Menu > Templates > Region %templateType%.

\n

More information about templates: mapsvg.com/docs/map-editor/templates

\n
\n
\n\n\x3c!-- Region fields are available in this template --\x3e\n
{{#if title}} {{title}} {{else}} {{id}} {{/if}}
\n

Status: {{status_text}}

\n\n\x3c!-- Show all linked Database Objects: --\x3e\n{{#each objects}}\n\n \x3c!-- DB Object are available inside of this block --\x3e\n\n
{{title}}
\n \x3c!-- When you need to render a field as HTML, use 3 curly braces instead of 2:--\x3e\n

{{{description}}}

\n

{{location.address.formatted}}

\n\n \x3c!-- Show all images: --\x3e\n {{#each images}}\n \x3c!-- Image fields "thumbnail", "medium", "full" --\x3e\n \x3c!-- are available in this block --\x3e\n \n {{/each}}\n\n{{/each}}',i='
\n

This is the demo content of the DB Object %templateType%.

\n

Click on the following link to edit the content of this window: Menu > Templates > Region %templateType%.

\n

More information about templates: mapsvg.com/docs/map-editor/templates

\n
\n
\n\n\x3c!-- DB Object fields are available in this template. --\x3e\n
{{title}}
\n\x3c!-- When you need to render a fields as HTML, use 3 curly braces instead of 2:--\x3e\n

{{{description}}}

\n

{{location.address.formatted}}

\n\n\x3c!-- Show all images: --\x3e\n{{#each images}}\n \x3c!-- Image fields "thumbnail", "medium", "full" --\x3e\n \x3c!-- are available in this block --\x3e\n \n{{/each}}\n\n\x3c!-- Show all linked Regions, comma-separated: --\x3e\n

Regions: \n {{#each regions}}\n \x3c!-- Region fields are available in this block --\x3e\n {{#if title}}\n {{title}}\n {{else}}\n {{id}}\n {{/if}}{{#unless @last}}, {{/unless}}\n {{/each}}\n

';this.defaults={markerLastID:0,regionLastID:0,dataLastID:1,disableAll:!1,width:null,height:null,lockAspectRatio:!1,padding:{top:0,left:0,right:0,bottom:0},maxWidth:null,maxHeight:null,minWidth:null,minHeight:null,loadingText:"Loading map...",colorsIgnore:!1,colors:{baseDefault:"#000000",background:"#eeeeee",selected:40,hover:20,directory:"#fafafa",detailsView:"",status:{},clusters:"",clustersBorders:"",clustersText:"",clustersHover:"",clustersHoverBorders:"",clustersHoverText:"",markers:{base:{opacity:100,saturation:100},hovered:{opacity:100,saturation:100},unhovered:{opacity:40,saturation:100},active:{opacity:100,saturation:100},inactive:{opacity:40,saturation:100}}},regions:{},clustering:{on:!1},viewBox:[],cursor:"default",manualRegions:!1,onClick:null,mouseOver:null,mouseOut:null,menuOnClick:null,beforeLoad:null,afterLoad:null,zoom:{on:!0,limit:[0,10],delta:2,buttons:{on:!0,location:"right"},mousewheel:!0,fingers:!0},scroll:{on:!0,limit:!1,background:!1,spacebar:!1},responsive:!0,tooltips:{on:!1,position:"bottom-right",template:"",maxWidth:"",minWidth:100},popovers:{on:!1,position:"top",template:"",centerOn:!0,width:300,maxWidth:50,maxHeight:50},multiSelect:!1,regionStatuses:{1:{label:"Enabled",value:"1",color:"",disabled:!1},0:{label:"Disabled",value:"0",color:"",disabled:!0}},events:{afterLoad:"function(){\n // var mapsvg = this;\n // var regions = mapsvg.regions;\n // var dbObjects = mapsvg.database.getLoaded();\n}",beforeLoad:"function(){\n // var mapsvg = this;\n // var settings = mapsvg.options;\n // console.log(settings);\n}",databaseLoaded:"function (){\n // var mapsvg = this;\n // var dbObjects = mapsvg.database.getLoaded();\n}","click.region":"function (e, mapsvg){\n // var region = this;\n // console.log(region);\n}","mouseover.region":"function (e, mapsvg){\n // var region = this;\n // console.log(region);\n}","mouseout.region":"function (e, mapsvg){\n // var region = this;\n // console.log(region);\n}","click.marker":"function (e, mapsvg){\n // var marker = this;\n // console.log(marker);\n}","mouseover.marker":"function (e, mapsvg){\n // var marker = this;\n // console.log(marker);\n}","mouseout.marker":"function (e, mapsvg){\n // var marker = this;\n // console.log(marker);\n}","click.directoryItem":"function (e, regionOrObject, mapsvg){\n // var itemjQueryObject = this;\n}","mouseover.directoryItem":"function (e, regionOrObject, mapsvg){\n // var itemjQueryObject = this;\n}","mouseout.directoryItem":"function (e, regionOrObject, mapsvg){\n // var itemjQueryObject = this;\n}","shown.popover":"function (mapsvg){\n // var popoverjQueryObject = this;\n}","closed.popover":"function (mapsvg){\n // var popoverjQueryObject = this;\n}","closed.detailsView":"function (mapsvg){\n // var detailsjQueryObject = this;\n}","shown.detailsView":"function (mapsvg){\n // var detailsjQueryObject = this;\n}"},css:"#mapsvg-map-%id% .mapsvg-tooltip {\n\n}\n#mapsvg-map-%id% .mapsvg-popover {\n\n}\n#mapsvg-map-%id% .mapsvg-details-container {\n\n}\n#mapsvg-map-%id% .mapsvg-directory-item {\n\n}\n#mapsvg-map-%id% .mapsvg-region-label {\n /* background-color: rgba(255,255,255,.6); */\n font-size: 11px;\n padding: 3px 5px;\n border-radius: 4px;\n}\n#mapsvg-map-%id% .mapsvg-marker-label {\n padding: 3px 5px;\n /*\n border-radius: 4px;\n background-color: white;\n margin-top: -4px;\n */\n}\n#mapsvg-map-%id% .mapsvg-filters-wrap {\n\n}\n\n\n\n\n\n\n",templates:{popoverRegion:o.replace(/%templateType%/g,"Popover").replace(/%templateTypeSnake%/g,"popover"),popoverMarker:i.replace(/%templateType%/g,"Popover").replace(/%templateTypeSnake%/g,"popover"),tooltipRegion:"\x3c!-- Region fields are available in this template --\x3e\n{{id}} - {{title}}",tooltipMarker:"\x3c!-- DB Object fields are available in this template --\x3e\n{{title}}",directoryItem:"\x3c!-- If Directory Source = Database: DB Object fields are available in this template --\x3e\n\x3c!-- If Directory Source = Regions: Region fields are available in this template --\x3e\n{{title}}",directoryCategoryItem:'\x3c!-- Available fields: "label", "value", "counter" --\x3e\n{{label}}\n{{counter}}\n',detailsView:i.replace(/%templateType%/g,"Details View").replace(/%templateTypeSnake%/g,"detailsView"),detailsViewRegion:o.replace(/%templateType%/g,"Details View").replace(/%templateTypeSnake%/g,"detailsView"),labelMarker:"\x3c!-- DB Object fields are available in this template --\x3e\n{{title}}",labelRegion:"\x3c!-- Region fields are available in this template --\x3e\n{{title}}",labelLocation:"You are here!"},gauge:{on:!1,labels:{low:"low",high:"high"},colors:{lowRGB:null,highRGB:null,low:"#550000",high:"#ee0000"},min:0,max:0},filters:{on:!0,source:"database",location:"header",modalLocation:"mapContainer",width:"100%",hide:!1,buttonText:"Filters",clearButtonText:"Clear all",clearButton:!1,padding:""},menu:{on:!1,hideOnMobile:!0,location:"leftSidebar",locationMobile:"leftSidebar",search:!1,containerId:"",searchPlaceholder:"Search...",searchFallback:!1,source:"database",showFirst:"map",showMapOnClick:!0,minHeight:"400",sortBy:"id",sortDirection:"desc",categories:{on:!1,groupBy:"",hideEmpty:!0,collapse:!0,collapseOther:!0},clickActions:{region:"default",marker:"default",directoryItem:{triggerClick:!0,showPopover:!1,showDetails:!0}},detailsViewLocation:"overDirectory",noResultsText:"No results found",filterout:{field:"",cond:"=",val:""}},database:{pagination:{on:!0,perpage:30,next:"Next",prev:"Prev.",showIn:"directory"},loadOnStart:!0,table:""},actions:{map:{afterLoad:{selectRegion:!1}},region:{click:{addIdToUrl:!1,showDetails:!0,showDetailsFor:"region",filterDirectory:!1,loadObjects:!1,showPopover:!1,showPopoverFor:"region",goToLink:!1,linkField:"Region.link"},touch:{showPopover:!1}},marker:{click:{showDetails:!0,showPopover:!1,goToLink:!1,linkField:"Object.link"},touch:{showPopover:!1}},directoryItem:{click:{showDetails:!0,showPopover:!1,goToLink:!1,selectRegion:!0,fireRegionOnClick:!0,linkField:"Object.link"},hover:{centerOnMarker:!1}}},detailsView:{location:"mapContainer",containerId:"",width:"100%",mobileFullscreen:!0},mobileView:{labelMap:"Map",labelList:"List",labelClose:"Close"},googleMaps:{on:!1,apiKey:"",loaded:!1,center:"auto",type:"roadmap",minZoom:1,style:"default",styleJSON:[]},groups:[],floors:[],layersControl:{on:!1,position:"top-left",label:"Show on map",expanded:!0,maxHeight:"100%"},floorsControl:{on:!1,position:"top-left",label:"Floors",expanded:!1,maxHeight:"100%"},containers:{leftSidebar:{on:!1,width:"250px"},rightSidebar:{on:!1,width:"250px"},header:{on:!0,height:"auto"},footer:{on:!1,height:"auto"}},labelsMarkers:{on:!1},labelsRegions:{on:!1},svgFileVersion:1,fitMarkers:!1,fitMarkersOnStart:!1,controls:{location:"right",zoom:!0,zoomReset:!1,userLocation:!1}},this.markerOptions={src:MapSVG.urls.root+"markers/pin1_red.png"},this.init(t,$("#"+e))},MapSVG.Map.prototype={setMarkersClickAsLink:function(){var t=this;this.database.loadSchema().done(function(e){e&&e.forEach(function(e){"marker"==e.type&&(t.markerIsLink=MapSVG.parseBoolean(e.isLink),t.markerUrlField=e.urlField)})})},setGroups:function(){var o=this;o.groups=o.options.groups,o.groups.forEach(function(t){t.objects&&t.objects.length&&t.objects.forEach(function(e){o.$svg.find("#"+e.value).toggle(t.visible)})})},setLayersControl:function(e){var o=this;e&&$.extend(!0,o.options.layersControl,e),o.options.layersControl.on?(o.$layersControl||(o.$layersControl=$('
'),o.$layersControlLabel=$('
').appendTo(o.$layersControl),o.$layersControlListWrap=$('
').appendTo(o.$layersControl),o.$layersControlListNano=$('
').appendTo(o.$layersControlListWrap),o.$layersControlList=$('
').appendTo(o.$layersControlListNano),o.$layersControl.appendTo(o.$mapContainer)),o.$layersControl.show(),o.$layersControlLabel.html(o.options.layersControl.label),o.$layersControlList.empty(),o.$layersControl.removeClass("mapsvg-top-left mapsvg-top-right mapsvg-bottom-left mapsvg-bottom-right"),o.$layersControl.addClass("mapsvg-"+o.options.layersControl.position),o.options.menu.on&&!o.options.menu.customContainer&&-1!==o.options.layersControl.position.indexOf("left")&&o.$layersControl.css("left",o.options.menu.width),o.$layersControl.css({"max-height":o.options.layersControl.maxHeight}),o.options.groups.forEach(function(e){$('
").appendTo(o.$layersControlList)}),o.$layersControlListNano.nanoScroller({preventPageScrolling:!0,iOSNativeScrolling:!0}),o.$layersControl.off(),o.$layersControl.on("click",".mapsvg-layers-item",function(){var t=$(this).data("group-id"),e=$(this).find("input");e.prop("checked",!e.prop("checked")),o.options.groups.forEach(function(e){e.id===t&&(e.visible=!e.visible)}),o.setGroups()}),o.$layersControlLabel.on("click",function(){o.$layersControl.toggleClass("closed")}),o.$layersControl.toggleClass("closed",!o.options.layersControl.expanded)):o.$layersControl&&o.$layersControl.hide()},setFloorsControl:function(e){var t=this;e&&$.extend(!0,t.options.floorsControl,e),t.options.floorsControl.on?(t.$floorsControl||(t.$floorsControl=$('
'),t.$floorsControlLabel=$('
').appendTo(t.$floorsControl),t.$floorsControlListWrap=$('
').appendTo(t.$floorsControl),t.$floorsControlListNano=$('
').appendTo(t.$floorsControlListWrap),t.$floorsControlList=$('
').appendTo(t.$floorsControlListNano),t.$floorsControl.appendTo(t.$map)),t.$floorsControlLabel.html(t.options.floorsControl.label),t.$floorsControlList.empty(),t.$floorsControl.removeClass("mapsvg-top-left mapsvg-top-right mapsvg-bottom-left mapsvg-bottom-right"),t.$floorsControl.addClass("mapsvg-"+t.options.floorsControl.position),t.$floorsControl.css({"max-height":t.options.floorsControl.maxHeight}),t.options.floors.forEach(function(e){$('
").appendTo(t.$floorsControlList)}),t.$floorsControlListNano.nanoScroller({preventPageScrolling:!0,iOSNativeScrolling:!0}),t.$floorsControl.off(),t.$floorsControl.on("click",".mapsvg-floors-item",function(){var e=$(this).data("floor-id");t.setFloor(e)}),t.$floorsControlLabel.on("click",function(){t.$floorsControl.toggleClass("closed")}),t.$floorsControl.toggleClass("closed",!t.options.floorsControl.expanded)):t.$floorsControl&&t.$floorsControl.hide()},setFloor:function(e){var t=this;t.$floorsControl.find(".mapsvg-floors-item").toggleClass("active",!1),t.$floorsControl.find('[data-floor-id="'+e+'"]').toggleClass("active",!0),t.options.floors.forEach(function(e){t.$svg.find("#"+e.object_id).hide()});var o=t.$svg.find("#"+e);o.show();e=(o=new MapObject(o,t)).getBBox();t._viewBox=e,t.setViewBox(t._viewBox),t.zoomLevels=null,t.zoomLevel=1,t.setZoom(),o=null},getGroupSelectOptions:function(){var t,e=[],o=[],i=[];return this.$svg.find("g").each(function(e){(t=$(this)[0].getAttribute("id"))&&o.push({label:t,value:t})}),e.push({title:"SVG Layers / Groups",options:o}),this.$svg.find("path,ellipse,circle,polyline,polygon,rectangle,img,text").each(function(e){(t=$(this)[0].getAttribute("id"))&&i.push({label:t,value:t})}),e.push({title:"Other SVG objects",options:i}),e},loadDataObjects:function(e){return this.database.getAll(e)},loadDirectory:function(){var e=this;if("database"===e.options.menu.source&&!e.database.loaded)return!1;e.options.menu.on&&e.controllers.directory.loadItemsToDirectory(),e.setPagination()},setPagination:function(){var e=this;e.$pagerMap&&e.$pagerMap.empty().remove(),e.$pagerDir&&e.$pagerDir.empty().remove(),e.options.database.pagination.on&&0!==e.options.database.pagination.perpage&&(e.$directory.toggleClass("mapsvg-with-pagination",-1!==["directory","both"].indexOf(e.options.database.pagination.showIn)),e.$map.toggleClass("mapsvg-with-pagination",-1!==["map","both"].indexOf(e.options.database.pagination.showIn)),e.options.menu.on&&(e.$pagerDir=e.getPagination(),e.controllers.directory.addPagination(e.$pagerDir)),e.$pagerMap=e.getPagination(),e.$map.append(e.$pagerMap))},getPagination:function(t){var o=this,e=$('');return o.database.onFirstPage()&&o.database.onLastPage()?e.hide():(e.find(".mapsvg-prev").removeClass("disabled"),e.find(".mapsvg-first").removeClass("disabled"),e.find(".mapsvg-last").removeClass("disabled"),e.find(".mapsvg-next").removeClass("disabled"),o.database.onLastPage()&&e.find(".mapsvg-next").addClass("disabled")&&e.find(".mapsvg-last").addClass("disabled"),o.database.onFirstPage()&&e.find(".mapsvg-prev").addClass("disabled")&&e.find(".mapsvg-first").addClass("disabled")),e.on("click",".mapsvg-next:not(.disabled)",function(e){e.preventDefault(),o.database.onLastPage()||o.database.getAll({page:o.database.query.page+1}).done(function(){t&&t()})}).on("click",".mapsvg-prev:not(.disabled)",function(e){e.preventDefault(),o.database.onFirstPage()||o.database.getAll({page:o.database.query.page-1}).done(function(){t&&t()})}).on("click",".mapsvg-first:not(.disabled)",function(e){e.preventDefault(),o.database.onFirstPage()||o.database.getAll({page:1}).done(function(){t&&t()})}).on("click",".mapsvg-last:not(.disabled)",function(e){e.preventDefault(),o.database.onLastPage()||o.database.getAll({lastpage:!0}).done(function(){t&&t()})}),e},deleteMarkers:function(){for(;this.markers.length;)this.markers[0].delete&&this.markers[0].delete()},deleteClusters:function(){var e=this;if(e.markersClusters)for(;e.markersClusters.length;)e.markersClusters[0].destroy&&e.markersClusters[0].destroy(),e.markersClusters.splice(0,1);e.clusters={},e.markersClusters=[],e.markersClustersDict={}},addLocations:function(){var t=this;t.firstDataLoad=void 0===t.firstDataLoad;var e,o=this.database.getLoaded(),i=this.database.getSchemaFieldByType("location");if(!i)return!1;(i=i.name)&&(t.firstDataLoad&&(e=this.convertGeoToSVG([this.geoViewBox.topLat,this.geoViewBox.rightLon]),this.yShift=e[1]-this.svgDefault.viewBox[1],t.setMarkerImagesDependency()),t.deleteMarkers(),t.deleteClusters(),t.clusters={},t.clustersByZoom=[],t.markersClusters=[],t.markersClustersDict={},o&&0
')),t.$details.toggleClass("mapsvg-details-container-relative",!(MapSVG.isPhone&&t.options.detailsView.mobileFullscreen||t.shouldBeScrollable(t.options.detailsView.location))),"custom"===t.options.detailsView.location?$("#"+t.options.detailsView.containerId).append(t.$details):(MapSVG.isPhone&&t.options.detailsView.mobileFullscreen?($("body").append(t.$details),t.$details.addClass("mapsvg-container-fullscreen")):t["$"+t.options.detailsView.location].append(t.$details),t.options.detailsView.margin&&t.$details.css("margin",t.options.detailsView.margin),t.$details.css("width",t.options.detailsView.width))},setMobileView:function(e){$.extend(!0,this.options.mobileView,e)},attachDataToRegions:function(e){var o=this;o.regions.forEach(function(e){e.objects=[]}),o.database.getLoaded().forEach(function(t,e){t.regions&&t.regions.length&&"object"==typeof t.regions&&t.regions.forEach(function(e){e=o.getRegion(e.id);e&&e.objects.push(t)})})},setTemplates:function(e){var t,o=this;for(t in o.templates=o.templates||{},e)if(null!=t){o.options.templates[t]=e[t];var i=o.options.templates[t];"directoryItem"!=t&&"directoryCategoryItem"!=t||(i='{{#each items}}
'+o.options.templates.directoryItem+"
{{/each}}",o.options.menu.categories&&o.options.menu.categories.on&&o.options.menu.categories.groupBy&&(i='{{#each items}}{{#with category}}
'+o.options.templates.directoryCategoryItem+'
{{/with}}'+i+"
{{/each}}"),t="directory");try{o.templates[t]=Handlebars.compile(i,{strict:!1})}catch(e){console.error(e),o.templates[t]=Handlebars.compile("",{strict:!1})}o.editMode&&("directory"==t||"directoryCategoryItem"==t)&&o.controllers&&o.controllers.directory&&(o.controllers.directory.templates.main=o.templates[t],o.loadDirectory())}},setRegionStatus:function(e,t){(t=this.regionsDatabase.getSchemaField("status").optionsDict[t]).disabled?e.setDisabled(!0):e.setDisabled(!1),t.color?e.setFill(t.color):e.setFill()},update:function(e){var t,o,i=this;for(t in e)"regions"==t?$.each(e.regions,function(e,t){var o=i.getRegion(e);o&&o.update(t),null!=t.gaugeValue&&(i.updateGaugeMinMax(),i.regionsRedrawColors()),null!=t.disabled&&(i.deselectRegion(o),i.options.regions[e]=i.options.regions[e]||{},i.options.regions[e].disabled=o.disabled)}):"markers"==t?$.each(e.markers,function(e,t){e=i.getMarker(e);e&&e.update(t)}):(o="set"+MapSVG.ucfirst(t),"function"==typeof i[o]?this[o](e[t]):i.options[t]=e[t])},setTitle:function(e){e&&(this.options.title=e)},setExtension:function(e){e?this.options.extension=e:delete this.options.extension},setDisableLinks:function(e){(e=MapSVG.parseBoolean(e))?this.$map.on("click.a.mapsvg","a",function(e){e.preventDefault()}):this.$map.off("click.a.mapsvg"),this.disableLinks=e},setLoadingText:function(e){this.options.loadingText=e},setLockAspectRatio:function(e){this.options.lockAspectRatio=MapSVG.parseBoolean(e)},setOnClick:function(e){this.options.onClick=e||void 0},setMouseOver:function(e){this.options.mouseOver=e||void 0},setMouseOut:function(e){this.options.mouseOut=e||void 0},setBeforeLoad:function(e){this.options.beforeLoad=e||void 0},setAfterLoad:function(e){this.options.afterLoad=e||void 0},setPopoverShown:function(e){this.options.popoverShown=e||void 0},setMarkerEditHandler:function(e){this.markerEditHandler=e},setRegionChoroplethField:function(e){this.options.regionChoroplethField=e,this.redrawGauge()},setRegionEditHandler:function(e){this.regionEditHandler=e},setDisableAll:function(e){e=MapSVG.parseBoolean(e),$.extend(!0,this.options,{disableAll:e}),this.$map.toggleClass("mapsvg-disabled-regions",e)},setRegionStatuses:function(e){var t=this;t.options.regionStatuses=e;var o,i={};for(o in t.options.regionStatuses)i[o]=t.options.regionStatuses[o].color.length?t.options.regionStatuses[o].color:void 0;t.setColors({status:i})},setColorsIgnore:function(e){this.options.colorsIgnore=MapSVG.parseBoolean(e),this.regionsRedrawColors()},fixColorHash:function(e){var t=new RegExp(/^([0-9a-f]{3}|[0-9a-f]{6})$/i);return e=e&&null!==e.match(t)?"#"+e:e},setColors:function(e){var t,o=this;for(t in e)if("status"===t)for(var i in e[t])o.fixColorHash(e[t][i]);else"string"==typeof e[t]&&o.fixColorHash(e[t]);if($.extend(!0,o.options,{colors:e}),e&&e.status&&(o.options.colors.status=e.status),o.options.colors.markers)for(var s in o.options.colors.markers)for(var a in o.options.colors.markers[s])o.options.colors.markers[s][a]=parseInt(o.options.colors.markers[s][a]);o.options.colors.background&&o.$map.css({background:o.options.colors.background}),o.options.colors.hover&&(o.options.colors.hover=o.options.colors.hover==""+parseInt(o.options.colors.hover)?parseInt(o.options.colors.hover):o.options.colors.hover),o.options.colors.selected&&(o.options.colors.selected=o.options.colors.selected==""+parseInt(o.options.colors.selected)?parseInt(o.options.colors.selected):o.options.colors.selected),o.$leftSidebar.css({"background-color":o.options.colors.leftSidebar}),o.$rightSidebar.css({"background-color":o.options.colors.rightSidebar}),o.$header.css({"background-color":o.options.colors.header}),o.$footer.css({"background-color":o.options.colors.footer}),o.$details&&void 0!==o.options.colors.detailsView&&o.$details.css({"background-color":o.options.colors.detailsView}),o.$directory&&void 0!==o.options.colors.directory&&o.$directory.css({"background-color":o.options.colors.directory}),o.$filtersModal&&void 0!==o.options.colors.modalFilters&&o.$filtersModal.css({"background-color":o.options.colors.modalFilters}),o.$filters&&o.options.colors.directorySearch?o.$filters.css({"background-color":o.options.colors.directorySearch}):o.$filters&&o.$filters.css({"background-color":""}),o.clusterCSS=o.clusterCSS||$("").appendTo("body");var n="";o.options.colors.clusters&&(n+="background-color: "+o.options.colors.clusters+";"),o.options.colors.clustersBorders&&(n+="border-color: "+o.options.colors.clustersBorders+";"),o.options.colors.clustersText&&(n+="color: "+o.options.colors.clustersText+";"),o.clusterCSS.html(".mapsvg-marker-cluster {"+n+"}"),o.clusterHoverCSS=o.clusterHoverCSS||$("").appendTo("head");n="";o.options.colors.clustersHover&&(n+="background-color: "+o.options.colors.clustersHover+";"),o.options.colors.clustersHoverBorders&&(n+="border-color: "+o.options.colors.clustersHoverBorders+";"),o.options.colors.clustersHoverText&&(n+="color: "+o.options.colors.clustersHoverText+";"),o.clusterHoverCSS.html(".mapsvg-marker-cluster:hover {"+n+"}"),o.markersCSS=o.markersCSS||$("").appendTo("head");n=".mapsvg-with-marker-active .mapsvg-marker {\n opacity: "+o.options.colors.markers.inactive.opacity/100+";\n -webkit-filter: grayscale("+(100-o.options.colors.markers.inactive.saturation)+"%);\n filter: grayscale("+(100-o.options.colors.markers.inactive.saturation)+"%);\n}\n.mapsvg-with-marker-active .mapsvg-marker-active {\n opacity: "+o.options.colors.markers.active.opacity/100+";\n -webkit-filter: grayscale("+(100-o.options.colors.markers.active.saturation)+"%);\n filter: grayscale("+(100-o.options.colors.markers.active.saturation)+"%);\n}\n.mapsvg-with-marker-hover .mapsvg-marker {\n opacity: "+o.options.colors.markers.unhovered.opacity/100+";\n -webkit-filter: grayscale("+(100-o.options.colors.markers.unhovered.saturation)+"%);\n filter: grayscale("+(100-o.options.colors.markers.unhovered.saturation)+"%);\n}\n.mapsvg-with-marker-hover .mapsvg-marker-hover {\n opacity: "+o.options.colors.markers.hovered.opacity/100+";\n -webkit-filter: grayscale("+(100-o.options.colors.markers.hovered.saturation)+"%);\n filter: grayscale("+(100-o.options.colors.markers.hovered.saturation)+"%);\n}\n";o.markersCSS.html(n),$.each(o.options.colors,function(e,t){null!==t&&""!=t||delete o.options.colors[e]}),o.regionsRedrawColors()},setTooltips:function(e){var i=this;void 0!==e.on&&(e.on=MapSVG.parseBoolean(e.on)),$.extend(!0,i.options,{tooltips:e}),i.tooltip=i.tooltip||{posOriginal:{},posShifted:{},posShiftedPrev:{},mirror:{}},i.tooltip.posOriginal={},i.tooltip.posShifted={},i.tooltip.posShiftedPrev={},i.tooltip.mirror={},i.tooltip.container?i.tooltip.container[0].className=i.tooltip.container[0].className.replace(/(^|\s)mapsvg-tt-\S+/g,""):(i.tooltip.container=$("
").addClass("mapsvg-tooltip"),i.$map.append(i.tooltip.container));e=i.options.tooltips.position.split("-");-1==e[0].indexOf("top")&&-1==e[0].indexOf("bottom")||(i.tooltip.posOriginal.topbottom=e[0]),-1==e[0].indexOf("left")&&-1==e[0].indexOf("right")||(i.tooltip.posOriginal.leftright=e[0]),e[1]&&(i.tooltip.posOriginal.leftright=e[1]);e="mousemove.tooltip.mapsvg-"+i.$map.attr("id");i.tooltip.container.addClass("mapsvg-tt-"+i.options.tooltips.position),i.tooltip.container.css({"min-width":i.options.tooltips.minWidth+"px","max-width":i.options.tooltips.maxWidth+"px"}),$("body").off(e).on(e,function(e){MapSVG.mouse=MapSVG.mouseCoords(e),i.tooltip.container[0].style.left=e.clientX+$(window).scrollLeft()-i.$map.offset().left+"px",i.tooltip.container[0].style.top=e.clientY+$(window).scrollTop()-i.$map.offset().top+"px";var t={x:e.clientX+$(window).scrollLeft(),y:e.clientY+$(window).scrollTop()},o=i.tooltip.container[0].getBoundingClientRect(),e=i.$wrap[0].getBoundingClientRect(),o={top:o.top+$(window).scrollTop(),bottom:o.bottom+$(window).scrollTop(),left:o.left+$(window).scrollLeft(),right:o.right+$(window).scrollLeft(),width:o.width,height:o.height};(e={top:e.top+$(window).scrollTop(),bottom:e.bottom+$(window).scrollTop(),left:e.left+$(window).scrollLeft(),right:e.right+$(window).scrollLeft(),width:e.width,height:e.height}).righti.tooltip.mirror.top?(i.tooltip.mirror.top=!1,delete i.tooltip.posShifted.topbottom):i.tooltip.mirror.bottom&&t.yi.tooltip.mirror.left?(i.tooltip.mirror.left=!1,delete i.tooltip.posShifted.leftright):i.tooltip.mirror.right&&t.x").addClass("mapsvg-popover"),t.layers.popovers.append(t.$popover)),t.$popover.css({width:t.options.popovers.width+("auto"==t.options.popovers.width?"":"px"),"max-width":t.options.popovers.maxWidth+"%","max-height":t.options.popovers.maxHeight*t.$wrap.outerHeight()/100+"px"}),t.options.popovers.mobileFullscreen&&MapSVG.isPhone&&($("body").toggleClass("mapsvg-fullscreen-popovers",!0),t.$popover.appendTo("body"))},setRegionPrefix:function(e){this.options.regionPrefix=e},setInitialViewBox:function(e){var t=this;"string"==typeof e&&(e=e.trim().split(" ")),t._viewBox=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])],t.options.googleMaps.on&&(t.options.googleMaps.center=t.googleMaps.map.getCenter().toJSON(),t.options.googleMaps.zoom=t.googleMaps.map.getZoom()),t.zoomLevel=0},setViewBoxOnStart:function(){var e=this;e.viewBoxFull=e.svgDefault.viewBox,e.viewBoxFake=e.viewBox,e.whRatioFull=e.viewBoxFull[2]/e.viewBox[2],e.$svg[0].setAttribute("viewBox",e.viewBoxFull.join(" ")),(MapSVG.device.ios||MapSVG.device.android)&&1500").addClass("mapsvg-buttons"),i=$("
").addClass("mapsvg-btn-group").appendTo(o),(s=$("
").addClass("mapsvg-btn-map mapsvg-in")).on("touchend click",function(e){e.cancelable&&e.preventDefault(),e.stopPropagation(),t.zoomIn()}),(a=$("
").addClass("mapsvg-btn-map mapsvg-out")).on("touchend click",function(e){e.cancelable&&e.preventDefault(),e.stopPropagation(),t.zoomOut()}),i.append(s).append(a),(e=$("
").addClass("mapsvg-btn-map mapsvg-btn-location")).on("touchend click",function(e){e.cancelable&&e.preventDefault(),e.stopPropagation(),t.showUserLocation(function(e){t.options.scroll.on&&t.centerOn(e.marker)})}),e.html(''),(s=$("
").addClass("mapsvg-btn-group").appendTo(o)).append(e),(a=$("
").html('').addClass("mapsvg-btn-map mapsvg-btn-zoom-reset")).on("touchend click",function(e){e.cancelable&&e.preventDefault(),e.stopPropagation(),t.viewBoxReset(!0)}),(e=$("
").addClass("mapsvg-btn-group").appendTo(o)).append(a),t.$controls=o,t.controls={zoom:i,userLocation:s,zoomReset:e},t.$map.append(t.$controls)),t.controls.zoom.toggle(t.options.controls.zoom),t.controls.userLocation.toggle(t.options.controls.userLocation),t.controls.zoomReset.toggle(t.options.controls.zoomReset),t.$controls.removeClass("left"),t.$controls.removeClass("right"),"right"==n&&t.$controls.addClass("right")||"left"==n&&t.$controls.addClass("left")},setZoomLevels:function(){var e=this;e.zoomLevels={};for(var t=1,o=0;o<=20;o++)e.zoomLevels[o+""]={_scale:t,viewBox:[0,0,e._viewBox[2]/t,e._viewBox[3]/t]},t*=e.options.zoom.delta;for(t=1,o=0;-20<=o;o--)e.zoomLevels[o+""]={_scale:t,viewBox:[0,0,e._viewBox[2]/t,e._viewBox[3]/t]},t/=e.options.zoom.delta},setZoomButtons:function(){var e,t,o=this,i=o.options.zoom.buttons.location||"hide";o.zoomButtons||(e=$("
").addClass("mapsvg-buttons"),t=$("
").addClass("mapsvg-btn-group").appendTo(e),e.zoomIn=$("
").addClass("mapsvg-btn-map mapsvg-in"),e.zoomIn.on("touchend click",function(e){e.stopPropagation(),o.zoomIn()}),e.zoomOut=$("
").addClass("mapsvg-btn-map mapsvg-out"),e.zoomOut.on("touchend click",function(e){e.stopPropagation(),o.zoomOut()}),t.append(e.zoomIn).append(e.zoomOut),e.location=$("
").addClass("mapsvg-btn-map mapsvg-btn-location"),e.location.on("touchend click",function(e){e.stopPropagation(),o.showUserLocation(function(){o.options.scroll.on&&o.centerOn(location.marker)})}),e.append(e.location),e.location.html(''),o.zoomButtons=e,o.$map.append(o.zoomButtons)),o.zoomButtons.removeClass("left"),o.zoomButtons.removeClass("right"),"right"==i&&o.zoomButtons.addClass("right")||"left"==i&&o.zoomButtons.addClass("left"),o.options.zoom.on&&"hide"!=i?o.zoomButtons.show():o.zoomButtons.hide()},setManualRegions:function(e){this.options.manualRegions=MapSVG.parseBoolean(e)},setCursor:function(e){e="pointer"==e?"pointer":"default","pointer"==(this.options.cursor=e)?this.$map.addClass("mapsvg-cursor-pointer"):this.$map.removeClass("mapsvg-cursor-pointer")},setMultiSelect:function(e,t){this.options.multiSelect=MapSVG.parseBoolean(e),!1!==t&&this.deselectAllRegions()},setGauge:function(e){var t=this;null!=(e=e||t.options.gauge).on&&(e.on=MapSVG.parseBoolean(e.on)),$.extend(!0,t.options,{gauge:e});var o,i=!1;t.$gauge||(t.$gauge={},t.$gauge.gradient=$(" ").addClass("mapsvg-gauge-gradient"),t.setGaugeGradientCSS(),t.$gauge.container=$("
").addClass("mapsvg-gauge").hide(),t.$gauge.table=$(""),o=$(""),t.$gauge.labelLow=$(""),t.$gauge.labelHigh=$(""),o.append(t.$gauge.labelLow),o.append(t.$gauge.gradient),o.append(t.$gauge.labelHigh),t.$gauge.table.append(o),t.$gauge.container.append(t.$gauge.table),t.$map.append(t.$gauge.container)),!t.options.gauge.on&&t.$gauge.container.is(":visible")?(t.$gauge.container.hide(),i=!0):t.options.gauge.on&&!t.$gauge.container.is(":visible")&&(t.$gauge.container.show(),i=!0,t.regionsDatabase.on("change",function(){t.redrawGauge()})),e.colors&&(t.options.gauge.colors.lowRGB=MapSVG.tinycolor(t.options.gauge.colors.low).toRgb(),t.options.gauge.colors.highRGB=MapSVG.tinycolor(t.options.gauge.colors.high).toRgb(),t.options.gauge.colors.diffRGB={r:t.options.gauge.colors.highRGB.r-t.options.gauge.colors.lowRGB.r,g:t.options.gauge.colors.highRGB.g-t.options.gauge.colors.lowRGB.g,b:t.options.gauge.colors.highRGB.b-t.options.gauge.colors.lowRGB.b,a:t.options.gauge.colors.highRGB.a-t.options.gauge.colors.lowRGB.a},i=!0,t.$gauge&&t.setGaugeGradientCSS()),e.labels&&(t.$gauge.labelLow.html(t.options.gauge.labels.low),t.$gauge.labelHigh.html(t.options.gauge.labels.high)),i&&t.redrawGauge()},redrawGauge:function(){this.updateGaugeMinMax(),this.regionsRedrawColors()},updateGaugeMinMax:function(){var t=this;t.options.gauge.min=0,t.options.gauge.max=!1;var o=[];t.regions.forEach(function(e){e=e.data&&e.data[t.options.regionChoroplethField];null!=e&&parseFloat(o.push(e))}),0").appendTo("head"),t.liveCSS.html(t.options.css)},setFilters:function(e){var t=this;null!=(e=e||t.options.filters).on&&(e.on=MapSVG.parseBoolean(e.on)),null!=e.hide&&(e.hide=MapSVG.parseBoolean(e.hide)),$.extend(!0,t.options,{filters:e});-1===["leftSidebar","rightSidebar","header","footer","custom","mapContainer"].indexOf(t.options.filters.location)&&(t.options.filters.location="leftSidebar"),t.options.filters.on?(t.formBuilder&&t.formBuilder.destroy(),t.$filters||(t.$filters=$('
')),t.$filters.empty(),t.$filters.show(),t.$filters.css({"background-color":t.options.colors.directorySearch}),t.$filtersModal&&t.$filtersModal.css({width:t.options.filters.width}),"custom"===t.options.filters.location?(t.$filters.removeClass("mapsvg-filter-container-custom").addClass("mapsvg-filter-container-custom"),$("#"+t.options.filters.containerId).length?$("#"+t.options.filters.containerId).append(t.$filters):(t.$filters.hide(),console.error("MapSVG: filter container #"+t.options.filters.containerId+" does not exists"))):MapSVG.isPhone?(t.$header.append(t.$filters),t.setContainers({header:{on:!0}})):(e="$"+(MapSVG.isPhone?"header":t.options.filters.location),t.options.menu.on&&t.controllers.directory&&t.options.menu.location===t.options.filters.location?(t.controllers.directory.view.find(".mapsvg-directory-filter-wrap").append(t.$filters),t.controllers.directory.updateTopShift()):(t[e].append(t.$filters),t.controllers.directory&&t.controllers.directory.updateTopShift())),t.loadFiltersController(t.$filters,!1),t.updateFiltersState()):t.$filters&&(t.$filters.empty(),t.$filters.hide()),t.options.menu.on&&t.controllers.directory&&t.options.menu.location===t.options.filters.location&&t.controllers.directory.updateTopShift()},updateFiltersState:function(){var o=this;if(o.$filterTags&&o.$filterTags.empty(),o.options.filters&&o.options.filters.on||o.database.query.filters&&0'),o.$filters||(o.options.menu.on&&o.controllers.directory?(o.controllers.directory.toolbarView.append(o.$filterTags),o.controllers.directory.updateTopShift()):(o.$map.append(o.$filterTags),o.options.zoom.buttons.on&&(o.options.layersControl.on?"top-left"==o.options.layersControl.position?o.$filterTags.css({right:0,bottom:0}):o.$filterTags.css({bottom:0}):"left"==o.options.zoom.buttons.location&&o.$filterTags.css({right:0})))),o.$filterTags.on("click",".mapsvg-filter-delete",function(e){var t=$(this).data("filter");$(this).parent().remove(),o.database.query.filters[t]=null,delete o.database.query.filters[t],o.deselectAllRegions(),o.loadDataObjects()})),o.$filterTags.append('
'+(i?i+": ":"")+t+' ×
')))}},setContainers:function(e){var t,o=this;for(t in o.containersCreated||(o.$wrapAll=$('
').attr("id","mapsvg-map-"+this.id).attr("data-map-id",this.id),o.$wrap=$('
'),o.$containers={},o.$mapContainer=$('
'),o.$leftSidebar=$('
'),o.$rightSidebar=$('
'),o.$header=$('
'),o.$footer=$(''),o.$wrapAll.insertBefore(o.$map),o.$wrapAll.append(o.$header),o.$wrapAll.append(o.$wrap),o.$wrapAll.append(o.$footer),o.$mapContainer.append(o.$map),o.$wrap.append(o.$leftSidebar),o.$wrap.append(o.$mapContainer),o.$wrap.append(o.$rightSidebar),o.containersCreated=!0),e=e||o.options){void 0!==e[t].on&&(e[t].on=MapSVG.parseBoolean(e[t].on)),$contName="$"+t,e[t].width&&(("string"!=typeof e[t].width||-1===e[t].width.indexOf("px")&&-1===e[t].width.indexOf("%")&&"auto"!==e[t].width)&&(e[t].width=e[t].width+"px"),o[$contName].css({"flex-basis":e[t].width})),e[t].height&&(("string"!=typeof e[t].height||-1===e[t].height.indexOf("px")&&-1===e[t].height.indexOf("%")&&"auto"!==e[t].height)&&(e[t].height=e[t].height+"px"),o[$contName].css({"flex-basis":e[t].height,height:e[t].height})),$.extend(!0,o.options,{containers:e});var i=o.options.containers[t].on;MapSVG.isPhone&&o.options.menu.hideOnMobile&&o.options.menu.location===t&&-1!==["leftSidebar","rightSidebar"].indexOf(t)?i=!1:MapSVG.isPhone&&"custom"===o.options.menu.location&&-1!==["leftSidebar","rightSidebar"].indexOf(t)?(i=!1,o.$wrapAll.addClass("mapsvg-hide-map-list-buttons")):MapSVG.isPhone&&!o.options.menu.hideOnMobile&&o.options.menu.location===t&&-1!==["leftSidebar","rightSidebar"].indexOf(t)&&(o.$wrapAll.addClass("mapsvg-hide-map-list-buttons"),o.$wrapAll.addClass("mapsvg-directory-visible")),o[$contName].toggle(i)}o.setDetailsView()},shouldBeScrollable:function(e){switch(e){case"mapContainer":case"leftSidebar":case"rightSidebar":return!0;case"custom":return!1;case"header":case"footer":return!(!this.options.containers[e].height||"auto"===this.options.containers[e].height||"100%"===this.options.containers[e].height);default:return!1}},setDirectory:function(e){return this.setMenu(e)},setMenu:function(e){var t,o=this;null!=(e=e||o.options.menu).on&&(e.on=MapSVG.parseBoolean(e.on)),null!=e.search&&(e.search=MapSVG.parseBoolean(e.search)),null!=e.showMapOnClick&&(e.showMapOnClick=MapSVG.parseBoolean(e.showMapOnClick)),null!=e.searchFallback&&(e.searchFallback=MapSVG.parseBoolean(e.searchFallback)),null!=e.customContainer&&(e.customContainer=MapSVG.parseBoolean(e.customContainer)),$.extend(!0,o.options,{menu:e}),o.controllers=o.controllers||{},o.$directory||(o.$directory=$('
')),o.$directory.toggleClass("flex",o.shouldBeScrollable(o.options.menu.location)),o.options.menu.on?(o.controllers.directory?(o.controllers.directory.database="regions"===o.options.menu.source?o.regionsDatabase:o.database,o.controllers.directory.database.query.set({sort:[{field:o.options.menu.sortBy,order:o.options.menu.sortDirection}]}),o.controllers.directory.scrollable=o.shouldBeScrollable(o.options.menu.location),e.filterout&&((t={})[o.options.menu.filterout.field]=o.options.menu.filterout.val,o.controllers.directory.database.query.setFilterOut(t))):o.controllers.directory=new MapSVG.DirectoryController({container:o.$directory,data:o.getData(),template:o.templates.directory,mapsvg:o,filters:o.filters,database:"regions"===o.options.menu.source?o.regionsDatabase:o.database,scrollable:o.shouldBeScrollable(o.options.menu.location),events:{click:o.events["click.directoryItem"],mouseover:o.events["mouseover.directoryItem"],mouseout:o.events["mouseout.directoryItem"]}}),(MapSVG.isPhone&&o.options.menu.hideOnMobile?o.$leftSidebar:"custom"!==o.options.menu.location?o["$"+o.options.menu.location]:$("#"+o.options.menu.containerId)).append(o.$directory),o.options.colors.directory&&o.$directory.css({"background-color":o.options.colors.directory}),o.setFilters(),o.setTemplates({directoryItem:o.options.templates.directoryItem}),("regions"===o.options.menu.source&&o.regionsDatabase.loaded||"database"===o.options.menu.source&&o.database.loaded)&&(o.editMode&&(e.sortBy||e.sortDirection||e.filterout)&&o.controllers.directory.database.getAll(),o.loadDirectory())):(o.controllers.directory&&o.controllers.directory.destroy(),o.controllers.directory=null)},setDatabase:function(e){var t=this;(e=e||t.options.database).pagination&&(null!=e.pagination.on&&(e.pagination.on=MapSVG.parseBoolean(e.pagination.on)),null!=e.pagination.perpage&&(e.pagination.perpage=parseInt(e.pagination.perpage))),$.extend(!0,t.options,{database:e}),e.pagination&&(void 0!==e.pagination.on||e.pagination.perpage?(e={perpage:t.options.database.pagination.on?t.options.database.pagination.perpage:0},t.database.getAll(e)):t.setPagination())},setGoogleMaps:function(e){var t,o,a=this;function i(e,t){this.bounds_=e,this.map_=t,this.setMap(t),this.prevCoords={sw:{x:0,y:0},sw2:{x:0,y:0},ne:{x:0,y:0},ne2:{x:0,y:0}}}null!=(e=e||a.options.googleMaps).on&&(e.on=MapSVG.parseBoolean(e.on)),a.googleMaps||(a.googleMaps={loaded:!1,initialized:!1,map:null}),$.extend(!0,a.options,{googleMaps:e}),a.options.googleMaps.on?(a.$map.toggleClass("mapsvg-with-google-map",!0),MapSVG.googleMapsApiLoaded?a.googleMaps.map?(a.$map.toggleClass("mapsvg-with-google-map",!0),a.$googleMaps&&a.$googleMaps.show(),e.type&&a.googleMaps.map.setMapTypeId(e.type)):(a.$googleMaps=$('
').prependTo(a.$map),a.$googleMaps.css({position:"absolute",top:0,left:0,bottom:0,right:0,"z-index":"0"}),a.googleMaps.map=new google.maps.Map(a.$googleMaps[0],{mapTypeId:e.type,fullscreenControl:!1,keyboardShortcuts:!1,mapTypeControl:!1,scaleControl:!1,scrollwheel:!1,streetViewControl:!1,zoomControl:!1,styles:e.styleJSON}),(i.prototype=new google.maps.OverlayView).onAdd=function(){var e=document.createElement("div");e.style.borderStyle="none",e.style.borderWidth="0px",e.style.position="absolute",this.div_=e,this.getPanes().overlayLayer.appendChild(e)},i.prototype.draw=function(e){if(!a.isScrolling){var t=this.getProjection();if(t){var o=this.bounds_.getSouthWest(),i=this.bounds_.getNorthEast(),s={};s.sw=t.fromLatLngToDivPixel(o),s.ne=t.fromLatLngToDivPixel(i),s.sw2=t.fromLatLngToContainerPixel(o),s.ne2=t.fromLatLngToContainerPixel(i);t=t.getWorldWidth();this.prevCoords.sw&&s.ne.xMath.abs(this.prevCoords.ne.x-s.ne.x)?s.sw.x=s.sw.x-t:s.ne.x=s.ne.x+t,Math.abs(this.prevCoords.sw2.x-s.sw2.x)>Math.abs(this.prevCoords.ne2.x-s.ne2.x)?s.sw2.x=s.sw2.x-t:s.ne2.x=s.ne2.x+t),this.prevCoords;t=((this.prevCoords=s).ne2.x-s.sw2.x)/a.svgDefault.viewBox[2],t=[a.svgDefault.viewBox[0]-s.sw2.x/t,a.svgDefault.viewBox[1]-s.ne2.y/t,a.$map.width()/t,a.$map.outerHeight()/t];a.setViewBox(t)}}},t=new google.maps.LatLng(a.geoViewBox.bottomLat,a.geoViewBox.leftLon),o=new google.maps.LatLng(a.geoViewBox.topLat,a.geoViewBox.rightLon),e=new google.maps.LatLngBounds(t,o),a.googleMaps.overlay=new i(e,a.googleMaps.map),a.options.googleMaps.center&&a.options.googleMaps.zoom?(a.googleMaps.map.setZoom(a.options.googleMaps.zoom),a.options.googleMaps.center.lat=parseFloat(a.options.googleMaps.center.lat),a.options.googleMaps.center.lng=parseFloat(a.options.googleMaps.center.lng),a.googleMaps.map.setCenter(a.options.googleMaps.center)):(t=new google.maps.LatLng(a.geoViewBox.bottomLat,a.geoViewBox.leftLon),o=new google.maps.LatLng(a.geoViewBox.topLat,a.geoViewBox.rightLon),e=new google.maps.LatLngBounds(t,o),a.googleMaps.map.fitBounds(e,0)),a.options.googleMaps.initialized=!0,a.googleMaps.map.addListener("idle",function(){a.isZooming=!1}),google.maps.event.addListenerOnce(a.googleMaps.map,"idle",function(){setTimeout(function(){a.$map.addClass("mapsvg-fade-in"),setTimeout(function(){a.$map.removeClass("mapsvg-google-map-loading"),a.$map.removeClass("mapsvg-fade-in"),a.options.googleMaps.center&&a.options.googleMaps.zoom||(a.options.googleMaps.center=a.googleMaps.map.getCenter().toJSON(),a.options.googleMaps.zoom=a.googleMaps.map.getZoom()),a.zoomDelta=a.options.googleMaps.zoom-a.zoomLevel,a.trigger("googleMapsLoaded")},300)},1)})):a.loadGoogleMapsAPI(function(){a.setGoogleMaps()},function(){a.setGoogleMaps({on:!1})})):(a.$map.toggleClass("mapsvg-with-google-map",!1),a.$googleMaps&&a.$googleMaps.hide(),a.googleMaps.initialized=!1)},loadGoogleMapsAPI:function(t,e){var o,i,s=this;void 0!==window.google&&google.maps&&(MapSVG.googleMapsApiLoaded=!0),MapSVG.googleMapsApiLoaded?"function"==typeof t&&t():(MapSVG.googleMapsLoadCallbacks=MapSVG.googleMapsLoadCallbacks||[],"function"==typeof t&&MapSVG.googleMapsLoadCallbacks.push(t),MapSVG.googleMapsApiIsLoading||(MapSVG.googleMapsApiIsLoading=!0,window.gm_authFailure=function(){MapSVG.GoogleMapBadApiKey?MapSVG.GoogleMapBadApiKey():s.editMode?alert("Google maps API key is incorrect."):console.error("MapSVG: Google maps API key is incorrect.")},s.googleMapsScript=document.createElement("script"),s.googleMapsScript.onload=function(){MapSVG.googleMapsApiLoaded=!0,MapSVG.googleMapsLoadCallbacks.forEach(function(e){"function"==typeof t&&e()})},o=[],s.options.googleMaps.drawingTools&&o.push("drawing"),s.options.googleMaps.geometry&&o.push("geometry"),i="",0'),e.setColors(),e.$filtersModal.css({width:e.options.filters.width}),MapSVG.isPhone?($("body").append(e.$filtersModal),e.$filtersModal.css({width:""})):e["$"+e.options.filters.modalLocation].append(e.$filtersModal)):(e.$filtersModal=$("#"+e.options.filters.containerId),e.$filtersModal.css({width:""})),e.loadFiltersController(e.$filtersModal,!0)},loadFiltersController:function(e,t){var a,n,o,r=this;r.filtersSchema.getSchema()&&(a="regions"===r.options.filters.source?r.regionsDatabase:r.database,t=void 0!==t&&t,n=MapSVG.isPhone?(o=!0,r.options.filters.hideOnMobile):(o=r.options.menu.on&&r.controllers.directory&&r.options.menu.location===r.options.filters.location,r.options.filters.hide),o=t||!o&&-1!==["leftSidebar","rightSidebar"].indexOf(r.options.filters.location),new MapSVG.FiltersController({container:e,template:Handlebars.compile('
'),mapsvg:r,data:{},scrollable:o,modal:t,withToolbar:!MapSVG.isPhone&&!0===t,width:e.hasClass("mapsvg-map-container")?r.options.filters.width:"100%",events:{shown:function(e){var i=this,s=new MapSVG.FormBuilder({container:this.contentView,filtersMode:!0,schema:r.filtersSchema.getSchema(),modal:t,filtersHide:n,editMode:!1,mapsvg:r,data:a.query.filters,admin:!1,events:{load:function(t){var e,o;t.container.find(".mapsvg-form-builder").css({padding:r.options.filters.padding}),i.updateScroll(),n&&((e=function(){var e=0<(e=Object.keys(a.query.filters).length)?e:"";a.query.filters.search&&0"+e+"")})(),a.on("dataLoaded",function(){e()})),r.options.filters.clearButton&&(o=$('
"),t.container.find(".mapsvg-data-form-view").append(o),o.on("click",function(){t.container.find("input").not(":button, :submit, :reset, :hidden, :checkbox, :radio").val("").prop("selected",!1),t.container.find('input[type="radio"]').prop("checked",!1),t.container.find('input[type="checkbox"]').prop("checked",!1),a.query.filters={},r.deselectAllRegions(),t.container.find("select").val("").trigger("change.select2"),a.getAll()})),r.controllers.directory&&r.controllers.directory.updateTopShift()}}});s.view.on("click",".mapsvg-btn-show-filters",function(){r.loadFiltersModal()}),s.view.on("paste keyup",'input[data-parameter-name="search"]',function(){r.throttle(r.textSearch,600,r,$(this))}),s.view.on("change paste keyup",'select,input[type="radio"],input',function(){var o,e,i,t;$(this).data("ignoreSelect2Change")?$(this).data("ignoreSelect2Change",!1):(o={},i=$(this).data("parameter-name"),"search"!=$(this).attr("data-parameter-name")&&"distanceAddress"!==$(this).attr("name")&&"search"!=i&&("distanceLatLng"===$(this).attr("name")||"distanceLength"===$(this).attr("name")?(e={units:s.view.find('[name="distanceUnits"]').val(),latlng:s.view.find('[name="distanceLatLng"]').val(),length:s.view.find('[name="distanceLength"]').val(),address:s.view.find('[name="distanceAddress"]').val()},(i=s.mapsvg.filtersSchema.schema.find(function(e){return"distance"===e.type})).country&&(e.country=i.country),e.units&&e.length&&e.latlng?(t=(o.distance=e).latlng.split(","),t={lat:parseFloat(t[0]),lng:parseFloat(t[1])},MapSVG.distanceSearch={latlng:t,units:i.distanceUnits,unitsLabel:i.distanceUnitsLabel}):(o.distance=null,MapSVG.distanceSearch=null)):0<$(this).closest(".mapsvg-checkbox-group").length?(o[i]=[],$(this).closest(".mapsvg-checkbox-group").find('input[type="checkbox"]:checked').each(function(e,t){o[i].push($(t).val())})):o[i]=$(this).val(),a.query.setFilters(o),t={filters:o},a.getAll(t)))})},closed:function(e){}}}))},textSearch:function(e){var t={search:e.val()},o="regions"===this.getData().options.filters.source?this.regionsDatabase:this.database;o.query.setFilters(t);t={filters:t};t.searchFallback=MapSVG.parseBoolean(e.attr("data-fallback")),o.getAll(t)},getRegion:function(e){return this.regions[this.regionsDict[e]]},getRegions:function(e){return _this.regions},getMarker:function(e){return this.markers[this.markersDict[e]]},checkId:function(e){return this.getRegion(e)?{error:"This ID is already being used by a Region"}:!this.getMarker(e)||{error:"This ID is already being used by another Marker"}},regionsRedrawColors:function(){this.regions.forEach(function(e){e.setFill()})},destroy:function(){var e=this;return e.controllers&&e.controllers.directory&&e.controllers.directory.mobileButtons.remove(),e.$map.empty().insertBefore(e.$wrapAll).attr("style","").removeClass("mapsvg mapsvg-responsive"),e.popover&&e.popover.close(),e.detailsController&&e.detailsController.destroy(),e.$wrapAll.remove(),e},getData:function(){return this},mayBeFitMarkers:function(){var e=this;this.lastTimeFitWas||(this.lastTimeFitWas=Date.now()-99999),this.fitDelta=Date.now()-this.lastTimeFitWas,1e3=t.options.zoom.limit[0]&&t.zoomLevel<=t.options.zoom.limit[1],i=t.googleMaps.map.getZoom(),s=t.googleMaps.zoomLimit?17:20,a=s=t.options.zoom.limit[0]&&s<=t.options.zoom.limit[1];if(o&&!i)return!1;t.isZooming=!0,t.googleMaps.map.setZoom(a),e&&(e=t.convertSVGToGeo(e[0],e[1]),t.googleMaps.map.setCenter({lat:e[0],lng:e[1]})),t.zoomLevel=s}}else t.canZoom&&(t.canZoom=!1,setTimeout(function(){t.canZoom=!0},700),t.zoom(1,e))},zoomOut:function(e){var t=this;if(t.googleMaps.map){if(!t.isZooming&&t.googleMaps.map.getZoom()-1>=t.options.googleMaps.minZoom){var o=t.zoomLevel>=t.options.zoom.limit[0]&&t.zoomLevel<=t.options.zoom.limit[1],i=t.googleMaps.map.getZoom(),s=i-1<1?1:i-1,a=s-t.zoomDelta,i=a>=t.options.zoom.limit[0]&&a<=t.options.zoom.limit[1];if(o&&!i)return!1;t.isZooming=!0,t.googleMaps.map.setZoom(s),t.zoomLevel=a}}else t.canZoom&&(t.canZoom=!1,setTimeout(function(){t.canZoom=!0},700),t.zoom(-1,e))},_touchZoomStart:function(e){var t=this;t._scale;t.scale=t.scale*zoom_k;t._scale;t._scale=t._scale*zoom_k;var o=t.viewBox[2],i=t.viewBox[3],s=[];s[2]=t._viewBox[2]/t._scale,s[3]=t._viewBox[3]/t._scale,s[0]=t.viewBox[0]+(o-s[2])/2,s[1]=viewBox[1]+(i-s[3])/2,t.setViewBox(s)},touchZoomMove:function(){},touchZoomEnd:function(){},zoomTo:function(e,o){var i=this;if(o=null!=o&&parseInt(o),"string"==typeof e&&(e=i.getRegion(e)),i.googleMaps.map)if(e instanceof MapSVG.Marker){var t=i.convertSVGToGeo(e.x,e.y);i.googleMaps.map.setZoom(o||1),i.googleMaps.map.setCenter({lat:t[0],lng:t[1]}),this.zoomLevel=this.googleMaps.map.getZoom()-this.zoomDelta}else{if(e&&void 0!==e.length)for(var s=e[0].getGeoBounds(),a=new google.maps.LatLng(s.sw[0],s.sw[1]),n=new google.maps.LatLng(s.ne[0],s.ne[1]),r=new google.maps.LatLngBounds(a,n),l=1;lg[2]&&d[3]>g[3]&&(g[2]>t.viewBox[2]||g[3]>t.viewBox[3])&&(i.zoomLevel=o||parseInt(e)-1,e=i.zoomLevels[i.zoomLevel].viewBox,i.setViewBox([g[0]-e[2]/2+g[2]/2,g[1]-e[3]/2+g[3]/2,e[2],e[3]]),i._scale=i.zoomLevels[i.zoomLevel]._scale,x=!1),d=t&&t.viewBox})}},zoomToMarkerOrCluster:function(e,t){var o=this;o.zoomLevel=t||1;t=o.zoomLevels[o.zoomLevel].viewBox;o.setViewBox([e.x-t[2]/2,e.y-t[3]/2,t[2],t[3]]),o._scale=o.zoomLevels[o.zoomLevel]._scale},centerOn:function(e,t){var o,i=this;i.options.googleMaps.on?(t=t?(t+12)/i.getScale():0,i.$map.addClass("scrolling"),o=e.getCenterLatLng(t),i.googleMaps.map.panTo(o),setTimeout(function(){i.$map.removeClass("scrolling")},100)):(t=t?(t+12)/i.getScale():0,o=e.getBBox(),e=i.viewBox,i.setViewBox([o[0]-e[2]/2+o[2]/2,o[1]-e[3]/2+o[3]/2-t,e[2],e[3]]))},zoom:function(e,t,o){var i=this,s=i.viewBox[2],a=i.viewBox[3],n=[],r=i.zoomLevel>=i.options.zoom.limit[0]&&i.zoomLevel<=i.options.zoom.limit[1];if(o)n[2]=i._viewBox[2]/o,n[3]=i._viewBox[3]/o;else{var l=0i.options.zoom.limit[1]||i._zoomLeveli.svgDefault.viewBox[0]+i.svgDefault.viewBox[2]&&(n[0]=i.svgDefault.viewBox[0]+i.svgDefault.viewBox[2]-n[2]),n[1]i.svgDefault.viewBox[1]+i.svgDefault.viewBox[3]&&(n[1]=i.svgDefault.viewBox[1]+i.svgDefault.viewBox[3]-n[3])),i.setViewBox(n)},markerDelete:function(e){var t=this;t.editingMarker&&t.editingMarker.id==e.id&&(t.editingMarker=null,delete t.editingMarker),t.markers.splice(t.markersDict[e.id],1),t.updateMarkersDict(),e=null,0==t.markers.length&&(t.options.markerLastID=0)},markersClusterAdd:function(e){this.layers.markers.append(e.node),this.markersClusters.push(e),e.adjustPosition()},markerAdd:function(e){e.node.hide(),e.adjustPosition(),this.layers.markers.append(e.node),this.markers.push(e),e.mapped=!0,this.markersDict[e.id]=this.markers.length-1,setTimeout(function(){e.node.show()},100)},markerRemove:function(e){e.node.detach(),e.show(),this.markers.splice(this.markersDict[e.id],1),e.mapped=!1,this.updateMarkersDict()},markerId:function(){var e=this;e.options.markerLastID=e.options.markerLastID+1;var t="marker_"+e.options.markerLastID;return e.getMarker(t)?e.markerId():t},labelsRegionsAdjustPosition:function(){var o=this;o.$map.is(":visible")&&o.regions.forEach(function(e){e.center||(e.center=e.getCenterSVG());var t=o.convertSVGToPixel([e.center.x,e.center.y]);e.textLabel&&(e.textLabel[0].style.transform="translate(-50%,-50%) translate("+t[0]+"px,"+t[1]+"px)")})},markersAdjustPosition:function(){var t=this;t.markers.forEach(function(e){e.adjustPosition(t.scale)}),t.markersClusters.forEach(function(e){e.adjustPosition()}),t.userLocationMarker&&t.userLocationMarker.adjustPosition()},markerMoveStart:function(){this.data("ox",parseFloat(this.attr("x"))),this.data("oy",parseFloat(this.attr("y")))},markerMove:function(e,t){e/=this.scale,t/=this.scale,this.attr({x:this.data("ox")+e,y:this.data("oy")+t})},markerMoveEnd:function(){this.data("ox")==this.attr("x")&&this.data("oy")==this.attr("y")&&options.markerEditHandler.call(this)},setEditingMarker:function(e){var t=this;t.editingMarker=e,t.editingMarker.mapped||(t.editingMarker.needToRemove=!0,t.markerAdd(t.editingMarker))},unsetEditingMarker:function(){var e=this;e.editingMarker&&e.editingMarker.needToRemove&&e.markerRemove(e.editingMarker),e.editingMarker=null},getEditingMarker:function(){return this.editingMarker},scrollStart:function(e,t){var o=this;if($(e.target).hasClass("mapsvg-btn-map")||$(e.target).closest(".mapsvg-gauge").length)return!1;if(o.editMarkers.on&&"mapsvg-marker"==$(e.target).hasClass("class"))return!1;e.preventDefault();var i=e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches[0]?e.originalEvent.touches[0]:e;o.scrollStarted=!0,o.scroll=o.scroll||{},o.scroll.vxi=o.viewBox[0],o.scroll.vyi=o.viewBox[1],o.scroll.x=i.clientX,o.scroll.y=i.clientY,o.scroll.dx=0,o.scroll.dy=0,o.scroll.vx=0,o.scroll.vy=0,o.scroll.gx=i.clientX,o.scroll.gy=i.clientY,o.scroll.tx=o.scroll.tx||0,o.scroll.ty=o.scroll.ty||0,0===e.type.indexOf("mouse")&&($(document).on("mousemove.scroll.mapsvg",function(e){o.scrollMove(e)}),o.options.scroll.spacebar?$(document).on("keyup.scroll.mapsvg",function(e){32==e.keyCode&&o.scrollEnd(e,t)}):$(document).on("mouseup.scroll.mapsvg",function(e){o.scrollEnd(e,t)}))},scrollMove:function(e){var t=this;e.preventDefault(),t.isScrolling||(t.isScrolling=!0,t.$map.addClass("scrolling"));var o,i=e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches[0]?e.originalEvent.touches[0]:e,s=t.panBy(t.scroll.gx-i.clientX,t.scroll.gy-i.clientY);t.googleMaps.map&&(s.x||s.y)&&(a=t.googleMaps.map.getCenter(),(e=(o=t.googleMaps.overlay.getProjection()).fromLatLngToDivPixel(a)).x+=s.x?t.scroll.gx-i.clientX:0,e.y+=s.y?t.scroll.gy-i.clientY:0,a=o.fromDivPixelToLatLng(e),t.googleMaps.map.setCenter(a)),t.scroll.gx=i.clientX,t.scroll.gy=i.clientY,t.scroll.dx=t.scroll.x-i.clientX,t.scroll.dy=t.scroll.y-i.clientY;var a=parseInt(t.scroll.vxi+t.scroll.dx/t.scale),i=parseInt(t.scroll.vyi+t.scroll.dy/t.scale);t.options.scroll.limit&&(at.svgDefault.viewBox[0]+t.svgDefault.viewBox[2]&&(a=t.svgDefault.viewBox[0]+t.svgDefault.viewBox[2]-t.viewBox[2]),it.svgDefault.viewBox[1]+t.svgDefault.viewBox[3]&&(i=t.svgDefault.viewBox[1]+t.svgDefault.viewBox[3]-t.viewBox[3])),t.scroll.vx=a,t.scroll.vy=i},scrollEnd:function(e,t,o){var i=this;setTimeout(function(){i.scrollStarted=!1,i.isScrolling=!1},100),i.googleMaps&&i.googleMaps.overlay&&i.googleMaps.overlay.draw(),i.$map.removeClass("scrolling"),$(document).off("keyup.scroll.mapsvg"),$(document).off("mousemove.scroll.mapsvg"),$(document).off("mouseup.scroll.mapsvg"),!0!==o&&Math.abs(i.scroll.dx)<5&&Math.abs(i.scroll.dy)<5&&(i.editMarkers.on?i.clickAddsMarker&&i.markerAddClickHandler(e):i.region_clicked&&i.regionClickHandler(e,i.region_clicked)),i.viewBox[0]=i.scroll.vx||i.viewBox[0],i.viewBox[1]=i.scroll.vy||i.viewBox[1]},panBy:function(e,t){var o,i,s=this,a=s.scroll.tx-e,n=s.scroll.ty-t,r={x:!0,y:!0};return s.options.scroll.limit&&(o=s.$svg[0].getBoundingClientRect(),i=s.$map[0].getBoundingClientRect(),(o.left-e>i.left&&e<0||o.right-ei.top&&t<0||o.bottom-t=n.touches[1].pageX?n.touches[0].pageX-(n.touches[0].pageX-n.touches[1].pageX)/2-o.$svg.offset().left:n.touches[1].pageX-(n.touches[1].pageX-n.touches[0].pageX)/2-o.$svg.offset().left,a=n.touches[0].pageY>=n.touches[1].pageY?n.touches[0].pageY-(n.touches[0].pageY-n.touches[1].pageY)-o.$svg.offset().top:n.touches[1].pageY-(n.touches[1].pageY-n.touches[0].pageY)-o.$svg.offset().top,a=o.convertPixelToSVG([s,a]),0t.svgDefault.viewBox[2]&&(i=t.svgDefault.viewBox[2]/t.mapLonDelta*360*Math.floor((t.viewBox[0]-t.svgDefault.viewBox[0])/t.svgDefault.viewBox[2])),[(e[0]-t.svgDefault.viewBox[0]+i)*o,(e[1]-t.svgDefault.viewBox[1]+0)*o]},convertPixelToSVG:function(e){var t=this.getScale();return[e[0]/t+this.svgDefault.viewBox[0],e[1]/t+this.svgDefault.viewBox[1]]},convertGeoToSVG:function(e){var t=this,o=parseFloat(e[0]),i=(parseFloat(e[1])-t.geoViewBox.leftLon)*(t.svgDefault.viewBox[2]/t.mapLonDelta),o=3.14159*o/180,s=t.svgDefault.viewBox[2]/t.mapLonDelta*360/6.28318,e=s/2*Math.log((1+Math.sin(t.mapLatBottomDegree))/(1-Math.sin(t.mapLatBottomDegree))),e=t.svgDefault.viewBox[3]-(s/2*Math.log((1+Math.sin(o))/(1-Math.sin(o)))-e);return i+=t.svgDefault.viewBox[0],e+=t.svgDefault.viewBox[1],[i,e-=this.yShift||0]},convertSVGToGeo:function(e,t){var o=this;e-=o.svgDefault.viewBox[0],t-=o.svgDefault.viewBox[1];var i=o.svgDefault.viewBox[2]/o.mapLonDelta*360/(2*Math.PI),s=i/2*Math.log((1+Math.sin(o.mapLatBottomDegree))/(1-Math.sin(o.mapLatBottomDegree))),i=(o.svgDefault.viewBox[3]+s-t)/i,i=180/Math.PI*(2*Math.atan(Math.exp(i))-Math.PI/2),o=o.geoViewBox.leftLon+e/o.svgDefault.viewBox[2]*o.mapLonDelta;return[i=parseFloat(i.toFixed(6)),o=parseFloat(o.toFixed(6))]},convertGeoBoundsToViewBox:function(e,t){var o=this,i=parseFloat(coords[0]),s=(parseFloat(coords[1])-o.geoViewBox.leftLon)*(o.svgDefault.viewBox[2]/o.mapLonDelta),i=3.14159*i/180,a=o.svgDefault.viewBox[2]/o.mapLonDelta*360/6.28318,n=a/2*Math.log((1+Math.sin(o.mapLatBottomDegree))/(1-Math.sin(o.mapLatBottomDegree))),n=o.svgDefault.viewBox[3]-(a/2*Math.log((1+Math.sin(i))/(1-Math.sin(i)))-n);return[s+=o.svgDefault.viewBox[0],n+=o.svgDefault.viewBox[1]]},pickGaugeColor:function(e){var t=this,e=(e-t.options.gauge.min)/t.options.gauge.maxAdjusted;return[Math.round(t.options.gauge.colors.diffRGB.r*e+t.options.gauge.colors.lowRGB.r),Math.round(t.options.gauge.colors.diffRGB.g*e+t.options.gauge.colors.lowRGB.g),Math.round(t.options.gauge.colors.diffRGB.b*e+t.options.gauge.colors.lowRGB.b),Math.round(t.options.gauge.colors.diffRGB.a*e+t.options.gauge.colors.lowRGB.a)]},isRegionDisabled:function(e,t){var o=this;return!(!o.options.regions[e]||!o.options.regions[e].disabled&&"none"!=t)||!(null!=o.options.regions[e]&&!MapSVG.parseBoolean(o.options.regions[e].disabled)||!o.options.disableAll&&"none"!=t&&"labels"!=e&&"Labels"!=e)},regionClickHandler:function(e,region){var _this=this;_this.region_clicked=null;var actions=_this.options.actions;if(!_this.eventsPreventList.click){if(_this.editRegions.on)return _this.selectRegion(region.id),void _this.regionEditHandler.call(region);if(region instanceof MapSVG.MarkersCluster)_this.zoomTo(region.markers);else if(region.isRegion()){if(_this.selectRegion(region.id),actions.region.click.zoom&&_this.zoomTo(region,actions.region.click.zoomToLevel),actions.region.click.filterDirectory&&(_this.database.getAll({filters:{regions:region.id}}).done(function(){_this.popover&&_this.popover.redraw(region.forTemplate()),_this.detailsController&&_this.detailsController.redraw(region.forTemplate())}),_this.updateFiltersState()),actions.region.click.showDetails&&_this.loadDetailsView(region),(actions.region.click.showPopover||e&&-1!==e.type.indexOf("touch")&&actions.region.touch.showPopover)&&(actions.region.click.zoom?setTimeout(function(){_this.showPopover(region)},400):_this.showPopover(region)),actions.region.click.goToLink){var linkParts=actions.region.click.linkField.split("."),url;if(1'),e.downloadForm.appendTo("body")),e.downloadForm.find('input[name="svg_file"]').val(e.$svg.prop("outerHTML")),e.downloadForm.find('input[name="svg_title"]').val(e.options.title),setTimeout(function(){jQuery("#mdownload").submit()},500)},showTooltip:function(e){e.length&&(this.tooltip.container.html(e),this.tooltip.container.addClass("mapsvg-tooltip-visible"))},popoverAdjustPosition:function(){var e,t=this;t.$popover&&t.$popover.data("point")&&(e=t.convertSVGToPixel(t.$popover.data("point")),t.$popover[0].style.transform="translateX(-50%) translate("+e[0]+"px,"+e[1]+"px)")},showPopover:function(e){var t,o=this,i=e instanceof MapSVG.Region?e:e.location&&e.location.marker&&e.location.marker?e.location.marker:null;i&&(t=i instanceof MapSVG.Marker?{x:i.x,y:i.y}:i.getCenterSVG(),o.popover&&o.popover.destroy(),o.popover=new MapSVG.PopoverController({container:o.$popover,point:t,yShift:i instanceof MapSVG.Marker?i.height:0,template:e instanceof MapSVG.Region?o.templates.popoverRegion:o.templates.popoverMarker,mapsvg:o,data:e instanceof MapSVG.Region?e.forTemplate():e,mapObject:i,scrollable:!0,withToolbar:!MapSVG.isPhone||!o.options.popovers.mobileFullscreen,events:{shown:function(e){var t;o.options.popovers.centerOn&&(t=this.container.height()/2,!o.options.popovers.centerOn||MapSVG.isPhone&&o.options.popovers.mobileFullscreen||o.centerOn(i,t));try{o.events["shown.popover"]&&o.events["shown.popover"].call(this,o)}catch(e){console.log(e)}o.popoverShowingFor=i,o.trigger("popoverShown")},closed:function(e){o.options.popovers.resetViewboxOnClose&&o.viewBoxReset(!0),o.popoverShowingFor=null;try{o.events["closed.popover"]&&o.events["closed.popover"].call(this,e)}catch(e){console.log(e)}o.trigger("popoverClosed")},resize:function(){var e;o.options.popovers.centerOn&&(e=this.container.height()/2,!o.options.popovers.centerOn||MapSVG.isPhone&&o.options.popovers.mobileFullscreen||o.centerOn(i,e))}}}))},hidePopover:function(){this.popover&&this.popover.close()},hideTip:function(){this.tooltip.container.removeClass("mapsvg-tooltip-visible")},popoverOffHandler:function(e){this.isScrolling||$(e.target).closest(".mapsvg-popover").length||$(e.target).hasClass("mapsvg-btn-map")||this.popover&&this.popover.close()},mouseOverHandler:function(e,t){var o,i,s,a=this;if(!a.eventsPreventList.mouseover)if(a.options.tooltips.on&&(t instanceof MapSVG.Region&&(o="tooltipRegion",i=t.forTemplate()),t instanceof MapSVG.Marker&&(o="tooltipMarker",i=t.object),a.popoverShowingFor!==t&&a.showTooltip(a.templates[o](i))),a.options.menu.on&&("database"==a.options.menu.source?(t instanceof MapSVG.Region&&t.objects.length&&(s=t.objects.map(function(e){return e.id})),t instanceof MapSVG.Marker&&(s=t.object?t.object.id:[])):(t instanceof MapSVG.Region&&(s=[t.id]),this instanceof MapSVG.Marker&&t.object.regions&&t.object.regions.length&&(s=t.object.regions.map(function(e){return e.id}))),a.controllers.directory.highlightItems(s)),t instanceof MapSVG.Region){if(t.selected||t.highlight(),a.events["mouseover.region"])try{a.events["mouseover.region"].call(t,e,a)}catch(e){console.log(e)}}else if(a.highlightMarker(t),a.events["mouseover.marker"])try{a.events["mouseover.marker"].call(t,e,a)}catch(e){console.log(e)}},mouseOutHandler:function(e,t){var o=this;if(!o.eventsPreventList.mouseout){if(o.options.tooltips.on&&o.hideTip(),t instanceof MapSVG.Region){if(t.selected||t.unhighlight(),o.events["mouseout.region"])try{o.events["mouseout.region"].call(t,e,o)}catch(e){console.log(e)}}else if(o.unhighlightMarker(t),o.events["mouseout.marker"])try{o.events["mouseout.marker"].call(t,e,o)}catch(e){console.log(e)}o.options.menu.on&&("database"==o.options.menu.source&&t instanceof MapSVG.Marker&&(t.object&&t.object.id),o.controllers.directory.unhighlightItems())}},updateMarkersDict:function(){var o=this;o.markersDict={},o.markers.forEach(function(e,t){o.markersDict[e.id]=t})},eventsPrevent:function(e){this.eventsPreventList[e]=!0},eventsRestore:function(e){e?this.eventsPreventList[e]=!1:this.eventsPreventList={}},setEventHandlers:function(){var o=this;o.$map.off(".common.mapsvg"),o.$scrollpane.off(".common.mapsvg"),$(document).off("keydown.scroll.mapsvg"),$(document).off("mousemove.scrollInit.mapsvg"),$(document).off("mouseup.scrollInit.mapsvg"),o.editMarkers.on&&o.$map.on("touchstart.common.mapsvg mousedown.common.mapsvg",".mapsvg-marker",function(e){e.originalEvent.preventDefault();var t=o.getMarker($(this).attr("id")),e=MapSVG.mouseCoords(e);t.drag(e,o.scale,function(){o.mapIsGeo&&(this.geoCoords=o.convertSVGToGeo(this.x+this.width/2,this.y+(this.height-1))),o.markerEditHandler&&o.markerEditHandler.call(this,!0),this.onChange&&this.onChange.call(this)},function(){o.markerEditHandler&&o.markerEditHandler.call(this),this.onChange&&this.onChange.call(this)})}),o.editMarkers.on||o.$map.on("mouseover.common.mapsvg",".mapsvg-region",function(e){var t=$(this).attr("id");o.mouseOverHandler.call(o,e,o.getRegion(t))}).on("mouseleave.common.mapsvg",".mapsvg-region",function(e){var t=$(this).attr("id");o.mouseOutHandler.call(o,e,o.getRegion(t))}),o.editRegions.on||o.$map.on("mouseover.common.mapsvg",".mapsvg-marker",function(e){var t=$(this).attr("id");o.mouseOverHandler.call(o,e,o.getMarker(t))}).on("mouseleave.common.mapsvg",".mapsvg-marker",function(e){var t=$(this).attr("id");o.mouseOutHandler.call(o,e,o.getMarker(t))}),o.options.scroll.spacebar?$(document).on("keydown.scroll.mapsvg",function(e){"INPUT"===document.activeElement.tagName||o.isScrolling||32!=e.keyCode||(e.preventDefault(),o.$map.addClass("mapsvg-scrollable"),$(document).on("mousemove.scrollInit.mapsvg",function(e){o.isScrolling=!0,$(document).off("mousemove.scrollInit.mapsvg"),o.scrollStart(e,o)}).on("keyup.scroll.mapsvg",function(e){32==e.keyCode&&($(document).off("mousemove.scrollInit.mapsvg"),o.$map.removeClass("mapsvg-scrollable"))}))}):o.options.scroll.on?o.$map.on("touchstart.common.mapsvg mousedown.common.mapsvg",function(e){if($(e.target).hasClass("mapsvg-popover")||$(e.target).closest(".mapsvg-popover").length)$(e.target).hasClass("mapsvg-popover-close")&&"touchstart"==e.type&&e.cancelable&&e.preventDefault();else{if("touchstart"==e.type&&e.cancelable&&e.preventDefault(),e.target&&$(e.target).attr("class")&&-1!=$(e.target).attr("class").indexOf("mapsvg-region")){var t=o.getRegion($(e.target).attr("id"));o.scrollRegionClickHandler.call(o,e,t)}else if(e.target&&$(e.target).attr("class")&&-1!=$(e.target).attr("class").indexOf("mapsvg-marker")&&-1===$(e.target).attr("class").indexOf("mapsvg-marker-cluster")){if(o.editMarkers.on)return;t=o.getMarker($(e.target).attr("id"));o.scrollRegionClickHandler.call(o,e,t)}else if(e.target&&$(e.target).attr("class")&&-1!=$(e.target).attr("class").indexOf("mapsvg-marker-cluster")){if(o.editMarkers.on)return;t=$(e.target).data("cluster");o.scrollRegionClickHandler.call(o,e,t)}"mousedown"==e.type?o.scrollStart(e,o):o.touchStart(e,o)}}):o.editMarkers.on?o.clickAddsMarker&&o.$map.on("touchend.common.mapsvg mouseup.common.mapsvg",function(e){e.cancelable&&e.preventDefault(),o.markerAddClickHandler(e)}):(o.$map.on("touchstart.common.mapsvg",".mapsvg-region",function(e){o.touchScrollStart=$(window).scrollTop()}),o.$map.on("touchstart.common.mapsvg",".mapsvg-marker",function(e){o.touchScrollStart=$(window).scrollTop()}),o.$map.on("touchend.common.mapsvg mouseup.common.mapsvg",".mapsvg-region",function(e){e.cancelable&&e.preventDefault(),void 0!==o.touchScrollStart&&o.touchScrollStart!==$(window).scrollTop()||o.regionClickHandler.call(o,e,o.getRegion($(this).attr("id")))}),o.$map.on("touchend.common.mapsvg mouseup.common.mapsvg",".mapsvg-marker",function(e){e.cancelable&&e.preventDefault(),void 0!==o.touchScrollStart&&o.touchScrollStart!==$(window).scrollTop()||o.regionClickHandler.call(o,e,o.getMarker($(this).attr("id")))}),o.$map.on("touchend.common.mapsvg mouseup.common.mapsvg",".mapsvg-marker-cluster",function(e){e.cancelable&&e.preventDefault(),o.touchScrollStart&&o.touchScrollStart!=$(window).scrollTop()||(e=$(this).data("cluster"),o.zoomTo(e.markers))}))},setLabelsRegions:function(e){var t=this;null!=(e=e||t.options.labelsRegions).on&&(e.on=MapSVG.parseBoolean(e.on)),$.extend(!0,t.options,{labelsRegions:e}),t.options.labelsRegions.on?(t.regions.forEach(function(e){e.textLabel||(e.textLabel=jQuery('
'),t.$scrollpane.append(e.textLabel));try{e.textLabel.html(t.templates.labelRegion(e.forTemplate()))}catch(e){console.error('MapSVG: Error in the "Region Label" template')}}),t.labelsRegionsAdjustPosition()):t.regions.forEach(function(e){e.textLabel&&(e.textLabel.remove(),e.textLabel=null,delete e.textLabel)})},deleteLabelsMarkers:function(){this.markers.forEach(function(e){e.textLabel&&(e.textLabel.remove(),e.textLabel=null,delete e.textLabel)})},setLabelsMarkers:function(e){var t=this;null!=(e=e||t.options.labelsMarkers).on&&(e.on=MapSVG.parseBoolean(e.on)),$.extend(!0,t.options,{labelsMarkers:e}),t.options.labelsMarkers.on?(t.markers.forEach(function(e){e.textLabel||(e.textLabel=jQuery('
'),t.$scrollpane.append(e.textLabel));try{e.textLabel.html(t.templates.labelMarker(e.object))}catch(e){console.error('MapSVG: Error in the "Marker Label" template')}}),t.markersAdjustPosition()):t.deleteLabelsMarkers()},addLayer:function(e){return this.layers[e]=$('
'),this.$layers.append(this.layers[e]),this.layers[e]},getDatabaseService:function(){return this.database},getDb:function(){return this.database},getDbRegions:function(){return this.regionsDatabase},regionAdd:function(e){var o=this,e=new MapSVG.Region($(e),o.options,o.regionID,o);return e.setStatus(1),o.regions.push(e),o.regions.sort(function(e,t){return e.id==t.id?0:+(e.id>t.id)||-1}),o.regions.forEach(function(e,t){o.regionsDict[e.id]=t}),e},regionDelete:function(e){var t,o=_this.regionsDict[e];void 0!==o?((t=_this.getRegion(e)).node&&t.node.remove(),_this.regions.splice(o,1),delete _this.regionsDict[e]):$("#"+e).length&&$("#"+e).remove()},reloadRegions:function(){var o=this;o.regions=[],o.regionsDict={},o.$svg.find(".mapsvg-region").removeClass("mapsvg-region"),o.$svg.find(".mapsvg-region-disabled").removeClass("mapsvg-region-disabled"),o.$svg.find("path, polygon, circle, ellipse, rect").each(function(e){var t;$(this).closest("defs").length||$(this)[0].getAttribute("id")&&(!o.options.regionPrefix||o.options.regionPrefix&&0===$(this)[0].getAttribute("id").indexOf(o.options.regionPrefix))&&(t=new MapSVG.Region($(this),o.options,o.regionID,o),o.regions.push(t))}),o.regions.sort(function(e,t){return e.id==t.id?0:+(e.id>t.id)||-1}),o.regions.forEach(function(e,t){o.regionsDict[e.id]=t})},reloadRegionsFull:function(){var o=this,i=o.regionsDatabase.getSchemaFieldByType("status");o.regions.forEach(function(e){var t=o.regionsDatabase.getLoadedObject(e.id);t?(e.data=t,i&&void 0!==t.status&&null!==t.status&&e.setStatus(t.status)):null!==o.options.filters.filteredRegionsStatus&&""!==o.options.filters.filteredRegionsStatus&&void 0!==o.options.filters.filteredRegionsStatus&&e.setStatus(o.options.filters.filteredRegionsStatus)}),o.loadDirectory(),o.setGauge(),o.setLayersControl(),o.setGroups(),o.options.labelsRegions.on&&o.setLabelsRegions()},fixMarkersWorldScreen:function(){var i=this;i.googleMaps.map&&setTimeout(function(){var e,t,o={left:0,right:0};1
').appendTo(i.$map),i.$layers=$('
').appendTo(i.$scrollpane),i.whRatio=0,i.isScrolling=!1,i.markerOptions={},i.svgDefault={},i.refLength=0,i.scale=1,i._scale=1,i.selected_id=[],i.mapData={},i.regions=[],i.regionsDict={},i.regionID={id:0},i.markers=[],i.markersDict={},i.markersClusters=[],i.markersClustersDict=[],i._viewBox=[],i.viewBox=[],i.viewBoxZoom=[],i.viewBoxFind=void 0,i.zoomLevel=0,i.scroll={},i.layers={},i.geoCoordinates=!1,i.geoViewBox={leftLon:0,topLat:0,rightLon:0,bottomLat:0},i.eventsPreventList={},i.googleMaps={loaded:!1,initialized:!1,map:null,zoomLimit:!0},i.setEvents(e.events),i.events.beforeLoad)try{i.events.beforeLoad.call(i)}catch(e){}if(i.events.beforeLoad&&i.events.beforeLoad.beforeLoad&&"function"==typeof i.events.beforeLoad.beforeLoad)try{i.events.beforeLoad.beforeLoad.call(i)}catch(e){console.log(e)}return i.setCss(),i.$map.addClass("mapsvg").addClass("no-transitions").css("background",i.options.colors.background),i.setContainers(i.options.containers),i.setColors(),i.$loading=$("
"+i.options.loadingText+"
").addClass("mapsvg-loading"),i.$map.append(i.$loading),i.addLayer("markers"),i.addLayer("popovers"),i.$loading.css({"margin-left":function(){return-$(this).outerWidth(!1)/2+"px"},"margin-top":function(){return-$(this).outerHeight(!1)/2+"px"}}),i.options.googleMaps.on&&i.$map.addClass("mapsvg-google-map-loading"),i.options.extension&&$().mapSvg.extensions&&$().mapSvg.extensions[i.options.extension]&&((e=$().mapSvg.extensions[i.options.extension])&&e.common(i)),$.ajax({url:i.options.source+"?v="+i.options.svgFileVersion}).fail(function(e){e=404==e.status?"MapSVG: file not found - "+i.options.source+"\n\nIf you moved MapSVG from another server please read the following docs page: https://mapsvg.com/docs/installation/moving":"MapSVG: can't load SVG file for unknown reason. Please contact support: https://mapsvg.ticksy.com",i.editMode?alert(e):console.error(e)}).done(function(e){e=$(e).find("svg");if(i.$svg=e,i.svgDefault.width=e.attr("width"),i.svgDefault.height=e.attr("height"),i.svgDefault.viewBox=e.attr("viewBox"),i.svgDefault.width&&i.svgDefault.height)i.svgDefault.width=parseFloat(i.svgDefault.width.replace(/px/g,"")),i.svgDefault.height=parseFloat(i.svgDefault.height.replace(/px/g,"")),i.svgDefault.viewBox=i.svgDefault.viewBox?i.svgDefault.viewBox.split(" "):[0,0,i.svgDefault.width,i.svgDefault.height];else{if(!i.svgDefault.viewBox){var t="MapSVG: width/height and viewBox are missing in the SVG file. Can't parse the file because of that.";return i.editMode?alert(t):console.error(t),!1}i.svgDefault.viewBox=i.svgDefault.viewBox.split(" "),i.svgDefault.width=parseFloat(i.svgDefault.viewBox[2]),i.svgDefault.height=parseFloat(i.svgDefault.viewBox[3])}var o,t=e.attr("mapsvg:geoViewBox")||e.attr("mapsvg:geoviewbox");t&&4==(t=t.split(" ")).length&&(i.mapIsGeo=!0,i.geoCoordinates=!0,i.geoViewBox={leftLon:parseFloat(t[0]),topLat:parseFloat(t[1]),rightLon:parseFloat(t[2]),bottomLat:parseFloat(t[3])},i.mapLonDelta=i.geoViewBox.rightLon-i.geoViewBox.leftLon,i.mapLatBottomDegree=3.14159*i.geoViewBox.bottomLat/180),$.each(i.svgDefault.viewBox,function(e,t){i.svgDefault.viewBox[e]=parseFloat(t)}),i._viewBox=4==i.options.viewBox.length&&i.options.viewBox||i.svgDefault.viewBox,$.each(i._viewBox,function(e,t){i._viewBox[e]=parseFloat(t)}),e.attr("preserveAspectRatio","xMidYMid meet"),e.removeAttr("width"),e.removeAttr("height"),i.reloadRegions(),i.$scrollpane.append(e),i.setSize(i.options.width,i.options.height,i.options.responsive),i.options.disableAll&&i.setDisableAll(!0),i.setViewBox(i._viewBox),i.setResponsive(i.options.responsive,!0),i.setScroll(i.options.scroll,!0),i.setZoom(i.options.zoom),i.setControls(i.options.controls),i.setGoogleMaps(),i.options.tooltipsMode&&(i.options.tooltips.mode=i.options.tooltipsMode),i.setTooltips(i.options.tooltips),i.options.popover&&(i.options.popovers=i.options.popover),i.setPopovers(i.options.popovers),i.options.cursor&&i.setCursor(i.options.cursor),i.setTemplates(i.options.templates),!i.options.backend&&i.options.extension&&$().mapSvg.extensions&&$().mapSvg.extensions[i.options.extension]&&((o=$().mapSvg.extensions[i.options.extension])&&o.frontend(i)),i.filtersSchema=new MapSVG.Filters(i.options.filtersSchema),i.database=new MapSVG.DatabaseService({map_id:i.id,perpage:i.options.database.pagination.on?i.options.database.pagination.perpage:0,sortBy:"database"==i.options.menu.source?i.options.menu.sortBy:"id",sortDir:"database"==i.options.menu.source?i.options.menu.sortDirection:"desc",table:"database"},i),i.database.on("dataLoaded",function(){i.fitOnDataLoadDone=!1,i.addLocations(),i.fixMarkersWorldScreen(),i.attachDataToRegions(),i.loadDirectory(),i.options.labelsMarkers.on&&i.setLabelsMarkers(),i.options.templates.labelRegion.indexOf(!0)&&i.setLabelsRegions();try{i.events.databaseLoaded&&i.events.databaseLoaded.call(i)}catch(e){console.log(e)}i.updateFiltersState()}),i.database.on("schemaChange",function(){i.database.getAll()}),i.database.on("create",function(e){i.attachDataToRegions(e),i.reloadRegionsFull()}),i.database.on("update",function(e){i.attachDataToRegions(e),i.reloadRegionsFull()}),i.database.on("delete",function(e){i.attachDataToRegions(),i.reloadRegionsFull()}),i.regionsDatabase=new MapSVG.DatabaseService({map_id:i.id,perpage:0,sortBy:"regions"==i.options.menu.source?i.options.menu.sortBy:"id",sortDir:"regions"==i.options.menu.source?i.options.menu.sortDirection:"desc",table:"regions"},i),i.regionsDatabase.on("dataLoaded",function(){if(i.reloadRegionsFull(),i.events.regionsLoaded)if(i.events.regionsLoaded.length&&0').addClass("mapsvg-marker");if(MapSVG.MapObject.call(this,t,this.mapsvg),this.location=e.location,(this.location.marker=this).mapsvg=e.mapsvg,e.object&&this.setObject(e.object),this.positioned=!1,e.width&&e.height&&(this.width=e.width,this.height=e.height),this.setId(this.mapsvg.markerId()),this.mapsvg.isGeo()&&MapSVG.isNumber(this.location.lat)&&MapSVG.isNumber(this.location.lng)){e=this.mapsvg.convertGeoToSVG([this.location.lat,this.location.lng]);this.x=e[0],this.y=e[1]}else{if(!MapSVG.isNumber(this.location.x)||!MapSVG.isNumber(this.location.y))return!1;this.x=parseFloat(this.location.x),this.y=parseFloat(this.location.y)}this.setImage(this.imagePath),this.setAltAttr(),this.positioned=!0},MapSVG.extend(MapSVG.Marker,MapSVG.MapObject),MapSVG.Marker.prototype.setId=function(e){MapSVG.MapObject.prototype.setId.call(this,e),this.mapsvg.updateMarkersDict()},MapSVG.Marker.prototype.getBBox=function(){var e=this.mapsvg.getData(),e={x:this.x,y:this.y,width:this.width/e.scale,height:this.height/e.scale};return[(e=r.extend(!0,{},e)).x,e.y,e.width,e.height]},MapSVG.Marker.prototype.getOptions=function(){var o={id:this.id,src:this.src,x:this.x,y:this.y,geoCoords:this.geoCoords};return r.each(o,function(e,t){null==t&&delete o[e]}),o},MapSVG.Marker.prototype.update=function(e,t){for(var o in e){var i="set"+MapSVG.ucfirst(o);i in this&&this[i](e[o],t)}},MapSVG.Marker.prototype.setImage=function(e,t){if(!e)return!1;var o=this;e=MapSVG.safeURL(e),t=t||this.mapScale;var t=new Image,i=this;this.src=e,"src"!==i.node[0].getAttribute("src")&&i.node[0].setAttribute("src",e),t.onload=function(){i.width=this.width,i.height=this.height,o.adjustPosition()},t.src=e,this.location&&this.location.setImage(e)},MapSVG.Marker.prototype.setAltAttr=function(){var e=this,e=void 0!==e.object&&void 0!==e.object.title&&""!==e.object.title?e.object.title:e.id;this.node[0].alt=e},MapSVG.Marker.prototype.setXy=function(e){this.x=e[0]||this.x,this.y=e[1]||this.y,this.xy=[this.x,this.y],this.location&&(this.location.x=this.x,this.location.y=this.y),this.mapsvg.getData().mapIsGeo&&(this.geoCoords=this.mapsvg.convertSVGToGeo(e[0],e[1]),this.location&&this.location.setLatLng({lat:this.geoCoords[0],lng:this.geoCoords[1]})),this.adjustPosition(),this.onChange&&this.onChange.call(this)},MapSVG.Marker.prototype.moveToClick=function(e){var t=this.mapsvg.getData(),o={};e[0]=e[0]+t.viewBox[0],e[1]=e[1]+t.viewBox[1],t.mapIsGeo&&(this.geoCoords=this.mapsvg.convertSVGToGeo(e[0],e[1])),o.xy=e,this.update(o)},MapSVG.Marker.prototype.adjustPosition=function(){var e,t=this.mapsvg.convertSVGToPixel([this.x,this.y]);3e7'+this.markers.length+"
");e.data("cluster",this),MapSVG.MapObject.call(this,e,this.mapsvg),this.markers.length<2&&this.node.hide(),this.adjustPosition()},MapSVG.extend(MapSVG.MarkersCluster,MapSVG.MapObject),MapSVG.MarkersCluster.prototype.addMarker=function(e){var t;this.markers.push(e),1this.max_x&&(this.max_x=e.x),e.ythis.max_x&&(this.max_y=e.y),this.x=this.min_x+(this.max_x-this.min_x)/2,this.y=this.min_y+(this.max_y-this.min_y)/2)):(this.x=e.x,this.y=e.y),this.node.text(this.markers.length),this.adjustPosition()},MapSVG.MarkersCluster.prototype.canTakeMarker=function(e){e=this.mapsvg.convertSVGToPixel([e.x,e.y]);return this.cellX===Math.ceil(e[0]/this.cellSize)&&this.cellY===Math.ceil(e[1]/this.cellSize)},MapSVG.MarkersCluster.prototype.destroy=function(){this.markers=null,this.node.remove()},MapSVG.MarkersCluster.prototype.adjustPosition=function(){var e=this.mapsvg.convertSVGToPixel([this.x,this.y]);3e7':""},MapSVG.PopoverController.prototype.viewDidLoad=function(){MapSVG.Controller.prototype.viewDidLoad.call(this);var e=this;MapSVG.isPhone&&e.mapsvg.getData().options.popovers.mobileFullscreen&&!this.mobileCloseBtn&&(this.mobileCloseBtn=o('"),this.view.append(this.mobileCloseBtn)),this.adjustPosition(),this.container.toggleClass("mapsvg-popover-animate",!0),this.container.toggleClass("mapsvg-popover-visible",!0),e.adjustHeight(),e.updateScroll(),this.resizeSensor.setScroll(),this.events&&this.events.shown&&this.events.shown.call(e,e.mapsvg)},MapSVG.PopoverController.prototype.adjustHeight=function(){this.container.height(this.container.find(".mapsvg-auto-height").outerHeight()+(this.toolbarView?this.toolbarView.outerHeight():0))},MapSVG.PopoverController.prototype.adjustPosition=function(){var e=this,t=e.mapsvg.convertSVGToPixel([e.point.x,e.point.y]);t[1]-=e.yShift,t[0]=Math.round(t[0]),t[1]=Math.round(t[1]),e.container[0].style.transform="translateX(-50%) translate("+t[0]+"px,"+t[1]+"px)"},MapSVG.PopoverController.prototype.setEventHandlers=function(){var t=this;o("body").off(".popover.mapsvg"),this.view.on("click touchend",".mapsvg-popover-close, .mapsvg-mobile-modal-close",function(e){e.stopImmediatePropagation(),t.close()}),o("body").on("mouseup.popover.mapsvg touchend.popover.mapsvg",function(e){t.mapsvg.getData().isScrolling||o(e.target).closest(".mapsvg-directory").length||o(e.target).closest(".mapsvg-popover").length||o(e.target).hasClass("mapsvg-btn-map")||t.close()})},MapSVG.PopoverController.prototype.close=function(){var e=this;this.container.data("popover-id")==this.id&&e.container.is(":visible")&&(e.destroy(),e.mapObject instanceof MapSVG.Region&&e.mapsvg.deselectRegion(e.mapObject),e.mapObject instanceof MapSVG.Marker&&e.mapsvg.deselectAllMarkers(),e.events&&e.events.closed&&e.events.closed.call(e,e.mapsvg))},MapSVG.PopoverController.prototype.destroy=function(){this.container.toggleClass("mapsvg-popover-animate",!1),this.container.toggleClass("mapsvg-popover-visible",!1),MapSVG.Controller.prototype.destroy.call(this)},MapSVG.PopoverController.prototype.show=function(){this.container.toggleClass("mapsvg-popover-animate",!0),this.container.toggleClass("mapsvg-popover-visible",!0)}}(jQuery),function(a){MapSVG.Region=function(e,t,o,i){MapSVG.MapObject.call(this,e),this.globalOptions=t,this.mapsvg=i,this.id=this.node.attr("id"),this.id&&t.regionPrefix&&this.setId(this.id.replace(t.regionPrefix,"")),this.id_no_spaces=this.id.replace(" ","_"),this.title=this.node.attr("title"),this.node[0].setAttribute("class",(this.node.attr("class")||"")+" mapsvg-region"),this.setStyleInitial();i=t.regions&&t.regions[this.id]?t.regions[this.id]:null;this.disabled=this.getDisabledState(),this.disabled&&this.attr("class",this.attr("class")+" mapsvg-disabled"),this.default_attr={},this.selected_attr={};t=!(this.hover_attr={});i&&i.selected&&(t=!0,delete i.selected),i&&this.update(i),this.setFill(),t&&this.setSelected(!0),this.saveState()},MapSVG.extend(MapSVG.Region,MapSVG.MapObject),MapSVG.Region.prototype.setStyleInitial=function(){var e;this.style={fill:this.getComputedStyle("fill")},this.style.stroke=this.getComputedStyle("stroke")||"",e=this.node.data("stroke-width")?this.node.data("stroke-width"):"1"==(e=(e=this.getComputedStyle("stroke-width"))?e.replace("px",""):"1")?1.2:parseFloat(e),this.style["stroke-width"]=e,this.node.data("stroke-width",e)},MapSVG.Region.prototype.saveState=function(){this.initialState=JSON.stringify(this.getOptions())},MapSVG.Region.prototype.getBBox=function(){this.mapsvg.getData();var e=this.node[0].getBBox(),e=a.extend(!0,{},e),t=this.node[0].getTransformToElement(this.mapsvg.getData().$svg[0]),o=e.x+e.width,i=e.y+e.height,s=this.mapsvg.getData().$svg[0].createSVGPoint();return s.x=e.x,s.y=e.y,s=s.matrixTransform(t),e.x=s.x,e.y=s.y,s.x=o,s.y=i,s=s.matrixTransform(t),e.width=s.x-e.x,e.height=s.y-e.y,[e.x,e.y,e.width,e.height]},MapSVG.Region.prototype.changed=function(){return JSON.stringify(this.getOptions())!=this.initialState},MapSVG.Region.prototype.edit=function(){this.nodeOriginal=this.node.clone()},MapSVG.Region.prototype.editCommit=function(){this.nodeOriginal=null},MapSVG.Region.prototype.editCancel=function(){this.nodeOriginal.appendTo(_this.mapsvg.getData().$svg),this.node=this.nodeOriginal,this.nodeOriginal=null},MapSVG.Region.prototype.getOptions=function(e){this.globalOptions.regions[this.id];var t,o={id:this.id,id_no_spaces:this.id_no_spaces,title:this.title,fill:this.globalOptions.regions[this.id]&&this.globalOptions.regions[this.id].fill,tooltip:this.tooltip,popover:this.popover,href:this.href,target:this.target,data:this.data,gaugeValue:this.gaugeValue};return e&&(o.disabled=this.disabled,o.dataCounter=this.data&&this.data.length||0),a.each(o,function(e,t){null==t&&delete o[e]}),this.customAttrs&&(t=this).customAttrs.forEach(function(e){o[e]=t[e]}),o},MapSVG.Region.prototype.forTemplate=function(){var e,t={id:this.id,title:this.title,objects:this.objects,data:this.data};for(e in this.data)"title"!=e&&"id"!=e&&(t[e]=this.data[e]);return t},MapSVG.Region.prototype.update=function(e){for(var t in e){var o="set"+MapSVG.ucfirst(t);o in this?this[o](e[t]):(this[t]=e[t],this.customAttrs=this.customAttrs||[],this.customAttrs.push(t))}},MapSVG.Region.prototype.setId=function(e){this.id=e,this.node.prop("id",e)},MapSVG.Region.prototype.setTitle=function(e){this.title=e},MapSVG.Region.prototype.setStyle=function(e){a.extend(!0,this.style,e),this.setFill()},MapSVG.Region.prototype.getChoroplethColor=function(){var e=this.globalOptions.gauge,t=0===e.maxAdjusted?0:(parseFloat(this.data[this.globalOptions.regionChoroplethField])-e.min)/e.maxAdjusted;return{r:Math.round(e.colors.diffRGB.r*t+e.colors.lowRGB.r),g:Math.round(e.colors.diffRGB.g*t+e.colors.lowRGB.g),b:Math.round(e.colors.diffRGB.b*t+e.colors.lowRGB.b),a:(e.colors.diffRGB.a*t+e.colors.lowRGB.a).toFixed(2)}},MapSVG.Region.prototype.setFill=function(e){var t,o;this.globalOptions.colorsIgnore?this.node.css(this.style):(e?((t={})[this.id]={fill:e},a.extend(!0,this.globalOptions,{regions:t})):!e&&void 0!==e&&this.globalOptions.regions&&this.globalOptions.regions[this.id]&&this.globalOptions.regions[this.id].fill&&delete this.globalOptions.regions[this.id].fill,this.globalOptions.gauge.on&&this.data&&void 0!==this.data[this.globalOptions.regionChoroplethField]&&""!==this.data[this.globalOptions.regionChoroplethField]?(o=this.getChoroplethColor(),this.default_attr.fill="rgba("+o.r+","+o.g+","+o.b+","+o.a+")"):void 0!==this.status&&this.mapsvg.regionsDatabase&&this.mapsvg.regionsDatabase.getSchemaFieldByType("status")&&this.mapsvg.regionsDatabase.getSchemaFieldByType("status").optionsDict&&this.mapsvg.regionsDatabase.getSchemaFieldByType("status").optionsDict[this.status]&&this.mapsvg.regionsDatabase.getSchemaFieldByType("status").optionsDict[this.status].color?this.default_attr.fill=this.mapsvg.regionsDatabase.getSchemaFieldByType("status").optionsDict[this.status].color:this.globalOptions.regions[this.id]&&this.globalOptions.regions[this.id].fill?this.default_attr.fill=this.globalOptions.regions[this.id].fill:this.globalOptions.colors.base?this.default_attr.fill=this.globalOptions.colors.base:"none"!=this.style.fill?this.default_attr.fill=this.style.fill||this.globalOptions.colors.baseDefault:this.default_attr.fill="none",MapSVG.isNumber(this.globalOptions.colors.selected)?this.selected_attr.fill=MapSVG.tinycolor(this.default_attr.fill).lighten(parseFloat(this.globalOptions.colors.selected)).toRgbString():this.selected_attr.fill=this.globalOptions.colors.selected,MapSVG.isNumber(this.globalOptions.colors.hover)?this.hover_attr.fill=MapSVG.tinycolor(this.default_attr.fill).lighten(parseFloat(this.globalOptions.colors.hover)).toRgbString():this.hover_attr.fill=this.globalOptions.colors.hover,this.node.css("fill",this.default_attr.fill),this.fill=this.default_attr.fill,"none"!=this.style.stroke&&null!=this.globalOptions.colors.stroke?this.node.css("stroke",this.globalOptions.colors.stroke):(o=null==this.style.stroke?"":this.style.stroke,this.node.css("stroke",o)),this.selected&&this.setSelected())},MapSVG.Region.prototype.setDisabled=function(e,t){e=void 0!==e?MapSVG.parseBoolean(e):this.getDisabledState();var o=this.disabled;this.disabled=e,this.attr("class",this.attr("class").replace("mapsvg-disabled","")),e&&this.attr("class",this.attr("class")+" mapsvg-disabled"),this.disabled!=o&&this.mapsvg.deselectRegion(this),t||this.setFill()},MapSVG.Region.prototype.setStatus=function(e){var t;(t=this.globalOptions.regionStatuses&&this.globalOptions.regionStatuses[e])?(this.status=e,this.data.status=e,this.setDisabled(t.disabled,!0)):(this.status=void 0,this.data.status=void 0,this.setDisabled(!1,!0)),this.setFill()},MapSVG.Region.prototype.setSelected=function(){this.mapsvg.selectRegion(this)},MapSVG.Region.prototype.setGaugeValue=function(e){this.gaugeValue=a.isNumeric(e)?parseFloat(e):void 0},MapSVG.Region.prototype.getDisabledState=function(e){var t=this.globalOptions.regions[this.id];return!e&&t&&void 0!==t.disabled?t.disabled:!(!this.globalOptions.disableAll&&"none"!=this.style.fill&&"labels"!=this.id&&"Labels"!=this.id)},MapSVG.Region.prototype.highlight=function(){this.node.css({fill:this.hover_attr.fill}),this.node.addClass("mapsvg-region-hover")},MapSVG.Region.prototype.unhighlight=function(){this.node.css({fill:this.default_attr.fill}),this.node.removeClass("mapsvg-region-hover")},MapSVG.Region.prototype.select=function(){this.node.css({fill:this.selected_attr.fill}),this.selected=!0,this.node.addClass("mapsvg-region-active")},MapSVG.Region.prototype.deselect=function(){this.node.css({fill:this.default_attr.fill}),this.selected=!1,this.node.removeClass("mapsvg-region-active")}}(jQuery),jQuery,MapSVG.ResizeSensor=function(e,t){var o=this;o.element=e,o.callback=t;var i=getComputedStyle(e),t=parseInt(i.zIndex);isNaN(t)&&(t=0),t--,o.expand=document.createElement("div"),o.expand.style.position="absolute",o.expand.style.left="0px",o.expand.style.top="0px",o.expand.style.right="0px",o.expand.style.bottom="0px",o.expand.style.overflow="hidden",o.expand.style.zIndex=t,o.expand.style.visibility="hidden";i=document.createElement("div");i.style.position="absolute",i.style.left="0px",i.style.top="0px",i.style.width="10000000px",i.style.height="10000000px",o.expand.appendChild(i),o.shrink=document.createElement("div"),o.shrink.style.position="absolute",o.shrink.style.left="0px",o.shrink.style.top="0px",o.shrink.style.right="0px",o.shrink.style.bottom="0px",o.shrink.style.overflow="hidden",o.shrink.style.zIndex=t,o.shrink.style.visibility="hidden";t=document.createElement("div");t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.width="200%",t.style.height="200%",o.shrink.appendChild(t),o.element.appendChild(o.expand),o.element.appendChild(o.shrink);e=e.getBoundingClientRect();o.currentWidth=e.width,o.currentHeight=e.height,o.setScroll(),o.expand.addEventListener("scroll",function(){o.onScroll()}),o.shrink.addEventListener("scroll",function(){o.onScroll()})},MapSVG.ResizeSensor.prototype.onScroll=function(){var e=this,t=e.element.getBoundingClientRect(),o=t.width,t=t.height;o==e.currentWidth&&t==e.currentHeight||(e.currentWidth=o,e.currentHeight=t,e.callback()),this.setScroll()},MapSVG.ResizeSensor.prototype.setScroll=function(){this.expand.scrollLeft=1e7,this.expand.scrollTop=1e7,this.shrink.scrollLeft=1e7,this.shrink.scrollTop=1e7},MapSVG.ResizeSensor.prototype.destroy=function(){this.expand.remove(),this.shrink.remove()},function(n){var a=/^\s+/,r=/\s+$/,i=0,s=n.round,p=n.min,c=n.max,e=n.random;function g(e,t){if(t=t||{},(e=e||"")instanceof g)return e;if(!(this instanceof g))return new g(e,t);var o=function(e){var t={r:0,g:0,b:0},o=1,i=!1,s=!1;"string"==typeof e&&(e=function(e){e=e.replace(a,"").replace(r,"").toLowerCase();var t,o=!1;if(G[e])e=G[e],o=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};if(t=F.rgb.exec(e))return{r:t[1],g:t[2],b:t[3]};if(t=F.rgba.exec(e))return{r:t[1],g:t[2],b:t[3],a:t[4]};if(t=F.hsl.exec(e))return{h:t[1],s:t[2],l:t[3]};if(t=F.hsla.exec(e))return{h:t[1],s:t[2],l:t[3],a:t[4]};if(t=F.hsv.exec(e))return{h:t[1],s:t[2],v:t[3]};if(t=F.hsva.exec(e))return{h:t[1],s:t[2],v:t[3],a:t[4]};if(t=F.hex8.exec(e))return{a:function(e){return B(e)/255}(t[1]),r:B(t[2]),g:B(t[3]),b:B(t[4]),format:o?"name":"hex8"};if(t=F.hex6.exec(e))return{r:B(t[1]),g:B(t[2]),b:B(t[3]),format:o?"name":"hex"};if(t=F.hex3.exec(e))return{r:B(t[1]+""+t[1]),g:B(t[2]+""+t[2]),b:B(t[3]+""+t[3]),format:o?"name":"hex"};return!1}(e));"object"==typeof e&&(z(e.r)&&z(e.g)&&z(e.b)?(t=function(e,t,o){return{r:255*D(e,255),g:255*D(t,255),b:255*D(o,255)}}(e.r,e.g,e.b),i=!0,s="%"===String(e.r).substr(-1)?"prgb":"rgb"):z(e.h)&&z(e.s)&&z(e.v)?(e.s=O(e.s),e.v=O(e.v),t=function(e,t,o){e=6*D(e,360),t=D(t,100),o=D(o,100);var i=n.floor(e),s=e-i,a=o*(1-t),e=o*(1-s*t),t=o*(1-(1-s)*t),i=i%6;return{r:255*[o,e,a,a,t,o][i],g:255*[t,o,o,e,a,a][i],b:255*[a,a,t,o,o,e][i]}}(e.h,e.s,e.v),i=!0,s="hsv"):z(e.h)&&z(e.s)&&z(e.l)&&(e.s=O(e.s),e.l=O(e.l),t=function(e,t,o){var i,s,a;function n(e,t,o){return o<0&&(o+=1),1>1)+720)%360;--t;)i.h=(i.h+s)%360,a.push(g(i));return a}function V(e,t){t=t||6;for(var e=g(e).toHsv(),o=e.h,i=e.s,s=e.v,a=[],n=1/t;t--;)a.push(g({h:o,s:i,v:s})),s=(s+n)%1;return a}g.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e=this.toRgb(),t=e.r/255,o=e.g/255,e=e.b/255,t=t<=.03928?t/12.92:n.pow((.055+t)/1.055,2.4),o=o<=.03928?o/12.92:n.pow((.055+o)/1.055,2.4),e=e<=.03928?e/12.92:n.pow((.055+e)/1.055,2.4);return.2126*t+.7152*o+.0722*e},setAlpha:function(e){return this._a=$(e),this._roundA=s(100*this._a)/100,this},toHsv:function(){var e=d(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=d(this._r,this._g,this._b),t=s(360*e.h),o=s(100*e.s),e=s(100*e.v);return 1==this._a?"hsv("+t+", "+o+"%, "+e+"%)":"hsva("+t+", "+o+"%, "+e+"%, "+this._roundA+")"},toHsl:function(){var e=l(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=l(this._r,this._g,this._b),t=s(360*e.h),o=s(100*e.s),e=s(100*e.l);return 1==this._a?"hsl("+t+", "+o+"%, "+e+"%)":"hsla("+t+", "+o+"%, "+e+"%, "+this._roundA+")"},toHex:function(e){return t(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(){return h(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:s(this._r),g:s(this._g),b:s(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+s(this._r)+", "+s(this._g)+", "+s(this._b)+")":"rgba("+s(this._r)+", "+s(this._g)+", "+s(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:s(100*D(this._r,255))+"%",g:s(100*D(this._g,255))+"%",b:s(100*D(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+s(100*D(this._r,255))+"%, "+s(100*D(this._g,255))+"%, "+s(100*D(this._b,255))+"%)":"rgba("+s(100*D(this._r,255))+"%, "+s(100*D(this._g,255))+"%, "+s(100*D(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&C[t(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+h(this._r,this._g,this._b,this._a),o=t;return"progid:DXImageTransform.Microsoft.gradient("+(this._gradientType?"GradientType = 1, ":"")+"startColorstr="+t+",endColorstr="+(o=e?g(e).toHex8String():o)+")"},toString:function(e){var t=!!e;e=e||this._format;var o=!1,i=this._a<1&&0<=this._a;return t||!i||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"name"!==e?("rgb"===e&&(o=this.toRgbString()),"prgb"===e&&(o=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(o=this.toHexString()),"hex3"===e&&(o=this.toHexString(!0)),"hex8"===e&&(o=this.toHex8String()),"name"===e&&(o=this.toName()),"hsl"===e&&(o=this.toHslString()),(o="hsv"===e?this.toHsvString():o)||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return g(this.toString())},_applyModification:function(e,t){t=e.apply(null,[this].concat([].slice.call(t)));return this._r=t._r,this._g=t._g,this._b=t._b,this.setAlpha(t._a),this},lighten:function(){return this._applyModification(v,arguments)},brighten:function(){return this._applyModification(f,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(o,arguments)},saturate:function(){return this._applyModification(u,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(y,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(k,arguments)},complement:function(){return this._applyCombination(w,arguments)},monochromatic:function(){return this._applyCombination(V,arguments)},splitcomplement:function(){return this._applyCombination(x,arguments)},triad:function(){return this._applyCombination(S,arguments)},tetrad:function(){return this._applyCombination(M,arguments)}},g.fromRatio=function(e,t){if("object"==typeof e){var o,i={};for(o in e)e.hasOwnProperty(o)&&(i[o]="a"===o?e[o]:O(e[o]));e=i}return g(e,t)},g.equals=function(e,t){return!(!e||!t)&&g(e).toRgbString()==g(t).toRgbString()},g.random=function(){return g.fromRatio({r:e(),g:e(),b:e()})},g.mix=function(e,t,o){o=0===o?0:o||50;var i=g(e).toRgb(),s=g(t).toRgb(),e=o/100,t=2*e-1,o=s.a-i.a,t=t*o==-1?t:(t+o)/(1+t*o),o=1-(t=(t+1)/2);return g({r:s.r*t+i.r*o,g:s.g*t+i.g*o,b:s.b*t+i.b*o,a:s.a*e+i.a*(1-e)})},g.readability=function(e,t){e=g(e),t=g(t);return(n.max(e.getLuminance(),t.getLuminance())+.05)/(n.min(e.getLuminance(),t.getLuminance())+.05)},g.isReadable=function(e,t,o){var i=g.readability(e,t),s=!1,o=function(e){var t;t=((e=e||{level:"AA",size:"small"}).level||"AA").toUpperCase(),e=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA");"small"!==e&&"large"!==e&&(e="small");return{level:t,size:e}}(o);switch(o.level+o.size){case"AAsmall":case"AAAlarge":s=4.5<=i;break;case"AAlarge":s=3<=i;break;case"AAAsmall":s=7<=i}return s},g.mostReadable=function(e,t,o){for(var i,s=null,a=0,n=(o=o||{}).includeFallbackColors,r=o.level,l=o.size,p=0;p= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};var u="[object Object]";s.prototype={constructor:s,logger:n.default,log:n.default.log,registerHelper:function(t,e){if(i.toString.call(t)===u){if(e)throw new o.default("Arg not supported with multiple helpers");i.extend(this.helpers,t)}else this.helpers[t]=e},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,e){if(i.toString.call(t)===u)i.extend(this.partials,t);else{if(void 0===e)throw new o.default('Attempting to register a partial called "'+t+'" as undefined');this.partials[t]=e}},unregisterPartial:function(t){delete this.partials[t]},registerDecorator:function(t,e){if(i.toString.call(t)===u){if(e)throw new o.default("Arg not supported with multiple decorators");i.extend(this.decorators,t)}else this.decorators[t]=e},unregisterDecorator:function(t){delete this.decorators[t]},resetLoggedPropertyAccesses:function(){l.resetLoggedProperties()}};r=n.default.log;e.log=r,e.createFrame=i.createFrame,e.logger=n.default},function(t,e){"use strict";function r(t){return n[t]}function s(t){for(var e=1;e":">",'"':""","'":"'","`":"`","=":"="},i=/[&<>"'`=]/g,o=/[&<>"'`=]/,a=Object.prototype.toString;e.toString=a;var c=function(t){return"function"==typeof t};c(/x/)&&(e.isFunction=c=function(t){return"function"==typeof t&&"[object Function]"===a.call(t)}),e.isFunction=c;var l=Array.isArray||function(t){return!(!t||"object"!=typeof t)&&"[object Array]"===a.call(t)};e.isArray=l},function(t,e,r){"use strict";function l(t,e){var r=e&&e.loc,s=void 0,n=void 0,i=void 0,o=void 0;r&&(s=r.start.line,n=r.end.line,i=r.start.column,o=r.end.column,t+=" - "+s+":"+i);for(var a=Error.prototype.constructor.call(this,t),c=0;c=m.LAST_COMPATIBLE_COMPILER_REVISION&&e<=m.COMPILER_REVISION)){if(et[0].length)||(t=e,r=i,this.options.flex));i++);return t?((s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],s=this.performAction.call(this,this.yy,this,n[r],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),s||void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return void 0!==t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)},options:{},performAction:function(t,r,e,s){function n(t,e){return r.yytext=r.yytext.substring(t,r.yyleng-e+t)}switch(e){case 0:if("\\\\"===r.yytext.slice(-2)?(n(0,1),this.begin("mu")):"\\"===r.yytext.slice(-1)?(n(0,1),this.begin("emu")):this.begin("mu"),r.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(n(5,9),"END_RAW_BLOCK");case 5:return 15;case 6:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(r.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;case 23:return 48;case 24:return 73;case 25:case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return r.yytext=n(1,2).replace(/\\"/g,'"'),80;case 32:return r.yytext=n(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return r.yytext=r.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^\/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],conditions:{mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!(r={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,partialBlock:12,content:13,COMMENT:14,CONTENT:15,openRawBlock:16,rawBlock_repetition0:17,END_RAW_BLOCK:18,OPEN_RAW_BLOCK:19,helperName:20,openRawBlock_repetition0:21,openRawBlock_option0:22,CLOSE_RAW_BLOCK:23,openBlock:24,block_option0:25,closeBlock:26,openInverse:27,block_option1:28,OPEN_BLOCK:29,openBlock_repetition0:30,openBlock_option0:31,openBlock_option1:32,CLOSE:33,OPEN_INVERSE:34,openInverse_repetition0:35,openInverse_option0:36,openInverse_option1:37,openInverseChain:38,OPEN_INVERSE_CHAIN:39,openInverseChain_repetition0:40,openInverseChain_option0:41,openInverseChain_option1:42,inverseAndProgram:43,INVERSE:44,inverseChain:45,inverseChain_option0:46,OPEN_ENDBLOCK:47,OPEN:48,mustache_repetition0:49,mustache_option0:50,OPEN_UNESCAPED:51,mustache_repetition1:52,mustache_option1:53,CLOSE_UNESCAPED:54,OPEN_PARTIAL:55,partialName:56,partial_repetition0:57,partial_option0:58,openPartialBlock:59,OPEN_PARTIAL_BLOCK:60,openPartialBlock_repetition0:61,openPartialBlock_option0:62,param:63,sexpr:64,OPEN_SEXPR:65,sexpr_repetition0:66,sexpr_option0:67,CLOSE_SEXPR:68,hash:69,hash_repetition_plus0:70,hashSegment:71,ID:72,EQUALS:73,blockParams:74,OPEN_BLOCK_PARAMS:75,blockParams_repetition_plus0:76,CLOSE_BLOCK_PARAMS:77,path:78,dataName:79,STRING:80,NUMBER:81,BOOLEAN:82,UNDEFINED:83,NULL:84,DATA:85,pathSegments:86,SEP:87,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"COMMENT",15:"CONTENT",18:"END_RAW_BLOCK",19:"OPEN_RAW_BLOCK",23:"CLOSE_RAW_BLOCK",29:"OPEN_BLOCK",33:"CLOSE",34:"OPEN_INVERSE",39:"OPEN_INVERSE_CHAIN",44:"INVERSE",47:"OPEN_ENDBLOCK",48:"OPEN",51:"OPEN_UNESCAPED",54:"CLOSE_UNESCAPED",55:"OPEN_PARTIAL",60:"OPEN_PARTIAL_BLOCK",65:"OPEN_SEXPR",68:"CLOSE_SEXPR",72:"ID",73:"EQUALS",75:"OPEN_BLOCK_PARAMS",77:"CLOSE_BLOCK_PARAMS",80:"STRING",81:"NUMBER",82:"BOOLEAN",83:"UNDEFINED",84:"NULL",85:"DATA",87:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[13,1],[10,3],[16,5],[9,4],[9,4],[24,6],[27,6],[38,6],[43,2],[45,3],[45,1],[26,3],[8,5],[8,5],[11,5],[12,3],[59,5],[63,1],[63,1],[64,5],[69,1],[71,3],[74,3],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[56,1],[56,1],[79,2],[78,1],[86,3],[86,1],[6,0],[6,2],[17,0],[17,2],[21,0],[21,2],[22,0],[22,1],[25,0],[25,1],[28,0],[28,1],[30,0],[30,2],[31,0],[31,1],[32,0],[32,1],[35,0],[35,2],[36,0],[36,1],[37,0],[37,1],[40,0],[40,2],[41,0],[41,1],[42,0],[42,1],[46,0],[46,1],[49,0],[49,2],[50,0],[50,1],[52,0],[52,2],[53,0],[53,1],[57,0],[57,2],[58,0],[58,1],[61,0],[61,2],[62,0],[62,1],[66,0],[66,2],[67,0],[67,1],[70,1],[70,2],[76,1],[76,2]],performAction:function(t,e,r,s,n,i,o){var a=i.length-1;switch(n){case 1:return i[a-1];case 2:this.$=s.prepareProgram(i[a]);break;case 3:case 4:case 5:case 6:case 7:case 8:this.$=i[a];break;case 9:this.$={type:"CommentStatement",value:s.stripComment(i[a]),strip:s.stripFlags(i[a],i[a]),loc:s.locInfo(this._$)};break;case 10:this.$={type:"ContentStatement",original:i[a],value:i[a],loc:s.locInfo(this._$)};break;case 11:this.$=s.prepareRawBlock(i[a-2],i[a-1],i[a],this._$);break;case 12:this.$={path:i[a-3],params:i[a-2],hash:i[a-1]};break;case 13:this.$=s.prepareBlock(i[a-3],i[a-2],i[a-1],i[a],!1,this._$);break;case 14:this.$=s.prepareBlock(i[a-3],i[a-2],i[a-1],i[a],!0,this._$);break;case 15:this.$={open:i[a-5],path:i[a-4],params:i[a-3],hash:i[a-2],blockParams:i[a-1],strip:s.stripFlags(i[a-5],i[a])};break;case 16:case 17:this.$={path:i[a-4],params:i[a-3],hash:i[a-2],blockParams:i[a-1],strip:s.stripFlags(i[a-5],i[a])};break;case 18:this.$={strip:s.stripFlags(i[a-1],i[a-1]),program:i[a]};break;case 19:var c=s.prepareBlock(i[a-2],i[a-1],i[a],i[a],!1,this._$),c=s.prepareProgram([c],i[a-1].loc);c.chained=!0,this.$={strip:i[a-2].strip,program:c,chain:!0};break;case 20:this.$=i[a];break;case 21:this.$={path:i[a-1],strip:s.stripFlags(i[a-2],i[a])};break;case 22:case 23:this.$=s.prepareMustache(i[a-3],i[a-2],i[a-1],i[a-4],s.stripFlags(i[a-4],i[a]),this._$);break;case 24:this.$={type:"PartialStatement",name:i[a-3],params:i[a-2],hash:i[a-1],indent:"",strip:s.stripFlags(i[a-4],i[a]),loc:s.locInfo(this._$)};break;case 25:this.$=s.preparePartialBlock(i[a-2],i[a-1],i[a],this._$);break;case 26:this.$={path:i[a-3],params:i[a-2],hash:i[a-1],strip:s.stripFlags(i[a-4],i[a])};break;case 27:case 28:this.$=i[a];break;case 29:this.$={type:"SubExpression",path:i[a-3],params:i[a-2],hash:i[a-1],loc:s.locInfo(this._$)};break;case 30:this.$={type:"Hash",pairs:i[a],loc:s.locInfo(this._$)};break;case 31:this.$={type:"HashPair",key:s.id(i[a-2]),value:i[a],loc:s.locInfo(this._$)};break;case 32:this.$=s.id(i[a-1]);break;case 33:case 34:this.$=i[a];break;case 35:this.$={type:"StringLiteral",value:i[a],original:i[a],loc:s.locInfo(this._$)};break;case 36:this.$={type:"NumberLiteral",value:Number(i[a]),original:Number(i[a]),loc:s.locInfo(this._$)};break;case 37:this.$={type:"BooleanLiteral",value:"true"===i[a],original:"true"===i[a],loc:s.locInfo(this._$)};break;case 38:this.$={type:"UndefinedLiteral",original:void 0,value:void 0,loc:s.locInfo(this._$)};break;case 39:this.$={type:"NullLiteral",original:null,value:null,loc:s.locInfo(this._$)};break;case 40:case 41:this.$=i[a];break;case 42:this.$=s.preparePath(!0,i[a],this._$);break;case 43:this.$=s.preparePath(!1,i[a],this._$);break;case 44:i[a-2].push({part:s.id(i[a]),original:i[a],separator:i[a-1]}),this.$=i[a-2];break;case 45:this.$=[{part:s.id(i[a]),original:i[a]}];break;case 46:this.$=[];break;case 47:i[a-1].push(i[a]);break;case 48:this.$=[];break;case 49:i[a-1].push(i[a]);break;case 50:this.$=[];break;case 51:i[a-1].push(i[a]);break;case 58:this.$=[];break;case 59:i[a-1].push(i[a]);break;case 64:this.$=[];break;case 65:i[a-1].push(i[a]);break;case 70:this.$=[];break;case 71:i[a-1].push(i[a]);break;case 78:this.$=[];break;case 79:i[a-1].push(i[a]);break;case 82:this.$=[];break;case 83:i[a-1].push(i[a]);break;case 86:this.$=[];break;case 87:i[a-1].push(i[a]);break;case 90:this.$=[];break;case 91:i[a-1].push(i[a]);break;case 94:this.$=[];break;case 95:i[a-1].push(i[a]);break;case 98:this.$=[i[a]];break;case 99:i[a-1].push(i[a]);break;case 100:this.$=[i[a]];break;case 101:i[a-1].push(i[a])}},table:[{3:1,4:2,5:[2,46],6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:11,14:[1,12],15:[1,20],16:17,19:[1,23],24:15,27:16,29:[1,21],34:[1,22],39:[2,2],44:[2,2],47:[2,2],48:[1,13],51:[1,14],55:[1,18],59:19,60:[1,24]},{1:[2,1]},{5:[2,47],14:[2,47],15:[2,47],19:[2,47],29:[2,47],34:[2,47],39:[2,47],44:[2,47],47:[2,47],48:[2,47],51:[2,47],55:[2,47],60:[2,47]},{5:[2,3],14:[2,3],15:[2,3],19:[2,3],29:[2,3],34:[2,3],39:[2,3],44:[2,3],47:[2,3],48:[2,3],51:[2,3],55:[2,3],60:[2,3]},{5:[2,4],14:[2,4],15:[2,4],19:[2,4],29:[2,4],34:[2,4],39:[2,4],44:[2,4],47:[2,4],48:[2,4],51:[2,4],55:[2,4],60:[2,4]},{5:[2,5],14:[2,5],15:[2,5],19:[2,5],29:[2,5],34:[2,5],39:[2,5],44:[2,5],47:[2,5],48:[2,5],51:[2,5],55:[2,5],60:[2,5]},{5:[2,6],14:[2,6],15:[2,6],19:[2,6],29:[2,6],34:[2,6],39:[2,6],44:[2,6],47:[2,6],48:[2,6],51:[2,6],55:[2,6],60:[2,6]},{5:[2,7],14:[2,7],15:[2,7],19:[2,7],29:[2,7],34:[2,7],39:[2,7],44:[2,7],47:[2,7],48:[2,7],51:[2,7],55:[2,7],60:[2,7]},{5:[2,8],14:[2,8],15:[2,8],19:[2,8],29:[2,8],34:[2,8],39:[2,8],44:[2,8],47:[2,8],48:[2,8],51:[2,8],55:[2,8],60:[2,8]},{5:[2,9],14:[2,9],15:[2,9],19:[2,9],29:[2,9],34:[2,9],39:[2,9],44:[2,9],47:[2,9],48:[2,9],51:[2,9],55:[2,9],60:[2,9]},{20:25,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:36,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:37,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{4:38,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{15:[2,48],17:39,18:[2,48]},{20:41,56:40,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:44,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{5:[2,10],14:[2,10],15:[2,10],18:[2,10],19:[2,10],29:[2,10],34:[2,10],39:[2,10],44:[2,10],47:[2,10],48:[2,10],51:[2,10],55:[2,10],60:[2,10]},{20:45,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:46,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:47,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:41,56:48,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[2,78],49:49,65:[2,78],72:[2,78],80:[2,78],81:[2,78],82:[2,78],83:[2,78],84:[2,78],85:[2,78]},{23:[2,33],33:[2,33],54:[2,33],65:[2,33],68:[2,33],72:[2,33],75:[2,33],80:[2,33],81:[2,33],82:[2,33],83:[2,33],84:[2,33],85:[2,33]},{23:[2,34],33:[2,34],54:[2,34],65:[2,34],68:[2,34],72:[2,34],75:[2,34],80:[2,34],81:[2,34],82:[2,34],83:[2,34],84:[2,34],85:[2,34]},{23:[2,35],33:[2,35],54:[2,35],65:[2,35],68:[2,35],72:[2,35],75:[2,35],80:[2,35],81:[2,35],82:[2,35],83:[2,35],84:[2,35],85:[2,35]},{23:[2,36],33:[2,36],54:[2,36],65:[2,36],68:[2,36],72:[2,36],75:[2,36],80:[2,36],81:[2,36],82:[2,36],83:[2,36],84:[2,36],85:[2,36]},{23:[2,37],33:[2,37],54:[2,37],65:[2,37],68:[2,37],72:[2,37],75:[2,37],80:[2,37],81:[2,37],82:[2,37],83:[2,37],84:[2,37],85:[2,37]},{23:[2,38],33:[2,38],54:[2,38],65:[2,38],68:[2,38],72:[2,38],75:[2,38],80:[2,38],81:[2,38],82:[2,38],83:[2,38],84:[2,38],85:[2,38]},{23:[2,39],33:[2,39],54:[2,39],65:[2,39],68:[2,39],72:[2,39],75:[2,39],80:[2,39],81:[2,39],82:[2,39],83:[2,39],84:[2,39],85:[2,39]},{23:[2,43],33:[2,43],54:[2,43],65:[2,43],68:[2,43],72:[2,43],75:[2,43],80:[2,43],81:[2,43],82:[2,43],83:[2,43],84:[2,43],85:[2,43],87:[1,50]},{72:[1,35],86:51},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{52:52,54:[2,82],65:[2,82],72:[2,82],80:[2,82],81:[2,82],82:[2,82],83:[2,82],84:[2,82],85:[2,82]},{25:53,38:55,39:[1,57],43:56,44:[1,58],45:54,47:[2,54]},{28:59,43:60,44:[1,58],47:[2,56]},{13:62,15:[1,20],18:[1,61]},{33:[2,86],57:63,65:[2,86],72:[2,86],80:[2,86],81:[2,86],82:[2,86],83:[2,86],84:[2,86],85:[2,86]},{33:[2,40],65:[2,40],72:[2,40],80:[2,40],81:[2,40],82:[2,40],83:[2,40],84:[2,40],85:[2,40]},{33:[2,41],65:[2,41],72:[2,41],80:[2,41],81:[2,41],82:[2,41],83:[2,41],84:[2,41],85:[2,41]},{20:64,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:65,47:[1,66]},{30:67,33:[2,58],65:[2,58],72:[2,58],75:[2,58],80:[2,58],81:[2,58],82:[2,58],83:[2,58],84:[2,58],85:[2,58]},{33:[2,64],35:68,65:[2,64],72:[2,64],75:[2,64],80:[2,64],81:[2,64],82:[2,64],83:[2,64],84:[2,64],85:[2,64]},{21:69,23:[2,50],65:[2,50],72:[2,50],80:[2,50],81:[2,50],82:[2,50],83:[2,50],84:[2,50],85:[2,50]},{33:[2,90],61:70,65:[2,90],72:[2,90],80:[2,90],81:[2,90],82:[2,90],83:[2,90],84:[2,90],85:[2,90]},{20:74,33:[2,80],50:71,63:72,64:75,65:[1,43],69:73,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{72:[1,79]},{23:[2,42],33:[2,42],54:[2,42],65:[2,42],68:[2,42],72:[2,42],75:[2,42],80:[2,42],81:[2,42],82:[2,42],83:[2,42],84:[2,42],85:[2,42],87:[1,50]},{20:74,53:80,54:[2,84],63:81,64:75,65:[1,43],69:82,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:83,47:[1,66]},{47:[2,55]},{4:84,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{47:[2,20]},{20:85,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:86,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{26:87,47:[1,66]},{47:[2,57]},{5:[2,11],14:[2,11],15:[2,11],19:[2,11],29:[2,11],34:[2,11],39:[2,11],44:[2,11],47:[2,11],48:[2,11],51:[2,11],55:[2,11],60:[2,11]},{15:[2,49],18:[2,49]},{20:74,33:[2,88],58:88,63:89,64:75,65:[1,43],69:90,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{65:[2,94],66:91,68:[2,94],72:[2,94],80:[2,94],81:[2,94],82:[2,94],83:[2,94],84:[2,94],85:[2,94]},{5:[2,25],14:[2,25],15:[2,25],19:[2,25],29:[2,25],34:[2,25],39:[2,25],44:[2,25],47:[2,25],48:[2,25],51:[2,25],55:[2,25],60:[2,25]},{20:92,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,31:93,33:[2,60],63:94,64:75,65:[1,43],69:95,70:76,71:77,72:[1,78],75:[2,60],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,66],36:96,63:97,64:75,65:[1,43],69:98,70:76,71:77,72:[1,78],75:[2,66],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,22:99,23:[2,52],63:100,64:75,65:[1,43],69:101,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,92],62:102,63:103,64:75,65:[1,43],69:104,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,105]},{33:[2,79],65:[2,79],72:[2,79],80:[2,79],81:[2,79],82:[2,79],83:[2,79],84:[2,79],85:[2,79]},{33:[2,81]},{23:[2,27],33:[2,27],54:[2,27],65:[2,27],68:[2,27],72:[2,27],75:[2,27],80:[2,27],81:[2,27],82:[2,27],83:[2,27],84:[2,27],85:[2,27]},{23:[2,28],33:[2,28],54:[2,28],65:[2,28],68:[2,28],72:[2,28],75:[2,28],80:[2,28],81:[2,28],82:[2,28],83:[2,28],84:[2,28],85:[2,28]},{23:[2,30],33:[2,30],54:[2,30],68:[2,30],71:106,72:[1,107],75:[2,30]},{23:[2,98],33:[2,98],54:[2,98],68:[2,98],72:[2,98],75:[2,98]},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],73:[1,108],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{23:[2,44],33:[2,44],54:[2,44],65:[2,44],68:[2,44],72:[2,44],75:[2,44],80:[2,44],81:[2,44],82:[2,44],83:[2,44],84:[2,44],85:[2,44],87:[2,44]},{54:[1,109]},{54:[2,83],65:[2,83],72:[2,83],80:[2,83],81:[2,83],82:[2,83],83:[2,83],84:[2,83],85:[2,83]},{54:[2,85]},{5:[2,13],14:[2,13],15:[2,13],19:[2,13],29:[2,13],34:[2,13],39:[2,13],44:[2,13],47:[2,13],48:[2,13],51:[2,13],55:[2,13],60:[2,13]},{38:55,39:[1,57],43:56,44:[1,58],45:111,46:110,47:[2,76]},{33:[2,70],40:112,65:[2,70],72:[2,70],75:[2,70],80:[2,70],81:[2,70],82:[2,70],83:[2,70],84:[2,70],85:[2,70]},{47:[2,18]},{5:[2,14],14:[2,14],15:[2,14],19:[2,14],29:[2,14],34:[2,14],39:[2,14],44:[2,14],47:[2,14],48:[2,14],51:[2,14],55:[2,14],60:[2,14]},{33:[1,113]},{33:[2,87],65:[2,87],72:[2,87],80:[2,87],81:[2,87],82:[2,87],83:[2,87],84:[2,87],85:[2,87]},{33:[2,89]},{20:74,63:115,64:75,65:[1,43],67:114,68:[2,96],69:116,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,117]},{32:118,33:[2,62],74:119,75:[1,120]},{33:[2,59],65:[2,59],72:[2,59],75:[2,59],80:[2,59],81:[2,59],82:[2,59],83:[2,59],84:[2,59],85:[2,59]},{33:[2,61],75:[2,61]},{33:[2,68],37:121,74:122,75:[1,120]},{33:[2,65],65:[2,65],72:[2,65],75:[2,65],80:[2,65],81:[2,65],82:[2,65],83:[2,65],84:[2,65],85:[2,65]},{33:[2,67],75:[2,67]},{23:[1,123]},{23:[2,51],65:[2,51],72:[2,51],80:[2,51],81:[2,51],82:[2,51],83:[2,51],84:[2,51],85:[2,51]},{23:[2,53]},{33:[1,124]},{33:[2,91],65:[2,91],72:[2,91],80:[2,91],81:[2,91],82:[2,91],83:[2,91],84:[2,91],85:[2,91]},{33:[2,93]},{5:[2,22],14:[2,22],15:[2,22],19:[2,22],29:[2,22],34:[2,22],39:[2,22],44:[2,22],47:[2,22],48:[2,22],51:[2,22],55:[2,22],60:[2,22]},{23:[2,99],33:[2,99],54:[2,99],68:[2,99],72:[2,99],75:[2,99]},{73:[1,108]},{20:74,63:125,64:75,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,23],14:[2,23],15:[2,23],19:[2,23],29:[2,23],34:[2,23],39:[2,23],44:[2,23],47:[2,23],48:[2,23],51:[2,23],55:[2,23],60:[2,23]},{47:[2,19]},{47:[2,77]},{20:74,33:[2,72],41:126,63:127,64:75,65:[1,43],69:128,70:76,71:77,72:[1,78],75:[2,72],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,24],14:[2,24],15:[2,24],19:[2,24],29:[2,24],34:[2,24],39:[2,24],44:[2,24],47:[2,24],48:[2,24],51:[2,24],55:[2,24],60:[2,24]},{68:[1,129]},{65:[2,95],68:[2,95],72:[2,95],80:[2,95],81:[2,95],82:[2,95],83:[2,95],84:[2,95],85:[2,95]},{68:[2,97]},{5:[2,21],14:[2,21],15:[2,21],19:[2,21],29:[2,21],34:[2,21],39:[2,21],44:[2,21],47:[2,21],48:[2,21],51:[2,21],55:[2,21],60:[2,21]},{33:[1,130]},{33:[2,63]},{72:[1,132],76:131},{33:[1,133]},{33:[2,69]},{15:[2,12],18:[2,12]},{14:[2,26],15:[2,26],19:[2,26],29:[2,26],34:[2,26],47:[2,26],48:[2,26],51:[2,26],55:[2,26],60:[2,26]},{23:[2,31],33:[2,31],54:[2,31],68:[2,31],72:[2,31],75:[2,31]},{33:[2,74],42:134,74:135,75:[1,120]},{33:[2,71],65:[2,71],72:[2,71],75:[2,71],80:[2,71],81:[2,71],82:[2,71],83:[2,71],84:[2,71],85:[2,71]},{33:[2,73],75:[2,73]},{23:[2,29],33:[2,29],54:[2,29],65:[2,29],68:[2,29],72:[2,29],75:[2,29],80:[2,29],81:[2,29],82:[2,29],83:[2,29],84:[2,29],85:[2,29]},{14:[2,15],15:[2,15],19:[2,15],29:[2,15],34:[2,15],39:[2,15],44:[2,15],47:[2,15],48:[2,15],51:[2,15],55:[2,15],60:[2,15]},{72:[1,137],77:[1,136]},{72:[2,100],77:[2,100]},{14:[2,16],15:[2,16],19:[2,16],29:[2,16],34:[2,16],44:[2,16],47:[2,16],48:[2,16],51:[2,16],55:[2,16],60:[2,16]},{33:[1,138]},{33:[2,75]},{33:[2,32]},{72:[2,101],77:[2,101]},{14:[2,17],15:[2,17],19:[2,17],29:[2,17],34:[2,17],39:[2,17],44:[2,17],47:[2,17],48:[2,17],51:[2,17],55:[2,17],60:[2,17]}],defaultActions:{4:[2,1],54:[2,55],56:[2,20],60:[2,57],73:[2,81],82:[2,85],86:[2,18],90:[2,89],101:[2,53],104:[2,93],110:[2,19],111:[2,77],116:[2,97],119:[2,63],122:[2,69],135:[2,75],136:[2,32]},parseError:function(t,e){throw new Error(t)},parse:function(t){var e=this,r=[0],s=[null],n=[],i=this.table,o="",a=0,c=0,l=0;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,void 0===(this.yy.parser=this).lexer.yylloc&&(this.lexer.yylloc={});var u=this.lexer.yylloc;n.push(u);var p=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var h,f,d,m,g,v,y,k,S,b={};;){if(d=r[r.length-1],void 0===(m=this.defaultActions[d]||(null!=h||(S=void 0,h=S="number"!=typeof(S=e.lexer.lex()||1)&&e.symbols_[S]||S),i[d]&&i[d][h]))||!m.length||!m[0]){var _;if(!l){for(v in k=[],i[d])this.terminals_[v]&&2this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var t=this.inlineStack;this.inlineStack=[];for(var e=0,r=t.length;e ",1+'+(e.length-1)+""),new Handlebars.SafeString(r)}),Handlebars.registerHelper("getSelectedOptions",function(e,r,t){e=e[r],r="";if(e&&e.length)return r+=' ",1+'+(e.length-1)+""),new Handlebars.SafeString(r)}),Handlebars.registerHelper("getRegionIDs",function(e,r,t){e=e[r],r="";if(e&&e.length)return r+=' ",1+'+(e.length-1)+""),new Handlebars.SafeString(r)}),Handlebars.registerHelper("getThumbs",function(e,r,t){e=e[r],r="";if(e&&e.length)return r+='',1+'+(e.length-1)+""),new Handlebars.SafeString(r)}),Handlebars.registerHelper("getMarkerImage",function(e,r,t){r=e[r];if(r&&r.img)return new Handlebars.SafeString(' '+(r.address&&r.address.formatted?r.address.formatted:""))}),Handlebars.registerHelper("not",function(e,r,t){return e!=r?t.fn(this):t.inverse(this)}),Handlebars.registerHelper("if_starts",function(e,r,t){return e&&0==e.indexOf(r)?t.fn(this):t.inverse(this)}),Handlebars.registerHelper("if_function",function(e,r){return"function"==typeof e?r.fn(this):r.inverse(this)}),Handlebars.registerHelper("if_number",function(e,r){return jQuery.isNumeric(e)?r.fn(this):r.inverse(this)}),Handlebars.registerHelper("if_string",function(e,r){return"string"!=typeof e||jQuery.isNumeric(e)?r.inverse(this):r.fn(this)}),Handlebars.registerHelper("toString",function(e){return null!=e?MapSVG.convertToText(e):""}),Handlebars.registerHelper("jsonToString",function(e){return null!=e?JSON.stringify(e):""}),Handlebars.registerHelper("log",function(e){return console.log(e),e}),Handlebars.registerHelper("distanceFrom",function(e){if(MapSVG.distanceSearch){e=getDistanceFromLatLonInKm(e.lat,e.lng,MapSVG.distanceSearch.latlng.lat,MapSVG.distanceSearch.latlng.lng);return"mi"===MapSVG.distanceSearch.units&&(e*=.62137),e.toFixed(2)+" "+MapSVG.distanceSearch.unitsLabel}return""}),Handlebars.registerHelper("distanceTo",function(e){if(MapSVG.distanceSearch){e=getDistanceFromLatLonInKm(e.lat,e.lng,MapSVG.distanceSearch.latlng.lat,MapSVG.distanceSearch.latlng.lng);return"mi"===MapSVG.distanceSearch.units&&(e*=.62137),e.toFixed(2)+" "+MapSVG.distanceSearch.unitsLabel}return""}),Handlebars.registerHelper("stripUnderscores",function(e){return null!=e?e.replace(/_/g," "):""}),Handlebars.registerHelper("spacesToUnderscores",function(e){return null!=e?e.replace(/ /g,"_"):""}),Handlebars.registerHelper("switch",function(e,r){this._switch_value_=e,this._switch_break_=!1;r=r.fn(this);return delete this._switch_break_,delete this._switch_value_,r}),Handlebars.registerHelper("case",function(e,r){var t=Array.prototype.slice.call(arguments),r=t.pop();return this._switch_break_||!this._open_break_&&-1===t.indexOf(this._switch_value_)?"":("true"===r.hash.break||!0===r.hash.break?this._switch_break_=!0:this._open_break_=!0,r.fn(this))}),Handlebars.registerHelper("default",function(e){if(!this._switch_break_)return e.fn(this)}),Handlebars.registerHelper("numberFormat",function(e,r){var t=r.hash.decimalLength||2,n=r.hash.thousandsSep||" ",a=r.hash.decimalSep||".",r="\\d(?=(\\d{3})+"+(0')}),Handlebars.registerHelper("shortcode_inline",function(e){for(item in this)e=e.replace(new RegExp("{{"+item+"}}","g"),this[item]);void 0===window.MapSVG.shortcodeCounter&&(window.MapSVG.shortcodeCounter=0);var r="mapsvg-inline-shortcode-"+ ++window.MapSVG.shortcodeCounter,t='';return jQuery.get(ajaxurl,{action:"mapsvg_shortcode",shortcode:e},function(e){jQuery("#"+r).replaceWith(e)}),new Handlebars.SafeString(t)}),Handlebars.registerHelper("post",function(e){return this.post_id?(void 0===window.MapSVG.resizeIframe&&(window.MapSVG.resizeIframe=function(e){jQuery(e).contents();window.addEventListener("message",function(e){for(var r=document.getElementsByTagName("iframe"),t=0;t')):""}),Handlebars.registerHelper("math",function(e,r,t){return{"+":(e=parseFloat(e))+(t=parseFloat(t)),"-":e-t,"*":e*t,"/":e/t,"%":e%t}[r]}); var scripts=document.getElementsByTagName("script"),myScript=scripts[scripts.length-1].src.split("/");myScript.pop();var pluginRootURL=myScript.join("/")+"/";!function(u,r,e){function i(e,t){e=e||{};var a,i=this;this.formBuilder=t,this.images=[],this.type=e.type,this.value=e.value,this.searchable=r.parseBoolean(e.searchable),this.databaseFields=this.formBuilder.mapsvg.database.getSchema().map(function(e){if("text"==e.type||"region"==e.type||"textarea"==e.type||"post"==e.type||"select"==e.type||"radio"==e.type||"checkbox"==e.type)return"post"==e.type?"Object.post.post_title":"Object."+e.name}),this.databaseFieldsFilterableShort=this.formBuilder.mapsvg.database.getSchema().filter(function(e){return"select"==e.type||"radio"==e.type||"region"==e.type}).map(function(e){return e.name}),this.regionFields=this.formBuilder.mapsvg.regionsDatabase.getSchema().map(function(e){if("status"==e.type||"text"==e.type||"textarea"==e.type||"post"==e.type||"select"==e.type||"radio"==e.type||"checkbox"==e.type)return"post"==e.type?"Region.post.post_title":"Region."+e.name}),this.db_type="varchar(255)","region"==this.type?(this.options=this.formBuilder.getRegionsList(),this.label="Regions",this.name="regions",this.db_type="text"):"text"==this.type?this.searchType=e.searchType||"fulltext":"textarea"==this.type?(this.autobr=e.autobr,this.html=e.html,this.db_type="text"):"modal"==this.type?this.showButtonText=e.showButtonText:"location"==this.type?(this.location=this.value,this.label=this.label||(void 0===e.label?"Location":e.label),this.name="location",this.db_type="text",this.languages=[{value:"sq",label:"Albanian"},{value:"ar",label:"Arabic"},{value:"eu",label:"Basque"},{value:"be",label:"Belarusian"},{value:"bg",label:"Bulgarian"},{value:"my",label:"Burmese"},{value:"bn",label:"Bengali"},{value:"ca",label:"Catalan"},{value:"zh-cn",label:"Chinese (simplified)"},{value:"zh-tw",label:"Chinese (traditional)"},{value:"hr",label:"Croatian"},{value:"cs",label:"Czech"},{value:"da",label:"Danish"},{value:"nl",label:"Dutch"},{value:"en",label:"English"},{value:"en-au",label:"English (australian)"},{value:"en-gb",label:"English (great Britain)"},{value:"fa",label:"Farsi"},{value:"fi",label:"Finnish"},{value:"fil",label:"Filipino"},{value:"fr",label:"French"},{value:"gl",label:"Galician"},{value:"de",label:"German"},{value:"el",label:"Greek"},{value:"gu",label:"Gujarati"},{value:"iw",label:"Hebrew"},{value:"hi",label:"Hindi"},{value:"hu",label:"Hungarian"},{value:"id",label:"Indonesian"},{value:"it",label:"Italian"},{value:"ja",label:"Japanese"},{value:"kn",label:"Kannada"},{value:"kk",label:"Kazakh"},{value:"ko",label:"Korean"},{value:"ky",label:"Kyrgyz"},{value:"lt",label:"Lithuanian"},{value:"lv",label:"Latvian"},{value:"mk",label:"Macedonian"},{value:"ml",label:"Malayalam"},{value:"mr",label:"Marathi"},{value:"no",label:"Norwegian"},{value:"pl",label:"Polish"},{value:"pt",label:"Portuguese"},{value:"pt-br",label:"Portuguese (brazil)"},{value:"pt-pt",label:"Portuguese (portugal)"},{value:"pa",label:"Punjabi"},{value:"ro",label:"Romanian"},{value:"ru",label:"Russian"},{value:"sr",label:"Serbian"},{value:"sk",label:"Slovak"},{value:"sl",label:"Slovenian"},{value:"es",label:"Spanish"},{value:"sv",label:"Swedish"},{value:"tl",label:"Tagalog"},{value:"ta",label:"Tamil"},{value:"te",label:"Telugu"},{value:"th",label:"Thai"},{value:"tr",label:"Turkish"},{value:"uk",label:"Ukrainian"},{value:"uz",label:"Uzbek"},{value:"vi",label:"Vietnamese"}],this.language=e.language,this.markerImages=r.markerImages,this.markersByField=e.markersByField,this.markerField=e.markerField,this.markersByFieldEnabled=r.parseBoolean(e.markersByFieldEnabled)):"search"==this.type?(this.searchFallback=r.parseBoolean(e.searchFallback),this.placeholder=e.placeholder||"Search",this.noResultsText=e.noResultsText||"No results found",this.width=i.formBuilder.filtersHide&&!i.formBuilder.modal?null:e.width||"100%"):"distance"==this.type?(this.label=this.label||(void 0===e.label?"Search radius":e.label),this.distanceControl=e.distanceControl||"select",this.distanceUnits=e.distanceUnits||"km",this.distanceUnitsLabel=e.distanceUnitsLabel||"km",this.fromLabel=e.fromLabel||"from",this.placeholder=e.placeholder,this.userLocationButton=e.userLocationButton||!1,this.type=e.type,this.addressField=e.addressField||!0,this.addressFieldPlaceholder=e.addressFieldPlaceholder||"Address",this.languages=[{value:"sq",label:"Albanian"},{value:"ar",label:"Arabic"},{value:"eu",label:"Basque"},{value:"be",label:"Belarusian"},{value:"bg",label:"Bulgarian"},{value:"my",label:"Burmese"},{value:"bn",label:"Bengali"},{value:"ca",label:"Catalan"},{value:"zh-cn",label:"Chinese (simplified)"},{value:"zh-tw",label:"Chinese (traditional)"},{value:"hr",label:"Croatian"},{value:"cs",label:"Czech"},{value:"da",label:"Danish"},{value:"nl",label:"Dutch"},{value:"en",label:"English"},{value:"en-au",label:"English (australian)"},{value:"en-gb",label:"English (great Britain)"},{value:"fa",label:"Farsi"},{value:"fi",label:"Finnish"},{value:"fil",label:"Filipino"},{value:"fr",label:"French"},{value:"gl",label:"Galician"},{value:"de",label:"German"},{value:"el",label:"Greek"},{value:"gu",label:"Gujarati"},{value:"iw",label:"Hebrew"},{value:"hi",label:"Hindi"},{value:"hu",label:"Hungarian"},{value:"id",label:"Indonesian"},{value:"it",label:"Italian"},{value:"ja",label:"Japanese"},{value:"kn",label:"Kannada"},{value:"kk",label:"Kazakh"},{value:"ko",label:"Korean"},{value:"ky",label:"Kyrgyz"},{value:"lt",label:"Lithuanian"},{value:"lv",label:"Latvian"},{value:"mk",label:"Macedonian"},{value:"ml",label:"Malayalam"},{value:"mr",label:"Marathi"},{value:"no",label:"Norwegian"},{value:"pl",label:"Polish"},{value:"pt",label:"Portuguese"},{value:"pt-br",label:"Portuguese (brazil)"},{value:"pt-pt",label:"Portuguese (portugal)"},{value:"pa",label:"Punjabi"},{value:"ro",label:"Romanian"},{value:"ru",label:"Russian"},{value:"sr",label:"Serbian"},{value:"sk",label:"Slovak"},{value:"sl",label:"Slovenian"},{value:"es",label:"Spanish"},{value:"sv",label:"Swedish"},{value:"tl",label:"Tagalog"},{value:"ta",label:"Tamil"},{value:"te",label:"Telugu"},{value:"th",label:"Thai"},{value:"tr",label:"Turkish"},{value:"uk",label:"Ukrainian"},{value:"uz",label:"Uzbek"},{value:"vi",label:"Vietnamese"}],this.countries=r.countries,this.country=e.country,this.language=e.language,this.searchByZip=e.searchByZip,this.zipLength=e.zipLength||5,this.userLocationButton=r.parseBoolean(e.userLocationButton),this.options=e.options||[{value:"10",default:!0},{value:"30",default:!1},{value:"50",default:!1},{value:"100",default:!1}],a=!1,i.value&&this.options.forEach(function(e){e.value===i.value.length&&(e.selected=!0,a=!0)}),a||this.options.forEach(function(e){e.default&&(e.selected=!0)})):"post"==this.type?(i.formBuilder.admin&&(this.post_types=this.formBuilder.admin.getPostTypes()),this.post_type=e.post_type||this.post_types[0],this.add_fields=r.parseBoolean(e.add_fields),this.db_type="int(11)",this.name="post_id",this.post_id=e.post_id,this.post=e.post):"checkbox"==this.type?(this.db_type="tinyint(1)",this.checkboxLabel=e.checkboxLabel,this.checkboxValue=e.checkboxValue):"checkboxes"==this.type?(this.db_type="text",this.checkboxLabel=e.checkboxLabel,this.options=e.options||[{label:"Option one",name:"option_one",value:1},{label:"Option two",name:"option_two",value:2}],this.optionsDict=e.optionsDict||{},this.optionsDict||this.options.forEach(function(e){i.optionsDict[e.value]=e.label})):"radio"==this.type||"select"==this.type?(this.options=e.options||[{label:"Option one",name:"option_one",value:1},{label:"Option two",name:"option_two",value:2}],"select"==this.type&&(this.multiselect=e.multiselect,this.optionsGrouped=e.optionsGrouped,this.db_type=this.multiselect?"text":"varchar(255)"),this.optionsDict=e.optionsDict||{},this.optionsDict||this.options.forEach(function(e){i.optionsDict[e.value]=e.label})):"image"==this.type?(this.button_text=e.button_text||"Browse...",this.db_type="text",this.label=e.label||"Images",this.name=e.name||"images"):"status"==this.type?(this.label=e.label||"Status",this.name="status",this.options=e.options||[{label:"Enabled",value:1,color:"",disabled:!1},{label:"Disabled",value:0,color:"",disabled:!0}]):"date"==this.type&&(i.formBuilder.admin&&(this.languages=["en-GB","ar","az","bg","bs","ca","cs","cy","da","de","el","es","et","eu","fa","fi","fo","fr","gl","he","hr","hu","hy","id","is","it","ja","ka","kh","kk","kr","lt","lv","mk","ms","nb","nl","nl-BE","no","pl","pt-BR","pt","ro","rs","rs-latin","ru","sk","sl","sq","sr","sr-latin","sv","sw","th","tr","uk","vi","zh-CN","zh-TW"]),this.db_type="varchar(50)",this.language=e.language),this.label=this.label||(void 0===e.label?"Label":e.label),this.name=this.name||e.name||"label",this.help=e.help||"",this.placeholder=e.placeholder;var s,t=this.type;"location"===(t="marker"===t&&i.formBuilder.mapsvg.isGeo()?"marker-geo":t)&&i.formBuilder.mapsvg.isGeo()&&(t="location-geo"),this.formBuilder.filtersMode?(this.parameterName=e.parameterName||"",this.parameterNameShort=this.parameterName.split(".")[1],this.placeholder=e.placeholder||"",this.templates={result:Handlebars.compile(u("#mapsvg-filters-tmpl-"+t+"-view").html())}):this.templates={result:Handlebars.compile(u("#mapsvg-data-tmpl-"+t+"-view").html())},this.views={result:u(this.templates.result(this.get()))},this.views.result.data("formElement",this),u().mselect2&&("distance"!==this.type?(s={},this.formBuilder.filtersMode&&"select"==this.type&&(s.placeholder=this.placeholder,this.multiselect||(s.allowClear=!0)),this.views.result.find("select").css({width:"100%",display:"block"}).mselect2(s).on("select2:focus",function(){u(this).mselect2("open")}),this.views.result.find(".select2-selection--multiple .select2-search__field").css("width","100%")):this.views.result.find("select").mselect2().on("select2:focus",function(){u(this).mselect2("open")})),u().colorpicker&&(this.views.result.find(".cpicker").colorpicker().on("changeColor.colorpicker",function(e){""==u(this).find("input").val()&&u(this).find("i").css({"background-color":""})}),this.views.edit&&this.views.edit.find(".cpicker").colorpicker().on("changeColor.colorpicker",function(e){""==u(this).find("input").val()&&u(this).find("i").css({"background-color":""})})),this.html&&(s=this.views.result.find("textarea")[0],this.editor=CodeMirror.fromTextArea(s,{mode:{name:"handlebars",base:"text/html"},matchBrackets:!0,lineNumbers:!0}),i.formBuilder.admin&&this.editor.on("change",this.setTextareaValue)),"image"==this.type&&(this.images=this.value||[],this.redrawImages()),"marker"!=this.type&&"location"!=this.type||(this.templates.marker=Handlebars.compile(u("#mapsvg-data-tmpl-marker").html()),this.location&&this.location.marker&&i.renderMarker()),this.setEventHandlers()}r.parseBoolean=function(e){switch(String(e).toLowerCase()){case"on":case"true":case"1":case"yes":case"y":return!0;case"off":case"false":case"0":case"no":case"n":return!1;default:return}},i.prototype.setTextareaValue=function(e,t){var a=e.getValue();u(e.getTextArea()).val(a).trigger("change")},i.prototype.setEventHandlers=function(){var e,a,i,s,l=this;this.formBuilder.editMode?this.views.result.on("click",function(){l.formBuilder.edit(l)}):("image"==this.type&&(e=l.views.result.find(".mapsvg-data-images"),this.formBuilder.mediaUploader.on("select",function(){return l.formBuilder.mediaUploaderFor===l&&(l.formBuilder.mediaUploader.state().get("selection").toJSON().forEach(function(e){var t,a={sizes:{}};for(t in e.sizes)a[t]=e.sizes[t].url.replace("http://","//").replace("https://","//"),a.sizes[t]={width:e.sizes[t].width,height:e.sizes[t].height};a.thumbnail||(a.thumbnail=a.full,a.sizes.thumbnail={width:e.sizes.full.width,height:e.sizes.full.height}),a.medium||(a.medium=a.full,a.sizes.medium={width:e.sizes.full.width,height:e.sizes.full.height}),a.caption=e.caption,a.description=e.description,l.images.push(a)}),void l.redrawImages())}),l.views.result.on("click",".mapsvg-upload-image",function(e){e.preventDefault(),(l.formBuilder.mediaUploaderFor=l).formBuilder.mediaUploader.open()}),l.views.result.on("click",".mapsvg-image-delete",function(e){e.preventDefault(),u(this).closest(".mapsvg-thumbnail-wrap").remove(),l.images=[],l.views.result.find("img").each(function(e,t){l.images.push(u(t).data("image"))}),l.views.result.find("input").val(JSON.stringify(l.images))}),l.sortable=new Sortable(e[0],{animation:150,onStart:function(){l.elements.containers.form_view.addClass("sorting")},onEnd:function(e){l.images=[],l.views.result.find("img").each(function(e,t){l.images.push(u(t).data("image"))}),l.views.result.find("input").val(JSON.stringify(l.images))}})),"post"==this.type&&l.views.result.find(".mapsvg-find-post").mselect2({placeholder:"Search post by title",allowClear:!0,ajax:{url:ajaxurl+"?action=mapsvg_search_posts&post_type="+l.post_type,dataType:"json",delay:250,data:function(e){return{query:e.term,page:e.page}},processResults:function(e,t){return t.page=t.page||1,{results:e,pagination:{more:!1}}},cache:!0},escapeMarkup:function(e){return e},minimumInputLength:1,templateResult:function(e){return e.loading?e.text:"
"+e.post_title+"
"},templateSelection:function(e){return e.post_title||e.text}}).on("select2:select",function(e){l.post=e.params.data,l.views.result.find(".mapsvg-post-id").text(l.post.ID),l.views.result.find(".mapsvg-post-url").text(l.post.url).attr("href",l.post.url),l.views.result.find('input[name="post_id"]').val(l.post.ID)}).on("change",function(e){""===e.target.value&&(l.views.result.find(".mapsvg-post-id").text(""),l.views.result.find(".mapsvg-post-url").text(""),l.views.result.find('input[name="post_id"]').val(""))}),"location"===this.type&&(l.formBuilder.mapsvg.isGeo()&&(i=new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("formatted_address"),queryTokenizer:Bloodhound.tokenizers.whitespace,remote:{url:ajaxurl+"?action=mapsvg_geocoding&address=%QUERY%&language="+this.language,wildcard:"%QUERY%",transform:function(e){return e.error_message&&alert(e.error_message),e.results},rateLimitWait:600}}),(s=this.views.result.find(".typeahead")).typeahead({minLength:3},{name:"mapsvg-addresses",display:"formatted_address",source:i}),s.on("typeahead:select",function(e,t){l.location&&l.location.marker&&l.deleteMarker();var a={};a.formatted=t.formatted_address,t.address_components.forEach(function(e){var t=e.types[0];a[t]=e.long_name,e.short_name!=e.long_name&&(a[t+"_short"]=e.short_name)});var i={address:a,lat:t.geometry.location.lat,lng:t.geometry.location.lng,img:l.formBuilder.mapsvg.getMarkerImage(l.formBuilder.getData())};l.location=new r.Location(i,l.formBuilder.mapsvg),l.formBuilder.location=this.location;t=new r.Marker({location:l.location,mapsvg:l.formBuilder.mapsvg});l.location.marker=t,l.formBuilder.mapsvg.markerAdd(l.location.marker),l.formBuilder.mapsvg.setEditingMarker(t),l.formBuilder.marker=t.getOptions(),l.renderMarker();i=l.formBuilder.view.find('select[name="regions"]');-1!==l.formBuilder.mapsvg.getData().options.source.indexOf("/geo-calibrated/usa.svg")?0!==i.length&&l.location.address.state_short&&(i.val(["US-"+l.location.address.state_short]),i.trigger("change")):-1!==l.formBuilder.mapsvg.getData().options.source.indexOf("/geo-calibrated/world.svg")?0!==i.length&&l.location.address.country_short&&(i.val([l.location.address.country_short]),i.trigger("change")):0===i.length||!l.location.address.administrative_area_level_1||0<(t=l.formBuilder.mapsvg.getData().regions.filter(function(e){return e.title===l.location.address.administrative_area_level_1||e.title===l.location.address.administrative_area_level_2||e.id===l.location.address.country_short+"-"+l.location.address.administrative_area_level_1_short})).length&&(t=t[0],i.val([t.id]),i.trigger("change")),s.typeahead("val","")})),l.views.result.on("click",".mapsvg-marker-image-btn-trigger",function(e){u(this).toggleClass("active"),l.toggleMarkerSelector.call(l,u(this),e)}),l.views.result.on("click",".mapsvg-marker-delete",function(e){e.preventDefault(),l.deleteMarker()})),"select"!==this.type&&"radio"!==this.type||(a=l.formBuilder.mapsvg.database.getSchemaField("location"))&&a.markersByFieldEnabled&&a.markerField&&this.name==a.markerField&&0'}),i.markerSelector||(i.markerSelector=i.views.result.find(".mapsvg-marker-image-selector")),i.markerSelector&&i.markerSelector.empty(),i.formBuilder.markerSelector=i.markerSelector,i.formBuilder.marker?i.markerSelector.data("marker",i.formBuilder.marker):i.markerSelector.data("marker",null),i.markerSelector.html(e.join("")),i.markerSelector.append('
Upload marker images on: Database > Edit fields > Location > Markers > Upload
'),i.markerSelector.on("click",".mapsvg-marker-image-btn-choose",function(e){e.preventDefault();e=u(this).find("img").attr("src");i.formBuilder.marker&&i.formBuilder.mapsvg.getMarker(i.formBuilder.marker.id).setImage(e),i.markerSelector.hide(),i.views.result.find(".mapsvg-marker-image-btn-trigger").toggleClass("active",!1),i.markerImageButton.attr("src",e)}))},i.prototype.toggleMarkerSelectorInLocationEditor=function(i,e){e.preventDefault();var t,a,s=this;i.data("markerSelector")&&i.data("markerSelector").is(":visible")?i.data("markerSelector").hide():i.data("markerSelector")&&i.data("markerSelector").not(":visible")?i.data("markerSelector").show():(t=u(this).closest("td").find(".mapsvg-marker-image-btn-trigger").attr("src"),a=r.markerImages.map(function(e){return''}),i.data("markerSelector")?i.data("markerSelector").empty():(e=u('
'),i.closest("td").append(e),i.data("markerSelector",e)),i.data("markerSelector").html(a.join("")),i.data("markerSelector").on("click",".mapsvg-marker-image-btn-choose",function(e){e.preventDefault();var t=u(this).find("img").attr("src");i.data("markerSelector").hide();var a=u(this).closest("td"),e=u(this).closest("tr").data("option-id"),a=a.find(".mapsvg-marker-image-btn-trigger");a.toggleClass("active",!1),a.find("img").attr("src",t),s.setMarkerByField(e,t)}))},i.prototype.setMarkerByField=function(e,t){this.markersByField=this.markersByField||{},this.markersByField[e]=t},i.prototype.deleteMarker=function(){this.formBuilder.backupData=this.formBuilder.backupData||{},this.formBuilder.backupData.location=this.location,this.formBuilder.backupData.marker=this.marker,this.location=null,this.marker=null,this.formBuilder.marker&&(this.formBuilder.mapsvg.getMarker(this.formBuilder.marker.id).delete(),this.formBuilder.mapsvg.editingMarker=null),this.views.result.find(".mapsvg-new-marker").hide(),this.views.result.find(".mapsvg-marker-id").attr("disabled","disabled")},i.prototype.renderMarker=function(e){var t=this;if(!(this.location||e&&e.location))return!1;e&&e.location&&(this.location=e.location),t.views.result.find(".mapsvg-new-marker").show().html(this.templates.marker(this.location)),this.location.marker.onChange=function(){t.renderMarker()}},i.prototype.redrawImages=function(){var a=this.views.result.find(".mapsvg-data-images");a.empty(),this.images&&this.images.forEach(function(e){var t=u('').attr("src",e.thumbnail).data("image",e),e=u('
').data("image",e);e.append(t),e.append(''),a.append(e)}),this.views.result.find("input").val(JSON.stringify(this.images))},i.prototype.setEditorEventHandlers=function(){var s=this;this.views.edit.on("click","button.mapsvg-remove",function(){s.views.result.empty().remove(),s.views.edit.empty().remove(),s.formBuilder.delete(s)}).on("keyup change paste",".mapsvg-edit-status-row input",function(){s.mayBeAddStatusRow()}).on("keyup change paste",".mapsvg-edit-distance-row input",function(){s.mayBeAddDistanceRow()});var a=u("#marker-file-uploader").closest(".form-group").find(".mapsvg-marker-image-selector"),i=u("#marker-file-uploader").closest(".btn-file");this.views.edit.on("change","#marker-file-uploader",function(){i=u(this).closest(".btn-file")._button("loading");for(var e=0;e',u(t).appendTo(a),r.markerImages.push(e))}).always(function(){i._button("reset")})}}),this.views.edit.on("change",'select[name="markerField"]',function(){var e=u(this).val();s.fillMarkersByFieldOptions(e)}),s.views.edit.on("click",".mapsvg-marker-image-btn-trigger",function(e){u(this).toggleClass("active"),s.toggleMarkerSelectorInLocationEditor.call(s,u(this),e)}),this.views.edit.on("click",".mapsvg-filter-insert-options",function(){var e=s.parameterName.split(".")[0],t=s.parameterName.split(".")[1],e="Object"==e?s.formBuilder.mapsvg.database.getSchemaField(t):"id"==t?{options:s.formBuilder.mapsvg.getData().regions.map(function(e){return{label:e.id,value:e.id}})}:"region_title"==t?{options:s.formBuilder.mapsvg.getData().regions.map(function(e){return{label:e.title,value:e.title}})}:s.formBuilder.mapsvg.regionsDatabase.getSchemaField(t);e&&e.options&&(e="regions"==t?(e.options[0].title&&e.options[0].title.length&&e.options.sort(function(e,t){return e.titlet.title?1:0}),e.options.map(function(e){return(e.title||e.id)+":"+e.id})):e.options.map(function(e){return e.label+":"+e.value}),u(this).closest(".form-group").find("textarea").val(e.join("\n")).trigger("change"))}),this.views.edit.on("keyup change paste","input, textarea, select",function(){var e=u(this).attr("name"),t=u(this).data("array");if("status"===s.type&&t){var a=u(this).data("param"),i=u(this).closest("tr").index();s.options[i]=s.options[i]||{label:"",value:"",color:"",disabled:!1},s.options[i][a]=u(this).is(":checkbox")?u(this).prop("checked"):u(this).val(),s.redraw()}else if("distance"===s.type&&t){var a=u(this).data("param"),i=u(this).closest("tr").index();s.options[i]||(s.options[i]={value:"",default:!1}),"default"===a?(s.options.forEach(function(e,t){e.default=!1}),s.options[i].default=u(this).prop("checked")):s.options[i].value=u(this).val(),s.redraw()}else{if("label"==e||"name"==e)return!1;a="checkbox"==u(this).attr("type")?u(this).prop("checked"):u(this).val(),"radio"==u(this).attr("type")&&(i=u(this).attr("name"),a=u('input[name="'+i+'"]:checked').val()),s.update(e,a)}}),this.views.edit.on("keyup change paste",'input[name="label"]',function(){var e;s.nameChanged||(s.label=u(this).val(),"region"!=s.type&&"location"!=s.type&&(e=(e=u(this).val()).toLowerCase().replace(/ /g,"_").replace(/\W/g,""),s.views.edit.find('input[name="name"]').val(e),s.name=e),s.views.result.find("label").first().html(s.label),s.formBuilder.filtersMode||s.views.result.find("label").first().append('
'+s.name+"
"))}),this.views.edit.on("keyup change paste",'input[name="name"]',function(){this.value&&(this.value.match(/[^a-zA-Z0-9_]/g)&&(this.value=this.value.replace(/[^a-zA-Z0-9_]/g,""),u(this).trigger("change")),this.value[0].match(/[^a-zA-Z_]/g)&&(this.value=this.value[0].replace(/[^a-zA-Z_]/g,"")+this.value.slice(1),u(this).trigger("change"))),"region"!=s.type&&(s.name=this.value),s.views.result.find("label").html(s.label+'
'+s.name+"
"),s.nameChanged=!0})},i.prototype.fillMarkersByFieldOptions=function(e){var a,i=this,e=i.formBuilder.mapsvg.database.getSchemaField(e);e&&(a=i.formBuilder.mapsvg.getData().options.defaultMarkerImage,e=e.options.map(function(e){var t=i.markersByField&&i.markersByField[e.value]?i.markersByField[e.value]:a;return'
'}),u("#markers-by-field").empty().append(e))},i.prototype.getEditor=function(){return this.formBuilder.filtersMode?this.templates.edit=this.templates.edit||Handlebars.compile(u("#mapsvg-filters-tmpl-"+this.type+"-control").html()):this.templates.edit=this.templates.edit||Handlebars.compile(u("#mapsvg-data-tmpl-"+this.type+"-control").html()),this.views.edit=u(this.templates.edit(this.get())),this.views.edit},i.prototype.destroyEditor=function(){this.views.edit.empty().remove()},i.prototype.initEditor=function(){var i=this;this.views.edit.find("input").first().select(),u().mselect2&&("distance"!==this.type?this.views.edit.find("select").css({width:"100%",display:"block"}):this.views.edit.find("select")).mselect2(),"status"==this.type&&(i.views.edit.find(".cpicker").colorpicker().on("changeColor.colorpicker",function(e){var t=u(this).find("input"),a=u(this).closest("tr").index();""==t.val()&&u(this).find("i").css({"background-color":""}),i.options[a]=i.options[a]||{label:"",value:"",color:"",disabled:!1},i.options[a].color=t.val()}),i.mayBeAddStatusRow()),"distance"===this.type&&i.mayBeAddDistanceRow(),"location"===this.type&&i.fillMarkersByFieldOptions(i.markerField),this.views.edit.find(".mapsvg-onoff").bootstrapToggle({onstyle:"default",offstyle:"default"}),this.setEditorEventHandlers()},i.prototype.mayBeAddStatusRow=function(){var i=this;this.templates.editStatusRow=this.templates.editStatusRow||u(u("#mapsvg-edit-status-row").html());var e=i.views.edit.find(".mapsvg-edit-status-label:last-child");e&&e.last()&&e.last().val()&&e.last().val().trim().length&&((t=this.templates.editStatusRow.clone()).insertAfter(i.views.edit.find(".mapsvg-edit-status-row:last-child")),t.find(".cpicker").colorpicker().on("changeColor.colorpicker",function(e){var t=u(this).find("input"),a=u(this).closest("tr").index();""==t.val()&&u(this).find("i").css({"background-color":""}),i.options[a]=i.options[a]||{label:"",value:"",color:"",disabled:!1},i.options[a].color=t.val()}));var e=i.views.edit.find(".mapsvg-edit-status-row"),t=e.eq(e.length-2),e=e.eq(e.length-1);t.length&&e.length&&!(t.find("input:eq(0)").val().trim()||t.find("input:eq(1)").val().trim()||t.find("input:eq(2)").val().trim())&&!(e.find("input:eq(0)").val().trim()||e.find("input:eq(1)").val().trim()||e.find("input:eq(2)").val().trim())&&e.remove()},i.prototype.mayBeAddDistanceRow=function(){this.templates.editDistanceRow=this.templates.editDistanceRow||u(u("#mapsvg-edit-distance-row").html());var e=this.views.edit.find(".mapsvg-edit-distance-row:last-child input");e&&e.last()&&e.last().val()&&e.last().val().trim().length&&this.templates.editDistanceRow.clone().insertAfter(this.views.edit.find(".mapsvg-edit-distance-row:last-child"));var t=this.views.edit.find(".mapsvg-edit-distance-row"),e=t.eq(t.length-2),t=t.eq(t.length-1);e.length&&t.length&&!e.find("input:eq(0)").val().trim()&&!t.find("input:eq(0)").val().trim()&&t.remove()},i.prototype.getSchema=function(){var e,t=this,a={type:this.type,db_type:this.db_type,label:this.label,name:this.name,value:this.value,searchable:r.parseBoolean(this.searchable)};return"select"==this.type&&(a.multiselect=r.parseBoolean(this.multiselect),a.multiselect&&(a.db_type="text"),a.optionsGrouped=this.optionsGrouped),this.options&&(e=u.extend(!0,{},{options:this.options}),a.options=e.options,a.optionsDict={},"region"==a.type?a.options.forEach(function(e){a.optionsDict[e.id]=e.title||e.id}):"status"==t.type?a.options.forEach(function(e,t){""===a.options[t].value?a.options.splice(t,1):(a.options[t].disabled=r.parseBoolean(a.options[t].disabled),a.optionsDict[e.value]=e)}):"distance"==t.type?a.options.forEach(function(e,t){""===a.options[t].value?a.options.splice(t,1):a.options[t].default=r.parseBoolean(a.options[t].default)}):a.options.forEach(function(e){a.optionsDict[e.value]="status"==t.type?e:e.label})),this.help&&(a.help=this.help),this.button_text&&(a.button_text=this.button_text),"post"==this.type&&(a.post_type=this.post_type,a.add_fields=this.add_fields),"date"==this.type&&(a.language=this.language),"location"==this.type&&(a.language=this.language,a.markersByField=this.markersByField,a.markerField=this.markerField,a.markersByFieldEnabled=r.parseBoolean(this.markersByFieldEnabled)),"textarea"==this.type&&(a.autobr=this.autobr,a.html=this.html),"text"==this.type&&(a.searchType=this.searchType),"modal"==this.type&&(a.showButtonText=this.showButtonText),"distance"==this.type&&(a.distanceControl=this.distanceControl,a.distanceUnits=this.distanceUnits,a.distanceUnitsLabel=this.distanceUnitsLabel,a.fromLabel=this.fromLabel,a.addressField=this.addressField,a.addressFieldPlaceholder=this.addressFieldPlaceholder,a.userLocationButton=this.userLocationButton,a.placeholder=this.placeholder,a.language=this.language,a.country=this.country,a.searchByZip=this.searchByZip,a.zipLength=this.zipLength,a.userLocationButton=r.parseBoolean(this.userLocationButton),"none"===a.distanceControl&&(a.distanceDefault=a.options.filter(function(e){return e.default})[0].value)),"search"==this.type&&(a.searchFallback=r.parseBoolean(this.searchFallback),a.placeholder=this.placeholder,a.noResultsText=this.noResultsText,a.width=this.width),this.checkboxLabel&&(a.checkboxLabel=this.checkboxLabel),this.checkboxValue&&(a.checkboxValue=this.checkboxValue),this.formBuilder.filtersMode&&(a.parameterName=this.parameterName,a.parameterNameShort=this.parameterName.split(".")[1],a.placeholder=this.placeholder),a.visible=void 0===this.visible||this.visible,a},i.prototype.get=function(){var e,t,a=this.getSchema();return a._name=a.name,this.formBuilder.namespace&&(a.name=this.name.split("[")[0],e=(e=this.name.split("[")[1]||"")&&"["+e,a.name=this.formBuilder.namespace+"["+a.name+"]"+e),"post"==this.type&&(this.formBuilder.admin&&(a.post_types=this.formBuilder.admin.getPostTypes()),a.post_type=this.post_type,a.post=this.post,a.add_fields=this.add_fields||0),"date"==this.type&&(this.formBuilder.admin&&(a.languages=this.languages),a.language=this.language),"distance"==this.type&&(this.formBuilder.admin&&(a.languages=this.languages,a.countries=this.countries),a.language=this.language,a.country=this.country,a.searchByZip=this.searchByZip,a.zipLength=this.zipLength,a.userLocationButton=r.parseBoolean(this.userLocationButton)),"location"==this.type&&(this.formBuilder.admin&&(a.languages=this.languages,a.markerImages=r.markerImages,a.markersByField=this.markersByField,a.markerField=this.markerField,a.markersByFieldEnabled=r.parseBoolean(this.markersByFieldEnabled),t=this,a.markerImages.forEach(function(e){e.url===t.formBuilder.mapsvg.getData().options.defaultMarkerImage?e.default=!0:e.default=!1})),a.language=this.language,this.location&&(a.location=this.location,this.location.marker&&(a.location.img=(0===this.location.marker.src.indexOf(r.urls.uploads)?"uploads/":"")+this.location.marker.src.split("/").pop()))),"textarea"==this.type&&(a.html=this.html),a.databaseFields=this.databaseFields,a.databaseFieldsFilterableShort=this.databaseFieldsFilterableShort,a.regionFields=this.regionFields,a.placeholder=this.placeholder,a},i.prototype.update=function(e,t){var a,i=this;"options"==e?(a=[],t=t.split("\n").forEach(function(e){e=e.trim().split(":"),"checkbox"==i.type&&3==e.length?a.push({label:e[0],name:e[1],value:e[2]}):"radio"!=i.type&&"select"!=i.type&&"checkboxes"!=i.type||2!=e.length||a.push({label:e[0],value:e[1]})}),this.options=a):this[e]=t,"parameterName"==e&&this.views.edit.find(".mapsvg-filter-param-name").text(t),this.redraw()},i.prototype.redraw=function(){var e=u(this.templates.result(this.get()));this.views.result.html(e.html()),u().mselect2&&("distance"!==this.type?this.views.result.find("select").css({width:"100%",display:"block"}):this.views.result.find("select")).mselect2().on("select2:focus",function(){u(this).mselect2("open")}),u().colorpicker&&this.views.edit&&this.views.edit.find(".cpicker").colorpicker().on("changeColor.colorpicker",function(e){""==u(this).find("input").val()&&u(this).find("i").css({"background-color":""})})};function t(e){var t=this;this.container=e.container,this.namespace=e.namespace,this.mediaUploader=e.mediaUploader,this.schema=e.schema||[],this.editMode=null!=e.editMode&&e.editMode,this.filtersMode=null!=e.filtersMode&&e.filtersMode,this.filtersHide=null!=e.filtersHide&&e.filtersHide,this.modal=null!=e.modal&&e.modal,this.admin=e.admin,this.mapsvg=e.mapsvg,this.data=e.data||{},this.eventHandlers=e.events,this.template="form-builder",this.closeOnSave=!0===e.closeOnSave,this.newRecord=!0===e.newRecord,this.types=e.types||["text","textarea","checkbox","radio","select","image","region","location","post","date"],this.templates={},this.elements={},this.view=u("
").addClass("mapsvg-form-builder"),this.editMode&&this.view.addClass("full-flex"),this.formControls=[],r.templatesLoaded[this.template]?this.init():u.get(r.urls.templates+t.template+".html?"+Math.random(),function(e){u(e).appendTo("body"),r.templatesLoaded[t.template]=!0,Handlebars.registerPartial("dataMarkerPartial",u("#mapsvg-data-tmpl-marker").html()),t.editMode&&Handlebars.registerPartial("markerByFieldPartial",u("#mapsvg-markers-by-field-tmpl-partial").html()),t.init()})}t.prototype.init=function(){var e,t=this;r.formBuilder=this,t.editMode?(e=Handlebars.compile(u("#mapsvg-form-editor-tmpl-ui").html()),t.view.append(e({types:this.types})),t.view.addClass("edit")):(e=u('
'),t.view.append(e),this.filtersMode||e.addClass("form-horizontal")),t.elements={buttons:{text:t.view.find("#mapsvg-data-btn-text"),textarea:t.view.find("#mapsvg-data-btn-textarea"),checkbox:t.view.find("#mapsvg-data-btn-checkbox"),radio:t.view.find("#mapsvg-data-btn-radio"),select:t.view.find("#mapsvg-data-btn-select"),image:t.view.find("#mapsvg-data-btn-image"),region:t.view.find("#mapsvg-data-btn-region"),marker:t.view.find("#mapsvg-data-btn-marker"),saveSchema:t.view.find("#mapsvg-data-btn-save-schema")},containers:{buttons_add:t.view.find("#mapsvg-data-buttons-add"),form_view:t.view.find(".mapsvg-data-form-view"),form_edit:t.view.find("#mapsvg-data-form-edit")}},t.redraw()},t.prototype.viewDidLoad=function(){_this.formControls.forEach(function(e){var t;e.html&&(t=e.views.result.find("textarea")[0],e.htmlEditor=CodeMirror.fromTextArea(t,{mode:{name:"handlebars",base:"text/html"},matchBrackets:!0,lineNumbers:!0}))})},t.prototype.setEventHandlers=function(){var m=this;u(e).off("keydown.form.mapsvg").on("keydown.form.mapsvg",function(e){r.formBuilder&&((e.metaKey||e.ctrlKey)&&13==e.keyCode?r.formBuilder.save():27==e.keyCode&&r.formBuilder.close())}),this.editMode?(this.view.on("click",".mapsvg-marker-image-selector button",function(e){e.preventDefault();e=u(this).find("img").attr("src");u(this).parent().find("button").removeClass("active"),u(this).addClass("active"),m.mapsvg.setDefaultMarkerImage(e)}),this.view.on("click","#mapsvg-data-buttons-add button",function(e){e.preventDefault();e=u(this).data("create");m.add({type:e})}),this.view.on("click","#mapsvg-data-btn-save-schema",function(e){e.preventDefault();var e=m.getSchema(),s={};m.formControls.forEach(function(e){s[e.name]=(s[e.name]||0)+1}),m.elements.containers.form_view.find(".form-group").removeClass("has-error");var l,r,o=[],n=["id","lat","lon","lng","location","location_lat","location_lon","location_lng","location_address","location_img","marker","marker_id","regions","region_id","post_id","post","post_title","post_url","keywords","status"],d={regions:"region",status:"status",post_id:"post",marker:"marker",location:"location"};m.formControls.forEach(function(e,t){var a,i=!1;m.filtersMode||(1")})}),setTimeout(function(){var e=m.elements.containers.form_view[0];m.sortable=new Sortable(e,{animation:150,onStart:function(){m.elements.containers.form_view.addClass("sorting")},onEnd:function(){setTimeout(function(){m.elements.containers.form_view.removeClass("sorting"),m.formControls=[],u(e).find(".form-group").each(function(e,t){m.formControls.push(u(t).data("formElement"))})},500)}})},1e3)):(m.view.on("click","button.btn-save",function(e){e.preventDefault(),m.save()}),m.view.on("click","button.btn-close",function(e){e.preventDefault(),m.close()})),new r.ResizeSensor(this.view[0],function(){m.scrollApi&&m.scrollApi.reinitialise()})},t.prototype.save=function(){var e=this;e.marker&&(e.marker.onChange=null,e.mapsvg.unsetEditingMarker());var t=e.getData();e.saved=!0,e.eventHandlers.save&&e.eventHandlers.save.call(e,t)},t.prototype.getData=function(){var i=this,e=i.toJSON(!0);return i.formControls.forEach(function(t){var a;"image"==t.type&&(e[t.name]=[],t.images&&t.images.length&&null!=t.images[0]&&(a=[],t.views.result.find(".mapsvg-thumbnail-wrap").each(function(e,t){t=u(t).data("image");a.push(t)}),t.images=a,e[t.name]=e[t.name].concat(t.images))),"location"==t.type&&(t.location?e[t.name]=t.location:e[t.name]=""),"post"==t.type&&(e.post=t.post),"region"==t.type&&(e.regions&&"object"==typeof e.regions&&e.regions.length?e.regions=e.regions.map(function(e){return{id:e,title:i.mapsvg.getRegion(e).title}}):e.regions=""),"select"==t.type&&t.multiselect&&e[t.name]&&e[t.name].length&&(e[t.name]=e[t.name].map(function(e){return{value:e,label:t.optionsDict[e]}}))}),null!=i.data.id&&(e.id=i.data.id),delete e.marker_id,e},t.prototype.getDataJSON=function(){var t=this,i=t.toJSON(!0);return t.formControls.forEach(function(e){var a;"image"==e.type&&(i[e.name]=[],e.images&&e.images.length&&null!=e.images[0]&&(a=[],t.view.find(".mapsvg-thumbnail-wrap").each(function(e,t){t=u(t).data("image");a.push(t)}),e.images=a,i[e.name]=i[e.name].concat(e.images))),"location"==e.type&&(i[e.name]=e.location)}),null!=t.data.id&&(i.id=t.data.id),i},t.prototype.redraw=function(e){var t,a,i=this;delete i.marker,i.container.empty(),i.elements.containers.form_view.empty(),i.formControls=[],i.data&&i.data.id&&i.add({type:"id",label:"ID",name:"id",value:i.data.id}),i.data&&i.data._title&&i.add({type:"title",label:"Title",name:"title",value:i.data._title}),i.schema&&i.schema.length&&i.schema.forEach(function(e){var t;i.admin&&i.admin.isMetabox&&"post"==e.type||(i.filtersMode?"distance"==e.type?e.value=i.data.distance||(void 0!==e.value?e.value:null):e.value=i.data[e.parameterNameShort]:e.value=i.data?i.data[e.name]:void 0!==e.value?e.value:null,"location"!=e.type||i.editMode?"post"==e.type&&(e.post=i.data.post):(e.value&&e.value.marker&&e.value.marker.id&&(i.marker=e.value.marker.getOptions(),i.mapsvg.setEditingMarker(e.value.marker)),i.admin&&i.admin.setMode&&i.admin.setMode("editMarkers"),i.admin&&i.admin.enableMarkersMode(!0),i.mapsvg.setMarkerEditHandler(function(){i.marker=this.getOptions(),i.mapsvg.setEditingMarker(this);var e=i.getData(),e=i.mapsvg.getMarkerImage(e);this.setImage(e),i.locationFormElement&&i.locationFormElement.renderMarker(i.mapsvg.getMarker(i.marker.id))})),(!i.filtersMode||!i.filtersHide||i.filtersHide&&i.modal&&"search"!==e.type||!i.modal&&"search"===e.type)&&(t=i.add(e)),"location"==e.type&&(i.locationFormElement=t))}),i.editMode||(0!=this.schema.length||i.filtersMode?i.admin&&!i.admin.isMetabox&&i.add({type:"save"}):i.add({type:"empty"})),i.filtersMode&&i.filtersHide&&!i.modal&&(this.showFiltersButton=i.add({type:"modal",buttonText:i.mapsvg.getData().options.filters.showButtonText})),i.editMode||i.filtersMode?i.container.html(this.view):(t=u('
'),a=u('
'),t.append(a),a.html(this.view),i.container.html(t),t.jScrollPane(),i.scrollApi=t.data("jsp")),i.eventHandlers.load&&i.eventHandlers.load(i),this.editMode||i.filtersMode||this.view.find("input:visible,textarea:visible").not(".tt-hint").first().focus(),this.container.find(".CodeMirror").each(function(e,t){t&&t.CodeMirror.refresh()}),i.setEventHandlers(),i.eventHandlers.init&&i.eventHandlers.init(i.data)},t.prototype.delete=function(a){var i=this;i.formControls.forEach(function(e,t){e===a&&(i.formControls.splice(t,1),i.structureChanged=!0)})},t.prototype.add=function(t){if(-1!=["region","marker","post","status","distance","location","search"].indexOf(t.type)){var a=!1;if(this.formControls.forEach(function(e){e.type==t.type&&(a=!0)}),a)return void u.growl.error({title:"Error",message:'You can add only 1 "'+r.ucfirst(t.type)+'" field'})}"date"==t.type&&(r.datepicker=r.datepicker||{});var e=new i(t,this);return this.formControls.push(e),this.elements.containers.form_view.append(e.views.result),this.editMode&&this.edit(e),e},t.prototype.edit=function(e){var t=this;t.currentlyEditing&&t.currentlyEditing.destroyEditor(),t.elements.containers.form_edit.append(e.getEditor()),e.initEditor(),t.currentlyEditing=e,t.elements.containers.form_view.find(".form-group.active").removeClass("active"),e.views.result.addClass("active")},t.prototype.get=function(){return this.formControls.map(function(e){return e.get()})},t.prototype.getSchema=function(){return this.formControls.map(function(e){return e.getSchema()})},t.prototype.close=function(){var e,t=this;t.saved||(null==t.data.id&&t.marker&&((e=t.mapsvg.getMarker(t.marker.id)).onChange=null,e.delete(),delete t.marker),this.backupData&&this.backupData.location&&(this.location=this.backupData.location,t.mapsvg.markerAdd(this.location.marker),t.mapsvg.setEditingMarker(this.location.marker)),!t.marker||(e=t.mapsvg.getEditingMarker())&&(e.setImage(t.marker.src),e.setXy([t.marker.x,t.marker.y]),t.mapsvg.unsetEditingMarker())),t.markerSelector&&t.markerSelector.popover("destroy"),!u().mselect2||(a=t.view.find(".mapsvg-select2")).length&&a.mselect2("destroy");var a=t.view.find(".CodeMirror");a.length&&a.empty().remove(),t.admin&&t.admin.enableMarkersMode(!1),r.formBuilder=null,t.eventHandlers.close&&t.eventHandlers.close()},t.prototype.destroy=function(){this.view.empty().remove(),this.sortable=null},t.prototype.on=function(e,t){this.eventHandlers[e]=t},t.prototype.toJSON=function(s){var t={};return this.elements.containers.form_view.find("input, textarea, select").each(function(){var e;u(this).data("skip")||u(this).prop("disabled")||!u(this).attr("name")||!s&&"checkbox"==u(this).attr("type")&&null==u(this).attr("checked")||"radio"==u(this).attr("type")&&!u(this).is(":checked")||(e="checkbox"==u(this).attr("type")?u(this).prop("checked"):u(this).val(),function e(t,a,i){(s||i)&&(1==a.length?t[a[0]]=i:(null==t[a[0]]&&(""===a[1]?t[a[0]]=[]:t[a[0]]={}),void 0!==t[a[0]].length?t[a[0]].push(i):e(t[a[0]],a.slice(1),i)))}(t,u(this).attr("name").replace(/]/g,"").split("["),e))}),t},t.prototype.getRegionsList=function(){return this.mapsvg.getData().regions.map(function(e){return{id:e.id,title:e.title}})},t.prototype.getMarkersList=function(){return this.mapsvg.getData().markers.map(function(e){return{id:e.id}})},r.FormBuilder=t}(jQuery,MapSVG,window); !function(e,n){"function"==typeof define&&define.amd?define(["jquery"],function(t){return e.Bloodhound=n(t)}):"object"==typeof exports?module.exports=n(require("jquery")):e.Bloodhound=n(e.jQuery)}(this,function(c){var h=function(){"use strict";return{isMsie:function(){return!!/(msie|trident)/i.test(navigator.userAgent)&&navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]},isBlankString:function(t){return!t||/^\s*$/.test(t)},escapeRegExChars:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isArray:c.isArray,isFunction:c.isFunction,isObject:c.isPlainObject,isUndefined:function(t){return void 0===t},isElement:function(t){return!(!t||1!==t.nodeType)},isJQuery:function(t){return t instanceof c},toStr:function(t){return h.isUndefined(t)||null===t?"":t+""},bind:c.proxy,each:function(t,n){c.each(t,function(t,e){return n(e,t)})},map:c.map,filter:c.grep,every:function(n,i){var s=!0;return n?(c.each(n,function(t,e){if(!(s=i.call(null,e,t,n)))return!1}),!!s):s},some:function(n,i){var s=!1;return n?(c.each(n,function(t,e){if(s=i.call(null,e,t,n))return!1}),!!s):s},mixin:c.extend,identity:function(t){return t},clone:function(t){return c.extend(!0,{},t)},getIdGenerator:function(){var t=0;return function(){return t++}},templatify:function(t){return c.isFunction(t)?t:function(){return String(t)}},defer:function(t){setTimeout(t,0)},debounce:function(s,r,o){var a,u;return function(){var t=this,e=arguments,n=function(){a=null,o||(u=s.apply(t,e))},i=o&&!a;return clearTimeout(a),a=setTimeout(n,r),u=i?s.apply(t,e):u}},throttle:function(n,i){var s,r,o,a,u=0,c=function(){u=new Date,o=null,a=n.apply(s,r)};return function(){var t=new Date,e=i-(t-u);return s=this,r=arguments,e<=0?(clearTimeout(o),o=null,u=t,a=n.apply(s,r)):o=o||setTimeout(c,e),a}},stringify:function(t){return h.isString(t)?t:JSON.stringify(t)},guid:function(){function t(t){var e=(Math.random().toString(16)+"000000000").substr(2,8);return t?"-"+e.substr(0,4)+"-"+e.substr(4,4):e}return"tt-"+t()+t(!0)+t(!0)+t()},noop:function(){}}}(),n=function(){"use strict";function t(t){return(t=h.toStr(t))?t.split(/\s+/):[]}function e(t){return(t=h.toStr(t))?t.split(/\W+/):[]}function n(t){t=h.toStr(t);var e=[],n="";return h.each(t.split(""),function(t){t.match(/\s+/)?n="":(e.push(n+t),n+=t)}),e}function i(i){return function(t){return t=h.isArray(t)?t:[].slice.call(arguments,0),function(e){var n=[];return h.each(t,function(t){n=n.concat(i(h.toStr(e[t])))}),n}}}return{nonword:e,whitespace:t,ngram:n,obj:{nonword:i(e),whitespace:i(t),ngram:i(n)}}}(),i=function(){"use strict";function t(t){this.maxSize=h.isNumber(t)?t:100,this.reset(),this.maxSize<=0&&(this.set=this.get=c.noop)}function e(){this.head=this.tail=null}function i(t,e){this.key=t,this.val=e,this.prev=this.next=null}return h.mixin(t.prototype,{set:function(t,e){var n=this.list.tail;this.size>=this.maxSize&&(this.list.remove(n),delete this.hash[n.key],this.size--),(n=this.hash[t])?(n.val=e,this.list.moveToFront(n)):(n=new i(t,e),this.list.add(n),this.hash[t]=n,this.size++)},get:function(t){t=this.hash[t];if(t)return this.list.moveToFront(t),t.val},reset:function(){this.size=0,this.hash={},this.list=new e}}),h.mixin(e.prototype,{add:function(t){this.head&&(t.next=this.head,this.head.prev=t),this.head=t,this.tail=this.tail||t},remove:function(t){t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev},moveToFront:function(t){this.remove(t),this.add(t)}}),t}(),e=function(){"use strict";function t(t,e){this.prefix=["__",t,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+h.escapeRegExChars(this.prefix)),this.ls=e||r,this.ls||this._noop()}function i(){return(new Date).getTime()}function s(t){return JSON.stringify(h.isUndefined(t)?null:t)}function e(t){return c.parseJSON(t)}var r;try{(r=window.localStorage).setItem("~~~","!"),r.removeItem("~~~")}catch(t){r=null}return h.mixin(t.prototype,{_prefix:function(t){return this.prefix+t},_ttlKey:function(t){return this._prefix(t)+this.ttlKey},_noop:function(){this.get=this.set=this.remove=this.clear=this.isExpired=h.noop},_safeSet:function(t,e){try{this.ls.setItem(t,e)}catch(t){"QuotaExceededError"===t.name&&(this.clear(),this._noop())}},get:function(t){return this.isExpired(t)&&this.remove(t),e(this.ls.getItem(this._prefix(t)))},set:function(t,e,n){return h.isNumber(n)?this._safeSet(this._ttlKey(t),s(i()+n)):this.ls.removeItem(this._ttlKey(t)),this._safeSet(this._prefix(t),s(e))},remove:function(t){return this.ls.removeItem(this._ttlKey(t)),this.ls.removeItem(this._prefix(t)),this},clear:function(){for(var t=function(t){for(var e,n=[],i=r.length,s=0;st)}}),t}(),s=function(){"use strict";function t(t){t=t||{},this.maxPendingRequests=t.maxPendingRequests||6,this.cancelled=!1,this.lastReq=null,this._send=t.transport,this._get=t.limiter?t.limiter(this._get):this._get,this._cache=!1===t.cache?new i(0):e}var a=0,u={},e=new i(10);return t.setMaxPendingRequests=function(t){this.maxPendingRequests=t},t.resetCache=function(){e.reset()},h.mixin(t.prototype,{_fingerprint:function(t){return(t=t||{}).url+t.type+c.param(t.data||{})},_get:function(t,e){function n(t){e(null,t),r._cache.set(o,t)}function i(){e(!0)}var s,r=this,o=this._fingerprint(t);this.cancelled||o!==this.lastReq||((s=u[o])?s.done(n).fail(i):ae[i]||(s.push(t[n]),n++),i++);return s}(s,t):t;else if(!r.matchAnyQueryToken)return!(s=[])}),s?h.map(function(t){for(var e={},n=[],i=0,s=t.length;i',menu:'
'},selectors:(e=e,n={},p.each(e,function(t,e){n[e]="."+t}),n)};return{css:i.css,html:i.html,classes:i.classes,selectors:i.selectors,mixin:function(t){p.mixin(t,i)}}}}(),g=function(){"use strict";function t(t){t&&t.el||f.error("EventBus initialized without el"),this.$el=f(t.el)}var e={render:"rendered",cursorchange:"cursorchanged",select:"selected",autocomplete:"autocompleted"};return p.mixin(t.prototype,{_trigger:function(t,e){t=f.Event("typeahead:"+t);return this.$el.trigger.call(this.$el,t,e||[]),t},before:function(t){var e=[].slice.call(arguments,1);return this._trigger("before"+t,e).isDefaultPrevented()},trigger:function(t){this._trigger(t,[].slice.call(arguments,1)),(t=e[t])&&this._trigger(t,[].slice.call(arguments,1))}}),t}(),e=function(){"use strict";function i(t,e,n,i){var s,r,o;if(!n)return this;for(e=e.split(a),n=i?(o=i,(r=n).bind?r.bind(o):function(){r.apply(o,[].slice.call(arguments,0))}):n,this._callbacks=this._callbacks||{};s=e.shift();)this._callbacks[s]=this._callbacks[s]||{sync:[],async:[]},this._callbacks[s][t].push(n);return this}function r(i,s,r){return function(){for(var t,e=0,n=i.length;!t&&e
"+t.options.gauge.labels.low+""+t.options.gauge.labels.high+"
'+e.label+'