!function(){"use strict";function e(t,s,i,n){const l=Object.keys(t.slides);let a=0,r=!1;n??=l.length>20,0!==l.length?l.forEach((o,d)=>{setTimeout(()=>{_tpt.ajax({action:"save_slide_v7",data:{fromSR6:i,id:t.id,alias:t.settings.alias,title:t.settings.title,slides:JSON.stringify(t.slides[o])},callBack:d=>{if("string"==typeof d)try{d=JSON.parse(d)}catch(l){console.error(`Failed to save slide ${o}.`),r||n||!d.toLowerCase().includes("database")&&!d.toLowerCase().includes("mysql")||(console.log("lets restart in 10 seconds!"),r=!0,setTimeout(()=>e(t,s,i,!0),1e4))}d.success?(a++,a===l.length&&s()):console.error(`Failed to save slide ${o}.`,d)}})},(n?3e3:0)*d)}):s()}window.SR7??={},window._tpt??={},SR7.F??={},SR7.D??={},void 0===SR7.F.saveAll&&(SR7.F.saveAll=function(e){var t={settings:{},slides:{}};let s=[];var i,n,l,a,r;for(r in SR7.M[e].migrate=!1,t.settings=SR7.F.removeMatching(SR7.D.moduleObj(e),SR7.M[e].settings),t.settings.addOns)_tpt.hop(t.settings.addOns,r)&&t.settings.addOns[r].u&&-1==s.indexOf(r)&&s.push(r);for(l in SR7.M[e].slides)if(_tpt.hop(SR7.M[e].slides,l)){for(r in a=SR7.M[e].slides[l],t.slides[l]={slide:SR7.F.removeMatching(SR7.D.slideObj(e),a.slide),layers:{}},a.slide.addOns)_tpt.hop(a.slide.addOns,r)&&a.slide.addOns[r].u&&-1==s.indexOf(r)&&s.push(r);for(n in a.layers){if(!_tpt.hop(a.layers,n))continue;i=a.layers[n].type;let s=Object.keys(a.layers[n].addOns);t.slides[l].layers[n]=SR7.F.removeMatching(SR7.D.layerObject({id:e,obj:{},layertype:i,msource:SR7.M[e].settings.source,ISEMPTY:!0,useAddons:s}),a.layers[n]);let r=SR7.D.hasActionLike(e,l,n,"link");if(r&&"a"==r.ltype){let e=t.slides[l].layers[n];e.tag="a",e.target=Array.isArray(r.target)?r.target[0]:r.target??"_blank",e.href=r.link??"","nofollow"==r.flw&&(e.rel="nofollow"),"_blank"==r.target&&(e.rel=(e.rel??"")+(void 0!==e.rel&&e.rel.length>0?" ":"")+"noopener")}t.slides[l].layers[n].type=i}1==a.slide.order&&(t.settings.thumb=""!==(a.slide.thumb?.admin??"")?a.slide.thumb.admin:""!==(a.slide.thumb?.src??"")?a.slide.thumb.src:a.slide.thumb?.default?.image?.src??(a.slide.thumb?.default?.color?a.slide.thumb?.default:void 0),void 0!==t.settings.thumb&&"#"==t.settings.thumb[t.settings.thumb.length-1]&&delete t.settings.thumb),a.slide?.attr?.deepLink&&(t.settings.deepLinks??={},t.settings.deepLinks[a.slide.attr.deepLink]=l)}return t.settings.aU=s,delete t.settings.imgs,t},SR7.F.removeMatching=function(e,t){let s={};for(let i in t)if(!_tpt.hop(e,i)||e[i]instanceof HTMLElement)_tpt.hop(e,i)||(s[i]=t[i]);else if(Array.isArray(t[i])&&Array.isArray(e[i])){t[i].length===e[i].length&&t[i].every((t,s)=>t===e[i][s])||(s[i]=t[i])}else if("object"==typeof t[i]&&"object"==typeof e[i]){let n=SR7.F.removeMatching(e[i],t[i]);Object.keys(n).length>0&&(s[i]=n)}else t[i]!==e[i]&&(s[i]=t[i]);return s},SR7.F.collectImageSources=function(e){e.settings.imgs=[];const t=t=>e.settings.imgs.findIndex(e=>e.src===t);return e.settings.bg?.image?.src&&-1===t(e.settings.bg.image.src)&&e.settings.imgs.push(e.settings.bg.image),Object.values(e.slides).forEach(s=>{Object.values(s.layers).forEach(s=>{["bg","content"].forEach(i=>{const n=s[i]?.image||s[i];n&&n.src&&((s,i)=>{let n={lib_id:s.lib_id,lib:s.lib,src:s.src};i&&(n.a="fn"==i.aO?"#fn":"c"==i.aO&&i.a||"",n.t="fn"==i.tO?"#fn":"c"==i.tO&&i.t||"",""===n.a&&delete n.a,""===n.t&&delete n.t);const l=t(s.src);-1===l?e.settings.imgs.push(n):("a"in n&&!("a"in e.settings.imgs[l])&&(e.settings.imgs[l].a=n.a),"t"in n&&!("t"in e.settings.imgs[l])&&(e.settings.imgs[l].t=n.t))})(n,s.attr),e.settings.hasYT=e.settings.hasYT||"youtube"===s[i]?.video?.type})})}),e},SR7.F.saveSliderDatas=function(t,s,i){t=SR7.F.collectImageSources(t),_tpt.ajax({action:"save_slider_v7",data:{fromSR6:i,id:t.id,alias:t.settings.alias,title:t.settings.title,settings:JSON.stringify(t.settings)},callBack:n=>{(n="string"==typeof n?JSON.parse(n):n).success?e(t,s,i):console.error("Failed to save settings.",n)}})},_tpt.R??={},_tpt.R.save=_tpt.extend?_tpt.extend(_tpt.R.save,{status:2,version:"1.0"}):{status:2,version:"1.0"})}();