import{F as b,H as h,G as y,ao as L,w as I}from"./D0ctIA8a.js";import{v as V}from"./CgvMZ2R4.js";function T(e,t,r){b(()=>{var n=h(()=>t(e,r==null?void 0:r())||{});if(r&&(n!=null&&n.update)){var d=!1,a={};y(()=>{var o=r();L(o),d&&I(a,o)&&(a=o,n.update(o))}),d=!0}if(n!=null&&n.destroy)return()=>n.destroy()})}const m=e=>{typeof window<"u"&&(typeof window.dataLayer>"u"&&(window.dataLayer=[]),window.dataLayer.push(e))},c=(e,t)=>m({event:e,events:t}),p=(e,t)=>`app://${e}/${t}`,v=e=>{const{contentType:t,id:r}=e,n={...e,siteRoot:{segment:"news",title:"ABC News"},productionUnit:"Story Lab",contentSource:"app"};return t&&r&&(n.uri=p(t,r)),n},k=e=>{m({document:v(e)})},B=()=>c("pageView"),A=e=>c("interact",e),C=e=>c("share",e),G=e=>c("read",e),D=e=>c("moduleView",e);{const e=new Map(document.cookie.split(";").map(t=>t.trim().split("=",2)));m({application:{environment:"production",generatorVersion:V},user:{userId:e.get("ABCAccountID"),guestId:e.get("ABCGuestID")}})}const H=e=>t=>{const{module:r,targets:n=[],recordView:d=!1,onSeen:a}=Object.assign({},t.dataset,e),o=p("module",r);t.dataset.module=r;const E=i=>{i.forEach(s=>{if(s.intersectionRatio>0){const{target:w}=s;u.unobserve(w),d&&D({uri:o}),a&&a()}})};k({embedded:{[p("module",r)]:v({id:r,contentType:"module",items:n.map(i=>({uri:i}))})}});const u=new IntersectionObserver(E),l=i=>{const{target:s,type:w}=i;if(s&&(s instanceof HTMLElement||s instanceof SVGElement)){const g=s.dataset.uri?s:s.closest("[data-uri]"),f=g instanceof HTMLElement?g.dataset.uri:null;f&&n.includes(f)&&A({trigger:"user initiated",action:"click",target:f,uri:o})}};return t.addEventListener("click",l),u.observe(t),()=>{t.removeEventListener("click",l),u.unobserve(t)}};export{T as a,H as b,C as c,k as d,B as e,G as f,p,A as r};