- md5
- 75689740593a39cfb62d5034e9614752
- sha1
- 65812d2c6d2aa00a4ab98024402103e1f70216d1
- sha256
- 4c19e70c1d155d68fe2b2b97ff0ba805471327d8564b6f41fe3d226d60ae8b65
import{B as BaseComponent,S as SelectorEngine,i as isVisible,t as triggerTransitionEnd,E as EventHandler,c as typeCheckConfig,r as reflow,a as getTransitionDurationFromElement,T as TRANSITION_END,e as emulateTransitionEnd,D as Data,M as Manipulator,g as getElementFromSelector,o as onDOMContentLoaded,b as getjQuery}from"./dom-8eef6b5f.js";const NAME="carousel",DATA_KEY="bs.carousel",EVENT_KEY=".bs.carousel",DATA_API_KEY=".data-api",ARROW_LEFT_KEY="ArrowLeft",ARROW_RIGHT_KEY="ArrowRight",TOUCHEVENT_COMPAT_WAIT=500,SWIPE_THRESHOLD=40,Default={interval:5e3,keyboard:!0,slide:!1,pause:"hover",wrap:!0,touch:!0},DefaultType={interval:"(number|boolean)",keyboard:"boolean",slide:"(boolean|string)",pause:"(string|boolean)",wrap:"boolean",touch:"boolean"},DIRECTION_NEXT="next",DIRECTION_PREV="prev",DIRECTION_LEFT="left",DIRECTION_RIGHT="right",EVENT_SLIDE="slide.bs.carousel",EVENT_SLID="slid.bs.carousel",EVENT_KEYDOWN="keydown.bs.carousel",EVENT_MOUSEENTER="mouseenter.bs.carousel",EVENT_MOUSELEAVE="mouseleave.bs.carousel",EVENT_TOUCHSTART="touchstart.bs.carousel",EVENT_TOUCHMOVE="touchmove.bs.carousel",EVENT_TOUCHEND="touchend.bs.carousel",EVENT_POINTERDOWN="pointerdown.bs.carousel",EVENT_POINTERUP="pointerup.bs.carousel",EVENT_DRAG_START="dragstart.bs.carousel",EVENT_LOAD_DATA_API="load.bs.carousel.data-api",EVENT_CLICK_DATA_API="click.bs.carousel.data-api",CLASS_NAME_CAROUSEL="carousel",CLASS_NAME_ACTIVE="active",CLASS_NAME_SLIDE="slide",CLASS_NAME_END="carousel-item-end",CLASS_NAME_START="carousel-item-start",CLASS_NAME_NEXT="carousel-item-next",CLASS_NAME_PREV="carousel-item-prev",CLASS_NAME_POINTER_EVENT="pointer-event",SELECTOR_ACTIVE=".active",SELECTOR_ACTIVE_ITEM=".active.carousel-item",SELECTOR_ITEM=".carousel-item",SELECTOR_ITEM_IMG=".carousel-item img",SELECTOR_NEXT_PREV=".carousel-item-next, .carousel-item-prev",SELECTOR_INDICATORS=".carousel-indicators",SELECTOR_DATA_SLIDE="[data-bs-slide], [data-bs-slide-to]",SELECTOR_DATA_RIDE='[data-bs-ride="carousel"]',PointerType={TOUCH:"touch",PEN:"pen"};class Carousel extends BaseComponent{constructor(e,t){super(e),this._items=null,this._interval=null,this._activeElement=null,this._isPaused=!1,this._isSliding=!1,this.touchTimeout=null,this.touchStartX=0,this.touchDeltaX=0,this._config=this._getConfig(t),this._indicatorsElement=SelectorEngine.findOne(SELECTOR_INDICATORS,this._element),this._touchSupported="ontouchstart"in document.documentElement||navigator.maxTouchPoints>0,this._pointerEvent=Boolean(window.PointerEvent),this._addEventListeners()}static get Default(){return Default}static get DATA_KEY(){return DATA_KEY}next(){this._isSliding||this._slide("next")}nextWhenVisible(){!document.hidden&&isVisible(this._element)&&this.next()}prev(){this._isSliding||this._slide("prev")}pause(e){e||(this._isPaused=!0),SelectorEngine.findOne(SELECTOR_NEXT_PREV,this._element)&&(triggerTransitionEnd(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null}cycle(e){e||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config&&this._config.interval&&!this._isPaused&&(this._updateInterval(),this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))}to(e){this._activeElement=SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM,this._element);const t=this._getItemIndex(this._activeElement);if(e>this._items.length-1||e<0)return;if(this._isSliding)return void EventHandler.one(this._element,EVENT_SLID,(()=>this.to(e)));if(t===e)return this.pause(),void this.cycle();const i=e>t?"next":"prev";this._slide(i,this._items[e])}dispose(){super.dispose(),EventHandler.off(this._element,EVENT_KEY),this._items=null,this._config=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null}_getConfig(e){return e={...Default,...e},typeCheckConfig(NAME,e,DefaultType),e}_handleSwipe(){const e=Math.abs(this.touchDeltaX);if(e<=40)return;const t=e/this.touchDeltaX;this.touchDeltaX=0,t>0&&this.prev(),t<0&&this.next()}_addEventListeners(){this._config.keyboard&&EventHandler.on(this._element,EVENT_KEYDOWN,(e=>this._keydown(e))),"hover"===this._config.pause&&(EventHandler.on(this._element,EVENT_MOUSEENTER,(e=>this.pause(e))),EventHandler.on(this._element,EVENT_MOUSELEAVE,(e=>this.cycle(e)))),this._config.touch&&this._touchSupported&&this._addTouchEventListeners()}_addTouchEventListeners(){const e=e=>{this._pointerEvent&&PointerType[e.pointerType.toUpperCase()]?this.touchStartX=e.clientX:this._pointerEvent||(this.touchStartX=e.touches[0].clientX)},t=e=>{e.touches&&e.touches.length>1?this.touchDeltaX=0:this.touchDeltaX=e.touches[0].clientX-this.touchStartX},i=e=>{this._pointerEvent&&PointerType[e.pointerType.toUpperCase()]&&(this.touchDeltaX=e.clientX-this.touchStartX),this._handleSwipe(),"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout((e=>this.cycle(e)),500+this._config.interval))};SelectorEngine.find(SELECTOR_ITEM_IMG,this._element).forEach((e=>{EventHandler.on(e,EVENT_DRAG_START,(e=>e.preventDefault()))})),this._pointerEvent?(EventHandler.on(this._element,EVENT_POINTERDOWN,(t=>e(t))),EventHandler.on(this._element,EVENT_POINTERUP,(e=>i(e))),this._element.classList.add("pointer-event")):(EventHandler.on(this._element,EVENT_TOUCHSTART,(t=>e(t))),EventHandler.on(this._element,EVENT_TOUCHMOVE,(e=>t(e))),EventHandler.on(this._element,EVENT_TOUCHEND,(e=>i(e))))}_keydown(e){if(!/input|textarea/i.test(e.target.tagName))switch(e.key){case"ArrowLeft":e.preventDefault(),this.prev();break;case"ArrowRight":e.preventDefault(),this.next()}}_getItemIndex(e){return this._items=e&&e.parentNode?SelectorEngine.find(SELECTOR_ITEM,e.parentNode):[],this._items.indexOf(e)}_getItemByDirection(e,t){const i="next"===e,s="prev"===e,n=this._getItemIndex(t),a=this._items.length-1;if((s&&0===n||i&&n===a)&&!this._config.wrap)return t;const o=(n+("prev"===e?-1:1))%this._items.length;return-1===o?this._items[this._items.length-1]:this._items[o]}_triggerSlideEvent(e,t){const i=this._getItemIndex(e),s=this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM,this._element));return EventHandler.trigger(this._element,EVENT_SLIDE,{relatedTarget:e,direction:t,from:s,to:i})}_setActiveIndicatorElement(e){if(this._indicatorsElement){const t=SelectorEngine.find(".active",this._indicatorsElement);for(let e=0;e<t.length;e++)t[e].classList.remove("active");const i=this._indicatorsElement.children[this._getItemIndex(e)];i&&i.classList.add("active")}}_updateInterval(){const e=this._activeElement||SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM,this._element);if(!e)return;const t=Number.parseInt(e.getAttribute("data-bs-interval"),10);t?(this._config.defaultInterval=this._config.defaultInterval||this._config.interval,this._config.interval=t):this._config.interval=this._config.defaultInterval||this._config.interval}_slide(e,t){const i=SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM,this._element),s=this._getItemIndex(i),n=t||i&&this._getItemByDirection(e,i),a=this._getItemIndex(n),o=Boolean(this._interval);let r,l,E;if("next"===e?(r=CLASS_NAME_START,l=CLASS_NAME_NEXT,E="left"):(r=CLASS_NAME_END,l=CLASS_NAME_PREV,E="right"),n&&n.classList.contains("active"))return void(this._isSliding=!1);if(!this._triggerSlideEvent(n,E).defaultPrevented&&i&&n){if(this._isSliding=!0,o&&this.pause(),this._setActiveIndicatorElement(n),this._activeElement=n,this._element.classList.contains("slide")){n.classList.add(l),reflow(n),i.classList.add(r),n.classList.add(r);const e=getTransitionDurationFromElement(i);EventHandler.one(i,TRANSITION_END,(()=>{n.classList.remove(r,l),n.classList.add("active"),i.classList.remove("active",l,r),this._isSliding=!1,setTimeout((()=>{EventHandler.trigger(this._element,EVENT_SLID,{relatedTarget:n,direction:E,from:s,to:a})}),0)})),emulateTransitionEnd(i,e)}else i.classList.remove("active"),n.classList.add("active"),this._isSliding=!1,EventHandler.trigger(this._element,EVENT_SLID,{relatedTarget:n,direction:E,from:s,to:a});o&&this.cycle()}}static carouselInterface(e,t){let i=Data.getData(e,DATA_KEY),s={...Default,...Manipulator.getDataAttributes(e)};"object"==typeof t&&(s={...s,...t});const n="string"==typeof t?t:s.slide;if(i||(i=new Carousel(e,s)),"number"==typeof t)i.to(t);else if("string"==typeof n){if(void 0===i[n])throw new TypeError(`No method named "${n}"`);i[n]()}else s.interval&&s.ride&&(i.pause(),i.cycle())}static jQueryInterface(e){return this.each((function(){Carousel.carouselInterface(this,e)}))}static dataApiClickHandler(e){const t=getElementFromSelector(this);if(!t||!t.classList.contains("carousel"))return;const i={...Manipulator.getDataAttributes(t),...Manipulator.getDataAttributes(this)},s=this.getAttribute("data-bs-slide-to");s&&(i.interval=!1),Carousel.carouselInterface(t,i),s&&Data.getData(t,DATA_KEY).to(s),e.preventDefault()}}if(EventHandler.on(document,EVENT_CLICK_DATA_API,SELECTOR_DATA_SLIDE,Carousel.dataApiClickHandler),EventHandler.on(window,EVENT_LOAD_DATA_API,(()=>{const e=SelectorEngine.find(SELECTOR_DATA_RIDE);for(let t=0,i=e.length;t<i;t++)Carousel.carouselInterface(e[t],Data.getData(e[t],DATA_KEY))})),onDOMContentLoaded((()=>{const e=getjQuery();if(e){const t=e.fn[NAME];e.fn[NAME]=Carousel.jQueryInterface,e.fn[NAME].Constructor=Carousel,e.fn[NAME].noConflict=()=>(e.fn[NAME]=t,Carousel.jQueryInterface)}})),window.bootstrap=window.bootstrap||{},window.bootstrap.Carousel=Carousel,Object.prototype.hasOwnProperty.call(document.body.dataset,"bsNoJquery")||(document.body.dataset.bsNoJquery=""),Joomla&&Joomla.getOptions){const e=Joomla.getOptions("bootstrap.carousel");"object"==typeof e&&null!==e&&Object.keys(e).forEach((t=>{const i=e[t],s={interval:i.interval?i.interval:5e3,keyboard:!i.keyboard||i.keyboard,pause:i.pause?i.pause:"hover",slide:!!i.slide&&i.slide,wrap:!i.wrap||i.wrap,touch:!i.touch||i.touch},n=Array.from(document.querySelectorAll(t));n.length&&n.map((e=>new window.bootstrap.Carousel(e,s)))}))}export{Carousel as C};
No other release has this exact content. See every version of this file.