String.prototype.replaceAll=function(t,e){return this.valueOf().split(t).join(e)},String.prototype.format=function(){for(var t=this,e=0;e0&&t.push(e)}),t},Array.prototype.random=function(){return this[Math.floor(Math.random()*this.length)]},Array.prototype.unique=function(){return this.filter(function(t,e,i){return i.indexOf(t)==e})},Array.prototype.except=function(t){var e=this;return Array.isArray(t)&&t.forEach(function(t){var i=e.indexOf(t);-1!=i&&e.splice(i,1)}),e},Array.prototype.only=function(t){var e=[];return Array.isArray(t)&&this.forEach(function(i){-1!=t.indexOf(i)&&e.push(i)}),e},Array.prototype.insert=function(t,e){this.splice(t,0,e)};var LadiPageScriptV2=LadiPageScriptV2||function(){};LadiPageScriptV2.prototype.init=function(){this.const={DESKTOP:"desktop",MOBILE:"mobile",DOMAIN_GOOGLE_DOCS:"docs.google.com",POWERED_BY_IMAGE:"https://w.ladicdn.com/source/ladipage-loader.svg",STATIC_W_DOMAIN:"w.ladicdn.com",STATIC_S_DOMAIN:"s.ladicdn.com",APP_RUNTIME_PREFIX:"_runtime",DATA_ACTION_TYPE:{link:"link",section:"section",email:"email",phone:"phone",popup:"popup",hidden_show:"hidden_show",collapse:"collapse",change_index:"change_index",lightbox:"lightbox"},DATA_ACTION_LIGHTBOX_TYPE:{image:"image",video:"video",iframe:"iframe"},COUNTDOWN_TYPE:{countdown:"countdown",daily:"daily",endtime:"endtime"},COUNTDOWN_ITEM_TYPE:{day:"day",hour:"hour",minute:"minute",seconds:"seconds"},VIDEO_TYPE:{youtube:"youtube",direct:"direct"},BACKGROUND_STYLE:{solid:"solid",gradient:"gradient",image:"image",video:"video"},PUBLISH_PLATFORM:{ladipage:"LADIPAGE",ladipagedns:"LADIPAGEDNS",wordpress:"WORDPRESS",haravan:"HARAVAN",sapo:"SAPO",shopify:"SHOPIFY",itop:"ITOPWEBSITE",ftp:"FTP",other:"OTHER"},TRACKING_NAME:"ladicid",PUBLISH_STYLE:{desktop_min_width:768,mobile_small_min_width:320},ANIMATED_LIST:["rotate-1","rotate-2","rotate-3","type","scale","loading-bar","slide","clip","zoom","push"],POSITION_TYPE:{default:"default",top:"top",bottom:"bottom",top_left:"top_left",top_center:"top_center",top_right:"top_right",center_left:"center_left",center_right:"center_right",bottom_left:"bottom_left",bottom_center:"bottom_center",bottom_right:"bottom_right"},COLLECTION_TYPE:{carousel:"carousel",readmore:"readmore"},INPUT_TYPE:{tel:"tel",text:"text",select_multiple:"select_multiple",number:"number",email:"email",textarea:"textarea",select:"select",radio:"radio",checkbox:"checkbox",file:"file",product_variant:"product_variant"},CONTENT_TYPE:{form_data:"FORM_DATA",form_urlencoded:"X_WWW_FORM_URLENCODED",json:"JSON"},SORT_BY_TYPE:{asc:"asc",desc:"desc"},PRODUCT_VARIANT_TYPE:{combined:"combined",combobox:"combobox"},PRODUCT_VARIANT_TITLE:{left:"left",top:"top"},FORM_THANKYOU_TYPE:{default:"default",url:"url",popup:"popup"},GAME_RESULT_TYPE:{default:"default",popup:"popup"},PERCENT_TRACKING_SCROLL:[0,25,50,75,100],TIME_ONPAGE_TRACKING:[10,30,60,120,180,300,600],FORM_CONFIG_TYPE:{email:"EMAIL",mail_chimp:"MAIL_CHIMP",infusion_soft:"INFUSION_SOFT",infusion_soft_ladi:"INFUSION_SOFT_LADI",active_campaign:"ACTIVE_CAMPAIGN",sendgrid:"SENDGRID",hubspot:"HUBSPOT",smtp:"SMTP",esms:"ESMS",get_response:"GET_RESPONSE",convertkit:"CONVERTKIT",ladiflow:"LADIFLOW",telegram:"TELEGRAM",slack:"SLACK",zalo:"ZALO",mautic:"MAUTIC",google_sheet:"GOOGLE_SHEET",google_form:"GOOGLE_FORM",custom_api:"CUSTOM_API",ladisales:"LADISALES",haravan:"HARAVAN",sapo:"SAPO",shopify:"SHOPIFY",nhanh_vn:"NHANH_VN",google_recaptcha:"GOOGLE_RECAPTCHA",kiotviet:"KIOTVIET",wordpress:"WORDPRESS",metu:"METU"},FORM_UPLOAD_FILE_LENGTH:5,FORM_UPLOAD_FILE_SIZE:25,CART_LAYOUT:{editable:"editable",viewonly:"viewonly"},WIDTH_SECTION_RESIZE:{},RESIZE_ADD_PIXEL:300,RESIZE_ADD_PIXEL_THUMB:50,RESIZE_RANGE:50,TOOLTIP_TYPE:{default:"default",info:"info",success:"success",error:"error",notice:"notice"},TOOLTIP_POSITION:{top_middle:"top_middle",top_left:"top_left",top_right:"top_right",bottom_middle:"bottom_middle",bottom_left:"bottom_left",bottom_right:"bottom_right",left_middle:"left_middle",left_top:"left_top",left_bottom:"left_bottom",right_middle:"right_middle",right_top:"right_top",right_bottom:"right_bottom"},TOOLTIP_SIZE:{small:"small",medium:"medium",big:"big"}},this.runtime={backdrop_popup_id:"backdrop-popup",lightbox_screen_id:"lightbox-screen",builder_section_popup_id:"SECTION_POPUP",ladipage_powered_by_classname:"ladipage_powered_by",current_element_mouse_down_carousel:null,current_element_mouse_down_carousel_position_x:0,current_element_mouse_down_carousel_diff:40,current_element_mouse_down_gallery_control:null,current_element_mouse_down_gallery_control_time:0,current_element_mouse_down_gallery_control_time_click:300,current_element_mouse_down_gallery_control_position_x:0,current_element_mouse_down_gallery_view:null,current_element_mouse_down_gallery_view_position_x:0,current_element_mouse_down_gallery_view_diff:40,scroll_show_popup:{},scroll_depth:[],scroll_to_section:{},isMobileOnly:!1,interval_countdown:null,interval_gallery:null,timeout_gallery:{},interval_carousel:null,timenext_carousel:{},isClient:!1,isDesktop:!0,isIE:!1,isYouTubeIframeAPIReady:!1,isLoadYouTubeIframeAPI:!1,device:this.const.DESKTOP,ladipage_id:null,list_collapse:{},list_scroll_func:{},list_show_popup_func:{},list_youtube_ready_exec:[],list_lightbox_id:{},list_set_value_name_country:["ward","district","state","country"],tmp:{},tabindexForm:0,eventData:{},timenow:0,widthScrollBar:0,replaceStr:{},replacePrefixStart:"{{",replacePrefixEnd:"}}"},this.const.WIDTH_SECTION_RESIZE[this.const.DESKTOP]=1440,this.const.WIDTH_SECTION_RESIZE[this.const.MOBILE]=768},LadiPageScriptV2.prototype.run=function(t){var e=this;this.runtime.isIE=!!document.documentMode,this.runtime.isIE=this.runtime.isIE?this.runtime.isIE:!this.runtime.isIE&&!!window.StyleMedia,this.runtime.isClient=t,this.runtime.timenow=this.getCookie("_timenow"),this.isEmpty(this.runtime.timenow)?(this.runtime.timenow=Date.now(),this.setCookie(null,"_timenow",this.runtime.timenow,0,!0,window.location.pathname)):this.runtime.timenow=parseFloatLadiPage(this.runtime.timenow)||0;try{this.runtime.widthScrollBar=window.innerWidth-document.documentElement.clientWidth}catch(t){}if(t){if(this.isString(this.runtime.eventData))try{var i=decodeURIComponent(this.runtime.eventData);this.runtime.eventData=JSON.parse(i)}catch(t){String.prototype.decode=function(){return this.valueOf().replaceAll(/&/g,"&").replaceAll(/>/g,">").replaceAll(/</g,"<").replaceAll(/"/g,'"')};var a=this.runtime.eventData.decode();a=a.replaceAll("\r\n","").replaceAll("\n",""),this.runtime.eventData=JSON.parse(a)}}else this.runtime.isMobileOnly=LadiPage.data.is_mobile_only,this.runtime.eventData=LadiPage.generateEventDataAll(t),this.runtime.ladipage_id=LadiPage.publish.id,this.runtime.publish_platform=LadiPage.publish.type,this.runtime.bodyFontSize=12,this.runtime.store_id=LadiPage.getRootScope().getStoreId(),this.runtime.time_zone=LadiPage.getRootScope().getStoreTimezone(!0),this.runtime.currency=LadiPage.getRootScope().getStoreCurrency();this.runtime.isMobileOnly&&Object.keys(e.runtime.eventData).forEach(function(t){Object.keys(e.runtime.eventData[t]).forEach(function(i){if(i.toLowerCase().startsWith(e.const.MOBILE)){var a=e.const.DESKTOP+i.substring(e.const.MOBILE.length);e.runtime.eventData[t][a]=e.runtime.eventData[t][i]}})});this.isNull(window.ladi_is_desktop)?this.runtime.isDesktop=t?!/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()):LadiPage.isDesktop():this.runtime.isDesktop=t?window.ladi_is_desktop:LadiPage.isDesktop(),this.runtime.device=this.runtime.isDesktop?this.const.DESKTOP:this.const.MOBILE,this.runtime.tmp.isFirstScroll=!0,this.runtime.tmp.capture_form_data_last={},this.runtime.tmp.runAfterLocation=[],this.runtime.tmp.product_info={},this.runtime.tmp.timeout_product_info={},this.runtime.tmp.product_tag_info={},this.runtime.tmp.timeout_product_tag_info={},this.runtime.tmp.dataset_check_load=!1,this.runtime.tmp.dataset_data={},this.runtime.tmp.timeout_dataset_data={},this.runtime.tmp.cart=[],this.runtime.tmp.add_to_cart_total_discount=0,this.runtime.tmp.add_to_cart_fee_shipping=0,this.runtime.tmp.is_click_add_to_cart=!1,this.runtime.tmp.is_click_check_price_discount=!1,this.runtime.tmp.current_use_coupon=null,this.changeTotalPriceCart();var n=e.getCookie("LADI_DATA");try{n=JSON.parse(Base64.decode(n||Base64.encode("{}"))),Object.keys(n).forEach(function(t){e.setDataReplaceStr(t,n[t])})}catch(t){}var r=function(t){var i=e.copy(t);return e.isObject(i)&&e.runtime.list_set_value_name_country.forEach(function(t){if(!e.isEmpty(i[t])){var a=i[t].split(":");a.length>1&&a.shift(),i[t]=a.join(":")}}),i},o=e.getURLSearchParams(window.location.search,null,!0),l=r(o),s="";Object.keys(l).forEach(function(t){t!=e.const.TRACKING_NAME&&(e.setDataReplaceStr(t,l[t]),(e.isArray(o[t])?o[t]:[o[t]]).forEach(function(i){e.isEmpty(s)?s+="?":s+="&",s+=t+"="+encodeURIComponent(i)}))}),this.deleteCookie(this.const.TRACKING_NAME),this.historyReplaceState(window.location.pathname+s+window.location.hash);var c,d=this.runtime.isDesktop,u=Object.keys(this.runtime.eventData),p=e.getCookie("LADI_CLIENT_ID"),m=parseFloatLadiPage(e.getCookie("LADI_FORM_SUBMIT"))||0,g=parseFloatLadiPage(e.getCookie("LADI_PAGE_VIEW"))||0,y=e.getCookie("LADI_CAMP_ID"),_=e.getCookie("LADI_CAMP_NAME"),f=e.getCookie("LADI_CAMP_TYPE"),h=e.getCookie("LADI_CAMP_TARGET_URL"),v=e.getCookie("LADI_CAMP_ORIGIN_URL"),E=parseFloatLadiPage(e.getCookie("LADI_CAMP_PAGE_VIEW"))||0,L=parseFloatLadiPage(e.getCookie("LADI_CAMP_FORM_SUBMIT"))||0,P=parseFloatLadiPage(e.getCookie("LADI_PAGE_VIEW_DAILY"))||0,A=parseFloatLadiPage(e.getCookie("LADI_FORM_SUBMIT_DAILY"))||0,S=parseFloatLadiPage(e.getCookie("LADI_CAMP_PAGE_VIEW_DAILY"))||0,w=parseFloatLadiPage(e.getCookie("LADI_CAMP_FORM_SUBMIT_DAILY"))||0,b=e.getCookie("LADI_CAMP_CONFIG"),T=e.getCookie("LADI_FUNNEL_NEXT_URL"),C=function(t,i,a){if("FormSubmit"==t&&e.isEmpty(p))e.isFunction(a)&&a();else{var n=e.runtime.publish_platform,r={event:t,pixel_id:e.runtime.store_id,time_zone:e.runtime.time_zone,domain:window.location.host,url:window.location.href,ladipage_id:e.runtime.ladipage_id,publish_platform:n,data:[]};Object.keys(i).forEach(function(t){r[t]=i[t]}),"FormSubmit"==t&&(e.isEmpty(y)?m++:(h==v&&m++,L++),e.setCookie(null,"LADI_FORM_SUBMIT",m,3650,!1,window.location.pathname),e.setCookie(null,"LADI_CAMP_FORM_SUBMIT",L,3650,!1,window.location.pathname)),e.sendRequest("POST",e.const.API_ANALYTICS_EVENT,JSON.stringify(r),!0,{"Content-Type":"application/json",LADI_CLIENT_ID:p,LADI_FORM_SUBMIT:m,LADI_PAGE_VIEW:g,LADI_CAMP_ID:y,LADI_CAMP_NAME:_,LADI_CAMP_TYPE:f,LADI_CAMP_TARGET_URL:h,LADI_CAMP_ORIGIN_URL:v,LADI_CAMP_PAGE_VIEW:E,LADI_CAMP_FORM_SUBMIT:L,LADI_PAGE_VIEW_DAILY:P,LADI_FORM_SUBMIT_DAILY:A,LADI_CAMP_PAGE_VIEW_DAILY:S,LADI_CAMP_FORM_SUBMIT_DAILY:w},function(t,i,n){n.readyState==XMLHttpRequest.DONE&&e.isFunction(a)&&a(i,t)})}},I=function(t,i,a,n,r){if(t=t||document.getElementById(i),!e.isEmpty(t))if(!r||e.isEmpty(T))if(e.isEmpty(n))t.addEventListener("click",function(t){e.runEventTracking(i,!1)});else{n.type==e.const.DATA_ACTION_TYPE.link&&t.addEventListener("click",function(a){if("true"==t.getAttribute("data-action")&&!e.isEmpty(n.action)){var r=n.action;r=e.getLinkUTMRedirect(r,window.location.search),r=e.convertDataReplaceStr(r,!0),window.ladi(r).open_url(n.target)}e.runEventTracking(i,!1)}),n.type==e.const.DATA_ACTION_TYPE.email&&t.addEventListener("click",function(a){"true"!=t.getAttribute("data-action")||e.isEmpty(n.action)||window.ladi("mailto:"+n.action).open_url(),e.runEventTracking(i,!1)}),n.type==e.const.DATA_ACTION_TYPE.phone&&t.addEventListener("click",function(a){"true"!=t.getAttribute("data-action")||e.isEmpty(n.action)||window.ladi("tel:"+n.action).open_url(),e.runEventTracking(i,!1)}),n.type==e.const.DATA_ACTION_TYPE.collapse&&t.addEventListener("click",function(t){var a=document.getElementById(n.action);e.isEmpty(a)||window.ladi(n.action).collapse(),e.runEventTracking(i,!1)}),n.type==e.const.DATA_ACTION_TYPE.section&&t.addEventListener("click",function(a){var r=document.getElementById(n.action);if(!e.isEmpty(r)){var o=e.findAncestor(t,"ladi-popup");if(!e.isEmpty(o)){var l=e.findAncestor(o,"ladi-element");l.hasAttribute("data-popup-backdrop")&&window.ladi(l.id).hide()}window.ladi(n.action).scroll(),e.runEventTracking(i,!1)}}),n.type==e.const.DATA_ACTION_TYPE.popup&&t.addEventListener("click",function(t){var a=document.getElementById(n.action);e.isEmpty(a)||window.ladi(n.action).show(),e.runEventTracking(i,!1)}),n.type==e.const.DATA_ACTION_TYPE.hidden_show&&t.addEventListener("click",function(t){e.isArray(n.hidden_ids)&&n.hidden_ids.forEach(function(t){window.ladi(t).hide()}),e.isArray(n.show_ids)&&n.show_ids.forEach(function(t){window.ladi(t).show()}),e.runEventTracking(i,!1)}),n.type==e.const.DATA_ACTION_TYPE.change_index&&t.addEventListener("click",function(t){var i=window.ladi(n.action);e.isEmpty(n.change_index_number)?e.isFunction(i[n.change_index_type])&&i[n.change_index_type]():i.index(n.change_index_number)});var o=null;if(n.type==e.const.DATA_ACTION_TYPE.lightbox?o=n.lightbox_type:"lightbox_image"==n.type?o=e.const.DATA_ACTION_LIGHTBOX_TYPE.image:"lightbox_video"==n.type?o=e.const.DATA_ACTION_LIGHTBOX_TYPE.video:"lightbox_iframe"==n.type&&(o=e.const.DATA_ACTION_LIGHTBOX_TYPE.iframe),o==e.const.DATA_ACTION_LIGHTBOX_TYPE.image&&t.addEventListener("click",function(t){lightbox_image(n.image_url),e.runEventTracking(i,!1)}),o==e.const.DATA_ACTION_LIGHTBOX_TYPE.video){var l=document.querySelectorAll("#"+i+".preload").length>0;l&&lightbox_video(n.video_url,n.video_type,l),t.addEventListener("click",function(t){lightbox_video(n.video_url,n.video_type,!1),e.runEventTracking(i,!1)})}o==e.const.DATA_ACTION_LIGHTBOX_TYPE.iframe&&t.addEventListener("click",function(t){lightbox_iframe(n.iframe_url),e.runEventTracking(i,!1)})}else t.addEventListener("click",function(t){t.preventDefault();var a=T;a=e.getLinkUTMRedirect(a,window.location.search),a=e.convertDataReplaceStr(a,!0),window.ladi(a).open_url(),e.runEventTracking(i,!1)})},O=function(t,i,a,n){t=t||document.getElementById(i),e.isEmpty(t)||e.isEmpty(n)||n.type==e.const.DATA_ACTION_TYPE.hidden_show&&(t.addEventListener("mouseenter",function(t){e.isArray(n.hidden_ids)&&n.hidden_ids.forEach(function(t){window.ladi(t).hide()}),e.isArray(n.show_ids)&&n.show_ids.forEach(function(t){window.ladi(t).show()})}),t.addEventListener("mouseleave",function(t){e.isArray(n.hidden_ids)&&n.hidden_ids.forEach(function(t){window.ladi(t).show()}),e.isArray(n.show_ids)&&n.show_ids.forEach(function(t){window.ladi(t).hide()})}))},N=function(t,i,a,n){if(e.isEmpty(e.runtime.timeout_gallery[t])&&e.isEmpty(e.runtime.current_element_mouse_down_gallery_view)&&e.isEmpty(e.runtime.current_element_mouse_down_gallery_control)){var r=document.getElementById(t);if(!(e.isEmpty(r)||e.runtime.tmp.gallery_playing_video&&i)){var o=r.getElementsByClassName("ladi-gallery-view-item"),l=r.getElementsByClassName("ladi-gallery-control-item");if(0!=o.length&&0!=o.length){var s=r.getAttribute("data-is-next")||"true";s="true"==s.toLowerCase();var c=parseFloatLadiPage(r.getAttribute("data-current"))||0,d=parseFloatLadiPage(r.getAttribute("data-max-item"))||0;i?s?c>=d-1?(c=d-2,s=!1):c++:c<=0?(c=1,s=!0):c--:s?c++:c--,c<0&&(c=0),c>=d-1&&(c=d-1),e.isEmpty(a)&&(a=s?"next":"prev"),e.isEmpty(n)&&(n=s?"left":"right"),e.runtime.tmp.gallery_playing_video&&!o[c].classList.contains("selected")&&e.pauseAllVideo(),o[c].classList.add(a),r.querySelectorAll(".ladi-gallery-view-item.selected")[0].classList.add(n);var u=1e3*(parseFloatLadiPage(getComputedStyle(o[c]).transitionDuration)||0);e.runtime.timeout_gallery[t]=e.runTimeout(function(){o[c].classList.add(n),e.runtime.timeout_gallery[t]=e.runTimeout(function(){for(var i=0;i0?0:-f;var h=parseFloatLadiPage(getComputedStyle(r.getElementsByClassName("ladi-gallery-control-box")[0]).width)||0;f<(h=(h=-(h-=parseFloatLadiPage(getComputedStyle(r.getElementsByClassName("ladi-gallery-control")[0]).width)||0))>0?0:h)&&(f=h),r.getElementsByClassName("ladi-gallery-control-box")[0].style.setProperty("left",f+"px")}else{var v=parseFloatLadiPage(getComputedStyle(r.getElementsByClassName("ladi-gallery-control")[0]).height)||0,E=parseFloatLadiPage(getComputedStyle(r.getElementsByClassName("ladi-gallery-control-item")[c]).height)||0,L=g.y-m.y-(v-E)/2;L=-(L-=parseFloatLadiPage(r.getElementsByClassName("ladi-gallery-control-box")[0].style.getPropertyValue("top"))||0)>0?0:-L;var P=parseFloatLadiPage(getComputedStyle(r.getElementsByClassName("ladi-gallery-control-box")[0]).height)||0;L<(P=(P=-(P-=parseFloatLadiPage(getComputedStyle(r.getElementsByClassName("ladi-gallery-control")[0]).height)||0))>0?0:P)&&(L=P),r.getElementsByClassName("ladi-gallery-control-box")[0].style.setProperty("top",L+"px")}r.setAttribute("data-is-next",s),r.setAttribute("data-current",c),(r.getElementsByClassName("ladi-gallery")[0].classList.contains("ladi-gallery-left")||r.getElementsByClassName("ladi-gallery")[0].classList.contains("ladi-gallery-right"))&&e.reloadLazyload()}}}},x=function(t,i,a){var n=i.getAttribute("data-video-type"),r=i.getAttribute("data-video-url"),o=t+"_"+i.getAttribute("data-index")+"_player",l=document.getElementById(o);a||(e.pauseAllVideo(),e.runtime.tmp.gallery_playing_video=!0),e.isEmpty(l)?(n==e.const.VIDEO_TYPE.youtube&&(l=document.createElement("iframe"),i.parentElement.insertBefore(l,i.nextSibling),l.outerHTML='',e.runEventPlayVideo(o,n,r,!1,!1,!0,a)),n==e.const.VIDEO_TYPE.direct&&(l=document.createElement("video"),i.parentElement.insertBefore(l,i.nextSibling),l.outerHTML='',e.runEventPlayVideo(o,n,r,!1,!0,!0,a))):e.runEventReplayVideo(o,n,!0)},D=function(t,i,a){t.stopPropagation();var n=e.runtime.eventData[i],r=n[e.runtime.device+".option.gallery_control.autoplay"],o=n[e.runtime.device+".option.gallery_control.autoplay_time"],l=0;r&&!e.isEmpty(o)&&(l=o);var s=parseFloatLadiPage(t.target.getAttribute("data-index"))||0,c=null,d=null;(parseFloatLadiPage(a.getAttribute("data-current"))||0)>s?(c="prev",d="right"):(c="next",d="left");var u=a.getAttribute("data-is-next")||"true";(u="true"==u.toLowerCase())?s--:s++,a.setAttribute("data-current",s),a.setAttribute("data-next-time",Date.now()+1e3*l),N(i,!1,c,d)},k=function(t,i){if((e.isEmpty(e.runtime.timenext_carousel[t])||!(e.runtime.timenext_carousel[t]>Date.now()))&&e.isEmpty(e.runtime.current_element_mouse_down_carousel)){var a=document.getElementById(t);if(!e.isEmpty(a)){var n=a.getAttribute("data-is-next")||"true";n="true"==n.toLowerCase();var r=parseFloatLadiPage(a.getAttribute("data-current"))||0,o=parseFloatLadiPage(e.runtime.eventData[t][e.runtime.device+".option.carousel_crop.width"])||0,l=parseFloatLadiPage(e.runtime.eventData[t][e.runtime.device+".option.carousel_crop.width_item"])||0;l>a.clientWidth&&(l=a.clientWidth);var s=Math.ceil(o/l);i?n?r>=s-1?(r=s-2,n=!1):r++:r<=0?(r=1,n=!0):r--:n?r++:r--,r<0&&(r=0),r>=s-1&&(r=s-1);var c=1e3*(parseFloatLadiPage(getComputedStyle(a.getElementsByClassName("ladi-carousel-content")[0]).transitionDuration)||0);e.runtime.timenext_carousel[t]=Date.now()+c;var d=e.getElementBoundingClientRect(a),u=d.x+r*l-d.x-(a.clientWidth-l)/2;u=-u>0?0:-u;var p=-(o-a.clientWidth);uDate.now()&&e.runTimeout(function(){R(t)},100)}},B=function(i,a){if("form"==a){var n=e.runtime.eventData[i];if(!e.isEmpty(n)&&n["option.is_add_to_cart"]){var r=document.getElementById(i);if(!e.isEmpty(r)){var o=r.querySelector('[data-variant="true"]');if(!e.isEmpty(o)){var l=e.runtime.eventData[o.id];if(!e.isEmpty(l)){var s=n["option.product_type"],c=n["option.product_id"];if(!e.isEmpty(s)&&!e.isEmpty(c)){var d=e.generateVariantProduct(n,!0,l["option.product_variant_type"],l["option.product_variant_title"],l["option.product_variant_price"],l["option.input_tabindex"],t,!0,function(t){B(i,a)});e.isEmpty(d)||e.showParentVisibility(o,function(){for(var t=o.clientHeight,i=t,a=o.querySelectorAll("select.ladi-form-control"),n={},s=0;s .ladi-image > .ladi-image-background {background-image: none;}":"#"+i+' > .ladi-image > .ladi-image-background {background-image: url("'+c+'");}',e.createStyleElement(s,d)}if("gallery"==a){if(!e.isArray(o))return;if(l=document.getElementById(i),e.isEmpty(l))return;for(var u=l.getElementsByClassName("ladi-gallery-view-item");u.length',null,!0);l.getElementsByClassName("ladi-gallery-view")[0].appendChild(p)}for(;u.length>o.length;)u[u.length-1].parentElement.removeChild(u[u.length-1]);for(var m=l.getElementsByClassName("ladi-gallery-control-item"),g=function(t){D(t,i,l)};m.length',null,!0);y.addEventListener("click",g),l.getElementsByClassName("ladi-gallery-control-box")[0].appendChild(y)}for(;m.length>o.length;)m[m.length-1].parentElement.removeChild(m[m.length-1]);s="style_add_to_cart_gallery_"+i;var _="";o.length<=1&&(_+="#"+i+" .ladi-gallery .ladi-gallery-view .ladi-gallery-view-arrow {display: none;}",_+="#"+i+" > .ladi-gallery > .ladi-gallery-view {height: 100%;}",_+="#"+i+" > .ladi-gallery > .ladi-gallery-control {display: none;}");var f=l.getElementsByClassName("ladi-gallery-view")[0],h=l.getElementsByClassName("ladi-gallery-control-item")[0];o.forEach(function(a,n){c=e.getOptimizeImage(a.src,f.clientWidth,f.clientHeight,!0,!1,!1,t),_+="#"+i+' .ladi-gallery .ladi-gallery-view-item[data-index="'+n+'"] {background-image: url("'+c+'");}',c=e.getOptimizeImage(a.src,h.clientWidth,h.clientHeight,!0,!1,!1,t),_+="#"+i+' .ladi-gallery .ladi-gallery-control-item[data-index="'+n+'"] {background-image: url("'+c+'");}'}),l.setAttribute("data-max-item",o.length),e.isEmpty(_)||e.createStyleElement(s,_)}}}};this.runtime.tmp.generateLadiSaleProduct=function(t){var i=function(){u.forEach(function(t){var i=e.runtime.eventData[t];M(t,i.type)})},a=function(n){if(n&&e.isEmpty(t))i();else{var r=t.target,o=e.findAncestor(r,"ladi-element");if(!e.isEmpty(o)){var l=e.findAncestor(o,"ladi-element");if(!e.isEmpty(l)){var s=e.runtime.eventData[l.id];if(!e.isEmpty(s)){var c=s["option.product_id"];if(!e.isEmpty(c)){var d=e.generateVariantProduct(s,!1,null,null,null,null,!0,!0,function(t){a(!1)});if(e.isObject(d)&&e.isObject(d.store_info)&&e.isObject(d.product)){var u=e.getProductVariantIndex(l.id,s),p=document.querySelectorAll('[data-variant="true"]');if(-1!=u)for(var m=0;m',s.innerHTML+=i,e.runEventPlayVideo(l,r,o,!0,!0,!1)),r==e.const.VIDEO_TYPE.direct&&(i='',s.innerHTML+=i,e.runEventPlayVideo(l,r,o,!0,!0,!1))}})}}}(i,n.type,n[e.const.DESKTOP+".option.background-style"],n[e.const.MOBILE+".option.background-style"],n["option.background_video.video_type"],n["option.background_video.video_value"]),I(null,i,n.type,n["option.data_action"],n["option.action_funnel"]),a=n["option.data_action"],e.isEmpty(a)||a.type!=LadiPageScript.const.DATA_ACTION_TYPE.collapse||e.isEmpty(a.action)||!e.isNull(a.collapse_start_is_show)&&a.collapse_start_is_show||window.ladi(a.action).collapse(!1),O(null,i,n.type,n["option.data_hover"]),function(t,i,a,n,r,o,l){if("video"==i&&!e.isEmpty(a)){var s=document.getElementById(t);if(!e.isEmpty(s)){var c=d&&o||!d&&l;if(c){var u=function(){e.playVideo(t,n,a,r,c)},p=e.findAncestor(s,"ladi-popup");e.isEmpty(p)?e.runtime.list_scroll_func[t]=u:(p=e.findAncestor(p,"ladi-element"),e.isArray(e.runtime.list_show_popup_func[p.id])||(e.runtime.list_show_popup_func[p.id]=[]),e.runtime.list_show_popup_func[p.id].push(u))}else{var m=document.querySelectorAll("#"+t+".preload").length>0;m&&e.playVideo(t,n,a,r,!1,m)}s.addEventListener("click",function(i){i.stopPropagation(),n==e.const.VIDEO_TYPE.direct&&"VIDEO"==i.target.tagName||n==e.const.VIDEO_TYPE.youtube&&"IFRAME"==i.target.tagName||e.playVideo(t,n,a,r)})}}}(i,n.type,n["option.video_value"],n["option.video_type"],n["option.video_control"],n[e.const.DESKTOP+".option.video_autoplay"],n[e.const.MOBILE+".option.video_autoplay"]),function(t,i,a,n){"popup"==i&&a&&((e.isEmpty(n)||n<0)&&(n=0),e.runTimeout(function(){window.ladi(t).show()},1e3*n))}(i,n.type,n["option.show_popup_welcome_page"],n["option.delay_popup_welcome_page"]),function(t,i,a,n,r,o,l){if("countdown"==i&&!e.isEmpty(a)){var s=document.getElementById(t);e.isEmpty(s)||(s.setAttribute("data-type",a),a!=e.const.COUNTDOWN_TYPE.countdown||e.isEmpty(n)||s.setAttribute("data-minute",n),a!=e.const.COUNTDOWN_TYPE.endtime||e.isEmpty(l)||s.setAttribute("data-endtime",l),a!=e.const.COUNTDOWN_TYPE.daily||e.isEmpty(r)||e.isEmpty(o)||(s.setAttribute("data-daily-start",r),s.setAttribute("data-daily-end",o)))}}(i,n.type,n["option.countdown_type"],n["option.countdown_minute"],n["option.countdown_daily_start"],n["option.countdown_daily_end"],n["option.countdown_endtime"]),function(t,i,a){if("countdown_item"==i&&!e.isEmpty(a)){var n=document.getElementById(t);e.isEmpty(n)||n.setAttribute("data-item-type",a)}}(i,n.type,n["option.countdown_item_type"]),function(t,i,a,n){if("section"==i){var r=document.getElementById(t);if(!e.isEmpty(r)){var o=r.getElementsByClassName("ladi-section-arrow-down")[0];if(e.isEmpty(o)){if(d){if(e.isEmpty(a))return void r.removeAttribute("data-opacity");var l=(parseFloatLadiPage(a)||0)+50;if(l>r.clientHeight)return void r.removeAttribute("data-opacity");r.style.setProperty("height",l+"px"),r.classList.add("overflow-hidden")}else{if(e.isEmpty(n))return void r.removeAttribute("data-opacity");var s=(parseFloatLadiPage(n)||0)+50;if(s>r.clientHeight)return void r.removeAttribute("data-opacity");r.style.setProperty("height",s+"px"),r.classList.add("overflow-hidden")}(o=document.createElement("div")).className="ladi-section-arrow-down",r.appendChild(o),r.removeAttribute("data-opacity"),o.addEventListener("click",function(t){t.stopPropagation(),r.classList.add("ladi-section-readmore"),r.style.removeProperty("height"),r.classList.remove("overflow-hidden"),o.parentElement.removeChild(o),e.runTimeout(function(){r.classList.remove("ladi-section-readmore"),e.runTimeout(e.removeSticky,100)},1e3*parseFloatLadiPage(getComputedStyle(r).transitionDuration))})}}}}(i,n.type,n[e.const.DESKTOP+".option.readmore_range"],n[e.const.MOBILE+".option.readmore_range"]),function(t,i,a){if("form_item"==i){var n=null;if(a==e.const.INPUT_TYPE.select||a==e.const.INPUT_TYPE.select_multiple)for(var r=document.getElementById(t).getElementsByClassName("ladi-form-control"),o=0;o0;if(n>0){for(var l=0;l0)&&(s=1),i.target.value=s),1==n.product.variants[r].inventory_checked&&(s>l||0==l)&&(i.target.value=l)}}}};r.addEventListener("input",o)}}}}}(i,n.type),function(t,i){if("collection"==i){var a=document.getElementById(t);if(!e.isEmpty(a)){var n=e.runtime.eventData[t];if(!e.isEmpty(n)){var r=n["option.collection_setting.type"],o=a.getElementsByClassName("ladi-collection")[0];if(r==e.const.COLLECTION_TYPE.carousel&&o.classList.add("carousel"),e.loadCollectionData(t,n,1,!0),r==e.const.COLLECTION_TYPE.carousel){var l=document.createElement("div");l.className="ladi-collection-arrow ladi-collection-arrow-left";var s=document.createElement("div");s.className="ladi-collection-arrow ladi-collection-arrow-right",o.appendChild(l),o.appendChild(s),l.addEventListener("click",function(i){i.stopPropagation();var r=parseFloatLadiPage(a.getAttribute("data-page"))||1;r=(r-=1)<1?1:r,e.loadCollectionData(t,n,r,!1)}),s.addEventListener("click",function(i){i.stopPropagation();var r=parseFloatLadiPage(a.getAttribute("data-page"))||1;if(r+=1,a.hasAttribute("data-max-page")){var o=parseFloatLadiPage(a.getAttribute("data-max-page"))||1;r=r>o?o:r}e.loadCollectionData(t,n,r,!1)})}if(r==e.const.COLLECTION_TYPE.readmore){var c=document.createElement("div");c.className="ladi-collection-button-next",o.appendChild(c),c.addEventListener("click",function(i){i.stopPropagation();var r=parseFloatLadiPage(a.getAttribute("data-page"))||1;if(r+=1,a.hasAttribute("data-max-page")){var o=parseFloatLadiPage(a.getAttribute("data-max-page"))||1;r=r>o?o:r}e.loadCollectionData(t,n,r,!1,!0)})}}}}}(i,n.type)):r(n,t).run(i,d)}),R(Date.now()+1e3),function(){var i,a=document.getElementsByClassName("ladi-form"),n=null,l=null,s=null,c=null,d=null,u=null,p=null,m=null,g=null,y=null,_=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],f=["name","email","phone","address","ward","district","state","country"],v=["email","phone"],E=e.copy(e.runtime.list_set_value_name_country).reverse(),L=function(t,i){var a=e.getCookie("_capture_"+t);return e.isEmpty(a)&&(a=i+"|"+e.runtime.ladipage_id+"|"+Date.now()+"|"+e.randomId(),e.setCookie(null,"_capture_"+t,a,3e5/864e5,!1,window.location.pathname)),a},P=function(t,i,a){if(i&&e.isEmpty(n[a]))return!1;var r=[];if(m.forEach(function(t){e.isEmpty(n[t])&&r.push(t)}),i&&(r=r.only([a])),r.length>0)return i||e.showMessage(e.const.LANG.FORM_INPUT_REQUIRED_ERROR,null,function(){var i=t.querySelector('[name="'+r[0]+'"]');e.isEmpty(i)||i.focus()}),!1;var o=!0,l=0,s=function(){var i=t.querySelector('[name="'+g[l].name+'"]');e.isEmpty(i)||i.focus()};for(l=0;l()\\[\\]\\\\.,;:\\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,}))',pattern_flag:"gi",title:e.const.LANG.FORM_INPUT_EMAIL_REGEX}):e.isEmpty(P)||g.push({name:d,pattern:P,title:e.isEmpty(A)?e.const.LANG.FORM_INPUT_TEXT_REGEX:A}),"checkbox"==L){e.isArray(n[d])||(n[d]=[]),a[v].checked&&n[d].push(a[v].value);continue}if("radio"==L){a[v].checked&&(n[d]=a[v].value);continue}}n[d]=a[v].value,a[v].hasAttribute("data-path-file")&&(n[d]=JSON.parse(a[v].getAttribute("data-path-file")),l[d]=!0)}i||f.forEach(function(t){e.isNull(n[t])||(e.setCookie(window.location.host,"_ladipage_"+t,n[t],365),e.isArray(e.runtime.DOMAIN_SET_COOKIE)&&e.runtime.DOMAIN_SET_COOKIE.forEach(function(i){i!=window.location.host&&e.setCookie(i,"_ladipage_"+t,n[t],365)}))}),s=r(n)},S=function(t,i,a){var r={form_config_id:d,ladipage_id:e.runtime.ladipage_id,tracking_form:[],form_data:[],data_key:i};if(t)r.status_send=1;else{r.status_send=2;var o=e.getCookie("_checkout_token");e.isEmpty(o)||(r.checkout_token=o)}e.isEmpty(p)||(r.captcha_token=p),e.isEmpty(u)||(r.total_revenue=u),e.isEmpty(e.runtime.time_zone)||(r.time_zone=e.runtime.time_zone);var s=Object.keys(LadiFormApi);c.forEach(function(t){var i=n[t];e.isArray(i)&&0==i.length&&(i="");var a={name:t,value:i=-1!=s.indexOf(t)?LadiFormApi[t]:i};l[t]&&(a.is_file=!0),r.form_data.push(a)}),(s=s.except(c)).forEach(function(t){r.form_data.push({name:t,value:LadiFormApi[t]})}),r.tracking_form.push({name:"url_page",value:window.location.href}),_.forEach(function(t){var i=y[t];i=e.isNull(i)?"":i,r.tracking_form.push({name:t,value:i})}),r.tracking_form.push({name:"variant_url",value:h}),r.tracking_form.push({name:"variant_content",value:e.generateVariantContentString(b,!0)}),e.isFunction(a)&&a(r)},w=function(t){t.reset();for(var i=t.querySelectorAll(".ladi-element .ladi-form-item-container .ladi-form-checkbox-item input"),a=0;a .ladi-element > .ladi-headline");e.isNull(e.runtime.tmp.form_button_headline[i.id])&&(e.runtime.tmp.form_button_headline[i.id]=t.innerHTML),t.innerHTML="● ● ●"},L=function(){delete e.runtime.tmp.form_sending[i.id],h.querySelector(".ladi-button > .ladi-element > .ladi-headline").innerHTML=e.runtime.tmp.form_button_headline[i.id]};if(a.captcha&&!e.isEmpty(v)&&v["option.form_captcha"]&&e.isObject(e.runtime.tmp.google_captcha))window.grecaptcha?(E(),window.grecaptcha.ready(function(){try{window.grecaptcha.execute(e.runtime.tmp.google_captcha.api_key,{action:"submit"}).then(function(t){L(),N(i,{captcha_token:t},r,o,f)}).catch(function(){O(),L()})}catch(t){O(),L()}})):e.showMessage(e.const.LANG.FORM_CAPTCHA_LOADING);else{var b=v["option.form_send_ladipage"],x=v["option.form_api_data"],D=v["option.thankyou_type"],k=v["option.thankyou_value"],R=v["option.deeplink_value"],B=v["option.form_auto_funnel"],M=v["option.form_thankyou_funnel"];if(e.isEmpty(d))I(h,o);else if(A(h,r),P(h,r,f)){var F=0,V=0,Y=[],q=!1,H=!1,U=!0,j=function(t){t&&w(h),L()},G=function(a,r,o,l){if(o.readyState==XMLHttpRequest.DONE){if(l==e.const.API_FORM_DATA){var c={};try{c=JSON.parse(a)}catch(t){}200==c.code?F++:(V++,U=!1)}else 200==r||201==r?F++:e.getElementAHref(l).host==e.const.DOMAIN_GOOGLE_DOCS?F++:V++;F+V==Y.length&&(U&&!q&&F>=1?(q=!0,function(t,i){var a=null,n=!1,r=function(t,r){n||(e.isFunction(i)&&i(t,r),e.removeTimeout(a),n=!0)};a=e.runTimeout(r,3e3),C("FormSubmit",{total_revenue:t},r)}(u,function(a,r){e.deleteCookie("_capture_"+i.id),e.deleteCookie("_cart_token"),e.deleteCookie("_checkout_token"),e.createCartData(),e.runEventTracking(i.id,!0),j(!0);var o=e.findAncestor(i,"ladi-popup");if(!e.isEmpty(o)){var l=e.findAncestor(o,"ladi-element").id;e.runRemovePopup(l,t)}!function(){var t=0;if(!e.runtime.isDesktop&&!e.isEmpty(R)){t=1e3;var i=e.convertDataReplaceStr(R,!0,null,!1,s);window.ladi(i).open_url()}if(!M||e.isEmpty(T)){if(D==e.const.FORM_THANKYOU_TYPE.default&&(e.isEmpty(k)||e.showMessage(k,s)),D==e.const.FORM_THANKYOU_TYPE.popup&&(B&&e.setDataReplaceElement(!1,!1,s,k),window.ladi(k).show()),D==e.const.FORM_THANKYOU_TYPE.url&&!e.isEmpty(k)){var a=window.ladi(k).get_url(n,B);e.runTimeout(function(){window.ladi(a).open_url()},t)}}else{var r=window.ladi(T).get_url(n,B);e.runTimeout(function(){window.ladi(r).open_url()},t)}}()})):!H&&V>=1&&(H=!0,e.showMessage(e.const.LANG.FORM_SEND_DATA_ERROR),j(!1)))}},W=function(t){Y.push({url:e.const.API_FORM_DATA,data:JSON.stringify(t),async:!0,headers:{"Content-Type":"application/json"},callback:G})};b&&S(r,o,W),e.isArray(x)&&x.forEach(function(t){if(!e.isEmpty(t.api_url)&&e.isArray(t.custom_fields)){var i=e.getElementAHref(t.api_url).host==e.const.DOMAIN_GOOGLE_DOCS,a={};t.custom_fields.forEach(function(t){if(!l[t.ladi_name]){var i=s[t.ladi_name];e.isNull(i)||(e.isArray(i)?0==i.length?a[t.name]="":a[t.name]=JSON.stringify(i):a[t.name]=i)}});var n={};if(!e.isEmpty(t.api_request_header))try{var r=JSON.parse(t.api_request_header);Object.keys(r).forEach(function(t){n[t]=r[t]})}catch(t){}i||(a.link=window.location.href,Object.keys(LadiFormApi).forEach(function(t){a[t]=LadiFormApi[t]}),_.forEach(function(t){var i=y[t];e.isNull(i)||(a[t]=i)}));var o=null,c=t.content_type||e.const.CONTENT_TYPE.form_urlencoded;c==e.const.CONTENT_TYPE.form_urlencoded&&(n["Content-Type"]="application/x-www-form-urlencoded",o=Object.keys(a).reduce(function(t,e){return t.push(e+"="+encodeURIComponent(a[e])),t},[]).join("&")),c==e.const.CONTENT_TYPE.json&&(n["Content-Type"]="application/json",o=JSON.stringify(a)),c==e.const.CONTENT_TYPE.form_data&&(o=new FormData,Object.keys(a).forEach(function(t){o.append(t,a[t])})),Y.push({url:t.api_url,data:o,async:!0,headers:n,callback:G})}}),Y.length>0?E():b?I(h,o):(E(),S(r,o,W)),Y.forEach(function(t){e.sendRequest("POST",t.url,t.data,t.async,t.headers,t.callback)})}}}}},x=function(t){var i=e.findAncestor(t.target,"ladi-element");if(!e.isEmpty(i))for(var a=i.querySelectorAll('[type="checkbox"]'),n=0;n0){s[0].setAttribute("required","required");for(var c=0;cu&&(_=u-e.runtime.tmp.cart[m].quantity),_>0){var f=function(){e.runtime.tmp.cart[m].quantity+=_,e.addCartCookie(t.store_info.id,{type:"LP",product_variant_id:l,quantity:_},null,function(t){e.runtime.tmp.cart[m].quantity-=_,g&&e.runtime.tmp.cart.splice(m,1),e.showMessage(t.message)},function(){e.runtime.tmp.generateCart(),e.changeTotalPriceCart(),e.runtime.tmp.is_click_add_to_cart=!1,0==e.runtime.tmp.cart.length&&(e.deleteCookie("_cart_token"),e.deleteCookie("_checkout_token")),e.runResizeAll()})};if(e.isEmpty(e.getCookie("_cart_token")))if(e.runtime.tmp.is_click_add_to_cart){var h=function(){e.runTimeout(function(){if(e.runtime.tmp.is_click_add_to_cart)return h();r()},100)};h()}else e.runtime.tmp.is_click_add_to_cart=!0,f();else f()}else e.showMessage(e.const.LANG.ADD_TO_CART_NO_QUANTITY)}}else e.showMessage(e.const.LANG.ADD_TO_CART_NO_QUANTITY)}};r()}}}},R=function(t){var i=e.findAncestor(t.target,"ladi-form");if(!e.isEmpty(i)){var a=i.querySelectorAll('[type="submit"]')[0];e.isEmpty(a)||a.click()}},B=function(t){var i=e.findAncestor(t.target,"ladi-form");if(!e.isEmpty(i)){var a=e.findAncestor(i,"ladi-element");if(!e.isEmpty(a)){var n=e.runtime.eventData[a.id];if(!e.isEmpty(n)&&n["option.form_auto_capture"]&&!e.isEmpty(n["option.form_config_id"])){var r=L(a.id,n["option.form_config_id"]);N(a,{captcha:!0},!0,r,t.target.getAttribute("name"))}}}},M={};f.forEach(function(t){M[t]=e.getCookie("_ladipage_"+t),e.isEmpty(o[t])||(M[t]=o[t])}),i=r(M);var F=0,V=!1,Y=function(t){for(var n=a[F].querySelectorAll('.ladi-element .ladi-form-item-container [name="'+t+'"]'),r=0;r0&&(n[r].value=o,V&&n[r].dispatchEvent(new Event("change")));else{if("country"==t&&"true"==n[r].getAttribute("data-is-select-country"))continue;n[r].value=o,V&&n[r].dispatchEvent(new Event("change"))}}};for(F=0;Fz&&(z=J),W[X].setAttribute("tabindex",e.runtime.tabindexForm+J)}e.runtime.tabindexForm+=z;for(var K=0;K'+a.name+""},l=function(t){var i=window.LadiLocation[t.target.getAttribute("data-country")].data[t.target.value.split(":")[0]];n="",e.isEmpty(i)||Object.keys(i.data).forEach(function(t){var e=i.data[t];n+='"});var a=e.findAncestor(t.target,"ladi-element");if(!e.isEmpty(a)){var r=a.querySelector('select[name="district"]');e.isEmpty(r)||(r.setAttribute("data-selected",""),r.innerHTML=r.querySelector("option").outerHTML+n);var o=a.querySelector('select[name="ward"]');e.isEmpty(o)||(o.setAttribute("data-selected",""),o.innerHTML=o.querySelector("option").outerHTML)}},s=function(t){var i=e.findAncestor(t.target,"ladi-element");if(!e.isEmpty(i)){var a=i.querySelector('select[name="ward"]');if(!e.isEmpty(a)){a.setAttribute("data-selected",""),r="";var n=i.querySelector('select[name="state"]');if(!e.isEmpty(n)){var o=n.getAttribute("data-selected");if(!e.isEmpty(o)){o=o.split(":")[0];var l=window.LadiLocation[n.getAttribute("data-country")].data[o];if(!e.isEmpty(l)){var s=l.data[t.target.value.split(":")[0]];e.isEmpty(s)||Object.keys(s.data).forEach(function(t){var e=s.data[t];r+='"})}}}a.innerHTML=a.querySelector("option").outerHTML+r}e.reloadFeeShipping()}};for(F=0;Fe.const.FORM_UPLOAD_FILE_LENGTH)e.showMessage(e.const.LANG.FORM_UPLOAD_FILE_MAX_LENGTH_ERROR,{max_length:e.const.FORM_UPLOAD_FILE_LENGTH});else{for(var n=new FormData,r=0,o=0;o1024*e.const.FORM_UPLOAD_FILE_SIZE*1024)e.showMessage(e.const.LANG.FORM_UPLOAD_FILE_MAX_SIZE_ERROR,{max_size:e.const.FORM_UPLOAD_FILE_SIZE});else{var l={ladipage_id:e.runtime.ladipage_id,lang:e.runtime.lang};n.append("json_data",JSON.stringify(l)),e.showLoadingBlur(),e.sendRequest("POST",e.const.API_FILE_UPLOAD,n,!0,null,function(i,a,n){if(n.readyState==XMLHttpRequest.DONE){if(e.hideLoadingBlur(),200==a)try{var r=JSON.parse(i);if(200==r.code){var o=[],l=[];return r.data.success.forEach(function(t){o.push(t.name),l.push({id:t._id,path:t.path})}),t.value=o.length>0?"["+o.join(", ")+"]":"",void t.setAttribute("data-path-file",JSON.stringify(l))}if(!e.isEmpty(r.message))return void e.showMessage(r.message)}catch(t){}e.showMessage(e.const.LANG.FORM_SEND_DATA_ERROR)}}),e.isFunction(a)&&a()}}}(i,t.target.files,function(){t.target.parentElement.removeChild(t.target)})})),a.click()},a=0;ao)){var u=r-o;u<0&&(u=0);for(var p=e.getCountdownTime(u),m=i.querySelectorAll("[data-item-type]"),g=0;g0&&(r=0),a.getElementsByClassName("ladi-gallery-control-box")[0].style.setProperty("left",r+"px")}else{var l=(parseFloatLadiPage(n.height)||0)+(parseFloatLadiPage(n.marginBottom)||0);(l+=parseFloatLadiPage(a.getElementsByClassName("ladi-gallery-control-box")[0].style.getPropertyValue("top"))||0)>0&&(l=0),a.getElementsByClassName("ladi-gallery-control-box")[0].style.setProperty("top",l+"px")}a.setAttribute("data-next-time",Date.now()+1e3*o)}}),a.getElementsByClassName("ladi-gallery-control-arrow-right")[0].addEventListener("click",function(t){t.stopPropagation();var i=a.getElementsByClassName("ladi-gallery-control-item")[0];if(!e.isEmpty(i)){var n=getComputedStyle(i);if(a.getElementsByClassName("ladi-gallery")[0].classList.contains("ladi-gallery-top")||a.getElementsByClassName("ladi-gallery")[0].classList.contains("ladi-gallery-bottom")){var r=(parseFloatLadiPage(n.width)||0)+(parseFloatLadiPage(n.marginRight)||0);r=-r+(parseFloatLadiPage(a.getElementsByClassName("ladi-gallery-control-box")[0].style.getPropertyValue("left"))||0);var l=parseFloatLadiPage(getComputedStyle(a.getElementsByClassName("ladi-gallery-control-box")[0]).width)||0;r<(l=(l=-(l-=parseFloatLadiPage(getComputedStyle(a.getElementsByClassName("ladi-gallery-control")[0]).width)||0))>0?0:l)&&(r=l),a.getElementsByClassName("ladi-gallery-control-box")[0].style.setProperty("left",r+"px")}else{var s=(parseFloatLadiPage(n.height)||0)+(parseFloatLadiPage(n.marginBottom)||0);s=-s+(parseFloatLadiPage(a.getElementsByClassName("ladi-gallery-control-box")[0].style.getPropertyValue("top"))||0);var c=parseFloatLadiPage(getComputedStyle(a.getElementsByClassName("ladi-gallery-control-box")[0]).height)||0;s<(c=(c=-(c-=parseFloatLadiPage(getComputedStyle(a.getElementsByClassName("ladi-gallery-control")[0]).height)||0))>0?0:c)&&(s=c),a.getElementsByClassName("ladi-gallery-control-box")[0].style.setProperty("top",s+"px")}a.setAttribute("data-next-time",Date.now()+1e3*o)}}),a.getElementsByClassName("ladi-gallery-view")[0].addEventListener("mousedown",s),a.getElementsByClassName("ladi-gallery-view")[0].addEventListener("touchstart",s),a.getElementsByClassName("ladi-gallery-control")[0].addEventListener("mousedown",c),a.getElementsByClassName("ladi-gallery-control")[0].addEventListener("touchstart",c);for(var d=a.getElementsByClassName("ladi-gallery-control-item"),u=0;u0){var l=a.getAttribute("data-next-time"),s=Date.now();e.isEmpty(l)&&(l=s+1e3*(o-1),a.setAttribute("data-next-time",l)),s>=l&&(N(t,!0),a.setAttribute("data-next-time",s+1e3*o))}}}})},1e3),u.forEach(function(t){var i=e.runtime.eventData[t];if("carousel"==i.type){var a=document.getElementById(t);if(!e.isEmpty(a)){a.hasAttribute("data-scrolled")||(a.setAttribute("data-scrolled",!1),e.runtime.list_scroll_func[t]=function(){a.setAttribute("data-scrolled",!0)});var n=i[e.runtime.device+".option.carousel_setting.autoplay"],r=i[e.runtime.device+".option.carousel_setting.autoplay_time"],o=0;n&&!e.isEmpty(r)&&(o=r);var l=function(i){i.stopPropagation(),i=e.getEventCursorData(i),!e.isEmpty(e.runtime.timenext_carousel[t])&&e.runtime.timenext_carousel[t]>Date.now()||(e.runtime.timenext_carousel[t]=Date.now()+864e5,e.runtime.current_element_mouse_down_carousel=t,e.runtime.current_element_mouse_down_carousel_position_x=i.pageX,a.getElementsByClassName("ladi-carousel-content")[0].style.setProperty("transition-duration","0ms"),a.getElementsByClassName("ladi-carousel-content")[0].setAttribute("data-left",getComputedStyle(a.getElementsByClassName("ladi-carousel-content")[0]).left))};a.getElementsByClassName("ladi-carousel-arrow-left")[0].addEventListener("click",function(e){e.stopPropagation(),a.getElementsByClassName("ladi-carousel-content")[0].style.removeProperty("transition-duration"),a.setAttribute("data-is-next",!1),a.setAttribute("data-next-time",Date.now()+1e3*o),k(t,!1)}),a.getElementsByClassName("ladi-carousel-arrow-right")[0].addEventListener("click",function(e){e.stopPropagation(),a.getElementsByClassName("ladi-carousel-content")[0].style.removeProperty("transition-duration"),a.setAttribute("data-is-next",!0),a.setAttribute("data-next-time",Date.now()+1e3*o),k(t,!1)}),a.getElementsByClassName("ladi-carousel")[0].addEventListener("mousedown",l),a.getElementsByClassName("ladi-carousel")[0].addEventListener("touchstart",l)}}}),e.runtime.interval_carousel=e.runInterval(function(){u.forEach(function(t){var i=e.runtime.eventData[t];if("carousel"==i.type){var a=document.getElementById(t);if(!e.isEmpty(a)&&"true"==a.getAttribute("data-scrolled")){var n=i[e.runtime.device+".option.carousel_setting.autoplay"],r=i[e.runtime.device+".option.carousel_setting.autoplay_time"],o=0;if(n&&!e.isEmpty(r)&&(o=r),o>0){var l=a.getAttribute("data-next-time"),s=Date.now();e.isEmpty(l)&&(l=s+1e3*(o-1),a.setAttribute("data-next-time",l)),s>=l&&(k(t,!0),a.setAttribute("data-next-time",s+1e3*o))}}}})},1e3),function(){for(var t=document.querySelectorAll(".ladi-checkout .ladi-button"),i=0;i=d.querySelectorAll("i").length;u(c.querySelectorAll("i")[0],c,f,n),p(d.querySelectorAll("i")[0],d,f,n)}else{var h=e.findAncestor(c,"ladipage-animated-words-wrapper");h.classList.add("selected"),h.classList.remove("waiting"),e.runTimeout(function(){h.classList.remove("selected"),c.classList.remove("is-visible"),c.classList.add("is-hidden");for(var t=c.querySelectorAll("i"),e=0;e'+l+"",o.forEach(function(t){e.isEmpty(t)?r.innerHTML=r.innerHTML+""+l+"":r.innerHTML=r.innerHTML+""+t.trim()+""}),!e.isEmpty(e.findAncestor(r,"type"))||!e.isEmpty(e.findAncestor(r,"loading-bar"))||!e.isEmpty(e.findAncestor(r,"clip"))){r.innerHTML=r.innerHTML+'
';for(var s=getComputedStyle(r).color,c=r.getElementsByClassName("after"),u=0;u"+n[o]+""),n[o]=r?''+n[o]+"":""+n[o]+""}var s=n.join("");a.innerHTML=s,a.style.setProperty("opacity",1)}}(document.querySelectorAll(".letters b")),t.classList.contains("loading-bar"))d=i,e.runTimeout(function(){r.classList.add("is-loading")},a);else if(t.classList.contains("clip")){var p=r.clientWidth+5;r.style.setProperty("width",p+"px")}e.runTimeout(function(){_(t.getElementsByClassName("is-visible")[0])},d)}}}},h=document.getElementsByClassName("ladipage-animated-headline"),v=0;v .ladi-element"),i=function(t){var i=e.findAncestor(t.target,"ladi-button");(i=e.isEmpty(i)?t.target:e.findAncestor(i,"ladi-element")).classList.add("selected");var a=e.findAncestor(t.target,"ladi-button-group");if(!e.isEmpty(a))for(var n=(a=e.findAncestor(a,"ladi-element")).querySelectorAll(".ladi-button-group > .ladi-element"),r=0;r
",document.body.appendChild(t))},LadiPageScriptV2.prototype.hideLoadingBlur=function(){var t=document.getElementsByClassName("ladi-loading")[0];this.isEmpty(t)||t.parentElement.removeChild(t)},LadiPageScriptV2.prototype.loadDataset=function(){},LadiPageScriptV2.prototype.generateVariantContentString=function(t,e,i,a){var n=[];i=this.isEmpty(i)?" | ":i;try{this.isEmpty(t)||(e&&(t=Base64.decode(t)),t=JSON.parse(t),this.isArray(t.dynamic_content.hide)&&t.dynamic_content.hide.length>0&&n.push(this.const.LANG.HIDE_ELEMENT+" "+t.dynamic_content.hide.join(", ")),this.isArray(t.dynamic_content.show)&&t.dynamic_content.show.length>0&&n.push(this.const.LANG.SHOW_ELEMENT+" "+t.dynamic_content.show.join(", ")),this.isArray(t.dynamic_content.top)&&t.dynamic_content.top.length>0&&n.push(this.const.LANG.TOP_ELEMENT+" "+t.dynamic_content.top.join(", ")),this.isArray(t.dynamic_content.scroll)&&t.dynamic_content.scroll.length>0&&n.push(this.const.LANG.SCROLL_ELEMENT+" "+t.dynamic_content.scroll.join(", ")),this.isArray(t.dynamic_content.cookie)&&t.dynamic_content.cookie.length>0&&n.push(this.const.LANG.SET_COOKIE+" "+t.dynamic_content.cookie.join("; ")))}catch(t){}return a?n:n.join(i)},LadiPageScriptV2.prototype.updateHeightElement=function(t,e,i,a,n){for(var r=[],o=[],l=t.parentElement.children,s=0;s=p+i&&(o[m].style.setProperty("top",(parseFloatLadiPage(g+u)||0)+"px"),r.push(o[m].id))}var y=0,_=0;if(!this.isEmpty(e)&&0!=u&&d(e)&&(y=parseFloatLadiPage(getComputedStyle(e).height)||0,_=parseFloatLadiPage(y+u)||0,e.style.setProperty("height",_+"px"),r.push(e.id)),y!=_){var f=this.findAncestor(e.parentElement,"ladi-element");this.isEmpty(f)&&(f=this.findAncestor(e.parentElement,"ladi-section")),r=r.concat(this.updateHeightElement(e,f,y,_,n))}return r.unique()},LadiPageScriptV2.prototype.showParentVisibility=function(t,e){var i=this.findAncestor(t,"ladi-popup");if(!this.isEmpty(i)&&(i=this.findAncestor(i,"ladi-element"),!this.isEmpty(i)))return"none"==getComputedStyle(i).display&&i.classList.add("hide-visibility"),this.isFunction(e)&&e(),void i.classList.remove("hide-visibility");this.isFunction(e)&&e()},LadiPageScriptV2.prototype.pauseAllVideo=function(t){var e=document.getElementById(this.runtime.lightbox_screen_id).getElementsByClassName("lightbox-close")[0];if(!this.isEmpty(e))return e.click(),this.pauseAllVideo(t);delete this.runtime.tmp.gallery_playing_video;for(var i=(t=t||document).querySelectorAll(".iframe-video-preload:not(.no-pause)"),a=0;a0;)c.runtime.list_youtube_ready_exec.shift()()},c.loadScript("//www.youtube.com/iframe_api")),!c.runtime.isYouTubeIframeAPIReady)return void c.runtime.list_youtube_ready_exec.push(f);d.outerHTML=d.outerHTML.replaceAll("",""),d=document.getElementById(t),n&&d.classList.add("opacity-0");var e=function(){(d=document.getElementById(t)).classList.remove("opacity-0")},i=e,u=function(e){d=document.getElementById(t);var i=window.YT.get(t);c.isEmpty(i)||c.isEmpty(d)?c.runTimeout(u,100):(c.runResizeAll(),a?i.mute():i.unMute(),o||l||i.playVideo(),c.isFunction(s)&&s())};new window.YT.Player(t,{videoId:_,playerVars:{rel:0,modestbranding:0,playsinline:n||a?1:0,controls:!n&&r?1:0},events:{onReady:u,onStateChange:function(i){if(y&&i.data==window.YT.PlayerState.PLAYING){y=!1;var a=function(){window.YT.get(t).getCurrentTime()>=.1?e():c.runTimeout(a,100)};n&&a()}i.data==window.YT.PlayerState.ENDED&&window.YT.get(t).playVideo()},onError:i}})}catch(t){}};f()}e==c.const.VIDEO_TYPE.direct&&(c.isEmpty(p)||d.setAttribute("poster",p),d.setAttribute("preload","auto"),d.setAttribute("controlslist","nodownload"),d.setAttribute("loop",""),o||l||d.setAttribute("autoplay",""),(n||a)&&(d.setAttribute("playsinline",""),d.setAttribute("webkit-playsinline","")),!n&&r&&d.setAttribute("controls",""),a?d.setAttribute("muted",""):d.removeAttribute("muted"),d.removeAttribute("src"),d.setAttribute("data-src",i),d.outerHTML=d.outerHTML.replaceAll("data-src=","src="),d=document.getElementById(t),c.isFunction(s)&&s(d))}},LadiPageScriptV2.prototype.playVideo=function(t,e,i,a,n,r){var o=document.getElementById(t);if(!this.isEmpty(o)){var l=document.getElementById(t+"_player");if(r||n||this.pauseAllVideo(),this.isEmpty(l)){var s=o.getElementsByClassName("ladi-video")[0],c=t+"_player";e==this.const.VIDEO_TYPE.youtube&&(s.innerHTML=s.innerHTML+'',this.runEventPlayVideo(c,e,i,n,!1,a,r)),e==this.const.VIDEO_TYPE.direct&&(s.innerHTML=s.innerHTML+'',this.runEventPlayVideo(c,e,i,n,!1,a,r))}else this.runEventReplayVideo(l.id,e,!0)}},LadiPageScriptV2.prototype.checkResizeImage=function(t){var e=[".jpg",".jpeg",".png"],i=function(t){for(var i=!1,a=0;as+1&&(l[s+1]=l[s+1].toLowerCase()),s=l.indexOf(this.const.STATIC_W_DOMAIN.toLowerCase()),this.checkResizeImage(t)&&-1!=s&&(l.length==s+3||l.length==s+6&&"ls"==l[3]&&"product"==l[5]||l.length==s+4&&"luid"==l[3]&&"avatar"==l[4]||l.length==s+4&&"rbg"==l[4])){var c=l[s+1].toLowerCase(),d=!0;if(c.startsWith("s")){var u=c.split("x");2==u.length&&parseFloatLadiPage(u[1])==u[1]&&(d=!1)}if(d){if(o||n){if(e=parseInt(e)||0,i=parseInt(i)||0,a){var p=this.const.RESIZE_RANGE+(r?this.const.RESIZE_ADD_PIXEL_THUMB:this.const.RESIZE_ADD_PIXEL);e=e-e%this.const.RESIZE_RANGE+p,i=i-i%this.const.RESIZE_RANGE+p}}else e=this.const.WIDTH_SECTION_RESIZE[LadiPage.data.device_screen],i=this.const.WIDTH_SECTION_RESIZE[LadiPage.data.device_screen];l.insert(s+1,"s"+e+"x"+i)}}return t=l.join("/")},LadiPageScriptV2.prototype.historyReplaceState=function(t){try{window.history.replaceState(null,null,t)}catch(t){}},LadiPageScriptV2.prototype.resetViewport=function(){this.isEmpty(this.runtime.tmp.timeoutViewport)||this.removeTimeout(this.runtime.tmp.timeoutViewport),this.isFunction(window.ladi_viewport)&&(this.runtime.tmp.timeoutViewport=this.runTimeout(window.ladi_viewport,10))},LadiPageScriptV2.prototype.runResizeSectionBackground=function(){var t=this;t instanceof LadiPageScriptV2||(t=LadiPageScript);try{for(var e=document.querySelectorAll(".ladi-section .ladi-section-background iframe.ladi-section-background-video"),i=0;i .ladi-element"),i=0;i0;){t.runtime.tmp.runAfterLocation.shift()()}t.reloadFeeShipping()},LadiPageScriptV2.prototype.randomId=function(t){var e=Date.now(),i=window.performance&&window.performance.now&&1e3*window.performance.now()||0,a="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var a=16*Math.random();return e>0?(a=(e+a)%16|0,e=Math.floor(e/16)):(a=(i+a)%16|0,i=Math.floor(i/16)),("x"===t?a:3&a|8).toString(16)});if(t)for(;"-"==a[0]||a[0]==parseInt(a[0]);)a=a.substr(1);return a},LadiPageScriptV2.prototype.removeLazyloadPopup=function(t){var e=document.getElementById(t);if(!this.isEmpty(e))for(var i=e.getElementsByClassName("ladi-lazyload");i.length>0;)i[0].classList.remove("ladi-lazyload")},LadiPageScriptV2.prototype.reloadLazyload=function(){var t=this;t instanceof LadiPageScriptV2||(t=LadiPageScript);for(var e=document.getElementsByClassName("ladi-lazyload"),i=[],a=0;an&&n+e[a].offsetHeight>window.scrollY&&i.push(e[a])}i.forEach(function(t){t.classList.remove("ladi-lazyload")});for(var r=document.querySelectorAll(".ladi-gallery .ladi-gallery-view-item.selected:not(.ladi-lazyload)"),o=0;o0;)l[0].classList.remove("ladi-lazyload")}},LadiPageScriptV2.prototype.documentLoaded=function(){var t=this;t instanceof LadiPageScriptV2||(t=LadiPageScript);var e=t.getURLSearchParams(window.location.search,null,!0),i=e.ladishow,a=e.ladihide,n=e.laditop,r=window.location.hash;t.isEmpty(i)?i=[]:t.isArray(i)||(i=i.split(",").removeSpace()),t.isEmpty(a)?a=[]:t.isArray(a)||(a=a.split(",").removeSpace()),t.isEmpty(n)?n=[]:t.isArray(n)||(n=n.split(",").removeSpace().reverse());try{var o=t.getCookie("LADI_CAMP_END_DATE"),l=t.getCookie("LADI_CAMP_CONFIG");if(!t.isEmpty(o)&&!t.isEmpty(l)){l=JSON.parse(Base64.decode(l));var s=((o=parseInt(o)||0)-Date.now())/24/60/60/1e3;if(s>0&&t.isArray(l.dynamic_content.cookie)){var c=[];l.dynamic_content.cookie.forEach(function(e){var i=e.split("=");2!=(i=i.removeSpace()).length||t.isEmpty(i[0])||t.isEmpty(i[1])||c.push({name:i[0],value:i[1]})}),c.forEach(function(e){t.setCookie(null,e.name,e.value,s,!1,window.location.pathname)})}a=l.dynamic_content.hide||[],i=l.dynamic_content.show||[],n=l.dynamic_content.top||[],t.isArray(l.dynamic_content.scroll)&&l.dynamic_content.scroll.length>0&&(r="#"+l.dynamic_content.scroll.pop())}}catch(t){}if(a.forEach(function(t){window.ladi(t).hide()}),i.forEach(function(t){window.ladi(t).show()}),n.forEach(function(t){window.ladi(t).top()}),!t.isEmpty(r))try{var d=document.querySelector(r);t.isEmpty(d)||t.isEmpty(d.id)||t.runTimeout(function(){window.ladi(d.id).scroll()},300)}catch(t){}if(t.resetViewport(),t.runEventScroll(),!t.isEmpty(t.runtime.tracking_global_url)){var u=!1,p=function(){u||(u=!0,t.loadScript(t.runtime.tracking_global_url+"?v="+Date.now()))};document.addEventListener("scroll",p),document.addEventListener("mousemove",p),document.addEventListener("touchstart",p),t.runTimeout(p,t.runtime.tracking_global_delay)}},LadiPageScriptV2.prototype.getWidthDevice=function(){if(this.runtime.isMobileOnly){var t=document.getElementsByClassName("ladi-wraper")[0];if(!this.isEmpty(t))return t.clientWidth}return window.outerWidth>0?window.outerWidth:window.screen.width},LadiPageScriptV2.prototype.getHeightDevice=function(t){return window.outerHeight>0&&!this.runtime.isDesktop&&(t&&window.outerHeight>window.innerHeight||!t&&window.innerHeight>window.outerHeight)?window.outerHeight:window.innerHeight},LadiPageScriptV2.prototype.startAutoScroll=function(t,e,i,a){if(this.runtime.isDesktop?i:a){var n=document.getElementById(t);if(!this.isEmpty(n)&&!n.classList.contains("ladi-auto-scroll")){var r=0;if("section"!=e){if(n.clientWidth<=this.getWidthDevice())return;r=(r=parseFloatLadiPage(getComputedStyle(n).left)||0)>0?0:-1*r}else{for(var o=n.querySelectorAll(".ladi-container > .ladi-element"),l=0;l0?0:-1*r,n.querySelector(".ladi-container").style.setProperty("margin-left",r+"px")}n.classList.add("ladi-auto-scroll"),n.scrollLeft=r}}},LadiPageScriptV2.prototype.getLinkUTMRedirect=function(t,e){var i=this.createTmpElement("a","",{href:t}),a=this.getURLSearchParams(e),n=a.utm_source;if(!this.isEmpty(n)){n="utm_source="+encodeURIComponent(n);var r=a.utm_medium,o=a.utm_campaign,l=a.utm_term,s=a.utm_content;this.isEmpty(r)||(n+="&utm_medium="+encodeURIComponent(r)),this.isEmpty(o)||(n+="&utm_campaign="+encodeURIComponent(o)),this.isEmpty(l)||(n+="&utm_term="+encodeURIComponent(l)),this.isEmpty(s)||(n+="&utm_content="+encodeURIComponent(s)),this.isEmpty(i.href)||this.isEmpty(i.host)||!this.isEmpty(this.getURLSearchParams(i.search,"utm_source"))||(i.search=i.search+(this.isEmpty(i.search)?"?":"&")+n)}return i.href},LadiPageScriptV2.prototype.randomInt=function(t,e){return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t},LadiPageScriptV2.prototype.randomString=function(t){for(var e="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",a=i.length,n=0;n0)return setTimeout(t,e);t()}},LadiPageScriptV2.prototype.removeTimeout=function(t){return clearTimeout(t)},LadiPageScriptV2.prototype.removeInterval=function(t){return clearInterval(t)},LadiPageScriptV2.prototype.runInterval=function(t,e){if(this.isFunction(t))return setInterval(t,e)},LadiPageScriptV2.prototype.deleteCookie=function(t){document.cookie=t+"=; expires = Thu, 01 Jan 1970 00:00:00 GMT; path = /","/"!=window.location.pathname&&(document.cookie=t+"=; expires = Thu, 01 Jan 1970 00:00:00 GMT; path = "+window.location.pathname)},LadiPageScriptV2.prototype.setCookie=function(t,e,i,a,n,r){var o="";if(n)o="0";else{var l=new Date;l.setTime(l.getTime()+24*a*60*60*1e3),o="expires = "+l.toUTCString()}var s=e+" = "+i;this.isEmpty(o)||(s+="; "+o),this.isEmpty(t)||(s+="; domain = "+t),this.isEmpty(r)||this.runtime.isIE||(s+="; path = "+r),document.cookie=s},LadiPageScriptV2.prototype.getCookie=function(t){for(var e=t+"=",i=decodeURIComponent(document.cookie).split(";"),a=0;a0&&(n=0),i.getElementsByClassName("ladi-carousel-content")[0].style.setProperty("left",n+"px"));if(!e.isEmpty(e.runtime.current_element_mouse_down_gallery_view)){i=document.getElementById(e.runtime.current_element_mouse_down_gallery_view),a=t.pageX-e.runtime.current_element_mouse_down_gallery_view_position_x;var o=parseFloatLadiPage(i.getAttribute("data-current"))||0;o==(parseFloatLadiPage(i.getAttribute("data-max-item"))||0)-1&&a<0&&(a=0),a>0&&0==o&&(a=0),a>=e.runtime.current_element_mouse_down_gallery_view_diff?(e.runtime.current_element_mouse_down_gallery_view=null,e.runtime.current_element_mouse_down_gallery_view_position_x=0,i.getElementsByClassName("ladi-gallery-view-arrow-left")[0].click()):a<=-e.runtime.current_element_mouse_down_gallery_view_diff?(e.runtime.current_element_mouse_down_gallery_view=null,e.runtime.current_element_mouse_down_gallery_view_position_x=0,i.getElementsByClassName("ladi-gallery-view-arrow-right")[0].click()):i.querySelectorAll(".ladi-gallery-view-item.selected").length>0&&i.querySelectorAll(".ladi-gallery-view-item.selected")[0].style.setProperty("left",a+"px")}e.isEmpty(e.runtime.current_element_mouse_down_gallery_control)||(i=document.getElementById(e.runtime.current_element_mouse_down_gallery_control),a=t.pageX-e.runtime.current_element_mouse_down_gallery_control_position_x,n=parseFloatLadiPage(i.getElementsByClassName("ladi-gallery-control-box")[0].getAttribute("data-left"))||0,(n+=a)<(r=(parseFloatLadiPage(getComputedStyle(i.getElementsByClassName("ladi-gallery-control")[0]).width)||0)-(parseFloatLadiPage(getComputedStyle(i.getElementsByClassName("ladi-gallery-control-box")[0]).width)||0))&&(n=r),n>0&&(n=0),i.getElementsByClassName("ladi-gallery-control-box")[0].style.setProperty("left",n+"px"))},LadiPageScriptV2.prototype.runEventMouseUp=function(t){t.stopPropagation();var e=this;e instanceof LadiPageScriptV2||(e=LadiPageScript),t=e.getEventCursorData(t);var i=null,a=0;if(!e.isEmpty(e.runtime.current_element_mouse_down_carousel)){delete e.runtime.timenext_carousel[e.runtime.current_element_mouse_down_carousel],a=t.pageX-e.runtime.current_element_mouse_down_carousel_position_x;var n=(i=document.getElementById(e.runtime.current_element_mouse_down_carousel)).getElementsByClassName("ladi-carousel-content")[0].getAttribute("data-left");i.getElementsByClassName("ladi-carousel-content")[0].removeAttribute("data-left"),i.getElementsByClassName("ladi-carousel-content")[0].style.removeProperty("transition-duration"),e.runtime.current_element_mouse_down_carousel=null,a>=e.runtime.current_element_mouse_down_carousel_diff?i.getElementsByClassName("ladi-carousel-arrow-left")[0].click():a<=-e.runtime.current_element_mouse_down_carousel_diff?i.getElementsByClassName("ladi-carousel-arrow-right")[0].click():i.getElementsByClassName("ladi-carousel-content").length>0&&(i.getElementsByClassName("ladi-carousel-content")[0].style.setProperty("transition-duration","100ms"),i.getElementsByClassName("ladi-carousel-content")[0].style.setProperty("left",n),e.runTimeout(function(){i.getElementsByClassName("ladi-carousel-content")[0].style.removeProperty("transition-duration")},1))}e.isEmpty(e.runtime.current_element_mouse_down_gallery_view)||(i=document.getElementById(e.runtime.current_element_mouse_down_gallery_view)).querySelectorAll(".ladi-gallery-view-item.selected").length>0&&i.querySelectorAll(".ladi-gallery-view-item.selected")[0].style.removeProperty("left"),e.isEmpty(e.runtime.current_element_mouse_down_gallery_control)||((i=document.getElementById(e.runtime.current_element_mouse_down_gallery_control)).getElementsByClassName("ladi-gallery-control-box")[0].removeAttribute("data-left"),i.getElementsByClassName("ladi-gallery-control-box")[0].style.removeProperty("transition-duration")),e.runtime.current_element_mouse_down_carousel_position_x=0,e.runtime.current_element_mouse_down_gallery_view=null,e.runtime.current_element_mouse_down_gallery_view_position_x=0;var r=0;e.runtime.current_element_mouse_down_gallery_control_time+e.runtime.current_element_mouse_down_gallery_control_time_click=o&&window.scrollY<=o+n.offsetHeight||window.scrollY+e.getHeightDevice()>=o&&window.scrollY+e.getHeightDevice()<=o+n.offsetHeight||o>=window.scrollY&&window.scrollY+e.getHeightDevice()>=o)&&(c=!0)):(o=e.getElementBoundingClientRect(n).y+window.scrollY,(window.scrollY>=o&&window.scrollY<=o+n.offsetHeight||window.scrollY+e.getHeightDevice(!0)>=o&&window.scrollY+e.getHeightDevice(!0)<=o+n.offsetHeight||o>=window.scrollY&&window.scrollY+e.getHeightDevice(!0)>=o)&&(c=!0)),c&&(l=e.runtime.list_scroll_func[t],delete e.runtime.list_scroll_func[t],l())}var d=a[e.runtime.device+".style.animation-name"];if(!e.isEmpty(d)&&(n=document.getElementById(t),!e.isEmpty(n)&&!n.classList.contains("ladi-animation"))){var u=parseFloatLadiPage(a[e.runtime.device+".style.animation-delay"])||0;o=e.getElementBoundingClientRect(n).y+window.scrollY;var p=window.scrollY>=o&&window.scrollY<=o+n.offsetHeight||window.scrollY+e.getHeightDevice(!0)>=o&&window.scrollY+e.getHeightDevice(!0)<=o+n.offsetHeight||o>=window.scrollY&&window.scrollY+e.getHeightDevice(!0)>=o;e.runtime.tmp.isFirstScroll&&u>0&&!p&&n.classList.add("ladi-animation-hidden"),p&&(n.classList.add("ladi-animation"),e.runTimeout(function(){n.classList.remove("ladi-animation-hidden")},1e3*u))}if(e.isEmpty(i)||-1!=r.indexOf(t)){var m=null,g=null,y=null;if(a[e.runtime.device+".option.sticky"]&&(m=a[e.runtime.device+".option.sticky_position"],g=parseFloatLadiPage(a[e.runtime.device+".option.sticky_position_top"]),y=parseFloatLadiPage(a[e.runtime.device+".option.sticky_position_bottom"])),!e.isEmpty(m)){var _=document.getElementById(t);if(!e.isEmpty(_)&&-1!=["default","top","bottom"].indexOf(m)){var f=e.getElementBoundingClientRect(_),h=_.getAttribute("data-top"),v=_.getAttribute("data-left");e.isEmpty(h)?(_.setAttribute("data-top",f.y+window.scrollY),h=f.y):h=parseFloatLadiPage(h),e.isEmpty(v)?(_.setAttribute("data-left",f.x+window.scrollX),v=f.x):v=parseFloatLadiPage(v);var E=null,L=null;if("default"==m&&(g>h-window.scrollY?(E=g+"px",L=v+"px"):e.getHeightDevice()-y-_.clientHeighth-window.scrollY||e.getHeightDevice()-0h+_.clientHeight-window.scrollY)&&(E="calc(100% - "+(y+_.clientHeight)+"px)",L=v+"px"),e.isEmpty(E)||e.isEmpty(L))_.style.removeProperty("top"),_.style.removeProperty("left"),_.style.removeProperty("width"),_.style.removeProperty("position"),_.style.removeProperty("z-index");else if(_.style.setProperty("top",E),_.style.setProperty("left",L),"section"==a.type&&(e.runtime.isMobileOnly?_.style.setProperty("width",document.getElementsByClassName("ladi-wraper")[0].clientWidth+"px"):s&&_.style.setProperty("width","100%")),_.style.setProperty("position","fixed"),_.style.setProperty("z-index","90000050"),!_.hasAttribute("data-sticky")){_.setAttribute("data-sticky",!0),_.classList.contains("ladi-animation-hidden")&&(_.classList.remove("ladi-animation-hidden"),_.classList.add("ladi-animation"));for(var P=_.getElementsByClassName("ladi-animation-hidden");P.length>0;)P[0].classList.add("ladi-animation"),P[0].classList.remove("ladi-animation-hidden");_.classList.remove("ladi-lazyload");for(var A=_.getElementsByClassName("ladi-lazyload");A.length>0;)A[0].classList.remove("ladi-lazyload")}}}}if("popup"==a.type){if(!e.isEmpty(e.runtime.scroll_show_popup[t]))return;e.isEmpty(a["option.popup_welcome_page_scroll_to"])||(n=document.getElementById(a["option.popup_welcome_page_scroll_to"]),e.isEmpty(n)||(o=n.offsetTop,(window.scrollY>=o&&window.scrollY<=o+n.offsetHeight||window.scrollY+e.getHeightDevice()>=o&&window.scrollY+e.getHeightDevice()<=o+n.offsetHeight||o>=window.scrollY&&window.scrollY+e.getHeightDevice()>=o)&&(e.runtime.scroll_show_popup[t]=!0,window.ladi(t).show())))}if("section"==a.type){if(!e.isEmpty(e.runtime.scroll_to_section[t]))return;n=document.getElementById(t),e.isEmpty(n)||(o=n.offsetTop,(window.scrollY>=o&&window.scrollY<=o+n.offsetHeight||window.scrollY+e.getHeightDevice()>=o&&window.scrollY+e.getHeightDevice()<=o+n.offsetHeight||o>=window.scrollY&&window.scrollY+e.getHeightDevice()>=o)&&(e.runtime.scroll_to_section[t]=!0,e.runEventTracking(t,!1)))}}),e.runtime.isClient)for(var c=Math.round((window.scrollY+e.getHeightDevice())/document.body.clientHeight*100),d=1;de.const.PERCENT_TRACKING_SCROLL[d-1]&&c<=e.const.PERCENT_TRACKING_SCROLL[d]&&-1==e.runtime.scroll_depth.indexOf(e.const.PERCENT_TRACKING_SCROLL[d])&&(e.runtime.scroll_depth.push(e.const.PERCENT_TRACKING_SCROLL[d]),e.isFunction(window.gtag)&&window.gtag("event","ScrollDepth_"+e.const.PERCENT_TRACKING_SCROLL[d]+"_percent",{event_category:"LadiPageScrollDepth",event_label:window.location.host+window.location.pathname,non_interaction:!0}),e.isFunction(window.fbq)&&window.fbq("trackCustom","ScrollDepth_"+e.const.PERCENT_TRACKING_SCROLL[d]+"_percent"));e.runtime.tmp.isFirstScroll=!1}},LadiPageScriptV2.prototype.runRemovePopup=function(t,e,i,a){var n=this,r=document.querySelectorAll("#"+this.runtime.builder_section_popup_id+" .ladi-container > .ladi-element"),o=!1;e||LadiPagePlugin.getPlugin("popup").removeStyleShowPopupBuilder();var l=function(){var t=document.getElementById("style_popup");n.isEmpty(t)||t.parentElement.removeChild(t)},s=[];if(this.isEmpty(t))for(var c=0;c .ladi-element"),d=0;d0;){this.runtime.list_show_popup_func[t].shift()()}o.style.setProperty("display","block","important");var p=o.hasAttribute("data-scroll"),m=!1;if(!p&&o.clientHeight>.9*this.getHeightDevice()&&(a?(o.setAttribute("data-scroll",!0),o.style.setProperty("overflow-y","auto","important"),o.style.setProperty("overflow-x","hidden","important"),p=!0):m=!0),p&&a&&(o.getElementsByClassName("ladi-popup")[0].style.removeProperty("height"),o.style.removeProperty("max-height"),o.getElementsByClassName("ladi-popup")[0].style.setProperty("height",o.clientHeight+"px","important"),o.style.setProperty("max-height",.9*this.getHeightDevice()+"px")),a||LadiPagePlugin.getPlugin("popup").styleShowPopupBuilderUpDown(t,m),s.isEmpty(r)||this.createStyleElement("style_popup",r),a&&!this.isEmpty(o)){var g=o.getElementsByClassName("popup-close")[0];this.isEmpty(g)&&((g=document.createElement("div")).className="popup-close",o.appendChild(g),g.addEventListener("click",function(e){e.stopPropagation(),s.runRemovePopup(t,a)})),o.getElementsByClassName("popup-close")[0].style.setProperty("display","block","important");var y=function(){var t=o.getElementsByClassName("popup-close")[0];if(!s.isEmpty(t)){var e=s.getElementBoundingClientRect(o),i=e.y,a=window.innerWidth-e.x-e.width;p&&(a+=s.runtime.widthScrollBar),t.style.setProperty("right",a+"px"),t.style.setProperty("top",i+"px"),t.style.setProperty("position","fixed")}};p&&(y(),o.hasAttribute("data-resize-scroll")||(o.setAttribute("data-resize-scroll",!0),window.addEventListener("resize",y)))}a&&!u&&this.runEventTracking(t,!1),s.runTimeout(function(){delete s.runtime.tmp.is_run_show_popup,s.runEventScroll()},c)}}},LadiPageScriptV2.prototype.runEventTracking=function(t,e){if(this.runtime.isClient&&!this.isEmpty(t)){var i=this.runtime.eventData[t],a=i.type,n=null,r=null,o=null,l=null,s=null,c=this.runtime.currency;if(e&&"form"==a?(n=i["option.form_conversion_name"],r=i["option.form_google_ads_conversion"],o=i["option.form_google_ads_label"],l=i["option.form_event_custom_script"],s=this.isEmpty(i["option.form_purchase_value"])?null:parseFloatLadiPage(i["option.form_purchase_value"])||0):(n=i["option.conversion_name"],r=i["option.google_ads_conversion"],o=i["option.google_ads_label"],l=i["option.event_custom_script"]),this.isFunction(window.fbq)&&!this.isEmpty(n)){var d="trackCustom";-1!=["AddPaymentInfo","AddToCart","AddToWishlist","CompleteRegistration","Contact","CustomizeProduct","Donate","FindLocation","InitiateCheckout","Lead","PageView","Purchase","Schedule","Search","StartTrial","SubmitApplication","Subscribe","ViewContent"].indexOf(n)&&(d="track");var u=null;this.isEmpty(s)||this.isEmpty(c)||((u={}).value=s,u.currency=c),window.fbq(d,n,u)}if(this.isFunction(window.gtag)&&(this.isEmpty(r)||this.isEmpty(o)||window.gtag("event","conversion",{send_to:"AW-"+r+"/"+o}),!this.isEmpty(n))){var p="";p="section"==a?"LadiPageSection":"popup"==a?"LadiPagePopup":"form"==a?"LadiPageConversion":"LadiPageClick";var m=LadiPageApp[i.type+this.const.APP_RUNTIME_PREFIX];if(!this.isEmpty(m)){var g=m(i,this.runtime.isClient);this.isFunction(g.getEventTrackingCategory)&&(p=m(i,this.runtime.isClient).getEventTrackingCategory())}var y={event_category:p,event_label:window.location.host+window.location.pathname};this.isEmpty(s)||this.isEmpty(c)||(y.value=s,y.currency=c),window.gtag("event",n,y)}this.isEmpty(l)||this.runFunctionString(l)}},LadiPageScriptV2.prototype.runFunctionString=function(t){try{new Function(t)()}catch(t){}},LadiPageScriptV2.prototype.reloadFeeShipping=function(){var t=this;t instanceof LadiPageScriptV2||(t=LadiPageScript),t.isEmpty(t.runtime.tmp.timeout_reload_fee_shipping)||t.removeTimeout(t.runtime.tmp.timeout_reload_fee_shipping);var e=function(e){t.runtime.tmp.add_to_cart_fee_shipping=e,t.changeTotalPriceCart()};t.runtime.tmp.timeout_reload_fee_shipping=t.runTimeout(function(){var i=t.getCookie("_cart_token"),a=t.getCookie("_checkout_token");if(t.isEmpty(i)||t.isEmpty(a))e(0);else{var n=document.getElementsByClassName("ladi-checkout")[0];if(t.isEmpty(n))e(0);else{var r=null,o=n.querySelector('.ladi-form-item select[name="state"]'),l=n.querySelector('.ladi-form-item select[name="district"]');if(t.isEmpty(o)||t.isEmpty(l))e(0);else{var s=o.value,c=l.value;if(t.isEmpty(s)||t.isEmpty(c))return void e(0);(r={state_id:s.split(":")[0],district_id:c.split(":")[0]}).state_id=parseInt(r.state_id)||r.state_id,r.district_id=parseInt(r.district_id)||r.district_id}}}},1e3)},LadiPageScriptV2.prototype.reloadPriceDiscount=function(t){var e=this;if(e instanceof LadiPageScriptV2||(e=LadiPageScript),!(e.runtime.tmp.is_click_check_price_discount||e.isEmpty(t)&&e.isEmpty(e.runtime.tmp.current_use_coupon))){e.isEmpty(e.runtime.tmp.timeout_reload_price_discount)||e.removeTimeout(e.runtime.tmp.timeout_reload_price_discount);var i=function(t){e.runtime.tmp.add_to_cart_total_discount=t,e.runtime.tmp.is_click_check_price_discount=!1,e.changeTotalPriceCart()};e.runtime.tmp.timeout_reload_price_discount=e.runTimeout(function(){var a=e.getCookie("_cart_token"),n=e.getCookie("_checkout_token");if(e.isEmpty(a)||e.isEmpty(n))i(0);else{var r=e.isEmpty(t)?document.getElementsByClassName("ladi-checkout")[0]:e.findAncestor(t.target,"ladi-checkout");if(e.isEmpty(r))i(0);else{var o={"Content-Type":"application/json","cart-token":a},l=null,s=r.querySelector('.ladi-form-item input[name="email"]'),c=r.querySelector('.ladi-form-item input[name="coupon"]');if(e.isEmpty(s)||e.isEmpty(c))i(0);else{var d=s.value,u=c.value;if(e.isEmpty(u))return void i(0);if(e.isEmpty(t)&&u!=e.runtime.tmp.current_use_coupon)return void i(0);l={discount_code:u,email:d},e.runtime.tmp.is_click_check_price_discount=!0,e.runtime.tmp.current_use_coupon=null,e.sendRequest("POST",e.const.API_LADISALE_VALIDATE_DISCOUNT.format(n),JSON.stringify(l),!0,o,function(a,n,r){if(r.readyState==XMLHttpRequest.DONE){if(200==n)try{var o=JSON.parse(a);if(200==o.code)return e.isEmpty(o.data.discount_error)?e.runtime.tmp.current_use_coupon=u:e.isEmpty(t)||e.showMessage(o.data.discount_error),void i(o.data.discount_price)}catch(t){}i(0)}})}}}},e.isEmpty(t)?1e3:0)}},LadiPageScriptV2.prototype.addCartCookie=function(t,e,i,a,n){var r=this.getCookie("_cart_token"),o={"Content-Type":"application/json","store-id":t};this.isEmpty(r)||(o["cart-token"]=r);var l=this,s={};this.sendRequest("POST",this.const.API_LADISALE_ADD,JSON.stringify(e),!0,o,function(t,e,r){if(r.readyState==XMLHttpRequest.DONE){if(200==e)try{if(200==(s=JSON.parse(t)).code)return l.setCookie(null,"_cart_token",s.data.cart_token,30,!1,window.location.pathname),l.setCookie(null,"_checkout_token",s.data.checkout_token,30,!1,window.location.pathname),l.isFunction(i)&&i(),l.isFunction(n)&&n(),l.reloadPriceDiscount(),void l.reloadFeeShipping()}catch(t){}l.isFunction(a)&&a(s),l.isFunction(n)&&n()}})},LadiPageScriptV2.prototype.updateCartCookie=function(t,e,i,a){var n=this.getCookie("_cart_token"),r={"Content-Type":"application/json"};this.isEmpty(n)||(r["cart-token"]=n);var o=this,l={};this.sendRequest("POST",this.const.API_LADISALE_UPDATE,JSON.stringify(t),!0,r,function(t,n,r){if(r.readyState==XMLHttpRequest.DONE){if(200==n)try{if(200==(l=JSON.parse(t)).code)return o.isFunction(e)&&e(),o.isFunction(a)&&a(),o.reloadPriceDiscount(),void o.reloadFeeShipping()}catch(t){}o.isFunction(i)&&i(l),o.isFunction(a)&&a()}})},LadiPageScriptV2.prototype.createCartData=function(){this.runtime.tmp.cart=[],this.runtime.tmp.add_to_cart_total_discount=0,this.runtime.tmp.add_to_cart_fee_shipping=0;var t=this,e=function(){t.runtime.tmp.generateCart(),t.changeTotalPriceCart(),t.runResizeAll()},i=this.getCookie("_cart_token"),a={"Content-Type":"application/json"};if(!this.isEmpty(i))return a["cart-token"]=i,void this.sendRequest("GET",this.const.API_LADISALE_SHOW,null,!0,a,function(i,a,n){if(n.readyState==XMLHttpRequest.DONE){if(200==a)try{var r=JSON.parse(i);200==r.code&&r.data.items.forEach(function(e){var i=t.isEmpty(e.src)?"":e.src;t.isEmpty(i)||(i="https://"+t.const.STATIC_W_DOMAIN+"/"+i),-1==t.runtime.tmp.cart.findIndex(function(t){return t.store_id==e.store_id&&t.product_id==e.product_id&&t.product_variant_id==e.product_variant_id})&&t.runtime.tmp.cart.push({store_id:e.store_id,product_id:e.product_id,product_variant_id:e.product_variant_id,name:e.product_name,title:e.option_name,price:e.price,image:i,quantity:e.quantity,inventory_checked:e.inventory_checked,available_quantity:e.available_quantity,currency:r.data.store_info.currency})})}catch(t){}e()}});e()},LadiPageScriptV2.prototype.changeTotalPriceCart=function(){var t=0,e=0;this.runtime.tmp.cart.forEach(function(i){t+=i.price*i.quantity,e+=i.quantity}),t=t<0?0:t;var i=this.runtime.tmp.add_to_cart_fee_shipping||0,a=this.runtime.tmp.add_to_cart_total_discount||0,n=t+i-a;n=n<0?0:n;var r=this.formatNumber(t,3),o=this.formatNumber(n,3),l=this.formatNumber(i,3),s=this.formatNumber(a,3);if(this.runtime.tmp.cart.length>0&&!this.isEmpty(this.runtime.tmp.cart[0].currency)&&!this.isEmpty(this.runtime.tmp.cart[0].currency.symbol)){var c=this.runtime.tmp.cart[0].currency.symbol;r=this.formatCurrency(t,c,!0),o=this.formatCurrency(n,c,!0),l=this.formatCurrency(i,c,!0),s=this.formatCurrency(a,c,!0)}this.setDataReplaceStr("cart_total_price",r),this.setDataReplaceStr("cart_total_checkout_price",o),this.setDataReplaceStr("cart_fee_shipping",l),this.setDataReplaceStr("cart_total_discount",s),this.setDataReplaceStr("cart_total_quantity",e),this.setDataReplaceElement(!1)},LadiPageScriptV2.prototype.removeAddToCartProduct=function(t){var e=this.runtime.tmp.cart.findIndex(function(e){return e.product_variant_id==t}),i=this;-1!=e&&this.updateCartCookie({type:"LP",product_variant_id:t,quantity:0},function(){i.runtime.tmp.cart.splice(e,1),i.runtime.tmp.generateCart(),i.changeTotalPriceCart(),0==i.runtime.tmp.cart.length&&(i.deleteCookie("_cart_token"),i.deleteCookie("_checkout_token")),i.runResizeAll()},function(t){i.showMessage(t.message)})},LadiPageScriptV2.prototype.buttonAddToCartProductQuantity=function(t,e){if(0!=this.runtime.tmp.cart.length){var i=this.findAncestor(t,"ladi-cart-quantity");if(!this.isEmpty(i)){var a=i.querySelector("input");if(!this.isEmpty(a)){var n=parseInt(a.value)||0;a.value=n+el&&(o=l),o<=0&&(o=0,l>0&&(o=1))}else o=o<=0?1:o;this.runtime.tmp.cart[a].quantity=o,t.value=o}var s=this.runtime.tmp.cart[a].quantity;if(r==s)return void(t.value=r);this.updateCartCookie({type:"LP",product_variant_id:this.runtime.tmp.cart[a].product_variant_id,quantity:s},null,function(t){n.runtime.tmp.cart[a].quantity-=s-r,n.showMessage(t.message)},function(){n.changeTotalPriceCart();var i=n.runtime.tmp.cart[a].price*n.runtime.tmp.cart[a].quantity,r=n.formatNumber(i,3);n.isObject(n.runtime.tmp.cart[a].currency)&&!n.isEmpty(n.runtime.tmp.cart[a].currency.symbol)&&(r=n.formatCurrency(i,n.runtime.tmp.cart[a].currency.symbol,!0));for(var o=document.querySelectorAll('.ladi-cart-price [data-product-variant-id="'+e+'"]'),l=0;l'+e+"";else{n.forEach(function(e){var n=a.getOptimizeImage(e.image,60,60,!0,!1,!0,i);r+='',t==a.const.CART_LAYOUT.viewonly&&(r+=''+e.quantity+""),r+="",r+=''+e.name+''+e.title+"",t==a.const.CART_LAYOUT.editable&&(r+='
'),r+='';var o=e.price*e.quantity,l=a.formatNumber(o,3);a.isObject(e.currency)&&!a.isEmpty(e.currency.symbol)&&(l=a.formatCurrency(o,e.currency.symbol,!0)),r+=l+"",t==a.const.CART_LAYOUT.editable&&(r+='',r+="")})}return r+=""},LadiPageScriptV2.prototype.getProductVariantIndex=function(t,e){var i=this,a=-1,n=e["option.product_type"],r=e["option.ladisale_store_id"]||null,o=e["option.product_id"],l=i.generateVariantProduct(e,!1,null,null,null,null,!0,!0);if(!(i.isObject(l)&&i.isObject(l.store_info)&&i.isObject(l.product)&&i.isArray(l.product.variants)))return a;this.runtime.isClient?Object.keys(this.runtime.eventData).forEach(function(e){if((i.isEmpty(t)||t==e)&&-1==a){var s=i.runtime.eventData[e];if("form"==s.type&&s["option.is_add_to_cart"]&&s["option.product_type"]==n&&s["option.product_id"]==o&&s["option.ladisale_store_id"]==r){var c=document.getElementById(e);if(!i.isEmpty(c)){var d=c.querySelector('[data-variant="true"]');if(!i.isEmpty(d)){var u=i.runtime.eventData[d.id];if(!i.isEmpty(u)){if(u["option.product_variant_type"]==i.const.PRODUCT_VARIANT_TYPE.combobox){var p=d.querySelectorAll(".ladi-form-item [data-product-variant-id]");a=l.product.variants.findIndex(function(t){for(var e=!0,i=null,a=function(t){return t==i},n=0;n=10?"":"0")+t}if(r.isObject(s)&&r.isObject(s.product)){var d=null;if(o==r.const.FORM_CONFIG_TYPE.ladisales){if(-1!=["name","description"].indexOf(l)&&(d=s.product[l],t=d),-1!=["image"].indexOf(l)&&(d=s.product[l],r.isObject(d)&&(t=d.src,r.isEmpty(t)||(t="https://"+r.const.STATIC_W_DOMAIN+"/"+t))),-1!=["images"].indexOf(l)&&(d=s.product[l],r.isArray(d)&&(t=[],d.forEach(function(e){r.isEmpty(e.src)||t.push({src:"https://"+r.const.STATIC_W_DOMAIN+"/"+e.src})}))),r.isArray(s.product.variants)&&s.product.variants.length>0){var u=a?0:r.getProductVariantIndex(null,i);if(-1!=u){var p=s.product.variants[u];if(-1!=["title","sku"].indexOf(l)&&(d=p[l],t=d),-1!=["text_quantity"].indexOf(l)&&(d=1==p.inventory_checked?p[l]:"",t=d),-1!=["weight"].indexOf(l)&&(d=p[l],r.isEmpty(p.weight_unit)||(d+=p.weight_unit),t=d),-1!=["price"].indexOf(l)&&(d=r.formatNumber(p[l],3),r.isObject(s.store_info)&&r.isObject(s.store_info.currency)&&!r.isEmpty(s.store_info.currency.symbol)&&(d=r.formatCurrency(p[l],s.store_info.currency.symbol,!0)),t=d),-1!=["src"].indexOf(l)){if(d=p[l],r.isEmpty(d)){if("src"==l){var m=r.copy(i);return m["option.product_mapping_name"]="image",r.generateProductKey(t,e,m,!1,n)}}else d="https://"+r.const.STATIC_W_DOMAIN+"/"+d;t=d}}}}else{if(d=s.product[l],r.isBoolean(d))d=d?r.const.LANG.OPTION_TRUE:r.const.LANG.OPTION_FALSE;else try{var g=new Date(d);g.toISOString()==d&&(d=g.getFullYear()+"-"+c(g.getMonth()+1)+"-"+c(g.getDate())+" "+c(g.getHours())+":"+c(g.getMinutes())+":"+c(g.getSeconds()))}catch(t){}t=d}!e&&r.isFunction(n)&&n(t)}return t},LadiPageScriptV2.prototype.generateVariantProduct=function(t,e,i,a,n,r,o,l,s){var c=e?"":null,d=this,u=t["option.product_type"],p=t["option.ladisale_store_id"]||null,m=t["option.product_id"],g=t["option.data_setting.value"],y=t["option.data_setting.type_dataset"],_=t["option.data_setting.sort_name"],f=t["option.data_setting.sort_by"],h=null,v=null;if(u==d.const.FORM_CONFIG_TYPE.ladisales){if(!d.isEmpty(m)&&!d.isEmpty(p)){if(d.isEmpty(d.runtime.tmp.product_info[p])&&(d.runtime.tmp.product_info[p]={}),d.isEmpty(d.runtime.tmp.timeout_product_info[p])&&(d.runtime.tmp.timeout_product_info[p]={}),m=parseInt(m)||m,h=d.runtime.tmp.product_info[p][m],v=function(){if(!e)return d.isObject(h)?h:null;var t="";if(d.isObject(h)){if(!d.isObject(h.product))return t;i==d.const.PRODUCT_VARIANT_TYPE.combined&&(t+='
"),i==d.const.PRODUCT_VARIANT_TYPE.combobox&&d.isArray(h.product.options)&&h.product.options.forEach(function(e){0!=e.values.length&&(t+='
',d.isEmpty(a)||(t+='
'+e.name+"
"),t+='
")})}return t},d.isNull(h)){d.runtime.tmp.product_info[p][m]=!0;var E={product_id:m};return d.sendRequest("POST",d.const.API_SHOW_PRODUCT,JSON.stringify(E),!0,{"Content-Type":"application/json","Store-Id":p},function(t,e,i){if(i.readyState==XMLHttpRequest.DONE)try{if(d.isObject(d.runtime.tmp.product_info[p][m]))h=d.runtime.tmp.product_info[p][m];else{var a=JSON.parse(t);h=a.data}d.isObject(h)?(d.runtime.tmp.product_info[p][m]=h,c=v(),d.isFunction(s)&&s(c)):(d.runtime.tmp.product_info[p][m]=!1,d.isEmpty(d.runtime.tmp.timeout_product_info[p][m])||(d.removeTimeout(d.runtime.tmp.timeout_product_info[p][m]),delete d.runtime.tmp.timeout_product_info[p][m]))}catch(t){d.runtime.tmp.product_info[p][m]=!1,d.isEmpty(d.runtime.tmp.timeout_product_info[p][m])||(d.removeTimeout(d.runtime.tmp.timeout_product_info[p][m]),delete d.runtime.tmp.timeout_product_info[p][m])}}),c}!0===h?d.runtime.tmp.timeout_product_info[p][m]=d.runTimeout(function(){d.generateVariantProduct(t,e,i,a,n,r,o,!1,s)},100):(c=v(),!l&&d.isFunction(s)&&s(c))}}else if(!d.isEmpty(m)){if(d.isEmpty(d.runtime.tmp.product_info[p])&&(d.runtime.tmp.product_info[p]={}),d.isEmpty(d.runtime.tmp.timeout_product_info[p])&&(d.runtime.tmp.timeout_product_info[p]={}),m+="",h=d.runtime.tmp.product_info[p][m],v=function(){return e?"":d.isObject(h)?h:null},d.isNull(h))return d.runtime.tmp.product_info[p][m]=!0,d.loadDataset(g,g,y,_,f,!0,d.runtime.isClient,function(t){c=v(),d.isFunction(s)&&s(c)}),c;!0===h?d.runtime.tmp.timeout_product_info[p][m]=d.runTimeout(function(){d.generateVariantProduct(t,e,i,a,n,r,o,!1,s)},100):(c=v(),!l&&d.isFunction(s)&&s(c))}return c},LadiPageScriptV2.prototype.getListProductByTagId=function(t,e,i,a,n){var r=this,o=t["option.product_type"],l=t["option.ladisale_store_id"]||null,s=t["option.product_tag_id"],c=t["option.data_setting.value"],d=t["option.data_setting.type_dataset"],u=t["option.collection_setting.type"],p=t["option.data_setting.sort_name"],m=t["option.data_setting.sort_by"],g=null,y=null,_=null,f=null,h=null;if(r.isArray(s)&&s.length>0&&!r.isEmpty(l)){if(r.isEmpty(r.runtime.tmp.product_tag_info[o])&&(r.runtime.tmp.product_tag_info[o]={}),r.isEmpty(r.runtime.tmp.timeout_product_tag_info[o])&&(r.runtime.tmp.timeout_product_tag_info[o]={}),s.sort(),_=JSON.stringify(s)+"_page_"+i+"_limit_"+e,f=r.runtime.tmp.product_tag_info[o][_],y=function(){var t=null;return r.isObject(f)&&r.isArray(f.products)&&(t={products:f.products,total_record:f.total_record},r.isEmpty(r.runtime.tmp.product_info[l])&&(r.runtime.tmp.product_info[l]={}),t.products.forEach(function(t){r.runtime.tmp.product_info[l][t.product_id]={store_info:f.store_info,product:t}})),t},r.isNull(f)){r.runtime.tmp.product_tag_info[o][_]=!0;var v={product_tag_ids:s,limit:e};return r.isEmpty(u)?v.type="group":v.paged=i,r.sendRequest("POST",r.const.API_COLLECTION_PRODUCT,JSON.stringify(v),!0,{"Content-Type":"application/json","Store-Id":l},function(t,e,i){if(i.readyState==XMLHttpRequest.DONE)try{var a=JSON.parse(t);f=a.data,r.isObject(f)?(r.runtime.tmp.product_tag_info[o][_]=f,g=y(),r.isFunction(n)&&n(g)):(r.runtime.tmp.product_tag_info[o][_]=!1,r.isEmpty(r.runtime.tmp.timeout_product_tag_info[o][_])||(r.removeTimeout(r.runtime.tmp.timeout_product_tag_info[o][_]),delete r.runtime.tmp.timeout_product_tag_info[o][_]))}catch(t){r.runtime.tmp.product_tag_info[o][_]=!1,r.isEmpty(r.runtime.tmp.timeout_product_tag_info[o][_])||(r.removeTimeout(r.runtime.tmp.timeout_product_tag_info[o][_]),delete r.runtime.tmp.timeout_product_tag_info[o][_])}}),g}}else r.isEmpty(c)||(y=function(){var t=null;if(r.isArray(h)){var a=r.copy(h);t={products:a=a.splice((i-1)*e,e),total_record:h.length},r.isEmpty(r.runtime.tmp.product_info[l])&&(r.runtime.tmp.product_info[l]={}),h.forEach(function(t){r.runtime.tmp.product_info[l][t.id]={store_info:{},product:t}})}return t},h=r.loadDataset(c,c,d,p,m,!0,r.runtime.isClient,function(t){h=t,g=y(),r.isFunction(n)&&n(g)}));return r.isFunction(y)&&(!0===f?r.runtime.tmp.timeout_product_tag_info[o][_]=r.runTimeout(function(){r.getListProductByTagId(t,e,i,!1,n)},100):(g=y(),!a&&r.isFunction(n)&&n(g))),g},LadiPageScriptV2.prototype.loadCollectionData=function(t,e,i,a,n){var r=this,o=e["option.product_type"],l=e["option.ladisale_store_id"],s=e["option.product_tag_id"],c=e["option.collection_setting.type"],d=r.runtime.eventData[t];if(!r.isEmpty(d)&&"collection"==d.type){var u=this.runtime.isDesktop?this.const.DESKTOP:this.const.MOBILE,p=d[u+".option.collection_setting.row"],m=d[u+".option.collection_setting.column"],g=function(t,e){var i=e["option.product_id"],a=JSON.stringify(e),n=null;if(r.isEmpty(i)||a!==(n=r.generateProductKey(a,!0,e,!0,function(i){g(t,e)}))){var o=null,l=e.type,s=null;if("headline"==l&&(s=t.getElementsByClassName("ladi-headline")[0],r.isEmpty(s)||(s.innerHTML=n)),"paragraph"==l&&(s=t.getElementsByClassName("ladi-paragraph")[0],r.isEmpty(s)||(s.innerHTML=n)),"image"==l){o=r.getOptimizeImage(n,t.clientWidth,t.clientHeight,!0,!1,!1,!0);var c=t.getElementsByClassName("ladi-image-background")[0];r.isEmpty(c)||(r.isEmpty(o)?c.style.setProperty("background-image","none"):c.style.setProperty("background-image",'url("'+o+'")'))}}},y=function(t,e){var d=p*m,u=r.getListProductByTagId(e,d,i,!0,function(){y(t,e)});if(r.isObject(u)&&r.isArray(u.products)){var _=document.getElementById(t);if(r.isEmpty(_))return;if(_.getAttribute("data-page")==i)return;var f=i,h=!1;if(!r.isEmpty(u.total_record)&&i*d>=u.total_record){if(c==r.const.COLLECTION_TYPE.readmore){var v=_.getElementsByClassName("ladi-collection-button-next")[0];r.isEmpty(v)||v.setAttribute("data-opacity","0")}_.setAttribute("data-max-page",f),h=!0}if(_.setAttribute("data-page",i>f?f:i),f0;)b[0].parentElement.removeChild(b[0]);for(var T=0;TT)){var C=document.createElement("div");C.className=P.className,w.appendChild(C),C.innerHTML=P.innerHTML;for(var I=C.getElementsByClassName("ladi-element"),O=0;O0?(n!=o.length?n>1&&(i=-(n-1)+"00%"):i="calc(-"+(n-1)+"00% + (100% / "+m+" * "+s+"))",a="calc("+o.length+"00% - (100% / "+m+" * "+s+"))",c+="#"+t+" .ladi-collection-content .ladi-collection-page.last {",c+="width: calc("+getComputedStyle(e).width+" / "+m+" * "+s+");",c+="}"):(n>1&&(i=-(n-1)+"00%"),a=o.length+"00%");var d="style_collection_"+t,u=document.getElementById(d);r.isEmpty(u)||u.parentElement.removeChild(u);var p="#"+t+" .ladi-collection-content {";p+="width: "+a+";",p+="left: "+i+";",p+="}",p+=c,r.createStyleElement(d,p)}}(t),n&&c==r.const.COLLECTION_TYPE.readmore&&function(t){var e=document.getElementById(t);if(!r.isEmpty(e)){var i=e.getElementsByClassName("ladi-collection-content")[0];if(e.hasAttribute("data-max-page")){var a=i.querySelector(".ladi-collection-page.last"),n=a.getElementsByClassName("ladi-collection-item"),o=Math.ceil(n.length/m);a.style.setProperty("height",(parseFloatLadiPage((parseFloatLadiPage(getComputedStyle(a).height)||0)/p*o)||0)+"px")}var l=parseFloatLadiPage(getComputedStyle(e).height)||0,s=i.scrollHeight;if(l!=s){e.style.setProperty("height",s+"px");var c=r.findAncestor(e.parentElement,"ladi-element");r.isEmpty(c)&&(c=r.findAncestor(e.parentElement,"ladi-section")),r.updateHeightElement(e,c,l,s)}}}(t),r.runResizeAll()}},_=d["option.product_tag_id"],f=d["option.data_setting.value"];!r.isArray(_)&&r.isEmpty(f)||y(t,d)}},LadiPageScriptV2.prototype.formatCurrency=function(t,e,i,a){var n={VND:"{0}đ",USD:"${0}",EUR:"€{0}",GBP:"₤{0}",CNY:"¥{0}",MYR:"RM{0}",THB:"฿{0}",IDR:"Rp {0}"};if(a)return this.isEmpty(n[e])?e:n[e].format("").trim();var r=this.formatNumber(t,3,null,{VND:0,USD:2,EUR:2,GBP:2,CNY:0,MYR:0,THB:0,IDR:0}[e]||0);return i&&(r=this.isEmpty(n[e])?r+" "+e:n[e].format(r)),r},LadiPageScriptV2.prototype.formatNumber=function(t,e,i,a){if(void 0!=t){void 0==i&&(i=0),void 0==a&&(a=0);var n="\\d(?=(\\d{"+(e||3)+"})+"+(a>0?"\\.":"$")+")";t=t.toFixed(Math.max(0,~~a)).replace(new RegExp(n,"g"),"$&,");var r=null,o=null;i>=1&&(o=(r=t.split("."))[0],t=o=new Array(i-o.length+1).join("0")+o,2==r.length&&(t+="."+r[1])),a>=1&&2==(r=t.split(".")).length&&(o=r[1],o=new Array(a-o.length+1).join("0")+o,t=r[0]+"."+o)}return t},LadiPageScriptV2.prototype.setDataReplaceStr=function(t,e){this.runtime.replaceStr[t]=e},LadiPageScriptV2.prototype.getDataReplaceStr=function(t,e){var i=null;return this.isNull(e)||(i=e[t]),this.isNull(i)&&(i=this.runtime.replaceStr[t]),i},LadiPageScriptV2.prototype.highlightText=function(t,e,i,a){if(!this.isEmpty(t)&&0!=e.length){var n=i?"gi":"g",r=[];e.forEach(function(t){r.push(t.replaceAll("|","\\|"))}),r.sort(function(t,e){return e.length-t.length});var o=this;Array.from(t.childNodes).forEach(function(t){var l=new RegExp(r.join("|"),n);if(3!==t.nodeType)o.highlightText(t,e,i,a);else if(l.test(t.textContent)){var s=document.createDocumentFragment(),c=0;t.textContent.replace(l,function(e,i){var n=document.createTextNode(t.textContent.slice(c,i)),r=null;o.isFunction(a)?r=a(e):(r=document.createElement("span")).textContent=e,s.appendChild(n),s.appendChild(r),c=i+e.length});var d=document.createTextNode(t.textContent.slice(c));s.appendChild(d),t.parentNode.replaceChild(s,t)}})}},LadiPageScriptV2.prototype.convertDataReplaceStr=function(t,e,i,a,n){for(var r=this,o=t,l=new RegExp(r.runtime.replacePrefixStart+"[^"+r.runtime.replacePrefixStart+"$"+r.runtime.replacePrefixEnd+"]*"+r.runtime.replacePrefixEnd,"gi"),s=null,c=[],d=function(t){if(a)c.push(t);else{var i=t,l=i.split("|");i=l[0].substr(r.runtime.replacePrefixStart.length),1==l.length&&(i=i.substr(0,i.length-r.runtime.replacePrefixEnd.length));var s=r.getDataReplaceStr(i,n);if(r.isEmpty(s))if(l.length>1){var d=r.randomInt(1,l.length-1);s=l[d],d==l.length-1&&(s=s.substr(0,s.length-r.runtime.replacePrefixEnd.length))}else s="";e&&(s=encodeURIComponent(s)),o=o.replaceAll(t,s)}};null!==(s=l.exec(t));)s.index===l.lastIndex&&l.lastIndex++,s.forEach(d);return c=c.unique(),r.highlightText(i,c,!0,function(t){var e=document.createElement("span");return e.setAttribute("data-replace-str",t),e}),o},LadiPageScriptV2.prototype.setDataReplaceElement=function(t,e,i,a,n){for(var r=this.isEmpty(a)?document:document.getElementById(a),o=r.querySelectorAll("span[data-replace-str]"),l=0;l0?(t.pageX=t.touches[0].pageX,t.pageY=t.touches[0].pageY):!this.isEmpty(t.targetTouches)&&t.targetTouches.length>0?(t.pageX=t.targetTouches[0].pageX,t.pageY=t.targetTouches[0].pageY):!this.isEmpty(t.changedTouches)&&t.changedTouches.length>0&&(t.pageX=t.changedTouches[0].pageX,t.pageY=t.changedTouches[0].pageY)),t},LadiPageScriptV2.prototype.getElementAHref=function(t,e){var i=document.createElement("a");return!e||t.toLowerCase().startsWith("http://")||t.toLowerCase().startsWith("https://")||(t="http://"+t),i.href=t,i},LadiPageScriptV2.prototype.loadScript=function(t,e,i,a){var n=document.createElement("script");(n.type="text/javascript",i&&(n.async=!0),this.isObject(e))&&Object.keys(e).forEach(function(t){n[t]=e[t]});n.addEventListener("load",a),n.src=t,document.head.appendChild(n)},LadiPageScriptV2.prototype.isObject=function(t){return!this.isFunction(t)&&!this.isArray(t)&&t instanceof Object},LadiPageScriptV2.prototype.isArray=function(t){return t instanceof Array},LadiPageScriptV2.prototype.isFunction=function(t){return"function"==typeof t||t instanceof Function},LadiPageScriptV2.prototype.isBoolean=function(t){return"boolean"==typeof t},LadiPageScriptV2.prototype.isString=function(t){return"string"==typeof t||t instanceof String},LadiPageScriptV2.prototype.isEmpty=function(t){return!!this.isNull(t)||(this.isString(t)?0==(t=t.trim()).length||"undefined"==t.toLowerCase():!!this.isArray(t)&&0==t.length)},LadiPageScriptV2.prototype.isNull=function(t){return void 0===t||void 0==t};var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(t){var e,i,a,n,r,o,l,s="",c=0;for(t=Base64._utf8_encode(t);c>2,r=(3&e)<<4|(i=t.charCodeAt(c++))>>4,o=(15&i)<<2|(a=t.charCodeAt(c++))>>6,l=63&a,isNaN(i)?o=l=64:isNaN(a)&&(l=64),s=s+Base64._keyStr.charAt(n)+Base64._keyStr.charAt(r)+Base64._keyStr.charAt(o)+Base64._keyStr.charAt(l);return s},decode:function(t){var e,i,a,n,r,o,l="",s=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");s>4,i=(15&n)<<4|(r=Base64._keyStr.indexOf(t.charAt(s++)))>>2,a=(3&r)<<6|(o=Base64._keyStr.indexOf(t.charAt(s++))),l+=String.fromCharCode(e),64!=r&&(l+=String.fromCharCode(i)),64!=o&&(l+=String.fromCharCode(a));return l=Base64._utf8_decode(l)},_utf8_encode:function(t){t=t.replace(/\r\n/g,"\n");for(var e="",i=0;i127&&a<2048?(e+=String.fromCharCode(a>>6|192),e+=String.fromCharCode(63&a|128)):(e+=String.fromCharCode(a>>12|224),e+=String.fromCharCode(a>>6&63|128),e+=String.fromCharCode(63&a|128))}return e},_utf8_decode:function(t){for(var e="",i=0,a=0,n=0,r=0;i191&&a<224?(r=t.charCodeAt(i+1),e+=String.fromCharCode((31&a)<<6|63&r),i+=2):(r=t.charCodeAt(i+1),n=t.charCodeAt(i+2),e+=String.fromCharCode((15&a)<<12|(63&r)<<6|63&n),i+=3);return e}},LadiPageScript=LadiPageScript||new LadiPageScriptV2;LadiPageScript.init();var LadiFormApi=LadiFormApi||{},parseFloatLadiPage=function(t,e){var i=parseFloat(t);return parseFloat(LadiPageScript.formatNumber(i,21,null,e||6))},lightbox_run=function(t,e,i,a,n,r,o,l){var s=document.getElementById(LadiPageScript.runtime.lightbox_screen_id);if(!LadiPageScript.isEmpty(s)){var c=JSON.stringify({html:t,url:e,is_video:i,video_type:r,video_value:o}),d=Object.keys(LadiPageScript.runtime.list_lightbox_id);-1==d.indexOf(c)&&(LadiPageScript.runtime.list_lightbox_id[c]=d.length+1);var u=LadiPageScript.runtime.list_lightbox_id[c];n=n+"_"+u;var p=document.getElementById(n),m=!1;LadiPageScript.isEmpty(p)?(p=document.createElement("div"),s.appendChild(p),p.outerHTML=t,p=s.lastChild,m=!0):i&&LadiPageScript.runEventReplayVideo(n,r,!0);var g=document.createElement("div");g.className="lightbox-close",g.setAttribute("data-hidden",!0),s.appendChild(g),p.setAttribute("id",n),p.setAttribute("data-hidden",!0),p.classList.remove("lightbox-hidden");var y=function(){if(p=p=document.getElementById(n),!LadiPageScript.isEmpty(p)){if("IFRAME"==p.tagName){var t=parseFloatLadiPage(getComputedStyle(p).width)||0,e=parseFloatLadiPage(getComputedStyle(p).height)||0;if(t>0||e>0){var i=.9*document.body.clientWidth,a=.9*LadiPageScript.getHeightDevice(),r=i,o=e/t*r;o>a&&(r=(o=a)*(t/e)),p.style.setProperty("width",(parseFloatLadiPage(r)||0)+"px"),p.style.setProperty("height",(parseFloatLadiPage(o)||0)+"px")}}if(g=s.getElementsByClassName("lightbox-close")[0],!LadiPageScript.isEmpty(g)){var l=LadiPageScript.getElementBoundingClientRect(p),c=10,d=10;l.x-5-g.clientWidth>d&&(d=l.x-5-g.clientWidth),l.y-5-g.clientHeight>c&&(c=l.y-5-g.clientHeight),d+=LadiPageScript.runtime.widthScrollBar,g.style.setProperty("right",d+"px"),g.style.setProperty("top",c+"px")}}},_=function(){LadiPageScript.runTimeout(function(){p=p=document.getElementById(n),LadiPageScript.isEmpty(p)||(p.setAttribute("data-opacity",0),p.removeAttribute("data-hidden")),g=s.getElementsByClassName("lightbox-close")[0],LadiPageScript.isEmpty(g)||(g.setAttribute("data-opacity",0),g.removeAttribute("data-hidden")),y(),LadiPageScript.isEmpty(p)||p.removeAttribute("data-opacity"),LadiPageScript.isEmpty(g)||g.removeAttribute("data-opacity")},100)};g.style.setProperty("top","-100px"),g.style.setProperty("right","-100px");var f="load";if(i&&r==LadiPageScript.const.VIDEO_TYPE.direct&&(f="loadedmetadata"),m&&(p.addEventListener(f,_),p.addEventListener("error",_)),i){var h=e;r==LadiPageScript.const.VIDEO_TYPE.youtube&&(e=null,h=o),m?LadiPageScript.runEventPlayVideo(n,r,h,!1,!1,!0,!1,l,function(t){LadiPageScript.isEmpty(t)?_():(t.addEventListener(f,_),t.addEventListener("error",_))}):_()}l||s.style.setProperty("display","block"),LadiPageScript.isEmpty(e)||(m?p.src=e:_());var v=function(){var t=document.getElementById(LadiPageScript.runtime.backdrop_popup_id);return LadiPageScript.isEmpty(t)||"none"==getComputedStyle(t).display},E=0;v()?(E=window.scrollY,LadiPageScript.runtime.tmp.bodyScrollY=E):E=LadiPageScript.runtime.tmp.bodyScrollY;var L=function(){s.style.removeProperty("display"),p=p=document.getElementById(n),LadiPageScript.isEmpty(p)||(a&&!i?p.parentElement.removeChild(p):(p.classList.add("lightbox-hidden"),i&&LadiPageScript.runEventReplayVideo(n,r,!1))),g=s.getElementsByClassName("lightbox-close")[0],LadiPageScript.isEmpty(g)||g.parentElement.removeChild(g);var t=document.getElementById("style_lightbox");LadiPageScript.isEmpty(t)||t.parentElement.removeChild(t);var e=v();e&&!LadiPageScript.isEmpty(LadiPageScript.runtime.tmp.bodyScrollY)&&window.scrollTo(0,LadiPageScript.runtime.tmp.bodyScrollY),e&&(LadiPageScript.runtime.tmp.bodyScrollY=null)};if(g.addEventListener("click",function(t){t.stopPropagation(),L()}),!l){var P="body {";P+="position: fixed !important;",P+="width: 100% !important;",P+="top: -"+E+"px",P+="}",LadiPageScript.createStyleElement("style_lightbox",P)}LadiPageScript.isEmpty(s.getAttribute("data-load-event"))&&(s.setAttribute("data-load-event",!0),s.addEventListener("click",function(t){t.stopPropagation(),t.target.id==s.id&&(g=s.getElementsByClassName("lightbox-close")[0],LadiPageScript.isEmpty(g)||g.click())}),window.addEventListener("resize",y)),l&&L()}},lightbox_iframe=function(t,e,i,a,n,r){if(!LadiPageScript.isEmpty(t)){var o="margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; max-width: 90%; max-height: 90%;",l='',s=t,c=LadiPageScript.createTmpElement("iframe",s,null,!0);LadiPageScript.isEmpty(c)||"IFRAME"!=c.tagName||(s=c.src,i=c.id||i,c.removeAttribute("src"),c.setAttribute("style",o),c.classList.add("lightbox-item"),l=c.outerHTML),lightbox_run(l,s,e,!0,i,a,n,r)}},lightbox_image=function(t){if(!LadiPageScript.isEmpty(t)){lightbox_run('',t,!1,!1,"lightbox_image")}},lightbox_video=function(t,e,i){if(!LadiPageScript.isEmpty(t)&&!LadiPageScript.isEmpty(e)){LadiPageScript.pauseAllVideo();var a="lightbox_player";if(e==LadiPageScript.const.VIDEO_TYPE.youtube&&lightbox_iframe('',!0,a,e,t,i),e==LadiPageScript.const.VIDEO_TYPE.direct){lightbox_run('',t,!0,!1,a,e,null,i)}}},LadiPageLibraryV2=LadiPageLibraryV2||function(){};LadiPageLibraryV2.prototype.get_url=function(t,e){if(!LadiPageScript.isEmpty(this.id)){var i=this.id,a="";if(e&&LadiPageScript.isObject(t))Object.keys(t).forEach(function(e){LadiPageScript.isEmpty(a)||(a+="&"),a+=e+"="+encodeURIComponent(t[e])});if(!LadiPageScript.isEmpty(a)){var n=LadiPageScript.createTmpElement("a","",{href:i});n.search=n.search+(LadiPageScript.isEmpty(n.search)?"?":"&")+a,i=n.href}return i=LadiPageScript.getLinkUTMRedirect(i,window.location.search),i=LadiPageScript.convertDataReplaceStr(i,!0,null,!1,t)}},LadiPageLibraryV2.prototype.open_url=function(t){if(!LadiPageScript.isEmpty(this.id)){var e=this.id;LadiPageScript.isEmpty(t)||"_self"==t.toLowerCase()?window.location.href=e:window.open(e,t)}},LadiPageLibraryV2.prototype.submit=function(){var t=document.getElementById(this.id);if(!LadiPageScript.isEmpty(t)){var e=t.querySelector('.ladi-form button[type="submit"]');LadiPageScript.isEmpty(e)||e.click()}},LadiPageLibraryV2.prototype.scroll=function(){var t=document.getElementById(this.id);if(!LadiPageScript.isEmpty(t)){for(var e=document.querySelectorAll("#"+LadiPageScript.runtime.builder_section_popup_id+" .ladi-container > .ladi-element"),i=0;i ."+["ladi-button .ladi-headline","ladi-headline","ladi-paragraph","ladi-list-paragraph"].join(", #"+this.id+" > .")),i=document.querySelectorAll("#"+this.id+" > ."+["ladi-form-item-container .ladi-form-item > input","ladi-form-item-container .ladi-form-item > textarea","ladi-form-item-container .ladi-form-item > select"].join(", #"+this.id+" > .")),a=document.querySelectorAll("#"+this.id+" > ."+["ladi-form-item-container .ladi-form-checkbox-item > input"].join(", #"+this.id+" > .")),n=0;for(n=0;n0&&r[0]==a[n].value&&(o=!0),o?a[n].checked||a[n].click():a[n].checked&&a[n].click()}}},LadiPageLibraryV2.prototype.top=function(){var t=document.getElementById(this.id);if(!LadiPageScript.isEmpty(t)&&t.classList.contains("ladi-section"))try{t.parentElement.insertBefore(t,t.parentElement.firstChild),LadiPageScript.reloadLazyload()}catch(t){}},LadiPageLibraryV2.prototype.pause=function(){var t=document.getElementById(this.id);if(!LadiPageScript.isEmpty(t)){var e=LadiPageScript.runtime.eventData[this.id];if(!LadiPageScript.isEmpty(e)&&"video"==e.type){var i=t.querySelector(".iframe-video-preload:not(.no-pause)");LadiPageScript.isEmpty(i)||LadiPageScript.runEventReplayVideo(i.id,i.getAttribute("data-video-type"),!1)}}},LadiPageLibraryV2.prototype.play=function(){var t=document.getElementById(this.id);if(!LadiPageScript.isEmpty(t)){var e=LadiPageScript.runtime.eventData[this.id];if(!LadiPageScript.isEmpty(e)&&"video"==e.type){var i=e["option.video_type"],a=e["option.video_value"],n=e["option.video_control"];LadiPageScript.playVideo(this.id,i,a,n)}}},LadiPageLibraryV2.prototype.prev=function(){var t=document.getElementById(this.id);if(!LadiPageScript.isEmpty(t)){var e=LadiPageScript.runtime.eventData[this.id];if(!LadiPageScript.isEmpty(e)){var i=null;"gallery"==e.type&&(i=t.querySelector(".ladi-gallery-view-arrow.ladi-gallery-view-arrow-left")),"carousel"==e.type&&(i=t.querySelector(".ladi-carousel-arrow.ladi-carousel-arrow-left")),"collection"==e.type&&(i=t.querySelector(".ladi-collection-arrow.ladi-collection-arrow-left")),LadiPageScript.isEmpty(i)||i.click()}}},LadiPageLibraryV2.prototype.next=function(){var t=document.getElementById(this.id);if(!LadiPageScript.isEmpty(t)){var e=LadiPageScript.runtime.eventData[this.id];if(!LadiPageScript.isEmpty(e)){var i=null;"gallery"==e.type&&(i=t.querySelector(".ladi-gallery-view-arrow.ladi-gallery-view-arrow-right")),"carousel"==e.type&&(i=t.querySelector(".ladi-carousel-arrow.ladi-carousel-arrow-right")),"collection"==e.type&&(i=t.querySelector(".ladi-collection-arrow.ladi-collection-arrow-right, .ladi-collection-button-next")),LadiPageScript.isEmpty(i)||i.click()}}},LadiPageLibraryV2.prototype.index=function(t){var e=document.getElementById(this.id);if(!LadiPageScript.isEmpty(e)){var i=LadiPageScript.runtime.eventData[this.id];if(!LadiPageScript.isEmpty(i)){var a=0;if("gallery"!=i.type&&"carousel"!=i.type||(a=parseFloatLadiPage(e.getAttribute("data-current"))||0,a+=1),"collection"==i.type&&(a=parseFloatLadiPage(e.getAttribute("data-page"))||1),LadiPageScript.isEmpty(t))return a;"gallery"!=i.type&&"carousel"!=i.type||(t-=1,a-=1),t!=a&&(t>a?("gallery"!=i.type&&"carousel"!=i.type||e.setAttribute("data-current",t-1),"collection"==i.type&&e.setAttribute("data-page",t-1),this.next()):("gallery"!=i.type&&"carousel"!=i.type||e.setAttribute("data-current",t+1),"collection"==i.type&&e.setAttribute("data-page",t+1),this.prev()))}}},LadiPageLibraryV2.prototype.hide=function(){var t=document.getElementById(this.id);LadiPageScript.isEmpty(t)||(0==t.getElementsByClassName("ladi-popup").length?(t.style.setProperty("display","none","important"),LadiPageScript.reloadLazyload()):LadiPageScript.runRemovePopup(this.id,!0,function(){for(var t=document.querySelectorAll("#"+LadiPageScript.runtime.builder_section_popup_id+" .ladi-container > .ladi-element"),e=0;e .ladi-element"),e=0;e=t.length?0:i+1];n.hasOwnProperty(f[a].key)&&(u.querySelectorAll(f[a].className)[0].src=LadiPageScript.isEmpty(n[f[a].key].$t)?_:n[f[a].key].$t)}LadiPageScript.runtime.tmp.timeout_notify[e]=LadiPageScript.runTimeout(c,y-500)};LadiPageScript.runtime.tmp.timeout_notify[e]=LadiPageScript.runTimeout(function(){h(),LadiPageScript.runtime.tmp.timeout_notify[e]=LadiPageScript.runTimeout(E,500)},g)}else v(t)};LadiPageScript.runtime.tmp.timeout_notify[e]=LadiPageScript.runTimeout(c,y)},E=function(t){u.querySelector(".ladi-notify").classList.remove("ladi-hidden"),u.classList.add("ladi-notify-transition"),v(t)};LadiPageScript.isEmpty(d)||E(d),LadiPageScript.isEmpty(c)||LadiPageScript.sendRequest("GET","https://spreadsheets.google.com/feeds/list/"+c+"/1/public/values?alt=json",null,!0,null,function(t,e,i){if(i.readyState==XMLHttpRequest.DONE&&200==e){var a=JSON.parse(t).feed.entry;E(a)}})}},new i},(LadiPageAppV2=LadiPageAppV2||function(){}).prototype.spinlucky_runtime=function(t,e){var i=function(){},a=function(t){return parseFloatLadiPage(LadiPageScript.getCookie("_total_turn_"+t))||0};return i.prototype.getEventTrackingCategory=function(){return"LadiPageFinish"},i.prototype.run=function(e,i){var n=t["option.spinlucky_setting.list_value"],r=t.dataset_value,o=t["option.spinlucky_setting.result_popup_id"],l=t["option.spinlucky_setting.result_message"],s=t["option.spinlucky_setting.max_turn"],c=a(e);if(!LadiPageScript.isEmpty(n)||!LadiPageScript.isEmpty(r)){n=n||r,LadiPageScript.setDataReplaceStr("spin_turn_left",s-c);var d=document.getElementById(e),u=d.getElementsByClassName("ladi-spin-lucky-start")[0],p=d.getElementsByClassName("ladi-spin-lucky-screen")[0],m="";n.forEach(function(t,e){var i=Base64.decode(t).split("|");if(3==i.length){var a=360/n.length*e+180/n.length,r="rotate("+(a*=-1)+"deg) translateY(-50%)";m+='
'+i[1].trim()+"
"}}),p.innerHTML=m;var g=!1;u.addEventListener("click",function(t){if(t.stopPropagation(),!g)if((c=a(e))>=s)LadiPageScript.showMessage(LadiPageScript.const.LANG.GAME_MAX_TURN_MESSAGE.format(s));else{g=!0;var i=[],r=0,d=1;n.forEach(function(t,e){var a=Base64.decode(t).split("|"),n=a[0].trim(),o=a[1].trim(),l=parseFloatLadiPage(a[2].trim())||0;i.push({min:d,max:d+l-1,value:n,text:o,percent:l,index:e}),d+=l,r+=l});for(var u=LadiPageScript.randomInt(1,r),m=null,y=0;y=u){m=i[y];break}if(LadiPageScript.isEmpty(m))g=!1;else{var _=parseFloatLadiPage(p.getAttribute("data-rotate"))||0,f=m.index*(360/i.length)+360*(4+Math.ceil(_/360))+180/i.length,h="rotate("+f+"deg)";p.setAttribute("data-rotate",f),p.style.setProperty("transform",h),p.style.setProperty("-webkit-transform",h),"NEXT_TURN"!=m.value.toUpperCase()&&(c++,LadiPageScript.setCookie(null,"_total_turn_"+e,c,1,!1,window.location.pathname));LadiPageScript.runTimeout(function(){"NEXT_TURN"==m.value.toUpperCase()?LadiPageScript.isEmpty(m.text)||LadiPageScript.showMessage(m.text):(LadiPageScript.setDataReplaceStr("coupon",m.value),LadiPageScript.setDataReplaceStr("coupon_code",m.value),LadiPageScript.setDataReplaceStr("coupon_text",m.text),LadiPageScript.setDataReplaceStr("spin_turn_left",s-c),LadiPageScript.setDataReplaceElement(!0,!1,null,null,["coupon","coupon_code","coupon_text","spin_turn_left"]),o==LadiPageScript.const.GAME_RESULT_TYPE.default?LadiPageScript.isEmpty(l)||LadiPageScript.showMessage(l):window.ladi(o).show(),LadiPageScript.runEventTracking(e,!1)),g=!1},1e3*parseFloatLadiPage(getComputedStyle(p).transitionDuration)+1e3)}}})}},i.prototype.start=function(t){var e=document.getElementById(t);if(!LadiPageScript.isEmpty(e)&&e.getElementsByClassName("ladi-spin-lucky").length>0){var i=e.getElementsByClassName("ladi-spin-lucky-start")[0];LadiPageScript.isEmpty(i)||i.click()}},i.prototype.add_turn=function(e){var i=t["option.spinlucky_setting.max_turn"],n=a(e);n>0&&n--,LadiPageScript.setCookie(null,"_total_turn_"+e,n,1,!1,window.location.pathname),LadiPageScript.setDataReplaceStr("spin_turn_left",i-n),LadiPageScript.setDataReplaceElement(!1)},new i}; LadiPageScript.runtime.lang="vi",LadiPageScript.const.LANG={ALERT_TITLE:"Alert",ALERT_BUTTON_TEXT:"OK",GAME_RESULT_MESSAGE:"Chúc mừng bạn nhận được {{coupon_text}}. Nhập mã: {{coupon_code}} để sử dụng. Bạn còn {{spin_turn_left}} lượt quay.",GAME_MAX_TURN_MESSAGE:"Bạn đã hết lượt quay.",FORM_SEND_DATA_ERROR:"Đã xảy ra lỗi, vui lòng thử lại!",FORM_SEND_DATA_NO_CONFIG:"Vui lòng kiểm tra lại cấu hình Form!",FORM_UPLOAD_FILE_MAX_SIZE_ERROR:"Bạn chỉ được upload file tổng dung lượng tối đa {{max_size}}MB.",FORM_UPLOAD_FILE_MAX_LENGTH_ERROR:"Bạn chỉ được upload tối đa {{max_length}} file.",FORM_CAPTCHA_ERROR:"Mã xác thực Captcha không đúng!",FORM_CAPTCHA_LOADING:"Vui lòng chờ xác thực Captcha trong giây lát!",FORM_THANKYOU_MESSAGE_DEFAULT:"Cảm ơn bạn đã quan tâm!",FORM_INPUT_REQUIRED_ERROR:"Vui lòng nhập đầy đủ các trường thông tin!",FORM_INPUT_EMAIL_REGEX:"Vui lòng nhập đúng định dạng email!",FORM_INPUT_TEXT_REGEX:"Vui lòng nhập đúng định dạng!",ADD_TO_CART_NO_QUANTITY:"Sản phẩm đã hết số lượng!",ADD_TO_CART_QUANTITY_REQUIRED:"Vui lòng nhập số lượng!",ADD_TO_CART_NO_PRODUCT:"Không tìm thấy thông tin sản phẩm, vui lòng thử lại sau!",HIDE_ELEMENT:"Ẩn phần tử",SHOW_ELEMENT:"Hiện phần tử",TOP_ELEMENT:"Kéo Section lên đầu",SCROLL_ELEMENT:"Kéo tới Section",SET_COOKIE:"Thiết lập Cookie",OPTION_TRUE:"Có",OPTION_FALSE:"Không"};