PageSourceSearch

https://www.dutch.com/cdn/shop/t/1171/assets/main-D0kbgca-.js

js dutch.com collected 2026-10-02 06:09:35 UTC 273,086 bytes, 33 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index.esm-B5b_sksL.js","./subscriptionCache-HW2FLFcF.js","./useTheme-CYmKclXd.js","./index-CDyFuCw9.js","./useAnalytics-D5iKMjQO.js","./filters-BrjZAjgu.js","./promo-params-vkKC0BzN.js","./platform-params-BHpjPEpa.js","./useShopifyAjax-OsCkI3bc.js","./js.cookie-CR4gOKBE.js","./useMoney-CLBrhtwG.js","./new-cart-redirect-CcNd8MEm.js","./handoff-cookie-C_5Qa1mE.js","./utc-CvZOimXZ.js","./index-D2onZCs9.js","./iterable-BxvvZ8JT.js","./useSubscription-DwYrLuun.js","./useUpgradeMembership-0AXbhAHk.js","./restricted-one-time-plans-B9H83GG2.js","./index-NCKdgxA7.js","./amplitudeExperiment-DbggqHX7.js","./promocodes-BLp2O_K-.js","./notifySlack-CMxtHm2f.js","./experiment-utils-DT7dcT-x.js","./observers-_h1yUw9p.js"])))=>i.map(i=>d[i]);
2import{i as uu,d as cu,a as lu,b as du,c as fu}from"./filters-BrjZAjgu.js";import{c as hu}from"./promo-params-vkKC0BzN.js";import{A as le,i as me,Q as vu,R as gu}from"./useTheme-CYmKclXd.js";import{c as pu}from"./platform-params-BHpjPEpa.js";import{u as mu}from"./useShopifyAjax-OsCkI3bc.js";import{a as _e}from"./js.cookie-CR4gOKBE.js";import{f as je}from"./useMoney-CLBrhtwG.js";import{u as we,_ as et,a as G,b as j,c as fr,d as x,e as T,f as M,g as z,h as Rr}from"./useAnalytics-D5iKMjQO.js";import{a as yu,n as bu,i as Su}from"./new-cart-redirect-CcNd8MEm.js";import{d as tt,a as Ys,C as _u,E as wu,s as Mr,n as Eu,k as $n,o as Iu,q as Ii,L as Or,u as Cu,r as Tu,t as Pu,v as xu}from"./subscriptionCache-HW2FLFcF.js";import{u as Xs}from"./utc-CvZOimXZ.js";import{u as Oe,C as Au}from"./index-D2onZCs9.js";import{i as zn,u as jn}from"./iterable-BxvvZ8JT.js";import{u as Ru}from"./useSubscription-DwYrLuun.js";import{u as Mu}from"./useUpgradeMembership-0AXbhAHk.js";import{R as Ou}from"./restricted-one-time-plans-B9H83GG2.js";import{p as ku}from"./index-NCKdgxA7.js";import{g as Lu,A as Du,a as Qs}from"./amplitudeExperiment-DbggqHX7.js";import{P as Q}from"./promocodes-BLp2O_K-.js";import{n as Fu}from"./notifySlack-CMxtHm2f.js";import{o as Nu,g as Bu,a as Zs,C as Uu}from"./experiment-utils-DT7dcT-x.js";import"./handoff-cookie-C_5Qa1mE.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="acecba69-3d63-4ad8-b843-360c57d162b0",e._sentryDebugIdIdentifier="sentry-dbid-acecba69-3d63-4ad8-b843-360c57d162b0")}catch{}})();hu();pu();document.addEventListener("click",e=>{const r=(e.target instanceof Element?e.target:null)?.closest('a[href="#cookie-sett
2ings"], a[href="#print-policy"]');r&&(e.preventDefault(),r.getAttribute("href")==="#print-policy"?window.print():window.ketch?.("showExperience"))});const qu=window.theme?.routes?.account_login_url??"/account/login",$u=window.theme?.routes?.account_url??"/account",zu=e=>e===qu,ju=e=>e.replace(/\/$/,"")===$u,Ci="https://return-to.invalid",Ti="/cart",Pi=e=>{const t=new URLSearchParams(e),r=t.get("return_to")||t.get("return_url");if(t.delete("return_to"),t.delete("return_url"),!r?.startsWith("/"))return{destination:null,params:t};try{const n=new URL(r,Ci);return{destination:n.origin===Ci?n:null,params:t}}catch{return{destination:null,params:t}}},Vu=(e,t="",r="")=>{if(r.startsWith("#/")){const{destination:s,params:a}=Pi(t);if(s)for(const[u,c]of s.searchParams)u==="return_url"||u==="return_to"||a.set(u,c);const o=a.toString();return`${e}/account${o?`?${o}`:""}${r}`}const{destination:n,params:i}=Pi(t);if(n?.pathname===Ti){for(const[s,a]of i)n.searchParams.has(s)||n.searchParams.append(s,a);return`${e}${Ti}${n.search}`}return`${e}/login${t}`},Hu=(e,t="",r="")=>r.startsWith("#/")?`${e}/account${t}${r}`:`${e}/${t}`,Wu=e=>{const{pathname:t,search:r,hash:n}=window.location;return window.theme?.customer?window.ReactNativeWebView||!ju(t)?null:Hu(e,r,n):zu(t)?Vu(e,r,n):null},Ku=()=>{const e=window.theme?.newAccountUrl;if(!e)return;const t=Wu(e);t&&window.location.replace(t)};Ku();const{segmentTrack:Gu}=we();function Yu({product:e}){const{addToCart:t,removeItem:r,goToCheckout:n}=mu(),i=e.variants[0];return{loading:!1,giftProduct:"",async handleSubmit(){if(this.giftProduct=="")return;this.loading=!0;const s={items:[{id:i.id,quantity:1,properties:{_annual_member_gift:this.giftProduct},selling_plan:i.selling_plan_allocations[0]?.selling_plan_id}]};try{await r(i.id),await t(s),await Gu("Product Added",{cart_id:_e.get("cart"),name:e.title,variant:i.title,variant_id:i.id,product_id:String(e.id),price:je(i.price,"{{amount}}"),currency:"USD",quantity:1,sku:i.sku,url:window.location.href,value:je(i.price,"{{amount}}"),product_type:e.type,source:"annual member gift"})}catch(a){le(a)}n()}}}tt.extend(Xs);function Xu({product:e,discount:t}){const r=new URLSearchParams(window.location.search),n=e?.selling_plan_allocations?.find(({selling_plan_id:i})=>i);return{loading:!1,get date(){const i=r.get("annualRenewalDate"),s=window.Alpine?.store("subscription")?.subscription?.next_charge_date;return i||(s?tt.utc(s).format("MM-DD-YYYY"):null)},async handleSubmit(){try{this.loading=!0;const i={items:[{id:e.id,quantity:1,properties:{_isAnnualRenewal:!0},selling_plan:n?.selling_plan_id?n.selling_plan_id:void 0}]};if(await Oe().clearCart(),await Oe().addItemToCart(i),t.length)return yu(t,"/checkout");window.location.href="/checkout"}catch(i){le(i)}finally{this.loading=!1}}}}const Qu=e=>{const t=e?`/discount/${e}?redirect=/cart`:"/cart";window.location.assign(t)},Zu=e=>{window?.analytics?.track("Product Added",{cart_id:_e.get("cart"),variant_id:e,currency:"USD",quantity:1,url:window.location.href,source:"bundle"})},Ju=e=>({_animal_type:"dog or cat",_marketing_banners:!0,...e==="Rx"&&{_purchase_rx:!0,_request_rx:!0},...e==="OTC"&&{_otc:!0}});function ec(e){const{products:t,discount:r,isAutoApplyDiscount:n=!1}=e,{addItemToCart:i}=Oe(),s=!!(r&&n),a=()=>t.flatMap(({variants:c,type:l})=>{const f=c.find(h=>h.available)?.id;if(!f)return[];Zu(f);const d=Ju(l);return[{id:f,quantity:1,properties:d}]}),o=c=>{s?Qu(r):(Alpine.store("cart").fetchCart(),Alpine.store("ui").show({items:c}))};return{products:t,discount:r,isAutoApplyDiscount:n,isLoading:!1,addBundleToCart:async function(){try{this.isLoading=!0;const c=a();await i({items:c});const l=Oe().state.value?.items.filter(f=>this.products?.some(d=>d.variants.some(h=>h.id===f.id)));l?.length&&o(l)}catch(c){le(c)}finally{this.isLoading=!1}}}}const tc=`
3  <div class="p-5">
4    <h6 class="text-lg">Oops, no products found.</h6>
5    <p>Please update the filters to expand your search.</p>
6  </div>`;function rc(e){const{containerId:t}
6=e,r=new URL(window.location.href),n=new URLSearchParams(r.search);return{loading:!1,isOpen:!1,targetContainer:null,targetSectionId:null,selectedFilters:[],selectedSorting:"",filteredData:[],async init(){this.convertParamsToFilters(),this.getTargetContainerAndSectionId(),this.$watch("selectedFilters",()=>{this.applyFiltersAndUpdateView()}),this.$watch("selectedSorting",()=>{this.applyFiltersAndUpdateView()})},async fetchTemplate(i){if(!this.targetSectionId)return console.error("No target section id found"),null;const s=`${window.location.pathname}?section_id=${this.targetSectionId}`;try{return this.loading=!0,await(await fetch(`${s}&${i}`)).text()}catch(a){return console.error(a),null}finally{this.loading=!1}},updateFilteredResults(i,s){if(!this.targetContainer||!i?.length){console.error("No target container or template found");return}const u=new DOMParser().parseFromString(i,"text/html").body.querySelector(t);if(!u){console.error("No target section found in template");return}const c=u.querySelector("ul"),l=!c||!c.children.length?tc:u.innerHTML;this.targetContainer.innerHTML=l,this.getTemplateFromCache(s)||this.filteredData.push({url:s,html:l})},convertParamsToFilters(){if(n?.size>0)for(const[i,s]of n.entries())i==="sort_by"&&(this.selectedSorting=s),this.selectedFilters.push(`${i}=${s}`)},async applyFiltersAndUpdateView(){const i=new URL(window.location.origin+window.location.pathname),s=new URLSearchParams(i.search);this.selectedFilters.forEach(c=>{const[l,f]=c.split("=");s.append(l,f)}),this.selectedSorting&&s.set("sort_by",this.selectedSorting);const a=s.toString(),o=`${window.location.pathname}?${a}`,u=this.getTemplateFromCache(a);if(u&&this.targetContainer)this.targetContainer.innerHTML=u;else{const c=await this.fetchTemplate(a);this.updateFilteredResults(c,a)}window.history.replaceState({},"",o)},getTargetContainerAndSectionId(){if(this.targetContainer||!t||!document.querySelector(t))return console.error("No target container found");if(this.targetContainer=document.querySelector(t),!this.targetContainer?.dataset.sectionId)return console.error("No section id found on target container");this.targetSectionId=this.targetContainer.dataset.sectionId},getTemplateFromCache(i){return i&&this.filteredData.length?this.filteredData.find(s=>s.url===i)?.html??null:null},resetAllFilters(){this.selectedFilters=[],this.selectedSorting=""}}}function nc(e){const t=Ys("history");return{...e,filter:!1,loading:!0,isNoResult:null,activeFilters:t.filterBy?.length?String(t.filterBy).split(","):[],filters:{pet:[{label:"Cat",value:"cat",active:!1},{label:"Dog",value:"dog",active:!1}],drug:[{label:"Non-prescription",value:"OTC",active:!1},{label:"Prescription",value:"Rx",active:!1}],collection:[],brands:[]},initializeFilters(r,n){this.filters[r]=this.collections.map(i=>({label:i.title,value:i.handle,active:!1})).filter(i=>!i.label.toLowerCase().includes("gift cards")).filter(n)},initCollections(){this.initializeFilters("collection",r=>!r.value.toLowerCase().includes("brands-"))},initBrands(){this.initializeFilters("brands",r=>r.value.toLowerCase().includes("brands-"))},setHeader(r){r.length&&r.forEach((n,i)=>{i===0?(this.$refs.filterTitle.innerText=n.title,this.$refs[n.handle]?.querySelector("h2")?.classList.add("hidden")):this.$refs[n.handle]?.querySelector("h2")?.classList.remove("hidden")})},initFilters(){const r=String(t.filterBy)?.split(",");r?.length&&(Object.keys(this.filters).forEach(n=>{this.filters[n]=this.filters[n].map(i=>r.includes(i.value)?{...i,active:!0}:i)}),this.setHeader(this.collections))},resetFilters(){for(const r in this.filters)this.filters[r]=this.filters[r].map(n=>({...n,active:!1}))},resetCategories(){this.collections.forEach(({handle:r})=>this.$refs[r].classList.remove("hidden")),this.setHeader(this.collections)},resetProducts(){this.collections.forEach(({products:r})=>{r.forEach(n=>n.hidden=null)})},getActiveFilters(r){if(!r?.length)throw new Error("filter types are required");return r.map(n=>this.filters[n]).flat().filter(n=>n.active).map(({value:n})=>n)},getChangedFilter(r,n){const i=r.filter(a=>!n.includes(a))[0],s=n.filter(a=>!r.includes(a))[0];return i||s},trackFilter(r,n){n!="undefined"&&we().segmentTrack("Product List Filtered",{filter_action:r,filter_name:n})},saveFilters(){const r=this.getActiveFilters(["drug","pet","collection","brands"]),n=t.filterBy!==""?Str
6ing(t.filterBy).split(","):[];if(r.length!==n.length){const i=r.length>n.length?"added":"removed",s=this.getChangedFilter(n,r);this.trackFilter(i,s)}t.filterBy=r.toString()},filterByCollectionAndBrand(){const r=this.filters.collection.filter(({active:i})=>i).map(({value:i,label:s})=>({handle:i,title:s})),n=this.filters.brands.filter(({active:i})=>i).map(({value:i,label:s})=>({handle:i,title:s}));(r.length||n.length)&&this.setHeader([...r,...n]),!r.length&&!n.length?this.resetCategories():this.collections.forEach(({handle:i})=>{r?.map(({handle:s})=>s).includes(i)||n?.map(({handle:s})=>s).includes(i)?this.$refs[i]?.classList.remove("hidden"):this.$refs[i]?.classList.add("hidden")})},filterByDrugType(){const r=this.getActiveFilters(["drug"]);if(!r.length){this.getActiveFilters(["pet"]).length&&this.filterByPetType();return}this.collections.forEach(({products:n})=>{n.forEach(i=>{i.hidden=!r.some(s=>i.type===s)})})},filterByPetType(){const r=this.getActiveFilters(["pet"]);if(!r.length){this.getActiveFilters(["drug"]).length&&this.filterByDrugType();return}this.collections.forEach(({products:n})=>{n.forEach(i=>{i.tags.filter(a=>r.includes(a)).length?i.hidden=!1:i.hidden=!0})})},filterProducts(){if(!this.getActiveFilters(["pet","drug"]).length)return this.resetProducts()},watchProducts(){this.collections.forEach(({handle:r,products:n})=>{n.forEach(i=>i.hidden?this.$refs[`${r}-${i.id}`]?.classList.add("hidden"):this.$refs[`${r}-${i.id}`]?.classList.remove("hidden"))})},checkIfNoResults(){const r=this.filters.collection.filter(({active:i})=>i).map(({value:i})=>i);if(!r.length){this.isNoResult=!1;return}const n=!!this.collections.filter(i=>r.includes(i.handle)?i.products.some(({hidden:s})=>!s):!1).length;this.isNoResult=!n},init(){this.loading=!0,this.initCollections(),this.initBrands(),this.$watch("filters.pet",()=>this.filterByPetType.bind(this)()),this.$watch("filters.drug",()=>this.filterByDrugType.bind(this)()),this.$watch("filters.collection",()=>{this.filterByCollectionAndBrand.bind(this)(),this.checkIfNoResults.bind(this)()}),this.$watch("filters.brands",()=>{this.filterByCollectionAndBrand.bind(this)(),this.checkIfNoResults.bind(this)()}),this.$watch("filters",()=>{this.filterProducts.bind(this)(),this.saveFilters.bind(this)()}),this.$watch("collections",()=>{this.watchProducts.bind(this)(),this.checkIfNoResults.bind(this)()}),this.initFilters(),this.loading=!1}}}tt.extend(Xs);const $e={EMPTY_EMAIL:"Email cannot be empty.",INVALID_EMAIL:"Invalid email format.",VALID_EMAIL:"Email is valid.",ERROR:"Oops, something went wrong. Please try again.",NETWORK_ERROR:"Network error. Please check your connection and try again.",CLIPBOARD_ERROR:"Could not copy code. Please copy manually."},xt={SUBSCRIBED:"_dp_newsletter_subscribed",LAST_CLOSED:"_dp_newsletter_last_closed"},Jr={CLOSE_DELAY:100,REOPEN_AFTER_MINUTES:1440,CLIPBOARD_FEEDBACK_DURATION:3e3},ic={EMAIL:/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/},sc=e=>{const t=e.trim();return t?t.length>254?{isValid:!1,message:$e.INVALID_EMAIL}:ic.EMAIL.test(t)?{isValid:!0,message:$e.VALID_EMAIL}:{isValid:!1,message:$e.INVALID_EMAIL}:{isValid:!1,message:$e.EMPTY_EMAIL}},Me={set:(e,t,r)=>_e.set(e,t,r?{expires:r}:void 0),get:e=>_e.get(e),isSubscribed:()=>_e.get(xt.SUBSCRIBED)==="true",shouldShowModal:()=>{if(Me.isSubscribed())return!1;const e=_e.get(xt.LAST_CLOSED);if(!e)return!0;const t=tt(e);return tt().diff(t,"minute")>=Jr.REOPEN_AFTER_MINUTES},saveSubscriptionState:()=>Me.set(xt.SUBSCRIBED,"true",365),saveModalClosed:()=>Me.set(xt.LAST_CLOSED,tt().toISOString())},ac=async e=>{try{await zn(e.trim()),await jn({email:e.trim(),prospect_source:"email_popup"})}catch(t){console.error("Failed to update user attributes:",t),le(t)}};function oc(e){const t=we();return{isOpen:!1,isSubscribed:!1,isJustSubscribed:!1,loading:!1,promoCode:e.promoCode,discountPercent:"",isCopied:!1,errorMessage:"",email:"",redirectUrl:e.redirectUrl,delayBeforeShowing:e.delayBeforeShowing*1e3,hasScheduledDisplay:!1,async init(){this.$watch("isOpen",r=>{!r&&!this.isSubscribed&&!this.isJustSubscribed&&(Me.saveModalClosed(),t.segmentTrack("Prompt Dismissed",this.getAnalyticsProperties()))}),this.$watch("isCopied",r=>{r&&setTimeout(()=>{this.isCopied=!1},Jr.CLIPBOARD_FEEDBACK_DURATION)}),this.initialization()},initialization(){this.isSubscribed=Me.isSubscribed();const r=this.promoCode.length>0;!this.isSubscribed&&!this.hasScheduledDisplay&&Me.shouldShowModal()&&r&&this.showModalWithDelay()},showModalWithDelay(){this.hasScheduledDisplay=!0;const r=Math.max(0,Math.min(this.delayBeforeShowing,1e4));setTimeout(()=>{!Me.isSubscribed()&&!this.isOpen&&(this.isOpen=!0,t.segmentTrack("Prompt Viewed",this.getAnalyticsProperties()))},r)},closeModal(){this.resetMessages(),setTimeout(()=>{this.isOpen=!1},Jr.CLOSE_DELAY)},resetMessages(){this.errorMessage=""},async copyToClipboard(r){try{await navigator.clipboard.writeText(r),this.isCopied=!0}catch(n){console.error("Failed to copy to clipboard:",n),this.errorMessage=$e.CLIPBOARD_ERROR,le(n)}},getAnalyticsProperties(){return{name:"email_popup",type:"popup",url:window.location.href}},async subscribeUser(){if(this.isJustSubscribed){this.closeModal(),this.redirectUrl.length>0&&window.location.assign(this.redirectUrl);return}if(this.loading)return;this.resetMessages();const{isValid:r,message:n}=sc(this.email);if(!r){this.errorMessage=n;return}const i=this.email.trim().toLowerCase();this.loading=!0;try{await ac(i),this.isSubscribed=!0,this.isJustSubscribed=!0,Me.saveSubscriptionState(),t.segmentTrack("Prompt Completed",{...this.getAnalyticsProperties(),email:i})}catch(s){const a=s instanceof Error&&(s.name==="NetworkError"||s.message.includes("fetch"));
6this.errorMessage=a?$e.NETWORK_ERROR:$e.ERROR,console.error("[Email Popup] Subscription failed:",s),le(s)}finally{this.loading=!1}}}}function uc(){const e=we();return{referFriendsHandlerHeader(){e.segmentTrack("CTA Clicked",{destination:"/pages/referrals",text:"SHARE NOW",type:"hyperlink",url:window.location.href,location:"header"}),window.location.assign("/pages/referrals")}}}async function cc({items:e,actions:t={}}){Alpine.store("cart").fetchCart(),Alpine.store("ui").show({items:e,actions:t})}function lc({product:e,customerId:t}){const{removeCartItem:r,addItemToCart:n}=Oe(),{IS_STAGING:i}=me(),s=new _u(wu(i?"dutch-staging":"dutch-prod"));return{loading:!1,states:Mr,dogInsuranceVariant:null,catInsuranceVariant:null,showStateError:!1,selectedState:null,async init(){if(t){const a=await this.getStateCode(t);this.selectedState=Mr.find(o=>o.value===a)||null,this.updateVariants(),this.updateCTAs()}},async getStateCode(a){try{const o=await Eu()??"",{Customer:u}=await s.onboard.GetCustomerByShopifyCustomerID(a,{HeaderAuthorization:o});return u?.StateCode||null}catch(o){return console.error("Error fetching state code:",o),null}},handleStateChange(a){const o=a.target;if(this.selectedState=Mr.find(u=>u.label===o.value)||null,!this.selectedState){this.showStateError=!0;return}this.updateVariants(),this.updateCTAs(),this.showStateError=!1},updateCTAs(){const a=this.$refs.dogInsuranceButton,o=this.$refs.catInsuranceButton;function u(c){return`$${je(c,"{{amount}}").replace(".00","")}/mo`}a.innerHTML=`Add dog insurance - ${u(this.dogInsuranceVariant?.price??0)}`,o.innerHTML=`Add cat insurance - ${u(this.catInsuranceVariant?.price??0)}`},updateVariants(){const a=e.variants.reduce((o,u)=>{const c=u.title.toLowerCase();return c.includes("cat")&&o.cat.push(u),c.includes("dog")&&o.dog.push(u),o},{cat:[],dog:[]});if(this.selectedState&&this.selectedState.value){this.dogInsuranceVariant=a.dog.find(o=>o.title.includes(this.selectedState?.value||""))||a.dog.find(o=>o.title.toLowerCase()==="dog")||null,this.catInsuranceVariant=a.cat.find(o=>o.title.includes(this.selectedState?.value||""))||a.cat.find(o=>o.title.toLowerCase()==="cat")||null;return}this.dogInsuranceVariant=a.dog.find(o=>o.title.toLowerCase()==="dog")||null,this.catInsuranceVariant=a.cat.find(o=>o.title.toLowerCase()==="cat")||null},stateValidation(){return this.selectedState?(this.showStateError=!1,!0):(this.showStateError=!0,!1)},async submitDogInsurance(){this.stateValidation()&&this.dogInsuranceVariant!=null&&(await this.addInsuranceToCart(this.dogInsuranceVariant),this.handleAnalytics(this.dogInsuranceVariant))},async submitCatInsurance(){this.stateValidation()&&this.catInsuranceVariant!=null&&(await this.addInsuranceToCart(this.catInsuranceVariant),this.handleAnalytics(this.catInsuranceVariant))},async removeInsuranceFromCart(){const o=Alpine.store("cart")?.state?.items.filter(u=>u.product_type==="insurance")||[];for await(const u of o)await r(u.id)},async addInsuranceToCart(a){this.loading=!0;const o={items:[{id:a.id,quantity:1,selling_plan:a.selling_plan_allocations[0]?.selling_plan_id,properties:{_keep:"true"}}]};try{await this.removeInsuranceFromCart();const c=(await n(o)).items.find(l=>l.id===a.id);c&&cc({items:[{...c,featured_image:{url:a.featured_image.src,alt:a.featured_image.alt??""}}]})}catch(u){le(u)}finally{this.loading=!1}},handleAnalytics(a){const{segmentTrack:o}=we();o("Product Added",{cart_id:_e.get("cart"),name:e.title,variant:a.title,variant_id:a.id,product_id:String(e.id),price:je(a.price,"{{amount}}"),currency:"USD",quantity:1,sku:a.sku,url:window.location.href,value:je(a.price,"{{amount}}"),product_type:e.type,source:"monthly insurance"})}}}function dc(){return{get searchParams(){return new URLSearchParams(window.location.search)},activePanel:"default",init(){this.activePanel=this.searchParams.has("lite")?"lite":"default"}}}function fc(){const{subscription:e}=Ru(),{segmentTrack:t}=we();return{loading:!1,error:!1,get subscriptionId(){return String(e.value?.subscription_id)},get rechargeCustomerId(){return String(e.value?.recharge_customer_id)},get formerPlanPrice(){return Number(e.value?.price)||0},async segmentAnalytics(r){const{variant:n,discountCode:i,discountAmount:s}=r,a=xi(i,s),o=hc(n.price,a),u={plan_movement:"upgrade",former_plan_name:"Unlimited Vet Advice",new_plan_name:n.name,former_plan_price:Ai(this.formerPlanPrice),new_plan_price:Ai(o),origin_source:"Upgrade to annual"};await t("Membership Updated",u)},async upgradeMembership(r){if(!this.loading){this.loading=!0,this.error=!1;try{await this.performUpgrade(String(r.variant.id),r.discountCode??""),await this.segmentAnalytics(r),gc({annual_upgraded:"true",discount_amount:xi(r.discountCode,r.discountAmount)?.toString()??"",new_plan:vc(r.variant)})}catch(n){this.handleError(n)}finally{this.loading=!1}}},async performUpgrade(r,n){const{upgradeMembership:i}=Mu(),s=Number(this.subscriptionId),a=Number(r);
6if(isNaN(s))throw new Error("Invalid subscription ID");if(isNaN(a))throw new Error("Invalid variant ID");try{if(!await i({subscriptionId:s,targetVariantId:a,discountCode:n}))throw new Error("Upgrade request failed")}catch(o){throw console.error("Upgrade request failed:",o),new Error("Membership upgrade failed")}},handleError(r){this.error=!0,le(r),console.error("Membership upgrade failed:",r)}}}const xi=(e,t)=>e&&t?t/100:void 0,hc=(e,t)=>{const n=(e-(t??0))/100;return Math.ceil(n)},Ai=e=>`$${e.toFixed(2)}`,vc=e=>[{type:"annual",name:"Annual"},{type:"biennial",name:"2-Year"}].find(r=>e.name.toLowerCase().includes(r.name.toLowerCase()))?.type??"",gc=e=>{const t=new URLSearchParams(e);window.location.assign(`/account#/?${t.toString()}`)},rt={EMPTY_EMAIL:"Email cannot be empty.",INVALID_EMAIL:"Invalid email format.",ERROR:"Oops, something went wrong. Please try again.",NETWORK_ERROR:"Network error. Please check your connection and try again.",SUCCESS:"You are subscribed!"},pc=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,mc=e=>{const t=e.trim();return t?t.length>254?{isValid:!1,message:rt.INVALID_EMAIL}:pc.test(t)?{isValid:!0,message:""}:{isValid:!1,message:rt.INVALID_EMAIL}:{isValid:!1,message:rt.EMPTY_EMAIL}},yc=async e=>{await zn(e);const t=await jn({email:e,prospect_source:"footer"});if(t?.code==="Error"){const r="error"in t?t.error:"Unknown error";throw new Error(`Failed to update Iterable attributes for ${e}: ${r}`)}};function bc(){return{email:"",loading:!1,isSubscribed:!1,errorMessage:"",successMessage:"",async subscribe(){if(this.loading||this.isSubscribed)return;this.errorMessage="";const{isValid:e,message:t}=mc(this.email);if(!e){this.errorMessage=t;return}const r=this.email.trim().toLowerCase();this.loading=!0;try{await yc(r),this.isSubscribed=!0,this.successMessage=rt.SUCCESS}catch(n){const i=n instanceof Error&&(n.name==="NetworkError"||n.message.includes("fetch"));this.errorMessage=i?rt.NETWORK_ERROR:rt.ERROR,console.error("[Newsletter Footer] Subscription failed:",n),le(n)}finally{this.loading=!1}}}}const Sc=[{weight:"4.4-6",fleaVariantId:41855342084249,heartwormVariantId:41855323537561},{weight:"6.1-12",fleaVariantId:41855342149785,heartwormVariantId:41855323570329},{weight:"12-25",fleaVariantId:41855342018713,heartwormVariantId:41855323603097},{weight:"25.1-50",fleaVariantId:41855342051481,heartwormVariantId:41855323635865},{weight:"50.1-100",fleaVariantId:41855342117017,heartwormVariantId:41855323668633}],_c=[{weight:"4.4-6",fleaVariantId:43261427876016,heartwormVariantId:43261418078384},{weight:"6.1-12",fleaVariantId:43261427908784,heartwormVariantId:43261418111152},{weight:"12-25",fleaVariantId:43261427941552,heartwormVariantId:43261418143920},{weight:"25.1-50",fleaVariantId:43261427974320,heartwormVariantId:43261418176688},{weight:"50.1-100",fleaVariantId:43261428007088,heartwormVariantId:43261418209456}];function wc(e){return{...e,quizResult:null,recommendedProducts:[],quantity:1,loading:!1,isAdded:!1,recommendedProduct:null,async init(){await window.CF.customerReady(()=>{this.quizResult=window.CF.customer.data,this.initRecommendedProducts(),this.setup()})},initRecommendedProducts(){this.recommendedProducts=me().IS_STAGING?Sc:_c},setup(){if(!this.products.length||!this.quizResult){console.error("Missing products or quiz result");return}const t=(this.quizResult?.rec_dog_flea_q_1||"").toLowerCase(),r=(this.quizResult?.rec_dog_flea_q_2||"").toLowerCase();if(!t||!r)return;const n=this.recommendedProducts.find(({weight:i})=>t.includes(i));if(n){const i=r.includes("yes")?n.heartwormVariantId:n.fleaVariantId;this.recommendedProduct=this.generateProduct(i,this.products)}},generateProduct(t,r){const n=r.filter(s=>s.variants.some(a=>a.id===t));if(n.length===0)return null;const i=n.map(s=>{const a=s.variants.find(u=>u.id===t),o=s.variants.findIndex(u=>u.id===t);return{id:s.id,title:s.title,productType:s.type,handle:s.handle,image:a?.featured_image?.src||s?.images[o]||s?.images[0],variant:{...a}}});return Object.assign({},...i)},formatPrice(t,r=0){if(!t)return;if(r===0)return je(t);const n=t*(1-r/100);return je(n)},async addBundleToCart(){try{this.loading=!0;const t=await this.addItemsToCart();if(t?.length&&this.trackAddedProducts(t),this.discountCode?.length){this.handleDiscountCode();return}t?.length&&Alpine.store("ui").show({items:t})}catch(t){le(t)}finally{this.loading=!1}},handleDiscountCode(){const t=this.isLoggedIn?"/cart":"/account/register",r=`${window.location.origin}/discount/${this.discountCode}?redirect=${t}`;window.location.assign(r)},buildCartPayload(){const t=this.recommendedProduct.productType.toLowerCase(),r=t==="rx",n=t==="otc";return{items:[{id:this.recommendedProduct.variant.id,quantity:1,properties:{_animal_type:"dog or cat",_marketing_banners:!0,...r&&{_purchase_rx:!0,_request_rx:!0},...n&&{_otc:!0}}}],attributes:{purchase_rx:r?!0:void 0,request_rx:r?!0:void 0,get_rx:r?!0:void 0}}},async addItemsToCart(){try{return await Oe().addItemToCart(this.buildCartPayload()),Oe().state.value?.items.filter(t=>t.variant_id===this.recommendedProduct.variant.id)}catch(t){le(t)}},trackAddedProducts(t){window.analytics&&t.forEach(r=>{window.analytics?.track("Product Added",{cart_id:_e.get("cart"),variant_id:r.id,currency:"USD",quantity:r.quantity,url:window.location.href,source:"quiz recommendation"})})}}}const Ec=[{title:"Dogs",url:"/search?q=dogs&type=product&options%5Bunavailable_products%5D=hide&options%5Bprefix%5D=last&options%5Bfields%5D=tag"},{title:"Cats",url:"/search?q=cats&type=product&options%5Bunavailable_products%5D=hide&options%5Bprefix%5D=last&options%5Bfields%5D=tag"}
6,{title:"Anxiety in Dogs",url:"/search?q=anxiety+dog&type=product&options%5Bunavailable_products%5D=hide&options%5Bprefix%5D=last&options%5Bfields%5D=tag"},{title:"Dog products",url:"/search?q=dog&type=product&options%5Bunavailable_products%5D=hide&options%5Bprefix%5D=last&options%5Bfields%5D=tag"},{title:"Cat products",url:"/search?q=cat&type=product&options%5Bunavailable_products%5D=hide&options%5Bprefix%5D=last&options%5Bfields%5D=tag"}];function Ic(){const{routes:e}=me(),t="&resources[type]=product,collection&resources[options][unavailable_products]=hide&resources[options][fields]=title,tag,product_type,variants.title";return{isShowSuggestions:!1,searchQuery:"",results:[],topics:Ec,loading:!1,isOpen:!1,init(){this.$watch("searchQuery",this.search.bind(this)),this.$watch("isOpen",r=>{if(!r)return this.isShowSuggestions=!1})},get isNoResults(){return!this.loading&&!this.results.length&&!this.isInvalidQuery&&this.searchQuery},get isInvalidQuery(){return this.inputValidation(this.searchQuery)},get isShowPopularTopics(){return!this.searchQuery&&!this.results.length},inputValidation(r){return!/^[a-zA-Z0-9\s]*$/.test(r)},async search(r){if(!this.isInvalidQuery){if(!r.length){this.results=[];return}try{this.loading=!0;const{data:n}=await $n.get(`${e.root_url}search/suggest.json?q=${r}${t}`);this.results=[...n?.resources?.results?.collections,...n?.resources?.results?.products]}catch(n){console.error(n)}finally{this.loading=!1}}},clear(){this.searchQuery="",this.results=[]},focusSearch(){this.isOpen=!this.isOpen,this.$nextTick(()=>this.$refs.input.focus())}}}const Cc=()=>{const{IS_STAGING:e}=me();return e?"18b4a4f5d9294c54a84250cf9b7edfe4":"ac2f4107a67342c896f99240a63fb2cd"},Tc=()=>{if(typeof document>"u")return[];const e="builder.tests.",t=new Set,r=[];for(const n of document.cookie.split("; ")){if(!n.startsWith(e))continue;const i=n.indexOf("=");if(i===-1)continue;const s=n.substring(e.length,i);if(!s||t.has(s))continue;const a=n.substring(i+1);a&&(t.add(s),r.push({contentId:s,variationId:a}))}return r};let kr=null;const Pc=e=>(kr||(kr=et(()=>import("./index.esm-B5b_sksL.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(t=>(t.builder.init(e),t))),kr);async function xc({amount:e}={}){if(!(typeof window>"u"))try{const t=Cc(),r=Tc();if(r.length===0)return;const{builder:n}=await Pc(t);for(const{contentId:i,variationId:s}of r){const a={type:"membership_purchased",contentId:i};s!==i&&(a.variationId=s),typeof e=="number"&&(a.amount=e),n.track("conversion",a)}}catch(t){console.warn("Builder.io conversion tracking failed",t)}}const Ac="thank_you",jt=`from=${Ac}`,Rc=`/login?${jt}`,Ri={"unlimited-vet-advice-12":{prod:{product_id:"7034225590448",product_variant_id:"43261427155120"},dev:{product_id:"7276766003353",product_variant_id:"42982385189017"}},"unlimited-vet-advice-24":{prod:{product_id:"7705825673392",product_variant_id:"43859584155824"},dev:{product_id:"44744155332761",product_variant_id:"8192203915417"}},"unlimited-vet-advice-annual-membership-149-12":{prod:{product_id:"7990800449712",product_variant_id:"44896003096752"},dev:{product_id:"8605661397145",product_variant_id:"46034103566489"}}};function Mc(e,t){if(!e||!(e in Ri))return;const{IS_STAGING:r}=me(),n=r?"dev":"prod";return Ri[e][n][t]}function Oc(){const e=Ys("history"),t=e.session_id,{segmentTrack:r}=we(),{IS_STAGING:n}=me(),i=window.theme.newAccountUrl,s=new Iu(n?Ii("dutch-staging"):Ii("dutch-prod"));
6return{loading:!1,isError:!1,sessionId:null,subscription:null,activationData:null,customerId:"",isGuestCheckout:String(e.source||"")==="guest_checkout",get bookVetCallUrl(){return`${i}/?schedule_call=true&${jt}`},get accountUrl(){return`${i}/?${jt}`},get loginUrl(){return`${i}${Rc}`},get isAccountActive(){return!this.activationData?.activationURL?.length},get isAuthenticated(){return!!me().customer},async init(){this.loading=!0,this.handleSessionId(typeof t=="string"?t:null),Oe().clearCart();const a=me().customer;this.customerId=a?.id?.toString()||"",await new Promise(o=>setTimeout(o,500)),await this.loadActivationURL(),this.trackOrderCompleted(),this.loading=!1},async loadActivationURL(){if(!this.sessionId){console.warn("No session ID available for activation URL");return}try{this.loading=!0,this.isError=!1;const a=await s.memberships.GetActivationURLFromCheckoutID(this.sessionId);this.activationData=a}catch(a){this.isError=!0,le(a,{tags:{component:"thank-you",method:"loadActivationURL"},extra:{sessionId:this.sessionId}}),console.error("Failed to load activation URL:",a)}finally{this.loading=!1}},trackOrderCompleted(){const a=this.activationData?.activationInformation?.ReferralCode||sessionStorage.getItem("dp:referralCode")||void 0,o={order_id:this.sessionId,product_title:this.activationData?.activationInformation?.ProductTitle,product_id:this.activationData?.activationInformation?.ProductID,product_variant_id:Mc(this.activationData?.activationInformation?.ProductSKU,"product_variant_id"),product_sku:this.activationData?.activationInformation?.ProductSKU,price:this.activationData?.activationInformation?.Price,email:this.activationData?.activationInformation?.Email,...a?{referral_code:a}:{}};r("Stripe Order Completed",o);const u=Cu(),c=Or.BuilderMembershipConversionTracked;if(this.sessionId&&u.get(c)!==this.sessionId){u.set(c,this.sessionId);const l=Number(o.price);xc({amount:Number.isFinite(l)?l:void 0})}window.Shopify&&window.Shopify.analytics.publish("stripe_order_completed",o),typeof window.dataLayer<"u"&&window.dataLayer.push({event:"stripe_order_completed",eventData:o})},handleSessionId(a){if(this.sessionId=a,a===localStorage.getItem(Or.StripeCheckoutSessionId)&&this.isAccountActive&&this.isAuthenticated){window.location.href=`${i}/?${jt}`;return}a&&localStorage.setItem(Or.StripeCheckoutSessionId,a)},tryAgainHandler(){this.isError=!1,this.loadActivationURL()}}}const kc=new Au,Lc=async()=>kc.fetchCart(),Dc=e=>!$n.isAxiosError(e)||(e.response?.status??0)>=500;let Mi=!1;const Fc={state:void 0,async fetchCart(){try{this.state=await Lc(),this.cartItemCount=this.state?.item_count??0}catch(e){Dc(e)?Mi||(Mi=!0,le(e,{tags:{component:"cart-store",method:"fetchCart"}})):vu({category:"cart",level:"warning",message:"cart.fetchCart failed; keeping last-known cart",data:$n.isAxiosError(e)?{code:e.code,status:e.response?.status}:void 0})}},async init(){await this.fetchCart()},cartItemCount:0},Nc={isActiveSubscriber:!1,subscription:null,book_a_vet_call:!1,call:null,loading:!1,resetState(){this.isActiveSubscriber=!1,this.subscription=null,this.book_a_vet_call=!1,this.call=null},async init(){await this.fetchSubscriptionStatus()},async fetchSubscriptionStatus(e=!1){this.loading=!0;try{const t=await Pu(e);t?(this.isActiveSubscriber=t.active||!1,this.subscription=t.subscription||null,this.book_a_vet_call=t.book_a_vet_call||!1,this.call=t.call||null):this.resetState()}catch(t){console.error("Failed to fetch subscription status:",t),this.resetState()}finally{this.loading=!1}},async forceRefreshSubscription(){Tu(),await this.fetchSubscriptionStatus(!0)}},Js={isOpen:!1,items:[],isPrescription:!1,actions:{primary:{label:"View cart",action:()=>bu()},secondary:{label:"Add more products",action:()=>Js.hide()}},dispatchAction(e){this.actions[e]!==void 0&&this.actions[e].action()},show({items:e,actions:t={},isPrescription:r=!1}){this.items=e,this.isOpen=!0,this.isPrescription=r;const n=Object.fromEntries(Object.entries(t).map(([i,s])=>[i,{...this.actions[i],...s}]));this.actions={...this.actions,...n}},hide(){this.isOpen=!1}},Bc={staging:[144568,170372],production:[144566]},Uc=Bc[me()?.IS_STAGING?"staging":"production"],qc=e=>{const t=e.replace(/\D/g,""),r=t.length===11&&t.startsWith("1")?t.slice(1):t;return r.length===10?`+1${r}`:null},$c=(e,t)=>({type:"Alia",aliaEvent:e,campaignID:t?.campaignID,campaignTitle:t?.campaignTitle,popupID:t?.popupID,popupTitle:t?.popupTitle,url:window.location.href}),Vn=(e,t,r)=>{try{const n=r.detail;we().segmentTrack(e,$c(t,n))}catch(n){console.error(`[Alia] Failed to track ${e}:`,n),le(n)}},zc=e=>Vn("Prompt Viewed","popupView",e),jc=e=>Vn("Prompt Dismissed","popupClose",e),Vc=async e=>{Vn("Prompt Completed","signUp",e);const t=e.detail,r=t?.email?.trim().toLowerCase(),n=t?.phone?qc(t.phone):null;if(r)try{await zn(r);const i=await jn({email:r,prospect_source:"alia",...n?{phoneNumber:n}:{},email_marketing_consent:{state:"subscribed",opt_in_level:"single_opt_in"},...n?{sms_marketing_consent:{state:"subscribed",opt_in_level:"single_opt_in",consent_collected_from:"WEBFORM",consent_updated_at:new Date().toISOString()},subscribedMessageTypeIds:Uc}:{}});if(i?.code==="Error"){const s="error"in i?i.error:"Unknown error";throw new Error(`Failed to update Iterable attributes for ${r}: ${s}`)}}catch(i){console.error("[Alia] Failed to forward signup to Iterable:",i),le(i)}};document.addEventListener("alia:popupView",zc);document.addEventListener("alia:signup",Vc);document.addEventListener("alia:popupClose",jc);function Hc(e){e.directive("collapse",t),t.inline=(r,{modifiers:n})=>{n.includes("min")&&(r._x_doShow=()=>{},r._x_doHide=()=>{})};function t(r,{modifiers:n}){let i=Oi(n,"duration",250)/1e3,s=Oi(n,"min",0),a=!n.includes("min");r._x_isShown||(r.style.height=`${s}
6px`),!r._x_isShown&&a&&(r.hidden=!0),r._x_isShown||(r.style.overflow="hidden");let o=(c,l)=>{let f=e.setStyles(c,l);return l.height?()=>{}:f},u={transitionProperty:"height",transitionDuration:`${i}s`,transitionTimingFunction:"cubic-bezier(0.4, 0.0, 0.2, 1)"};r._x_transition={in(c=()=>{},l=()=>{}){a&&(r.hidden=!1),a&&(r.style.display=null);let f=r.getBoundingClientRect().height;r.style.height="auto";let d=r.getBoundingClientRect().height;f===d&&(f=s),e.transition(r,e.setStyles,{during:u,start:{height:f+"px"},end:{height:d+"px"}},()=>r._x_isShown=!0,()=>{Math.abs(r.getBoundingClientRect().height-d)<1&&(r.style.overflow=null)})},out(c=()=>{},l=()=>{}){let f=r.getBoundingClientRect().height;e.transition(r,o,{during:u,start:{height:f+"px"},end:{height:s+"px"}},()=>r.style.overflow="hidden",()=>{r._x_isShown=!1,r.style.height==`${s}px`&&a&&(r.style.display="none",r.hidden=!0)})}}}}function Oi(e,t,r){if(e.indexOf(t)===-1)return r;const n=e[e.indexOf(t)+1];if(!n)return r;if(t==="duration"){let i=n.match(/([0-9]+)ms/);if(i)return i[1]}if(t==="min"){let i=n.match(/([0-9]+)px/);if(i)return i[1]}return n}var Wc=Hc,ea=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],tr=ea.join(","),ta=typeof Element>"u",Ye=ta?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,en=!ta&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},ra=function(t,r,n){var i=Array.prototype.slice.apply(t.querySelectorAll(tr));return r&&Ye.call(t,tr)&&i.unshift(t),i=i.filter(n),i},na=function e(t,r,n){for(var i=[],s=Array.from(t);s.length;){var a=s.shift();if(a.tagName==="SLOT"){var o=a.assignedElements(),u=o.length?o:a.children,c=e(u,!0,n);n.flatten?i.push.apply(i,c):i.push({scope:a,candidates:c})}else{var l=Ye.call(a,tr);l&&n.filter(a)&&(r||!t.includes(a))&&i.push(a);var f=a.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(a),d=!n.shadowRootFilter||n.shadowRootFilter(a);if(f&&d){var h=e(f===!0?a.children:f.children,!0,n);n.flatten?i.push.apply(i,h):i.push({scope:a,candidates:h})}else s.unshift.apply(s,a.children)}}return i},ia=function(t,r){return t.tabIndex<0&&(r||/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||t.isContentEditable)&&isNaN(parseInt(t.getAttribute("tabindex"),10))?0:t.tabIndex},Kc=function(t,r){return t.tabIndex===r.tabIndex?t.documentOrder-r.documentOrder:t.tabIndex-r.tabIndex},sa=function(t){return t.tagName==="INPUT"},Gc=function(t){return sa(t)&&t.type==="hidden"},Yc=function(t){var r=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(n){return n.tagName==="SUMMARY"});return r},Xc=function(t,r){for(var n=0;n<t.length;n++)if(t[n].checked&&t[n].form===r)return t[n]},Qc=function(t){if(!t.name)return!0;var r=t.form||en(t),n=function(o){return r.querySelectorAll('input[type="radio"][name="'+o+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=n(window.CSS.escape(t.name));else try{i=n(t.name)}catch(a){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",a.message),!1}var s=Xc(i,t.form);return!s||s===t},Zc=function(t){return sa(t)&&t.type==="radio"},Jc=function(t){return Zc(t)&&!Qc(t)},ki=function(t){var r=t.getBoundingClientRect(),n=r.width,i=r.height;return n===0&&i===0},el=function(t,r){var n=r.displayCheck,i=r.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var s=Ye.call(t,"details>summary:first-of-type"),a=s?t.parentElement:t;if(Ye.call(a,"details:not([open]) *"))return!0;var o=en(t).host,u=o?.ownerDocument.contains(o)||t.ownerDocument.contains(t);if(!n||n==="full"){if(typeof i=="function"){for(var c=t;t;){var l=t.parentElement,f=en(t);if(l&&!l.shadowRoot&&i(l)===!0)return ki(t);t.assignedSlot?t=t.assignedSlot:!l&&f!==t.ownerDocument?t=f.host:t=l}t=c}if(u)return!t.getClientRects().length}else if(n==="non-zero-area")return ki(t);return!1}
vendor: 5,399 bytes, line 6
6,tl=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var r=t.parentElement;r;){if(r.tagName==="FIELDSET"&&r.disabled){for(var n=0;n<r.children.length;n++){var i=r.children.item(n);if(i.tagName==="LEGEND")return Ye.call(r,"fieldset[disabled] *")?!0:!i.contains(t)}return!0}r=r.parentElement}return!1},rr=function(t,r){return!(r.disabled||Gc(r)||el(r,t)||Yc(r)||tl(r))},tn=function(t,r){return!(Jc(r)||ia(r)<0||!rr(t,r))},rl=function(t){var r=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(r)||r>=0)},nl=function e(t){var r=[],n=[];return t.forEach(function(i,s){var a=!!i.scope,o=a?i.scope:i,u=ia(o,a),c=a?e(i.candidates):o;u===0?a?r.push.apply(r,c):r.push(o):n.push({documentOrder:s,tabIndex:u,item:i,isScope:a,content:c})}),n.sort(Kc).reduce(function(i,s){return s.isScope?i.push.apply(i,s.content):i.push(s.content),i},[]).concat(r)},il=function(t,r){r=r||{};var n;return r.getShadowRoot?n=na([t],r.includeContainer,{filter:tn.bind(null,r),flatten:!1,getShadowRoot:r.getShadowRoot,shadowRootFilter:rl}):n=ra(t,r.includeContainer,tn.bind(null,r)),nl(n)},aa=function(t,r){r=r||{};var n;return r.getShadowRoot?n=na([t],r.includeContainer,{filter:rr.bind(null,r),flatten:!0,getShadowRoot:r.getShadowRoot}):n=ra(t,r.includeContainer,rr.bind(null,r)),n},At=function(t,r){if(r=r||{},!t)throw new Error("No node provided");return Ye.call(t,tr)===!1?!1:tn(r,t)},sl=ea.concat("iframe").join(","),Vt=function(t,r){if(r=r||{},!t)throw new Error("No node provided");return Ye.call(t,sl)===!1?!1:rr(r,t)};function Li(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Di(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Li(Object(r),!0).forEach(function(n){al(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Li(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function al(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Fi=function(){var e=[];return{activateTrap:function(r){if(e.length>0){var n=e[e.length-1];n!==r&&n.pause()}var i=e.indexOf(r);i===-1||e.splice(i,1),e.push(r)},deactivateTrap:function(r){var n=e.indexOf(r);n!==-1&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()}}}(),ol=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},ul=function(t){return t.key==="Escape"||t.key==="Esc"||t.keyCode===27},cl=function(t){return t.key==="Tab"||t.keyCode===9},Ni=function(t){return setTimeout(t,0)},Bi=function(t,r){var n=-1;return t.every(function(i,s){return r(i)?(n=s,!1):!0}),n},ht=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return typeof t=="function"?t.apply(void 0,n):t},Rt=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},ll=function(t,r){var n=r?.document||document,i=Di({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},r),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},a,o=function(b,y,I){return b&&b[y]!==void 0?b[y]:i[I||y]},u=function(b){return s.containerGroups.findIndex(function(y){var I=y.container,C=y.tabbableNodes;return I.contains(b)||C.find(function(A){return A===b})})},c=function(b){var y=i[b];if(typeof y=="function"){for(var I=arguments.length,C=new Array(I>1?I-1:0),A=1;A<I;A++)C[A-1]=arguments[A];y=y.apply(void 0,C)}if(y===!0&&(y=void 0),!y){if(y===void 0||y===!1)return y;throw new Error("`".concat(b,"` was specified but was not a node, or did not return a node"))}var N=y;if(typeof y=="string"&&(N=n.querySelector(y),!N))throw new Error("`".concat(b,"` as selector refers to no known node"));return N},l=function(){var b=c("initialFocus");if(b===!1)return!1;if(b===void 0)if(u(n.activeElement)>=0)b=n.activeElement;else{var y=s.tabbableGroups[0],I=y&&y.firstTabbableNode;b=I||c("fallbackFocus")}if(!b)throw new Error("Your focus-trap needs to have at least one focusable element");return b},f=function(){if(s.containerGroups=s.containers.map(function(b){var y=il(b,i.tabbableOptions),I=aa(b,i.tabbableOptions);return{container:b,tabbableNodes:y,focusableNodes:I,firstTabbableNode:y.length>0?y[0]:null,lastTabbableNode:y.length>0?y[y.length-1]:null,nextTabbableNode:function(A){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,F=I.findIndex(function(k){return k===A});if(!(F<0))return N?I.slice(F+1).find(function(k){return At(k,i.tabbableOptions)}):I.slice(0,F).reverse().find(function(k){return At(k,i.tabbableOptions)})}}}),s.tabbableGroups=s.containerGroups.filter(function(b){return b.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!c("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},d=function E(b){if(b!==!1&&b!==n.activeElement){if(!b||!b.focus){E(l());return}b.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=b,ol(b)&&b.select()}},h=function(b){var y=c("setReturnFocus",b);return y||(y===!1?!1:b)},v=function(b){var y=Rt(b);if(!(u(y)>
6=0)){if(ht(i.clickOutsideDeactivates,b)){a.deactivate({returnFocus:i.returnFocusOnDeactivate&&!Vt(y,i.tabbableOptions)});return}ht(i.allowOutsideClick,b)||b.preventDefault()}},m=function(b){var y=Rt(b),I=u(y)>=0;I||y instanceof Document?I&&(s.mostRecentlyFocusedNode=y):(b.stopImmediatePropagation(),d(s.mostRecentlyFocusedNode||l()))},g=function(b){var y=Rt(b);f();var I=null;if(s.tabbableGroups.length>0){var C=u(y),A=C>=0?s.containerGroups[C]:void 0;if(C<0)b.shiftKey?I=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:I=s.tabbableGroups[0].firstTabbableNode;else if(b.shiftKey){var N=Bi(s.tabbableGroups,function(L){var $=L.firstTabbableNode;return y===$});if(N<0&&(A.container===y||Vt(y,i.tabbableOptions)&&!At(y,i.tabbableOptions)&&!A.nextTabbableNode(y,!1))&&(N=C),N>=0){var F=N===0?s.tabbableGroups.length-1:N-1,k=s.tabbableGroups[F];I=k.lastTabbableNode}}else{var D=Bi(s.tabbableGroups,function(L){var $=L.lastTabbableNode;return y===$});if(D<0&&(A.container===y||Vt(y,i.tabbableOptions)&&!At(y,i.tabbableOptions)&&!A.nextTabbableNode(y))&&(D=C),D>=0){var P=D===s.tabbableGroups.length-1?0:D+1,R=s.tabbableGroups[P];I=R.firstTabbableNode}}}else I=c("fallbackFocus");I&&(b.preventDefault(),d(I))},p=function(b){if(ul(b)&&ht(i.escapeDeactivates,b)!==!1){b.preventDefault(),a.deactivate();return}if(cl(b)){g(b);return}},S=function(b){var y=Rt(b);u(y)>=0||ht(i.clickOutsideDeactivates,b)||ht(i.allowOutsideClick,b)||(b.preventDefault(),b.stopImmediatePropagation())},_=function(){if(s.active)return Fi.activateTrap(a),s.delayInitialFocusTimer=i.delayInitialFocus?Ni(function(){d(l())}):d(l()),n.addEventListener("focusin",m,!0),n.addEventListener("mousedown",v,{capture:!0,passive:!1}),n.addEventListener("touchstart",v,{capture:!0,passive:!1}),n.addEventListener("click",S,{capture:!0,passive:!1}),n.addEventListener("keydown",p,{capture:!0,passive:!1}),a},w=function(){if(s.active)return n.removeEventListener("focusin",m,!0),n.removeEventListener("mousedown",v,!0),n.removeEventListener("touchstart",v,!0),n.removeEventListener("click",S,!0),n.removeEventListener("keydown",p,!0),a};return a={get active(){return s.active},get paused(){return s.paused},activate:function(b){if(s.active)return this;var y=o(b,"onActivate"),I=o(b,"onPostActivate"),C=o(b,"checkCanFocusTrap");C||f(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=n.activeElement,y&&y();var A=function(){C&&f(),_(),I&&I()};return C?(C(s.containers.concat()).then(A,A),this):(A(),this)},deactivate:function(b){if(!s.active)return this;var y=Di({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},b);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,w(),s.active=!1,s.paused=!1,Fi.deactivateTrap(a);var I=o(y,"onDeactivate"),C=o(y,"onPostDeactivate"),A=o(y,"checkCanReturnFocus"),N=o(y,"returnFocus","returnFocusOnDeactivate");I&&I();var F=function(){Ni(function(){N&&d(h(s.nodeFocusedBeforeActivation)),C&&C()})};return N&&A?(A(h(s.nodeFocusedBeforeActivation)).then(F,F),this):(F(),this)},pause:function(){return s.paused||!s.active?this:(s.paused=!0,w(),this)},unpause:function(){return!s.paused||!s.active?this:(s.paused=!1,f(),_(),this)},updateContainerElements:function(b){var y=[].concat(b).filter(Boolean);return s.containers=y.map(function(I){return typeof I=="string"?n.querySelector(I):I}),s.active&&f(),this}},a.updateContainerElements(t),a};function dl(e){let t,r;window.addEventListener("focusin",()=>{t=r,r=document.activeElement}),e.magic("focus",n=>{let i=n;return{__noscroll:!1,__wrapAround:!1,within(s){return i=s,this},withoutScrolling(){return this.__noscroll=!0,this},noscroll(){return this.__noscroll=!0,this},withWrapAround(){return this.__wrapAround=!0,this},wrap(){return this.withWrapAround()},focusable(s){return Vt(s)},previouslyFocused(){return t},lastFocused(){return t},focused(){return r},focusables(){return Array.isArray(i)?i:aa(i,{displayCheck:"none"})},all(){return this.focusables()},isFirst(s){let a=this.all();return a[0]&&a[0].isSameNode(s)},isLast(s){let a=this.all();return a.length&&a.slice(-1)[0].isSameNode(s)},getFirst(){return this.all()[0]},getLast(){return this.all().slice(-1)[0]},getNext(){let s=this.all(),a=document.activeElement;if(s.indexOf(a)!==-1)return this.__wrapAround&&s.indexOf(a)===s.length-1?s[0]:s[s.indexOf(a)+1]},getPrevious(){let s=this.all(),a=document.activeElement;if(s.indexOf(a)!==-1)return this.__wrapAround&&s.indexOf(a)===0?s.slice(-1)[0]:s[s.indexOf(a)-1]},first(){this.focus(this.getFirst())},last(){this.focus(this.getLast())},next(){this.focus(this.getNext())},previous(){this.focus(this.getPrevious())},prev(){return this.previous()},focus(s){s&&setTimeout(()=>{s.hasAttribute("tabindex")||s.setAttribute("tabindex","0"),s.focus({preventScroll:this.__noscroll})})}}}),e.directive("trap",e.skipDuringClone((n,{expression:i,modifiers:s},{effect:a,evaluateLater:o,cleanup:u})=>{let c=o(i),l=!1,f={escapeDeactivates:!1,allowOutsideClick:!0,fallbackFocus:()=>n};if(s.includes("noautofocus"))f.initialFocus=!1;else{let g=n.querySelector("[autofocus]");g&&(f.initialFocus=g)}let d=ll(n,f),h=()=>{},v=()=>{};const m=()=>{h(),h=()=>{},v(),v=()=>{},d.deactivate({returnFocus:!s.includes("noreturn")})};a(()=>c(g=>{l!==g&&(g&&!l&&(s.includes("noscroll")&&(v=fl()),s.includes("inert")&&(h=Ui(n)),setTimeout(()=>{d.activate()},15)),!g&&l&&m(),l=!!g)})),u(m)},(n,{expression:i,modifiers:s},{evaluate:a})=>{s.includes("inert")&&a(i)&&Ui(n)}))}function Ui(e){let t=[];return oa(e,r=>{let n=r.hasAttribute("aria-hidden");
6r.setAttribute("aria-hidden","true"),t.push(()=>n||r.removeAttribute("aria-hidden"))}),()=>{for(;t.length;)t.pop()()}}function oa(e,t){e.isSameNode(document.body)||!e.parentNode||Array.from(e.parentNode.children).forEach(r=>{r.isSameNode(e)?oa(e.parentNode,t):t(r)})}function fl(){let e=document.documentElement.style.overflow,t=document.documentElement.style.paddingRight,r=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=`${r}px`,()=>{document.documentElement.style.overflow=e,document.documentElement.style.paddingRight=t}}var hl=dl;/*! Bundled license information:
7
8tabbable/dist/index.esm.js:
9  (*!
10  * tabbable 5.3.3
11  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
12  *)
13
14focus-trap/dist/focus-trap.esm.js:
15  (*!
16  * focus-trap 6.9.4
17  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
18  *)
19*/function vl(e){e.directive("intersect",e.skipDuringClone((t,{value:r,expression:n,modifiers:i},{evaluateLater:s,cleanup:a})=>{let o=s(n),u={rootMargin:ml(i),threshold:gl(i)},c=new IntersectionObserver(l=>{l.forEach(f=>{f.isIntersecting!==(r==="leave")&&(o(),i.includes("once")&&c.disconnect())})},u);c.observe(t),a(()=>{c.disconnect()})}))}function gl(e){if(e.includes("full"))return .99;if(e.includes("half"))return .5;if(!e.includes("threshold"))return 0;let t=e[e.indexOf("threshold")+1];return t==="100"?1:t==="0"?0:+`.${t}`}function pl(e){let t=e.match(/^(-?[0-9]+)(px|%)?$/);return t?t[1]+(t[2]||"px"):void 0}function ml(e){const t="margin",r="0px 0px 0px 0px",n=e.indexOf(t);if(n===-1)return r;let i=[];for(let s=1;s<5;s++)i.push(pl(e[n+s]||""));return i=i.filter(s=>s!==void 0),i.length?i.join(" ").trim():r}var yl=vl;function bl(e){let t=()=>{let r,n;try{n=localStorage}catch(i){console.error(i),console.warn("Alpine: $persist is using temporary storage since localStorage is unavailable.");let s=new Map;n={getItem:s.get.bind(s),setItem:s.set.bind(s)}}return e.interceptor((i,s,a,o,u)=>{let c=r||`_x_${o}`,l=qi(c,n)?$i(c,n):i;return a(l),e.effect(()=>{let f=s();zi(c,f,n),a(f)}),l},i=>{i.as=s=>(r=s,i),i.using=s=>(n=s,i)})};Object.defineProperty(e,"$persist",{get:()=>t()}),e.magic("persist",t),e.persist=(r,{get:n,set:i},s=localStorage)=>{let a=qi(r,s)?$i(r,s):n();i(a),e.effect(()=>{let o=n();zi(r,o,s),i(o)})}}function qi(e,t){return t.getItem(e)!==null}function $i(e,t){let r=t.getItem(e,t);if(r!==void 0)return JSON.parse(r)}function zi(e,t,r){r.setItem(e,JSON.stringify(t))}var Sl=bl;function _l(e){e.directive("money",(t,{expression:r,modifiers:n},{evaluateLater:i,effect:s})=>{const[a,o]=n,u=n.includes("decimal"),c=n.includes("shopify"),l=c?window.Shopify.locale:a,f=c?window.Shopify.currency.active:o,d=i(r);s(()=>{d(h=>{const v=u?Number(h):Number(h)/100,m=new Intl.NumberFormat(l,{style:"currency",currency:f}).format(v);t.innerText=m})})})}function wl(e){e.magic("plur",()=>(t,r=1)=>ku(t,r))}function El(e){const t=(n,i)=>{window?.analytics&&window.analytics.track(n,i)},r=()=>{window?.analytics&&window.analytics.page("Page Viewed")};e.magic("segmentTrack",()=>t),e.magic("segmentPage",()=>r)}let ji=!1;function Il(e){ji||(e.magic("getFlagValue",()=>async t=>{try{return await Lu(t)}catch{return console.error(`[Amplitude Experiment] Flag ${t} not found`),null}}),ji=!0)}var rn=!1,nn=!1,Ve=[],sn=-1;function Cl(e){Tl(e)}function Tl(e){Ve.includes(e)||Ve.push(e),xl()}function Pl(e){let t=Ve.indexOf(e);t!==-1&&t>sn&&Ve.splice(t,1)}function xl(){!nn&&!rn&&(rn=!0,queueMicrotask(Al))}function Al(){rn=!1,nn=!0;for(let e=0;e<Ve.length;e++)Ve[e](),sn=e;Ve.length=0,sn=-1,nn=!1}var ot,Qe,ut,ua,an=!0;function Rl(e){an=!1,e(),an=!0}function Ml(e){ot=e.reactive,ut=e.release,Qe=t=>e.effect(t,{scheduler:r=>{an?Cl(r):r()}}),ua=e.raw}function Vi(e){Qe=e}function Ol(e){let t=()=>{};return[n=>{let i=Qe(n);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(s=>s())}),e._x_effects.add(i),t=()=>{i!==void 0&&(e._x_effects.delete(i),ut(i))},i},()=>{t()}]}function ca(e,t){let r=!0,n,i=Qe(()=>{let s=e();JSON.stringify(s),r?n=s:queueMicrotask(()=>{t(s,n),n=s}),r=!1});return()=>ut(i)}var la=[],da=[],fa=[];function kl(e){fa.push(e)}function Hn(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,da.push(t))}function ha(e){la.push(e)}function va(e,t,r){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(r)}function ga(e,t){e._x_attributeCleanups&&Object.entries(e._x_attributeCleanups).forEac
vendor: 19,601 bytes, lines 19-23
19h(([r,n])=>{(t===void 0||t.includes(r))&&(n.forEach(i=>i()),delete e._x_attributeCleanups[r])})}function Ll(e){for(e._x_effects?.forEach(Pl);e._x_cleanups?.length;)e._x_cleanups.pop()()}var Wn=new MutationObserver(Xn),Kn=!1;function Gn(){Wn.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),Kn=!0}function pa(){Dl(),Wn.disconnect(),Kn=!1}var vt=[];function Dl(){let e=Wn.takeRecords();vt.push(()=>e.length>0&&Xn(e));let t=vt.length;queueMicrotask(()=>{if(vt.length===t)for(;vt.length>0;)vt.shift()()})}function Y(e){if(!Kn)return e();pa();let t=e();return Gn(),t}var Yn=!1,nr=[];function Fl(){Yn=!0}function Nl(){Yn=!1,Xn(nr),nr=[]}function Xn(e){if(Yn){nr=nr.concat(e);return}let t=[],r=new Set,n=new Map,i=new Map;for(let s=0;s<e.length;s++)if(!e[s].target._x_ignoreMutationObserver&&(e[s].type==="childList"&&(e[s].removedNodes.forEach(a=>{a.nodeType===1&&a._x_marker&&r.add(a)}),e[s].addedNodes.forEach(a=>{if(a.nodeType===1){if(r.has(a)){r.delete(a);return}a._x_marker||t.push(a)}})),e[s].type==="attributes")){let a=e[s].target,o=e[s].attributeName,u=e[s].oldValue,c=()=>{n.has(a)||n.set(a,[]),n.get(a).push({name:o,value:a.getAttribute(o)})},l=()=>{i.has(a)||i.set(a,[]),i.get(a).push(o)};a.hasAttribute(o)&&u===null?c():a.hasAttribute(o)?(l(),c()):l()}i.forEach((s,a)=>{ga(a,s)}),n.forEach((s,a)=>{la.forEach(o=>o(a,s))});for(let s of r)t.some(a=>a.contains(s))||da.forEach(a=>a(s));for(let s of t)s.isConnected&&fa.forEach(a=>a(s));t=null,r=null,n=null,i=null}function ma(e){return Tt(nt(e))}function Ct(e,t,r){return e._x_dataStack=[t,...nt(r||e)],()=>{e._x_dataStack=e._x_dataStack.filter(n=>n!==t)}}function nt(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?nt(e.host):e.parentNode?nt(e.parentNode):[]}function Tt(e){return new Proxy({objects:e},Bl)}var Bl={ownKeys({objects:e}){return Array.from(new Set(e.flatMap(t=>Object.keys(t))))},has({objects:e},t){return t==Symbol.unscopables?!1:e.some(r=>Object.prototype.hasOwnProperty.call(r,t)||Reflect.has(r,t))},get({objects:e},t,r){return t=="toJSON"?Ul:Reflect.get(e.find(n=>Reflect.has(n,t))||{},t,r)},set({objects:e},t,r,n){const i=e.find(a=>Object.prototype.hasOwnProperty.call(a,t))||e[e.length-1],s=Object.getOwnPropertyDescriptor(i,t);return s?.set&&s?.get?s.set.call(n,r)||!0:Reflect.set(i,t,r)}};function Ul(){return Reflect.ownKeys(this).reduce((t,r)=>(t[r]=Reflect.get(this,r),t),{})}function ya(e){let t=n=>typeof n=="object"&&!Array.isArray(n)&&n!==null,r=(n,i="")=>{Object.entries(Object.getOwnPropertyDescriptors(n)).forEach(([s,{value:a,enumerable:o}])=>{if(o===!1||a===void 0||typeof a=="object"&&a!==null&&a.__v_skip)return;let u=i===""?s:`${i}.${s}`;typeof a=="object"&&a!==null&&a._x_interceptor?n[s]=a.initialize(e,u,s):t(a)&&a!==n&&!(a instanceof Element)&&r(a,u)})};return r(e)}function ba(e,t=()=>{}){let r={initialValue:void 0,_x_interceptor:!0,initialize(n,i,s){return e(this.initialValue,()=>ql(n,i),a=>on(n,i,a),i,s)}};return t(r),n=>{if(typeof n=="object"&&n!==null&&n._x_interceptor){let i=r.initialize.bind(r);r.initialize=(s,a,o)=>{let u=n.initialize(s,a,o);return r.initialValue=u,i(s,a,o)}}else r.initialValue=n;return r}}function ql(e,t){return t.split(".").reduce((r,n)=>r[n],e)}function on(e,t,r){if(typeof t=="string"&&(t=t.split(".")),t.length===1)e[t[0]]=r;else{if(t.length===0)throw error;return e[t[0]]||(e[t[0]]={}),on(e[t[0]],t.slice(1),r)}}var Sa={};function be(e,t){Sa[e]=t}function un(e,t){let r=$l(t);return Object.entries(Sa).forEach(([n,i])=>{Object.defineProperty(e,`$${n}`,{get(){return i(t,r)},enumerable:!1})}),e}function $l(e){let[t,r]=Ta(e),n={interceptor:ba,...t};return Hn(e,r),n}function zl(e,t,r,...n){try{return r(...n)}catch(i){Et(i,e,t)}}function Et(e,t,r=void 0){e=Object.assign(e??{message:"No error message given."},{el:t,expression:r}),console.warn(`Alpine Expression Error: ${e.message}
20
21${r?'Expression: "'+r+`"
22
23`:""}`,t),setTimeout(()=>{throw e},0)}var Ht=!0;function _a(e){let t=Ht;Ht=!1;let r=e();return Ht=t,r}function He(e,t,r={}){let n;return ce(e,t)(i=>n=i,r),n}function ce(...e){return wa(...e)}var wa=Ea;function jl(e){wa=e}function Ea(e,t){let r={};un(r,e);let n=[r,...nt(e)],i=typeof t=="function"?Vl(n,t):Wl(n,t,e);return zl.bind(null,e,t,i)}function Vl(e,t){return(r=()=>{},{scope:n={},params:i=[]}={})=>{let s=t.apply(Tt([n,...e]),i);ir(r,s)}}var Lr={};function Hl(e,t){if(Lr[e])return Lr[e];let r=Object.getPrototypeOf(async function(){}).constructor,n=/^[\n\s]*if.*\(.*\)/.test(e.trim())||/^(let|const)\s/.test(e.trim())?`(async()=>{ ${e} })()`:e,s=(()=>{try{let a=new r(["__self","scope"],`with (scope) { __self.result = ${n} }; __self.finished = true; return __self.result;`);return Object.defineProperty(a,"name",{value:`[Alpine] ${e}`}),a}catch(a){return Et(a,t,e),Promise.resolve()}})();return Lr[e]=s,s}function Wl(e,t,r){let n=Hl(t,r);return(i=()=>{},{scope:s={},params:a=[]}={})=>{n.result=void 0,n.finished=!1;let o=Tt([s,...e]);if(typeof n=="function"){let u=n(n,o).catch(c=>Et(c,r,t));n.finished?(ir(i,n.result,o,a,r),n.result=void 0):u.then(c=>{ir(i,c,o,a,r)}).catch(c=>Et(c,r,t)).finally(()=>n.result=void 0)}}}function ir(e,t,r,n,i){if(Ht&&typeof t=="function"){let s=t.apply(r,n);s instanceof Promise?s.then(a=>ir(e,a,r,n)).catch(a=>Et(a,i,t)):e(s)}else typeof t=="object"&&t instanceof Promise?t.then(s=>e(s)):e(t)}var Qn="x-";function ct(e=""){return Qn+e}function Kl(e){Qn=e}var sr={};function te(e,t){return sr[e]=t,{before(r){if(!sr[r]){console.warn(String.raw`Cannot find directive \`${r}\`. \`${e}\` will use the default order of execution`);return}const n=ze.indexOf(r);ze.splice(n>=0?n:ze.indexOf("DEFAULT"),0,e)}}}function Gl(e){return Object.keys(sr).includes(e)}function Zn(e,t,r){if(t=Array.from(t),e._x_virtualDirectives){let s=Object.entries(e._x_virtualDirectives).map(([o,u])=>({name:o,value:u})),a=Ia(s);s=s.map(o=>a.find(u=>u.name===o.name)?{name:`x-bind:${o.name}`,value:`"${o.value}"`}:o),t=t.concat(s)}let n={};return t.map(Aa((s,a)=>n[s]=a)).filter(Ma).map(Ql(n,r)).sort(Zl).map(s=>Xl(e,s))}function Ia(e){return Array.from(e).map(Aa()).filter(t=>!Ma(t))}var cn=!1,yt=new Map,Ca=Symbol();function Yl(e){cn=!0;let t=Symbol();Ca=t,yt.set(t,[]);let r=()=>{for(;yt.get(t).length;)yt.get(t).shift()();yt.delete(t)},n=()=>{cn=!1,r()};e(r),n()}function Ta(e){let t=[],r=o=>t.push(o),[n,i]=Ol(e);return t.push(i),[{Alpine:Pt,effect:n,cleanup:r,evaluateLater:ce.bind(ce,e),evaluate:He.bind(He,e)},()=>t.forEach(o=>o())]}function Xl(e,t){let r=()=>{},n=sr[t.type]||r,[i,s]=Ta(e);va(e,t.original,s);let a=()=>{e._x_ignore||e._x_ignoreSelf||(n.inline&&n.inline(e,t,i),n=n.bind(n,e,t,i),cn?yt.get(Ca).push(n):n())};return a.runCleanups=s,a}var Pa=(e,t)=>({name:r,value:n})=>(r.startsWith(e)&&(r=r.replace(e,t)),{name:r,value:n}),xa=e=>e;function Aa(e=()=>{}){return({name:t,value:r})=>{let{name:n,value:i}=Ra.reduce((s,a)=>a(s),{name:t,value:r});return n!==t&&e(n,t),{name:n,value:i}}}var Ra=[];function Jn(e){Ra.push(e)}function Ma({name:e}){return Oa().test(e)}var Oa=()=>new RegExp(`^${Qn}([^:^.]+)\\b`);function Ql(e,t){return({name:r,value:n})=>{let i=r.match(Oa()),s=r.match(/:([a-zA-Z0-9\-_:]+)/),a=r.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],o=t||e[r]||r;return{type:i?i[1]:null,value:s?s[1]:null,modifiers:a.map(u=>u.replace(".","")),expression:n,original:o}}}var ln="DEFAULT",ze=["ignore","ref","data","id","anchor","bind","init","for","model","modelable","transition","show","if",ln,"teleport"];function Zl(e,t){let r=ze.indexOf(e.type)===-1?ln:e.type,n=ze.indexOf(t.type)===-1?ln:t.type;return ze.indexOf(r)-ze.indexOf(n)}function St(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}function Xe(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>Xe(i,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let n=e.firstElementChild;for(;n;)Xe(n,t),n=n.nextElementSibling}function ge(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}var Hi=!1;function Jl(){Hi&&ge("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."),Hi=!0,document.body||ge("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"),St(document,"alpine:init"),St(document,"alpine:initializing"),Gn(),kl(t=>Te(t,Xe)),Hn(t=>dt(t)),ha((t,r)=>{Zn(t,r).forEach(n=>n())});let e=t=>!hr(t.parentElement,!0);Array.from(document.querySelectorAll(Da().join(","))).filter(e).forEach(t=>{Te(t)}),St(document,"alpine:initialized"),setTimeout(()=>{nd()})}var ei=[],ka=[];function La(){return ei.map(e=>e())}function Da(){return ei.concat(ka).map(e=>e())}function Fa(e){ei.push(e)}function Na(e){ka.push(e)}function hr(e,t=!1){return lt(e,r=>{if((t?Da():La()).some(i=>r.matches(i)))return!0})}function lt(e,t){if(e){if(t(e))return e;if(e._x_teleportBack&&(e=e._x_teleportBack),!!e.parentElement)return lt(e.parentElement,t)}}function ed(e){return La().some(t=>e.matches(t))}var Ba=[];function td(e){Ba.push(e)}var rd=1;function Te(e,t=Xe,r=()=>{}){lt(e,n=>n._x_ignore)||Yl(()=>{t(e,(n,i)=>{n._x_marker||(r(n,i),Ba.forEach(s=>s(n,i)),Zn(n,n.attributes).forEach(s=>s()),n._x_ignore||(n._x_marker=rd++),n._x_ignore&&i())})})}function dt(e,t=Xe){t(e,r=>{Ll(r),ga(r),delete r._x_marker})}function nd(){[["ui","dialog",["[x-dialog], [x-popover]"]],["anchor","anchor",["[x-anchor]"]],["sort","sort",["[x-sort]"]]].forEach(([t,r,n])=>{Gl(r)||n.some(i=>{if(document.querySelector(i))return ge(`found "${i}", but missing ${t} plugin`),!0})})}var dn=[],ti=!1;function ri(e=()=>{}){return queueMicrotask(()=>{ti||setTimeout(()=>{fn()})}),new Promise(t=>{dn.push(()=>{e(),t()})})}function fn(){for(ti=!1;dn.length;)dn.shift()()}function id(){ti=!0}function ni(e,t){return Array.isArray(t)?Wi(e,t.join(" ")):typeof t=="object"&&t!==null?sd(e,t):typeof t=="function"?ni(e,t()):Wi(e,t)}function Wi(e,t){let r=i=>i.split(" ").filter(s=>!e.classList.contains(s)).filter(Boolean),n=i=>(e.classList.add(...i),()=>{e.classList.remove(...i)});return t=t===!0?t="":t||"",n(r(t))}function sd(e,t){let r=o=>o.split(" ").filter(Boolean),n=Object.entries(t).flatMap(([o,u])=>u?r(o):!1).filter(Boolean),i=Object.entries(t).flatMap(([o,u])=>u?!1:r(o)).filter(Boolean),s=[],a=[];return i.forEach(o=>{e.classList.contains(o)&&(e.classList.remove(o),a.push(o))}),n.forEach(o=>{e.classList.contains(o)||(e.classList.add(o),s.push(o))}),()=>{a.forEach(o=>e.classList.add(o)),s.forEach(o=>e.classList.remove(o))}}function vr(e,t){return typeof t=="object"&&t!==null?ad(e,t):od(e,t)}function ad(e,t){let r={};return Object.entries(t).forEach(([n,i])=>{r[n]=e.style[n],n.startsWith("--")||(n=ud(n)),e.style.setProperty(n,i)}),setTimeout(()=>{e.style.length===0&&e.removeAttribute("style")}),()=>{vr(e,r)}}function od(e,t){let r=e.getAttribute("style",t);return e.setAttribute("style",t),()=>{e.setAttribute("style",r||"")}}function ud(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function hn(e,t=()=>{}){let r=!1;return function(){r?t.apply(this,arguments):(r=!0,e.apply(this,arguments))}}te("transition",(e,{value:t,modifiers:r,expression:n},{evaluate:i})=>{typeof n=="function"&&(n=i(n)),n!==!1&&(!n||typeof n=="boolean"?ld(e,r,t):cd(e,n,t))});function cd(e,t,r){Ua(e,ni,""),{enter:i=>{e._x_transition.enter.during=i},"enter-start":i=>{e._x_transition.enter.start=i},"enter-end":i=>{e._x_transition.enter.end=i},leave:i=>{e._x_transition.leave.during=i},"leave-start":i=>{e._x_transition.leave.start=i},"leave-end":i=>{e._x_transition.leave.end=i}}[r](t)}function ld(e,t,r){Ua(e,vr);let n=!t.includes("in")&&!t.includes("out")&&!r,i=n||t.includes("in")||["enter"].includes(r),s=n||t.includes("out")||["leave"].includes(r);t.includes("in")&&!n&&(t=t.filter((p,S)=>S<t.indexOf("out"))),t.includes("out")&&!n&&(t=t.filter((p,S)=>S>t.indexOf("out")));let a=!t.includes("opacity")&&!t.includes("scale"),o=a||t.includes("opacity"),u=a||t.includes("scale"),c=o?0:1,l=u?gt(t,"scale",95)/100:1,f=gt(t,"delay",0)/1e3,d=gt(t,"origin","center"),h="opacity, transform",v=gt(t,"duration",150)/1e3,m=gt(t,"duration",75)/1e3,g="cubic-bezier(0.4, 0.0, 0.2, 1)";i&&(e._x_transition.enter.during={transformOrigin:d,transitionDelay:`${f}s`,transitionProperty:h,transitionDuration:`${v}s`,transitionTimingFunction:g},e._x_transition.enter.start={opacity:c,transform:`scale(${l})`},e._x_transition.enter.end={opacity:1,transform:"scale(1)"}),s&&(e._x_transition.leave.during={transformOrigin:d,transitionDelay:`${f}s`,transitionProperty:h,transitionDuration:`${m}s`,transitionTimingFunction:g},e._x_transition.leave.start={opacity:1,transform:"scale(1)"},e._x_transition.leave.end={opacity:c,transform:`scale(${l})`})}function Ua(e,t,r={}){e._x_transition||(e._x_transition={enter:{during:r,start:r,end:r},leave:{during:r,start:r,end:r},in(n=()=>{},i=()=>{}){vn(e,t,{during:this.enter.during,start:this.enter.start,end:this.enter.end},n,i)},out(n=()=>{},i=()=>{}){vn(e,t,{during:this.leave.during,start:this.leave.start,end:this.leave.end},n,i)}})}window.Element.prototype._x_toggleAndCascadeWithTransitions=function(e,t,r,n){const i=document.visibilityState==="visible"?requestAnimationFrame:setTimeout;let s=()=>i(r);if(t){e._x_transition&&(e._x_transition.enter||e._x_transition.leave)?e._x_transition.enter&&(Object.entries(e._x_transition.enter.during).length||Object.entries(e._x_transition.enter.start).length||Object.entries(e._x_transition.enter.end).length)?e._x_transition.in(r):s():e._x_transition?e._x_transition.in(r):s();return}e._x_hidePromise=e._x_transition?new Promise((a,o)=>{e._x_transition.out(()=>{},()=>a(n)),e._x_transitioning&&e._x_transitioning.beforeCancel(()=>o({isFromCancelledTransition:!0}))}):Promise.resolve(n),queueMicrotask(()=>{let a=qa(e);a?(a._x_hideChildren||(a._x_hideChildren=[]),a._x_hideChildren.push(e)):i(()=>{let o=u=>{let c=Promise.all([u._x_hidePromise,...(u._x_hideChildren||[]).map(o)]).then(([l])=>l?.());return delete u._x_hidePromise,delete u._x_hideChildren,c};o(e).catch(u=>{if(!u.isFromCancelledTransition)throw u})})})};function qa(e){let t=e.parentNode;if(t)return t._x_hidePromise?t:qa(t)}function vn(e,t,{during:r,start:n,end:i}={},s=()=>{},a=()=>{}){if(e._x_transitioning&&e._x_transitioning.cancel(),Object.keys(r).length===0&&Object.keys(n).length===0&&Object.keys(i).length===0){s(),a();return}let o,u,c;dd(e,{start(){o=t(e,n)},during(){u=t(e,r)},before:s,end(){o(),c=t(e,i)},after:a,cleanup(){u(),c()}})}function dd(e,t){let r,n,i,s=hn(()=>{Y(()=>{r=!0,n||t.before(),i||(t.end(),fn()),t.after(),e.isConnected&&t.cleanup(),delete e._x_transitioning})});e._x_transitioning={beforeCancels:[],beforeCancel(a){this.beforeCancels.push(a)},cancel:hn(function(){for(;this.beforeCancels.length;)this.beforeCancels.shift()();s()}),finish:s},Y(()=>{t.start(),t.during()}),id(),requestAnimationFrame(()=>{if(r)return;let a=Number(getComputedStyle(e).transitionDuration.replace(/,.*/,"").replace("s",""))*1e3,o=Number(getComputedStyle(e).transitionDelay.replace(/,.*/,"").replace("s",""))*1e3;a===0&&(a=Number(getComputedStyle(e).animationDuration.replace("s",""))*1e3),Y(()=>{t.before()}),n=!0,requestAnimationFrame(()=>{r||(Y(()=>{t.end()}),fn(),setTimeout(e._x_transitioning.finish,a+o),i=!0)})})}function gt(e,t,r){if(e.indexOf(t)===-1)return r;const n=e[e.indexOf(t)+1];if(!n||t==="scale"&&isNaN(n))return r;if(t==="duration"||t==="delay"){let i=n.match(/([0-9]+)ms/);if(i)return i[1]}return t==="origin"&&["top","right","left","center","bottom"].includes(e[e.indexOf(t)+2])?[n,e[e.indexOf(t)+2]].join(" "):n}var ke=!1;function De(e,t=()=>{}){return(...r)=>ke?t(...r):e(...r)}function fd(e){return(...t)=>ke&&e(...t)}var $a=[];function gr(e){$a.push(e)}function hd(e,t){$a.forEach(r=>r(e,t)),ke=!0,za(()=>{Te(t,(r,n)=>{n(r,()=>{})})}),ke=!1}var gn=!1;function vd(e,t){t._x_dataStack||(t._x_dataStack=e._x_dataStack),ke=!0,gn=!0,za(()=>{gd(t)}),ke=!1,gn=!1}function gd(e){let t=!1;Te(e,(n,i)=>{Xe(n,(s,a)=>{if(t&&ed(s))return a();t=!0,i(s,a)})})}function za(e){let t=Qe;Vi((r,n)=>{let i=t(r);return ut(i),()=>{}}),e(),Vi(t)}function ja(e,t,r,n=[]){switch(e._x_bindings||(e._x_bindings=ot({})),e._x_bindings[t]=r,t=n.includes("camel")?Ed(t):t,t){case"value":pd(e,r);break;case"style":yd(e,r);break;case"class":md(e,r);break;case"selected":case"checked":bd(e,t,r);break;default:Va(e,t,r);break}}function pd(e,t){if(Ka(e))e.attributes.value===void 0&&(e.value=t),window.fromModel&&(typeof t=="boolean"?e.checked=Wt(e.value)===t:e.checked=Ki(e.value,t));else if(ii(e))Number.isInteger(t)?e.value=t:!Array.isArray(t)&&typeof t!="boolean"&&![null,void 0].includes(t)?e.value=String(t):Array.isArray(t)?e.checked=t.some(r=>Ki(r,e.value)):e.checked=!!t;else if(e.tagName==="SELECT")wd(e,t);else{if(e.value===t)return;e.value=t===void 0?"":t}}function md(e,t){e._x_undoAddedClasses&&e._x_undoAddedClasses(),e._x_undoAddedClasses=ni(e,t)}function yd(e,t){e._x_undoAddedStyles&&e._x_undoAddedStyles(),e._x_undoAddedStyles=vr(e,t)}function bd(e,t,r){Va(e,t,r),_d(e,t,r)}function Va(e,t,r){[null,void 0,!1].includes(r)&&Cd(t)?e.removeAttribute(t):(Ha(t)&&(r=t),Sd(e,t,r))}function Sd(e,t,r){e.getAttribute(t)!=r&&e.setAttribute(t,r)}function _d(e,t,r){e[t]!==r&&(e[t]=r)}function wd(e,t){const r=[].concat(t).map(n=>n+"");Array.from(e.options).forEach(n=>{n.selected=r.includes(n.value)})}function Ed(e){return e.toLowerCase().replace(/-(\w)/g,(t,r)=>r.toUpperCase())}function Ki(e,t){return e==t}function Wt(e){return[1,"1","true","on","yes",!0].includes(e)?!0:[0,"0","false","off","no",!1].includes(e)?!1:e?!!e:null}var Id=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected","shadowrootclonable","shadowrootdelegatesfocus","shadowrootserializable"]);function Ha(e){return Id.has(e)}function Cd(e){return!["aria-pressed","aria-checked","aria-expanded","aria-selected"].includes(e)}function Td(e,t,r){return e._x_bindings&&e._x_bindings[t]!==void 0?e._x_bindings[t]:Wa(e,t,r)}function Pd(e,t,r,n=!0){if(e._x_bindings&&e._x_bindings[t]!==void 0)return e._x_bindings[t];if(e._x_inlineBindings&&e._x_inlineBindings[t]!==void 0){let i=e._x_inlineBindings[t];return i.extract=n,_a(()=>He(e,i.expression))}return Wa(e,t,r)}function Wa(e,t,r){let n=e.getAttribute(t);return n===null?typeof r=="function"?r():r:n===""?!0:Ha(t)?!![t,"true"].includes(n):n}function ii(e){return e.type==="checkbox"||e.localName==="ui-checkbox"||e.localName==="ui-switch"}function Ka(e){return e.type==="radio"||e.localName==="ui-radio"}function Ga(e,t){var r;return function(){var n=this,i=arguments,s=function(){r=null,e.apply(n,i)};clearTimeout(r),r=setTimeout(s,t)}}function Ya(e,t){let r;return function(){let n=this,i=arguments;r||(e.apply(n,i),r=!0,setTimeout(()=>r=!1,t))}}function Xa({get:e,set:t},{get:r,set:n}){let i=!0,s,a=Qe(()=>{let o=e(),u=r();if(i)n(Dr(o)),i=!1;else{let c=JSON.stringify(o),l=JSON.stringify(u);c!==s?n(Dr(o)):c!==l&&t(Dr(u))}s=JSON.stringify(e()),JSON.stringify(r())});return()=>{ut(a)}}function Dr(e){return typeof e=="object"?JSON.parse(JSON.stringify(e)):e}function xd(e){(Array.isArray(e)?e:[e]).forEach(r=>r(Pt))}var Ue={},Gi=!1;function Ad(e,t){if(Gi||(Ue=ot(Ue),Gi=!0),t===void 0)return Ue[e];Ue[e]=t,ya(Ue[e]),typeof t=="object"&&t!==null&&t.hasOwnProperty("init")&&typeof t.init=="function"&&Ue[e].init()}function Rd(){return Ue}var Qa={};function Md(e,t){let r=typeof t!="function"?()=>t:t;return e instanceof Element?Za(e,r()):(Qa[e]=r,()=>{})}
23function Od(e){return Object.entries(Qa).forEach(([t,r])=>{Object.defineProperty(e,t,{get(){return(...n)=>r(...n)}})}),e}function Za(e,t,r){let n=[];for(;n.length;)n.pop()();let i=Object.entries(t).map(([a,o])=>({name:a,value:o})),s=Ia(i);return i=i.map(a=>s.find(o=>o.name===a.name)?{name:`x-bind:${a.name}`,value:`"${a.value}"`}:a),Zn(e,i,r).map(a=>{n.push(a.runCleanups),a()}),()=>{for(;n.length;)n.pop()()}}var Ja={};function kd(e,t){Ja[e]=t}function Ld(e,t){return Object.entries(Ja).forEach(([r,n])=>{Object.defineProperty(e,r,{get(){return(...i)=>n.bind(t)(...i)},enumerable:!1})}),e}var Dd={get reactive(){return ot},get release(){return ut},get effect(){return Qe},get raw(){return ua},version:"3.14.9",flushAndStopDeferringMutations:Nl,dontAutoEvaluateFunctions:_a,disableEffectScheduling:Rl,startObservingMutations:Gn,stopObservingMutations:pa,setReactivityEngine:Ml,onAttributeRemoved:va,onAttributesAdded:ha,closestDataStack:nt,skipDuringClone:De,onlyDuringClone:fd,addRootSelector:Fa,addInitSelector:Na,interceptClone:gr,addScopeToNode:Ct,deferMutations:Fl,mapAttributes:Jn,evaluateLater:ce,interceptInit:td,setEvaluator:jl,mergeProxies:Tt,extractProp:Pd,findClosest:lt,onElRemoved:Hn,closestRoot:hr,destroyTree:dt,interceptor:ba,transition:vn,setStyles:vr,mutateDom:Y,directive:te,entangle:Xa,throttle:Ya,debounce:Ga,evaluate:He,initTree:Te,nextTick:ri,prefixed:ct,prefix:Kl,plugin:xd,magic:be,store:Ad,start:Jl,clone:vd,cloneNode:hd,bound:Td,$data:ma,watch:ca,walk:Xe,data:kd,bind:Md},Pt=Dd;function Fd(e,t){const r=Object.create(null),n=e.split(",");for(let i=0;i<n.length;i++)r[n[i]]=!0;return i=>!!r[i]}var Nd=Object.freeze({}),Bd=Object.prototype.hasOwnProperty,pr=(e,t)=>Bd.call(e,t),We=Array.isArray,_t=e=>eo(e)==="[object Map]",Ud=e=>typeof e=="string",si=e=>typeof e=="symbol",mr=e=>e!==null&&typeof e=="object",qd=Object.prototype.toString,eo=e=>qd.call(e),to=e=>eo(e).slice(8,-1),ai=e=>Ud(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,$d=e=>{const t=Object.create(null);return r=>t[r]||(t[r]=e(r))},zd=$d(e=>e.charAt(0).toUpperCase()+e.slice(1)),ro=(e,t)=>e!==t&&(e===e||t===t),pn=new WeakMap,pt=[],Se,Ke=Symbol("iterate"),mn=Symbol("Map key iterate");function jd(e){return e&&e._isEffect===!0}function Vd(e,t=Nd){jd(e)&&(e=e.raw);const r=Kd(e,t);return t.lazy||r(),r}function Hd(e){e.active&&(no(e),e.options.onStop&&e.options.onStop(),e.active=!1)}var Wd=0;function Kd(e,t){const r=function(){if(!r.active)return e();if(!pt.includes(r)){no(r);try{return Yd(),pt.push(r),Se=r,e()}finally{pt.pop(),io(),Se=pt[pt.length-1]}}};return r.id=Wd++,r.allowRecurse=!!t.allowRecurse,r._isEffect=!0,r.active=!0,r.raw=e,r.deps=[],r.options=t,r}function no(e){const{deps:t}=e;if(t.length){for(let r=0;r<t.length;r++)t[r].delete(e);t.length=0}}var it=!0,oi=[];function Gd(){oi.push(it),it=!1}function Yd(){oi.push(it),it=!0}function io(){const e=oi.pop();it=e===void 0?!0:e}function ye(e,t,r){if(!it||Se===void 0)return;let n=pn.get(e);n||pn.set(e,n=new Map);let i=n.get(r);i||n.set(r,i=new Set),i.has(Se)||(i.add(Se),Se.deps.push(i),Se.options.onTrack&&Se.options.onTrack({effect:Se,target:e,type:t,key:r}))}function Le(e,t,r,n,i,s){const a=pn.get(e);if(!a)return;const o=new Set,u=l=>{l&&l.forEach(f=>{(f!==Se||f.allowRecurse)&&o.add(f)})};
23if(t==="clear")a.forEach(u);else if(r==="length"&&We(e))a.forEach((l,f)=>{(f==="length"||f>=n)&&u(l)});else switch(r!==void 0&&u(a.get(r)),t){case"add":We(e)?ai(r)&&u(a.get("length")):(u(a.get(Ke)),_t(e)&&u(a.get(mn)));break;case"delete":We(e)||(u(a.get(Ke)),_t(e)&&u(a.get(mn)));break;case"set":_t(e)&&u(a.get(Ke));break}const c=l=>{l.options.onTrigger&&l.options.onTrigger({effect:l,target:e,key:r,type:t,newValue:n,oldValue:i,oldTarget:s}),l.options.scheduler?l.options.scheduler(l):l()};o.forEach(c)}var Xd=Fd("__proto__,__v_isRef,__isVue"),so=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(si)),Qd=ao(),Zd=ao(!0),Yi=Jd();function Jd(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...r){const n=H(this);for(let s=0,a=this.length;s<a;s++)ye(n,"get",s+"");const i=n[t](...r);return i===-1||i===!1?n[t](...r.map(H)):i}}),["push","pop","shift","unshift","splice"].forEach(t=>{e[t]=function(...r){Gd();const n=H(this)[t].apply(this,r);return io(),n}}),e}function ao(e=!1,t=!1){return function(n,i,s){if(i==="__v_isReactive")return!e;if(i==="__v_isReadonly")return e;if(i==="__v_raw"&&s===(e?t?vf:lo:t?hf:co).get(n))return n;const a=We(n);if(!e&&a&&pr(Yi,i))return Reflect.get(Yi,i,s);const o=Reflect.get(n,i,s);return(si(i)?so.has(i):Xd(i))||(e||ye(n,"get",i),t)?o:yn(o)?!a||!ai(i)?o.value:o:mr(o)?e?fo(o):di(o):o}}var ef=tf();function tf(e=!1){return function(r,n,i,s){let a=r[n];if(!e&&(i=H(i),a=H(a),!We(r)&&yn(a)&&!yn(i)))return a.value=i,!0;const o=We(r)&&ai(n)?Number(n)<r.length:pr(r,n),u=Reflect.set(r,n,i,s);return r===H(s)&&(o?ro(i,a)&&Le(r,"set",n,i,a):Le(r,"add",n,i)),u}}function rf(e,t){const r=pr(e,t),n=e[t],i=Reflect.deleteProperty(e,t);return i&&r&&Le(e,"delete",t,void 0,n),i}function nf(e,t){const r=Reflect.has(e,t);return(!si(t)||!so.has(t))&&ye(e,"has",t),r}function sf(e){return ye(e,"iterate",We(e)?"length":Ke),Reflect.ownKeys(e)}var af={get:Qd,set:ef,deleteProperty:rf,has:nf,ownKeys:sf},of={get:Zd,set(e,t){return console.warn(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0},deleteProperty(e,t){return console.warn(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}},ui=e=>mr(e)?di(e):e,ci=e=>mr(e)?fo(e):e,li=e=>e,yr=e=>Reflect.getPrototypeOf(e);function Mt(e,t,r=!1,n=!1){e=e.__v_raw;const i=H(e),s=H(t);t!==s&&!r&&ye(i,"get",t),!r&&ye(i,"get",s);const{has:a}=yr(i),o=n?li:r?ci:ui;if(a.call(i,t))return o(e.get(t));if(a.call(i,s))return o(e.get(s));e!==i&&e.get(t)}function Ot(e,t=!1){const r=this.__v_raw,n=H(r),i=H(e);return e!==i&&!t&&ye(n,"has",e),!t&&ye(n,"has",i),e===i?r.has(e):r.has(e)||r.has(i)}function kt(e,t=!1){return e=e.__v_raw,!t&&ye(H(e),"iterate",Ke),Reflect.get(e,"size",e)}function Xi(e){e=H(e);const t=H(this);return yr(t).has.call(t,e)||(t.add(e),Le(t,"add",e,e)),this}function Qi(e,t){t=H(t);const r=H(this),{has:n,get:i}=yr(r);let s=n.call(r,e);s?uo(r,n,e):(e=H(e),s=n.call(r,e));const a=i.call(r,e);return r.set(e,t),s?ro(t,a)&&Le(r,"set",e,t,a):Le(r,"add",e,t),this}function Zi(e){const t=H(this),{has:r,get:n}=yr(t);let i=r.call(t,e);i?uo(t,r,e):(e=H(e),i=r.call(t,e));const s=n?n.call(t,e):void 0,a=t.delete(e);return i&&Le(t,"delete",e,void 0,s),a}function Ji(){const e=H(this),t=e.size!==0,r=_t(e)?new Map(e):new Set(e),n=e.clear();return t&&Le(e,"clear",void 0,void 0,r),n}function Lt(e,t){return function(n,i){const s=this,a=s.__v_raw,o=H(a),u=t?li:e?ci:ui;return!e&&ye(o,"iterate",Ke),a.forEach((c,l)=>n.call(i,u(c),u(l),s))}}function Dt(e,t,r){return function(...n){const i=this.__v_raw,s=H(i),a=_t(s),o=e==="entries"||e===Symbol.iterator&&a,u=e==="keys"&&a,c=i[e](...n),l=r?li:t?ci:ui;return!t&&ye(s,"iterate",u?mn:Ke),{next(){const{value:f,done:d}=c.next();return d?{value:f,done:d}:{value:o?[l(f[0]),l(f[1])]:l(f),done:d}},[Symbol.iterator](){return this}}}}function Re(e){return function(...t){{const r=t[0]?`on key "${t[0]}" `:"";console.warn(`${zd(e)} operation ${r}failed: target is readonly.`,H(this))}return e==="delete"?!1:this}}function uf(){const e={get(s){return Mt(this,s)},get size(){return kt(this)}
23,has:Ot,add:Xi,set:Qi,delete:Zi,clear:Ji,forEach:Lt(!1,!1)},t={get(s){return Mt(this,s,!1,!0)},get size(){return kt(this)},has:Ot,add:Xi,set:Qi,delete:Zi,clear:Ji,forEach:Lt(!1,!0)},r={get(s){return Mt(this,s,!0)},get size(){return kt(this,!0)},has(s){return Ot.call(this,s,!0)},add:Re("add"),set:Re("set"),delete:Re("delete"),clear:Re("clear"),forEach:Lt(!0,!1)},n={get(s){return Mt(this,s,!0,!0)},get size(){return kt(this,!0)},has(s){return Ot.call(this,s,!0)},add:Re("add"),set:Re("set"),delete:Re("delete"),clear:Re("clear"),forEach:Lt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(s=>{e[s]=Dt(s,!1,!1),r[s]=Dt(s,!0,!1),t[s]=Dt(s,!1,!0),n[s]=Dt(s,!0,!0)}),[e,r,t,n]}var[cf,lf,lm,dm]=uf();function oo(e,t){const r=e?lf:cf;return(n,i,s)=>i==="__v_isReactive"?!e:i==="__v_isReadonly"?e:i==="__v_raw"?n:Reflect.get(pr(r,i)&&i in n?r:n,i,s)}var df={get:oo(!1)},ff={get:oo(!0)};function uo(e,t,r){const n=H(r);if(n!==r&&t.call(e,n)){const i=to(e);console.warn(`Reactive ${i} contains both the raw and reactive versions of the same object${i==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}var co=new WeakMap,hf=new WeakMap,lo=new WeakMap,vf=new WeakMap;function gf(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function pf(e){return e.__v_skip||!Object.isExtensible(e)?0:gf(to(e))}function di(e){return e&&e.__v_isReadonly?e:ho(e,!1,af,df,co)}function fo(e){return ho(e,!0,of,ff,lo)}function ho(e,t,r,n,i){if(!mr(e))return console.warn(`value cannot be made reactive: ${String(e)}`),e;if(e.__v_raw&&!(t&&e.__v_isReactive))return e;const s=i.get(e);if(s)return s;const a=pf(e);if(a===0)return e;const o=new Proxy(e,a===2?n:r);return i.set(e,o),o}function H(e){return e&&H(e.__v_raw)||e}function yn(e){return!!(e&&e.__v_isRef===!0)}be("nextTick",()=>ri);be("dispatch",e=>St.bind(St,e));be("watch",(e,{evaluateLater:t,cleanup:r})=>(n,i)=>{let s=t(n),o=ca(()=>{let u;return s(c=>u=c),u},i);r(o)});be("store",Rd);be("data",e=>ma(e));be("root",e=>hr(e));be("refs",e=>(e._x_refs_proxy||(e._x_refs_proxy=Tt(mf(e))),e._x_refs_proxy));function mf(e){let t=[];return lt(e,r=>{r._x_refs&&t.push(r._x_refs)}),t}var Fr={};function vo(e){return Fr[e]||(Fr[e]=0),++Fr[e]}function yf(e,t){return lt(e,r=>{if(r._x_ids&&r._x_ids[t])return!0})}function bf(e,t){e._x_ids||(e._x_ids={}),e._x_ids[t]||(e._x_ids[t]=vo(t))}be("id",(e,{cleanup:t})=>(r,n=null)=>{let i=`${r}${n?`-${n}`:""}`;return Sf(e,i,t,()=>{let s=yf(e,r),a=s?s._x_ids[r]:vo(r);return n?`${r}-${a}-${n}`:`${r}-${a}`})});gr((e,t)=>{e._x_id&&(t._x_id=e._x_id)});function Sf(e,t,r,n){if(e._x_id||(e._x_id={}),e._x_id[t])return e._x_id[t];let i=n();return e._x_id[t]=i,r(()=>{delete e._x_id[t]}),i}be("el",e=>e);go("Focus","focus","focus");go("Persist","persist","persist");function go(e,t,r){be(t,n=>ge(`You can't use [$${t}] without first installing the "${e}" plugin here: https://alpinejs.dev/plugins/${r}`,n))}te("modelable",(e,{expression:t},{effect:r,evaluateLater:n,cleanup:i})=>{let s=n(t),a=()=>{let l;return s(f=>l=f),l},o=n(`${t} = __placeholder`),u=l=>o(()=>{},{scope:{__placeholder:l}}),c=a();u(c),queueMicrotask(()=>{if(!e._x_model)return;e._x_removeModelListeners.default();let l=e._x_model.get,f=e._x_model.set,d=Xa({get(){return l()},set(h){f(h)}},{get(){return a()},set(h){u(h)}});i(d)})});te("teleport",(e,{modifiers:t,expression:r},{cleanup:n})=>{e.tagName.toLowerCase()!=="template"&&ge("x-teleport can only be used on a <template> tag",e);let i=es(r),s=e.content.cloneNode(!0).firstElementChild;e._x_teleport=s,s._x_teleportBack=e,e.setAttribute("data-teleport-template",!0),s.setAttribute("data-teleport-target",!0),e._x_forwardEvents&&e._x_forwardEvents.forEach(o=>{s.addEventListener(o,u=>{u.stopPropagation(),e.dispatchEvent(new u.constructor(u.type,u))})}),Ct(s,{},e);let a=(o,u,c)=>{c.includes("prepend")?u.parentNode.insertBefore(o,u):c.includes("append")?u.parentNode.insertBefore(o,u.nextSibling):u.appendChild(o)};Y(()=>{a(s,i,t),De(()=>{Te(s)})()}),e._x_teleportPutBack=()=>{let o=es(r);Y(()=>{a(e._x_teleport,o,t)})},n(()=>Y(()=>{s.remove(),dt(s)}))});var _f=document.createElement("div");function es(e){let t=De(()=>document.querySelector(e),()=>_f)();return t||ge(`Cannot find x-teleport element for selector: "${e}"`),t}var po=()=>{};po.inline=(e,{modifiers:t},{cleanup:r})=>
vendor: 6,078 bytes, line 23
23{t.includes("self")?e._x_ignoreSelf=!0:e._x_ignore=!0,r(()=>{t.includes("self")?delete e._x_ignoreSelf:delete e._x_ignore})};te("ignore",po);te("effect",De((e,{expression:t},{effect:r})=>{r(ce(e,t))}));function bn(e,t,r,n){let i=e,s=u=>n(u),a={},o=(u,c)=>l=>c(u,l);if(r.includes("dot")&&(t=wf(t)),r.includes("camel")&&(t=Ef(t)),r.includes("passive")&&(a.passive=!0),r.includes("capture")&&(a.capture=!0),r.includes("window")&&(i=window),r.includes("document")&&(i=document),r.includes("debounce")){let u=r[r.indexOf("debounce")+1]||"invalid-wait",c=ar(u.split("ms")[0])?Number(u.split("ms")[0]):250;s=Ga(s,c)}if(r.includes("throttle")){let u=r[r.indexOf("throttle")+1]||"invalid-wait",c=ar(u.split("ms")[0])?Number(u.split("ms")[0]):250;s=Ya(s,c)}return r.includes("prevent")&&(s=o(s,(u,c)=>{c.preventDefault(),u(c)})),r.includes("stop")&&(s=o(s,(u,c)=>{c.stopPropagation(),u(c)})),r.includes("once")&&(s=o(s,(u,c)=>{u(c),i.removeEventListener(t,s,a)})),(r.includes("away")||r.includes("outside"))&&(i=document,s=o(s,(u,c)=>{e.contains(c.target)||c.target.isConnected!==!1&&(e.offsetWidth<1&&e.offsetHeight<1||e._x_isShown!==!1&&u(c))})),r.includes("self")&&(s=o(s,(u,c)=>{c.target===e&&u(c)})),(Cf(t)||mo(t))&&(s=o(s,(u,c)=>{Tf(c,r)||u(c)})),i.addEventListener(t,s,a),()=>{i.removeEventListener(t,s,a)}}function wf(e){return e.replace(/-/g,".")}function Ef(e){return e.toLowerCase().replace(/-(\w)/g,(t,r)=>r.toUpperCase())}function ar(e){return!Array.isArray(e)&&!isNaN(e)}function If(e){return[" ","_"].includes(e)?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]/,"-").toLowerCase()}function Cf(e){return["keydown","keyup"].includes(e)}function mo(e){return["contextmenu","click","mouse"].some(t=>e.includes(t))}function Tf(e,t){let r=t.filter(s=>!["window","document","prevent","stop","once","capture","self","away","outside","passive"].includes(s));if(r.includes("debounce")){let s=r.indexOf("debounce");r.splice(s,ar((r[s+1]||"invalid-wait").split("ms")[0])?2:1)}if(r.includes("throttle")){let s=r.indexOf("throttle");r.splice(s,ar((r[s+1]||"invalid-wait").split("ms")[0])?2:1)}if(r.length===0||r.length===1&&ts(e.key).includes(r[0]))return!1;const i=["ctrl","shift","alt","meta","cmd","super"].filter(s=>r.includes(s));return r=r.filter(s=>!i.includes(s)),!(i.length>0&&i.filter(a=>((a==="cmd"||a==="super")&&(a="meta"),e[`${a}Key`])).length===i.length&&(mo(e.type)||ts(e.key).includes(r[0])))}function ts(e){if(!e)return[];e=If(e);let t={ctrl:"control",slash:"/",space:" ",spacebar:" ",cmd:"meta",esc:"escape",up:"arrow-up",down:"arrow-down",left:"arrow-left",right:"arrow-right",period:".",comma:",",equal:"=",minus:"-",underscore:"_"};return t[e]=e,Object.keys(t).map(r=>{if(t[r]===e)return r}).filter(r=>r)}te("model",(e,{modifiers:t,expression:r},{effect:n,cleanup:i})=>{let s=e;t.includes("parent")&&(s=e.parentNode);let a=ce(s,r),o;typeof r=="string"?o=ce(s,`${r} = __placeholder`):typeof r=="function"&&typeof r()=="string"?o=ce(s,`${r()} = __placeholder`):o=()=>{};let u=()=>{let d;return a(h=>d=h),rs(d)?d.get():d},c=d=>{let h;a(v=>h=v),rs(h)?h.set(d):o(()=>{},{scope:{__placeholder:d}})};typeof r=="string"&&e.type==="radio"&&Y(()=>{e.hasAttribute("name")||e.setAttribute("name",r)});var l=e.tagName.toLowerCase()==="select"||["checkbox","radio"].includes(e.type)||t.includes("lazy")?"change":"input";let f=ke?()=>{}:bn(e,l,t,d=>{c(Nr(e,t,d,u()))});if(t.includes("fill")&&([void 0,null,""].includes(u())||ii(e)&&Array.isArray(u())||e.tagName.toLowerCase()==="select"&&e.multiple)&&c(Nr(e,t,{target:e},u())),e._x_removeModelListeners||(e._x_removeModelListeners={}),e._x_removeModelListeners.default=f,i(()=>e._x_removeModelListeners.default()),e.form){let d=bn(e.form,"reset",[],h=>{ri(()=>e._x_model&&e._x_model.set(Nr(e,t,{target:e},u())))});i(()=>d())}e._x_model={get(){return u()},set(d){c(d)}},e._x_forceModelUpdate=d=>{d===void 0&&typeof r=="string"&&r.match(/\./)&&(d=""),window.fromModel=!0,Y(()=>ja(e,"value",d)),delete window.fromModel},n(()=>{let d=u();t.includes("unintrusive")&&document.activeElement.isSameNode(e)||e._x_forceModelUpdate(d)})});function Nr(e,t,r,n){return Y(()=>{if(r instanceof CustomEvent&&r.detail!==void 0)return r.detail!==null&&r.detail!==void 0?r.detail:r.target.value;if(ii(e))if(Array.isArray(n)){let i=null;return t.includes("number")?i=Br(r.target.value):t.includes("boolean")?i=Wt(r.target.value):i=r.target.value,r.target.checked?n.includes(i)?n:n.concat([i]):n.filter(s=>!Pf(s,i))}else return r.target.checked;else{if(e.tagName.toLowerCase()==="select"&&e.multiple)return t.includes("number")?Array.from(r.target.selectedOptions).map(i=>{let s=i.value||i.text;return Br(s)}):t.includes("boolean")?Array.from(r.target.selectedOptions).map(i=>{let s=i.value||i.text;return Wt(s)}):Array.from(r.target.selectedOptions).map(i=>i.value||i.text);{let i;return Ka(e)?r.target.checked?i=r.target.value:i=n:i=r.target.value,t.includes("number")?Br(i):t.includes("boolean")?Wt(i):t.includes("trim")?i.trim():i}}})}function Br(e){let t=e?parseFloat(e):null;return xf(t)?t:e}function Pf(e,t){return e==t}function xf(e){return!Array.isArray(e)&&!isNaN(e)}function rs(e){return e!==null&&typeof e=="object"&&typeof e.get=="function"&&typeof e.set=="function"}te("cloak",e=>queueMicrotask(()=>Y(()=>e.removeAttribute(ct("cloak")))));Na(()=>`[${ct("init")}]`);te("init",De((e,{expression:t},{evaluate:r})=>typeof t=="string"?!!t.trim()&&r(t,{},!1):r(t,{},!1)));te("text",(e,{expression:t},{effect:r,evaluateLater:n})=>{let i=n(t);r(()=>{i(s=>{Y(()=>{e.textContent=s})})})});te("html",(e,{expression:t},{effect:r,evaluateLater:n})=>{let i=n(t);r(()=>{i(s=>{Y(()=>{e.innerHTML=s,e._x_ignoreSelf=!0,Te(e),delete e._x_ignoreSelf})})})});Jn(Pa(":",xa(ct("bind:"))));var yo=(e,{value:t,modifiers:r,expression:n,original:i},{effect:s,cleanup:a})=>{if(!t){let u={};Od(u),ce(e,n)(l=>{Za(e,l,i)},{scope:u});return}if(t==="key")return Af(e,n);if(e._x_inlineBindings&&e._x_inlineBindings[t]&&e._x_inlineBindings[t].extract)return;let o=ce(e,n);s(()=>o(u=>{u===void 0&&typeof n=="string"&&n.match(/\./)&&(u=""),Y(()=>ja(e,t,u,r))})),a(()=>
23{e._x_undoAddedClasses&&e._x_undoAddedClasses(),e._x_undoAddedStyles&&e._x_undoAddedStyles()})};yo.inline=(e,{value:t,modifiers:r,expression:n})=>{t&&(e._x_inlineBindings||(e._x_inlineBindings={}),e._x_inlineBindings[t]={expression:n,extract:!1})};te("bind",yo);function Af(e,t){e._x_keyExpression=t}Fa(()=>`[${ct("data")}]`);te("data",(e,{expression:t},{cleanup:r})=>{if(Rf(e))return;t=t===""?"{}":t;let n={};un(n,e);let i={};Ld(i,n);let s=He(e,t,{scope:i});(s===void 0||s===!0)&&(s={}),un(s,e);let a=ot(s);ya(a);let o=Ct(e,a);a.init&&He(e,a.init),r(()=>{a.destroy&&He(e,a.destroy),o()})});gr((e,t)=>{e._x_dataStack&&(t._x_dataStack=e._x_dataStack,t.setAttribute("data-has-alpine-state",!0))});function Rf(e){return ke?gn?!0:e.hasAttribute("data-has-alpine-state"):!1}te("show",(e,{modifiers:t,expression:r},{effect:n})=>{let i=ce(e,r);e._x_doHide||(e._x_doHide=()=>{Y(()=>{e.style.setProperty("display","none",t.includes("important")?"important":void 0)})}),e._x_doShow||(e._x_doShow=()=>{Y(()=>{e.style.length===1&&e.style.display==="none"?e.removeAttribute("style"):e.style.removeProperty("display")})});let s=()=>{e._x_doHide(),e._x_isShown=!1},a=()=>{e._x_doShow(),e._x_isShown=!0},o=()=>setTimeout(a),u=hn(f=>f?a():s(),f=>{typeof e._x_toggleAndCascadeWithTransitions=="function"?e._x_toggleAndCascadeWithTransitions(e,f,a,s):f?o():s()}),c,l=!0;n(()=>i(f=>{!l&&f===c||(t.includes("immediate")&&(f?o():s()),u(f),c=f,l=!1)}))});te("for",(e,{expression:t},{effect:r,cleanup:n})=>{let i=Of(t),s=ce(e,i.items),a=ce(e,e._x_keyExpression||"index");e._x_prevKeys=[],e._x_lookup={},r(()=>Mf(e,i,s,a)),n(()=>{Object.values(e._x_lookup).forEach(o=>Y(()=>{dt(o),o.remove()})),delete e._x_prevKeys,delete e._x_lookup})});function Mf(e,t,r,n){let i=a=>typeof a=="object"&&!Array.isArray(a),s=e;r(a=>{kf(a)&&a>=0&&(a=Array.from(Array(a).keys(),g=>g+1)),a===void 0&&(a=[]);let o=e._x_lookup,u=e._x_prevKeys,c=[],l=[];if(i(a))a=Object.entries(a).map(([g,p])=>{let S=ns(t,p,g,a);n(_=>{l.includes(_)&&ge("Duplicate key on x-for",e),l.push(_)},{scope:{index:g,...S}}),c.push(S)});else for(let g=0;g<a.length;g++){let p=ns(t,a[g],g,a);n(S=>{l.includes(S)&&ge("Duplicate key on x-for",e),l.push(S)},{scope:{index:g,...p}}),c.push(p)}let f=[],d=[],h=[],v=[];for(let g=0;g<u.length;g++){let p=u[g];l.indexOf(p)===-1&&h.push(p)}u=u.filter(g=>!h.includes(g));let m="template";for(let g=0;g<l.length;g++){let p=l[g],S=u.indexOf(p);if(S===-1)u.splice(g,0,p),f.push([m,g]);else if(S!==g){let _=u.splice(g,1)[0],w=u.splice(S-1,1)[0];u.splice(g,0,w),u.splice(S,0,_),d.push([_,w])}else v.push(p);m=p}for(let g=0;g<h.length;g++){let p=h[g];p in o&&(Y(()=>{dt(o[p]),o[p].remove()}),delete o[p])}for(let g=0;g<d.length;g++){let[p,S]=d[g],_=o[p],w=o[S],E=document.createElement("div");Y(()=>{w||ge('x-for ":key" is undefined or invalid',s,S,o),w.after(E),_.after(w),w._x_currentIfEl&&w.after(w._x_currentIfEl),E.before(_),_._x_currentIfEl&&_.after(_._x_currentIfEl),E.remove()}),w._x_refreshXForScope(c[l.indexOf(S)])}for(let g=0;g<f.length;g++){let[p,S]=f[g],_=p==="template"?s:o[p];_._x_currentIfEl&&(_=_._x_currentIfEl);let w=c[S],E=l[S],b=document.importNode(s.content,!0).firstElementChild,y=ot(w);Ct(b,y,s),b._x_refreshXForScope=I=>{Object.entries(I).forEach(([C,A])=>{y[C]=A})},Y(()=>{_.after(b),De(()=>Te(b))()}),typeof E=="object"&&ge("x-for key cannot be an object, it must be a string or an integer",s),o[E]=b}for(let g=0;g<v.length;g++)o[v[g]]._x_refreshXForScope(c[l.indexOf(v[g])]);s._x_prevKeys=l})}function Of(e){let t=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,r=/^\s*\(|\)\s*$/g,n=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,i=e.match(n);if(!i)return;let s={};s.items=i[2].trim();let a=i[1].replace(r,"").trim(),o=a.match(t);return o?(s.item=a.replace(t,"").trim(),s.index=o[1].trim(),o[2]&&(s.collection=o[2].trim())):s.item=a,s}function ns(e,t,r,n){let i={};return/^\[.*\]$/.test(e.item)&&Array.isArray(t)?e.item.replace("[","").replace("]","").split(",").map(a=>a.trim()).forEach((a,o)=>{i[a]=t[o]}):/^\{.*\}$/.test(e.item)&&!Array.isArray(t)&&typeof t=="object"?e.item.replace("{","").replace("}","").split(",").map(a=>
23a.trim()).forEach(a=>{i[a]=t[a]}):i[e.item]=t,e.index&&(i[e.index]=r),e.collection&&(i[e.collection]=n),i}function kf(e){return!Array.isArray(e)&&!isNaN(e)}function bo(){}bo.inline=(e,{expression:t},{cleanup:r})=>{let n=hr(e);n._x_refs||(n._x_refs={}),n._x_refs[t]=e,r(()=>delete n._x_refs[t])};te("ref",bo);te("if",(e,{expression:t},{effect:r,cleanup:n})=>{e.tagName.toLowerCase()!=="template"&&ge("x-if can only be used on a <template> tag",e);let i=ce(e,t),s=()=>{if(e._x_currentIfEl)return e._x_currentIfEl;let o=e.content.cloneNode(!0).firstElementChild;return Ct(o,{},e),Y(()=>{e.after(o),De(()=>Te(o))()}),e._x_currentIfEl=o,e._x_undoIf=()=>{Y(()=>{dt(o),o.remove()}),delete e._x_currentIfEl},o},a=()=>{e._x_undoIf&&(e._x_undoIf(),delete e._x_undoIf)};r(()=>i(o=>{o?s():a()})),n(()=>e._x_undoIf&&e._x_undoIf())});te("id",(e,{expression:t},{evaluate:r})=>{r(t).forEach(i=>bf(e,i))});gr((e,t)=>{e._x_ids&&(t._x_ids=e._x_ids)});Jn(Pa("@",xa(ct("on:"))));te("on",De((e,{value:t,modifiers:r,expression:n},{cleanup:i})=>{let s=n?ce(e,n):()=>{};e.tagName.toLowerCase()==="template"&&(e._x_forwardEvents||(e._x_forwardEvents=[]),e._x_forwardEvents.includes(t)||e._x_forwardEvents.push(t));let a=bn(e,t,r,o=>{s(()=>{},{scope:{$event:o},params:[o]})});i(()=>a())}));br("Collapse","collapse","collapse");br("Intersect","intersect","intersect");br("Focus","trap","focus");br("Mask","mask","mask");function br(e,t,r){te(t,n=>ge(`You can't use [x-${t}] without first installing the "${e}" plugin here: https://alpinejs.dev/plugins/${r}`,n))}Pt.setEvaluator(Ea);Pt.setReactivityEngine({reactive:di,effect:Vd,release:Hd,raw:H});var Lf=Pt,V=Lf;V.store("ui",Js);V.store("cart",Fc);V.store("subscription",Nc);V.store("restrictedOneTimePlans",Ou);V.plugin(_l);V.plugin(hl);V.plugin(wl);V.plugin(Sl);V.plugin(yl);V.plugin(Wc);V.plugin(El);V.plugin(Il);V.data("collections",nc);V.data("membership",fc);V.data("search",Ic);V.data("bundleCart",ec);V.data("quizRecommendProduct",wc);V.data("annualRenewal",Xu);V.data("annualGift",Yu);V.data("emailSubscription",oc);V.data("newsletterSubscription",bc);V.data("collectionFiltering",rc);V.data("header",uc);V.data("insuranceHandler",lc);V.data("login",dc);V.data("thankYou",Oc);var is=function(e){if(typeof(t=e)!="object"||Array.isArray(t))throw"state should be an object";var t},ss=function(e,t,r,n){return(i=e,i.reduce(function(s,a,o){return s.indexOf(a)>-1?s:s.concat(a)},[])).reduce(function(s,a){return s.concat(t[a]||[])},[]).map(function(s){return s(r,n)});var i};function So(e){e===void 0&&(e={});var t={};return{getState:function(){return Object.assign({},e)},hydrate:function(r){return is(r),Object.assign(e,r),function(){var n=["*"].concat(Object.keys(r));ss(n,t,e)}},on:function(r,n){return(r=[].concat(r)).map(function(i){return t[i]=(t[i]||[]).concat(n)}),function(){return r.map(function(i){return t[i].splice(t[i].indexOf(n),1)})}},emit:function(r,n,i){var s=(r==="*"?[]:["*"]).concat(r);(n=typeof n=="function"?n(e):n)&&(is(n),Object.assign(e,n),s=s.concat(Object.keys(n))),ss(s,t,e,i)}}}So();var as=function(e){return typeof e=="object"&&!Array.isArray(e)},os=function(e){return typeof e=="function"};function Sr(e){return function(t,r){var n=[];return{subs:n,unmount:e(t,Object.assign({},r,{on:function(i,s){var a=r.on(i,s);return n.push(a),a}})),node:t}}}function Df(e,t,r){e===void 0&&(e={}),t===void 0&&(t={}),r===void 0&&(r=[]);var n=So(t),i=[];return{on:n.on,emit:n.emit,getState:function(){return n.getState()},add:function(s){if(!as(s))throw"components should be an object";Object.assign(e,s)},use:function(s){if(!os(s))throw"plugins should be a function";r.push(s)},hydrate:function(s){return n.hydrate(s)},mount:function(s){s===void 0&&(s="data-component"),s=[].concat(s);for(var a=0;a<s.length;a++){for(var o=s[a],u=[].slice.call(document.querySelectorAll("["+o+"]")),c=function(){for(var l=u.pop(),f=l.getAttribute(o).split(/\s/),d=0;d<f.length;d++){var h=e[f[d]];if(h){l.removeAttribute(o);try{var v=r.reduce(function(g,p){var S=p(l,n);return as(S)?Object.assign(g,S):g},{}),m=h(l,Object.assign({},v,n));os(m.unmount)&&i.push(m)}catch(g){console.error(g),n.emit("error",{error:g}),n.hydrate({error:void 0})}}}};u.length;)c();n.emit("mount")}},unmount:function(){for(var s=i.length-1;s>-1;s--){var a=i[s],o=a.subs;(0,a.unmount)(a.node),o.map(function(u){return u()}),i.splice(s,1)}n.emit("unmount")}}}const Ff=Sr(()=>{const e=document.querySelectorAll("details");e.forEach(r=>{r.addEventListener("toggle",t)});function t(){this.open&&e.forEach(r=>{r!=this&&r.open&&(r.open=!1)})}});function us(e,t){t.querySelectorAll("[data-range-slider]").forEach(r=>{e.cfForm.setFieldValue(r.getAttribute("data-range-slider"),r.value),r.addEventListener("change",n=>{e.cfForm.setFieldValue(n.target.getAttribute("data-range-slider"),n.target.value)})})}function Nf(e){const{segmentTrack:t}=we(),r=e.getAttribute("data-quiz-title"),n=e.getAttribute("data-prev-step-title"),i=document.querySelector(".cf-step-counter");let s=0;if(i){const o=i.innerText.match(/Step (\d+)/);o&&(s=parseInt(o[1],10))}t("Assessment Step Completed",{assessment_name:r,step_name:n,step_number:s-1}),typeof dataLayer<"u"&&CF.customer.get("quiz_type")&&dataLayer.push({quizCategory:`Quiz ${r}`,quizAction:"Step changed",quizStep:n,event:"trackCompletedStep"})}const fi=window.location.pathname.includes("-diagnosis"),hi=window.location.pathname.includes("-medical-history"),Bf=fi||hi;function cs(){const e=document.querySelector("[data-quiz-progress-bar]"),t=document.querySelector(".cf-step-counter"),r=t?Number(t.innerText.split(" ")[1]):1,n=t?Number(t.innerText.split(" ")[3])+1:1;let i=0;fi&&!location.pathname.includes("-flea-and-tick")?i=r/n*50:hi&&!location.pathname.includes("-flea-and-tick")?i=r/n*50+50:i=r/n*100,e&&(e.style.width=`${i}%`)}const Uf=Sr(e=>{const t=e.querySelector("[data-cf-form]");
23CF.ready(async function(){if(us(t,e),cs(),fi){const r=new URLSearchParams(location.search);r.get("pet"),r.get("petId"),r.get("issue"),r.get("type"),r.get("age");const n={id:t.getAttribute("data-cf-form"),name:window.location.pathname.split("/pages/")[1].replaceAll("-"," ").replace(/./,i=>i.toUpperCase())};localStorage.setItem("dp:rx-quiz-info",JSON.stringify(n)),e.classList.remove("hidden")}else hi&&console.log(document.referrer),e.classList.remove("hidden");window.onbeforeunload=function(){if(!t.classList.contains("no-alert")&&!t.classList.contains("submitting"))return CF.customer.isLoggedIn&&CF.customer.save(),"This page is asking you to confirm that you want to leave — information you’ve entered may not be saved."},document.addEventListener("cf:field_changed",function(){us(t,e)}),document.addEventListener("cf:step_changed",function(r){const n=r.detail.fromIndex,i=r.detail.toIndex;window.scrollTo(0,0),setTimeout(function(){cs()},50),i>n&&Bf&&Nf(e),e.querySelector(".cf-step-title")&&e.setAttribute("data-prev-step-title",document.querySelector(".cf-step-title").innerText)}),t.cfForm.beforeSave(function(){const r=new Date;CF.customer.emit("changes_saved",CF.customer.unsavedChanges,r).then(function(){}).catch(function(n){console.error("Could not emit event",n)}),t.classList.add("submitting")}),document.addEventListener("cf:form_submission_failed",function(){t.classList.remove("submitting")}),document.addEventListener("cf:customer_save_failed",function(r){const n=r.detail.errors,i="CF form save failed - duplicate addresses?",s=CF.customer.data.email?CF.customer.data.email:"Anonymous (non logged-in user)";CF.customer.data&&JSON.stringify(CF.customer.data);const a=`URL: ${location.href}
24 Referrer: ${document.referrer}
25 UserAgent: ${navigator.userAgent}
26 Customer Email: ${s}
27Errors: ${JSON.stringify(n)}`;console.error(n),JSON.stringify(n).includes("Could not save form, please try again later")&&Fu(i,a)}),document.querySelector(".cf-step-title")&&e.setAttribute("data-prev-step-title",document.querySelector(".cf-step-title").innerText)})});/*!
28 * Glide.js v3.7.1
29 * (c) 2013-2024 Jędrzej Chałubek (https://github.com/jedrzejchalubek/)
30 * Released under the MIT License.
31 */function ls(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ds(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ls(Object(r),!0).forEach(function(n){$f(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ls(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Kt(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Kt=function(t){return typeof t}:Kt=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kt(e)}function _r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qf(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function wr(e,t,r){return t&&qf(e.prototype,t),e}function $f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zf(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Sn(e,t)}function st(e){return st=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},st(e)}function Sn(e,t){return Sn=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Sn(e,t)}function jf(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Vf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Hf(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Vf(e)}function Wf(e){var t=jf();return function(){var n=st(e),i;if(t){var s=st(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return Hf(this,i)}}function Kf(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=st(e),e!==null););return e}function Gt(){return typeof Reflect<"u"&&Reflect.get?Gt=Reflect.get:Gt=function(t,r,n){var i=Kf(t,r);
31if(i){var s=Object.getOwnPropertyDescriptor(i,r);return s.get?s.get.call(arguments.length<3?t:n):s.value}},Gt.apply(this,arguments)}var Gf={type:"slider",startAt:0,perView:1,focusAt:0,gap:10,autoplay:!1,hoverpause:!0,keyboard:!0,bound:!1,swipeThreshold:80,dragThreshold:120,perSwipe:"",touchRatio:.5,touchAngle:45,animationDuration:400,rewind:!0,rewindDuration:800,animationTimingFunc:"cubic-bezier(.165, .840, .440, 1)",waitForTransition:!0,throttle:10,direction:"ltr",peek:0,cloningRatio:1,breakpoints:{},classes:{swipeable:"glide--swipeable",dragging:"glide--dragging",direction:{ltr:"glide--ltr",rtl:"glide--rtl"},type:{slider:"glide--slider",carousel:"glide--carousel"},slide:{clone:"glide__slide--clone",active:"glide__slide--active"},arrow:{disabled:"glide__arrow--disabled"},nav:{active:"glide__bullet--active"}}};function Ce(e){console.error("[Glide warn]: ".concat(e))}function se(e){return parseInt(e)}function Yf(e){return parseFloat(e)}function _n(e){return typeof e=="string"}function at(e){var t=Kt(e);return t==="function"||t==="object"&&!!e}function or(e){return typeof e=="function"}function _o(e){return typeof e>"u"}function wn(e){return e.constructor===Array}function Xf(e,t,r){var n={};for(var i in t)or(t[i])?n[i]=t[i](e,n,r):Ce("Extension must be a function");for(var s in n)or(n[s].mount)&&n[s].mount();return n}function K(e,t,r){Object.defineProperty(e,t,r)}function Qf(e){return Object.keys(e).sort().reduce(function(t,r){return t[r]=e[r],t[r],t},{})}function En(e,t){var r=Object.assign({},e,t);if(t.hasOwnProperty("classes")){r.classes=Object.assign({},e.classes,t.classes);var n=["direction","type","slide","arrow","nav"];n.forEach(function(i){t.classes.hasOwnProperty(i)&&(r.classes[i]=ds(ds({},e.classes[i]),t.classes[i]))})}return t.hasOwnProperty("breakpoints")&&(r.breakpoints=Object.assign({},e.breakpoints,t.breakpoints)),r}var Zf=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_r(this,e),this.events=t,this.hop=t.hasOwnProperty}return wr(e,[{key:"on",value:function(r,n){if(wn(r)){for(var i=0;i<r.length;i++)this.on(r[i],n);return}this.hop.call(this.events,r)||(this.events[r]=[]);var s=this.events[r].push(n)-1;return{remove:function(){delete this.events[r][s]}}}},{key:"emit",value:function(r,n){if(wn(r)){for(var i=0;i<r.length;i++)this.emit(r[i],n);return}this.hop.call(this.events,r)&&this.events[r].forEach(function(s){s(n||{})})}}]),e}(),Jf=function(){function e(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};_r(this,e),this._c={},this._t=[],this._e=new Zf,this.disabled=!1,this.selector=t,this.settings=En(Gf,r),this.index=this.settings.startAt}return wr(e,[{key:"mount",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this._e.emit("mount.before"),at(r)?this._c=Xf(this,r,this._e):Ce("You need to provide a object on `mount()`"),this._e.emit("mount.after"),this}},{key:"mutate",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return wn(r)?this._t=r:Ce("You need to provide a array on `mutate()`"),this}},{key:"update",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.settings=En(this.settings,r),r.hasOwnProperty("startAt")&&(this.index=r.startAt),this._e.emit("update"),this}},{key:"go",value:function(r){return this._c.Run.make(r),this}},{key:"move",value:function(r){return this._c.Transition.disable(),this._c.Move.make(r),this}},{key:"destroy",value:function(){return this._e.emit("destroy"),this}},{key:"play",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return r&&(this.settings.autoplay=r),this._e.emit("play"),this}},{key:"pause",value:function(){return this._e.emit("pause"),this}},{key:"disable",value:function(){return this.disabled=!0,this}},{key:"enable",value:function(){return this.disabled=!1,this}},{key:"on",value:function(r,n){return this._e.on(r,n),this}},{key:"isType",value:function(r){return this.settings.type===r}},{key:"settings",get:function(){return this._o},set:function(r){at(r)?this._o=r:Ce("Options must be an `object` instance.")}},{key:"index",get:function(){return this._i},set:function(r){this._i=se(r)}},{key:"type",get:function(){return this.settings.type}},{key:"disabled",get:function(){return this._d},set:function(r){this._d=!!r}}]),e}();function eh(e,t,r){var n={mount:function(){this._o=!1},make:function(c){var l=this;e.disabled||(!e.settings.waitForTransition||e.disable(),this.move=c,r.emit("run.before",this.move),this.calculate(),r.emit("run",this.move),t.Transition.after(function(){l.isStart()&&r.emit("run.start",l.move),l.isEnd()&&r.emit("run.end",l.move),l.isOffset()&&(l._o=!1,r.emit("run.offset",l.move)),r.emit("run.after",l.move),e.enable()}))},calculate:function(){var c=this.move,l=this.length,f=c.steps,d=c.direction,h=1;
31if(d==="="){if(e.settings.bound&&se(f)>l){e.index=l;return}e.index=f;return}if(d===">"&&f===">"){e.index=l;return}if(d==="<"&&f==="<"){e.index=0;return}if(d==="|"&&(h=e.settings.perView||1),d===">"||d==="|"&&f===">"){var v=i(h);v>l&&(this._o=!0),e.index=s(v,h);return}if(d==="<"||d==="|"&&f==="<"){var m=a(h);m<0&&(this._o=!0),e.index=o(m,h);return}Ce("Invalid direction pattern [".concat(d).concat(f,"] has been used"))},isStart:function(){return e.index<=0},isEnd:function(){return e.index>=this.length},isOffset:function(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;return c?this._o?c==="|>"?this.move.direction==="|"&&this.move.steps===">":c==="|<"?this.move.direction==="|"&&this.move.steps==="<":this.move.direction===c:!1:this._o},isBound:function(){return e.isType("slider")&&e.settings.focusAt!=="center"&&e.settings.bound}};function i(u){var c=e.index;return e.isType("carousel")?c+u:c+(u-c%u)}function s(u,c){var l=n.length;return u<=l?u:e.isType("carousel")?u-(l+1):e.settings.rewind?n.isBound()&&!n.isEnd()?l:0:n.isBound()?l:Math.floor(l/c)*c}function a(u){var c=e.index;if(e.isType("carousel"))return c-u;var l=Math.ceil(c/u);return(l-1)*u}function o(u,c){var l=n.length;return u>=0?u:e.isType("carousel")?u+(l+1):e.settings.rewind?n.isBound()&&n.isStart()?l:Math.floor(l/c)*c:0}return K(n,"move",{get:function(){return this._m},set:function(c){var l=c.substr(1);this._m={direction:c.substr(0,1),steps:l?se(l)?se(l):l:0}}}),K(n,"length",{get:function(){var c=e.settings,l=t.Html.slides.length;return this.isBound()?l-1-(se(c.perView)-1)+se(c.focusAt):l-1}}),K(n,"offset",{get:function(){return this._o}}),n}function fs(){return new Date().getTime()}function Er(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n,i,s,a,o=0,u=function(){o=r.leading===!1?0:fs(),n=null,a=e.apply(i,s),n||(i=s=null)},c=function(){var f=fs();!o&&r.leading===!1&&(o=f);var d=t-(f-o);return i=this,s=arguments,d<=0||d>t?(n&&(clearTimeout(n),n=null),o=f,a=e.apply(i,s),n||(i=s=null)):!n&&r.trailing!==!1&&(n=setTimeout(u,d)),a};return c.cancel=function(){clearTimeout(n),o=0,n=i=s=null},c}var Ft={ltr:["marginLeft","marginRight"],rtl:["marginRight","marginLeft"]};function th(e,t,r){var n={apply:function(s){for(var a=0,o=s.length;a<o;a++){var u=s[a].style,c=t.Direction.value;a!==0?u[Ft[c][0]]="".concat(this.value/2,"px"):u[Ft[c][0]]="",a!==s.length-1?u[Ft[c][1]]="".concat(this.value/2,"px"):u[Ft[c][1]]=""}},remove:function(s){for(var a=0,o=s.length;a<o;a++){var u=s[a].style;u.marginLeft="",u.marginRight=""}}};return K(n,"value",{get:function(){return se(e.settings.gap)}}),K(n,"grow",{get:function(){return n.value*t.Sizes.length}}),K(n,"reductor",{get:function(){var s=e.settings.perView;return n.value*(s-1)/s}}),r.on(["build.after","update"],Er(function(){n.apply(t.Html.wrapper.children)},30)),r.on("destroy",function(){n.remove(t.Html.wrapper.children)}),n}function wo(e){if(e&&e.parentNode){for(var t=e.parentNode.firstChild,r=[];t;t=t.nextSibling)t.nodeType===1&&t!==e&&r.push(t);return r}return[]}function In(e){return Array.prototype.slice.call(e)}var rh='[data-glide-el="track"]';function nh(e,t,r){var n={mount:function(){this.root=e.selector,this.track=this.root.querySelector(rh),this.collectSlides()},collectSlides:function(){this.slides=In(this.wrapper.children).filter(function(s){return!s.classList.contains(e.settings.classes.slide.clone)})}};return K(n,"root",{get:function(){return n._r},set:function(s){_n(s)&&(s=document.querySelector(s)),s!==null?n._r=s:Ce("Root element must be a existing Html node")}}),K(n,"track",{get:function(){return n._t},set:function(s){n._t=s}}),K(n,"wrapper",{get:function(){return n.track.children[0]}}),r.on("update",function(){n.collectSlides()}),n}function ih(e,t,r){var n={mount:function(){this.value=e.settings.peek}};return K(n,"value",{get:function(){return n._v},set:function(s){at(s)?(s.before=se(s.before),s.after=se(s.after)):s=se(s),n._v=s}}),K(n,"reductor",{get:function(){var s=n.value,a=e.settings.perView;return at(s)?s.before/a+s.after/a:s*2/a}}),r.on(["resize","update"],function(){n.mount()}),n}function sh(e,t,r){var n={mount:function(){this._o=0},make:function(){var s=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;this.offset=a,r.emit("move",{movement:this.value}),t.Transition.after(function(){r.emit("move.after",{movement:s.value})})}};return K(n,"offset",{get:function(){return n._o},set:function(s){n._o=_o(s)?0:se(s)}}),K(n,"translate",{get:function(){return t.Sizes.slideWidth*e.index}}),K(n,"value",{get:function(){var s=this.offset,a=this.translate;return t.Direction.is("rtl")?a+s:a-s}}),r.on(["build.before","run"],function(){n.make()}),n}function ah(e,t,r){var n={setupSlides:function(){for(var s="".concat(this.slideWidth,"px"),a=t.Html.slides,o=0;o<a.length;o++)a[o].style.width=s},setupWrapper:function(){t.Html.wrapper.style.width="".concat(this.wrapperSize,"px")},remove:function(){for(var s=t.Html.slides,a=0;a<s.length;a++)s[a].style.width="";t.Html.wrapper.style.width=""}};return K(n,"length",{get:function(){return t.Html.slides.length}}),K(n,"width",{get:function(){return t.Html.track.offsetWidth}}),K(n,"wrapperSize",{get:function(){return n.slideWidth*n.length+t.Gaps.grow+t.Clones.grow}}),K(n,"slideWidth",{get:function(){return n.width/e.settings.perView-t.Peek.reductor-t.Gaps.reductor}}),r.on(["build.before","resize","update"],function(){n.setupSlides(),n.setupWrapper()}),r.on("destroy",function(){n.remove()}),n}function oh(e,t,r){var n={mount:function(){r.emit("build.before"),this.typeClass(),this.activeClass(),r.emit("build.after")},typeClass:function(){t.Html.root.classList.add(e.settings.classes.type[e.settings.type])},activeClass:function(){var s=e.settings.classes,a=t.Html.slides[e.index];
31a&&(a.classList.add(s.slide.active),wo(a).forEach(function(o){o.classList.remove(s.slide.active)}))},removeClasses:function(){var s=e.settings.classes,a=s.type,o=s.slide;t.Html.root.classList.remove(a[e.settings.type]),t.Html.slides.forEach(function(u){u.classList.remove(o.active)})}};return r.on(["destroy","update"],function(){n.removeClasses()}),r.on(["resize","update"],function(){n.mount()}),r.on("move.after",function(){n.activeClass()}),n}function uh(e,t,r){var n={mount:function(){this.items=[],e.isType("carousel")&&(this.items=this.collect())},collect:function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],a=t.Html.slides,o=e.settings,u=o.perView,c=o.classes,l=o.cloningRatio;if(a.length>0)for(var f=+!!e.settings.peek,d=u+f+Math.round(u/2),h=a.slice(0,d).reverse(),v=a.slice(d*-1),m=0;m<Math.max(l,Math.floor(u/a.length));m++){for(var g=0;g<h.length;g++){var p=h[g].cloneNode(!0);p.classList.add(c.slide.clone),s.push(p)}for(var S=0;S<v.length;S++){var _=v[S].cloneNode(!0);_.classList.add(c.slide.clone),s.unshift(_)}}return s},append:function(){for(var s=this.items,a=t.Html,o=a.wrapper,u=a.slides,c=Math.floor(s.length/2),l=s.slice(0,c).reverse(),f=s.slice(c*-1).reverse(),d="".concat(t.Sizes.slideWidth,"px"),h=0;h<f.length;h++)o.appendChild(f[h]);for(var v=0;v<l.length;v++)o.insertBefore(l[v],u[0]);for(var m=0;m<s.length;m++)s[m].style.width=d},remove:function(){for(var s=this.items,a=0;a<s.length;a++)t.Html.wrapper.removeChild(s[a])}};return K(n,"grow",{get:function(){return(t.Sizes.slideWidth+t.Gaps.value)*n.items.length}}),r.on("update",function(){n.remove(),n.mount(),n.append()}),r.on("build.before",function(){e.isType("carousel")&&n.append()}),r.on("destroy",function(){n.remove()}),n}var Fe=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_r(this,e),this.listeners=t}return wr(e,[{key:"on",value:function(r,n,i){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;_n(r)&&(r=[r]);for(var a=0;a<r.length;a++)this.listeners[r[a]]=i,n.addEventListener(r[a],this.listeners[r[a]],s)}},{key:"off",value:function(r,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;_n(r)&&(r=[r]);for(var s=0;s<r.length;s++)n.removeEventListener(r[s],this.listeners[r[s]],i)}},{key:"destroy",value:function(){delete this.listeners}}]),e}();function ch(e,t,r){var n=new Fe,i={mount:function(){this.bind()},bind:function(){n.on("resize",window,Er(function(){r.emit("resize")},e.settings.throttle))},unbind:function(){n.off("resize",window)}};return r.on("destroy",function(){i.unbind(),n.destroy()}),i}var lh=["ltr","rtl"],dh={">":"<","<":">","=":"="};function fh(e,t,r){var n={mount:function(){this.value=e.settings.direction},resolve:function(s){var a=s.slice(0,1);return this.is("rtl")?s.split(a).join(dh[a]):s},is:function(s){return this.value===s},addClass:function(){t.Html.root.classList.add(e.settings.classes.direction[this.value])},removeClass:function(){t.Html.root.classList.remove(e.settings.classes.direction[this.value])}};return K(n,"value",{get:function(){return n._v},set:function(s){lh.indexOf(s)>-1?n._v=s:Ce("Direction value must be `ltr` or `rtl`")}}),r.on(["destroy","update"],function(){n.removeClass()}),r.on("update",function(){n.mount()}),r.on(["build.before","update"],function(){n.addClass()}),n}function hh(e,t){return{modify:function(n){return t.Direction.is("rtl")?-n:n}}}function vh(e,t){return{modify:function(n){var i=Math.floor(n/t.Sizes.slideWidth);return n+t.Gaps.value*i}}}function gh(e,t){return{modify:function(n){return n+t.Clones.grow/2}}}function ph(e,t){return{modify:function(n){if(e.settings.focusAt>=0){var i=t.Peek.value;return at(i)?n-i.before:n-i}return n}}}function mh(e,t){return{modify:function(n){var i=t.Gaps.value,s=t.Sizes.width,a=e.settings.focusAt,o=t.Sizes.slideWidth;return a==="center"?n-(s/2-o/2):n-o*a-i*a}}}function yh(e,t,r){var n=[vh,gh,ph,mh].concat(e._t,[hh]);return{mutate:function(s){for(var a=0;a<n.length;a++){var o=n[a];or(o)&&or(o().modify)?s=o(e,t,r).modify(s):Ce("Transformer should be a function that returns an object with `modify()` method")}return s}}}function bh(e,t,r){var n={set:function(s){var a=yh(e,t).mutate(s),o="translate3d(".concat(-1*a,"px, 0px, 0px)");t.Html.wrapper.style.mozTransform=o,t.Html.wrapper.style.webkitTransform=o,t.Html.wrapper.style.transform=o},remove:function(){t.Html.wrapper.style.transform=""}
31,getStartIndex:function(){var s=t.Sizes.length,a=e.index,o=e.settings.perView;return t.Run.isOffset(">")||t.Run.isOffset("|>")?s+(a-o):(a+o)%s},getTravelDistance:function(){var s=t.Sizes.slideWidth*e.settings.perView;return t.Run.isOffset(">")||t.Run.isOffset("|>")?s*-1:s}};return r.on("move",function(i){if(!e.isType("carousel")||!t.Run.isOffset())return n.set(i.movement);t.Transition.after(function(){r.emit("translate.jump"),n.set(t.Sizes.slideWidth*e.index)});var s=t.Sizes.slideWidth*t.Translate.getStartIndex();return n.set(s-t.Translate.getTravelDistance())}),r.on("destroy",function(){n.remove()}),n}function Sh(e,t,r){var n=!1,i={compose:function(a){var o=e.settings;return n?"".concat(a," 0ms ").concat(o.animationTimingFunc):"".concat(a," ").concat(this.duration,"ms ").concat(o.animationTimingFunc)},set:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";t.Html.wrapper.style.transition=this.compose(a)},remove:function(){t.Html.wrapper.style.transition=""},after:function(a){setTimeout(function(){a()},this.duration)},enable:function(){n=!1,this.set()},disable:function(){n=!0,this.set()}};return K(i,"duration",{get:function(){var a=e.settings;return e.isType("slider")&&t.Run.offset?a.rewindDuration:a.animationDuration}}),r.on("move",function(){i.set()}),r.on(["build.before","resize","translate.jump"],function(){i.disable()}),r.on("run",function(){i.enable()}),r.on("destroy",function(){i.remove()}),i}var Eo=!1;try{var hs=Object.defineProperty({},"passive",{get:function(){Eo=!0}});window.addEventListener("testPassive",null,hs),window.removeEventListener("testPassive",null,hs)}catch{}var Cn=Eo,Nt=["touchstart","mousedown"],vs=["touchmove","mousemove"],gs=["touchend","touchcancel","mouseup","mouseleave"],ps=["mousedown","mousemove","mouseup","mouseleave"];function _h(e,t,r){var n=new Fe,i=0,s=0,a=0,o=!1,u=Cn?{passive:!0}:!1,c={mount:function(){this.bindSwipeStart()},start:function(f){if(!o&&!e.disabled){this.disable();var d=this.touches(f);i=null,s=se(d.pageX),a=se(d.pageY),this.bindSwipeMove(),this.bindSwipeEnd(),r.emit("swipe.start")}},move:function(f){if(!e.disabled){var d=e.settings,h=d.touchAngle,v=d.touchRatio,m=d.classes,g=this.touches(f),p=se(g.pageX)-s,S=se(g.pageY)-a,_=Math.abs(p<<2),w=Math.abs(S<<2),E=Math.sqrt(_+w),b=Math.sqrt(w);if(i=Math.asin(b/E),i*180/Math.PI<h)f.stopPropagation(),t.Move.make(p*Yf(v)),t.Html.root.classList.add(m.dragging),r.emit("swipe.move");else return!1}},end:function(f){if(!e.disabled){var d=e.settings,h=d.perSwipe,v=d.touchAngle,m=d.classes,g=this.touches(f),p=this.threshold(f),S=g.pageX-s,_=i*180/Math.PI;this.enable(),S>p&&_<v?t.Run.make(t.Direction.resolve("".concat(h,"<"))):S<-p&&_<v?t.Run.make(t.Direction.resolve("".concat(h,">"))):t.Move.make(),t.Html.root.classList.remove(m.dragging),this.unbindSwipeMove(),this.unbindSwipeEnd(),r.emit("swipe.end")}},bindSwipeStart:function(){var f=this,d=e.settings,h=d.swipeThreshold,v=d.dragThreshold;h&&n.on(Nt[0],t.Html.wrapper,function(m){f.start(m)},u),v&&n.on(Nt[1],t.Html.wrapper,function(m){f.start(m)},u)},unbindSwipeStart:function(){n.off(Nt[0],t.Html.wrapper,u),n.off(Nt[1],t.Html.wrapper,u)},bindSwipeMove:function(){var f=this;n.on(vs,t.Html.wrapper,Er(function(d){f.move(d)},e.settings.throttle),u)},unbindSwipeMove:function(){n.off(vs,t.Html.wrapper,u)},bindSwipeEnd:function(){var f=this;n.on(gs,t.Html.wrapper,function(d){f.end(d)})},unbindSwipeEnd:function(){n.off(gs,t.Html.wrapper)},touches:function(f){return ps.indexOf(f.type)>-1?f:f.touches[0]||f.changedTouches[0]},threshold:function(f){var d=e.settings;return ps.indexOf(f.type)>-1?d.dragThreshold:d.swipeThreshold},enable:function(){return o=!1,t.Transition.enable(),this},disable:function(){return o=!0,t.Transition.disable(),this}};return r.on("build.after",function(){t.Html.root.classList.add(e.settings.classes.swipeable)}),r.on("destroy",function(){c.unbindSwipeStart(),c.unbindSwipeMove(),c.unbindSwipeEnd(),n.destroy()}),c}function wh(e,t,r){var n=new Fe,i={mount:function(){this.bind()},bind:function(){n.on("dragstart",t.Html.wrapper,this.dragstart)},unbind:function(){n.off("dragstart",t.Html.wrapper)},dragstart:function(a){a.preventDefault()}};return r.on("destroy",function(){i.unbind(),n.destroy()}),i}function Eh(e,t,r){var n=new Fe,i=!1,s=!1,a={mount:function(){this._a=t.Html.wrapper.querySelectorAll("a"),this.bind()},bind:function(){n.on("click",t.Html.wrapper,this.click)},unbind:function(){n.off("click",t.Html.wrapper)},click:function(u){s&&(u.stopPropagation(),u.preventDefault())},detach:function(){if(s=!0,!i){for(var u=0;u<this.items.length;u++)this.items[u].draggable=!1;i=!0}return this},attach:function(){if(s=!1,i){for(var u=0;u<this.items.length;u++)this.items[u].draggable=!0;i=!1}return this}};return K(a,"items",{get:function(){return a._a}}),r.on("swipe.move",function(){a.detach()}),r.on("swipe.end",function(){t.Transition.after(function(){a.attach()})}),r.on("destroy",function(){a.attach(),a.unbind(),n.destroy()}),a}
31var Ih='[data-glide-el="controls[nav]"]',vi='[data-glide-el^="controls"]',Ch="".concat(vi,' [data-glide-dir*="<"]'),Th="".concat(vi,' [data-glide-dir*=">"]');function Ph(e,t,r){var n=new Fe,i=Cn?{passive:!0}:!1,s={mount:function(){this._n=t.Html.root.querySelectorAll(Ih),this._c=t.Html.root.querySelectorAll(vi),this._arrowControls={previous:t.Html.root.querySelectorAll(Ch),next:t.Html.root.querySelectorAll(Th)},this.addBindings()},setActive:function(){for(var o=0;o<this._n.length;o++)this.addClass(this._n[o].children)},removeActive:function(){for(var o=0;o<this._n.length;o++)this.removeClass(this._n[o].children)},addClass:function(o){var u=e.settings,c=o[e.index];c&&(c.classList.add(u.classes.nav.active),wo(c).forEach(function(l){l.classList.remove(u.classes.nav.active)}))},removeClass:function(o){var u=o[e.index];u?.classList.remove(e.settings.classes.nav.active)},setArrowState:function(){if(!e.settings.rewind){var o=s._arrowControls.next,u=s._arrowControls.previous;this.resetArrowState(o,u),e.index===0&&this.disableArrow(u),e.index===t.Run.length&&this.disableArrow(o)}},resetArrowState:function(){for(var o=e.settings,u=arguments.length,c=new Array(u),l=0;l<u;l++)c[l]=arguments[l];c.forEach(function(f){In(f).forEach(function(d){d.classList.remove(o.classes.arrow.disabled)})})},disableArrow:function(){for(var o=e.settings,u=arguments.length,c=new Array(u),l=0;l<u;l++)c[l]=arguments[l];c.forEach(function(f){In(f).forEach(function(d){d.classList.add(o.classes.arrow.disabled)})})},addBindings:function(){for(var o=0;o<this._c.length;o++)this.bind(this._c[o].children)},removeBindings:function(){for(var o=0;o<this._c.length;o++)this.unbind(this._c[o].children)},bind:function(o){for(var u=0;u<o.length;u++)n.on("click",o[u],this.click),n.on("touchstart",o[u],this.click,i)},unbind:function(o){for(var u=0;u<o.length;u++)n.off(["click","touchstart"],o[u])},click:function(o){!Cn&&o.type==="touchstart"&&o.preventDefault();var u=o.currentTarget.getAttribute("data-glide-dir");t.Run.make(t.Direction.resolve(u))}};return K(s,"items",{get:function(){return s._c}}),r.on(["mount.after","move.after"],function(){s.setActive()}),r.on(["mount.after","run"],function(){s.setArrowState()}),r.on("destroy",function(){s.removeBindings(),s.removeActive(),n.destroy()}),s}function xh(e,t,r){var n=new Fe,i={mount:function(){e.settings.keyboard&&this.bind()},bind:function(){n.on("keyup",document,this.press)},unbind:function(){n.off("keyup",document)},press:function(a){var o=e.settings.perSwipe,u={ArrowRight:">",ArrowLeft:"<"};["ArrowRight","ArrowLeft"].includes(a.code)&&t.Run.make(t.Direction.resolve("".concat(o).concat(u[a.code])))}};return r.on(["destroy","update"],function(){i.unbind()}),r.on("update",function(){i.mount()}),r.on("destroy",function(){n.destroy()}),i}function Ah(e,t,r){var n=new Fe,i={mount:function(){this.enable(),this.start(),e.settings.hoverpause&&this.bind()},enable:function(){this._e=!0},disable:function(){this._e=!1},start:function(){var a=this;this._e&&(this.enable(),e.settings.autoplay&&_o(this._i)&&(this._i=setInterval(function(){a.stop(),t.Run.make(">"),a.start(),r.emit("autoplay")},this.time)))},stop:function(){this._i=clearInterval(this._i)},bind:function(){var a=this;n.on("mouseover",t.Html.root,function(){a._e&&a.stop()}),n.on("mouseout",t.Html.root,function(){a._e&&a.start()})},unbind:function(){n.off(["mouseover","mouseout"],t.Html.root)}};return K(i,"time",{get:function(){var a=t.Html.slides[e.index].getAttribute("data-glide-autoplay");return se(a||e.settings.autoplay)}}),r.on(["destroy","update"],function(){i.unbind()}),r.on(["run.before","swipe.start","update"],function(){i.stop()}),r.on(["pause","destroy"],function(){i.disable(),i.stop()}),r.on(["run.after","swipe.end"],function(){i.start()}),r.on(["play"],function(){i.enable(),i.start()}),r.on("update",function(){i.mount()}),r.on("destroy",function(){n.destroy()}),i}function ms(e){return at(e)?Qf(e):(Ce("Breakpoints option must be an object"),{})}function Rh(e,t,r){var n=new Fe,i=e.settings,s=ms(i.breakpoints),a=Object.assign({},i),o={match:function(c){if(typeof window.matchMedia<"u"){for(var l in c)if(c.hasOwnProperty(l)&&window.matchMedia("(max-width: ".concat(l,"px)")).matches)return c[l]}return a}};return Object.assign(i,o.match(s)),n.on("resize",window,Er(function(){e.settings=En(i,o.match(s))},e.settings.throttle)),r.on("update",function(){s=ms(s),a=Object.assign({},i)}),r.on("destroy",function(){n.off("resize",window)}),o}var Mh={Html:nh,Translate:bh,Transition:Sh,Direction:fh,Peek:ih,Sizes:ah,Gaps:th,Move:sh,Clones:uh,Resize:ch,Build:oh,Run:eh,Swipe:_h,Images:wh,Anchors:Eh,Controls:Ph,Keyboard:xh,Autoplay:Ah,Breakpoints:Rh},Io=function(e){zf(r,e);var t=Wf(r);function r(){return _r(this,r),t.apply(this,arguments)}
31return wr(r,[{key:"mount",value:function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Gt(st(r.prototype),"mount",this).call(this,Object.assign({},Mh,i))}}]),r}(Jf);const Oh=Sr(e=>{const t=e.getAttribute("data-gap")||20,r=e.getAttribute("data-peek")||0;new Io(e,{type:"carousel",perView:3,gap:t,peek:{before:0,after:0},breakpoints:{520:{gap:t/2,perView:1,peek:{before:r,after:r},focusAt:"center"}}}).mount()}),kh=Sr(e=>{new Io(e,{type:"slider",perView:3,gap:60,peek:{before:0,after:240},bound:!0,dragThreshold:60,breakpoints:{1280:{perView:2,gap:30,peek:{before:0,after:120}},1024:{perView:2,gap:30,peek:{before:0,after:120}},768:{perView:1,gap:30,peek:{before:0,after:80}}}}).mount()}),Lh={specialists:kh,reviews:Oh,cfForm:Uf,accordion:Ff},Dh=Df(Lh),{customer:Ur,IS_STAGING:qr}=me(),Fh=()=>{const e=uu({dsn:qr?"https://d1adfb29713f23224ec2b2695edbed03@o4507495026196480.ingest.us.sentry.io/4508406703783936":"https://d98a4cd829a62cc8d51af148c497f30c@o4507495026196480.ingest.us.sentry.io/4508406709157888",environment:qr?"staging":"production",integrations:[du()],replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1,ignoreErrors:lu,denyUrls:cu,beforeSend:t=>fu(t)?null:(Ur&&(t.user={id:Ur.id,email:Ur.email}),t.tags={...t.tags,app_name:"Theme"},t)});qr&&e&&console.info("✅ Sentry initialized in staging mode")},Nh=e=>{const t=_e.get("discount_code");t&&e.includes(t)&&_e.remove("discount_code")};Su();const Bh="hp-sticky-cta-2",Uh={"get-started":"Get started"},qh=768,$h="hp-sticky-cta-bar",Co="hp-sticky-cta-link",To="cta-primary-hero",zh="cta-secondary-hero",jh=".cta-buttons",Vh="#shopify-section-header",Hh="/account/register",ys=16,Wh=()=>{const e=window.theme?.routes?.root_url||"/";return!(window.location.pathname!==e||window.innerWidth>=qh||window.theme?.customer)},bs=e=>e.getAttribute("href")||Hh,Kh=["/account/register"],Gh=()=>{const e=document.createElement("style"),t=Kh.map(r=>`a[href*='${r}'].rounded-full:not(#${To}):not(#${zh}):not(#${Co}):not(${Vh} a)`).join(",");e.textContent=`${t} { display: none !important; }`,document.head.appendChild(e)},Ss=e=>{const t=e.getBoundingClientRect();if(t.width===0||t.height===0||t.top<window.innerHeight/2)return!1;const r=getComputedStyle(e);return r.position==="fixed"&&r.visibility!=="hidden"&&parseFloat(r.opacity)>0};let Ze=null;const Yh=()=>{if(Ze?.isConnected&&Ss(Ze))return Ze;Ze=null;const e=document.querySelectorAll('[id^="alia-root"], [id*="alia" i], [class*="alia" i]');for(const t of e)if(Ss(t)){Ze=t;break}return Ze},Xh=e=>{const t=Yh();if(t){const r=t.getBoundingClientRect().top;e.style.bottom=`${window.innerHeight-r+ys}px`}else e.style.bottom=`calc(env(safe-area-inset-bottom, 0px) + ${ys}px)`},Qh=(e,t,r)=>{const n=document.createElement("div");n.id=$h,n.className="fixed inset-x-0 z-40 px-4 md:hidden",n.style.display="none";const i=document.createElement("a");return i.id=Co,i.href=r,i.textContent=e,i.className="block w-full text-lg px-8 py-3 text-center whitespace-nowrap rounded-full bg-black text-white border border-black",i.dataset[Uu]="true",Zs(i,r,t),n.appendChild(i),document.body.appendChild(n),{bar:n,link:i}},_s=.9,Zh=(e,t)=>{const r=t.closest(jh)??t;new IntersectionObserver(([n])=>{n.intersectionRatio>=_s?e.style.display="none":(Xh(e),e.style.display="block")},{threshold:_s}).observe(r)},Jh=async()=>{if(!Wh())return;const e=document.getElementById(To);if(!(e instanceof HTMLAnchorElement))return;const t=await Bu(Bh,"control"),r=Uh[t];if(!r)return;Gh();const{bar:n,link:i}=Qh(r,t,bs(e));Zh(n,e),new MutationObserver(()=>{const s=bs(e);i.href=s,Zs(i,s,t)}).observe(e,{attributes:!0,attributeFilter:["href"]})};Nu(()=>void Jh());var ws;(function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"})(ws||(ws={}));var Tn;(function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"})(Tn||(Tn={}));var Po="$default_instance",xo="https://api2.amplitude.com/2/httpapi",ev="https://api.eu.amplitude.com/2/httpapi",tv="https://api2.amplitude.com/batch",rv="https://api.eu.amplitude.com/batch",ne;(function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"})(ne||(ne={}));var W=function(){var e="ampIntegrationContext";if(typeof globalThis<"u"&&typeof globalThis[e]<"u")return globalThis[e];if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global},nv=function(e){return e?(e^Math.random()*16>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,Ao)},Es=G([],j(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),Ao=function(e){var t,r=W();if(!(!((t=r?.crypto)===null||t===void 0)&&t.getRandomValues))return nv(e);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=n[6]&15|64,n[8]=n[8]&63|128,G([],j(n.entries()),!1).map(function(i){var s=j(i,2),a=s[0],o=s[1];return[4,6,8,10].includes(a)?"-".concat(Es[o]):Es[o]}).join("")},Is=function(e){return{promise:e||Promise.resolve()}},ve;(function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"})(ve||(ve={}));var Bt="Amplitude Logger ",ur=function(){function e(){this.logLevel=ve.None}return e.prototype.disable=function(){this.logLevel=ve.None},e.prototype.enable=function(t){t===void 0&&(t=ve.Warn),this.logLevel=t},e.prototype.log=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<ve.Verbose||console.log("".concat(Bt,"[Log]: ").concat(t.join(" ")))},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<ve.Warn||console.warn("".concat(Bt,"[Warn]: ").concat(t.join(" ")))},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<ve.Error||console.error("".concat(Bt,"[Error]: ").concat(t.join(" ")))},e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<ve.Debug||console.log("".concat(Bt,"[Debug]: ").concat(t.join(" ")))},e}(),Yt=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:Po,logLevel:ve.Warn,loggerProvider:new ur,offline:!1,optOut:!1,serverUrl:xo,serverZone:"US",useBatch:!1}},iv=function(){function e(t){var r,n,i,s;this._optOut=!1;var a=Yt();this.apiKey=t.apiKey,this.flushIntervalMillis=(r=t.flushIntervalMillis)!==null&&r!==void 0?r:a.flushIntervalMillis,this.flushMaxRetries=t.flushMaxRetries||a.flushMaxRetries,this.flushQueueSize=t.flushQueueSize||a.flushQueueSize,this.instanceName=t.instanceName||a.instanceName,this.loggerProvider=t.loggerProvider||a.loggerProvider,this.logLevel=(n=t.logLevel)!==null&&n!==void 0?n:a.logLevel,this.minIdLength=t.minIdLength,this.plan=t.plan,this.ingestionMetadata=t.ingestionMetadata,this.offline=t.offline!==void 0?t.offline:a.offline,this.optOut=(i=t.optOut)!==null&&i!==void 0?i:a.optOut,this.serverUrl=t.serverUrl,this.serverZone=t.serverZone||a.serverZone,this.storageProvider=t.storageProvider,this.transportProvider=t.transportProvider,this.useBatch=(s=t.useBatch)!==null&&s!==void 0?s:a.useBatch,this.loggerProvider.enable(this.logLevel);var o=av(t.serverUrl,t.serverZone,t.useBatch);this.serverZone=o.serverZone,this.serverUrl=o.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(t){this._optOut=t}
31,enumerable:!1,configurable:!0}),e}(),sv=function(e,t){return e==="EU"?t?rv:ev:t?tv:xo},av=function(e,t,r){if(e===void 0&&(e=""),t===void 0&&(t=Yt().serverZone),r===void 0&&(r=Yt().useBatch),e)return{serverUrl:e,serverZone:void 0};var n=["US","EU"].includes(t)?t:Yt().serverZone;return{serverZone:n,serverUrl:sv(n,r)}};function ov(e){return e>=200&&e<300}var uv=function(e){var t=new Error().stack||"";return t.split(`
32`).slice(2+e).map(function(r){return r.trim()})},Ne=function(e,t,r,n,i){return i===void 0&&(i=null),function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];var o=r(),u=o.logger,c=o.logLevel;if(c&&c<ve.Debug||!c||!u)return e.apply(i,s);var l={type:"invoke public method",name:t,args:s,stacktrace:uv(1),time:{start:new Date().toISOString()},states:{}},f=e.apply(i,s);return f&&f.promise?f.promise.then(function(){l.time&&(l.time.end=new Date().toISOString()),u.debug(JSON.stringify(l,null,2))}):(l.time&&(l.time.end=new Date().toISOString()),u.debug(JSON.stringify(l,null,2))),f}},cv=function(e){return e===void 0&&(e=Po),Du.getInstance(e)},Cs=function(e){var t=0;if(e.length===0)return t;for(var r=0;r<e.length;r++){var n=e.charCodeAt(r);t=(t<<5)-t+n,t|=0}return t},Ro=function(){function e(){}return e.prototype.send=function(t,r,n){return Promise.resolve(null)},e.prototype.buildResponse=function(t){var r,n,i,s,a,o,u,c,l,f,d,h,v,m,g,p,S,_,w,E,b,y;if(typeof t!="object")return null;var I=t.code||0,C=this.buildStatus(I);switch(C){case ne.Success:return{status:C,statusCode:I,body:{eventsIngested:(r=t.events_ingested)!==null&&r!==void 0?r:0,payloadSizeBytes:(n=t.payload_size_bytes)!==null&&n!==void 0?n:0,serverUploadTime:(i=t.server_upload_time)!==null&&i!==void 0?i:0}};case ne.Invalid:return{status:C,statusCode:I,body:{error:(s=t.error)!==null&&s!==void 0?s:"",missingField:(a=t.missing_field)!==null&&a!==void 0?a:"",eventsWithInvalidFields:(o=t.events_with_invalid_fields)!==null&&o!==void 0?o:{},eventsWithMissingFields:(u=t.events_with_missing_fields)!==null&&u!==void 0?u:{},eventsWithInvalidIdLengths:(c=t.events_with_invalid_id_lengths)!==null&&c!==void 0?c:{},epsThreshold:(l=t.eps_threshold)!==null&&l!==void 0?l:0,exceededDailyQuotaDevices:(f=t.exceeded_daily_quota_devices)!==null&&f!==void 0?f:{},silencedDevices:(d=t.silenced_devices)!==null&&d!==void 0?d:[],silencedEvents:(h=t.silenced_events)!==null&&h!==void 0?h:[],throttledDevices:(v=t.throttled_devices)!==null&&v!==void 0?v:{},throttledEvents:(m=t.throttled_events)!==null&&m!==void 0?m:[]}};case ne.PayloadTooLarge:return{status:C,statusCode:I,body:{error:(g=t.error)!==null&&g!==void 0?g:""}};case ne.RateLimit:return{status:C,statusCode:I,body:{error:(p=t.error)!==null&&p!==void 0?p:"",epsThreshold:(S=t.eps_threshold)!==null&&S!==void 0?S:0,throttledDevices:(_=t.throttled_devices)!==null&&_!==void 0?_:{},throttledUsers:(w=t.throttled_users)!==null&&w!==void 0?w:{},exceededDailyQuotaDevices:(E=t.exceeded_daily_quota_devices)!==null&&E!==void 0?E:{},exceededDailyQuotaUsers:(b=t.exceeded_daily_quota_users)!==null&&b!==void 0?b:{},throttledEvents:(y=t.throttled_events)!==null&&y!==void 0?y:[]}};case ne.Timeout:default:return{status:C,statusCode:I}}},e.prototype.buildStatus=function(t){return ov(t)?ne.Success:t===429?ne.RateLimit:t===413?ne.PayloadTooLarge:t===408?ne.Timeout:t>=400&&t<500?ne.Invalid:t>=500?ne.Failed:ne.Unknown},e}(),lv=function(e){fr(t,e);function t(r){r===void 0&&(r={});var n=e.call(this)||this;return n.customHeaders=r,n}return t.prototype.send=function(r,n){return x(this,void 0,void 0,function(){var i,s,a;return T(this,function(o){switch(o.label){case 0:if(typeof fetch>"u")throw new Error("FetchTransport is not supported");return i={headers:M({"Content-Type":"application/json",Accept:"*/*"},this.customHeaders),body:JSON.stringify(n),method:"POST"},[4,fetch(r,i)];case 1:return s=o.sent(),[4,s.text()];case 2:a=o.sent();try{return[2,this.buildResponse(JSON.parse(a))]}catch{return[2,this.buildResponse({code:s.status})]}return[2]}})})},t}(Ro),dv=function(){function e(t,r){this.key="AMP_remote_config_".concat(t.substring(0,10)),this.logger=r}return e.prototype.fetchConfig=function(){var t=null,r={remoteConfig:null,lastFetch:new Date};try{t=localStorage.getItem(this.key)}catch(i){return this.logger.debug("Remote config localstorage failed to access: ",i),Promise.resolve(r)}if(t===null)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(r);try{var n=JSON.parse(t);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(i){return this.logger.debug("Remote config localstorage failed to parse: ",i),localStorage.removeItem(this.key),Promise.resolve(r)}},e.prototype.setConfig=function(t){try{return localStorage.setItem(this.key,JSON.stringify(t)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(r){this.logger.debug("Remote config localstorage failed to set: ",r)}return Promise.resolve(!1)},e}();function fv(e,t){return new Promise(function(r,n){var i=function(){var s=new Error("Remote config custom fetch aborted by timeout");s.name="AbortError",n(s)};t.addEventListener("abort",i,{once:!0}),e.then(function(s){t.removeEventListener("abort",i),r(s)},function(s){t.removeEventListener("abort",i),n(s)})})}var hv="https://sr-client-cfg.amplitude.com/config",vv="https://sr-client-cfg.eu.amplitude.com/config",gv=3,$r={INVALID_API_KEY:401,FORB
32IDDEN:403,RATE_LIMIT:429},pv=1e3,mv=300*1e3,yv=function(){function e(t,r,n,i,s){n===void 0&&(n="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=t,this.serverUrl=i||(n==="US"?hv:vv),this.logger=r,this.storage=new dv(t,r),this.customFetch=s}return e.prototype.subscribe=function(t,r,n){var i=Ao(),s={id:i,key:t,deliveryMode:r,callback:n};return this.callbackInfos.push(s),r==="all"?this.subscribeAll(s):this.subscribeWaitForRemote(s,r.timeout),i},e.prototype.unsubscribe=function(t){var r=this.callbackInfos.findIndex(function(n){return n.id===t});return r===-1?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(t," doesn't exist.")),!1):(this.callbackInfos.splice(r,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(t,".")),!0)},e.prototype.updateConfigs=function(){return x(this,void 0,void 0,function(){var t,r,n=this;return T(this,function(i){switch(i.label){case 0:return this.lastSuccessfulFetch&&(t=Date.now()-this.lastSuccessfulFetch,t<mv)?(this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2]):[4,this.getOrCreateFetchPromise()];case 1:return r=i.sent(),this.storage.setConfig(r),this.callbackInfos.forEach(function(s){n.sendCallback(s,r,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var t=this;return this.fetchPromise?this.fetchPromise:this.isLastFetchInvalidApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){t.fetchPromise=null}),this.fetchPromise):(this.fetchPromise=this.fetch().then(function(r){return r.remoteConfig!==null&&(t.lastSuccessfulFetch=Date.now()),r}).finally(function(){t.fetchPromise=null}),this.fetchPromise)},e.prototype.subscribeAll=function(t){return x(this,void 0,void 0,function(){var r,n,i,s=this;return T(this,function(a){switch(a.label){case 0:return r=this.getOrCreateFetchPromise().then(function(o){s.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(o))),s.sendCallback(t,o,"remote"),s.storage.setConfig(o)}),n=this.storage.fetchConfig().then(function(o){return o}),[4,Promise.race([r,n])];case 1:return i=a.sent(),i!==void 0&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(i))),i.remoteConfig!==null?this.sendCallback(t,i,"cache"):this.logger.debug("Remote config client skips sending c
32allback because cache is empty (first time user).")),[4,r];case 2:return a.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(t,r){return x(this,void 0,void 0,function(){var n,i,i;return T(this,function(s){switch(s.label){case 0:n=new Promise(function(a,o){setTimeout(function(){o("Timeout exceeded")},r)}),s.label=1;case 1:return s.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return i=s.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(t,i,"remote"),this.storage.setConfig(i),[3,5];case 3:return s.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return i=s.sent(),i.remoteConfig!==null?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(t,i,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(t,i,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(t,r,n){t.lastCallback=new Date;var i;t.key?i=t.key.split(".").reduce(function(s,a){return s===null?s:a in s?s[a]:null},r.remoteConfig):i=r.remoteConfig,t.callback(i,n,r.lastFetch)},e.prototype.fetch=function(t,r){return t===void 0&&(t=gv),r===void 0&&(r=pv),x(this,void 0,void 0,function(){var n,i,s,a,o,u,c=this;return T(this,function(l){switch(l.label){case 0:n=r/t,i={remoteConfig:null,lastFetch:new Date},s=function(f){var d,h,v,m,g,p,S,_,w,E,b;return T(this,function(y){switch(y.label){case 0:d=!0,h=new AbortController,v=setTimeout(function(){return h.abort()},r),y.label=1;case 1:return y.trys.push([1,10,11,12]),m=a.getUrlParams(),g={Accept:"*/*"},a.customFetch?[4,fv(a.customFetch({url:m,method:"GET",headers:g,signal:h.signal}),h.signal)]:[3,3];case 2:return S=y.sent(),[3,5];case 3:return[4,fetch(m,{method:"GET",headers:g,signal:h.signal})];case 4:S=y.sent(),y.label=5;case 5:return p=S,_=p.ok||p.status>=200&&p.status<300,_?[3,7]:[4,p.text()];case 6:return w=y.sent(),a.logger.debug("Remote config client fetch with retry time ".concat(t," failed with ").concat(p.status,": ").concat(w)),p.status===$r.INVALID_API_KEY||p.status===$r.FORBIDDEN?(a.logger.error("Remote config client fetch failed with ".concat(p.status,". Invalid API key; future fetches will be skipped.")),a.isLastFetchInvalidApiKey=!0,d=!1):p.status>=400&&p.status<500&&p.status!==$r.RATE_LIMIT&&(d=!1),[3,9];case 7:return[4,p.json()];case 8:return E=y.sent(),[2,{value:{remoteConfig:E,lastFetch:new Date}}];case 9:return[3,12];case 10:return b=y.sent(),b instanceof Error&&b.name==="AbortError"?a.logger.debug("Remote config client fetch with retry time ".concat(t," timed out after ").concat(r,"ms")):a.logger.debug("Remote config client fetch with retry time ".concat(t," is rejected because: "),b),[3,12];case 11:return clearTimeout(v),[7];case 12:return d?f<t-1?[4,new Promise(function(I){return setTimeout(I,c.getJitterDelay(n))})]:[3,14]:[2,"break"];case 13:y.sent(),y.label=14;case 14:return[2]}})},a=this,o=0,l.label=1;case 1:return o<t?[5,s(o)]:[3,4];case 2:if(u=l.sent(),typeof u=="object")return[2,u.value];if(u==="break")return[3,4];l.label=3;case 3:return o++,[3,1];case 4:return[2,i]}})})},e.prototype.getJitterDelay=function(t){return Math.floor(Math.random()*t)},e.prototype.getUrlParams=function(){var t=encodeURIComponent(this.apiKey),r=new URLSearchParams;return r.append("config_group",e.CONFIG_GROUP),"".concat(this.serverUrl,"/").concat(t,"?").concat(r.toString())},e.CONFIG_GROUP="browser",e}(),Pn;(function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"})(Pn||(Pn={}));var xn="https://app.amplitude.com",bv="https://app.eu.amplitude.com",Sv="https://apps.stag2.amplitude.com",_v={US:xn,EU:bv,STAGING:Sv},wv="https://cdn.amplitude.com/libs/background-capture-1.0.3.js.gz",Ev=function(e){var t=document.querySelector('script[src="'.concat(CSS.escape(e),'"]'));return t?Promise.resolve({status:!0}):new Promise(function(r,n){var i;try{var s=document.createElement("script");s.type="text/javascript",s.async=!0,s.src=e,s.addEventListener("load",function(){r({status:!0})},{once:!0}),s.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),(i=document.head)===null||i===void 0||i.appendChild(s)}catch(a){n(a)}})};function Iv(){return"".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9))}var Mo,An="__AMPLITUDE_MESSENGER_INSTANCE__",cr="__AMPLITUDE_MESSENGER__",Cv=function(){function e(t){var r=t===void 0?{}:t,n=r.origin,i=n===void 0?xn:n;this[Mo]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=i}return e.prototype.notify=function(t){var r,n,i,s;(n=(r=this.logger)===null||r===void 0?void 0:r.debug)===null||n===void 0||n.call(r,"Message sent: ",JSON.stringify(t)),(s=(i=window.opener)===null||i===void 0?void 0:i.postMessage)===null||s===void 0||s.call(i,t,this.endpoint)},e.prototype.sendRequest=function(t,r,n){var i=this;n===void 0&&(n={timeout:15e3});var s=Iv(),a={id:s,action:t,args:r},o=new Promise(function(u,c){i.requestCallbacks[s]={resolve:u,reject:c},i.notify(a),n.timeout>0&&setTimeout(function(){c(new Error("".concat(t," timed out (id: ").concat(s,")"))),delete i.requestCallbacks[s]},n.timeout)});return o},e.prototype.handleResponse=function(t){var r;if(!this.requestCallbacks[t.id]){(r=this.logger)===null||r===void 0||r.warn("No callback found for request id: ".concat(t.id));return}this.requestCallbacks[t.id].resolve(t.responseData),delete this.requestCallbacks[t.id]},e.prototype.registerActionHandler=function(t,r){var n,i,s,a;this.actionHandlers.has(t)&&((a=(s=this.logger)===null||s===void 0?void 0:s.warn)===null||a===void 0||a.call(s,"Overwriting existing action handler for: ".concat(t))),this.actionHandlers.set(t,r);var o=this.pendingMessages.get(t);if(o){this.pendingMessages.delete(t);try{for(var u=z(o),c=u.next();!c.done;c=u.next()){var l=c.value;r(l)}}catch(f){n={error:f}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(t){return x(this,void 0,void 0,function(){var r,n,i;return T(this,function(s){switch(s.label){case 0:if(r=this.scriptLoadPromises.get(t),r)return[2,r];n=Ev(t).then(function(){}),this.scriptLoadPromises.set(t,n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n];case 2:return s.sent(),[3,4];case 3:throw i=s.sent(),this.scriptLoadPromises.delete(t),i;case 4:return[2]}})})},e.prototype.setup=function(t){var r=this,n,i,s=t===void 0?{}:t,a=s.logger,o=s.endpoint;
32a&&(this.logger=a),o&&this.endpoint===xn&&(this.endpoint=o),!this.isSetup&&(this.isSetup=!0,(i=(n=this.logger)===null||n===void 0?void 0:n.debug)===null||i===void 0||i.call(n,"Setting up messenger"),this.messageHandler=function(u){var c,l,f,d,h;if((l=(c=r.logger)===null||c===void 0?void 0:c.debug)===null||l===void 0||l.call(c,"Message received: ",JSON.stringify(u)),r.endpoint===u.origin){var v=u.data,m=v?.action;if(m)if("id"in v&&v.id)(d=(f=r.logger)===null||f===void 0?void 0:f.debug)===null||d===void 0||d.call(f,"Received Response to previous request: ",JSON.stringify(u)),r.handleResponse(v);else{if(m==="ping"){r.notify({action:"pong"});return}var g=r.actionHandlers.get(m);if(g)g(v.data);else{var p=(h=r.pendingMessages.get(m))!==null&&h!==void 0?h:[];p.push(v.data),r.pendingMessages.set(m,p)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var t=W();t?.[cr]===this&&delete t[cr]},e}();Mo=An;function Tv(e){return typeof e=="object"&&e!==null&&An in e&&e[An]===!0}function Pv(e){var t=W(),r=t?.[cr];if(Tv(r))return r;var n=new Cv(e);return t&&(t[cr]=n),n}var Ts="__AMPLITUDE_BACKGROUND_CAPTURE__";function xv(e,t){var r,n=e;if(n[Ts]!==!0){n[Ts]=!0;var i=(r=void 0)!==null&&r!==void 0?r:wv,s=null,a=function(o,u){var c,l;o==="background-capture-complete"&&((l=(c=e.logger)===null||c===void 0?void 0:c.debug)===null||l===void 0||l.call(c,"Background capture complete"),e.notify({action:"background-capture-complete",data:u}))};e.registerActionHandler("initialize-background-capture",function(){var o,u;(u=(o=e.logger)===null||o===void 0?void 0:o.debug)===null||u===void 0||u.call(o,"Initializing background capture (external script)");var c=new URL(i,e.endpoint).toString();e.loadScriptOnce(c).then(function(){var l,f,d;(f=(l=e.logger)===null||l===void 0?void 0:l.debug)===null||f===void 0||f.call(l,"Background capture script loaded (external)"),s=(d=window?.amplitudeBackgroundCapture)===null||d===void 0?void 0:d.call(window,{messenger:e,onBackgroundCapture:a}),e.notify({action:"background-capture-loaded"})}).catch(function(){var l;(l=e.logger)===null||l===void 0||l.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var o;(o=s?.close)===null||o===void 0||o.call(s),s=null})}}var Oo="[Amplitude]",Av="".concat(Oo," Session Replay ID"),Rv=0,Mv=Pn.US,Ov={enabled:!0},gi=1e3,kv="".concat(Oo," Session Replay Debug"),Lv="amp-block",ko="amp-mask",Lo="amp-unmask",Do="https://api-sr.amplitude.com/sessions/v2/track",Fo="https://api-sr.eu.amplitude.com/sessions/v2/track",No="https://api-sr.stag2.amplitude.com/sessions/v2/track",Dv=2e6,Fv=6e6,Bo=9*1e6,Nv=/payload.*exceed/i,Bv=3e4,Uv=6e4,Rn=500,Mn=10*1e3,qv=1e3,$v=10*1e3,On=1024,zv=1e3,jv=64*1024,Vv=1e4,Ps="X-Session-Replay-Event-Skipped",Hv="429",Wv="4004",Kv="4005",xs=6e4,Gv=2*Dv,Xt="amplitude-sr-iframe",Ee;(function(e){e.GET_SR_PROPS="get-sr-props",e.DEBUG_INFO="debug-info",e.FETCH_REQUEST="fetch-request",e.METADATA="metadata",e.TARGETING_DECISION="targeting-decision",e.REPLAY_GATE_DECISION="replay-gate-decision"})(Ee||(Ee={}));var kn=function(){function e(t){this.logger=t,this.log=this.getSafeMethod("log"),this.warn=this.getSafeMethod("warn"),this.error=this.getSafeMethod("error"),this.debug=this.getSafeMethod("debug")}return e.prototype.getSafeMethod=function(t){var r;if(!this.logger)return function(){};var n=this.logger[t];if(typeof n=="function"){var i=(r=n.__rrweb_original__)!==null&&r!==void 0?r:n;return i.bind(this.logger)}return function(){}},e.prototype.enable=function(t){this.logger.enable(t)},e.prototype.disable=function(){this.logger.disable()},e}(),pi="medium";function Yv(e){return e.toLowerCase()}function Xv(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Yv(t):null}function wt(e,t){return t||(e==="STAGING"?No:e==="EU"?Fo:Do)}
32var Uo=function(e,t,r){switch(t){case"light":{if(e!=="input")return!1;var n=r?Xv(r):"";return n?!!(["password","hidden","email","tel"].includes(n)||r.autocomplete.startsWith("cc-")):!1}case"medium":return e==="input";case"conservative":return!0;default:return Uo(e,pi,r)}},qo=function(e,t){var r,n,i;if(e&&t.urlMaskLevels)try{for(var s=z(t.urlMaskLevels),a=s.next();!a.done;a=s.next()){var o=a.value;if(zo(o.match).test(e))return o.maskLevel}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return(i=t.defaultMaskLevel)!==null&&i!==void 0?i:pi},$o=function(e,t,r,n){var i,s;if(t===void 0&&(t={defaultMaskLevel:pi}),r){if(r.closest("."+ko))return!0;var a=((i=t.maskSelector)!==null&&i!==void 0?i:[]).some(function(u){return r.closest(u)});if(a)return!0;if(r.closest("."+Lo))return!1;var o=((s=t.unmaskSelector)!==null&&s!==void 0?s:[]).some(function(u){return r.closest(u)});if(o)return!1}return Uo(e,qo(n,t),r)},As=function(e,t,r){return function(n,i){return $o(e,t,i,r?.())?n.replace(/[^\s]/g,"*"):n}},Qv=function(e,t){return function(r,n,i){var s;if(r==="style"||!((s=e?.maskAttributes)!==null&&s!==void 0?s:[]).includes(r))return n;var a=["INPUT","SELECT","TEXTAREA"].includes(i.tagName)?"input":"text";return $o(a,e,i,t?.())?n.replace(/[^\s]/g,"*"):n}},Ln=function(){var e=W();return e?.location?e.location.href:""},Zv=function(e,t){return"".concat(t,"/").concat(e)},Jv=function(e){if(typeof e!="string"||e.trim()==="")return!1;var t=/^\/|^https?:\/\/[^\s]+$/;return!!t.test(e)},Rs=new Map,zo=function(e){var t=Rs.get(e);if(t)return t;var r="\0TRAIL\0",n="\0MID\0",i="\0DS\0",s="\0ST\0",a="\0QU\0",o=e;o=o.replace(/\/\*\*$/,r),o=o.replace(/\/\*\*\//g,n),o=o.replace(/\*\*/g,i),o=o.replace(/\*/g,s),o=o.replace(/\?/g,a),o=o.replace(/[.+^${}()|[\]\\]/g,"\\$&"),o=o.split(r).join("(/.*)?"),o=o.split(n).join("/(.*\\/)?"),o=o.split(i).join(".*"),o=o.split(s).join(".*"),o=o.split(a).join(".");var u=new RegExp("^".concat(o,"$"));return Rs.set(e,u),u},eg=function(e){if(!e.every(function(t){return typeof t.selector=="string"&&typeof t.replacement=="string"}))throw new Error("ugcFilterRules must be an array of objects with selector and replacement properties");if(!e.every(function(t){return Jv(t.selector)}))throw new Error("ugcFilterRules must be an array of objects with valid globs")},Ir=function(e,t){var r,n;try{for(var i=z(t),s=i.next();!s.done;s=i.next()){var a=s.value,o=zo(a.selector);if(o.test(e))return e.replace(o,a.replacement)}}catch(u){r={error:u}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return e},jo=function(){return x(void 0,void 0,void 0,function(){var e,t,r,n,i,s,a;return T(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),e=W(),e?[4,e.navigator.storage.estimate()]:[3,2];case 1:return t=o.sent(),r=t.usage,n=t.quota,i=t.usageDetails,s=r?Math.round(r/On):0,a=r&&n?Math.round((r/n+Number.EPSILON)*1e3)/1e3:0,[2,{totalStorageSize:s,percentOfQuota:a,usageDetails:JSON.stringify(i)}];case 2:return[3,4];case 3:return o.sent(),[3,4];case 4:return[2,{totalStorageSize:0,percentOfQuota:0,usageDetails:""}]}})})},Vo=function(e){var t=M({},e),r=t.apiKey;return t.apiKey="****".concat(r.substring(r.length-4)),t},Ho=function(){return{flushMaxRetries:2,logLevel:ve.Warn,loggerProvider:new ur,transportProvider:new lv}},tg=function(e){fr(t,e);function t(r,n){var i=this,s,a,o,u,c,l,f,d,h,v,m,g,p,S,_=Ho();i=e.call(this,M(M({transportProvider:_.transportProvider,loggerProvider:new kn(n.loggerProvider||_.loggerProvider)},n),{apiKey:r}))||this,i.flushMaxRetries=n.flushMaxRetries!==void 0&&n.flushMaxRetries<=_.flushMaxRetries?n.flushMaxRetries:_.flushMaxRetries,i.apiKey=r,i.sampleRate=n.sampleRate||Rv,i.serverZone=n.serverZone||Mv,i.configServerUrl=n.configServerUrl,i.trackServerUrl=n.trackServerUrl,i.shouldInlineStylesheet=n.shouldInlineStylesheet,i.version=n.version,i.performanceConfig=n.performanceConfig||Ov,i.storeType=(s=n.storeType)!==null&&s!==void 0?s:"memory",i.applyBackgroundColorToBlockedElements=(a=n.applyBackgroundColorToBlockedElements)!==null&&a!==void 0?a:!1,i.enableUrlChangePolling=(o=n.enableUrlChangePolling)!==null&&o!==void 0?o:!1,i.urlChangePollingInterval=(u=n.urlChangePollingInterval)!==null&&u!==void 0?u:gi,i.captureDocumentTitle=(c=n.captureDocumentTitle)!==null&&c!==void 0?c:!1,n.fullSnapshotIntervalMs!==void 0&&(i.fullSnapshotIntervalMs=n.fullSnapshotIntervalMs),n.eagerFullSnapshotSend!==void 0&&(i.eagerFullSnapshotSend=n.eagerFullSnapshotSend),i.captureFullSnapshotOnFocus=(l=n.captureFullSnapshotOnFocus)!==null&&l!==void 0?l:!1,n.maxPersistedEventsSizeBytes!==void 0&&(i.maxPer
32sistedEventsSizeBytes=Os(n.maxPersistedEventsSizeBytes,Ms,rg,"maxPersistedEventsSizeBytes",i.loggerProvider)),n.maxSingleEventSizeBytes!==void 0&&(i.maxSingleEventSizeBytes=Os(n.maxSingleEventSizeBytes,Ms,ng,"maxSingleEventSizeBytes",i.loggerProvider)),i.privacyConfig=M(M({},(f=n.privacyConfig)!==null&&f!==void 0?f:{}),{unmaskSelector:Array.from(new Set(G([".".concat(Lo)],j((h=(d=n.privacyConfig)===null||d===void 0?void 0:d.unmaskSelector)!==null&&h!==void 0?h:[]),!1)))}),n.interactionConfig&&(i.interactionConfig=n.interactionConfig,i.interactionConfig.ugcFilterRules&&eg(i.interactionConfig.ugcFilterRules)),n.debugMode&&(i.debugMode=n.debugMode);var w=n;return i.useWebWorker=(g=(v=n.useWebWorker)!==null&&v!==void 0?v:(m=w.experimental)===null||m===void 0?void 0:m.useWebWorker)!==null&&g!==void 0?g:!0,i.enableTransportCompression=(p=n.enableTransportCompression)!==null&&p!==void 0?p:!0,i.sendTimeoutMs=n.sendTimeoutMs,i.captureAdoptedStyleSheets=(S=n.captureAdoptedStyleSheets)!==null&&S!==void 0?S:!0,n.crossOriginIframes&&(i.crossOriginIframes=n.crossOriginIframes),n.flushIntervalConfig?i.flushIntervalConfig=ig(n.flushIntervalConfig,i.loggerProvider):i.flushIntervalConfig={minIntervalMs:qv,maxIntervalMs:$v},i.handleSendEvents=n.handleSendEvents,i.handleFetchConfig=n.handleFetchConfig,i}return t}(iv),Je=100,Ms=1e3,rg=8e6,ng=1e7;function Os(e,t,r,n,i){if(!Number.isFinite(e)){i.warn("".concat(n," value is not a finite number (got ").concat(String(e),"); ignoring."));return}return e<t?(i.warn("".concat(n," ").concat(e," is below floor ").concat(t,"; clamping.")),t):e>r?(i.warn("".concat(n," ").concat(e," exceeds ceiling ").concat(r,"; clamping.")),r):e}function ig(e,t){var r,n,i={};if(e.minIntervalMs!==void 0&&(!Number.isFinite(e.minIntervalMs)||e.minIntervalMs<Je?(t.warn("flushIntervalConfig.minIntervalMs ".concat(e.minIntervalMs," is below floor ").concat(Je,"ms; clamping.")),i.minIntervalMs=Je):i.minIntervalMs=e.minIntervalMs),e.maxIntervalMs!==void 0&&(Number.isNaN(e.maxIntervalMs)||e.maxIntervalMs<Je?(t.warn("flushIntervalConfig.maxIntervalMs ".concat(e.maxIntervalMs," is below floor ").concat(Je,"ms; clamping.")),i.maxIntervalMs=Je):i.maxIntervalMs=e.maxIntervalMs),i.minIntervalMs!==void 0||i.maxIntervalMs!==void 0){var s=(r=i.minIntervalMs)!==null&&r!==void 0?r:Rn,a=(n=i.maxIntervalMs)!==null&&n!==void 0?n:Mn;a<s&&(i.maxIntervalMs===void 0?(t.warn("flushIntervalConfig.minIntervalMs (".concat(s,") exceeds the default maxIntervalMs (").concat(Mn,"); raising max to match min.")),i.maxIntervalMs=s):i.minIntervalMs===void 0?(t.warn("flushIntervalConfig.maxIntervalMs (".concat(a,") is below the default minIntervalMs (").concat(Rn,"); lowering min to match max.")),i.minIntervalMs=a):(t.warn("flushIntervalConfig.maxIntervalMs (".concat(i.maxIntervalMs,") is less than minIntervalMs (").concat(i.minIntervalMs,"); raising max to match min.")),i.maxIntervalMs=i.minIntervalMs))}return i}var Cr=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Cr||{}),mi=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(mi||{}),Wo=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(Wo||{}),sg=1500,ag=function(e,t){var r=document.createDocumentFragment(),n=function(i){if(i===void 0&&(i=[]),typeof i=="string"&&(i=[i]),i=i.filter(function(s){try{r.querySelector(s)}catch{return t.warn('[session-replay-browser] omitting selector "'.concat(s,'" because it is invali
32d')),!1}return!0}),i.length!==0)return i};return e.blockSelector=n(e.blockSelector),e.maskSelector=n(e.maskSelector),e.unmaskSelector=n(e.unmaskSelector),e},og=function(){function e(t,r){this.localConfig=r,this.remoteConfigClient=t}return e.prototype.generateJoinedConfig=function(){var t,r,n,i,s,a,o;return x(this,void 0,void 0,function(){var u,c,l,f,d,h,v,m,g,p,S,_,w,E,b,y,I,C=this;return T(this,function(A){switch(A.label){case 0:u=M({},this.localConfig),u.optOut=this.localConfig.optOut,u.captureEnabled=!0,A.label=1;case 1:return A.trys.push([1,3,,4]),[4,new Promise(function(N,F){C.remoteConfigClient.subscribe("configs.sessionReplay",{timeout:sg},function(k,D){var P;if(C.localConfig.loggerProvider.debug("Session Replay remote configuration received from ".concat(D,":"),JSON.stringify(k,null,2)),!k){F(new Error("No remote config received"));return}var R=k,L=R.sr_sampling_config,$=R.sr_privacy_config,B=R.sr_targeting_config,U=(P=u.interactionConfig)===null||P===void 0?void 0:P.ugcFilterRules;u.interactionConfig=R.sr_interaction_config,u.interactionConfig&&U&&(u.interactionConfig.ugcFilterRules=U),u.loggingConfig=R.sr_logging_config,(L||$||B)&&(c={},L&&(c.sr_sampling_config=L),$&&(c.sr_privacy_config=$),B&&(c.sr_targeting_config=B)),N()})})];case 2:return A.sent(),[3,4];case 3:return l=A.sent(),this.localConfig.loggerProvider.error("Failed to generate joined config: ",l),u.captureEnabled=!1,[2,{localConfig:this.localConfig,joinedConfig:u,remoteConfig:void 0}];case 4:if(!c)return[2,{localConfig:this.localConfig,joinedConfig:u,remoteConfig:c}];if(f=c.sr_sampling_config,d=c.sr_privacy_config,h=c.sr_targeting_config,f&&Object.keys(f).length>0?(Object.prototype.hasOwnProperty.call(f,"capture_enabled")?u.captureEnabled=f.capture_enabled:u.captureEnabled=!1,Object.prototype.hasOwnProperty.call(f,"sample_rate")&&(u.sampleRate=f.sample_rate),Object.prototype.hasOwnProperty.call(f,"min_session_duration_ms")&&(u.minSessionDurationMs=this.sanitizeMinSessionDurationMs(f.min_session_duration_ms))):(u.captureEnabled=!0,this.localConfig.loggerProvider.debug("Remote config successfully fetched, but no values set for project, Session Replay capture enabled.")),d){v=(t=u.privacyConfig)!==null&&t!==void 0?t:{},m={defaultMaskLevel:(n=(r=d.defaultMaskLevel)!==null&&r!==void 0?r:v.defaultMaskLevel)!==null&&n!==void 0?n:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[],maskAttributes:G([],j(new Set(G(G([],j((i=v.maskAttributes)!==null&&i!==void 0?i:[]),!1),j((s=d.maskAttributes)!==null&&s!==void 0?s:[]),!1))),!1),urlMaskLevels:G(G([],j((a=d.urlMaskLevels)!==null&&a!==void 0?a:[]),!1),j((o=v.urlMaskLevels)!==null&&o!==void 0?o:[]),!1)},g=function(N){var F,k,D,P,R,L,$,B,U,O={};typeof N.blockSelector=="string"&&(N.blockSelector=[N.blockSelector]);try{for(var Z=z(($=N.blockSelector)!==null&&$!==void 0?$:[]),q=Z.next();!q.done;q=Z.next()){var J=q.value;O[J]="block"}}catch(oe){F={error:oe}}finally{try{q&&!q.done&&(k=Z.return)&&k.call(Z)}finally{if(F)throw F.error}}try{for(var X=z((B=N.maskSelector)!==null&&B!==void 0?B:[]),ee=X.next();!ee.done;ee=X.next()){var J=ee.value;O[J]="mask"}}catch(oe){D={error:oe}}finally{try{ee&&!ee.done&&(P=X.return)&&P.call(X)}finally{if(D)throw D.error}}try{for(var re=z((U=N.unmaskSelector)!==null&&U!==void 0?U:[]),ae=re.next();!ae.done;ae=re.next()){var J=ae.value;O[J]="unmask"}}catch(oe){R={error:oe}}finally{try{ae&&!ae.done&&(L=re.return)&&L.call(re)}finally{if(R)throw R.error}}return O},p=M(M({},g(v)),g(d));try{for(S=z(Object.entries(p)),_=S.next();!_.done;_=S.next())w=j(_.value,2),E=w[0],b=w[1],b==="mask"?m.maskSelector.push(E):b==="block"?m.blockSelector.push(E):b==="unmask"&&m.unmaskSelector.push(E)}catch(N){y={error:N}}finally{try{_&&!_.done&&(I=S.return)&&I.call(S)}finally{if(y)throw y.error}}u.privacyConfig=ag(m,this.localConfig.loggerProvider)}return h&&Object.keys(h).length>0&&(u.targetingConfig=h),this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:Vo(u)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:u,remoteConfig:c}]}})})},e.prototype.sanitizeMinSessionDurationMs=function(t){if(typeof t!="number"||!Number.isFinite(t)){this.localConfig.loggerProvider.warn("min_session_duration_ms remote value is not a finite number (got ".concat(String(t),"); ignoring."));return}if(t<0){this.localConfig.loggerProvider.warn("min_session_duration_ms remote value is negative (".concat(t,"); ignoring."));return}return t>zr?(this.localConfig.loggerProvider.warn("min_session_duration_ms remote value ".concat(t," exceeds ").concat(zr,"ms ceiling; clamping.")),zr):t},e}(),zr=6e4,ug=function(e,t){return x(void 0,void 0,void 0,function(){var r,n;return T(this,function(i){return r=new tg(e,t),n=new yv(e,r.loggerProvider,r.serverZone,t.configServerUrl,t.handleFetchConfig),[2,new og(n,r)]})})};function ks(e){if(e.type!==Cr.IncrementalSnapshot)return!1;var t=e.data;return t.source===mi.Mutation&&!t.isAttachIframe}function cg(e){return typeof e=="object"&&e!==null}function lg(e){var t,r,n,i,s={};try{for(var a=z(e),o=a.next();!o.done;o=a.next()){var u=o.value;try{for(var c=(n=void 0,z(Object.keys(u))),l=c.next();!l.done;l=c.next()){var f=l.value;s[f]=u[f]}}catch(d){n={error:d}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}catch(d){t={error:d}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return s}function dg(e){var t,r,n=new Map;if(e.forEach(function(d,h){if(d.attributes&&"style"in d.attributes){var v=n.get(d.id);v?v.push(h):n.set(d.id,[h])}}),n.size===0)return e;var i=function(d){return e[d].attributes.style},s=new Set,a=new Map,o=function(d){if(d.length===1)return"continue";var h=-1;d.forEach(function(p,S){cg(i(p))||(h=S)});var v=[];
32if(d.forEach(function(p,S){S!==h&&(s.add(p),S>h&&v.push(p))}),v.length>0){var m=v[v.length-1],g=lg(v.map(function(p){return i(p)}));s.delete(m),a.set(m,g)}};try{for(var u=z(n.values()),c=u.next();!c.done;c=u.next()){var l=c.value;o(l)}}catch(d){t={error:d}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}if(s.size===0&&a.size===0)return e;var f=[];return e.forEach(function(d,h){var v=a.get(h);if(v!==void 0){f.push(M(M({},d),{attributes:M(M({},d.attributes),{style:v})}));return}if(!s.has(h)){f.push(d);return}var m=M({},d.attributes);delete m.style,Object.keys(m).length>0&&f.push(M(M({},d),{attributes:m}))}),f}function fg(e){var t,r,n,i,s=e[0],a=new Map,o=new Map,u=new Map,c=new Map,l=new Map;e.forEach(function(O,Z){var q,J,X,ee,re=O.data;try{for(var ae=z(re.adds),oe=ae.next();!oe.done;oe=ae.next()){var Pe=oe.value;a.has(Pe.node.id)||a.set(Pe.node.id,Z),o.set(Pe.node.id,Z),l.set(Pe.node.id,Pe.parentId)}}catch(ie){q={error:ie}}finally{try{oe&&!oe.done&&(J=ae.return)&&J.call(ae)}finally{if(q)throw q.error}}try{for(var xe=z(re.removes),Ae=xe.next();!Ae.done;Ae=xe.next()){var de=Ae.value;u.has(de.id)||u.set(de.id,Z),c.set(de.id,Z)}}catch(ie){X={error:ie}}finally{try{Ae&&!Ae.done&&(ee=xe.return)&&ee.call(xe)}finally{if(X)throw X.error}}});var f=new Set,d=new Set;try{for(var h=z(a),v=h.next();!v.done;v=h.next()){var m=j(v.value,2),g=m[0],p=m[1],S=u.get(g);if(S!==void 0){var _=o.get(g),w=c.get(g);_>=w||(p<S?f.add(g):S<p&&d.add(g))}}}catch(O){t={error:O}}finally{try{v&&!v.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}var E=new Set;if(f.size>0||d.size>0)for(var b=!0;b;){b=!1;try{for(var y=(n=void 0,z(l)),I=y.next();!I.done;I=y.next()){var C=j(I.value,2),A=C[0],N=C[1];if(!f.has(A)&&!d.has(A)&&!E.has(A)&&(f.has(N)||d.has(N)||E.has(N))){var F=u.get(A),k=a.get(A);F!==void 0&&k!==void 0&&F<k?d.add(A):F!==void 0&&k!==void 0&&F===k?E.add(A):f.add(A),b=!0}}}catch(O){n={error:O}}finally{try{I&&!I.done&&(i=y.return)&&i.call(y)}finally{if(n)throw n.error}}}var D=f.size>0||d.size>0||E.size>0,P=[];e.forEach(function(O,Z){var q,J;try{for(var X=z(O.data.removes),ee=X.next();!ee.done;ee=X.next()){var re=ee.value;f.has(re.id)||d.has(re.id)&&Z>=a.get(re.id)||E.has(re.id)&&(f.has(re.parentId)||d.has(re.parentId)||E.has(re.parentId))||P.push(re)}}catch(ae){q={error:ae}}finally{try{ee&&!ee.done&&(J=X.return)&&J.call(X)}finally{if(q)throw q.error}}});var R=e.flatMap(function(O){return O.data.adds}),L=e.flatMap(function(O){return O.data.texts}),$=e.flatMap(function(O){return O.data.attributes}),B=D?$.filter(function(O){return!f.has(O.id)&&!d.has(O.id)&&!E.has(O.id)}):$,U={source:mi.Mutation,removes:P,adds:D?R.filter(function(O){return!f.has(O.node.id)&&!d.has(O.node.id)&&!E.has(O.node.id)}):R,texts:D?L.filter(function(O){return!f.has(O.id)&&!d.has(O.id)&&!E.has(O.id)}):L,attributes:dg(B)};return M(M({},s),{data:U})}function hg(e){if(e.length<=1)return e;for(var t=[],r=0;r<e.length;){if(!ks(e[r])){t.push(e[r]),r++;continue}for(var n=r+1;n<e.length&&ks(e[n]);)n++;t.push(n>r+1?fg(e.slice(r,n)):e[r]),r=n}return t}var vg=2e3,gg=function(){function e(t,r,n,i,s){var a=this,o;this.taskQueue=[],this.pendingQueue=[],this.isProcessing=!1,this.compressEvent=function(d){var h=d,v=h.type,m=h.timestamp,g=h.delay,p=h.data;return g!=null?JSON.stringify({type:v,timestamp:m,delay:g,data:p}):JSON.stringify({type:v,timestamp:m,data:p})},this.addCompressedEventToManager=function(d,h){var v,m=new Blob([d]).size;if(m>((v=a.config.maxSingleEventSizeBytes)!==null&&v!==void 0?v:Bo)){a.config.loggerProvider.warn("Session replay event dropped: serialized size ".concat(Math.round(m/1024)," KB exceeds maximum allowed event size. If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support."));return}a.eventsManager&&a.deviceId&&a.eventsManager.addEvent({event:{type:"replay",data:d},sessionId:h,deviceId:a.deviceId})},this.addCompressedEvent=function(d,h){if(a.worker)try{a.worker.postMessage({event:d,sessionId:h})}catch(m){m.name==="DataCloneError"?a.worker.postMessage(JSON.stringify({event:d,sessionId:h})):a.config.loggerProvider.warn("Unexpected error while posting message to worker:",m)}else{var v=a.compressEvent(d);a.addCompressedEventToManager(v,h)}},this.flushQueue=function(){var d;for(a.pendingQueue.length>0&&(d=a.taskQueue).push.apply(d,G([],j(a.mergeMutationTasks(a.pendingQueue.splice(0))),!1));a.taskQueue.length>0;){var h=a.taskQueue.shift();if(h){var v=h.event,m=h.sessionId,g=a.compressEvent(v);a.addCompressedEventToManager(g,m)}}a.isProcessing=!1},this.terminate=function(){var d;(d=a.worker)===null||d===void 0||d.terminate()};var u=W();if(this.canUseIdleCallback=u&&"requestIdleCallback"in u,this.eventsManager=t,this.config=r,this.deviceId=n,this.timeout=((o=r.performanceConfig)===null||o===void 0?void 0:o.timeout)||vg,this.onFullSnapshotProcessed=s,i){r.loggerProvider.log("Enabling web worker for compression");try{var c=new Blob([i],{type:"application/javascript"}),l=URL.createObjectURL(c),f=new Worker(l);f.onerror=function(d){d.preventDefault(),r.loggerProvider.error("Worker failed, falling back to non-worker compression: ".concat(d.message," (").concat(d.filename,":").concat(d.lineno,")")),f.terminate(),a.worker=void 0},f.onmessage=function(d){var h=d.data,v=h.compressedEvent,m=h.sessionId;a.addCompressedEventToManager(v,m)},this.worker=f}catch(d){r.loggerProvider.error("Failed to create worker, falling back to non-worker compression:",d)}}}return e.prototype.scheduleIdleProcessing=function(){var t=this;this.isProcessing||(this.isProcessing=!0,requestIdleCallback(function(r){t.processQueue(r)},{timeout:this.timeout}))},e.prototype.enqueueEvent=function(t,r){var n,i,s,a;if(t.type===Cr.FullSnapshot){if(this.config.loggerProvider.debug("Processing full snapshot immediately."),this.taskQueue.length>0||this.pendingQueue.length>0){var o=G(G([],j(this.taskQueue.splice(0)),!1),j(this.mergeMutationTasks(this.pendingQueue.splice(0))),!1);try{for(var u=z(o),c=u.next();!c.done;c=u.next()){var l=c.value,f=this.compressEvent(l.event);this.addCompressedEventToManager(f,l.sessionId)}}catch(h){n={error:h}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}this.isProcessing=!1}var d=this.compressEvent(t);this.addCompressedEventToManager(d,r),(s=this.onFullSnapshotProcessed)===null||s===void 0||s.call(this);return}this.canUseIdleCallback&&(!((a=this.config.performanceConfig)===null||a===void 0)&&a.enabled)?(this.config.loggerProvider.debug("Enqueuing event for processing during idle time."),this.pendingQueue.push({event:t,sessionId:r}),this.scheduleIdleProcessing()):(this.config.loggerProvider.debug("Processing event without idle callback."),this.addCompressedEvent(t,r))},e.prototype.processQueue=function(t){var r,n=this;for(this.pendingQueue.length>0&&(r=this.taskQueue).push.apply(r,G([],j(this.mergeMutationTasks(this.pendingQueue.splice(0))),!1));this.taskQueue.length>0&&(t.timeRemaining()>0||t.didTimeout);){var i=this.taskQueue.shift();if(i){var s=i.event,a=i.sessionId;this.addCompressedEvent(s,a)}}this.taskQueue.length>0||this.pendingQueue.length>0?requestIdleCallback(function(o){n.processQueue(o)},{timeout:this.timeout}):this.isProcessing=!1},e.prototype.mergeMutationTasks=function(t){var r,n,i;if(((i=this.config.performanceConfig)===null||i===void 0?void 0:i.mergeMutations)===!1||t.length<=1)return t;for(var s=[],a=0;a<t.length;){for(var o=t[a].sessionId,u=a+1;u<t.length&&t[u].sessionId===o;)u++;var c=hg(t.slice(a,u).map(function(h){return h.event}));try{for(var l=(r=void 0,z(c)),f=l.next();!f.done;f=l.next()){var d=f.value;s.push({event:d,sessionId:o})}}catch(h){r={error:h}}finally{try{f&&!f.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}a=u}return s},e}(),pg="Unexpected error occurred",mg="Network error occurred, event batch rejected",Ls="Session replay event batch rejected due to exceeded retry count",fe="Failed to store session replay events in IndexedDB",yg="Session replay event batch not sent due to missing device ID",bg="Session replay event batch not sent due to missing api key",jr="Session replay event batch dropped: server signalled capture disabled or session out of valid range for this session",lr="1.48.2";function Sg(e,t){return x(this,void 0,void 0,function(){var r,n,i,s,a,o,u,c,l,f,d,h,v,m,g=this;return T(this,function(p){switch(p.label){case 0:return p.trys.push([0,4,,5]),r=t.CompressionStream,n=new r("gzip"),i=n.writable.getWriter(),s=n.readable.getReader(),a=[],o=function(){return x(g,void 0,void 0,function(){var S,_,w;return T(this,function(E){switch(E.label){case 0:return[4,s.read()];case 1:if(S=E.sent(),_=S.done,w=S.value,_)return[3,3];a.push(w),E.label=2;case 2:return[3,0];case 3:return[2]}})})}(),[4,i.write(new TextEncoder().encode(e))];case 1:return p.sent(),[4,i.close()];case 2:return p.sent(),[4,o];case 3:p.sent(),u=a.reduce(function(S,_){return S+_.length},0),c=new Uint8Array(u),l=0;try{for(f=z(a),d=f.next();!d.done;d=f.next())h=d.value,c.set(h,l),l+=h.length}catch(S){v={error:S}}finally{try{d&&!d.done&&(m=f.return)&&m.call(f)}finally{if(v)throw v.error}}return[2,c];case 4:return p.sent(),[2,null];case 5:return[2]}})})}var _g=256,wg=256;function Eg(e,t){return new Promise(function(r,n){var i=function(){var s=new Error("Custom session replay transport aborted by send timeout");s.name="AbortError",n(s)};t.addEventListener("abort",i,{once:!0}),e.then(function(s){t.removeEventListener("abort",i),r(s)},function(s){t.removeEventListener("abort",i),n(s)})})}var Ig=function(){function e(t){var r=t.trackServerUrl,n=t.loggerProvider,i=t.payloadBatcher,s=t.workerScript,a=t.enableTransportCompression,o=t.sendTimeoutMs,u=t.handleSendEvents,c=this;if(this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.sendIdCounter=0,this.pendingWorkerRequests=new Map,this.timedOutWorkerRequests=new Map,this.flushPauseUntilMs=0,this.mergeOnNextFlush=!1,this.coalesceNextFlush=!1,this.mergeLogFiredThisPause=!1,this.killedSessions=new Set,this.loggerProvider=n,this.payloadBatcher=i||function(h){return h},this.trackServerUrl=r,this.enableTransportCompression=a??!0,this.sendTimeoutMs=o??Vv,this.handleSendEvents=u,s
32)try{var l=new Blob([s],{type:"application/javascript"}),f=URL.createObjectURL(l),d=new Worker(f);d.onerror=function(h){var v,m;h.preventDefault(),n.error("Track destination worker failed, falling back to main-thread sending: ".concat(h.message," (").concat(h.filename,":").concat(h.lineno,")")),d.terminate(),c.worker=void 0;try{for(var g=z(c.pendingWorkerRequests),p=g.next();!p.done;p=g.next()){var S=j(p.value,2),_=S[1];_.timeout&&clearTimeout(_.timeout),n.warn("Session replay event send failed due to worker crash: ".concat(h.message)),_.resolve()}}catch(w){v={error:w}}finally{try{p&&!p.done&&(m=g.return)&&m.call(g)}finally{if(v)throw v.error}}c.pendingWorkerRequests.clear(),c.timedOutWorkerRequests.clear()},d.onmessage=function(h){var v=h.data;if(v.type==="log")n.log(v.message);else if(v.type==="warn")n.warn(v.message);else if(v.type==="payload_too_large"){var m=c.pendingWorkerRequests.get(v.id);if(m)m.timeout&&clearTimeout(m.timeout),c.handlePayloadTooLargeResponse(m.context,v.isWaf),m.resolve(),c.pendingWorkerRequests.delete(v.id);else{var g=c.timedOutWorkerRequests.get(v.id);g&&(c.timedOutWorkerRequests.delete(v.id),c.handlePayloadTooLargeResponse(g,v.isWaf))}}else if(v.type==="complete"){var p=c.pendingWorkerRequests.get(v.id);if(p)p.timeout&&clearTimeout(p.timeout),v.skipCode!==void 0&&c.applyServerDirective(p.context.sessionId,v.skipCode),c.completeRequest({context:p.context}),p.resolve(),c.pendingWorkerRequests.delete(v.id);else{var g=c.timedOutWorkerRequests.get(v.id);g&&(c.timedOutWorkerRequests.delete(v.id),v.skipCode!==void 0&&c.applyServerDirective(g.sessionId,v.skipCode),c.completeRequest({context:g}))}}else v.type==="fetch-request"&&c.handleDelegatedFetch(d,v).catch(function(S){n.warn("Failed to handle delegated session replay fetch:",S)})},this.worker=d}catch(h){n.error("Failed to create track destination worker, falling back to main-thread sending:",h)}}return e.prototype.sendEventsList=function(t){this.addToQueue(M(M({},t),{attempts:0,timeout:0}))},e.prototype.markCoalesceNextFlush=function(){this.coalesceNextFlush=!0,this.schedule(0)},e.prototype.sendBeacon=function(t){var r=this,n,i,s=t.events,a=t.sessionId,o=t.deviceId,u=t.apiKey,c=t.serverZone,l=64*1024,f=function(C){return new Blob([C]).size},d=s,h=JSON.stringify({version:2,events:d});if(f(h)>l){for(var v=0,m=d.length;v<m;){var g=Math.floor((v+m+1)/2);f(JSON.stringify({version:2,events:d.slice(0,g)}))<=l?v=g:m=g-1}d=d.slice(0,v),h=JSON.stringify({version:2,events:d}),this.loggerProvider.warn("sendBeacon payload exceeded 64 KB limit, trimmed from ".concat(s.length," to ").concat(d.length," events"))}if(d.length!==0){if(this.handleSendEvents){var p=new URLSearchParams({device_id:o,session_id:String(a),type:"replay"}),S="".concat(wt(c,this.trackServerUrl),"?").concat(p.toString()),_={"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(u)};this.loggerProvider.debug("Routing session replay exit batch (".concat(d.length," events) through custom transport for session id ").concat(a,"."));try{this.handleSendEvents({url:S,method:"POST",headers:_,body:h,keepalive:!0}).catch(function(C){r.loggerProvider.warn("Custom transport failed to send session replay exit batch:",C)})}catch(C){this.loggerProvider.warn("Custom transport threw while sending session replay exit batch:",C)}return}var w=new URLSearchParams({device_id:o,session_id:String(a),type:"replay",api_key:u}),E="".concat(wt(c,this.trackServerUrl),"?").concat(w.toString()),b=W();try{var y=new Blob([h],{type:"application/json"}),I=(i=(n=b?.navigator)===null||n===void 0?void 0:n.sendBeacon)===null||i===void 0?void 0:i.call(n,E,y);I===!1&&this.loggerProvider.warn("sendBeacon failed to queue session replay payload")}catch{}}},e.prototype.addToQueue=function(){for(var t=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r.filter(function(s){return t.killedSessions.has(s.sessionId)?(t.completeRequest({context:s,err:jr}),!1):s.attempts<(s.flushMaxRetries||0)?(s.attempts+=1,!0):(t.completeRequest({context:s,err:Ls}),!1)});i.forEach(function(s){t.queue=t.queue.concat(s),t.schedule(0)})},e.prototype.schedule=function(t){var r=this;if(!this.scheduled){var n=this.flushPauseUntilMs-Date.now(),i=n>0,s=n>t?n:t;i&&(this.mergeOnNextFlush=!0),this.scheduled=setTimeout(function(){r.flush(!0).then(function(){r.queue.length>0&&r.schedule(t)})},s)}},e.prototype.flush=function(t){return t===void 0&&(t=!1),x(this,void 0,void 0,function(){var r,n,i,s,a,o,u;return T(this,function(c){switch(c.label){case 0:r=this.queue,this.queue=[],this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),this.mergeOnNextFlush?(this.mergeOnNextFlush=!1,this.coalesceNextFlush=!1,r=this.mergeQueueAfterThrottle(r)):this.coalesceNextFlush&&(this.coalesceNextFlush=!1,r=this.mergeDrainBacklog(r)),c.label=1;case 1:c.trys.push([1,6,7,8]),n=z(r),i=n.next(),c.label=2;case 2:return i.done?[3,5]:(s=i.value,[4,this.send(s,t)]);case 3:c.sent(),c.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return a=c.sent(),o={error:a},[3,8];case 7:try{i&&!i.done&&(u=n.return)&&u.call(n)}finally{if(o)throw o.error}
32return[7];case 8:return[2]}})})},e.prototype.mergeQueueAfterThrottle=function(t){var r=this.coalesceByIdentity(t);return r.length<t.length&&!this.mergeLogFiredThisPause&&(this.mergeLogFiredThisPause=!0,this.loggerProvider.log("Session replay throttle pause ended; merged ".concat(t.length," queued batches into ").concat(r.length," request(s)"))),r},e.prototype.mergeDrainBacklog=function(t){var r=this.coalesceByIdentity(t);return r.length<t.length&&this.loggerProvider.log("Session replay coalesced ".concat(t.length," persisted page-load backlog batches into ").concat(r.length," request(s)")),r},e.prototype.coalesceByIdentity=function(t){var r,n,i,s,a=this,o,u,c,l,f,d,h;if(t.length<=1)return t;var v=new Map;try{for(var m=z(t),g=m.next();!g.done;g=m.next()){var p=g.value,S=[p.sessionId,(o=p.deviceId)!==null&&o!==void 0?o:"",(u=p.apiKey)!==null&&u!==void 0?u:"",p.type,(c=p.serverZone)!==null&&c!==void 0?c:"",p.sampleRate,(f=(l=p.version)===null||l===void 0?void 0:l.type)!==null&&f!==void 0?f:"",(h=(d=p.version)===null||d===void 0?void 0:d.version)!==null&&h!==void 0?h:""].join("|"),_=v.get(S);_?_.push(p):v.set(S,[p])}}catch(C){r={error:C}}finally{try{g&&!g.done&&(n=m.return)&&n.call(m)}finally{if(r)throw r.error}}var w=[],E=function(C){var A,N;if(C.length===1)return w.push(C[0]),"continue";var F=null,k=0,D=function(){F&&w.push(F),F=null,k=0},P=function(B){var U=B.events.reduce(function(q,J){return q+new Blob([J]).size},0);if(F===null)return F=M(M({},B),{events:G([],j(B.events),!1),attempts:0}),k=U,"continue";if(k+U>Gv)return D(),F=M(M({},B),{events:G([],j(B.events),!1),attempts:0}),k=U,"continue";var O=F.onComplete,Z=B.onComplete;F.events=F.events.concat(B.events),k+=U,F.onComplete=function(){return x(a,void 0,void 0,function(){return T(this,function(q){switch(q.label){case 0:return[4,Promise.allSettled([O(),Z()])];case 1:return q.sent(),[2]}})})}};try{for(var R=(A=void 0,z(C)),L=R.next();!L.done;L=R.next()){var $=L.value;P($)}}catch(B){A={error:B}}finally{try{L&&!L.done&&(N=R.return)&&N.call(R)}finally{if(A)throw A.error}}D()};try{for(var b=z(v.values()),y=b.next();!y.done;y=b.next()){var I=y.value;E(I)}}catch(C){i={error:C}}finally{try{y&&!y.done&&(s=b.return)&&s.call(b)}finally{if(i)throw i.error}}return w},e.prototype.send=function(t,r){return r===void 0&&(r=!0),x(this,void 0,void 0,function(){var n,i,s,a;return T(this,function(o){return this.killedSessions.has(t.sessionId)?[2,this.completeRequest({context:t,err:jr})]:(n=t.apiKey,n?(i=t.deviceId,i?(s=this.payloadBatcher({version:1,events:t.events}),s.events.length===0?(this.completeRequest({context:t}),[2]):(a=this.worker,a?[2,this.sendViaWorker(a,t,s,r)]:[2,this.sendOnMainThread(n,i,t,s,r)])):[2,this.completeRequest({context:t,err:yg})]):[2,this.completeRequest({context:t,err:bg})])})})},e.prototype.sendViaWorker=function(t,r,n,i){return x(this,void 0,void 0,function(){var s,a=this;return T(this,function(o){return s="".concat(++this.sendIdCounter),[2,new Promise(function(u){var c,l=a.sendTimeoutMs>0?setTimeout(function(){var f=a.pendingWorkerRequests.get(s);f&&(a.pendingWorkerRequests.delete(s),a.rememberTimedOutRequest(s,f.context),a.loggerProvider.warn("Session replay worker send timed out after ".concat(a.sendTimeoutMs,"ms; leaving events for retry")),f.resolve())},a.sendTimeoutMs):void 0;a.pendingWorkerRequests.set(s,{context:r,resolve:u,timeout:l}),t.postMessage({type:"send",id:s,payload:n,useRetry:i,useCustomTransport:!!a.handleSendEvents,context:{apiKey:r.apiKey,deviceId:r.deviceId,sessionId:r.sessionId,events:r.events,eventType:r.type,flushMaxRetries:(c=r.flushMaxRetries)!==null&&c!==void 0?c:0,sampleRate:r.sampleRate,serverZone:r.serverZone,trackServerUrl:a.trackServerUrl,version:r.version,currentUrl:Ln(),sdkVersion:lr,enableTransportCompression:a.enableTransportCompression,sendTimeoutMs:a.sendTimeoutMs}})})]})})},e.prototype.rememberTimedOutRequest=function(t,r){var n,i;if(this.timedOutWorkerRequests.set(t,r),this.timedOutWorkerRequests.size>wg)try{for(var s=z(this.timedOutWorkerRequests.keys()),a=s.next();!a.done;a=s.next()){var o=a.value;this.timedOutWorkerRequests.delete(o);break}}catch(u){n={error:u}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}},e.prototype.handleDelegatedFetch=function(t,r){var n,i,s;return x(this,void 0,void 0,function(){var a,o,u,c,l,f,d,h,v,m,g;return T(this,function(p){switch(p.label){case 0:a=r.requestId,o=r.url,u=r.method,c=r.headers,l=r.body,f=r.keepalive,p.label=1;case 1:return p.trys.push([1,10,,11]),d=void 0,this.handleSendEvents?[4,this.handleSendEvents({url:o,method:u,headers:c,body:l,keepalive:f})]:[3,3];case 2:return d=p.sent(),[3,5];case 3:return this.loggerProvider.warn("Delegated session replay fetch received without a custom transport configured; falling back to built-in fetch."),[4,fetch(o,{method:u,headers:c,body:l,keepalive:f})];case 4:d=p.sent(),p.label=5;case 5:if(h=d.status,v=null,m="",h>=200&&h<300&&(v=(s=(i=(n=d.headers)===null||n===void 0?void 0:n.get)===null||i===void 0?void 0:i.call(n,Ps))!==null&&s!==void 0?s:null),h!==413)return[3,9];p.label=6;case 6:return p.trys.push([6,8,,9]),[4,d.text()];case 7:return m=p.sent(),[3,9];case 8:return p.sent(),[3,9];case 9:return this.loggerProvider.debug("Delegated session replay fetch (request ".concat(a,") returned status ").concat(h,".")),t.postMessage({type:"fetch-response",requestId:a,status:h,skipHeader:v,body:m}),[3,11];case 10:return g=p.sent(),this.loggerProvider.debug("Delegated session replay fetch (request ".concat(a,") failed:"),g),t.postMessage({type:"fetch-response",requestId:a,status:0,skipHeader:null,body:String(g),error:!0}),[3,11];case 11:return[2]}})})},e.prototype.sendOnMainThread=function(t,r,n,i,s){var a,o,u,c,l,f,d;return x(this,void 0,void 0,function(){var h,v,m,g,p,S,_,w,E,b,y,I,C,A,N,F,k,D,P,R,L,L,$,B;return T(this,function(U){switch(U.label){case 0:h=Ln(),v=lr,m=n.sampleRate,g=new 
32URLSearchParams({device_id:r,session_id:"".concat(n.sessionId),type:"".concat(n.type)}),p="".concat((o=(a=n.version)===null||a===void 0?void 0:a.type)!==null&&o!==void 0?o:"standalone","/").concat((c=(u=n.version)===null||u===void 0?void 0:u.version)!==null&&c!==void 0?c:v),U.label=1;case 1:return U.trys.push([1,19,,23]),S=JSON.stringify(i),_=W(),this.enableTransportCompression&&_&&"CompressionStream"in _?[4,Sg(S,_)]:[3,3];case 2:return E=U.sent(),[3,4];case 3:E=null,U.label=4;case 4:if(w=E,b=w?w.byteLength:new Blob([S]).size,y=new AbortController,I=M({"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(t),"X-Client-Version":v,"X-Client-Library":p,"X-Client-Url":h.substring(0,zv),"X-Client-Sample-Rate":"".concat(m),"X-Sampling-Hash-Alg":"xxhash32"},w?{"Content-Encoding":"gzip"}:{}),C=w??S,A=b<=jv,N={headers:I,body:C,method:"POST",keepalive:A,signal:y.signal},F="".concat(wt(n.serverZone,this.trackServerUrl),"?").concat(g.toString()),i.events.length===0)return this.completeRequest({context:n}),[2];k=this.sendTimeoutMs>0?setTimeout(function(){y.abort()},this.sendTimeoutMs):void 0,D=void 0,U.label=5;case 5:return U.trys.push([5,,10,11]),this.handleSendEvents?[4,Eg(this.handleSendEvents({url:F,method:"POST",headers:I,body:C,keepalive:A}),y.signal)]:[3,7];case 6:return P=U.sent(),[3,9];case 7:return[4,fetch(F,N)];case 8:P=U.sent(),U.label=9;case 9:return D=P,[3,11];case 10:return k&&clearTimeout(k),[7];case 11:if(D===null)return this.completeRequest({context:n,err:pg}),[2];if(D.status>=200&&D.status<300&&(R=(d=(f=(l=D.headers)===null||l===void 0?void 0:l.get)===null||f===void 0?void 0:f.call(l,Ps))!==null&&d!==void 0?d:null,this.applyServerDirective(n.sessionId,R)),s)return[3,12];L="";try{L=JSON.stringify(D.body,null,2)}catch{}return this.completeRequest({context:n,success:"".concat(D.status,": ").concat(L)}),[3,18];case 12:if(L="",D.status!==413)return[3,16];U.label=13;case 13:return U.trys.push([13,15,,16]),[4,D.text()];case 14:return L=U.sent(),[3,16];case 15:return U.sent(),[3,16];case 16:return[4,this.handleReponse(D.status,n,L)];case 17:U.sent(),U.label=18;case 18:return[3,23];case 19:return $=U.sent(),B=!!$&&typeof $=="object"&&$.name==="AbortError",B&&s?[4,this.handleOtherResponse(n)]:[3,21];case 20:return U.sent(),[3,22];case 21:this.completeRequest({context:n,err:$}),U.label=22;case 22:return[3,23];case 23:return[2]}})})},e.prototype.handleReponse=function(t,r,n){return n===void 0&&(n=""),x(this,void 0,void 0,function(){var i,s;return T(this,function(a){switch(a.label){case 0:switch(i=new Ro().buildStatus(t),s=i,s){case ne.Success:return[3,1];case ne.Failed:return[3,2];case ne.Timeout:return[3,2];case ne.RateLimit:return[3,2];case ne.PayloadTooLarge:return[3,4]}return[3,5];case 1:return this.handleSuccessResponse(r),[3,8];case 2:return[4,this.handleOtherResponse(r)];case 3:return a.sent(),[3,8];case 4:return this.handlePayloadTooLargeResponse(r,Nv.test(n)),[3,8];case 5:return t!==499?[3,7]:[4,this.handleOtherResponse(r)];case 6:return a.sent(),[3,8];case 7:this.completeRequest({context:r,err:mg}),a.label=8;case 8:return[2]}})})},e.prototype.handlePayloadTooLargeResponse=function(t,r){var n=r?"WAF (compressed payload too large)":"server (event too large)",i=Math.round(t.events.reduce(function(o,u){return o+u.length},0)/On);if(!r){this.completeRequest({context:t,err:"Session replay event batch dropped: ".concat(n," rejected payload (").concat(t.events.length," events, ").concat(i," KB) — not retrying non-WAF 413")});return}if(t.events.length===1){this.completeRequest({context:t,err:"Session replay event dropped: single event (".concat(i," KB, 1 event) rejected by ").concat(n," — cannot split further")});return}this.loggerProvider.warn("Session replay event batch rejected by ".concat(n," (").concat(t.events.length," events, ").concat(i," KB total) — splitting and retrying")),t.onComplete();var s=function(){return Promise.resolve()},a=Math.floor(t.events.length/2);this.sendEventsList(M(M({},t),{events:t.events.slice(0,a),onComplete:s})),this.sendEventsList(M(M({},t),{events:t.events.slice(a),onComplete:s}))},e.prototype.handleSuccessResponse=function(t){var r=Math.round(new Blob(t.events).size/On);this.completeRequest({context:t,success:"Session replay event batch tracked successfully for session id ".concat(t.sessionId,", size of events: ").concat(r," KB")})},e.prototype.handleOtherResponse=function(t){return x(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return r=Math.random()*t.attempts*this.retryTimeout,t.attempts++,t.attempts>(t.flushMaxRetries||0)?(this.completeRequest({context:t,err:Ls}),[2]):[4,new Promise(function(i){return setTimeout(i,r)})];case 1:return n.sent(),[4,this.send(t,!0)];case 2:return n.sent(),[2]}})})},e.prototype.completeRequest=function(t){var r=t.context,n=t.err,i=t.success;r.onComplete(),n?this.loggerProvider.warn(n):i&&this.loggerProvider.log(i)},e.prototype.applyServerDirective=function(t,r){if(r===null){this.flushPauseUntilMs=0,this.mergeLogFiredThisPause=!1;return}if(r===Hv){var n=this.flushPauseUntilMs>Date.now();this.flushPauseUntilMs=Date.now()+xs,n||this.loggerProvider.log("Session replay throttled by server; pausing flush schedule for ".concat(xs/1e3,"s"));return}(r===Kv||r===Wv)&&this.killSession(t,r)},e.prototype.killSession=function(t,r){var n,i,s,a;if(!this.killedSessions.has(t)){if(this.killedSessions.add(t),this.killedSessions.size>_g)try{for(var o=z(this.killedSessions),u=o.next();!u.done;u=o.next()){var c=u.value;this.killedSessions.delete(c);break}}catch(v){n={error:v}}finally{try{u&&!u.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}this.loggerProvider.log("Session replay capture stopped for session ".concat(t," by server directive ").concat(r,"; remaining events will be dropped"));var l=[];try{for(var f=z(this.queue),d=f.next();!d.done;d=f.next()){var h=d.value;h.sessionId===t?this.completeRequest({context:h,err:jr}):l.push(h)}}catch(v){s={error:v}}finally{try{d&&!d.done&&(a=f.return)&&a.call(f)}finally{if(s)throw s.error}}this.queue=l}},e}();const Dn=(e,t)=>t.some(r=>e instanceof r);let Ds,Fs;function Cg(){return Ds||(Ds=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Tg(){return Fs||(Fs=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Fn=new WeakMap,Vr=new WeakMap,Tr=new WeakMap;function Pg(e){const t=new Promise((r,n)=>{const i=()=>{e.removeEventListener("success",s),e.removeEventListener("error",a)},s=()=>{r(Ge(e.result)),i()},a=()=>{n(e.error),i()};e.addEventListener("success",s),e.addEventListener("error",a)});return Tr.set(t,e),t}function xg(e){if(Fn.has(e))return;const t=new Promise((r,n)=>{const i=()=>{e.removeEventListener("complete",s),e.removeEventListener("error",a),e.removeEventListener("abort",a)},s=()=>{r(),i()},a=()=>{n(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",s),e.addEventListener("error",a),e.addEventListener("abort",a)});Fn.set(e,t)}let Nn={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return Fn.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Ge(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function Ko(e){Nn=e(Nn)}function Ag(e){return Tg().includes(e)?function(...t){return e.apply(Bn(this),t),Ge(this.request)}:function(...t){return Ge(e.apply(Bn(this),t))}}function Rg(e){return typeof e=="function"?Ag(e):(e instanceof IDBTransaction&&xg(e),Dn(e,Cg())?new Proxy(e,Nn):e)}function Ge(e){if(e instanceof IDBRequest)return Pg(e);if(Vr.has(e))return Vr.get(e);const t=Rg(e);return t!==e&&(Vr.set(e,t),Tr.set(t,e)),t}const Bn=e=>Tr.get(e);function Go(e,t,{blocked:r,upgrade:n,blocking:i,terminated:s}={}){const a=indexedDB.open(e,t),o=Ge(a);return n&&a.addEventListener("upgradeneeded",u=>{n(Ge(a.result),u.oldVersion,u.newVersion,Ge(a.transaction),u)}),r&&a.addEventListener("blocked",u=>r(u.oldVersion,u.newVersion,u)),o.then(u=>{s&&u.addEventListener("close",()=>s()),i&&u.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),o}const Mg=["get","getKey","getAll","getAllKeys","count"],Og=["put","add","delete","clear"],Hr=new Map;function Ns(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Hr.get(t))return Hr.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,i=Og.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(i||Mg.includes(r)))return;const s=async function(a,...o){const u=this.transaction(a,i?"readwrite":"readonly");let c=u.store;
32return n&&(c=c.index(o.shift())),(await Promise.all([c[r](...o),i&&u.done]))[0]};return Hr.set(t,s),s}Ko(e=>({...e,get:(t,r,n)=>Ns(t,r)||e.get(t,r,n),has:(t,r)=>!!Ns(t,r)||e.has(t,r)}));const kg=["continue","continuePrimaryKey","advance"],Bs={},Un=new WeakMap,Yo=new WeakMap,Lg={get(e,t){if(!kg.includes(t))return e[t];let r=Bs[t];return r||(r=Bs[t]=function(...n){Un.set(this,Yo.get(this)[t](...n))}),r}};async function*Dg(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;t=t;const r=new Proxy(t,Lg);for(Yo.set(r,t),Tr.set(r,Bn(t));t;)yield r,t=await(Un.get(r)||t.continue()),Un.delete(r)}function Us(e,t){return t===Symbol.asyncIterator&&Dn(e,[IDBIndex,IDBObjectStore,IDBCursor])||t==="iterate"&&Dn(e,[IDBIndex,IDBObjectStore])}Ko(e=>({...e,get(t,r,n){return Us(t,r)?Dg:e.get(t,r,n)},has(t,r){return Us(t,r)||e.has(t,r)}}));var Xo=function(){function e(t){var r=this,n,i,s;this.minInterval=Rn,this.maxInterval=Mn,this.maxPersistedEventsSize=Fv,this._timeAtLastSplit=Date.now(),this.shouldSplitEventsList=function(a,o){var u=r.getStringSize(o),c=r.getEventsArraySize(a);return c+u>=r.maxPersistedEventsSize?!0:Date.now()-r.timeAtLastSplit>r.interval&&a.length?(r.interval=Math.min(r.maxInterval,r.interval+r.minInterval),r._timeAtLastSplit=Date.now(),!0):!1},this.loggerProvider=t.loggerProvider,this.minInterval=(n=t.minInterval)!==null&&n!==void 0?n:this.minInterval,this.maxInterval=(i=t.maxInterval)!==null&&i!==void 0?i:this.maxInterval,this.maxPersistedEventsSize=(s=t.maxPersistedEventsSize)!==null&&s!==void 0?s:this.maxPersistedEventsSize,this.interval=this.minInterval}return Object.defineProperty(e.prototype,"timeAtLastSplit",{get:function(){return this._timeAtLastSplit},enumerable:!1,configurable:!0}),e.prototype.getStringSize=function(t){for(var r=0,n=0;n<t.length;n++){var i=t.charCodeAt(n);if(i<=127)r++;else if(i<=2047)r+=2;else if(i>=55296&&i<=56319){var s=n+1<t.length?t.charCodeAt(n+1):NaN;s>=56320&&s<=57343?(r+=4,n++):r+=3}else i>=56320&&i<=57343,r+=3}return r},e.prototype.getEventsArraySize=function(t){var r,n,i=0;try{for(var s=z(t),a=s.next();!a.done;a=s.next()){var o=a.value;i+=this.getStringSize(o)}}catch(c){r={error:c}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}var u=2+Math.max(0,t.length-1)+t.length*2;return i+u},e}(),Fg=function(e){return typeof e=="object"&&e!==null&&e.name==="AbortError"},ue=function(e,t,r){Fg(r)?e.debug(t):e.warn(t)};function Ng(){try{return crypto.randomUUID()}catch{return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=Math.random()*16|0;return(t==="x"?r:r&3|8).toString(16)})}}var he="sessionCurrentSequence",Ie="sequencesToSend",Bg=2e3,Wr=5e3;function Ug(e,t,r){return new Promise(function(n,i){var s=setTimeout(function(){return i(new Error("".concat(r," after ").concat(t,"ms")))},t);e.then(function(a){clearTimeout(s),n(a)},function(a){clearTimeout(s),i(a)})})}function Kr(e,t,r){var n=setTimeout(r,t);return e.then(function(){return clearTimeout(n)},function(){return clearTimeout(n)}),function(){return clearTimeout(n)}}var qg=function(e){var t,r;return e.objectStoreNames.contains(he)||(r=e.createObjectStore(he,{keyPath:"sessionId"})),e.objectStoreNames.contains(Ie)||(t=e.createObjectStore(Ie,{keyPath:"sequenceId",autoIncrement:!0}),t.createIndex("sessionId","sessionId")),{sequencesStore:t,currentSequenceStore:r}},$g=function(e){return x(void 0,void 0,void 0,function(){return T(this,function(t){switch(t.label){case 0:return[4,Ug(Go(e,1,{upgrade:qg}),Bg,"IDB openDB timed out")];case 1:return[2,t.sent()]}})})},zg=function(e){fr(t,e);function t(r){var n=this,i;return n=e.call(this,r)||this,n.consecutiveFailures=0,n.hasTriggeredFallback=!1,n.emptyFilteredCount=0,n.getSequencesToSend=function(){return x(n,void 0,void 0,function(){var s,a,o,u,c,l,f,d,h,v,m=this;return T(this,function(g){switch(g.label){case 0:s=!1,a=!1,g.label=1;case 1:return g.trys.push([1,9,,10]),o=[],u=this.db.transaction("sequencesToSend","readwrite"),u.done.catch(function(p){!s&&!a&&(ue(m.loggerProvider,"".concat(fe,": ").concat(p),p),m.recordFailure())}),c=Kr(u.done,Wr,function(){!s&&!a&&(a=!0,ue(m.loggerProvider,"".concat(fe,": transaction timed out")),m.recordFailure())}),[4,u.store.openCursor()];case 2:l=g.sent(),g.label=3;case 3:return l?(f=l.value,d=f.sessionId,h=f.events,h.length!==0?[3,5]:(this.maybeLogEmptyFiltered("getSequencesToSend"),[4,l.delete()])):[3,8];case 4:return g.sent(),[3,6];case 5:o.push({events:h,sequenceId:l.key,sessionId:d}),g.label=6;case 6:return[4,l.continue()];case 7:return l=g.sent(),[3,3];case 8:return this.recordSuccess(),c(),[2,o];case 9:return v=g.sent(),a||(s=!0,ue(this.loggerProvider,"".concat(fe,": ").concat(v),v),this.recordFailure()),[3,10];case 10:return[2,void 0]}})})},n.storeCurrentSequence=function(s){return x(n,void 0,void 0,function(){var a,o,u,c,l,f,d,h,v=this;return T(this,function(m){switch(m.label){case 0:a=!1,o=!1,m.label=1;case 1:return m.trys.push([1,5,,6]),u=this.db.transaction([he,Ie],"readwrite"),u.done.catch(function(g){!a&&!o&&(ue(v.loggerProvider,"".concat(fe,": ").concat(g),g),v.recordFailure())}),c=Kr(u.done,Wr,function(){!a&&!o&&(o=!0,ue(v.loggerProvider,"".concat(fe,": transaction timed out")),v.recordFailure())}),[4,u.objectStore(he).get(s)];case 2:return l=m.sent(),!l||l.tabId&&l.tabId!==this.tabId?(c(),[2,void 0]):l.events.length===0?(this.maybeLogEmptyFiltered("storeCurrentSequence"),c(),[2,void 0]):[4,u.objectStore(Ie).put({sessionId:s,events:l.events,tabId:this.tabId})];case 3:return f=m.sent(),[4,u.objectStore(he).put({sessionId:s,events:[],tabId:this.tabId})];case 4:return m.sent(),this.recordSuccess(),c(),l.tabId,d=Rr(l,["tabId"]),[2,M(M({},d),{sessionId:s,sequenceId:f})];case 5:return h=m.sent(),o||(a=!0,ue(this.loggerProvider,"".concat(fe,": ").concat(h),h),this.recordFailure()),[3,6];case 6:return[2,void 0]}})})},n.addEventToCurrentSequence=function(s,a){return x(n,void 0,void 0,function(){var o,u,c,l,f,d,h,v,m,g=this;return T(this,function(p){switch(p.label){case 0:o=!1,u=!1,p.label=1;case 1:return p.trys.push([1,15,,16]),c=this.db.transaction([he,Ie],"readwrite"),c.done.catch(function(S){!o&&!u&&(ue(g.loggerProvider,"".concat(fe,": ").concat(S),S),g.recordFailure())}),l=Kr(c.done,Wr,function(){!o&&!u&&(u=!0,ue(g.loggerProvider,"".concat(fe,": transaction timed out")),g.recordFailure())}),[4,c.objectStore(he).get(s)];case 2:return f=p.sent(),f?.tabId&&f.tabId!==this.tabId?f.events.length>0?[4,c.objectStore(Ie).put({sessionId:s,events:f.events,tabId:f.tabId})]:[3,4]:[3,6];case 3:p.sent(),p.label=4;case 4:return[4,c.objectStore(he).put({sessionId:s,events:[a],tabId:this.tabId})];case 5:return p.sent(),this.recordSuccess(),l(),[2,void 0];case 6:return d=f,d?[3,8]:[4,c.objectStore(he).put({sessionId:s,events:[a],tabId:this.tabId})];case 7:return p.sent(),this.recordSuccess(),l(),[2,void 0];case 8:return this.shouldSplitEventsList(d.events,a)?[3,10]:[4,c.objectStore(he).put({sessionId:s,events:d.events.concat(a),tabId:this.tabId})];case 9:return p.sent(),this.recordSuccess(),l(),[2,void 0];case 10:return h=d.events,h.length!==0?[3,12]:(this.maybeLogEmptyFiltered("addEventToCurrentSequence"),[4,c.objectStore(he).put({sessionId:s,events:[a],tabId:this.tabId})]);case 11:return p.sent(),this.recordSuccess(),l(),[2,void 0];case 12:return[4,c.objectStore(he).put({sessionId:s,events:[a],tabId:this.tabId})];case 13:return p.sent(),[4,c.objectStore(Ie).put({sessionId:s,events:h,tabId:this.tabId})];case 14:return v=p.sent(),this.recordSuccess(),l(),[2,{events:h,sessionId:s,sequenceId:v}];case 15:return m=p.sent(),u||(o=!0,ue(this.loggerProvider,"".concat(fe,": ").concat(m),m),this.recordFailure()),[3,16];case 16:return[2,void 0]}})})},n.storeSendingEvents=function(s,a){return x(n,void 0,void 0,function(){var o,u;return T(this,function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),[4,this.db.put(Ie,{sessionId:s,events:a,tabId:this.tabId})];case 1:return o=c.sent(),this.recordSuccess(),[2,o];case 2:return u=c.sent(),ue(this.loggerProvider,"".concat(fe,": ").concat(u),u),this.recordFailure(),[3,3];case 3:return[2,void 0]}})})},n.cleanUpSessionEventsStore=function(s,a){return x(n,void 0,void 0,function(){var o;return T(this,function(u){switch(u.label){case 0:if(!a)return[2];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.db.delete(Ie,a)];case 2:return u.sent(),this.recordSuccess(),[3,4];case 3:return o=u.sent(),ue(this.loggerProvider,"".concat(fe,": ").concat(o),o),this.recordFailure(),[3,4];case 4:return[2]}})})},n.db=r.db,n.tabId=r.tabId,n.onPersistentFailure=r.onPersistentFailure,n.consecutiveFailureThreshold=(i=r.consecutiveFailureThreshold)!==null&&i!==void 0?i:1,n}return t.prototype.maybeLogEmptyFiltered=function(r){this.emptyFilteredCount++%100===0&&this.loggerProvider.debug("Filtered empty session replay sequence at ".concat(r," (idb store)"))},t.prototype.recordFailure=function(){var r;this.consecutiveFailures++,!this.hasTriggeredFallback&&this.consecutiveFailures>=this.consecutiveFailureThreshold&&(this.hasTriggeredFallback=!0,(r=this.onPersistentFailure)===null||r===void 0||r.call(this))},t.prototype.recordSuccess=function(){this.consecutiveFailures=0},t.new=function(r,n){var i;return x(this,void 0,void 0,function(){var s,a,o,u,c;return T(this,function(l){switch(l.label){case 0:return l.trys.push([0,2,,3]),s=r==="replay"?"":"_".concat(r),a="".concat(n.apiKey.substring(0,10),"_amp_session_replay_events").concat(s),[4,$g(a)];case 1:return o=l.sent(),u=(i=n.tabId)!==null&&i!==void 0?i:Ng(),[2,new t(M(M({},n),{db:o,tabId:u}))];case 2:return c=l.sent(),ue(n.loggerProvider,"".concat(fe,": ").concat(c),c),[3,3];case 3:return[2]}})})},t.prototype.getCurrentSequenceEvents=function(r){return x(this,void 0,void 0,function(){var a,o,n,i,s,a,o,u,c,l;return T(this,function(f){switch(f.label){case 0:return r?[4,this.db.get("sessionCurrentSequence",r)]:[3,2];case 1:return a=f.sent(),a?a.tabId&&a.tabId!==this.tabId?[2,void 0]:(a.tabId,o=Rr(a,["tabId"]),[2,[o]]):[2,void 0];case 2:n=[],f.label=3;case 3:return f.trys.push([3,8,9,10]),[4,this.db.getAll("sessionCurrentSequence")];case 4:i=z.apply(void 0,[f.sent()]),s=i.next(),f.label=5;case 5:if(s.done)return[3,7];if(a=s.value,a.tabId&&a.tabId!==this.tabId)return[3,6];a.tabId,o=Rr(a,["tabId"]),n.push(o),f.label=6;case 6:return s=i.next(),[3,5];case 7:return[3,10];case 8:return u=f.sent(),c={error:u},[3,10];case 9:try{s&&!s.done&&(l=i.return)&&l.call(i)}finally{if(c)throw c.error}
32return[7];case 10:return[2,n]}})})},t}(Xo),jg=function(e){fr(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.finalizedSequences={},r.sequences={},r.sequenceId=0,r.emptyFilteredCount=0,r}return t.prototype.resetCurrentSequence=function(r){this.sequences[r]=[]},t.prototype.addSequence=function(r){var n=this.sequenceId++,i=G([],j(this.sequences[r]),!1);return this.finalizedSequences[n]={sessionId:r,events:i},this.resetCurrentSequence(r),{sequenceId:n,events:i,sessionId:r}},t.prototype.maybeLogEmptyFiltered=function(r){this.emptyFilteredCount++%100===0&&this.loggerProvider.debug("Filtered empty session replay sequence at ".concat(r," (in-memory store)"))},t.prototype.getSequencesToSend=function(){return x(this,void 0,void 0,function(){var r,n,i,s,a,o,u,c,l,f;return T(this,function(d){r=[];try{for(n=z(Object.entries(this.finalizedSequences)),i=n.next();!i.done;i=n.next()){if(s=j(i.value,2),a=s[0],o=s[1],u=o.sessionId,c=o.events,c.length===0){this.maybeLogEmptyFiltered("getSequencesToSend"),delete this.finalizedSequences[Number(a)];continue}r.push({sequenceId:Number(a),sessionId:u,events:c})}}catch(h){l={error:h}}finally{try{i&&!i.done&&(f=n.return)&&f.call(n)}finally{if(l)throw l.error}}return[2,r]})})},t.prototype.storeCurrentSequence=function(r){return x(this,void 0,void 0,function(){var n;return T(this,function(i){return n=this.sequences[r],n?n.length===0?(this.maybeLogEmptyFiltered("storeCurrentSequence"),[2,void 0]):[2,this.addSequence(r)]:[2,void 0]})})},t.prototype.addEventToCurrentSequence=function(r,n){return x(this,void 0,void 0,function(){var i;return T(this,function(s){return this.sequences[r]||this.resetCurrentSequence(r),this.shouldSplitEventsList(this.sequences[r],n)&&(this.sequences[r].length===0?this.maybeLogEmptyFiltered("addEventToCurrentSequence"):i=this.addSequence(r)),this.sequences[r].push(n),[2,i]})})},t.prototype.storeSendingEvents=function(r,n){return x(this,void 0,void 0,function(){return T(this,function(i){return this.finalizedSequences[this.sequenceId]={sessionId:r,events:n},[2,this.sequenceId++]})})},t.prototype.cleanUpSessionEventsStore=function(r,n){return x(this,void 0,void 0,function(){return T(this,function(i){return n!==void 0&&delete this.finalizedSequences[n],[2]})})},t}(Xo),qs=function(e){var t=e.config,r=e.minInterval,n=e.maxInterval,i=e.maxPersistedEventsSize,s=e.type,a=e.payloadBatcher,o=e.storeType,u=e.trackDestinationWorkerScript,c=e.shouldSend;return x(void 0,void 0,void 0,function(){function l(D){return D===void 0&&(D=!1),x(this,void 0,void 0,function(){return T(this,function(P){return[2,d.flush(D)]})})}var f,d,h,v,m,g,p,S,_,w,E,b,y,I,C,A,N,F,k;return T(this,function(D){switch(D.label){case 0:return f=(k=t.maxSingleEventSizeBytes)!==null&&k!==void 0?k:Bo,d=new Ig(M(M({},t),{loggerProvider:t.loggerProvider,payloadBatcher:a,workerScript:u})),h=function(){return new jg({loggerProvider:t.loggerProvider,maxInterval:n,minInterval:r,maxPersistedEventsSize:i})},m=!1,p=function(){return x(void 0,void 0,void 0,function(){var P,R,L;return T(this,function($){switch($.label){case 0:return m?(m=!1,t.loggerProvider.warn("IDB store is experiencing repeated failures; falling back to in-memory event store."),v?[4,g.getSequencesToSend()]:[3,2]):[2];case 1:return R=$.sent(),[3,3];case 2:R=void 0,$.label=3;case 3:return P=R,g=h(),P&&v&&(L=v,P.forEach(function(B){y({sequenceId:B.sequenceId,events:B.events,sessionId:B.sessionId,deviceId:L})})),[2]}})})},S=function(){return x(void 0,void 0,void 0,function(){var P;return T(this,function(R){switch(R.label){case 0:return[4,zg.new(s,{loggerProvider:t.loggerProvider,minInterval:r,maxInterval:n,maxPersistedEventsSize:i,apiKey:t.apiKey,onPersistentFailure:function(){p()}})];case 1:return P=R.sent(),P?(m=!0,[2,P]):(t.loggerProvider.log("Failed to initialize idb store, falling back to memory store."),[2,h()])}})})},o!=="idb"?[3,2]:[4,S()];case 1:return _=D.sent(),[3,3];case 2:_=h(),D.label=3;case 3:return g=_,w=[],E=0,b=function(P){if(!(P<=E)){var R=Math.min(P-E,w.length);R>0&&(w.splice(0,R),E=P)}},y=function(P){var R=P.events,L=P.sessionId,$=P.deviceId,B=P.sequenceId,U=R.map(function(q){return{event:q,bytes:new Blob([q]).size}}
32),O=U.filter(function(q){return q.bytes>f});O.length>0&&t.loggerProvider.warn("Dropping ".concat(O.length," oversized event(s) from session replay sequence before send. Sizes: ").concat(O.map(function(q){return"".concat(Math.round(q.bytes/1024)," KB")}).join(", "),". If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support."));var Z=O.length>0?U.filter(function(q){return q.bytes<=f}).map(function(q){return q.event}):R;if(Z.length===0){g.cleanUpSessionEventsStore(L,B).catch(function(q){t.loggerProvider.warn("Failed to clean up session replay events store:",q)});return}t.debugMode&&jo().then(function(q){var J=q.totalStorageSize,X=q.percentOfQuota,ee=q.usageDetails;t.loggerProvider.debug("Total storage size: ".concat(J," KB, percentage of quota: ").concat(X,"%, usage details: ").concat(ee))}).catch(function(){}),d.sendEventsList({events:Z,sessionId:L,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:$,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:s,onComplete:function(){return x(void 0,void 0,void 0,function(){return T(this,function(q){switch(q.label){case 0:return[4,g.cleanUpSessionEventsStore(L,B)];case 1:return q.sent(),[2]}})})}})},I=function(P){var R=P.sessionId,L=P.deviceId;if(v=L,!(c&&!c())){var $=E+w.length;g.storeCurrentSequence(R).then(function(B){B&&(b($),y({sequenceId:B.sequenceId,events:B.events,sessionId:B.sessionId,deviceId:L}))}).catch(function(B){t.loggerProvider.warn("Failed to get current sequence of session replay events for session:",B)})}},C=function(P){var R=P.deviceId;return x(void 0,void 0,void 0,function(){var L;return T(this,function($){switch($.label){case 0:return v=R,[4,g.getSequencesToSend()];case 1:return L=$.sent(),L?.length?(t.loggerProvider.log("Draining ".concat(L.length," stored sequence(s) from previous session.")),L.length>
vendor: 7,952 bytes, line 32
321&&d.markCoalesceNextFlush(),L.forEach(function(B){y({sequenceId:B.sequenceId,events:B.events,sessionId:B.sessionId,deviceId:R})}),[2]):[2]}})})},A=function(P){var R=P.event,L=P.sessionId,$=P.deviceId;v=$;var B=!c||c(),U=E+w.length;w.push(R.data),g.addEventToCurrentSequence(L,R.data).then(function(O){if(O){if(!B){g.cleanUpSessionEventsStore(O.sessionId,O.sequenceId).catch(function(Z){t.loggerProvider.warn("Failed to clean up dropped session replay sequence:",Z)}),b(U);return}b(U),y({sequenceId:O.sequenceId,events:O.events,sessionId:O.sessionId,deviceId:$})}}).catch(function(O){t.loggerProvider.warn("Failed to add event to session replay capture:",O)})},N=function(){return G([],j(w),!1)},F=function(){b(E+w.length)},[2,{sendCurrentSequenceEvents:I,addEvent:A,sendStoredEvents:C,flush:l,getBeaconEvents:N,dropPendingBeaconEvents:F,trackDestination:d}]}})})},$s=function(){function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=new Map;t.forEach(function(i){n.set(i.name,i.manager)}),this.managers=n}return e.prototype.sendStoredEvents=function(t){return x(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return r=[],this.managers.forEach(function(i){r.push(i.sendStoredEvents(t))}),[4,Promise.all(r)];case 1:return n.sent(),[2]}})})},e.prototype.addEvent=function(t){var r,n=t.sessionId,i=t.event,s=t.deviceId;(r=this.managers.get(i.type))===null||r===void 0||r.addEvent({sessionId:n,event:i,deviceId:s})},e.prototype.sendCurrentSequenceEvents=function(t){var r=t.sessionId,n=t.deviceId;this.managers.forEach(function(i){i.sendCurrentSequenceEvents({sessionId:r,deviceId:n})})},e.prototype.flush=function(t){return x(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return r=[],this.managers.forEach(function(i){r.push(i.flush(t))}),[4,Promise.all(r)];case 1:return n.sent(),[2]}})})},e}(),pe,yi,Qo;function Vg(e,t){if(Qo=new Date,e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(e.tagName.toLowerCase()==="html")return"html";var r={root:document.body,idName:function(s){return!0},className:function(s){return!0},tagName:function(s){return!0},attr:function(s,a){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4,timeoutMs:void 0};pe=M(M({},r),t),yi=Hg(pe.root,r);var n=Ut(e,"all",function(){return Ut(e,"two",function(){return Ut(e,"one",function(){return Ut(e,"none")})})});if(n){var i=eu(tu(n,e));return i.length>0&&(n=i[0]),Pr(n)}else throw new Error("Selector was not found.")}function Hg(e,t){return e.nodeType===Node.DOCUMENT_NODE?e:e===t.root?e.ownerDocument:e}function Ut(e,t,r){for(var n=null,i=[],s=e,a=0,o=function(){var c,l,f=new Date().getTime()-Qo.getTime();if(pe.timeoutMs!==void 0&&f>pe.timeoutMs)throw new Error("Timeout: Can't find a unique selector after ".concat(f,"ms"));var d=$t(Wg(s))||$t.apply(void 0,G([],j(Kg(s)),!1))||$t.apply(void 0,G([],j(Gg(s)),!1))||$t(Yg(s))||[Vs()],h=Xg(s);if(t=="all")h&&(d=d.concat(d.filter(Gr).map(function(S){return qt(S,h)})));else if(t=="two")d=d.slice(0,1),h&&(d=d.concat(d.filter(Gr).map(function(S){return qt(S,h)})));else if(t=="one"){var v=j(d=d.slice(0,1),1),m=v[0];h&&Gr(m)&&(d=[qt(m,h)])}else t=="none"&&(d=[Vs()],h&&(d=[qt(d[0],h)]));try{for(var g=(c=void 0,z(d)),p=g.next();!p.done;p=g.next()){var m=p.value;m.level=a}}catch(S){c={error:S}}finally{try{p&&!p.done&&(l=g.return)&&l.call(g)}finally{if(c)throw c.error}}if(i.push(d),i.length>=pe.seedMinLength&&(n=zs(i,r),n))return"break";s=s.parentElement,a++};s;){var u=o();if(u==="break")break}return n||(n=zs(i,r)),!n&&r?r():n}function zs(e,t){var r,n,i=eu(Jo(e));if(i.length>pe.threshold)return t?t():null;try{for(var s=z(i),a=s.next();!a.done;a=s.next()){var o=a.value;if(Zo(o))return o}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return null}function Pr(e){for(var t=e[0],r=t.name,n=1;n<e.length;n++){var i=e[n].level||0;t.level===i-1?r="".concat(e[n].name," > ").concat(r):r="".concat(e[n].name," ").concat(r),t=e[n]}return r}function js(e){return e.map(function(t){return t.penalty}).reduce(function(t,r){return t+r},0)}function Zo(e){var t=Pr(e);switch(yi.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function Wg(e){var t=e.getAttribute("id");return t&&pe.idName(t)?{name:"#"+CSS.escape(t),penalty:0}:null}function Kg(e){var t=Array.from(e.attributes).filter(function(r){return pe.attr(r.name,r.value)});return t.map(function(r){return{name:"[".concat(CSS.escape(r.name),'="').concat(CSS.escape(r.value),'"]'),penalty:.5}})}function Gg(e){var t=Array.from(e.classList).filter(pe.className);return t.map(function(r){return{name:"."+CSS.escape(r),penalty:1}})}function Yg(e){var t=e.tagName.toLowerCase();return pe.tagName(t)?{name:t,penalty:2}:null}function Vs(){return{name:"*",penalty:3}}function Xg(e){var t=e.parentNode;if(!t)return null;var r=t.firstChild;if(!r)return null;for(var n=0;r&&(r.nodeType===Node.ELEMENT_NODE&&n++,r!==e);)r=r.nextSibling;return n}function qt(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function Gr(e){return e.name!=="html"&&!e.name.startsWith("#")}function $t(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.filter(Qg);return r.length>0?r:null}function Qg(e){return e!=null}function Jo(e,t){var r,n,i,s,a,o;return t===void 0&&(t=[]),T(this,function(u){switch(u.label){case 0:if(!(e.length>0))return[3,9];u.label=1;case 1:u.trys.push([1,6,7,8]),r=z(e[0]),n=r.next(),u.label=2;case 2:return n.done?[3,5]:(i=n.value,[5,z(Jo(e.slice(1,e.length),t.concat(i)))]);case 3:u.sent(),u.label=4;case 4:return n=r.next(),[3,2];case 5:return[3,8];case 6:return s=u.sent(),a={error:s},[3,8];case 7:try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(a)throw a.error}return[7];case 8:return[3,11];case 9:return[4,t];case 10:u.sent(),u.label=11;case 11:return[2]}})}function eu(e){return G([],j(e),!1).sort(function(t,r){return js(t)-js(r)})}function tu(e,t,r){var n,i,s;return r===void 0&&(r={counter:0,visited:new Map}),T(this,function(a){switch(a.label){case 0:if(!(e.length>2&&e.length>pe.optimizedMinLength))return[3,5];n=1,a.label=1;case 1:return n<e.length-1?r.counter>pe.maxNumberOfTries?[2]:(r.counter+=1,i=G([],j(e),!1),i.splice(n,1),s=Pr(i),r.visited.has(s)?[2]:Zo(i)&&Zg(i,t)?[4,i]:[3,4]):[3,5];case 2:return a.sent(),r.visited.set(s,!0),[5,z(tu(i,t,r))];case 3:a.sent(),a.label=4;case 4:return n++,[3,1];case 5:return[2]}})}function Zg(e,t){return yi.querySelector(Pr(e))===t}var Jg=36e5,ep=function(e){var t=e.version,r=e.events,n=[];return r.forEach(function(i){var s=JSON.parse(i);s.count=1,s.type==="click"&&n.push(s)}),{version:t,events:n}},tp=function(e){var t=e.version,r=e.events,n=[];r.forEach(function(s){var a=JSON.parse(s);a.type==="click"&&n.push(a)});var i=n.reduce(function(s,a){var o=a.x,u=a.y,c=a.selector,l=a.timestamp,f=l-l%Jg,d="".concat(o,":").concat(u,":").concat(c??"",":").concat(f);return s[d]?s[d].count+=1:s[d]=M(M({},a),{timestamp:f,count:1}),s},{});return{version:t,events:Object.values(i)}},rp=function(){function e(t,r){var n=this;this.createHook=function(i){var s=i.eventsManager,a=i.sessionId,o=i.deviceIdFn,u=i.mirror,c=i.ugcFilterRules,l=i.performanceOptions;return function(f){if(f.type===Wo.Click){var d=W();if(d){var h=d.location,v=d.innerHeight,m=d.innerWidth;if(h){var g=f.x,p=f.y;if(!(g===void 0||p===void 0)){var S=u.getNode(f.id),_;if(S)try{_=Vg(S,l)}catch{n.logger.debug("error resolving selector from finder")}var w=Ir(h.href,c),E={x:g+n.scrollWatcher.currentScrollX,y:p+n.scrollWatcher.currentScrollY,selector:_,viewportHeight:v,viewportWidth:m,pageUrl:w,timestamp:Date.now(),type:"click"},b=o();b&&s.addEvent({sessionId:a,event:{type:"interaction",data:JSON.stringify(E)},deviceId:b})}}}}}},this.logger=t,this.scrollWatcher=r}return e}();function Yr(){var e=W();
32return e?.innerHeight||document.documentElement&&document.documentElement.clientHeight||0}function Xr(){var e=W();return e?.innerWidth||document.documentElement&&document.documentElement.clientWidth||0}var np=function(){function e(t,r){var n=W();n&&n.navigator&&typeof n.navigator.sendBeacon=="function"?this.sendBeacon=function(i,s){try{if(n.navigator.sendBeacon(i,JSON.stringify(s)))return!0}catch{}return!1}:this.sendBeacon=function(){return!1},this.sendXhr=function(i,s){var a=new XMLHttpRequest;return a.open("POST",i,!0),a.setRequestHeader("Accept","*/*"),a.send(JSON.stringify(s)),!0},this.basePageUrl=wt(r.serverZone,r.trackServerUrl),this.apiKey=r.apiKey,this.context=t,this.handleSendEvents=r.handleSendEvents,this.loggerProvider=r.loggerProvider}return e.prototype.send=function(t,r){var n=this,i,s=this.context,a=s.sessionId,o=s.type;if(this.handleSendEvents){var u=new URLSearchParams({device_id:t,session_id:String(a),type:String(o)}),c="".concat(this.basePageUrl,"?").concat(u.toString()),l={"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(this.apiKey)};try{this.handleSendEvents({url:c,method:"POST",headers:l,body:JSON.stringify(r),keepalive:!0}).catch(function(h){var v;(v=n.loggerProvider)===null||v===void 0||v.warn("Custom transport failed to send session replay interaction beacon:",h)})}catch(h){(i=this.loggerProvider)===null||i===void 0||i.warn("Custom transport threw while sending session replay interaction beacon:",h)}return}var f=new URLSearchParams({device_id:t,session_id:String(a),type:String(o),api_key:this.apiKey}),d="".concat(this.basePageUrl,"?").concat(f.toString());this.sendBeacon(d,r)||this.sendXhr(d,r)},e}(),ip=function(){function e(t,r){var n=this;this.timestamp=Date.now(),this.hook=function(i){n.update(i)},this.send=function(i){return function(s){var a,o,u,c,l=i(),f=W();if(f&&l){var d=(a=f.scrollX)!==null&&a!==void 0?a:0,h=(o=f.scrollY)!==null&&o!==void 0?o:0;(d>0||h>0)&&n.update({id:1,x:d,y:h}),n.transport.send(l,{version:1,events:[{maxScrollX:n._maxScrollX,maxScrollY:n._maxScrollY,maxScrollWidth:n._maxScrollWidth,maxScrollHeight:n._maxScrollHeight,viewportHeight:Yr(),viewportWidth:Xr(),pageUrl:Ir(f.location.href,(c=(u=n.config.interactionConfig)===null||u===void 0?void 0:u.ugcFilterRules)!==null&&c!==void 0?c:[]),timestamp:n.timestamp,type:"scroll"}]})}}},this._maxScrollX=0,this._maxScrollY=0,this._currentScrollX=0,this._currentScrollY=0,this._maxScrollWidth=Xr(),this._maxScrollHeight=Yr(),this.config=r,this.transport=t}return e.default=function(t,r){return new e(new np(t,r),r)},Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this._maxScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return this._maxScrollY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollWidth",{get:function(){return this._maxScrollWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollHeight",{get:function(){return this._maxScrollHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollX",{get:function(){return this._currentScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollY",{get:function(){return this._currentScrollY},enumerable:!1,configurable:!0}),e.prototype.update=function(t){var r=Date.now();if(this._currentScrollX=t.x,this._currentScrollY=t.y,t.x>this._maxScrollX){var n=Xr();this._maxScrollX=t.x;var i=t.x+n;i>this._maxScrollWidth&&(this._maxScrollWidth=i),this.timestamp=r}if(t.y>this._maxScrollY){var s=Yr();this._maxScrollY=t.y;var a=t.y+s;a>this._maxScrollHeight&&(this._maxScrollHeight=a),this.timestamp=r}},e}(),Hs=function(){function e(t){var r=t.sessionId,n=t.deviceId;this.deviceId=n,this.sessionId=r,r&&n&&(this.sessionReplayId=Zv(r,n))}return e}(),sp="AMP_SR_START_",ap=10,ru=1440*60*1e3,nu=function(e){return"".concat(sp).concat(e.substring(0,ap),"_")},bi=function(e,t){return"".concat(nu(e)).concat(t)},xr=function(){try{var e=W();return e?.localStorage}catch{return}},op=function(e,t,r,n){var i=xr();if(i){var s=bi(e,t);try{var a=i.getItem(s);if(a!==null){var o=Number(a);if(Number.isFinite(o)&&o>0&&o<=r&&r-o<ru)return o}return i.setItem(s,String(r)),r}catch(u){n?.debug("Failed to read/write replay start time from storage: ".concat(String(u)));return}}},up=function(e,t,r,n){var i=xr();if(i)try{i.setItem(bi(e,t),String(r))}catch(s){n?.debug("Failed to write replay start time to storage: ".concat(String(s)))}},cp=function(e,t,r){var n=xr();if(n)try{n.removeItem(bi(e,t))}catch(i){r?.debug("Failed to remove replay start time from storage: ".concat(String(i)))}},lp=function(e,t,r){var n,i,s=xr();if(s){var a=nu(e);try{for(var o=[],u=0;u<s.length;u++){var c=s.key(u);if(!(!c||!c.startsWith(a))){var l=s.getItem(c);if(l!==null){var f=Number(l);(!Number.isFinite(f)||f<=0||t-f>=ru)&&o.push(c)}}}try{for(var d=z(o),h=d.next();!h.done;h=d.next()){var c=h.value;s.removeItem(c)}}catch(v){n={error:v}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}}catch(v){r?.debug("Failed to prune stale replay start times: ".concat(String(v)))}}},dp=1e3*60*60*24*2,fp=function(){function e(){var t=this;this.dbs={},this.createStore=function(r){return x(t,void 0,void 0,function(){return T(this,function(n){switch(n.label){case 0:return[4,Go(r,1,{upgrade:function(i){i.objectStoreNames.contains("sessionTargetingMatch")||i.createObjectStore("sessionTargetingMatch",{keyPath:"sessionId"})}})];case 1:return[2,n.sent()]}})})},this.openOrCreateDB=function(r){return x(t,void 0,void 0,function(){var n,i;return T(this,function(s){switch(s.label){case 0:return this.dbs&&this.dbs[r]?[2,this.dbs[r]]:(n="".concat(r.substring(0,10),"_amp_session_replay_targeting"),[4,this.createStore(n)]);case 1:return i=s.sent(),this.dbs[r]=i,[2,i]}})})},this.getTargetingMatchForSession=function(r){var n=r.loggerProvider,i=r.apiKey,s=r.sessionId;return x(t,void 0,void 0,function(){var a,o,u,c;return T(this,function(l){switch(l.label){case 0:return l.trys.push([0,3,,4]),[4,this.openOrCreateDB(i)];case 1:return a=l.sent(),o=String(s),[4,a.get("sessionTargetingMatch",o)];case 2:return u=l.sent(),[2,u?.targetingMatch];case 3:return c=l.sent(),ue(n,"Failed to get targeting match for session id ".concat(s,": ").concat(c),c),[3,4];case 4:return[2,void 0]}})})},this.storeTargetingMatchForSession=function(r){var n=r.loggerProvider,i=r.apiKey,s=r.sessionId,a=r.targetingMatch;return x(t,void 0,void 0,function(){var o,u,c,l;return T(this,function(f){switch(f.label){case 0:return f.trys.push([0,3,,4]),[4,this.openOrCreateDB(i)];case 1:return o=f.sent(),u=String(s),[4,o.put("sessionTargetingMatch",{targetingMatch:a,sessionId:u,lastUpdated:Date.now()})];case 2:return c=f.sent(),[2,c];case 3:return l=f.sent(),ue(n,"Failed to store targeting match for session id ".concat(s,": ").concat(l),l),[3,4];case 4:return[2,void 0]}})})},this.clearStoreOfOldSessions=function(r){var n=r.loggerProvider,i=r.apiKey,s=r.currentSessionId;return x(t,void 0,void 0,function(){var a,o,u,c,l,f,d,h;return T(this,function(v){switch(v.label){case 0:return v.trys.push([0,8,,9]),[4,this.openOrCreateDB(i)];case 1:return a=v.sent(),o=String(s),u=a.transaction("sessionTargetingMatch","readwrite"),[4,u.store.getAll()];case 2:c=v.sent(),l=0,v.label=3;case 3:return l<c.length?(f=c[l],d=Date.now()-f.lastUpdated,f.sessionId!==o&&d>dp?[4,u.store.delete(f.sessionId)]:[3,5]):[3,6];case 4:v.sent(),v.label=5;case 5:return l++,[3,3];case 6:return[4,u.done];case 7:return v.sent(),[3,9];case 8:return h=v.sent(),ue(n,"Failed to clear old targeting matches for sessions: ".concat(h),h),[3,9];case 9:return[2]}})})}}return e}(),Qr=new fp,hp=function(e){var t=e.sessionId,r=e.targetingConfig,n=e.loggerProvider,i=e.apiKey,s=e.targetingParams,a=e.urlChange,o=a===void 0?!1:a;return x(void 0,void 0,void 0,function(){var u,c,l,f,d,h,v;return T(this,function(m){switch(m.label){case 0:return[4,Qr.clearStoreOfOldSessions({loggerProvider:n,apiKey:i,currentSessionId:t})];case 1:return m.sent(),[4,Qr.getTargetingMatchForSession({loggerProvider:n,apiKey:i,sessionId:t})];case 2:if(u=m.sent(),u===!0&&!o)return[2,!0];c=!0,m.label=3;case 3:return m.trys.push([3,6,,7]),[4,et(()=>import("./index-CDyFuCw9.js"),__vite__mapDeps([3,4,2,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url)];case 4:return l=m.sent().evaluateTargeting,f=M(M({},s),{flag:r,sessionId:typeof t=="string"?parseInt(t,10):t,apiKey:i,loggerProvider:n}),[4,l(f)];case 5:return d=m.sent(),d&&d.sr_targeting_config&&(c=d.sr_targeting_config.key==="on"),Qr.storeTargetingMatchForSession({loggerProvider:n,apiKey:i,sessionId:t,targetingMatch:c}),[3,7];case 6:return h=m.sent(),v=h,n.warn(v.message),[3,7];case 7:return[2,c]}})})},Qt=2654435761,Zt=2246822519,Ws=3266489917,vp=668265263,Ks=374761393;function qe(e,t){return(e<<t|e>>>32-t)>>>0}function zt(e,t){return e=e+Math.imul(t,Zt)>>>0,e=qe(e,13),e=Math.imul(e,Qt)>>>0,e}function mt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function gp(e){for(var t=[],r=0;r<e.length;r++){var n=e.charCodeAt(r);if(n>=55296&&n<=56319&&r+1<e.length){var i=e.charCodeAt(r+1);i>=56320&&i<=57343&&(n=(n-55296<<10)+(i-56320)+65536,r++)}n<128?t.push(n):n<2048?t.push(192|n>>6,128|n&63):n<65536?t.push(224|n>>12,128|n>>6&63,128|n&63):t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63)}return new Uint8Array(t)}
32function pp(e,t){t===void 0&&(t=0);var r=gp(e),n=r.length,i,s=0;if(n>=16){for(var a=t+Qt+Zt>>>0,o=t+Zt>>>0,u=t>>>0,c=t-Qt>>>0;s<=n-16;)a=zt(a,mt(r,s)),s+=4,o=zt(o,mt(r,s)),s+=4,u=zt(u,mt(r,s)),s+=4,c=zt(c,mt(r,s)),s+=4;i=qe(a,1)+qe(o,7)+qe(u,12)+qe(c,18)>>>0}else i=t+Ks>>>0;for(i=i+n>>>0;s<=n-4;)i=i+Math.imul(mt(r,s),Ws)>>>0,i=Math.imul(qe(i,17),vp)>>>0,s+=4;for(;s<n;)i=i+Math.imul(r[s],Ks)>>>0,i=Math.imul(qe(i,11),Qt)>>>0,s++;return i^=i>>>15,i=Math.imul(i,Zt)>>>0,i^=i>>>13,i=Math.imul(i,Ws)>>>0,i^=i>>>16,i>>>0}function mp(e,t){var r=pp(e.toString()),n=r%1e6;return n/1e6<t}var Zr="__amplitude_url_tracking_patched__",Gs=new WeakMap;function iu(e,t,r){if(r===void 0&&(r={}),!e?.location)return function(){};var n=r.enablePolling,i=n===void 0?!1:n,s=r.pollingInterval,a=s===void 0?gi:s;if(i){var o=function(){var w;return(w=e.location.href)!==null&&w!==void 0?w:""},u=o(),c=e.setInterval(function(){var w=o();w!==u&&(u=w,t(w))},a);return function(){c!=null&&e.clearInterval(c)}}var l=Gs.get(e);if(!l){var f=void 0,d=new Set,h=function(){var w;return(w=e.location.href)!==null&&w!==void 0?w:""},v=function(){var w=h();f!==void 0&&w===f||(f=w,d.forEach(function(E){return E(w)}))},m=function(w){var E=function(){for(var b=[],y=0;y<arguments.length;y++)b[y]=arguments[y];var I=w.apply(this,b);return v(),I};return E[Zr]=!0,E},g=e.history;if(g?.pushState){var p=Reflect.get(g,"pushState");p[Zr]||(g.pushState=m(p))}if(g?.replaceState){var S=Reflect.get(g,"replaceState");S[Zr]||(g.replaceState=m(S))}l={callbacks:d,notify:v,onPopStateOrHashChange:function(){return v()},listenersAttached:!1},Gs.set(e,l)}var _=l;return _.listenersAttached||(e.addEventListener("popstate",_.onPopStateOrHashChange),e.addEventListener("hashchange",_.onPopStateOrHashChange),_.listenersAttached=!0),_.callbacks.add(t),function(){_.callbacks.delete(t),_.callbacks.size===0&&_.listenersAttached&&(e.removeEventListener("popstate",_.onPopStateOrHashChange),e.removeEventListener("hashchange",_.onPopStateOrHashChange),_.listenersAttached=!1)}}function su(e){return e===void 0&&(e={}),{name:"amplitude/url-tracking@1",observer:function(t,r,n){var i,s,a,o=M(M({},e),n),u=o.ugcFilterRules||[],c=(i=o.enablePolling)!==null&&i!==void 0?i:!1,l=(s=o.pollingInterval)!==null&&s!==void 0?s:gi,f=(a=o.captureDocumentTitle)!==null&&a!==void 0?a:!1;if(!r)return function(){};var d=void 0,h=function(){return r.location&&r.location.href||""},v=function(){var p=r.innerHeight,S=r.innerWidth,_=r.document,w=h(),E="";f&&(E=_?.title||"");var b=u.length>0?Ir(w,u):w;return{href:b,title:E,viewportHeight:p,viewportWidth:S,type:"url-change-event"}},m=function(){var p=h();if(d===void 0||p!==d){d=p;var S=v();t(S)}},g=iu(r,function(){return m()},c?{enablePolling:!0,pollingInterval:l}:{});return m(),function(){return g()}},options:e}}su();function yp(){try{var e=W();return e?e.parent!==e:!1}catch{return!0}}var bp=function(){function e(){this.pendingLoadListeners=new Map}return e.prototype.start=function(){var t=this,r;(r=this.mutationObserver)===null||r===void 0||r.disconnect();var n=W();n&&(this.sendToAllIframes({type:Xt,action:"start"}),this.mutationObserver=new MutationObserver(function(i){var s,a,o,u,c,l;try{for(var f=z(i),d=f.next();!d.done;d=f.next()){var h=d.value;try{for(var v=(o=void 0,z(Array.from(h.addedNodes))),m=v.next();!m.done;m=v.next()){var g=m.value;g instanceof HTMLIFrameElement?t.sendToIframeAfterLoad(g):g instanceof Element&&g.querySelectorAll("iframe").forEach(function(w){t.sendToIframeAfterLoad(w)})}}catch(w){o={error:w}}finally{try{m&&!m.done&&(u=v.return)&&u.call(v)}finally{if(o)throw o.error}}try{for(var p=(c=void 0,z(Array.from(h.removedNodes))),S=p.next();!S.done;S=p.next()){var g=S.value;if(g instanceof HTMLIFrameElement){var _=t.pendingLoadListeners.get(g);_&&(g.removeEventListener("load",_),t.pendingLoadListeners.delete(g))}}}catch(w){c={error:w}}finally{try{S&&!S.done&&(l=p.return)&&l.call(p)}finally{if(c)throw c.error}}}}catch(w){s={error:w}}finally{try{d&&!d.done&&(a=f.return)&&a.call(f)}finally{if(s)throw s.error}}}),this.mutationObserver.observe(document.documentElement,{childList:!0,subtree:!0}))},e.prototype.stop=function(){var t;(t=this.mutationObserver)===null||t===void 0||t.disconnect(),this.mutationObserver=void 0,this.pendingLoadListeners.forEac
32h(function(r,n){n.removeEventListener("load",r)}),this.pendingLoadListeners.clear(),this.sendToAllIframes({type:Xt,action:"stop"})},e.prototype.sendToIframeAfterLoad=function(t){var r=this,n=function(){r.pendingLoadListeners.delete(t),r.sendToIframe(t,{type:Xt,action:"start"})};this.pendingLoadListeners.set(t,n),t.addEventListener("load",n,{once:!0})},e.prototype.sendToAllIframes=function(t){var r=this,n=document.querySelectorAll("iframe");n.forEach(function(i){return r.sendToIframe(i,t)})},e.prototype.sendToIframe=function(t,r){var n;try{(n=t.contentWindow)===null||n===void 0||n.postMessage(r,"*")}catch{}},e}();function Sp(e){var t=W();if(!t)return function(){};var r=t.parent;function n(i){if(i.source===r){var s=i.data;s?.type===Xt&&(s.action==="start"?e.onStart():s.action==="stop"&&e.onStop())}}return t.addEventListener("message",n),function(){return t.removeEventListener("message",n)}}var _p=function(){function e(){var t=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.eventCount=0,this.sessionTargetingMatch=!1,this.pageLeaveFns=[],this.suppressedSendCount=0,this.hasEmittedGateDecision=!1,this.recordFunction=null,this.recordEventsInFlight=!1,this.pendingEmitEvents=[],this.currentPageUrl="",this.recordEventsPendingShouldLogMetadata=null,this.urlChangeCleanup=null,this.crossOriginIframeCoordinator=null,this.crossOriginParentSignalCleanup=null,this.latestUrlChangeTargetingEvaluationId=0,this.teardownEventListeners=function(r){var n=W();n&&(n.removeEventListener("blur",t.blurListener),n.removeEventListener("focus",t.focusListener),!r&&n.addEventListener("blur",t.blurListener),!r&&n.addEventListener("focus",t.focusListener),n.self&&"onpagehide"in n.self?(n.removeEventListener("pagehide",t.pageLeaveListener),!r&&n.addEventListener("pagehide",t.pageLeaveListener)):(n.removeEventListener("beforeunload",t.pageLeaveListener),!r&&n.addEventListener("beforeunload",t.pageLeaveListener)))},this.blurListener=function(){t.sendEvents()},this.focusListener=function(){var r;if(t.recordCancelCallback&&t.recordFunction){if(((r=t.config)===null||r===void 0?void 0:r.captureFullSnapshotOnFocus)===!1)return;try{t.recordFunction.takeFullSnapshot(!0)}catch(n){t.loggerProvider.warn("Failed to take full snapshot on focus:",n)}}else t.recordEventsInFlight||t.recordEvents(!1)},this.pageLeaveListener=function(r){var n;(n=t.eventCompressor)===null||n===void 0||n.flushQueue(),t.sendEvents(),t.pageLeaveFns.forEach(function(i){i(r)})},this.evaluateTargetingAndCapture=function(r,n,i,s){return n===void 0&&(n=!1),i===void 0&&(i=!1),s===void 0&&(s=!1),x(t,void 0,void 0,function(){var a,o,u,c,l,f,d,h,v,m,g,p,S;return T(this,function(_){switch(_.label){case 0:if(!this.identifiers||!this.identifiers.sessionId||!this.config)return this.identifiers&&!this.identifiers.sessionId?this.loggerProvider.log("Session ID has not been set yet, cannot evaluate targeting for Session Replay."):this.loggerProvider.warn("Session replay init has not been called, cannot evaluate targeting."),[2];if(!this.config.targetingConfig)if(n)this.loggerProvider.log("Targeting config has not been set yet, cannot evaluate targeting.");else return this.loggerProvider.log("No targeting config set, skipping initialization/recording for event."),[2];return this.lastTargetingParams=r,a=this.config.targetingConfig,o=a&&!this.sessionTargetingMatch,o?(u=s?this.latestUrlChangeTargetingEvaluationId:void 0,c=r.event,c&&Object.values(Tn).includes(c.event_type)&&(c=void 0),l=(p=(v=(h=r.page)===null||h===void 0?void 0:h.url)!==null&&v!==void 0?v:(g=(m=W())===null||m===void 0?void 0:m.location)===null||g===void 0?void 0:g.href)!==null&&p!==void 0?p:"",f=(S=r.page)!==null&&S!==void 0?S:l!==""?{url:l}:void 0,[4,hp({sessionId:this.identifiers.sessionId,targetingConfig:a,loggerProvider:this.loggerProvider,apiKey:this.config.apiKey,targetingParams:{userProperties:r.userProperties,event:c,page:f},urlChange:s})]):[3,2];case 1:if(d=_.sent(),s&&u!==void 0&&u!==this.latestUrlChangeTargetingEvaluationId)return this.loggerProvider.debug("Ignoring stale URL-change targeting result #".concat(u,"; latest is #").concat(this.latestUrlChangeTargetingEvaluationId,".")),[2];this.sessionTargetingMatch=this.sessionTargetingMatch||d,this.loggerProvider.debug(JSON.stringify({name:"targeted replay capture config",sessionTargetingMatch:this.sessionTargetingMatch,event:c,targetingParams:r},null,2)),_.label=2;case 2:return n?(this.initialize(!0),[3,5]):[3,3];case 3:return i||!this.recordCancelCallback?(this.loggerProvider.log("Recording events for session due to forceRestart or no ongoing recording."),[4,this.recordEvents()]):[3,5];case 4:_.sent(),_.label=5;case 5:return[2]}})})},this.addCustomRRWebEvent=function(r,n,i){return n===void 0&&(n={}),i===void 0&&(i=!0),x(t,void 0,void 0,function(){var s,a,o,u;return T(this,function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),s=void 0,a=this.config,a&&r!==Ee.METADATA?(s={config:Vo(a),version:lr},i?[4,jo()]:[3,2]):[3,2];case 1:o=c.sent(),s=M(M({},o),s),c.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(r,M(M({},n),s)):this.loggerProvider.debug("Not able to add custom replay capture event ".concat(r," due to no ongoing recording.")),[3,4];case 3:return u=c.sent(),this.loggerProvider.debug("Error while adding custom replay capture event: ",u),[3,4];case 4:return[2]}})})},this.stopRecordingEvents=function(){var r,n,i;try{t.loggerProvider.log("Session Replay capture stopping."),t.recordCancelCallback&&t.recordCancelCallback(),t.recordCancelCallback=null,(r=t.networkObservers)===null||r===void 0||r.stop(),(n=t.crossOriginIframeC
32oordinator)===null||n===void 0||n.stop(),t.crossOriginIframeCoordinator=null,(i=t.crossOriginParentSignalCleanup)===null||i===void 0||i.call(t),t.crossOriginParentSignalCleanup=null}catch(a){var s=a;t.loggerProvider.warn("Error occurred while stopping replay capture: ".concat(s.toString()))}},this.loggerProvider=new kn(new ur)}return e.prototype.init=function(t,r){return Is(this._init(t,r))},e.prototype.setupUrlChangeListener=function(){var t=this,r,n;(r=this.urlChangeCleanup)===null||r===void 0||r.call(this);var i=W();if(i?.location){var s=!!(!((n=this.config)===null||n===void 0)&&n.targetingConfig),a=function(u){if(t.currentPageUrl=u,s){var c=++t.latestUrlChangeTargetingEvaluationId;t.evaluateTargetingAndCapture({userProperties:{},event:void 0,page:{url:u}},!1,!1,!0),t.loggerProvider.debug("Queued URL-change targeting re-evaluation #".concat(c," for ").concat(u,"."))}},o=iu(i,a);this.urlChangeCleanup=function(){o(),t.urlChangeCleanup=null}}},e.prototype.isBelowMinSessionDuration=function(){var t,r=(t=this.config)===null||t===void 0?void 0:t.minSessionDurationMs;return r===void 0||this.sessionStartTime===void 0?!1:Date.now()-this.sessionStartTime<r},e.prototype.getCurrentPageForTargeting=function(){var t,r,n=(r=(t=W())===null||t===void 0?void 0:t.location)===null||r===void 0?void 0:r.href;return n!=null?{url:n}:void 0},e.prototype._init=function(t,r){var n,i,s,a,o,u,c,l,f,d,h,v,m,g;return x(this,void 0,void 0,function(){var p,S,_,w,E,b,y,I,C,A,N,F,k,D,P,R,L,O,$,B,U,O,Z,q,J,X,ee,re,ae,oe,Pe,xe,Ae,de=this;return T(this,function(ie){switch(ie.label){case 0:return(n=this.urlChangeCleanup)===null||n===void 0||n.call(this),this.loggerProvider=new kn(r.loggerProvider||new ur),Object.prototype.hasOwnProperty.call(r,"logLevel")&&this.loggerProvider.enable(r.logLevel),this.currentPageUrl=Ln(),this.identifiers=new Hs({sessionId:r.sessionId,deviceId:r.deviceId}),p=Date.now(),lp(t,p,this.loggerProvider),this.sessionStartTime=r.sessionId!==void 0&&(i=op(t,r.sessionId,p,this.loggerProvider))!==null&&i!==void 0?i:p,S=this,[4,ug(t,r)];case 1:return S.joinedConfigGenerator=ie.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig()];case 2:return _=ie.sent(),w=_.joinedConfig,E=_.localConfig,b=_.remoteConfig,this.config=w,this.setMetadata(r.sessionId,w,E,b,(s=r.version)===null||s===void 0?void 0:s.version,lr,(a=r.version)===null||a===void 0?void 0:a.type),this.pageLeaveFns=[],r.sessionId&&(!((o=this.config.interactionConfig)===null||o===void 0)&&o.enabled)&&(y=ip.default({sessionId:r.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[y.send(this.getDeviceId.bind(this)).bind(y)],this.scrollHook=y.hook.bind(y),this.clickHandler=new rp(this.loggerProvider,y)),I=[],C=this.config.storeType,C==="idb"&&!(!((u=W())===null||u===void 0)&&u.indexedDB)&&(C="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(C," for event storage.")),F=W(),this.config.useWebWorker&&F&&F.Worker?[4,et(()=>import("./index-CdgHfcmO.js"),[],import.meta.url)]:[3,4];case 3:k=ie.sent(),D=k.compressionScript,P=k.trackDestinationScript,A=D,N=P,ie.label=4;case 4:return ie.trys.push([4,6,,7]),[4,qs({config:this.config,type:"replay",minInterval:(c=this.config.flushIntervalConfig)===null||c===void 0?void 0:c.minIntervalMs,maxInterval:(l=this.config.flushIntervalConfig)===null||l===void 0?void 0:l.maxIntervalMs,maxPersistedEventsSize:this.config.maxPersistedEventsSizeBytes,storeType:C,trackDestinationWorkerScript:N,shouldSend:function(){return!de.isBelowMinSessionDuration()}})];case 5:return R=ie.sent(),this.rrwebEventManager=R,I.push({name:"replay",manager:R}),[3,7];case 6:return L=ie.sent(),O=L,this.loggerProvider.warn("Error occurred while creating replay events manager: ".concat(O.toString())),[3,7];case 7:if(!(!((f=this.config.interactionConfig)===null||f===void 0)&&f.enabled))return[3,11];$=this.config.interactionConfig.batch?tp:ep,ie.label=8;case 8:return ie.trys.push([8,10,,11]),[4,qs({config:this.config,type:"interaction",minInterval:(d=this.config.interactionConfig.trackEveryNms)!==null&&d!==void 0?d:Bv,maxInterval:Uv,maxPersistedEventsSize:this.config.maxPersistedEventsSizeBytes,payloadBatcher:$,storeType:C,trackDestinationWorkerScript:N})];case 9:return B=ie.sent(),I.push({name:"interaction",manager:B}),[3,11];case 10:return U=ie.sent(),O=U,this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(O.toString())),[3,11];case 11:if(this.eventsManager=new($s.bind.apply($s,G([void 0],j(I),!1))),this.eventCompressor&&this.eventCompressor.terminate(),Z=this.config.eagerFullSnapshotSend===!0?function(){return de.sendEvents()}:void 0,this.eventCompressor=new gg(this.eventsManager,this.config,this.getDeviceId(),A,Z),this.pendingEmitEvents.length>0){q=this.pendingEmitEvents.splice(0);try{for(J=z(q),X=J.next();!X.done;X=J.next())ee=X.value,re=ee.event,ae=ee.sessionId,this.eventCompressor.enqueueEvent(re,ae)}catch(ft){xe={error:ft}}finally{try{X&&!X.done&&(Ae=J.return)&&Ae.call(J)}finally{if(xe)throw xe.error}}}return this.pageLeaveFns=G(G([],j(this.pageLeaveFns),!1),[function(){var ft;if(!(!de.config||!(!((ft=de.identifiers)===null||ft===void 0)&&ft.sessionId)||!R)){var wi=R.getBeaconEvents();if(wi.length){var Ei=de.getDeviceId();Ei&&(de.isBelowMinSessionDuration()||R.trackDestination.sendBeacon({events:wi,sessionId:de.identifiers.sessionId,deviceId:Ei,apiKey:de.config.apiKey,serverZone:de.config.serverZone}))}}}],!1),[4,this.initializeNetworkObservers()];case 12:return ie.sent(),!((h=W())===null||h===void 0)&&h.opener&&(oe=Pv(),xv(oe),oe.setup(M({logger:this.loggerProvider},this.config.serverZone&&{endpoint:_v[this.config.serverZone]}))),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.teardownEventListeners(!1),[4,this.evaluateTargetingAndCapture({userProperties:r.userProperties,page:this.getCurrentPageForTargeting()},!0)];case 13:return ie.sent(),Pe=this.config.targetingConfig||((g=(m=(v=this.config.privacyConfig)===null||v===void 0?void 0:v.urlMaskLevels)===null||m===void 0?void 0:m.length)!==null&&g!==void 0?g:0)>0,Pe&&this.setupUrlChangeListener(),[2]}})})},e.prototype.setSessionId=function(t,r){return Is(this.asyncSetSessionId(t,r))},e.prototype.asyncSetSessionId=function(t,r,n){var i,s,a,o;return x(this,void 0,void 0,function(){var u,c,l,f,d;return T(this,function(h){switch(h.label){case 0:return u=(i=this.identifiers)===null||i===void 0?void 0:i.sessionId,c=this.getDeviceId(),u!==void 0&&u===t&&(r===void 0||r===c)&&(n?.userProperties===void 0||Object.keys(n.userProperties).length===0)?[2]:(this.latestUrlChangeTargetingEvaluationId++,this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,u&&this.sendEvents(u),l=u!==t,l&&((s=this.rrwebEventManager)===null||s===void 0||s.dropPendingBeaconEvents()),f=r||this.getDeviceId(),this.identifiers=new Hs({sessionId:t,deviceId:f}),l&&(this.sessionStartTime=Date.now(),this.suppressedSendCount=0,this.hasEmittedGateDecision=!1,!((a=this.config)===null||a===void 0)&&a.apiKey&&(up(this.config.apiKey,t,this.sessionStartTime,this.loggerProvider),u!==void 0&&cp(this.config.apiKey,u,this.loggerProvider))),this.joinedConfigGenerator&&u?[4,this.joinedConfigGenerator.generateJoinedConfig()]:[3,2]);case 1:d=h.sent().joinedConfig,this.config=d,h.label=2;case 2:return!((o=this.config)===null||o===void 0)&&o.targetingConfig?[4,this.evaluateTargetingAndCapture({userProperties:n?.userProperties,page:this.getCurrentPageForTargeting()},!1,!0)]:[3,4];case 3:return h.sent(),[3,6];case 4:return[4,this.recordEvents()];case 5:h.sent(),h.label=6;case 6:return[2]}})})},e.prototype.getSessionReplayProperties=function(){var t,r=this.config,n=this.identifiers;if(!r||!n)return this.loggerProvider.warn("Session replay init has not been called, cannot get session replay properties."),{};var i=this.getShouldRecord(),s={};return i&&(s=(t={},t[Av]=n.sessionReplayId?n.sessionReplayId:null,t),r.debugMode&&(s[kv]=JSON.stringify({appHash:Cs(r.apiKey).toString()}))),this.addCustomRRWebEvent(Ee.GET_SR_PROPS,{shouldRecord:i,eventProperties:s},this.eventCount===10),this.eventCount===10&&(this.eventCount=0),this.eventCount++,s},e.prototype.sendEvents=function(t){var r,n,i=t||((r=this.identifiers)===null||r===void 0?void 0:r.sessionId),s=this.getDeviceId();if(this.eventsManager&&i&&s){if(this.isBelowMinSessionDuration()){var a=this.sessionStartTime,o=this.config.minSessionDurationMs;this.loggerProvider.log("Session ".concat(i," not sent: duration ").concat(Date.now()-a,"ms is below minimum ").concat(o,"ms.")),this.suppressedSendCount++;return}if(!this.hasEmittedGateDecision&&((n=this.config)===null||n===void 0?void 0:n.minSessionDurationMs)!==void 0&&this.recordCancelCallback&&this.recordFunction){this.hasEmittedGateDecision=!0;var u=this.sessionStartTime!==void 0?Date.now()-this.sessionStartTime:void 0;this.addCustomRRWebEvent(Ee.REPLAY_GATE_DECISION,{sessionId:i,suppressedSendCount:this.suppressedSendCount,elapsedMs:u,minSessionDurationMs:this.config.minSessionDurationMs},!1)}this.eventsManager.sendCurrentSequenceEvents({sessionId:i,deviceId:s})}},e.prototype.initialize=function(t){var r;return t===void 0&&(t=!1),x(this,void 0,void 0,function(){var n;return T(this,function(i){return!((r=this.identifiers)===null||r===void 0)&&r.sessionId?(n=this.getDeviceId(),n?(this.eventsManager&&t&&this.eventsManager.sendStoredEvents({deviceId:n}),[2,this.recordEvents()]):(this.loggerProvider.log("Session is not being recorded due to lack of device id."),[2,Promise.resolve()])):(this.loggerProvider.log("Session is not being recorded due to lack of session id."),[2,Promise.resolve()])})})},e.prototype.shouldOptOut=function(){var t,r,n;if(!((t=this.config)===null||t===void 0)&&t.instanceName){var i=cv(this.config.instanceName).identityStore;n=i.getIdentity().optOut}return n!==void 0?n:(r=this.config)===null||r===void 0?void 0:r.optOut},e.prototype.getShouldRecord=function(){if(!this.identifiers||!this.config||!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;if(!this.config.captureEnabled)return this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," not being captured due to capture being disabled for project or because the remote config could not be fetched.")),!1;if(this.shouldOptOut())return this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to optOut config.")),!1;var t=!1,r="",n=!1;if(this.config.targetingConfig)this.sessionTargetingMatch?(r="Capturing replays for session ".concat(this.identifiers.sessionId," due to matching targeting conditions."),this.loggerProvider.log(r),t=!0,n=!0):(r="Not capturing replays for session ".concat(this.identifiers.sessionId," due to not matching targeting conditions."),this.loggerProvider.log(r),t=!1,n=!1);else{var i=mp(this.identifiers.sessionId,this.config.sampleRate);i?(t=!0,n=!0):(r="Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate."),this.loggerProvider.log(r),t=!1,n=!1)}return this.lastShouldRecordDecision!==t&&this.config.targetingConfig&&(this.addCustomRRWebEvent(Ee.TARGETING_DECISION,{message:r,sessionId:this.identifiers.sessionId,matched:n,targetingParams:this.lastTargetingParams}),this.lastShouldRecordDecision=t),t},e.prototype.getBlockSelectors=function(){var t,r,n,i=(n=(r=(t=this.config)===null||t===void 0?void 0:t.privacyConfig)===null||r===void 0?void 0:r.blockSelector)!==null&&n!==void 0?n:[];if(i.length!==0)return i},e.prototype.getMaskTextSelectors=function(){var t,r,n=(t=this.config)===null||t===void 0?void 0:t.privacyConfig,i=n?qo(this.currentPageUrl,n):void 0;if(i==="conservative"||!((r=n?.urlMaskLevels)===null||r===void 0)&&r.some(function(o){return o.maskLevel==="conservative"}))return"*";var s=n?.urlMaskLevels;if(n?.defaultMaskLevel==="conservative"&&s&&s.length>0)return"*";var a=n?.maskSelector;if(a)return a},e.prototype.getRecordingPlugins=function(t){var r,n,i,s,a,o;return x(this,void 0,void 0,function(){var u,c,l,f;return T(this,function(d){switch(d.label){case 0:u=[];try{c=su({ugcFilterRules:((n=(r=this.config)===null||r===void 0?void 0:r.interactionConfig)===null||n===void 0?void 0:n.ugcFilterRules)||[],enablePolling:((i=this.config)===null||i===void 0?void 0:i.enableUrlChangePolling)||!1,pollingInterval:(s=this.config)===null||s===void 0?void 0:s.urlChangePollingInterval,captureDocumentTitle:(a=this.config)===null||a===void 0?void 0:a.captureDocumentTitle}),u.push(c)}catch(h){this.loggerProvider.warn("Failed to create URL tracking plugin:",h)}if(!(!((o=t?.console)===null||o===void 0)&&o.enabled))return[3,4];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,et(()=>
32import("./rrweb-plugin-console-record-DqpQf3ux.js"),[],import.meta.url)];case 2:return l=d.sent().getRecordConsolePlugin,u.push(l({level:t.console.levels})),[3,4];case 3:return f=d.sent(),this.loggerProvider.warn("Failed to load console plugin:",f),[3,4];case 4:return[2,u.length>0?u:void 0]}})})},e.prototype.getRecordFunction=function(){return x(this,void 0,void 0,function(){var t,r;return T(this,function(n){switch(n.label){case 0:if(this.recordFunction)return[2,this.recordFunction];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,et(()=>import("./rrweb-record-vdEozIfZ.js"),[],import.meta.url)];case 2:return t=n.sent().record,this.recordFunction=t,[2,t];case 3:return r=n.sent(),this.loggerProvider.warn("Failed to load rrweb-record module:",r),[2,null];case 4:return[2]}})})},e.prototype.recordEvents=function(t){return t===void 0&&(t=!0),x(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:if(this.recordEventsInFlight)return this.recordEventsPendingShouldLogMetadata=t,[2];this.recordEventsInFlight=!0,n.label=1;case 1:return n.trys.push([1,,6,7]),[4,this._recordEvents(t)];case 2:n.sent(),n.label=3;case 3:return this.recordEventsPendingShouldLogMetadata===null?[3,5]:(r=this.recordEventsPendingShouldLogMetadata,this.recordEventsPendingShouldLogMetadata=null,[4,this._recordEvents(r)]);case 4:return n.sent(),[3,3];case 5:return[3,7];case 6:return this.recordEventsInFlight=!1,this.recordEventsPendingShouldLogMetadata=null,[7];case 7:return[2]}})})},e.prototype._recordEvents=function(t){var r,n,i,s,a,o,u,c;return t===void 0&&(t=!0),x(this,void 0,void 0,function(){var l,f,d,h,v,m,g,p,S,_,w,E,b,y,I,C,A,N,F,k=this;return T(this,function(D){switch(D.label){case 0:return l=this.config,f=this.getShouldRecord(),d=(r=this.identifiers)===null||r===void 0?void 0:r.sessionId,!f||!d||!l?[2]:(this.stopRecordingEvents(),[4,this.getRecordFunction()]);case 1:return h=D.sent(),h?[4,this.initializeNetworkObservers()]:[2];case 2:D.sent(),v=(n=l.loggingConfig)===null||n===void 0?void 0:n.network,m=wt(l.serverZone,l.trackServerUrl),g=[Do,Fo,No,m],(i=this.networkObservers)===null||i===void 0||i.start(function(P){g.some(function(R){return P.url.startsWith(R)})||k.addCustomRRWebEvent(Ee.FETCH_REQUEST,P)},v),p=l.interactionConfig,S=l.loggingConfig,_=p?.enabled?{mouseInteraction:this.eventsManager&&((s=this.clickHandler)===null||s===void 0?void 0:s.createHook({eventsManager:this.eventsManager,sessionId:d,deviceIdFn:this.getDeviceId.bind(this),mirror:h.mirror,ugcFilterRules:(a=p.ugcFilterRules)!==null&&a!==void 0?a:[],performanceOptions:(o=l.performanceConfig)===null||o===void 0?void 0:o.interaction})),scroll:this.scrollHook}:{},w=p?.enabled&&p.ugcFilterRules?p.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(d,".")),D.label=3;case 3:return D.trys.push([3,5,,6]),E=!!(!((u=l.crossOriginIframes)===null||u===void 0)&&u.enabled),b=((c=l.crossOriginIframes)===null||c===void 0?void 0:c.coordinateChildren)!==!1,y=E&&yp(),y&&b?(this.crossOriginParentSignalCleanup=Sp({onStart:function(){return k._recordEventsInChildMode(h,d,l,_)},onStop:function(){try{k.recordCancelCallback&&k.recordCancelCallback(),k.recordCancelCallback=null}catch(R){var P=R;k.loggerProvider.warn("Error occurred while stopping child iframe replay capture: ".concat(P.toString()))}}}),[2]):(I=this,C=h,A=[M({},this.buildRRWebRecordOptions(l,_,function(P){if(k.shouldOptOut()){k.loggerProvider.log("Opting session ".concat(d," out of recording due to optOut config.")),k.stopRecordingEvents(),k.sendEvents();return}P.type===Cr.Meta&&(P.data.href=Ir(P.data.href,w)),k.eventCompressor?k.eventCompressor.enqueueEvent(P,d):k.pendingEmitEvents.push({event:P,sessionId:d})},"Error while capturing replay: "))],F={},[4,this.getRecordingPlugins(S)]);case 4:return I.recordCancelCallback=C.apply(void 0,[M.apply(void 0,A.concat([(F.plugins=D.sent(),F.recordCrossOriginIframes=E,F)]))]),E&&!y&&b&&(this.crossOriginIframeCoordinator||(this.crossOriginIframeCoordinator=new bp),this.crossOriginIframeCoordinator.start()),this.addCustomRRWebEvent(Ee.DEBUG_INFO),t&&this.addCustomRRWebEvent(Ee.METADATA,this.metadata),[3,6];case 5:return N=D.sent(),this.loggerProvider.warn("Failed to initialize session replay:",N),[3,6];case 6:return[2]}})})},e.prototype.buildRRWebRecordOptions=function(t,r,n,i){var s=this,a=t.privacyConfig;return M(M({emit:n,inlineStylesheet:t.shouldInlineStylesheet,hooks:r,maskAllInputs:!0,maskTextClass:ko,blockClass:Lv,blockSelector:this.getBlockSelectors(),applyBackgroun
32dColorToBlockedElements:t.applyBackgroundColorToBlockedElements,maskInputFn:As("input",a,function(){return s.currentPageUrl}),maskTextFn:As("text",a,function(){return s.currentPageUrl}),maskAttributeFn:Qv(a,function(){return s.currentPageUrl}),maskTextSelector:this.getMaskTextSelectors()},t.fullSnapshotIntervalMs!==void 0&&{checkoutEveryNms:t.fullSnapshotIntervalMs}),{recordCanvas:!1,captureAdoptedStyleSheets:t.captureAdoptedStyleSheets,slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0},errorHandler:function(o){var u=o;if(u.message.includes("insertRule")&&u.message.includes("CSSStyleSheet")||u._external_)throw u;return s.loggerProvider.warn(i,u.toString()),!0}})},e.prototype._recordEventsInChildMode=function(t,r,n,i){try{this.recordCancelCallback&&this.recordCancelCallback(),this.recordCancelCallback=null,this.recordCancelCallback=t(M(M({},this.buildRRWebRecordOptions(n,i,function(){},"Error while capturing replay (child iframe): ")),{recordCrossOriginIframes:!0})),this.loggerProvider.log("Session Replay child iframe capture beginning for session ".concat(r,"."))}catch(s){this.loggerProvider.warn("Failed to initialize session replay in child iframe mode:",s)}},e.prototype.getDeviceId=function(){var t;return(t=this.identifiers)===null||t===void 0?void 0:t.deviceId},e.prototype.getSessionId=function(){var t;return(t=this.identifiers)===null||t===void 0?void 0:t.sessionId},e.prototype.flush=function(t){var r;return t===void 0&&(t=!1),x(this,void 0,void 0,function(){return T(this,function(n){return[2,(r=this.eventsManager)===null||r===void 0?void 0:r.flush(t)]})})},e.prototype.shutdown=function(){var t,r;(t=this.urlChangeCleanup)===null||t===void 0||t.call(this),(r=this.crossOriginParentSignalCleanup)===null||r===void 0||r.call(this),this.crossOriginParentSignalCleanup=null,this.teardownEventListeners(!0),this.stopRecordingEvents(),this.sendEvents()},e.prototype.mapSDKType=function(t){return t==="plugin"?"@amplitude/plugin-session-replay-browser":t==="segment"?"@amplitude/segment-session-replay-plugin":null},e.prototype.setMetadata=function(t,r,n,i,s,a,o){var u=t?.toString()?Cs(t.toString()):void 0;this.metadata={joinedConfig:r,localConfig:n,remoteConfig:i,sessionId:t,hashValue:u,sampleRate:r.sampleRate,replaySDKType:this.mapSDKType(o),replaySDKVersion:s,standaloneSDKType:"@amplitude/session-replay-browser",standaloneSDKVersion:a}},e.prototype.initializeNetworkObservers=function(){var t,r,n;return x(this,void 0,void 0,function(){var i,s;return T(this,function(a){switch(a.label){case 0:if(!(!((n=(r=(t=this.config)===null||t===void 0?void 0:t.loggingConfig)===null||r===void 0?void 0:r.network)===null||n===void 0)&&n.enabled&&!this.networkObservers))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,et(()=>import("./observers-_h1yUw9p.js"),__vite__mapDeps([24,4,2,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url)];case 2:return i=a.sent().NetworkObservers,this.networkObservers=new i,[3,4];case 3:return s=a.sent(),this.loggerProvider.warn("Failed to import or instantiate NetworkObservers:",s),[3,4];case 4:return[2]}})})},e}(),Be=function(e){return function(){var t=e.config,r=t||Ho(),n=r.loggerProvider,i=r.logLevel;return{logger:n,logLevel:i}}},wp=function(){var e=new _p;return{init:Ne(e.init.bind(e),"init",Be(e)),evaluateTargetingAndCapture:Ne(e.evaluateTargetingAndCapture.bind(e),"evaluateTargetingAndRecord",Be(e)),setSessionId:Ne(e.setSessionId.bind(e),"setSessionId",Be(e)),getSessionId:Ne(e.getSessionId.bind(e),"getSessionId",Be(e)),getSessionReplayProperties:Ne(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",Be(e)),flush:Ne(e.flush.bind(e),"flush",Be(e)),shutdown:Ne(e.shutdown.bind(e),"shutdown",Be(e))}};const Ar=wp();var Ep=Ar.init,Ip=Ar.setSessionId,Cp=Ar.getSessionReplayProperties,Tp=Ar.shutdown;const{IS_STAGING:au}=me(),Pp=au?"4b3cbc660011c10ecccff05f2362790a":"f37e5bc7075dd48157855154e5b7f2dc",dr=we();let bt=null,It=!1,Jt,er=null,qn=null;const xp=["shopping_nb_google","shopping_google"],Ap=()=>xp.includes(gu("utm_campaign").toLowerCase()),Rp=125,Mp=e=>{const t=e??Qs();if(!t||!t.trim())return!1;const r=t.toLowerCase();let n=2166136261;for(let i=0;i<r.length;i++)n^=r.charCodeAt(i),n=Math.imul(n,16777619);return n^=n>>>16,n=Math.imul(n,2246822507),n^=n>>>13,n=Math.imul(n,3266489909),n^=n>>>16,(n>>>0)%1e3<Rp},Op=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,kp=e=>typeof e=="string"&&Op.test(e),Lp=[{type:"exact",path:"/"},{type:"prefix",path:"/account/register"},{type:"exact",path:"/pages/thank-you"},{type:"exact",path:"/pages/dog-cat-flea-tick-protection"},{type:"exact",path:"/pages/dog-flea"},{type:"exact",path:"/pages/compare-best-pet-insurances"},{type:"exact",path:"/pages/membership-plans"},{type:"exact",path:"/pages/how-it-works"},{type:"prefix",path:"/products/",condition:Ap,postReadySample:Mp}],ou=e=>Lp.find(({type:t,path:r,condition:n})=>(t==="prefix"?e.startsWith(r):e===r)&&(n?.()??!0)),Si=(e=!0)=>{const t=window.location.pathname;if(e&&er!==null&&qn===t)return er;const r=ou(t)!==void 0;return er=r,qn=t,r},Dp=(e=5e3)=>new Promise(t=>{const r=setTimeout(()=>{console.warn("[Amplitude Session Replay] Analytics ready timeout"),t()},e);dr.segmentReady(()=>{clearTimeout(r),t()})}),_i=()=>{const e=document.cookie.match(/analytics_session_id=(\d+)/);return e?parseInt(e[1],10):void 0},Fp=async()=>
32{if(Si()){if(!bt){const e=ou(window.location.pathname);bt=(async()=>{await Dp();const{deviceId:t}=dr.segmentUserData();if(t!=null&&typeof t!="string")return;const r=t||Qs();if(!kp(r)||!e||e.postReadySample&&!e.postReadySample(r))return;const n=_i();await Ep(Pp,{deviceId:r,sessionId:n,debugMode:au}).promise,It=!0})().catch(t=>{throw console.error("[Amplitude Session Replay] Failed to initialize:",t),bt=null,t})}return bt}},Np=async e=>{if(It)try{await Ip(e).promise}catch(t){console.error("[Amplitude Session Replay] Failed to update session ID:",t)}},Bp=()=>{if(It){try{Tp()}catch(e){console.error("[Amplitude Session Replay] Failed to shutdown:",e)}It=!1,bt=null,er=null,qn=null}},Up=()=>{if(It){if(!Si()){Bp();return}try{return Cp()}catch(e){console.error("[Amplitude Session Replay] Failed to get session replay properties:",e);return}}},qp=()=>{const e=_i();e&&e!==Jt&&e>(Jt||0)&&(Jt=e,Np(e))},$p=async()=>{Si()&&dr.segmentReady(()=>{const e=dr.segmentAnalyticsInstance();if(!e){console.error("[Session Replay] Could not find Segment analytics instance");return}Jt=_i(),e.addSourceMiddleware(({payload:t,next:r})=>{qp();const n=Up();n&&t.obj?.properties&&(t.obj.properties={...t.obj.properties,...n}),r(t)}),Fp().catch(t=>{console.error("[Amplitude Session Replay] Initialization failed:",t)})})};Fh();$p();Dh.mount();window.Alpine=V;V.start();xu();Nh([Q.Apoquel,Q.BravectoForCats,Q.BravectoForDogs,Q.CapstarFleaTreatment,Q.Clomicalm,Q.Credelio1Month,Q.Credelio3Months,Q.Credelio6Months,Q.CredelioCAT3Months,Q.CredelioCAT6Months,Q.EicosaDermOmega3Liquid,Q.FecalFloatWithGiardiaELISAKit,Q.FeliwayMultiCatStarterKit,Q.FeliwayOptimumDiffuserRefill,Q.FeliwayTravelSpray,Q.Galliprant,Q.Incurin,Q.MovoflexSoftChews,Q.NexGard1Month,Q.NexGard3Months,Q.NexGard6Months,Q.NutraMaxCosequinDS]);export{W as g,Go as o};
33//# sourceMappingURL=main-D0kbgca-.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.