"use strict";!function(){var t;window.location.href.includes(window.location.host+"/?u=")&&(t={},window.location.search.split("?")[1].split("&").forEach(function(e){t[e.split("=")[0]]=e.split("=")[1]}),t.u&&(window.location.href="https://gateway.salesdish.com/wix-service/app_tools/pass/url/"+t.u));var c={},v=[],w=void 0,S="",o=void 0,e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),e.setAttribute("href","https://wix.salesdish.com/page/css/qrCodePoster.css"),document.body.appendChild(e),"undefined"==typeof QRCode&&((n=document.createElement("script")).src="https://wix.salesdish.com/page/js/qrcode.min.js",document.head.appendChild(n)),"undefined"==typeof html2canvas&&((n=document.createElement("script")).src="https://wix.salesdish.com/page/js/html2canvas.min.js",document.head.appendChild(n));var n=document.querySelector("#qrcode-poster-2011");function x(e){fetch("https://gateway.salesdish.com/wix-service/app_tools/pass/site_info/"+o).then(function(e){return e.json()}).then(function(e){e.success&&(window.sdShopInfo=JSON.parse(e.data),S=e.upload_code)}).finally(function(){e&&e()})}!n||(n=n.getAttribute("src")).includes("?")&&(o=n.split("?")[1].split("=")[1],w=o,fetch("https://gateway.salesdish.com/shopify-service/app-config/pass/2011?params=QRcode Poster&store_id="+o+"&is_preview=1").then(function(e){return e.json()}).then(function(e){e.success&&((c=JSON.parse(e.data["QRcode Poster"])).isAppOpen=e.is_open["QRcode Poster"],c.welcomeMsg&&0!==c.welcomeMsg.length||(c.welcomeMsg="Come and share with more people!"),window.location.search.includes("?sd-test")&&(c.isAppOpen=!0),c&&c.isAppOpen&&function(){var e=document.createElement("div");e.className="qr_box",document.body.appendChild(e);var t=0;document.body.offsetWidth<767&&(t=1);e.style=("1"===c.position||"2"===c.position?"top:":"bottom:")+c.pVal1+"px;"+("1"===c.position||"4"===c.position?"left:":"right:")+c.pVal2+"px;";t="\n      <img class='qr_logo "+(c.options.includes("3")?"animate__tada_qr":"")+"' src='https://wix.salesdish.com/static/qr_logo.png' alt=\"\" ></img>\n      <div class='qr_tooltip_left' style='"+(window.localStorage.getItem("qr_tooltip_close")===c.welcomeMsg?"display:none;":"")+("1"===c.position||"4"===c.position?"left: 68px;":"right: 68px;")+" max-width: calc( 50vw + "+50*t+"vw - 78px - "+c.pVal2+"px )'>\n        "+c.welcomeMsg+"\n        <img src='https://wix.salesdish.com/static/close_ctaPopup.svg' alt=\"\"></img>\n        <div class='qr_arrow' style='"+("1"===c.position||"4"===c.position?"left: -12px; border-right: 7px solid #202123;":"right: -12px; border-left: 7px solid #202123;")+"'></div>\n      </div>\n      <div class='qr_menu' style='display: none;"+("1"===c.position||"2"===c.position?"top:":"bottom:")+(0<parseInt(c.pVal1)-15?22-18*(c.options.includes("1")+c.options.includes("2"))-3*t+"px;":parseInt(c.pVal1))+"px;"+("1"===c.position||"4"===c.position?"left:":"right:")+(68-6*t)+"px;'>\n        "+(c.options.includes("1")?"<div class='qr_menu_item qr_qt_code'>\n            <img src='https://wix.salesdish.com/static/qr_qrcode.svg' alt=''></img>\n            QR code\n          </div>":"")+"\n        "+(c.options.includes("2")?"<div class='qr_menu_item qr_short_link'>\n            <img src='https://wix.salesdish.com/static/qr_shortlink.svg' alt=''></img>\n            ShortLink\n          </div>":"")+"\n        <div class="+("1"===c.position||"4"===c.position?"qr_menu_arrow_left":"qr_menu_arrow_right")+"></div>\n      </div>\n      "+(c.options.includes("1")?"<div class='qr_shadow' style='display:none;'></div>\n        <div class='qr_modal_box' style='display:none;'>\n          <div class='qr_modal_box_main'>\n            <div class='qr_box_inner'>\n              <div class='qr_modal_card' style='display:none;'>\n                <div class='qr_modal_card_img'></div>\n                <div class='qr_modal_card_title'></div>\n                <div class='qr_modal_card_info'>\n                  <div class='qr_modal_card_info_left'>\n                    <div class='qr_modal_card_info_left_title'>This is a demo product….</div>\n                    <div class='qr_modal_card_info_left_des'>Style 1 / Shipping from…</div>\n                  </div>\n                  <div class='qr_modal_card_info_right'>\n                    <div class='qr_currency'>AU$</div>\n                    <div class='qr_amount'>10.24</div>\n                  </div>\n                </div>\n                <div class='qr_modal_card_qr'>\n                  <div class='qr_modal_card_qr_left'>\n                    "+(c.imgList&&c.imgList[0]||document.querySelector('link[rel="icon"]')&&"https://static.parastorage.com/client/pfavico.ico"!==document.querySelector('link[rel="icon"]').href?"<img class='qr_modal_card_store_icon' src='"+(c.imgList&&c.imgList[0]&&c.imgList[0].imgUrl||document.querySelector('link[rel="icon"]').href)+'\' alt="LOGO"></img><div class=\'qr_modal_card_store_name\' style="max-width:146px">':"<div class='qr_modal_card_store_name' style=\"max-width:186px; margin: 0px 12px 12px 0;\">")+"\n                    <span "+(document.querySelector('[property~="og:site_name"]')&&0<document.querySelector('[property~="og:site_name"]').content.split(" ").filter(function(e){return 20<e.length}).length?'style="font-size: 12px;"':"")+">"+(document.querySelector('[property~="og:site_name"]')&&document.querySelector('[property~="og:site_name"]').content||"")+"</span></div>\n                  </div>\n                  <div class='qr_modal_card_qr_code' alt=''></div>\n                </div>\n              </div>\n              <div class='qr_modal_card_clone'></div>\n              <img class='qr_modal_card_qrimg' style='display:none;' src=''></img>\n              <div class='qr_modal_link'>\n                <div class='qr_modal_link_text'>- Share image to -</div>\n                <div class='qr_modal_link_opt'>\n                  <div class='qr_save_image'><img src='https://wix.salesdish.com/static/qr_save_image.svg' alt=\"\"></img><span>Save Image</span></div>\n                  <div class='qr_facebook'><img src='https://wix.salesdish.com/static/qr_facebook.svg' alt=\"\"></img><span>Facebook</span></div>\n                  <div class='qr_pintreast'><img src='https://wix.salesdish.com/static/qr_pintreast.svg' alt=\"\"></img><span>Pintreast</span></div>\n                  <div class='qr_twitter'><img src='https://wix.salesdish.com/static/qr_twitter.svg' alt=\"\"></img><span>Twitter</span></div>\n                </div>\n                <div class='qr_modal_link_info' style=\"display: none;\">Image not saved? <span id=\"qr_open_in_new\" href=\"\" target=\"_blank\">Click here.</span></div>\n              </div>\n            </div>\n          </div>\n          <img class='qr_modal_close' src='https://wix.salesdish.com/static/close_ctaPopup.svg' alt=\"\"></img>\n        </div>":"");e.innerHTML=t;var o=void 0,n=void 0;(o=document.createElement("div")).className="qr_tooltip_bottom qr_tooltip_2",o.style.bottom="-76px",o.innerHTML="Sorry, the checkout page does not support sharing\n    <img src='https://wix.salesdish.com/static/close_ctaPopup.svg' alt=\"\"></img>",document.body.appendChild(o),o.onclick=function(e){o.style.bottom="-76px"},document.querySelector(".qr_tooltip_left>img").onclick=function(){document.querySelector(".qr_tooltip_left").style.display="none",window.localStorage.setItem("qr_tooltip_close",c.welcomeMsg)};var a=!1;{var s,d,m,u,p,_,y,q,h,g,f;document.querySelector(".qr_logo").onclick=function(e){e.stopPropagation(),location.pathname.indexOf("checkout")<5&&0<location.pathname.indexOf("checkout")?(a=!0,clearTimeout(n),o.style.bottom="50px",n=setTimeout(function(){o.style.bottom="-76px"},3e3)):a=!1,document.querySelector(".qr_box").className="qr_box",document.querySelector(".qr_tooltip_left").style.display="none",a||("none"===document.querySelector(".qr_menu").style.display?document.querySelector(".qr_menu").style.display="":document.querySelector(".qr_menu").style.display="none")},document.body.addEventListener("click",function(){document.querySelector(".qr_menu").style.display="none"}),c.options.includes("1")&&(s=function r(i){var c=document.querySelector(".qr_loading_bg");if(d!==window.location.href){_=null,d=window.location.href;var n=window.location.href;if(q=!0,g=(new Date).getTime(),!(window.location.pathname.split("/")[1].includes("product")||document.querySelector('[data-hook="product-image-item"] img')||document.querySelector('[data-hook="responsive-gallery-media"]'))&&v.length<12)return void function e(t){var o;"undefined"!=typeof html2canvas?(o=(document.documentElement.scrollTop||document.body.scrollTop||0)-(t.offsetTop||0),o={allowTaint:!0,useCORS:!0,backgroundColor:"transparent",logging:!1,scale:1,width:document.body.offsetWidth,height:document.body.offsetWidth,y:0<o?o:0},html2canvas(t,o).then(function(t){document.querySelectorAll("#qr_screen_shot").forEach(function(e){e.src=t.toDataURL("image/png"),setTimeout(function(){l(document.querySelector(".qr_modal_card"),m,n)},0)})})):setTimeout(function(){e(document.querySelector("#SITE_CONTAINER"))},100)}(document.querySelector("#SITE_CONTAINER"));l(document.querySelector(".qr_modal_card"),m,n)}else!m.src.match(/http/i)||m.src.includes(location.host)||m.src.includes("data:image")?q||(m.src.includes("data:image")?q=!0:(d="",r(i))):t();function l(e,t,r){q&&r===window.location.href&&(document.querySelector(".qr_modal_card_clone").style.display="",t.style.display="none",t.src="",e.style.position="",html2canvas(e,{allowTaint:!0,useCORS:!0,backgroundColor:"transparent",logging:!1}).then(function(e){var t,o,n;f=e.toDataURL("image/png"),t=e.toDataURL("image/png"),o=r,q&&o===window.location.href&&(n=new FormData,(e=function(e){var t=e.split(","),e=t[0].match(/:(.*?);/)[1],o=atob(t[1]),n=o.length,r=new Uint8Array(n);for(;n--;)r[n]=o.charCodeAt(n);return new File([r],(new Date).getTime()+".png",{type:e})}(t)).imageUrl=t,n.append("file",e),(_=n).timeUrl=o)}))}function a(e){if(q&&0===h.indexOf(e.timeUrl)){if(0<u.length&&(u=u.match(/[a-zA-Z0-9_]+/gi).join("_").toLowerCase()),1===i)return m.src=f,document.querySelector(".qr_modal_card_clone").style.display="none",m.style.display="",console.log("GENERATE_TIME: ",(new Date).getTime()-g),t(),void clearInterval(y);var n=(new Date).getTime();!function t(o){fetch("https://gateway.salesdish.com/shopify-service/app-tools/pass/upload_file/"+S+"?type=png&store_id="+w+(0<u.length?"&file_name="+u:""),{method:"POST",body:e}).then(function(e){return e.json()}).then(function(e){q&&0===h.indexOf(window.location.href)&&(console.log("UPLOAD_TIME: ",(new Date).getTime()-n),e.success?e.url?(m.src=e.url,document.querySelector(".qr_modal_card_clone").style.display="none",m.style.display="",_=null,r(i),clearInterval(y),q=!1,console.log("GENERATE_TIME: ",(new Date).getTime()-g),u=""):x(a(_)):1<o?(alert("Failed to generate image, please try again or refresh the page."),_=null,q=!1,c.style.display="flex",d=""):t(o+1))})}(1)}}function t(){if(""===m.src||m.src===location.href)return d="",r(i),alert("Please wait for the picture to be generated.");var e,t,o=m.src;1===i?(e=document.createElement("a"),t=(t=document.querySelector('[data-hook="product-title"]')?document.querySelector('[data-hook="product-title"]').innerText:document.querySelector('[property="og:title"]').content).match(/[a-zA-Z0-9_]+/gi).join("_").toLowerCase(),e.download=t+(new Date).getTime()+".png",e.href=f,e.target="_blank",e.click(),p&&(p.style.display="")):2===i?window.open("https://www.facebook.com/sharer.php?u="+o,"_blank"):3===i?window.open("https://www.pinterest.com/pin-builder/?url="+window.location.href+"&media="+o+"&method=button","_blank"):4===i?window.open("https://twitter.com/intent/tweet?url="+o,"_blank"):5===i&&window.open(o,"_blank")}i&&(h.unshift(window.location.href),c.style.display="flex",_?a(_):(y&&clearInterval(y),y=setInterval(function(){_&&(clearInterval(y),a(_))},500)))},document.querySelector(".qr_shadow").addEventListener("touchmove",function(e){e.preventDefault()}),d="",m=document.querySelector(".qr_modal_card_qrimg"),u="",document.querySelector(".qr_menu_item.qr_qt_code").onclick=function(e){var t,o,n,r,i,c,l;a||(document.body.offsetWidth<767?document.querySelector(".qr_modal_close").style="\n            position: absolute;\n            width: 20px;\n            bottom: -32px;\n            left: 50%;\n            transform: translate(-50%, 0);\n            cursor: pointer;":document.querySelector(".qr_modal_close").style="\n            position: absolute;\n            width: 16px;\n            top: 2px;\n            right: -26px;\n            cursor: pointer;",document.querySelector(".qr_modal_card_qr_code").innerHTML="",new QRCode(document.querySelector(".qr_modal_card_qr_code"),{text:window.location.href,width:344,height:344,colorDark:"#000000",colorLight:"#ffffff",correctLevel:QRCode.CorrectLevel.H}),document.querySelector('[data-hook="product-image-item"] img')||document.querySelector('[data-hook="responsive-gallery-media"]')?(document.querySelector(".qr_modal_card_img").style.height="",o=document.querySelector('[data-hook="product-image-item"] img'),i="",(n=document.querySelector('[data-hook="responsive-gallery-media"]'))&&n.style.backgroundImage&&n.style.backgroundImage.match(/http.+\"|\'/gi)[0].slice(0,-1)&&(i=n.style.backgroundImage.match(/http.+\"|\'/gi)[0].slice(0,-1)),""!==(i=o&&o.src?o.src:i)?(document.querySelector(".qr_modal_card_img").style.display="flex",document.querySelector(".qr_modal_card_img").innerHTML="<img src='"+i+"'></img>"):document.querySelector(".qr_modal_card_img").style.display="none",document.querySelector(".qr_modal_card_title").style.display="none",document.querySelector(".qr_modal_card_info").style.display="flex",n=document.querySelector('[data-hook="product-title"]').innerText,document.querySelector(".qr_modal_card_info_left_title").innerText=n,u=n+" "+(new Date).getTime(),t="",document.querySelectorAll('[data-hook="product-options-inputs"] [data-hook="options-dropdown-title"]').forEach(function(e){e.parentNode.querySelector('[data-hook="dropdown-base-text"]')&&"Select"!==e.parentNode.querySelector('[data-hook="dropdown-base-text"]').innerText?t+=e.querySelector('[data-hook="options-dropdown-title"] label').innerText+": "+e.parentNode.querySelector('[data-hook="dropdown-base-text"]').innerText+"; ":e.parentNode.querySelector('[data-hook="native-select"]')&&"Select"!==e.parentNode.querySelector('[data-hook="native-select"]').selectedOptions[0].innerText&&(t+=e.parentNode.querySelector('[data-hook="options-dropdown-title"] label').innerText+": "+e.parentNode.querySelector('[data-hook="native-select"]').selectedOptions[0].innerText+"; ")}),0===t.length?document.querySelector(".qr_modal_card_qr").style.alignItems="center":document.querySelector(".qr_modal_card_qr").style.alignItems="flex-end",document.querySelector(".qr_modal_card_info_left_des").innerText=t,o=document.querySelector(".qr_currency"),i=document.querySelector(".qr_amount"),n=document.querySelector('[data-hook="formatted-primary-price"]')?document.querySelector('[data-hook="formatted-primary-price"]').innerText:document.querySelector('[data-hook="price-range-from"]').innerText.match(/\d.*\d/g)[0],localStorage.getItem("ad_currency_changedata")?o.innerText=JSON.parse(localStorage.getItem("ad_currency_changedata")).newCu:o.innerText=window.sdShopInfo&&window.sdShopInfo.properties.paymentCurrency?window.sdShopInfo.properties.paymentCurrency:"",i.innerText=(n.match(/\d.*\d/g)?n.match(/\d.*\d/g):n.match(/\d+/g))[0],i.innerText.length<=6?i.style.fontSize="30px":7===i.innerText.length?i.style.fontSize="24px":7<i.innerText.length&&i.innerText.length<=9?i.style.fontSize="20px":9<i.innerText.length&&(i.style.fontSize="16px")):(12<=v.length?(r="<div class='qr_image_falls'><div class='qr_image_falls_column'>",v.forEach(function(e,t){r+=t%3!=2||11===t?"<div><img src='"+e+"'/></div>":"<div><img src='"+e+"'/></div></div><div class='qr_image_falls_column'>"}),r+="</div></div>",document.querySelector(".qr_modal_card_img").innerHTML=r,document.querySelector(".qr_modal_card_img").style.display="flex",document.querySelector(".qr_modal_card_img").style.height="338px"):(document.querySelector(".qr_modal_card_img").innerHTML='<img src="Generating" id="qr_screen_shot" alt="Page screenshots are being generated." style="min-height: 200px;"/>',document.querySelector(".qr_modal_card_img").style.display="flex",document.querySelector(".qr_modal_card_img").style.height=""),document.querySelector(".qr_modal_card_info").style.display="none",document.querySelector(".qr_modal_card_title").style.display="block",l=document.querySelector('[property="og:title"]').content,document.querySelector(".qr_modal_card_title").innerText=l,u=l+" "+(new Date).getTime(),document.querySelector(".qr_modal_card_qr").style.alignItems="center"),(i=document.querySelector(".qr_modal_card_clone")).innerHTML=document.querySelector(".qr_modal_card").innerHTML,document.querySelector(".qr_modal_card_qr_code img").src||(c=setInterval(function(){document.querySelector(".qr_modal_card_qr_code img").src&&(document.querySelector(".qr_modal_card_clone .qr_modal_card_qr_code").innerHTML=document.querySelector(".qr_modal_card_qr_code").innerHTML,clearInterval(c))},500)),(l=document.createElement("div")).className="qr_loading_bg",l.innerHTML="<img class='qr_loading' src='https://wix.salesdish.com/static/qr_loading.svg'></img>\n        <div class='qr_loading_text'>Generating poster, please wait...<div/>",i.appendChild(l),document.querySelector(".qr_modal_box").style.display="",document.querySelector(".qr_shadow").style.display="",document.querySelector(".qr_modal_card").style.display="block",d!==window.location.href?(m.style.display="none",m.src="",i.style.display=""):m.src.match(/http/i)&&!m.src.includes(location.host)&&(i.style.display="none"),s())},document.querySelector(".qr_save_image").onclick=function(){s(1)},document.querySelector(".qr_facebook").onclick=function(){s(2)},document.querySelector(".qr_pintreast").onclick=function(){s(3)},document.querySelector(".qr_twitter").onclick=function(){s(4)},(p=document.querySelector(".qr_modal_link_info"))&&(document.querySelector("#qr_open_in_new").onclick=function(){s(5)}),q=!1,h=[],g=y=_=void 0,f="",document.querySelector(".qr_shadow").onclick=function(e){document.querySelector(".qr_modal_box").style.display="none",e.target.style.display="none",q=!1,p&&(p.style.display="none")},document.querySelector(".qr_modal_close").onclick=function(e){document.querySelector(".qr_modal_box").style.display="none",document.querySelector(".qr_shadow").style.display="none",q=!1,p&&(p.style.display="none")})}{var r,i;c.options.includes("2")&&(r=void 0,(r=document.createElement("div")).className="qr_tooltip_bottom",r.style.bottom="-76px",r.innerHTML="Copied to clipboard\n      <img src='https://wix.salesdish.com/static/close_ctaPopup.svg' alt=\"\"></img>",document.body.appendChild(r),i=void 0,document.querySelector(".qr_menu_item.qr_short_link").onclick=function(e){a||fetch("https://gateway.salesdish.com/wix-service/app_tools/pass/get_short_url?store_id="+w+"&url="+window.location.href).then(function(e){return e.json()}).then(function(e){var t;e.success&&(t=window.location.origin+"/?u="+e.url,(e=document.createElement("input")).value=t,document.body.appendChild(e),e.select(),document.execCommand("Copy"),e.className="oInput",e.style.display="none",clearTimeout(i),r.style.bottom="50px",i=setTimeout(function(){r.style.bottom="-76px"},3e3))})},r.onclick=function(e){r.style.bottom="-76px"})}}())}),x())}();