"use strict";var S=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var le=Object.prototype.hasOwnProperty;var ue=(t,e)=>{for(var n in e)S(t,n,{get:e[n],enumerable:!0})},ce=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ae(e))!le.call(t,o)&&o!==n&&S(t,o,{get:()=>e[o],enumerable:!(i=se(e,o))||i.enumerable});return t};var de=t=>ce(S({},"__esModule",{value:!0}),t);var he={};ue(he,{audio:()=>K,autoplay:()=>G,fool:()=>F,log:()=>q,marquee:()=>$,play:()=>N,share:()=>Y});module.exports=de(he);function q(t){return console.log("log",t),({node:e,options:n,instance:i})=>(console.log("log",{node:e,options:n,instance:i}),e.addEventListener("destroy",function o(){e.removeEventListener("destroy",o)}),null)}function h(t,e,n){let i=n?new CustomEvent(e,n):new Event(e,{bubbles:!0});return t.dispatchEvent(i)}function A(t,e,n=0){let i,o=0,r=0,s=e;function a(){o===1&&(o=2,clearInterval(i),s=n||e-Math.abs(performance.now()-r))}function l(){o===2&&(o=3,setTimeout(L,s))}function c(){o=0,clearInterval(i)}function p(){o=1,r=performance.now(),i=setInterval(()=>{t(),r=performance.now()},e)}function L(){o===3&&(t(),p())}return{play:p,pause:a,resume:l,stop:c}}function N(t,e,n=0){(!t||!Object.keys(t).length)&&(t={duration:1500,delay:0});let{duration:i,delay:o}=t;return({node:r,options:s,instance:a})=>{e||=()=>{!s.loop&&s.index&&s.edged?(h(r,"stop"),l.stop(),n=0):(n=1,a.to(s.index+1))};let l=A(e,i,o);return r.addEventListener("mount",c),r.addEventListener("destroy",l.stop),l;function c(){document.onvisibilitychange=()=>{if(document.visibilityState==="hidden"){if(n!==1)return;h(r,"pause"),l.pause(),n=2}else{if(n!==2)return;h(r,"resume"),l.resume()}},r.onpointerenter=()=>{n===1&&(h(r,"pause"),l.pause(),n=2)},r.onpointerleave=()=>{n===2&&(h(r,"resume"),l.resume())}}}}function $(t={duration:700,delay:1}){let{duration:e,delay:n}=t;return({node:i,options:o,instance:r})=>{let s=A(()=>{r.to(o.index,e/16.667)},Math.abs(e/16.667),n);return i.addEventListener("mount",a),i.addEventListener("destroy",s.stop),s;function a(){o.loop=!0,o.snap=void 0,o.duration=Math.abs(e),s.play(),document.onvisibilitychange=()=>{document.visibilityState==="hidden"?s.pause():s.resume()},i.onpointerenter=()=>s.pause(),i.onpointerleave=()=>s.resume()}}}function F(){return({node:t,instance:e})=>{t.addEventListener("destroy",function i(){t.removeEventListener("destroy",i),t.removeEventListener("index",n)}),t.addEventListener("index",n);function n({detail:{index:i}}){setTimeout(function(){e.update({axis:i%2?"x":"y"})})}}}var z={viewBox:"0 0 24 24",path:"M5.75,3A1.75,1.75,0,0,0,4,4.75v14.5A1.75,1.75,0,0,0,5.75,21h3.5A1.75,1.75,0,0,0,11,19.25V4.75A1.75,1.75,0,0,0,9.25,3ZM5.5,4.75a.25.25,0,0,1,.25-.25h3.5a.25.25,0,0,1,.25.25v14.5a.25.25,0,0,1-.25.25H5.75a.25.25,0,0,1-.25-.25ZM14.75,3A1.75,1.75,0,0,0,13,4.75v14.5A1.75,1.75,0,0,0,14.75,21h3.5A1.75,1.75,0,0,0,20,19.25V4.75A1.75,1.75,0,0,0,18.25,3ZM14.5,4.75a.25.25,0,0,1,.25-.25h3.5a.25.25,0,0,1,.25.25v14.5a.25.25,0,0,1-.25.25h-3.5a.25.25,0,0,1-.25-.25Z"},Z={viewBox:"0 0 24 24",path:"M7.61,4.61a.75.75,0,0,0-1.11.66V18.73a.75.75,0,0,0,1.11.65L20,12.66a.75.75,0,0,0,0-1.32ZM5,5.27a2.25,2.25,0,0,1,3.33-2L20.69,10a2.26,2.26,0,0,1,0,4L8.33,20.7a2.25,2.25,0,0,1-3.33-2Z"},V={viewBox:"0 0 24 24",path:"M5.75,3h12.5A2.75,2.75,0,0,1,21,5.75v12.5A2.75,2.75,0,0,1,18.25,21H5.75A2.75,2.75,0,0,1,3,18.25V5.75A2.75,2.75,0,0,1,5.75,3Zm0,1.5A1.25,1.25,0,0,0,4.5,5.75v12.5A1.25,1.25,0,0,0,5.75,19.5h12.5a1.25,1.25,0,0,0,1.25-1.25V5.75A1.25,1.25,0,0,0,18.25,4.5Z"};var u=15,b=2,O={play:Z.path,pause:z.path,stop:V.path},pe=`0 0 ${2*u+b} ${2*u+b}`,D=`${b}px`,H=`M ${u+b/2}, ${u+b/2} m -${u}, 0 a ${u},${u} 0 1,0 ${2*u},0 a ${u},${u} 0 1,0 ${-2*u},0`,w=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=``}setDuration(e){this.style.setProperty("--slidy-autoplay-interval",e+"ms")}get path0(){return this.shadowRoot.firstElementChild.nextElementSibling.firstElementChild.nextElementSibling}get button(){return this.shadowRoot.firstElementChild.nextElementSibling.nextElementSibling}get path1(){return this.button.firstElementChild.firstElementChild}get animation(){let e=this.path0.classList;return{pause(){e.add("pause")},cancel(){e.add("stop")},play(){e.remove("stop","pause")}}}},j=!1;function R(t){j||(customElements.define("autoplay-button",w),j=!0);let e=document.createElement("autoplay-button"),n=e.button;return n.onclick=t,[e,n,e.path1]}var M=(t,e)=>{let n=Object.entries(e),i=()=>{for(let[r,s]of n)t.addEventListener(r,s)},o=()=>{for(let[r,s]of n)t.removeEventListener(r,s)};return i(),o},k=(t,...e)=>e.includes(t);var v=performance.now.bind(performance),P=class{queue;timeoutId;index;off;time=v();constructor(e){this.queue=e,this.index=0,this.off=0}start(){this.time=v(),this.runNextTask()}pause(){clearTimeout(this.timeoutId),this.off+=v()-this.time}stop(){clearTimeout(this.timeoutId),this.off=0,this.index=0}runNextTask(){this.index===this.queue.length&&this.stop();let e=this.queue[this.index];if(typeof e=="function"){let n=v();e(),this.index++,this.off+=v()-n,this.runNextTask()}else this.timeoutId=setTimeout(()=>{this.index++,this.time=v(),this.off=0,this.runNextTask()},e.await-this.off)}};function Q(t,e,n=0){let i=new P([()=>{e.animation.play()},{await:e.interval},()=>{t(),e.animation.cancel(),n=3},{await:e.delay},()=>{n=1,e.animation.cancel()}]);return{play(){n!==3&&e.animation.play(),n=1,e.state=0,i.start()},pause(){n!==3&&(n=2),e.state=2,e.animation.pause(),i.pause()},stop(){n=0,e.state=1,e.animation.cancel(),i.stop()}}}var me={play:"Start autoplay",stop:"Stop autoplay"};var ye={[0]:"pause",[1]:"play",[2]:"stop"},G=({i18n:t=me,duration:e=2500,delay:n=0,autoplay:i=!1,target:o}={})=>{let r=1,s={[0]:t.stop,[1]:t.play,[2]:t.stop};return({node:a,options:l,instance:c})=>{let p=()=>a.childElementCount,L=()=>{let f=l.index+1;l.loop||f
{k(r,2,0)?d.stop():d.play(),y()}),d=Q(L,{set state(f){r=f,y()},delay:n,interval:e,animation:m.animation});o?typeof o=="string"?document.querySelector(o).appendChild(m):o.appendChild(m):a.insertAdjacentElement("afterend",m),m.setDuration(e);let y=()=>{y.current!==r&&(T.setAttribute("title",s[r]),ee.setAttribute("d",O[ye[r]]),y.current=r)};y();let te=f=>{let re=f.detail.index+1;l.loop||re
{r===0&&d.pause()},I=()=>{r===2&&d.play()},ne=()=>{k(x,0,1)||I()},E=2,x=2;a.onpointerenter=()=>{x=1,E!==0&&B()},m.onpointerenter=()=>{x=0,B()},m.onpointerleave=()=>{E!==1&&I(),E=0},a.onpointerleave=()=>{E=1,x=2,queueMicrotask(ne)};let oe=M(document,{visibilitychange:()=>{document.visibilityState==="hidden"&&r===0?d.pause():r===2&&d.play()}}),ie=M(a,{index:te,mount:()=>{i&&d.play()},destroy:()=>{d.stop(),oe(),ie()}})}};var g={C4:261.63,E4:329.63,G4:392,Bell:1567.98,Beep:493.88},_={index:[{freq:g.C4,dur:.5},{freq:g.E4,dur:.5},{freq:g.G4,dur:.5},{freq:g.C4,dur:1}],keys:[{freq:g.Beep,dur:1},{freq:g.Bell,dur:.5}]};var J=(t,e,n)=>{let i=t.createOscillator();i.type="square";let o=t.createGain();i.connect(o),o.connect(t.destination),i.frequency.value=e,o.gain.setValueAtTime(1,t.currentTime),o.gain.exponentialRampToValueAtTime(.001,t.currentTime+n),i.start(t.currentTime),i.stop(t.currentTime+n)};var K=(t=_)=>{let e,n=!1,i=Object.entries(t).reduce((o,[r,s])=>(o[r]=()=>{if(!e)try{e=new AudioContext}catch{return}n||s.forEach((a,l,c)=>{let p=l>0?c[l-1].dur*1e3:0;setTimeout(()=>{J(e,a.freq,a.dur),l===0&&(n=!0),l===c.length-1&&setTimeout(()=>{n=!1},a.dur)},p)})},o),{});return({node:o})=>{function r(){for(let[s,a]of Object.entries(i))o.removeEventListener(s,a);o.removeEventListener("destroy",r)}o.addEventListener("destroy",r);for(let[s,a]of Object.entries(i))o.addEventListener(s,a)}};var fe="Share",W="slidy-share-button",C=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}).innerHTML=``}},U=!1,X=t=>{U||(customElements.define(W,C),U=!0);let e=document.createElement(W);return e.onclick=t,e};var Y=({target:t,type:e}={target:void 0,type:"url"})=>({node:n,options:i})=>{let o=X(()=>{let s=i.index;if(!s)return;let a=n.childNodes[s];if(!a)return;let l=a.querySelector("[src]")?.src||a.style.backgroundImage||void 0,c=a.querySelector("img")?.alt||void 0;if(l)try{e==="url"&&navigator.share({url:l,title:c})}finally{}});function r(){o.remove(),n.removeEventListener("destroy",r)}n.addEventListener("destroy",r),t?typeof t=="string"?document.querySelector(t).appendChild(o):t.appendChild(o):n.insertAdjacentElement("afterend",o)};