/*! * Splide.js * Version : 4.1.3 * License : MIT * Copyright: 2022 Naotoshi Fujita */ var t,s;t=this,s=function(){"use strict";const n={width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:["ArrowUp","ArrowRight"],ArrowRight:["ArrowDown","ArrowLeft"]};function r(t,s,r){return{resolve:function(t,s,i){const e="rtl"!==(i=i||r.direction)||s?"ttb"===i?0:-1:1;return n[t]&&n[t][e]||t.replace(/width|left|right/i,(t,s)=>{const i=n[t.toLowerCase()][e]||t;return 0y(t,s)):i}(t,s)[0]:t.firstElementChild}c(d,"undefined");const _=Object.keys;function m(s,i,t){s&&(t?_(s).reverse():_(s)).forEach(t=>{"__proto__"!==t&&i(s[t],t)})}function x(e){return u(arguments,1).forEach(i=>{m(i,(t,s)=>{e[s]=i[s]})}),e}function S(i){return u(arguments,1).forEach(t=>{m(t,(t,s)=>{p(t)?i[s]=t.slice():f(t)?i[s]=S({},f(i[s])?i[s]:{},t):i[s]=t})}),i}function A(t){b(t,t=>{t&&t.parentNode&&t.parentNode.removeChild(t)})}function C(t){return g(t)?t:t?t+"px":""}function T(t,s){if(!t)throw new Error(`[${i}] `+(s||""))}const k=Math["max"];function L(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}const O={};function P(){let h=[];function i(t,i,e){b(t,s=>{s&&b(i,t=>{t.split(" ").forEach(t=>{t=t.split(".");e(s,t[0],t[1])})})})}return{bind:function(t,s,n,o){i(t,s,(t,s,i)=>{var e="addEventListener"in t,r=e?t.removeEventListener.bind(t,s,n,o):t.removeListener.bind(t,n);e?t.addEventListener(s,n,o):t.addListener(n),h.push([t,s,i,n,r])})},unbind:function(t,s,r){i(t,s,(s,i,e)=>{h=h.filter(t=>!!(t[0]!==s||t[1]!==i||t[2]!==e||r&&t[3]!==r)||(t[4](),!1))})},dispatch:function(t,s,i){let e;return"function"==typeof CustomEvent?e=new CustomEvent(s,{bubbles:!0,detail:i}):(e=document.createEvent("CustomEvent")).initCustomEvent(s,!0,!1,i),t.dispatchEvent(e),e},destroy:function(){h.forEach(t=>{t[4]()}),h.length=0}}}function R(t){const i=t?t.event.bus:document.createDocumentFragment(),e=P();return t&&t.event.on("destroy",e.destroy),x(e,{bus:i,on:function(t,s){e.bind(i,v(t).join(" "),t=>{s.apply(s,p(t.detail)?t.detail:[])})},off:c(e.unbind,i),emit:function(t){e.dispatch(i,t,u(arguments,1))}})}const E={listTag:"ul",slideTag:"li"};class G{styles={};id;options;constructor(t,s){this.id=t,this.options=s}rule(t,s,i,e){const r=this.styles[e=e||"default"]=this.styles[e]||{},n=r[t]=r[t]||{};n[s]=i}build(){let s="";return this.styles.default&&(s+=this.buildSelectors(this.styles.default)),Object.keys(this.styles).sort((t,s)=>"min"===this.options.mediaQuery?+t-+s:+s-+t).forEach(t=>{"default"!==t&&(s=(s+=`@media screen and (max-width: ${t}px) {`)+this.buildSelectors(this.styles[t])+"}")}),s}buildSelectors(t){let i="";return m(t,(t,s)=>{s=(`#${this.id} `+s).trim(),i+=s+" {",m(t,(t,s)=>{!t&&0!==t||(i+=s+`: ${t};`)}),i+="}"}),i}}return class{static clean(t){const s=R(t)["on"],i=t["root"];t=i;var e,t=(e="."+h)?u(t.querySelectorAll(e)):[];s("mounted",()=>{A($(i,"style"))}),A(t)}contents;slides=[];Direction;Style;options={};config;id;breakpoints=[];constructor(t,s,i,e){S(a,e||{}),S(S(this.options,a),s||{}),this.contents=t,this.config=x({},E,i||{}),this.id=this.config.id||""+(e="splide")+((e=O[e]=(O[e]||0)+1)<10?"0"+e:""+e),this.Style=new G(this.id,this.options),this.Direction=r(0,0,this.options),T(this.contents.length,"Provide at least 1 content."),this.init()}init(){this.parseBreakpoints(),this.initSlides(),this.registerRootStyles(),this.registerTrackStyles(),this.registerSlideStyles(),this.registerListStyles()}initSlides(){w(this.slides,this.contents.map((t,s)=>{(t=g(t)?{html:t}:t).styles=t.styles||{},t.attrs=t.attrs||{},this.cover(t);s=this.options.classes.slide+" "+(0===s?"is-active":"");return x(t.attrs,{class:(s+" "+(t.attrs.class||"")).trim(),style:this.buildStyles(t.styles)}),t})),this.isLoop()&&this.generateClones(this.slides)}registerRootStyles(){this.breakpoints.forEach(([t,s])=>{this.Style.rule(" ","max-width",C(s.width),t)})}registerTrackStyles(){const i=this["Style"],e=".splide__track";this.breakpoints.forEach(([t,s])=>{i.rule(e,this.resolve("paddingLeft"),this.cssPadding(s,!1),t),i.rule(e,this.resolve("paddingRight"),this.cssPadding(s,!0),t),i.rule(e,"height",this.cssTrackHeight(s),t)})}registerListStyles(){const i=this["Style"],e=".splide__list";this.breakpoints.forEach(([t,s])=>{i.rule(e,"transform",this.buildTranslate(s),t),this.cssSlideHeight(s)||i.rule(e,"aspect-ratio",this.cssAspectRatio(s),t)})}registerSlideStyles(){const i=this["Style"],e="."+o;this.breakpoints.forEach(([t,s])=>{i.rule(e,"width",this.cssSlideWidth(s),t),i.rule(e,"height",this.cssSlideHeight(s)||"100%",t),i.rule(e,this.resolve("marginRight"),C(s.gap)||"0px",t),i.rule(e+" > img","display",s.cover?"none":"inline",t)})}buildTranslate(t){const{resolve:s,orient:i}=this.Direction,e=[];return e.push(this.cssOffsetClones(t)),e.push(this.cssOffsetGaps(t)),this.isCenter(t)&&(e.push(this.buildCssValue(i(-50),"%")),e.push(...this.cssOffsetCenter(t))),e.filter(Boolean).map(t=>`translate${s("X")}(${t})`).join(" ")}cssOffsetClones(t){const{resolve:s,orient:i}=this.Direction;var e,r,n=this.getCloneCount();return this.isFixedWidth(t)?({value:r,unit:e}=this.parseCssValue(t[s("fixedWidth")]),this.buildCssValue(i(r)*n,e)):(r=100*n/t.perPage,i(r)+"%")}cssOffsetCenter(t){const{resolve:s,orient:i}=this.Direction;if(this.isFixedWidth(t))return{value:r,unit:n}=this.parseCssValue(t[s("fixedWidth")]),[this.buildCssValue(i(r/2),n)];const e=[];var{perPage:r,gap:n}=t;return e.push(i(50/r)+"%"),n&&({value:t,unit:n}=this.parseCssValue(n),e.push(this.buildCssValue(i((t/r-t)/2),n))),e}cssOffsetGaps(t){var s=this.getCloneCount();if(s&&t.gap){const r=this.Direction["orient"];var{value:i,unit:e}=this.parseCssValue(t.gap);return this.isFixedWidth(t)?this.buildCssValue(r(i*s),e):(t=t["perPage"],this.buildCssValue(r(s/t*i),e))}return""}resolve(t){return L(this.Direction.resolve(t))}cssPadding(t,s){t=t.padding,s=this.Direction.resolve(s?"right":"left",!0);return t&&C(t[s]||(f(t)?0:t))||"0px"}cssTrackHeight(t){let s="";return this.isVertical()&&(T(s=this.cssHeight(t),'"height" is missing.'),s=`calc(${s} - ${this.cssPadding(t,!1)} - ${this.cssPadding(t,!0)})`),s}cssHeight(t){return C(t.height)}cssSlideWidth(t){return t.autoWidth?"":C(t.fixedWidth)||(this.isVertical()?"":this.cssSlideSize(t))}cssSlideHeight(t){return C(t.fixedHeight)||(this.isVertical()?t.autoHeight?"":this.cssSlideSize(t):this.cssHeight(t))}cssSlideSize(t){var s=C(t.gap);return`calc((100%${s&&" + "+s})/${t.perPage||1}${s&&" - "+s})`}cssAspectRatio(t){t=t.heightRatio;return t?""+1/t:""}buildCssValue(t,s){return""+t+s}parseCssValue(t){return g(t)?{value:parseFloat(t)||0,unit:t.replace(/\d*(\.\d*)?/,"")||"px"}:{value:t,unit:"px"}}parseBreakpoints(){var t=this.options["breakpoints"];this.breakpoints.push(["default",this.options]),t&&m(t,(t,s)=>{this.breakpoints.push([s,S(S({},this.options),t)])})}isFixedWidth(t){return!!t[this.Direction.resolve("fixedWidth")]}isLoop(){return"loop"===this.options.type}isCenter(t){if("center"===t.focus){if(this.isLoop())return!0;if("slide"===this.options.type)return!this.options.trimSpace}return!1}isVertical(){return"ttb"===this.options.direction}buildClasses(){const t=this["options"];return[s,s+"--"+t.type,s+"--"+t.direction,t.drag&&s+"--draggable",t.isNavigation&&s+"--nav",l,!this.config.hidden&&"is-rendered"].filter(Boolean).join(" ")}buildAttrs(t){let i="";return m(t,(t,s)=>{i+=t?` ${L(s)}="${t}"`:""}),i.trim()}buildStyles(t){let i="";return m(t,(t,s)=>{i+=` ${L(s)}:${t};`}),i.trim()}renderSlides(){const s=this.config["slideTag"];return this.slides.map(t=>`<${s} ${this.buildAttrs(t.attrs)}>${t.html||""}`).join("")}cover(t){const{styles:s,html:i=""}=t;this.options.cover&&!this.options.lazyLoad&&(t=i.match(//))&&t[2]&&(s.background=`center/cover no-repeat url('${t[2]}')`)}generateClones(e){const r=this.options["classes"],n=this.getCloneCount(),t=e.slice();for(;t.length{var i=x({},t.attrs,{class:t.attrs.class+" "+r.clone}),t=x({},t,{attrs:i});st.perPage))*((t.flickMaxPages||1)+1)):0}renderArrows(){var t="";return(t+=`
`)+this.renderArrow(!0)+this.renderArrow(!1)+"
"}renderArrow(t){var{classes:s,i18n:i}=this.options,s={class:s.arrow+" "+(t?s.prev:s.next),type:"button",ariaLabel:t?i.prev:i.next};return``}html(){var{rootClass:t,listTag:s,arrows:i,beforeTrack:e,afterTrack:r,slider:n,beforeSlider:o,afterSlider:h}=this.config;let l="";return l=(l+=`
`)+``,n&&(l=l+(o||"")+'
'),l+=e||"",i&&(l+=this.renderArrows()),l=(l=(l=l+'
'+`<${s} class="splide__list">`)+this.renderSlides()+``)+"
"+(r||""),n&&(l=l+"
"+(h||"")),l+="
"}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=s():"function"==typeof define&&define.amd?define(s):(t="undefined"!=typeof globalThis?globalThis:t||self).SplideRenderer=s(); //# sourceMappingURL=splide-renderer.min.js.map