text: import{r as t,h as i,g as e}from"./p-a1b3783e.js";import"./p-a4bfa1a2.js";import"./p-5eef8cc8.js";import{T as s}from"./p-a0ba8b88.js";import{C as a}from"./p-f30844a3.js";var l=function(t,i,e,s){var a,l=arguments.length,n=l<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,i,e,s);else for(var r=t.length-1;r>=0;r--)(a=t[r])&&(n=(l<3?a(n):l>3?a(i,e,n):a(i,e))||n);return l>3&&n&&Object.defineProperty(i,e,n),n};const n=class{constructor(i){t(this,i),this.fadeSeconds=1,this.visibleSeconds=10}componentWillLoad(){this.images?(this.marginTop=this.element.getBoundingClientRect().y,this.checkLayout(),this.imagesSrcs=this.images.split(","),this.getAnimationCSS()):console.log("No images provided")}checkLayout(){this.slideshowHeight=document.documentElement.clientHeight-this.marginTop}renderSlide(t,e){return i("li",{id:"slide-"+e,class:"animation-"+e,style:{backgroundImage:"url("+t+")"}})}getAnimationCSS(){let t=this.fadeSeconds+this.visibleSeconds,i=100/(t*this.imagesSrcs.length),e=`@keyframes fade {\n    0% { opacity: 0; }\n    ${i*this.fadeSeconds}% { opacity: 1; }\n    ${i*t}% { opacity: 1; }\n    ${i*(t+this.fadeSeconds)}% { opacity: 0; }\n    100% { opacity: 0; }\n  }`;for(let a=0;a<this.imagesSrcs.length;a++)e+=`#psk-slider li:nth-child(${a}) {\n        animation-delay: ${t*a}s;\n        }`;e+=`#psk-slider li{animation-duration: ${t*this.imagesSrcs.length}s;}`;let s=document.createElement("style");s.innerHTML=e,this.element.shadowRoot.prepend(s)}render(){let t=[];this.imagesSrcs.forEach((i,e)=>{t.push(this.renderSlide(i,e))});let e=this.title?i("div",{class:"title"},this.title):null,s=this.caption?i("div",{class:"caption"},this.caption):null,a=this.element.children.length>0?i("div",{class:"actions"},i("slot",null)):null,l=null;return(e||s||a)&&(l=i("div",{class:"container"},i("div",{class:"content"},[e,s,a]))),i("div",{class:"psk-slideshow"},i("div",{class:"psk-slideshow-container"},l,i("div",{id:"psk-content-slider"},i("div",{id:"psk-slider"},i("div",{id:"psk-slider-mask",style:{height:this.slideshowHeight+"px"}},i("ul",null,t))))))}get element(){return e(this)}};l([a(),s({description:["This property is the images sources separed by ','.","Using this property a new array will be created by spliting this string by ','."],isMandatory:!0,propertyType:"string"})],n.prototype,"images",void 0),l([s({description:["This property is the title of the slideshow that will be rendered.","If this property is given than a new div container will be created with the title as the class and the HTML child."],isMandatory:!1,propertyType:"string",defaultValue:"null"})],n.prototype,"title",void 0),l([s({description:["This property is the caption of the slideshow that will be rendered.","If this property is given than a new div container will be created with the caption as the class and the HTML child."],isMandatory:!1,propertyType:"string",defaultValue:"null"})],n.prototype,"caption",void 0);export{n as psk_slideshow};