PageSourceSearch

https://malibutimes.com/assets/AdSlot-BZGFqFLf.js

js malibutimes.com collected 2026-09-24 19:12:30 UTC 4,355 bytes, 1 lines download raw bytes

1import{y as B,u as U,b as V,s as E,j as _,a as $,r as C}from"./index-obhH_LhV.js";import{I as F}from"./SiteShell-DO5yyJRk.js";import{b as d,u as K}from"./react-vendor-iJun6VP1.js";import{s as Y}from"./sanitize-CtKkT6de.js";import{l as Z,a as J,b as P,g as G}from"./adZones-C042cRiq.js";const j=.5,D=1e3,Q=5e3,M="https://hqywacyhpllapdwccmaw.supabase.co/functions/v1/track-ad-event";let g=[],S=null,W=!1;function b(){if(g.length===0)return;const n=g.splice(0,g.length),s=JSON.stringify({events:n});if(typeof navigator<"u"&&navigator.sendBeacon){const c=new Blob([s],{type:"application/json"});navigator.sendBeacon(M,c)}else fetch(M,{method:"POST",headers:{"Content-Type":"application/json"},body:s,keepalive:!0}).catch(()=>{})}function X(){S===null&&(S=window.setTimeout(()=>{b(),S=null},Q))}function ee(){W||typeof window>"u"||(W=!0,window.addEventListener("pagehide",b),document.addEventListener("visibilitychange",()=>{document.hidden&&b()}))}function q(){const n=window.innerWidth;return n<768?"mobile":n<1024?"tablet":"desktop"}function H(){try{return sessionStorage.getItem("sp_session")}catch{return null}}function te(n,{placementId:s,pagePath:c,storyId:v}){const h=d.useRef(!1),r=d.useRef(null);d.useEffect(()=>{if(h.current=!1,r.current=null,!n.current||!s||typeof navigator<"u"&&navigator.webdriver)return;ee();const u=new IntersectionObserver(y=>{const m=y[0];m.intersectionRatio>=j?r.current||(r.current=Date.now(),window.setTimeout(()=>{if(r.current&&!h.current){const o=Date.now()-r.current;o>=D&&(h.current=!0,g.push({placement_id:s,event_type:"impression",page_path:c,story_id:v??null,session_id:H(),reader_id:B(),device_type:q(),viewport_pct:Math.round(m.intersectionRatio*100),visible_ms:o}),X(),u.disconnect())}},D)):r.current=null},{threshold:[0,j]});return u.observe(n.current),()=>u.disconnect()},[n,s,c,v])}function ne({placementId:n,pagePath:s,storyId:c}){g.push({placement_id:n,event_type:"click",page_path:s,story_id:c??null,session_id:H(),reader_id:B(),device_type:q()}),b()}const I={},z={width:1200,height:200};function ie(){return new Date().toLocaleDateString("en-CA",{timeZone:"America/Los_Angeles"})}function ce({slug:n,size:s,zone:c,style:v,usedIds:h,onClaimed:r}){const u=U(),y=V(),m=K().pathname,o=n||c||s||"leaderboard",[t,x]=d.useState(null),[,T]=d.useState(!1),[w,L]=d.useState(z),k=d.useRef(null);te(k,{placementId:(t==null?void 0:t.id)??"",pagePath:m,storyId:y}),d.useEffect(()=>{let i=!1;return(async()=>{if(await Z(),i)return;const e=G(o);e!=null&&e.width&&(e!=null&&e.height)?L({width:e.width,height:e.height}):L(z),await O()})(),()=>{i=!0}},[u.id,o]);function R(i){const{placements:e,fallback:a}=i;if(e&&e.length){const l=h?e.filter(A=>!h.has(A.id)):e,p=l.length?l:e,f=p[Math.floor(Math.random()*p.length)];return r&&r(f.id),f}return a?{creative_html:a}:null}async function O(){await J();const i=ie(),e=`${P({siteId:u.id,slug:o})}:${i}`;if(I[e]!==void 0){x(R(I[e]||{placements:[],fallback:null})),T(!0);return}const{data:a}=await E.from("ad_zones").select("id, slug, fallback_code").eq("publication_id",u.id).eq("is_active",!0).eq("is_visible_on_site",!0).eq("slug",o);let l={placements:[],fallback:null};if(a!=null&&a.length){const p=a.map(A=>A.id),{data:f}=await E.from("ad_placements").select("id, creative_url, creative_html, click_url, alt_text, impressions").in("ad_zone_id",p).eq("is_active",!0).lte("start_date",i).gte("end_date",i);l={placements:f||[],fallback:a[0].fallback_code||null}}I[e]=l,x(R(l)),T(!0)}function N(){t!=null&&t.id&&ne({placementId:t.id,pagePath:m,storyId:y})}if(t){const i=w.width>=600,e=i?"75%":"100%",a=i?"none":w.width,l={width:e,maxWidth:a,overflow:"hidden",margin:`${$[6]}px auto`,textAlign:"center",...v};if(t.creative_html)return _.jsx("div",{ref:k,className:"ad-slot","data-ad-zone":o,style:l,children:_.jsx("div",{dangerouslySetInnerHTML:{__html:Y(t.creative_html)}})});if(t.creative_url){const p=i?{width:"100%",height:"auto",borderRadius:C.sm,display:"block"}:{maxWidth:"100%",height:"auto",maxHeight:w.height,borderRadius:C.sm},f=_.jsx(F,{src:t.creative_url,w:w.width,alt:t.alt_text||"Advertisement",style:p,loading:"lazy"});return _.jsx("div",{ref:k,className:"ad-slot","data-ad-zone":o,style:l,children:t.click_url?_.jsx("a",{href:t.click_url,target:"_blank",rel:"noopener noreferrer sponsored",onClick:N,children:f}):f})}}return null}export{ce as A,ne as t,te as u};

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.