!function(){function s(e){return e.forEach(function(e,t){e.id=elementorCommon.helpers.getUniqueId(),0<e.elements.length&&s(e.elements)}),e}xdLocalStorage.init({iframeUrl:"https://kapasias.com/livecopy/",initCallback:function(){}});var i=["section","container","column","widget"],t=[];elementor.on("preview:loaded",function(){i.forEach(function(e,o){elementor.hooks.addFilter("elements/"+i[o]+"/contextMenuGroups",function(e,n){return t.push(n),e.push({name:"ec_"+i[o],actions:[{name:"ec_live_copy",title:"EC Copy",icon:"eicon-export-kit",callback:function(){var e={};e.ecElementType="widget"==i[o]?n.model.get("widgetType"):null,e.elementCode=n.model.toJSON(),xdLocalStorage.setItem("eccopycontents",JSON.stringify(e));var t=document.createElement("textarea");t.value=JSON.stringify(e),document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}},{name:"ec_live_paste",title:"EC Paste",icon:"eicon-import-kit",callback:function(){navigator.clipboard.readText().then(function(e){var t;!function(e){try{return JSON.parse(e),1}catch(e){return}}(e)||(t=JSON.parse(e),e&&"object"==typeof t&&t.elementCode&&(xdLocalStorage.setItem("eccopycontents",e),xdLocalStorage.getItem("eccopycontents",function(e){e&&e.value&&null!=e.value&&(function(e,t){var n=t,o=t.model.get("elType"),i=e.elementCode.elType,c=e.elementCode,a=JSON.stringify(c),t=/\.(jpg|png|jpeg|gif|svg)/gi.test(a),l={elType:i,settings:c.settings},r=null,d={index:0};i&&("section"==i||"container"==i?(l.elements=s(c.elements),r=elementor.getPreviewContainer()):"column"==i?(l.elements=s(c.elements),o&&("section"==o||"container"==o?r=n.getContainer():"column"==o?(r=n.getContainer().parent,d.index=n.getOption("_index")+1):"widget"==o&&(r=n.getContainer().parent.parent,d.index=n.getContainer().parent.view.getOption("_index")+1))):"widget"==i&&(l.widgetType=e.ecElementType,r=n.getContainer(),o&&("section"==o||"container"==o?r=n.children.findByIndex(0).getContainer():"column"==o?r=n.getContainer():"widget"==o&&(r=n.getContainer().parent,o.index=n.getOption("_index")+1,d.index=n.getOption("_index")+1))));var m=$e.run("document/elements/create",{model:l,container:r,options:d});t&&jQuery.ajax({url:ec_live_copy.ajax_url,method:"POST",data:{nonce:ec_live_copy.nonce,action:"ec_live_copy_nonce",copy_content:a}}).done(function(e){e.success&&(e=e.data[0],l.elType=e.elType,l.settings=e.settings,"widget"===l.elType?l.widgetType=e.widgetType:l.elements=e.elements,$e.run("document/elements/delete",{container:m}),$e.run("document/elements/create",{model:l,container:r,options:d}))})}(JSON.parse(e.value),n),xdLocalStorage.removeItem("ecetents"))})))})}}]}),e})})})}(jQuery);