1import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,r as n}from"./framework-C-kvl5Nm.js";import{c as r}from"./index-B4I92b9X.js";import{Localized as i}from"./localization-CO-4PPYb.js";import{t as a}from"./icon-DPcGqS8O.js";var o=e(t(),1),s=n();function c(){let e=r(),t=(0,o.useRef)(null),n=(0,o.useRef)(null),c=(0,o.useRef)(null),l=(0,o.useRef)(null),u=(0,o.useRef)(0),d=(0,o.useRef)(!0),[f,p]=(0,o.useState)(!1),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(``),v=e.startsWith(`/staff`);(0,o.useEffect)(()=>{function e(){u.current++,t.current?.pause(),p(!1),h(!1)}function n(){document.hidden&&e()}return document.addEventListener(`visibilitychange`,n),window.addEventListener(`pagehide`,e),()=>{document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`pagehide`,e)}},[]),(0,o.useEffect)(()=>{v&&(u.current++,t.current?.pause(),p(!1),h(!1))},[v]),(0,o.useEffect)(()=>{if(v||!d.current)return;try{if(localStorage.getItem(`mdw-sound`)===`off`){d.current=!1;return}}catch{}b(`auto`);function e(e){!d.current||e.target instanceof Element&&e.target.closest(`.site-music`)||b(`gesture`)}return document.addEventListener(`click`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`click`,e),document.removeEventListener(`keydown`,e)}},[v]),(0,o.useEffect)(()=>()=>{n.current?.close()},[]);function y(){d.current=!1;try{localStorage.setItem(`mdw-sound`,f||m?`off`:`on`)}catch{}if(f||m){u.current++,t.current?.pause(),p(!1),h(!1);return}b(`manual`)}async function b(e){let r=t.current;if(!r||document.hidden)return;let i=++u.current;h(!0),_(``);try{if(!n.current&&typeof AudioContext<`u`){let e=new AudioContext,t=e.createGain();e.createMediaElementSource(r).connect(t),t.connect(e.destination),n.current=e,c.current=t}let t=n.current,a=c.current;if(e===`auto`&&t?.state===`suspended`||(d.current=!1,t&&a?(a.gain.cancelScheduledValues(t.currentTime),a.gain.setValueAtTime(0,t.currentTime)):r.volume=.18,await Promise.all([t?.resume(),r.play()]),i!==u.current))return;t&&a&&a.gain.linearRampToValueAtTime(.18,t.currentTime+2.5),p(!0)}catch{i===u.current&&(r.pause(),p(!1),e===`auto`?d.current=!0:_(`Music couldnât start. Tap Sound on to try again.`))}finally{i===u.current&&h(!1)}}return(0,s.jsx)(i,{children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`audio`,{ref:t,src:`/audio/call-to-adventure.mp3`,preload:`none`,loop:!0,onPause:()=>p(!1),onError:()=>{p(!1),h(!1),_(`Music is unavailable. Please try again.`)}}),!v&&(0,s.jsxs)(`div`,{className:`site-music ${e.startsWith(`/book`)?`on-booking`:``}`,children:[(0,s.jsxs)(`div`,{className:`music-pill`,children:[(0,s.jsxs)(`button`,{type:`button`,className:`music-toggle`,onClick:y,"aria-pressed":f,"aria-label":m?`Cancel background music`:f?`Mute background music`:`Play background music`,children:[(0,s.jsxs)(`span`,{className:`music-levels`,"data-playing":f,"aria-hidden":`true`,children:[(0,s.jsx)(`i`,{}),(0,s.jsx)(`i`,{}),(0,s.jsx)(`i`,{}),(0,s.jsx)(`i`,{})]}),(0,s.jsx)(`span`,{children:m?`Cancel music`:f?`Sound off`:`Sound on`})]}),(0,s.jsx)(`button`,{type:`button`,className:`music-info`,"aria-label":`Music credits`,onClick:()=>l.current?.showModal(),children:`i`})]}),g&&(0,s.jsx)(`p`,{className:`music-error`,role:`status`,children:g}),(0,s.jsxs)(`dialog`,{ref:l,className:`music-credits`,"aria-labelledby":`music-credit-title`,onClick:e=>{e.target===e.currentTarget&&l.current?.close()},children:[(0,s.jsx)(`button`,{type:`button`,className:`dialog-close`,"aria-label":`Close music credits`,onClick:()=>l.current?.close(),children:(0,s.jsx)(a,{name:`close`})}),(0,s.jsx)(`p`,{className:`eyebrow`,children:`THE WEBSITE SOUNDTRACK`}),(0,s.jsx)(`h2`,{id:`music-credit-title`,children:`Call to Adventure`}),(0,s.jsxs)(`p`,{children:[`Kevin MacLeod · `,(0,s.jsx)(`a`,{href:`https://incompetech.com/music/royalty-free/index.html?isrc=USUAN1300022`,target:`_blank`,rel:`noreferrer`,children:`incompetech.com`})]}),(0,s.jsxs)(`p`,{children:[`Licensed under `,(0,s.jsx)(`a`,{href:`https://creativecommons.org/licenses/by/4.0/`,target:`_blank`,rel:`noreferrer`,children:`Creative Commons: By Attribution 4.0`}),`.`]}),(0,s.jsx)(`p`,{children:`Original recording, played at reduced volume with a fade-in. Website background music; not a recording of the live show.`})]})]})]})})}export{c as SiteMusic};
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.