芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/www/media/vendor/bootstrap/js/carousel.min.js
import{B as BaseComponent,S as SelectorEngine,i as isVisible,t as triggerTransitionEnd,E as EventHandler,M as Manipulator,a as typeCheckConfig,b as getNextActiveElement,r as reflow,c as isRTL,g as getElementFromSelector,d as defineJQueryPlugin}from"./dom.min.js?1629745661";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"},ORDER_NEXT="next",ORDER_PREV="prev",DIRECTION_LEFT="left",DIRECTION_RIGHT="right",KEY_TO_DIRECTION={ArrowLeft:DIRECTION_RIGHT,ArrowRight:DIRECTION_LEFT},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_INDICATOR="[data-bs-target]",SELECTOR_DATA_SLIDE="[data-bs-slide], [data-bs-slide-to]",SELECTOR_DATA_RIDE='[data-bs-ride="carousel"]',POINTER_TYPE_TOUCH="touch",POINTER_TYPE_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 NAME(){return NAME}next(){this._slide(ORDER_NEXT)}nextWhenVisible(){!document.hidden&&isVisible(this._element)&&this.next()}prev(){this._slide(ORDER_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?ORDER_NEXT:ORDER_PREV;this._slide(i,this._items[e])}_getConfig(e){return e={...Default,...Manipulator.getDataAttributes(this._element),..."object"==typeof e?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&&this._slide(t>0?DIRECTION_RIGHT:DIRECTION_LEFT)}_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||"pen"!==e.pointerType&&"touch"!==e.pointerType?this._pointerEvent||(this.touchStartX=e.touches[0].clientX):this.touchStartX=e.clientX},t=e=>{this.touchDeltaX=e.touches&&e.touches.length>1?0:e.touches[0].clientX-this.touchStartX},i=e=>{!this._pointerEvent||"pen"!==e.pointerType&&"touch"!==e.pointerType||(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))return;const t=KEY_TO_DIRECTION[e.key];t&&(e.preventDefault(),this._slide(t))}_getItemIndex(e){return this._items=e&&e.parentNode?SelectorEngine.find(SELECTOR_ITEM,e.parentNode):[],this._items.indexOf(e)}_getItemByOrder(e,t){const i=e===ORDER_NEXT;return getNextActiveElement(this._items,t,i,this._config.wrap)}_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.findOne(".active",this._indicatorsElement);t.classList.remove("active"),t.removeAttribute("aria-current");const i=SelectorEngine.find("[data-bs-target]",this._indicatorsElement);for(let t=0;t
{EventHandler.trigger(this._element,EVENT_SLID,{relatedTarget:r,direction:c,from:n,to:a})};if(this._element.classList.contains("slide")){r.classList.add(_),reflow(r),s.classList.add(l),r.classList.add(l);const e=()=>{r.classList.remove(l,_),r.classList.add("active"),s.classList.remove("active",_,l),this._isSliding=!1,setTimeout(h,0)};this._queueCallback(e,s,!0)}else s.classList.remove("active"),r.classList.add("active"),this._isSliding=!1,h();o&&this.cycle()}_directionToOrder(e){return[DIRECTION_RIGHT,DIRECTION_LEFT].includes(e)?isRTL()?e===DIRECTION_LEFT?ORDER_PREV:ORDER_NEXT:e===DIRECTION_LEFT?ORDER_NEXT:ORDER_PREV:e}_orderToDirection(e){return[ORDER_NEXT,ORDER_PREV].includes(e)?isRTL()?e===ORDER_PREV?DIRECTION_LEFT:DIRECTION_RIGHT:e===ORDER_PREV?DIRECTION_RIGHT:DIRECTION_LEFT:e}static carouselInterface(e,t){const i=Carousel.getOrCreateInstance(e,t);let{_config:s}=i;"object"==typeof t&&(s={...s,...t});const n="string"==typeof t?t:s.slide;if("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&&Carousel.getInstance(t).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
{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};