PageSourceSearch

https://aof.dk/assets/CourseInfoGrid-BF-x-BaA.js

js aof.dk collected 2026-10-03 19:39:21 UTC 11,145 bytes, 1 lines download raw bytes

1import{j as e,r as v,u as ne}from"./entry-client-D1PaMr5D.js";import{I as _}from"./InfoLine-DNIkUHJp.js";import{c as C}from"./clsx-B-dksMZM.js";import{H as O}from"./HtmlText-XL0wKobx.js";import{u as ce,L as X}from"./useAvailableSeats-BHZAVm7y.js";import{t as F,f as Z}from"./tracking-Z-Ni9SXd.js";import{I as de}from"./ImageShape-iOJ5nFI7.js";import{B as P}from"./Button-B4dpIOxM.js";import{S as z}from"./Sprite-dPPLzmC-.js";import{A as W}from"./disclosure-dgfV7s_Q.js";import{u as oe}from"./useMedia-Cyz7mXHt.js";import{s as me}from"./screens-B02I67MW.js";import{q as fe}from"./transition-oXpkvJwb.js";import"./hyphenation-lJJzaKAp.js";import"./Image-BiToVRkk.js";import"./bundle-mjs-D696Ktp4.js";import"./utils-zfUgGo0J.js";import"./keyboard-CJGOARu6.js";import"./use-is-mounted-CJ1i0FOp.js";const L={white:" bg-white",orange:"bg-orange-80"};function he({label:s,children:r,bgColor:d="white"}){return e.jsx("div",{className:C(L[d],"w-full rounded"),children:e.jsx(W,{children:({open:h})=>e.jsxs(e.Fragment,{children:[e.jsxs(W.Button,{className:C(L[d],"flex w-full items-center justify-between rounded p-4 text-left font-medium"),children:[s,e.jsx(z,{id:"chevron-down",className:C(h&&"rotate-180","m-2 h-2 w-4")})]}),e.jsx(W.Panel,{className:"space-y-6 px-4 py-6",children:r})]})})})}var M=new Map,q=new WeakMap,ee=0,xe=void 0;function pe(s){return s?(q.has(s)||(ee+=1,q.set(s,ee.toString())),q.get(s)):"0"}function ue(s){return Object.keys(s).sort().filter(r=>s[r]!==void 0).map(r=>`${r}_${r==="root"?pe(s.root):s[r]}`).toString()}function ve(s){const r=ue(s);let d=M.get(r);if(!d){const h=new Map;let m;const x=new IntersectionObserver(c=>{c.forEach(t=>{var f;const b=t.isIntersecting&&m.some(u=>t.intersectionRatio>=u);s.trackVisibility&&typeof t.isVisible>"u"&&(t.isVisible=b),(f=h.get(t.target))==null||f.forEach(u=>{u(b,t)})})},s);m=x.thresholds||(Array.isArray(s.threshold)?s.threshold:[s.threshold||0]),d={id:r,observer:x,elements:h},M.set(r,d)}return d}function je(s,r,d={},h=xe){if(typeof window.IntersectionObserver>"u"&&h!==void 0){const f=s.getBoundingClientRect();return r(h,{isIntersecting:h,target:s,intersectionRatio:typeof d.threshold=="number"?d.threshold:0,time:0,boundingClientRect:f,intersectionRect:f,rootBounds:f}),()=>{}}const{id:m,observer:x,elements:c}=ve(d),t=c.get(s)||[];return c.has(s)||c.set(s,t),t.push(r),x.observe(s),function(){t.splice(t.indexOf(r),1),t.length===0&&(c.delete(s),x.unobserve(s)),c.size===0&&(x.disconnect(),M.delete(m))}}function ge({threshold:s,delay:r,trackVisibility:d,rootMargin:h,root:m,triggerOnce:x,skip:c,initialInView:t,fallbackInView:f,onChange:b}={}){var u;const[N,B]=v.useState(null),T=v.useRef(b),[E,A]=v.useState({inView:!!t,entry:void 0});T.current=b,v.useEffect(()=>{if(c||!N)return;let p;return p=je(N,(w,I)=>{A({inView:w,entry:I}),T.current&&T.current(w,I),I.isIntersecting&&x&&p&&(p(),p=void 0)},{root:m,rootMargin:h,threshold:s,trackVisibility:d,delay:r},f),()=>{p&&p()}},[Array.isArray(s)?s.toString():s,N,m,h,x,c,d,f,r]);const i=(u=E.entry)==null?void 0:u.target,j=v.useRef(void 0);!N&&i&&!x&&!c&&j.current!==i&&(j.current=i,A({inView:!!t,entry:void 0}));const g=[B,E.inView,E.entry];return g.ref=g[0],g.inView=g[1],g.entry=g[2],g}function we({tag:s}){return e.jsx("a",{href:s.href,className:C("rounded-3xl bg-blue-90 py-0.5 px-2 text-sm text-blue-20 hover:bg-blue-80 focus:bg-blue-60"),children:s==null?void 0:s.label})}const $=(s,r)=>s?s.includes("{numberOfAvailableSeats}")?s.replace("{numberOfAvailableSeats}",String(r)):s:void 0;function ye({course:s,umbracoId:r,htmlText:d,detailsHeadline:h,isFinished:m=!1,priceText:x,teacher:c,buttonLink:t,accordion:f,timesHeadline:b,timesList:u,courseNumber:N,schoolName:B,schoolLink:T,signupDescription:E,categoryTags:A}){var J,Q;const{t:i}=ne(),j=[],{location:g,weekdays:p,title:w,level:I,lessonLength:G,numberOfLessons:H,date:U,price:S}=s||{},{ref:se,inView:le}=ge({fallbackInView:!0}),ae=oe({minWidth:me.lg}),[te,re]=v.useState(!0),{data:l,isLoading:k,isError:D,refetch:K}=ce((r==null?void 0:r.toString())||"",3e5,6e5,3e3),[R,V]=v.useState(!1),y=t!=null&&t.href?$(t.href,l==null?void 0:l.availableSeats):void 0,Y=v.useRef(!1);if(!Y.current&&typeof window<"u"&&(Y.current=!0,F("view_item",{ecommerce:{items:[{item_id:s==null?void 0:s.id,item_name:w,currency:"DKK",item_category:s==null?void 0:s.category,price:S}]}})),s!=null&&s.location&&g&&j.push(e.jsx(_,{icon:"pin",value:g,truncate:!1})),s&&p)for(let a=0;a<p.length;a++)j.push(e.jsx(_,{icon:"event-repeat",value:i("eventDate",{weekday:p[a].courseWeekDay,fromTime:p[a].courseStartTime,toTime:p[a].courseEndTime}),truncate:!1}));return s&&G&&H&&j.push(e.jsx(_,{icon:"repeat",value:i("cadence",{lessons:H,meetings:G}),truncate:!1})),s!=null&&s.date&&U&&j.push(e.jsx(_,{icon:"rocket-launch",value:U,truncate:!1})),N&&j.push(e.jsx(_,{icon:"level",value:`${i("courseNumber")} ${N}`,truncate:!1})),B&&j.push(e.jsx(_,{icon:"home",value:i("contact_school",{schoolName:B}),link:T,truncate:!1})),v.useEffect(()=>{const a=()=>{re(window.scrollY<104)};return window.addEventListener("scroll",a),()=>{window.removeEventListener("scroll",a)}},[]),v.useEffect(()=>{if(typeof window>"u")return;const a=()=>{V(!1)};return window.addEventListener("pageshow",a),()=>window.removeEventListener("pageshow",a)},[]),e.jsxs(e.Fragment,{children:[e.jsx(fe,{show:te||!ae||!le,enter:"transition-opacity duration-100",enterFrom:"opacity-0 ",enterTo:"opacity-100",leave:"transition-opacity duration-150",leaveFrom:"opacity-100",leaveTo:"opacity-0",as:"span",children:e.jsx("div",{className:"fixed bottom-0 z-10 w-full items-center border-t border-black-60 bg-white !py-4 lg:top-14 lg:h-[60px] lg:border-t-0 lg:bg-white/90 lg:!py-2",children:e.jsx("div",{className:"container flex h-full items-center justify-end lg:w-full lg:flex-initial",children:e.jsxs("div",{className:"flex grow items-center justify-between lg:shrink lg:grow-0 lg:justify-end",children:[!m&&s&&S!==void 0&&e.jsxs("p",{children:[e.jsx("span",{className:"pr-2 text-xl font-medium",children:Z(S)}),x]}),m?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"pr-2",children:i("label.salesClosed")}),e.jsx(X,{variant:"isClosed",children:i("label.isClosed")})]}):e.jsx(e.Fragment,{children:D?null:y&&(t!=null&&t.href)?e.jsx(P,{href:y,isPending:k||R,disabled:k||R,onClick:async a=>{if(a.preventDefault(),R)return;V(!0);let n=l;try{const o=await K();o.error||(n=o.data)}catch{n=l}if(y){F("add_to_cart",{ecommerce:{items:[{item_id:(s==null?void 0:s.id)||w,item_name:w,currency:"DKK",item_category:s==null?void 0:s.category,price:S,quantity:s==null?void 0:s.quantity}]}});const o=$(t.href,n==null?void 0:n.availableSeats);window.location.href=o||y}else V(!1)},className:"inline-block lg:ml-6 lg:z-40",children:D?"Prøv igen":l!=null&&l.showWaitList?i("course.waitlist"):(l==null?void 0:l.availableSeats)!==0?i("course.signUp"):null}):null})]})})})}),e.jsxs("div",{className:"container grid grid-cols-1 gap-y-10 md:gap-y-14 lg:grid-cols-12 lg:gap-y-24",children:[e.jsxs("div",{className:"space-y-4 lg:col-span-6 lg:row-span-1",children:[(J=l==null?void 0:l.labels)!=null&&J.length?e.jsx("div",{className:C("flex flex-row flex-wrap gap-1","transition duration-200 ease-out",k?"opacity-0":"opacity-100"),children:(Q=l==null?void 0:l.labels)==null?void 0:Q.map(a=>e.jsx(X,{variant:a,children:i(`label.${a}`)},a))}):null,e.jsx("h1",{className:"style-headline-lg",children:w}),s&&I&&e.jsx(_,{icon:"level",value:I}),e.jsx("div",{className:C("prose max-w-none"),children:e.jsx(O,{html:d})}),E?e.jsxs("div",{className:"prose",children:[e.jsx("h2",{className:"mb-4",children:i("signup_notice")}),e.jsx(O,{html:E})]}):null,A&&A.length>0?e.jsx("ul",{className:"mt-6 flex flex-wrap gap-2 pt-6",children:A.map((a,n)=>e.jsx("li",{children:e.jsx(we,{tag:a},n)},n))}):null]}),e.jsx("div",{className:"lg:col-start-8 lg:col-end-13 lg:row-span-2",children:e.jsxs("div",{className:"space-y-8 bg-orange-90 px-6 py-10 md:px-12 md:py-14 lg:py-12",children:[e.jsx("h2",{className:"style-headline-sm",children:h}),e.jsx("div",{className:"space-y-2",children:j.map((a,n)=>e.jsx(v.Fragment,{children:a},n))}),e.jsx("p",{ref:se,children:!m&&s&&S!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"style-headline-md pr-2",children:Z(S)}),x]})}),e.jsxs("div",{className:"grid gap-4",children:[!D&&e.jsxs("span",{className:C("style-label flex w-fit items-center",l!=null&&l.showFewSeats||(l==null?void 0:l.availableSeats)===0?"px-2 py-1":void 0,l!=null&&l.showFewSeats&&(l==null?void 0:l.availableSeats)!==0?"bg-orange-80 text-orange-10":(l==null?void 0:l.availableSeats)===0?"bg-black-80":""),children:[e.jsx(z,{id:"ticket",className:"mr-2 size-5"}),i("label.placesLeft",{count:l==null?void 0:l.availableSeats})]}),!m&&D?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-x-1 text-orange-20",children:[e.jsx(z,{id:"error",className:"size-4"}),e.jsx("p",{className:"text-sm",children:i("course.availableSeats.error")})]}),e.jsx(P,{onClick:()=>K(),variant:"secondary",large:!0,children:i("error.tryAgain")})]}):!m&&y&&(t!=null&&t.href)?e.jsx(P,{large:!0,href:y,isPending:k||R,disabled:k||R,onClick:async a=>{if(a.preventDefault(),R)return;V(!0);let n=l;try{const o=await K();o.error||(n=o.data)}catch{n=l}if(y){F("add_to_cart",{ecommerce:{items:[{item_id:(s==null?void 0:s.id)||w,item_name:w,currency:"DKK",item_category:s==null?void 0:s.category,price:S,quantity:s==null?void 0:s.quantity}]}});const o=$(t.href,n==null?void 0:n.availableSeats);window.location.href=o||y}else V(!1)},className:"inline-block w-fit",children:l!=null&&l.showWaitList?i("course.waitlist"):(l==null?void 0:l.availableSeats)!==0?i("course.signUp"):null}):m?e.jsx("p",{className:"style-headline-sm",children:i("label.salesClosed")}):null]}),e.jsx("div",{className:"space-y-4",children:f==null?void 0:f.map((a,n)=>a.list.length>0&&e.jsxs(he,{label:a.label,bgColor:"orange",children:[e.jsx("div",{className:"space-y-6",children:a.list.map((o,ie)=>e.jsxs("dl",{className:"flex justify-between",children:[e.jsx("dt",{className:"truncate",children:o.text1}),e.jsx("dd",{className:"shrink-0 pl-4",children:o.text2})]},ie+o.text1))}),e.jsx("p",{className:"text-sm",children:a.disclaimerText})]},n+a.label))})]})}),c&&e.jsxs("div",{className:"space-y-4 lg:col-span-6 lg:row-span-2",children:[c.image&&e.jsx(de,{image:c.image}),e.jsx("p",{children:i("teacher.title",{count:1})}),e.jsx("h2",{className:"style-headline-md !mt-1",children:c.fullName}),e.jsx("div",{children:e.jsx(O,{html:c.description})})]}),u!=null&&u.length?e.jsxs("div",{className:"space-y-4 lg:col-start-8 lg:col-end-13 lg:row-span-2",children:[e.jsx("h2",{className:"style-headline-sm",children:b}),e.jsx("ul",{children:u.map((a,n)=>e.jsxs("li",{className:"flex justify-between border-t border-black-80 py-4",children:[e.jsx("span",{className:"truncate",children:a.text}),e.jsxs("a",{className:"flex shrink-0 items-center pl-4 text-blue-40",href:a.link,children:[i("showCourse"),e.jsx(z,{id:"arrow-forward",className:"mx-3 size-3"})]})]},n+a.text))})]}):null]})]})}ye.displayName="CourseInfoGrid";const Pe={htmlTag:"section"};export{ye as CourseInfoGrid,Pe as config,ye as default};

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.