text: let audio=!1,video=!1;async function checkDevice(e,t,o,r){if(/iPhone|iPad|iPod/i.test(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent))document.getElementById("videoCategoryModal").style.display="none",makeCall(e,t,o,r);else{await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((e=>{let t;video=!0,e.getTracks().forEach((e=>{e.stop()}));const o=e.getTracks();for(t=0;t<o.length;t++)e.removeTrack(o[t])})).catch((e=>{})),await navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((e=>{let t;audio=!0,e.getTracks().forEach((e=>{e.stop()}));const o=e.getTracks();for(t=0;t<o.length;t++)e.removeTrack(o[t])})).catch((e=>{}));const a=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),s=sessionStorage.getItem("categoryName");!0===audio&&!0===video||!0===audio&&!1===video?(document.getElementById("videoCategoryModal").style.display="none",makeCall(e,t,o,r)):!1===audio&&!0===video?a?/Android/i.test(navigator.userAgent)&&(micCamAnalytics(),displayWinDroidMicMessage(s)):/Windows/i.test(navigator.userAgent)&&(micCamAnalytics(),displayWinDroidMicMessage(s)):a?/Android/i.test(navigator.userAgent)&&(micCamAnalytics(),displayWinDroidMicCamMessage(s)):/Windows/i.test(navigator.userAgent)&&(micCamAnalytics(),displayWinDroidMicCamMessage(s))}}function displayWinDroidMicMessage(e){document.getElementById("shopWithVideoContainer").innerHTML=`<div id='mic-cam-msg'><strong>Please allow microphone access to continue</strong><p style="margin-top: 2.5%;">1. Open Chrome <span style="font-weight:bold">Settings</span>.</p><p>2. Go to <span style="font-weight:bold">Site Settings</span>.</p><p>3. Navigate to <span style="font-weight:bold">Microphone</span>.</p><p>4. Turn on ‘<span style="font-weight:bold">Ask before accessing</span>’ option for microphone.</p><p>5. Delete website from ‘<span style="font-weight: bold">Block</span>’ if listed.</p><p>6. Click ‘<span style="font-weight:bold">Allow</span>’ when prompted.</p><br /><strong>Alternately, request callback from store.</strong></div><div class="mic-cam-wrap"><button onclick="getCallBack('AudioIssue','${e}','${sessionStorage.getItem("productName")||""}','mad','callConnectEvent');" class="btn btn-secondary connect-to-expert">Call back</button></div>`}function displayWinDroidMicCamMessage(e){document.getElementById("shopWithVideoContainer").innerHTML=`<div id='mic-cam-msg'><strong>Please allow microphone & camera access to continue</strong><p style="margin-top: 2.5%;">1. Open Chrome <span style="font-weight: bold">Settings</span>.</p><p>2. Go to <span style="font-weight: bold">Site Settings</span>.</p><p>3. Navigate to <span style="font-weight: bold">Microphone</span> and <span style="font-weight: bold">Camera</span>.</p><p>4. Turn on ‘<span style="font-weight: bold">Ask before accessing</span>’ option for microphone and camera.</p><p>5. Delete website from ‘<span style="font-weight: bold">Block</span>’ if listed.</p><p>6. Click ‘<span style="font-weight: bold">Allow</span>’ when prompted.</p><br /><strong>Alternately, request callback from store.</strong></div><div class="mic-cam-wrap"><button onclick="getCallBack('AudioVideoIssue','${e}','${sessionStorage.getItem("productName")||""}','mad','callConnectEvent');" class="btn btn-secondary connect-to-expert">Call back</button></div>`}function displayMacMicCamMessage(e){document.getElementById("shopWithVideoContainer").innerHTML=`<div id='mic-cam-msg'><strong>Please allow microphone & camera access to continue…</strong><p style="margin-top: 2.5%;">1. Open Safari Preferences.</p><p>2. Navigate to Websites.</p><p>3. Go to Camera and Microphone tabs.</p><p>4. Change access to ‘Allow’.</p><p style="margin-bottom: 2.5%;">5. Restart Safari.</p><strong>Alternately, request callback from store.</strong></div><div class="mic-cam-wrap"><button onclick="getCallBack('AudioVideoIssue','${e}','${sessionStorage.getItem("productName")||""}','mad','callConnectEvent');" class="btn btn-secondary connect-to-expert">Call back</button></div>`}function displayiOSMicCamMessage(e){document.getElementById("shopWithVideoContainer").innerHTML=`<div id='mic-cam-msg'><strong>Please allow microphone & camera access to continue…</strong><p style="margin-top: 2.5%;">1. Open the mobile settings.</p><p>2. Tap on Safari</p><p>3. Scroll down to camera & microphone</p><p style="margin-bottom: 2.5%;">4. Change access to Allow</p><strong>Alternately, request callback from store.</strong></div><div class="mic-cam-wrap"><button onclick="getCallBack('AudioVideoIssue','${e}','${sessionStorage.getItem("productName")||""}','mad','callConnectEvent');" class="btn btn-secondary connect-to-expert">Call back</button></div>`}function makeCall(e,t,o,r){document.getElementById("videoCategoryModal").style.display="none";const[a,s]=getCurrentAndPreviousPage(),n="wkEQ=9(@Bz7YT#3!lMx",i=CryptoJS.AES.encrypt(t,n),l=CryptoJS.AES.encrypt(o,n),c=CryptoJS.AES.encrypt(e,n);window.digitalData={page:{pageName:`${s}`,prevPageName:`${a}`,channel:`croma:${s}`,emailID:`${sessionStorage.getItem("hashedMail")?sessionStorage.getItem("hashedMail"):""}`,mobNo:`${sessionStorage.getItem("hashedTel")?sessionStorage.getItem("hashedTel"):""}`,pinCode:`${localStorage.getItem("3hrPincode")?JSON.parse(localStorage.getItem("3hrPincode")):""}`,storeName:`${localStorage.getItem("preferredStore")?JSON.parse(localStorage.getItem("preferredStore")):""}`},event:{linkName:"live video demo:complete",linkType:"clicked",linkPosition:"body"},product:{productName:[`${"true"===sessionStorage.getItem("plpPdpFlag")?sessionStorage.getItem("productName"):""}`],productCategory:[`${sessionStorage.getItem("categoryName")||""}`],productSKU:[`${"true"===sessionStorage.getItem("plpPdpFlag")?sessionStorage.getItem("productCode"):""}`],originalPrice:[""],price:[""]},videoCustomer:{videoCustomerName:`${c}`,videoCustomerPhone:`${i}`,videoCustomerEmailID:`${l}`}},triggerSatellite(),sessionStorage.removeItem("plpPdpFlag"),sessionStorage.removeItem("hashedMail"),sessionStorage.removeItem("hashedTel"),document.getElementById("viewport").setAttribute("content","width=device-width, initial-scale=1.0"),document.querySelector(".bs-header").style.position="unset";const d=document.querySelector("#wrapDiv"),m=document.querySelector("#framewrap");d.style.height="100%",d.style.width="100%",m.style.width=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0)+"px",m.style.height=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)+"px",m.style.display="block";const u=navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1===navigator.userAgent.indexOf("CriOS")&&-1===navigator.userAgent.indexOf("FxiOS");""!==u&&u&&(m.style.position="sticky",m.style.float="right");let g="";if(void 0!==sessionStorage.getItem("productCode")&&null!==sessionStorage.getItem("productCode"))g="productCode="+sessionStorage.getItem("productCode");else{let e=sessionStorage.getItem("categoryName");e=e.replace(/ /g,"%20"),e=e.replace(/&/g,"%26"),g="categoryName="+e}fetch(`${r}videodemo/allchannels/v1/data?${g}&fields=FULL`).then((e=>e.json())).then((o=>{sessionStorage.removeItem("productCode");let r="";void 0!==sessionStorage.getItem("productName")&&null!==sessionStorage.getItem("productName")&&(r=sessionStorage.getItem("productName").replace(/[\s#,&~]/g,"_"));let a="";void 0!==sessionStorage.getItem("categoryName")&&null!==sessionStorage.getItem("categoryName")&&(a=sessionStorage.getItem("categoryName").replace(/[\s#,&~]/g,"_"));const s=o.widgetId||"unknown_widget",n=e.replace(/ /g,"_")||"unknown_customer",i=t||"unknown_contact",l=r||a||"unknown_category_or_product",c=o.queueName||"unknown_queue",d=o.skills||"unknown_skills",m=document.createElement("iframe");m.allowTransparency="true",m.allowusermedia="",m.allow="camera;microphone",m.scrolling="no",m.frameborder="0",m.id="videoFrame",document.querySelector("#wrapDiv").appendChild(m);const u=document.querySelector("#videoFrame");u.style.width="100%",u.style.height="100%",m.setAttribute("src",window.getTCLEndpoint()+s+"&Calling_User_FirstName="+n+"&Calling_User_LastName="+i+"&Product_Name="+l+"&Call_Center_QueueName="+c+"&Calling_User_Skills="+d)})),document.getElementById("buttonWrap").style.display="flex"}function minimizeVideo(){document.querySelector(".bs-header").style.position="fixed",document.body.style.overflow="auto";const e=document.querySelector("#framewrap");e.style.width="320px",e.style.height="240px",document.querySelector("#toggleMinMax").setAttribute("onclick","maximizeVideo();"),document.querySelector("#toggleMinMax").innerHTML='<svg viewBox="0 0 36 36" width="100%"  height="100%"><image href="/assets/images/maximize.svg"/></svg>'}function maximizeVideo(){if(document.querySelector("#videoFrame")){document.querySelector(".bs-header").style.position="unset",document.body.style.overflow="hidden";const e=document.querySelector("#wrapDiv");e.style.height="100%",e.style.width="100%";const t=document.querySelector("#framewrap");t.style.width=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0)+"px",t.style.height=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)+"px",document.querySelector("#toggleMinMax").setAttribute("onclick","minimizeVideo();"),document.querySelector("#toggleMinMax").innerHTML='<svg viewBox="0 0 36 36" width="100%"  height="100%"><image href="/assets/images/minimize.svg"/></svg>'}}function closeiframe(){"107"!==sessionStorage.getItem("eventFromCromaVideo")?!1===sessionStorage.getItem("callConnectEvent")?confirm("Do you want to exit this live session?")&&throwOutofFrame():null===sessionStorage.getItem("anyEventStorage")||sessionStorage.getItem("anyEventStorage").includes("165")?(sessionStorage.removeItem("anyEventStorage"),confirm("Do you want to exit this live session?")&&throwOutofFrame()):throwOutofFrame():throwOutofFrame()}function throwOutofFrame(){document.body.getAttribute("style")&&document.body.removeAttribute("style"),document.querySelector("#videoFrame").remove(),document.querySelector("#framewrap").style.display="none",document.querySelector(".bs-header").style.position="fixed"}function validateUserDetails(e){const t=document.querySelector("input[name=customerName]")?document.querySelector("input[name=customerName]").value:"Anonymous",o=document.querySelector('input[name="customerMobileNumber"]').value,r=document.querySelector('input[name="customerEmailAdd"]')?document.querySelector('input[name="customerEmailAdd"]').value:"anonymous@anonymous.com";if(!1===checkInputs(t,o,r))return!1;document.querySelector("#cust-details-swv > div > button")&&document.querySelector("#cust-details-swv > div > button").removeAttribute("onclick"),document.querySelector("#triggerClose").setAttribute("onclick","closeVideoModal(false)"),sessionStorage.setItem("fullName",t),sessionStorage.setItem("telNumber",o),sessionStorage.setItem("eMail",r),checkDevice(t,o,r,e)}function displayCloseOption(){document.querySelector("#buttonWrap").style.top="initial",document.querySelector("#toggleMinMax").style.left="initial",document.querySelector("#toggleMinMax").style.minWidth="85px",document.querySelector("#buttonWrap").style.bottom="5%",document.querySelector("#buttonWrap").style.width="100%",document.querySelector("#buttonWrap").style.justifyContent="center",document.querySelector("#closeFrame").style.display="initial"}function hideCloseOption(){document.querySelector("#closeFrame").style.display="none",document.querySelector("#buttonWrap").style.bottom="initial";navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1===navigator.userAgent.indexOf("CriOS")&&navigator.userAgent.indexOf("FxiOS");screen.width,document.querySelector("#buttonWrap").style.top="13.5px",document.querySelector("#buttonWrap").style.width="initial",document.querySelector("#buttonWrap").style.justifyContent="flex-start",document.querySelector("#toggleMinMax").style.left="5%",document.querySelector("#toggleMinMax").style.minWidth="43px"}let callConnectedEvent=!1;function callBackFun(){if(null!==event.data&&"string"==typeof event.data&&event.data.includes("CustomChat: "))try{const e=JSON.parse(event.data.replace("CustomChat: ",""));if(sessionStorage.setItem("anyEventStorage",e.data.Status_Code),"error"===e.type&&"de:4iv"===e.data){const e=navigator.userAgent;if(detectSafari()){throwOutofFrame();-1!==e.search("iPhone OS ")||-1!==e.search("iPad;")||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>0?displayiOSMicCamMessage(sessionStorage.categoryName):displayMacMicCamMessage(sessionStorage.categoryName),document.getElementById("videoCategoryModal").style.display="block",micCamAnalytics()}}"ccspEvent"!==e.type||166!==e.data.Status_Code&&165!==e.data.Status_Code?"ccspEvent"===e.type&&133===e.data.Status_Code?(callConnectedEvent=!0,hideCloseOption()):"ccspEvent"===e.type&&107===e.data.Status_Code?!1===callConnectedEvent?(sessionStorage.setItem("eventFromCromaVideo","No_Associate_Available"),sessionStorage.setItem("callConnectEvent",callConnectedEvent),callConnectedEvent=!1,throwOutofFrame(),callonreadystatechange()):displayCloseOption():"status"===e.type&&"callEnded"===e.data?!0===callConnectedEvent&&(sessionStorage.setItem("callConnectEvent",callConnectedEvent),closeiframe(),callConnectedEvent=!1):"error"===e.type&&e.data.includes("Disconnected due to max polling interval reached")&&(killVideoFrame(),callConnectedEvent=!1):displayCloseOption()}catch(e){}}function killVideoFrame(){alert("There is limited or no connectivity. Please check your network connection & try again.");document.querySelector("#videoFrame").setAttribute("src",""),document.querySelector("#framewrap").style.display="none",document.getElementById("viewport").setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no")}async function getCallBack(e,t){const o=sessionStorage.getItem("baseURL"),r=document.querySelector("#customerName")?document.querySelector("#customerName").value:"Anonymous",a=document.querySelector("#customerMobileNumber")?document.querySelector("#customerMobileNumber").value:sessionStorage.telNumber,s=document.querySelector("#customerEmailAdd")?document.querySelector("#customerEmailAdd").value:"anonymous@anonymous.com";if(!1===checkInputs(r,a,s))return!1;const[n,i]=getCurrentAndPreviousPage(),l="wkEQ=9(@Bz7YT#3!lMx",c=CryptoJS.AES.encrypt(a,l),d=CryptoJS.AES.encrypt(s,l),m=CryptoJS.AES.encrypt(r,l);let u="";if(void 0!==sessionStorage.getItem("productCode")&&null!==sessionStorage.getItem("productCode"))u="productCode="+sessionStorage.getItem("productCode");else{let e=sessionStorage.getItem("categoryName");e=e.replace(/ /g,"%20"),e=e.replace(/&/g,"%26"),u="categoryName="+e}await fetch(`${o}videodemo/allchannels/v1/data?${u}&fields=FULL`).then((e=>e.json())).then((e=>{sessionStorage.setItem("productName",e.productName||""),sessionStorage.setItem("productCode",e.productCode||""),sessionStorage.setItem("categoryName",e.categoryName)})),window.digitalData={page:{pageName:`${i}`,prevPageName:`${n}`,channel:`croma:${i}`,emailID:`${sessionStorage.getItem("hashedMail")?sessionStorage.getItem("hashedMail"):""}`,mobNo:`${sessionStorage.getItem("hashedTel")?sessionStorage.getItem("hashedTel"):""}`,pinCode:`${localStorage.getItem("3hrPincode")?JSON.parse(localStorage.getItem("3hrPincode")):""}`,storeName:`${localStorage.getItem("preferredStore")?JSON.parse(localStorage.getItem("preferredStore")):""}`},event:{linkName:`live video demo:call back${sessionStorage.getItem("micCamCallBack")?sessionStorage.getItem("micCamCallBack"):""}`,linkType:"clicked",linkPosition:"body"},product:{productName:[`${sessionStorage.getItem("productName")||""}`],productCategory:[`${sessionStorage.getItem("categoryName")||""}`],productSKU:[`${sessionStorage.getItem("productCode")||""}`],originalPrice:[""],price:[""]},videoCustomer:{videoCustomerName:`${m}`,videoCustomerPhone:`${c}`,videoCustomerEmailID:`${d}`}},triggerSatellite(),sessionStorage.getItem("micCamCallBack")&&sessionStorage.removeItem("micCamCallBack"),fetch(`${o}/videodemo/allchannels/v1/storingliverequest`,{method:"POST",body:JSON.stringify({categoryName:t,productName:sessionStorage.getItem("productName"),reasonForCallBack:`${e||"No Event Code Received"}`,customerName:r,customerEmailAdd:s,customerMobileNumber:a}),headers:{"Content-type":"application/json; charset=UTF-8"}}).then((e=>e.json())).then((e=>{document.getElementById("modalWrapper").setAttribute("style","min-height:10rem"),Object.assign(document.querySelector("#shopWithVideoContainer").style,{minHeight:"inherit",display:"initial",flexDirection:"column",justifyContent:"center"}),!0===e?document.querySelector("#shopWithVideoContainer").innerHTML='<div style="text-align: center;margin:5%;"><svg width="50" height="50" viewBox="0 0 50 50" style="margin: 0 auto;">       \n        <image href="/assets/images/greentick.svg"/>    \n   </svg></div><h4 style=\'text-align: center;color:#000000;\'>Call back details submitted successfully.</h4>':throwError("Sorry, your request was not submitted. Please try after sometime.")}))}function reportWindowSize(){const e=navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1===navigator.userAgent.indexOf("CriOS")&&-1===navigator.userAgent.indexOf("FxiOS");if(""!==e&&e&&document.querySelector("#videoFrame")){const e=document.querySelector("#framewrap");parseInt(window.innerHeight)-parseInt(e.style.height)<29&&(e.style.height=parseInt(e.style.height)+(parseInt(window.innerHeight)-parseInt(e.style.height))+"px")}}function callonreadystatechange(){if("complete"===document.readyState){const e=sessionStorage.getItem("eventFromCromaVideo");if(null!==e){document.querySelector("#triggerClose").setAttribute("onclick","closeVideoModal(false)");let t,o,r,a,s="";e.includes("No_Associate_Available")?s="Apologies, all our associates are busy at the moment. Kindly share your details in the form below & we will connect with you shortly":e.includes("Outside_Operational_Hours")?(s=sessionStorage.storeClosedMessage||`Shop with video assistance is available between ${sessionStorage.getItem("storeOpenTime")} and ${sessionStorage.getItem("storeCloseTime")}. Do visit again or leave your contact details & we will call you back during operational hours.`,sessionStorage.removeItem("storeClosedMessage")):s="Call Drop",localStorage.getItem("cr-cache:user-data")&&(t=JSON.parse(localStorage.getItem("cr-cache:user-data")),o=decryptData(t.customerInfo.firstName)+" "+decryptData(t.customerInfo.lastName)||sessionStorage.getItem("fullName"),r=decryptData(t.customerInfo.phone)||sessionStorage.getItem("telNumber"),a=decryptData(t.customerInfo.email)||sessionStorage.getItem("eMail"));const n=sessionStorage.getItem("categoryName");document.querySelector("#shopWithVideoContainer").innerHTML=`\n      ${window.errorBox(s)}\n  <div id="newInstant" style="height: 44rem;"><div class="sah-title-wrap"><h1 class="sah-title">Please fill in your details</h1></div>\n  <div class="form-list">\n      ${userDetailsForm(o,r,a,"scheduleLater")}\n      <div class="mic-cam-wrap" style="display: flex;justify-content: center;"><button style="margin-bottom: 5rem;" onclick="getCallBack('${sessionStorage.getItem("eventFromCromaVideo")}', '${n}', 'bad', 'mad', ${sessionStorage.getItem("callConnectEvent")});" class="btn btn-secondary connect-to-expert">Call back</button></div>\n  </div></div>`,sessionStorage.removeItem("eventFromCromaVideo"),sessionStorage.removeItem("callConnectEvent"),document.querySelector("#videoCategoryModal").style.display="block"}window.onorientationchange=function(){window.orientation;{const e=document.querySelector("#framewrap"),t=navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1===navigator.userAgent.indexOf("CriOS")&&-1===navigator.userAgent.indexOf("FxiOS");""!==t&&t?(e.style.width="-webkit-calc(100% - 0px)",e.style.height="calc(100vh - var(--vh-offset, 0px))"):(e.style.width="-webkit-fill-available",e.style.height="-webkit-fill-available"),"320"===e.style.width?(document.querySelector("#toggleMinMax").setAttribute("onclick","maximizeVideo();"),document.querySelector("#toggleMinMax").innerHTML='<svg viewBox="0 0 36 36" width="100%"  height="100%"><image href="/assets/images/maximize.svg"/></svg>'):(document.querySelector("#toggleMinMax").setAttribute("onclick","minimizeVideo();"),document.querySelector("#toggleMinMax").innerHTML='<svg viewBox="0 0 36 36" width="100%"  height="100%"><image href="/assets/images/minimize.svg"/></svg>')}}}}async function displayVideoCategory(e,t){if(!document.querySelector("#videoFrame")){sessionStorage.removeItem("productCode"),sessionStorage.removeItem("productName"),sessionStorage.setItem("baseURL",e),sessionStorage.setItem("baseURLImg",t);if(detectiOSVersion()){document.querySelector("body").style.overflow="hidden";const{browserListCheck:t,suggestedBrowserName:o}=detectSupportForBrowser();t?displaySuggestedBrowser(o):((!localStorage.SAH_Categories||(new Date).valueOf()>localStorage.SAH_Time)&&await fetchSAHCategories(e+"videodemo/allchannels/v1/categorylist"),document.querySelector("#modalWrapper").style.display="inherit",document.querySelector("#shopWithVideoContainer").innerHTML='<div class="success-msg" style="margin-bottom:0;"><h2 class="message" id="shopWithVideoMessage">Please select a category for demo</h2>\n        <div class="form-group">\n            <div class="add-on"><span class="input-group-addon" style="top: 39px;"><i class="icon icon-search"></i></span><input style="border-radius: 1.8rem;padding: 0.9rem 5rem;height: inherit;margin-bottom: 2.7rem;margin-top: 2.1rem;" type="text" placeholder="Search for a Category" class="formControl" id="searchCategory" onkeyup="debounceForData();" name="customerMobileNumber"><i onclick="this.previousElementSibling.value=\'\';debounceForData();" id="sah-search-close" class="icon icon-close" style="position: absolute;top: 31px;right: 2.3rem;color: #333;display:none"></i></div></div>\n        </div><div class="category-list" style="height: 29rem;overflow-y: auto;padding-top: 1rem;"></div>',document.querySelector(".category-list").innerHTML=generateList(JSON.parse(localStorage.SAH_Categories))),document.querySelector("#videoCategoryModal").style.display="block"}}}function closeVideoModal(e){if(document.body.getAttribute("style")&&document.body.removeAttribute("style"),document.querySelector("#shopWithVideoContainer")&&(document.getElementById("modalWrapper").removeAttribute("style"),document.querySelector("#shopWithVideoContainer").innerHTML='<div class="video-loader"></div>',document.querySelector("#shopWithVideoContainer").getAttribute("style")&&document.querySelector("#shopWithVideoContainer").removeAttribute("style")),!1===e)document.querySelector("#videoCategoryModal").style.display="none";else{document.querySelector("#triggerClose").setAttribute("onclick","closeVideoModal(false)");let e="";["Will try later","Exploring for now","Unable to connect","Prefer anonymity","Application is slow","Other reasons (Please specify)"].forEach((t=>{e+=`<li class="item"><div class="cp-checkbox-item"><input type="checkbox" id="${t}"><label for="${t}"><span class="check"></span><span class="text feedback-sah">${t}</span></label></div></li>`})),document.querySelector("#shopWithVideoContainer").innerHTML=`<p style='font-size: 1.8rem;text-align:center;'>Leaving us too soon?</p><p style="font-weight: bold;font-size:1.6rem;margin: 3.1rem 0 2.4rem 0;">Help us understand why</p>  \n    <ul class="cp-checkbox">${e}</ul>\n    <div class="form-group" style="margin-top: 1.2rem;"><input type="text" placeholder="Share your reason" class="formControl" id="psrflats" name="psrflats" onkeydown="this.classList.remove('fc-error');this.nextSibling.remove();" spellcheck="false" data-ms-editor="true"></div>\n    <div class="mic-cam-wrap"><button onclick="processFeedback();" class="btn btn-secondary connect-to-expert">Submit</button></div>`}}function enterFillUpForm(e){let t,o,r,a;document.querySelector("#shopWithVideoContainer").style.pointerEvents="initial",document.querySelector("#shopWithVideoContainer").innerHTML='<div class="video-loader"></div>',document.querySelector("#triggerClose").setAttribute("onclick","closeVideoModal(true)"),sessionStorage.setItem("categoryName",e),localStorage.getItem("cr-cache:user-data")&&(t=JSON.parse(localStorage.getItem("cr-cache:user-data")),o=decryptData(t.customerInfo.firstName)+" "+decryptData(t.customerInfo.lastName)||sessionStorage.getItem("fullName"),r=decryptData(t.customerInfo.phone)||sessionStorage.getItem("telNumber"),a=decryptData(t.customerInfo.email)||sessionStorage.getItem("eMail"));const s=sessionStorage.getItem("baseURL"),n=sessionStorage.getItem("baseURLImg"),[i,l]=getCurrentAndPreviousPage();"lp-shop-with-video"!==l&&"homePage"!==l||(window.digitalData={page:{pageName:`${l}`,prevPageName:`${i}`,channel:`croma:${l}`,emailID:`${sessionStorage.getItem("hashedMail")?sessionStorage.getItem("hashedMail"):""}`,mobNo:`${sessionStorage.getItem("hashedTel")?sessionStorage.getItem("hashedTel"):""}`,pinCode:`${localStorage.getItem("3hrPincode")?JSON.parse(localStorage.getItem("3hrPincode")):""}`,storeName:`${localStorage.getItem("preferredStore")?JSON.parse(localStorage.getItem("preferredStore")):""}`},event:{linkName:`live video demo:${e}`,linkType:"clicked",linkPosition:"body"}},triggerSatellite());let c="";c=e.replace(/ /g,"%20"),c=e.replace(/&/g,"%26"),fetch(`${s}videodemo/allchannels/v1/data?categoryName=${c}&fields=FULL`).then((e=>e.json())).then((e=>{const t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][(new Date).getDay()];let i="",l="";e.store.videoDemoableHours.weekDayOpeningList.map((e=>{e.weekDay===t&&(i=e.openingTime.formattedHour,l=e.closingTime.formattedHour)})),e.storeOpen?document.querySelector("#shopWithVideoContainer").innerHTML=`<div id="sah-back">\n          ${sessionStorage.getItem("productName")?"":`<button onclick="displayVideoCategory('${s}','${n}');"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18"><path d="M15 8.25H5.87l4.19-4.19L9 3 3 9l6 6 1.06-1.06-4.19-4.19H15v-1.5z"/></svg></button></div>`}\n          ${homeplppdpsearch(o,r,a,s,"connectNow")}\n          `:(e.isStoreClose&&e.messageforcloseday&&(sessionStorage.storeClosedMessage=e.messageforcloseday),sessionStorage.setItem("eventFromCromaVideo","Outside_Operational_Hours"),sessionStorage.setItem("storeOpenTime",i),sessionStorage.setItem("storeCloseTime",l),sessionStorage.setItem("callConnectEvent",!1),document.querySelector("#triggerClose").setAttribute("onclick","closeVideoModal(false)"),callonreadystatechange())}))}function entryPointForPlpPdp(e,t,o){if(document.querySelector("#videoCategoryModal").style.display="block",document.querySelector("#triggerClose").setAttribute("onclick","closeVideoModal(true)"),!document.querySelector("#videoFrame")){sessionStorage.setItem("baseURL",e),sessionStorage.setItem("baseURLImg",t),sessionStorage.setItem("productCode",o);if(detectiOSVersion()){document.querySelector("body").style.overflow="hidden";const{browserListCheck:e,suggestedBrowserName:t}=detectSupportForBrowser();if(e)displaySuggestedBrowser(t);else{document.querySelector("#modalWrapper").style.display="inherit";const e=sessionStorage.getItem("baseURL");fetch(`${e}videodemo/allchannels/v1/data?productCode=${o}&fields=FULL`).then((e=>e.json())).then((t=>{sessionStorage.setItem("categoryName",t.categoryName),sessionStorage.setItem("productName",t.productName);const o=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][(new Date).getDay()];let r="",a="";if(t.store.videoDemoableHours.weekDayOpeningList.map((e=>{e.weekDay===o&&(r=e.openingTime.formattedHour,a=e.closingTime.formattedHour)})),t.storeOpen){let t,o,r,a;localStorage.getItem("cr-cache:user-data")&&(t=JSON.parse(localStorage.getItem("cr-cache:user-data")),o=decryptData(t.customerInfo.firstName)+" "+decryptData(t.customerInfo.lastName)||sessionStorage.getItem("fullName"),r=decryptData(t.customerInfo.phone)||sessionStorage.getItem("telNumber"),a=decryptData(t.customerInfo.email)||sessionStorage.getItem("eMail")),document.querySelector("#shopWithVideoContainer").innerHTML=`<div id="sah-back">    \n              ${homeplppdpsearch(o,r,a,e,"connectNow")}`,sessionStorage.setItem("plpPdpFlag",!0)}else t.isStoreClose&&t.messageforcloseday&&(sessionStorage.storeClosedMessage=t.messageforcloseday),sessionStorage.setItem("eventFromCromaVideo","Outside_Operational_Hours"),sessionStorage.setItem("storeOpenTime",r),sessionStorage.setItem("storeCloseTime",a),sessionStorage.setItem("callConnectEvent",!1),callonreadystatechange()}))}}}}function getURLPath(e){return/\/c\//.test(e)?"plp":/\/p\//.test(e)?"pdp":"/"===e?"homePage":/\/search/.test(e)?"search":/\/lp-shop-with-video/.test(e)?"lp-shop-with-video":"homePage"}function getCurrentAndPreviousPage(){let e="",t="",o={};if("undefined"!=typeof Storage&&(localStorage.getItem("urlPath")&&(o=JSON.parse(localStorage.getItem("urlPath"))),Object.keys(o).length>0)){const r=o.prevPath?o.prevPath:"",a=o.currentPath?o.currentPath:"";r&&(e=getURLPath(r)),a&&(t=getURLPath(a))}return[e,t]}function checkInputs(e,t,o){if(document.querySelectorAll(".error")){document.querySelectorAll(".error").forEach((e=>e.parentNode.removeChild(e)));const e=document.querySelector("#customerName");e&&e.classList.remove("fc-error");const t=document.querySelector("#customerMobileNumber");t&&t.classList.remove("fc-error");const o=document.querySelector("#customerEmailAdd");o&&o.classList.remove("fc-error")}if(""===e.trim()||t.length<10||""===o){if(""===e.trim()&&document.querySelector("div.form-list > ul > li:nth-child(1) > div")){document.querySelector("#customerName").insertAdjacentHTML("afterend",'<span class="error">Enter your full name</span>');document.querySelector("#customerName").classList.add("fc-error")}if(t.length<10){document.querySelector("#customerMobileNumber").insertAdjacentHTML("afterend",'<span class="error">Enter a valid 10 digit mobile number</span>');document.querySelector("#customerMobileNumber").classList.add("fc-error")}if(""===o){if(document.querySelector("div.form-list > ul > li:nth-child(3) > div")){document.querySelector("#customerEmailAdd").insertAdjacentHTML("afterend",'<span class="error">Enter a valid mail id</span>');document.querySelector("#customerEmailAdd").classList.add("fc-error")}}else if(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(o));else if(document.querySelector("div.form-list > ul > li:nth-child(3) > div")){document.querySelector("#customerEmailAdd").insertAdjacentHTML("afterend",'<span class="error">Enter a valid mail id</span>');document.querySelector("#customerEmailAdd").classList.add("fc-error")}return!1}if(!/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(o)){if(document.querySelector("div.form-list > ul > li:nth-child(3) > div")){document.querySelector("#customerEmailAdd").insertAdjacentHTML("afterend",'<span class="error">Enter a valid mail id</span>');document.querySelector("#customerEmailAdd").classList.add("fc-error")}return!1}if(""===e.trim()||!/^[a-zA-Z._ ]*$/.test(e.trim())){if(document.querySelector("div.form-list > ul > li:nth-child(1) > div")){document.querySelector("#customerName").insertAdjacentHTML("afterend",'<span class="error">Enter your full name</span>');document.querySelector("#customerName").classList.add("fc-error")}return!1}}function detectSupportForBrowser(){const e=navigator.userAgent,t=navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&e&&-1===e.indexOf("CriOS")&&-1===e.indexOf("FxiOS")&&-1===e.indexOf("EdgiOS")&&-1===e.indexOf("OPT"),o=e.match("FxiOS")||e.match("CriOS")||e.match("OPR")||e.match("OPT")||e.match("Opera")||e.match("UCBrowser")||e.match("Miui")||e.match("Trident")||e.match("Firefox")||e.match("Edg")||e.match("SAMSUNG")||e.match("Macintosh")&&!(navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&e&&-1===e.indexOf("CriOS")&&-1===e.indexOf("FxiOS"));let r="";if(o)if(""===t?!e.match("Macintosh"):e.match("Windows")||e.includes("Android")&&e.includes("AppleWebKit")||e.match("SAMSUNG")||t)r="Chrome, please switch your browser";else{r=-1!==e.search("iPhone OS ")||-1!==e.search("iPad;")||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>0?"Safari 14.4, please switch your browser":"Safari 14.0.3, please switch your browser"}return{browserListCheck:o,suggestedBrowserName:r}}function displaySuggestedBrowser(e){document.querySelector("#triggerClose").setAttribute("onclick","closeVideoModal(false)"),document.getElementById("modalWrapper").setAttribute("style","min-height:10rem"),document.getElementById("shopWithVideoContainer").innerHTML=`<div style="text-align:center">Sorry, this feature is currently available only on ${e} to continue.</div>`,document.getElementById("modalWrapper").style.display="flex",document.getElementById("modalWrapper").style.alignItems="center",document.getElementById("videoCategoryModal").style.display="block"}function micCamAnalytics(){const[e,t]=getCurrentAndPreviousPage(),o="wkEQ=9(@Bz7YT#3!lMx",r=document.querySelector("#customerName")?document.querySelector("#customerName").value:"Anonymous",a=document.querySelector("#customerMobileNumber").value,s=document.querySelector("#customerEmailAdd")?document.querySelector("#customerEmailAdd").value:"anonymous@anonymous.com",n=CryptoJS.AES.encrypt(a,o),i=CryptoJS.AES.encrypt(s,o),l=CryptoJS.AES.encrypt(r,o);window.digitalData={page:{pageName:`${t}`,prevPageName:`${e}`,channel:`croma:${t}`,emailID:`${sessionStorage.getItem("hashedMail")?sessionStorage.getItem("hashedMail"):""}`,mobNo:`${sessionStorage.getItem("hashedTel")?sessionStorage.getItem("hashedTel"):""}`,pinCode:`${localStorage.getItem("3hrPincode")?JSON.parse(localStorage.getItem("3hrPincode")):""}`,storeName:`${localStorage.getItem("preferredStore")?JSON.parse(localStorage.getItem("preferredStore")):""}`},event:{linkName:"live video demo:complete:permission",linkType:"clicked",linkPosition:"body"},product:{productName:[`${"true"===sessionStorage.getItem("plpPdpFlag")?sessionStorage.getItem("productName"):""}`],productCategory:[`${sessionStorage.getItem("categoryName")||""}`],productSKU:[`${"true"===sessionStorage.getItem("plpPdpFlag")?sessionStorage.getItem("productCode"):""}`],originalPrice:[""],price:[""]},videoCustomer:{videoCustomerName:`${l}`,videoCustomerPhone:`${n}`,videoCustomerEmailID:`${i}`}},triggerSatellite(),sessionStorage.setItem("micCamCallBack",":permission")}function decideWhomToCall(){const[,e]=getCurrentAndPreviousPage();"homePage"===e?displayVideoCategory(sessionStorage.getItem("baseURL"),sessionStorage.getItem("baseURLImg")):entryPointForPlpPdp(sessionStorage.getItem("baseURL"),sessionStorage.getItem("baseURLImg"),sessionStorage.getItem("productCode"))}function userDetailsForm(e,t,o,r){return"scheduleLater"===r?`<ul class="list" style="width: 90%;margin: 5% auto;">\n    <li class="item">\n        <div class="form-group"><input type="text" placeholder="Enter your Name" class="formControl" id="customerName" name="customerName" spellcheck="false" data-ms-editor="true" ${null!==sessionStorage.getItem("fullName")&&"Anonymous"!==sessionStorage.getItem("fullName")&&`value="${sessionStorage.getItem("fullName")}"`||void 0!==e&&`value="${e}"`}></div>\n    </li>\n    <li class="item">\n        <div class="form-group">\n          <input type="tel" placeholder="Enter your Mobile Number" class="formControl" id="customerMobileNumber" name="customerMobileNumber" maxlength="10" ${null!==sessionStorage.getItem("telNumber")&&`value="${sessionStorage.getItem("telNumber")}"`||void 0!==t&&`value="${t}"`} oninput="this.value = this.value.replace(/[^0-9]/g, '')">\n        </div>\n    </li>\n    <li class="item">\n        <div class="form-group"><input type="text" placeholder="Enter your Email ID" class="formControl" name="customerEmailAdd" id="customerEmailAdd" spellcheck="false" data-ms-editor="true" ${null!==sessionStorage.getItem("eMail")&&"anonymous@anonymous.com"!==sessionStorage.getItem("eMail")&&`value="${sessionStorage.getItem("eMail")}"`||void 0!==o&&`value="${o}"`}></div>\n    </li>\n  </ul>`:"connectNow"===r?`<ul class="list" style="width: 90%;margin: 0 5% 4.9rem 5%;">\n    <li class="item">\n        <div class="form-group">\n          <input type="tel" style="padding-left: 2rem;" placeholder="Enter Mobile Number" class="formControl" id="customerMobileNumber" name="customerMobileNumber" maxlength="10"  ${null!==sessionStorage.getItem("telNumber")&&`value="${sessionStorage.getItem("telNumber")}"`||void 0!==t&&`value="${t}"`} oninput="this.value = this.value.replace(/[^0-9]/g, '')">\n        </div>\n    </li>\n  </ul>`:void 0}async function fetchSAHCategories(e){await fetch(e).then((e=>e.json())).then((e=>{localStorage.SAH_Categories=JSON.stringify(e.listOfVideoDemoCategory?e.listOfVideoDemoCategory:e)})),localStorage.SAH_Time=(new Date).valueOf()+parseInt(6e5)}function instantConnect(e){return`<div class="mic-cam-wrap" style="display: flex;justify-content: center;"><button onclick="validateUserDetails('${e}')" class="btn btn-secondary">CONNECT</button></div>`}function homeplppdpsearch(e,t,o,r,a){return`<div id="newInstant"><div class="sah-title-wrap"><h1 class="sah-title">Get ready to connect to a Croma staff right away!</h1></div>\n        <div class="form-list" id="cust-details-swv" style="border: 1px solid #e7f0ea;border-radius: 1rem;">\n            ${userDetailsForm(e,t,o,a)}\n            ${instantConnect(r)}\n        </div>\n        <div style="display: flex;flex:1;margin-bottom: 1.5rem;padding-top: 3.4rem;"><div style="flex:0.175;justify-content: center;display: flex;"><svg width="16.251" height="23.274" viewBox="0 0 16.251 23.274">\n          <image href="/assets/images/mic.svg"/>    \n     </svg></div><div style="flex:0.75">Please allow access to microphone when prompted.</div></div>\n          <div style="display: flex;flex:1;padding-bottom: 2.3rem;"><div style="flex:0.175;justify-content: center;display: flex;"><svg width="21.598" height="23.583" viewBox="0 0 21.598 23.583">\n          <image href="/assets/images/camerastrike.svg"/>    \n     </svg></div><div style="flex:0.75">Your camera would be in OFF mode by default when call connects, if you choose to turn on the same.</div></div></div>\n        </div>`}function processFeedback(){const e=[];document.querySelectorAll("#shopWithVideoContainer input[type=checkbox]:checked").forEach((t=>e.push(t.id)));const t=document.querySelector("#psrflats").value;if(""===t&&0===e.length)return document.getElementById("shareReasons")||(document.getElementById("psrflats").classList.add("fc-error"),document.getElementById("psrflats").insertAdjacentHTML("afterend",'<div id="shareReasons"><br /><span style="color:#c72d3a;font-size:1.2rem;font-weight: 600;margin: .6rem 0;">Please share reason(s) for leaving.</span></div>')),!1;const o={cancelationReasonFromTestBox:t,cancelationReasons:e,customerMobileNumber:""};fetch(`${sessionStorage.baseURL}/videodemo/allchannels/v1/savingcancelrequest`,{method:"POST",body:JSON.stringify(o),headers:{"Content-type":"application/json; charset=UTF-8"}}).then((e=>e.json())).then((()=>{thankYou()}))}function thankYou(){document.getElementById("modalWrapper").setAttribute("style","min-height:10rem"),document.getElementById("shopWithVideoContainer").innerHTML='<div style="text-align: center;margin:5%;"><svg width="50" height="50" viewBox="0 0 50 50" style="margin: 0 auto;">       \n  <image href="/assets/images/greentick.svg"/>    \n</svg></div><h4 style=\'text-align: center;color:#000000;\'>Thank you for your feedback!</h4>'}function triggerSatellite(){try{void 0!==window._satellite&&window._satellite&&window._satellite.track("otherClick")}catch(e){}}function searchList(){const e=document.querySelector("#searchCategory").value,t=JSON.parse(localStorage.SAH_Categories),o=t.filter((t=>-1!==t.categoryName.search(new RegExp(e,"i"))));document.querySelector("#filter-sah")&&document.querySelector("#filter-sah").remove(),o.length===t.length?(document.querySelector("#sah-search-close").style.display="none",document.querySelector(".category-list").style.display="block"):(document.querySelector("#sah-search-close").style.display="initial",document.querySelector(".category-list").style.display="none",document.querySelector(".category-list").insertAdjacentHTML("afterend",`<div id="filter-sah" style="height: 24rem;overflow-y: auto;padding-top: 1rem;">${generateList(o)}</div>`))}window.addEventListener("message",callBackFun,!0),window.onbeforeunload=function(){if(document.querySelector("#videoFrame")&&document.querySelector("#videoFrame").getAttribute("src"))return"back"},document.addEventListener("visibilitychange",maximizeVideo,!1),document.onreadystatechange=callonreadystatechange,window.onresize=reportWindowSize;const debounce=function(e,t){let o;return function(){const r=this,a=arguments;clearTimeout(o),o=setTimeout((()=>{e.apply(r,a)}),t)}},debounceForData=debounce(searchList,300);function generateList(e){let t="";return e.forEach((e=>{t+=`<button  class="item demo-category-tiles" onclick="document.querySelector('#shopWithVideoContainer').style.pointerEvents='none';this.style.border='solid 1px #005652';this.style.color='#48a7a3';setTimeout(function(){enterFillUpForm('${e.categoryName}')},1500);">\n                    ${e.categoryName}\n                </button>`})),t}function showSuccessMessage(e){document.querySelector("#shopWithVideoContainer").innerHTML=`<div style="text-align: center;margin:5%;"><svg width="86" height="86" viewBox="0 0 86 86" style="margin: 0 auto;display: block;margin-top: 5rem;">       \n  <image href="/assets/images/greentick.svg"/>    \n</svg></div><h4 style='font-size: 175%;\ntext-align: center;color:#000000;'>${e}</h4>\n<div style="text-align: center;margin-top: 7.5rem;"><button class="btn btn-secondary" onclick="window.location.href='https://www.croma.com/';">Navigate to Croma.com</button></div>`,document.querySelector("#videoCategoryModal").style.display="block"}function throwError(e){Object.assign(document.querySelector("#shopWithVideoContainer").style,{minHeight:"inherit",display:"flex",flexDirection:"column",justifyContent:"center"}),document.querySelector("#shopWithVideoContainer").innerHTML=`<div style="text-align: center;margin:5%;"><svg width="86" height="86" viewBox="0 0 150 150" style="margin: 0 auto;">       \n  <image href="/assets/images/error.svg"/>    \n</svg></div><h4 style='font-size: 175%;text-align: center;color:#000000;'>${e}</h4>`,document.querySelector("#videoCategoryModal").style.display="block"}window.errorBox=e=>`<div class="appoint-error">${e}</div>`;const decryptData=e=>{try{return CryptoJS.AES.decrypt(e,"wkEQ=9(@Bz7YT#3!lMx").toString(CryptoJS.enc.Utf8)}catch(e){return""}};