PageSourceSearch

https://www.rifftrax.com/sites/all/themes/dante/dist/hero_layout.js

js rifftrax.com collected 2026-10-01 11:24:56 UTC 7,133 bytes, 1 lines download raw bytes

1import{__toESM as e}from"./chunks/1789588560/DwhA72BA.js";import"./chunks/1789588560/BwePz0_j.js";import"./chunks/1789588560/huvI58Oe.js";import{QueryClientProvider as t,api as l,require_jsx_runtime as r,require_react as s,trackEvent as n,useQuery as i,useUser as a}from"./chunks/1789588560/BmfL6bJN.js";import"./chunks/1789588560/BquWGr95.js";import"./chunks/1789588560/BkiG42WH.js";import"./chunks/1789588560/CenyWr5S.js";import{renderApp as o}from"./chunks/1789588560/w0wygjsK.js";import{motion as u}from"./chunks/1789588560/BgH17wEP.js";import"./chunks/1789588560/C_xjKaoM.js";import{AnimatePresence as c}from"./chunks/1789588560/x3KYsL9P.js";import{useIsNewCustomer as d}from"./chunks/1789588560/CXNVwooJ.js";import{Hero as m,useSwipeable as h,useWrappingCounter as p}from"./chunks/1789588560/BwrcLQUZ.js";import"./chunks/1789588560/CELVK5aU.js";import"./chunks/1789588560/B2xX7U0l.js";import"./chunks/1789588560/C5sy-Vlx.js";var x=e(s(),1),f=e(r(),1);let w={FacetedProductCarousel:(0,x.lazy)(()=>import("./chunks/1789588560/wgb1jD4x.js"))},j=({item:e,slot:t})=>{switch(e.type){case"image":return(0,f.jsx)(g,{item:e,slot:t});case"react":return(0,f.jsx)(v,{item:e});case"html":return(0,f.jsx)(b,{item:e});default:return null}},g=({item:e,slot:t})=>{let l=(0,f.jsx)("img",{src:e.image_url,alt:e.alt_text||"",className:"w-full h-full max-w-full object-cover"});return e.link_url?(0,f.jsx)("a",{href:e.link_url,onClick:()=>n("select_content",{content_type:"hero_sidebar",item_id:e.id,item_name:e.alt_text||e.link_url,click_target:t}),target:e.target||"_self",rel:"_blank"===e.target?"noopener noreferrer":void 0,className:"block w-full h-full overflow-hidden",children:l}):l},v=({item:e})=>{let t=w[e.component];return t?(0,f.jsx)(x.Suspense,{fallback:(0,f.jsx)("div",{className:"w-full h-full bg-base-200 animate-pulse"}),children:(0,f.jsx)(t,{...e.props||{}})}):null},b=({item:e})=>(0,f.jsx)("div",{className:"w-full h-full max-w-full overflow-hidden [&_img]:max-w-full [&_img]:h-auto",dangerouslySetInnerHTML:{__html:e.content}}),k=({items:e=[],isLoading:t,slot:l})=>{let{index:r,increment:s,setIndex:n}=p(e.length),[i,a]=(0,x.useState)(!1),[o,d]=(0,x.useState)(0),[m,w]=(0,x.useState)(1),g=(0,x.useRef)(0),v=(0,x.useRef)(Date.now()),b=(0,x.useCallback)(e=>{w(e),s(e)},[s]);(0,x.useEffect)(()=>{e.length>0&&r<0&&n(0)},[e.length,r,n]),(0,x.useEffect)(()=>{g.current=0,d(0),v.current=Date.now()},[r]),(0,x.useEffect)(()=>{if(e.length<=1)return;let t=setInterval(()=>{if(i)v.current=Date.now();else{let e=Date.now(),t=e-v.current;v.current=e,g.current+=t,d(Math.min(g.current/1e4*100,100)),g.current>=1e4&&b(1)}},50);return()=>clearInterval(t)},[e.length,b,i]);let k=(0,x.useCallback)(()=>a(!0),[]),y=(0,x.useCallback)(()=>a(!1),[]),_=h({onSwipedLeft:()=>b(1),onSwipedRight:()=>b(-1),swipeDuration:250,preventScrollOnSwipe:!0});if(t)return(0,f.jsx)("div",{"data-theme":"dark",className:"w-full h-full bg-base-200 animate-pulse rounded-lg"});if(0===e.length)return null;let N=r<e.length?r:0,S=e[N];if(!S)return null;let C=e.length>1;return(0,f.jsxs)("div",{"data-theme":"dark",className:"flex flex-col h-full w-full max-w-full overflow-hidden",onMouseEnter:k,onMouseLeave:y,children:[(0,f.jsxs)("div",{className:"group relative flex-1 overflow-hidden rounded-lg bg-base-200",...C?_:{},children:[(0,f.jsx)(c,{mode:"wait",custom:m,initial:!1,children:(0,f.jsx)(u.div,{custom:m,variants:{enter:e=>({x:e>0?"8%":"-8%",opacity:0}),center:{x:0,opacity:1},exit:e=>({x:e>0?"-8%":"8%",opacity:0})},initial:"enter",animate:"center",exit:"exit",transition:{x:{duration:.35,ease:[.16,1,.3,1]},opacity:{duration:.25}},className:"w-full h-full",style:S.border_color?{border:`2px solid ${S.border_color}`,borderRadius:"0.5rem",boxSizing:"border-box"}:void 0,children:(0,f.jsx)(j,{item:S,slot:l})},S.id)}),C&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("button",{type:"button",onClick:()=>b(-1),className:"absolute left-2 top-1/2 -translate-y-1/2 w-8 h-8 flex items-center justify-center rounded-full bg-black/50 text-white opacity-0 group-hover:opacity-100 transition-all cursor-pointer hover:bg-primary hover:scale-110","aria-label":"Previous slide",children:(0,f.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4","aria-hidden":"true",children:(0,f.jsx)("polyline",{points:"15 18 9 12 15 6"})})}),(0,f.jsx)("button",{type:"button",onClick:()=>b(1),className:"absolute right-2 top-1/2 -translate-y-1/2 w-8 h-8 flex items-center justify-center rounded-full bg-black/50 text-white opacity-0 group-hover:opacity-100 transition-all cursor-pointer hover:bg-primary hover:scale-110","aria-label":"Next slide",children:(0,f.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4","aria-hidden":"true",children:(0,f.jsx)("polyline",{points:"9 18 15 12 9 6"})})})]}),C&&(0,f.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-1 bg-black/20",children:(0,f.jsx)("div",{className:"h-full bg-primary transition-none",style:{width:`${o}%`}})})]}),C&&(0,f.jsx)("div",{className:"flex justify-center gap-1 py-2",children:e.map((e,t)=>(0,f.jsx)("button",{type:"button",className:`w-2 h-2 rounded-full transition-colors cursor-pointer ${t===N?"bg-primary":"bg-base-300"}`,onClick:()=>{w(t>=N?1:-1),n(t)},"aria-label":`Slide ${t+1}`},e.id))})]})},y=({heroNids:e=[],showNewBadge:t=!1,newWithinDays:r=30})=>{var s,n;let{data:o,isLoading:u}=i({queryKey:["heroSidebarItems"],queryFn:async()=>await l.get("/api/dante/hero_sidebar").json(),staleTime:6e4}),c=d(),{uid:h,roles:p}=a(),w=(0,x.useMemo)(()=>{let e=new Set(Object.values(p||{}));return e.add(h>0?"authenticated user":"anonymous user"),e},[h,p]),j=(0,x.useCallback)(e=>(e||[]).filter(e=>{var t;let l=e.audience_rule;if((null==l?void 0:l.kind)==="role"){let e=l.include||[];return!(l.exclude||[]).some(e=>w.has(e))&&(0===e.length||e.some(e=>w.has(e)))}let r=null!=(t=null==l?void 0:l.visitor)?t:e.audience;return!r||"all"===r||"new_customer"===r&&c}),[c,w]),g=Math.min(null!=(s=null==(n=window.Drupal)||null==(n=n.settings)?void 0:n.dante_heroMaxItems)?s:6,10),v=e.slice(0,g);return(0,f.jsxs)("div",{className:"grid gap-4 grid-cols-2 md:gap-x-4 md:gap-y-2 md:grid-cols-3 md:items-center max-w-full overflow-hidden",children:[(0,f.jsx)("div",{className:"col-span-2 md:row-span-2 md:p-0 md:m-0 min-w-0",children:(0,f.jsx)(m,{nids:v,showNewBadge:t,newWithinDays:r})}),(0,f.jsx)("div",{className:"col-span-2 md:col-span-1 px-6 sm:px-12 md:px-0 min-w-0 
1w-full overflow-hidden aspect-video",children:(0,f.jsx)(k,{items:j(null==o?void 0:o.slot_1),isLoading:u,slot:"slot_1"})}),(0,f.jsx)("div",{className:"col-span-2 md:col-span-1 px-6 sm:px-12 md:px-0 min-w-0 w-full overflow-hidden aspect-video",children:(0,f.jsx)(k,{items:j(null==o?void 0:o.slot_2),isLoading:u,slot:"slot_2"})})]})};o(({products:e,newbadge:l,newwithindays:r})=>(0,f.jsx)(t,{children:(0,f.jsx)(y,{heroNids:e.map(({nid:e})=>e),showNewBadge:!!l,newWithinDays:Number(r)||30})}),"hero_layout");

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.