1function m(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}class o{static ensureDataLayer(){window.dataLayer=window.dataLayer||[]}static clearEcommerce(){window.dataLayer.push({ecommerce:null})}static sendEvent(e,t,i=null){if(this.ensureDataLayer(),i){const r=`gtm_sent_${i}`;if(localStorage.getItem(r))return;localStorage.setItem(r,"true")}const n={event:e,...t};this.clearEcommerce(),window.dataLayer.push(n)}static extractCurrencyFromPrice(e){if(!e)return null;const t=String(e).trim();return t.startsWith("$")?"USD":t.startsWith("£")?"GBP":null}static getCurrencyFromBasket(e){const t=e?.purchasables?.[0]?.price,i=this.extractCurrencyFromPrice(t);if(i)return i;const n=e?.summary?.total;return this.extractCurrencyFromPrice(n)||"USD"}static getCurrencyFromOrder(e){const t=e?.purchasables?.[0]?.price,i=this.extractCurrencyFromPrice(t);if(i)return i;const n=e?.summary?.total;return this.extractCurrencyFromPrice(n)||"USD"}static parsePrice(e){return e&&parseFloat(String(e).replace(/[^0-9.]/g,""))||0}static formatCustomer(e){return e?{title:e.title||null,first_name:e.first_name||null,last_name:e.last_name||null,email:e.email||null,mobile_phone:e.mobile_phone||null,user_type:e.type||e.user_type||"guest",is_logged_in:!!window.app?.customer}:{title:null,first_name:null,last_name:null,email:null,mobile_phone:null,user_type:"guest",is_logged_in:!1}}static parseDateTime(e){if(!e)return{date:null,time:null};const t=e.includes("T")?"T":" ",i=e.split(t);return{date:i[0]||null,time:i[1]?.slice(0,5)||null}}static getScreeningInfo(e){const t=e?.screening||{},{date:i,time:n}=this.parseDateTime(t?.local_start_date);return{item_list_id:t?.identifier||t?.id,item_list_name:t?.film_name,screening_date:i,screening_time:n}}static getReducersCoupon(e){const t=e?.reducers||[];return t.length===0?null:t.map(i=>i.code||i.type).join("|")}static formatBasketItems(e,t=!1){const i=[],n=e?.purchasables||[],r=this.getScreeningInfo(e),a=this.getReducersCoupon(e);for(const s of n){const c={item_name:s.name||s.title,item_category:s.purchasable_type,price:this.parsePrice(s.price),...r};t&&(c.coupon=a),i.push(c)}return i}static viewScreeningFromPage(e){if(!e)return;const t=e.film||{},i=window.app?.customer,{date:n,time:r}=this.parseDateTime(e.screening_local_date||e.local_start_date),a=e.venue_name||null;this.sendEvent("view_screening",{customer:this.formatCustomer(i),ecommerce:{venue:a,item_list_id:e.identifier||e.id,item_list_name:t.title||e.title,screening_date:n,screening_time:r}})}static viewScreeningFromCheckout(e,t){if(!e)return;const i=window.app?.customer,{date:n,time:r}=this.parseDateTime(e.local_start_date);let a=e.venue_name;this.sendEvent("view_screening",{customer:this.formatCustomer(i),checkout_ui_variant:window.app?.checkout_ui_variant??null,ecommerce:{venue:a,item_list_id:e.identifier,item_list_name:t?.title,screening_date:n,screening_time:r}})}static addToBasket(e){if(!e)return;const t=e?.customer||window.app?.customer,i=e?.screening?.venue_name||null;this.sendEvent("add_to_basket",{customer:this.formatCustomer(t),checkout_ui_variant:window.app?.checkout_ui_variant??null,ecommerce:{venue:i,currency:this.getCurrencyFromBasket(e),value:this.parsePrice(e?.summary?.total),items:this.formatBasketItems(e,!1)}})}static startedCheckout(e){if(!e)return;const t=e?.customer||window.app?.customer,i=e?.screening?.venue_name||null;this.sendEvent("checkout_started",{customer:this.formatCustomer(t),checkout_ui_variant:window.app?.checkout_ui_variant??null,ecommerce:{venue:i,currency:this.getCurrencyFromBasket(e),value:this.parsePrice(e?.summary?.total),discount:this.parsePrice(e?.summary?.discount),items:this.formatBasketItems(e,!0)}})}static purchaseComplete(e){if(!e)return;const t=e?.customer||window.app?.customer,i=e.identifier,n=`${e.tenant_id||"default"}-${i}`,r=e?.screening?.venue_name||null;this.sendEvent("purchase_complete",{customer:this.formatCustomer(t),checkout_ui_variant:window.app?.checkout_ui_variant??null,ecommerce:{venue:r,transaction_id:i,currency:this.getCurrencyFromOrder(e),tax:this.parsePrice(e?.summary?.sales_tax),value:this.parsePrice(e?.summary?.total),discount:this.parsePrice(e?.summary?.reduced),items:this.formatBasketItems(e,!0)}},n)}}window.GTM=o;class u{static isAvailable(){return!!window.klaviyo}static identify(e){if(!this.isAvailable()||!e?.email)return;const t={$email:e.email,$first_name:e.first_name||null,$last_name:e.last_name||null,$phone_number:e.mobile_phone||null};window.klaviyo.push(["identify",t])}static track(e,t){this.isAvailable()&&window.klaviyo.push(["track",e,t||{}])}static viewedScreening(e){if(!e)return;const t=e.local_start_date||e.screening_local_date||"",i=t.split(/[ T]/)[0]||"",n=(t.split(/[ T]/)[1]||"").replace(/:/g,"").slice(0,4),r=e.film||{},a=r.release_date?new Date(r.release_date).getFullYear():null;this.track("Viewed Screening",{screening_id:e.identifier,screening:r.title||e.title,venue:e.venue_name,screening_local_start_date:i,screening_local_start_time:n,screening_screen:e.screen_name||"",screening_door_time:e.door_time||"",screening_minimum_age:e.minimum_age||"",screening_trailer_duration:e.trailer_duration||"",film_release_year:a,film_rating:r.rating||"",film_duration:r.duration||"",film_trailer:r.trailer_url||"",film_genres:r.genres||[],booking_url:e.booking_url||window.location.href,film_cover_image_url:r.cover_image_url||""})}}window.Klaviyo=u;export{o as G,u as K,m as b};
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.