(function(){function s(e,o,t,r){Object.defineProperty(e,o,{get:t,set:r,enumerable:!0,configurable:!0})}var ct=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{},ke={},xe={},a=ct.parcelRequire94c2;a==null&&(a=function(e){if(e in ke)return ke[e].exports;if(e in xe){var o=xe[e];delete xe[e];var t={id:e,exports:{}};return ke[e]=t,o.call(t.exports,t,t.exports),t.exports}var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r},a.register=function(o,t){xe[o]=t},ct.parcelRequire94c2=a);var C=a.register;C("jHnDr",function(e,o){s(e.exports,"register",function(){return t},function(d){return t=d}),s(e.exports,"resolve",function(){return r},function(d){return r=d});var t,r,n=new Map;function i(d,l){for(var u=0;u`tolstoy${(0,c.uppercaseFirstChar)(h)}`,T=h=>{(0,c.verifyUserConsent)()&&(O(h),g(h))},g=h=>{const{data:{name:N,text:A,facebookAnalyticsID:x,playlist:y,collectInfoType:H}}=h;if(!window.fbq||!x||!y)return;const k=`tolstoy-${y}`;switch(N){case t.PLAYER_EVENT_NAMES.sessionStart:v(x,`${k}-click`,{value:"Start Tolstoy"});break;case t.PLAYER_EVENT_NAMES.clickCta:v(x,`${k}-click`,{value:A});break;case t.PLAYER_EVENT_NAMES.submitInput:v(x,`${k}-input`,{value:A});break;case t.PLAYER_EVENT_NAMES.collectInfo:v(x,`${k}-${t.PLAYER_EVENTS.collectInfo}`,{value:H});break;case t.PLAYER_EVENT_NAMES.videoResponse:v(x,`${k}-${t.PLAYER_EVENTS.videoResponse}`);break;case t.PLAYER_EVENT_NAMES.imageResponse:v(x,`${k}-${t.PLAYER_EVENTS.imageResponse}`);break;case t.PLAYER_EVENT_NAMES.audioResponse:v(x,`${k}-${t.PLAYER_EVENTS.audioResponse}`);break;case t.PLAYER_EVENTS.sessionEnd:v(x,`${k}-${t.PLAYER_EVENTS.sessionEnd}`);break}},v=(h,N,A)=>{window.fbq("trackSingleCustom",h,N,A)},O=h=>{const{data:{name:N,text:A,googleAnalyticsID:x,playlist:y,collectInfoType:H,productNames:k,totalTime:K,videoName:oe,type:X,direction:re}}=h;if(!window.gtag&&!window.dataLayer&&!window.ga||!x||!y)return;const q=`tolstoy-${y}`;switch(N){case i.EVENT_NAMES.pageView:break;case t.PLAYER_EVENTS.sessionStart:case t.PLAYER_EVENT_NAMES.sessionStart:D(x,q,t.PLAYER_EVENT_NAMES.sessionStart),D(x,q,"click","Start Tolstoy");break;case t.PLAYER_EVENT_NAMES.clickCta:D(x,q,N,A);break;case t.PLAYER_EVENT_NAMES.collectInfo:D(x,q,N,H);break;case t.PLAYER_EVENT_NAMES.submitInput:case t.PLAYER_EVENT_NAMES.imageResponse:case t.PLAYER_EVENT_NAMES.audioResponse:case t.PLAYER_EVENT_NAMES.videoResponse:case t.PLAYER_EVENT_NAMES.sessionEnd:D(x,q,N);break;case i.EVENT_NAMES.tolstoyModalClose:D(x,q,i.EVENT_NAMES.tolstoyModalClose,K);break;case i.EVENT_NAMES.videoLoaded:k&&D(x,q,"tolstoyVideoLoaded-products",k),D(x,q,"tolstoyVideoLoaded-videoName",oe);break;case i.EVENT_NAMES.feedProductModalOpen:case i.EVENT_NAMES.feedProductModalClose:case i.EVENT_NAMES.clickViewProduct:case i.EVENT_NAMES.openProductPageClick:D(x,q,$(N),k);break;case i.EVENT_NAMES.feedPlay:case i.EVENT_NAMES.feedPause:case i.EVENT_NAMES.videoMuted:case i.EVENT_NAMES.videoUnmuted:case i.EVENT_NAMES.videoWatched:D(x,q,$(N),oe);break;case i.EVENT_NAMES.openShareLink:D(x,q,$("openShareLink"),X);break;case i.EVENT_NAMES.feedNavigationArrowClick:case i.EVENT_NAMES.feedScroll:D(x,q,$(N),re);break;default:D(x,q,$(N),A)}},D=(h,N,A,x)=>{(0,c.verifyUserConsent)()&&(window.gtag?window.gtag("event",A,{event_category:N,event_label:x,send_to:h}):window.dataLayer&&window.dataLayer.push({event:A,event_category:N,event_label:x,send_to:h}))},R={},U=(h,N)=>{R[h]=R[h]||N};let w=!1;const P=()=>{if(!w)try{const h=(0,E.getAppKey)();V({appKey:h}),w=!0}catch(h){console.error(h),window.tolstoyCaptureError?.(h)}},V=({appKey:h}={})=>{let N=0,A=!1;if((0,p.setNotVisibileOpenedTolstoyPublishId)(null),!(0,d.validateUUID)(h))return;const x=({now:y,performanceNow:H})=>{A=!1;let k=(0,p.getTolstoysActivity)();W(y,k),k=(0,p.getTolstoysActivity)();const K=Math.round(H-N),oe=(0,p.getSessionUniqueId)(),X=F(k),re=window.location.href.split("?")[0],q=(0,u.getCurrentPageProductId)(),le={appKey:h,sessionUniqueId:oe,timestamp:new Date().toISOString(),anonymousId:(0,p.getAndSetAnonymousId)(),storeUrl:window.Shopify?.shop,siteActivity:X,eventName:n.SITE_ACTIVITY_EVENT_NAME,timeOnPage:K,pageUrl:re,currentPageProductId:q};(0,f.createSiteActivityEvent)(le),A=!0,(0,p.clearTolstoyActivity)()};document.addEventListener("visibilitychange",()=>{try{const y=Date.now(),H=window.performance.now();document.visibilityState==="visible"&&(N=H,A=!1,Y(y)),document.visibilityState==="hidden"&&!A&&x({now:y,performanceNow:H})}catch(y){console.error(y),window.tolstoyCaptureError?.(y)}}),window.addEventListener("beforeunload",()=>{if(!A)try{const y=Date.now(),H=window.performance.now();x({now:y,performanceNow:H})}catch(y){console.error(y),window.tolstoyCaptureError?.(y)}})},F=h=>{const N={};for(const[A,x]of Object.entries(R)){const y=h[A];!y?.length&&!N[A]&&(N[A]={activity:{},totalTime:0,impression:x});const H=S({publishId:A,activities:y});let k=0;for(const K of Object.values(H))k+=K;N[A]={activity:H,totalTime:k,impression:x}}return N},S=({publishId:h,activities:N})=>{if(!h||!N?.length)return{};const A=Date.now(),x={},y={};for(const{timeStamp:H,type:k,sessionId:K}of N)y[K]=y[K]||0,x[K]===void 0&&(x[K]=!1),(0,l.getIsActiveWidgetEvent)(k)&&!x[K]&&(x[K]=!0,y[K]-=H),(0,l.getIsInactiveWidgetEvent)(k)&&x[K]&&(x[K]=!1,y[K]+=H);for(const[H,k]of Object.entries(x))k&&(y[H]+=A),(y[H]<=0||y[H]>m)&&delete y[H];return y},M=h=>Object.entries(h).find(([N,A])=>{if(A.length===0)return;const x=A[A.length-1].type;return(0,l.getIsActiveWidgetEvent)(x)})?.[0],Y=h=>{const N=(0,p.getNotVisibleOpenedTolstoyPublishId)(),A=(0,p.getSessionId)();!N||!A||((0,p.pushTolstoyActivity)({publishId:N,timeStamp:h,type:r.WIDGET_MESSAGES_EVENTS.OPEN,sessionId:A}),(0,p.setNotVisibileOpenedTolstoyPublishId)(null))},W=(h,N)=>{const A=M(N),x=(0,p.getSessionId)();!A||!x||((0,p.pushTolstoyActivity)({publishId:A,timeStamp:h,type:r.WIDGET_MESSAGES_EVENTS.CLOSE,sessionId:x}),(0,p.setNotVisibileOpenedTolstoyPublishId)(A))},L=()=>{const h=(0,E.getAppKey)();if(!h)return;const N=window.location.href.split("?")[0],A=(0,u.getCurrentPageProductId)(),x={appKey:h,sessionUniqueId:(0,p.getSessionUniqueId)(),createdAt:new Date().toISOString(),anonymousId:(0,p.getAndSetAnonymousId)(),appUrl:window.Shopify?.shop,eventName:n.PAGE_VISIT_EVENT_NAME,parentUrl:N,currentPageProductId:A};(0,f.createPageVisitEvent)(x)}}),C("50h3S",function(e,o){s(e.exports,"PLAYER_EVENTS",function(){return t}),s(e.exports,"PLAYER_EVENT_NAMES",function(){return r});const t={pageView:"pageView",sessionStart:"sessionStart",sessionEnd:"sessionEnd",videoPause:"videoPause",videoStart:"videoStart",videoResume:"videoResume",videoReplay:"videoReplay",clickCta:"clickCta",submitInput:"submitInput",collectInfo:"collectInfo",videoResponse:"videoResponse",audioResponse:"audioResponse",imageResponse:"imageResponse",tolstoyClick:"tolstoyClick",chapterSelected:"chapterSelected",chapterPickerOpened:"chapterPickerOpened",videoSeeked:"videoSeeked",shareClick:"shareClick",quizResult:"quizResult",autoplayStart:"autoplayStart"},r={sessionStart:"tolstoyStarted",sessionEnd:"tolstoyReachedEnd",clickCta:"tolstoyAnswerClicked",submitInput:"tolstoyInputSubmit",collectInfo:"tolstoyLeadFormSubmit",videoResponse:"tolstoyVideoSubmit",audioResponse:"tolstoyAudioSubmit",imageResponse:"tolstoyImageSubmit",openGorgias:"tolstoyOpenGorgias",hideGorgias:"tolstoyHideGorgias",openIntercom:"tolstoyOpenIntercom",hideIntercom:"tolstoyHideIntercom",openTawkTo:"tolstoyOpenTawkTo",hideTawkTo:"tolstoyHideTawkTo",openLiveChat:"tolstoyOpenLiveChat",hideLiveChat:"tolstoyHideLiveChat",openHubSpot:"tolstoyOpenHubSpot",hideHubSpot:"tolstoyHideHubSpot",openHelpScout:"tolstoyOpenHelpScout",hideHelpScout:"tolstoyHideHelpScout",openDrift:"tolstoyOpenDrift",hideDrift:"tolstoyHideDrift",openZendesk:"tolstoyOpenZendesk",hideZendesk:"tolstoyHideZendesk"}}),C("8ptJJ",function(e,o){s(e.exports,"TOLSTOY_ESCAPE_KEY_PRESSED_MESSAGE",function(){return t}),s(e.exports,"TOLSTOY_WATCHED_PRODUCT_IDS_MESSAGE",function(){return r}),s(e.exports,"SHOW_FEED_PRODUCT_MODAL_MESSAGE",function(){return n}),s(e.exports,"WIDGETS_MESSAGES",function(){return i}),s(e.exports,"SHOW_FEED_CART_MOBILE_MESSAGE",function(){return c}),s(e.exports,"TOLSTOY_MOVE_TO_URL",function(){return d}),s(e.exports,"TOLSTOY_CLOSE_MODAL_MESSAGE",function(){return l}),s(e.exports,"TOLSTOY_PLAYER_READY_MESSAGE",function(){return u}),s(e.exports,"FOCUS_CLOSE_BUTTON_MESSAGE",function(){return f}),s(e.exports,"WIDGET_MESSAGES_EVENTS",function(){return p}),s(e.exports,"ACTIVE_WIDGET_MESSAGES_EVENTS",function(){return E}),s(e.exports,"INACTIVE_WIDGET_MESSAGES_EVENTS",function(){return m}),s(e.exports,"PRE_CONFIG_MESSAGES",function(){return $}),s(e.exports,"RECHARGE_MESSAGING",function(){return T}),s(e.exports,"RECHARGE_WIDGET_DATA_MESSAGE",function(){return g}),s(e.exports,"REQUEST_RECHARGE_WIDGET_DATA_MESSAGE",function(){return v}),s(e.exports,"REQUEST_RECHARGE_ADD_TO_CART_MESSAGE",function(){return O});const t="tolstoyEscapeKeyPressed",r="tolstoyWatchedProductIds",n="showFeedProductModal",i="tolstoyWidgets",c="showFeedCartMobile",d="tolstoyMoveToUrl",l="tolstoyCloseModalMessage",u="tolstoyPlayerReady",f="focusCloseButton",p={OPEN:"open",CLOSE:"close",PLAY:"play",PAUSE:"pause"},E=[p.OPEN,p.PLAY],m=[p.CLOSE,p.PAUSE],$={ready:"tolstoyPreConfigMessengerReady",vodAssetIds:"tolstoyVodAssetIds"},T="rechargeMessaging",g="tolstoyRechargeWidgetData",v="tolstoyRequestRechargeWidgetData",O="tolstoyRequestRechargeAddToCart",D="tolstoyRechargePostToCartResponse"}),C("kCbDV",function(e,o){s(e.exports,"CAROUSEL_EMBED_WIDGET",function(){return l}),s(e.exports,"IN_TILE_CAROUSEL_EMBED_WIDGET",function(){return u}),s(e.exports,"BUBBLE_WIDGET",function(){return f}),s(e.exports,"STORY_EMBED_WIDGET",function(){return p}),s(e.exports,"EMBED_WIDGET",function(){return E}),s(e.exports,"ON_YOU_WIDGET",function(){return m}),s(e.exports,"TILE_EMBED_WIDGET",function(){return $}),s(e.exports,"CENTERED_MODAL_WIDGET",function(){return T}),s(e.exports,"COLLECTION_TILE_EMBED_WIDGET",function(){return g}),s(e.exports,"COLLECTION_PAGE_TILE_EMBED_WIDGET",function(){return v}),s(e.exports,"STOP_SHOWING_WIDGET_TO",function(){return O}),s(e.exports,"EMBED_WIDGETS_CLASSNAMES",function(){return D}),s(e.exports,"SITE_ACTIVITY_EVENT_NAME",function(){return R}),s(e.exports,"PAGE_VISIT_EVENT_NAME",function(){return U}),s(e.exports,"DOM_EXCEPTION_ERRORS",function(){return w}),s(e.exports,"DEFAULT_CART_QUANTITY",function(){return P}),s(e.exports,"WIDGET_SCRIPT_PARAMETERS",function(){return V}),s(e.exports,"URL_PARAMETERS",function(){return F}),s(e.exports,"PLACEHOLDER_PRODUCT_ID",function(){return S}),s(e.exports,"CAROUSEL_CREATOR_PROFILE_LINK_POSITION",function(){return M});var t=a("iG8TK"),r=a("hRKjm"),n=a("99pD6"),i=a("lPPKE"),c=a("4lhba"),d=a("fgRdL");const l="carousel",u="inTileCarousel",f="bubble",p="stories",E="embed",m="onYou",$="tile",T="centeredModal",g="collectionTile",v="collectionPageTile",O={clickedX:"stopShowingWidgetToClickedX",viewed:"stopShowingWidgetToViewed"},D={[l]:t.PUBLIC_CLASSES.carousel,[p]:n.PUBLIC_CLASSES.story,[E]:r.PUBLIC_CLASSES.embed,[$]:i.PUBLIC_CLASSES.tile,[g]:c.PUBLIC_CLASSES.collectionTile,[v]:d.PUBLIC_CLASS},R="siteActivity",U="pageVisit",w={notAllowedError:"NotAllowedError",abortError:"AbortError"},P=1,V={shop:"shop",appKey:"app-key",productId:"product-id",shouldUseCache:"should-use-cache",cacheVersion:"cache-version"},F={tolstoyAutoOpen:"tolstoyAutoOpen",tolstoyAutoOpenOnYou:"autoOpenOnYou",tolstoyStartVideo:"tolstoyStartVideo",tolstoyMoneyFormat:"tolstoyMoneyFormat"},S="PRODUCT_ID",M={TOP:"top",BOTTOM:"bottom"}}),C("iG8TK",function(e,o){s(e.exports,"EMBED_CAROUSEL_MOTION",function(){return t}),s(e.exports,"CAROUSEL_TILE_NAME_LOCATION_TYPES",function(){return r}),s(e.exports,"PUBLIC_CLASSES",function(){return n}),s(e.exports,"MAX_TILE_NUMBER",function(){return i}),s(e.exports,"MIN_TILE_NUMBER",function(){return c}),s(e.exports,"MIN_WIDTH_FOR_TILE",function(){return d}),s(e.exports,"DEFAULT_DOT_OPACITY",function(){return l}),s(e.exports,"TILE_NAME_HEIGHT",function(){return u}),s(e.exports,"SPACING_HORIZONTAL",function(){return f}),s(e.exports,"DEFAULT_TILE_HEIGHT",function(){return p}),s(e.exports,"CAROUSEL_TYPE",function(){return E}),s(e.exports,"SPOTLIGHT_CAROUSEL_CONTENT_TILE_TYPE",function(){return m}),s(e.exports,"CAROUSEL_TITLE",function(){return $}),s(e.exports,"CAROUSEL_ARROW_CLICK_MODE",function(){return T});const t={static:"static",dynamic:"dynamic",hoverOver:"hoverOver"},r={under:"under",over:"over"},n={carousel:"tolstoy-carousel",carouselContainer:"tolstoy-carousel-container",title:"tolstoy-carousel-title",videoCarouselContainer:"tolstoy-video-carousel-container",previousButton:"tolstoy-previous-button",nextButton:"tolstoy-next-button",arrowsContainer:"tolstoy-carousel-arrows-container",videosContainer:"tolstoy-carousel-videos-container",videoContainer:"tolstoy-carousel-video-container",video:"tolstoy-carousel-video",image:"tolstoy-carousel-image",dotsContainer:"tolstoy-dots-container",dot:"tolstoy-dot",playButtonContainer:"tolstoy-play-button-container",controlsContainer:"tolstoy-carousel-controls-container",expandButton:"tolstoy-carousel-expand-button",muteButton:"tolstoy-carousel-mute-button",playButton:"tolstoy-carousel-play-button",tileContainer:"tolstoy-carousel-tile-container",tile:"tolstoy-carousel-tile",centerTile:"tolstoy-carousel-center-tile",tileNameContainer:"tolstoy-tile-name-container",tileNameText:"tolstoy-carousel-tile-name-text",arrowButtonContainer:"tolstoy-carousel-arrow-button-container",arrowButton:"tolstoy-carousel-arrow-button",tileNameHeightPlaceholder:"tolstoy-tile-name-height-placeholder",productTile:"tolstoy-product-tile",productContent:"tolstoy-product-content",productTileImage:"tolstoy-product-tile-image",productTileTitle:"tolstoy-product-tile-title",tileText:"tolstoy-tile-text",variantTile:"tolstoy-product-variant-tile",variantTileIcon:"tolstoy-product-variant-tile-icon",variantTileTitle:"tolstoy-product-variant-tile-title",productTilePrice:"tolstoy-product-tile-price",productTileSubtitle:"tolstoy-product-tile-subtitle",productTileButton:"tolstoy-product-tile-button",productTileArrow:"tolstoy-product-tile-arrow",productTileFallback:"tolstoy-product-tile-fallback",descriptionTile:"tolstoy-description-tile",descriptionTileContent:"tolstoy-description-tile-content",descriptionTileButton:"tolstoy-description-tile-button",progressBarContainer:"tolstoy-carousel-progress-bar-container",progressBar:"tolstoy-carousel-progress-bar"},i=6,c=2,d=80,l=.3,u=80,f=12,p=416,E={DEFAULT:"default",SPOTLIGHT:"spotlight"},m={product:"product",videoName:"videoName",none:"none"},$={shoppableVideoCarousel:"Shoppable Video Carousel",viewProduct:"View Product"},T={SCROLLS_CAROUSEL:"scrollsCarousel",SCROLLS_VIDEO:"scrollsVideo"}}),C("hRKjm",function(e,o){s(e.exports,"PUBLIC_CLASSES",function(){return t}),s(e.exports,"ASPECT_RATIO_9_16",function(){return r});const t={embed:"tolstoy-embed",iframe:"tolstoy-embed-iframe",videoPreview:"tolstoy-embed-video-preview",videoContainer:"tolstoy-embed-video-container",playButtonContainer:"tolstoy-embed-play-button-container",startText:"tolstoy-embed-start-text",startButtonContainer:"tolstoy-embed-start-button-container",startButton:"tolstoy-embed-start-button",embedContainer:"tolstoy-embed-container"},r=9/16}),C("99pD6",function(e,o){s(e.exports,"PUBLIC_CLASSES",function(){return r}),s(e.exports,"POSTER_SUFFIX",function(){return n}),s(e.exports,"STORIES_IMAGE_EXTENSION",function(){return c}),s(e.exports,"EMBED_STORY_MOTION",function(){return d}),s(e.exports,"STORIES_ITEMS_SIZE_TYPES",function(){return l}),s(e.exports,"STORIES_NAME_LOCATION",function(){return u}),s(e.exports,"DEFAULT_STORIES_ITEMS_SIZE_TYPE",function(){return f}),s(e.exports,"DEFAULT_STORIES_ITEMS_PER_ROW",function(){return p}),s(e.exports,"DEFAULT_STORIES_SIZE",function(){return E}),s(e.exports,"DEFAULT_STORIES_SPACING",function(){return m}),s(e.exports,"STORIES_ITEM_MAX_FIXED_SIZE",function(){return $}),s(e.exports,"STORIES_HIGHER_IMAGE_RESOLUTION_SIZE",function(){return T});var t=a("iG8TK");const r={story:"tolstoy-stories",storiesMainContainer:"tolstoy-stories-main-container",storiesContainer:"tolstoy-stories-container",tilesContainer:"tolstoy-stories-tiles-container",tileName:"tolstoy-stories-tile-name",storyTile:"tolstoy-stories-tile",storyImage:"tolstoy-stories-story-image",storyVideo:"tolstoy-stories-story-video",plusTile:"tolstoy-stories-plus-tile",storyName:"tolstoy-stories-story-name",titleContainer:"tolstoy-stories-title",plusTileContainer:"tolstoy-stories-plus-tile-container",previousButton:"tolstoy-stories-previous-button",nextButton:"tolstoy-stories-next-button",onYouButton:"tolstoy-stories-on-you-button",onlyOnYouButton:"tolstoy-stories-only-on-you-button",playButtonContainer:"tolstoy-stories-play-button-container"},n=".0000000.jpg",c=`.avatar${n}`,d={static:t.EMBED_CAROUSEL_MOTION.static,dynamic:t.EMBED_CAROUSEL_MOTION.dynamic},l={responsive:"responsive",fixed:"fixed"},u={below:"below",overlay:"overlay"},f=l.fixed,p=8,E=80,m=8,$=240,T=200}),C("lPPKE",function(e,o){s(e.exports,"PUBLIC_CLASSES",function(){return t});const t={tile:"tolstoy-tile",tileContainer:"tolstoy-tile-container",video:"tolstoy-tile-video",nativeCaptionsTrack:"tolstoy-tile-native-captions-track",customCaptionsTrack:"tolstoy-tile-custom-captions-track",imageOverlay:"tolstoy-tile-image-overlay",image:"tolstoy-tile-image",controlsOverlay:"tolstoy-tile-controls-overlay",controlsContainer:"tolstoy-tile-controls",playButtonOverlay:"tolstoy-tile-play-button-overlay",playButtonContainer:"tolstoy-tile-play-button-container",playButtonLabelContainer:"tolstoy-tile-play-button-label-container",playButtonLabel:"tolstoy-tile-play-button-label",timebarWrapper:"tolstoy-tile-timebar-wrapper",timebarContainer:"tolstoy-tile-timebar-container",timebar:"tolstoy-tile-timebar",timeIndicator:"tolstoy-tile-time-indicator",muteButton:"tolstoy-tile-mute-button",fullScreenButton:"tolstoy-tile-full-screen-button",togglesContainer:"tolstoy-tile-toggles",captionsButton:"tolstoy-tile-captions-button"}}),C("4lhba",function(e,o){s(e.exports,"PUBLIC_CLASSES",function(){return t}),s(e.exports,"PLAY_MODE",function(){return r}),s(e.exports,"PLAY_VIDEOS",function(){return n}),s(e.exports,"VIDEO_PLAYBACK_MODE",function(){return i}),s(e.exports,"TILE_CLICK_MODE",function(){return c}),s(e.exports,"TILE_DATA_KEY",function(){return d}),s(e.exports,"DEFAULT_SETTINGS",function(){return l});const t={collectionTile:"tolstoy-collection-tile",collectionTileHoverWrapper:"tolstoy-collection-tile-hover-wrapper",video:"tolstoy-collection-tile-video",controlsContainer:"tolstoy-collection-tile-controls-container",playButton:"tolstoy-collection-tile-play-button",muteButton:"tolstoy-collection-tile-mute-button"},r={AUTOPLAY:"autoplay",CLICK:"click",HOVER:"hover"},n={CONSECUTIVELY:"consecutively",SIMULTANEOUSLY:"simultaneously"},i={LOOP:"loop",PLAY_ONCE:"playOnce"},c={PDP:"pdp",PLAY:"play"},d="data-tolstoy-collection-tile-key",l={playMode:r.AUTOPLAY,playVideos:n.CONSECUTIVELY,autoplayDelay:1,minProductsBetweenVideos:2,mutedByDefault:!1,tileClickMode:c.PDP,shouldHideVideoWhenNotPlaying:!0,controls:{play:{enabled:!1,backgroundEnabled:!0,backgroundColor:"#0000004d",borderEnabled:!1,borderColor:"#ffffff",opacity:1},mute:{enabled:!1,backgroundEnabled:!0,backgroundColor:"#0000004d",borderEnabled:!1,borderColor:"#ffffff",opacity:1}}}}),C("fgRdL",function(e,o){s(e.exports,"PUBLIC_CLASS",function(){return r});const t="collectionPageTile",r="tolstoy-collection-page-tile"}),C("bvKjB",function(e,o){s(e.exports,"EVENT_NAMES",function(){return t});const t={embedView:"embedView",embedPlay:"embedPlay",embedPause:"embedPause",embedMute:"embedMute",embedUnmute:"embedUnmute",embedExpand:"embedExpand",tolstoyModalClose:"tolstoyModalClose",feedProductModalOpen:"feedProductModalOpen",feedProductModalClose:"feedProductModalClose",videoLoaded:"videoLoaded",pageView:"pageView",clickViewProduct:"clickViewProduct",openProductPageClick:"openProductPageClick",feedPlay:"feedPlay",feedPause:"feedPause",videoMuted:"videoMuted",videoUnmuted:"videoUnmuted",videoWatched:"videoWatched",openShareLink:"Open Share Link",feedNavigationArrowClick:"feedNavigationArrowClick",feedScroll:"feedScroll",sessionStart:"sessionStart",tolstoyStarted:"tolstoyStarted",abTestInitialized:"abTestInitialized",onYouClick:"onYouClick"}}),C("93NPo",function(e,o){s(e.exports,"uppercaseFirstChar",function(){return r}),s(e.exports,"getSafeParameter",function(){return n}),s(e.exports,"getRandomNumberBetweenTwoIntegers",function(){return i}),s(e.exports,"generateUUID",function(){return c}),s(e.exports,"logDevelopmentMessage",function(){return u}),s(e.exports,"logDevelopmentError",function(){return f}),s(e.exports,"getIsIOS",function(){return p}),s(e.exports,"getIsMobile",function(){return E}),s(e.exports,"debounce",function(){return m}),s(e.exports,"sleep",function(){return $}),s(e.exports,"safeRoundNumber",function(){return T}),s(e.exports,"removeHtmlTags",function(){return g}),s(e.exports,"isNullOrUndefined",function(){return v}),s(e.exports,"formatTime",function(){return O}),s(e.exports,"verifyUserConsent",function(){return D});var t=a("2Aomz");const r=R=>R?.length?`${R[0]?.toUpperCase()}${R?.slice(1)}`:"",n=R=>{if(!("URLSearchParams"in window))return null;try{return new URLSearchParams(window.location?.search).get(R)}catch(w){if(w)return null}},i=(R,U)=>Math.floor(Math.random()*(U-R+1))+R,c=()=>{const R=U=>{const w=Math.floor(Math.random()*16);return(U==="x"?w:w&3|8).toString(16)};return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,R)},d=()=>t.NODE_ENV==="development",l=()=>d()||n("td")==="true",u=(...R)=>{l()&&console.log(...R)},f=R=>{l()&&console.error(R)},p=()=>["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document,E=()=>p()||window.screen.width<=450||window.screen.height<=450,m=(R,U=300)=>{let w;return(...P)=>{clearTimeout(w),w=setTimeout(()=>{R(...P)},U)}},$=async(R=0)=>new Promise(U=>{setTimeout(U,R)}),T=(R,U=1)=>{const w=Number(R);return Number.isNaN(w)?0:Number.isInteger(w)?w:Number.parseFloat(w.toFixed(U))},g=R=>R.replace(/<[^>]*>?/gm,""),v=R=>R==null,O=R=>{const U=Math.floor(R/60),w=Math.floor(R%60);return`${U}:${w.toString().padStart(2,"0")}`},D=()=>window.Shopify?.customerPrivacy?.currentVisitorConsent().analytics!=="no"}),C("2Aomz",function(e,o){s(e.exports,"API_BASE_URL",function(){return n}),s(e.exports,"API_LB_BASE_URL",function(){return i}),s(e.exports,"API_LB_CDN_BASE_URL",function(){return c}),s(e.exports,"PLAYER_URL",function(){return l}),s(e.exports,"ON_YOU_URL",function(){return u}),s(e.exports,"HERO_URL",function(){return f}),s(e.exports,"WIDGET_DOMAIN",function(){return p}),s(e.exports,"VIDEO_OUTPUT",function(){return E}),s(e.exports,"CREATE_VIDEO_RESOLUTIONS",function(){return m}),s(e.exports,"SITE_ACTIVITY_EVENT_URL",function(){return $}),s(e.exports,"PAGE_VISIT_EVENT_URL",function(){return T}),s(e.exports,"NODE_ENV",function(){return g});const t="https://d39ynn9qmq2swd.cloudfront.net/public/published",r="https://tolstoyprojects221542-prod.s3.amazonaws.com/public/published",n="https://api.gotolstoy.com",i="https://apilb.gotolstoy.com",c="https://cf-apilb.gotolstoy.com",d="https://fyhmdsxdn7.execute-api.us-east-1.amazonaws.com/rule-groups/get",l="https://player.gotolstoy.com",u="https://play.gotolstoy.com/widget-v2/index.onyou-fullscreen.html",f="https://play.gotolstoy.com/hero",p="widget.gotolstoy.com",E="https://videos.gotolstoy.com",m="https://api.gotolstoy.com/migrations/recreate-video",$="https://analytics-v2.gotolstoy.com/site-activity",T="https://analytics-v2.gotolstoy.com/page-visit",g="production";var O={CONFIG_URL_CDN:t,CONFIG_URL:r,API_BASE_URL:n,API_LB_BASE_URL:i,API_LB_CDN_BASE_URL:c,GET_RULE_GROUPS_URL:d,PLAYER_URL:l,ON_YOU_URL:u,WIDGET_DOMAIN:p,VIDEO_OUTPUT:E,CREATE_VIDEO_RESOLUTIONS:m,SITE_ACTIVITY_EVENT_URL:$,PAGE_VISIT_EVENT_URL:T,NODE_ENV:g}}),C("dNsZ9",function(e,o){s(e.exports,"validateUUID",function(){return t});const t=r=>{const n=/^[\da-f]{8}-[\da-f]{4}-[0-5][\da-f]{3}-[089ab][\da-f]{3}-[\da-f]{12}$/i;return r?.match(n)}}),C("tZRsn",function(e,o){s(e.exports,"getIsActiveWidgetEvent",function(){return r}),s(e.exports,"getIsInactiveWidgetEvent",function(){return n});var t=a("8ptJJ");const r=i=>t.ACTIVE_WIDGET_MESSAGES_EVENTS.includes(i),n=i=>t.INACTIVE_WIDGET_MESSAGES_EVENTS.includes(i)}),C("i1NbZ",function(e,o){s(e.exports,"getParameterFromWidgetScripts",function(){return c}),s(e.exports,"getEmbedProductId",function(){return d}),s(e.exports,"getCurrentPageProductId",function(){return l}),s(e.exports,"getShouldUseCache",function(){return u}),s(e.exports,"getCacheVersion",function(){return f});var t=a("kCbDV"),r=a("2Aomz");const n=(p,E)=>{const m=p.src;return new URL(m).searchParams.get(E)},i=(p,E)=>p.getAttribute(`data-${E}`),c=p=>{const E=document.querySelectorAll(`script[src*="${r.WIDGET_DOMAIN}"]`);for(const m of E){const $=i(m,p)||n(m,p);if($)return $}},d=p=>{const E=p?.dataset?.productId;return E==="{{ product.id }}"?null:E},l=()=>{const p=c(t.WIDGET_SCRIPT_PARAMETERS.productId);if(p)return p;const{stories:E,carousel:m,embed:$,tile:T}=t.EMBED_WIDGETS_CLASSNAMES,g=document.querySelectorAll(`.${E}, .${m}, .${$}, .${T}`);for(const v of g){const O=d(v);if(O)return O}},u=()=>c(t.WIDGET_SCRIPT_PARAMETERS.shouldUseCache)==="true",f=()=>c(t.WIDGET_SCRIPT_PARAMETERS.cacheVersion)}),C("kK0IS",function(e,o){s(e.exports,"getAccountSettings",function(){return f}),s(e.exports,"postUserIdentification",function(){return p}),s(e.exports,"getProjectConfig",function(){return E}),s(e.exports,"getConfigByUrl",function(){return m}),s(e.exports,"getConfigByProductId",function(){return $}),s(e.exports,"getCollectionTileConfigs",function(){return T}),s(e.exports,"getBubbleSettings",function(){return g}),s(e.exports,"getCollectionPageTileConfig",function(){return v}),s(e.exports,"sendEvent",function(){return O}),s(e.exports,"createPlayerEvent",function(){return D}),s(e.exports,"createResolutions",function(){return R}),s(e.exports,"createSiteActivityEvent",function(){return V}),s(e.exports,"createPageVisitEvent",function(){return F});var t=a("2Aomz"),r=a("i1NbZ"),n=a("lUrCX"),i=a("93NPo"),c=a("6QfcD"),d=a("gxrY5"),l=a("izL3O");const u=()=>window.tolstoySettings?.shouldUseCache?t.API_LB_CDN_BASE_URL:t.API_LB_BASE_URL,f=async()=>{const S=(0,c.getAppKey)(),M=window.Shopify?.shop||(0,l.getShop)(),Y=(0,r.getShouldUseCache)(),W=(0,r.getCacheVersion)(),L=Y?t.API_LB_CDN_BASE_URL:t.API_LB_BASE_URL;let h,N;window.widget_V1_AccountSettingsPromise=new Promise((A,x)=>{h=A,N=x});try{const A=new URL(`${L}/actions/accounts/${S}`);W&&A.searchParams.set("v",W),M&&A.searchParams.set("appUrl",M);const y=await(await fetch(A.toString())).json();return h(y),y}catch(A){N(A),window.tolstoyCaptureError?.(A,"Error loading account settings:")}},p=async S=>{try{return(0,i.verifyUserConsent)()?(await fetch(`${t.API_BASE_URL}/identify/identify`,{method:"POST",body:JSON.stringify({data:S})})).json():void 0}catch(M){window.tolstoyCaptureError?.(M,"Error updating identification:")}},E=async(S,M)=>{const Y=(0,r.getCurrentPageProductId)(),W=u(),L=(0,r.getCacheVersion)(),h=(0,n.getFilteredSearchParams)({widgetType:M,productId:Y,publishId:S,v:L});try{return(await fetch(`${W}/settings/widget/by-publish-id?${h}`)).json()}catch(N){window.tolstoyCaptureError?.(N,"Error loading config:")}},m=async S=>{const M=u(),Y=(0,r.getCacheVersion)(),W=(0,n.getFilteredSearchParams)({...S,url:`${window.location.origin}${window.location.pathname}`,v:Y});try{return(await fetch(`${M}/settings/widget/by-product-url?${W}`)).json()}catch(L){window.tolstoyCaptureError?.(L,"Error getting product page config:")}},$=async S=>{const M=u(),Y=(0,r.getCacheVersion)(),W=(0,n.getFilteredSearchParams)({...S,v:Y});try{return(await fetch(`${M}/settings/widget/by-product-id?${W}`)).json()}catch(L){window.tolstoyCaptureError?.(L,"Error getting product page config:")}},T=async(S,M)=>{const Y=u(),W=(0,r.getCacheVersion)(),L=(0,n.getFilteredSearchParams)({appKey:S,collectionId:M,v:W});try{const N=await(await fetch(`${Y}/settings/widget/get-collection-tile-config?${L}`)).json();if(Array.isArray(N)&&N.some(A=>A.project&&A.collectionId)){const A=window.Shopify?.shop||(0,l.getShop)();return N.filter(x=>x.project.appUrl===A)}}catch(h){window.tolstoyCaptureError?.(h,"Error getting collection tile config:")}return[]},g=async S=>{const M=new URLSearchParams(S);try{return(await fetch(`${t.API_LB_BASE_URL}/settings/bubble?${M.toString()}`)).json()}catch(Y){window.tolstoyCaptureError?.(Y,"Error getting bubble settings:")}},v=async(S,M)=>{const Y=u(),W=(0,r.getCacheVersion)(),L=(0,n.getFilteredSearchParams)({publishId:S,collectionId:M,v:W});try{return(await fetch(`${Y}/settings/collection-page-tile-config?${L}`)).json()}catch(h){window.tolstoyCaptureError?.(h,"Error getting collection page tile config:")}},O=async S=>{if(window.location.origin!==void 0&&(0,i.verifyUserConsent)())try{return await fetch(`${t.API_BASE_URL}/events/event`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(S)})}catch(M){window.tolstoyCaptureError?.(M,"Error sending page view:")}},D=(0,d.sendWithInitialDelay)(O),R=async S=>{try{return await fetch(`${t.CREATE_VIDEO_RESOLUTIONS}?publishId=${S}`)}catch(M){window.tolstoyCaptureError?.(M)}},U=!0,w=!0,P=S=>{const M=S?.siteActivity;return!M||M===""||Object.keys(M).length===0?!1:Object.values(M).some(Y=>Y?.totalTime>0)},V=(0,d.sendWithInitialDelay)(S=>{if(!(U&&!P(S))&&(0,i.verifyUserConsent)())try{window.navigator.sendBeacon(t.SITE_ACTIVITY_EVENT_URL,JSON.stringify(S))}catch(M){const Y="Error occurred in createSiteActivityEvent";console.error(Y,M),window.tolstoyCaptureError?.(M,Y)}}),F=(0,d.sendWithInitialDelay)(S=>{if(!w&&(0,i.verifyUserConsent)())try{window.navigator.sendBeacon(t.PAGE_VISIT_EVENT_URL,JSON.stringify(S))}catch(M){const Y="Error occurred in createPageVisitEvent";console.error(Y,M),window.tolstoyCaptureError?.(M,Y)}})}),C("lUrCX",function(e,o){s(e.exports,"getIsTheSameURL",function(){return c}),s(e.exports,"getUrlCustomParams",function(){return d}),s(e.exports,"getFilteredSearchParams",function(){return l}),s(e.exports,"isUrl",function(){return u}),s(e.exports,"getIsEmailCampaignProject",function(){return f});const t="www.",r=new RegExp("^((([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[\\-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9\\.\\-]+|(?:www\\.|[\\-;:&=\\+\\$,\\w]+@)[A-Za-z0-9\\.\\-]+)((?:\\/[\\+~%\\/\\.\\w\\-_]*)?\\??(?:[\\-\\+=&;%@\\.\\w_]*)#?(?:[\\.\\!\\/\\\\\\w]*))?)","i"),n=p=>p?!!r.test(p)||p.startsWith("tel:")||p.startsWith("mailto:")||p.startsWith("_self:"):!1,i=p=>{const E=p.replace(t,""),m=new URL(E);return`${m.origin}${m.pathname}${m.search}`},c=(p,E)=>!n(p)||!n(E)?!1:i(p)===i(E),d=()=>{const p=new URLSearchParams(window.location.search),E=new URLSearchParams;for(const[m,$]of p){const T=m.toLowerCase();m.length<50&&$.length<100&&(T.startsWith("custom_")||T.startsWith("utm_"))&&E.append(m,$)}return E},l=(p={})=>{const E=new URLSearchParams;for(const[m,$]of Object.entries(p))$!=null&&$!==""&&E.append(m,$);return E.toString()},u=p=>r.test(p),f=p=>new URLSearchParams(window.location.search).get("tolstoy")===p}),C("6QfcD",function(e,o){s(e.exports,"getAppKey",function(){return i});var t=a("kCbDV"),r=a("i1NbZ");let n="";function i(){return window.tolstoyAppKey||n?window.tolstoyAppKey||n:(n=(0,r.getParameterFromWidgetScripts)(t.WIDGET_SCRIPT_PARAMETERS.appKey),n)}}),C("gxrY5",function(e,o){s(e.exports,"sendWithInitialDelay",function(){return c});const t=4e3;let r=!1;const n=[],i=()=>{for(;n.length>0;){const{eventFunction:d,args:l}=n.shift();d(...l)}};setTimeout(()=>{r=!0,i()},t);const c=d=>(...l)=>{if(r)return d(...l);n.push({eventFunction:d,args:l})}}),C("izL3O",function(e,o){s(e.exports,"getShop",function(){return n});var t=a("kCbDV"),r=a("i1NbZ");function n(){return(0,r.getParameterFromWidgetScripts)(t.WIDGET_SCRIPT_PARAMETERS.shop)}}),C("eSOI5",function(e,o){s(e.exports,"getAndSetAnonymousId",function(){return V}),s(e.exports,"setPublishId",function(){return Y}),s(e.exports,"getTolstoysActivity",function(){return W}),s(e.exports,"pushTolstoyActivity",function(){return L}),s(e.exports,"pushTolstoyViewedProducts",function(){return h}),s(e.exports,"clearTolstoyActivity",function(){return N}),s(e.exports,"setIsReply",function(){return x}),s(e.exports,"setTolstoyProductRecommendation",function(){return y}),s(e.exports,"getTolstoyViewers",function(){return k}),s(e.exports,"setTolstoyViewers",function(){return q}),s(e.exports,"getTolstoyInteractionDate",function(){return le}),s(e.exports,"setIdentifyInfoId",function(){return he}),s(e.exports,"getIdentifyInfoId",function(){return ge}),s(e.exports,"removeIdentifyInfoId",function(){return we}),s(e.exports,"setSessionCounter",function(){return Se}),s(e.exports,"getSessionCounter",function(){return ue}),s(e.exports,"setFirstSeenAt",function(){return Xe}),s(e.exports,"getFirstSeenAt",function(){return Je}),s(e.exports,"setTolstoyInteractionDate",function(){return et}),s(e.exports,"updateIsAddedFromTolstoyVariantIds",function(){return rt}),s(e.exports,"getTolstoyHideWidget",function(){return nt}),s(e.exports,"setTolstoyHideWidget",function(){return st}),s(e.exports,"removeTolstoyHideWidget",function(){return at}),s(e.exports,"getSessionId",function(){return Ue}),s(e.exports,"setSessionId",function(){return Ve}),s(e.exports,"removeSessionId",function(){return B}),s(e.exports,"getSessionUniqueId",function(){return z}),s(e.exports,"getNotVisibleOpenedTolstoyPublishId",function(){return se}),s(e.exports,"setNotVisibileOpenedTolstoyPublishId",function(){return it}),s(e.exports,"updateTolstoyActivitySessionIdByPublishId",function(){return _n}),s(e.exports,"getIsShopifyCartAnonymousIdSet",function(){return wn}),s(e.exports,"setIsShopifyCartAnonymousIdSet",function(){return xn}),s(e.exports,"setTolstoyRecreateResolution",function(){return An}),s(e.exports,"getTolstoyRecreateResolution",function(){return Cn}),s(e.exports,"setShowNotificationBadge",function(){return Rn}),s(e.exports,"getShowNotificationBadge",function(){return Ln}),s(e.exports,"setShowBubbleText",function(){return On}),s(e.exports,"getShowBubbleText",function(){return Pn}),s(e.exports,"setRecreateNewResolution",function(){return Mn}),s(e.exports,"getRecreateNewResolution",function(){return Dn}),s(e.exports,"setAbTestGroup",function(){return Un}),s(e.exports,"getAbTestGroup",function(){return Vn});var t=a("lY4N9"),r=a("hlJEM"),n=a("lxjfR"),i=a("fvcet");const{TOLSTOY_HIDE_WIDGET_STORAGE_KEY:c,TOLSTOY_SESSION_ID_KEY:d,TOLSTOY_SESSION_UNIQUE_ID_KEY:l,TOLSTOY_PRODUCT_RECOMMENDATIONS:u,TOLSTOY_ANONYMOUS_ID:f,TOLSTOY_REPLY:p,TOLSTOY_GROUP:E,TOLSTOY_PUBLISH_ID:m,TOLSTOY_ACTIVITY_KEY:$,TOLSTOY_NOT_VISIBLE_OPENED_PUBLISH_ID_KEY:T,TOLSTOY_INTERACTION_DATE:g,IS_SHOPIFY_CART_ANONYMOUS_ID_SET_KEY:v,TOLSTOY_RECREATE_RESOLUTIONS_PREFIX:O,TOLSTOY_AB_TEST_GROUP:D}=r.TOLSTOY_CACHE_KEYS,R=2592e3;function U(I){return I?`${g}-${I}`:g}function w(){return(0,n.getFromCache)(f)}function P(I){!I||["undefined","false"].includes(I)||(0,n.setToCache)(f,I)}function V(){let j=((0,t.getIsTapcart)()?(0,t.getTapcartDeviceId)():null)||w()||(0,n.uuidv4)();return j==="false"&&(j=(0,n.uuidv4)()),P(j),j}function F(){return(0,n.getFromCache)(E)}function S(I){(0,n.setToCache)(E,I,!0)}function M(){return(0,n.getFromCache)(m)}function Y(I){(0,n.setToCache)(m,I,!0)}function W(){return JSON.parse((0,n.getFromSessionStorage)($)||"{}")}function L({publishId:I,timeStamp:j,type:ee,sessionId:fe}){const $e=W()||{},kn=$e[I]||[];$e[I]=[...kn,{timeStamp:j,type:ee,sessionId:fe}],(0,n.setToSessionStorage)($,JSON.stringify($e),!0)}const h=({publishId:I,productId:j})=>{const ee=X(),fe=ee[j]||[],$e={interactionDate:new Date().toISOString(),publishId:I,productId:j};fe.push($e),ee[j]=fe,re(ee)},N=()=>{(0,n.setToSessionStorage)($,"{}",!0)};function A(){return(0,n.getFromCache)(p)}function x(I){(0,n.setToCache)(p,I)}function y(){(0,n.setToCache)(u,!0)}function H(){return(0,n.getFromCache)(u)}const k=()=>JSON.parse((0,n.getFromLocalStorage)(i.Keys.TOLSTOY_VIEWERS_KEY)||"{}"),K=()=>k().abTest||{},oe=I=>{const j=k();j.abTest=I,q(j)},X=()=>JSON.parse((0,n.getFromCache)(i.Keys.TOLSTOY_VIEWED_PRODUCTS)||"{}"),re=I=>{(0,n.setToCache)(i.Keys.TOLSTOY_VIEWED_PRODUCTS,JSON.stringify(I))},q=I=>{(0,n.setLocalStorage)(i.Keys.TOLSTOY_VIEWERS_KEY,JSON.stringify(I))};function le(I){return(0,n.getFromCache)(U(I))||(0,n.getFromCache)(U())}function he(I){(0,n.setLocalStorage)(i.Keys.IDENTIFY_INFO_ID_KEY,I)}function ge(){return(0,n.getFromLocalStorage)(i.Keys.IDENTIFY_INFO_ID_KEY)}function we(){localStorage.removeItem(i.Keys.IDENTIFY_INFO_ID_KEY)}const Se=I=>{(0,n.setLocalStorage)(i.Keys.SESSION_COUNTER_KEY,I)},ue=()=>Number((0,n.getFromLocalStorage)(i.Keys.SESSION_COUNTER_KEY)),Xe=I=>{(0,n.setLocalStorage)(i.Keys.FIRST_SEEN_AT_KEY,I)},Je=()=>(0,n.getFromLocalStorage)(i.Keys.FIRST_SEEN_AT_KEY);function et(I,j){const ee=new Date().toISOString();(0,n.setToCache)(U(I),ee),tt(j)}const tt=I=>{(0,n.setCookie)(i.COOKIE_KEYS.TOLSTOY_INTERACTION,JSON.stringify({anonymousId:V(),appUrl:I}),R),(0,n.setLocalStorage)(i.COOKIE_KEYS.TOLSTOY_INTERACTION,JSON.stringify({anonymousId:V(),appUrl:I}),!0)},Gt=()=>{const I=(0,n.getFromCache)(i.COOKIE_KEYS.TOLSTOY_INTERACTION);return JSON.parse(I||"{}")},ot=()=>{const I=(0,n.getFromCache)(i.Keys.TOLSTOY_IS_ADDED_FROM_TOLSTOY_VARIANT_IDS);return JSON.parse(I||"[]")},rt=I=>{try{const j=ot();j.includes(I)||j.push(`${I}`),(0,n.setLocalStorage)(i.COOKIE_KEYS.TOLSTOY_IS_ADDED_FROM_TOLSTOY_VARIANT_IDS,JSON.stringify(j),!0),(0,n.setCookie)(i.COOKIE_KEYS.TOLSTOY_IS_ADDED_FROM_TOLSTOY_VARIANT_IDS,JSON.stringify(j),R)}catch{}},nt=I=>(0,n.getFromSessionStorage)(`${c}-${I}`),st=I=>(0,n.setToSessionStorage)(`${c}-${I}`,"true",!0),at=I=>window.sessionStorage.removeItem(`${c}-${I}`),Ue=()=>(0,n.getFromSessionStorage)(d),Ve=I=>(0,n.setToSessionStorage)(d,I,!0),B=()=>(0,n.removeFromSessionStorage)(d),z=()=>{const I=(0,n.getFromSessionStorage)(l);return I||ie()},ie=()=>{const I=(0,n.uuidv4)();return(0,n.setToSessionStorage)(l,I,!0),I},se=()=>{const I=(0,n.getFromSessionStorage)(T);return!I||I==="null"?null:I},it=I=>(0,n.setToSessionStorage)(T,I,!0),_n=(I,j)=>{const ee=W()||{},fe=ee[I]||[];if(!fe?.length)return;const $e=fe[fe.length-1];$e.sessionId=j,(0,n.setToSessionStorage)($,JSON.stringify(ee),!0)},wn=()=>(0,n.getFromSessionStorage)(v),xn=I=>(0,n.setToSessionStorage)(v,I),An=I=>(0,n.setLocalStorage)(`${O}-${I}`,"true",!0),Cn=I=>(0,n.getFromLocalStorage)(`${O}-${I}`),Rn=(I,j)=>(0,n.setLocalStorage)(`${i.Keys.NOTIFICATION_BADGE_PREFIX}-${I}`,j,!0),Ln=I=>(0,n.getFromLocalStorage)(`${i.Keys.NOTIFICATION_BADGE_PREFIX}-${I}`),On=(I,j,ee)=>(0,n.setLocalStorage)(`${i.Keys.BUBBLE_TEXT_PREFIX}-${I}-${j}`,ee,!0),Pn=(I,j)=>(0,n.getFromLocalStorage)(`${i.Keys.BUBBLE_TEXT_PREFIX}-${I}-${j}`),Mn=(I,j)=>(0,n.setLocalStorage)(`${i.Keys.RECREATE_NEW_RESOLUTION_PREFIX}-${I}`,j,!0),Dn=I=>(0,n.getFromLocalStorage)(`${i.Keys.RECREATE_NEW_RESOLUTION_PREFIX}-${I}`),Un=(I,j)=>(0,n.setLocalStorage)(`${D}-${I}`,j,!0),Vn=I=>(0,n.getFromLocalStorage)(`${D}-${I}`)}),C("lY4N9",function(e,o){s(e.exports,"getIsTapcart",function(){return r}),s(e.exports,"getTapcartDeviceId",function(){return n}),s(e.exports,"isTapcartDashboard",function(){return i});const t="custom-blocks.tapcart.com",r=()=>!!(window?.Tapcart?.isInitialized||document.location?.host?.includes(t)),n=()=>window?.Tapcart?.variables?.device?.id?.toLowerCase(),i=()=>window?.location?.hostname?.includes&&window.location.hostname.includes("app.tapcart.com")}),C("hlJEM",function(e,o){s(e.exports,"TOLSTOY_CACHE_KEYS",function(){return t}),s(e.exports,"COOKIE_POLICIES",function(){return r});const t={TOLSTOY_HIDE_WIDGET_STORAGE_KEY:"tolstoy-hide-widget",TOLSTOY_SESSION_ID_KEY:"tolstoy-session-id",TOLSTOY_SESSION_UNIQUE_ID_KEY:"tolstoy-session-unique-id",TOLSTOY_PRODUCT_RECOMMENDATIONS:"tolstoy-product-recommendation",TOLSTOY_ANONYMOUS_ID:"tolstoy-anonymousId",TOLSTOY_REPLY:"tolstoy-reply",TOLSTOY_GROUP:"tolstoy-group",TOLSTOY_PUBLISH_ID:"tolstoy-publishId",TOLSTOY_ACTIVITY_KEY:"tolstoy-activity",TOLSTOY_NOT_VISIBLE_OPENED_PUBLISH_ID_KEY:"tolstoy-not-visible-opened-publish-id",TOLSTOY_INTERACTION_DATE:"tolstoy-interaction-date",IS_SHOPIFY_CART_ANONYMOUS_ID_SET_KEY:"tolstoy-is-shopify-cart-anonymous-id-set",TOLSTOY_COOKIE_POLICY:"tolstoy-cookie-policy",TOLSTOY_RECREATE_RESOLUTIONS_PREFIX:"tolstoy-recreate-resolutions",TOLSTOY_AB_TEST_GROUP:"tolstoy-ab-test-group"},r={accepted:"accepted",rejected:"rejected"}}),C("lxjfR",function(e,o){s(e.exports,"uuidv4",function(){return i}),s(e.exports,"getFromSessionStorage",function(){return d}),s(e.exports,"getFromLocalStorage",function(){return l}),s(e.exports,"getFromCache",function(){return f}),s(e.exports,"setToSessionStorage",function(){return p}),s(e.exports,"setLocalStorage",function(){return E}),s(e.exports,"setToCache",function(){return m}),s(e.exports,"removeFromSessionStorage",function(){return $}),s(e.exports,"setCookiePolicy",function(){return g}),s(e.exports,"setCookie",function(){return v}),s(e.exports,"removeAllTolstoyKeysFromStorage",function(){return R});var t=a("hlJEM"),r=a("fvcet");const{TOLSTOY_COOKIE_POLICY:n}=t.TOLSTOY_CACHE_KEYS;function i(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(w){const P=Math.trunc(Math.random()*16);return(w==="x"?P:P&3|8).toString(16)})}function c(w){try{return w()}catch(P){return window.tolstoyCaptureError?.(P),null}}function d(w){return c(()=>window.sessionStorage.getItem(w))}function l(w){return c(()=>localStorage.getItem(w))||d(w)}function u(w){return c(()=>{const P=document.cookie.split("; ").find(V=>V.startsWith(`${w}=`));return P?decodeURIComponent(P.split("=")[1]):null})}function f(w){return l(w)||d(w)||u(w)}function p(w,P,V=!1){c(()=>{if(!(T()===t.COOKIE_POLICIES.rejected&&!V))return window.sessionStorage.setItem(w,P)})}function E(w,P,V=!1){c(()=>{if(T()!==t.COOKIE_POLICIES.rejected)return localStorage.setItem(w,P);if(V)return window.sessionStorage.setItem(w,P)})}function m(w,P,V=!1){c(()=>{if(T()!==t.COOKIE_POLICIES.rejected)return localStorage.setItem(w,P);if(V)return window.sessionStorage.setItem(w,P)})}function $(w){return c(()=>window.sessionStorage.removeItem(w))}const T=()=>f(n),g=w=>{m(n,w,!0)},v=(w,P,V)=>{const F=window.location.host,S=V?`max-age=${V}; `:"",W=`${w}=${encodeURIComponent(P)}; path=/; ${S}Secure; SameSite=None; `;document.cookie=W+`domain=.${F}; `},O=w=>{const P=window.location.host;document.cookie=`${w}=; path=/; domain=.${P}; expires=Thu, 01 Jan 1970 00:00:00 UTC;`,document.cookie=`${w}=; path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC;`},D=w=>[...Object.values(t.TOLSTOY_CACHE_KEYS),...Object.values(r.Keys)].some(V=>w.includes(V));function R(){const w=document.cookie.split("; ");for(const P of w){const[V]=P.split("=");D(V.trim())&&O(V)}for(const P in localStorage)D(P)&&localStorage.removeItem(P);for(const P in sessionStorage)D(P)&&sessionStorage.removeItem(P)}(()=>{const w=document.cookie.split("; ");for(const P of w){const[V]=P.split("=");D(V.trim())&&O(V)}})()}),C("fvcet",function(e,o){s(e.exports,"Keys",function(){return t}),s(e.exports,"COOKIE_KEYS",function(){return r});const t={IDENTIFY_INFO_ID_KEY:"identifyInfoId",SESSION_COUNTER_KEY:"tolstoySessionCounter",LAST_SEEN_AT_KEY:"tolstoyLastSeenAtKey",FIRST_SEEN_AT_KEY:"tolstoyFirstSeenAtKey",TOLSTOY_VIEWERS_KEY:"tolstoyViewers",TOLSTOY_VIEWED_PRODUCTS:"tolstoyViewedProducts",CURRENT_CUSTOMER_EMAIL_KEY:"tolstoyCurrentCustomer",BUBBLE_TEXT_PREFIX:"bubbleText",NOTIFICATION_BADGE_PREFIX:"notificationBadge",RECREATE_NEW_RESOLUTION_PREFIX:"reCreateNewResolution"},r={TOLSTOY_INTERACTION:"_td_key_c",TOLSTOY_IS_ADDED_FROM_TOLSTOY_VARIANT_IDS:"_td_v_id"}}),C("xb7kn",function(e,o){s(e.exports,"tolstoyWidgetReady",function(){return r}),s(e.exports,"tolstoyPlayerReady",function(){return n});var t=a("8ptJJ");const r=()=>{const i=new CustomEvent("tolstoyWidgetReady");window.dispatchEvent(i)},n=()=>{const i=new CustomEvent(t.TOLSTOY_PLAYER_READY_MESSAGE);window.dispatchEvent(i)}}),C("ljwIw",function(e,o){s(e.exports,"createElement",function(){return t}),s(e.exports,"createScript",function(){return r}),s(e.exports,"createIframe",function(){return n}),s(e.exports,"registerDomUpdatesListener",function(){return d}),s(e.exports,"safePlayVideo",function(){return l}),s(e.exports,"stringToHTML",function(){return u}),s(e.exports,"getPublicId",function(){return f}),s(e.exports,"getElementSelector",function(){return p}),s(e.exports,"getElement",function(){return E}),s(e.exports,"getCustomElementSelector",function(){return $}),s(e.exports,"getCustomElement",function(){return T});const t=({tagName:g,src:v,container:O,attributes:D,style:R,styleString:U,classNames:w,eventListeners:P})=>{const V=document.createElement(g);if(P)for(const[F,S]of Object.entries(P))V.addEventListener(F,S);if(v&&(V.src=v),D)for(const[F,S]of Object.entries(D))V.setAttribute(F,S);if(U&&(V.style.cssText=U),R)for(const[F,S]of Object.entries(R))V.style[F]=S;return w&&V.classList.add(...w),O&&O.append(V),V},r=({src:g,container:v,attributes:O})=>t({tagName:"script",src:g,container:v,attributes:O}),n=({src:g,container:v,attributes:O,style:D})=>t({tagName:"iframe",src:g,container:v,attributes:O,style:D}),i=({callback:g,classNames:v})=>{const O=F=>v.some(S=>F.getElementsByClassName(S).length>0),D=F=>v.includes(F),R=F=>[...F.classList].some(D),U=F=>F.classList?R(F)||O(F):!1,w=F=>F.type!=="childList"||F.addedNodes.length===0?!1:[...F.addedNodes].some(U),P=F=>{F.some(w)&&g()};new window.MutationObserver(P).observe(document.body,{subtree:!0,childList:!0})},c=({callback:g})=>{window.addEventListener("DOMContentLoaded",g),window.addEventListener("load",g)},d=({callback:g,classNames:v})=>{c({callback:g}),"MutationObserver"in window&&i({callback:g,classNames:v})},l=({video:g,onError:v})=>{if(!g)return Promise.reject(new Error("No video element"));const O=/iPad|iPhone|iPod/.test(navigator.userAgent),D=Number.parseFloat(navigator.userAgent.match(/OS (\d+)_/)?.[1]||"0");return O&&D>=18&&g.readyState<1&&g.load(),g.play().catch(U=>(console.warn("Video play failed:",U),v&&v(U),Promise.reject(U)))},u=g=>{const v=document.createElement("div");return v.innerHTML=g.trim(),v.firstChild},f=(g,v)=>`${g}-${v}`,p=(g,v)=>`[data-tolstoy-element="${f(g,v)}"]`,E=(g,v)=>window.document.querySelector(p(g,v)),m=(g,v)=>window.document.querySelectorAll(`[data-tolstoy-element="${f(g,v)}"]`),$=(g,v)=>`[${g}="${v}"]`,T=(g,v)=>window.document.querySelector(`[${g}="${v}"]`)}),C("2S3LN",function(e,o){s(e.exports,"getPublicId",function(){return T}),s(e.exports,"getEmbedPublishId",function(){return g}),s(e.exports,"getEmbedCollectionId",function(){return v}),s(e.exports,"reloadFontIfNeeded",function(){return O}),s(e.exports,"getVideoBaseUrl",function(){return D}),s(e.exports,"getAllElements",function(){return U}),s(e.exports,"stopAllVideos",function(){return w}),s(e.exports,"stopDynamicVideos",function(){return P}),s(e.exports,"onViewPortChangeHandler",function(){return V}),s(e.exports,"getConfig",function(){return F}),s(e.exports,"shouldForceMute",function(){return S}),s(e.exports,"getMessageFromError",function(){return M}),s(e.exports,"getIsElementVisible",function(){return Y}),s(e.exports,"getPageVariantId",function(){return W});var t=a("ljwIw"),r=a("68VIL"),n=a("519R9"),i=a("aEodP"),c=a("dQiGr"),d=a("6QfcD"),l=a("jvykV"),u=a("kK0IS"),f=a("kCbDV"),p=a("1A9Dw"),E=a("8ZCcc"),m=a("6MJM3"),$=a("iG8TK");const T=(L,h,N)=>N?`${L}-${h}-${N}`:`${L}-${h}`,g=L=>L.dataset.publishId?L.dataset.publishId.toLowerCase():L.id?L.id.split("_")[0].toLowerCase():"",v=L=>L?.dataset?.collectionId,O=L=>{const h=L?.design?.branding?.typography?.font,N=L?.design?.branding?.typography?.fontHeading;!h?.family&&!N?.family||(h?.family&&(0,l.reloadFont)(h),N?.family&&(0,l.reloadFont)(N,"tolstoy-custom-heading-font-family"))},D=({step:L,embedMotion:h,isStory:N,loadAll:A=!1,isCarouselPlayInTileFirst:x})=>{if(h===$.EMBED_CAROUSEL_MOTION.static||x)return null;const H=window.innerWidth<=450,k=h===$.EMBED_CAROUSEL_MOTION.hoverOver,K=h===$.EMBED_CAROUSEL_MOTION.dynamic;return K&&A?(0,m.getBaseUrl)({step:L,isStory:N}):k&&H||K?null:(0,m.getBaseUrl)({step:L,isStory:N})},R=L=>{const h=L.getBoundingClientRect();return h.top>=-h.height&&h.left>=0&&h.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&h.right<=(window.innerWidth||document.documentElement.clientWidth)},U=(L,h)=>window.document.querySelectorAll(`[data-tolstoy-element="${T(L,h)}"]`),w=({videoClass:L,publishId:h,removeEventListenerFunction:N})=>{const A=U(L,h);for(const x of A)x.pause(),N?.(x)},P=({videoClass:L,publishId:h,setIsDynamicVideoRunning:N,onVideoEnd:A})=>{N(!1),w({videoClass:L,publishId:h,removeEventListenerFunction:x=>{x.removeEventListener("ended",A)}})},V=({videoClass:L,isDynamicVideoRunning:h,setIsDynamicVideoRunning:N,dynamicVideoHandler:A,publishId:x,onVideoEnd:y})=>{const H=U(L,x);if(H.length===0)return;const k=R(H[0]);!k&&h?(P({videoClass:L,publishId:x,setIsDynamicVideoRunning:N,onVideoEnd:y}),N(!1)):k&&!h&&(A(),N(!0))},F=async({publishId:L,productId:h,widgetType:N,tags:A,appUrl:x,variantId:y})=>{const H=h&&h!==f.PLACEHOLDER_PRODUCT_ID?u.getConfigByProductId:u.getConfigByUrl,k=window.tolstoyAppKey||(0,d.getAppKey)()||"",K=new URLSearchParams(window.location.search),oe=y||K.get("variant"),X=await H({productId:h,defaultPublishId:L,widgetType:N,appKey:k,tags:A,appUrl:x,variantId:oe});return(new p.default(N).init(X)||{}).hideElement?{disabled:!0}:(X?.disabled||((0,E.getFeatureIsEnabled)({config:X,featureKey:c.FEATURE_BLOCK_SHOPIFY_ADD_TO_CART_ATTRIBUTE})&&n.default.postMessage({eventName:i.INTERNAL_EVENTS.blockAnonymousIdToCart,appKey:k}),X?.openCommerceSettings&&n.default.postMessage({eventName:i.INTERNAL_EVENTS.openCommerceSettingsUpdate,openCommerceSettings:X.openCommerceSettings})),X)};function S(L,h){return!!(h==null?L:!h)}const M=L=>{const h=k=>{const K=(0,t.stringToHTML)(k);return K.style.verticalAlign="middle",K.style.margin="0 5px",K.style.marginBottom="3px",K},N=document.createElement("p"),A=h((0,r.getWarningIcon)()),x=h((0,r.getPublishIcon)());return N.append(A),({"Invalid publishId":["Add the publish ID from the",x,"tab of your project in Tolstoy"],"Project is not live":["Your project is in draft. Publish project in the",x," tab of your project in Tolstoy"],"Project is deleted":["Project has been deleted"],"No videos found":["Select videos in the Videos tab of your project in Tolstoy"],"No filtered videos found":["Select videos in the Videos tab of your project in Tolstoy"],"No connections found":["Select videos in the Videos tab of your project in Tolstoy"],"No videos found for product":["Add tagged videos for this product in the Videos tab of your project in Tolstoy"]}[L]||["Couldn't find product page"]).forEach(k=>{typeof k=="string"?N.append(document.createTextNode(k)):N.append(k)}),N},Y=({element:L})=>{const h=L.getBoundingClientRect();return h.width===0||h.height===0?!1:h.top>=0&&h.left>=0&&h.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&h.right<=(window.innerWidth||document.documentElement.clientWidth)},W=()=>new URLSearchParams(window.location.search).get("variant")}),C("68VIL",function(e,o){s(e.exports,"xButtonsSvg",function(){return t}),s(e.exports,"getFeedXButtonSvg",function(){return r}),s(e.exports,"getPlayButtonSvg",function(){return n}),s(e.exports,"leftArrowSvg",function(){return i}),s(e.exports,"rightStraightArrowSvg",function(){return c}),s(e.exports,"rightChevron",function(){return d}),s(e.exports,"getPauseSvg",function(){return l}),s(e.exports,"getMutedSvg",function(){return u}),s(e.exports,"getUnmutedSvg",function(){return f}),s(e.exports,"getWarningIcon",function(){return p}),s(e.exports,"getPublishIcon",function(){return E});const t=` `,r=($="#FFFFFF")=>``,n=($="#fff",T="")=>``,i='',c='',d=` `,l=($="#fff",T="")=>` `,u=({color:$="#fff",className:T=""}={})=>``,f=({color:$="#fff",className:T=""}={})=>``,p=()=>` `,E=()=>` Publish `,m=()=>` Videos Design `}),C("519R9",function(e,o){s(e.exports,"default",function(){return c});var t=a("dEa8z"),r=a("93NPo");class n extends t.default{constructor(){if(n.instance)return n.instance;super({shouldArchivePastEvents:!0}),n.instance=this}eventHandler=l=>{const{data:u={}}=l,{eventName:f}=u;if(this.eventCallbacks[f])for(const p of this.eventCallbacks[f])p(l)};postMessage=l=>{const u=l.transmissionId||(0,r.generateUUID)();return super.postMessage({...l,transmissionId:u}),u};init=()=>{this.initListener(this.eventHandler)}}const i=new n;Object.freeze(i);var c=i}),C("dEa8z",function(e,o){s(e.exports,"default",function(){return n});var t=a("lqvQ6");class r{constructor({shouldIncludeLogs:c=!1,shouldArchivePastEvents:d=!1}={}){this.broadcastHub=new t.default,this.eventCallbacks={},this.pastEvents={},this.shouldIncludeLogs=c,this.shouldArchivePastEvents=d}logMessage(c){this.shouldIncludeLogs&&console.log(c)}throwError(c){if(this.shouldIncludeLogs)throw new Error(c)}archivePastEvent(c){if(!this.shouldArchivePastEvents)return;const{eventName:d}=c;this.pastEvents[d]||(this.pastEvents[d]=[]),this.pastEvents[d].push(c)}postMessage(c){this.archivePastEvent(c),this.broadcastHub.postMessage(c)}postPastEvents({eventName:c,callback:d}){if(this.pastEvents[c])for(const l of this.pastEvents[c])d({data:{...l,isPastEvent:!0}})}subscribe({eventName:c,callback:d,shouldIncludePastEvents:l}){if(this.eventCallbacks[c]||(this.eventCallbacks[c]=new Set),this.eventCallbacks[c].has(d)){this.throwError(`Already subscribed to event ${c} with this callback`);return}this.eventCallbacks[c].add(d),l&&this.postPastEvents({eventName:c,callback:d})}subscribeMultipleEvents=({eventNames:c,callback:d,shouldIncludePastEvents:l})=>{for(const u of c)this.subscribe({eventName:u,callback:d,shouldIncludePastEvents:l})};unsubscribe({eventName:c,callback:d}){if(!this.eventCallbacks[c]){this.throwError(`Not subscribed to event ${c}`);return}if(!this.eventCallbacks[c].has(d)){this.throwError("Callback is not subscribed");return}if(!this.eventCallbacks[c].delete(d)){this.logMessage(`Not subscribed to event ${c} with this callback`);return}this.logMessage(`Unsubscribed from event ${c}`)}unsubscribeMultipleEvents=({eventNames:c,callback:d})=>{for(const l of c)this.unsubscribe({eventName:l,callback:d})};initListener(c){this.broadcastHub.addEventListener("message",c)}}var n=r}),C("lqvQ6",function(e,o){s(e.exports,"default",function(){return n});var t=a("93NPo");class r{constructor(c){this.name=c||(0,t.generateUUID)();try{"BroadcastChannel"in self&&(this.broadcaster=new BroadcastChannel(this.name),this.receiver=new BroadcastChannel(this.name))}catch(d){console.error("self is not defined",d)}}postMessage=c=>{this.broadcaster?.postMessage(c)};addEventListener=(...c)=>{this.receiver?.addEventListener(...c)}}var n=r}),C("aEodP",function(e,o){s(e.exports,"INTERNAL_EVENTS",function(){return v});const v={...{modalOpen:"tolstoyModalOpen",playerReady:"tolstoyPlayerReady",toggleFeedCloseButton:"toggleFeedCloseButton",showFeedProductModal:"showFeedProductModal",reportModalOpen:"tolstoyReportModalOpen",reportModalClose:"tolstoyReportModalClose",modalMessagingReady:"tolstoyModalMessagingReady",closePlayer:"tolstoyClosePlayer",userEmailUpdate:"tolstoyUserEmailUpdate"},...{isRebuyAppInstalled:"tolstoyIsRebuyAppInstalled",openRebuyCart:"tolstoyOpenRebuyCart",rebuyCartShown:"rebuyCartShown",rebuyCartHidden:"rebuyCartHidden"},...{openKendoModal:"tolstoyOpenKendoModal",changeZIndex:"tolstoyChangeZIndex"},...{isAfterpayAppInstalled:"tolstoyIsAfterpayAppInstalled"},...{getProductsMetafields:"getProductsMetafields",returnProductsMetafields:"returnProductsMetafields"},...{productCardClick:"tolstoyProductCardClick"},...{spotlightCarouselQuickShopClick:"tolstoySpotlightCarouselQuickShopClick"},...{externalEventSubscribed:"tolstoyExternalEventSubscribed",productCardClickSubscribed:"tolstoyProductCardClickSubscribed"},...{isTapcart:"tolstoyIsTapcart",openTapcartProduct:"tolstoyOpenTapcartProduct"},...{setAnonymousIdToCart:"tolstoySetAnonymousIdToCart",blockAnonymousIdToCart:"tolstoyBlockAnonymousIdToCart",addToCart:"tolstoyAddToCart",addToCartSuccess:"tolstoyAddToCartSuccess",addToCartError:"tolstoyAddToCartError",addToCartSoldOut:"tolstoyAddToCartSoldOut",addToCartDisableDefault:"tolstoyAddToCartDisableDefault",cartItemQuantityChange:"tolstoyCartItemQuantityChange",cartItemQuantityChangeSuccess:"tolstoyCartItemQuantityChangeSuccess",cartItemQuantityChangeError:"tolstoyCartItemQuantityChangeError",cartDataRequest:"tolstoyCartDataRequest",cartDataResponse:"tolstoyCartDataResponse"},...{loginWithMultipassUrlRequest:"tolstoyLoginWithMultipassUrl",loginWithMultipassUrlResponse:"tolstoyLoginWithMultipassUrlResponseMessage"},...{productRecommendationsRequest:"tolstoyProductRecommendationsRequest",productRecommendationsResponse:"tolstoyProductRecommendationsResponse"},...{requestProductsUpdate:"tolstoyRequestProductsUpdate",productUpdateResponse:"tolstoyProductUpdateResponse",moveToUrl:"tolstoyMoveToUrl",isNonBaseCurrency:"tolstoyIsNonBaseCurrency"},...{urlChange:"urlChange",urlLocaleUpdate:"tolstoyUrlLocaleUpdate"},...{openCommerceSettingsUpdate:"tolstoyOpenCommerceSettingsUpdate"},rejectCookiePolicy:"rejectCookiePolicy"}}),C("dQiGr",function(e,o){s(e.exports,"FEATURE_WIDGET_LOADING",function(){return t}),s(e.exports,"FEATURE_WIDGET_ONYOU",function(){return r}),s(e.exports,"FEATURE_WIDGET_ONYOU_ALL_PAGES",function(){return n}),s(e.exports,"FEATURE_WIDGET_FALLBACK_VIDEO",function(){return c}),s(e.exports,"FEATURE_CAROUSEL_SHOW_DOTS",function(){return d}),s(e.exports,"FEATURE_CAROUSEL_VIDEOS",function(){return l}),s(e.exports,"FEATURE_HIDE_SPOTLIGHT_PLUS_BUTTON",function(){return u}),s(e.exports,"FEATURE_APP_USE_CREATOR_PROFILE",function(){return p}),s(e.exports,"FEATURE_BLOCK_SHOPIFY_ADD_TO_CART_ATTRIBUTE",function(){return E}),s(e.exports,"FEATURE_SHOPIFY_PRICE_FORMATTING",function(){return m});const t="widget-loading",r="widget-onyou",n="widget-onyou-enableAllPages",i="widget-site-activity-event",c="widget-video-fallback",d="carousel-show-dots",l="carousel-videos",u="hide-spotlight-plus-button",f="spotlight-auto-resize",p="app-use-creator-profile",E="block-shopify-add-to-cart-attribute",m="shopify-price-formatting"}),C("jvykV",function(e,o){s(e.exports,"reloadFont",function(){return d});var t=a("e857j");const r=[];function n(l,u){const f="italic",p="normal",E={".ttf":"truetype",".otf":"opentype",".woff":"woff",".woff2":"woff2"},m=document.createElement("style");for(const $ of Object.keys(l)){const T=l[$],g=$.includes(f),v=$.split("-")[1]||$.replace(f,"")||p,O=g?f:p,D=Object.keys(E).find(w=>T.includes(w)),R=E[D],U=T.replace("http://","https://");m.append(document.createTextNode(`@font-face { font-family: '${u}'; src: url("${U}") format("${[R]}"); font-weight: ${v}; font-style: ${O}; font-display: swap;}`))}document.head.append(m)}const i=(l,u=1)=>{if(!(!l||u===3)){if(!document.querySelector("#tolstoyWidgetElement")){setTimeout(()=>{i(l,u+1)},1e3);return}document.querySelector("#tolstoyWidgetElement").style.fontFamily=`${l}, ${t.FALLBACK_FONTS}`}},c=l=>{const u=document.head.querySelectorAll("style");return Array.from(u).some(f=>f.textContent.includes(`@font-face { font-family: '${l}';`))};function d(l,u="tolstoy-custom-font-family"){if(!l||r.includes(u)||c(u))return;const{sources:f}=l;n(f,u),i(u),r.push(u)}}),C("e857j",function(e,o){s(e.exports,"FALLBACK_FONTS",function(){return i}),s(e.exports,"TOLSTOY_CUSTOM_FONT_FAMILY",function(){return c}),s(e.exports,"TOLSTOY_CUSTOM_HEADING_FONT_FAMILY",function(){return d});const t="default-header-title",r=100,n=9/16,i="Nunito Sans, sans-serif",c="tolstoy-custom-font-family",d="tolstoy-custom-heading-font-family"}),C("1A9Dw",function(e,o){s(e.exports,"default",function(){return d});var t=a("9bB3T"),r=a("bvKjB"),n=a("eSOI5");const i={A:"A",B:"B"};class c{constructor(u){this.widgetType=u}sendAbTestInitializedEvent({abTestId:u,group:f,excludeExternalAnalytics:p,probability:E}){const m={abTestId:u,eventName:r.EVENT_NAMES.abTestInitialized,sessionUniqueId:(0,n.getSessionUniqueId)(),testGroup:f,probability:E};this.analytics.sendEventImmediately(m,p)}initializeGroup({abTestId:u,probability:f,excludeExternalAnalytics:p}){const E=(0,n.getAbTestGroup)(u);if(E){this.group=E;return}const $=Math.random()>f?i.B:i.A;this.group=$,this.sendAbTestInitializedEvent({abTestId:u,group:$,excludeExternalAnalytics:p,probability:f}),(0,n.setAbTestGroup)(u,$)}init(u){if(!u)return;const{abTestSettings:f={}}=u,{isEnabled:p,abTestId:E,probability:m,groupASettings:$={},groupBSettings:T={},excludeExternalAnalytics:g}=f;if(p)return this.analytics=new t.default({config:u,playerType:this.widgetType}),this.initializeGroup({abTestId:E,probability:m,excludeExternalAnalytics:g}),this.group===i.A?$:T}}var d=c}),C("9bB3T",function(e,o){s(e.exports,"default",function(){return E});var t=a("bvKjB"),r=a("aQK74"),n=a("igWUq"),i=a("50h3S"),c=a("i1NbZ"),d=a("eSOI5"),l=a("kK0IS"),u=a("lxjfR"),f=a("93NPo");class p{constructor({config:$,playerType:T,collectionId:g}){this.config=$,this.publishId=$.publishId,this.playerType=T,this.sessionId=(0,d.getSessionId)()||(0,u.uuidv4)(),this.anonymousId=(0,d.getAndSetAnonymousId)(),this.currentPageProductId=(0,c.getCurrentPageProductId)(),this.collectionId=g,this.errors={}}getIsMobile(){return window.screen.width<=450||window.screen.height<=450}getAnalyticsParams($={}){const{id:T,appKey:g,name:v,googleAnalyticsID:O}=this.config,D=window.location.href.split("?")[0],R=window.Shopify?.shop,U=this.errors;return{appKey:g,publishId:this.publishId,sessionId:this.sessionId,anonymousId:this.anonymousId,currentPageProductId:this.currentPageProductId,isMobile:this.getIsMobile(),pageUrl:D,storeUrl:R,appUrl:R,googleAnalyticsID:O,projectId:T,playlist:v,timestamp:new Date().toISOString(),parentUrl:window.location.href,playerType:this.playerType,customParams:U?JSON.stringify(U):void 0,collectionId:this.collectionId,...$}}sendEventToAllSources($){(0,l.createPlayerEvent)($),(0,r.sendAnalyticsToExternalSource)({data:{...$,name:$.eventName}})}sendEventImmediately($={},T=!1){const g=this.getAnalyticsParams($);(0,l.sendEvent)(g),!T&&(0,r.sendAnalyticsToExternalSource)({data:{...g,name:g.eventName}})}sendEvent($={},T=!1){if(!(0,f.verifyUserConsent)())return;const g=this.getAnalyticsParams($);g.eventName===t.EVENT_NAMES.onYouClick&&console.log("Analytics::sendEvent::params",g),(0,l.createPlayerEvent)(g),!T&&(0,r.sendAnalyticsToExternalSource)({data:{...g,name:g.eventName}})}handlePageView(){(0,r.setImpressionByPublishId)(this.publishId,!1),this.sendEvent({eventName:t.EVENT_NAMES.pageView})}handleEmbedView(){(0,r.setImpressionByPublishId)(this.publishId,!0),this.sendEvent({eventName:t.EVENT_NAMES.embedView})}handleOnYouClick(){(0,r.setImpressionByPublishId)(this.publishId,!0),(0,d.setSessionId)(this.sessionId),this.sendEvent({eventName:t.EVENT_NAMES.onYouClick})}handleSessionStart(){const $=this.getAnalyticsParams({eventName:t.EVENT_NAMES.sessionStart});this.sendEventToAllSources($),(0,n.handleTolstoyStart)({data:{...$,name:i.PLAYER_EVENT_NAMES.sessionStart}}),window.postMessage({...$,name:i.PLAYER_EVENT_NAMES.sessionStart},"*")}handleVideoLoaded($={}){const T=this.getAnalyticsParams({...$,eventName:t.EVENT_NAMES.videoLoaded});this.sendEventToAllSources(T)}handleVideoWatched($={}){const T=this.getAnalyticsParams({...$,eventName:t.EVENT_NAMES.videoWatched});this.sendEventToAllSources(T)}}var E=p}),C("igWUq",function(e,o){s(e.exports,"handleTolstoyStart",function(){return $}),s(e.exports,"handleWatchedProductIds",function(){return v}),s(e.exports,"handleOpenIntegration",function(){return O}),s(e.exports,"handleHideIntegration",function(){return D});var t=a("50h3S"),r=a("bvKjB"),n=a("8ptJJ"),i=a("519R9"),c=a("aEodP"),d=a("93NPo"),l=a("eSOI5");let u,f="";const p=B=>{B.data.eventName===n.TOLSTOY_PLAYER_READY_MESSAGE&&document.querySelector("#tolstoy")?.contentWindow.postMessage({parentUrl:`${window.location.origin}${window.location.pathname}`.slice(0,1999),name:"setTolstoyData",eventName:"setTolstoyData"},"*")},E=B=>{const z=document.querySelector("#smile-ui-container");B&&(f=z?.style.display||""),z?.style?.setProperty("display",B||f)},m=B=>{let z=0;return ie=>{try{ie()}catch(se){try{if(!(0,d.verifyUserConsent)())return;fetch("https://api.gotolstoy.com/events/event",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({eventName:"widgetError",text:se.message,timestamp:new Date().toISOString(),parentUrl:window.location.href,appKey:B.data.appKey,publishId:B.data.publishId,sessionId:B.data.sessionId,source:B.data.name,answerKey:`${z}`,currentPageProductId:ie.toString(),formData:`${(se&&se.stack||"").slice(0,1999)}`})})}catch(it){(0,d.logDevelopmentError)(it)}}finally{z++}}},$=B=>{if(B.data.name===t.PLAYER_EVENT_NAMES.sessionStart||B.data.name===t.PLAYER_EVENTS.autoplayStart){const z=m(B);z(()=>(0,l.setPublishId)(B.data.publishId)),z(()=>(0,l.setTolstoyInteractionDate)(B.data.appKey,B.data.appUrl)),z(()=>(0,l.setSessionId)(B.data.sessionId)),z(()=>(0,l.updateTolstoyActivitySessionIdByPublishId)(B.data.publishId,B.data.sessionId)),z(()=>E("none")),z(()=>g(B.data.anonymousId))}},T=B=>{B.data.name===r.EVENT_NAMES.tolstoyModalClose&&E()},g=B=>{window.Shopify&&i.default.postMessage({eventName:c.INTERNAL_EVENTS.setAnonymousIdToCart,anonymousId:B})},v=({data:{name:B,publishId:z,productIds:ie}={}})=>{if(B===n.TOLSTOY_WATCHED_PRODUCT_IDS_MESSAGE)for(const se of ie)(0,l.pushTolstoyViewedProducts)({productId:se,publishId:z})},O=B=>{Ue[B.data.name]&&Ue[B.data.name](B.data)},D=B=>{Ve[B.data.name]&&setTimeout(()=>Ve[B.data.name](),500)},R=()=>{window.GorgiasChat&&(window.GorgiasChat.open?.(),window.tolstoyWidget.hide(),document.head.insertAdjacentHTML("beforeend",""))},U=()=>{window.GorgiasChat&&(window.GorgiasChat.close?.(),document.head.insertAdjacentHTML("beforeend",""))},w=()=>{window.adaEmbed&&(window.adaEmbed.toggle(),window.tolstoyWidget.hide())},P=()=>{document.head.insertAdjacentHTML("beforeend","")},V=()=>{window.fcWidget&&(window.fcWidget.show(),window.fcWidget.open(),window.tolstoyWidget.hide())},F=()=>{window.fcWidget&&(window.fcWidget.close(),window.fcWidget.hide(),window.tolstoyWidget.show())},S=()=>{if(!u&&window.Reamaze?.popup){window.Reamaze.popup(),window.tolstoyWidget.hide();return}window._support&&u&&window.Reamaze?.reload&&(window._support.ui=u,window.Reamaze.reload(),u=null,window.tolstoyWidget.hide())},M=()=>{window._support?.ui&&window.Reamaze?.reload&&(u=window._support.ui,delete window._support.ui,window.Reamaze.reload(),window.tolstoyWidget.show())},Y=()=>{const B=setTimeout(()=>clearInterval(z),9e3),z=setInterval(()=>{window.Intercom&&(window.Intercom("show"),window.tolstoyWidget.hide(),clearInterval(z),clearTimeout(B),window.Intercom("onHide",()=>{window.tolstoyWidget.show()}))})},W=()=>{const B=setTimeout(()=>clearInterval(z),9e3),z=setInterval(()=>{window.Intercom&&(window.Intercom("update",{hide_default_launcher:!0}),clearInterval(z),clearTimeout(B))},100)},L=()=>{window.Tawk_API&&(window.Tawk_API.maximize(),window.tolstoyWidget.hide())};function h(){window.Tawk_API&&window.Tawk_API.hideWidget()}const N=()=>{window.LiveChatWidget&&(window.LiveChatWidget.call("maximize"),window.tolstoyWidget.hide())};function A(){window.LiveChatWidget&&window.LiveChatWidget.call("hide")}const x=()=>{window.HubSpotConversations&&window.HubSpotConversations.widget&&(window.HubSpotConversations.widget.open(),window.tolstoyWidget.hide())};function y(){window.HubSpotConversations&&window.HubSpotConversations.widget&&window.HubSpotConversations.widget.close()}const H=()=>{window.Beacon&&(window.Beacon("open"),window.tolstoyWidget.hide(),window.Beacon("config",{display:{zIndex:"99999"}}))},k=()=>{window.Beacon&&window.Beacon("config",{display:{zIndex:"0"}})},K=()=>{window.drift&&(window.drift.api.toggleChat(),window.tolstoyWidget.hide())},oe=()=>{window.drift&&window.drift.api.widget.hide()},X=()=>{window.zE&&(window.zE("messenger","open"),document.querySelector('[title="Button to launch messaging window"]')?.style?.setProperty("display","block"),window.tolstoyWidget.hide())},re=()=>{const B=setTimeout(()=>clearInterval(z),5e3),z=setInterval(()=>{const ie=document.querySelector('[title="Button to launch messaging window"]'),se=document.querySelector('[title="Message from company"]');ie?.style?.setProperty("display","none"),se?.parentElement?.style?.setProperty("display","none"),ie&&se&&(clearInterval(z),clearTimeout(B))},100);window.zE&&window.zE("messenger","close")},q=()=>{window.tidioChatApi&&(window.tidioChatApi.show(),window.tidioChatApi.open(),window.tolstoyWidget.hide())},le=()=>{window.tidioChatApi&&window.tidioChatApi.close()},he=B=>{if(window.certainly)switch(window.certainly.widgetStatus({action:"open"}),window.tolstoyWidget.hide(),B.data.key){case"PmkMI":window.certainly.goTo({module:"670442"});break;case"_23Hl":window.certainly.goTo({module:"670178"});break;case"P9rfq":window.certainly.goTo({module:"670179"});break;default:break}},ge=()=>{window.certainly&&window.certainly.widgetStatus({action:"hide"})},we=B=>{document.head.insertAdjacentHTML("beforeend",``)},Se=()=>{we("#vfChat+div"),we("#vfChat+div+div")},ue="tolstoyHideFreshChat",Xe="tolstoyOpenFreshChat",Je="tolstoyHideReamaze",et="tolstoyOpenReamaze",tt="tolstoyHideAda",Gt="tolstoyOpenAda",ot="tolstoyHideTidio",rt="tolstoyOpenTidio",nt="tolstoyHideCertainly",st="tolstoyOpenCertainly",at="tolstoyHideVfChat",Ue={[t.PLAYER_EVENT_NAMES.openGorgias]:R,[t.PLAYER_EVENT_NAMES.openIntercom]:Y,[t.PLAYER_EVENT_NAMES.openTawkTo]:L,[t.PLAYER_EVENT_NAMES.openLiveChat]:N,[t.PLAYER_EVENT_NAMES.openHubSpot]:x,[t.PLAYER_EVENT_NAMES.openDrift]:K,[t.PLAYER_EVENT_NAMES.openZendesk]:X,[t.PLAYER_EVENT_NAMES.openHelpScout]:H,[Xe]:V,[et]:S,[Gt]:w,[rt]:q,[st]:he},Ve={[t.PLAYER_EVENT_NAMES.hideGorgias]:U,[t.PLAYER_EVENT_NAMES.hideIntercom]:W,[t.PLAYER_EVENT_NAMES.hideTawkTo]:h,[t.PLAYER_EVENT_NAMES.hideLiveChat]:A,[t.PLAYER_EVENT_NAMES.hideHubSpot]:y,[t.PLAYER_EVENT_NAMES.hideDrift]:oe,[t.PLAYER_EVENT_NAMES.hideZendesk]:re,[t.PLAYER_EVENT_NAMES.hideHelpScout]:k,[ue]:F,[Je]:M,[tt]:P,[at]:Se,[ot]:le,[nt]:ge}}),C("8ZCcc",function(e,o){s(e.exports,"getFeatureSettings",function(){return r}),s(e.exports,"getFeatureIsEnabled",function(){return n}),s(e.exports,"getIsPlayerLazy",function(){return i}),s(e.exports,"getPlayerOrigin",function(){return c}),s(e.exports,"getIsFallbackVideoDisabled",function(){return d});var t=a("dQiGr");const r=({config:l,featureKey:u})=>l?.featureSettings?.[u],n=({config:l,featureKey:u})=>!!l?.featureSettings?.[u],i=(l={})=>r({config:l,featureKey:t.FEATURE_WIDGET_LOADING})?.playerLazy,c=(l={})=>r({config:l,featureKey:t.FEATURE_WIDGET_LOADING})?.playerOrigin,d=(l={})=>r({config:l,featureKey:t.FEATURE_WIDGET_FALLBACK_VIDEO})?.dontUseFallback}),C("6MJM3",function(e,o){s(e.exports,"getBaseUrl",function(){return l}),s(e.exports,"getImageUrlByStep",function(){return u}),s(e.exports,"setVideoSourceOnEnd",function(){return f});var t=a("e8kzi"),r=a("kq83N"),n=a("j2c9o"),i=a("iG8TK");const c=480,d=({isMobile:p,isStory:E,isPlayInTileFirst:m,isTile:$})=>m||$?"_640.mp4":p||E?"_preview.mp4":"_preview_embed.mp4",l=({step:p,isStory:E,isPlayInTileFirst:m,height:$=i.DEFAULT_TILE_HEIGHT,isTile:T})=>{const{videoOwner:g,stockAsset:v,videoId:O}=p,D=window.innerWidth<=450,R=d({isMobile:D,isStory:E,isPlayInTileFirst:m,isTile:T}),U=v?.videoUrl,w=!!v?.shopifyFileId,P=v?.previewUrl,V=v?.hasOriginal,F=v?.gifUrl,S=w&&!V;return P&&!m&&${const T=window.innerWidth<=450?n.WEBP_AVATAR_EXTENSION:n.WEBP_EXTENSION;return(0,t.getImageUrl)({step:p,extension:T,posterSettings:E,size:m})},f=(p,E)=>{const m=()=>{if(p.autoplay){p.src="";return}p.src=E};p.addEventListener("ended",m,{once:!0})}}),C("e8kzi",function(e,o){s(e.exports,"buildUrl",function(){return n}),s(e.exports,"getPosterUrlFromStockAsset",function(){return i}),s(e.exports,"getImageUrl",function(){return c});var t=a("2Aomz"),r=a("kq83N");const n=({path:d=`${t.VIDEO_OUTPUT}/public`,ownerId:l="",assetId:u="",suffix:f="",extension:p=""})=>`${d}/${l}/${u}/${u}${f}${p}`,i=({stockAsset:d={},posterSettings:l={}})=>{const{useShopifyPoster:u=!0}=l,{shopifyPosterUrl:f,posterUrl:p}=d||{};return f&&u?f:p},c=({step:d,extension:l,posterSettings:u,size:f=r.IMAGE_DIMENSIONS["250x250"],custom:p={condition:"",callback:""},path:E=`${t.VIDEO_OUTPUT}/public`})=>{const{videoOwner:m,videoId:$,stockAsset:T={},mediaAssets:g}=d;if(!$)return"";const{avatarUrl:v,posterUrl:O,hasOriginal:D,shopifyPosterUrl:R}=T||{},{shopifyAttributes:U={},shopifySpotlightAttributes:w={},useShopifyPoster:P=!1}=u||{},V={...U,...w},F=!!Object.keys(V)?.length,S=R&&P&&F;if(O)return O;if(g&&g?.images&&g?.images[f]&&!S)return g.images[f];const M=!D&&(v||O);if(R&&!1){let W="width=300";return P&&(W=new URLSearchParams(V).toString()),`${R}&${W}`}return O?.endsWith(l)||O&&!D?O:p?.condition&&p?.callback&&p.condition({posterUrl:O,avatarUrl:v,extension:l,isDuplicated:M})?p.callback(T):n({path:E,ownerId:m,assetId:$,extension:l})}}),C("kq83N",function(e,o){s(e.exports,"DEFAULT_IMAGE_EXTENSION",function(){return t}),s(e.exports,"ASSET_TYPE",function(){return r}),s(e.exports,"IMAGE_SIZE",function(){return n}),s(e.exports,"IMAGE_SIZE_SUFFIX",function(){return i}),s(e.exports,"IMAGE_DIMENSIONS",function(){return c});const t=".webp",r={VIDEO:"video",IMAGE:"image",GALLERY:"gallery"},n={XS:250,S:480,M:960,L:1280,XL:1920},i={[n.XS]:"_250",[n.S]:"_480",[n.M]:"_960",[n.L]:"_1280",[n.XL]:"_1920"},c={"250x140":"250x140","250x250":"250x250","480x480":"480x480","960x540":"960x540"}}),C("j2c9o",function(e,o){s(e.exports,"WEBP_AVATAR_EXTENSION",function(){return t}),s(e.exports,"WEBP_EXTENSION",function(){return r}),s(e.exports,"JPG_AVATAR_EXTENSION",function(){return n}),s(e.exports,"JPG_EXTENSION",function(){return i});const t=".avatar.0000000.webp",r=".401.0000000.webp",n=".avatar.0000000.jpg",i=".0000000.jpg"}),C("e7CwX",function(e,o){e.exports=a("1rN27")(a("jHnDr").resolve("jzpb5")).then(()=>a("2apiB"))}),C("1rN27",function(e,o){"use strict";var t=a("JNMYe");e.exports=t(function(r){return new Promise(function(n,i){var c=document.getElementsByTagName("script");if([].concat(c).some(function(u){return u.src===r})){n();return}var d=document.createElement("link");d.href=r,d.rel="preload",d.as="script",document.head.appendChild(d);var l=document.createElement("script");l.async=!0,l.type="text/javascript",l.src=r,l.onerror=function(u){var f=new TypeError("Failed to fetch dynamically imported module: ".concat(r,". Error: ").concat(u.message));l.onerror=l.onload=null,l.remove(),i(f)},l.onload=function(){l.onerror=l.onload=null,n()},document.getElementsByTagName("head")[0].appendChild(l)})})}),C("JNMYe",function(e,o){"use strict";var t={},r={},n={};function i(c){switch(c){case"preload":return r;case"prefetch":return n;default:return t}}e.exports=function(c,d){return function(l){var u=i(d);return u[l]?u[l]:u[l]=c.apply(null,arguments).catch(function(f){throw delete u[l],f})}}}),C("krrJN",function(e,o){e.exports=a("1rN27")(a("jHnDr").resolve("89rZX")).then(()=>a("hdNOp"))}),C("fGHMu",function(e,o){e.exports=Promise.all([a("9FDC1")(a("jHnDr").resolve("ls8QA")),a("1rN27")(a("jHnDr").resolve("cDpG9")),a("1rN27")(a("jHnDr").resolve("34FYC"))]).then(()=>a("2LevF"))}),C("9FDC1",function(e,o){"use strict";var t=a("JNMYe");e.exports=t(function(r){return new Promise(function(n,i){var c=document.getElementsByTagName("link");if([].concat(c).some(function(l){return l.href===r&&l.rel.indexOf("stylesheet")>-1})){n();return}var d=document.createElement("link");d.rel="stylesheet",d.href=r,d.onerror=function(l){d.onerror=d.onload=null,d.remove(),i(l)},d.onload=function(){d.onerror=d.onload=null,n()},document.getElementsByTagName("head")[0].appendChild(d)})})}),C("bjM0J",function(e,o){e.exports=Promise.all([a("9FDC1")(a("jHnDr").resolve("1U8tk")),a("1rN27")(a("jHnDr").resolve("cDpG9")),a("1rN27")(a("jHnDr").resolve("l1VTG"))]).then(()=>a("8EN4e"))}),C("bqpZk",function(e,o){e.exports=Promise.all([a("9FDC1")(a("jHnDr").resolve("cGSvp")),a("1rN27")(a("jHnDr").resolve("jiIH5"))]).then(()=>a("2IbOs"))}),C("kzluS",function(e,o){e.exports=Promise.all([a("9FDC1")(a("jHnDr").resolve("6iLLd")),a("1rN27")(a("jHnDr").resolve("lCIdQ"))]).then(()=>a("a0Gsc"))}),C("dtdnN",function(e,o){e.exports=Promise.all([a("9FDC1")(a("jHnDr").resolve("ksyNr")),a("1rN27")(a("jHnDr").resolve("6mZ8R"))]).then(()=>a("li39R"))}),C("a78DZ",function(e,o){s(e.exports,"default",function(){return n});var t=a("eSOI5");class r{addHours(c,d=new Date){return d.setTime(d.getTime()+c*36e5),d}getTolstoyViewers(){const c=(0,t.getTolstoyViewers)();for(const[l,u]of Object.entries(c)){const f=u.restrictionLimits;!f||!(f?.time&&new Date(f?.time)<=new Date)||delete c[l].restrictionLimits}const d=JSON.stringify(c);return(0,t.setTolstoyViewers)(c),d}updateRestrictions(c,d){const l=(0,t.getTolstoyViewers)(),u=l[d]?.restrictionLimits;if(!u||u?.type!==c)return;const f=u[c];u[c]=f?f+1:1,u.limit&&u.clickLimit===u[c]&&(u.time=this.addHours(u?.limit)),l[d].restrictionLimits=u,(0,t.setTolstoyViewers)(l)}updateRules(c){const d=c?.publishId||void 0,l=c?.limit,u=(0,t.getTolstoyViewers)();let f=u[d];const p=f?.restrictionLimits;f?f.impressionCount+=1:f={impressionCount:1,playCount:0};let E=u.undefined;if(E?E.impressionCount+=1:E={impressionCount:1,playCount:0},l){let m={limit:Number(l.timeLimit),type:l.type,clickLimit:Number(l.clickLimit)};p&&(m={...p,...m}),f.restrictionLimits=m}else p&&(f.restrictionLimits=null);u[d]=f,u.undefined=E,(0,t.setTolstoyViewers)(u)}}var n=r}),C("7Tj0o",function(e,o){s(e.exports,"default",function(){return r});class t{static isValidUrl(i){return i?i.startsWith("tel:")||i.startsWith("mailto:")?!0:i.match(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g)!==null:!1}static isAndroid(){return navigator.userAgent.toLowerCase().indexOf("android")>-1}static isInIframe(){try{return window.self!==window.top}catch{return!0}}static isIos(){return/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}static getMobileOperatingSystem(){const i=navigator.userAgent||navigator.vendor||window.opera;return/windows phone/i.test(i)?"Windows Phone":/android/i.test(i)?"Android":/iPad|iPhone|iPod/.test(i)&&!window.MSStream?"iOS":navigator.userAgent.match(/Mac/)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2?"ipad":null}static isMobile(){return t.getMobileOperatingSystem()!=null}static isSafari(){return window.safari!==void 0}static enforceProtocol(i,c="https"){return i.startsWith("http")||i.startsWith("//")||i.startsWith("tel:")||i.startsWith("mailto:")?i:`${c}://${i}`}static removeProtocol(i){return i.replace(/(^\w+:|^)\/\//,"")}static stripUrl(i){return t.removeProtocol(i).replace(/^www./,"").replace(/\/$/,"")}static stringifyUrlParams(i){const c=new URLSearchParams;return Object.entries(i).forEach(([d,l])=>{c.set(d,l)}),c.toString()}}var r=t}),C("k3iEx",function(e,o){s(e.exports,"isShopifyStore",function(){return E}),s(e.exports,"getCustomerId",function(){return g}),s(e.exports,"getEmailFromParams",function(){return O}),s(e.exports,"getTolstoyAutoOpen",function(){return D}),s(e.exports,"getTolstoyAutoOpenOnYou",function(){return R}),s(e.exports,"getTolstoyStartVideo",function(){return U}),s(e.exports,"getTolstoyMoneyFormat",function(){return w}),s(e.exports,"getIframeSource",function(){return F});var t=a("eSOI5"),r=a("2Aomz"),n=a("kCbDV"),i=a("37dzN"),c=a("izL3O"),d=a("8ZCcc"),l=a("lUrCX"),u=a("lY4N9"),f=a("93NPo");const p=(S,M,Y)=>{if(Y)return`${r.ON_YOU_URL}`;const W=(0,d.getPlayerOrigin)(S);if(W){const h=(0,f.getSafeParameter)("td"),N=m(S);return h&&N?W.replace("2.0.0","2.0.0-ls"):N?W.replace("2.0.0","2.0.0-l"):h?W.replace("2.0.0","2.0.0-s"):W}let L=`${r.PLAYER_URL}`;return M&&(L+="/feed"),S.publishId&&(L+=`/${S.publishId}`),L},E=()=>!!(window.Shopify&&window.Shopify?.routes),m=S=>S.playerLazy||(0,f.getSafeParameter)("pl"),$=S=>S?.featureSettings?.[i.FEATURE_PLAYER_VERSION]?.version,T=S=>S?.carouselEmbed?.carouselPlayInTileFirst?n.IN_TILE_CAROUSEL_EMBED_WIDGET:"",g=()=>window._st?.cid||window.ShopifyAnalytics?.meta?.page?.customerId||"",v=()=>new URLSearchParams(window.location.search).get("authToken"),O=()=>window.tolstoyUserInfo?.email||window.tolstoyUser,D=()=>(0,f.getSafeParameter)(n.URL_PARAMETERS.tolstoyAutoOpen)||window.tolstoyAutoOpen,R=()=>(0,f.getSafeParameter)(n.URL_PARAMETERS.tolstoyAutoOpenOnYou)||window.tolstoyAutoOpenOnYou,U=()=>(0,f.getSafeParameter)(n.URL_PARAMETERS.tolstoyStartVideo)||window.tolstoyStartVideo,w=()=>{const S=window.tolstoyMoneyFormat;return S?encodeURIComponent(S):""},P=({data:S,onYouMode:M})=>{const Y=window.Shopify?.shop||(0,c.getShop)(),{productId:W}=S,L=`${window.location.origin}${window.location.pathname}`,h=window.location.href,N=localStorage.getItem("tolstoy-anonymousId"),A=Array.from(document.querySelectorAll("div")||{}).find(H=>H.textContent.trim()==="Size & Fit"),x=Array.from(A?.nextElementSibling?.childNodes||{}).filter(H=>H.nodeType===Node.TEXT_NODE).map(H=>H.textContent.trim()).join(" "),y=new URLSearchParams;return y.append("appUrl",Y),y.append("productId",W),y.append("url",L),y.append("urlWithQueryParams",h),y.append("isTolstoyStories","true"),N&&y.append("tolstoyAnonymousId",N),x&&y.append("productFitDetails",x),M&&y.append("mode",M),y.toString().split("&")},V=({data:S,isFeed:M,isOnYou:Y,email:W,isDynamic:L,modalId:h,tolstoyStartVideo:N,onYouMode:A})=>{if(Y)return P({data:S,onYouMode:A});const y=[`url=${`${window.location.origin}${window.location.pathname}`.slice(0,1999)}`,`modalId=${h}`];S.publishId&&y.push(`publishId=${S.publishId}`);const H=v();H&&y.push(`authToken=${H}`);const k=W||O();k&&y.push(`email=${encodeURIComponent(k)}`),S.productId&&y.push(`productId=${S.productId}`),S.currentProductDbId&&y.push(`currentPageDbProductId=${S.currentProductDbId}`);const K=window.Shopify?.shop||"",oe=!!(E()&&K);if(y.push("host",`safari=${!!window?.safari}`,`dontDownload=${!!S.dontDownload}`,`playerType=${S.playerType}`,`isShopifyStore=${oe}`,`shopifyStoreUrl=${K}`,`ai=${(0,t.getAndSetAnonymousId)()}`),E()){const ue=window.Shopify?.routes?.root;ue&&y.push(`shopifyRootRoute=${ue}`)}if(window.tolstoyUserInfo?.name&&y.push(`name=${encodeURIComponent(window.tolstoyUserInfo.name)}`),window.tolstoyUserInfo?.phone&&y.push(`phone=${encodeURIComponent(window.tolstoyUserInfo.phone)}`),window.tolstoyMoneyFormat){const ue=w();y.push(`tolstoyMoneyFormat=${ue}`)}N&&y.push(`tolstoyStartVideo=${N}`),S.testGroup&&y.push(`group=${S.testGroup}`),S.sneakpeek&&y.push("sneakpeek"),S.sneakpeek_hidden&&y.push("sneakpeek_hidden"),S.token&&y.push(`token=${S.token}`),S.gclid&&y.push(`gclid=${S.gclid}`),S.widgetDelay&&y.push("delay"),S.isShoppable===!1&&y.push(`isShoppable=${S.isShoppable}`),S.si&&y.push(`si=${S.si}`);const X=(0,f.getSafeParameter)("td");X&&y.push(`td=${X}`);const re=m(S);re&&y.push(`pl=${re}`);const q=$(S);q&&y.push(`pv=${q}`);const le=T(S);le&&y.push(`playerVariant=${le}`),L&&y.push("isDynamic=true");const he=g();he&&y.push(`customerId=${he}`);const ge=(0,l.getUrlCustomParams)();ge.size>0&&y.push(ge.toString()),(0,u.getIsTapcart)()&&y.push("isTapcart=true");const Se=(0,d.getPlayerOrigin)(S);return Se&&S.publishId&&y.push(`publishId=${S.publishId}`),Se&&M&&y.push("isFeed=true"),window.tolstoySettings?.shouldUseCache&&y.push(`shouldUseCache=${window.tolstoySettings?.shouldUseCache}`),window.tolstoySettings?.cacheVersion&&y.push(`cacheVersion=${window.tolstoySettings?.cacheVersion}`),(0,f.verifyUserConsent)()||y.push("userConsent=false"),y},F=({data:S,isFeed:M,isOnYou:Y,email:W,isDynamic:L,modalId:h,tolstoyStartVideo:N,onYouMode:A})=>{const x=p(S,M,Y),y=V({data:S,isFeed:M,isOnYou:Y,email:W,isDynamic:L,modalId:h,tolstoyStartVideo:N,onYouMode:A});return`${x}?${y.join("&")}`}}),C("37dzN",function(e,o){s(e.exports,"FEATURE_PLAYER_VERSION",function(){return t});const t="player-version"}),C("enQtM",function(e,o){e.exports=Promise.all([a("9FDC1")(a("jHnDr").resolve("isfCu")),a("1rN27")(a("jHnDr").resolve("cDpG9")),a("1rN27")(a("jHnDr").resolve("aKM9X"))]).then(()=>a("4FBx6"))}),C("bQxIb",function(e,o){e.exports=Promise.all([a("9FDC1")(a("jHnDr").resolve("koqqC")),a("1rN27")(a("jHnDr").resolve("cDpG9")),a("1rN27")(a("jHnDr").resolve("b9uE3"))]).then(()=>a("9Du8u"))}),C("5GzNL",function(e,o){s(e.exports,"PUBLIC_CLASSES",function(){return t}),s(e.exports,"TOLSTOY_TV_CONTAINER_ID",function(){return r}),s(e.exports,"TOLSTOY_TV_ID",function(){return n}),s(e.exports,"AB_TEST_PUBLISH_IDS",function(){return i});const t={tvContainer:"tolstoy-video-page"},r="tolstoy-tv-container",n="tolstoy-tv",i={}}),C("6TwUM",function(e,o){e.exports=Promise.all([a("9FDC1")(a("jHnDr").resolve("3xAff")),a("1rN27")(a("jHnDr").resolve("dTIhU"))]).then(()=>a("3c1EV"))}),C("kHyIS",function(e,o){s(e.exports,"EXTERNAL_EVENTS_TO_SUBSCRIBE",function(){return t}),s(e.exports,"EXTERNAL_EVENTS_TO_POST",function(){return r}),s(e.exports,"ALLOWED_EXTERNAL_EVENTS_TO_SUBSCRIBE",function(){return n}),s(e.exports,"ALLOWED_EXTERNAL_EVENTS_TO_POST",function(){return i});const t={addToCart:"tolstoy_add_to_cart",spotlightCarouselQuickShopClick:"tolstoy_spotlight_carousel_quick_shop_click",productCardClick:"tolstoy_product_card_click"},r={addToCartSuccess:"tolstoy_add_to_cart_success",addToCartError:"tolstoy_add_to_cart_error",rejectCookiePolicy:"tolstoy_reject_cookie_policy",tolstoyZIndexChange:"tolstoy_z_index_change",urlLocaleUpdate:"tolstoy_url_locale_update",productUpdate:"tolstoy_product_update"},n=Object.values(t),i=new Set([r.addToCartSuccess,r.addToCartError,r.rejectCookiePolicy,r.tolstoyZIndexChange,r.urlLocaleUpdate,r.productUpdate])}),C("k6zg1",function(e,o){s(e.exports,"getIsBaseCurrency",function(){return t}),s(e.exports,"isShopifyCdnUrl",function(){return r});const t=()=>Number(window.Shopify?.currency?.rate)===1,r=n=>typeof n=="string"&&n.includes("cdn.shopify.com")}),C("4dQPj",function(e,o){s(e.exports,"default",function(){return E});var t=a("aEodP"),r=a("8ptJJ"),n=a("519R9"),i=a("e3391");const c={},d={},l={},u=[];class f{constructor(){if(f.instance)return f.instance;f.instance=this}registerIframe({modalId:$,modalIframe:T}){c[$]=T}postInternalMessage({modalId:$,data:T}){delete T.modalId;const g=n.default.postMessage(T);l[g]=$}handleModalMessagingReady({modalId:$}){d[$]=!0;const T=c[$];for(const g of u){const{transmissionId:v}=g,O=l[v];(!O||O===$)&&this.postMessageToIframe({iframe:T,message:g})}}eventHandler=({data:$={}})=>{const{modalId:T,eventName:g}=$;if(T)switch(g){case t.INTERNAL_EVENTS.addToCart:case t.INTERNAL_EVENTS.openRebuyCart:case t.INTERNAL_EVENTS.openKendoModal:case t.INTERNAL_EVENTS.getProductsMetafields:case t.INTERNAL_EVENTS.productCardClick:case t.INTERNAL_EVENTS.loginWithMultipassUrlRequest:case t.INTERNAL_EVENTS.cartItemQuantityChange:case t.INTERNAL_EVENTS.cartDataRequest:case t.INTERNAL_EVENTS.productRecommendationsRequest:case t.INTERNAL_EVENTS.requestProductsUpdate:case t.INTERNAL_EVENTS.moveToUrl:case t.INTERNAL_EVENTS.showFeedProductModal:case t.INTERNAL_EVENTS.reportModalOpen:case t.INTERNAL_EVENTS.reportModalClose:case r.TOLSTOY_PLAYER_READY_MESSAGE:return this.postInternalMessage({modalId:T,data:$});case t.INTERNAL_EVENTS.modalMessagingReady:return this.postInternalMessage({modalId:T,data:$}),this.handleModalMessagingReady({modalId:T});case t.INTERNAL_EVENTS.toggleFeedCloseButton:return this.postInternalMessage({modalId:T,data:$});default:return null}};internalEventHandler=({data:$})=>{this.postMessageToModal($)};postMessageToIframe({iframe:$,message:T}){$.contentWindow?.postMessage(T,"*")}postMessageToAllIframes({message:$}){u.push($);for(const[T,g]of Object.entries(c))d[T]&&this.postMessageToIframe({iframe:g,message:$})}postMessageToModal($){const{transmissionId:T,shouldEndTransmission:g=!0,...v}=$,O=l[T];if(!O)return this.postMessageToAllIframes({message:v});if(!d[O]){u.push($);return}const R=c[O];this.postMessageToIframe({iframe:R,message:v}),g&&delete l[T]}initInternalMessagingSubscriptions=()=>{n.default.subscribeMultipleEvents({eventNames:i.INTERNAL_MESSAGES_TO_SUBSCRIBE,callback:this.internalEventHandler})};init(){this.initInternalMessagingSubscriptions(),window.addEventListener("message",this.eventHandler)}}const p=new f;Object.freeze(p);var E=p}),C("e3391",function(e,o){s(e.exports,"INTERNAL_MESSAGES_TO_SUBSCRIBE",function(){return r});var t=a("aEodP");const r=[t.INTERNAL_EVENTS.addToCartError,t.INTERNAL_EVENTS.addToCartSuccess,t.INTERNAL_EVENTS.addToCartSoldOut,t.INTERNAL_EVENTS.isRebuyAppInstalled,t.INTERNAL_EVENTS.isAfterpayAppInstalled,t.INTERNAL_EVENTS.openRebuyCart,t.INTERNAL_EVENTS.returnProductsMetafields,t.INTERNAL_EVENTS.rejectCookiePolicy,t.INTERNAL_EVENTS.productCardClickSubscribed,t.INTERNAL_EVENTS.isTapcart,t.INTERNAL_EVENTS.urlLocaleUpdate,t.INTERNAL_EVENTS.loginWithMultipassUrlResponse,t.INTERNAL_EVENTS.cartDataResponse,t.INTERNAL_EVENTS.cartItemQuantityChangeSuccess,t.INTERNAL_EVENTS.cartItemQuantityChangeError,t.INTERNAL_EVENTS.productRecommendationsResponse,t.INTERNAL_EVENTS.productUpdateResponse,t.INTERNAL_EVENTS.isNonBaseCurrency,t.INTERNAL_EVENTS.eventListenersInitialized]});var Bn={};a("jHnDr").register(a("2372k").getBundleURL("fWNwr"),JSON.parse('["fWNwr","widget.js","jzpb5","widget.events.js","89rZX","carousel-loader.js","izN8B","carousel-skeleton.js","1NB7b","CarouselSkeleton.66dafc9f.js","ew0qU","CarouselSkeleton.a4b79390.css","dj7hR","carousel.js","cDpG9","Carousel.4837b2d2.js","kFOMR","Carousel.d0113a03.css","2SjbV","spotlight-carousel-controller.js","2GnTj","SpotlightCarouselController.c61be7c9.css","34FYC","story.js","ls8QA","Story.ef5ade25.css","l1VTG","embed.js","1U8tk","Embed.9bcdb556.css","jiIH5","tile.js","cGSvp","Tile.864911ff.css","lCIdQ","collection-tile-controller.js","6iLLd","CollectionTileController.821f8f4a.css","6mZ8R","collection-page-tile-controller.js","ksyNr","CollectionPageTileController.104ab420.css","aKM9X","centered-modal.js","isfCu","CenteredModal.ce242a2e.css","b9uE3","bubble.js","koqqC","Bubble.8f869649.css","dTIhU","t-v.js","3xAff","TV.8d0c699d.css"]'));var Pe=a("aQK74"),Kt=a("xb7kn"),dt=a("2Aomz"),ne=a("lY4N9");const Ae={PDP_CAROUSEL:"pdp-carousel",VIDEO_PAGE:"video-page"},ce={HEADER:"header",HEADER_AND_BOTTOM_NAVBAR:"header-and-bottom-navbar",CUSTOM_SCREEN:"custom-screen",CUSTOM_SCREEN_AND_BOTTOM_NAVBAR:"custom-screen-and-bottom-navbar"},Be=e=>document.documentElement.style.setProperty("height",`${e}px`,"important"),jt=()=>navigator.userAgent.toLowerCase().includes("android"),zt=e=>{const o=window.screen.availHeight,t=window.Tapcart.variables.device.windowHeight;switch(e){case ce.HEADER:return t;case ce.HEADER_AND_BOTTOM_NAVBAR:return t;case ce.CUSTOM_SCREEN:return o-100;case ce.CUSTOM_SCREEN_AND_BOTTOM_NAVBAR:return o-184;default:return t||o}},qt=e=>{const o=window.screen.availHeight,t=window.Tapcart.variables.device.windowHeight;switch(e){case ce.HEADER:return t;case ce.HEADER_AND_BOTTOM_NAVBAR:return t-75;case ce.CUSTOM_SCREEN:return o-90;case ce.CUSTOM_SCREEN_AND_BOTTOM_NAVBAR:return o-175;default:return t||o}},Qt=e=>jt()?zt(e):qt(e),Zt=(e,o)=>{const t=Qt(o.navType);Be(t)},Xt=e=>` `,Jt=(e={})=>{const{height:o=490}=e;let t=0;const r=setInterval(function(){t++;const n=document.querySelector(".tolstoy-carousel-container"),i=document.querySelector(".tolstoy-carousel");n&&i?(i.style.display="block",Be(o),clearInterval(r)):t>=50&&clearInterval(r)},200)},eo=(e,o)=>{Be(0),Jt(o)},to=e=>{const o=window?.Tapcart?.variables?.product?.id;return` `},oo=async(e,o)=>{switch(o.blockType){case Ae.PDP_CAROUSEL:eo(e,o);break;case Ae.VIDEO_PAGE:Zt(e,o);break;default:break}},ro=`
Tolstoy widget will appear here.
Click on preview in top right to see widget.
`,no=async()=>{const e=document.querySelectorAll("tolstoy-block");if(e.length!==0){if((0,ne.isTapcartDashboard)()){for(const o of Array.from(e))o.outerHTML=ro;return}for(const o of Array.from(e)){const{publishId:t,blockType:r,navType:n,height:i}=o.dataset||{},c={blockType:r,navType:n,height:i};let d="";switch(r){case Ae.PDP_CAROUSEL:d=to(t);break;case Ae.VIDEO_PAGE:d=Xt(t);break;default:break}d&&(o.outerHTML=d,oo(o,c))}}};var Q=a("kCbDV"),be=a("ljwIw"),ne=a("lY4N9"),Q=a("kCbDV"),J=a("6QfcD"),Oe=a("i1NbZ"),ae=a("kK0IS"),so=a("fgRdL"),ao=a("2S3LN"),te=a("93NPo"),de=a("4lhba");function io(e){function o(){n&&(t.length>0&&/^[~+>]$/.test(t[t.length-1])&&t.push(" "),t.push(n))}var t=[],r,n,i,c=[0],d=0,l,u=/(?:[^\\]|(?:^|[^\\])(?:\\\\)+)$/,f=/^\s+$/,p=[/\s+|\/\*|["'>~+[(]/g,/\s+|\/\*|["'[\]()]/g,/\s+|\/\*|["'[\]()]/g,null,/\*\//g];for(e=e.trim();;)if(n="",i=p[c[c.length-1]],i.lastIndex=d,r=i.exec(e),r)if(l=d,d=i.lastIndex,l0)c.pop();else if(/^(?:\s+|[~+>])$/.test(r[0])&&(t.length>0&&!f.test(t[t.length-1])&&c[c.length-1]===0&&t.push(" "),c[c.length-1]===1&&t.length===5&&t[2].charAt(t[2].length-1)==="="&&(t[4]=" "+t[4]),f.test(r[0])))continue;t.push(r[0])}else t[t.length-1]+=n,u.test(t[t.length-1])&&(c[c.length-1]===4&&(t.length<2||f.test(t[t.length-2])?t.pop():t[t.length-1]=" ",r[0]=""),c.pop()),t[t.length-1]+=r[0];else{n=e.substr(d),o();break}return t.join("").trim()}function Ce(e,o=document,t=null){return lt(e,!0,o,t)}function Fn(e,o=document,t=null){return lt(e,!1,o,t)}function lt(e,o,t,r=null){e=io(e);let n=t.querySelector(e);return document.head.createShadowRoot||document.head.attachShadow?!o&&n?n:Fe(e,",").reduce((c,d)=>{if(!o&&c)return c;const l=Fe(d.replace(/^\s+/g,"").replace(/\s*([>+~]+)\s*/g,"$1")," ").filter(m=>!!m).map(m=>Fe(m,">")),u=l.length-1,f=l[u][l[u].length-1],p=uo(f,t,r),E=co(l,u,t);return o?(c=c.concat(p.filter(E)),c):(c=p.find(E),c||null)},o?[]:null):o?t.querySelectorAll(e):n}function co(e,o,t){return r=>{let n=o,i=r,c=!1;for(;i&&!lo(i);){let d=!0;if(e[n].length===1)d=i.matches(e[n]);else{const l=[].concat(e[n]).reverse();let u=i;for(const f of l){if(!u||!u.matches(f)){d=!1;break}u=ut(u,t)}}if(d&&n===0){c=!0;break}d&&n--,i=ut(i,t)}return c}}function Fe(e,o){return e.match(/\\?.|^$/g).reduce((t,r)=>(r==='"'&&!t.sQuote?(t.quote^=1,t.a[t.a.length-1]+=r):r==="'"&&!t.quote?(t.sQuote^=1,t.a[t.a.length-1]+=r):!t.quote&&!t.sQuote&&r===o?t.a.push(""):t.a[t.a.length-1]+=r,t),{a:[""]}).a}function lo(e){return e.nodeType===Node.DOCUMENT_FRAGMENT_NODE||e.nodeType===Node.DOCUMENT_NODE}function ut(e,o){const t=e.parentNode;return t&&t.host&&t.nodeType===11?t.host:t===o?null:t}function uo(e=null,o,t=null){let r=[];if(t)r=t;else{const n=function(i){for(let c=0;cn.matches(e)):r}const Re=(e,o,t,r=null)=>{if(!e||e.length===0)return;e.forEach(i=>o.add(i));const n=Array.from(o);r&&r(n),t(n)},fo=(e,o,t=null)=>setInterval(()=>{const n=Array.from(Ce("img")).filter(i=>!e.has(i));n.length>0&&Re(n,e,o,t)},2e3),po=(e,o,t,r=null)=>{const n=new IntersectionObserver(i=>{let c=!1;i.forEach(d=>{if(d.isIntersecting){const u=d.target.querySelectorAll("img");if(u.length>0){const f=Array.from(u).filter(p=>!e.has(p));f.length>0&&(Re(f,e,o,r),c=!0)}}}),c&&(t.current=Date.now())},{root:null,rootMargin:"100px",threshold:.1});return n.observe(document.body),n},$o=(e,o,t,r,n=null)=>{const i=new MutationObserver(c=>{let d=!1;const l=[];if(c.forEach(u=>{u.type==="childList"?(Array.from(u.addedNodes).forEach(f=>{if(f.nodeName==="IMG")l.push(f),d=!0,r.observe(f);else if(f.querySelectorAll){const p=Array.from(f.querySelectorAll("img"));p.length>0&&(l.push(...p),d=!0,p.forEach(E=>r.observe(E)))}f.nodeType===1&&r.observe(f)}),Array.from(u.removedNodes).forEach(f=>{(f.nodeName==="IMG"||f.querySelectorAll&&f.querySelectorAll("img").length>0)&&(d=!0)})):u.type==="attributes"&&u.attributeName==="src"&&(d=!0)}),d)if(t.current=Date.now(),l.length>0)Re(l,e,o,n);else{const f=Array.from(Ce("img")).filter(p=>!e.has(p));f.length>0&&Re(f,e,o,n)}});return i.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["src"]}),i},Eo=(e,o,t,r,n)=>{let i=null;const c={current:Date.now()};function d(){Date.now()-c.current>=e?(clearTimeout(o),clearTimeout(i),n(t)):i=setTimeout(d,100)}return i=setTimeout(d,100),{timeoutId:i,lastChangeTimeRef:c}};function bo(e=3e3,o=1e4,t=null){let r=Array.from(Ce("img"));const n=new Set;let i=null,c=null,d=null;return new Promise(u=>{i=u,r.length>0&&(r.forEach(E=>n.add(E)),t&&t(r),u(r)),c=setTimeout(()=>{r=Array.from(Ce("img")),r.forEach(E=>n.add(E)),t&&t(r),u(r)},o),d=Eo(e,c,r,n,u).lastChangeTimeRef,fo(n,i,t);const p=po(n,i,d,t);$o(n,i,d,p,t)})}const ho=e=>{let o=e;if(o){if(o.parentElement?.tagName==="PICTURE"&&(o=e.parentElement),!o.parentElement){const t=o?.shadowRoot?.host||o?.parentNode?.host;if(t)o=t;else if(e.parentElement)o=e;else return}return o}},go=e=>{const o=e.getBoundingClientRect();return o.width>200&&o.height>200};function So(e){const o=window.getComputedStyle(e),t=[":hover",":focus",":active",":visited",":focus-within",":focus-visible",":target",":checked",":disabled"],r=[];for(const i of document.styleSheets){let c=[];try{c=i.cssRules||i.rules}catch{}const d=(l,u=null)=>{for(const f of l){if(f instanceof CSSMediaRule&&d(f.cssRules,f.conditionText||f.media.mediaText),!(f instanceof CSSStyleRule))continue;const p=f.selectorText.replace(new RegExp(t.join("|"),"g"),"").trim();if(p)try{p&&e.matches(p)&&r.push({selector:f.selectorText,style:f.style,cssText:f.cssText,originalRule:f,media:u?{condition:u,matches:window.matchMedia(u).matches}:null})}catch{}}};d(c)}const n=e.style.cssText?{selector:"inline",cssText:e.style.cssText}:null;return{computed:Object.fromEntries(Array.from(o).map(i=>[i,o.getPropertyValue(i)])),rules:n?[...r,n]:r}}function ft(e){let o;const t=document.styleSheets;for(const r of t)if(!r.href){o=r;break}if(!o){const r=document.createElement("style");document.head.append(r),o=r.sheet}o.insertRule(e,o.cssRules.length)}function To(e){const{rules:o}=So(e);o.forEach(t=>{if(t.selector.includes("img")){const r=t.cssText.replace(/img\s*\+\s*img/,`img + .${de.PUBLIC_CLASSES.collectionTileHoverWrapper}`);if(r===t.cssText){const n=t.cssText.replace("img",`.${de.PUBLIC_CLASSES.collectionTileHoverWrapper}`);ft(n)}else ft(r)}})}const yo=e=>{const o=e.attributes,t=new Set;for(const r of o){const n=String(r.value||"").split(/[,\s]+/).filter(Boolean);for(const i of n){const c=pt(i);c&&t.add(c)}}return Array.from(t)},Io=e=>{const o=e.attributes,t=new Set;for(const r of o){const n=String(r.value||"").split(/[,\s]+/).filter(Boolean);for(const i of n){const c=$t(i);c&&t.add(c)}}return t};function pt(e){try{return!e||!e.includes("//")?null:new URL(e?.startsWith("//")?`https:${e}`:e).pathname.split("/").pop().split(".").slice(0,-1).join(".")}catch{return null}}function $t(e){if(typeof e!="string")return null;const o=e.toLowerCase(),t=/[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}/,r=o.match(t);return r?r[0]:null}const vo=({config:e,project:o,collectionId:t},r)=>{if(!e||!o||!t)return;const n=(e.settings||de.DEFAULT_SETTINGS)?.playMode===de.PLAY_MODE.HOVER;Object.entries(e?.productsMap||{}).forEach(([i,c])=>{const d=c?.images?.map(E=>E.src)||c?.variants?.map(E=>E?.imageUrl);if(!d)return;const l=d.map(E=>pt(E)),u=d.map(E=>$t(E)).filter(Boolean);let f=r.map(({fileNames:E,fileUuidsSet:m,element:$,isLarge:T,externalElement:g})=>{let v=-1;return u.length>0&&(v=u.findLastIndex(O=>m.has(O))),v===-1&&(v=l.findLastIndex(O=>E.some(D=>D.includes(O)&&D.length<1.3*O.length))),{imgElement:$,externalImgElement:g,imageIndex:v,isLarge:T,fileName:l[v]}}).filter(({imageIndex:E})=>E!==-1);(0,te.logDevelopmentMessage)("filtered by src img elements",{imgElements:r,filteredImgElements:f,productFileNames:l,productUuids:u});const p=f.filter(({isLarge:E})=>E);if(p.length>0&&(f=p),f.length>0){const{externalImgElement:E}=f.at(n?0:-1),m=[...E.classList].join(" ").split(" ").filter(Boolean),$=document.createElement("div");if($.innerHTML=``,E.parentElement)if(n){To(E);const{width:T,height:g}=E.getBoundingClientRect();$.style.width=`${T}px`,$.style.height=`${g}px`,$.classList.add(de.PUBLIC_CLASSES.collectionTileHoverWrapper,...m),$.firstChild.style.zIndex="0",E.style.display="none",E.parentElement.insertBefore($,E),$.append(E)}else m&&$.firstChild.classList.add(...m),$.firstChild.style.zIndex="1",E.parentElement.insertBefore($.firstChild,E)}})},mo=(e,o,t)=>{if(!e||e.length===0)return;e.forEach(n=>o.add(n));const r=No(e);wo(r,t)},No=e=>e.map(o=>({element:o,externalElement:ho(o),isLarge:go(o),fileNames:yo(o),fileUuidsSet:Io(o)})).reverse(),_o=(e,o)=>{if(!o)return e;const t=o.split(",").flatMap(n=>[n,`${n} img`]).join(","),r=document.querySelectorAll(t);return e.filter(n=>[...r].some(i=>i.contains(n)))},wo=(e,o)=>{o.forEach(t=>vo(t,e))},xo=(e,o,t)=>{const{playerSettings:r,widgetSettings:n}=t[0].project,i=n.collectionTileSettings.playMode===de.PLAY_MODE.HOVER,c=r.gallerySelector||"",d=r.galleryImageSelector||"",l=i&&r.galleryImageSecondarySelector,u=(i?l:d)||c,f=_o(e.filter(p=>!o.has(p)),u);return u&&(0,te.logDevelopmentMessage)("filter new images with selector",{playerSettings:r,widgetSettings:n,imgElements:e,filteredBySelectorImages:f,processedImageElements:o,filterSelector:u}),f},Et=(e,o,t)=>{if(!e||e.length===0)return;const r=xo(e,o,t);r.length!==0&&((0,te.logDevelopmentMessage)("processImages",{imgElements:e,newImages:r}),mo(r,o,t))},Ao=async e=>{if(!e?.length||document.querySelector(`.${de.PUBLIC_CLASSES.collectionTile}`))return;const o=new Set,r=await bo(3e3,1e4,n=>{Et(n,o,e)});Et(r,o,e)},He="data-status",Ye=[Q.COLLECTION_TILE_EMBED_WIDGET],Le={loading:"loading",loaded:"loaded",failed:"notFound"},Co=()=>{const e=document.querySelector("script[data-collection-id]")?.dataset?.collectionId;return e?.includes("{{ collection.id")||!e?null:e},Ro=({element:e,callback:o,outOfViewCallback:t})=>{const r=new window.IntersectionObserver(n=>{n[0].isIntersecting===!0&&n[0].intersectionRatio>.9?(t||r.unobserve(e),o()):n[0].intersectionRatio<.1&&t?.()},{threshold:[.1,.9]});r.observe(e)};class Lo{constructor({name:o,component:t,elementClassname:r}){this.name=o,this.Component=t,this.widgets=[],this.initialized=!1,this.elementClassname=r,this.initTemplatesState=this.initAdditionalTemplates()}async init(){await this.initTemplatesState;const o=this.getElements();if(o.length!==0){for(const t of o)if(this.getShouldInitializeElement(t)){if(Ye.includes(this.name)&&this.widgets.length>0)break;this.setElementStatus(t,Le.loading);try{const r=new this.Component;if(await r.init(t,this.preloadedConfigs.find(n=>n.projectId===t.dataset.projectId)),!r.getIsInitialized()){this.setElementStatus(t,Le.failed);continue}if(this.widgets.push(r),this.initializeEvents({element:t,widget:r}),this.setElementStatus(t,Le.loaded),Ye.includes(this.name))break}catch(r){this.setElementStatus(t,Le.failed),console.log(`error starting tolstoy ${this.name}`,t.id,r)}}this.widgets.length>0&&(this.initialized=!0)}}deleteElementStatus(o){delete o.removeAttribute(He)}getElementStatus(o){return o.getAttribute(He)}getIsTolstoyPreview(){return window.tolstoyPreview}getIsElementHidden(o){return window.getComputedStyle(o)?.display==="none"||!o.offsetParent}setElementStatus(o,t){return o.setAttribute(He,t)}getShouldInitializeElement(o){return o.classList.contains(so.PUBLIC_CLASS)&&!this.getElementStatus(o)?!0:!this.getElementStatus(o)&&!this.getIsElementHidden(o)||!this.getElementStatus(o)&&(0,ne.getIsTapcart)()||this.getIsTolstoyPreview()}setComponent(o){this.Component=o}async loadWidgetAdditionalConfigs(){if(this.preloadedConfigs)return this.preloadedConfigs;try{const o=(0,J.getAppKey)(),t=Co(),r=(0,Oe.getParameterFromWidgetScripts)("collection-gallery-projects");if(!r)return[];const n=JSON.parse(r);if(t&&o&&n?.length)return(0,ae.getCollectionTileConfigs)(o,t)}catch(o){console.log(o)}return[]}async initAdditionalTemplates(){if(this.name!==Q.COLLECTION_TILE_EMBED_WIDGET){this.preloadedConfigs=[];return}try{const o=await this.loadWidgetAdditionalConfigs();this.preloadedConfigs=o,await Ao(this.preloadedConfigs)}catch(o){console.error("error initializing additional templates",o)}}getElements(){return Ye.includes(this.name)?[...document.querySelectorAll(`.${this.elementClassname}`)].filter(Boolean):[...document.querySelectorAll(`.${this.elementClassname}`)]}shouldLoad(){return this.initTemplatesState.isResolved?this.getElements().length>0:!0}initializeEvents({element:o,widget:t}){t.handlePageView?.(),this.registerEmbedViewListener({element:o,callback:t.handleView,outOfViewCallback:t.handleOutOfView})}registerEmbedViewListener({element:o,callback:t,outOfViewCallback:r}){(0,ao.getIsElementVisible)({element:o})&&(t(),!r)||Ro({element:o,callback:t,outOfViewCallback:r})}}var Oo=Lo,_=a("519R9"),b=a("aEodP");let bt=!1;const ht=async()=>{if(bt)return;(await a("e7CwX")).initializeWidgetEvents(),bt=!0};class Po{constructor(){this.domUpdatesListenerInitialized=!1,this.widgets=[],this.embedWidgetsMap={}}async init(){const o=[],t=[Q.CAROUSEL_EMBED_WIDGET,Q.STORY_EMBED_WIDGET,Q.EMBED_WIDGET,Q.TILE_EMBED_WIDGET,Q.COLLECTION_TILE_EMBED_WIDGET];for(const r of t){const n=Q.EMBED_WIDGETS_CLASSNAMES[r],i=new Oo({name:r,elementClassname:n});this.embedWidgetsMap[r]={embedWidget:i,loaded:!1},o.push(n)}this.registerDomUpdatesListenerIfNeeded(o),this.subscribeToUrlChange(),await this.loadEmbedWidgets()}loadEmbedWidgets=async()=>{const o=Object.entries(this.embedWidgetsMap).map(async([t,{embedWidget:r,loaded:n,loading:i}])=>{if(r.shouldLoad()){if(i){setTimeout(()=>this.loadEmbedWidgets(),2e3);return}n||await this.loadEmbedWidget({embedWidgetName:t,embedWidget:r}),await r.init()}});await Promise.all(o)};async loadEmbedWidget({embedWidgetName:o,embedWidget:t}){this.embedWidgetsMap[o].loading=!0;let r;switch(o){case Q.CAROUSEL_EMBED_WIDGET:r=await a("krrJN");break;case Q.STORY_EMBED_WIDGET:r=await a("fGHMu");break;case Q.EMBED_WIDGET:r=await a("bjM0J");break;case Q.TILE_EMBED_WIDGET:r=await a("bqpZk");break;case Q.COLLECTION_TILE_EMBED_WIDGET:r=await a("kzluS");break;case Q.COLLECTION_PAGE_TILE_EMBED_WIDGET:r=await a("dtdnN");break}t.setComponent(r.default),await ht(),this.embedWidgetsMap[o].loaded=!0,this.embedWidgetsMap[o].loading=!1}registerDomUpdatesListenerIfNeeded(o){if(this.domUpdatesListenerInitialized)return;const t=()=>this.loadEmbedWidgets();(0,be.registerDomUpdatesListener)({classNames:o,callback:t}),this.domUpdatesListenerInitialized=!0}handleUrlChange=()=>{for(const o of Object.keys(this.embedWidgetsMap))this.embedWidgetsMap[o].loaded=!1;this.loadEmbedWidgets()};subscribeToUrlChange(){_.default.subscribe({eventName:b.INTERNAL_EVENTS.urlChange,callback:this.handleUrlChange})}}var Mo=Po,Z=a("eSOI5"),Q=a("kCbDV"),Z=a("eSOI5"),Q=a("kCbDV");const pe=Q.BUBBLE_WIDGET,Do=new Set(["5bzilmwoe1fon","z7uu0kcyzumt0"]),gt=e=>Do.has(e)?Q.CENTERED_MODAL_WIDGET:pe;class Uo{constructor(){this.initialized=!1,this.widgets=[],this.start=this.start.bind(this),this.startPart=this.startPart.bind(this),this.hide=this.hide.bind(this),this.show=this.show.bind(this),this.on=this.on.bind(this),this.recreate=this.recreate.bind(this),window.tolstoyWidget={...window.tolstoyWidget,start:this.start,startPart:this.startPart,show:this.show,hide:this.hide,on:this.on,recreate:this.recreate}}async init({bubbleSettings:o,widgetId:t,Component:r}){this.bubbleSettings=o;const n=new r(o);if(await n.init(),this.widgets.push(n),this.updateViewerIdentifyAttributes(),window.tolstoySettings?.noReload||this.registerEvents(),(window.tolstoySettings?.alwaysShow||(0,Z.getTolstoyHideWidget)(t)!=="true")&&!o.exitIntentPublishId){const c=gt(t);this.show(c),this.recreate(t,c)}else this.hide()}updateViewerIdentifyAttributes(){const o=Number((0,Z.getSessionCounter)()||0)+1;(0,Z.setSessionCounter)(o.toString()),(0,Z.getFirstSeenAt)()||(0,Z.setFirstSeenAt)(new Date().toISOString())}handleMouseDown(){this.userInteracted=!0,document.removeEventListener("mousedown",this.handleMouseDown)}registerEvents(){document.addEventListener("mousedown",()=>{this.handleMouseDown()}),document.body.addEventListener("mouseleave",async()=>{const o=this.bubbleSettings?.exitIntentPublishId;if(o&&this.userInteracted){const r=this.widgets.find(n=>n?.bubbleSettings?.exitIntentPublishId);r&&await this.recreate(o,r.name,{startPlayerImmediately:!0})}})}start(o=pe){const t=Ee(this.widgets,o);t&&t.start()}startPart(o,t=pe){const r=Ee(this.widgets,t);r&&r.startPart(o)}hide(o=pe){const t=Ee(this.widgets,o);t&&t.hide()}show(o=pe){const t=Ee(this.widgets,o);t&&t.show()}on(o,t,r=pe){const n=Ee(this.widgets,r);n&&n.eventChange(o,t)}recreate(o,t=pe,r={}){const n=Ee(this.widgets,t);n&&n.recreate(o,r)}}const Ee=(e,o)=>e.find(t=>t.name===o);var Vo=Uo,We=a("a78DZ"),J=a("6QfcD"),Ge=a("izL3O"),ko=a("7Tj0o"),ae=a("kK0IS"),Oe=a("i1NbZ"),ae=a("kK0IS"),J=a("6QfcD"),Bo=a("k3iEx"),te=a("93NPo"),We=a("a78DZ"),Ge=a("izL3O");class Te{constructor(){if(Te.instance)return Te.instance;Te.instance=this,this.appKey=(0,J.getAppKey)(),this.shop=window.Shopify?.shop||(0,Ge.getShop)(),this.accountSettings=null,this.rules=new We.default,this.shouldUseCache=null,this.cacheVersion=null,this.hasLiveBubble=null}async init(){if(!(!this.appKey&&!this.shop)){if(this.accountSettings)return this.accountSettings;try{this.accountSettings=await(0,ae.getAccountSettings)(),this.rules.updateRules(this.accountSettings),(this.accountSettings?.shouldUseCache||(0,Oe.getShouldUseCache)())&&(window.tolstoySettings=window.tolstoySettings||{},window.tolstoySettings.shouldUseCache=!0);const t=this.accountSettings?.cacheVersion||(0,Oe.getCacheVersion)();return t&&(window.tolstoySettings=window.tolstoySettings||{},window.tolstoySettings.cacheVersion=t),window.tolstoySettings.hasLiveShopAssistant=this.accountSettings?.hasLiveShopAssistant,this.hasLiveBubble=this.accountSettings?.hasLiveBubble||!!window.tolstoyWidgetId||(0,Bo.getTolstoyAutoOpen)(),this.accountSettings}catch(o){return(0,te.logDevelopmentError)("Error loading account settings",o),null}}}}var St=new Te,_=a("519R9"),b=a("aEodP");class Fo{constructor(){this.account=St,this.rules=new We.default,this.appKey=(0,J.getAppKey)()}getBubbleSettings=async()=>{const o=window.location.href,t=window.Shopify?.shop||(0,Ge.getShop)();if(!this.appKey&&!t)return;const r=(0,Z.getIdentifyInfoId)(),n=this.rules.getTolstoyViewers(),i=t||window.location.host,c={timestamp:Date.now(),url:o,sessionCount:Number((0,Z.getSessionCounter)()||0),lastSeenAt:new Date().toISOString(),firstSeenAt:(0,Z.getFirstSeenAt)(),tolstoySeenCounter:n,isMobile:ko.default.isMobile(),domain:i,appUrl:t,appKey:this.appKey};r&&(c.identifyInfoId=r);try{const d=await(0,ae.getBubbleSettings)(c);return d?(this.rules.updateRules(d),d):null}catch{return null}};init=async()=>{if(!this.account?.hasLiveBubble)return;const o=await this.getBubbleSettings();this.subscribeToUrlChange();const t=window.tolstoyWidgetId||o?.publishId||o?.exitIntentPublishId;if(!t){this.widget?.hide?.();return}if(!window.tolstoySettings?.alwaysShow&&(0,Z.getTolstoyHideWidget)(t)==="true")return;const n=gt(t);let i;n===Q.CENTERED_MODAL_WIDGET?i=await a("enQtM"):n===Q.BUBBLE_WIDGET&&(i=await a("bQxIb")),await ht(),this.widget?(this.widget.recreate(t,n),this.widget.show()):(this.widget=new Vo,await this.widget.init({bubbleSettings:o,widgetId:t,Component:i.default}))};handleUrlChange=()=>{this.unsubscribeFromUrlChange(),this.init()};subscribeToUrlChange(){_.default.subscribe({eventName:b.INTERNAL_EVENTS.urlChange,callback:this.handleUrlChange})}unsubscribeFromUrlChange(){_.default.unsubscribe({eventName:b.INTERNAL_EVENTS.urlChange,callback:this.handleUrlChange})}}var Ho=Fo,Tt=a("5GzNL"),be=a("ljwIw");class Yo{constructor(){this.domUpdatesListenerInitialized=!1,this.loaded=!1}async init(){await this.loadVideo(),!this.loaded&&this.registerDomUpdatesListenerIfNeeded()}async loadVideo(){const o=document.querySelector(`#${Tt.TOLSTOY_TV_CONTAINER_ID}`);if(!o)return;const t=(await a("6TwUM")).default;new t({tolstoyContainer:o}).init(),this.loaded=!0}registerDomUpdatesListenerIfNeeded(){if(this.domUpdatesListenerInitialized)return;const o=[Tt.PUBLIC_CLASSES.tvContainer],t=()=>this.loadVideo();(0,be.registerDomUpdatesListener)({classNames:o,callback:t}),this.domUpdatesListenerInitialized=!0}}var Wo=Yo,b=a("aEodP");const Go=[b.INTERNAL_EVENTS.urlChange];var Pe=a("aQK74"),b=a("aEodP");const Ko=e=>{switch(e.data.eventName){case b.INTERNAL_EVENTS.urlChange:return(0,Pe.sendPageVisitEvent)();default:return null}};var J=a("6QfcD");const jo=["(+https://whatis.contentkingapp.com)","Shopify-Observe-Synthetic-Checks","+http://www.google.com/bot.html","https://naver.me/spd","HeadlessChrome","(+http://www.facebook.com/externalhit_uatext.php)","Bytespider","bot"],zo=()=>jo.some(e=>window.navigator.userAgent.includes(e)),Yn=e=>{const o=e.toLocaleLowerCase();return o.includes("chrome-lighthouse")||o.includes("page speed insights")};var qo=a("dEa8z"),G=a("kHyIS"),b=a("aEodP"),_=a("519R9"),G=a("kHyIS");const Qo=({eventName:e,callback:o})=>{if(!G.ALLOWED_EXTERNAL_EVENTS_TO_SUBSCRIBE.includes(e)){console.error(`Event ${e} is not a valid event`);return}if(!o){console.error("Callback must be provided");return}if(typeof o!="function"){console.error("Callback must be a function");return}return!0};class ye extends qo.default{constructor(){if(ye.instance)return ye.instance;super({shouldIncludeLogs:!0}),ye.instance=this}eventHandler=({data:o={}})=>{const{eventName:t}=o;if(this.eventCallbacks[t])for(const r of this.eventCallbacks[t])try{r(o)}catch(n){console.error(n)}};subscribe=(o,t,r={})=>{if(Qo({eventName:o,callback:t}))try{super.subscribe({eventName:o,callback:t}),_.default.postMessage({eventName:b.INTERNAL_EVENTS.externalEventSubscribed,subscribedEventName:o,payload:r});const n=new CustomEvent("TOLSTOY_WIDGET_V2_SUBSCRIBE",{detail:{eventName:o,payload:r,callback:t}});window.dispatchEvent(n),console.log("Subscribed to event",o)}catch(n){console.error(n)}};unsubscribe=(o,t)=>super.unsubscribe({eventName:o,callback:t});initInternalMessagingSubscriptions=()=>{_.default.subscribeMultipleEvents({eventNames:G.ALLOWED_EXTERNAL_EVENTS_TO_SUBSCRIBE,callback:this.eventHandler})};init(){this.initInternalMessagingSubscriptions(),this.initListener(this.eventHandler)}}const yt=new ye;Object.freeze(yt);var Ke=yt,J=a("6QfcD"),ae=a("kK0IS"),b=a("aEodP"),G=a("kHyIS"),_=a("519R9"),Z=a("eSOI5");const Zo=e=>{const{eventName:o}=e;if(!o){console.error("eventName is required");return}if(!G.ALLOWED_EXTERNAL_EVENTS_TO_POST.has(o)){console.error(`${o} is not a valid eventName`);return}return!0};class Xo{postMessage=(o={})=>{Zo(o)&&_.default.postMessage(o)};closePlayer(){_.default.postMessage({eventName:b.INTERNAL_EVENTS.closePlayer})}changeEmail(o){window.tolstoyUser=o,_.default.postMessage({eventName:b.INTERNAL_EVENTS.userEmailUpdate,email:o})}async identify(o={}){const{email:t,userId:r}=o;if(!t&&!r){console.error("No email or userId");return}try{t&&this.changeEmail(t),r&&(o.userId=r.toString()),o.appKey=(0,J.getAppKey)();const n=await(0,ae.postUserIdentification)(o);(0,Z.setIdentifyInfoId)(n?.id)}catch(n){console.error("Error occurred while updating identify info:",n),window.tolstoyCaptureError?.(n,"Error occurred while updating identify info:"),(0,Z.removeIdentifyInfoId)()}}}const It=new Xo;Object.freeze(It);var vt=It,_=a("519R9"),b=a("aEodP"),_=a("519R9"),b=a("aEodP");const Jo=[b.INTERNAL_EVENTS.modalOpen];class er{sendIsAfterpayAppInstalledMessage(){_.default.postMessage({eventName:b.INTERNAL_EVENTS.isAfterpayAppInstalled,value:!!window?.Afterpay})}internalMessagingHandler=o=>{switch(o.data.eventName){case b.INTERNAL_EVENTS.modalOpen:this.sendIsAfterpayAppInstalledMessage();return;default:return null}};initInternalMessagingSubscriptions(){_.default.subscribeMultipleEvents({eventNames:Jo,callback:this.internalMessagingHandler})}init(){this.initInternalMessagingSubscriptions()}}const mt=new er;Object.freeze(mt);var tr=mt,G=a("kHyIS"),_=a("519R9"),Nt=a("lxjfR"),or=a("hlJEM"),b=a("aEodP"),_=a("519R9");const rr=()=>{(0,Nt.removeAllTolstoyKeysFromStorage)(),(0,Nt.setCookiePolicy)(or.COOKIE_POLICIES.rejected),_.default.postMessage({eventName:b.INTERNAL_EVENTS.rejectCookiePolicy})},nr=[G.EXTERNAL_EVENTS_TO_POST.rejectCookiePolicy];class Ie{constructor(){if(Ie.instance)return Ie.instance;Ie.instance=this}externalMessagingHandler=o=>{switch(o.data.eventName){case G.EXTERNAL_EVENTS_TO_POST.rejectCookiePolicy:return rr();default:return null}};initExternalMessagingSubscriptions=()=>{_.default.subscribeMultipleEvents({eventNames:nr,callback:this.externalMessagingHandler})};init(){this.initExternalMessagingSubscriptions()}}const _t=new Ie;Object.freeze(_t);var sr=_t,G=a("kHyIS"),_=a("519R9"),b=a("aEodP");const ar={itemSoldOut:"itemSoldOut"},wt={tolstoyAnonymousId:"__tolstoyAnonymousId"};var G=a("kHyIS"),b=a("aEodP"),_=a("519R9");const ir=({description:e})=>{switch(e){case ar.itemSoldOut:return b.INTERNAL_EVENTS.addToCartSoldOut;default:return b.INTERNAL_EVENTS.addToCartError}},cr=({data:e})=>{const{description:o}=e,t=ir({description:o});_.default.postMessage({...e,eventName:t})},dr=({data:e})=>{const{variantId:o,productId:t,transmissionId:r,quantity:n,productHandle:i,templateSuffix:c}=e;_.default.postMessage({variantId:o,productId:t,transmissionId:r,quantity:n,productHandle:i,eventName:G.EXTERNAL_EVENTS_TO_SUBSCRIBE.addToCart,templateSuffix:c})},lr=({data:e})=>{const{product:o,transmissionId:t}=e;_.default.postMessage({product:o,transmissionId:t,eventName:G.EXTERNAL_EVENTS_TO_SUBSCRIBE.spotlightCarouselQuickShopClick})},ur=({data:e})=>{const{subscribedEventName:o,payload:t={}}=e,{disableDefault:r}=t;switch(o){case G.EXTERNAL_EVENTS_TO_SUBSCRIBE.addToCart:case G.EXTERNAL_EVENTS_TO_SUBSCRIBE.spotlightCarouselQuickShopClick:r&&_.default.postMessage({eventName:b.INTERNAL_EVENTS.addToCartDisableDefault});break;default:return null}},fr=({data:e})=>{_.default.postMessage({...e,eventName:b.INTERNAL_EVENTS.addToCartSuccess})},pr=[b.INTERNAL_EVENTS.addToCart,b.INTERNAL_EVENTS.spotlightCarouselQuickShopClick,b.INTERNAL_EVENTS.externalEventSubscribed],$r=[G.EXTERNAL_EVENTS_TO_POST.addToCartSuccess,G.EXTERNAL_EVENTS_TO_POST.addToCartError];class ve{constructor(){if(ve.instance)return ve.instance;ve.instance=this}internalMessagingHandler=o=>{switch(o.data.eventName){case b.INTERNAL_EVENTS.addToCart:return dr(o);case b.INTERNAL_EVENTS.spotlightCarouselQuickShopClick:return lr(o);case b.INTERNAL_EVENTS.externalEventSubscribed:return ur(o);default:return null}};externalMessagingHandler=o=>{switch(o.data.eventName){case G.EXTERNAL_EVENTS_TO_POST.addToCartSuccess:return fr(o);case G.EXTERNAL_EVENTS_TO_POST.addToCartError:return cr(o);default:return null}};initInternalMessagingSubscriptions=()=>{_.default.subscribeMultipleEvents({eventNames:pr,callback:this.internalMessagingHandler})};initExternalMessagingSubscriptions=()=>{_.default.subscribeMultipleEvents({eventNames:$r,callback:this.externalMessagingHandler})};init(){this.initInternalMessagingSubscriptions(),this.initExternalMessagingSubscriptions()}}const xt=new ve;Object.freeze(xt);var Er=xt,b=a("aEodP"),_=a("519R9"),b=a("aEodP");const br=[b.INTERNAL_EVENTS.openKendoModal];class hr{internalMessagingHandler=o=>{switch(o.data.eventName){case b.INTERNAL_EVENTS.openKendoModal:_.default.postMessage({eventName:b.INTERNAL_EVENTS.changeZIndex,zIndex:1e3}),window.KENDO?.openQuickModalByHandle?.(o.data.productHandle);const t=o.data.quantity;if(t<=1)return;for(let r=1;r{document.querySelector(".quantity-selector__action--increment")?.click?.()},1e3+r*150);return;default:return null}};initInternalMessagingSubscriptions(){_.default.subscribeMultipleEvents({eventNames:br,callback:this.internalMessagingHandler})}init(){this.initInternalMessagingSubscriptions()}}const At=new hr;Object.freeze(At);var gr=At,b=a("aEodP"),_=a("519R9");const Ct={USD:"$",CAD:"CA$",EUR:"\u20AC",AED:"\u062F.\u0625.\u200F",AFN:"\u060B",ALL:"Lek",AMD:"\u0564\u0580.",ARS:"$",AUD:"AU$",AZN:"\u043C\u0430\u043D.",BAM:"KM",BDT:"\u09F3",BGN:"\u043B\u0432.",BHD:"\u062F.\u0628.\u200F",BIF:"FBu",BND:"$",BOB:"Bs",BRL:"R$",BWP:"P",BYN:"\u0440\u0443\u0431.",BZD:"$",CDF:"FrCD",CHF:"CHF",CLP:"$",CNY:"CN\xA5",COP:"$",CRC:"\u20A1",CVE:"CV$",CZK:"K\u010D",DJF:"Fdj",DKK:"kr",DOP:"RD$",DZD:"\u062F.\u062C.\u200F",EEK:"kr",EGP:"\u062C.\u0645.\u200F",ERN:"Nfk",ETB:"Br",GBP:"\xA3",GEL:"GEL",GHS:"GH\u20B5",GNF:"FG",GTQ:"Q",HKD:"$",HNL:"L",HRK:"kn",HUF:"Ft",IDR:"Rp",ILS:"\u20AA",INR:"\u20B9",IQD:"\u062F.\u0639.\u200F",IRR:"\uFDFC",ISK:"kr",JMD:"$",JOD:"\u062F.\u0623.\u200F",JPY:"\uFFE5",KES:"Ksh",KHR:"\u17DB",KMF:"FC",KRW:"\u20A9",KWD:"\u062F.\u0643.\u200F",KZT:"\u0442\u04A3\u0433.",LBP:"\u0644.\u0644.\u200F",LKR:"SL Re",LTL:"Lt",LVL:"Ls",LYD:"\u062F.\u0644.\u200F",MAD:"\u062F.\u0645.\u200F",MDL:"MDL",MGA:"MGA",MKD:"MKD",MMK:"K",MOP:"MOP$",MUR:"MURs",MXN:"MX$",MYR:"RM",MZN:"MTn",NAD:"N$",NGN:"\u20A6",NIO:"C$",NOK:"kr",NPR:"\u0928\u0947\u0930\u0942",NZD:"$",OMR:"\u0631.\u0639.\u200F",PAB:"B/.",PEN:"S/.",PHP:"\u20B1",PKR:"\u20A8",PLN:"z\u0142",PYG:"\u20B2",QAR:"\u0631.\u0642.\u200F",RON:"RON",RSD:"\u0434\u0438\u043D.",RUB:"\u20BD.",RWF:"FR",SAR:"\u0631.\u0633.\u200F",SDG:"SDG",SEK:"kr",SGD:"$",SOS:"Ssh",SYP:"\u0644.\u0633.\u200F",THB:"\u0E3F",TND:"\u062F.\u062A.\u200F",TOP:"T$",TRY:"TL",TTD:"$",TWD:"NT$",TZS:"TSh",UAH:"\u20B4",UGX:"USh",UYU:"$",UZS:"UZS",VEF:"Bs.F.",VND:"\u20AB",XAF:"FCFA",XOF:"CFA",YER:"\u0631.\u064A.\u200F",ZAR:"R",ZMK:"ZK",ZWL:"ZWL$"},Sr=e=>({id:e.id,price:e.price,compareAtPrice:e.price,currencyCode:e.currency,currencySymbol:Ct[e.currency],variants:[{price:e.price,compareAtPrice:e.price}]}),Tr=(e="")=>e.replace("_","-");var b=a("aEodP");const yr=[b.INTERNAL_EVENTS.openCommerceSettingsUpdate,b.INTERNAL_EVENTS.requestProductsUpdate],je={},Me={};class Ir{constructor(){this.isOpenCommerceStore=!!window.CQuotient,this.siteId=window.CQuotient?.siteId,this.locale=Tr(window.CQuotient?.locale),this.apiBaseUrl="",this.clientId="",this.currencyCode=window.pageContext?.ecommerce?.currencyCode}fetchProduct=async o=>{const t=`${this.apiBaseUrl}/products/${o}`,r=new URL(t);r.searchParams.append("client_id",this.clientId),r.searchParams.append("locale",this.locale),r.searchParams.append("currency",this.currencyCode),r.searchParams.append("expand","prices");try{const i=await(await fetch(r)).json();return Sr(i)}catch(n){console.error("Error fetching product price",n)}};getProduct=async o=>{if(je[o])return je[o];if(Me[o])return Me[o];const t=this.fetchProduct(o);Me[o]=t;const r=await t;return je[o]=r,delete Me[o],r};onRequestProductsUpdateMessage=async({productIds:o})=>{const r=[...new Set(o)].map(i=>this.getProduct(i)),n=(await Promise.all(r)).filter(Boolean);for(const i of n)_.default.postMessage({eventName:b.INTERNAL_EVENTS.productUpdateResponse,product:i,isProductUpdateResponse:!0})};postUrlLocaleUpdateIfNeeded(o){this.locale!==o&&_.default.postMessage({eventName:b.INTERNAL_EVENTS.urlLocaleUpdate,urlLocale:this.locale})}postIsNonBaseCurrencyIfNeeded(o){this.currencyCode!==o&&_.default.postMessage({eventName:b.INTERNAL_EVENTS.isNonBaseCurrency,currencyCode:this.currencyCode})}onOpenCommerceSettingsUpdate({openCommerceSettings:o}){const{apiVersion:t,clientId:r,baseLocale:n,baseCurrency:i}=o;this.apiBaseUrl=`https://${window.location.host}/s/${this.siteId}/dw/shop/${t}`,this.clientId=r,this.postUrlLocaleUpdateIfNeeded(n),this.postIsNonBaseCurrencyIfNeeded(i)}internalMessagingHandler=o=>{switch(o.data.eventName){case b.INTERNAL_EVENTS.openCommerceSettingsUpdate:return this.onOpenCommerceSettingsUpdate(o.data);case b.INTERNAL_EVENTS.requestProductsUpdate:return this.onRequestProductsUpdateMessage(o.data);default:return null}};initInternalMessagingSubscriptions(){_.default.subscribeMultipleEvents({eventNames:yr,callback:this.internalMessagingHandler})}init(){this.isOpenCommerceStore&&this.initInternalMessagingSubscriptions()}}var vr=new Ir,_=a("519R9"),b=a("aEodP");const mr=[b.INTERNAL_EVENTS.externalEventSubscribed,b.INTERNAL_EVENTS.productCardClick];var G=a("kHyIS"),b=a("aEodP"),_=a("519R9");const Nr=({subscribedEventName:e,payload:o})=>{switch(e){case G.EXTERNAL_EVENTS_TO_SUBSCRIBE.productCardClick:{const{disableProductModal:t=!0}=o;_.default.postMessage({eventName:b.INTERNAL_EVENTS.productCardClickSubscribed,isDisableProductModal:t});break}default:return null}},_r=({data:e})=>{const{eventName:o}=e;switch(o){case b.INTERNAL_EVENTS.externalEventSubscribed:{const{subscribedEventName:t,payload:r}=e;Nr({subscribedEventName:t,payload:r});break}case b.INTERNAL_EVENTS.productCardClick:{const{variantId:t,productId:r,externalProductIds:n,productHandle:i}=e;_.default.postMessage({eventName:G.EXTERNAL_EVENTS_TO_SUBSCRIBE.productCardClick,variantId:t,productId:r,taggedProductIds:n,productHandle:i});break}default:return null}};class wr{initInternalMessagingSubscriptions(){_.default.subscribeMultipleEvents({eventNames:mr,callback:_r})}init(){this.initInternalMessagingSubscriptions()}}const Rt=new wr;Object.freeze(Rt);var xr=Rt,_=a("519R9"),b=a("aEodP"),b=a("aEodP");const Ar=[b.INTERNAL_EVENTS.getProductsMetafields];class Cr{getProductsMetafields(o=[]){const t={};for(const r of o)t[r]=window?.metafields?.products?.[r];return t}internalMessagingHandler=({data:o})=>{switch(o.eventName){case b.INTERNAL_EVENTS.getProductsMetafields:if(!o?.productIds?.length)return;_.default.postMessage({productsExtraData:this.getProductsMetafields(o.productIds),modalId:o.modalId,eventName:b.INTERNAL_EVENTS.returnProductsMetafields});return;default:return null}};initInternalMessagingSubscriptions(){_.default.subscribeMultipleEvents({eventNames:Ar,callback:this.internalMessagingHandler})}init(){this.initInternalMessagingSubscriptions()}}const Lt=new Cr;Object.freeze(Lt);var Rr=Lt,_=a("519R9"),G=a("kHyIS");const Lr=[G.EXTERNAL_EVENTS_TO_POST.productUpdate],Or=["id","descriptionHtml","description_html","variants","price","compare_at_price","title"],Pr=["id","price","compare_at_price","title"];var _=a("519R9"),b=a("aEodP"),G=a("kHyIS");const Mr=e=>Or.includes(e),Dr=e=>Array.isArray(e)?e.flatMap((o,t)=>{const n=Object.keys(o).filter(i=>!Pr.includes(i));return n.length===0?[]:`variants[${t}]: { ${n.join(", ")} }`}):["variants (must be an array)"],Ur=({product:e})=>{const t=Object.keys(e).filter(r=>!Mr(r));if(e.variants&&t.push(...Dr(e.variants)),t.length>0){console.error(`Fields ${t.join(", ")} are not supported for product update.`);return}_.default.postMessage({product:e,eventName:b.INTERNAL_EVENTS.productUpdateResponse})},Vr=({data:e})=>{switch(e.eventName){case G.EXTERNAL_EVENTS_TO_POST.productUpdate:return Ur(e);default:return null}};class kr{initExternalMessagingSubscriptions(){_.default.subscribeMultipleEvents({eventNames:Lr,callback:Vr})}init(){this.initExternalMessagingSubscriptions()}}const Ot=new kr;Object.freeze(Ot);var Br=Ot,b=a("aEodP"),_=a("519R9"),b=a("aEodP");const Fr=[b.INTERNAL_EVENTS.openRebuyCart],ze={show:"rebuy:smartcart.show",hide:"rebuy:smartcart.hide",init:"rebuy:smartcart.init"};class Hr{sendIsRebuyAppInstalledMessage=()=>{if(!window?.Rebuy?.SmartCart){document.addEventListener(ze.init,this.sendIsRebuyAppInstalledMessage,{once:!0});return}_.default.postMessage({eventName:b.INTERNAL_EVENTS.isRebuyAppInstalled,value:!!window?.Rebuy?.SmartCart}),this.initRebuyEventListeners()};internalMessagingHandler=o=>{switch(o.data.eventName){case b.INTERNAL_EVENTS.openRebuyCart:return window?.Rebuy?.SmartCart?.show();default:return null}};initInternalMessagingSubscriptions(){_.default.subscribeMultipleEvents({eventNames:Fr,callback:this.internalMessagingHandler})}initRebuyEventListeners(){document.addEventListener(ze.show,()=>{_.default.postMessage({eventName:b.INTERNAL_EVENTS.rebuyCartShown})}),document.addEventListener(ze.hide,()=>{_.default.postMessage({eventName:b.INTERNAL_EVENTS.rebuyCartHidden})})}init(){this.initInternalMessagingSubscriptions(),this.sendIsRebuyAppInstalledMessage()}}const Pt=new Hr;Object.freeze(Pt);var Yr=Pt,b=a("aEodP"),J=a("6QfcD"),Z=a("eSOI5"),Q=a("kCbDV"),_=a("519R9"),te=a("93NPo"),Wr=a("k6zg1"),b=a("aEodP");const Mt={soldOut:"already sold out",sellingPlanRequired:"Variant can only be purchased with a selling plan."},Gr=[b.INTERNAL_EVENTS.addToCartDisableDefault,b.INTERNAL_EVENTS.setAnonymousIdToCart,b.INTERNAL_EVENTS.loginWithMultipassUrlRequest,b.INTERNAL_EVENTS.cartItemQuantityChange,b.INTERNAL_EVENTS.cartDataRequest,b.INTERNAL_EVENTS.productRecommendationsRequest,b.INTERNAL_EVENTS.requestProductsUpdate,b.INTERNAL_EVENTS.blockAnonymousIdToCart],Dt=[b.INTERNAL_EVENTS.addToCart,b.INTERNAL_EVENTS.spotlightCarouselQuickShopClick],qe=e=>({headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(e)});let Ut=!1,Qe=!1;const Ze={},De={};class me{constructor(){if(me.instance)return me.instance;me.instance=this,this.isShopifyStore=!!(window.Shopify?.shop&&window.Shopify?.routes),this.storeRootUrl=window.Shopify?.routes?.root}getIsProductSoldOutError(o){return o.includes(Mt.soldOut)}getIsSellingPlanError(o){return o.includes(Mt.sellingPlanRequired)}formatProduct(o){if(!o)return null;const t=window.Shopify?.currency?.active||window.Shopify?.currency,r=window.tolstoyCurrencySymbol||Ct[t];return{...o,id:String(o.id),price:o.price/100,compare_at_price:o.compare_at_price?o.compare_at_price/100:o.compare_at_price,currencyCode:t,currencySymbol:r,variants:o.variants.map(n=>({...n,price:n.price/100,compare_at_price:n.compare_at_price?n.compare_at_price/100:n.compare_at_price}))}}async fetchRawProduct(o){const t=this.storeRootUrl+`products/${o}.js`;try{const n=await(await fetch(t)).json();return this.formatProduct(n)}catch{}}getProduct=async o=>{if(Ze[o])return Ze[o];if(De[o])return De[o];const t=this.fetchRawProduct(o);De[o]=t;const r=await t;return Ze[o]=r,delete De[o],r};onRequestProductsUpdateMessage=async({handles:o})=>{const r=[...new Set(o)].map(i=>this.getProduct(i)),n=(await Promise.all(r)).filter(Boolean);for(const i of n)_.default.postMessage({eventName:b.INTERNAL_EVENTS.productUpdateResponse,product:i,isProductUpdateResponse:!0})};async handleSellingPlanError(o,t){const r=await this.getProduct(t);if(!r)return;const{id:n}=r.selling_plan_groups[0].selling_plans[0];return this.shopifyAddToCart({variantId:o,productHandle:t,sellingPlanId:n})}handleAddToCartError({error:o,variantId:t,productHandle:r,transmissionId:n}){const{description:i}=o;if(this.getIsProductSoldOutError(i)){_.default.postMessage({eventName:b.INTERNAL_EVENTS.addToCartSoldOut,variantId:t,transmissionId:n});return}if(this.getIsSellingPlanError(i))return this.handleSellingPlanError(t,r);_.default.postMessage({eventName:b.INTERNAL_EVENTS.addToCartError,error:i,variantId:t,transmissionId:n})}handleUpdateItemQuantityError({error:o,variantId:t,transmissionId:r}){const{description:n}=o;_.default.postMessage({eventName:b.INTERNAL_EVENTS.cartItemQuantityChangeError,error:n,variantId:t,transmissionId:r})}async getCart({transmissionId:o}){try{const r=await(await fetch(`${this.storeRootUrl}cart.js`,{method:"GET"})).json();_.default.postMessage({eventName:b.INTERNAL_EVENTS.cartDataResponse,cart:r,transmissionId:o})}catch{}}triggerExternalCartUpdate(){window.VueMiniCart?.$store?._actions?.initCart?.[0]?.(),window.slate?.cart?.reloadCart?.(),window.tolstoyCartRefresh?.(),window.monster_refresh?.(),window.updateMiniCart?.()}disableAddToCart(){Ut=!0,_.default.unsubscribeMultipleEvents({eventNames:Dt,callback:this.internalMessagingHandler})}postUrlLocaleUpdateIfNeeded(){window.Shopify?.routes?.root!=="/"&&_.default.postMessage({eventName:b.INTERNAL_EVENTS.urlLocaleUpdate,urlLocale:window.Shopify?.routes?.root})}postIsNonBaseCurrencyIfNeeded(){(0,Wr.getIsBaseCurrency)()||_.default.postMessage({eventName:b.INTERNAL_EVENTS.isNonBaseCurrency})}shopifyQuickShopClick({product:o}){const{variants:t,handle:r,quantity:n=1}=o,i=t[0].id;return this.shopifyAddToCart({variantId:i,productHandle:r,quantity:n})}shopifyAddToCart=async({variantId:o,productHandle:t,sellingPlanId:r,quantity:n=Q.DEFAULT_CART_QUANTITY,transmissionId:i})=>{const c={};Qe||(c._isAddedFromTolstoy=!0,(0,Z.updateIsAddedFromTolstoyVariantIds)(o));const d={id:o,quantity:n,properties:c};r&&(d.selling_plan=r);const u=qe({items:[d]});try{const f=await fetch(`${this.storeRootUrl}cart/add.js`,u);if(!f.ok){const p=await f.json();return this.handleAddToCartError({error:p,variantId:o,productHandle:t,transmissionId:i})}this.triggerExternalCartUpdate(),(0,Z.updateIsAddedFromTolstoyVariantIds)(o),_.default.postMessage({eventName:b.INTERNAL_EVENTS.addToCartSuccess,variantId:o,transmissionId:i,shouldEndTransmission:!1}),this.getCart({transmissionId:i})}catch(f){console.log(f),this.handleAddToCartError({error:f,variantId:o,productHandle:t,transmissionId:i})}};shopifyUpdateItemQuantity=async({variantId:o,quantity:t,transmissionId:r})=>{const n={updates:{[o]:t}},i=qe(n);try{const c=await fetch(`${this.storeRootUrl}cart/update.js`,i);if(!c.ok){const d=await c.json();return this.handleUpdateItemQuantityError({error:d,variantId:o,transmissionId:r})}this.triggerExternalCartUpdate(),_.default.postMessage({eventName:b.INTERNAL_EVENTS.cartItemQuantityChangeSuccess,variantId:o,transmissionId:r,shouldEndTransmission:!1}),this.getCart({transmissionId:r})}catch(c){this.handleUpdateItemQuantityError({error:c,variantId:o,transmissionId:r})}};async getProductRecommendations({productId:o,transmissionId:t}){const r=`${this.storeRootUrl}recommendations/products.json?product_id=${o}`;try{const n=await fetch(r,{method:"GET"}),{products:i}=await n.json();_.default.postMessage({eventName:b.INTERNAL_EVENTS.productRecommendationsResponse,productId:o,products:i,transmissionId:t})}catch{}}async loginWithMultipassUrl({multipassUrl:o,transmissionId:t}){try{const r=await fetch(o);_.default.postMessage({eventName:b.INTERNAL_EVENTS.loginWithMultipassUrlResponse,statusCode:r.status,transmissionId:t})}catch{}}async setAnonymousIdToCart({anonymousId:o}){if((0,Z.getIsShopifyCartAnonymousIdSet)()==="true"||Qe||!(0,te.verifyUserConsent)())return;const t={attributes:{[wt.tolstoyAnonymousId]:o}},r=qe(t);try{await fetch(`${this.storeRootUrl}cart/update.js`,r),(0,Z.setIsShopifyCartAnonymousIdSet)(!0)}catch(n){console.error(n)}}async blockAnonymousIdToCart({appKey:o}){const t=(0,Z.getTolstoyInteractionDate)(o);(0,te.isNullOrUndefined)(t)||await this.setAnonymousIdToCart({anonymousId:null}),Qe=!0}forceClearAnonymousIdFromCart(){if(window.Shopify?.shop!=="mlt-boutique.myshopify.com")return;const o=(0,J.getAppKey)();o&&this.blockAnonymousIdToCart({appKey:o})}internalMessagingHandler=o=>{switch(o.data.eventName){case b.INTERNAL_EVENTS.addToCart:return this.shopifyAddToCart(o.data);case b.INTERNAL_EVENTS.spotlightCarouselQuickShopClick:return this.shopifyQuickShopClick(o.data);case b.INTERNAL_EVENTS.addToCartDisableDefault:return this.disableAddToCart(o.data);case b.INTERNAL_EVENTS.blockAnonymousIdToCart:return this.blockAnonymousIdToCart(o.data);case b.INTERNAL_EVENTS.setAnonymousIdToCart:return this.setAnonymousIdToCart(o.data);case b.INTERNAL_EVENTS.loginWithMultipassUrlRequest:return this.loginWithMultipassUrl(o.data);case b.INTERNAL_EVENTS.cartItemQuantityChange:return this.shopifyUpdateItemQuantity(o.data);case b.INTERNAL_EVENTS.cartDataRequest:return this.getCart(o.data);case b.INTERNAL_EVENTS.productRecommendationsRequest:return this.getProductRecommendations(o.data);case b.INTERNAL_EVENTS.requestProductsUpdate:return this.onRequestProductsUpdateMessage(o.data);default:return null}};initInternalMessagingSubscriptions=()=>{if(_.default.subscribeMultipleEvents({eventNames:Gr,callback:this.internalMessagingHandler}),Ut){(0,te.logDevelopmentMessage)("Add to cart disabled");return}_.default.subscribeMultipleEvents({eventNames:Dt,callback:this.internalMessagingHandler})};init(){this.isShopifyStore&&(this.initInternalMessagingSubscriptions(),this.postUrlLocaleUpdateIfNeeded(),this.postIsNonBaseCurrencyIfNeeded(),this.forceClearAnonymousIdFromCart())}}const Vt=new me;Object.freeze(Vt);var Kr=Vt,b=a("aEodP"),_=a("519R9"),ne=a("lY4N9"),ae=a("kK0IS"),J=a("6QfcD"),b=a("aEodP"),_=a("519R9"),ne=a("lY4N9"),b=a("aEodP");const jr=[b.INTERNAL_EVENTS.addToCart,b.INTERNAL_EVENTS.playerReady,b.INTERNAL_EVENTS.productCardClick],zr={cartUpdated:"cart/updated"},Gn="custom-blocks.tapcart.com",qr=({productId:e,variantId:o})=>{const t={productId:String(e)};return o&&(t.variantId=String(o)),window.Tapcart.actions.openProduct(t)},Qr=e=>{const t=setTimeout(()=>{_.default.postMessage({...e,eventName:b.INTERNAL_EVENTS.addToCartError})},4e3);window.Tapcart.registerEventHandler(zr.cartUpdated,()=>{clearTimeout(t),_.default.postMessage({...e,eventName:b.INTERNAL_EVENTS.addToCartSuccess})})},Zr=async e=>{const{variantId:o,productId:t}=e;try{Qr(e),window.Tapcart.actions.addToCart({lineItems:[{variantId:String(o||t),quantity:1}]})}catch(r){return _.default.postMessage({...e,error:r,eventName:b.INTERNAL_EVENTS.addToCartError})}},Xr=()=>{try{const e=(0,ne.getTapcartDeviceId)();if(!e)return;const t=[...window?.Tapcart?.variables?.cart?.attributes||[],{key:wt.tolstoyAnonymousId,value:e}];window?.Tapcart?.actions?.updateCartAttributes?.({attributes:t})}catch(e){(0,ae.createPlayerEvent)({text:e?.message,parentUrl:window.location.href,appKey:(0,J.getAppKey)(),source:"tapcart",eventName:"widgetError",timestamp:new Date().toISOString()})}};class Jr{disableCartDefault(){_.default.postMessage({eventName:b.INTERNAL_EVENTS.addToCartDisableDefault})}internalMessagingHandler=o=>{switch(o.data.eventName){case b.INTERNAL_EVENTS.playerReady:return this.disableCartDefault();case b.INTERNAL_EVENTS.productCardClick:return qr(o.data);case b.INTERNAL_EVENTS.addToCart:return Zr(o.data);default:return null}};initInternalMessagingSubscriptions(){_.default.subscribeMultipleEvents({eventNames:jr,callback:this.internalMessagingHandler})}init(){(0,ne.getIsTapcart)()&&(this.initInternalMessagingSubscriptions(),Xr())}}const kt=new Jr;Object.freeze(kt);var en=kt,b=a("aEodP"),_=a("519R9"),G=a("kHyIS");const tn=[G.EXTERNAL_EVENTS_TO_POST.urlLocaleUpdate];var b=a("aEodP"),G=a("kHyIS"),_=a("519R9");const on=({data:e})=>{switch(e.eventName){case G.EXTERNAL_EVENTS_TO_POST.urlLocaleUpdate:const{payload:o}=e;_.default.postMessage({eventName:b.INTERNAL_EVENTS.urlLocaleUpdate,urlLocale:o.urlLocale});break;default:return null}};class Ne{constructor(){if(Ne.instance)return Ne.instance;Ne.instance=this}initExternalMessagingSubscriptions(){_.default.subscribeMultipleEvents({eventNames:tn,callback:on})}init(){this.initExternalMessagingSubscriptions();const o=window.history.pushState,t=window.history.replaceState;let r=window.location.href;const n=()=>{window.location.href!==r&&(r=window.location.href,_.default.postMessage({eventName:b.INTERNAL_EVENTS.urlChange}))};window.history.pushState=function(){o.apply(window.history,arguments),n()},window.history.replaceState=function(){t.apply(window.history,arguments),n()}}}const Bt=new Ne;Object.freeze(Bt);var rn=Bt,_=a("519R9"),G=a("kHyIS");const nn=[G.EXTERNAL_EVENTS_TO_POST.addToCartSuccess,G.EXTERNAL_EVENTS_TO_POST.addToCartError];class _e{constructor(){if(_e.instance)return _e.instance;_e.instance=this}postMessageToWidgetV2=o=>{const{data:t}=o||{},{eventName:r,subscribedEventName:n}=t||{};if(!r&&!n)return;const i=new CustomEvent("TOLSTOY_WIDGET_V2_MESSAGE",{detail:{...t,eventName:n||r}});window.dispatchEvent(i)};initExternalMessagingSubscriptions=()=>{_.default.subscribeMultipleEvents({eventNames:nn,callback:this.postMessageToWidgetV2})};init(){this.initExternalMessagingSubscriptions()}}const Ft=new _e;Object.freeze(Ft);var sn=Ft,be=a("ljwIw"),ne=a("lY4N9"),te=a("93NPo");class an{constructor(){this.domUpdatesListenerInitialized=!1,this.loaded=!1}async init(){}async loadVideo(){}registerDomUpdatesListenerIfNeeded(){}}var cn=an,Ht=a("4dQPj"),Yt=Object.assign(Object.create(null),{url:"file:///packages/widget/src/widgets/widgetloader.js"});const dn=50,ln="8b32dacc-8f1d-4cce-b641-9f60e88f9414",un=()=>{if((document.currentScript?.src||Yt?.url)?.includes("/we/widget.js")){(0,be.createScript)({src:`https://${dt.WIDGET_DOMAIN}/wes/widget.js`,container:document.head,attributes:{type:"module"}});return}(0,be.createScript)({src:`https://${dt.WIDGET_DOMAIN}/ws/widget.js`,container:document.head})},fn=()=>!!document.body,pn=()=>{try{return window.self!==window.top}catch{return!0}},$n=()=>pn()&&window.location.host==="theordinary.com",Wt=async()=>{try{if(window.tolstoyWidget||$n())return;if(zo()){console.debug("Bot user");return}if(!fn()){setTimeout(Wt,dn);return}if((0,ne.getIsTapcart)()&&await no(),(0,ne.isTapcartDashboard)())return;if((0,te.getSafeParameter)("td")==="true"&&!document.currentScript?.src?.includes?.("/ws/widget.js")&&!Yt?.url?.includes?.("/wes/widget.js")){un();return}(0,Pe.registerSiteActivityListenerIfNeeded)(),Tn(),yn(),In(),vn(),mn(),Nn(),(0,Pe.sendPageVisitEvent)(),await En(),await Promise.all([bn(),hn(),Sn(),gn()]),(0,Kt.tolstoyWidgetReady)()}catch(e){console.log("error",e)}},En=async()=>St.init(),bn=e=>new Ho(e).init(),hn=()=>new Wo().init(),gn=()=>new Mo().init(),Sn=()=>new cn().init(),Tn=()=>(_.default.init(),_.default),yn=()=>(Ht.default.init(),Ht.default),In=()=>{Ke.init();const{subscribe:e,unsubscribe:o}=Ke;return window.tolstoyWidget={...window.tolstoyWidget,subscribe:e,unsubscribe:o},Ke},vn=()=>{const{postMessage:e,closePlayer:o,identify:t,changeEmail:r}=vt;return window.tolstoyWidget={...window.tolstoyWidget,postMessage:e,closePlayer:o,identify:t,changeEmail:r},vt},mn=()=>{Kr.init(),rn.init(),Er.init(),Yr.init(),gr.init(),en.init(),tr.init(),sr.init(),xr.init(),vr.init(),Br.init(),sn.init(),(0,J.getAppKey)()===ln&&Rr.init()},Nn=()=>{_.default.subscribeMultipleEvents({eventNames:Go,callback:Ko})};Wt()})();