File "image-map-pro-editor.js"
Full Path: /home/veodprin/public_html/wp-content/plugins/image-map-pro-wordpress/js/image-map-pro-editor.js
File size: 124.2 KB
MIME-type: text/plain
Charset: utf-8
!function(x,t,o,g){var m=g,C=g,s=!1,i=g,_=0,u=g,w=g,a="drag",r={id:96,editor:{selected_shape:"rect-3198"},general:{name:"TourDemo",width:800,height:450,naturalWidth:800,naturalHeight:450},image:{},tooltips:{show_title_on_mouseover:1},layers:{layers_list:[{id:0,title:"Main Floor",image_url:"https://webcraftplugins.com/uploads/image-map-pro/demo.jpg",image_width:1280,image_height:776}]},spots:[{id:"rect-3198",title:"rect-3198",type:"rect",x:9.375,y:60.667,width:16.5,height:26,x_image_background:9.375,y_image_background:60.667,width_image_background:16.5,height_image_background:26,default_style:{border_radius:10,background_opacity:0,border_width:2,border_style:"dashed",border_color:"#000000"},mouseover_style:{border_radius:10},tooltip_style:{width:150,auto_width:0},tooltip_content:{squares_settings:{containers:[{id:"sq-container-305521",settings:{elements:[{settings:{name:"Paragraph",iconClass:"fa fa-paragraph"}}]}}]}}},{id:"oval-3529",title:"oval-3529",type:"oval",x:79.875,y:14.223,width:12.25,height:20.667,x_image_background:79.875,y_image_background:14.223,width_image_background:12.25,height_image_background:20.667,default_style:{background_opacity:0},tooltip_content:{squares_settings:{containers:[{id:"sq-container-403761",settings:{elements:[{settings:{name:"Paragraph",iconClass:"fa fa-paragraph"}}]}}]}}},{id:"oval-9040",title:"oval-9040",type:"oval",x:77.75,y:42.667,width:15.5,height:22.889,x_image_background:77.75,y_image_background:42.667,width_image_background:15.5,height_image_background:22.889,default_style:{background_opacity:0},tooltip_content:{squares_settings:{containers:[{id:"sq-container-403761",settings:{elements:[{settings:{name:"Paragraph",iconClass:"fa fa-paragraph"}}]}}]}}}]},n=g,y=x.imageMapProEditorDefaults,h=x.imageMapProShapeDefaults;function l(){this.wcpEditorSettings=g,this.actionStack=new Array,this.actionIndex=0,this.canvasImage=new Image,this.canvasWidth=0,this.canvasHeight=0,this.canvas=g,this.ix=0,this.iy=0,this.x=0,this.y=0,this.dx=0,this.dy=0,this.ixss=0,this.iyss=0,this.xss=0,this.yss=0,this.dxss=0,this.dyss=0,this.drawRectWidth=0,this.drawRectHeight=0,this.transformX=0,this.transformY=0,this.transformWidth=0,this.transformHeight=0,this.eventSpotId=g,this.redrawEl=g,this.redrawSvgEl=g,this.redrawPolygonEl=g,this.redrawElBgImage=g,this.redrawTooltip=g,this.tempControlPoint=g,this.tempControlPointLine=g,this.tempControlPointIndex=g,this.controlPointInsertionPointX=0,this.controlPointInsertionPointY=0,this.translatedPointIndex=0,this.translatedPoint=g,this.translatedPointX=0,this.translatedPointY=0,this.polyPoints=new Array,this.canvasInitialX=0,this.canvasInitialY=0,this.movingTooltipShapeCenterX=0,this.movingTooltipShapeCenterY=0,this.movingTooltipCenterX=0,this.movingTooltipCenterY=0,this.movingTooltipPosition=g,this.movingTooltipColorRGBA=g,this.movingTooltipArrow=g,this.transformingTooltipStartingWidth=0,this.transformingTooltipWidth=0,this.startedSelecting=!1,this.startedMoving=!1,this.startedTransforming=!1,this.didTransforming=!1,this.transformDirection=0,this.startedTransformingTooltip=!1,this.didTransformTooltip=!1,this.startedDrawingSpot=!1,this.startedDrawingText=!1,this.startedDrawingRect=!1,this.createdDrawingRect=!1,this.startedDrawingOval=!1,this.createdDrawingOval=!1,this.startedDrawingPoly=!1,this.drawingPoly=!1,this.finishedDrawingPoly=!1,this.mouseDownWhileDrawingPoly=!1,this.startedTranslatingControlPoint=!1,this.translatingControlPoint=!1,this.didDeleteControlPoint=!1,this.shouldDeselectShape=!1,this.ctrlKeyDown=!1,this.altKeyDown=!1,this.shiftKeyDown=!1,this.spaceKeyDown=!1,this.commandKeyDown=!1,this.draggingCanvas=!1,this.startedSelectingTooltip=!1,this.movingTooltip=!1,this.selectedSpot=g,this.eventSpot=g,this.shapesFormSpotIndex=g,this.iconsHTML=x.wcpFontawesomeUI,this.zoom=1,this.canvasX=0,this.canvasY=0}function p(t,e,o,i){t.complete&&t.naturalWidth!==g&&t.naturalHeight!==g?o():(e(),x(t).on("load",function(){x(t).off("load"),o()}),x(t).on("error",function(){x(t).off("error"),i()}))}function F(t){t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:{r:0,g:0,b:0}}function I(t,e,o){return{x:Math.round(1e3*(t-o.offset().left))/1e3,y:Math.round(1e3*(e-o.offset().top))/1e3}}function k(t,e){return{x:e.width*(t.x/100)+e.x,y:e.height*(t.y/100)+e.y}}function M(t,e){return 100<(t=t<0?0:t)&&(t=100),100<(e=e<0?0:e)&&(e=100),{x:Math.round(1e3*t)/1e3,y:Math.round(1e3*e)/1e3}}function H(t){return 1==parseInt(t,10)}function S(t,e){this.x=t,this.y=e}x.imageMapProDefaultSettings=x.extend(!0,{},y),x.imageMapProDefaultSpotSettings=x.extend(!0,{},h),x.squaresExtendElementDefaults({defaultControls:{font:{text_color:{name:"Text Color",type:"color",default:"#ffffff"}}}}),x.squaresUpdatedContent=function(t){m.selectedSpot&&(m.selectedSpot.tooltip_content.squares_settings=t),m.addAction()},x.image_map_pro_default_spot_settings=function(){return h},x.image_map_pro_init_editor=function(t,e){(m=new l).init(t,e)},x.image_map_pro_editor_current_settings=function(){return C},x.image_map_pro_editor_compressed_settings=function(){return m.getCompressedSettings()},x.image_map_pro_user_uploaded_image=function(){},x.wcpEditorSliderStartedDragging=function(){s=!0},x.wcpEditorSliderFinishedDragging=function(){s=!1},x.wcpTourCoordinatesForTipForStep=function(t){return"Drawing Shapes"==t?{x:x("#wcp-editor-toolbar-wrap").offset().left+x("#wcp-editor-toolbar-wrap").width()+20,y:x("#wcp-editor-toolbar-wrap").offset().top+x("#wcp-editor-toolbar-wrap").height()/3}:"Customize Your Shapes"==t?{x:x("#wcp-editor-object-settings").offset().left-20,y:x("#wcp-editor-object-settings").offset().top+40}:"Edit and Delete Shapes"==t?{x:x("#wcp-editor-object-list-wrap").offset().left-20,y:x("#wcp-editor-object-list-wrap").offset().top+50}:"Edit the Tooltips"==t?{x:x("#imp-editor-tooltip-bar-wrap").offset().left-20,y:x("#imp-editor-tooltip-bar-wrap").offset().top+10}:"Image Map Settings"==t?{x:x("#wcp-editor-button-settings").offset().left+x("#wcp-editor-button-settings").outerWidth()+20,y:x("#wcp-editor-button-settings").offset().top+x("#wcp-editor-button-settings").outerHeight()/2}:"Responsive & Fullscreen Tooltips"==t?{x:x('[data-wcp-main-tab-button-name="Image Map"]').offset().left+150,y:x('[data-wcp-main-tab-button-name="Image Map"]').offset().top+40}:"Preview Mode"==t?{x:x("#wcp-editor-button-preview").offset().left-20,y:x("#wcp-editor-button-preview").offset().top+32}:"Save and Load"==t?{x:x("#wcp-editor-button-load").offset().left+64,y:x("#wcp-editor-button-load").offset().top+32}:"Publish"==t?{x:x("#wcp-editor-button-settings").offset().left+x("#wcp-editor-button-settings").outerWidth()+20,y:x("#wcp-editor-button-settings").offset().top+x("#wcp-editor-button-settings").outerHeight()/2}:"Import and Export"==t?{x:x('[data-wcp-editor-main-button-name="import"]').offset().left-20,y:x('[data-wcp-editor-main-button-name="import"]').offset().top+32}:"Easy Installation"==t?{x:x('[data-wcp-editor-main-button-name="code"]').offset().left-20,y:x('[data-wcp-editor-main-button-name="code"]').offset().top+32}:void 0},x.wcpTourCoordinatesForHighlightRect=function(t){return"Drawing Shapes"==t?{x:x("#wcp-editor-toolbar-wrap").offset().left,y:x(".wcp-editor-toolbar").first().offset().top,width:x("#wcp-editor-toolbar-wrap").outerWidth(),height:x(".wcp-editor-toolbar").last().offset().top-x(".wcp-editor-toolbar").first().offset().top+x(".wcp-editor-toolbar").last().outerHeight()}:"Customize Your Shapes"==t?{x:x("#wcp-editor-object-settings").offset().left,y:x("#wcp-editor-object-settings").offset().top,width:x("#wcp-editor-object-settings").outerWidth(),height:x("#wcp-editor-object-settings").outerHeight()}:"Edit and Delete Shapes"==t?{x:x("#wcp-editor-object-list-wrap").offset().left,y:x("#wcp-editor-object-list-wrap").offset().top,width:x("#wcp-editor-object-list-wrap").outerWidth(),height:x("#wcp-editor-object-list-wrap").outerHeight()}:"Edit the Tooltips"==t?{x:x("#imp-editor-tooltip-bar-wrap").offset().left,y:x("#imp-editor-tooltip-bar-wrap").offset().top,width:x("#imp-editor-tooltip-bar-wrap").outerWidth(),height:x("#imp-editor-tooltip-bar-wrap").outerHeight()}:"Image Map Settings"==t?{x:x("#wcp-editor-button-settings").offset().left,y:x("#wcp-editor-button-settings").offset().top,width:x("#wcp-editor-button-settings").outerWidth(),height:x("#wcp-editor-button-settings").outerHeight()}:"Responsive & Fullscreen Tooltips"==t?{x:x('[data-wcp-main-tab-button-name="Image Map"]').offset().left,y:x('[data-wcp-main-tab-button-name="Image Map"]').offset().top,width:x('[data-wcp-main-tab-button-name="Image Map"]').outerWidth(),height:x('[data-wcp-main-tab-button-name="Image Map"]').outerHeight()}:"Preview Mode"==t?{x:x("#wcp-editor-button-preview").offset().left,y:x("#wcp-editor-button-preview").offset().top,width:x("#wcp-editor-button-preview").outerWidth(),height:x("#wcp-editor-button-preview").outerHeight()}:"Save and Load"==t?{x:x("#wcp-editor-button-save").offset().left,y:x("#wcp-editor-button-save").offset().top,width:x("#wcp-editor-button-save").outerWidth()+x("#wcp-editor-button-load").outerWidth(),height:x("#wcp-editor-button-save").outerHeight()}:"Publish"==t?{x:x("#wcp-editor-button-settings").offset().left,y:x("#wcp-editor-button-settings").offset().top,width:x("#wcp-editor-button-settings").outerWidth(),height:x("#wcp-editor-button-settings").outerHeight()}:"Import and Export"==t?{x:x('[data-wcp-editor-main-button-name="import"]').offset().left,y:x('[data-wcp-editor-main-button-name="import"]').offset().top,width:x('[data-wcp-editor-main-button-name="import"]').outerWidth()+x('[data-wcp-editor-main-button-name="export"]').outerWidth(),height:x('[data-wcp-editor-main-button-name="import"]').outerHeight()}:"Easy Installation"==t?{x:x('[data-wcp-editor-main-button-name="code"]').offset().left,y:x('[data-wcp-editor-main-button-name="code"]').offset().top,width:x('[data-wcp-editor-main-button-name="code"]').outerWidth(),height:x('[data-wcp-editor-main-button-name="code"]').outerHeight()}:void 0},x.wcpTourEventStarted=function(){},x.wcpTourEventFinished=function(){},x.wcpTourEventStepWillChange=function(t){},x.wcpEditorGetContentForCanvas=function(){return""},x.wcpEditorGetListItems=function(){for(var t=[],e=C.spots.length-1;0<=e;e--){var o=C.spots[e];t.push({id:o.id,title:o.title})}return t},x.wcpEditorGetSaves=function(r){x.imp_editor_storage_get_saves_list(function(t){for(var e=new Array,o=0;o<t.length;o++){var i={},i=t[o].name?{name:t[o].name,id:t[o].id}:{name:"Untitled",id:t[o].id};e.push(i)}r(e)})},x.wcpEditorGetExportJSON=function(){return JSON.stringify(m.getCompressedSettings())},x.wcpEditorGetSettingsForm=function(){return x.wcpFormGenerateHTMLForForm("Image Map Settings")},x.wcpEditorGetSettingsFormTitle=function(){return"Image Map Settings"},x.wcpEditorEventNewButtonPressed=function(){var t={name:"create_new",title:"Create New",buttons:[{name:"cancel",title:"Cancel",class:""},{name:"primary",title:"Create",class:"primary",id:"wcp-editor-button-create-new-instance"}],width:500,body:x.wcpFormGenerateHTMLForForm("New Image Map")};x.wcpEditorPresentModal(t),x.wcpFormUpdateForm("New Image Map"),m.updateNewImageMapFormState()},x.wcpEditorEventSaveButtonPressed=function(){x.wcpEditorPresentLoadingScreen("Saving..."),x.imp_editor_storage_store_save(m.getCompressedSettings(),function(t){var e;t?x.wcpEditorHideLoadingScreenWithMessage("Saved!",!1,!1):(x.wcpEditorHideLoadingScreenWithMessage("There was an error saving the image map!",!0,!1),e="",e+='<div class="modal-info-text">Please save this code in order to preserve your work and try again later. <br>This code can be imported any time by opening an existing image map and pressing the Import button. <br>You can also <a href="https://webcraftplugins.com/support">contact us</a>!</div>',e+='<textarea id="textarea-error-saving">'+JSON.stringify(m.getCompressedSettings())+"</textarea>",setTimeout(function(){x.wcpEditorPresentModal({name:"error-saving",title:"Error Saving Image Map",buttons:[{class:"primary",name:"primary",title:"Done"}],body:e})},1e3))})},x.wcpEditorEventLoadButtonPressed=function(){},x.wcpEditorEventUndoButtonPressed=function(){m.undo()},x.wcpEditorEventRedoButtonPressed=function(){m.redo()},x.wcpEditorEventPreviewButtonPressed=function(){x.wcpEditorIsFloatingWindowOpen()&&x.wcpEditorCloseFloatingWindow()},x.wcpEditorEventEnteredPreviewMode=function(){C.editor.previewMode=1,m.redraw()},x.wcpEditorEventExitedPreviewMode=function(){C.editor.previewMode=0,m.redraw()},x.wcpEditorEventListItemMouseover=function(t){for(var e=g,o=0;o<C.spots.length;o++)C.spots[o].id==t&&(e=C.spots[o].title),H(C.editor.previewMode)&&x.imageMapProUnhighlightShape(C.general.name,C.spots[o].title);H(C.editor.previewMode)&&x.imageMapProHighlightShape(C.general.name,e)},x.wcpEditorEventListItemSelected=function(t){m.selectSpot(t),m.redraw()},x.wcpEditorEventListItemMoved=function(t,e){C.spots.splice(e,0,C.spots.splice(t,1)[0]),m.updateShapesList(),m.redraw()},x.wcpEditorEventObjectListButtonPressed=function(t){var e;m.selectedSpot&&("duplicate"==t&&("spot"==(e=x.extend(!0,{},m.selectedSpot)).type&&(e.id=m.createIdForSpot()),"rect"==e.type&&(e.id=m.createIdForRect()),"oval"==e.type&&(e.id=m.createIdForOval()),"poly"==e.type&&(e.id=m.createIdForPoly()),"text"==e.type&&(e.id=m.createIdForText()),e.title+=" Copy",C.spots.push(e),m.redraw(),m.addAction()),"copy"==t&&(i={text:x.extend(!0,{},m.selectedSpot.text),default_style:x.extend(!0,{},m.selectedSpot.default_style),mouseover_style:x.extend(!0,{},m.selectedSpot.mouseover_style),tooltip_style:x.extend(!0,{},m.selectedSpot.tooltip_style)}),"paste"==t&&(e=m.selectedSpot.text.text,m.selectedSpot.text=x.extend(!0,{},i.text),m.selectedSpot.default_style=x.extend(!0,{},i.default_style),m.selectedSpot.mouseover_style=x.extend(!0,{},i.mouseover_style),m.selectedSpot.tooltip_style=x.extend(!0,{},i.tooltip_style),m.selectedSpot.text.text=e,m.redraw(),m.addAction()),"delete"==t&&(_=m.getIndexOfSpotWithId(m.selectedSpot.id),x.wcpEditorPresentModal({name:"confirm-delete-shape",title:"Confirm Delete",buttons:[{name:"cancel",title:"Cancel",class:""},{name:"primary",title:"Delete",class:"danger"}],body:"Delete this shape?"})),"rename"==t&&(t='<div class="wcp-form-form-control">',t+="<label>Shape Name</label>",t+='<input type="text" id="input-shape-name">',t+="</div>",t+='<div class="modal-error-text" id="rename-shape-error" style="margin-top: 10px; display: none;"></div>',x.wcpEditorPresentModal({name:"confirm-rename-shape",title:"Rename Shape",buttons:[{name:"cancel",title:"Cancel",class:""},{name:"primary",title:"Rename",class:"primary"}],body:'<div class="wcp-form-form-control"><label>Shape Name</label><input type="text" id="input-shape-name"></div><div class="modal-error-text" id="rename-shape-error" style="margin-top: 10px; display: none;"></div>'}),x("#input-shape-name").val(m.selectedSpot.title)))},x.wcpEditorEventSelectedTool=function(t){C.editor.tool=t,m.redraw()},x.wcpEditorEventPressedTool=function(t){"reset"==t&&m.zoomReset()},x.wcpEditorEventMainButtonClick=function(t){var e;"code"==t&&(e="",e+='<div id="imp-generated-code-wrap">',e+='<div class="generated-code-help">',e+=" This is a sample HTML document, showing how to install the plugin in your website.",e+="</div>",e+="<pre>",e+="<!doctype html><br>",e+="<html><br>",e+="<head><br>",e+=' <strong><span class="em-code"><link rel="stylesheet" href="css/image-map-pro.min.css"></span></strong><br>',e+="</head><br>",e+="<body><br>",e+=' <div id="<strong><span class="em-code">image-map-pro-container</span></strong>"></div><br><br>',e+=" <script src="js/jquery.min.js"></script><br>",e+=' <strong><span class="em-code"><script src="js/image-map-pro.min.js"></script></span></strong><br>',e+=" <script type="text/javascript"><br>",e+=" ;(function ($, window, document, undefined) {<br>",e+=" $(document).ready(function() {<br>",e+="</pre>",e+='<div class="generated-code-help">The code that contains all settings and initializes the plugin:</div>',e+='<textarea id="textarea-generated-code" rows="4"></textarea>',e+=" <pre>",e+=" });<br>",e+=" })(jQuery, window, document);<br>",e+=" </script><br>",e+="</body><br>",e+="</html><br>",e+="</pre>",x.wcpEditorPresentModal({name:"code",title:"Code",buttons:[{name:"primary",title:"Done",class:"primary"}],body:e+="</div>"}),x("#textarea-generated-code").val("$('#image-map-pro-container').imageMapPro("+JSON.stringify(m.getCompressedSettings())+");")),"activate"==t&&(e='<div class="wcp-form-form-control">',e+='<label>Purchase Code <a href="https://help.market.envato.com/hc/en-us/articles/202822600-Where-Is-My-Purchase-Code-" target="_blank"><i class="fa fa-question-circle" aria-hidden="true" data-wcp-tooltip="Trouble finding your purchase code?" data-wcp-tooltip-position="right"></i></a></label>',e+='<input type="text" id="input-purchase-code">',x.wcpEditorPresentModal({name:"activate",title:"Activate",buttons:[{name:"cancel",title:"Cancel",class:"default"},{name:"primary",title:"Activate",class:"primary"}],body:e+="</div>"})),"help"==t&&(n=C,C=r,m.shapesFormSpotIndex=-1,m.parseSettings(),m.redraw(),x("#wcp-editor-main-buttons").addClass("wcp-expanded"),x.wcpTourEventFinished=function(){C=n,m.redraw()},x.wcpTourRestart("Image Map Pro Editor Tour")),"import"==t&&(x.wcpFormCreateForm({name:"Import",controls:[{label_width:104,name:"import_format",title:"Import Format",type:"button group",options:[{value:"imp_code",title:"Image Map Pro Code"},{value:"svg_code",title:"SVG XML Code"}],value:"imp_code"},{label_width:104,name:"code",title:"Paste code to import",type:"textarea",value:""},{type:"info",name:"invalid_code",title:"Invalid Code",value:"Invalid Code",options:{style:"red"}},{label_width:104,name:"resize_canvas",title:"Resize Image Map",type:"switch",value:0}]}),t={name:"import",title:"Import",buttons:[{name:"cancel",title:"Cancel",class:""},{name:"primary",title:"Import",class:"primary",id:"wcp-editor-confirm-import"}],body:x.wcpFormGenerateHTMLForForm("Import"),width:700},x.wcpEditorPresentModal(t),x.wcpFormUpdateForm("Import"),x.wcpFormHideControl("Import","invalid_code"),x.wcpFormHideControl("Import","resize_canvas"))},x.wcpEditorEventModalButtonClicked=function(t,e){if("create_new"==t&&("cancel"==e&&x.wcpEditorCloseModal(),"primary"==e&&((d=x.wcpFormGetModel("New Image Map")).name&&0!=d.name||(d.name="Untitled"),d.name=d.name.replace(/\W+/g," "),(C=x.extend(!0,{},y)).id=Math.round(1e4*Math.random())+1,C.general.name=d.name,C.general.shortcode=d.name.replace(/[^\w]/g,""),x.wcpEditorCloseModal(),x.wcpEditorPresentLoadingScreen("Creating..."),"countries"==d.template?x.imageMapProCountriesGetCountrySVG(d.country,function(t){m.parseSVG(t,1);for(var e=0;e<C.spots.length;e++)C.spots[e].default_style.background_color="#0258CF",C.spots[e].default_style.background_opacity=1,C.spots[e].default_style.stroke_color="#ffffff",C.spots[e].default_style.stroke_width=1,C.spots[e].default_style.stroke_opacity=1,C.spots[e].mouseover_style.background_color="#00357D",C.spots[e].mouseover_style.background_opacity=1,C.spots[e].mouseover_style.stroke_color="#ffffff",C.spots[e].mouseover_style.stroke_width=1,C.spots[e].mouseover_style.stroke_opacity=1;C.tooltips.sticky_tooltips=1,x.imp_editor_storage_store_save(m.getCompressedSettings(),function(){x.imp_editor_storage_set_last_save(C.id,function(){m.launch(),x.wcpEditorHideLoadingScreenWithMessage("Created!",!1,!1)})})}):x.imp_editor_storage_store_save(m.getCompressedSettings(),function(){x.imp_editor_storage_set_last_save(C.id,function(){m.launch(),x.wcpEditorHideLoadingScreenWithMessage("Created!",!1,!1)})}))),"modal-choose-icon"==t&&"cancel"==e&&x.wcpEditorCloseModal(),"load"==t&&"cancel"==e&&x.wcpEditorCloseModal(),"confirm-delete-shape"==t&&("primary"==e&&(C.editor.selected_shape==C.spots[_].id&&m.deselectSpot(),C.spots.splice(_,1),x.wcpEditorCloseModal(),m.redraw(),m.addAction()),"cancel"==e&&x.wcpEditorCloseModal()),"code"==t&&"primary"==e&&x.wcpEditorCloseModal(),"export"==t&&"primary"==e&&x.wcpEditorCloseModal(),"import"==t&&("cancel"==e&&x.wcpEditorCloseModal(),"primary"==e)){if("imp_code"==(d=x.wcpFormGetModel("Import")).import_format){var o,i=d.code,r=g;try{r=JSON.parse(i)}catch(t){console.log("error decoding JSON!")}r===g?x.wcpFormShowControl("Import","invalid_code"):(x.wcpEditorCloseModal(),x.wcpFormHideControl("Import","invalid_code"),o=C.general.name,i=C.id,(C=x.extend(!0,{},r)).general.name=o,C.id=i,m.launch())}if("svg_code"==d.import_format){var s=x.extend(!0,{},C);x.wcpFormHideControl("Import","invalid_code");try{m.parseSVG(d.code,d.resize_canvas),m.redraw(),x.wcpEditorCloseModal()}catch(t){C=x.extend(!0,{},s),x.wcpFormShowControl("Import","invalid_code")}}}if("error-saving"==t&&"primary"==e&&x.wcpEditorCloseModal(),"activate"==t&&("cancel"==e&&x.wcpEditorCloseModal(),"primary"==e&&(x.wcpEditorCloseModal(),x.wcpEditorPresentLoadingScreen("Validating Purchase Code..."),x.wcpValidatePurchaseCode?x.wcpValidatePurchaseCode(x("#input-purchase-code").val(),function(t,e){t?(x.wcpEditorHideLoadingScreenWithMessage("Success!",!1,!1),x.wcpEditorHideExtraMainButton("activate")):x.wcpEditorHideLoadingScreenWithMessage("Failed to validate your purchase code.",!0,!1)}):x.wcpEditorHideLoadingScreenWithMessage("Failed to validate your purchase code.</div>",!0,!0))),"confirm-rename-shape"==t&&("cancel"==e&&x.wcpEditorCloseModal(),"primary"==e)){var a=x("#input-shape-name").val();if(0==a.length)return void x("#rename-shape-error").show().html("Please enter a new name for the shape, or press Cancel.");for(var n=!1,l=0;l<C.spots.length;l++)if(C.spots[l].title==a&&C.spots[l].id!=m.selectedSpot.id){n=!0;break}if(n||0==a.length)return void x("#rename-shape-error").show().html("A shape with this name already exists!");m.selectedSpot.title=a,x.wcpEditorCloseModal(),m.redraw()}if("modal-add-layer"==t&&("cancel"==e&&x.wcpEditorCloseModal(),"primary"==e)){var p=!1;if(0==(d=x.wcpFormGetModel("New/Edit Layer")).name.length?(x.wcpFormSetErrorStateForControl("New/Edit Layer","name",!0),p=!0):x.wcpFormSetErrorStateForControl("New/Edit Layer","name",!1),0==d.url.length)return x.wcpFormSetErrorStateForControl("New/Edit Layer","url",!0),void(p=!0);x.wcpFormSetErrorStateForControl("New/Edit Layer","url",!1),m.processNewLayerImage(d.url,function(t,e,o){t?x.wcpFormSetErrorStateForControl("New/Edit Layer","url",!1):(p=!0,x.wcpFormSetErrorStateForControl("New/Edit Layer","url",!0)),p||(o={id:m.createIdForLayer(),title:d.name,image_url:d.url,image_width:e,image_height:o},C.layers.layers_list.push(o),m.updateImageMapForm(),m.redraw(),x.wcpEditorCloseModal())})}if("modal-edit-layer"==t&&("cancel"==e&&x.wcpEditorCloseModal(),"primary"==e)){var d,p=!1;if(0==(d=x.wcpFormGetModel("New/Edit Layer")).name.length?(x.wcpFormSetErrorStateForControl("New/Edit Layer","name",!0),p=!0):x.wcpFormSetErrorStateForControl("New/Edit Layer","name",!1),0==d.url.length)return x.wcpFormSetErrorStateForControl("New/Edit Layer","url",!0),void(p=!0);x.wcpFormSetErrorStateForControl("New/Edit Layer","url",!1),m.processNewLayerImage(d.url,function(t,e,o){if(t?x.wcpFormSetErrorStateForControl("New/Edit Layer","url",!1):(p=!0,x.wcpFormSetErrorStateForControl("New/Edit Layer","url",!0)),!p){for(var i=0;i<C.layers.layers_list.length;i++)if(C.layers.layers_list[i].id==w){C.layers.layers_list[i].title=d.name,C.layers.layers_list[i].image_url=d.url,C.layers.layers_list[i].image_width=e,C.layers.layers_list[i].image_height=o;break}m.updateImageMapForm(),m.redraw(),x.wcpEditorCloseModal()}})}if("modal-confirm-delete-floor"==t&&("cancel"==e&&x.wcpEditorCloseModal(),"primary"==e)){if(1==C.layers.layers_list.length){x.wcpEditorCloseModal();return void x.wcpEditorPresentModal({name:"modal-delete-floor-error",title:"Error",buttons:[{name:"ok",title:"OK",class:"default",id:"imp-editor-button-delete-floor-error-ok"}],body:"Unable to delete, there is only one floor left."})}for(l=0;l<C.layers.layers_list.length;l++)C.layers.layers_list[l].id==u&&C.layers.layers_list.splice(l,1);C.editor.currentLayer=C.layers.layers_list[0].id;for(var c,h=[],l=0;l<C.spots.length;l++)C.spots[l].layerID!=u&&(c=x.extend(!0,{},C.spots[l]),h.push(c));C.spots=h,x.wcpEditorCloseModal(),m.updateImageMapForm(),m.updateShapesList(),m.redraw()}"modal-delete-floor-error"==t&&"ok"==e&&x.wcpEditorCloseModal()},x.wcpEditorEventModalClosed=function(t){},x.wcpEditorEventLoadSaveWithID=function(t){x.wcpEditorPresentLoadingScreen("Loading Image Map..."),x.imp_editor_storage_get_save(t,function(t){t?(C=t,x.imp_editor_storage_set_last_save(C.id,function(){x.wcpEditorHideLoadingScreen(),m.launch()})):x.wcpEditorHideLoadingScreenWithMessage("Error loading image map.",!0,!1)})},x.wcpEditorEventDeleteSaveWithID=function(t,e){x.imp_editor_storage_delete_save(t,function(){e()})},x.wcpEditorEventHelpButtonPressed=function(){},x.wcpFormEventFormUpdated=function(t){var e,o,i,r;"Image Map Settings"==t&&((r=x.wcpFormGetModel(t)).image.image_url&&0<r.image.image_url.length&&C.image.url!==r.image.image_url?(C.image.url=r.image.image_url,m.canvasImage.src=r.image.image_url,p(m.canvasImage,function(){x.wcpEditorPresentLoadingScreen("Loading Image...")},function(){m.canvas_events(),x.wcpEditorHideLoadingScreen(),C.general.width=m.canvasImage.naturalWidth,C.general.height=m.canvasImage.naturalHeight,C.general.naturalWidth=m.canvasImage.naturalWidth,C.general.naturalHeight=m.canvasImage.naturalHeight,x.wcpFormSetControlValue("Image Map Settings","image_map_width",C.general.width),x.wcpFormSetControlValue("Image Map Settings","image_map_height",C.general.height),x.wcpFormUpdateForm("Image Map Settings"),m.redraw(),m.addAction()},function(){x.wcpEditorHideLoadingScreenWithMessage("Error Loading Image!",!0,!1)})):(C.image.url!==r.image.image_url?(C.image.url=r.image.image_url,m.canvasImage.src=r.image.image_url,m.canvas_events(),C.general.width=y.general.naturalWidth,C.general.height=y.general.naturalHeight,C.general.naturalWidth=y.general.naturalWidth,C.general.naturalHeight=y.general.naturalHeight,x.wcpFormSetControlValue("Image Map Settings","image_map_width",y.general.width),x.wcpFormSetControlValue("Image Map Settings","image_map_height",y.general.height),x.wcpFormUpdateForm("Image Map Settings")):(C.general.name=r.general.image_map_name.trim(),r.general.image_map_shortcode&&(C.general.shortcode=r.general.image_map_shortcode.replace(/[\[\]']+/g,"").trim()),C.general.width=r.general.image_map_width,C.general.height=r.general.image_map_height,C.general.responsive=r.general.responsive,C.general.preserve_quality=r.general.preserve_quality,C.general.center_image_map=r.general.center_image_map,C.image.url=r.image.image_url,C.shapes.pageload_animation=r.shapes.pageload_animation,C.shapes.glowing_shapes=r.shapes.glowing_shapes,C.shapes.glowing_shapes_color=r.shapes.glowing_shapes_color,C.shapes.glow_opacity=r.shapes.glow_opacity,C.shapes.stop_glowing_on_mouseover=r.shapes.stop_glowing_on_mouseover,C.tooltips.enable_tooltips=r.tooltips.enable_tooltips,C.tooltips.show_tooltips=r.tooltips.show_tooltips,C.tooltips.show_title_on_mouseover=r.tooltips.show_title_on_mouseover,C.tooltips.sticky_tooltips=r.tooltips.sticky_tooltips,C.tooltips.constrain_tooltips=r.tooltips.constrain_tooltips,C.tooltips.tooltip_animation=r.tooltips.tooltip_animation,C.tooltips.fullscreen_tooltips=r.tooltips.fullscreen_tooltips,C.fullscreen.enable_fullscreen_mode=r.fullscreen.enable_fullscreen_mode,C.fullscreen.start_in_fullscreen_mode=r.fullscreen.start_in_fullscreen_mode,C.fullscreen.fullscreen_background=r.fullscreen.fullscreen_background,C.fullscreen.fullscreen_button_position=r.fullscreen.fullscreen_button_position,C.fullscreen.fullscreen_button_type=r.fullscreen.fullscreen_button_type,C.fullscreen.fullscreen_button_color=r.fullscreen.fullscreen_button_color,C.fullscreen.fullscreen_button_text_color=r.fullscreen.fullscreen_button_text_color,C.zooming.enable_zooming=r.zooming.enable_zooming,C.zooming.max_zoom=r.zooming.max_zoom,C.zooming.limit_max_zoom_to_image_size=r.zooming.limit_max_zoom_to_image_size,C.zooming.enable_navigator=r.zooming.enable_navigator,C.zooming.enable_zoom_buttons=r.zooming.enable_zoom_buttons,C.zooming.zoom_button_text_color=r.zooming.zoom_button_text_color,C.zooming.zoom_button_background_color=r.zooming.zoom_button_background_color,C.zooming.hold_ctrl_to_zoom=r.zooming.hold_ctrl_to_zoom,C.layers.enable_layers=r.layers.enable_layers,C.layers.layers_list=r.layers.layers_list,H(C.layers.enable_layers)&&0==C.layers.layers_list.length&&(C.layers.layers_list=[{id:0,title:"Main Floor",image_url:C.image.url,image_width:C.general.width,image_height:C.general.height}],m.updateImageMapForm()),C.shapes_menu.enable_shapes_menu=r.shapes_menu.enable_shapes_menu,C.shapes_menu.detached_menu=r.shapes_menu.detached_menu,C.shapes_menu.menu_position=r.shapes_menu.menu_position,C.shapes_menu.enable_search=r.shapes_menu.enable_search,C.shapes_menu.group_by_floor=r.shapes_menu.group_by_floor,C.shapes_menu.hide_children_of_connected_shapes=r.shapes_menu.hide_children_of_connected_shapes,e='<div data-imp-detached-menu="'+C.id+'"></div>',x.wcpFormSetControlValue("Image Map Settings","detached_menu_info",e),r.custom_code&&(C.custom_code.custom_css=r.custom_code.custom_css,C.custom_code.custom_js=r.custom_code.custom_js)),m.redraw(),m.addAction())),"Shape Settings"==t&&m.selectedSpot!==g&&(o=m.selectedSpot,i=x.wcpFormGetModel("Shape Settings"),o.title=i.general.shape_title,o.x=i.general.x,o.y=i.general.y,o.width=i.general.width,o.height=i.general.height,o.connected_to=i.general.connected_to,o.use_connected_shape_tooltip=i.general.use_connected_shape_tooltip,o.static=i.general.static,o.text.text=i.text.text,o.text.font_family=i.text.font_family,o.text.font_size=i.text.font_size,o.text.font_weight=i.text.font_weight,o.text.text_color=i.text.text_color,o.text.text_opacity=i.text.text_opacity,o.actions.click=i.actions.click,o.actions.link=i.actions.link,o.actions.script=i.actions.script,o.actions.open_link_in_new_window=i.actions.open_link_in_new_window,o.default_style.opacity=i.default_style.opacity,o.default_style.icon_fill=i.default_style.icon_fill,o.default_style.border_radius=i.default_style.border_radius,o.default_style.background_type=i.default_style.background_type,o.default_style.background_image_url=i.default_style.background_image_url,o.default_style.background_image_opacity=i.default_style.background_image_opacity,o.default_style.background_image_scale=i.default_style.background_image_scale,o.default_style.background_image_offset_x=i.default_style.background_image_offset_x,o.default_style.background_image_offset_y=i.default_style.background_image_offset_y,o.default_style.background_color=i.default_style.background_color,o.default_style.background_opacity=i.default_style.background_opacity,o.default_style.border_width=i.default_style.border_width,o.default_style.border_style=i.default_style.border_style,o.default_style.border_color=i.default_style.border_color,o.default_style.border_opacity=i.default_style.border_opacity,o.default_style.stroke_color=i.default_style.stroke_color,o.default_style.stroke_opacity=i.default_style.stroke_opacity,o.default_style.stroke_width=i.default_style.stroke_width,o.default_style.stroke_dasharray=i.default_style.stroke_dasharray,o.default_style.stroke_linecap=i.default_style.stroke_linecap,o.default_style.use_icon=i.icon.use_icon,o.default_style.icon_type=i.icon.icon_type,o.default_style.icon_svg_path=i.icon.icon_svg_path,o.default_style.icon_svg_viewbox=i.icon.icon_svg_viewbox,o.default_style.icon_url=i.icon.icon_url,o.default_style.icon_is_pin=i.icon.icon_is_pin,o.default_style.icon_shadow=i.icon.icon_shadow,o.mouseover_style.opacity=i.mouseover_style.mouseover_opacity,o.mouseover_style.background_image_url=i.mouseover_style.mouseover_background_image_url,o.mouseover_style.background_image_opacity=i.mouseover_style.mouseover_background_image_opacity,o.mouseover_style.background_image_scale=i.mouseover_style.mouseover_background_image_scale,o.mouseover_style.background_image_offset_x=i.mouseover_style.mouseover_background_image_offset_x,o.mouseover_style.background_image_offset_y=i.mouseover_style.mouseover_background_image_offset_y,o.mouseover_style.background_color=i.mouseover_style.mouseover_background_color,o.mouseover_style.background_opacity=i.mouseover_style.mouseover_background_opacity,o.mouseover_style.icon_fill=i.mouseover_style.mouseover_icon_fill,o.mouseover_style.border_radius=i.mouseover_style.mouseover_border_radius,o.mouseover_style.border_width=i.mouseover_style.mouseover_border_width,o.mouseover_style.border_style=i.mouseover_style.mouseover_border_style,o.mouseover_style.border_color=i.mouseover_style.mouseover_border_color,o.mouseover_style.border_opacity=i.mouseover_style.mouseover_border_opacity,o.mouseover_style.stroke_color=i.mouseover_style.mouseover_stroke_color,o.mouseover_style.stroke_opacity=i.mouseover_style.mouseover_stroke_opacity,o.mouseover_style.stroke_width=i.mouseover_style.mouseover_stroke_width,o.mouseover_style.stroke_dasharray=i.mouseover_style.mouseover_stroke_dasharray,o.mouseover_style.stroke_linecap=i.mouseover_style.mouseover_stroke_linecap,o.tooltip.enable_tooltip=i.tooltip.enable_tooltip,m.redraw(),s||m.addAction()),"Tooltip Style"==t&&m.selectedSpot!==g&&(o=m.selectedSpot,i=x.wcpFormGetModel("Tooltip Style"),o.tooltip_style.border_radius=i.tooltip_border_radius,o.tooltip_style.padding=i.tooltip_padding,o.tooltip_style.background_color=i.tooltip_background_color,o.tooltip_style.background_opacity=i.tooltip_background_opacity,o.tooltip_style.position=i.tooltip_position,o.tooltip_style.width=i.tooltip_width,o.tooltip_style.auto_width=i.tooltip_auto_width,m.redraw(),s||m.addAction()),"New Image Map"==t&&m.updateNewImageMapFormState(),"Import"==t&&("svg_code"==(r=x.wcpFormGetModel(t)).import_format?x.wcpFormShowControl("Import","resize_canvas"):x.wcpFormHideControl("Import","resize_canvas"))},x.wcpEditorEventFloatingWindowClosed=function(t){"Tooltip Content"==t&&m.redraw()},x.wcpEditorSettingsWindowOpened=function(){m.redraw()},x.wcpEditorSettingsWindowClosed=function(){m.redraw()},l.prototype.init=function(t,e){var o=this;o.events(),o.wcpEditorSettings=e,C=x.extend(!0,{},y),x.wcpEditorWebsiteSettings?x.wcpTourIsFinished("Image Map Pro Editor Tour")?(C=x.wcpEditorWebsiteSettings(),o.launch()):(n=C,C=r,x.wcpEditorInit(this.wcpEditorSettings),m.shapesFormSpotIndex=-1,m.parseSettings(),m.redraw(),x("#wcp-editor-main-buttons").addClass("wcp-expanded"),x.wcpTourStart("Image Map Pro Editor Tour"),x.wcpTourEventFinished=function(t){"Image Map Pro Editor Tour"==t&&(C=x.wcpEditorWebsiteSettings(),o.launch())}):(x.wcpEditorInit(this.wcpEditorSettings),t?(C=t,o.launch()):x.imp_editor_storage_get_last_save(function(e){e?x.wcpTourIsFinished("Whats New 5.0")?(x.wcpEditorPresentLoadingScreen("Loading Image Map..."),x.imp_editor_storage_get_save(parseInt(e,10),function(t){t?(C=t,m.launch()):(x.wcpEditorHideLoadingScreenWithMessage("Error loading image map.",!0,!1),(C=x.extend(!0,{},y)).general.name="Untitled",C.id=Math.round(1e4*Math.random())+1,o.launch())})):(x.wcpTourStart("Whats New 5.0"),x.wcpTourEventFinished=function(t){"Whats New 5.0"==t&&(x.wcpEditorPresentLoadingScreen("Loading Image Map..."),x.imp_editor_storage_get_save(parseInt(e,10),function(t){t?(C=t,m.launch()):(x.wcpEditorHideLoadingScreenWithMessage("Error loading image map.",!0,!1),(C=x.extend(!0,{},y)).general.name="Untitled",C.id=Math.round(1e4*Math.random())+1,o.launch())}))}):x.imp_editor_storage_get_saves_list(function(t){0<t.length?x.wcpTourIsFinished("Whats New 5.0")?((C=x.extend(!0,{},y)).general.name="Untitled",C.id=Math.round(1e4*Math.random())+1,o.launch(),x.wcpEditorPresentLoadModal()):(x.wcpTourStart("Whats New 5.0"),x.wcpTourEventFinished=function(t){"Whats New 5.0"==t&&((C=x.extend(!0,{},y)).general.name="Untitled",C.id=Math.round(1e4*Math.random())+1,o.launch(),x.wcpEditorPresentLoadModal())}):x.wcpTourIsFinished("Image Map Pro Editor Tour")?(x.wcpTourDisable("Whats New 5.0"),(C=x.extend(!0,{},y)).general.name="Untitled",C.id=Math.round(1e4*Math.random())+1,o.launch()):(n=C,C=r,m.shapesFormSpotIndex=-1,m.parseSettings(),m.redraw(),x("#wcp-editor-main-buttons").addClass("wcp-expanded"),x.wcpTourStart("Image Map Pro Editor Tour"),x.wcpTourEventFinished=function(t){"Image Map Pro Editor Tour"==t&&((C=x.extend(!0,{},y)).general.name="Untitled",C.id=Math.round(1e4*Math.random())+1,o.launch())})})}))},l.prototype.launch=function(){var t=this;x.wcpEditorInit(this.wcpEditorSettings),x("#wcp-editor-canvas").attr("data-editor-object-type","0"),this.selectedSpot=g,this.eventSpot=g,this.shapesFormSpotIndex=g,this.parseSettings(),C.image.url&&0<C.image.url.length||H(C.layers.enable_layers)&&0<C.layers.layers_list.length?(H(C.layers.enable_layers)&&0<C.layers.layers_list.length?this.canvasImage.src=C.layers.layers_list[0].image_url:this.canvasImage.src=C.image.url,p(this.canvasImage,function(){x.wcpEditorPresentLoadingScreen("Loading Image...")},function(){t.canvas_events(),C.general.naturalWidth=t.canvasImage.naturalWidth,C.general.naturalHeight=t.canvasImage.naturalHeight,C.editor.state={dragging:!1,canvasX:0,canvasY:0,canvasZoom:1},t.redraw(),t.selectSpot(C.editor.selected_shape),x.wcpEditorHideLoadingScreen()},function(){x.wcpEditorHideLoadingScreenWithMessage("Error Loading Image!",!0,!1)})):(t.canvas_events(),C.editor.state={dragging:!1,canvasX:0,canvasY:0,canvasZoom:1},t.redraw(),t.selectSpot(C.editor.selected_shape),x.wcpEditorHideLoadingScreen()),this.actionIndex=-1,this.actionStack=new Array,this.addAction(),this.canvas=x("#wcp-editor-canvas"),x.wcpEditorSelectTool(C.editor.tool),this.updateImageMapForm(),x.wcpEditorModifyForPublish&&x.wcpEditorModifyForPublish()},l.prototype.parseSettings=function(){for(var t,e=0;e<C.spots.length;e++){if(C.spots[e]=x.extend(!0,{},h,C.spots[e]),-1!=C.spots[e].x_image_background&&-1!=C.spots[e].y_image_background||(C.spots[e].x_image_background=C.spots[e].x,C.spots[e].y_image_background=C.spots[e].y,C.spots[e].width_image_background=C.spots[e].width,C.spots[e].height_image_background=C.spots[e].height),"poly"==C.spots[e].type&&(C.spots[e].default_style.fill&&(C.spots[e].default_style.background_color=C.spots[e].default_style.fill,C.spots[e].default_style.fill=g),C.spots[e].default_style.fill_opacity&&(C.spots[e].default_style.background_opacity=C.spots[e].default_style.fill_opacity,C.spots[e].default_style.fill_opacity=g)),(C.spots[e].tooltip_content.title||C.spots[e].tooltip_content.text)&&(t="",C.spots[e].tooltip_content.title&&(t+="<h3>"+C.spots[e].tooltip_content.title+"</h3>"),C.spots[e].tooltip_content.text&&(t+="<p>"+C.spots[e].tooltip_content.text+"</p>"),C.spots[e].tooltip_content.plain_text=t,C.spots[e].tooltip_content={content_type:C.spots[e].tooltip_content.content_type,plain_text:C.spots[e].tooltip_content.plain_text,plain_text_color:C.spots[e].tooltip_content.plain_text_color,squares_json:C.spots[e].tooltip_content.squares_json}),C.spots[e].tooltip_content.squares_json)try{C.spots[e].tooltip_content.squares_settings=JSON.parse(C.spots[e].tooltip_content.squares_json),C.spots[e].tooltip_content.squares_json=""}catch(t){}C.spots[e].title||(C.spots[e].title=C.spots[e].id),"show-tooltip"==C.spots[e].actions.click&&(C.spots[e].actions.click="no-action"),"[object Array]"!==Object.prototype.toString.call(C.spots[e].points)&&(C.spots[e].points=[]),"[object Array]"!==Object.prototype.toString.call(C.spots[e].vs)&&(C.spots[e].vs=[])}for(var o,e=0;e<C.spots.length;e++)(i=C.spots[e]).tooltip_content&&i.tooltip_content.title&&(i.title=i.tooltip_content.title,i.tooltip_content.title=g),i.tooltip_style&&i.tooltip_style.enable_tooltip&&(i.tooltip.enable_tooltip=i.tooltip_style.enable_tooltip,i.tooltip_style.enable_tooltip=g),i.tooltip_content.plain_text&&"content-builder"!=i.tooltip_content.content_type&&(o={containers:[{id:"sq-container-160121",settings:{elements:[{settings:{name:"Paragraph",iconClass:"fa fa-paragraph"},options:{text:{text:i.tooltip_content.plain_text},font:{text_color:i.tooltip_content.plain_text_color}}}]}}]},i.tooltip_content.squares_settings=o,i.tooltip_content.content_type=g,i.tooltip_content.plain_text=g,i.tooltip_content.plain_text_color=g),i.default_style&&i.default_style.fill&&(i.default_style.background_color=i.default_style.fill,delete i.default_style.fill),i.default_style&&i.default_style.fill_opacity&&(i.default_style.background_opacity=i.default_style.fill_opacity,delete i.default_style.fill_opacity),i.mouseover_style&&i.mouseover_style.fill&&(i.mouseover_style.background_color=i.mouseover_style.fill,delete i.mouseover_style.fill),i.mouseover_style&&i.mouseover_style.fill_opacity&&(i.mouseover_style.background_opacity=i.mouseover_style.fill_opacity,delete i.mouseover_style.fill_opacity);C.shapes||(C.shapes=x.imageMapProDefaultSettings.shapes,C.general&&C.general.pageload_animation&&(C.shapes.pageload_animation=C.general.pageload_animation,C.general.pageload_animation=g));for(var i,r=[],e=0;e<C.spots.length;e++){if((i=C.spots[e]).x=parseFloat(i.x),i.y=parseFloat(i.y),i.width&&(i.width=parseFloat(i.width)),i.height&&(i.height=parseFloat(i.height)),"poly"==i.type){if(i.points.length<3)continue;if(i.points)for(var s=0;s<i.points.length;s++)i.points[s].x=parseFloat(i.points[s].x),i.points[s].y=parseFloat(i.points[s].y);if(i.vs)for(s=0;s<i.vs.length;s++)for(var a=0;a<i.vs[s].length;a++)i.vs[s][0]=parseFloat(i.vs[s][0]),i.vs[s][1]=parseFloat(i.vs[s][1])}r.push(i)}C.spots=r,C.general=x.extend(!0,{},y.general,C.general),C.image=x.extend(!0,{},y.image,C.image),C.shapes=x.extend(!0,{},y.shapes,C.shapes),C.tooltips=x.extend(!0,{},y.tooltips,C.tooltips),C.fullscreen=x.extend(!0,{},y.fullscreen,C.fullscreen),C.zooming=x.extend(!0,{},y.zooming,C.zooming),C.editor=x.extend(!0,{},y.editor,C.editor),C.custom_code=x.extend(!0,{},y.custom_code,C.custom_code),C.layers=x.extend(!0,{},y.layers,C.layers),C.shapes_menu=x.extend(!0,{},y.shapes_menu,C.shapes_menu),C.general.width=parseInt(C.general.width),C.general.height=parseInt(C.general.height),C.general.image_url&&(C.image.url=C.general.image_url,C.general.image_url=g),C.general.sticky_tooltips&&(C.tooltips.sticky_tooltips=C.general.sticky_tooltips,C.general.sticky_tooltips=g),C.general.constrain_tooltips&&(C.tooltips.constrain_tooltips=C.general.constrain_tooltips,C.general.constrain_tooltips=g),C.general.fullscreen_tooltips&&(C.tooltips.fullscreen_tooltips=C.general.fullscreen_tooltips,C.general.fullscreen_tooltips=g),C.general.tooltip_animation&&(C.tooltips.tooltip_animation=C.general.tooltip_animation,C.general.tooltip_animation=g);for(e=0;e<C.spots.length;e++)C.spots[e].tooltip_content.squares_settings||(C.spots[e].tooltip_content.squares_settings=x.extend(!0,{},h.tooltip_content.squares_settings));C.general.imageurl&&(C.image.url=C.general.imageurl),C.general.name=C.general.name.trim(),C.general.shortcode=C.general.shortcode.trim()},l.prototype.redraw=function(){var t,e;H(C.editor.previewMode)?(e=this.getCanvasDefaultSize(),""!=C.image.url?x("#wcp-editor-canvas").css({width:"auto",height:"auto","max-width":e.w,"max-height":e.h}):x("#wcp-editor-canvas").css({width:"100%",height:"auto","max-width":e.w,"max-height":e.h}),(t=x.extend(!0,{},C)).fullscreen.start_in_fullscreen_mode=0,t.shapes_menu.detached_menu=0,x("#wcp-editor-canvas").imageMapPro(t),1!=this.zoom&&this.zoomReset(),x.wcpEditorSetPreviewModeOn()):(e=this.getCanvasDefaultSize(),this.canvasWidth=e.w*this.zoom,this.canvasHeight=e.h*this.zoom,x("#wcp-editor-canvas").css({width:this.canvasWidth,height:this.canvasHeight,"max-width":"none","max-height":"none"}),x("#wcp-editor-canvas").html(x.image_map_pro_editor_content()),x("#imp-editor-image").css({width:this.canvasWidth,height:this.canvasHeight}),x.wcpEditorSetPreviewModeOff()),this.redrawSpotSelection(),this.redrawSelectedSpotTooltip(),this.updateShapesForm(),this.updateShapesFormState(),this.updateShapesList(),this.updateImageMapFormState(),this.drawingPoly&&this.redrawTempPoly()},l.prototype.redrawCanvas=function(){this.canvas.css({transform:"translate("+this.canvasX+"px, "+this.canvasY+"px)"})},l.prototype.getCanvasDefaultSize=function(){var t,e={w:0,h:0},o=x("#wcp-editor-center").width()-80,i=x("#wcp-editor-center").height()-80,r=0,s=0;if(H(C.layers.enable_layers)){for(var a=0;a<C.layers.layers_list.length;a++)if(parseInt(C.layers.layers_list[a].id,10)==parseInt(C.editor.currentLayer,10)){r=C.layers.layers_list[a].image_width,s=C.layers.layers_list[a].image_height;break}}else r=C.general.width,s=C.general.height;return o<r||i<s?(t=r/s)<=o/i?(e.w=i*t,e.h=x("#wcp-editor-center").height()-80):(e.w=x("#wcp-editor-center").width()-80,e.h=o/t):(e.w=r,e.h=s),e},l.prototype.redrawSpotSelection=function(){var t=this;if(x(".imp-editor-shape").removeClass("selected"),x("#imp-editor-shape-tooltip").removeClass("selected"),-1!=C.editor.selected_shape){var e=t.getIndexOfSpotWithId(C.editor.selected_shape);if(e!=g){if(this.tooltipTransformMode)return x("#imp-editor-shape-tooltip").addClass("selected"),void x("#wcp-editor-tooltip").remove();x('.imp-editor-shape[data-id="'+C.editor.selected_shape+'"]').addClass("selected"),t.selectedSpot=C.spots[e],"poly"==t.selectedSpot.type&&(t.tempControlPoint=x('.imp-editor-poly[data-id="'+C.editor.selected_shape+'"]').find(".imp-editor-poly-svg-temp-control-point"),t.tempControlPointLine=x('.imp-editor-poly[data-id="'+C.editor.selected_shape+'"]').find(".imp-editor-poly-svg-temp-control-point-line"))}else C.editor.selected_shape=-1}else t.selectedSpot=g},l.prototype.redrawSelectedSpotTooltip=function(){var t,e,o,i,r,s,a,n,l,p,d,c;!this.selectedSpot||"text"==this.selectedSpot.type||0!=(t=x("#imp-editor-shape-tooltip")).length&&(i=this.selectedSpot,r=t[o=e=0].getBoundingClientRect().width/this.canvasWidth*100,s=t[0].getBoundingClientRect().height/this.canvasHeight*100,a=20/this.canvasWidth*100,n=20/this.canvasHeight*100,l=i.width,p=i.height,d=i.x,c=i.y,"spot"==i.type&&(l=i.width/this.canvasWidth*100,p=i.height/this.canvasHeight*100,d=i.x-l/2,c=i.y-p/2,H(i.default_style.icon_is_pin)&&H(i.default_style.use_icon)&&(c-=p/2)),"top"==i.tooltip_style.position&&(e=d+l/2-r/2,o=c-s-n),"bottom"==i.tooltip_style.position&&(e=d+l/2-r/2,o=c+p+n),"left"==i.tooltip_style.position&&(e=d-r-a,o=c+p/2-s/2),"right"==i.tooltip_style.position&&(e=d+l+a,o=c+p/2-s/2),e+=i.tooltip_style.offset_x,o+=i.tooltip_style.offset_y,t.css({left:e+"%",top:o+"%",width:r+"%"}))},l.prototype.events=function(){var n=this;x(o).off("squares_image_loaded"),x(o).on("squares_image_loaded",function(){n.redrawSelectedSpotTooltip()}),x(o).off("button-choose-icon-clicked"),x(o).on("button-choose-icon-clicked",function(){x.wcpEditorPresentModal({name:"modal-choose-icon",title:"Choose Icon",buttons:[{name:"cancel",title:"Cancel",class:"default",id:"imp-editor-button-cancel-choose-icon"}],body:n.iconsHTML})}),x(o).off("button-copy-from-default-styles-clicked"),x(o).on("button-copy-from-default-styles-clicked",function(){n.selectedSpot.mouseover_style.opacity=n.selectedSpot.default_style.opacity,n.selectedSpot.mouseover_style.background_image_url=n.selectedSpot.default_style.background_image_url,n.selectedSpot.mouseover_style.background_image_opacity=n.selectedSpot.default_style.background_image_opacity,n.selectedSpot.mouseover_style.background_image_scale=n.selectedSpot.default_style.background_image_scale,n.selectedSpot.mouseover_style.background_image_offset_x=n.selectedSpot.default_style.background_image_offset_x,n.selectedSpot.mouseover_style.background_image_offset_y=n.selectedSpot.default_style.background_image_offset_y,n.selectedSpot.mouseover_style.background_color=n.selectedSpot.default_style.background_color,n.selectedSpot.mouseover_style.background_opacity=n.selectedSpot.default_style.background_opacity,n.selectedSpot.mouseover_style.icon_fill=n.selectedSpot.default_style.icon_fill,n.selectedSpot.mouseover_style.border_radius=n.selectedSpot.default_style.border_radius,n.selectedSpot.mouseover_style.border_width=n.selectedSpot.default_style.border_width,n.selectedSpot.mouseover_style.border_style=n.selectedSpot.default_style.border_style,n.selectedSpot.mouseover_style.border_color=n.selectedSpot.default_style.border_color,n.selectedSpot.mouseover_style.border_opacity=n.selectedSpot.default_style.border_opacity,n.selectedSpot.mouseover_style.stroke_color=n.selectedSpot.default_style.stroke_color,n.selectedSpot.mouseover_style.stroke_opacity=n.selectedSpot.default_style.stroke_opacity,n.selectedSpot.mouseover_style.stroke_width=n.selectedSpot.default_style.stroke_width,n.selectedSpot.mouseover_style.stroke_dasharray=n.selectedSpot.default_style.stroke_dasharray,n.selectedSpot.mouseover_style.stroke_linecap=n.selectedSpot.default_style.stroke_linecap,n.redraw(),n.addAction()}),x(o).off("button-reset-size-clicked"),x(o).on("button-reset-size-clicked",function(){""!=C.image.url?(C.general.width=n.canvasImage.naturalWidth,C.general.height=n.canvasImage.naturalHeight):(C.general.width=y.general.naturalWidth,C.general.height=y.general.naturalHeight,C.general.naturalWidth=y.general.naturalWidth,C.general.naturalHeight=y.general.naturalHeight),n.updateImageMapForm(),n.redraw()}),x(o).off("button-launch-content-builder-clicked"),x(o).on("button-launch-content-builder-clicked",function(){n.launchTooltipContentBuilder()}),x(o).off("click",".fontawesome-icon-wrap"),x(o).on("click",".fontawesome-icon-wrap",function(){x.wcpEditorCloseModal(),n.selectedSpot.default_style.icon_fontawesome_id=x(this).data("fontawesome-id"),n.redraw(),n.addAction()}),x(o).off("click",".category-title-wrap"),x(o).on("click",".category-title-wrap",function(){x(this).toggleClass("active"),x(this).next().toggle()}),x(o).on("mouseout","#wcp-editor-right",function(t){if(H(C.editor.previewMode))for(var e=0;e<C.spots.length;e++)x.imageMapProUnhighlightShape(C.general.name,C.spots[e].title)}),x(o).off("event-layers-list-add"),x(o).on("event-layers-list-add",function(){x.wcpEditorPresentModal({name:"modal-add-layer",title:"Add Layer",buttons:[{name:"cancel",title:"Cancel",class:"default",id:"imp-editor-button-cancel-add-layer"},{name:"primary",title:"Create",class:"primary",id:"imp-editor-button-create-layer"}],body:x.wcpFormGenerateHTMLForForm("New/Edit Layer")}),x.wcpFormSetControlValue("New/Edit Layer","name","Untitled"),x.wcpFormSetControlValue("New/Edit Layer","url",""),x.wcpFormUpdateForm("New/Edit Layer")}),x(o).off("event-layers-list-remove"),x(o).on("event-layers-list-remove",function(t,e){u=e;e="";e+="Are you sure you want to permanently delete this floor and all shapes in it?",x.wcpEditorPresentModal({name:"modal-confirm-delete-floor",title:"Delete Floor",buttons:[{name:"cancel",title:"Cancel",class:"default",id:"imp-editor-button-cancel-delete-floor"},{name:"primary",title:"Delete",class:"danger",id:"imp-editor-button-delete-floor"}],body:"Are you sure you want to permanently delete this floor and all shapes in it?"})}),x(o).off("event-layers-list-duplicate"),x(o).on("event-layers-list-duplicate",function(t,e){for(var o=0;o<C.layers.layers_list.length;o++){var i=n.createIdForLayer();if(C.layers.layers_list[o].id==e){var r={id:i,image_height:C.layers.layers_list[o].image_height,image_width:C.layers.layers_list[o].image_width,image_url:C.layers.layers_list[o].image_url,title:C.layers.layers_list[o].title+" Copy"};C.layers.layers_list.splice(o+1,0,r);break}}for(var s=C.spots.length,o=0;o<s;o++){var a=C.spots[o];a.layerID==e&&((a=x.extend(!0,{},a)).layerID=i,"spot"==a.type&&(a.id=n.createIdForSpot()),"rect"==a.type&&(a.id=n.createIdForRect()),"oval"==a.type&&(a.id=n.createIdForOval()),"poly"==a.type&&(a.id=n.createIdForPoly()),"text"==a.type&&(a.id=n.createIdForText()),C.spots.push(a))}n.updateImageMapForm(),n.redraw()}),x(o).off("event-layers-list-up"),x(o).on("event-layers-list-up",function(){}),x(o).off("event-layers-list-down"),x(o).on("event-layers-list-down",function(){}),x(o).off("event-layers-list-edit"),x(o).on("event-layers-list-edit",function(t,e){w=e,x.wcpEditorPresentModal({name:"modal-edit-layer",title:"Edit Layer",buttons:[{name:"cancel",title:"Cancel",class:"default",id:"imp-editor-button-cancel-add-layer"},{name:"primary",title:"Done",class:"primary",id:"imp-editor-button-edit-layer-done"}],body:x.wcpFormGenerateHTMLForForm("New/Edit Layer")});e=x('[data-wcp-form-layers-list-control-option-id="'+e+'"]');x.wcpFormSetControlValue("New/Edit Layer","name",e.data("wcp-form-layers-list-control-option-title")),x.wcpFormSetControlValue("New/Edit Layer","url",e.data("wcp-form-layers-list-control-option-image-url")),x.wcpFormUpdateForm("New/Edit Layer")}),x(o).off("change","#select-canvas-layer"),x(o).on("change","#select-canvas-layer",function(){C.editor.currentLayer=x("#select-canvas-layer").val(),n.updateShapesList(),n.deselectSpot(),n.redraw()}),x(o).off("button-reset-tooltip-position-clicked"),x(o).on("button-reset-tooltip-position-clicked",function(){n.selectedSpot&&(n.selectedSpot.tooltip_style.offset_x=x.imageMapProDefaultSpotSettings.tooltip_style.offset_x,n.selectedSpot.tooltip_style.offset_y=x.imageMapProDefaultSpotSettings.tooltip_style.offset_y,n.selectedSpot.tooltip_style.position=x.imageMapProDefaultSpotSettings.tooltip_style.position),n.addAction(),n.redraw()}),x(o).off("button-reset-tooltip-size-clicked"),x(o).on("button-reset-tooltip-size-clicked",function(){n.selectedSpot&&(n.selectedSpot.tooltip_style.width=x.imageMapProDefaultSpotSettings.tooltip_style.width),n.addAction(),n.redraw()}),x(o).off("button-edit-tooltip-style-clicked"),x(o).on("button-edit-tooltip-style-clicked",function(){if(1==C.editor.transform_tooltip_mode&&(C.editor.transform_tooltip_mode=0,n.tooltipTransformMode=!1,n.redraw()),x.wcpEditorIsFloatingWindowOpen())return x.wcpEditorCloseFloatingWindow(),void n.redraw();var t=x('[data-editor-object-type="10"]').parent(),e=t.offset().left,o=t.offset().top,i=t.width(),t=x.wcpFormGenerateHTMLForForm("Tooltip Style"),t={x:Math.round(e+i+10),y:Math.round(o),padding:!0,title:"Tooltip Style",width:300,content:t};x.wcpEditorCreateFloatingWindow(t),n.updateShapesForm(),n.redraw()}),x(o).off("button-edit-tooltip-position-clicked"),x(o).on("button-edit-tooltip-position-clicked",function(){x.wcpEditorIsFloatingWindowOpen()&&x.wcpEditorCloseFloatingWindow(),1==C.editor.transform_tooltip_mode?(C.editor.transform_tooltip_mode=0,n.tooltipTransformMode=!1):(C.editor.transform_tooltip_mode=1,n.tooltipTransformMode=!0,n.transformingTooltipStartingWidth=x("#imp-editor-shape-tooltip").outerWidth()),n.redraw()}),x(o).off("button-edit-tooltip-content-clicked"),x(o).on("button-edit-tooltip-content-clicked",function(){if(1==C.editor.transform_tooltip_mode&&(C.editor.transform_tooltip_mode=0,n.tooltipTransformMode=!1,n.redraw()),x.wcpEditorIsFloatingWindowOpen())return x.wcpEditorCloseFloatingWindow(),void n.redraw();var t=x('[data-editor-object-type="10"]').parent(),e=t.offset().left,o=t.offset().top,i=t.width();x.squaresInitWithSettings(x("#imp-editor-shape-tooltip-content-wrap"),n.selectedSpot.tooltip_content.squares_settings);t=x.squaresGetEditorWindowContents(),t={x:Math.round(e+i+10),y:Math.round(o),padding:!1,title:"Tooltip Content",content:t,width:394};x.wcpEditorCreateFloatingWindow(t)})},l.prototype.canvas_events=function(){var e=this;x(t).off("resize.imp-redraw"),x(t).on("resize.imp-redraw",function(){e.redraw()}),x(o).off("mousedown","#wcp-editor-center"),x(o).on("mousedown","#wcp-editor-center",function(t){e.handleMouseDown(t)}),x(o).off("mousemove","#wcp-editor"),x(o).on("mousemove","#wcp-editor",function(t){e.handleMouseMove(t)}),x(o).off("mouseup","#wcp-editor"),x(o).on("mouseup","#wcp-editor",function(t){e.handleMouseUp(t)}),x("body").on("contextmenu",function(t){if(e.didDeleteControlPoint)return e.didDeleteControlPoint=!1}),x(o).off("keydown.canvasEvents"),x(o).on("keydown.canvasEvents",function(t){return e.handleKeyDown(t)}),x(o).off("keyup.canvasEvents"),x(o).on("keyup.canvasEvents",function(t){return e.handleKeyUp(t)})},l.prototype.addAction=function(){var t=this;t.actionIndex<t.actionStack.length-1&&t.actionStack.splice(t.actionIndex+1,t.actionStack.length),t.actionStack.push(x.extend(!0,{},C)),t.actionIndex++,100<t.actionStack.length&&(t.actionStack.splice(0,1),t.actionIndex--),x("#button-save").html('<span class="glyphicon glyphicon-hdd"></span> Save')},l.prototype.undo=function(){var t=this;0<t.actionIndex&&t.actionIndex--,C=x.extend(!0,{},t.actionStack[t.actionIndex]),t.redraw(),t.updateImageMapForm(),t.updateImageMapFormState(),t.updateShapesForm(),t.updateShapesFormState()},l.prototype.redo=function(){var t=this;t.actionIndex<t.actionStack.length-1&&t.actionIndex++,C=x.extend(!0,{},t.actionStack[t.actionIndex]),t.redraw(),t.updateImageMapForm(),t.updateImageMapFormState(),t.updateShapesForm(),t.updateShapesFormState()},l.prototype.handleMouseDown=function(t){var e=this;if("wcp-editor-toolbar"!=x(t.target).attr("id")&&1!=x(t.target).closest("#wcp-editor-toolbar").length&&"wcp-editor-extra-main-buttons"!=x(t.target).attr("id")&&1!=x(t.target).closest("#wcp-editor-extra-main-buttons").length&&!(0<x(t.target).closest("#wcp-editor-floating-window").length||"wcp-editor-floating-window"==x(t.target).attr("id")||"imp-poly-tooltip-close-button"==x(t.target).attr("id")||H(C.editor.previewMode)||x("body").hasClass("modal-open"))){var o=I(t.pageX,t.pageY,e.canvas);e.ix=o.x,e.iy=o.y,e.ixss=t.pageX,e.iyss=t.pageY;var i=!1;0<o.x&&o.x<e.canvasWidth*e.zoom&&0<o.y&&o.y<e.canvasHeight*e.zoom&&(i=!0);var r=x(t.target).data("editor-object-type")||x(t.target).closest("[data-editor-object-type]").data("editor-object-type");if((e.spaceKeyDown||C.editor.tool==a)&&i)return e.draggingCanvas=!0,e.canvasInitialX=e.canvasX,void(e.canvasInitialY=e.canvasY);if("zoom-in"==C.editor.tool&&"wcp-editor-center"!=x(t.target).attr("id"))return e.zoomIn(t),void(this.shouldDeselectShape=!0);if("zoom-out"==C.editor.tool&&"wcp-editor-center"!=x(t.target).attr("id"))return e.zoomOut(t),void(this.shouldDeselectShape=!0);if(e.drawingPoly)return x(t.target).is("circle")&&0==x(t.target).data("index")?(e.drawingPoly=!1,void(e.finishedDrawingPoly=!0)):(e.placePointForTempPoly(e.ix,e.iy),e.redrawTempPoly(),void(e.mouseDownWhileDrawingPoly=!0));if(C.editor.tool==a&&"wcp-editor-center"!=x(t.target).attr("id"))return e.startedDraggingCanvas=!0,void(this.shouldDeselectShape=!0);if(7==r)return x(t.target).addClass("active"),e.translatedPointIndex=x(t.target).data("index"),2==t.button?(e.selectedSpot.points.splice(e.translatedPointIndex,1),e.updateBoundingBoxForPolygonSpot(e.selectedSpot),e.redraw(),e.addAction(),void(e.didDeleteControlPoint=!0)):(e.translatingControlPoint=!0,e.translatedPointX=e.selectedSpot.points[e.translatedPointIndex].x,e.translatedPointY=e.selectedSpot.points[e.translatedPointIndex].y,e.translatedPoint=x(t.target),void(e.redrawPolygonEl=x(t.target).closest(".imp-editor-shape").find(".imp-editor-poly-svg polygon")));if(6==r)return e.selectedSpot.points.splice(e.tempControlPointIndex+1,0,{x:e.controlPointInsertionPointX,y:e.controlPointInsertionPointY}),e.redraw(),(o=x('.imp-editor-shape[data-id="'+e.selectedSpot.id+'"]').find('.imp-poly-control-point[data-index="'+(e.tempControlPointIndex+1)+'"]')).addClass("active"),e.translatedPointIndex=o.data("index"),e.translatingControlPoint=!0,e.translatedPointX=e.selectedSpot.points[e.translatedPointIndex].x,e.translatedPointY=e.selectedSpot.points[e.translatedPointIndex].y,e.translatedPoint=o,void(e.redrawPolygonEl=o.closest(".imp-editor-shape").find(".imp-editor-poly-svg polygon"));if(5!=r)if(9!=r){if(15==r&&(this.transformDirection=x(t.target).data("transform-direction"),this.startedTransformingTooltip=!0,this.didTransformTooltip=!1,this.redrawTooltip=x("#imp-editor-shape-tooltip")),10!=r&&11!=r&&12!=r&&13!=r&&14!=r&&!this.tooltipTransformMode){for(s=C.spots.length-1;0<=s;s--)if("poly"==C.spots[s].type&&(!H(C.layers.enable_layers)||C.spots[s].layerID==C.editor.currentLayer)&&e.shouldSelectPoly(C.spots[s].id))return e.eventSpotId=C.spots[s].id,void(e.startedSelecting=!0);if((x(t.target).hasClass("imp-editor-shape")||0<x(t.target).closest(".imp-editor-shape").length)&&!x(t.target).hasClass("imp-editor-poly")&&0==x(t.target).closest(".imp-editor-poly").length)return e.eventSpotId=x(t.target).data("id")||x(t.target).closest(".imp-editor-shape").data("id"),void(e.startedSelecting=!0);if(i){if("spot"==C.editor.tool)return void(e.startedDrawingSpot=!0);if("rect"==C.editor.tool)return void(e.startedDrawingRect=!0);if("oval"==C.editor.tool)return void(e.startedDrawingOval=!0);if("poly"==C.editor.tool)return e.startedDrawingPoly=!0,e.deselectSpot(),e.redraw(),e.polyPoints=new Array,x("#imp-editor-shapes-container").append('<svg id="temp-poly" width="'+e.canvasWidth+'px" height="'+e.canvasHeight+'px" viewBox="0 0 '+e.canvasWidth+" "+e.canvasHeight+'" version="1.1" xmlns="http://www.w3.org/2000/svg"></svg>'),e.placePointForTempPoly(e.ix,e.iy),e.redrawTempPoly(),e.mouseDownWhileDrawingPoly=!0,void(e.drawingPoly=!0);if("text"==C.editor.tool)return void(e.startedDrawingText=!0)}("select"==C.editor.tool&&0==r||"wcp-editor-center"==x(t.target).attr("id")&&this.selectedSpot)&&(this.shouldDeselectShape=!0)}}else this.tooltipTransformMode&&(this.startedSelectingTooltip=!0);else if(e.startedTransforming=!0,e.transformDirection=x(t.target).data("transform-direction"),e.redrawEl=x(t.target).closest(".imp-editor-shape"),e.redrawElBgImage=x('.imp-editor-shape-background-image[data-id="'+e.selectedSpot.id+'"]'),"poly"==e.selectedSpot.type){e.redrawSvgEl=e.redrawEl.find(".imp-editor-poly-svg"),e.redrawPolygonEl=e.redrawSvgEl.find("polygon"),e.polyPoints=new Array;for(var s=0;s<e.selectedSpot.points.length;s++)e.polyPoints.push({x:e.selectedSpot.points[s].x,y:e.selectedSpot.points[s].y})}}},l.prototype.handleMouseMove=function(t){if(!H(C.editor.previewMode)){var e,o,i,r,s,a,n,l,p=I(t.pageX,t.pageY,this.canvas);if(this.x=p.x,this.y=p.y,this.dx=(this.x-this.ix)/this.canvasWidth*100,this.dy=(this.y-this.iy)/this.canvasHeight*100,this.dx=Math.round(1e3*this.dx)/1e3,this.dy=Math.round(1e3*this.dy)/1e3,this.xss=t.pageX,this.yss=t.pageY,this.dxss=this.xss-this.ixss,this.dyss=this.yss-this.iyss,this.startedSelectingTooltip&&(this.movingTooltip=!0,this.startedSelectingTooltip=!1,this.redrawTooltip=x("#imp-editor-shape-tooltip"),this.movingTooltipPosition=this.selectedSpot.tooltip_style.position,r=F(this.selectedSpot.default_style.background_color),this.movingTooltipColorRGBA="rgba("+r.r+", "+r.g+", "+r.b+", "+this.selectedSpot.tooltip_style.background_opacity+")",this.movingTooltipArrow=this.redrawTooltip.find(".hs-arrow"),"spot"!=this.selectedSpot.type?(this.movingTooltipShapeCenterX=this.selectedSpot.x+this.selectedSpot.width/2,this.movingTooltipShapeCenterY=this.selectedSpot.y+this.selectedSpot.height/2,this.movingTooltipShapeCenterX=this.movingTooltipShapeCenterX/100*this.canvasWidth,this.movingTooltipShapeCenterY=this.movingTooltipShapeCenterY/100*this.canvasHeight):(this.movingTooltipShapeCenterX=this.selectedSpot.x/100*this.canvasWidth+this.selectedSpot.width/2,this.movingTooltipShapeCenterY=this.selectedSpot.y/100*this.canvasHeight+this.selectedSpot.height/2),this.movingTooltipCenterX=this.redrawTooltip.position().left+this.redrawTooltip.outerWidth()/2,this.movingTooltipCenterY=this.redrawTooltip.position().top+this.redrawTooltip.outerHeight()/2),this.movingTooltip&&this.redrawTooltip&&(this.redrawTooltip.css({transform:"translate("+(this.x-this.ix)+"px,"+(this.y-this.iy)+"px)"}),a=this.movingTooltipCenterX+(this.x-this.ix)-this.movingTooltipShapeCenterX,s=this.movingTooltipCenterY+(this.y-this.iy)-this.movingTooltipShapeCenterY,-135<(n=180*Math.atan2(s,a)/Math.PI)&&n<-45&&(this.movingTooltipPosition="top",this.movingTooltipArrow.attr("class","hs-arrow hs-arrow-bottom"),this.movingTooltipArrow.css("border-top-color",this.movingTooltipColorRGBA),this.movingTooltipArrow.css("border-bottom-color",""),this.movingTooltipArrow.css("border-left-color",""),this.movingTooltipArrow.css("border-right-color","")),(135<n&&n<180||-180<n&&n<-135)&&(this.movingTooltipPosition="left",this.movingTooltipArrow.attr("class","hs-arrow hs-arrow-right"),this.movingTooltipArrow.css("border-top-color",""),this.movingTooltipArrow.css("border-bottom-color",""),this.movingTooltipArrow.css("border-left-color",this.movingTooltipColorRGBA),this.movingTooltipArrow.css("border-right-color","")),-45<n&&n<45&&(this.movingTooltipPosition="right",this.movingTooltipArrow.attr("class","hs-arrow hs-arrow-left"),this.movingTooltipArrow.css("border-top-color",""),this.movingTooltipArrow.css("border-bottom-color",""),this.movingTooltipArrow.css("border-left-color",""),this.movingTooltipArrow.css("border-right-color",this.movingTooltipColorRGBA)),45<n&&n<135&&(this.movingTooltipPosition="bottom",this.movingTooltipArrow.attr("class","hs-arrow hs-arrow-top"),this.movingTooltipArrow.css("border-top-color",""),this.movingTooltipArrow.css("border-bottom-color",this.movingTooltipColorRGBA),this.movingTooltipArrow.css("border-left-color",""),this.movingTooltipArrow.css("border-right-color",""))),this.draggingCanvas&&(v=this.canvasInitialX+this.dxss,b=this.canvasInitialY+this.dyss,this.canvasX=this.canvasInitialX+this.dxss,this.canvasY=this.canvasInitialY+this.dyss,this.redrawCanvas()),this.startedSelecting&&(this.redrawTooltip=x("#imp-editor-shape-tooltip"),this.selectedSpot&&this.eventSpotId!=this.selectedSpot.id&&this.redrawTooltip.remove(),this.selectSpot(this.eventSpotId),this.redrawEl=x('.imp-editor-shape[data-id="'+this.eventSpotId+'"]'),this.redrawElBgImage=x('.imp-editor-shape-background-image[data-id="'+this.eventSpotId+'"]'),this.redrawSpotSelection(),this.startedMoving=!0,this.startedSelecting=!1),this.startedMoving){var d=M(this.selectedSpot.x+this.dx,this.selectedSpot.y+this.dy);"rect"!=this.selectedSpot.type&&"oval"!=this.selectedSpot.type&&"poly"!=this.selectedSpot.type||(100<d.x+this.selectedSpot.width&&(d.x=100-this.selectedSpot.width),100<d.y+this.selectedSpot.height&&(d.y=100-this.selectedSpot.height)),this.redrawEl.css({left:d.x+"%",top:d.y+"%"}),this.redrawElBgImage&&this.redrawElBgImage.css({left:d.x+"%",top:d.y+"%"});var c=(d.x-this.selectedSpot.x)/100*this.canvasWidth,h=(d.y-this.selectedSpot.y)/100*this.canvasHeight;this.redrawTooltip&&this.redrawTooltip.css({transform:"translate("+c+"px,"+h+"px)"})}else if(this.startedTransforming){if(this.didTransform=!0,this.shiftKeyDown&&(S=this.selectedSpot.width/this.selectedSpot.height,1!=this.transformDirection&&5!=this.transformDirection||(this.dy=this.dx/S),3!=this.transformDirection&&7!=this.transformDirection||(this.dy=-this.dx/S)),1==this.transformDirection&&(d={x:this.selectedSpot.x+this.dx,y:this.selectedSpot.y+this.dy},y={x:this.selectedSpot.width-this.dx,y:this.selectedSpot.height-this.dy}),2==this.transformDirection&&(d={x:this.selectedSpot.x,y:this.selectedSpot.y+this.dy},y={x:this.selectedSpot.width,y:this.selectedSpot.height-this.dy}),3==this.transformDirection&&(d={x:this.selectedSpot.x,y:this.selectedSpot.y+this.dy},y={x:this.selectedSpot.width+this.dx,y:this.selectedSpot.height-this.dy}),4==this.transformDirection&&(d={x:this.selectedSpot.x,y:this.selectedSpot.y},y={x:this.selectedSpot.width+this.dx,y:this.selectedSpot.height}),5==this.transformDirection&&(d={x:this.selectedSpot.x,y:this.selectedSpot.y},y={x:this.selectedSpot.width+this.dx,y:this.selectedSpot.height+this.dy}),6==this.transformDirection&&(d={x:this.selectedSpot.x,y:this.selectedSpot.y},y={x:this.selectedSpot.width,y:this.selectedSpot.height+this.dy}),7==this.transformDirection&&(d={x:this.selectedSpot.x+this.dx,y:this.selectedSpot.y},y={x:this.selectedSpot.width-this.dx,y:this.selectedSpot.height+this.dy}),8==this.transformDirection&&(d={x:this.selectedSpot.x+this.dx,y:this.selectedSpot.y},y={x:this.selectedSpot.width-this.dx,y:this.selectedSpot.height}),d.x<0&&(y.x=this.selectedSpot.x+this.selectedSpot.width,d.x=0),d.y<0&&(d.y=0,y.y=this.selectedSpot.y+this.selectedSpot.height),100<y.x+d.x&&(y.x=100-d.x),100<y.y+d.y&&(y.y=100-d.y),d.x>this.selectedSpot.x+this.selectedSpot.width&&(d.x=this.selectedSpot.x+this.selectedSpot.width),d.y>this.selectedSpot.y+this.selectedSpot.height&&(d.y=this.selectedSpot.y+this.selectedSpot.height),y.x<0&&(y.x=0),y.y<0&&(y.y=0),this.transformX=d.x,this.transformY=d.y,this.transformWidth=y.x,this.transformHeight=y.y,this.redrawEl.css({left:this.transformX+"%",top:this.transformY+"%",width:this.transformWidth+"%",height:this.transformHeight+"%"}),this.redrawElBgImage.css({left:this.transformX+"%",top:this.transformY+"%",width:this.transformWidth+"%",height:this.transformHeight+"%"}),"poly"==this.selectedSpot.type){var g=C.general.width*(y.x/100),m=C.general.height*(y.y/100);this.redrawSvgEl[0].setAttribute("viewBox","0 0 "+g+" "+m);for(var _="",u=0;u<this.selectedSpot.points.length;u++){var w=this.selectedSpot.points[u];_+=(v=this.selectedSpot.default_style.stroke_width+w.x/100*(g-2*this.selectedSpot.default_style.stroke_width))+","+(b=this.selectedSpot.default_style.stroke_width+w.y/100*(m-2*this.selectedSpot.default_style.stroke_width))+" "}this.redrawPolygonEl.attr("points",_)}}else{if(this.startedTransformingTooltip&&(this.didTransformTooltip=!0,y=this.ix-this.x,"top"==this.selectedSpot.tooltip_style.position||"bottom"==this.selectedSpot.tooltip_style.position?(4==this.transformDirection&&(this.transformingTooltipWidth=this.transformingTooltipStartingWidth-2*y),8==this.transformDirection&&(this.transformingTooltipWidth=this.transformingTooltipStartingWidth+2*y)):(4==this.transformDirection&&(this.transformingTooltipWidth=this.transformingTooltipStartingWidth-y),8==this.transformDirection&&(this.transformingTooltipWidth=this.transformingTooltipStartingWidth+y)),l=this.redrawTooltip,b=v=0,e=this.selectedSpot,o=this.transformingTooltipWidth/this.canvasWidth*100,i=l.outerHeight()/this.canvasHeight*100,r=20/this.canvasWidth*100,s=20/this.canvasHeight*100,a=e.width,n=e.height,d=e.x,l=e.y,"spot"==e.type&&(a=e.width/this.canvasWidth*100,n=e.height/this.canvasHeight*100,d=e.x-a/2,l=e.y-n/2,H(e.default_style.icon_is_pin)&&(l-=n/2)),"top"==e.tooltip_style.position&&(v=d+a/2-o/2,b=l-i-s),"bottom"==e.tooltip_style.position&&(v=d+a/2-o/2,b=l+n+s),"left"==e.tooltip_style.position&&(v=d-o-r,b=l+n/2-i/2),"right"==e.tooltip_style.position&&(v=d+a+r,b=l+n/2-i/2),v+=e.tooltip_style.offset_x,b+=e.tooltip_style.offset_y,this.redrawTooltip.css({width:this.transformingTooltipWidth,left:v+"%",top:b+"%"})),this.startedDrawingRect){p=I(t.pageX,t.pageY,this.canvas);this.createdDrawingRect||(this.createdDrawingRect=!0,this.eventSpot=this.createRect(),this.eventSpot.x=this.x/this.canvasWidth*100,this.eventSpot.y=this.y/this.canvasHeight*100,this.eventSpot.x=Math.round(1e3*this.eventSpot.x)/1e3,this.eventSpot.y=Math.round(1e3*this.eventSpot.y)/1e3,this.redraw(),this.redrawEl=x('.imp-editor-shape[data-id="'+this.eventSpot.id+'"]'));var y={x:this.dx,y:this.dy};return 100<this.eventSpot.x+y.x&&(y.x=100-this.eventSpot.x),100<this.eventSpot.y+y.y&&(y.y=100-this.eventSpot.y),this.drawRectWidth=y.x,this.drawRectHeight=y.y,this.shiftKeyDown&&(S=this.canvasWidth/this.canvasHeight,this.drawRectHeight=this.drawRectWidth*S),void this.redrawEl.css({width:this.drawRectWidth+"%",height:this.drawRectHeight+"%"})}if(this.startedDrawingOval){p=I(t.pageX,t.pageY,this.canvas);this.createdDrawingOval||(this.createdDrawingOval=!0,this.eventSpot=this.createOval(),this.eventSpot.x=this.x/this.canvasWidth*100,this.eventSpot.y=this.y/this.canvasHeight*100,this.eventSpot.x=Math.round(1e3*this.eventSpot.x)/1e3,this.eventSpot.y=Math.round(1e3*this.eventSpot.y)/1e3,this.eventSpot.x_image_background=this.eventSpot.x,this.eventSpot.y_image_background=this.eventSpot.y,this.redraw(),this.redrawEl=x('.imp-editor-shape[data-id="'+this.eventSpot.id+'"]'));var S,y={x:this.dx,y:this.dy};return 100<this.eventSpot.x+y.x&&(y.x=100-this.eventSpot.x),100<this.eventSpot.y+y.y&&(y.y=100-this.eventSpot.y),this.drawRectWidth=y.x,this.drawRectHeight=y.y,this.shiftKeyDown&&(S=this.canvasWidth/this.canvasHeight,this.drawRectHeight=this.drawRectWidth*S),void this.redrawEl.css({width:this.drawRectWidth+"%",height:this.drawRectHeight+"%"})}if(this.mouseDownWhileDrawingPoly)return this.polyPoints[this.polyPoints.length-1].x=this.x/this.zoom,this.polyPoints[this.polyPoints.length-1].y=this.y/this.zoom,void this.redrawTempPoly();if(this.translatingControlPoint){if(!this.startedTranslatingControlPoint){this.startedTranslatingControlPoint=!0,x(t.target).closest(".imp-editor-shape").find(".imp-selection").hide(),x(t.target).closest(".imp-editor-shape").css({left:0,top:0,width:"100%",height:"100%"}),x(t.target).closest(".imp-editor-shape").find(".imp-editor-poly-svg")[0].setAttribute("viewBox","0 0 "+C.general.width+" "+C.general.height);for(var f=0;f<this.selectedSpot.points.length;f++)x('.imp-editor-shape[data-id="'+this.selectedSpot.id+'"]').find('.imp-poly-control-point[data-index="'+f+'"]').css({left:k(this.selectedSpot.points[f],this.selectedSpot).x+"%",top:k(this.selectedSpot.points[f],this.selectedSpot).y+"%"})}k({x:this.translatedPointX,y:this.translatedPointY},this.selectedSpot).x+this.dx<0&&(this.dx=-k({x:this.translatedPointX,y:this.translatedPointY},this.selectedSpot).x),100<k({x:this.translatedPointX,y:this.translatedPointY},this.selectedSpot).x+this.dx&&(this.dx=100-k({x:this.translatedPointX,y:this.translatedPointY},this.selectedSpot).x),k({x:this.translatedPointX,y:this.translatedPointY},this.selectedSpot).y+this.dy<0&&(this.dy=-k({x:this.translatedPointX,y:this.translatedPointY},this.selectedSpot).y),100<k({x:this.translatedPointX,y:this.translatedPointY},this.selectedSpot).y+this.dy&&(this.dy=100-k({x:this.translatedPointX,y:this.translatedPointY},this.selectedSpot).y);c=this.dx/(this.selectedSpot.width/100*this.canvasWidth/this.canvasWidth),h=this.dy/(this.selectedSpot.height/100*this.canvasHeight/this.canvasHeight);this.selectedSpot.points[this.translatedPointIndex].x=this.translatedPointX+c,this.selectedSpot.points[this.translatedPointIndex].y=this.translatedPointY+h,this.translatedPoint.css({left:k(this.selectedSpot.points[this.translatedPointIndex],this.selectedSpot).x+"%",top:k(this.selectedSpot.points[this.translatedPointIndex],this.selectedSpot).y+"%"});for(_="",u=0;u<this.selectedSpot.points.length;u++){var v,b,w=k(this.selectedSpot.points[u],this.selectedSpot);_+=(v=this.selectedSpot.default_style.stroke_width+w.x/100*(C.general.width-2*this.selectedSpot.default_style.stroke_width))+","+(b=this.selectedSpot.default_style.stroke_width+w.y/100*(C.general.height-2*this.selectedSpot.default_style.stroke_width))+" "}this.redrawPolygonEl.attr("points",_)}else this.selectedSpot&&"poly"==this.selectedSpot.type&&this.redrawSelectedPolyTempPoint(t)}}},l.prototype.handleMouseUp=function(t){if(!H(C.editor.previewMode)){"imp-poly-tooltip-close-button"==x(t.target).attr("id")&&x("#imp-poly-tooltip").remove();var e,o,i,r,s,a,n,l,p,d,c=x(t.target).data("editor-object-type")||x(t.target).closest("[data-editor-object-type]").data("editor-object-type");if(this.startedDrawingSpot?((o=this.createSpot()).x=this.ix/this.canvasWidth*100,o.y=this.iy/this.canvasHeight*100,o.x=Math.round(1e3*o.x)/1e3,o.y=Math.round(1e3*o.y)/1e3,this.selectSpot(o.id),this.redraw(),this.addAction()):this.startedDrawingRect&&this.createdDrawingRect||this.startedDrawingOval&&this.createdDrawingOval?(a=M(this.dx,this.dy),this.eventSpot.width=Math.round(1e3*this.drawRectWidth)/1e3,this.eventSpot.height=Math.round(1e3*this.drawRectHeight)/1e3,this.eventSpot.x_image_background=this.eventSpot.x,this.eventSpot.y_image_background=this.eventSpot.y,this.eventSpot.width_image_background=this.eventSpot.width,this.eventSpot.height_image_background=this.eventSpot.height,this.selectSpot(this.eventSpot.id),this.redraw(),this.addAction()):this.finishedDrawingPoly?(x("#temp-poly").remove(),s=this.createPoly(this.polyPoints),this.selectSpot(s.id),s.x_image_background=s.x,s.y_image_background=s.y,s.width_image_background=s.width,s.height_image_background=s.height,this.addAction(),this.redraw()):this.startedDrawingText?((o=this.createText()).x=this.ix/this.canvasWidth*100,o.y=this.iy/this.canvasHeight*100,o.x=Math.round(1e3*o.x)/1e3,o.y=Math.round(1e3*o.y)/1e3,this.selectSpot(o.id),this.redraw(),this.addAction()):this.startedMoving?(a=M(this.selectedSpot.x+this.dx,this.selectedSpot.y+this.dy),"rect"!=this.selectedSpot.type&&"oval"!=this.selectedSpot.type&&"poly"!=this.selectedSpot.type||(100<a.x+this.selectedSpot.width&&(a.x=100-this.selectedSpot.width),100<a.y+this.selectedSpot.height&&(a.y=100-this.selectedSpot.height)),this.selectedSpot.x=Math.round(1e3*a.x)/1e3,this.selectedSpot.y=Math.round(1e3*a.y)/1e3,this.selectedSpot.x_image_background=this.selectedSpot.x,this.selectedSpot.y_image_background=this.selectedSpot.y,this.redraw(),this.addAction()):this.startedTransforming&&this.didTransform?(this.selectedSpot.x=Math.round(1e3*this.transformX)/1e3,this.selectedSpot.y=Math.round(1e3*this.transformY)/1e3,this.selectedSpot.width=Math.round(1e3*this.transformWidth)/1e3,this.selectedSpot.height=Math.round(1e3*this.transformHeight)/1e3,this.selectedSpot.x_image_background=this.selectedSpot.x,this.selectedSpot.y_image_background=this.selectedSpot.y,this.selectedSpot.width_image_background=this.selectedSpot.width,this.selectedSpot.height_image_background=this.selectedSpot.height,this.redraw(),this.addAction()):this.startedTransformingTooltip&&this.didTransformTooltip?(this.selectedSpot.tooltip_style.width=this.transformingTooltipWidth,this.selectedSpot.tooltip_style.auto_width=0,this.addAction(),this.redraw()):this.translatingControlPoint?(this.dx,this.selectedSpot.width,this.canvasWidth,this.canvasWidth,this.dy,this.selectedSpot.height,this.canvasHeight,this.canvasHeight,this.updateBoundingBoxForPolygonSpot(this.selectedSpot),this.redraw(),this.addAction()):this.startedSelecting?(this.selectedSpot&&this.selectedSpot.id!=this.eventSpotId&&this.deselectSpot(),this.selectSpot(this.eventSpotId),this.redraw(),this.addAction()):this.shouldDeselectShape?(this.deselectSpot(),this.redraw(),this.addAction()):this.movingTooltip&&(n=this.redrawTooltip,d=e=0,o=this.selectedSpot,l=n.outerWidth()/this.canvasWidth*100,p=n.outerHeight()/this.canvasHeight*100,i=20/this.canvasWidth*100,r=20/this.canvasHeight*100,t=o.width,s=o.height,a=o.x,n=o.y,"spot"==o.type&&(t=o.width/this.canvasWidth*100,s=o.height/this.canvasHeight*100,a=o.x-t/2,n=o.y-s/2,H(o.default_style.icon_is_pin)&&(n-=s/2)),"top"==this.movingTooltipPosition&&(e=a+t/2-l/2,d=n-p-r),"bottom"==this.movingTooltipPosition&&(e=a+t/2-l/2,d=n+s+r),"left"==this.movingTooltipPosition&&(e=a-l-i,d=n+s/2-p/2),"right"==this.movingTooltipPosition&&(e=a+t+i,d=n+s/2-p/2),l=e+l/2,d=d+p/2,p=(this.redrawTooltip.position().left+this.redrawTooltip.outerWidth()/2)/this.canvasWidth*100,d=(this.redrawTooltip.position().top+this.redrawTooltip.outerHeight()/2)/this.canvasHeight*100-d,this.selectedSpot.tooltip_style.offset_x=p-l,this.selectedSpot.tooltip_style.offset_y=d,this.selectedSpot.tooltip_style.position=this.movingTooltipPosition,this.addAction(),this.redraw()),10==c){if(x.wcpEditorIsFloatingWindowOpen())return x.wcpEditorCloseFloatingWindow(),void this.redraw();var h=(w=x('[data-editor-object-type="10"]').parent()).offset().left,g=w.offset().top,m=w.width(),_=x.wcpFormGenerateHTMLForForm("Tooltip Style"),u={x:Math.round(h+m+10),y:Math.round(g),padding:!0,title:"Tooltip Style",width:300,content:_};return x.wcpEditorCreateFloatingWindow(u),this.updateShapesForm(),void this.redraw()}if(11==c)return x.wcpEditorIsFloatingWindowOpen()&&x.wcpEditorCloseFloatingWindow(),C.editor.transform_tooltip_mode=1,this.tooltipTransformMode=!0,this.transformingTooltipStartingWidth=x("#imp-editor-shape-tooltip").outerWidth(),void this.redraw();if(12!=c)return 13==c?(C.editor.transform_tooltip_mode=0,this.tooltipTransformMode=!1,this.addAction(),void this.redraw()):14==c?(this.selectedSpot.tooltip_style.offset_x=0,this.selectedSpot.tooltip_style.offset_y=0,this.selectedSpot.tooltip_style.width=this.transformingTooltipStartingWidth,this.addAction(),void this.redraw()):(this.draggingCanvas=!1,this.startedSelecting=!1,this.startedMoving=!1,this.startedTransforming=!1,this.didTransform=!1,this.startedTransformingTooltip=!1,this.didTransformTooltip=!1,this.transformDirection=0,this.startedDrawingSpot=!1,this.startedDrawingText=!1,this.startedDrawingRect=!1,this.createdDrawingRect=!1,this.startedDrawingOval=!1,this.createdDrawingOval=!1,this.startedDrawingPoly=!1,this.finishedDrawingPoly=!1,this.mouseDownWhileDrawingPoly=!1,this.translatingControlPoint=!1,this.startedTranslatingControlPoint=!1,this.shouldDeselectShape=!1,this.startedSelectingTooltip=!1,void(this.movingTooltip=!1));if(x.wcpEditorIsFloatingWindowOpen())return x.wcpEditorCloseFloatingWindow(),void this.redraw();var w,h=(w=x('[data-editor-object-type="10"]').parent()).offset().left,g=w.offset().top,m=w.width();x.squaresInitWithSettings(x("#imp-editor-shape-tooltip-content-wrap"),this.selectedSpot.tooltip_content.squares_settings);_=x.squaresGetEditorWindowContents(),u={x:Math.round(h+m+10),y:Math.round(g),padding:!1,title:"Tooltip Content",content:_,width:394};x.wcpEditorCreateFloatingWindow(u)}},l.prototype.handleKeyDown=function(t){var e=g;return 0<x("input:focus").length||0<x("textarea:focus").length||(32==t.keyCode&&(this.spaceKeyDown=!0,this.enterCanvasDragMode(),e=!1),91==t.keyCode&&(e=this.commandKeyDown=!0),17==t.keyCode&&(e=this.ctrlKeyDown=!0),16==t.keyCode&&(e=this.shiftKeyDown=!0),187!=t.keyCode&&107!=t.keyCode||(this.ctrlKeyDown||this.commandKeyDown)&&(this.zoomIn(),e=!1),189!=t.keyCode&&109!=t.keyCode||(this.ctrlKeyDown||this.commandKeyDown)&&(this.zoomOut(),e=!1),48==t.keyCode&&(this.ctrlKeyDown||this.commandKeyDown)&&(this.zoomReset(),e=!1),e)},l.prototype.handleKeyUp=function(t){var e,o=!1;return 0<x("input:focus").length||0<x("textarea:focus").length?(x("#input-icon-search").is(":focus")&&x.wcpFontawesomeSearch(x("#input-icon-search").val()),!0):(32==t.keyCode&&(this.spaceKeyDown=!1,this.exitCanvasDragMode(),o=!1),91==t.keyCode&&(o=!(this.commandKeyDown=!1)),17==t.keyCode&&(o=!(this.ctrlKeyDown=!1)),16==t.keyCode&&(o=!(this.shiftKeyDown=!1)),27==t.keyCode&&(this.drawingPoly?(this.drawingPoly=!1,this.startedDrawingPoly=!1,this.mouseDownWhileDrawingPoly=!1,x("#temp-poly").remove()):this.tooltipTransformMode?(this.tooltipTransformMode=!1,C.editor.transform_tooltip_mode=0,this.redraw()):x.wcpEditorCloseModal()),13==t.keyCode&&(this.drawingPoly?(this.drawingPoly=!1,this.finishedDrawingPoly=!1,x("#temp-poly").remove(),e=this.createPoly(this.polyPoints),this.selectSpot(e.id),this.addAction(),this.redraw()):this.tooltipTransformMode&&(this.tooltipTransformMode=!1,C.editor.transform_tooltip_mode=0,this.redraw())),46==t.keyCode&&(o=!0,this.selectedSpot&&(_=m.getIndexOfSpotWithId(this.selectedSpot.id),x.wcpEditorPresentModal({name:"confirm-delete-shape",title:"Confirm Delete",buttons:[{name:"cancel",title:"Cancel",class:""},{name:"primary",title:"Delete",class:"danger"}],body:"Delete this shape?"}))),o)},l.prototype.getIndexOfSpotWithId=function(t){for(var e=0;e<C.spots.length;e++)if(C.spots[e].id==t)return e},l.prototype.selectSpot=function(t){C.editor.selected_shape=t},l.prototype.deselectSpot=function(){x.wcpEditorCloseFloatingWindow(),C.editor.selected_shape=-1,C.editor.transform_tooltip_mode=0,this.tooltipTransformMode=!1},l.prototype.createIdForSpot=function(){var t=0,e=!1;do{for(var t="spot-"+Math.floor(9999*Math.random()),e=!1,o=0;o<C.spots.length;o++)if(C.spots[o].id==t){e=!0;break}}while(e);return t},l.prototype.createIdForRect=function(){var t=0,e=!1;do{for(var t="rect-"+Math.floor(9999*Math.random()),e=!1,o=0;o<C.spots.length;o++)if(C.spots[o].id==t){e=!0;break}}while(e);return t},l.prototype.createIdForOval=function(){var t=0,e=!1;do{for(var t="oval-"+Math.floor(9999*Math.random()),e=!1,o=0;o<C.spots.length;o++)if(C.spots[o].id==t){e=!0;break}}while(e);return t},l.prototype.createIdForPoly=function(){var t=0,e=!1;do{for(var t="poly-"+Math.floor(9999*Math.random()),e=!1,o=0;o<C.spots.length;o++)if(C.spots[o].id==t){e=!0;break}}while(e);return t},l.prototype.createIdForText=function(){var t=0,e=!1;do{for(var t="text-"+Math.floor(9999*Math.random()),e=!1,o=0;o<C.spots.length;o++)if(C.spots[o].id==t){e=!0;break}}while(e);return t},l.prototype.createIdForPath=function(){var t=0,e=!1;do{for(var t="path-"+Math.floor(9999*Math.random()),e=!1,o=0;o<C.spots.length;o++)if(C.spots[o].id==t){e=!0;break}}while(e);return t},l.prototype.createIdForLayer=function(){for(var t=0,e=0;e<C.layers.layers_list.length;e++)C.layers.layers_list[e].id>t&&(t=C.layers.layers_list[e].id);return++t},l.prototype.createTitleForSpot=function(){var t="Spot "+C.editor.shapeCounter.spots;return C.editor.shapeCounter.spots++,t},l.prototype.createTitleForRect=function(){var t="Rect "+C.editor.shapeCounter.rects;return C.editor.shapeCounter.rects++,t},l.prototype.createTitleForOval=function(){var t="Oval "+C.editor.shapeCounter.ovals;return C.editor.shapeCounter.ovals++,t},l.prototype.createTitleForPoly=function(){var t="Poly "+C.editor.shapeCounter.polys;return C.editor.shapeCounter.polys++,t},l.prototype.createTitleForText=function(){var t="Text "+C.editor.shapeCounter.texts;return C.editor.shapeCounter.texts++,t},l.prototype.createTitleForPath=function(){var t="Path "+C.editor.shapeCounter.paths;return C.editor.shapeCounter.paths++,t},l.prototype.createSpot=function(){var t=x.extend(!0,{},h);return t.type="spot",t.id=this.createIdForSpot(),t.title=this.createTitleForSpot(),t.tooltip_content.squares_settings.containers[0].settings.elements[0].options.heading.text=t.title,H(C.layers.enable_layers)?t.layerID=C.editor.currentLayer:C.layers.layers_list[0]?t.layerID=C.layers.layers_list[0].id:t.layerID=0,C.spots.push(t),t},l.prototype.createRect=function(){var t=x.extend(!0,{},h);return t.type="rect",t.default_style.border_radius=10,t.mouseover_style.border_radius=10,t.id=this.createIdForRect(),t.title=this.createTitleForRect(),t.tooltip_content.squares_settings.containers[0].settings.elements[0].options.heading.text=t.title,H(C.layers.enable_layers)?t.layerID=C.editor.currentLayer:C.layers.layers_list[0]?t.layerID=C.layers.layers_list[0].id:t.layerID=0,C.spots.push(t),t},l.prototype.createOval=function(){var t=x.extend(!0,{},h);return t.type="oval",t.id=this.createIdForOval(),t.title=this.createTitleForOval(),t.tooltip_content.squares_settings.containers[0].settings.elements[0].options.heading.text=t.title,H(C.layers.enable_layers)?t.layerID=C.editor.currentLayer:C.layers.layers_list[0]?t.layerID=C.layers.layers_list[0].id:t.layerID=0,C.spots.push(t),t},l.prototype.createPoly=function(t,e=0,o=0){var i=x.extend(!0,{},h);i.type="poly",i.id=this.createIdForPoly(),i.title=this.createTitleForPoly(),i.tooltip_content.squares_settings.containers[0].settings.elements[0].options.heading.text=i.title;for(var r=99999,s=99999,a=0,n=0,l=0;l<t.length;l++){var p=t[l];p.x<r&&(r=p.x),p.x>a&&(a=p.x),p.y<s&&(s=p.y),p.y>n&&(n=p.y)}for(l=0;l<t.length;l++)t[l].x+=e,t[l].y+=o;var d=a-r,c=n-s;i.x=r/this.canvasWidth*100*this.zoom,i.y=s/this.canvasHeight*100*this.zoom,i.width=d/this.canvasWidth*100*this.zoom,i.height=c/this.canvasHeight*100*this.zoom;for(l=0;l<t.length;l++)i.points.push({x:(t[l].x-r)/d*100,y:(t[l].y-s)/c*100});return H(C.layers.enable_layers)?i.layerID=C.editor.currentLayer:C.layers.layers_list[0]?i.layerID=C.layers.layers_list[0].id:i.layerID=0,C.spots.push(i),i},l.prototype.createText=function(){var t=x.extend(!0,{},h);return t.type="text",t.id=this.createIdForText(),t.title=this.createTitleForText(),t.tooltip_content.squares_settings.containers[0].settings.elements[0].options.heading.text=t.title,H(C.layers.enable_layers)?t.layerID=C.editor.currentLayer:C.layers.layers_list[0]?t.layerID=C.layers.layers_list[0].id:t.layerID=0,C.spots.push(t),t},l.prototype.createPath=function(t,e,o){var i=x.extend(!0,{},h),r=x.pathParse(t).absNormalize();i.type="path",i.id=this.createIdForPath(),i.title=this.createTitleForPath(),i.tooltip_content.squares_settings.containers[0].settings.elements[0].options.heading.text=i.title;r=x.offsetPath(r,e,o),t=x.getMinMaxValues(r),e=t.maxX-t.minX,o=t.maxY-t.minY;return i.d=x.serializePath(r),i.x=t.minX/C.general.width*100,i.y=t.minY/C.general.height*100,i.width=e/C.general.width*100,i.height=o/C.general.height*100,H(C.layers.enable_layers)?i.layerID=C.editor.currentLayer:C.layers.layers_list[0]?i.layerID=C.layers.layers_list[0].id:i.layerID=0,C.spots.push(i),i},l.prototype.enterCanvasDragMode=function(){C.editor.state.dragging||(C.editor.state.dragging=!0,this.canvas.append('<div class="imp-editor-canvas-overlay" id="imp-editor-canvas-overlay-drag"></div>'))},l.prototype.exitCanvasDragMode=function(){C.editor.state.dragging&&(C.editor.state.dragging=!1,this.canvas.find("#imp-editor-canvas-overlay-drag").remove())},l.prototype.zoomIn=function(t){var e,o,i,r;this.zoom*=2,C.editor.zoom=this.zoom,32<this.zoom?this.zoom=32:(r=i=o=e=0,r=t?(i=this.ix,this.iy):this.selectedSpot?"spot"!=this.selectedSpot.type?(i=this.selectedSpot.x+this.selectedSpot.width/2,r=this.selectedSpot.y+this.selectedSpot.height/2,i=i/100*this.canvasWidth,r/100*this.canvasHeight):(i=this.selectedSpot.x/100*this.canvasWidth+this.selectedSpot.width/2,this.selectedSpot.y/100*this.canvasHeight+this.selectedSpot.height/2):(i=(t=I((t=x("#wcp-editor-center")).offset().left+t.width()/2,t.offset().top+t.height()/2,this.canvas)).x,t.y),e=this.canvasWidth/2-i,o=this.canvasHeight/2-r,this.canvasX+=e,this.canvasY+=o,this.redrawCanvas(),this.redraw())},l.prototype.zoomOut=function(t){var e,o,i,r;this.zoom/=2,C.editor.zoom=this.zoom,this.zoom<1?(this.zoom=1,C.editor.zoom=1):(r=i=o=e=0,r=t?(i=this.ix,this.iy):(i=(t=I((t=x("#wcp-editor-center")).offset().left+t.width()/2,t.offset().top+t.height()/2,this.canvas)).x,t.y),e=this.canvasWidth/2-i,o=this.canvasHeight/2-r,this.canvasX-=e/2,this.canvasY-=o/2,this.redrawCanvas(),this.redraw()),1==this.zoom&&(this.canvasX=0,this.canvasY=0,this.redrawCanvas())},l.prototype.zoomReset=function(){this.zoom=1,C.editor.zoom=this.zoom,this.canvasX=0,this.canvasY=0,this.redrawCanvas(),this.redraw()},l.prototype.shouldSelectPoly=function(t){for(var e,o=this,i=0;i<C.spots.length;i++)C.spots[i].id==t&&(e=C.spots[i]);for(var r=o.ix-e.x/100*o.canvasWidth,s=o.iy-e.y/100*o.canvasHeight,r=r/(e.width/100*o.canvasWidth)*100,s=s/(e.height/100*o.canvasHeight)*100,a=new Array,i=0;i<e.points.length;i++)a.push([e.points[i].x,e.points[i].y]);return!!function(t,e){for(var o=t.x,i=t.y,r=!1,s=0,a=e.length-1;s<e.length;a=s++){var n=e[s][0],l=e[s][1],p=e[a][0],d=e[a][1];i<l!=i<d&&o<(p-n)*(i-l)/(d-l)+n&&(r=!r)}return r}({x:r,y:s},a)},l.prototype.placePointForTempPoly=function(t,e){this.polyPoints.push({x:t/this.zoom,y:e/this.zoom})},l.prototype.redrawTempPoly=function(){for(var t=this,e='<polygon points="',o=0;o<t.polyPoints.length;o++)e+=t.polyPoints[o].x*t.zoom+","+t.polyPoints[o].y*t.zoom+" ";e+='" />';for(o=0;o<t.polyPoints.length;o++)e+='<circle cx="'+t.polyPoints[o].x*t.zoom+'" cy="'+t.polyPoints[o].y*t.zoom+'" r="4" data-index="'+o+'" />';0==x("#temp-poly").length&&x("#imp-editor-shapes-container").append('<svg id="temp-poly" width="'+t.canvasWidth+'px" height="'+t.canvasHeight+'px" viewBox="0 0 '+t.canvasWidth+" "+t.canvasHeight+'" version="1.1" xmlns="http://www.w3.org/2000/svg"></svg>'),x("#temp-poly").html(e);e="";1!=localStorage["image-map-pro-seen-poly-tooltip"]&&(localStorage["image-map-pro-seen-poly-tooltip"]=1,e+='<div id="imp-poly-tooltip" style="left: '+t.polyPoints[0].x*t.zoom+"px; top: "+t.polyPoints[0].y*t.zoom+'px;">Click the first point or press ENTER to finish <i class="fa fa-times" aria-hidden="true" id="imp-poly-tooltip-close-button"></i></div>',x("#imp-editor-shapes-container").append(e),x("#imp-poly-tooltip").css({left:x("#imp-poly-tooltip").position().left-x("#imp-poly-tooltip").outerWidth()-20,top:x("#imp-poly-tooltip").position().top-x("#imp-poly-tooltip").outerHeight()/2}))},l.prototype.redrawSelectedPolyTempPoint=function(t){var e=this,o=e.selectedSpot.width/100*e.canvasWidth,i=e.selectedSpot.height/100*e.canvasHeight,r=e.x-e.selectedSpot.x/100*e.canvasWidth,s=e.y-e.selectedSpot.y/100*e.canvasHeight;(t=e.shouldShowTempControlPoint(r/o*100,s/i*100,e.selectedSpot.points,t))?(e.tempControlPoint.show(),e.tempControlPointLine.show(),e.tempControlPoint.css({left:t.x+"%",top:t.y+"%"}),e.controlPointInsertionPointX=t.x,e.controlPointInsertionPointY=t.y):(e.tempControlPoint.hide(),e.tempControlPointLine.hide())},l.prototype.shouldShowTempControlPoint=function(t,e,o,i){if(7==(x(i.target).data("editor-object-type")||x(i.target).closest("[data-editor-object-type]").data("editor-object-type")))return!1;for(var r={x:t,y:e},s=9999,a=-1,n=!1,l=2e3/(this.canvasWidth*(this.selectedSpot.width/100)),p=0;p<o.length;p++){var d={x:o[p].x,y:o[p].y},c=g,c=o[p+1]?{x:o[p+1].x,y:o[p+1].y}:{x:o[0].x,y:o[0].y},d=new S(r.x,r.y).closestPointOnLine(new S(d.x,d.y),new S(c.x,c.y)),c=Math.sqrt(Math.pow(r.x-d.x,2)+Math.pow(r.y-d.y,2));c<s&&c<l&&(s=c,a=this.tempControlPointIndex=p,n={x:d.x,y:d.y})}return-1!=a&&n},l.prototype.updateBoundingBoxForPolygonSpot=function(t){for(var e=99999,o=99999,i=-99999,r=-99999,s=0;s<t.points.length;s++)(l=t.points[s]).x<e&&(e=l.x),l.x>i&&(i=l.x),l.y<o&&(o=l.y),l.y>r&&(r=l.y);for(var a=k({x:e,y:o},t),n=k({x:i,y:r},t),s=0;s<t.points.length;s++){var l,p=k(l=t.points[s],t),d=(d={x:a.x,y:a.y,width:n.x-a.x,height:n.y-a.y},{x:(p.x-d.x)/d.width*100,y:(p.y-d.y)/d.height*100});l.x=d.x,l.y=d.y}t.x=a.x,t.y=a.y,t.width=n.x-a.x,t.height=n.y-a.y},l.prototype.updateShapesList=function(){for(var t=[],e=C.spots.length-1;0<=e;e--){var o=C.spots[e],i={id:o.id,title:o.title,modelIndex:e};H(C.layers.enable_layers)&&parseInt(o.layerID,10)!=parseInt(C.editor.currentLayer,10)||t.push(i)}x.wcpEditorSetListItems(t),x.wcpEditorSelectListItem(C.editor.selected_shape)},l.prototype.launchTooltipContentBuilder=function(){0==x("#imp-editor-tooltip-content-builder-wrap").length?(e="",e+='<div id="imp-editor-tooltip-content-builder-wrap">',e+=' <div id="imp-editor-tooltip-content-builder-background"></div>',e+=' <div id="imp-editor-tooltip-content-builder-close"><i class="fa fa-times" aria-hidden="true"></i></div>',e+=' <div id="imp-editor-tooltip-content-builder-tooltip-wrap" class="squares">',e+=' <div id="imp-editor-tooltip-content-builder" class="squares"></div>',e+=" </div>",e+=' <div id="imp-editor-tooltip-content-builder-description">',e+=" <p>Press the Done button when you are done editing, or click the Close button in the upper-right corner.</p>",e+=" </div>",e+=' <div class="wcp-editor-control-button" id="imp-editor-done-editing-tooltip">Done</div>',e+="</div>",x("body").append('<div id="imp-editor-tooltip-content-builder-wrap"> <div id="imp-editor-tooltip-content-builder-background"></div> <div id="imp-editor-tooltip-content-builder-close"><i class="fa fa-times" aria-hidden="true"></i></div> <div id="imp-editor-tooltip-content-builder-tooltip-wrap" class="squares"> <div id="imp-editor-tooltip-content-builder" class="squares"></div> </div> <div id="imp-editor-tooltip-content-builder-description"> <p>Press the Done button when you are done editing, or click the Close button in the upper-right corner.</p> </div> <div class="wcp-editor-control-button" id="imp-editor-done-editing-tooltip">Done</div></div>')):x("#imp-editor-tooltip-content-builder-wrap").show(),setTimeout(function(){x("#imp-editor-tooltip-content-builder-wrap").addClass("imp-visible")},10);var t=this.selectedSpot.tooltip_style.width,e=F(this.selectedSpot.tooltip_style.background_color),e="rgba("+e.r+", "+e.g+", "+e.b+", "+this.selectedSpot.tooltip_style.background_opacity+")";x("#imp-editor-tooltip-content-builder-tooltip-wrap").css({width:t,background:e}),x.squaresInitWithSettings(x("#imp-editor-tooltip-content-builder"),this.selectedSpot.tooltip_content.squares_settings),x.squaresShowEditorWindow(20,20)},l.prototype.processNewLayerImage=function(t,e){var o=new Image;o.src=t,p(o,function(){},function(){e(!0,o.naturalWidth,o.naturalHeight)},function(){e(!1)})},l.prototype.getCompressedSettings=function(){for(var t=x.extend(!0,{},C),e=[],o=0;o<t.spots.length;o++)e[o]=x.wcpCompress(t.spots[o],h),e[o].x=Math.round(1e3*e[o].x)/1e3,e[o].y=Math.round(1e3*e[o].y)/1e3,e[o].width&&(e[o].width=Math.round(1e3*e[o].width)/1e3),e[o].height&&(e[o].height=Math.round(1e3*e[o].height)/1e3);return(t=x.wcpCompress(C,y)).spots=e,t},l.prototype.updateShapesForm=function(){var t=this.getIndexOfSpotWithId(C.editor.selected_shape),e=C.spots[t];if(e){if(x.wcpFormSetControlValue("Shape Settings","shape_title",e.title),x.wcpFormSetControlValue("Shape Settings","x",e.x),x.wcpFormSetControlValue("Shape Settings","y",e.y),x.wcpFormSetControlValue("Shape Settings","width",e.width),x.wcpFormSetControlValue("Shape Settings","height",e.height),x.wcpFormSetControlValue("Shape Settings","connected_to",e.connected_to),x.wcpFormSetControlValue("Shape Settings","use_connected_shape_tooltip",e.use_connected_shape_tooltip),x.wcpFormSetControlValue("Shape Settings","text",e.text),x.wcpFormSetControlValue("Shape Settings","static",e.static),x.wcpFormSetControlValue("Shape Settings","text",e.text.text),x.wcpFormSetControlValue("Shape Settings","font_family",e.text.font_family),x.wcpFormSetControlValue("Shape Settings","font_size",e.text.font_size),x.wcpFormSetControlValue("Shape Settings","font_weight",e.text.font_weight),x.wcpFormSetControlValue("Shape Settings","text_color",e.text.text_color),x.wcpFormSetControlValue("Shape Settings","text_opacity",e.text.text_opacity),x.wcpFormSetControlValue("Shape Settings","click",e.actions.click),x.wcpFormSetControlValue("Shape Settings","link",e.actions.link),x.wcpFormSetControlValue("Shape Settings","script",e.actions.script),x.wcpFormSetControlValue("Shape Settings","open_link_in_new_window",e.actions.open_link_in_new_window),x.wcpFormSetControlValue("Shape Settings","use_icon",e.default_style.use_icon),x.wcpFormSetControlValue("Shape Settings","icon_type",e.default_style.icon_type),x.wcpFormSetControlValue("Shape Settings","icon_svg_path",e.default_style.icon_svg_path),x.wcpFormSetControlValue("Shape Settings","icon_svg_viewbox",e.default_style.icon_svg_viewbox),x.wcpFormSetControlValue("Shape Settings","icon_url",e.default_style.icon_url),x.wcpFormSetControlValue("Shape Settings","icon_is_pin",e.default_style.icon_is_pin),x.wcpFormSetControlValue("Shape Settings","icon_shadow",e.default_style.icon_shadow),x.wcpFormSetControlValue("Shape Settings","opacity",e.default_style.opacity),x.wcpFormSetControlValue("Shape Settings","icon_fill",e.default_style.icon_fill),x.wcpFormSetControlValue("Shape Settings","border_radius",e.default_style.border_radius),x.wcpFormSetControlValue("Shape Settings","background_type",e.default_style.background_type),x.wcpFormSetControlValue("Shape Settings","background_image_url",e.default_style.background_image_url),x.wcpFormSetControlValue("Shape Settings","background_image_opacity",e.default_style.background_image_opacity),x.wcpFormSetControlValue("Shape Settings","background_image_scale",e.default_style.background_image_scale),x.wcpFormSetControlValue("Shape Settings","background_image_offset_x",e.default_style.background_image_offset_x),x.wcpFormSetControlValue("Shape Settings","background_image_offset_y",e.default_style.background_image_offset_y),x.wcpFormSetControlValue("Shape Settings","background_color",e.default_style.background_color),x.wcpFormSetControlValue("Shape Settings","background_opacity",e.default_style.background_opacity),x.wcpFormSetControlValue("Shape Settings","border_width",e.default_style.border_width),x.wcpFormSetControlValue("Shape Settings","border_style",e.default_style.border_style),x.wcpFormSetControlValue("Shape Settings","border_color",e.default_style.border_color),x.wcpFormSetControlValue("Shape Settings","border_opacity",e.default_style.border_opacity),x.wcpFormSetControlValue("Shape Settings","stroke_color",e.default_style.stroke_color),x.wcpFormSetControlValue("Shape Settings","stroke_opacity",e.default_style.stroke_opacity),x.wcpFormSetControlValue("Shape Settings","stroke_width",e.default_style.stroke_width),x.wcpFormSetControlValue("Shape Settings","stroke_dasharray",e.default_style.stroke_dasharray),x.wcpFormSetControlValue("Shape Settings","stroke_linecap",e.default_style.stroke_linecap),x.wcpFormSetControlValue("Shape Settings","mouseover_opacity",e.mouseover_style.opacity),x.wcpFormSetControlValue("Shape Settings","mouseover_icon_fill",e.mouseover_style.icon_fill),x.wcpFormSetControlValue("Shape Settings","mouseover_border_radius",e.mouseover_style.border_radius),x.wcpFormSetControlValue("Shape Settings","mouseover_background_image_url",e.mouseover_style.background_image_url),x.wcpFormSetControlValue("Shape Settings","mouseover_background_image_opacity",e.mouseover_style.background_image_opacity),x.wcpFormSetControlValue("Shape Settings","mouseover_background_image_scale",e.mouseover_style.background_image_scale),x.wcpFormSetControlValue("Shape Settings","mouseover_background_image_offset_x",e.mouseover_style.background_image_offset_x),x.wcpFormSetControlValue("Shape Settings","mouseover_background_image_offset_y",e.mouseover_style.background_image_offset_y),x.wcpFormSetControlValue("Shape Settings","mouseover_background_color",e.mouseover_style.background_color),x.wcpFormSetControlValue("Shape Settings","mouseover_background_opacity",e.mouseover_style.background_opacity),x.wcpFormSetControlValue("Shape Settings","mouseover_border_width",e.mouseover_style.border_width),x.wcpFormSetControlValue("Shape Settings","mouseover_border_style",e.mouseover_style.border_style),x.wcpFormSetControlValue("Shape Settings","mouseover_border_color",e.mouseover_style.border_color),x.wcpFormSetControlValue("Shape Settings","mouseover_border_opacity",e.mouseover_style.border_opacity),x.wcpFormSetControlValue("Shape Settings","mouseover_stroke_color",e.mouseover_style.stroke_color),x.wcpFormSetControlValue("Shape Settings","mouseover_stroke_opacity",e.mouseover_style.stroke_opacity),x.wcpFormSetControlValue("Shape Settings","mouseover_stroke_width",e.mouseover_style.stroke_width),x.wcpFormSetControlValue("Shape Settings","mouseover_stroke_dasharray",e.mouseover_style.stroke_dasharray),x.wcpFormSetControlValue("Shape Settings","mouseover_stroke_linecap",e.mouseover_style.stroke_linecap),x.wcpFormSetControlValue("Tooltip Style","tooltip_border_radius",e.tooltip_style.border_radius,!0),x.wcpFormSetControlValue("Tooltip Style","tooltip_padding",e.tooltip_style.padding,!0),x.wcpFormSetControlValue("Tooltip Style","tooltip_background_color",e.tooltip_style.background_color,!0),x.wcpFormSetControlValue("Tooltip Style","tooltip_background_opacity",e.tooltip_style.background_opacity,!0),x.wcpFormSetControlValue("Tooltip Style","tooltip_position",e.tooltip_style.position,!0),x.wcpFormSetControlValue("Tooltip Style","tooltip_width",e.tooltip_style.width,!0),x.wcpFormSetControlValue("Tooltip Style","tooltip_auto_width",e.tooltip_style.auto_width,!0),x.wcpFormSetControlValue("Shape Settings","enable_tooltip",e.tooltip.enable_tooltip),t!=this.shapesFormSpotIndex){this.shapesFormSpotIndex=t;t=x.wcpFormGenerateHTMLForForm("Shape Settings");x.wcpEditorSetObjectSettingsContent(t),x.wcpFormUpdateForm("Shape Settings");for(var o='<option value="">(Not Connected)</option>',i=0;i<C.spots.length;i++)C.spots[i].id!=C.editor.selected_shape&&""==C.spots[i].connected_to&&(o+='<option value="'+C.spots[i].id+'">'+C.spots[i].title+"</option>");x("#wcp-form-form-control-connected_to select").html(o),x("#wcp-form-form-control-connected_to select").val(e.connected_to)}}else this.shapesFormSpotIndex=-1,x.wcpEditorSetObjectSettingsContent('<div id="imp-editor-no-shape-selected-wrap"><span>No shape selected</span></div>')},l.prototype.updateShapesFormState=function(){var t=this.getIndexOfSpotWithId(C.editor.selected_shape),t=C.spots[t];t&&(H(t.tooltip.enable_tooltip)?(x.wcpFormShowControl("Shape Settings","reset_tooltip_position"),x.wcpFormShowControl("Shape Settings","reset_tooltip_size"),x.wcpFormShowControl("Shape Settings","edit_tooltip_style"),x.wcpFormShowControl("Shape Settings","edit_tooltip_position"),x.wcpFormShowControl("Shape Settings","edit_tooltip_content")):(x.wcpFormHideControl("Shape Settings","reset_tooltip_position"),x.wcpFormHideControl("Shape Settings","reset_tooltip_size"),x.wcpFormHideControl("Shape Settings","edit_tooltip_style"),x.wcpFormHideControl("Shape Settings","edit_tooltip_position"),x.wcpFormHideControl("Shape Settings","edit_tooltip_content")),"spot"==t.type&&(x.wcpFormHideControlsGroup("Shape Settings","text"),x.wcpFormHideControl("Shape Settings","stroke_color"),x.wcpFormHideControl("Shape Settings","stroke_opacity"),x.wcpFormHideControl("Shape Settings","stroke_width"),x.wcpFormHideControl("Shape Settings","stroke_dasharray"),x.wcpFormHideControl("Shape Settings","stroke_linecap"),x.wcpFormHideControl("Shape Settings","mouseover_stroke_color"),x.wcpFormHideControl("Shape Settings","mouseover_stroke_opacity"),x.wcpFormHideControl("Shape Settings","mouseover_stroke_width"),x.wcpFormHideControl("Shape Settings","mouseover_stroke_dasharray"),x.wcpFormHideControl("Shape Settings","mouseover_stroke_linecap")),"rect"==t.type&&(x.wcpFormHideControlsGroup("Shape Settings","text"),x.wcpFormHideControlsGroup("Shape Settings","icon"),x.wcpFormHideControl("Shape Settings","icon_fill"),x.wcpFormHideControl("Shape Settings","mouseover_icon_fill"),x.wcpFormHideControl("Shape Settings","stroke_color"),x.wcpFormHideControl("Shape Settings","stroke_opacity"),x.wcpFormHideControl("Shape Settings","stroke_width"),x.wcpFormHideControl("Shape Settings","stroke_dasharray"),x.wcpFormHideControl("Shape Settings","stroke_linecap"),x.wcpFormHideControl("Shape Settings","mouseover_stroke_color"),x.wcpFormHideControl("Shape Settings","mouseover_stroke_opacity"),x.wcpFormHideControl("Shape Settings","mouseover_stroke_width"),x.wcpFormHideControl("Shape Settings","mouseover_stroke_dasharray"),x.wcpFormHideControl("Shape Settings","mouseover_stroke_linecap")),"oval"==t.type&&(x.wcpFormHideControlsGroup("Shape Settings","text"),x.wcpFormHideControlsGroup("Shape Settings","icon"),x.wcpFormHideControl("Shape Settings","icon_fill"),x.wcpFormHideControl("Shape Settings","mouseover_icon_fill"),x.wcpFormHideControl("Shape Settings","border_radius"),x.wcpFormHideControl("Shape Settings","mouseover_border_radius"),x.wcpFormHideControl("Shape Settings","stroke_color"),x.wcpFormHideControl("Shape Settings","stroke_opacity"),x.wcpFormHideControl("Shape Settings","stroke_width"),x.wcpFormHideControl("Shape Settings","stroke_dasharray"),x.wcpFormHideControl("Shape Settings","stroke_linecap"),x.wcpFormHideControl("Shape Settings","mouseover_stroke_color"),x.wcpFormHideControl("Shape Settings","mouseover_stroke_opacity"),x.wcpFormHideControl("Shape Settings","mouseover_stroke_width"),x.wcpFormHideControl("Shape Settings","mouseover_stroke_dasharray"),x.wcpFormHideControl("Shape Settings","mouseover_stroke_linecap")),"poly"!=t.type&&"path"!=t.type||(x.wcpFormHideControlsGroup("Shape Settings","text"),x.wcpFormHideControlsGroup("Shape Settings","icon"),x.wcpFormHideControl("Shape Settings","icon_fill"),x.wcpFormHideControl("Shape Settings","mouseover_icon_fill"),x.wcpFormHideControl("Shape Settings","opacity"),x.wcpFormHideControl("Shape Settings","border_radius"),x.wcpFormHideControl("Shape Settings","border_width"),x.wcpFormHideControl("Shape Settings","border_style"),x.wcpFormHideControl("Shape Settings","border_color"),x.wcpFormHideControl("Shape Settings","border_opacity"),x.wcpFormHideControl("Shape Settings","mouseover_opacity"),x.wcpFormHideControl("Shape Settings","mouseover_border_radius"),x.wcpFormHideControl("Shape Settings","mouseover_border_width"),x.wcpFormHideControl("Shape Settings","mouseover_border_style"),x.wcpFormHideControl("Shape Settings","mouseover_border_color"),x.wcpFormHideControl("Shape Settings","mouseover_border_opacity")),"text"==t.type&&(x.wcpFormHideControl("Shape Settings","width"),x.wcpFormHideControl("Shape Settings","height"),x.wcpFormHideControl("Shape Settings","connected_to"),x.wcpFormHideControlsGroup("Shape Settings","actions"),x.wcpFormHideControlsGroup("Shape Settings","icon"),x.wcpFormHideControlsGroup("Shape Settings","default_style"),x.wcpFormHideControlsGroup("Shape Settings","mouseover_style"),x.wcpFormHideControlsGroup("Shape Settings","tooltip"),x.wcpFormShowControlsGroup("Shape Settings","text")),"color"==t.default_style.background_type?(x.wcpFormHideControl("Shape Settings","background_image_url"),x.wcpFormHideControl("Shape Settings","background_image_opacity"),x.wcpFormHideControl("Shape Settings","background_image_scale"),x.wcpFormHideControl("Shape Settings","background_image_offset_x"),x.wcpFormHideControl("Shape Settings","background_image_offset_y"),x.wcpFormHideControl("Shape Settings","mouseover_background_image_url"),x.wcpFormHideControl("Shape Settings","mouseover_background_image_opacity"),x.wcpFormHideControl("Shape Settings","mouseover_background_image_scale"),x.wcpFormHideControl("Shape Settings","mouseover_background_image_offset_x"),x.wcpFormHideControl("Shape Settings","mouseover_background_image_offset_y"),x.wcpFormShowControl("Shape Settings","background_color"),x.wcpFormShowControl("Shape Settings","background_opacity"),x.wcpFormShowControl("Shape Settings","mouseover_background_color"),x.wcpFormShowControl("Shape Settings","mouseover_background_opacity")):(x.wcpFormShowControl("Shape Settings","background_image_url"),x.wcpFormShowControl("Shape Settings","background_image_opacity"),x.wcpFormShowControl("Shape Settings","background_image_scale"),x.wcpFormShowControl("Shape Settings","background_image_offset_x"),x.wcpFormShowControl("Shape Settings","background_image_offset_y"),x.wcpFormShowControl("Shape Settings","mouseover_background_image_url"),x.wcpFormShowControl("Shape Settings","mouseover_background_image_opacity"),x.wcpFormShowControl("Shape Settings","mouseover_background_image_scale"),x.wcpFormShowControl("Shape Settings","mouseover_background_image_offset_x"),x.wcpFormShowControl("Shape Settings","mouseover_background_image_offset_y"),x.wcpFormHideControl("Shape Settings","background_color"),x.wcpFormHideControl("Shape Settings","background_opacity"),x.wcpFormHideControl("Shape Settings","mouseover_background_color"),x.wcpFormHideControl("Shape Settings","mouseover_background_opacity")),"spot"==t.type&&(H(t.default_style.use_icon)?(x.wcpFormShowControl("Shape Settings","choose_icon_from_library"),x.wcpFormShowControl("Shape Settings","icon_type"),x.wcpFormShowControl("Shape Settings","icon_url"),x.wcpFormShowControl("Shape Settings","icon_is_pin"),x.wcpFormShowControl("Shape Settings","icon_shadow"),x.wcpFormShowControl("Shape Settings","icon_fill"),x.wcpFormHideControl("Shape Settings","border_radius"),x.wcpFormHideControl("Shape Settings","background_type"),x.wcpFormHideControl("Shape Settings","background_color"),x.wcpFormHideControl("Shape Settings","background_opacity"),x.wcpFormHideControl("Shape Settings","border_width"),x.wcpFormHideControl("Shape Settings","border_style"),x.wcpFormHideControl("Shape Settings","border_color"),x.wcpFormHideControl("Shape Settings","border_opacity"),x.wcpFormShowControl("Shape Settings","mouseover_icon_fill"),x.wcpFormHideControl("Shape Settings","mouseover_border_radius"),x.wcpFormHideControl("Shape Settings","mouseover_background_color"),x.wcpFormHideControl("Shape Settings","mouseover_background_opacity"),x.wcpFormHideControl("Shape Settings","mouseover_border_width"),x.wcpFormHideControl("Shape Settings","mouseover_border_style"),x.wcpFormHideControl("Shape Settings","mouseover_border_color"),x.wcpFormHideControl("Shape Settings","mouseover_border_opacity")):(x.wcpFormHideControl("Shape Settings","choose_icon_from_library"),x.wcpFormHideControl("Shape Settings","icon_type"),x.wcpFormHideControl("Shape Settings","icon_url"),x.wcpFormHideControl("Shape Settings","icon_is_pin"),x.wcpFormHideControl("Shape Settings","icon_shadow"),x.wcpFormHideControl("Shape Settings","icon_fill"),x.wcpFormShowControl("Shape Settings","border_radius"),x.wcpFormShowControl("Shape Settings","background_type"),x.wcpFormShowControl("Shape Settings","background_color"),x.wcpFormShowControl("Shape Settings","background_opacity"),x.wcpFormShowControl("Shape Settings","border_width"),x.wcpFormShowControl("Shape Settings","border_style"),x.wcpFormShowControl("Shape Settings","border_color"),x.wcpFormShowControl("Shape Settings","border_opacity"),x.wcpFormHideControl("Shape Settings","mouseover_icon_fill"),x.wcpFormShowControl("Shape Settings","mouseover_border_radius"),x.wcpFormShowControl("Shape Settings","mouseover_background_color"),x.wcpFormShowControl("Shape Settings","mouseover_background_opacity"),x.wcpFormShowControl("Shape Settings","mouseover_border_width"),x.wcpFormShowControl("Shape Settings","mouseover_border_style"),x.wcpFormShowControl("Shape Settings","mouseover_border_color"),x.wcpFormShowControl("Shape Settings","mouseover_border_opacity")),"library"==t.default_style.icon_type&&x.wcpFormHideControl("Shape Settings","icon_url"),"custom"==t.default_style.icon_type&&x.wcpFormHideControl("Shape Settings","choose_icon_from_library")),"follow-link"==t.actions.click?(x.wcpFormShowControl("Shape Settings","link"),x.wcpFormShowControl("Shape Settings","open_link_in_new_window")):(x.wcpFormHideControl("Shape Settings","link"),x.wcpFormHideControl("Shape Settings","open_link_in_new_window")),"run-script"==t.actions.click?x.wcpFormShowControl("Shape Settings","script"):x.wcpFormHideControl("Shape Settings","script"),""!=t.connected_to?(x.wcpFormShowControl("Shape Settings","use_connected_shape_tooltip"),H(t.use_connected_shape_tooltip)?x.wcpFormHideControlsGroup("Shape Settings","tooltip"):x.wcpFormShowControlsGroup("Shape Settings","tooltip")):x.wcpFormHideControl("Shape Settings","use_connected_shape_tooltip"))},l.prototype.updateImageMapForm=function(){x.wcpFormSetControlValue("Image Map Settings","image_map_name",C.general.name),x.wcpFormSetControlValue("Image Map Settings","image_map_shortcode",C.general.shortcode),x.wcpFormSetControlValue("Image Map Settings","image_map_width",C.general.width),x.wcpFormSetControlValue("Image Map Settings","image_map_height",C.general.height),x.wcpFormSetControlValue("Image Map Settings","responsive",C.general.responsive),x.wcpFormSetControlValue("Image Map Settings","preserve_quality",C.general.preserve_quality),x.wcpFormSetControlValue("Image Map Settings","center_image_map",C.general.center_image_map),x.wcpFormSetControlValue("Image Map Settings","image_url",C.image.url),x.wcpFormSetControlValue("Image Map Settings","pageload_animation",C.shapes.pageload_animation),x.wcpFormSetControlValue("Image Map Settings","glowing_shapes",C.shapes.glowing_shapes),x.wcpFormSetControlValue("Image Map Settings","glowing_shapes_color",C.shapes.glowing_shapes_color),x.wcpFormSetControlValue("Image Map Settings","glow_opacity",C.shapes.glow_opacity),x.wcpFormSetControlValue("Image Map Settings","stop_glowing_on_mouseover",C.shapes.stop_glowing_on_mouseover),x.wcpFormSetControlValue("Image Map Settings","enable_tooltips",C.tooltips.enable_tooltips),x.wcpFormSetControlValue("Image Map Settings","show_tooltips",C.tooltips.show_tooltips),x.wcpFormSetControlValue("Image Map Settings","show_title_on_mouseover",C.tooltips.show_title_on_mouseover),x.wcpFormSetControlValue("Image Map Settings","sticky_tooltips",C.tooltips.sticky_tooltips),x.wcpFormSetControlValue("Image Map Settings","constrain_tooltips",C.tooltips.constrain_tooltips),x.wcpFormSetControlValue("Image Map Settings","tooltip_animation",C.tooltips.tooltip_animation),x.wcpFormSetControlValue("Image Map Settings","fullscreen_tooltips",C.tooltips.fullscreen_tooltips),x.wcpFormSetControlValue("Image Map Settings","enable_fullscreen_mode",C.fullscreen.enable_fullscreen_mode),x.wcpFormSetControlValue("Image Map Settings","start_in_fullscreen_mode",C.fullscreen.start_in_fullscreen_mode),x.wcpFormSetControlValue("Image Map Settings","fullscreen_background",C.fullscreen.fullscreen_background),x.wcpFormSetControlValue("Image Map Settings","fullscreen_button_position",C.fullscreen.fullscreen_button_position),x.wcpFormSetControlValue("Image Map Settings","fullscreen_button_type",C.fullscreen.fullscreen_button_type),x.wcpFormSetControlValue("Image Map Settings","fullscreen_button_color",C.fullscreen.fullscreen_button_color),x.wcpFormSetControlValue("Image Map Settings","fullscreen_button_text_color",C.fullscreen.fullscreen_button_text_color),x.wcpFormSetControlValue("Image Map Settings","enable_zooming",C.zooming.enable_zooming),x.wcpFormSetControlValue("Image Map Settings","max_zoom",C.zooming.max_zoom),x.wcpFormSetControlValue("Image Map Settings","limit_max_zoom_to_image_size",C.zooming.limit_max_zoom_to_image_size),x.wcpFormSetControlValue("Image Map Settings","enable_navigator",C.zooming.enable_navigator),x.wcpFormSetControlValue("Image Map Settings","enable_zoom_buttons",C.zooming.enable_zoom_buttons),x.wcpFormSetControlValue("Image Map Settings","zoom_button_text_color",C.zooming.zoom_button_text_color),x.wcpFormSetControlValue("Image Map Settings","zoom_button_background_color",C.zooming.zoom_button_background_color),x.wcpFormSetControlValue("Image Map Settings","hold_ctrl_to_zoom",C.zooming.hold_ctrl_to_zoom),x.wcpFormSetControlValue("Image Map Settings","custom_css",C.custom_code.custom_css),x.wcpFormSetControlValue("Image Map Settings","custom_js",C.custom_code.custom_js),x.wcpFormSetControlValue("Image Map Settings","enable_layers",C.layers.enable_layers),x.wcpFormSetControlValue("Image Map Settings","layers_list",C.layers.layers_list);var t='<div data-imp-detached-menu="'+C.id+'"></div>';x.wcpFormSetControlValue("Image Map Settings","enable_shapes_menu",C.shapes_menu.enable_shapes_menu),x.wcpFormSetControlValue("Image Map Settings","detached_menu",C.shapes_menu.detached_menu),x.wcpFormSetControlValue("Image Map Settings","detached_menu_info",t),x.wcpFormSetControlValue("Image Map Settings","menu_position",C.shapes_menu.menu_position),x.wcpFormSetControlValue("Image Map Settings","enable_search",C.shapes_menu.enable_search),x.wcpFormSetControlValue("Image Map Settings","group_by_floor",C.shapes_menu.group_by_floor),x.wcpFormSetControlValue("Image Map Settings","hide_children_of_connected_shapes",C.shapes_menu.hide_children_of_connected_shapes),x.wcpFormUpdateForm("Image Map Settings")},l.prototype.updateImageMapFormState=function(){H(C.general.responsive)?(x.wcpFormHideControl("Image Map Settings","image_map_width"),x.wcpFormHideControl("Image Map Settings","image_map_height"),x.wcpFormHideControl("Image Map Settings","reset_size"),x.wcpFormShowControl("Image Map Settings","preserve_quality")):(x.wcpFormShowControl("Image Map Settings","image_map_width"),x.wcpFormShowControl("Image Map Settings","image_map_height"),x.wcpFormShowControl("Image Map Settings","reset_size"),x.wcpFormHideControl("Image Map Settings","preserve_quality")),H(C.fullscreen.enable_fullscreen_mode)?(x.wcpFormShowControl("Image Map Settings","start_in_fullscreen_mode"),x.wcpFormShowControl("Image Map Settings","fullscreen_background"),x.wcpFormShowControl("Image Map Settings","fullscreen_button_position"),x.wcpFormShowControl("Image Map Settings","fullscreen_button_type"),x.wcpFormShowControl("Image Map Settings","fullscreen_button_color"),x.wcpFormShowControl("Image Map Settings","fullscreen_button_text_color")):(x.wcpFormHideControl("Image Map Settings","start_in_fullscreen_mode"),x.wcpFormHideControl("Image Map Settings","fullscreen_background"),x.wcpFormHideControl("Image Map Settings","fullscreen_button_position"),x.wcpFormHideControl("Image Map Settings","fullscreen_button_type"),x.wcpFormHideControl("Image Map Settings","fullscreen_button_color"),x.wcpFormHideControl("Image Map Settings","fullscreen_button_text_color")),H(C.tooltips.enable_tooltips)?(x.wcpFormShowControl("Image Map Settings","show_tooltips"),x.wcpFormShowControl("Image Map Settings","sticky_tooltips"),x.wcpFormShowControl("Image Map Settings","constrain_tooltips"),x.wcpFormShowControl("Image Map Settings","tooltip_animation"),x.wcpFormShowControl("Image Map Settings","fullscreen_tooltips")):(x.wcpFormHideControl("Image Map Settings","show_tooltips"),x.wcpFormHideControl("Image Map Settings","sticky_tooltips"),x.wcpFormHideControl("Image Map Settings","constrain_tooltips"),x.wcpFormHideControl("Image Map Settings","tooltip_animation"),x.wcpFormHideControl("Image Map Settings","fullscreen_tooltips")),"click"==C.tooltips.show_tooltips?x.wcpFormShowControl("Image Map Settings","show_title_on_mouseover"):x.wcpFormHideControl("Image Map Settings","show_title_on_mouseover"),H(C.zooming.enable_zooming)?(x.wcpFormShowControl("Image Map Settings","max_zoom"),x.wcpFormShowControl("Image Map Settings","limit_max_zoom_to_image_size"),x.wcpFormShowControl("Image Map Settings","enable_zoom_buttons"),x.wcpFormShowControl("Image Map Settings","enable_navigator"),x.wcpFormShowControl("Image Map Settings","hold_ctrl_to_zoom")):(x.wcpFormHideControl("Image Map Settings","max_zoom"),x.wcpFormHideControl("Image Map Settings","limit_max_zoom_to_image_size"),x.wcpFormHideControl("Image Map Settings","enable_zoom_buttons"),x.wcpFormHideControl("Image Map Settings","enable_navigator"),x.wcpFormHideControl("Image Map Settings","hold_ctrl_to_zoom")),H(C.zooming.enable_zoom_buttons)&&H(C.zooming.enable_zooming)?(x.wcpFormShowControl("Image Map Settings","zoom_button_text_color"),x.wcpFormShowControl("Image Map Settings","zoom_button_background_color")):(x.wcpFormHideControl("Image Map Settings","zoom_button_text_color"),x.wcpFormHideControl("Image Map Settings","zoom_button_background_color")),H(C.layers.enable_layers)?(x.wcpFormShowControl("Image Map Settings","layers_list"),x.wcpFormHideControlsGroup("Image Map Settings","image")):(x.wcpFormHideControl("Image Map Settings","layers_list"),x.wcpFormShowControlsGroup("Image Map Settings","image")),H(C.shapes_menu.enable_shapes_menu)?(x.wcpFormShowControl("Image Map Settings","detached_menu"),x.wcpFormShowControl("Image Map Settings","menu_position"),x.wcpFormShowControl("Image Map Settings","enable_search"),x.wcpFormShowControl("Image Map Settings","group_by_floor"),x.wcpFormShowControl("Image Map Settings","hide_children_of_connected_shapes"),H(C.shapes_menu.detached_menu)?(x.wcpFormShowControl("Image Map Settings","detached_menu_info"),x.wcpFormHideControl("Image Map Settings","menu_position")):(x.wcpFormHideControl("Image Map Settings","detached_menu_info"),x.wcpFormShowControl("Image Map Settings","menu_position"))):(x.wcpFormHideControl("Image Map Settings","detached_menu"),x.wcpFormHideControl("Image Map Settings","menu_position"),x.wcpFormHideControl("Image Map Settings","detached_menu_info"),x.wcpFormHideControl("Image Map Settings","enable_search"),x.wcpFormHideControl("Image Map Settings","group_by_floor"),x.wcpFormHideControl("Image Map Settings","hide_children_of_connected_shapes")),H(C.shapes.glowing_shapes)?(x.wcpFormShowControl("Image Map Settings","glowing_shapes_color"),x.wcpFormShowControl("Image Map Settings","glow_opacity")):(x.wcpFormHideControl("Image Map Settings","glowing_shapes_color"),x.wcpFormHideControl("Image Map Settings","glow_opacity"))},l.prototype.updateNewImageMapFormState=function(){"blank"==x.wcpFormGetModel("New Image Map").template?x.wcpFormHideControl("New Image Map","country"):x.wcpFormShowControl("New Image Map","country")},l.prototype.parseSVG=function(t,e){var o,i=x.parseXML(t);e&&(t=o=0,isNaN(parseInt(x(i).find("svg").attr("height"),10))||isNaN(parseInt(x(i).find("svg").attr("width"),10))?x(i).find("svg").attr("viewBox")&&(e=x(i).find("svg").attr("viewBox").split(" "),o=parseInt(e[2],10),t=parseInt(e[3],10)):(o=parseInt(x(i).find("svg").attr("width"),10),t=parseInt(x(i).find("svg").attr("height"),10)),0<o&&0<t&&(C.general.width=o,C.general.height=t,C.general.naturalWidth=o,C.general.naturalHeight=t,this.redraw())),this.parseNode(i.children[0],0,0)},l.prototype.parseNode=function(t,e,o){var i,r=x(t).prop("nodeName");if(r&&(x(t).attr("transform")&&(i=x(t).attr("transform").match(/\d+\.\d+/g),e+=parseInt(i[0],10),o+=parseInt(i[1],10)),"rect"!=r&&"polygon"!=r&&"ellipse"!=r&&"circle"!=r&&"path"!=r||this.parseSVGShape(x(t),e,o),0<t.children.length))for(var s=0;s<t.children.length;s++)this.parseNode(t.children[s],e,o)},l.prototype.parseSVGShape=function(t,e,o){var i,r=0;if(t.is("polygon")){for(var s,a,n=t.attr("points").split(" "),l=[],p=0;p<n.length-2;p++)p%2==0&&(s=parseFloat(n[p]),a=parseFloat(n[p+1]),l.push({x:s,y:a}));var d=m.createPoly(l),r=d.id;t.attr("id")&&(d.title=t.attr("id"),d.tooltip_content.squares_settings.containers[0].settings.elements[0].options.heading.text=t.attr("id"))}return t.is("rect")&&((d=m.createRect()).x=t.attr("x")/C.general.naturalWidth*100,d.y=t.attr("y")/C.general.naturalHeight*100,d.width=t.attr("width")/C.general.naturalWidth*100,d.height=t.attr("height")/C.general.naturalHeight*100,r=d.id,t.attr("id")&&(d.title=t.attr("id"),d.tooltip_content.squares_settings.containers[0].settings.elements[0].options.heading.text=t.attr("id"))),t.is("circle")&&((i=m.createOval()).x=(t.attr("cx")-t.attr("r"))/C.general.naturalWidth*100,i.y=(t.attr("cy")-t.attr("r"))/C.general.naturalHeight*100,i.width=2*t.attr("r")/C.general.naturalWidth*100,i.height=2*t.attr("r")/C.general.naturalHeight*100,r=i.id,t.attr("id")&&(i.title=t.attr("id"),i.tooltip_content.squares_settings.containers[0].settings.elements[0].options.heading.text=t.attr("id"))),t.is("ellipse")&&((i=m.createOval()).x=(t.attr("cx")-t.attr("rx"))/C.general.naturalWidth*100,i.y=(t.attr("cy")-t.attr("ry"))/C.general.naturalHeight*100,i.width=2*t.attr("rx")/C.general.naturalWidth*100,i.height=2*t.attr("ry")/C.general.naturalHeight*100,r=i.id,t.attr("id")&&(i.title=t.attr("id"),i.tooltip_content.squares_settings.containers[0].settings.elements[0].options.heading.text=t.attr("id"))),t.is("path")&&(r=(o=m.createPath(t.attr("d"),e,o)).id,t.attr("id")&&(o.title=t.attr("id"),o.tooltip_content.squares_settings.containers[0].settings.elements[0].options.heading.text=t.attr("id"))),r},S.prototype.add=function(t){return new S(this.x+t.x,this.y+t.y)},S.prototype.subtract=function(t){return new S(this.x-t.x,this.y-t.y)},S.prototype.scale=function(t){return new S(this.x*t,this.y*t)},S.prototype.normalized=function(){var t=Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2));return new S(this.x/t,this.y/t)},S.prototype.dot=function(t){return this.x*t.x+this.y*t.y},S.prototype.closestPointOnLine=function(t,e){function o(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)}var i=o(t,e);if(0==i)return o(this,v);i=((this.x-t.x)*(e.x-t.x)+(this.y-t.y)*(e.y-t.y))/i;return i<0?t:1<i?e:new S(t.x+i*(e.x-t.x),t.y+i*(e.y-t.y))},S.prototype.vector2Args=function(t,e){return[this.x+(t=t||0),this.y+(e=e||0)]}}(jQuery,window,document);