'use strict';function RTrim(c,b="/"){return c[c.length-1]===b?c.slice(0,-1):c}const params=new URL(self.location.href),pathname=params.pathname,min=-1!==pathname.indexOf(".min.js",5)?".min":"";let _arr=pathname.split("/");_arr.pop();_arr.pop();let fwFolder=_arr.pop(),themeFolder=_arr.pop(),wpThemesFolder=_arr.pop(),wpContentFolder=_arr.pop();""===_arr[0]&&_arr.shift();_arr=_arr.join("/");""!==_arr&&(_arr+="/");console.log(_arr);
const DOMAIN=params.origin+"/"+_arr,FV=params.searchParams.get("ver"),TV=params.searchParams.get("tv"),WP=params.searchParams.get("wp"),WC=params.searchParams.get("wc"),JQV=params.searchParams.get("jq"),SWV="5.3.6",WPMIN=params.searchParams.get("wpm")?"":".min",ISMULTISITE=!!params.searchParams.get("m"),THEME_URL=DOMAIN+wpContentFolder+"/"+wpThemesFolder+"/"+themeFolder+"/",FW_URL=THEME_URL+fwFolder+"/",BUILDER_URL=FW_URL+"themify-builder/",PLUGINS_URL=DOMAIN+wpContentFolder+"/"+params.searchParams.get("pl")+
"/",INCLUDES_URL=RTrim(params.searchParams.get("i").replace("6789",DOMAIN))+"/",WC_URL=WC?PLUGINS_URL+"woocommerce/":null,CACHE_PREFIX="tf-cache-",CACHE_KEY_FW=CACHE_PREFIX+"fw"+FV,CACHE_KEY_THEME=CACHE_PREFIX+"theme-"+themeFolder+TV,CACHE_KEY_WP=CACHE_PREFIX+"wp"+WP,CACHE_KEY_WC=WC?CACHE_PREFIX+"wc"+WC:null,CACHE_KEY_FONTS=CACHE_PREFIX+"fonts",CACHE_KEY_OTHERS=CACHE_PREFIX+"others",APP_CACHES={[CACHE_KEY_WP]:[INCLUDES_URL+"js/jquery/jquery"+WPMIN+".js?ver="+JQV],[CACHE_KEY_FW]:[FW_URL+"css/modules/animate.min.css?ver=3.6.2",
FW_URL+"css/grids/auto_tiles"+min+".css?ver="+FV,FW_URL+"css/swiper/swiper"+min+".css?ver="+FV,FW_URL+"css/swiper/effects/fade"+min+".css?ver="+FV,FW_URL+"js/main"+min+".js?ver="+FV,FW_URL+"js/modules/fixedheader"+min+".js?ver="+FV,FW_URL+"js/modules/tf_wow"+min+".js?ver="+FV,FW_URL+"js/modules/jquery.isotope.min.js?ver=3.0.6",FW_URL+"js/modules/isotop"+min+".js?ver="+FV,FW_URL+"js/modules/autoTiles"+min+".js?ver="+FV,FW_URL+"js/modules/infinite"+min+".js?ver="+FV,FW_URL+"js/modules/themify.dropdown"+
min+".js?ver="+FV,FW_URL+"js/modules/themify.sidemenu"+min+".js?ver="+FV,FW_URL+"js/themify.gallery"+min+".js?ver="+FV,FW_URL+"js/modules/themify.carousel"+min+".js?ver="+FV,FW_URL+"js/modules/lax"+min+".js?ver="+FV,FW_URL+"js/modules/video-player"+min+".js?ver="+FV,FW_URL+"js/modules/audio-player"+min+".js?ver="+FV,FW_URL+"js/modules/edge.Menu"+min+".js?ver="+FV,FW_URL+"js/modules/swiper/swiper.min.js?ver="+SWV,FW_URL+"js/modules/swiper/modules/autoplay.min.js?ver="+SWV,FW_URL+"js/modules/swiper/effects/flip.min.js?ver="+
SWV,FW_URL+"js/modules/swiper/effects/fade.min.js?ver="+SWV,FW_URL+"megamenu/js/themify.mega-menu"+min+".js?ver="+FV,BUILDER_URL+"js/themify.builder.script"+min+".js?ver="+FV,BUILDER_URL+"css/modules/sliders/carousel"+min+".css?ver="+FV,BUILDER_URL+"css/modules/sliders/gallery"+min+".css?ver="+FV,BUILDER_URL+"css/modules/sliders/slider"+min+".css?ver="+FV,BUILDER_URL+"css/modules/sliders/testimonial-slider"+min+".css?ver="+FV,BUILDER_URL+"js/modules/fullwidthRows"+min+".js?ver="+FV,BUILDER_URL+"js/modules/menu"+
min+".js?ver="+FV,BUILDER_URL+"js/modules/feature"+min+".js?ver="+FV,BUILDER_URL+"js/modules/accordion"+min+".js?ver="+FV,BUILDER_URL+"js/modules/tab"+min+".js?ver="+FV,BUILDER_URL+"js/modules/parallax"+min+".js?ver="+FV,BUILDER_URL+"js/modules/video"+min+".js?ver="+FV],[CACHE_KEY_THEME]:[THEME_URL+"js/themify.script"+min+".js?ver="+TV],[CACHE_KEY_FONTS]:[],[CACHE_KEY_OTHERS]:[]};
null!==CACHE_KEY_WC&&(APP_CACHES[CACHE_KEY_WC]=[WC_URL+"assets/js/frontend/woocommerce"+WPMIN+".js?ver="+WC,WC_URL+"assets/js/frontend/add-to-cart"+WPMIN+".js?ver="+WC,WC_URL+"assets/js/frontend/cart-fragments"+WPMIN+".js?ver="+WC,WC_URL+"assets/js/js-cookie/js.cookie"+WPMIN+".js?ver=2.1.4-wc."+WC,WC_URL+"assets/js/jquery-blockui/jquery.blockUI"+WPMIN+".js?ver=2.7.0-wc."+WC,WC_URL+"assets/js/frontend/add-to-cart-variation"+WPMIN+".js?ver="+WC,WC_URL+"assets/js/frontend/single-product"+WPMIN+".js?ver="+
WC,WC_URL+"assets/css/photoswipe/photoswipe.min.css?ver="+WC,WC_URL+"assets/css/photoswipe/default-skin/default-skin.min.css?ver="+WC,WC_URL+"assets/js/photoswipe/photoswipe"+WPMIN+".js?ver=4.1.1-wc."+WC,WC_URL+"assets/js/zoom/jquery.zoom"+WPMIN+".js?ver=1.7.21-wc."+WC,WC_URL+"assets/js/flexslider/jquery.flexslider"+WPMIN+".js?ver=2.7.2-wc."+WC],APP_CACHES[CACHE_KEY_FW].push(FW_URL+"js/modules/wc"+min+".js?ver="+FV),APP_CACHES[CACHE_KEY_FW].push(FW_URL+"js/modules/sticky-buy"+min+".js?ver="+FV));
const CACHE_KEYS=Object.keys(APP_CACHES);self.addEventListener("install",function(c){console.log(params,FW_URL,THEME_URL,WC_URL,INCLUDES_URL,DOMAIN);c.waitUntil(caches.keys().then(function(b){return Promise.all(CACHE_KEYS.map(function(a){return-1===b.indexOf(a)?caches.open(a).then(function(e){return e.addAll(APP_CACHES[a])}).catch(function(e){console.error("Pre-fetching failed for cache: "+a,e)}):Promise.resolve(!0)})).then(function(){return self.skipWaiting()})}))});
self.addEventListener("activate",function(c){console.log("active");c.waitUntil(caches.keys().then(function(b){return Promise.all(b.map(function(a){if(-1===CACHE_KEYS.indexOf(a)&&0===a.indexOf(CACHE_PREFIX)&&(!1===ISMULTISITE||CACHE_KEY_THEME!==a))return caches.delete(a)})).then(function(){return self.clients.claim()})}))});
self.addEventListener("fetch",function(c){if("GET"===c.request.method&&"fetch"!==c.request.destination){const e=c.request,d=e.url,l=-1!==d.indexOf("ajax.googleapis"),g=-1!==d.indexOf("fonts.googleapis")||-1!==d.indexOf("fonts.gstatic");if(("only-if-cached"!==e.cache||"same-origin"===e.mode)&&-1!==d.indexOf("/testdemo/")){var b=e.destination;if(!b){var a=(new URL(d)).pathname;if(a=a.substring(a.lastIndexOf(".")+1))if(a=a.toLowerCase(),"css"===a||!0===g)b="style";else if("js"===a)b="script";else if("jpeg"===
a||"jpg"===a||"png"===a||"webp"===a||"gif"===a||"bmp"===a||"apng"===a||"ico"===a)b="image";else if("woff2"===a||"woff"===a||"ttf"===a||"EOT"===a||"OTF"===a)b="font"}!0!==g&&!0!==l&&"image"!==b&&-1===d.indexOf(DOMAIN)||"script"!==b&&"style"!==b&&"font"!==b&&"image"!==b||c.respondWith(async function(){const h=await caches.match(e);return h?h:fetch(e,{importance:"low"}).then(function(f){if(f&&f.ok&&("basic"===f.type||!0===g)){let k;k=!0===g?CACHE_KEY_FONTS:-1!==d.indexOf(FW_URL)||-1!==d.indexOf("themify-css")?
CACHE_KEY_FW:-1!==d.indexOf(THEME_URL)||-1!==d.indexOf("themify-customizer")?CACHE_KEY_THEME:null!==WC_URL&&-1!==d.indexOf(WC_URL)?CACHE_KEY_WC:-1!==d.indexOf(INCLUDES_URL)?CACHE_KEY_WP:CACHE_KEY_OTHERS;const m=f.clone();c.waitUntil(async function(){try{await (await caches.open(k)).put(e,await m)}catch(n){}}())}return f}).catch(function(f){console.error("Fetching failed:",f);throw f;})}())}}});
