zikra-slider-pro 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -7
- package/dist/zikra-slider.css +1 -1
- package/dist/zikraslider.cjs +3 -3
- package/dist/zikraslider.esm.js +2 -2
- package/dist/zikraslider.esm.min.js +2 -2
- package/dist/zikraslider.min.js +2 -2
- package/dist/zikraslider.umd.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
# Zikra Slider Pro
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/zikra-slider-pro)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://akhtar1985.github.io/zikra-slider-pro/)
|
|
6
|
+
|
|
3
7
|
**A small, accessible carousel engine for sites that care about weight and keyboard users.**
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install zikra-slider-pro
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Zikra Slider Pro runs in Vanilla JS, React, Next.js App Router and Vue 3 without owning your stack: one ~16 kB (gzip) file, seven layouts, an optional animation ladder (GSAP / anime.js / Motion One → WAAPI → CSS), and accessibility that is on by default instead of an add-on module. Prefer no build step? Use the [CDN snippet](#cdn) below.
|
|
6
14
|
|
|
7
15
|
- **Small and auditable.** 16 kB gzipped, one ES module, no runtime dependencies, no build step required. Read the whole engine in an afternoon.
|
|
8
16
|
- **Accessible by default.** Roles, labels, live-region announcements, `inert` off-screen slides, keyboard support and reduced-motion handling ship on; nothing extra to install or configure.
|
|
@@ -95,21 +103,71 @@ npm install zikra-slider-pro
|
|
|
95
103
|
|
|
96
104
|
`window.zikraslider` is both a factory and a class, so `new zikraslider(...)` works too. `window.zikraslider.ZikraSlider` exposes the class directly.
|
|
97
105
|
|
|
106
|
+
### Complete HTML page
|
|
107
|
+
|
|
108
|
+
Save this as `index.html`, open it, and you have a working slider — CDN files, markup and init in one file (no build step, no dependencies):
|
|
109
|
+
|
|
110
|
+
```html
|
|
111
|
+
<!doctype html>
|
|
112
|
+
<html lang="en">
|
|
113
|
+
<head>
|
|
114
|
+
<meta charset="utf-8">
|
|
115
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
116
|
+
<title>Zikra Slider Pro test</title>
|
|
117
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zikra-slider-pro@1.2.1/dist/zikra-slider.css">
|
|
118
|
+
</head>
|
|
119
|
+
<body>
|
|
120
|
+
|
|
121
|
+
<!-- Slides are direct children of the root. Do not add viewport/track yourself. -->
|
|
122
|
+
<div id="hero" class="zs-slider zs-no-js" aria-label="Photo gallery" style="max-width: 900px; margin: 40px auto;">
|
|
123
|
+
<div class="zs-slide"><img src="https://picsum.photos/id/1015/1600/1000" alt="River between mountains" width="1600" height="1000"></div>
|
|
124
|
+
<div class="zs-slide"><img src="https://picsum.photos/id/1016/1600/1000" alt="Canyon at dusk" width="1600" height="1000" loading="lazy"></div>
|
|
125
|
+
<div class="zs-slide"><img src="https://picsum.photos/id/1018/1600/1000" alt="Misty mountain lake" width="1600" height="1000" loading="lazy"></div>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<script src="https://cdn.jsdelivr.net/npm/zikra-slider-pro@1.2.1/dist/zikraslider.min.js"></script>
|
|
129
|
+
<script>
|
|
130
|
+
const slider = zikraslider('#hero', {
|
|
131
|
+
loop: true,
|
|
132
|
+
features: { autoplay: { enabled: true, delay: 4000 } }
|
|
133
|
+
});
|
|
134
|
+
</script>
|
|
135
|
+
|
|
136
|
+
</body>
|
|
137
|
+
</html>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Arrows and bullet pagination are on by default; autoplay is enabled above via `features.autoplay`. The markup rules are explained in [Markup](#markup), and a bigger real-world page is in [`examples/index.html`](examples/index.html).
|
|
141
|
+
|
|
98
142
|
### CDN
|
|
99
143
|
|
|
100
144
|
No build step — load the stylesheet and the UMD bundle:
|
|
101
145
|
|
|
102
146
|
```html
|
|
103
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zikra-slider-pro@1.2.
|
|
104
|
-
<script src="https://cdn.jsdelivr.net/npm/zikra-slider-pro@1.2.
|
|
147
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zikra-slider-pro@1.2.1/dist/zikra-slider.css">
|
|
148
|
+
<script src="https://cdn.jsdelivr.net/npm/zikra-slider-pro@1.2.1/dist/zikraslider.min.js"></script>
|
|
105
149
|
<script>
|
|
106
150
|
zikraslider('#hero', { loop: true, bullets: { enabled: true } });
|
|
107
151
|
</script>
|
|
108
152
|
```
|
|
109
153
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
154
|
+
Direct links to every published file (script, CSS, ESM, types, React):
|
|
155
|
+
|
|
156
|
+
| File | Use it for | Link |
|
|
157
|
+
| --- | --- | --- |
|
|
158
|
+
| `zikraslider.min.js` | UMD script tag (what the snippet above loads) | https://cdn.jsdelivr.net/npm/zikra-slider-pro@1.2.1/dist/zikraslider.min.js |
|
|
159
|
+
| `zikra-slider.css` | required stylesheet | https://cdn.jsdelivr.net/npm/zikra-slider-pro@1.2.1/dist/zikra-slider.css |
|
|
160
|
+
| `zikraslider.esm.min.js` | ESM `<script type="module">` | https://cdn.jsdelivr.net/npm/zikra-slider-pro@1.2.1/dist/zikraslider.esm.min.js |
|
|
161
|
+
| `zikraslider.esm.js` | unminified ESM (debugging) | https://cdn.jsdelivr.net/npm/zikra-slider-pro@1.2.1/dist/zikraslider.esm.js |
|
|
162
|
+
| `zikraslider.cjs` | CommonJS | https://cdn.jsdelivr.net/npm/zikra-slider-pro@1.2.1/dist/zikraslider.cjs |
|
|
163
|
+
| `zikraslider.d.ts` | TypeScript types | https://cdn.jsdelivr.net/npm/zikra-slider-pro@1.2.1/dist/zikraslider.d.ts |
|
|
164
|
+
| `ZikraSlider.js` | React component (JSX-free) | https://cdn.jsdelivr.net/npm/zikra-slider-pro@1.2.1/react/ZikraSlider.js |
|
|
165
|
+
|
|
166
|
+
Browse the whole package at https://cdn.jsdelivr.net/npm/zikra-slider-pro@1.2.1/ (or https://www.jsdelivr.com/package/npm/zikra-slider-pro).
|
|
167
|
+
|
|
168
|
+
- unpkg works the same way: `https://unpkg.com/zikra-slider-pro@1.2.1/dist/…`.
|
|
169
|
+
- Pin a version (`@1.2.1`) or a major range (`@1`); avoid `latest` in production.
|
|
170
|
+
- A brand-new package name shows a `0.0.0-stage` placeholder and holds back the tarball for a few minutes while npm runs its malware scan; the release becomes installable automatically once the scan finishes.
|
|
113
171
|
|
|
114
172
|
### ES modules
|
|
115
173
|
|
|
@@ -498,7 +556,7 @@ Static helpers:
|
|
|
498
556
|
zikraslider.get('#hero'); // existing instance or undefined
|
|
499
557
|
zikraslider.instances(); // array of live instances
|
|
500
558
|
zikraslider.defaults; // default options object
|
|
501
|
-
zikraslider.VERSION; // '1.2.
|
|
559
|
+
zikraslider.VERSION; // '1.2.1'
|
|
502
560
|
```
|
|
503
561
|
|
|
504
562
|
Creating an instance on a missing element or without a DOM returns a safe stub whose methods are no-ops, so code paths do not crash during SSR.
|
package/dist/zikra-slider.css
CHANGED
package/dist/zikraslider.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! Zikra Slider Pro v1.2.
|
|
1
|
+
/*! Zikra Slider Pro v1.2.1 | MIT | zero dependencies */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
/*!
|
|
5
|
-
* Zikra Slider Pro v1.2.
|
|
5
|
+
* Zikra Slider Pro v1.2.1
|
|
6
6
|
* Zero-dependency slider / carousel engine for Vanilla JS, React, Next.js and Vue 3.
|
|
7
7
|
* MIT License.
|
|
8
8
|
*
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* - Every animation backend (GSAP, anime.js, Motion One, WAAPI, CSS) receives
|
|
16
16
|
* the same from/to style descriptors, so falling back is just a strategy swap.
|
|
17
17
|
*/
|
|
18
|
-
const VERSION = '1.2.
|
|
18
|
+
const VERSION = '1.2.1';
|
|
19
19
|
|
|
20
20
|
const TYPES = ['slide', 'fade', 'scale', 'coverflow', 'stack', 'cards', 'custom'];
|
|
21
21
|
const AXES = ['x', 'y'];
|
package/dist/zikraslider.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Zikra Slider Pro v1.2.
|
|
2
|
+
* Zikra Slider Pro v1.2.1
|
|
3
3
|
* Zero-dependency slider / carousel engine for Vanilla JS, React, Next.js and Vue 3.
|
|
4
4
|
* MIT License.
|
|
5
5
|
*
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* - Every animation backend (GSAP, anime.js, Motion One, WAAPI, CSS) receives
|
|
13
13
|
* the same from/to style descriptors, so falling back is just a strategy swap.
|
|
14
14
|
*/
|
|
15
|
-
const VERSION = '1.2.
|
|
15
|
+
const VERSION = '1.2.1';
|
|
16
16
|
|
|
17
17
|
const TYPES = ['slide', 'fade', 'scale', 'coverflow', 'stack', 'cards', 'custom'];
|
|
18
18
|
const AXES = ['x', 'y'];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Zikra Slider Pro v1.2.
|
|
2
|
-
const j="1.2.0",B=["slide","fade","scale","coverflow","stack","cards","custom"],W=["x","y"],Z=["ltr","rtl"],X=["slide","fade","zoom","slide-up","flip","stagger"],Y={type:"slide",axis:"x",dir:"ltr",slidesPerView:1,slidesToScroll:1,gap:0,centeredSlides:!1,freeMode:!1,loop:!1,initialSlide:0,autoHeight:!1,speed:480,classPrefix:"zs-",parallax:{enabled:!1,selector:"[data-zs-parallax]",factor:.2},custom:{transform:null},sync:{with:null,mode:"index",asThumbnails:!1},arrows:{enabled:!0,prevEl:null,nextEl:null,container:null,className:"",prevClass:"",nextClass:"",prevHtml:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 18l-6-6 6-6"/></svg>',nextHtml:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 18l6-6-6-6"/></svg>',ariaPrevLabel:"Previous slide",ariaNextLabel:"Next slide",hideAtEdges:!1,render:null},bullets:{enabled:!0,el:null,type:"bullets",clickable:!0,dynamicBullets:!1,className:"",bulletClass:"",activeClass:"",formatFraction:null,render:null},features:{autoplay:{enabled:!1,delay:4200,pauseOnHover:!0,pauseOnFocus:!0,pauseOnHiddenTab:!0,stopOnInteraction:!1},drag:{enabled:!0,threshold:6,velocity:.4,rubberband:!0},keyboard:{enabled:!0,onlyWhenFocused:!0},wheel:{enabled:!1,passive:!0},lazyLoad:{enabled:!1,mode:"adjacent",placeholder:""},a11y:{enabled:!0,roleDescription:"carousel",liveRegion:!0}},responsive:null,animation:{library:"auto",effect:"slide",duration:null,ease:"cubic-bezier(0.22, 0.61, 0.36, 1)",fallback:"css"},fallback:{disableIfNotEnoughSlides:!0,reducedMotion:"fade",noJsClass:"zs-no-js",onMediaError:null},on:{},plugins:[]},N=()=>typeof window<"u"&&typeof document<"u",z=d=>!!(d&&d.nodeType===1),w=(d,t,e)=>Math.min(Math.max(d,t),e);function F(d){if(!d||typeof d!="object")return!1;const t=Object.getPrototypeOf(d);return t===Object.prototype||t===null}function L(...d){const t={};for(const e of d)if(F(e))for(const s of Object.keys(e)){const i=e[s];i!==void 0&&(F(i)?t[s]=L(F(t[s])?t[s]:{},i):Array.isArray(i)?t[s]=i.slice():t[s]=i)}return t}function q(d){if(!N())return null;if(z(d))return d;if(typeof d=="string")try{return document.querySelector(d)}catch{return null}return d&&d.length&&z(d[0])?d[0]:null}function I(d,t){const e=document.createElement(d);return t&&(e.className=t),e}function x(d,t,e,s,i){!t||typeof t.addEventListener!="function"||(t.addEventListener(e,s,i),d.push({target:t,type:e,handler:s,options:i}))}function V(d){for(;d.length;){const{target:t,type:e,handler:s,options:i}=d.pop();try{t.removeEventListener(e,s,i)}catch{}}}function J(){if(!N()||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function K(d){return Array.isArray(d)?d.flat(1/0).filter(Boolean):[]}const G=/^(linear|ease|ease-in|ease-out|ease-in-out|step-start|step-end|cubic-bezier\(.+\)|steps\(.+\))$/;function H(d,t){if(typeof d!="string")return t;const e=d.trim();return e&&!G.test(e)?e:t}function Q(d){return{name:"gsap",fromTo(t,e,s,i){return new Promise(r=>{if(!z(t))return r();d.fromTo(t,{...e,x:e.x||0,y:e.y||0,z:e.z||0,scale:e.scale==null?1:e.scale,rotation:e.rotate||0,rotateY:e.rotateY||0,opacity:e.opacity==null?1:e.opacity},{...s,x:s.x||0,y:s.y||0,z:s.z||0,scale:s.scale==null?1:s.scale,rotation:s.rotate||0,rotateY:s.rotateY||0,opacity:s.opacity==null?1:s.opacity,duration:i.duration/1e3,delay:(i.delay||0)/1e3,ease:H(i.easing,"power2.out"),overwrite:"auto",onComplete:r,onInterrupt:r})})}}}function tt(d){const t=d&&typeof d.animate=="function";return{name:t?"anime-v4":"anime",fromTo(e,s,i,r){return new Promise(a=>{if(!z(e))return a();const n={targets:e,duration:r.duration,delay:r.delay||0,easing:H(r.easing,"easeOutQuad"),complete:a},o={translateX:i.x||0,translateY:i.y||0,translateZ:i.z||0,scale:i.scale==null?1:i.scale,rotate:`${i.rotate||0}deg`,rotateY:`${i.rotateY||0}deg`,opacity:i.opacity==null?1:i.opacity},l={translateX:s.x||0,translateY:s.y||0,translateZ:s.z||0,scale:s.scale==null?1:s.scale,rotate:`${s.rotate||0}deg`,rotateY:`${s.rotateY||0}deg`,opacity:s.opacity==null?1:s.opacity};try{if(t){const h=H(r.easing,null),p={duration:r.duration,delay:r.delay||0};h&&(p.ease=h),d.animate(e,{...l,...o},p).finished.then(a,a)}else d({...n,...l,keyframes:[{...l},{...o}]})}catch{a()}})}}}function et(d){return{name:"motion",fromTo(t,e,s,i){if(!z(t))return Promise.resolve();const r={x:[e.x||0,s.x||0],y:[e.y||0,s.y||0],z:[e.z||0,s.z||0],scale:[e.scale==null?1:e.scale,s.scale==null?1:s.scale],rotate:[e.rotate||0,s.rotate||0],rotateY:[e.rotateY||0,s.rotateY||0],opacity:[e.opacity==null?1:e.opacity,s.opacity==null?1:s.opacity]},a=d.animate(t,r,{duration:i.duration/1e3,delay:(i.delay||0)/1e3,easing:H(i.easing,"ease-out")});return a&&typeof a.finished=="object"?a.finished.then(()=>{},()=>{}):Promise.resolve()}}}function st(d){return{name:"custom",fromTo(t,e,s,i){if(typeof d.fromTo=="function")return Promise.resolve(d.fromTo(t,e,s,i));if(typeof d.animate=="function")return Promise.resolve(d.animate(t,{from:e,to:s,...i}));throw new Error("Custom animation library must expose fromTo() or animate().")}}}function it(d){if(!N()||d==="none")return null;if(d&&typeof d=="object")return{adapter:st(d),label:"custom"};const t=window,e=d==="auto"?["gsap","anime","motion"]:[d];for(const s of e)try{if(s==="gsap"&&t.gsap&&typeof t.gsap.fromTo=="function")return{adapter:Q(t.gsap),label:"gsap"};if(s==="anime"&&typeof t.anime=="function")return{adapter:tt(t.anime),label:"anime"};if(s==="motion"&&t.motion&&typeof t.motion.animate=="function")return{adapter:et(t.motion),label:"motion"}}catch{return null}return null}let rt=0;const O=new WeakMap,D=new Set,at={"aria-prev":"Previous slide","aria-next":"Next slide",fraction:(d,t)=>`${d} / ${t}`},nt=["role","aria-roledescription","aria-label","tabindex","dir","id"];class P{constructor(t,e={}){this.el=null,this.ready=!1,this.destroyed=!1,this._events=new Map,this._listeners=[],this._generated=[],this._generatedArrows=[],this._syncTargets=[],this._syncListeners=[],this._syncOrigin=null,this._pluginList=[],this._breakpointListeners=[],this._mediaLoadListeners=[],this._waapi=[],this._timers=new Set,this._controlListeners=[],this._controlSnapshots=[],this._slideSnapshots=[],this._innerState=new WeakMap,this._parallaxCache=new WeakMap,this._parallaxTouched=new Map;const s=q(t);if(!N()||!s){this.params=L(Y),this._cls=this._buildClassNames();return}this.el=s,this.id=s.id||`zs-${++rt}`,O.set(s,this),D.add(this),this._init(e)}_init(t){const e=this.el;this._userOptions=L(t),this._hadId=!!e.id,this._original={className:e.className,style:e.getAttribute("style"),attrs:nt.reduce((s,i)=>({...s,[i]:e.getAttribute(i)}),{}),children:Array.from(e.children)},this.params=this._resolveParams(),this._cls=this._buildClassNames(),this.params.fallback.noJsClass&&e.classList.remove(this.params.fallback.noJsClass),this._setupDom(),this._setupA11y(),this._connectMedia(),this._buildControls(),this._bindEvents(),this._setupBreakpoints(),this._activeIndex=this._normalizeIndex(this.params.initialSlide),this._renderIndex=this._activeIndex,this._offset=0,this._measure(),this._renderIndex=this._renderIndexFor(this._activeIndex),this._offset=this._offsetFor(this._renderIndex),this._render({instant:!0}),this._updateControls(),this._loadLazy(),this._initPlugins(),this._resolveSyncTargets(),this.ready=!0,e.classList.add(this._cls.initialized),this._emit("init",{instance:this}),this._startAutoplay(),D.forEach(s=>{s!==this&&s.ready&&s._resolveSyncTargets()})}_buildClassNames(){const t=this.params.classPrefix||"zs-",e={};return["slider","initialized","viewport","track","slide","slide-clone","slide-active","slide-visible","arrows","arrow","arrow-prev","arrow-next","arrow-hidden","bullets","bullet","bullet-active","fraction","progressbar","progressbar-fill","live","dragging","drag-enabled","disabled","animating"].forEach(s=>{e[s]=t+s}),B.forEach(s=>{e[`type-${s}`]=`${t}type-${s}`}),W.forEach(s=>{e[`axis-${s}`]=`${t}axis-${s}`}),e}_resolveParams(){const t=L(Y,this._userOptions);if(t.type=B.includes(t.type)?t.type:"slide",t.axis=W.includes(t.axis)?t.axis:"x",t.dir=Z.includes(t.dir)?t.dir:"ltr",t.slidesPerView=t.slidesPerView==="auto"?"auto":Math.max(.1,Number(t.slidesPerView)||1),t.slidesToScroll=Math.max(1,Math.round(Number(t.slidesToScroll)||1)),t.gap=Math.max(0,Number(t.gap)||0),t.speed=Math.max(0,Number(t.speed)||0),X.includes(t.animation.effect)||(t.animation.effect="slide"),["css","waapi"].includes(t.animation.fallback)||(t.animation.fallback="css"),[!0,!1,"auto"].includes(t.loop)||(t.loop=!!t.loop),F(t.responsive)&&typeof window.matchMedia=="function"){const e=Object.keys(t.responsive).map(s=>({key:s,min:parseFloat(s)||0,overrides:t.responsive[s]})).sort((s,i)=>i.min-s.min);for(const s of e)try{if(window.matchMedia(`(min-width: ${s.min}px)`).matches){Object.assign(t,L(t,s.overrides));break}}catch{}}return t}_setupDom(){const t=this.el,e=this._cls;t.classList.add(e.slider,e.initialized,e[`type-${this.params.type}`],e[`axis-${this.params.axis}`]),t.classList.toggle(e["drag-enabled"],!!this.params.features.drag.enabled),this.params.dir==="rtl"&&t.setAttribute("dir","rtl"),t.id||(t.id=this.id),this.params.features.a11y.enabled&&t.setAttribute("tabindex","0"),this._viewport=I("div",`${e.viewport} ${e[`type-${this.params.type}`]}`),this._track=I("div",e.track),this._generated.push(this._viewport),this._slides=Array.from(t.children),this._slideSnapshots=this._slides.map(s=>({className:s.className,style:s.getAttribute("style"),id:s.getAttribute("id"),role:s.getAttribute("role"),"aria-roledescription":s.getAttribute("aria-roledescription"),"aria-label":s.getAttribute("aria-label"),"aria-hidden":s.getAttribute("aria-hidden"),inert:s.hasAttribute("inert")})),this._slides.forEach((s,i)=>{s.classList.contains(e.slide)||s.classList.add(e.slide),s.setAttribute("data-zs-index",String(i)),this._track.appendChild(s)}),this._realCount=this._slides.length,this._viewport.appendChild(this._track),t.appendChild(this._viewport),this._baseSlideClasses=this._slides.map(s=>s.className),this._baseSlideStyles=this._slides.map(s=>s.getAttribute("style"))}_setupA11y(){const t=this.params.features.a11y;if(!t.enabled)return;const e=this.el;e.setAttribute("role","region"),e.setAttribute("aria-roledescription",t.roleDescription),e.hasAttribute("aria-label")||e.setAttribute("aria-label","Image carousel"),this._slides.forEach((s,i)=>{s.id||(s.id=`${this.id}-slide-${i}`),s.setAttribute("role","group"),s.setAttribute("aria-roledescription","slide"),s.setAttribute("aria-label",`${i+1} of ${this._realCount}`)}),t.liveRegion&&(this._live=I("div",this._cls.live),this._live.setAttribute("aria-live","polite"),this._live.setAttribute("aria-atomic","true"),this.el.appendChild(this._live),this._generated.push(this._live))}_bindEvents(){const t=this.el,e=this.params.features;this._onPointerDown=this._handlePointerDown.bind(this),this._onPointerMove=this._handlePointerMove.bind(this),this._onPointerUp=this._handlePointerUp.bind(this),x(this._listeners,t,"pointerdown",this._onPointerDown,{passive:!0}),x(this._listeners,t,"pointermove",this._onPointerMove,{passive:!1}),x(this._listeners,t,"pointerup",this._onPointerUp),x(this._listeners,t,"pointercancel",this._onPointerUp),x(this._listeners,t,"dragstart",i=>{this._drag&&this._drag.started&&i.preventDefault()}),e.autoplay.pauseOnHover&&(x(this._listeners,t,"pointerenter",i=>{i.pointerType==="mouse"&&(this._hoverPaused=!0)}),x(this._listeners,t,"pointerleave",()=>{this._hoverPaused=!1,this._scheduleAutoplay()})),e.autoplay.pauseOnFocus&&(x(this._listeners,t,"focusin",()=>{this._focusPaused=!0}),x(this._listeners,t,"focusout",i=>{t.contains(i.relatedTarget)||(this._focusPaused=!1,this._scheduleAutoplay())})),e.autoplay.pauseOnHiddenTab&&typeof document<"u"&&(this._onVisibility=()=>{document.hidden||this._scheduleAutoplay()},x(this._listeners,document,"visibilitychange",this._onVisibility)),x(this._listeners,t,"click",i=>{this._suppressClickUntil&&performance.now()<this._suppressClickUntil&&(i.preventDefault(),i.stopPropagation())},!0),this._onKeyDown=i=>{const r=this.params.features.keyboard;if(!r.enabled||this._disabled||i.metaKey||i.ctrlKey||i.altKey)return;const a=i.target;if(a&&/^(INPUT|TEXTAREA|SELECT)$/.test((a.tagName||"").toUpperCase()))return;if(!r.onlyWhenFocused&&a&&a.closest){const l=a.closest(`.${this._cls.slider}`);if(l&&l!==this.el)return}const n=this._rtl;let o;switch(i.key){case"ArrowLeft":o=n?"next":"prev";break;case"ArrowRight":o=n?"prev":"next";break;case"ArrowUp":o="prev";break;case"ArrowDown":o="next";break;case"Home":o="first";break;case"End":o="last";break;case"PageUp":o="prev";break;case"PageDown":o="next";break;default:return}i.preventDefault(),this._userInteracted(),o==="first"?this.goTo(0):o==="last"?this.goTo(this._realCount-1):o==="next"?this.next():this.prev()};const s=this.params.features.keyboard.onlyWhenFocused?t:document;x(this._listeners,s,"keydown",this._onKeyDown),this._onWheel=i=>{const r=this.params.features.wheel;if(!r.enabled)return;const a=Date.now();if(a-(this._wheelAt||0)<320)return;const n=this.params.axis==="x"&&Math.abs(i.deltaX)>Math.abs(i.deltaY)?i.deltaX:i.deltaY;Math.abs(n)<12||(this._wheelAt=a,r.passive||i.preventDefault(),this._userInteracted(),n>0?this.next():this.prev())},x(this._listeners,t,"wheel",this._onWheel,{passive:!!this.params.features.wheel.passive}),typeof ResizeObserver=="function"&&(this._ro=new ResizeObserver(()=>this._requestRecalc()),this._ro.observe(t),this._ro.observe(this._track)),this._onWindowResize=()=>this._requestRecalc(),x(this._listeners,window,"resize",this._onWindowResize),x(this._listeners,window,"orientationchange",this._onWindowResize),this.params.features.lazyLoad.enabled&&x(this._listeners,document,"zs:lazy",i=>{i.detail&&i.detail.instance===this&&this._loadLazy()})}_requestRecalc(){this.destroyed||!this.ready||this._recalcRaf||(this._recalcRaf=requestAnimationFrame(()=>{this._recalcRaf=null,!this.destroyed&&this.ready&&this.recalculate()}))}_measure(){const t=this.el,e=this.params.axis,s=this.params.gap,i=this.params.slidesPerView;if(!this._viewport)return;if(!this._realCount){this._empty=!0,this._disabled=!0,this._loopActive=!1,this._renderSlides=[],this._pos=[0],this._sizes=[],this._viewport.style.height="0px";return}this._empty=!1,this._rtl=this.params.dir==="rtl";const r=t.getBoundingClientRect(),a=Math.max(0,e==="x"?t.clientWidth||r.width:t.clientHeight||r.height);this._slides.forEach(c=>{i==="auto"?e==="x"?c.style.width="auto":c.style.height="auto":e==="x"?c.style.width="":c.style.height=""});let n=0;e==="y"&&a<1&&this._slides.forEach(c=>{n=Math.max(n,c.offsetHeight||0)});let o=[];if(i==="auto")o=this._slides.map(u=>{const f=e==="x"?u.getBoundingClientRect().width:u.getBoundingClientRect().height;return Math.max(40,Math.round(f*100)/100)}),o.reduce((u,f)=>u+f,0)+s*Math.max(0,o.length-1)<=1&&(o=this._slides.map(()=>Math.max(40,a||300)));else{const c=a>1?a:n*Math.ceil(i)||300,u=Math.max(1,(c-s*(i-1))/i);o=this._slides.map(()=>Math.round(u*100)/100)}if(this._slideSizes=o,this._slides.forEach((c,u)=>{e==="x"?(c.style.width=`${o[u]}px`,c.style.height=""):(c.style.height=`${o[u]}px`,c.style.width="")}),e==="x"){let c=0;this._slides.forEach(y=>{c=Math.max(c,y.offsetHeight||0)}),this._slideHeights=this._slides.map(y=>y.offsetHeight||0);const u=this._slideHeights[this._activeIndex]||c,f=this.params.autoHeight?u:c;if(f>0){this._viewport.style.transition=this.params.autoHeight?`height ${this._transitionDuration()}ms ${this.params.animation.ease}`:"none";const y=`${f}px`;this._viewport.style.height!==y&&(this._viewport.style.height=y)}}else if(this._slideHeights=o.slice(),a<1){const c=o[0]*(i==="auto"?1:i)+s*Math.max(0,(i==="auto"?1:Math.ceil(i))-1);this._viewport.style.height=`${Math.max(0,c)}px`}else this._viewport.style.height="";this._viewportSize=e==="y"&&a<1?this._viewport.clientHeight:a;let l=0;const h=o;h.forEach((c,u)=>{l+=c+(u<h.length-1?s:0)}),this._realExtent=l;const p=i==="auto"?1:Math.ceil(i);this._notEnough=this._realCount<=p&&l<=this._viewportSize+1,this._disabled=!!(this.params.fallback.disableIfNotEnoughSlides&&this._notEnough),this._loopActive=!!this.params.loop&&!this._disabled&&this._realCount>1&&(this.params.type!=="slide"||l>this._viewportSize+1),this._buildRender(),this._renderSlides.forEach(c=>{c.clone&&(e==="x"?(c.el.style.width=`${o[c.real]}px`,c.el.style.height=""):(c.el.style.height=`${o[c.real]}px`,c.el.style.width=""))}),this._pos=[],this._sizes=[];let _=0;this._renderSlides.forEach((c,u)=>{const f=o[c.real]||0;this._pos[u]=_,this._sizes[u]=f,_+=f+s}),this._renderExtent=Math.max(0,_-s),this._clipRenderIndex(),this._updateSlideClasses(),this._loadLazy()}_buildRender(){const t=this._cls,e=this._realCount,s=this.params.slidesPerView,i=this._loopActive&&this.params.type==="slide"&&e>1;if(Array.from(this._track.querySelectorAll("[data-zs-clone]")).forEach(l=>l.remove()),!i){this._usingClones=!1,this._pre=0,this._renderSlides=this._slides.map((l,h)=>({el:l,real:h,clone:!1}));return}const r=s==="auto"?2:Math.ceil(s),a=Math.min(e-1,Math.max(1,r+(this.params.slidesToScroll>1?1:0))),n=[],o=l=>{const h=this._slides[l].cloneNode(!0);return h.removeAttribute("id"),h.querySelectorAll("[id]").forEach(p=>p.removeAttribute("id")),h.querySelectorAll("a, button, input, select, textarea, [tabindex]").forEach(p=>{p.setAttribute("tabindex","-1")}),h.setAttribute("aria-hidden","true"),"inert"in h&&(h.inert=!0),h.setAttribute("data-zs-clone",""),h.classList.add(t.slide,t["slide-clone"]),h.classList.remove(t["slide-active"]),h};for(let l=e-a;l<e;l+=1){const h=o(l);this._track.insertBefore(h,this._slides[0]),n.push({el:h,real:l,clone:!0})}this._pre=a,this._slides.forEach((l,h)=>n.push({el:l,real:h,clone:!1}));for(let l=0;l<a;l+=1){const h=o(l);this._track.appendChild(h),n.push({el:h,real:l,clone:!0})}this._usingClones=!0,this._renderSlides=n}_clipRenderIndex(){const t=Math.max(0,this._renderSlides.length-1);Number.isFinite(this._renderIndex)||(this._renderIndex=this._renderIndexFor(this._activeIndex)),this._renderIndex=w(this._renderIndex,0,t),Number.isFinite(this._offset)||(this._offset=this._offsetFor(this._renderIndex))}_offsetFor(t){const e=this._pos[t]||0,s=this._sizes[t]||0,i=this.params.centeredSlides?(this._viewportSize-s)/2:0;let a=this._rtl&&this.params.axis==="x"?-(e+i):-(e-i);const n=this.params.slidesPerView;if(!this.params.centeredSlides&&!this._loopActive&&(n==="auto"||n>1)){const o=Math.max(0,(this._realExtent||0)-(this._viewportSize||0));a=Math.max(a,-o)}return a}_renderIndexFor(t){const e=this._realCount;if(!e)return 0;const s=(Math.round(t)%e+e)%e;if(!this._usingClones)return s;const i=[s+this._pre,s+this._pre-e,s+this._pre+e],r=Number.isFinite(this._renderIndex)?this._renderIndex:this._pre;let a=i[0],n=1/0;return i.forEach(o=>{if(o<0||o>=this._renderSlides.length)return;const l=Math.abs(o-r);l<n&&(n=l,a=o)}),a}_realIndexFor(t){const e=this._realCount;return e?((t-this._pre)%e+e)%e:0}_normalizeIndex(t){const e=this._realCount||this._slides.length;if(!e)return 0;const s=!!this.params.loop&&!this._disabled;let i=Math.round(Number(t)||0);return i<0&&(i=s?(i%e+e)%e:0),i>=e&&(i=s?i%e:e-1),i}_normalizeClones(){if(!this._usingClones)return!1;const t=this._realCount,e=this._pre;let s=this._renderIndex;return s<e?s+=t:s>=e+t&&(s-=t),s===this._renderIndex?!1:(this._renderIndex=s,this._activeIndex=this._realIndexFor(s),this._offset=this._offsetFor(s),this._applyInstant(this._computeStyles()),!0)}_cyclicRel(t,e){const s=this._renderSlides.length||this._realCount;let i=t-e;if(!this._loopActive||s<=1)return i;for(;i>s/2;)i-=s;for(;i<-s/2;)i+=s;return i}_warnCustomTransform(t){this._customWarned||(this._customWarned=!0,t?console.error("[ZikraSlider] custom.transform failed; falling back to neutral styles.",t):console.warn('[ZikraSlider] type "custom" needs a custom.transform({ ... }) callback.'))}_computeStyles(){const t=this.params.type,e=this.params.axis,s=this._rtl,i=s?-1:1,r=this.params.parallax||{},a=[],n=this._renderIndex,o=t==="slide"?n:Number.isFinite(this._float)?this._float:n,l=this.params.slidesPerView==="auto"?2:this.params.slidesPerView;return this._renderSlides.forEach((h,p)=>{const _=this._sizes[p]||0;let c=0,u=0,f=0,y=1,A=0,E=0,b=1,C=1,S=!0,k=!0,R=0;if(t==="slide"){const m=(this._pos[p]||0)+this._offset;if(e==="x"?c=s?-m:m:u=m,e==="x"){const g=s?-m:m;S=g<this._viewportSize+1&&g+_>-1,k=g<this._viewportSize-1&&g+_>1}else S=m<this._viewportSize+1&&m+_>-1,k=m<this._viewportSize-1&&m+_>1;if(r.enabled){const g=this.params.centeredSlides?(this._viewportSize-_)/2:0;R=(e==="x"?c:m)-g}C=p===n?3:1}else{const m=this._cyclicRel(p,o),g=Math.abs(m);if(r.enabled&&(R=m*(this._viewportSize||0)),t==="custom"){const T=this.params.custom&&this.params.custom.transform;let $=null;if(typeof T=="function")try{$=T({index:p,realIndex:h.real,relative:m,activeIndex:this._activeIndex,total:this._realCount,viewportSize:this._viewportSize,slideSize:_,axis:e,dir:this.params.dir,loop:!!this._loopActive})}catch(U){this._warnCustomTransform(U),$=null}else this._warnCustomTransform();const v=$&&typeof $=="object"?$:{};c=Number(v.x)||0,u=Number(v.y)||0,f=Number(v.z)||0,y=v.scale==null?1:Number(v.scale)||0,A=Number(v.rotate)||0,E=Number(v.rotateY)||0,b=v.opacity==null?1:w(Number(v.opacity)||0,0,1),C=v.zIndex==null?Math.round((1-Math.min(g,1))*100)+1:Math.round(Number(v.zIndex))||0,S=v.visible==null?b>.02:!!v.visible,k=v.interactive==null?S&&b>.05:!!v.interactive}else if(t==="fade"){b=w(1-g,0,1);const T=(e==="x"?_*.08:_*.06)*m;e==="x"?c=i*T:u=T,C=Math.round((1-g)*100)+1,S=b>.02}else if(t==="scale")b=w(1-g*.9,0,1),y=1-Math.min(g,1)*.14,C=Math.round((1-g)*100)+1,S=b>.02;else if(t==="coverflow"){const T=(e==="x"?_*.52:_*.4)*m*i;e==="x"?c=T:u=m*_*.3,E=w(-m,-1,1)*42*i,f=-g*130,y=1-g*.06,b=g>2.4?0:w(1-g*.2,0,1),C=100-Math.round(g*10),S=b>.02}else t==="stack"?(u=-Math.max(m,0)*20,y=1-Math.max(m,0)*.07,b=m<-.5?0:w(1-Math.max(m,0)*.2,0,1),C=60-Math.round(m*10),S=b>.02):t==="cards"&&(e==="x"?c=i*m*_*.2:u=m*_*.2,c+=i*Math.abs(m)*10,u+=Math.abs(m)*20,A=m*4*i,y=1-g*.06,b=g>2.2?0:w(1-g*.28,0,1),C=70-Math.round(g*10),S=b>.02);t!=="custom"&&(g<.5&&(C+=50),g>l+2&&(S=!1),k=S&&b>.05)}a.push({el:h.el,renderIndex:p,realIndex:h.real,clone:h.clone,active:p===n||t!=="slide"&&Math.abs(this._cyclicRel(p,o))<.5,visible:S,interactive:k,parallax:R,style:{x:c,y:u,z:f,scale:y,rotate:A,rotateY:E,opacity:b,zIndex:C}})}),a}_transformString(t){return`translate3d(${t.x}px, ${t.y}px, ${t.z}px) scale(${t.scale}) rotateZ(${t.rotate}deg) rotateY(${t.rotateY}deg)`}_parallaxElements(t){let e=this._parallaxCache.get(t);if(e)return e;e=[];const s=this.params.parallax;if(s&&s.enabled)try{t.querySelectorAll(s.selector||"[data-zs-parallax]").forEach(i=>{const r=i.getAttribute("data-zs-parallax"),a=r==null||r.trim()===""?NaN:parseFloat(r),n=Number.isFinite(a)?a:Number(s.factor)||0;n&&e.push({el:i,factor:n})})}catch{}return this._parallaxCache.set(t,e),e}_parallaxShift(t,e){const s=-(Number(t)||0)*e;return this.params.axis==="y"?{x:0,y:s}:{x:s,y:0}}_touchParallax(t){this._parallaxTouched.has(t)||this._parallaxTouched.set(t,{transform:t.style.transform,opacity:t.style.opacity,transition:t.style.transition,transitionDelay:t.style.transitionDelay,willChange:t.style.willChange})}_resetParallax(){this._parallaxTouched.forEach((t,e)=>{!e||!e.style||(t.transform?e.style.transform=t.transform:e.style.removeProperty("transform"),t.opacity?e.style.opacity=t.opacity:e.style.removeProperty("opacity"),t.transition?e.style.transition=t.transition:e.style.removeProperty("transition"),t.transitionDelay?e.style.transitionDelay=t.transitionDelay:e.style.removeProperty("transition-delay"),t.willChange?e.style.willChange=t.willChange:e.style.removeProperty("will-change"))}),this._parallaxTouched.clear(),this._innerState=new WeakMap,this._parallaxCache=new WeakMap}_applyParallax(t){const e=this.params.parallax;!e||!e.enabled||t.forEach(s=>{this._parallaxElements(s.el).forEach(({el:i,factor:r})=>{const a=this._parallaxShift(s.parallax,r);this._touchParallax(i),i.style.transition="none",i.style.transitionDelay="0ms",i.style.transform=`translate3d(${a.x}px, ${a.y}px, 0)`,this._innerState.set(i,a)})})}_applyInstant(t){t.forEach(({el:e,style:s})=>{e.style.transition="none",e.style.transform=this._transformString(s),e.style.opacity=String(s.opacity),e.style.zIndex=String(s.zIndex),this.params.type!=="slide"?e.style.pointerEvents=s.opacity>.05?"auto":"none":e.style.pointerEvents=""}),this._applyParallax(t),this._styleState=new Map(t.map(e=>[e.el,e.style])),this._updateSlideClasses(t)}_updateSlideClasses(t){const e=t||this._computeStyles(),s=this._cls,i=this.params.features.a11y.enabled;e.forEach(r=>{const a=r.el;a.classList.toggle(s["slide-active"],!!r.active),a.classList.toggle(s["slide-visible"],r.visible),i&&(r.clone||!r.visible?a.setAttribute("aria-hidden","true"):a.removeAttribute("aria-hidden"),!r.clone&&"inert"in a&&(a.inert=!r.interactive))}),this._lastEntries=e}_announce(){!this._live||!this.params.features.a11y.liveRegion||!this._realCount||(this._announceTimer&&(clearTimeout(this._announceTimer),this._timers.delete(this._announceTimer)),this._announceTimer=setTimeout(()=>{if(this.destroyed)return;const t=`Slide ${this._activeIndex+1} of ${this._realCount}`;this._live.textContent=t},120),this._timers.add(this._announceTimer))}_lazyTargets(){if(!this.params.features.lazyLoad.enabled||!this._renderSlides)return[];const t=this.params.features.lazyLoad.mode;if(t==="eager")return this._renderSlides;const e=t==="onDemand"?0:Math.ceil(this.params.slidesPerView==="auto"?2:this.params.slidesPerView)+1;return this._renderSlides.filter(s=>{const i=Math.abs(s.real-this._activeIndex);return this._loopActive?Math.min(i,this._realCount-i)<=e:i<=e})}_loadLazy(){const t=this.params.features.lazyLoad;if(!t.enabled)return;const e=t.placeholder;this._lazyTargets().forEach(({el:i})=>{i.querySelectorAll("img").forEach(r=>{const a=r.getAttribute("data-zs-src");if(!a)return;const n=r.getAttribute("data-zs-srcset");if(!r.getAttribute("src")&&e&&r.setAttribute("src",e),r.getAttribute("data-zs-loading")==="1")return;r.setAttribute("data-zs-loading","1");const o=()=>{r.removeAttribute("data-zs-loading"),this._requestRecalc()},l=()=>{r.removeAttribute("data-zs-loading");const h=t.onMediaError||this.params.fallback.onMediaError;if(typeof h=="function")try{h(r,a)}catch{}r.setAttribute("data-zs-error",a)};r.addEventListener("load",o,{once:!0}),r.addEventListener("error",l,{once:!0}),this._mediaLoadListeners.push({img:r,onLoad:o,onError:l}),n&&r.setAttribute("srcset",n),r.setAttribute("src",a),r.removeAttribute("data-zs-src"),r.removeAttribute("data-zs-srcset")})})}_connectMedia(){this._slides&&this._slides.forEach(t=>{t.querySelectorAll("img").forEach(e=>{if(e.getAttribute("data-zs-media")==="1")return;e.setAttribute("data-zs-media","1");const s=()=>this._requestRecalc(),i=()=>{const r=this.params.fallback.onMediaError;if(typeof r=="function")try{r(e,e.currentSrc||e.src)}catch{}};e.addEventListener("load",s),e.addEventListener("error",i),this._mediaLoadListeners.push({img:e,onLoad:s,onError:i})})})}_transitionDuration(){if(typeof this._speedOverride=="number")return Math.max(0,this._speedOverride);const t=this.params.animation.duration,e=t??this.params.speed;return Math.max(0,Number(e)||0)}_render({instant:t=!1}={}){if(this.destroyed||!this._renderSlides||!this._renderSlides.length)return;const e=this._computeStyles();if(this._targetEntries=e,t){this._cancelAnimations(),this._applyInstant(e),this._updateControls();return}this._animate(e)}_cancelAnimations(){this._animSeq=(this._animSeq||0)+1,this._animating=!1,this._animTimer&&(clearTimeout(this._animTimer),this._timers.delete(this._animTimer),this._animTimer=null),this._progressRaf&&(cancelAnimationFrame(this._progressRaf),this._progressRaf=null),this._waapi.forEach(t=>{try{t.cancel()}catch{}}),this._waapi=[],this._cls&&this.el.classList.remove(this._cls.animating)}_planTransition(t,e,s,i){const r=this._styleState||new Map,a=this._renderIndex,n=this._directionForward!==!1,o=[];return t.forEach(l=>{let h={...r.get(l.el)||l.style};const p=l.style,_=Math.abs(l.renderIndex-a);i||(e==="fade"&&l.active?h.opacity=0:e==="zoom"&&l.active?(h.scale=(p.scale==null?1:p.scale)*.86,h.opacity=Math.min(h.opacity,.7)):e==="slide-up"&&l.active?(h.y=(h.y||0)+56,h.opacity=Math.min(h.opacity,.4)):e==="flip"&&l.active&&(h.rotateY=(n?-1:1)*72)),i&&(h={...p,opacity:h.opacity});const c=e==="stagger"?Math.min(_,3)*Math.max(40,Math.round(s*.09)):0;o.push({el:l.el,from:h,to:p,delay:c,distance:_});const u=this.params.parallax;u&&u.enabled&&this._parallaxElements(l.el).forEach(({el:f,factor:y})=>{const A=this._parallaxShift(l.parallax,y),E=this._innerState.get(f),b=i||!E?{...A}:{x:E.x,y:E.y};this._touchParallax(f),o.push({el:f,inner:!0,from:b,to:A,delay:c,distance:_})})}),o}_animate(t){this._cancelAnimations();const e=this._animSeq+=1;let s=this._transitionDuration();const i=this.params.animation;let r=i.effect||"slide";const a=J();if(a&&this.params.fallback.reducedMotion==="instant"&&(s=0),a&&this.params.fallback.reducedMotion==="fade"&&(s=Math.min(s,220),r="fade"),s<=0){this._applyInstant(t),this._normalizeClones(),this._emitProgress(this.getProgress()),this._updateControls(),this._updateAutoHeight(),this._loadLazy(),this._updateSlideClasses(t),this._afterTransition();return}const n=this._planTransition(t,r,s,a);let o=0;n.forEach(_=>{o=Math.max(o,_.delay)}),this._animating=!0,this.el.classList.add(this._cls.animating);const l=this.getProgress(),h=this._pendingChange&&this._realCount>1?w(this._pendingChange.previousIndex/(this._realCount-1),0,1):l;this._emitProgress(h),this._startProgress(s+o,e,h,l);const p=it(i.library);if(p)try{const _=n.map(({el:c,from:u,to:f,delay:y,inner:A})=>(c.style.transition="none",A?(c.style.transform=`translate3d(${u.x}px, ${u.y}px, 0)`,Promise.resolve(p.adapter.fromTo(c,{...u,z:0,scale:1,rotate:0,rotateY:0,opacity:1},{...f,z:0,scale:1,rotate:0,rotateY:0,opacity:1},{duration:s,delay:y,easing:i.ease}))):(c.style.transform=this._transformString(u),c.style.opacity=String(u.opacity),c.style.zIndex=String(f.zIndex),Promise.resolve(p.adapter.fromTo(c,u,f,{duration:s,delay:y,easing:i.ease})))));Promise.all(_).then(()=>this._finishAnimation(e),()=>this._finishAnimation(e)),this._scheduleAnimationFinish(e,s+o+320),this._backend=p.label;return}catch{this._backend="css"}if(i.fallback==="waapi"&&this._supportsWaapi()){this._backend="waapi";const _=n.map(({el:c,from:u,to:f,delay:y,inner:A})=>{if(c.style.transition="none",A){c.style.transform=`translate3d(${u.x}px, ${u.y}px, 0)`;const b=c.animate([{transform:`translate3d(${u.x}px, ${u.y}px, 0)`},{transform:`translate3d(${f.x}px, ${f.y}px, 0)`}],{duration:s,delay:y,easing:i.ease||"ease-out",fill:"both"});return this._waapi.push(b),b.finished.catch(()=>{})}c.style.zIndex=String(f.zIndex);const E=c.animate([{transform:this._transformString(u),opacity:String(u.opacity)},{transform:this._transformString(f),opacity:String(f.opacity)}],{duration:s,delay:y,easing:i.ease||"ease-out",fill:"both"});return this._waapi.push(E),E.finished.catch(()=>{})});Promise.all(_).then(()=>this._finishAnimation(e)),this._scheduleAnimationFinish(e,s+o+140);return}this._backend="css",this._animateCss(n,s,i.ease,e)}_supportsWaapi(){return typeof Element<"u"&&typeof Element.prototype.animate=="function"}_animateCss(t,e,s,i){const r=s||"ease-out";t.forEach(({el:n,from:o,to:l,inner:h})=>{if(n.style.transition="none",n.style.transitionDelay="0ms",h){n.style.willChange="transform",n.style.transform=`translate3d(${o.x}px, ${o.y}px, 0)`;return}n.style.willChange="transform, opacity",n.style.transform=this._transformString(o),n.style.opacity=String(o.opacity),n.style.zIndex=String(l.zIndex)}),this.el.offsetWidth;let a=0;t.forEach(({el:n,to:o,delay:l,inner:h})=>{if(a=Math.max(a,l),h){n.style.transition=`transform ${e}ms ${r}`,n.style.transitionDelay=`${l}ms`,n.style.transform=`translate3d(${o.x}px, ${o.y}px, 0)`;return}n.style.transition=`transform ${e}ms ${r}, opacity ${e}ms ${r}`,n.style.transitionDelay=`${l}ms`,n.style.transform=this._transformString(o),n.style.opacity=String(o.opacity),n.style.zIndex=String(o.zIndex)}),this._scheduleAnimationFinish(i,e+a+40)}_startProgress(t,e,s=0,i=1){const r=typeof performance<"u"?performance.now():Date.now(),a=n=>{if(this.destroyed||this._animSeq!==e||!this._animating)return;const o=(n||Date.now())-r,l=w(o/Math.max(1,t),0,.995);this._emitProgress(s+(i-s)*l),this._progressRaf=requestAnimationFrame(a)};this._progressRaf=requestAnimationFrame(a)}_scheduleAnimationFinish(t,e){this._animTimer=setTimeout(()=>{this._timers.delete(this._animTimer),this._animTimer=null,this._finishAnimation(t)},Math.max(16,e)),this._timers.add(this._animTimer)}_finishAnimation(t){this.destroyed||t!==this._animSeq||!this._animating||(this._animating=!1,this._animTimer&&(clearTimeout(this._animTimer),this._timers.delete(this._animTimer),this._animTimer=null),this._progressRaf&&(cancelAnimationFrame(this._progressRaf),this._progressRaf=null),this._waapi.forEach(e=>{try{e.cancel()}catch{}}),this._waapi=[],this.el.classList.remove(this._cls.animating),this._applyInstant(this._targetEntries||this._computeStyles()),this._emitProgress(this.getProgress()),this._normalizeClones(),this._updateControls(),this._updateAutoHeight(),this._loadLazy(),this._announce(),this._afterTransition())}_updateAutoHeight(){if(!this.params.autoHeight||this.params.axis!=="x"||!this._slideHeights)return;const t=this._slideHeights[this._activeIndex]||0;t>0&&(this._viewport.style.height=`${t}px`)}_afterTransition(){this._speedOverride=null,this._announce();const t=this._pendingChange;this._pendingChange=null,t&&(this._emit("afterChange",{index:t.index,previousIndex:t.previousIndex,reason:t.reason}),this._notifyPlugins("onChange",{index:t.index,previousIndex:t.previousIndex,reason:t.reason}),this._notifySync("change")),this._syncOrigin=null,this._scheduleAutoplay()}_emitProgress(t){this._emit("progress",{progress:t,index:this._activeIndex}),this._notifySync("progress",t)}on(t,e){return typeof e!="function"||typeof t!="string"?this:(this._events.has(t)||this._events.set(t,new Set),this._events.get(t).add(e),this)}off(t,e){return this._events.has(t)?(e?this._events.get(t).delete(e):this._events.delete(t),this):this}_eventHandlers(t){const e=Array.from(this._events.get(t)||[]),s=this.params.on&&this.params.on[t];return typeof s=="function"?e.unshift(s):Array.isArray(s)&&e.unshift(...s.filter(i=>typeof i=="function")),e}_emit(t,e){this._eventHandlers(t).forEach(s=>{try{s(e)}catch(i){console.error(`[ZikraSlider] "${t}" listener failed:`,i)}})}_emitCancellable(t,e){const s=this._eventHandlers(t);for(const i of s)try{if(i(e)===!1)return!1}catch(r){console.error(`[ZikraSlider] "${t}" listener failed:`,r)}return!0}_initPlugins(){this._pluginList=[],K(this.params.plugins).forEach(t=>{if(!(!t||typeof t.init!="function"))try{t.init(this),this._pluginList.push(t)}catch(e){console.error(`[ZikraSlider] plugin "${t.name||"unnamed"}" init failed:`,e)}})}_notifyPlugins(t,e){this._pluginList.forEach(s=>{if(typeof s[t]=="function")try{s[t](this,e)}catch(i){console.error(`[ZikraSlider] plugin "${s.name||"unnamed"}" ${t} failed:`,i)}})}_settle(){this._animating&&this._finishAnimation(this._animSeq)}goTo(t,e={}){if(!this.ready||this.destroyed||!this._realCount)return this;this._animating&&this._settle(),this._momentum&&this._stopMomentum();const s=this._normalizeIndex(t),i=this._activeIndex,r=e.reason||"api";return s===i&&!e.force?(this._float=void 0,this._snapBack(this._transitionDuration()),this):!e.silent&&!this._emitCancellable("beforeChange",{index:s,previousIndex:i,reason:r})?this:(this._directionForward=s>=i,this._activeIndex=s,this._renderIndex=this._renderIndexFor(s),this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._pendingChange={index:s,previousIndex:i,reason:r},this._speedOverride=typeof e.speed=="number"?e.speed:null,this._updateControls(),this._pendingChange&&!this._loopActive&&!this.params.loop&&s===i?(this._pendingChange=null,this):(this._render(),this._animating===!1&&(this._speedOverride=null),this))}next(t={}){if(!this.ready||this.destroyed)return this;if(this._disabled)return this;const e=Math.max(1,this.params.slidesToScroll);return!this._loopActive&&this._activeIndex>=this._realCount-1?(this._snapBack(this._transitionDuration()),this):this.goTo(this._activeIndex+e,{...t,reason:t.reason||"next"})}prev(t={}){if(!this.ready||this.destroyed)return this;if(this._disabled)return this;const e=Math.max(1,this.params.slidesToScroll);return!this._loopActive&&this._activeIndex<=0?(this._snapBack(this._transitionDuration()),this):this.goTo(this._activeIndex-e,{...t,reason:t.reason||"prev"})}_snapBack(t){this._renderSlides.length&&(this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._speedOverride=typeof t=="number"?t:null,this._render(),this._animating||(this._speedOverride=null))}_nearestRenderIndex(t){let e=this._renderIndex,s=1/0;for(let i=0;i<this._renderSlides.length;i+=1){const r=Math.abs(this._offsetFor(i)-t);r<s&&(s=r,e=i)}return e}_resolveEl(t,e=!1){if(!t||!N())return null;if(z(t))return t;if(typeof t!="string")return null;try{return(e?this.el:document).querySelector(t)}catch{return null}}_buildControls(){this._buildArrows(),this._buildBullets()}_buildArrows(){const t=this.params.arrows,e=this._cls;if(!t.enabled)return;const s=this._resolveEl(t.prevEl),i=this._resolveEl(t.nextEl);if(this._arrowPrev=this._createArrow("prev",s),this._arrowNext=this._createArrow("next",i),!s||!i){const a=this._resolveEl(t.container);a?(!s&&this._arrowPrev&&(a.appendChild(this._arrowPrev),this._generatedArrows.push(this._arrowPrev)),!i&&this._arrowNext&&(a.appendChild(this._arrowNext),this._generatedArrows.push(this._arrowNext))):(this._arrowsWrap=I("div",`${e.arrows} ${t.className||""}`.trim()),!s&&this._arrowPrev&&this._arrowsWrap.appendChild(this._arrowPrev),!i&&this._arrowNext&&this._arrowsWrap.appendChild(this._arrowNext),this.el.appendChild(this._arrowsWrap),this._generated.push(this._arrowsWrap))}}_createArrow(t,e){const s=this.params.arrows,i=this._cls,r=`${i.arrow} ${i[`arrow-${t}`]}`,a=t==="prev"?s.prevClass:s.nextClass;let n=e;n?(this._controlSnapshots.push({el:n,className:n.className,html:n.innerHTML}),n.classList.add(...r.split(" ").filter(Boolean)),s.className&&s.className.split(/\s+/).filter(Boolean).forEach(l=>n.classList.add(l)),a&&a.split(/\s+/).filter(Boolean).forEach(l=>n.classList.add(l)),n.innerHTML.trim()||(n.innerHTML=t==="prev"?s.prevHtml:s.nextHtml)):(n=I("button",`${r} ${s.className||""} ${a||""}`.trim()),n.type="button",n.innerHTML=t==="prev"?s.prevHtml:s.nextHtml),n.setAttribute("aria-label",t==="prev"?s.ariaPrevLabel:s.ariaNextLabel);const o=l=>{l.preventDefault(),this._userInteracted(),t==="prev"?this.prev({reason:"arrow"}):this.next({reason:"arrow"})};return this._controlListeners||(this._controlListeners=[]),x(this._controlListeners,n,"click",o),this._arrowEls=this._arrowEls||{},this._arrowEls[t]=n,n}_buildBullets(){const t=this.params.bullets,e=this._cls;if(!t.enabled||!this._realCount)return;const s=this._resolveEl(t.el),i=s||I("div","");this._bulletsEl=i,this._bulletsExternal=!!s,this._bulletsSignature="";const r=[e.bullets,t.className||""];t.type==="fraction"&&r.push(e.fraction),t.type==="progressbar"&&r.push(e.progressbar),s&&this._controlSnapshots.push({el:i,className:i.className,html:i.innerHTML}),i.classList.add(...r.filter(Boolean)),s||(this.el.appendChild(i),this._generated.push(i)),this._controlListeners||(this._controlListeners=[]),this._bulletEls=[],this._progressFill=null,this._bulletsSignature="",this._ensureBulletContent()}_ensureBulletContent(){const t=this.params.bullets,e=t.type;if(!this._bulletsEl)return;if(e==="fraction"){this._bulletsSignature="fraction";return}if(e==="progressbar"){this._bulletsEl.innerHTML="";const i=I("div",this._cls["progressbar-fill"]);this._bulletsEl.appendChild(i),this._progressFill=i,this._bulletsEl.setAttribute("role","progressbar"),this._bulletsEl.setAttribute("aria-label","Slide progress"),this._bulletsEl.setAttribute("aria-valuemin","0"),this._bulletsEl.setAttribute("aria-valuemax","100"),this._bulletsEl.setAttribute("data-orientation",this.params.axis==="x"?"horizontal":"vertical"),this._bulletsSignature="progressbar";return}const s=`bullets:${this._realCount}:${t.bulletClass}:${!!t.render}`;if(s!==this._bulletsSignature){this._bulletsSignature=s,this._bulletsEl.innerHTML="",this._bulletEls=[];for(let i=0;i<this._realCount;i+=1){const r=I("button",`${this._cls.bullet} ${t.bulletClass||""}`.trim());r.type="button",r.setAttribute("aria-label",`Go to slide ${i+1}`),this._renderBulletContent(r,i,!1),t.clickable?x(this._controlListeners,r,"click",()=>{this._userInteracted(),this.goTo(i,{reason:"bullet"})}):r.setAttribute("disabled",""),this._bulletsEl.appendChild(r),this._bulletEls.push(r)}this._bulletsEl.setAttribute("role","group"),this._bulletsEl.setAttribute("aria-label","Slide pagination")}}_renderBulletContent(t,e,s){const i=this.params.bullets.render;if(typeof i!="function"){t.innerHTML="";return}let r;try{r=i({index:e,isActive:s,total:this._realCount})}catch{return}typeof r=="string"?t.innerHTML=r:r&&r.nodeType===1&&t.replaceChildren(r)}_updateControls(){if(this.destroyed)return;const t=this._cls,e=this._realCount||0,s=Number.isFinite(this._activeIndex)?this._activeIndex:0,i=this._loopActive,r=s<=0,a=s>=e-1,n=(h,p)=>{if(!h)return;const _=this.params.arrows,c=p==="prev"?r:a,u=this._disabled||!e||!i&&c;if("disabled"in h&&(h.disabled=u),h.setAttribute("aria-disabled",u?"true":"false"),_.hideAtEdges&&(h.classList.toggle(t["arrow-hidden"],!i&&c),h.setAttribute("aria-hidden",!i&&c?"true":"false")),typeof _.render=="function"){let f;try{f=_.render({direction:p,index:s,total:e})}catch{f=null}typeof f=="string"?h.innerHTML=f:f&&f.nodeType===1&&h.replaceChildren(f)}};n(this._arrowPrev||this._arrowEls&&this._arrowEls.prev,"prev"),n(this._arrowNext||this._arrowEls&&this._arrowEls.next,"next");const o=this.params.bullets;if(!o.enabled||!this._bulletsEl)return;const l=e>1?s/(e-1):0;if(o.type==="fraction"){const h=typeof o.formatFraction=="function"?o.formatFraction:at.fraction;this._bulletsEl.textContent=h(s+1,e)}else if(o.type==="progressbar")this._progressFill&&(this.params.axis==="x"?(this._progressFill.style.width=`${(l*100).toFixed(2)}%`,this._progressFill.style.height=""):(this._progressFill.style.height=`${(l*100).toFixed(2)}%`,this._progressFill.style.width="")),this._bulletsEl.setAttribute("aria-valuenow",String(Math.round(l*100)));else{(!this._bulletEls||this._bulletEls.length!==e)&&this._ensureBulletContent();const h=o.activeClass||t["bullet-active"],p=o.dynamicBullets?2:1/0;(this._bulletEls||[]).forEach((_,c)=>{const u=c===s;_.classList.toggle(h,u),u?_.setAttribute("aria-current","true"):_.removeAttribute("aria-current"),_.classList.toggle(t["bullet-active"],u&&h!==t["bullet-active"]),o.dynamicBullets&&e>7?(_.hidden=Math.abs(c-s)>p,u&&this._renderBulletContent(_,c,!0)):(_.hidden=!1,this._renderBulletContent(_,c,u))})}}_destroyControls(){V(this._controlListeners||[]),this._controlListeners=[],(this._controlSnapshots||[]).forEach(({el:t,className:e,html:s})=>{t.className=e,t.innerHTML=s}),this._controlSnapshots=[],this._generatedArrows.forEach(t=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),this._generatedArrows=[],this._arrowsWrap&&this._arrowsWrap.isConnected&&this._arrowsWrap.remove(),this._bulletsEl&&!this._bulletsExternal&&this._bulletsEl.isConnected&&this._bulletsEl.remove(),this._arrowPrev=null,this._arrowNext=null,this._arrowEls=null,this._arrowsWrap=null,this._bulletsEl=null,this._bulletEls=[],this._progressFill=null,this._bulletsSignature=""}_startAutoplay(){this._autoplayPlaying=!!this.params.features.autoplay.enabled,this._stoppedByUser=!1,this._scheduleAutoplay()}play(){return!this.ready||this.destroyed||this._disabled?this:(this._autoplayPlaying=!0,this._stoppedByUser=!1,this._scheduleAutoplay(),this)}pause(){return this._autoplayPlaying=!1,this._clearAutoplay(),this}toggleAutoplay(){return this._autoplayPlaying?this.pause():this.play()}_clearAutoplay(){this._autoplayTimer&&(clearTimeout(this._autoplayTimer),this._timers.delete(this._autoplayTimer),this._autoplayTimer=null),this._autoplayRunning=!1}_canAutoplay(){const t=this.params.features.autoplay;return!(!this.ready||this.destroyed||!this._autoplayPlaying||this._stoppedByUser||!t.enabled||this._disabled||this._realCount<2||t.pauseOnHover&&this._hoverPaused||t.pauseOnFocus&&this._focusPaused||t.pauseOnHiddenTab&&typeof document<"u"&&document.hidden)}_scheduleAutoplay(){if(this._clearAutoplay(),!this._canAutoplay()||this._animating)return;if(!this._loopActive&&this._activeIndex>=this._realCount-1){this._autoplayPlaying=!1;return}const t=Math.max(250,Number(this.params.features.autoplay.delay)||4e3);this._autoplayRunning=!0,this._autoplayTimer=setTimeout(()=>{this._timers.delete(this._autoplayTimer),this._autoplayTimer=null,this._autoplayRunning=!1,!(!this._canAutoplay()||this._animating)&&(this.next({reason:"autoplay"}),this._animating||this._scheduleAutoplay())},t),this._timers.add(this._autoplayTimer)}_userInteracted(){this.ready&&this.params.features.autoplay.stopOnInteraction&&(this._stoppedByUser=!0,this._autoplayPlaying=!1,this._clearAutoplay())}_stepSize(){const t=this._renderIndex||0,s=(this._sizes&&this._sizes[t]||0)+this.params.gap;return s>0?s:Math.max(1,this._viewportSize)}_dragProgress(){if(!this._realCount||this._realCount<2)return 0;let t;if(this.params.type==="slide"){const e=this._drag,s=e?e.startOffset:this._offsetFor(this._activeIndex);t=this._activeIndex-(this._offset-s)/this._stepSize()}else t=Number.isFinite(this._float)?this._float:this._activeIndex;return w(t/(this._realCount-1),0,1)}_handlePointerDown(t){if(!this.ready||this.destroyed||!this.params.features.drag.enabled||this._disabled||t.pointerType==="mouse"&&t.button>0||this._drag)return;const e=`.${this._cls.arrow}, .${this._cls.bullets}, input, select, textarea, [data-zs-nodrag]`;t.target&&t.target.closest&&t.target.closest(e)||(this._momentum&&this._stopMomentum(),this._animating&&this._settle(),this._drag={pointerId:t.pointerId,pointerType:t.pointerType,startX:t.clientX,startY:t.clientY,startOffset:this._offset,startFloat:this._float,lastPrimary:0,lastT:typeof performance<"u"?performance.now():Date.now(),vx:0,started:!1})}_handlePointerMove(t){const e=this._drag;if(!e||this.destroyed||t.pointerId!==e.pointerId)return;if(!this.params.features.drag.enabled){this._drag=null;return}const s=this.params.features.drag,i=t.clientX-e.startX,r=t.clientY-e.startY,a=this.params.axis==="x"?i:r,n=this.params.axis==="x"?r:i;if(!e.started){if(Math.abs(a)<s.threshold&&Math.abs(n)<s.threshold)return;if(Math.abs(n)>Math.abs(a)*1.2){this._drag=null;return}e.started=!0,this.el.classList.add(this._cls.dragging);try{this.el.setPointerCapture(t.pointerId)}catch{}this._applyInstant(this._computeStyles()),this._userInteracted()}t.cancelable&&t.preventDefault();const o=this.params.axis==="x"&&this._rtl?-1:1;let l=e.startOffset+a*o;const h=s.rubberband?.35:0,p=this._offsetFor(0),_=this._offsetFor(this._renderSlides.length-1),c=Math.max(p,_),u=Math.min(p,_);l>c?l=c+(l-c)*h:l<u&&(l=u+(l-u)*h),this._offset=l,this.params.type!=="slide"&&(this._float=this._activeIndex-(l-e.startOffset)/this._stepSize()),this._applyInstant(this._computeStyles()),this._emitProgress(this._dragProgress());const f=typeof performance<"u"?performance.now():Date.now(),y=f-e.lastT;if(y>0){const A=(a-e.lastPrimary)/y;e.vx=e.vx*.7+A*.3,e.lastPrimary=a,e.lastT=f}}_handlePointerUp(t){const e=this._drag;if(!e||t.pointerId!==e.pointerId||(this._drag=null,!e.started))return;const s=this.params.features.drag;this.el.classList.remove(this._cls.dragging);try{this.el.hasPointerCapture&&this.el.hasPointerCapture(t.pointerId)&&this.el.releasePointerCapture(t.pointerId)}catch{}if(this._suppressClickUntil=(typeof performance<"u"?performance.now():Date.now())+140,t.type==="pointercancel"){this._snapBack(this._transitionDuration());return}const r=(typeof performance<"u"?performance.now():Date.now())-e.lastT>120,a=this.params.axis==="x"&&this._rtl?-1:1,n=r?0:e.vx*a,o=this._stepSize(),l=-(this._offset-e.startOffset)/o,h=-n/o;if(this._float!==void 0&&(this._float=void 0),this.params.freeMode){this._startMomentum(n);return}let p=0;if(Math.abs(n)>s.velocity?p=Math.sign(h)||Math.sign(-n):Math.abs(l)>.18&&(p=Math.sign(l)),!p){this._snapBack(this._transitionDuration());return}const _=this._activeIndex,c=_+p*Math.max(1,this.params.slidesToScroll);this.goTo(c,{reason:"drag"}),this._activeIndex===_&&this._snapBack(this._transitionDuration())}_startMomentum(t){this._drag&&(this._drag=null);let e=t,s=typeof performance<"u"?performance.now():Date.now();const i=this._stepSize(),r=this._offsetFor(0),a=this._offsetFor(this._renderSlides.length-1),n=Math.max(r,a),o=Math.min(r,a);this._momentum=!0;const l=()=>{if(this.destroyed||!this._momentum)return;const h=typeof performance<"u"?performance.now():Date.now(),p=Math.min(48,h-s);s=h,e*=Math.pow(.95,p/16.7);let _=this._offset+e*p;if((_>n||_<o)&&(_=w(_,o,n),e=0),this._offset=_,this.params.type!=="slide"&&(this._float=this._activeIndex-(_-this._offsetFor(this._renderIndex))/i),this._applyInstant(this._computeStyles()),this._emitProgress(this._dragProgress()),Math.abs(e)<.02||p===0){this._momentum=null,this._snapToNearest();return}this._momentum=requestAnimationFrame(l)};this._momentum=requestAnimationFrame(l)}_stopMomentum(){this._momentum&&typeof this._momentum=="number"&&cancelAnimationFrame(this._momentum),this._momentum=null}_snapToNearest(){if(!this._renderSlides.length)return;const t=this._nearestRenderIndex(this._offset),e=this._realIndexFor(t);this._renderIndex=t,this._float=void 0,this.goTo(e,{reason:"drag",speed:this._transitionDuration()}),this._animating||this._snapBack(this._transitionDuration())}_resolveSyncTargets(t=!1){const e=this.params.sync||{};if(!e.with){this._syncTargets.length&&this._unbindSync();return}const s=Array.isArray(e.with)?e.with.flat(1/0):[e.with],i=[];s.forEach(n=>{if(n instanceof P){n!==this&&i.push(n);return}const o=q(n);if(!o)return;const l=O.get(o);l&&l!==this&&i.push(l)});const r=Array.from(new Set(i)).filter(n=>n.ready&&!n.destroyed);!t&&r.length===this._syncTargets.length&&r.every((n,o)=>n===this._syncTargets[o])||(this._unbindSync(),this._syncTargets=r,this._syncListeners=this._syncListeners||[],r.length&&e.asThumbnails&&(r.forEach(n=>{this._thumbHostEl=n.el,n.el.setAttribute("data-zs-thumbnails",""),n._slides.forEach((o,l)=>{const h=p=>{this._suppressClickUntil&&performance.now()<this._suppressClickUntil||(p.preventDefault(),this._userInteracted(),this.goTo(l,{reason:"thumbnail"}))};x(this._syncListeners,o,"click",h)})}),this._notifySync("change")))}_unbindSync(){V(this._syncListeners||[]),this._syncListeners=[],this._thumbHostEl&&(this._thumbHostEl.removeAttribute("data-zs-thumbnails"),this._thumbHostEl=null),this._syncTargets=[],this._syncOrigin=null}_notifySync(t,e){if(!this._syncTargets||!this._syncTargets.length||this.destroyed)return;const s=this.params.sync.mode;this._syncTargets.forEach(i=>{if(!(i===this||i.destroyed||!i.ready)&&!(i._syncOrigin===this||i._syncingNow)&&!(t==="progress"&&s!=="progress"))try{t==="change"?i._syncApply(this,this._activeIndex,!1):i._syncApply(this,e,!0)}catch(r){console.error("[ZikraSlider] sync failed:",r)}})}_syncApply(t,e,s){if(!(this.destroyed||!this.ready)&&!this._syncingNow&&!(this._drag&&this._drag.started)){this._syncingNow=!0,this._syncOrigin=t;try{s?this._syncToProgress(e):e!==this._activeIndex||this._animating?this.goTo(e,{reason:"sync",silent:!0}):(this._float=void 0,this._snapBack(this._transitionDuration()))}finally{this._syncingNow=!1,this._animating||(this._syncOrigin=null)}}}_syncToProgress(t){if(this._disabled||this._realCount<2||!this._renderSlides.length)return;const e=w(t,0,1);if(this._animating&&this._settle(),this.params.type==="slide"){const s=this._pre||0,i=this._offsetFor(s),r=this._offsetFor(s+this._realCount-1);this._offset=i+(r-i)*e,this._activeIndex=Math.round(e*(this._realCount-1)),this._renderIndex=this._renderIndexFor(this._activeIndex),this._float=void 0,this._applyInstant(this._computeStyles())}else this._float=e*(this._realCount-1),this._activeIndex=Math.round(this._float),this._renderIndex=this._renderIndexFor(this._activeIndex),this._applyInstant(this._computeStyles());this._updateControls(),this._loadLazy(),this._syncOrigin=null}_setupBreakpoints(){const t=this.params.responsive;!F(t)||typeof window.matchMedia!="function"||Object.keys(t).forEach(e=>{const s=parseFloat(e)||0;let i;try{i=window.matchMedia(`(min-width: ${s}px)`)}catch{return}const r=()=>{clearTimeout(this._bpTimer),this._bpTimer=setTimeout(()=>{this._timers.delete(this._bpTimer),this._bpTimer=null,this.update({})},60),this._timers.add(this._bpTimer)};i.addEventListener?i.addEventListener("change",r):i.addListener&&i.addListener(r),this._breakpointListeners.push(()=>{i.removeEventListener?i.removeEventListener("change",r):i.removeListener&&i.removeListener(r)})})}_destroyBreakpoints(){this._breakpointListeners.forEach(t=>{try{t()}catch{}}),this._breakpointListeners=[],this._bpTimer&&(clearTimeout(this._bpTimer),this._timers.delete(this._bpTimer),this._bpTimer=null)}update(t={}){if(!this.ready||this.destroyed)return this;const e=this._activeIndex;this._drag=null,this._syncOrigin=null,this._cancelAnimations(),this._resetParallax(),this._stopMomentum(),this._destroyControls(),this._destroyBreakpoints(),this._userOptions=L(this._userOptions,t),this.params=this._resolveParams(),this._cls=this._buildClassNames();const s=this._cls,i=this.el;return B.forEach(r=>i.classList.remove(s[`type-${r}`])),W.forEach(r=>i.classList.remove(s[`axis-${r}`])),i.classList.remove("zs-no-js"),this.params.fallback.noJsClass&&i.classList.remove(this.params.fallback.noJsClass),i.classList.add(s[`type-${this.params.type}`],s[`axis-${this.params.axis}`]),i.classList.toggle(s["drag-enabled"],!!this.params.features.drag.enabled),this.params.dir==="rtl"?i.setAttribute("dir","rtl"):this._original.attrs.dir==null?i.removeAttribute("dir"):i.setAttribute("dir",this._original.attrs.dir),this._viewport.className=`${s.viewport} ${s[`type-${this.params.type}`]}`,this._buildControls(),this._activeIndex=e,this._measure(),this._activeIndex=this._normalizeIndex(e),this._renderIndex=this._renderIndexFor(this._activeIndex),this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._render({instant:!0}),this._updateControls(),this._resolveSyncTargets(!0),this._setupBreakpoints(),this._autoplayPlaying=!!this.params.features.autoplay.enabled,this._stoppedByUser=!1,this._scheduleAutoplay(),this}recalculate(){if(!this.ready||this.destroyed)return this;const t=this._activeIndex;return this._syncOrigin=null,this._measure(),this._activeIndex=this._normalizeIndex(t),this._renderIndex=this._renderIndexFor(this._activeIndex),this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._render({instant:!0}),this._updateControls(),this._loadLazy(),this._scheduleAutoplay(),this}getProgress(){return!this._realCount||this._realCount<2?0:w(this._activeIndex/(this._realCount-1),0,1)}getState(){return{index:this._activeIndex,realIndex:this._activeIndex,progress:this.getProgress(),total:this._realCount,slidesPerView:this.params.slidesPerView,isLooping:!!this._loopActive,isAutoplay:!!this._autoplayPlaying,isAutoplayRunning:!!this._autoplayRunning,isAnimating:!!this._animating,isDragging:!!(this._drag&&this._drag.started),isDisabled:!!this._disabled,isDestroyed:!!this.destroyed,isBroken:!this.ready,type:this.params.type,axis:this.params.axis,dir:this.params.dir,backend:this._backend||null}}_disconnectMedia(){this._mediaLoadListeners.forEach(({img:t,onLoad:e,onError:s})=>{t.removeEventListener("load",e),t.removeEventListener("error",s)}),this._mediaLoadListeners=[]}destroy(){if(this.destroyed)return this;if(!this.el)return this.destroyed=!0,this;this._emit("destroy",{instance:this}),this._clearAutoplay(),this._cancelAnimations(),this._resetParallax(),this._stopMomentum(),this._destroyBreakpoints(),this._disconnectMedia(),this._announceTimer&&(clearTimeout(this._announceTimer),this._timers.delete(this._announceTimer),this._announceTimer=null),this._timers.forEach(i=>clearTimeout(i)),this._timers.clear(),this._recalcRaf&&cancelAnimationFrame(this._recalcRaf),this._progressRaf&&cancelAnimationFrame(this._progressRaf),this._ro&&this._ro.disconnect(),D.forEach(i=>{!i||i===this||i.destroyed||(i._syncTargets=(i._syncTargets||[]).filter(r=>r!==this),i._thumbHostEl===this.el&&(i._thumbHostEl.removeAttribute("data-zs-thumbnails"),i._thumbHostEl=null))}),this._unbindSync(),this._notifyPlugins("destroy"),this._pluginList=[],this._destroyControls(),V(this._listeners),this._waapi=[];const t=this.el,e=this._slides||[],s=this._slideSnapshots||[];return e.forEach((i,r)=>{i.parentNode!==t&&t.appendChild(i);const a=s[r];a&&(i.className=a.className,a.id==null?i.removeAttribute("id"):i.setAttribute("id",a.id),["role","aria-roledescription","aria-label"].forEach(n=>{a[n]==null?i.removeAttribute(n):i.setAttribute(n,a[n])}),a["aria-hidden"]==null?i.removeAttribute("aria-hidden"):i.setAttribute("aria-hidden",a["aria-hidden"]),a.inert?i.setAttribute("inert",""):("inert"in i&&(i.inert=!1),i.removeAttribute("inert"))),i.removeAttribute("data-zs-index"),a&&(a.style==null?i.removeAttribute("style"):i.setAttribute("style",a.style))}),this._slideSnapshots=[],this._generated.forEach(i=>{i&&i.parentNode&&i.parentNode.removeChild(i)}),this._generated=[],this._viewport&&this._viewport.parentNode&&this._viewport.parentNode.removeChild(this._viewport),t.className=this._original.className,Object.keys(this._original.attrs||{}).forEach(i=>{const r=this._original.attrs[i];r==null?t.removeAttribute(i):t.setAttribute(i,r)}),!this._hadId&&t.id===this.id&&t.removeAttribute("id"),this._original.style==null?t.removeAttribute("style"):t.setAttribute("style",this._original.style),D.delete(this),O.delete(t),this._events.clear(),this.ready=!1,this.destroyed=!0,this}}function M(d,t){return new P(d,t)}M.prototype=P.prototype,M.VERSION=j,M.defaults=Y,M.ZikraSlider=P,M.get=d=>{const t=q(d);return t&&O.get(t)||null},M.instances=()=>Array.from(D);export{P as ZikraSlider};export default M;
|
|
1
|
+
/*! Zikra Slider Pro v1.2.1 | MIT | zero dependencies */
|
|
2
|
+
const j="1.2.1",B=["slide","fade","scale","coverflow","stack","cards","custom"],W=["x","y"],Z=["ltr","rtl"],X=["slide","fade","zoom","slide-up","flip","stagger"],Y={type:"slide",axis:"x",dir:"ltr",slidesPerView:1,slidesToScroll:1,gap:0,centeredSlides:!1,freeMode:!1,loop:!1,initialSlide:0,autoHeight:!1,speed:480,classPrefix:"zs-",parallax:{enabled:!1,selector:"[data-zs-parallax]",factor:.2},custom:{transform:null},sync:{with:null,mode:"index",asThumbnails:!1},arrows:{enabled:!0,prevEl:null,nextEl:null,container:null,className:"",prevClass:"",nextClass:"",prevHtml:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 18l-6-6 6-6"/></svg>',nextHtml:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 18l6-6-6-6"/></svg>',ariaPrevLabel:"Previous slide",ariaNextLabel:"Next slide",hideAtEdges:!1,render:null},bullets:{enabled:!0,el:null,type:"bullets",clickable:!0,dynamicBullets:!1,className:"",bulletClass:"",activeClass:"",formatFraction:null,render:null},features:{autoplay:{enabled:!1,delay:4200,pauseOnHover:!0,pauseOnFocus:!0,pauseOnHiddenTab:!0,stopOnInteraction:!1},drag:{enabled:!0,threshold:6,velocity:.4,rubberband:!0},keyboard:{enabled:!0,onlyWhenFocused:!0},wheel:{enabled:!1,passive:!0},lazyLoad:{enabled:!1,mode:"adjacent",placeholder:""},a11y:{enabled:!0,roleDescription:"carousel",liveRegion:!0}},responsive:null,animation:{library:"auto",effect:"slide",duration:null,ease:"cubic-bezier(0.22, 0.61, 0.36, 1)",fallback:"css"},fallback:{disableIfNotEnoughSlides:!0,reducedMotion:"fade",noJsClass:"zs-no-js",onMediaError:null},on:{},plugins:[]},N=()=>typeof window<"u"&&typeof document<"u",z=d=>!!(d&&d.nodeType===1),w=(d,t,e)=>Math.min(Math.max(d,t),e);function F(d){if(!d||typeof d!="object")return!1;const t=Object.getPrototypeOf(d);return t===Object.prototype||t===null}function L(...d){const t={};for(const e of d)if(F(e))for(const s of Object.keys(e)){const i=e[s];i!==void 0&&(F(i)?t[s]=L(F(t[s])?t[s]:{},i):Array.isArray(i)?t[s]=i.slice():t[s]=i)}return t}function q(d){if(!N())return null;if(z(d))return d;if(typeof d=="string")try{return document.querySelector(d)}catch{return null}return d&&d.length&&z(d[0])?d[0]:null}function I(d,t){const e=document.createElement(d);return t&&(e.className=t),e}function x(d,t,e,s,i){!t||typeof t.addEventListener!="function"||(t.addEventListener(e,s,i),d.push({target:t,type:e,handler:s,options:i}))}function V(d){for(;d.length;){const{target:t,type:e,handler:s,options:i}=d.pop();try{t.removeEventListener(e,s,i)}catch{}}}function J(){if(!N()||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function K(d){return Array.isArray(d)?d.flat(1/0).filter(Boolean):[]}const G=/^(linear|ease|ease-in|ease-out|ease-in-out|step-start|step-end|cubic-bezier\(.+\)|steps\(.+\))$/;function H(d,t){if(typeof d!="string")return t;const e=d.trim();return e&&!G.test(e)?e:t}function Q(d){return{name:"gsap",fromTo(t,e,s,i){return new Promise(r=>{if(!z(t))return r();d.fromTo(t,{...e,x:e.x||0,y:e.y||0,z:e.z||0,scale:e.scale==null?1:e.scale,rotation:e.rotate||0,rotateY:e.rotateY||0,opacity:e.opacity==null?1:e.opacity},{...s,x:s.x||0,y:s.y||0,z:s.z||0,scale:s.scale==null?1:s.scale,rotation:s.rotate||0,rotateY:s.rotateY||0,opacity:s.opacity==null?1:s.opacity,duration:i.duration/1e3,delay:(i.delay||0)/1e3,ease:H(i.easing,"power2.out"),overwrite:"auto",onComplete:r,onInterrupt:r})})}}}function tt(d){const t=d&&typeof d.animate=="function";return{name:t?"anime-v4":"anime",fromTo(e,s,i,r){return new Promise(a=>{if(!z(e))return a();const n={targets:e,duration:r.duration,delay:r.delay||0,easing:H(r.easing,"easeOutQuad"),complete:a},o={translateX:i.x||0,translateY:i.y||0,translateZ:i.z||0,scale:i.scale==null?1:i.scale,rotate:`${i.rotate||0}deg`,rotateY:`${i.rotateY||0}deg`,opacity:i.opacity==null?1:i.opacity},l={translateX:s.x||0,translateY:s.y||0,translateZ:s.z||0,scale:s.scale==null?1:s.scale,rotate:`${s.rotate||0}deg`,rotateY:`${s.rotateY||0}deg`,opacity:s.opacity==null?1:s.opacity};try{if(t){const h=H(r.easing,null),p={duration:r.duration,delay:r.delay||0};h&&(p.ease=h),d.animate(e,{...l,...o},p).finished.then(a,a)}else d({...n,...l,keyframes:[{...l},{...o}]})}catch{a()}})}}}function et(d){return{name:"motion",fromTo(t,e,s,i){if(!z(t))return Promise.resolve();const r={x:[e.x||0,s.x||0],y:[e.y||0,s.y||0],z:[e.z||0,s.z||0],scale:[e.scale==null?1:e.scale,s.scale==null?1:s.scale],rotate:[e.rotate||0,s.rotate||0],rotateY:[e.rotateY||0,s.rotateY||0],opacity:[e.opacity==null?1:e.opacity,s.opacity==null?1:s.opacity]},a=d.animate(t,r,{duration:i.duration/1e3,delay:(i.delay||0)/1e3,easing:H(i.easing,"ease-out")});return a&&typeof a.finished=="object"?a.finished.then(()=>{},()=>{}):Promise.resolve()}}}function st(d){return{name:"custom",fromTo(t,e,s,i){if(typeof d.fromTo=="function")return Promise.resolve(d.fromTo(t,e,s,i));if(typeof d.animate=="function")return Promise.resolve(d.animate(t,{from:e,to:s,...i}));throw new Error("Custom animation library must expose fromTo() or animate().")}}}function it(d){if(!N()||d==="none")return null;if(d&&typeof d=="object")return{adapter:st(d),label:"custom"};const t=window,e=d==="auto"?["gsap","anime","motion"]:[d];for(const s of e)try{if(s==="gsap"&&t.gsap&&typeof t.gsap.fromTo=="function")return{adapter:Q(t.gsap),label:"gsap"};if(s==="anime"&&typeof t.anime=="function")return{adapter:tt(t.anime),label:"anime"};if(s==="motion"&&t.motion&&typeof t.motion.animate=="function")return{adapter:et(t.motion),label:"motion"}}catch{return null}return null}let rt=0;const O=new WeakMap,D=new Set,at={"aria-prev":"Previous slide","aria-next":"Next slide",fraction:(d,t)=>`${d} / ${t}`},nt=["role","aria-roledescription","aria-label","tabindex","dir","id"];class P{constructor(t,e={}){this.el=null,this.ready=!1,this.destroyed=!1,this._events=new Map,this._listeners=[],this._generated=[],this._generatedArrows=[],this._syncTargets=[],this._syncListeners=[],this._syncOrigin=null,this._pluginList=[],this._breakpointListeners=[],this._mediaLoadListeners=[],this._waapi=[],this._timers=new Set,this._controlListeners=[],this._controlSnapshots=[],this._slideSnapshots=[],this._innerState=new WeakMap,this._parallaxCache=new WeakMap,this._parallaxTouched=new Map;const s=q(t);if(!N()||!s){this.params=L(Y),this._cls=this._buildClassNames();return}this.el=s,this.id=s.id||`zs-${++rt}`,O.set(s,this),D.add(this),this._init(e)}_init(t){const e=this.el;this._userOptions=L(t),this._hadId=!!e.id,this._original={className:e.className,style:e.getAttribute("style"),attrs:nt.reduce((s,i)=>({...s,[i]:e.getAttribute(i)}),{}),children:Array.from(e.children)},this.params=this._resolveParams(),this._cls=this._buildClassNames(),this.params.fallback.noJsClass&&e.classList.remove(this.params.fallback.noJsClass),this._setupDom(),this._setupA11y(),this._connectMedia(),this._buildControls(),this._bindEvents(),this._setupBreakpoints(),this._activeIndex=this._normalizeIndex(this.params.initialSlide),this._renderIndex=this._activeIndex,this._offset=0,this._measure(),this._renderIndex=this._renderIndexFor(this._activeIndex),this._offset=this._offsetFor(this._renderIndex),this._render({instant:!0}),this._updateControls(),this._loadLazy(),this._initPlugins(),this._resolveSyncTargets(),this.ready=!0,e.classList.add(this._cls.initialized),this._emit("init",{instance:this}),this._startAutoplay(),D.forEach(s=>{s!==this&&s.ready&&s._resolveSyncTargets()})}_buildClassNames(){const t=this.params.classPrefix||"zs-",e={};return["slider","initialized","viewport","track","slide","slide-clone","slide-active","slide-visible","arrows","arrow","arrow-prev","arrow-next","arrow-hidden","bullets","bullet","bullet-active","fraction","progressbar","progressbar-fill","live","dragging","drag-enabled","disabled","animating"].forEach(s=>{e[s]=t+s}),B.forEach(s=>{e[`type-${s}`]=`${t}type-${s}`}),W.forEach(s=>{e[`axis-${s}`]=`${t}axis-${s}`}),e}_resolveParams(){const t=L(Y,this._userOptions);if(t.type=B.includes(t.type)?t.type:"slide",t.axis=W.includes(t.axis)?t.axis:"x",t.dir=Z.includes(t.dir)?t.dir:"ltr",t.slidesPerView=t.slidesPerView==="auto"?"auto":Math.max(.1,Number(t.slidesPerView)||1),t.slidesToScroll=Math.max(1,Math.round(Number(t.slidesToScroll)||1)),t.gap=Math.max(0,Number(t.gap)||0),t.speed=Math.max(0,Number(t.speed)||0),X.includes(t.animation.effect)||(t.animation.effect="slide"),["css","waapi"].includes(t.animation.fallback)||(t.animation.fallback="css"),[!0,!1,"auto"].includes(t.loop)||(t.loop=!!t.loop),F(t.responsive)&&typeof window.matchMedia=="function"){const e=Object.keys(t.responsive).map(s=>({key:s,min:parseFloat(s)||0,overrides:t.responsive[s]})).sort((s,i)=>i.min-s.min);for(const s of e)try{if(window.matchMedia(`(min-width: ${s.min}px)`).matches){Object.assign(t,L(t,s.overrides));break}}catch{}}return t}_setupDom(){const t=this.el,e=this._cls;t.classList.add(e.slider,e.initialized,e[`type-${this.params.type}`],e[`axis-${this.params.axis}`]),t.classList.toggle(e["drag-enabled"],!!this.params.features.drag.enabled),this.params.dir==="rtl"&&t.setAttribute("dir","rtl"),t.id||(t.id=this.id),this.params.features.a11y.enabled&&t.setAttribute("tabindex","0"),this._viewport=I("div",`${e.viewport} ${e[`type-${this.params.type}`]}`),this._track=I("div",e.track),this._generated.push(this._viewport),this._slides=Array.from(t.children),this._slideSnapshots=this._slides.map(s=>({className:s.className,style:s.getAttribute("style"),id:s.getAttribute("id"),role:s.getAttribute("role"),"aria-roledescription":s.getAttribute("aria-roledescription"),"aria-label":s.getAttribute("aria-label"),"aria-hidden":s.getAttribute("aria-hidden"),inert:s.hasAttribute("inert")})),this._slides.forEach((s,i)=>{s.classList.contains(e.slide)||s.classList.add(e.slide),s.setAttribute("data-zs-index",String(i)),this._track.appendChild(s)}),this._realCount=this._slides.length,this._viewport.appendChild(this._track),t.appendChild(this._viewport),this._baseSlideClasses=this._slides.map(s=>s.className),this._baseSlideStyles=this._slides.map(s=>s.getAttribute("style"))}_setupA11y(){const t=this.params.features.a11y;if(!t.enabled)return;const e=this.el;e.setAttribute("role","region"),e.setAttribute("aria-roledescription",t.roleDescription),e.hasAttribute("aria-label")||e.setAttribute("aria-label","Image carousel"),this._slides.forEach((s,i)=>{s.id||(s.id=`${this.id}-slide-${i}`),s.setAttribute("role","group"),s.setAttribute("aria-roledescription","slide"),s.setAttribute("aria-label",`${i+1} of ${this._realCount}`)}),t.liveRegion&&(this._live=I("div",this._cls.live),this._live.setAttribute("aria-live","polite"),this._live.setAttribute("aria-atomic","true"),this.el.appendChild(this._live),this._generated.push(this._live))}_bindEvents(){const t=this.el,e=this.params.features;this._onPointerDown=this._handlePointerDown.bind(this),this._onPointerMove=this._handlePointerMove.bind(this),this._onPointerUp=this._handlePointerUp.bind(this),x(this._listeners,t,"pointerdown",this._onPointerDown,{passive:!0}),x(this._listeners,t,"pointermove",this._onPointerMove,{passive:!1}),x(this._listeners,t,"pointerup",this._onPointerUp),x(this._listeners,t,"pointercancel",this._onPointerUp),x(this._listeners,t,"dragstart",i=>{this._drag&&this._drag.started&&i.preventDefault()}),e.autoplay.pauseOnHover&&(x(this._listeners,t,"pointerenter",i=>{i.pointerType==="mouse"&&(this._hoverPaused=!0)}),x(this._listeners,t,"pointerleave",()=>{this._hoverPaused=!1,this._scheduleAutoplay()})),e.autoplay.pauseOnFocus&&(x(this._listeners,t,"focusin",()=>{this._focusPaused=!0}),x(this._listeners,t,"focusout",i=>{t.contains(i.relatedTarget)||(this._focusPaused=!1,this._scheduleAutoplay())})),e.autoplay.pauseOnHiddenTab&&typeof document<"u"&&(this._onVisibility=()=>{document.hidden||this._scheduleAutoplay()},x(this._listeners,document,"visibilitychange",this._onVisibility)),x(this._listeners,t,"click",i=>{this._suppressClickUntil&&performance.now()<this._suppressClickUntil&&(i.preventDefault(),i.stopPropagation())},!0),this._onKeyDown=i=>{const r=this.params.features.keyboard;if(!r.enabled||this._disabled||i.metaKey||i.ctrlKey||i.altKey)return;const a=i.target;if(a&&/^(INPUT|TEXTAREA|SELECT)$/.test((a.tagName||"").toUpperCase()))return;if(!r.onlyWhenFocused&&a&&a.closest){const l=a.closest(`.${this._cls.slider}`);if(l&&l!==this.el)return}const n=this._rtl;let o;switch(i.key){case"ArrowLeft":o=n?"next":"prev";break;case"ArrowRight":o=n?"prev":"next";break;case"ArrowUp":o="prev";break;case"ArrowDown":o="next";break;case"Home":o="first";break;case"End":o="last";break;case"PageUp":o="prev";break;case"PageDown":o="next";break;default:return}i.preventDefault(),this._userInteracted(),o==="first"?this.goTo(0):o==="last"?this.goTo(this._realCount-1):o==="next"?this.next():this.prev()};const s=this.params.features.keyboard.onlyWhenFocused?t:document;x(this._listeners,s,"keydown",this._onKeyDown),this._onWheel=i=>{const r=this.params.features.wheel;if(!r.enabled)return;const a=Date.now();if(a-(this._wheelAt||0)<320)return;const n=this.params.axis==="x"&&Math.abs(i.deltaX)>Math.abs(i.deltaY)?i.deltaX:i.deltaY;Math.abs(n)<12||(this._wheelAt=a,r.passive||i.preventDefault(),this._userInteracted(),n>0?this.next():this.prev())},x(this._listeners,t,"wheel",this._onWheel,{passive:!!this.params.features.wheel.passive}),typeof ResizeObserver=="function"&&(this._ro=new ResizeObserver(()=>this._requestRecalc()),this._ro.observe(t),this._ro.observe(this._track)),this._onWindowResize=()=>this._requestRecalc(),x(this._listeners,window,"resize",this._onWindowResize),x(this._listeners,window,"orientationchange",this._onWindowResize),this.params.features.lazyLoad.enabled&&x(this._listeners,document,"zs:lazy",i=>{i.detail&&i.detail.instance===this&&this._loadLazy()})}_requestRecalc(){this.destroyed||!this.ready||this._recalcRaf||(this._recalcRaf=requestAnimationFrame(()=>{this._recalcRaf=null,!this.destroyed&&this.ready&&this.recalculate()}))}_measure(){const t=this.el,e=this.params.axis,s=this.params.gap,i=this.params.slidesPerView;if(!this._viewport)return;if(!this._realCount){this._empty=!0,this._disabled=!0,this._loopActive=!1,this._renderSlides=[],this._pos=[0],this._sizes=[],this._viewport.style.height="0px";return}this._empty=!1,this._rtl=this.params.dir==="rtl";const r=t.getBoundingClientRect(),a=Math.max(0,e==="x"?t.clientWidth||r.width:t.clientHeight||r.height);this._slides.forEach(c=>{i==="auto"?e==="x"?c.style.width="auto":c.style.height="auto":e==="x"?c.style.width="":c.style.height=""});let n=0;e==="y"&&a<1&&this._slides.forEach(c=>{n=Math.max(n,c.offsetHeight||0)});let o=[];if(i==="auto")o=this._slides.map(u=>{const f=e==="x"?u.getBoundingClientRect().width:u.getBoundingClientRect().height;return Math.max(40,Math.round(f*100)/100)}),o.reduce((u,f)=>u+f,0)+s*Math.max(0,o.length-1)<=1&&(o=this._slides.map(()=>Math.max(40,a||300)));else{const c=a>1?a:n*Math.ceil(i)||300,u=Math.max(1,(c-s*(i-1))/i);o=this._slides.map(()=>Math.round(u*100)/100)}if(this._slideSizes=o,this._slides.forEach((c,u)=>{e==="x"?(c.style.width=`${o[u]}px`,c.style.height=""):(c.style.height=`${o[u]}px`,c.style.width="")}),e==="x"){let c=0;this._slides.forEach(y=>{c=Math.max(c,y.offsetHeight||0)}),this._slideHeights=this._slides.map(y=>y.offsetHeight||0);const u=this._slideHeights[this._activeIndex]||c,f=this.params.autoHeight?u:c;if(f>0){this._viewport.style.transition=this.params.autoHeight?`height ${this._transitionDuration()}ms ${this.params.animation.ease}`:"none";const y=`${f}px`;this._viewport.style.height!==y&&(this._viewport.style.height=y)}}else if(this._slideHeights=o.slice(),a<1){const c=o[0]*(i==="auto"?1:i)+s*Math.max(0,(i==="auto"?1:Math.ceil(i))-1);this._viewport.style.height=`${Math.max(0,c)}px`}else this._viewport.style.height="";this._viewportSize=e==="y"&&a<1?this._viewport.clientHeight:a;let l=0;const h=o;h.forEach((c,u)=>{l+=c+(u<h.length-1?s:0)}),this._realExtent=l;const p=i==="auto"?1:Math.ceil(i);this._notEnough=this._realCount<=p&&l<=this._viewportSize+1,this._disabled=!!(this.params.fallback.disableIfNotEnoughSlides&&this._notEnough),this._loopActive=!!this.params.loop&&!this._disabled&&this._realCount>1&&(this.params.type!=="slide"||l>this._viewportSize+1),this._buildRender(),this._renderSlides.forEach(c=>{c.clone&&(e==="x"?(c.el.style.width=`${o[c.real]}px`,c.el.style.height=""):(c.el.style.height=`${o[c.real]}px`,c.el.style.width=""))}),this._pos=[],this._sizes=[];let _=0;this._renderSlides.forEach((c,u)=>{const f=o[c.real]||0;this._pos[u]=_,this._sizes[u]=f,_+=f+s}),this._renderExtent=Math.max(0,_-s),this._clipRenderIndex(),this._updateSlideClasses(),this._loadLazy()}_buildRender(){const t=this._cls,e=this._realCount,s=this.params.slidesPerView,i=this._loopActive&&this.params.type==="slide"&&e>1;if(Array.from(this._track.querySelectorAll("[data-zs-clone]")).forEach(l=>l.remove()),!i){this._usingClones=!1,this._pre=0,this._renderSlides=this._slides.map((l,h)=>({el:l,real:h,clone:!1}));return}const r=s==="auto"?2:Math.ceil(s),a=Math.min(e-1,Math.max(1,r+(this.params.slidesToScroll>1?1:0))),n=[],o=l=>{const h=this._slides[l].cloneNode(!0);return h.removeAttribute("id"),h.querySelectorAll("[id]").forEach(p=>p.removeAttribute("id")),h.querySelectorAll("a, button, input, select, textarea, [tabindex]").forEach(p=>{p.setAttribute("tabindex","-1")}),h.setAttribute("aria-hidden","true"),"inert"in h&&(h.inert=!0),h.setAttribute("data-zs-clone",""),h.classList.add(t.slide,t["slide-clone"]),h.classList.remove(t["slide-active"]),h};for(let l=e-a;l<e;l+=1){const h=o(l);this._track.insertBefore(h,this._slides[0]),n.push({el:h,real:l,clone:!0})}this._pre=a,this._slides.forEach((l,h)=>n.push({el:l,real:h,clone:!1}));for(let l=0;l<a;l+=1){const h=o(l);this._track.appendChild(h),n.push({el:h,real:l,clone:!0})}this._usingClones=!0,this._renderSlides=n}_clipRenderIndex(){const t=Math.max(0,this._renderSlides.length-1);Number.isFinite(this._renderIndex)||(this._renderIndex=this._renderIndexFor(this._activeIndex)),this._renderIndex=w(this._renderIndex,0,t),Number.isFinite(this._offset)||(this._offset=this._offsetFor(this._renderIndex))}_offsetFor(t){const e=this._pos[t]||0,s=this._sizes[t]||0,i=this.params.centeredSlides?(this._viewportSize-s)/2:0;let a=this._rtl&&this.params.axis==="x"?-(e+i):-(e-i);const n=this.params.slidesPerView;if(!this.params.centeredSlides&&!this._loopActive&&(n==="auto"||n>1)){const o=Math.max(0,(this._realExtent||0)-(this._viewportSize||0));a=Math.max(a,-o)}return a}_renderIndexFor(t){const e=this._realCount;if(!e)return 0;const s=(Math.round(t)%e+e)%e;if(!this._usingClones)return s;const i=[s+this._pre,s+this._pre-e,s+this._pre+e],r=Number.isFinite(this._renderIndex)?this._renderIndex:this._pre;let a=i[0],n=1/0;return i.forEach(o=>{if(o<0||o>=this._renderSlides.length)return;const l=Math.abs(o-r);l<n&&(n=l,a=o)}),a}_realIndexFor(t){const e=this._realCount;return e?((t-this._pre)%e+e)%e:0}_normalizeIndex(t){const e=this._realCount||this._slides.length;if(!e)return 0;const s=!!this.params.loop&&!this._disabled;let i=Math.round(Number(t)||0);return i<0&&(i=s?(i%e+e)%e:0),i>=e&&(i=s?i%e:e-1),i}_normalizeClones(){if(!this._usingClones)return!1;const t=this._realCount,e=this._pre;let s=this._renderIndex;return s<e?s+=t:s>=e+t&&(s-=t),s===this._renderIndex?!1:(this._renderIndex=s,this._activeIndex=this._realIndexFor(s),this._offset=this._offsetFor(s),this._applyInstant(this._computeStyles()),!0)}_cyclicRel(t,e){const s=this._renderSlides.length||this._realCount;let i=t-e;if(!this._loopActive||s<=1)return i;for(;i>s/2;)i-=s;for(;i<-s/2;)i+=s;return i}_warnCustomTransform(t){this._customWarned||(this._customWarned=!0,t?console.error("[ZikraSlider] custom.transform failed; falling back to neutral styles.",t):console.warn('[ZikraSlider] type "custom" needs a custom.transform({ ... }) callback.'))}_computeStyles(){const t=this.params.type,e=this.params.axis,s=this._rtl,i=s?-1:1,r=this.params.parallax||{},a=[],n=this._renderIndex,o=t==="slide"?n:Number.isFinite(this._float)?this._float:n,l=this.params.slidesPerView==="auto"?2:this.params.slidesPerView;return this._renderSlides.forEach((h,p)=>{const _=this._sizes[p]||0;let c=0,u=0,f=0,y=1,A=0,E=0,b=1,C=1,S=!0,k=!0,R=0;if(t==="slide"){const m=(this._pos[p]||0)+this._offset;if(e==="x"?c=s?-m:m:u=m,e==="x"){const g=s?-m:m;S=g<this._viewportSize+1&&g+_>-1,k=g<this._viewportSize-1&&g+_>1}else S=m<this._viewportSize+1&&m+_>-1,k=m<this._viewportSize-1&&m+_>1;if(r.enabled){const g=this.params.centeredSlides?(this._viewportSize-_)/2:0;R=(e==="x"?c:m)-g}C=p===n?3:1}else{const m=this._cyclicRel(p,o),g=Math.abs(m);if(r.enabled&&(R=m*(this._viewportSize||0)),t==="custom"){const T=this.params.custom&&this.params.custom.transform;let $=null;if(typeof T=="function")try{$=T({index:p,realIndex:h.real,relative:m,activeIndex:this._activeIndex,total:this._realCount,viewportSize:this._viewportSize,slideSize:_,axis:e,dir:this.params.dir,loop:!!this._loopActive})}catch(U){this._warnCustomTransform(U),$=null}else this._warnCustomTransform();const v=$&&typeof $=="object"?$:{};c=Number(v.x)||0,u=Number(v.y)||0,f=Number(v.z)||0,y=v.scale==null?1:Number(v.scale)||0,A=Number(v.rotate)||0,E=Number(v.rotateY)||0,b=v.opacity==null?1:w(Number(v.opacity)||0,0,1),C=v.zIndex==null?Math.round((1-Math.min(g,1))*100)+1:Math.round(Number(v.zIndex))||0,S=v.visible==null?b>.02:!!v.visible,k=v.interactive==null?S&&b>.05:!!v.interactive}else if(t==="fade"){b=w(1-g,0,1);const T=(e==="x"?_*.08:_*.06)*m;e==="x"?c=i*T:u=T,C=Math.round((1-g)*100)+1,S=b>.02}else if(t==="scale")b=w(1-g*.9,0,1),y=1-Math.min(g,1)*.14,C=Math.round((1-g)*100)+1,S=b>.02;else if(t==="coverflow"){const T=(e==="x"?_*.52:_*.4)*m*i;e==="x"?c=T:u=m*_*.3,E=w(-m,-1,1)*42*i,f=-g*130,y=1-g*.06,b=g>2.4?0:w(1-g*.2,0,1),C=100-Math.round(g*10),S=b>.02}else t==="stack"?(u=-Math.max(m,0)*20,y=1-Math.max(m,0)*.07,b=m<-.5?0:w(1-Math.max(m,0)*.2,0,1),C=60-Math.round(m*10),S=b>.02):t==="cards"&&(e==="x"?c=i*m*_*.2:u=m*_*.2,c+=i*Math.abs(m)*10,u+=Math.abs(m)*20,A=m*4*i,y=1-g*.06,b=g>2.2?0:w(1-g*.28,0,1),C=70-Math.round(g*10),S=b>.02);t!=="custom"&&(g<.5&&(C+=50),g>l+2&&(S=!1),k=S&&b>.05)}a.push({el:h.el,renderIndex:p,realIndex:h.real,clone:h.clone,active:p===n||t!=="slide"&&Math.abs(this._cyclicRel(p,o))<.5,visible:S,interactive:k,parallax:R,style:{x:c,y:u,z:f,scale:y,rotate:A,rotateY:E,opacity:b,zIndex:C}})}),a}_transformString(t){return`translate3d(${t.x}px, ${t.y}px, ${t.z}px) scale(${t.scale}) rotateZ(${t.rotate}deg) rotateY(${t.rotateY}deg)`}_parallaxElements(t){let e=this._parallaxCache.get(t);if(e)return e;e=[];const s=this.params.parallax;if(s&&s.enabled)try{t.querySelectorAll(s.selector||"[data-zs-parallax]").forEach(i=>{const r=i.getAttribute("data-zs-parallax"),a=r==null||r.trim()===""?NaN:parseFloat(r),n=Number.isFinite(a)?a:Number(s.factor)||0;n&&e.push({el:i,factor:n})})}catch{}return this._parallaxCache.set(t,e),e}_parallaxShift(t,e){const s=-(Number(t)||0)*e;return this.params.axis==="y"?{x:0,y:s}:{x:s,y:0}}_touchParallax(t){this._parallaxTouched.has(t)||this._parallaxTouched.set(t,{transform:t.style.transform,opacity:t.style.opacity,transition:t.style.transition,transitionDelay:t.style.transitionDelay,willChange:t.style.willChange})}_resetParallax(){this._parallaxTouched.forEach((t,e)=>{!e||!e.style||(t.transform?e.style.transform=t.transform:e.style.removeProperty("transform"),t.opacity?e.style.opacity=t.opacity:e.style.removeProperty("opacity"),t.transition?e.style.transition=t.transition:e.style.removeProperty("transition"),t.transitionDelay?e.style.transitionDelay=t.transitionDelay:e.style.removeProperty("transition-delay"),t.willChange?e.style.willChange=t.willChange:e.style.removeProperty("will-change"))}),this._parallaxTouched.clear(),this._innerState=new WeakMap,this._parallaxCache=new WeakMap}_applyParallax(t){const e=this.params.parallax;!e||!e.enabled||t.forEach(s=>{this._parallaxElements(s.el).forEach(({el:i,factor:r})=>{const a=this._parallaxShift(s.parallax,r);this._touchParallax(i),i.style.transition="none",i.style.transitionDelay="0ms",i.style.transform=`translate3d(${a.x}px, ${a.y}px, 0)`,this._innerState.set(i,a)})})}_applyInstant(t){t.forEach(({el:e,style:s})=>{e.style.transition="none",e.style.transform=this._transformString(s),e.style.opacity=String(s.opacity),e.style.zIndex=String(s.zIndex),this.params.type!=="slide"?e.style.pointerEvents=s.opacity>.05?"auto":"none":e.style.pointerEvents=""}),this._applyParallax(t),this._styleState=new Map(t.map(e=>[e.el,e.style])),this._updateSlideClasses(t)}_updateSlideClasses(t){const e=t||this._computeStyles(),s=this._cls,i=this.params.features.a11y.enabled;e.forEach(r=>{const a=r.el;a.classList.toggle(s["slide-active"],!!r.active),a.classList.toggle(s["slide-visible"],r.visible),i&&(r.clone||!r.visible?a.setAttribute("aria-hidden","true"):a.removeAttribute("aria-hidden"),!r.clone&&"inert"in a&&(a.inert=!r.interactive))}),this._lastEntries=e}_announce(){!this._live||!this.params.features.a11y.liveRegion||!this._realCount||(this._announceTimer&&(clearTimeout(this._announceTimer),this._timers.delete(this._announceTimer)),this._announceTimer=setTimeout(()=>{if(this.destroyed)return;const t=`Slide ${this._activeIndex+1} of ${this._realCount}`;this._live.textContent=t},120),this._timers.add(this._announceTimer))}_lazyTargets(){if(!this.params.features.lazyLoad.enabled||!this._renderSlides)return[];const t=this.params.features.lazyLoad.mode;if(t==="eager")return this._renderSlides;const e=t==="onDemand"?0:Math.ceil(this.params.slidesPerView==="auto"?2:this.params.slidesPerView)+1;return this._renderSlides.filter(s=>{const i=Math.abs(s.real-this._activeIndex);return this._loopActive?Math.min(i,this._realCount-i)<=e:i<=e})}_loadLazy(){const t=this.params.features.lazyLoad;if(!t.enabled)return;const e=t.placeholder;this._lazyTargets().forEach(({el:i})=>{i.querySelectorAll("img").forEach(r=>{const a=r.getAttribute("data-zs-src");if(!a)return;const n=r.getAttribute("data-zs-srcset");if(!r.getAttribute("src")&&e&&r.setAttribute("src",e),r.getAttribute("data-zs-loading")==="1")return;r.setAttribute("data-zs-loading","1");const o=()=>{r.removeAttribute("data-zs-loading"),this._requestRecalc()},l=()=>{r.removeAttribute("data-zs-loading");const h=t.onMediaError||this.params.fallback.onMediaError;if(typeof h=="function")try{h(r,a)}catch{}r.setAttribute("data-zs-error",a)};r.addEventListener("load",o,{once:!0}),r.addEventListener("error",l,{once:!0}),this._mediaLoadListeners.push({img:r,onLoad:o,onError:l}),n&&r.setAttribute("srcset",n),r.setAttribute("src",a),r.removeAttribute("data-zs-src"),r.removeAttribute("data-zs-srcset")})})}_connectMedia(){this._slides&&this._slides.forEach(t=>{t.querySelectorAll("img").forEach(e=>{if(e.getAttribute("data-zs-media")==="1")return;e.setAttribute("data-zs-media","1");const s=()=>this._requestRecalc(),i=()=>{const r=this.params.fallback.onMediaError;if(typeof r=="function")try{r(e,e.currentSrc||e.src)}catch{}};e.addEventListener("load",s),e.addEventListener("error",i),this._mediaLoadListeners.push({img:e,onLoad:s,onError:i})})})}_transitionDuration(){if(typeof this._speedOverride=="number")return Math.max(0,this._speedOverride);const t=this.params.animation.duration,e=t??this.params.speed;return Math.max(0,Number(e)||0)}_render({instant:t=!1}={}){if(this.destroyed||!this._renderSlides||!this._renderSlides.length)return;const e=this._computeStyles();if(this._targetEntries=e,t){this._cancelAnimations(),this._applyInstant(e),this._updateControls();return}this._animate(e)}_cancelAnimations(){this._animSeq=(this._animSeq||0)+1,this._animating=!1,this._animTimer&&(clearTimeout(this._animTimer),this._timers.delete(this._animTimer),this._animTimer=null),this._progressRaf&&(cancelAnimationFrame(this._progressRaf),this._progressRaf=null),this._waapi.forEach(t=>{try{t.cancel()}catch{}}),this._waapi=[],this._cls&&this.el.classList.remove(this._cls.animating)}_planTransition(t,e,s,i){const r=this._styleState||new Map,a=this._renderIndex,n=this._directionForward!==!1,o=[];return t.forEach(l=>{let h={...r.get(l.el)||l.style};const p=l.style,_=Math.abs(l.renderIndex-a);i||(e==="fade"&&l.active?h.opacity=0:e==="zoom"&&l.active?(h.scale=(p.scale==null?1:p.scale)*.86,h.opacity=Math.min(h.opacity,.7)):e==="slide-up"&&l.active?(h.y=(h.y||0)+56,h.opacity=Math.min(h.opacity,.4)):e==="flip"&&l.active&&(h.rotateY=(n?-1:1)*72)),i&&(h={...p,opacity:h.opacity});const c=e==="stagger"?Math.min(_,3)*Math.max(40,Math.round(s*.09)):0;o.push({el:l.el,from:h,to:p,delay:c,distance:_});const u=this.params.parallax;u&&u.enabled&&this._parallaxElements(l.el).forEach(({el:f,factor:y})=>{const A=this._parallaxShift(l.parallax,y),E=this._innerState.get(f),b=i||!E?{...A}:{x:E.x,y:E.y};this._touchParallax(f),o.push({el:f,inner:!0,from:b,to:A,delay:c,distance:_})})}),o}_animate(t){this._cancelAnimations();const e=this._animSeq+=1;let s=this._transitionDuration();const i=this.params.animation;let r=i.effect||"slide";const a=J();if(a&&this.params.fallback.reducedMotion==="instant"&&(s=0),a&&this.params.fallback.reducedMotion==="fade"&&(s=Math.min(s,220),r="fade"),s<=0){this._applyInstant(t),this._normalizeClones(),this._emitProgress(this.getProgress()),this._updateControls(),this._updateAutoHeight(),this._loadLazy(),this._updateSlideClasses(t),this._afterTransition();return}const n=this._planTransition(t,r,s,a);let o=0;n.forEach(_=>{o=Math.max(o,_.delay)}),this._animating=!0,this.el.classList.add(this._cls.animating);const l=this.getProgress(),h=this._pendingChange&&this._realCount>1?w(this._pendingChange.previousIndex/(this._realCount-1),0,1):l;this._emitProgress(h),this._startProgress(s+o,e,h,l);const p=it(i.library);if(p)try{const _=n.map(({el:c,from:u,to:f,delay:y,inner:A})=>(c.style.transition="none",A?(c.style.transform=`translate3d(${u.x}px, ${u.y}px, 0)`,Promise.resolve(p.adapter.fromTo(c,{...u,z:0,scale:1,rotate:0,rotateY:0,opacity:1},{...f,z:0,scale:1,rotate:0,rotateY:0,opacity:1},{duration:s,delay:y,easing:i.ease}))):(c.style.transform=this._transformString(u),c.style.opacity=String(u.opacity),c.style.zIndex=String(f.zIndex),Promise.resolve(p.adapter.fromTo(c,u,f,{duration:s,delay:y,easing:i.ease})))));Promise.all(_).then(()=>this._finishAnimation(e),()=>this._finishAnimation(e)),this._scheduleAnimationFinish(e,s+o+320),this._backend=p.label;return}catch{this._backend="css"}if(i.fallback==="waapi"&&this._supportsWaapi()){this._backend="waapi";const _=n.map(({el:c,from:u,to:f,delay:y,inner:A})=>{if(c.style.transition="none",A){c.style.transform=`translate3d(${u.x}px, ${u.y}px, 0)`;const b=c.animate([{transform:`translate3d(${u.x}px, ${u.y}px, 0)`},{transform:`translate3d(${f.x}px, ${f.y}px, 0)`}],{duration:s,delay:y,easing:i.ease||"ease-out",fill:"both"});return this._waapi.push(b),b.finished.catch(()=>{})}c.style.zIndex=String(f.zIndex);const E=c.animate([{transform:this._transformString(u),opacity:String(u.opacity)},{transform:this._transformString(f),opacity:String(f.opacity)}],{duration:s,delay:y,easing:i.ease||"ease-out",fill:"both"});return this._waapi.push(E),E.finished.catch(()=>{})});Promise.all(_).then(()=>this._finishAnimation(e)),this._scheduleAnimationFinish(e,s+o+140);return}this._backend="css",this._animateCss(n,s,i.ease,e)}_supportsWaapi(){return typeof Element<"u"&&typeof Element.prototype.animate=="function"}_animateCss(t,e,s,i){const r=s||"ease-out";t.forEach(({el:n,from:o,to:l,inner:h})=>{if(n.style.transition="none",n.style.transitionDelay="0ms",h){n.style.willChange="transform",n.style.transform=`translate3d(${o.x}px, ${o.y}px, 0)`;return}n.style.willChange="transform, opacity",n.style.transform=this._transformString(o),n.style.opacity=String(o.opacity),n.style.zIndex=String(l.zIndex)}),this.el.offsetWidth;let a=0;t.forEach(({el:n,to:o,delay:l,inner:h})=>{if(a=Math.max(a,l),h){n.style.transition=`transform ${e}ms ${r}`,n.style.transitionDelay=`${l}ms`,n.style.transform=`translate3d(${o.x}px, ${o.y}px, 0)`;return}n.style.transition=`transform ${e}ms ${r}, opacity ${e}ms ${r}`,n.style.transitionDelay=`${l}ms`,n.style.transform=this._transformString(o),n.style.opacity=String(o.opacity),n.style.zIndex=String(o.zIndex)}),this._scheduleAnimationFinish(i,e+a+40)}_startProgress(t,e,s=0,i=1){const r=typeof performance<"u"?performance.now():Date.now(),a=n=>{if(this.destroyed||this._animSeq!==e||!this._animating)return;const o=(n||Date.now())-r,l=w(o/Math.max(1,t),0,.995);this._emitProgress(s+(i-s)*l),this._progressRaf=requestAnimationFrame(a)};this._progressRaf=requestAnimationFrame(a)}_scheduleAnimationFinish(t,e){this._animTimer=setTimeout(()=>{this._timers.delete(this._animTimer),this._animTimer=null,this._finishAnimation(t)},Math.max(16,e)),this._timers.add(this._animTimer)}_finishAnimation(t){this.destroyed||t!==this._animSeq||!this._animating||(this._animating=!1,this._animTimer&&(clearTimeout(this._animTimer),this._timers.delete(this._animTimer),this._animTimer=null),this._progressRaf&&(cancelAnimationFrame(this._progressRaf),this._progressRaf=null),this._waapi.forEach(e=>{try{e.cancel()}catch{}}),this._waapi=[],this.el.classList.remove(this._cls.animating),this._applyInstant(this._targetEntries||this._computeStyles()),this._emitProgress(this.getProgress()),this._normalizeClones(),this._updateControls(),this._updateAutoHeight(),this._loadLazy(),this._announce(),this._afterTransition())}_updateAutoHeight(){if(!this.params.autoHeight||this.params.axis!=="x"||!this._slideHeights)return;const t=this._slideHeights[this._activeIndex]||0;t>0&&(this._viewport.style.height=`${t}px`)}_afterTransition(){this._speedOverride=null,this._announce();const t=this._pendingChange;this._pendingChange=null,t&&(this._emit("afterChange",{index:t.index,previousIndex:t.previousIndex,reason:t.reason}),this._notifyPlugins("onChange",{index:t.index,previousIndex:t.previousIndex,reason:t.reason}),this._notifySync("change")),this._syncOrigin=null,this._scheduleAutoplay()}_emitProgress(t){this._emit("progress",{progress:t,index:this._activeIndex}),this._notifySync("progress",t)}on(t,e){return typeof e!="function"||typeof t!="string"?this:(this._events.has(t)||this._events.set(t,new Set),this._events.get(t).add(e),this)}off(t,e){return this._events.has(t)?(e?this._events.get(t).delete(e):this._events.delete(t),this):this}_eventHandlers(t){const e=Array.from(this._events.get(t)||[]),s=this.params.on&&this.params.on[t];return typeof s=="function"?e.unshift(s):Array.isArray(s)&&e.unshift(...s.filter(i=>typeof i=="function")),e}_emit(t,e){this._eventHandlers(t).forEach(s=>{try{s(e)}catch(i){console.error(`[ZikraSlider] "${t}" listener failed:`,i)}})}_emitCancellable(t,e){const s=this._eventHandlers(t);for(const i of s)try{if(i(e)===!1)return!1}catch(r){console.error(`[ZikraSlider] "${t}" listener failed:`,r)}return!0}_initPlugins(){this._pluginList=[],K(this.params.plugins).forEach(t=>{if(!(!t||typeof t.init!="function"))try{t.init(this),this._pluginList.push(t)}catch(e){console.error(`[ZikraSlider] plugin "${t.name||"unnamed"}" init failed:`,e)}})}_notifyPlugins(t,e){this._pluginList.forEach(s=>{if(typeof s[t]=="function")try{s[t](this,e)}catch(i){console.error(`[ZikraSlider] plugin "${s.name||"unnamed"}" ${t} failed:`,i)}})}_settle(){this._animating&&this._finishAnimation(this._animSeq)}goTo(t,e={}){if(!this.ready||this.destroyed||!this._realCount)return this;this._animating&&this._settle(),this._momentum&&this._stopMomentum();const s=this._normalizeIndex(t),i=this._activeIndex,r=e.reason||"api";return s===i&&!e.force?(this._float=void 0,this._snapBack(this._transitionDuration()),this):!e.silent&&!this._emitCancellable("beforeChange",{index:s,previousIndex:i,reason:r})?this:(this._directionForward=s>=i,this._activeIndex=s,this._renderIndex=this._renderIndexFor(s),this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._pendingChange={index:s,previousIndex:i,reason:r},this._speedOverride=typeof e.speed=="number"?e.speed:null,this._updateControls(),this._pendingChange&&!this._loopActive&&!this.params.loop&&s===i?(this._pendingChange=null,this):(this._render(),this._animating===!1&&(this._speedOverride=null),this))}next(t={}){if(!this.ready||this.destroyed)return this;if(this._disabled)return this;const e=Math.max(1,this.params.slidesToScroll);return!this._loopActive&&this._activeIndex>=this._realCount-1?(this._snapBack(this._transitionDuration()),this):this.goTo(this._activeIndex+e,{...t,reason:t.reason||"next"})}prev(t={}){if(!this.ready||this.destroyed)return this;if(this._disabled)return this;const e=Math.max(1,this.params.slidesToScroll);return!this._loopActive&&this._activeIndex<=0?(this._snapBack(this._transitionDuration()),this):this.goTo(this._activeIndex-e,{...t,reason:t.reason||"prev"})}_snapBack(t){this._renderSlides.length&&(this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._speedOverride=typeof t=="number"?t:null,this._render(),this._animating||(this._speedOverride=null))}_nearestRenderIndex(t){let e=this._renderIndex,s=1/0;for(let i=0;i<this._renderSlides.length;i+=1){const r=Math.abs(this._offsetFor(i)-t);r<s&&(s=r,e=i)}return e}_resolveEl(t,e=!1){if(!t||!N())return null;if(z(t))return t;if(typeof t!="string")return null;try{return(e?this.el:document).querySelector(t)}catch{return null}}_buildControls(){this._buildArrows(),this._buildBullets()}_buildArrows(){const t=this.params.arrows,e=this._cls;if(!t.enabled)return;const s=this._resolveEl(t.prevEl),i=this._resolveEl(t.nextEl);if(this._arrowPrev=this._createArrow("prev",s),this._arrowNext=this._createArrow("next",i),!s||!i){const a=this._resolveEl(t.container);a?(!s&&this._arrowPrev&&(a.appendChild(this._arrowPrev),this._generatedArrows.push(this._arrowPrev)),!i&&this._arrowNext&&(a.appendChild(this._arrowNext),this._generatedArrows.push(this._arrowNext))):(this._arrowsWrap=I("div",`${e.arrows} ${t.className||""}`.trim()),!s&&this._arrowPrev&&this._arrowsWrap.appendChild(this._arrowPrev),!i&&this._arrowNext&&this._arrowsWrap.appendChild(this._arrowNext),this.el.appendChild(this._arrowsWrap),this._generated.push(this._arrowsWrap))}}_createArrow(t,e){const s=this.params.arrows,i=this._cls,r=`${i.arrow} ${i[`arrow-${t}`]}`,a=t==="prev"?s.prevClass:s.nextClass;let n=e;n?(this._controlSnapshots.push({el:n,className:n.className,html:n.innerHTML}),n.classList.add(...r.split(" ").filter(Boolean)),s.className&&s.className.split(/\s+/).filter(Boolean).forEach(l=>n.classList.add(l)),a&&a.split(/\s+/).filter(Boolean).forEach(l=>n.classList.add(l)),n.innerHTML.trim()||(n.innerHTML=t==="prev"?s.prevHtml:s.nextHtml)):(n=I("button",`${r} ${s.className||""} ${a||""}`.trim()),n.type="button",n.innerHTML=t==="prev"?s.prevHtml:s.nextHtml),n.setAttribute("aria-label",t==="prev"?s.ariaPrevLabel:s.ariaNextLabel);const o=l=>{l.preventDefault(),this._userInteracted(),t==="prev"?this.prev({reason:"arrow"}):this.next({reason:"arrow"})};return this._controlListeners||(this._controlListeners=[]),x(this._controlListeners,n,"click",o),this._arrowEls=this._arrowEls||{},this._arrowEls[t]=n,n}_buildBullets(){const t=this.params.bullets,e=this._cls;if(!t.enabled||!this._realCount)return;const s=this._resolveEl(t.el),i=s||I("div","");this._bulletsEl=i,this._bulletsExternal=!!s,this._bulletsSignature="";const r=[e.bullets,t.className||""];t.type==="fraction"&&r.push(e.fraction),t.type==="progressbar"&&r.push(e.progressbar),s&&this._controlSnapshots.push({el:i,className:i.className,html:i.innerHTML}),i.classList.add(...r.filter(Boolean)),s||(this.el.appendChild(i),this._generated.push(i)),this._controlListeners||(this._controlListeners=[]),this._bulletEls=[],this._progressFill=null,this._bulletsSignature="",this._ensureBulletContent()}_ensureBulletContent(){const t=this.params.bullets,e=t.type;if(!this._bulletsEl)return;if(e==="fraction"){this._bulletsSignature="fraction";return}if(e==="progressbar"){this._bulletsEl.innerHTML="";const i=I("div",this._cls["progressbar-fill"]);this._bulletsEl.appendChild(i),this._progressFill=i,this._bulletsEl.setAttribute("role","progressbar"),this._bulletsEl.setAttribute("aria-label","Slide progress"),this._bulletsEl.setAttribute("aria-valuemin","0"),this._bulletsEl.setAttribute("aria-valuemax","100"),this._bulletsEl.setAttribute("data-orientation",this.params.axis==="x"?"horizontal":"vertical"),this._bulletsSignature="progressbar";return}const s=`bullets:${this._realCount}:${t.bulletClass}:${!!t.render}`;if(s!==this._bulletsSignature){this._bulletsSignature=s,this._bulletsEl.innerHTML="",this._bulletEls=[];for(let i=0;i<this._realCount;i+=1){const r=I("button",`${this._cls.bullet} ${t.bulletClass||""}`.trim());r.type="button",r.setAttribute("aria-label",`Go to slide ${i+1}`),this._renderBulletContent(r,i,!1),t.clickable?x(this._controlListeners,r,"click",()=>{this._userInteracted(),this.goTo(i,{reason:"bullet"})}):r.setAttribute("disabled",""),this._bulletsEl.appendChild(r),this._bulletEls.push(r)}this._bulletsEl.setAttribute("role","group"),this._bulletsEl.setAttribute("aria-label","Slide pagination")}}_renderBulletContent(t,e,s){const i=this.params.bullets.render;if(typeof i!="function"){t.innerHTML="";return}let r;try{r=i({index:e,isActive:s,total:this._realCount})}catch{return}typeof r=="string"?t.innerHTML=r:r&&r.nodeType===1&&t.replaceChildren(r)}_updateControls(){if(this.destroyed)return;const t=this._cls,e=this._realCount||0,s=Number.isFinite(this._activeIndex)?this._activeIndex:0,i=this._loopActive,r=s<=0,a=s>=e-1,n=(h,p)=>{if(!h)return;const _=this.params.arrows,c=p==="prev"?r:a,u=this._disabled||!e||!i&&c;if("disabled"in h&&(h.disabled=u),h.setAttribute("aria-disabled",u?"true":"false"),_.hideAtEdges&&(h.classList.toggle(t["arrow-hidden"],!i&&c),h.setAttribute("aria-hidden",!i&&c?"true":"false")),typeof _.render=="function"){let f;try{f=_.render({direction:p,index:s,total:e})}catch{f=null}typeof f=="string"?h.innerHTML=f:f&&f.nodeType===1&&h.replaceChildren(f)}};n(this._arrowPrev||this._arrowEls&&this._arrowEls.prev,"prev"),n(this._arrowNext||this._arrowEls&&this._arrowEls.next,"next");const o=this.params.bullets;if(!o.enabled||!this._bulletsEl)return;const l=e>1?s/(e-1):0;if(o.type==="fraction"){const h=typeof o.formatFraction=="function"?o.formatFraction:at.fraction;this._bulletsEl.textContent=h(s+1,e)}else if(o.type==="progressbar")this._progressFill&&(this.params.axis==="x"?(this._progressFill.style.width=`${(l*100).toFixed(2)}%`,this._progressFill.style.height=""):(this._progressFill.style.height=`${(l*100).toFixed(2)}%`,this._progressFill.style.width="")),this._bulletsEl.setAttribute("aria-valuenow",String(Math.round(l*100)));else{(!this._bulletEls||this._bulletEls.length!==e)&&this._ensureBulletContent();const h=o.activeClass||t["bullet-active"],p=o.dynamicBullets?2:1/0;(this._bulletEls||[]).forEach((_,c)=>{const u=c===s;_.classList.toggle(h,u),u?_.setAttribute("aria-current","true"):_.removeAttribute("aria-current"),_.classList.toggle(t["bullet-active"],u&&h!==t["bullet-active"]),o.dynamicBullets&&e>7?(_.hidden=Math.abs(c-s)>p,u&&this._renderBulletContent(_,c,!0)):(_.hidden=!1,this._renderBulletContent(_,c,u))})}}_destroyControls(){V(this._controlListeners||[]),this._controlListeners=[],(this._controlSnapshots||[]).forEach(({el:t,className:e,html:s})=>{t.className=e,t.innerHTML=s}),this._controlSnapshots=[],this._generatedArrows.forEach(t=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),this._generatedArrows=[],this._arrowsWrap&&this._arrowsWrap.isConnected&&this._arrowsWrap.remove(),this._bulletsEl&&!this._bulletsExternal&&this._bulletsEl.isConnected&&this._bulletsEl.remove(),this._arrowPrev=null,this._arrowNext=null,this._arrowEls=null,this._arrowsWrap=null,this._bulletsEl=null,this._bulletEls=[],this._progressFill=null,this._bulletsSignature=""}_startAutoplay(){this._autoplayPlaying=!!this.params.features.autoplay.enabled,this._stoppedByUser=!1,this._scheduleAutoplay()}play(){return!this.ready||this.destroyed||this._disabled?this:(this._autoplayPlaying=!0,this._stoppedByUser=!1,this._scheduleAutoplay(),this)}pause(){return this._autoplayPlaying=!1,this._clearAutoplay(),this}toggleAutoplay(){return this._autoplayPlaying?this.pause():this.play()}_clearAutoplay(){this._autoplayTimer&&(clearTimeout(this._autoplayTimer),this._timers.delete(this._autoplayTimer),this._autoplayTimer=null),this._autoplayRunning=!1}_canAutoplay(){const t=this.params.features.autoplay;return!(!this.ready||this.destroyed||!this._autoplayPlaying||this._stoppedByUser||!t.enabled||this._disabled||this._realCount<2||t.pauseOnHover&&this._hoverPaused||t.pauseOnFocus&&this._focusPaused||t.pauseOnHiddenTab&&typeof document<"u"&&document.hidden)}_scheduleAutoplay(){if(this._clearAutoplay(),!this._canAutoplay()||this._animating)return;if(!this._loopActive&&this._activeIndex>=this._realCount-1){this._autoplayPlaying=!1;return}const t=Math.max(250,Number(this.params.features.autoplay.delay)||4e3);this._autoplayRunning=!0,this._autoplayTimer=setTimeout(()=>{this._timers.delete(this._autoplayTimer),this._autoplayTimer=null,this._autoplayRunning=!1,!(!this._canAutoplay()||this._animating)&&(this.next({reason:"autoplay"}),this._animating||this._scheduleAutoplay())},t),this._timers.add(this._autoplayTimer)}_userInteracted(){this.ready&&this.params.features.autoplay.stopOnInteraction&&(this._stoppedByUser=!0,this._autoplayPlaying=!1,this._clearAutoplay())}_stepSize(){const t=this._renderIndex||0,s=(this._sizes&&this._sizes[t]||0)+this.params.gap;return s>0?s:Math.max(1,this._viewportSize)}_dragProgress(){if(!this._realCount||this._realCount<2)return 0;let t;if(this.params.type==="slide"){const e=this._drag,s=e?e.startOffset:this._offsetFor(this._activeIndex);t=this._activeIndex-(this._offset-s)/this._stepSize()}else t=Number.isFinite(this._float)?this._float:this._activeIndex;return w(t/(this._realCount-1),0,1)}_handlePointerDown(t){if(!this.ready||this.destroyed||!this.params.features.drag.enabled||this._disabled||t.pointerType==="mouse"&&t.button>0||this._drag)return;const e=`.${this._cls.arrow}, .${this._cls.bullets}, input, select, textarea, [data-zs-nodrag]`;t.target&&t.target.closest&&t.target.closest(e)||(this._momentum&&this._stopMomentum(),this._animating&&this._settle(),this._drag={pointerId:t.pointerId,pointerType:t.pointerType,startX:t.clientX,startY:t.clientY,startOffset:this._offset,startFloat:this._float,lastPrimary:0,lastT:typeof performance<"u"?performance.now():Date.now(),vx:0,started:!1})}_handlePointerMove(t){const e=this._drag;if(!e||this.destroyed||t.pointerId!==e.pointerId)return;if(!this.params.features.drag.enabled){this._drag=null;return}const s=this.params.features.drag,i=t.clientX-e.startX,r=t.clientY-e.startY,a=this.params.axis==="x"?i:r,n=this.params.axis==="x"?r:i;if(!e.started){if(Math.abs(a)<s.threshold&&Math.abs(n)<s.threshold)return;if(Math.abs(n)>Math.abs(a)*1.2){this._drag=null;return}e.started=!0,this.el.classList.add(this._cls.dragging);try{this.el.setPointerCapture(t.pointerId)}catch{}this._applyInstant(this._computeStyles()),this._userInteracted()}t.cancelable&&t.preventDefault();const o=this.params.axis==="x"&&this._rtl?-1:1;let l=e.startOffset+a*o;const h=s.rubberband?.35:0,p=this._offsetFor(0),_=this._offsetFor(this._renderSlides.length-1),c=Math.max(p,_),u=Math.min(p,_);l>c?l=c+(l-c)*h:l<u&&(l=u+(l-u)*h),this._offset=l,this.params.type!=="slide"&&(this._float=this._activeIndex-(l-e.startOffset)/this._stepSize()),this._applyInstant(this._computeStyles()),this._emitProgress(this._dragProgress());const f=typeof performance<"u"?performance.now():Date.now(),y=f-e.lastT;if(y>0){const A=(a-e.lastPrimary)/y;e.vx=e.vx*.7+A*.3,e.lastPrimary=a,e.lastT=f}}_handlePointerUp(t){const e=this._drag;if(!e||t.pointerId!==e.pointerId||(this._drag=null,!e.started))return;const s=this.params.features.drag;this.el.classList.remove(this._cls.dragging);try{this.el.hasPointerCapture&&this.el.hasPointerCapture(t.pointerId)&&this.el.releasePointerCapture(t.pointerId)}catch{}if(this._suppressClickUntil=(typeof performance<"u"?performance.now():Date.now())+140,t.type==="pointercancel"){this._snapBack(this._transitionDuration());return}const r=(typeof performance<"u"?performance.now():Date.now())-e.lastT>120,a=this.params.axis==="x"&&this._rtl?-1:1,n=r?0:e.vx*a,o=this._stepSize(),l=-(this._offset-e.startOffset)/o,h=-n/o;if(this._float!==void 0&&(this._float=void 0),this.params.freeMode){this._startMomentum(n);return}let p=0;if(Math.abs(n)>s.velocity?p=Math.sign(h)||Math.sign(-n):Math.abs(l)>.18&&(p=Math.sign(l)),!p){this._snapBack(this._transitionDuration());return}const _=this._activeIndex,c=_+p*Math.max(1,this.params.slidesToScroll);this.goTo(c,{reason:"drag"}),this._activeIndex===_&&this._snapBack(this._transitionDuration())}_startMomentum(t){this._drag&&(this._drag=null);let e=t,s=typeof performance<"u"?performance.now():Date.now();const i=this._stepSize(),r=this._offsetFor(0),a=this._offsetFor(this._renderSlides.length-1),n=Math.max(r,a),o=Math.min(r,a);this._momentum=!0;const l=()=>{if(this.destroyed||!this._momentum)return;const h=typeof performance<"u"?performance.now():Date.now(),p=Math.min(48,h-s);s=h,e*=Math.pow(.95,p/16.7);let _=this._offset+e*p;if((_>n||_<o)&&(_=w(_,o,n),e=0),this._offset=_,this.params.type!=="slide"&&(this._float=this._activeIndex-(_-this._offsetFor(this._renderIndex))/i),this._applyInstant(this._computeStyles()),this._emitProgress(this._dragProgress()),Math.abs(e)<.02||p===0){this._momentum=null,this._snapToNearest();return}this._momentum=requestAnimationFrame(l)};this._momentum=requestAnimationFrame(l)}_stopMomentum(){this._momentum&&typeof this._momentum=="number"&&cancelAnimationFrame(this._momentum),this._momentum=null}_snapToNearest(){if(!this._renderSlides.length)return;const t=this._nearestRenderIndex(this._offset),e=this._realIndexFor(t);this._renderIndex=t,this._float=void 0,this.goTo(e,{reason:"drag",speed:this._transitionDuration()}),this._animating||this._snapBack(this._transitionDuration())}_resolveSyncTargets(t=!1){const e=this.params.sync||{};if(!e.with){this._syncTargets.length&&this._unbindSync();return}const s=Array.isArray(e.with)?e.with.flat(1/0):[e.with],i=[];s.forEach(n=>{if(n instanceof P){n!==this&&i.push(n);return}const o=q(n);if(!o)return;const l=O.get(o);l&&l!==this&&i.push(l)});const r=Array.from(new Set(i)).filter(n=>n.ready&&!n.destroyed);!t&&r.length===this._syncTargets.length&&r.every((n,o)=>n===this._syncTargets[o])||(this._unbindSync(),this._syncTargets=r,this._syncListeners=this._syncListeners||[],r.length&&e.asThumbnails&&(r.forEach(n=>{this._thumbHostEl=n.el,n.el.setAttribute("data-zs-thumbnails",""),n._slides.forEach((o,l)=>{const h=p=>{this._suppressClickUntil&&performance.now()<this._suppressClickUntil||(p.preventDefault(),this._userInteracted(),this.goTo(l,{reason:"thumbnail"}))};x(this._syncListeners,o,"click",h)})}),this._notifySync("change")))}_unbindSync(){V(this._syncListeners||[]),this._syncListeners=[],this._thumbHostEl&&(this._thumbHostEl.removeAttribute("data-zs-thumbnails"),this._thumbHostEl=null),this._syncTargets=[],this._syncOrigin=null}_notifySync(t,e){if(!this._syncTargets||!this._syncTargets.length||this.destroyed)return;const s=this.params.sync.mode;this._syncTargets.forEach(i=>{if(!(i===this||i.destroyed||!i.ready)&&!(i._syncOrigin===this||i._syncingNow)&&!(t==="progress"&&s!=="progress"))try{t==="change"?i._syncApply(this,this._activeIndex,!1):i._syncApply(this,e,!0)}catch(r){console.error("[ZikraSlider] sync failed:",r)}})}_syncApply(t,e,s){if(!(this.destroyed||!this.ready)&&!this._syncingNow&&!(this._drag&&this._drag.started)){this._syncingNow=!0,this._syncOrigin=t;try{s?this._syncToProgress(e):e!==this._activeIndex||this._animating?this.goTo(e,{reason:"sync",silent:!0}):(this._float=void 0,this._snapBack(this._transitionDuration()))}finally{this._syncingNow=!1,this._animating||(this._syncOrigin=null)}}}_syncToProgress(t){if(this._disabled||this._realCount<2||!this._renderSlides.length)return;const e=w(t,0,1);if(this._animating&&this._settle(),this.params.type==="slide"){const s=this._pre||0,i=this._offsetFor(s),r=this._offsetFor(s+this._realCount-1);this._offset=i+(r-i)*e,this._activeIndex=Math.round(e*(this._realCount-1)),this._renderIndex=this._renderIndexFor(this._activeIndex),this._float=void 0,this._applyInstant(this._computeStyles())}else this._float=e*(this._realCount-1),this._activeIndex=Math.round(this._float),this._renderIndex=this._renderIndexFor(this._activeIndex),this._applyInstant(this._computeStyles());this._updateControls(),this._loadLazy(),this._syncOrigin=null}_setupBreakpoints(){const t=this.params.responsive;!F(t)||typeof window.matchMedia!="function"||Object.keys(t).forEach(e=>{const s=parseFloat(e)||0;let i;try{i=window.matchMedia(`(min-width: ${s}px)`)}catch{return}const r=()=>{clearTimeout(this._bpTimer),this._bpTimer=setTimeout(()=>{this._timers.delete(this._bpTimer),this._bpTimer=null,this.update({})},60),this._timers.add(this._bpTimer)};i.addEventListener?i.addEventListener("change",r):i.addListener&&i.addListener(r),this._breakpointListeners.push(()=>{i.removeEventListener?i.removeEventListener("change",r):i.removeListener&&i.removeListener(r)})})}_destroyBreakpoints(){this._breakpointListeners.forEach(t=>{try{t()}catch{}}),this._breakpointListeners=[],this._bpTimer&&(clearTimeout(this._bpTimer),this._timers.delete(this._bpTimer),this._bpTimer=null)}update(t={}){if(!this.ready||this.destroyed)return this;const e=this._activeIndex;this._drag=null,this._syncOrigin=null,this._cancelAnimations(),this._resetParallax(),this._stopMomentum(),this._destroyControls(),this._destroyBreakpoints(),this._userOptions=L(this._userOptions,t),this.params=this._resolveParams(),this._cls=this._buildClassNames();const s=this._cls,i=this.el;return B.forEach(r=>i.classList.remove(s[`type-${r}`])),W.forEach(r=>i.classList.remove(s[`axis-${r}`])),i.classList.remove("zs-no-js"),this.params.fallback.noJsClass&&i.classList.remove(this.params.fallback.noJsClass),i.classList.add(s[`type-${this.params.type}`],s[`axis-${this.params.axis}`]),i.classList.toggle(s["drag-enabled"],!!this.params.features.drag.enabled),this.params.dir==="rtl"?i.setAttribute("dir","rtl"):this._original.attrs.dir==null?i.removeAttribute("dir"):i.setAttribute("dir",this._original.attrs.dir),this._viewport.className=`${s.viewport} ${s[`type-${this.params.type}`]}`,this._buildControls(),this._activeIndex=e,this._measure(),this._activeIndex=this._normalizeIndex(e),this._renderIndex=this._renderIndexFor(this._activeIndex),this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._render({instant:!0}),this._updateControls(),this._resolveSyncTargets(!0),this._setupBreakpoints(),this._autoplayPlaying=!!this.params.features.autoplay.enabled,this._stoppedByUser=!1,this._scheduleAutoplay(),this}recalculate(){if(!this.ready||this.destroyed)return this;const t=this._activeIndex;return this._syncOrigin=null,this._measure(),this._activeIndex=this._normalizeIndex(t),this._renderIndex=this._renderIndexFor(this._activeIndex),this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._render({instant:!0}),this._updateControls(),this._loadLazy(),this._scheduleAutoplay(),this}getProgress(){return!this._realCount||this._realCount<2?0:w(this._activeIndex/(this._realCount-1),0,1)}getState(){return{index:this._activeIndex,realIndex:this._activeIndex,progress:this.getProgress(),total:this._realCount,slidesPerView:this.params.slidesPerView,isLooping:!!this._loopActive,isAutoplay:!!this._autoplayPlaying,isAutoplayRunning:!!this._autoplayRunning,isAnimating:!!this._animating,isDragging:!!(this._drag&&this._drag.started),isDisabled:!!this._disabled,isDestroyed:!!this.destroyed,isBroken:!this.ready,type:this.params.type,axis:this.params.axis,dir:this.params.dir,backend:this._backend||null}}_disconnectMedia(){this._mediaLoadListeners.forEach(({img:t,onLoad:e,onError:s})=>{t.removeEventListener("load",e),t.removeEventListener("error",s)}),this._mediaLoadListeners=[]}destroy(){if(this.destroyed)return this;if(!this.el)return this.destroyed=!0,this;this._emit("destroy",{instance:this}),this._clearAutoplay(),this._cancelAnimations(),this._resetParallax(),this._stopMomentum(),this._destroyBreakpoints(),this._disconnectMedia(),this._announceTimer&&(clearTimeout(this._announceTimer),this._timers.delete(this._announceTimer),this._announceTimer=null),this._timers.forEach(i=>clearTimeout(i)),this._timers.clear(),this._recalcRaf&&cancelAnimationFrame(this._recalcRaf),this._progressRaf&&cancelAnimationFrame(this._progressRaf),this._ro&&this._ro.disconnect(),D.forEach(i=>{!i||i===this||i.destroyed||(i._syncTargets=(i._syncTargets||[]).filter(r=>r!==this),i._thumbHostEl===this.el&&(i._thumbHostEl.removeAttribute("data-zs-thumbnails"),i._thumbHostEl=null))}),this._unbindSync(),this._notifyPlugins("destroy"),this._pluginList=[],this._destroyControls(),V(this._listeners),this._waapi=[];const t=this.el,e=this._slides||[],s=this._slideSnapshots||[];return e.forEach((i,r)=>{i.parentNode!==t&&t.appendChild(i);const a=s[r];a&&(i.className=a.className,a.id==null?i.removeAttribute("id"):i.setAttribute("id",a.id),["role","aria-roledescription","aria-label"].forEach(n=>{a[n]==null?i.removeAttribute(n):i.setAttribute(n,a[n])}),a["aria-hidden"]==null?i.removeAttribute("aria-hidden"):i.setAttribute("aria-hidden",a["aria-hidden"]),a.inert?i.setAttribute("inert",""):("inert"in i&&(i.inert=!1),i.removeAttribute("inert"))),i.removeAttribute("data-zs-index"),a&&(a.style==null?i.removeAttribute("style"):i.setAttribute("style",a.style))}),this._slideSnapshots=[],this._generated.forEach(i=>{i&&i.parentNode&&i.parentNode.removeChild(i)}),this._generated=[],this._viewport&&this._viewport.parentNode&&this._viewport.parentNode.removeChild(this._viewport),t.className=this._original.className,Object.keys(this._original.attrs||{}).forEach(i=>{const r=this._original.attrs[i];r==null?t.removeAttribute(i):t.setAttribute(i,r)}),!this._hadId&&t.id===this.id&&t.removeAttribute("id"),this._original.style==null?t.removeAttribute("style"):t.setAttribute("style",this._original.style),D.delete(this),O.delete(t),this._events.clear(),this.ready=!1,this.destroyed=!0,this}}function M(d,t){return new P(d,t)}M.prototype=P.prototype,M.VERSION=j,M.defaults=Y,M.ZikraSlider=P,M.get=d=>{const t=q(d);return t&&O.get(t)||null},M.instances=()=>Array.from(D);export{P as ZikraSlider};export default M;
|
package/dist/zikraslider.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Zikra Slider Pro v1.2.
|
|
2
|
-
(function(B,T){typeof module=="object"&&module.exports?module.exports=T():typeof define=="function"&&define.amd?define([],T):B.zikraslider=T()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(){"use strict";const B="1.2.0",T=["slide","fade","scale","coverflow","stack","cards","custom"],W=["x","y"],j=["ltr","rtl"],Z=["slide","fade","zoom","slide-up","flip","stagger"],Y={type:"slide",axis:"x",dir:"ltr",slidesPerView:1,slidesToScroll:1,gap:0,centeredSlides:!1,freeMode:!1,loop:!1,initialSlide:0,autoHeight:!1,speed:480,classPrefix:"zs-",parallax:{enabled:!1,selector:"[data-zs-parallax]",factor:.2},custom:{transform:null},sync:{with:null,mode:"index",asThumbnails:!1},arrows:{enabled:!0,prevEl:null,nextEl:null,container:null,className:"",prevClass:"",nextClass:"",prevHtml:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 18l-6-6 6-6"/></svg>',nextHtml:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 18l6-6-6-6"/></svg>',ariaPrevLabel:"Previous slide",ariaNextLabel:"Next slide",hideAtEdges:!1,render:null},bullets:{enabled:!0,el:null,type:"bullets",clickable:!0,dynamicBullets:!1,className:"",bulletClass:"",activeClass:"",formatFraction:null,render:null},features:{autoplay:{enabled:!1,delay:4200,pauseOnHover:!0,pauseOnFocus:!0,pauseOnHiddenTab:!0,stopOnInteraction:!1},drag:{enabled:!0,threshold:6,velocity:.4,rubberband:!0},keyboard:{enabled:!0,onlyWhenFocused:!0},wheel:{enabled:!1,passive:!0},lazyLoad:{enabled:!1,mode:"adjacent",placeholder:""},a11y:{enabled:!0,roleDescription:"carousel",liveRegion:!0}},responsive:null,animation:{library:"auto",effect:"slide",duration:null,ease:"cubic-bezier(0.22, 0.61, 0.36, 1)",fallback:"css"},fallback:{disableIfNotEnoughSlides:!0,reducedMotion:"fade",noJsClass:"zs-no-js",onMediaError:null},on:{},plugins:[]},k=()=>typeof window<"u"&&typeof document<"u",L=d=>!!(d&&d.nodeType===1),w=(d,t,e)=>Math.min(Math.max(d,t),e);function $(d){if(!d||typeof d!="object")return!1;const t=Object.getPrototypeOf(d);return t===Object.prototype||t===null}function P(...d){const t={};for(const e of d)if($(e))for(const s of Object.keys(e)){const i=e[s];i!==void 0&&($(i)?t[s]=P($(t[s])?t[s]:{},i):Array.isArray(i)?t[s]=i.slice():t[s]=i)}return t}function q(d){if(!k())return null;if(L(d))return d;if(typeof d=="string")try{return document.querySelector(d)}catch{return null}return d&&d.length&&L(d[0])?d[0]:null}function I(d,t){const e=document.createElement(d);return t&&(e.className=t),e}function x(d,t,e,s,i){!t||typeof t.addEventListener!="function"||(t.addEventListener(e,s,i),d.push({target:t,type:e,handler:s,options:i}))}function V(d){for(;d.length;){const{target:t,type:e,handler:s,options:i}=d.pop();try{t.removeEventListener(e,s,i)}catch{}}}function X(){if(!k()||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function J(d){return Array.isArray(d)?d.flat(1/0).filter(Boolean):[]}const K=/^(linear|ease|ease-in|ease-out|ease-in-out|step-start|step-end|cubic-bezier\(.+\)|steps\(.+\))$/;function O(d,t){if(typeof d!="string")return t;const e=d.trim();return e&&!K.test(e)?e:t}function G(d){return{name:"gsap",fromTo(t,e,s,i){return new Promise(r=>{if(!L(t))return r();d.fromTo(t,{...e,x:e.x||0,y:e.y||0,z:e.z||0,scale:e.scale==null?1:e.scale,rotation:e.rotate||0,rotateY:e.rotateY||0,opacity:e.opacity==null?1:e.opacity},{...s,x:s.x||0,y:s.y||0,z:s.z||0,scale:s.scale==null?1:s.scale,rotation:s.rotate||0,rotateY:s.rotateY||0,opacity:s.opacity==null?1:s.opacity,duration:i.duration/1e3,delay:(i.delay||0)/1e3,ease:O(i.easing,"power2.out"),overwrite:"auto",onComplete:r,onInterrupt:r})})}}}function Q(d){const t=d&&typeof d.animate=="function";return{name:t?"anime-v4":"anime",fromTo(e,s,i,r){return new Promise(a=>{if(!L(e))return a();const n={targets:e,duration:r.duration,delay:r.delay||0,easing:O(r.easing,"easeOutQuad"),complete:a},o={translateX:i.x||0,translateY:i.y||0,translateZ:i.z||0,scale:i.scale==null?1:i.scale,rotate:`${i.rotate||0}deg`,rotateY:`${i.rotateY||0}deg`,opacity:i.opacity==null?1:i.opacity},l={translateX:s.x||0,translateY:s.y||0,translateZ:s.z||0,scale:s.scale==null?1:s.scale,rotate:`${s.rotate||0}deg`,rotateY:`${s.rotateY||0}deg`,opacity:s.opacity==null?1:s.opacity};try{if(t){const h=O(r.easing,null),p={duration:r.duration,delay:r.delay||0};h&&(p.ease=h),d.animate(e,{...l,...o},p).finished.then(a,a)}else d({...n,...l,keyframes:[{...l},{...o}]})}catch{a()}})}}}function tt(d){return{name:"motion",fromTo(t,e,s,i){if(!L(t))return Promise.resolve();const r={x:[e.x||0,s.x||0],y:[e.y||0,s.y||0],z:[e.z||0,s.z||0],scale:[e.scale==null?1:e.scale,s.scale==null?1:s.scale],rotate:[e.rotate||0,s.rotate||0],rotateY:[e.rotateY||0,s.rotateY||0],opacity:[e.opacity==null?1:e.opacity,s.opacity==null?1:s.opacity]},a=d.animate(t,r,{duration:i.duration/1e3,delay:(i.delay||0)/1e3,easing:O(i.easing,"ease-out")});return a&&typeof a.finished=="object"?a.finished.then(()=>{},()=>{}):Promise.resolve()}}}function et(d){return{name:"custom",fromTo(t,e,s,i){if(typeof d.fromTo=="function")return Promise.resolve(d.fromTo(t,e,s,i));if(typeof d.animate=="function")return Promise.resolve(d.animate(t,{from:e,to:s,...i}));throw new Error("Custom animation library must expose fromTo() or animate().")}}}function st(d){if(!k()||d==="none")return null;if(d&&typeof d=="object")return{adapter:et(d),label:"custom"};const t=window,e=d==="auto"?["gsap","anime","motion"]:[d];for(const s of e)try{if(s==="gsap"&&t.gsap&&typeof t.gsap.fromTo=="function")return{adapter:G(t.gsap),label:"gsap"};if(s==="anime"&&typeof t.anime=="function")return{adapter:Q(t.anime),label:"anime"};if(s==="motion"&&t.motion&&typeof t.motion.animate=="function")return{adapter:tt(t.motion),label:"motion"}}catch{return null}return null}let it=0;const R=new WeakMap,N=new Set,rt={"aria-prev":"Previous slide","aria-next":"Next slide",fraction:(d,t)=>`${d} / ${t}`},at=["role","aria-roledescription","aria-label","tabindex","dir","id"];class F{constructor(t,e={}){this.el=null,this.ready=!1,this.destroyed=!1,this._events=new Map,this._listeners=[],this._generated=[],this._generatedArrows=[],this._syncTargets=[],this._syncListeners=[],this._syncOrigin=null,this._pluginList=[],this._breakpointListeners=[],this._mediaLoadListeners=[],this._waapi=[],this._timers=new Set,this._controlListeners=[],this._controlSnapshots=[],this._slideSnapshots=[],this._innerState=new WeakMap,this._parallaxCache=new WeakMap,this._parallaxTouched=new Map;const s=q(t);if(!k()||!s){this.params=P(Y),this._cls=this._buildClassNames();return}this.el=s,this.id=s.id||`zs-${++it}`,R.set(s,this),N.add(this),this._init(e)}_init(t){const e=this.el;this._userOptions=P(t),this._hadId=!!e.id,this._original={className:e.className,style:e.getAttribute("style"),attrs:at.reduce((s,i)=>({...s,[i]:e.getAttribute(i)}),{}),children:Array.from(e.children)},this.params=this._resolveParams(),this._cls=this._buildClassNames(),this.params.fallback.noJsClass&&e.classList.remove(this.params.fallback.noJsClass),this._setupDom(),this._setupA11y(),this._connectMedia(),this._buildControls(),this._bindEvents(),this._setupBreakpoints(),this._activeIndex=this._normalizeIndex(this.params.initialSlide),this._renderIndex=this._activeIndex,this._offset=0,this._measure(),this._renderIndex=this._renderIndexFor(this._activeIndex),this._offset=this._offsetFor(this._renderIndex),this._render({instant:!0}),this._updateControls(),this._loadLazy(),this._initPlugins(),this._resolveSyncTargets(),this.ready=!0,e.classList.add(this._cls.initialized),this._emit("init",{instance:this}),this._startAutoplay(),N.forEach(s=>{s!==this&&s.ready&&s._resolveSyncTargets()})}_buildClassNames(){const t=this.params.classPrefix||"zs-",e={};return["slider","initialized","viewport","track","slide","slide-clone","slide-active","slide-visible","arrows","arrow","arrow-prev","arrow-next","arrow-hidden","bullets","bullet","bullet-active","fraction","progressbar","progressbar-fill","live","dragging","drag-enabled","disabled","animating"].forEach(s=>{e[s]=t+s}),T.forEach(s=>{e[`type-${s}`]=`${t}type-${s}`}),W.forEach(s=>{e[`axis-${s}`]=`${t}axis-${s}`}),e}_resolveParams(){const t=P(Y,this._userOptions);if(t.type=T.includes(t.type)?t.type:"slide",t.axis=W.includes(t.axis)?t.axis:"x",t.dir=j.includes(t.dir)?t.dir:"ltr",t.slidesPerView=t.slidesPerView==="auto"?"auto":Math.max(.1,Number(t.slidesPerView)||1),t.slidesToScroll=Math.max(1,Math.round(Number(t.slidesToScroll)||1)),t.gap=Math.max(0,Number(t.gap)||0),t.speed=Math.max(0,Number(t.speed)||0),Z.includes(t.animation.effect)||(t.animation.effect="slide"),["css","waapi"].includes(t.animation.fallback)||(t.animation.fallback="css"),[!0,!1,"auto"].includes(t.loop)||(t.loop=!!t.loop),$(t.responsive)&&typeof window.matchMedia=="function"){const e=Object.keys(t.responsive).map(s=>({key:s,min:parseFloat(s)||0,overrides:t.responsive[s]})).sort((s,i)=>i.min-s.min);for(const s of e)try{if(window.matchMedia(`(min-width: ${s.min}px)`).matches){Object.assign(t,P(t,s.overrides));break}}catch{}}return t}_setupDom(){const t=this.el,e=this._cls;t.classList.add(e.slider,e.initialized,e[`type-${this.params.type}`],e[`axis-${this.params.axis}`]),t.classList.toggle(e["drag-enabled"],!!this.params.features.drag.enabled),this.params.dir==="rtl"&&t.setAttribute("dir","rtl"),t.id||(t.id=this.id),this.params.features.a11y.enabled&&t.setAttribute("tabindex","0"),this._viewport=I("div",`${e.viewport} ${e[`type-${this.params.type}`]}`),this._track=I("div",e.track),this._generated.push(this._viewport),this._slides=Array.from(t.children),this._slideSnapshots=this._slides.map(s=>({className:s.className,style:s.getAttribute("style"),id:s.getAttribute("id"),role:s.getAttribute("role"),"aria-roledescription":s.getAttribute("aria-roledescription"),"aria-label":s.getAttribute("aria-label"),"aria-hidden":s.getAttribute("aria-hidden"),inert:s.hasAttribute("inert")})),this._slides.forEach((s,i)=>{s.classList.contains(e.slide)||s.classList.add(e.slide),s.setAttribute("data-zs-index",String(i)),this._track.appendChild(s)}),this._realCount=this._slides.length,this._viewport.appendChild(this._track),t.appendChild(this._viewport),this._baseSlideClasses=this._slides.map(s=>s.className),this._baseSlideStyles=this._slides.map(s=>s.getAttribute("style"))}_setupA11y(){const t=this.params.features.a11y;if(!t.enabled)return;const e=this.el;e.setAttribute("role","region"),e.setAttribute("aria-roledescription",t.roleDescription),e.hasAttribute("aria-label")||e.setAttribute("aria-label","Image carousel"),this._slides.forEach((s,i)=>{s.id||(s.id=`${this.id}-slide-${i}`),s.setAttribute("role","group"),s.setAttribute("aria-roledescription","slide"),s.setAttribute("aria-label",`${i+1} of ${this._realCount}`)}),t.liveRegion&&(this._live=I("div",this._cls.live),this._live.setAttribute("aria-live","polite"),this._live.setAttribute("aria-atomic","true"),this.el.appendChild(this._live),this._generated.push(this._live))}_bindEvents(){const t=this.el,e=this.params.features;this._onPointerDown=this._handlePointerDown.bind(this),this._onPointerMove=this._handlePointerMove.bind(this),this._onPointerUp=this._handlePointerUp.bind(this),x(this._listeners,t,"pointerdown",this._onPointerDown,{passive:!0}),x(this._listeners,t,"pointermove",this._onPointerMove,{passive:!1}),x(this._listeners,t,"pointerup",this._onPointerUp),x(this._listeners,t,"pointercancel",this._onPointerUp),x(this._listeners,t,"dragstart",i=>{this._drag&&this._drag.started&&i.preventDefault()}),e.autoplay.pauseOnHover&&(x(this._listeners,t,"pointerenter",i=>{i.pointerType==="mouse"&&(this._hoverPaused=!0)}),x(this._listeners,t,"pointerleave",()=>{this._hoverPaused=!1,this._scheduleAutoplay()})),e.autoplay.pauseOnFocus&&(x(this._listeners,t,"focusin",()=>{this._focusPaused=!0}),x(this._listeners,t,"focusout",i=>{t.contains(i.relatedTarget)||(this._focusPaused=!1,this._scheduleAutoplay())})),e.autoplay.pauseOnHiddenTab&&typeof document<"u"&&(this._onVisibility=()=>{document.hidden||this._scheduleAutoplay()},x(this._listeners,document,"visibilitychange",this._onVisibility)),x(this._listeners,t,"click",i=>{this._suppressClickUntil&&performance.now()<this._suppressClickUntil&&(i.preventDefault(),i.stopPropagation())},!0),this._onKeyDown=i=>{const r=this.params.features.keyboard;if(!r.enabled||this._disabled||i.metaKey||i.ctrlKey||i.altKey)return;const a=i.target;if(a&&/^(INPUT|TEXTAREA|SELECT)$/.test((a.tagName||"").toUpperCase()))return;if(!r.onlyWhenFocused&&a&&a.closest){const l=a.closest(`.${this._cls.slider}`);if(l&&l!==this.el)return}const n=this._rtl;let o;switch(i.key){case"ArrowLeft":o=n?"next":"prev";break;case"ArrowRight":o=n?"prev":"next";break;case"ArrowUp":o="prev";break;case"ArrowDown":o="next";break;case"Home":o="first";break;case"End":o="last";break;case"PageUp":o="prev";break;case"PageDown":o="next";break;default:return}i.preventDefault(),this._userInteracted(),o==="first"?this.goTo(0):o==="last"?this.goTo(this._realCount-1):o==="next"?this.next():this.prev()};const s=this.params.features.keyboard.onlyWhenFocused?t:document;x(this._listeners,s,"keydown",this._onKeyDown),this._onWheel=i=>{const r=this.params.features.wheel;if(!r.enabled)return;const a=Date.now();if(a-(this._wheelAt||0)<320)return;const n=this.params.axis==="x"&&Math.abs(i.deltaX)>Math.abs(i.deltaY)?i.deltaX:i.deltaY;Math.abs(n)<12||(this._wheelAt=a,r.passive||i.preventDefault(),this._userInteracted(),n>0?this.next():this.prev())},x(this._listeners,t,"wheel",this._onWheel,{passive:!!this.params.features.wheel.passive}),typeof ResizeObserver=="function"&&(this._ro=new ResizeObserver(()=>this._requestRecalc()),this._ro.observe(t),this._ro.observe(this._track)),this._onWindowResize=()=>this._requestRecalc(),x(this._listeners,window,"resize",this._onWindowResize),x(this._listeners,window,"orientationchange",this._onWindowResize),this.params.features.lazyLoad.enabled&&x(this._listeners,document,"zs:lazy",i=>{i.detail&&i.detail.instance===this&&this._loadLazy()})}_requestRecalc(){this.destroyed||!this.ready||this._recalcRaf||(this._recalcRaf=requestAnimationFrame(()=>{this._recalcRaf=null,!this.destroyed&&this.ready&&this.recalculate()}))}_measure(){const t=this.el,e=this.params.axis,s=this.params.gap,i=this.params.slidesPerView;if(!this._viewport)return;if(!this._realCount){this._empty=!0,this._disabled=!0,this._loopActive=!1,this._renderSlides=[],this._pos=[0],this._sizes=[],this._viewport.style.height="0px";return}this._empty=!1,this._rtl=this.params.dir==="rtl";const r=t.getBoundingClientRect(),a=Math.max(0,e==="x"?t.clientWidth||r.width:t.clientHeight||r.height);this._slides.forEach(c=>{i==="auto"?e==="x"?c.style.width="auto":c.style.height="auto":e==="x"?c.style.width="":c.style.height=""});let n=0;e==="y"&&a<1&&this._slides.forEach(c=>{n=Math.max(n,c.offsetHeight||0)});let o=[];if(i==="auto")o=this._slides.map(u=>{const f=e==="x"?u.getBoundingClientRect().width:u.getBoundingClientRect().height;return Math.max(40,Math.round(f*100)/100)}),o.reduce((u,f)=>u+f,0)+s*Math.max(0,o.length-1)<=1&&(o=this._slides.map(()=>Math.max(40,a||300)));else{const c=a>1?a:n*Math.ceil(i)||300,u=Math.max(1,(c-s*(i-1))/i);o=this._slides.map(()=>Math.round(u*100)/100)}if(this._slideSizes=o,this._slides.forEach((c,u)=>{e==="x"?(c.style.width=`${o[u]}px`,c.style.height=""):(c.style.height=`${o[u]}px`,c.style.width="")}),e==="x"){let c=0;this._slides.forEach(y=>{c=Math.max(c,y.offsetHeight||0)}),this._slideHeights=this._slides.map(y=>y.offsetHeight||0);const u=this._slideHeights[this._activeIndex]||c,f=this.params.autoHeight?u:c;if(f>0){this._viewport.style.transition=this.params.autoHeight?`height ${this._transitionDuration()}ms ${this.params.animation.ease}`:"none";const y=`${f}px`;this._viewport.style.height!==y&&(this._viewport.style.height=y)}}else if(this._slideHeights=o.slice(),a<1){const c=o[0]*(i==="auto"?1:i)+s*Math.max(0,(i==="auto"?1:Math.ceil(i))-1);this._viewport.style.height=`${Math.max(0,c)}px`}else this._viewport.style.height="";this._viewportSize=e==="y"&&a<1?this._viewport.clientHeight:a;let l=0;const h=o;h.forEach((c,u)=>{l+=c+(u<h.length-1?s:0)}),this._realExtent=l;const p=i==="auto"?1:Math.ceil(i);this._notEnough=this._realCount<=p&&l<=this._viewportSize+1,this._disabled=!!(this.params.fallback.disableIfNotEnoughSlides&&this._notEnough),this._loopActive=!!this.params.loop&&!this._disabled&&this._realCount>1&&(this.params.type!=="slide"||l>this._viewportSize+1),this._buildRender(),this._renderSlides.forEach(c=>{c.clone&&(e==="x"?(c.el.style.width=`${o[c.real]}px`,c.el.style.height=""):(c.el.style.height=`${o[c.real]}px`,c.el.style.width=""))}),this._pos=[],this._sizes=[];let _=0;this._renderSlides.forEach((c,u)=>{const f=o[c.real]||0;this._pos[u]=_,this._sizes[u]=f,_+=f+s}),this._renderExtent=Math.max(0,_-s),this._clipRenderIndex(),this._updateSlideClasses(),this._loadLazy()}_buildRender(){const t=this._cls,e=this._realCount,s=this.params.slidesPerView,i=this._loopActive&&this.params.type==="slide"&&e>1;if(Array.from(this._track.querySelectorAll("[data-zs-clone]")).forEach(l=>l.remove()),!i){this._usingClones=!1,this._pre=0,this._renderSlides=this._slides.map((l,h)=>({el:l,real:h,clone:!1}));return}const r=s==="auto"?2:Math.ceil(s),a=Math.min(e-1,Math.max(1,r+(this.params.slidesToScroll>1?1:0))),n=[],o=l=>{const h=this._slides[l].cloneNode(!0);return h.removeAttribute("id"),h.querySelectorAll("[id]").forEach(p=>p.removeAttribute("id")),h.querySelectorAll("a, button, input, select, textarea, [tabindex]").forEach(p=>{p.setAttribute("tabindex","-1")}),h.setAttribute("aria-hidden","true"),"inert"in h&&(h.inert=!0),h.setAttribute("data-zs-clone",""),h.classList.add(t.slide,t["slide-clone"]),h.classList.remove(t["slide-active"]),h};for(let l=e-a;l<e;l+=1){const h=o(l);this._track.insertBefore(h,this._slides[0]),n.push({el:h,real:l,clone:!0})}this._pre=a,this._slides.forEach((l,h)=>n.push({el:l,real:h,clone:!1}));for(let l=0;l<a;l+=1){const h=o(l);this._track.appendChild(h),n.push({el:h,real:l,clone:!0})}this._usingClones=!0,this._renderSlides=n}_clipRenderIndex(){const t=Math.max(0,this._renderSlides.length-1);Number.isFinite(this._renderIndex)||(this._renderIndex=this._renderIndexFor(this._activeIndex)),this._renderIndex=w(this._renderIndex,0,t),Number.isFinite(this._offset)||(this._offset=this._offsetFor(this._renderIndex))}_offsetFor(t){const e=this._pos[t]||0,s=this._sizes[t]||0,i=this.params.centeredSlides?(this._viewportSize-s)/2:0;let a=this._rtl&&this.params.axis==="x"?-(e+i):-(e-i);const n=this.params.slidesPerView;if(!this.params.centeredSlides&&!this._loopActive&&(n==="auto"||n>1)){const o=Math.max(0,(this._realExtent||0)-(this._viewportSize||0));a=Math.max(a,-o)}return a}_renderIndexFor(t){const e=this._realCount;if(!e)return 0;const s=(Math.round(t)%e+e)%e;if(!this._usingClones)return s;const i=[s+this._pre,s+this._pre-e,s+this._pre+e],r=Number.isFinite(this._renderIndex)?this._renderIndex:this._pre;let a=i[0],n=1/0;return i.forEach(o=>{if(o<0||o>=this._renderSlides.length)return;const l=Math.abs(o-r);l<n&&(n=l,a=o)}),a}_realIndexFor(t){const e=this._realCount;return e?((t-this._pre)%e+e)%e:0}_normalizeIndex(t){const e=this._realCount||this._slides.length;if(!e)return 0;const s=!!this.params.loop&&!this._disabled;let i=Math.round(Number(t)||0);return i<0&&(i=s?(i%e+e)%e:0),i>=e&&(i=s?i%e:e-1),i}_normalizeClones(){if(!this._usingClones)return!1;const t=this._realCount,e=this._pre;let s=this._renderIndex;return s<e?s+=t:s>=e+t&&(s-=t),s===this._renderIndex?!1:(this._renderIndex=s,this._activeIndex=this._realIndexFor(s),this._offset=this._offsetFor(s),this._applyInstant(this._computeStyles()),!0)}_cyclicRel(t,e){const s=this._renderSlides.length||this._realCount;let i=t-e;if(!this._loopActive||s<=1)return i;for(;i>s/2;)i-=s;for(;i<-s/2;)i+=s;return i}_warnCustomTransform(t){this._customWarned||(this._customWarned=!0,t?console.error("[ZikraSlider] custom.transform failed; falling back to neutral styles.",t):console.warn('[ZikraSlider] type "custom" needs a custom.transform({ ... }) callback.'))}_computeStyles(){const t=this.params.type,e=this.params.axis,s=this._rtl,i=s?-1:1,r=this.params.parallax||{},a=[],n=this._renderIndex,o=t==="slide"?n:Number.isFinite(this._float)?this._float:n,l=this.params.slidesPerView==="auto"?2:this.params.slidesPerView;return this._renderSlides.forEach((h,p)=>{const _=this._sizes[p]||0;let c=0,u=0,f=0,y=1,A=0,E=0,b=1,C=1,S=!0,D=!0,U=0;if(t==="slide"){const m=(this._pos[p]||0)+this._offset;if(e==="x"?c=s?-m:m:u=m,e==="x"){const g=s?-m:m;S=g<this._viewportSize+1&&g+_>-1,D=g<this._viewportSize-1&&g+_>1}else S=m<this._viewportSize+1&&m+_>-1,D=m<this._viewportSize-1&&m+_>1;if(r.enabled){const g=this.params.centeredSlides?(this._viewportSize-_)/2:0;U=(e==="x"?c:m)-g}C=p===n?3:1}else{const m=this._cyclicRel(p,o),g=Math.abs(m);if(r.enabled&&(U=m*(this._viewportSize||0)),t==="custom"){const z=this.params.custom&&this.params.custom.transform;let H=null;if(typeof z=="function")try{H=z({index:p,realIndex:h.real,relative:m,activeIndex:this._activeIndex,total:this._realCount,viewportSize:this._viewportSize,slideSize:_,axis:e,dir:this.params.dir,loop:!!this._loopActive})}catch(nt){this._warnCustomTransform(nt),H=null}else this._warnCustomTransform();const v=H&&typeof H=="object"?H:{};c=Number(v.x)||0,u=Number(v.y)||0,f=Number(v.z)||0,y=v.scale==null?1:Number(v.scale)||0,A=Number(v.rotate)||0,E=Number(v.rotateY)||0,b=v.opacity==null?1:w(Number(v.opacity)||0,0,1),C=v.zIndex==null?Math.round((1-Math.min(g,1))*100)+1:Math.round(Number(v.zIndex))||0,S=v.visible==null?b>.02:!!v.visible,D=v.interactive==null?S&&b>.05:!!v.interactive}else if(t==="fade"){b=w(1-g,0,1);const z=(e==="x"?_*.08:_*.06)*m;e==="x"?c=i*z:u=z,C=Math.round((1-g)*100)+1,S=b>.02}else if(t==="scale")b=w(1-g*.9,0,1),y=1-Math.min(g,1)*.14,C=Math.round((1-g)*100)+1,S=b>.02;else if(t==="coverflow"){const z=(e==="x"?_*.52:_*.4)*m*i;e==="x"?c=z:u=m*_*.3,E=w(-m,-1,1)*42*i,f=-g*130,y=1-g*.06,b=g>2.4?0:w(1-g*.2,0,1),C=100-Math.round(g*10),S=b>.02}else t==="stack"?(u=-Math.max(m,0)*20,y=1-Math.max(m,0)*.07,b=m<-.5?0:w(1-Math.max(m,0)*.2,0,1),C=60-Math.round(m*10),S=b>.02):t==="cards"&&(e==="x"?c=i*m*_*.2:u=m*_*.2,c+=i*Math.abs(m)*10,u+=Math.abs(m)*20,A=m*4*i,y=1-g*.06,b=g>2.2?0:w(1-g*.28,0,1),C=70-Math.round(g*10),S=b>.02);t!=="custom"&&(g<.5&&(C+=50),g>l+2&&(S=!1),D=S&&b>.05)}a.push({el:h.el,renderIndex:p,realIndex:h.real,clone:h.clone,active:p===n||t!=="slide"&&Math.abs(this._cyclicRel(p,o))<.5,visible:S,interactive:D,parallax:U,style:{x:c,y:u,z:f,scale:y,rotate:A,rotateY:E,opacity:b,zIndex:C}})}),a}_transformString(t){return`translate3d(${t.x}px, ${t.y}px, ${t.z}px) scale(${t.scale}) rotateZ(${t.rotate}deg) rotateY(${t.rotateY}deg)`}_parallaxElements(t){let e=this._parallaxCache.get(t);if(e)return e;e=[];const s=this.params.parallax;if(s&&s.enabled)try{t.querySelectorAll(s.selector||"[data-zs-parallax]").forEach(i=>{const r=i.getAttribute("data-zs-parallax"),a=r==null||r.trim()===""?NaN:parseFloat(r),n=Number.isFinite(a)?a:Number(s.factor)||0;n&&e.push({el:i,factor:n})})}catch{}return this._parallaxCache.set(t,e),e}_parallaxShift(t,e){const s=-(Number(t)||0)*e;return this.params.axis==="y"?{x:0,y:s}:{x:s,y:0}}_touchParallax(t){this._parallaxTouched.has(t)||this._parallaxTouched.set(t,{transform:t.style.transform,opacity:t.style.opacity,transition:t.style.transition,transitionDelay:t.style.transitionDelay,willChange:t.style.willChange})}_resetParallax(){this._parallaxTouched.forEach((t,e)=>{!e||!e.style||(t.transform?e.style.transform=t.transform:e.style.removeProperty("transform"),t.opacity?e.style.opacity=t.opacity:e.style.removeProperty("opacity"),t.transition?e.style.transition=t.transition:e.style.removeProperty("transition"),t.transitionDelay?e.style.transitionDelay=t.transitionDelay:e.style.removeProperty("transition-delay"),t.willChange?e.style.willChange=t.willChange:e.style.removeProperty("will-change"))}),this._parallaxTouched.clear(),this._innerState=new WeakMap,this._parallaxCache=new WeakMap}_applyParallax(t){const e=this.params.parallax;!e||!e.enabled||t.forEach(s=>{this._parallaxElements(s.el).forEach(({el:i,factor:r})=>{const a=this._parallaxShift(s.parallax,r);this._touchParallax(i),i.style.transition="none",i.style.transitionDelay="0ms",i.style.transform=`translate3d(${a.x}px, ${a.y}px, 0)`,this._innerState.set(i,a)})})}_applyInstant(t){t.forEach(({el:e,style:s})=>{e.style.transition="none",e.style.transform=this._transformString(s),e.style.opacity=String(s.opacity),e.style.zIndex=String(s.zIndex),this.params.type!=="slide"?e.style.pointerEvents=s.opacity>.05?"auto":"none":e.style.pointerEvents=""}),this._applyParallax(t),this._styleState=new Map(t.map(e=>[e.el,e.style])),this._updateSlideClasses(t)}_updateSlideClasses(t){const e=t||this._computeStyles(),s=this._cls,i=this.params.features.a11y.enabled;e.forEach(r=>{const a=r.el;a.classList.toggle(s["slide-active"],!!r.active),a.classList.toggle(s["slide-visible"],r.visible),i&&(r.clone||!r.visible?a.setAttribute("aria-hidden","true"):a.removeAttribute("aria-hidden"),!r.clone&&"inert"in a&&(a.inert=!r.interactive))}),this._lastEntries=e}_announce(){!this._live||!this.params.features.a11y.liveRegion||!this._realCount||(this._announceTimer&&(clearTimeout(this._announceTimer),this._timers.delete(this._announceTimer)),this._announceTimer=setTimeout(()=>{if(this.destroyed)return;const t=`Slide ${this._activeIndex+1} of ${this._realCount}`;this._live.textContent=t},120),this._timers.add(this._announceTimer))}_lazyTargets(){if(!this.params.features.lazyLoad.enabled||!this._renderSlides)return[];const t=this.params.features.lazyLoad.mode;if(t==="eager")return this._renderSlides;const e=t==="onDemand"?0:Math.ceil(this.params.slidesPerView==="auto"?2:this.params.slidesPerView)+1;return this._renderSlides.filter(s=>{const i=Math.abs(s.real-this._activeIndex);return this._loopActive?Math.min(i,this._realCount-i)<=e:i<=e})}_loadLazy(){const t=this.params.features.lazyLoad;if(!t.enabled)return;const e=t.placeholder;this._lazyTargets().forEach(({el:i})=>{i.querySelectorAll("img").forEach(r=>{const a=r.getAttribute("data-zs-src");if(!a)return;const n=r.getAttribute("data-zs-srcset");if(!r.getAttribute("src")&&e&&r.setAttribute("src",e),r.getAttribute("data-zs-loading")==="1")return;r.setAttribute("data-zs-loading","1");const o=()=>{r.removeAttribute("data-zs-loading"),this._requestRecalc()},l=()=>{r.removeAttribute("data-zs-loading");const h=t.onMediaError||this.params.fallback.onMediaError;if(typeof h=="function")try{h(r,a)}catch{}r.setAttribute("data-zs-error",a)};r.addEventListener("load",o,{once:!0}),r.addEventListener("error",l,{once:!0}),this._mediaLoadListeners.push({img:r,onLoad:o,onError:l}),n&&r.setAttribute("srcset",n),r.setAttribute("src",a),r.removeAttribute("data-zs-src"),r.removeAttribute("data-zs-srcset")})})}_connectMedia(){this._slides&&this._slides.forEach(t=>{t.querySelectorAll("img").forEach(e=>{if(e.getAttribute("data-zs-media")==="1")return;e.setAttribute("data-zs-media","1");const s=()=>this._requestRecalc(),i=()=>{const r=this.params.fallback.onMediaError;if(typeof r=="function")try{r(e,e.currentSrc||e.src)}catch{}};e.addEventListener("load",s),e.addEventListener("error",i),this._mediaLoadListeners.push({img:e,onLoad:s,onError:i})})})}_transitionDuration(){if(typeof this._speedOverride=="number")return Math.max(0,this._speedOverride);const t=this.params.animation.duration,e=t??this.params.speed;return Math.max(0,Number(e)||0)}_render({instant:t=!1}={}){if(this.destroyed||!this._renderSlides||!this._renderSlides.length)return;const e=this._computeStyles();if(this._targetEntries=e,t){this._cancelAnimations(),this._applyInstant(e),this._updateControls();return}this._animate(e)}_cancelAnimations(){this._animSeq=(this._animSeq||0)+1,this._animating=!1,this._animTimer&&(clearTimeout(this._animTimer),this._timers.delete(this._animTimer),this._animTimer=null),this._progressRaf&&(cancelAnimationFrame(this._progressRaf),this._progressRaf=null),this._waapi.forEach(t=>{try{t.cancel()}catch{}}),this._waapi=[],this._cls&&this.el.classList.remove(this._cls.animating)}_planTransition(t,e,s,i){const r=this._styleState||new Map,a=this._renderIndex,n=this._directionForward!==!1,o=[];return t.forEach(l=>{let h={...r.get(l.el)||l.style};const p=l.style,_=Math.abs(l.renderIndex-a);i||(e==="fade"&&l.active?h.opacity=0:e==="zoom"&&l.active?(h.scale=(p.scale==null?1:p.scale)*.86,h.opacity=Math.min(h.opacity,.7)):e==="slide-up"&&l.active?(h.y=(h.y||0)+56,h.opacity=Math.min(h.opacity,.4)):e==="flip"&&l.active&&(h.rotateY=(n?-1:1)*72)),i&&(h={...p,opacity:h.opacity});const c=e==="stagger"?Math.min(_,3)*Math.max(40,Math.round(s*.09)):0;o.push({el:l.el,from:h,to:p,delay:c,distance:_});const u=this.params.parallax;u&&u.enabled&&this._parallaxElements(l.el).forEach(({el:f,factor:y})=>{const A=this._parallaxShift(l.parallax,y),E=this._innerState.get(f),b=i||!E?{...A}:{x:E.x,y:E.y};this._touchParallax(f),o.push({el:f,inner:!0,from:b,to:A,delay:c,distance:_})})}),o}_animate(t){this._cancelAnimations();const e=this._animSeq+=1;let s=this._transitionDuration();const i=this.params.animation;let r=i.effect||"slide";const a=X();if(a&&this.params.fallback.reducedMotion==="instant"&&(s=0),a&&this.params.fallback.reducedMotion==="fade"&&(s=Math.min(s,220),r="fade"),s<=0){this._applyInstant(t),this._normalizeClones(),this._emitProgress(this.getProgress()),this._updateControls(),this._updateAutoHeight(),this._loadLazy(),this._updateSlideClasses(t),this._afterTransition();return}const n=this._planTransition(t,r,s,a);let o=0;n.forEach(_=>{o=Math.max(o,_.delay)}),this._animating=!0,this.el.classList.add(this._cls.animating);const l=this.getProgress(),h=this._pendingChange&&this._realCount>1?w(this._pendingChange.previousIndex/(this._realCount-1),0,1):l;this._emitProgress(h),this._startProgress(s+o,e,h,l);const p=st(i.library);if(p)try{const _=n.map(({el:c,from:u,to:f,delay:y,inner:A})=>(c.style.transition="none",A?(c.style.transform=`translate3d(${u.x}px, ${u.y}px, 0)`,Promise.resolve(p.adapter.fromTo(c,{...u,z:0,scale:1,rotate:0,rotateY:0,opacity:1},{...f,z:0,scale:1,rotate:0,rotateY:0,opacity:1},{duration:s,delay:y,easing:i.ease}))):(c.style.transform=this._transformString(u),c.style.opacity=String(u.opacity),c.style.zIndex=String(f.zIndex),Promise.resolve(p.adapter.fromTo(c,u,f,{duration:s,delay:y,easing:i.ease})))));Promise.all(_).then(()=>this._finishAnimation(e),()=>this._finishAnimation(e)),this._scheduleAnimationFinish(e,s+o+320),this._backend=p.label;return}catch{this._backend="css"}if(i.fallback==="waapi"&&this._supportsWaapi()){this._backend="waapi";const _=n.map(({el:c,from:u,to:f,delay:y,inner:A})=>{if(c.style.transition="none",A){c.style.transform=`translate3d(${u.x}px, ${u.y}px, 0)`;const b=c.animate([{transform:`translate3d(${u.x}px, ${u.y}px, 0)`},{transform:`translate3d(${f.x}px, ${f.y}px, 0)`}],{duration:s,delay:y,easing:i.ease||"ease-out",fill:"both"});return this._waapi.push(b),b.finished.catch(()=>{})}c.style.zIndex=String(f.zIndex);const E=c.animate([{transform:this._transformString(u),opacity:String(u.opacity)},{transform:this._transformString(f),opacity:String(f.opacity)}],{duration:s,delay:y,easing:i.ease||"ease-out",fill:"both"});return this._waapi.push(E),E.finished.catch(()=>{})});Promise.all(_).then(()=>this._finishAnimation(e)),this._scheduleAnimationFinish(e,s+o+140);return}this._backend="css",this._animateCss(n,s,i.ease,e)}_supportsWaapi(){return typeof Element<"u"&&typeof Element.prototype.animate=="function"}_animateCss(t,e,s,i){const r=s||"ease-out";t.forEach(({el:n,from:o,to:l,inner:h})=>{if(n.style.transition="none",n.style.transitionDelay="0ms",h){n.style.willChange="transform",n.style.transform=`translate3d(${o.x}px, ${o.y}px, 0)`;return}n.style.willChange="transform, opacity",n.style.transform=this._transformString(o),n.style.opacity=String(o.opacity),n.style.zIndex=String(l.zIndex)}),this.el.offsetWidth;let a=0;t.forEach(({el:n,to:o,delay:l,inner:h})=>{if(a=Math.max(a,l),h){n.style.transition=`transform ${e}ms ${r}`,n.style.transitionDelay=`${l}ms`,n.style.transform=`translate3d(${o.x}px, ${o.y}px, 0)`;return}n.style.transition=`transform ${e}ms ${r}, opacity ${e}ms ${r}`,n.style.transitionDelay=`${l}ms`,n.style.transform=this._transformString(o),n.style.opacity=String(o.opacity),n.style.zIndex=String(o.zIndex)}),this._scheduleAnimationFinish(i,e+a+40)}_startProgress(t,e,s=0,i=1){const r=typeof performance<"u"?performance.now():Date.now(),a=n=>{if(this.destroyed||this._animSeq!==e||!this._animating)return;const o=(n||Date.now())-r,l=w(o/Math.max(1,t),0,.995);this._emitProgress(s+(i-s)*l),this._progressRaf=requestAnimationFrame(a)};this._progressRaf=requestAnimationFrame(a)}_scheduleAnimationFinish(t,e){this._animTimer=setTimeout(()=>{this._timers.delete(this._animTimer),this._animTimer=null,this._finishAnimation(t)},Math.max(16,e)),this._timers.add(this._animTimer)}_finishAnimation(t){this.destroyed||t!==this._animSeq||!this._animating||(this._animating=!1,this._animTimer&&(clearTimeout(this._animTimer),this._timers.delete(this._animTimer),this._animTimer=null),this._progressRaf&&(cancelAnimationFrame(this._progressRaf),this._progressRaf=null),this._waapi.forEach(e=>{try{e.cancel()}catch{}}),this._waapi=[],this.el.classList.remove(this._cls.animating),this._applyInstant(this._targetEntries||this._computeStyles()),this._emitProgress(this.getProgress()),this._normalizeClones(),this._updateControls(),this._updateAutoHeight(),this._loadLazy(),this._announce(),this._afterTransition())}_updateAutoHeight(){if(!this.params.autoHeight||this.params.axis!=="x"||!this._slideHeights)return;const t=this._slideHeights[this._activeIndex]||0;t>0&&(this._viewport.style.height=`${t}px`)}_afterTransition(){this._speedOverride=null,this._announce();const t=this._pendingChange;this._pendingChange=null,t&&(this._emit("afterChange",{index:t.index,previousIndex:t.previousIndex,reason:t.reason}),this._notifyPlugins("onChange",{index:t.index,previousIndex:t.previousIndex,reason:t.reason}),this._notifySync("change")),this._syncOrigin=null,this._scheduleAutoplay()}_emitProgress(t){this._emit("progress",{progress:t,index:this._activeIndex}),this._notifySync("progress",t)}on(t,e){return typeof e!="function"||typeof t!="string"?this:(this._events.has(t)||this._events.set(t,new Set),this._events.get(t).add(e),this)}off(t,e){return this._events.has(t)?(e?this._events.get(t).delete(e):this._events.delete(t),this):this}_eventHandlers(t){const e=Array.from(this._events.get(t)||[]),s=this.params.on&&this.params.on[t];return typeof s=="function"?e.unshift(s):Array.isArray(s)&&e.unshift(...s.filter(i=>typeof i=="function")),e}_emit(t,e){this._eventHandlers(t).forEach(s=>{try{s(e)}catch(i){console.error(`[ZikraSlider] "${t}" listener failed:`,i)}})}_emitCancellable(t,e){const s=this._eventHandlers(t);for(const i of s)try{if(i(e)===!1)return!1}catch(r){console.error(`[ZikraSlider] "${t}" listener failed:`,r)}return!0}_initPlugins(){this._pluginList=[],J(this.params.plugins).forEach(t=>{if(!(!t||typeof t.init!="function"))try{t.init(this),this._pluginList.push(t)}catch(e){console.error(`[ZikraSlider] plugin "${t.name||"unnamed"}" init failed:`,e)}})}_notifyPlugins(t,e){this._pluginList.forEach(s=>{if(typeof s[t]=="function")try{s[t](this,e)}catch(i){console.error(`[ZikraSlider] plugin "${s.name||"unnamed"}" ${t} failed:`,i)}})}_settle(){this._animating&&this._finishAnimation(this._animSeq)}goTo(t,e={}){if(!this.ready||this.destroyed||!this._realCount)return this;this._animating&&this._settle(),this._momentum&&this._stopMomentum();const s=this._normalizeIndex(t),i=this._activeIndex,r=e.reason||"api";return s===i&&!e.force?(this._float=void 0,this._snapBack(this._transitionDuration()),this):!e.silent&&!this._emitCancellable("beforeChange",{index:s,previousIndex:i,reason:r})?this:(this._directionForward=s>=i,this._activeIndex=s,this._renderIndex=this._renderIndexFor(s),this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._pendingChange={index:s,previousIndex:i,reason:r},this._speedOverride=typeof e.speed=="number"?e.speed:null,this._updateControls(),this._pendingChange&&!this._loopActive&&!this.params.loop&&s===i?(this._pendingChange=null,this):(this._render(),this._animating===!1&&(this._speedOverride=null),this))}next(t={}){if(!this.ready||this.destroyed)return this;if(this._disabled)return this;const e=Math.max(1,this.params.slidesToScroll);return!this._loopActive&&this._activeIndex>=this._realCount-1?(this._snapBack(this._transitionDuration()),this):this.goTo(this._activeIndex+e,{...t,reason:t.reason||"next"})}prev(t={}){if(!this.ready||this.destroyed)return this;if(this._disabled)return this;const e=Math.max(1,this.params.slidesToScroll);return!this._loopActive&&this._activeIndex<=0?(this._snapBack(this._transitionDuration()),this):this.goTo(this._activeIndex-e,{...t,reason:t.reason||"prev"})}_snapBack(t){this._renderSlides.length&&(this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._speedOverride=typeof t=="number"?t:null,this._render(),this._animating||(this._speedOverride=null))}_nearestRenderIndex(t){let e=this._renderIndex,s=1/0;for(let i=0;i<this._renderSlides.length;i+=1){const r=Math.abs(this._offsetFor(i)-t);r<s&&(s=r,e=i)}return e}_resolveEl(t,e=!1){if(!t||!k())return null;if(L(t))return t;if(typeof t!="string")return null;try{return(e?this.el:document).querySelector(t)}catch{return null}}_buildControls(){this._buildArrows(),this._buildBullets()}_buildArrows(){const t=this.params.arrows,e=this._cls;if(!t.enabled)return;const s=this._resolveEl(t.prevEl),i=this._resolveEl(t.nextEl);if(this._arrowPrev=this._createArrow("prev",s),this._arrowNext=this._createArrow("next",i),!s||!i){const a=this._resolveEl(t.container);a?(!s&&this._arrowPrev&&(a.appendChild(this._arrowPrev),this._generatedArrows.push(this._arrowPrev)),!i&&this._arrowNext&&(a.appendChild(this._arrowNext),this._generatedArrows.push(this._arrowNext))):(this._arrowsWrap=I("div",`${e.arrows} ${t.className||""}`.trim()),!s&&this._arrowPrev&&this._arrowsWrap.appendChild(this._arrowPrev),!i&&this._arrowNext&&this._arrowsWrap.appendChild(this._arrowNext),this.el.appendChild(this._arrowsWrap),this._generated.push(this._arrowsWrap))}}_createArrow(t,e){const s=this.params.arrows,i=this._cls,r=`${i.arrow} ${i[`arrow-${t}`]}`,a=t==="prev"?s.prevClass:s.nextClass;let n=e;n?(this._controlSnapshots.push({el:n,className:n.className,html:n.innerHTML}),n.classList.add(...r.split(" ").filter(Boolean)),s.className&&s.className.split(/\s+/).filter(Boolean).forEach(l=>n.classList.add(l)),a&&a.split(/\s+/).filter(Boolean).forEach(l=>n.classList.add(l)),n.innerHTML.trim()||(n.innerHTML=t==="prev"?s.prevHtml:s.nextHtml)):(n=I("button",`${r} ${s.className||""} ${a||""}`.trim()),n.type="button",n.innerHTML=t==="prev"?s.prevHtml:s.nextHtml),n.setAttribute("aria-label",t==="prev"?s.ariaPrevLabel:s.ariaNextLabel);const o=l=>{l.preventDefault(),this._userInteracted(),t==="prev"?this.prev({reason:"arrow"}):this.next({reason:"arrow"})};return this._controlListeners||(this._controlListeners=[]),x(this._controlListeners,n,"click",o),this._arrowEls=this._arrowEls||{},this._arrowEls[t]=n,n}_buildBullets(){const t=this.params.bullets,e=this._cls;if(!t.enabled||!this._realCount)return;const s=this._resolveEl(t.el),i=s||I("div","");this._bulletsEl=i,this._bulletsExternal=!!s,this._bulletsSignature="";const r=[e.bullets,t.className||""];t.type==="fraction"&&r.push(e.fraction),t.type==="progressbar"&&r.push(e.progressbar),s&&this._controlSnapshots.push({el:i,className:i.className,html:i.innerHTML}),i.classList.add(...r.filter(Boolean)),s||(this.el.appendChild(i),this._generated.push(i)),this._controlListeners||(this._controlListeners=[]),this._bulletEls=[],this._progressFill=null,this._bulletsSignature="",this._ensureBulletContent()}_ensureBulletContent(){const t=this.params.bullets,e=t.type;if(!this._bulletsEl)return;if(e==="fraction"){this._bulletsSignature="fraction";return}if(e==="progressbar"){this._bulletsEl.innerHTML="";const i=I("div",this._cls["progressbar-fill"]);this._bulletsEl.appendChild(i),this._progressFill=i,this._bulletsEl.setAttribute("role","progressbar"),this._bulletsEl.setAttribute("aria-label","Slide progress"),this._bulletsEl.setAttribute("aria-valuemin","0"),this._bulletsEl.setAttribute("aria-valuemax","100"),this._bulletsEl.setAttribute("data-orientation",this.params.axis==="x"?"horizontal":"vertical"),this._bulletsSignature="progressbar";return}const s=`bullets:${this._realCount}:${t.bulletClass}:${!!t.render}`;if(s!==this._bulletsSignature){this._bulletsSignature=s,this._bulletsEl.innerHTML="",this._bulletEls=[];for(let i=0;i<this._realCount;i+=1){const r=I("button",`${this._cls.bullet} ${t.bulletClass||""}`.trim());r.type="button",r.setAttribute("aria-label",`Go to slide ${i+1}`),this._renderBulletContent(r,i,!1),t.clickable?x(this._controlListeners,r,"click",()=>{this._userInteracted(),this.goTo(i,{reason:"bullet"})}):r.setAttribute("disabled",""),this._bulletsEl.appendChild(r),this._bulletEls.push(r)}this._bulletsEl.setAttribute("role","group"),this._bulletsEl.setAttribute("aria-label","Slide pagination")}}_renderBulletContent(t,e,s){const i=this.params.bullets.render;if(typeof i!="function"){t.innerHTML="";return}let r;try{r=i({index:e,isActive:s,total:this._realCount})}catch{return}typeof r=="string"?t.innerHTML=r:r&&r.nodeType===1&&t.replaceChildren(r)}_updateControls(){if(this.destroyed)return;const t=this._cls,e=this._realCount||0,s=Number.isFinite(this._activeIndex)?this._activeIndex:0,i=this._loopActive,r=s<=0,a=s>=e-1,n=(h,p)=>{if(!h)return;const _=this.params.arrows,c=p==="prev"?r:a,u=this._disabled||!e||!i&&c;if("disabled"in h&&(h.disabled=u),h.setAttribute("aria-disabled",u?"true":"false"),_.hideAtEdges&&(h.classList.toggle(t["arrow-hidden"],!i&&c),h.setAttribute("aria-hidden",!i&&c?"true":"false")),typeof _.render=="function"){let f;try{f=_.render({direction:p,index:s,total:e})}catch{f=null}typeof f=="string"?h.innerHTML=f:f&&f.nodeType===1&&h.replaceChildren(f)}};n(this._arrowPrev||this._arrowEls&&this._arrowEls.prev,"prev"),n(this._arrowNext||this._arrowEls&&this._arrowEls.next,"next");const o=this.params.bullets;if(!o.enabled||!this._bulletsEl)return;const l=e>1?s/(e-1):0;if(o.type==="fraction"){const h=typeof o.formatFraction=="function"?o.formatFraction:rt.fraction;this._bulletsEl.textContent=h(s+1,e)}else if(o.type==="progressbar")this._progressFill&&(this.params.axis==="x"?(this._progressFill.style.width=`${(l*100).toFixed(2)}%`,this._progressFill.style.height=""):(this._progressFill.style.height=`${(l*100).toFixed(2)}%`,this._progressFill.style.width="")),this._bulletsEl.setAttribute("aria-valuenow",String(Math.round(l*100)));else{(!this._bulletEls||this._bulletEls.length!==e)&&this._ensureBulletContent();const h=o.activeClass||t["bullet-active"],p=o.dynamicBullets?2:1/0;(this._bulletEls||[]).forEach((_,c)=>{const u=c===s;_.classList.toggle(h,u),u?_.setAttribute("aria-current","true"):_.removeAttribute("aria-current"),_.classList.toggle(t["bullet-active"],u&&h!==t["bullet-active"]),o.dynamicBullets&&e>7?(_.hidden=Math.abs(c-s)>p,u&&this._renderBulletContent(_,c,!0)):(_.hidden=!1,this._renderBulletContent(_,c,u))})}}_destroyControls(){V(this._controlListeners||[]),this._controlListeners=[],(this._controlSnapshots||[]).forEach(({el:t,className:e,html:s})=>{t.className=e,t.innerHTML=s}),this._controlSnapshots=[],this._generatedArrows.forEach(t=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),this._generatedArrows=[],this._arrowsWrap&&this._arrowsWrap.isConnected&&this._arrowsWrap.remove(),this._bulletsEl&&!this._bulletsExternal&&this._bulletsEl.isConnected&&this._bulletsEl.remove(),this._arrowPrev=null,this._arrowNext=null,this._arrowEls=null,this._arrowsWrap=null,this._bulletsEl=null,this._bulletEls=[],this._progressFill=null,this._bulletsSignature=""}_startAutoplay(){this._autoplayPlaying=!!this.params.features.autoplay.enabled,this._stoppedByUser=!1,this._scheduleAutoplay()}play(){return!this.ready||this.destroyed||this._disabled?this:(this._autoplayPlaying=!0,this._stoppedByUser=!1,this._scheduleAutoplay(),this)}pause(){return this._autoplayPlaying=!1,this._clearAutoplay(),this}toggleAutoplay(){return this._autoplayPlaying?this.pause():this.play()}_clearAutoplay(){this._autoplayTimer&&(clearTimeout(this._autoplayTimer),this._timers.delete(this._autoplayTimer),this._autoplayTimer=null),this._autoplayRunning=!1}_canAutoplay(){const t=this.params.features.autoplay;return!(!this.ready||this.destroyed||!this._autoplayPlaying||this._stoppedByUser||!t.enabled||this._disabled||this._realCount<2||t.pauseOnHover&&this._hoverPaused||t.pauseOnFocus&&this._focusPaused||t.pauseOnHiddenTab&&typeof document<"u"&&document.hidden)}_scheduleAutoplay(){if(this._clearAutoplay(),!this._canAutoplay()||this._animating)return;if(!this._loopActive&&this._activeIndex>=this._realCount-1){this._autoplayPlaying=!1;return}const t=Math.max(250,Number(this.params.features.autoplay.delay)||4e3);this._autoplayRunning=!0,this._autoplayTimer=setTimeout(()=>{this._timers.delete(this._autoplayTimer),this._autoplayTimer=null,this._autoplayRunning=!1,!(!this._canAutoplay()||this._animating)&&(this.next({reason:"autoplay"}),this._animating||this._scheduleAutoplay())},t),this._timers.add(this._autoplayTimer)}_userInteracted(){this.ready&&this.params.features.autoplay.stopOnInteraction&&(this._stoppedByUser=!0,this._autoplayPlaying=!1,this._clearAutoplay())}_stepSize(){const t=this._renderIndex||0,s=(this._sizes&&this._sizes[t]||0)+this.params.gap;return s>0?s:Math.max(1,this._viewportSize)}_dragProgress(){if(!this._realCount||this._realCount<2)return 0;let t;if(this.params.type==="slide"){const e=this._drag,s=e?e.startOffset:this._offsetFor(this._activeIndex);t=this._activeIndex-(this._offset-s)/this._stepSize()}else t=Number.isFinite(this._float)?this._float:this._activeIndex;return w(t/(this._realCount-1),0,1)}_handlePointerDown(t){if(!this.ready||this.destroyed||!this.params.features.drag.enabled||this._disabled||t.pointerType==="mouse"&&t.button>0||this._drag)return;const e=`.${this._cls.arrow}, .${this._cls.bullets}, input, select, textarea, [data-zs-nodrag]`;t.target&&t.target.closest&&t.target.closest(e)||(this._momentum&&this._stopMomentum(),this._animating&&this._settle(),this._drag={pointerId:t.pointerId,pointerType:t.pointerType,startX:t.clientX,startY:t.clientY,startOffset:this._offset,startFloat:this._float,lastPrimary:0,lastT:typeof performance<"u"?performance.now():Date.now(),vx:0,started:!1})}_handlePointerMove(t){const e=this._drag;if(!e||this.destroyed||t.pointerId!==e.pointerId)return;if(!this.params.features.drag.enabled){this._drag=null;return}const s=this.params.features.drag,i=t.clientX-e.startX,r=t.clientY-e.startY,a=this.params.axis==="x"?i:r,n=this.params.axis==="x"?r:i;if(!e.started){if(Math.abs(a)<s.threshold&&Math.abs(n)<s.threshold)return;if(Math.abs(n)>Math.abs(a)*1.2){this._drag=null;return}e.started=!0,this.el.classList.add(this._cls.dragging);try{this.el.setPointerCapture(t.pointerId)}catch{}this._applyInstant(this._computeStyles()),this._userInteracted()}t.cancelable&&t.preventDefault();const o=this.params.axis==="x"&&this._rtl?-1:1;let l=e.startOffset+a*o;const h=s.rubberband?.35:0,p=this._offsetFor(0),_=this._offsetFor(this._renderSlides.length-1),c=Math.max(p,_),u=Math.min(p,_);l>c?l=c+(l-c)*h:l<u&&(l=u+(l-u)*h),this._offset=l,this.params.type!=="slide"&&(this._float=this._activeIndex-(l-e.startOffset)/this._stepSize()),this._applyInstant(this._computeStyles()),this._emitProgress(this._dragProgress());const f=typeof performance<"u"?performance.now():Date.now(),y=f-e.lastT;if(y>0){const A=(a-e.lastPrimary)/y;e.vx=e.vx*.7+A*.3,e.lastPrimary=a,e.lastT=f}}_handlePointerUp(t){const e=this._drag;if(!e||t.pointerId!==e.pointerId||(this._drag=null,!e.started))return;const s=this.params.features.drag;this.el.classList.remove(this._cls.dragging);try{this.el.hasPointerCapture&&this.el.hasPointerCapture(t.pointerId)&&this.el.releasePointerCapture(t.pointerId)}catch{}if(this._suppressClickUntil=(typeof performance<"u"?performance.now():Date.now())+140,t.type==="pointercancel"){this._snapBack(this._transitionDuration());return}const r=(typeof performance<"u"?performance.now():Date.now())-e.lastT>120,a=this.params.axis==="x"&&this._rtl?-1:1,n=r?0:e.vx*a,o=this._stepSize(),l=-(this._offset-e.startOffset)/o,h=-n/o;if(this._float!==void 0&&(this._float=void 0),this.params.freeMode){this._startMomentum(n);return}let p=0;if(Math.abs(n)>s.velocity?p=Math.sign(h)||Math.sign(-n):Math.abs(l)>.18&&(p=Math.sign(l)),!p){this._snapBack(this._transitionDuration());return}const _=this._activeIndex,c=_+p*Math.max(1,this.params.slidesToScroll);this.goTo(c,{reason:"drag"}),this._activeIndex===_&&this._snapBack(this._transitionDuration())}_startMomentum(t){this._drag&&(this._drag=null);let e=t,s=typeof performance<"u"?performance.now():Date.now();const i=this._stepSize(),r=this._offsetFor(0),a=this._offsetFor(this._renderSlides.length-1),n=Math.max(r,a),o=Math.min(r,a);this._momentum=!0;const l=()=>{if(this.destroyed||!this._momentum)return;const h=typeof performance<"u"?performance.now():Date.now(),p=Math.min(48,h-s);s=h,e*=Math.pow(.95,p/16.7);let _=this._offset+e*p;if((_>n||_<o)&&(_=w(_,o,n),e=0),this._offset=_,this.params.type!=="slide"&&(this._float=this._activeIndex-(_-this._offsetFor(this._renderIndex))/i),this._applyInstant(this._computeStyles()),this._emitProgress(this._dragProgress()),Math.abs(e)<.02||p===0){this._momentum=null,this._snapToNearest();return}this._momentum=requestAnimationFrame(l)};this._momentum=requestAnimationFrame(l)}_stopMomentum(){this._momentum&&typeof this._momentum=="number"&&cancelAnimationFrame(this._momentum),this._momentum=null}_snapToNearest(){if(!this._renderSlides.length)return;const t=this._nearestRenderIndex(this._offset),e=this._realIndexFor(t);this._renderIndex=t,this._float=void 0,this.goTo(e,{reason:"drag",speed:this._transitionDuration()}),this._animating||this._snapBack(this._transitionDuration())}_resolveSyncTargets(t=!1){const e=this.params.sync||{};if(!e.with){this._syncTargets.length&&this._unbindSync();return}const s=Array.isArray(e.with)?e.with.flat(1/0):[e.with],i=[];s.forEach(n=>{if(n instanceof F){n!==this&&i.push(n);return}const o=q(n);if(!o)return;const l=R.get(o);l&&l!==this&&i.push(l)});const r=Array.from(new Set(i)).filter(n=>n.ready&&!n.destroyed);!t&&r.length===this._syncTargets.length&&r.every((n,o)=>n===this._syncTargets[o])||(this._unbindSync(),this._syncTargets=r,this._syncListeners=this._syncListeners||[],r.length&&e.asThumbnails&&(r.forEach(n=>{this._thumbHostEl=n.el,n.el.setAttribute("data-zs-thumbnails",""),n._slides.forEach((o,l)=>{const h=p=>{this._suppressClickUntil&&performance.now()<this._suppressClickUntil||(p.preventDefault(),this._userInteracted(),this.goTo(l,{reason:"thumbnail"}))};x(this._syncListeners,o,"click",h)})}),this._notifySync("change")))}_unbindSync(){V(this._syncListeners||[]),this._syncListeners=[],this._thumbHostEl&&(this._thumbHostEl.removeAttribute("data-zs-thumbnails"),this._thumbHostEl=null),this._syncTargets=[],this._syncOrigin=null}_notifySync(t,e){if(!this._syncTargets||!this._syncTargets.length||this.destroyed)return;const s=this.params.sync.mode;this._syncTargets.forEach(i=>{if(!(i===this||i.destroyed||!i.ready)&&!(i._syncOrigin===this||i._syncingNow)&&!(t==="progress"&&s!=="progress"))try{t==="change"?i._syncApply(this,this._activeIndex,!1):i._syncApply(this,e,!0)}catch(r){console.error("[ZikraSlider] sync failed:",r)}})}_syncApply(t,e,s){if(!(this.destroyed||!this.ready)&&!this._syncingNow&&!(this._drag&&this._drag.started)){this._syncingNow=!0,this._syncOrigin=t;try{s?this._syncToProgress(e):e!==this._activeIndex||this._animating?this.goTo(e,{reason:"sync",silent:!0}):(this._float=void 0,this._snapBack(this._transitionDuration()))}finally{this._syncingNow=!1,this._animating||(this._syncOrigin=null)}}}_syncToProgress(t){if(this._disabled||this._realCount<2||!this._renderSlides.length)return;const e=w(t,0,1);if(this._animating&&this._settle(),this.params.type==="slide"){const s=this._pre||0,i=this._offsetFor(s),r=this._offsetFor(s+this._realCount-1);this._offset=i+(r-i)*e,this._activeIndex=Math.round(e*(this._realCount-1)),this._renderIndex=this._renderIndexFor(this._activeIndex),this._float=void 0,this._applyInstant(this._computeStyles())}else this._float=e*(this._realCount-1),this._activeIndex=Math.round(this._float),this._renderIndex=this._renderIndexFor(this._activeIndex),this._applyInstant(this._computeStyles());this._updateControls(),this._loadLazy(),this._syncOrigin=null}_setupBreakpoints(){const t=this.params.responsive;!$(t)||typeof window.matchMedia!="function"||Object.keys(t).forEach(e=>{const s=parseFloat(e)||0;let i;try{i=window.matchMedia(`(min-width: ${s}px)`)}catch{return}const r=()=>{clearTimeout(this._bpTimer),this._bpTimer=setTimeout(()=>{this._timers.delete(this._bpTimer),this._bpTimer=null,this.update({})},60),this._timers.add(this._bpTimer)};i.addEventListener?i.addEventListener("change",r):i.addListener&&i.addListener(r),this._breakpointListeners.push(()=>{i.removeEventListener?i.removeEventListener("change",r):i.removeListener&&i.removeListener(r)})})}_destroyBreakpoints(){this._breakpointListeners.forEach(t=>{try{t()}catch{}}),this._breakpointListeners=[],this._bpTimer&&(clearTimeout(this._bpTimer),this._timers.delete(this._bpTimer),this._bpTimer=null)}update(t={}){if(!this.ready||this.destroyed)return this;const e=this._activeIndex;this._drag=null,this._syncOrigin=null,this._cancelAnimations(),this._resetParallax(),this._stopMomentum(),this._destroyControls(),this._destroyBreakpoints(),this._userOptions=P(this._userOptions,t),this.params=this._resolveParams(),this._cls=this._buildClassNames();const s=this._cls,i=this.el;return T.forEach(r=>i.classList.remove(s[`type-${r}`])),W.forEach(r=>i.classList.remove(s[`axis-${r}`])),i.classList.remove("zs-no-js"),this.params.fallback.noJsClass&&i.classList.remove(this.params.fallback.noJsClass),i.classList.add(s[`type-${this.params.type}`],s[`axis-${this.params.axis}`]),i.classList.toggle(s["drag-enabled"],!!this.params.features.drag.enabled),this.params.dir==="rtl"?i.setAttribute("dir","rtl"):this._original.attrs.dir==null?i.removeAttribute("dir"):i.setAttribute("dir",this._original.attrs.dir),this._viewport.className=`${s.viewport} ${s[`type-${this.params.type}`]}`,this._buildControls(),this._activeIndex=e,this._measure(),this._activeIndex=this._normalizeIndex(e),this._renderIndex=this._renderIndexFor(this._activeIndex),this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._render({instant:!0}),this._updateControls(),this._resolveSyncTargets(!0),this._setupBreakpoints(),this._autoplayPlaying=!!this.params.features.autoplay.enabled,this._stoppedByUser=!1,this._scheduleAutoplay(),this}recalculate(){if(!this.ready||this.destroyed)return this;const t=this._activeIndex;return this._syncOrigin=null,this._measure(),this._activeIndex=this._normalizeIndex(t),this._renderIndex=this._renderIndexFor(this._activeIndex),this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._render({instant:!0}),this._updateControls(),this._loadLazy(),this._scheduleAutoplay(),this}getProgress(){return!this._realCount||this._realCount<2?0:w(this._activeIndex/(this._realCount-1),0,1)}getState(){return{index:this._activeIndex,realIndex:this._activeIndex,progress:this.getProgress(),total:this._realCount,slidesPerView:this.params.slidesPerView,isLooping:!!this._loopActive,isAutoplay:!!this._autoplayPlaying,isAutoplayRunning:!!this._autoplayRunning,isAnimating:!!this._animating,isDragging:!!(this._drag&&this._drag.started),isDisabled:!!this._disabled,isDestroyed:!!this.destroyed,isBroken:!this.ready,type:this.params.type,axis:this.params.axis,dir:this.params.dir,backend:this._backend||null}}_disconnectMedia(){this._mediaLoadListeners.forEach(({img:t,onLoad:e,onError:s})=>{t.removeEventListener("load",e),t.removeEventListener("error",s)}),this._mediaLoadListeners=[]}destroy(){if(this.destroyed)return this;if(!this.el)return this.destroyed=!0,this;this._emit("destroy",{instance:this}),this._clearAutoplay(),this._cancelAnimations(),this._resetParallax(),this._stopMomentum(),this._destroyBreakpoints(),this._disconnectMedia(),this._announceTimer&&(clearTimeout(this._announceTimer),this._timers.delete(this._announceTimer),this._announceTimer=null),this._timers.forEach(i=>clearTimeout(i)),this._timers.clear(),this._recalcRaf&&cancelAnimationFrame(this._recalcRaf),this._progressRaf&&cancelAnimationFrame(this._progressRaf),this._ro&&this._ro.disconnect(),N.forEach(i=>{!i||i===this||i.destroyed||(i._syncTargets=(i._syncTargets||[]).filter(r=>r!==this),i._thumbHostEl===this.el&&(i._thumbHostEl.removeAttribute("data-zs-thumbnails"),i._thumbHostEl=null))}),this._unbindSync(),this._notifyPlugins("destroy"),this._pluginList=[],this._destroyControls(),V(this._listeners),this._waapi=[];const t=this.el,e=this._slides||[],s=this._slideSnapshots||[];return e.forEach((i,r)=>{i.parentNode!==t&&t.appendChild(i);const a=s[r];a&&(i.className=a.className,a.id==null?i.removeAttribute("id"):i.setAttribute("id",a.id),["role","aria-roledescription","aria-label"].forEach(n=>{a[n]==null?i.removeAttribute(n):i.setAttribute(n,a[n])}),a["aria-hidden"]==null?i.removeAttribute("aria-hidden"):i.setAttribute("aria-hidden",a["aria-hidden"]),a.inert?i.setAttribute("inert",""):("inert"in i&&(i.inert=!1),i.removeAttribute("inert"))),i.removeAttribute("data-zs-index"),a&&(a.style==null?i.removeAttribute("style"):i.setAttribute("style",a.style))}),this._slideSnapshots=[],this._generated.forEach(i=>{i&&i.parentNode&&i.parentNode.removeChild(i)}),this._generated=[],this._viewport&&this._viewport.parentNode&&this._viewport.parentNode.removeChild(this._viewport),t.className=this._original.className,Object.keys(this._original.attrs||{}).forEach(i=>{const r=this._original.attrs[i];r==null?t.removeAttribute(i):t.setAttribute(i,r)}),!this._hadId&&t.id===this.id&&t.removeAttribute("id"),this._original.style==null?t.removeAttribute("style"):t.setAttribute("style",this._original.style),N.delete(this),R.delete(t),this._events.clear(),this.ready=!1,this.destroyed=!0,this}}function M(d,t){return new F(d,t)}return M.prototype=F.prototype,M.VERSION=B,M.defaults=Y,M.ZikraSlider=F,M.get=d=>{const t=q(d);return t&&R.get(t)||null},M.instances=()=>Array.from(N),M});
|
|
1
|
+
/*! Zikra Slider Pro v1.2.1 | MIT | zero dependencies */
|
|
2
|
+
(function(B,T){typeof module=="object"&&module.exports?module.exports=T():typeof define=="function"&&define.amd?define([],T):B.zikraslider=T()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:this,function(){"use strict";const B="1.2.1",T=["slide","fade","scale","coverflow","stack","cards","custom"],W=["x","y"],j=["ltr","rtl"],Z=["slide","fade","zoom","slide-up","flip","stagger"],Y={type:"slide",axis:"x",dir:"ltr",slidesPerView:1,slidesToScroll:1,gap:0,centeredSlides:!1,freeMode:!1,loop:!1,initialSlide:0,autoHeight:!1,speed:480,classPrefix:"zs-",parallax:{enabled:!1,selector:"[data-zs-parallax]",factor:.2},custom:{transform:null},sync:{with:null,mode:"index",asThumbnails:!1},arrows:{enabled:!0,prevEl:null,nextEl:null,container:null,className:"",prevClass:"",nextClass:"",prevHtml:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 18l-6-6 6-6"/></svg>',nextHtml:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 18l6-6-6-6"/></svg>',ariaPrevLabel:"Previous slide",ariaNextLabel:"Next slide",hideAtEdges:!1,render:null},bullets:{enabled:!0,el:null,type:"bullets",clickable:!0,dynamicBullets:!1,className:"",bulletClass:"",activeClass:"",formatFraction:null,render:null},features:{autoplay:{enabled:!1,delay:4200,pauseOnHover:!0,pauseOnFocus:!0,pauseOnHiddenTab:!0,stopOnInteraction:!1},drag:{enabled:!0,threshold:6,velocity:.4,rubberband:!0},keyboard:{enabled:!0,onlyWhenFocused:!0},wheel:{enabled:!1,passive:!0},lazyLoad:{enabled:!1,mode:"adjacent",placeholder:""},a11y:{enabled:!0,roleDescription:"carousel",liveRegion:!0}},responsive:null,animation:{library:"auto",effect:"slide",duration:null,ease:"cubic-bezier(0.22, 0.61, 0.36, 1)",fallback:"css"},fallback:{disableIfNotEnoughSlides:!0,reducedMotion:"fade",noJsClass:"zs-no-js",onMediaError:null},on:{},plugins:[]},k=()=>typeof window<"u"&&typeof document<"u",L=d=>!!(d&&d.nodeType===1),w=(d,t,e)=>Math.min(Math.max(d,t),e);function $(d){if(!d||typeof d!="object")return!1;const t=Object.getPrototypeOf(d);return t===Object.prototype||t===null}function P(...d){const t={};for(const e of d)if($(e))for(const s of Object.keys(e)){const i=e[s];i!==void 0&&($(i)?t[s]=P($(t[s])?t[s]:{},i):Array.isArray(i)?t[s]=i.slice():t[s]=i)}return t}function q(d){if(!k())return null;if(L(d))return d;if(typeof d=="string")try{return document.querySelector(d)}catch{return null}return d&&d.length&&L(d[0])?d[0]:null}function I(d,t){const e=document.createElement(d);return t&&(e.className=t),e}function x(d,t,e,s,i){!t||typeof t.addEventListener!="function"||(t.addEventListener(e,s,i),d.push({target:t,type:e,handler:s,options:i}))}function V(d){for(;d.length;){const{target:t,type:e,handler:s,options:i}=d.pop();try{t.removeEventListener(e,s,i)}catch{}}}function X(){if(!k()||typeof window.matchMedia!="function")return!1;try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function J(d){return Array.isArray(d)?d.flat(1/0).filter(Boolean):[]}const K=/^(linear|ease|ease-in|ease-out|ease-in-out|step-start|step-end|cubic-bezier\(.+\)|steps\(.+\))$/;function O(d,t){if(typeof d!="string")return t;const e=d.trim();return e&&!K.test(e)?e:t}function G(d){return{name:"gsap",fromTo(t,e,s,i){return new Promise(r=>{if(!L(t))return r();d.fromTo(t,{...e,x:e.x||0,y:e.y||0,z:e.z||0,scale:e.scale==null?1:e.scale,rotation:e.rotate||0,rotateY:e.rotateY||0,opacity:e.opacity==null?1:e.opacity},{...s,x:s.x||0,y:s.y||0,z:s.z||0,scale:s.scale==null?1:s.scale,rotation:s.rotate||0,rotateY:s.rotateY||0,opacity:s.opacity==null?1:s.opacity,duration:i.duration/1e3,delay:(i.delay||0)/1e3,ease:O(i.easing,"power2.out"),overwrite:"auto",onComplete:r,onInterrupt:r})})}}}function Q(d){const t=d&&typeof d.animate=="function";return{name:t?"anime-v4":"anime",fromTo(e,s,i,r){return new Promise(a=>{if(!L(e))return a();const n={targets:e,duration:r.duration,delay:r.delay||0,easing:O(r.easing,"easeOutQuad"),complete:a},o={translateX:i.x||0,translateY:i.y||0,translateZ:i.z||0,scale:i.scale==null?1:i.scale,rotate:`${i.rotate||0}deg`,rotateY:`${i.rotateY||0}deg`,opacity:i.opacity==null?1:i.opacity},l={translateX:s.x||0,translateY:s.y||0,translateZ:s.z||0,scale:s.scale==null?1:s.scale,rotate:`${s.rotate||0}deg`,rotateY:`${s.rotateY||0}deg`,opacity:s.opacity==null?1:s.opacity};try{if(t){const h=O(r.easing,null),p={duration:r.duration,delay:r.delay||0};h&&(p.ease=h),d.animate(e,{...l,...o},p).finished.then(a,a)}else d({...n,...l,keyframes:[{...l},{...o}]})}catch{a()}})}}}function tt(d){return{name:"motion",fromTo(t,e,s,i){if(!L(t))return Promise.resolve();const r={x:[e.x||0,s.x||0],y:[e.y||0,s.y||0],z:[e.z||0,s.z||0],scale:[e.scale==null?1:e.scale,s.scale==null?1:s.scale],rotate:[e.rotate||0,s.rotate||0],rotateY:[e.rotateY||0,s.rotateY||0],opacity:[e.opacity==null?1:e.opacity,s.opacity==null?1:s.opacity]},a=d.animate(t,r,{duration:i.duration/1e3,delay:(i.delay||0)/1e3,easing:O(i.easing,"ease-out")});return a&&typeof a.finished=="object"?a.finished.then(()=>{},()=>{}):Promise.resolve()}}}function et(d){return{name:"custom",fromTo(t,e,s,i){if(typeof d.fromTo=="function")return Promise.resolve(d.fromTo(t,e,s,i));if(typeof d.animate=="function")return Promise.resolve(d.animate(t,{from:e,to:s,...i}));throw new Error("Custom animation library must expose fromTo() or animate().")}}}function st(d){if(!k()||d==="none")return null;if(d&&typeof d=="object")return{adapter:et(d),label:"custom"};const t=window,e=d==="auto"?["gsap","anime","motion"]:[d];for(const s of e)try{if(s==="gsap"&&t.gsap&&typeof t.gsap.fromTo=="function")return{adapter:G(t.gsap),label:"gsap"};if(s==="anime"&&typeof t.anime=="function")return{adapter:Q(t.anime),label:"anime"};if(s==="motion"&&t.motion&&typeof t.motion.animate=="function")return{adapter:tt(t.motion),label:"motion"}}catch{return null}return null}let it=0;const R=new WeakMap,N=new Set,rt={"aria-prev":"Previous slide","aria-next":"Next slide",fraction:(d,t)=>`${d} / ${t}`},at=["role","aria-roledescription","aria-label","tabindex","dir","id"];class F{constructor(t,e={}){this.el=null,this.ready=!1,this.destroyed=!1,this._events=new Map,this._listeners=[],this._generated=[],this._generatedArrows=[],this._syncTargets=[],this._syncListeners=[],this._syncOrigin=null,this._pluginList=[],this._breakpointListeners=[],this._mediaLoadListeners=[],this._waapi=[],this._timers=new Set,this._controlListeners=[],this._controlSnapshots=[],this._slideSnapshots=[],this._innerState=new WeakMap,this._parallaxCache=new WeakMap,this._parallaxTouched=new Map;const s=q(t);if(!k()||!s){this.params=P(Y),this._cls=this._buildClassNames();return}this.el=s,this.id=s.id||`zs-${++it}`,R.set(s,this),N.add(this),this._init(e)}_init(t){const e=this.el;this._userOptions=P(t),this._hadId=!!e.id,this._original={className:e.className,style:e.getAttribute("style"),attrs:at.reduce((s,i)=>({...s,[i]:e.getAttribute(i)}),{}),children:Array.from(e.children)},this.params=this._resolveParams(),this._cls=this._buildClassNames(),this.params.fallback.noJsClass&&e.classList.remove(this.params.fallback.noJsClass),this._setupDom(),this._setupA11y(),this._connectMedia(),this._buildControls(),this._bindEvents(),this._setupBreakpoints(),this._activeIndex=this._normalizeIndex(this.params.initialSlide),this._renderIndex=this._activeIndex,this._offset=0,this._measure(),this._renderIndex=this._renderIndexFor(this._activeIndex),this._offset=this._offsetFor(this._renderIndex),this._render({instant:!0}),this._updateControls(),this._loadLazy(),this._initPlugins(),this._resolveSyncTargets(),this.ready=!0,e.classList.add(this._cls.initialized),this._emit("init",{instance:this}),this._startAutoplay(),N.forEach(s=>{s!==this&&s.ready&&s._resolveSyncTargets()})}_buildClassNames(){const t=this.params.classPrefix||"zs-",e={};return["slider","initialized","viewport","track","slide","slide-clone","slide-active","slide-visible","arrows","arrow","arrow-prev","arrow-next","arrow-hidden","bullets","bullet","bullet-active","fraction","progressbar","progressbar-fill","live","dragging","drag-enabled","disabled","animating"].forEach(s=>{e[s]=t+s}),T.forEach(s=>{e[`type-${s}`]=`${t}type-${s}`}),W.forEach(s=>{e[`axis-${s}`]=`${t}axis-${s}`}),e}_resolveParams(){const t=P(Y,this._userOptions);if(t.type=T.includes(t.type)?t.type:"slide",t.axis=W.includes(t.axis)?t.axis:"x",t.dir=j.includes(t.dir)?t.dir:"ltr",t.slidesPerView=t.slidesPerView==="auto"?"auto":Math.max(.1,Number(t.slidesPerView)||1),t.slidesToScroll=Math.max(1,Math.round(Number(t.slidesToScroll)||1)),t.gap=Math.max(0,Number(t.gap)||0),t.speed=Math.max(0,Number(t.speed)||0),Z.includes(t.animation.effect)||(t.animation.effect="slide"),["css","waapi"].includes(t.animation.fallback)||(t.animation.fallback="css"),[!0,!1,"auto"].includes(t.loop)||(t.loop=!!t.loop),$(t.responsive)&&typeof window.matchMedia=="function"){const e=Object.keys(t.responsive).map(s=>({key:s,min:parseFloat(s)||0,overrides:t.responsive[s]})).sort((s,i)=>i.min-s.min);for(const s of e)try{if(window.matchMedia(`(min-width: ${s.min}px)`).matches){Object.assign(t,P(t,s.overrides));break}}catch{}}return t}_setupDom(){const t=this.el,e=this._cls;t.classList.add(e.slider,e.initialized,e[`type-${this.params.type}`],e[`axis-${this.params.axis}`]),t.classList.toggle(e["drag-enabled"],!!this.params.features.drag.enabled),this.params.dir==="rtl"&&t.setAttribute("dir","rtl"),t.id||(t.id=this.id),this.params.features.a11y.enabled&&t.setAttribute("tabindex","0"),this._viewport=I("div",`${e.viewport} ${e[`type-${this.params.type}`]}`),this._track=I("div",e.track),this._generated.push(this._viewport),this._slides=Array.from(t.children),this._slideSnapshots=this._slides.map(s=>({className:s.className,style:s.getAttribute("style"),id:s.getAttribute("id"),role:s.getAttribute("role"),"aria-roledescription":s.getAttribute("aria-roledescription"),"aria-label":s.getAttribute("aria-label"),"aria-hidden":s.getAttribute("aria-hidden"),inert:s.hasAttribute("inert")})),this._slides.forEach((s,i)=>{s.classList.contains(e.slide)||s.classList.add(e.slide),s.setAttribute("data-zs-index",String(i)),this._track.appendChild(s)}),this._realCount=this._slides.length,this._viewport.appendChild(this._track),t.appendChild(this._viewport),this._baseSlideClasses=this._slides.map(s=>s.className),this._baseSlideStyles=this._slides.map(s=>s.getAttribute("style"))}_setupA11y(){const t=this.params.features.a11y;if(!t.enabled)return;const e=this.el;e.setAttribute("role","region"),e.setAttribute("aria-roledescription",t.roleDescription),e.hasAttribute("aria-label")||e.setAttribute("aria-label","Image carousel"),this._slides.forEach((s,i)=>{s.id||(s.id=`${this.id}-slide-${i}`),s.setAttribute("role","group"),s.setAttribute("aria-roledescription","slide"),s.setAttribute("aria-label",`${i+1} of ${this._realCount}`)}),t.liveRegion&&(this._live=I("div",this._cls.live),this._live.setAttribute("aria-live","polite"),this._live.setAttribute("aria-atomic","true"),this.el.appendChild(this._live),this._generated.push(this._live))}_bindEvents(){const t=this.el,e=this.params.features;this._onPointerDown=this._handlePointerDown.bind(this),this._onPointerMove=this._handlePointerMove.bind(this),this._onPointerUp=this._handlePointerUp.bind(this),x(this._listeners,t,"pointerdown",this._onPointerDown,{passive:!0}),x(this._listeners,t,"pointermove",this._onPointerMove,{passive:!1}),x(this._listeners,t,"pointerup",this._onPointerUp),x(this._listeners,t,"pointercancel",this._onPointerUp),x(this._listeners,t,"dragstart",i=>{this._drag&&this._drag.started&&i.preventDefault()}),e.autoplay.pauseOnHover&&(x(this._listeners,t,"pointerenter",i=>{i.pointerType==="mouse"&&(this._hoverPaused=!0)}),x(this._listeners,t,"pointerleave",()=>{this._hoverPaused=!1,this._scheduleAutoplay()})),e.autoplay.pauseOnFocus&&(x(this._listeners,t,"focusin",()=>{this._focusPaused=!0}),x(this._listeners,t,"focusout",i=>{t.contains(i.relatedTarget)||(this._focusPaused=!1,this._scheduleAutoplay())})),e.autoplay.pauseOnHiddenTab&&typeof document<"u"&&(this._onVisibility=()=>{document.hidden||this._scheduleAutoplay()},x(this._listeners,document,"visibilitychange",this._onVisibility)),x(this._listeners,t,"click",i=>{this._suppressClickUntil&&performance.now()<this._suppressClickUntil&&(i.preventDefault(),i.stopPropagation())},!0),this._onKeyDown=i=>{const r=this.params.features.keyboard;if(!r.enabled||this._disabled||i.metaKey||i.ctrlKey||i.altKey)return;const a=i.target;if(a&&/^(INPUT|TEXTAREA|SELECT)$/.test((a.tagName||"").toUpperCase()))return;if(!r.onlyWhenFocused&&a&&a.closest){const l=a.closest(`.${this._cls.slider}`);if(l&&l!==this.el)return}const n=this._rtl;let o;switch(i.key){case"ArrowLeft":o=n?"next":"prev";break;case"ArrowRight":o=n?"prev":"next";break;case"ArrowUp":o="prev";break;case"ArrowDown":o="next";break;case"Home":o="first";break;case"End":o="last";break;case"PageUp":o="prev";break;case"PageDown":o="next";break;default:return}i.preventDefault(),this._userInteracted(),o==="first"?this.goTo(0):o==="last"?this.goTo(this._realCount-1):o==="next"?this.next():this.prev()};const s=this.params.features.keyboard.onlyWhenFocused?t:document;x(this._listeners,s,"keydown",this._onKeyDown),this._onWheel=i=>{const r=this.params.features.wheel;if(!r.enabled)return;const a=Date.now();if(a-(this._wheelAt||0)<320)return;const n=this.params.axis==="x"&&Math.abs(i.deltaX)>Math.abs(i.deltaY)?i.deltaX:i.deltaY;Math.abs(n)<12||(this._wheelAt=a,r.passive||i.preventDefault(),this._userInteracted(),n>0?this.next():this.prev())},x(this._listeners,t,"wheel",this._onWheel,{passive:!!this.params.features.wheel.passive}),typeof ResizeObserver=="function"&&(this._ro=new ResizeObserver(()=>this._requestRecalc()),this._ro.observe(t),this._ro.observe(this._track)),this._onWindowResize=()=>this._requestRecalc(),x(this._listeners,window,"resize",this._onWindowResize),x(this._listeners,window,"orientationchange",this._onWindowResize),this.params.features.lazyLoad.enabled&&x(this._listeners,document,"zs:lazy",i=>{i.detail&&i.detail.instance===this&&this._loadLazy()})}_requestRecalc(){this.destroyed||!this.ready||this._recalcRaf||(this._recalcRaf=requestAnimationFrame(()=>{this._recalcRaf=null,!this.destroyed&&this.ready&&this.recalculate()}))}_measure(){const t=this.el,e=this.params.axis,s=this.params.gap,i=this.params.slidesPerView;if(!this._viewport)return;if(!this._realCount){this._empty=!0,this._disabled=!0,this._loopActive=!1,this._renderSlides=[],this._pos=[0],this._sizes=[],this._viewport.style.height="0px";return}this._empty=!1,this._rtl=this.params.dir==="rtl";const r=t.getBoundingClientRect(),a=Math.max(0,e==="x"?t.clientWidth||r.width:t.clientHeight||r.height);this._slides.forEach(c=>{i==="auto"?e==="x"?c.style.width="auto":c.style.height="auto":e==="x"?c.style.width="":c.style.height=""});let n=0;e==="y"&&a<1&&this._slides.forEach(c=>{n=Math.max(n,c.offsetHeight||0)});let o=[];if(i==="auto")o=this._slides.map(u=>{const f=e==="x"?u.getBoundingClientRect().width:u.getBoundingClientRect().height;return Math.max(40,Math.round(f*100)/100)}),o.reduce((u,f)=>u+f,0)+s*Math.max(0,o.length-1)<=1&&(o=this._slides.map(()=>Math.max(40,a||300)));else{const c=a>1?a:n*Math.ceil(i)||300,u=Math.max(1,(c-s*(i-1))/i);o=this._slides.map(()=>Math.round(u*100)/100)}if(this._slideSizes=o,this._slides.forEach((c,u)=>{e==="x"?(c.style.width=`${o[u]}px`,c.style.height=""):(c.style.height=`${o[u]}px`,c.style.width="")}),e==="x"){let c=0;this._slides.forEach(y=>{c=Math.max(c,y.offsetHeight||0)}),this._slideHeights=this._slides.map(y=>y.offsetHeight||0);const u=this._slideHeights[this._activeIndex]||c,f=this.params.autoHeight?u:c;if(f>0){this._viewport.style.transition=this.params.autoHeight?`height ${this._transitionDuration()}ms ${this.params.animation.ease}`:"none";const y=`${f}px`;this._viewport.style.height!==y&&(this._viewport.style.height=y)}}else if(this._slideHeights=o.slice(),a<1){const c=o[0]*(i==="auto"?1:i)+s*Math.max(0,(i==="auto"?1:Math.ceil(i))-1);this._viewport.style.height=`${Math.max(0,c)}px`}else this._viewport.style.height="";this._viewportSize=e==="y"&&a<1?this._viewport.clientHeight:a;let l=0;const h=o;h.forEach((c,u)=>{l+=c+(u<h.length-1?s:0)}),this._realExtent=l;const p=i==="auto"?1:Math.ceil(i);this._notEnough=this._realCount<=p&&l<=this._viewportSize+1,this._disabled=!!(this.params.fallback.disableIfNotEnoughSlides&&this._notEnough),this._loopActive=!!this.params.loop&&!this._disabled&&this._realCount>1&&(this.params.type!=="slide"||l>this._viewportSize+1),this._buildRender(),this._renderSlides.forEach(c=>{c.clone&&(e==="x"?(c.el.style.width=`${o[c.real]}px`,c.el.style.height=""):(c.el.style.height=`${o[c.real]}px`,c.el.style.width=""))}),this._pos=[],this._sizes=[];let _=0;this._renderSlides.forEach((c,u)=>{const f=o[c.real]||0;this._pos[u]=_,this._sizes[u]=f,_+=f+s}),this._renderExtent=Math.max(0,_-s),this._clipRenderIndex(),this._updateSlideClasses(),this._loadLazy()}_buildRender(){const t=this._cls,e=this._realCount,s=this.params.slidesPerView,i=this._loopActive&&this.params.type==="slide"&&e>1;if(Array.from(this._track.querySelectorAll("[data-zs-clone]")).forEach(l=>l.remove()),!i){this._usingClones=!1,this._pre=0,this._renderSlides=this._slides.map((l,h)=>({el:l,real:h,clone:!1}));return}const r=s==="auto"?2:Math.ceil(s),a=Math.min(e-1,Math.max(1,r+(this.params.slidesToScroll>1?1:0))),n=[],o=l=>{const h=this._slides[l].cloneNode(!0);return h.removeAttribute("id"),h.querySelectorAll("[id]").forEach(p=>p.removeAttribute("id")),h.querySelectorAll("a, button, input, select, textarea, [tabindex]").forEach(p=>{p.setAttribute("tabindex","-1")}),h.setAttribute("aria-hidden","true"),"inert"in h&&(h.inert=!0),h.setAttribute("data-zs-clone",""),h.classList.add(t.slide,t["slide-clone"]),h.classList.remove(t["slide-active"]),h};for(let l=e-a;l<e;l+=1){const h=o(l);this._track.insertBefore(h,this._slides[0]),n.push({el:h,real:l,clone:!0})}this._pre=a,this._slides.forEach((l,h)=>n.push({el:l,real:h,clone:!1}));for(let l=0;l<a;l+=1){const h=o(l);this._track.appendChild(h),n.push({el:h,real:l,clone:!0})}this._usingClones=!0,this._renderSlides=n}_clipRenderIndex(){const t=Math.max(0,this._renderSlides.length-1);Number.isFinite(this._renderIndex)||(this._renderIndex=this._renderIndexFor(this._activeIndex)),this._renderIndex=w(this._renderIndex,0,t),Number.isFinite(this._offset)||(this._offset=this._offsetFor(this._renderIndex))}_offsetFor(t){const e=this._pos[t]||0,s=this._sizes[t]||0,i=this.params.centeredSlides?(this._viewportSize-s)/2:0;let a=this._rtl&&this.params.axis==="x"?-(e+i):-(e-i);const n=this.params.slidesPerView;if(!this.params.centeredSlides&&!this._loopActive&&(n==="auto"||n>1)){const o=Math.max(0,(this._realExtent||0)-(this._viewportSize||0));a=Math.max(a,-o)}return a}_renderIndexFor(t){const e=this._realCount;if(!e)return 0;const s=(Math.round(t)%e+e)%e;if(!this._usingClones)return s;const i=[s+this._pre,s+this._pre-e,s+this._pre+e],r=Number.isFinite(this._renderIndex)?this._renderIndex:this._pre;let a=i[0],n=1/0;return i.forEach(o=>{if(o<0||o>=this._renderSlides.length)return;const l=Math.abs(o-r);l<n&&(n=l,a=o)}),a}_realIndexFor(t){const e=this._realCount;return e?((t-this._pre)%e+e)%e:0}_normalizeIndex(t){const e=this._realCount||this._slides.length;if(!e)return 0;const s=!!this.params.loop&&!this._disabled;let i=Math.round(Number(t)||0);return i<0&&(i=s?(i%e+e)%e:0),i>=e&&(i=s?i%e:e-1),i}_normalizeClones(){if(!this._usingClones)return!1;const t=this._realCount,e=this._pre;let s=this._renderIndex;return s<e?s+=t:s>=e+t&&(s-=t),s===this._renderIndex?!1:(this._renderIndex=s,this._activeIndex=this._realIndexFor(s),this._offset=this._offsetFor(s),this._applyInstant(this._computeStyles()),!0)}_cyclicRel(t,e){const s=this._renderSlides.length||this._realCount;let i=t-e;if(!this._loopActive||s<=1)return i;for(;i>s/2;)i-=s;for(;i<-s/2;)i+=s;return i}_warnCustomTransform(t){this._customWarned||(this._customWarned=!0,t?console.error("[ZikraSlider] custom.transform failed; falling back to neutral styles.",t):console.warn('[ZikraSlider] type "custom" needs a custom.transform({ ... }) callback.'))}_computeStyles(){const t=this.params.type,e=this.params.axis,s=this._rtl,i=s?-1:1,r=this.params.parallax||{},a=[],n=this._renderIndex,o=t==="slide"?n:Number.isFinite(this._float)?this._float:n,l=this.params.slidesPerView==="auto"?2:this.params.slidesPerView;return this._renderSlides.forEach((h,p)=>{const _=this._sizes[p]||0;let c=0,u=0,f=0,y=1,A=0,E=0,b=1,C=1,S=!0,D=!0,U=0;if(t==="slide"){const m=(this._pos[p]||0)+this._offset;if(e==="x"?c=s?-m:m:u=m,e==="x"){const g=s?-m:m;S=g<this._viewportSize+1&&g+_>-1,D=g<this._viewportSize-1&&g+_>1}else S=m<this._viewportSize+1&&m+_>-1,D=m<this._viewportSize-1&&m+_>1;if(r.enabled){const g=this.params.centeredSlides?(this._viewportSize-_)/2:0;U=(e==="x"?c:m)-g}C=p===n?3:1}else{const m=this._cyclicRel(p,o),g=Math.abs(m);if(r.enabled&&(U=m*(this._viewportSize||0)),t==="custom"){const z=this.params.custom&&this.params.custom.transform;let H=null;if(typeof z=="function")try{H=z({index:p,realIndex:h.real,relative:m,activeIndex:this._activeIndex,total:this._realCount,viewportSize:this._viewportSize,slideSize:_,axis:e,dir:this.params.dir,loop:!!this._loopActive})}catch(nt){this._warnCustomTransform(nt),H=null}else this._warnCustomTransform();const v=H&&typeof H=="object"?H:{};c=Number(v.x)||0,u=Number(v.y)||0,f=Number(v.z)||0,y=v.scale==null?1:Number(v.scale)||0,A=Number(v.rotate)||0,E=Number(v.rotateY)||0,b=v.opacity==null?1:w(Number(v.opacity)||0,0,1),C=v.zIndex==null?Math.round((1-Math.min(g,1))*100)+1:Math.round(Number(v.zIndex))||0,S=v.visible==null?b>.02:!!v.visible,D=v.interactive==null?S&&b>.05:!!v.interactive}else if(t==="fade"){b=w(1-g,0,1);const z=(e==="x"?_*.08:_*.06)*m;e==="x"?c=i*z:u=z,C=Math.round((1-g)*100)+1,S=b>.02}else if(t==="scale")b=w(1-g*.9,0,1),y=1-Math.min(g,1)*.14,C=Math.round((1-g)*100)+1,S=b>.02;else if(t==="coverflow"){const z=(e==="x"?_*.52:_*.4)*m*i;e==="x"?c=z:u=m*_*.3,E=w(-m,-1,1)*42*i,f=-g*130,y=1-g*.06,b=g>2.4?0:w(1-g*.2,0,1),C=100-Math.round(g*10),S=b>.02}else t==="stack"?(u=-Math.max(m,0)*20,y=1-Math.max(m,0)*.07,b=m<-.5?0:w(1-Math.max(m,0)*.2,0,1),C=60-Math.round(m*10),S=b>.02):t==="cards"&&(e==="x"?c=i*m*_*.2:u=m*_*.2,c+=i*Math.abs(m)*10,u+=Math.abs(m)*20,A=m*4*i,y=1-g*.06,b=g>2.2?0:w(1-g*.28,0,1),C=70-Math.round(g*10),S=b>.02);t!=="custom"&&(g<.5&&(C+=50),g>l+2&&(S=!1),D=S&&b>.05)}a.push({el:h.el,renderIndex:p,realIndex:h.real,clone:h.clone,active:p===n||t!=="slide"&&Math.abs(this._cyclicRel(p,o))<.5,visible:S,interactive:D,parallax:U,style:{x:c,y:u,z:f,scale:y,rotate:A,rotateY:E,opacity:b,zIndex:C}})}),a}_transformString(t){return`translate3d(${t.x}px, ${t.y}px, ${t.z}px) scale(${t.scale}) rotateZ(${t.rotate}deg) rotateY(${t.rotateY}deg)`}_parallaxElements(t){let e=this._parallaxCache.get(t);if(e)return e;e=[];const s=this.params.parallax;if(s&&s.enabled)try{t.querySelectorAll(s.selector||"[data-zs-parallax]").forEach(i=>{const r=i.getAttribute("data-zs-parallax"),a=r==null||r.trim()===""?NaN:parseFloat(r),n=Number.isFinite(a)?a:Number(s.factor)||0;n&&e.push({el:i,factor:n})})}catch{}return this._parallaxCache.set(t,e),e}_parallaxShift(t,e){const s=-(Number(t)||0)*e;return this.params.axis==="y"?{x:0,y:s}:{x:s,y:0}}_touchParallax(t){this._parallaxTouched.has(t)||this._parallaxTouched.set(t,{transform:t.style.transform,opacity:t.style.opacity,transition:t.style.transition,transitionDelay:t.style.transitionDelay,willChange:t.style.willChange})}_resetParallax(){this._parallaxTouched.forEach((t,e)=>{!e||!e.style||(t.transform?e.style.transform=t.transform:e.style.removeProperty("transform"),t.opacity?e.style.opacity=t.opacity:e.style.removeProperty("opacity"),t.transition?e.style.transition=t.transition:e.style.removeProperty("transition"),t.transitionDelay?e.style.transitionDelay=t.transitionDelay:e.style.removeProperty("transition-delay"),t.willChange?e.style.willChange=t.willChange:e.style.removeProperty("will-change"))}),this._parallaxTouched.clear(),this._innerState=new WeakMap,this._parallaxCache=new WeakMap}_applyParallax(t){const e=this.params.parallax;!e||!e.enabled||t.forEach(s=>{this._parallaxElements(s.el).forEach(({el:i,factor:r})=>{const a=this._parallaxShift(s.parallax,r);this._touchParallax(i),i.style.transition="none",i.style.transitionDelay="0ms",i.style.transform=`translate3d(${a.x}px, ${a.y}px, 0)`,this._innerState.set(i,a)})})}_applyInstant(t){t.forEach(({el:e,style:s})=>{e.style.transition="none",e.style.transform=this._transformString(s),e.style.opacity=String(s.opacity),e.style.zIndex=String(s.zIndex),this.params.type!=="slide"?e.style.pointerEvents=s.opacity>.05?"auto":"none":e.style.pointerEvents=""}),this._applyParallax(t),this._styleState=new Map(t.map(e=>[e.el,e.style])),this._updateSlideClasses(t)}_updateSlideClasses(t){const e=t||this._computeStyles(),s=this._cls,i=this.params.features.a11y.enabled;e.forEach(r=>{const a=r.el;a.classList.toggle(s["slide-active"],!!r.active),a.classList.toggle(s["slide-visible"],r.visible),i&&(r.clone||!r.visible?a.setAttribute("aria-hidden","true"):a.removeAttribute("aria-hidden"),!r.clone&&"inert"in a&&(a.inert=!r.interactive))}),this._lastEntries=e}_announce(){!this._live||!this.params.features.a11y.liveRegion||!this._realCount||(this._announceTimer&&(clearTimeout(this._announceTimer),this._timers.delete(this._announceTimer)),this._announceTimer=setTimeout(()=>{if(this.destroyed)return;const t=`Slide ${this._activeIndex+1} of ${this._realCount}`;this._live.textContent=t},120),this._timers.add(this._announceTimer))}_lazyTargets(){if(!this.params.features.lazyLoad.enabled||!this._renderSlides)return[];const t=this.params.features.lazyLoad.mode;if(t==="eager")return this._renderSlides;const e=t==="onDemand"?0:Math.ceil(this.params.slidesPerView==="auto"?2:this.params.slidesPerView)+1;return this._renderSlides.filter(s=>{const i=Math.abs(s.real-this._activeIndex);return this._loopActive?Math.min(i,this._realCount-i)<=e:i<=e})}_loadLazy(){const t=this.params.features.lazyLoad;if(!t.enabled)return;const e=t.placeholder;this._lazyTargets().forEach(({el:i})=>{i.querySelectorAll("img").forEach(r=>{const a=r.getAttribute("data-zs-src");if(!a)return;const n=r.getAttribute("data-zs-srcset");if(!r.getAttribute("src")&&e&&r.setAttribute("src",e),r.getAttribute("data-zs-loading")==="1")return;r.setAttribute("data-zs-loading","1");const o=()=>{r.removeAttribute("data-zs-loading"),this._requestRecalc()},l=()=>{r.removeAttribute("data-zs-loading");const h=t.onMediaError||this.params.fallback.onMediaError;if(typeof h=="function")try{h(r,a)}catch{}r.setAttribute("data-zs-error",a)};r.addEventListener("load",o,{once:!0}),r.addEventListener("error",l,{once:!0}),this._mediaLoadListeners.push({img:r,onLoad:o,onError:l}),n&&r.setAttribute("srcset",n),r.setAttribute("src",a),r.removeAttribute("data-zs-src"),r.removeAttribute("data-zs-srcset")})})}_connectMedia(){this._slides&&this._slides.forEach(t=>{t.querySelectorAll("img").forEach(e=>{if(e.getAttribute("data-zs-media")==="1")return;e.setAttribute("data-zs-media","1");const s=()=>this._requestRecalc(),i=()=>{const r=this.params.fallback.onMediaError;if(typeof r=="function")try{r(e,e.currentSrc||e.src)}catch{}};e.addEventListener("load",s),e.addEventListener("error",i),this._mediaLoadListeners.push({img:e,onLoad:s,onError:i})})})}_transitionDuration(){if(typeof this._speedOverride=="number")return Math.max(0,this._speedOverride);const t=this.params.animation.duration,e=t??this.params.speed;return Math.max(0,Number(e)||0)}_render({instant:t=!1}={}){if(this.destroyed||!this._renderSlides||!this._renderSlides.length)return;const e=this._computeStyles();if(this._targetEntries=e,t){this._cancelAnimations(),this._applyInstant(e),this._updateControls();return}this._animate(e)}_cancelAnimations(){this._animSeq=(this._animSeq||0)+1,this._animating=!1,this._animTimer&&(clearTimeout(this._animTimer),this._timers.delete(this._animTimer),this._animTimer=null),this._progressRaf&&(cancelAnimationFrame(this._progressRaf),this._progressRaf=null),this._waapi.forEach(t=>{try{t.cancel()}catch{}}),this._waapi=[],this._cls&&this.el.classList.remove(this._cls.animating)}_planTransition(t,e,s,i){const r=this._styleState||new Map,a=this._renderIndex,n=this._directionForward!==!1,o=[];return t.forEach(l=>{let h={...r.get(l.el)||l.style};const p=l.style,_=Math.abs(l.renderIndex-a);i||(e==="fade"&&l.active?h.opacity=0:e==="zoom"&&l.active?(h.scale=(p.scale==null?1:p.scale)*.86,h.opacity=Math.min(h.opacity,.7)):e==="slide-up"&&l.active?(h.y=(h.y||0)+56,h.opacity=Math.min(h.opacity,.4)):e==="flip"&&l.active&&(h.rotateY=(n?-1:1)*72)),i&&(h={...p,opacity:h.opacity});const c=e==="stagger"?Math.min(_,3)*Math.max(40,Math.round(s*.09)):0;o.push({el:l.el,from:h,to:p,delay:c,distance:_});const u=this.params.parallax;u&&u.enabled&&this._parallaxElements(l.el).forEach(({el:f,factor:y})=>{const A=this._parallaxShift(l.parallax,y),E=this._innerState.get(f),b=i||!E?{...A}:{x:E.x,y:E.y};this._touchParallax(f),o.push({el:f,inner:!0,from:b,to:A,delay:c,distance:_})})}),o}_animate(t){this._cancelAnimations();const e=this._animSeq+=1;let s=this._transitionDuration();const i=this.params.animation;let r=i.effect||"slide";const a=X();if(a&&this.params.fallback.reducedMotion==="instant"&&(s=0),a&&this.params.fallback.reducedMotion==="fade"&&(s=Math.min(s,220),r="fade"),s<=0){this._applyInstant(t),this._normalizeClones(),this._emitProgress(this.getProgress()),this._updateControls(),this._updateAutoHeight(),this._loadLazy(),this._updateSlideClasses(t),this._afterTransition();return}const n=this._planTransition(t,r,s,a);let o=0;n.forEach(_=>{o=Math.max(o,_.delay)}),this._animating=!0,this.el.classList.add(this._cls.animating);const l=this.getProgress(),h=this._pendingChange&&this._realCount>1?w(this._pendingChange.previousIndex/(this._realCount-1),0,1):l;this._emitProgress(h),this._startProgress(s+o,e,h,l);const p=st(i.library);if(p)try{const _=n.map(({el:c,from:u,to:f,delay:y,inner:A})=>(c.style.transition="none",A?(c.style.transform=`translate3d(${u.x}px, ${u.y}px, 0)`,Promise.resolve(p.adapter.fromTo(c,{...u,z:0,scale:1,rotate:0,rotateY:0,opacity:1},{...f,z:0,scale:1,rotate:0,rotateY:0,opacity:1},{duration:s,delay:y,easing:i.ease}))):(c.style.transform=this._transformString(u),c.style.opacity=String(u.opacity),c.style.zIndex=String(f.zIndex),Promise.resolve(p.adapter.fromTo(c,u,f,{duration:s,delay:y,easing:i.ease})))));Promise.all(_).then(()=>this._finishAnimation(e),()=>this._finishAnimation(e)),this._scheduleAnimationFinish(e,s+o+320),this._backend=p.label;return}catch{this._backend="css"}if(i.fallback==="waapi"&&this._supportsWaapi()){this._backend="waapi";const _=n.map(({el:c,from:u,to:f,delay:y,inner:A})=>{if(c.style.transition="none",A){c.style.transform=`translate3d(${u.x}px, ${u.y}px, 0)`;const b=c.animate([{transform:`translate3d(${u.x}px, ${u.y}px, 0)`},{transform:`translate3d(${f.x}px, ${f.y}px, 0)`}],{duration:s,delay:y,easing:i.ease||"ease-out",fill:"both"});return this._waapi.push(b),b.finished.catch(()=>{})}c.style.zIndex=String(f.zIndex);const E=c.animate([{transform:this._transformString(u),opacity:String(u.opacity)},{transform:this._transformString(f),opacity:String(f.opacity)}],{duration:s,delay:y,easing:i.ease||"ease-out",fill:"both"});return this._waapi.push(E),E.finished.catch(()=>{})});Promise.all(_).then(()=>this._finishAnimation(e)),this._scheduleAnimationFinish(e,s+o+140);return}this._backend="css",this._animateCss(n,s,i.ease,e)}_supportsWaapi(){return typeof Element<"u"&&typeof Element.prototype.animate=="function"}_animateCss(t,e,s,i){const r=s||"ease-out";t.forEach(({el:n,from:o,to:l,inner:h})=>{if(n.style.transition="none",n.style.transitionDelay="0ms",h){n.style.willChange="transform",n.style.transform=`translate3d(${o.x}px, ${o.y}px, 0)`;return}n.style.willChange="transform, opacity",n.style.transform=this._transformString(o),n.style.opacity=String(o.opacity),n.style.zIndex=String(l.zIndex)}),this.el.offsetWidth;let a=0;t.forEach(({el:n,to:o,delay:l,inner:h})=>{if(a=Math.max(a,l),h){n.style.transition=`transform ${e}ms ${r}`,n.style.transitionDelay=`${l}ms`,n.style.transform=`translate3d(${o.x}px, ${o.y}px, 0)`;return}n.style.transition=`transform ${e}ms ${r}, opacity ${e}ms ${r}`,n.style.transitionDelay=`${l}ms`,n.style.transform=this._transformString(o),n.style.opacity=String(o.opacity),n.style.zIndex=String(o.zIndex)}),this._scheduleAnimationFinish(i,e+a+40)}_startProgress(t,e,s=0,i=1){const r=typeof performance<"u"?performance.now():Date.now(),a=n=>{if(this.destroyed||this._animSeq!==e||!this._animating)return;const o=(n||Date.now())-r,l=w(o/Math.max(1,t),0,.995);this._emitProgress(s+(i-s)*l),this._progressRaf=requestAnimationFrame(a)};this._progressRaf=requestAnimationFrame(a)}_scheduleAnimationFinish(t,e){this._animTimer=setTimeout(()=>{this._timers.delete(this._animTimer),this._animTimer=null,this._finishAnimation(t)},Math.max(16,e)),this._timers.add(this._animTimer)}_finishAnimation(t){this.destroyed||t!==this._animSeq||!this._animating||(this._animating=!1,this._animTimer&&(clearTimeout(this._animTimer),this._timers.delete(this._animTimer),this._animTimer=null),this._progressRaf&&(cancelAnimationFrame(this._progressRaf),this._progressRaf=null),this._waapi.forEach(e=>{try{e.cancel()}catch{}}),this._waapi=[],this.el.classList.remove(this._cls.animating),this._applyInstant(this._targetEntries||this._computeStyles()),this._emitProgress(this.getProgress()),this._normalizeClones(),this._updateControls(),this._updateAutoHeight(),this._loadLazy(),this._announce(),this._afterTransition())}_updateAutoHeight(){if(!this.params.autoHeight||this.params.axis!=="x"||!this._slideHeights)return;const t=this._slideHeights[this._activeIndex]||0;t>0&&(this._viewport.style.height=`${t}px`)}_afterTransition(){this._speedOverride=null,this._announce();const t=this._pendingChange;this._pendingChange=null,t&&(this._emit("afterChange",{index:t.index,previousIndex:t.previousIndex,reason:t.reason}),this._notifyPlugins("onChange",{index:t.index,previousIndex:t.previousIndex,reason:t.reason}),this._notifySync("change")),this._syncOrigin=null,this._scheduleAutoplay()}_emitProgress(t){this._emit("progress",{progress:t,index:this._activeIndex}),this._notifySync("progress",t)}on(t,e){return typeof e!="function"||typeof t!="string"?this:(this._events.has(t)||this._events.set(t,new Set),this._events.get(t).add(e),this)}off(t,e){return this._events.has(t)?(e?this._events.get(t).delete(e):this._events.delete(t),this):this}_eventHandlers(t){const e=Array.from(this._events.get(t)||[]),s=this.params.on&&this.params.on[t];return typeof s=="function"?e.unshift(s):Array.isArray(s)&&e.unshift(...s.filter(i=>typeof i=="function")),e}_emit(t,e){this._eventHandlers(t).forEach(s=>{try{s(e)}catch(i){console.error(`[ZikraSlider] "${t}" listener failed:`,i)}})}_emitCancellable(t,e){const s=this._eventHandlers(t);for(const i of s)try{if(i(e)===!1)return!1}catch(r){console.error(`[ZikraSlider] "${t}" listener failed:`,r)}return!0}_initPlugins(){this._pluginList=[],J(this.params.plugins).forEach(t=>{if(!(!t||typeof t.init!="function"))try{t.init(this),this._pluginList.push(t)}catch(e){console.error(`[ZikraSlider] plugin "${t.name||"unnamed"}" init failed:`,e)}})}_notifyPlugins(t,e){this._pluginList.forEach(s=>{if(typeof s[t]=="function")try{s[t](this,e)}catch(i){console.error(`[ZikraSlider] plugin "${s.name||"unnamed"}" ${t} failed:`,i)}})}_settle(){this._animating&&this._finishAnimation(this._animSeq)}goTo(t,e={}){if(!this.ready||this.destroyed||!this._realCount)return this;this._animating&&this._settle(),this._momentum&&this._stopMomentum();const s=this._normalizeIndex(t),i=this._activeIndex,r=e.reason||"api";return s===i&&!e.force?(this._float=void 0,this._snapBack(this._transitionDuration()),this):!e.silent&&!this._emitCancellable("beforeChange",{index:s,previousIndex:i,reason:r})?this:(this._directionForward=s>=i,this._activeIndex=s,this._renderIndex=this._renderIndexFor(s),this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._pendingChange={index:s,previousIndex:i,reason:r},this._speedOverride=typeof e.speed=="number"?e.speed:null,this._updateControls(),this._pendingChange&&!this._loopActive&&!this.params.loop&&s===i?(this._pendingChange=null,this):(this._render(),this._animating===!1&&(this._speedOverride=null),this))}next(t={}){if(!this.ready||this.destroyed)return this;if(this._disabled)return this;const e=Math.max(1,this.params.slidesToScroll);return!this._loopActive&&this._activeIndex>=this._realCount-1?(this._snapBack(this._transitionDuration()),this):this.goTo(this._activeIndex+e,{...t,reason:t.reason||"next"})}prev(t={}){if(!this.ready||this.destroyed)return this;if(this._disabled)return this;const e=Math.max(1,this.params.slidesToScroll);return!this._loopActive&&this._activeIndex<=0?(this._snapBack(this._transitionDuration()),this):this.goTo(this._activeIndex-e,{...t,reason:t.reason||"prev"})}_snapBack(t){this._renderSlides.length&&(this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._speedOverride=typeof t=="number"?t:null,this._render(),this._animating||(this._speedOverride=null))}_nearestRenderIndex(t){let e=this._renderIndex,s=1/0;for(let i=0;i<this._renderSlides.length;i+=1){const r=Math.abs(this._offsetFor(i)-t);r<s&&(s=r,e=i)}return e}_resolveEl(t,e=!1){if(!t||!k())return null;if(L(t))return t;if(typeof t!="string")return null;try{return(e?this.el:document).querySelector(t)}catch{return null}}_buildControls(){this._buildArrows(),this._buildBullets()}_buildArrows(){const t=this.params.arrows,e=this._cls;if(!t.enabled)return;const s=this._resolveEl(t.prevEl),i=this._resolveEl(t.nextEl);if(this._arrowPrev=this._createArrow("prev",s),this._arrowNext=this._createArrow("next",i),!s||!i){const a=this._resolveEl(t.container);a?(!s&&this._arrowPrev&&(a.appendChild(this._arrowPrev),this._generatedArrows.push(this._arrowPrev)),!i&&this._arrowNext&&(a.appendChild(this._arrowNext),this._generatedArrows.push(this._arrowNext))):(this._arrowsWrap=I("div",`${e.arrows} ${t.className||""}`.trim()),!s&&this._arrowPrev&&this._arrowsWrap.appendChild(this._arrowPrev),!i&&this._arrowNext&&this._arrowsWrap.appendChild(this._arrowNext),this.el.appendChild(this._arrowsWrap),this._generated.push(this._arrowsWrap))}}_createArrow(t,e){const s=this.params.arrows,i=this._cls,r=`${i.arrow} ${i[`arrow-${t}`]}`,a=t==="prev"?s.prevClass:s.nextClass;let n=e;n?(this._controlSnapshots.push({el:n,className:n.className,html:n.innerHTML}),n.classList.add(...r.split(" ").filter(Boolean)),s.className&&s.className.split(/\s+/).filter(Boolean).forEach(l=>n.classList.add(l)),a&&a.split(/\s+/).filter(Boolean).forEach(l=>n.classList.add(l)),n.innerHTML.trim()||(n.innerHTML=t==="prev"?s.prevHtml:s.nextHtml)):(n=I("button",`${r} ${s.className||""} ${a||""}`.trim()),n.type="button",n.innerHTML=t==="prev"?s.prevHtml:s.nextHtml),n.setAttribute("aria-label",t==="prev"?s.ariaPrevLabel:s.ariaNextLabel);const o=l=>{l.preventDefault(),this._userInteracted(),t==="prev"?this.prev({reason:"arrow"}):this.next({reason:"arrow"})};return this._controlListeners||(this._controlListeners=[]),x(this._controlListeners,n,"click",o),this._arrowEls=this._arrowEls||{},this._arrowEls[t]=n,n}_buildBullets(){const t=this.params.bullets,e=this._cls;if(!t.enabled||!this._realCount)return;const s=this._resolveEl(t.el),i=s||I("div","");this._bulletsEl=i,this._bulletsExternal=!!s,this._bulletsSignature="";const r=[e.bullets,t.className||""];t.type==="fraction"&&r.push(e.fraction),t.type==="progressbar"&&r.push(e.progressbar),s&&this._controlSnapshots.push({el:i,className:i.className,html:i.innerHTML}),i.classList.add(...r.filter(Boolean)),s||(this.el.appendChild(i),this._generated.push(i)),this._controlListeners||(this._controlListeners=[]),this._bulletEls=[],this._progressFill=null,this._bulletsSignature="",this._ensureBulletContent()}_ensureBulletContent(){const t=this.params.bullets,e=t.type;if(!this._bulletsEl)return;if(e==="fraction"){this._bulletsSignature="fraction";return}if(e==="progressbar"){this._bulletsEl.innerHTML="";const i=I("div",this._cls["progressbar-fill"]);this._bulletsEl.appendChild(i),this._progressFill=i,this._bulletsEl.setAttribute("role","progressbar"),this._bulletsEl.setAttribute("aria-label","Slide progress"),this._bulletsEl.setAttribute("aria-valuemin","0"),this._bulletsEl.setAttribute("aria-valuemax","100"),this._bulletsEl.setAttribute("data-orientation",this.params.axis==="x"?"horizontal":"vertical"),this._bulletsSignature="progressbar";return}const s=`bullets:${this._realCount}:${t.bulletClass}:${!!t.render}`;if(s!==this._bulletsSignature){this._bulletsSignature=s,this._bulletsEl.innerHTML="",this._bulletEls=[];for(let i=0;i<this._realCount;i+=1){const r=I("button",`${this._cls.bullet} ${t.bulletClass||""}`.trim());r.type="button",r.setAttribute("aria-label",`Go to slide ${i+1}`),this._renderBulletContent(r,i,!1),t.clickable?x(this._controlListeners,r,"click",()=>{this._userInteracted(),this.goTo(i,{reason:"bullet"})}):r.setAttribute("disabled",""),this._bulletsEl.appendChild(r),this._bulletEls.push(r)}this._bulletsEl.setAttribute("role","group"),this._bulletsEl.setAttribute("aria-label","Slide pagination")}}_renderBulletContent(t,e,s){const i=this.params.bullets.render;if(typeof i!="function"){t.innerHTML="";return}let r;try{r=i({index:e,isActive:s,total:this._realCount})}catch{return}typeof r=="string"?t.innerHTML=r:r&&r.nodeType===1&&t.replaceChildren(r)}_updateControls(){if(this.destroyed)return;const t=this._cls,e=this._realCount||0,s=Number.isFinite(this._activeIndex)?this._activeIndex:0,i=this._loopActive,r=s<=0,a=s>=e-1,n=(h,p)=>{if(!h)return;const _=this.params.arrows,c=p==="prev"?r:a,u=this._disabled||!e||!i&&c;if("disabled"in h&&(h.disabled=u),h.setAttribute("aria-disabled",u?"true":"false"),_.hideAtEdges&&(h.classList.toggle(t["arrow-hidden"],!i&&c),h.setAttribute("aria-hidden",!i&&c?"true":"false")),typeof _.render=="function"){let f;try{f=_.render({direction:p,index:s,total:e})}catch{f=null}typeof f=="string"?h.innerHTML=f:f&&f.nodeType===1&&h.replaceChildren(f)}};n(this._arrowPrev||this._arrowEls&&this._arrowEls.prev,"prev"),n(this._arrowNext||this._arrowEls&&this._arrowEls.next,"next");const o=this.params.bullets;if(!o.enabled||!this._bulletsEl)return;const l=e>1?s/(e-1):0;if(o.type==="fraction"){const h=typeof o.formatFraction=="function"?o.formatFraction:rt.fraction;this._bulletsEl.textContent=h(s+1,e)}else if(o.type==="progressbar")this._progressFill&&(this.params.axis==="x"?(this._progressFill.style.width=`${(l*100).toFixed(2)}%`,this._progressFill.style.height=""):(this._progressFill.style.height=`${(l*100).toFixed(2)}%`,this._progressFill.style.width="")),this._bulletsEl.setAttribute("aria-valuenow",String(Math.round(l*100)));else{(!this._bulletEls||this._bulletEls.length!==e)&&this._ensureBulletContent();const h=o.activeClass||t["bullet-active"],p=o.dynamicBullets?2:1/0;(this._bulletEls||[]).forEach((_,c)=>{const u=c===s;_.classList.toggle(h,u),u?_.setAttribute("aria-current","true"):_.removeAttribute("aria-current"),_.classList.toggle(t["bullet-active"],u&&h!==t["bullet-active"]),o.dynamicBullets&&e>7?(_.hidden=Math.abs(c-s)>p,u&&this._renderBulletContent(_,c,!0)):(_.hidden=!1,this._renderBulletContent(_,c,u))})}}_destroyControls(){V(this._controlListeners||[]),this._controlListeners=[],(this._controlSnapshots||[]).forEach(({el:t,className:e,html:s})=>{t.className=e,t.innerHTML=s}),this._controlSnapshots=[],this._generatedArrows.forEach(t=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),this._generatedArrows=[],this._arrowsWrap&&this._arrowsWrap.isConnected&&this._arrowsWrap.remove(),this._bulletsEl&&!this._bulletsExternal&&this._bulletsEl.isConnected&&this._bulletsEl.remove(),this._arrowPrev=null,this._arrowNext=null,this._arrowEls=null,this._arrowsWrap=null,this._bulletsEl=null,this._bulletEls=[],this._progressFill=null,this._bulletsSignature=""}_startAutoplay(){this._autoplayPlaying=!!this.params.features.autoplay.enabled,this._stoppedByUser=!1,this._scheduleAutoplay()}play(){return!this.ready||this.destroyed||this._disabled?this:(this._autoplayPlaying=!0,this._stoppedByUser=!1,this._scheduleAutoplay(),this)}pause(){return this._autoplayPlaying=!1,this._clearAutoplay(),this}toggleAutoplay(){return this._autoplayPlaying?this.pause():this.play()}_clearAutoplay(){this._autoplayTimer&&(clearTimeout(this._autoplayTimer),this._timers.delete(this._autoplayTimer),this._autoplayTimer=null),this._autoplayRunning=!1}_canAutoplay(){const t=this.params.features.autoplay;return!(!this.ready||this.destroyed||!this._autoplayPlaying||this._stoppedByUser||!t.enabled||this._disabled||this._realCount<2||t.pauseOnHover&&this._hoverPaused||t.pauseOnFocus&&this._focusPaused||t.pauseOnHiddenTab&&typeof document<"u"&&document.hidden)}_scheduleAutoplay(){if(this._clearAutoplay(),!this._canAutoplay()||this._animating)return;if(!this._loopActive&&this._activeIndex>=this._realCount-1){this._autoplayPlaying=!1;return}const t=Math.max(250,Number(this.params.features.autoplay.delay)||4e3);this._autoplayRunning=!0,this._autoplayTimer=setTimeout(()=>{this._timers.delete(this._autoplayTimer),this._autoplayTimer=null,this._autoplayRunning=!1,!(!this._canAutoplay()||this._animating)&&(this.next({reason:"autoplay"}),this._animating||this._scheduleAutoplay())},t),this._timers.add(this._autoplayTimer)}_userInteracted(){this.ready&&this.params.features.autoplay.stopOnInteraction&&(this._stoppedByUser=!0,this._autoplayPlaying=!1,this._clearAutoplay())}_stepSize(){const t=this._renderIndex||0,s=(this._sizes&&this._sizes[t]||0)+this.params.gap;return s>0?s:Math.max(1,this._viewportSize)}_dragProgress(){if(!this._realCount||this._realCount<2)return 0;let t;if(this.params.type==="slide"){const e=this._drag,s=e?e.startOffset:this._offsetFor(this._activeIndex);t=this._activeIndex-(this._offset-s)/this._stepSize()}else t=Number.isFinite(this._float)?this._float:this._activeIndex;return w(t/(this._realCount-1),0,1)}_handlePointerDown(t){if(!this.ready||this.destroyed||!this.params.features.drag.enabled||this._disabled||t.pointerType==="mouse"&&t.button>0||this._drag)return;const e=`.${this._cls.arrow}, .${this._cls.bullets}, input, select, textarea, [data-zs-nodrag]`;t.target&&t.target.closest&&t.target.closest(e)||(this._momentum&&this._stopMomentum(),this._animating&&this._settle(),this._drag={pointerId:t.pointerId,pointerType:t.pointerType,startX:t.clientX,startY:t.clientY,startOffset:this._offset,startFloat:this._float,lastPrimary:0,lastT:typeof performance<"u"?performance.now():Date.now(),vx:0,started:!1})}_handlePointerMove(t){const e=this._drag;if(!e||this.destroyed||t.pointerId!==e.pointerId)return;if(!this.params.features.drag.enabled){this._drag=null;return}const s=this.params.features.drag,i=t.clientX-e.startX,r=t.clientY-e.startY,a=this.params.axis==="x"?i:r,n=this.params.axis==="x"?r:i;if(!e.started){if(Math.abs(a)<s.threshold&&Math.abs(n)<s.threshold)return;if(Math.abs(n)>Math.abs(a)*1.2){this._drag=null;return}e.started=!0,this.el.classList.add(this._cls.dragging);try{this.el.setPointerCapture(t.pointerId)}catch{}this._applyInstant(this._computeStyles()),this._userInteracted()}t.cancelable&&t.preventDefault();const o=this.params.axis==="x"&&this._rtl?-1:1;let l=e.startOffset+a*o;const h=s.rubberband?.35:0,p=this._offsetFor(0),_=this._offsetFor(this._renderSlides.length-1),c=Math.max(p,_),u=Math.min(p,_);l>c?l=c+(l-c)*h:l<u&&(l=u+(l-u)*h),this._offset=l,this.params.type!=="slide"&&(this._float=this._activeIndex-(l-e.startOffset)/this._stepSize()),this._applyInstant(this._computeStyles()),this._emitProgress(this._dragProgress());const f=typeof performance<"u"?performance.now():Date.now(),y=f-e.lastT;if(y>0){const A=(a-e.lastPrimary)/y;e.vx=e.vx*.7+A*.3,e.lastPrimary=a,e.lastT=f}}_handlePointerUp(t){const e=this._drag;if(!e||t.pointerId!==e.pointerId||(this._drag=null,!e.started))return;const s=this.params.features.drag;this.el.classList.remove(this._cls.dragging);try{this.el.hasPointerCapture&&this.el.hasPointerCapture(t.pointerId)&&this.el.releasePointerCapture(t.pointerId)}catch{}if(this._suppressClickUntil=(typeof performance<"u"?performance.now():Date.now())+140,t.type==="pointercancel"){this._snapBack(this._transitionDuration());return}const r=(typeof performance<"u"?performance.now():Date.now())-e.lastT>120,a=this.params.axis==="x"&&this._rtl?-1:1,n=r?0:e.vx*a,o=this._stepSize(),l=-(this._offset-e.startOffset)/o,h=-n/o;if(this._float!==void 0&&(this._float=void 0),this.params.freeMode){this._startMomentum(n);return}let p=0;if(Math.abs(n)>s.velocity?p=Math.sign(h)||Math.sign(-n):Math.abs(l)>.18&&(p=Math.sign(l)),!p){this._snapBack(this._transitionDuration());return}const _=this._activeIndex,c=_+p*Math.max(1,this.params.slidesToScroll);this.goTo(c,{reason:"drag"}),this._activeIndex===_&&this._snapBack(this._transitionDuration())}_startMomentum(t){this._drag&&(this._drag=null);let e=t,s=typeof performance<"u"?performance.now():Date.now();const i=this._stepSize(),r=this._offsetFor(0),a=this._offsetFor(this._renderSlides.length-1),n=Math.max(r,a),o=Math.min(r,a);this._momentum=!0;const l=()=>{if(this.destroyed||!this._momentum)return;const h=typeof performance<"u"?performance.now():Date.now(),p=Math.min(48,h-s);s=h,e*=Math.pow(.95,p/16.7);let _=this._offset+e*p;if((_>n||_<o)&&(_=w(_,o,n),e=0),this._offset=_,this.params.type!=="slide"&&(this._float=this._activeIndex-(_-this._offsetFor(this._renderIndex))/i),this._applyInstant(this._computeStyles()),this._emitProgress(this._dragProgress()),Math.abs(e)<.02||p===0){this._momentum=null,this._snapToNearest();return}this._momentum=requestAnimationFrame(l)};this._momentum=requestAnimationFrame(l)}_stopMomentum(){this._momentum&&typeof this._momentum=="number"&&cancelAnimationFrame(this._momentum),this._momentum=null}_snapToNearest(){if(!this._renderSlides.length)return;const t=this._nearestRenderIndex(this._offset),e=this._realIndexFor(t);this._renderIndex=t,this._float=void 0,this.goTo(e,{reason:"drag",speed:this._transitionDuration()}),this._animating||this._snapBack(this._transitionDuration())}_resolveSyncTargets(t=!1){const e=this.params.sync||{};if(!e.with){this._syncTargets.length&&this._unbindSync();return}const s=Array.isArray(e.with)?e.with.flat(1/0):[e.with],i=[];s.forEach(n=>{if(n instanceof F){n!==this&&i.push(n);return}const o=q(n);if(!o)return;const l=R.get(o);l&&l!==this&&i.push(l)});const r=Array.from(new Set(i)).filter(n=>n.ready&&!n.destroyed);!t&&r.length===this._syncTargets.length&&r.every((n,o)=>n===this._syncTargets[o])||(this._unbindSync(),this._syncTargets=r,this._syncListeners=this._syncListeners||[],r.length&&e.asThumbnails&&(r.forEach(n=>{this._thumbHostEl=n.el,n.el.setAttribute("data-zs-thumbnails",""),n._slides.forEach((o,l)=>{const h=p=>{this._suppressClickUntil&&performance.now()<this._suppressClickUntil||(p.preventDefault(),this._userInteracted(),this.goTo(l,{reason:"thumbnail"}))};x(this._syncListeners,o,"click",h)})}),this._notifySync("change")))}_unbindSync(){V(this._syncListeners||[]),this._syncListeners=[],this._thumbHostEl&&(this._thumbHostEl.removeAttribute("data-zs-thumbnails"),this._thumbHostEl=null),this._syncTargets=[],this._syncOrigin=null}_notifySync(t,e){if(!this._syncTargets||!this._syncTargets.length||this.destroyed)return;const s=this.params.sync.mode;this._syncTargets.forEach(i=>{if(!(i===this||i.destroyed||!i.ready)&&!(i._syncOrigin===this||i._syncingNow)&&!(t==="progress"&&s!=="progress"))try{t==="change"?i._syncApply(this,this._activeIndex,!1):i._syncApply(this,e,!0)}catch(r){console.error("[ZikraSlider] sync failed:",r)}})}_syncApply(t,e,s){if(!(this.destroyed||!this.ready)&&!this._syncingNow&&!(this._drag&&this._drag.started)){this._syncingNow=!0,this._syncOrigin=t;try{s?this._syncToProgress(e):e!==this._activeIndex||this._animating?this.goTo(e,{reason:"sync",silent:!0}):(this._float=void 0,this._snapBack(this._transitionDuration()))}finally{this._syncingNow=!1,this._animating||(this._syncOrigin=null)}}}_syncToProgress(t){if(this._disabled||this._realCount<2||!this._renderSlides.length)return;const e=w(t,0,1);if(this._animating&&this._settle(),this.params.type==="slide"){const s=this._pre||0,i=this._offsetFor(s),r=this._offsetFor(s+this._realCount-1);this._offset=i+(r-i)*e,this._activeIndex=Math.round(e*(this._realCount-1)),this._renderIndex=this._renderIndexFor(this._activeIndex),this._float=void 0,this._applyInstant(this._computeStyles())}else this._float=e*(this._realCount-1),this._activeIndex=Math.round(this._float),this._renderIndex=this._renderIndexFor(this._activeIndex),this._applyInstant(this._computeStyles());this._updateControls(),this._loadLazy(),this._syncOrigin=null}_setupBreakpoints(){const t=this.params.responsive;!$(t)||typeof window.matchMedia!="function"||Object.keys(t).forEach(e=>{const s=parseFloat(e)||0;let i;try{i=window.matchMedia(`(min-width: ${s}px)`)}catch{return}const r=()=>{clearTimeout(this._bpTimer),this._bpTimer=setTimeout(()=>{this._timers.delete(this._bpTimer),this._bpTimer=null,this.update({})},60),this._timers.add(this._bpTimer)};i.addEventListener?i.addEventListener("change",r):i.addListener&&i.addListener(r),this._breakpointListeners.push(()=>{i.removeEventListener?i.removeEventListener("change",r):i.removeListener&&i.removeListener(r)})})}_destroyBreakpoints(){this._breakpointListeners.forEach(t=>{try{t()}catch{}}),this._breakpointListeners=[],this._bpTimer&&(clearTimeout(this._bpTimer),this._timers.delete(this._bpTimer),this._bpTimer=null)}update(t={}){if(!this.ready||this.destroyed)return this;const e=this._activeIndex;this._drag=null,this._syncOrigin=null,this._cancelAnimations(),this._resetParallax(),this._stopMomentum(),this._destroyControls(),this._destroyBreakpoints(),this._userOptions=P(this._userOptions,t),this.params=this._resolveParams(),this._cls=this._buildClassNames();const s=this._cls,i=this.el;return T.forEach(r=>i.classList.remove(s[`type-${r}`])),W.forEach(r=>i.classList.remove(s[`axis-${r}`])),i.classList.remove("zs-no-js"),this.params.fallback.noJsClass&&i.classList.remove(this.params.fallback.noJsClass),i.classList.add(s[`type-${this.params.type}`],s[`axis-${this.params.axis}`]),i.classList.toggle(s["drag-enabled"],!!this.params.features.drag.enabled),this.params.dir==="rtl"?i.setAttribute("dir","rtl"):this._original.attrs.dir==null?i.removeAttribute("dir"):i.setAttribute("dir",this._original.attrs.dir),this._viewport.className=`${s.viewport} ${s[`type-${this.params.type}`]}`,this._buildControls(),this._activeIndex=e,this._measure(),this._activeIndex=this._normalizeIndex(e),this._renderIndex=this._renderIndexFor(this._activeIndex),this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._render({instant:!0}),this._updateControls(),this._resolveSyncTargets(!0),this._setupBreakpoints(),this._autoplayPlaying=!!this.params.features.autoplay.enabled,this._stoppedByUser=!1,this._scheduleAutoplay(),this}recalculate(){if(!this.ready||this.destroyed)return this;const t=this._activeIndex;return this._syncOrigin=null,this._measure(),this._activeIndex=this._normalizeIndex(t),this._renderIndex=this._renderIndexFor(this._activeIndex),this._offset=this._offsetFor(this._renderIndex),this._float=void 0,this._render({instant:!0}),this._updateControls(),this._loadLazy(),this._scheduleAutoplay(),this}getProgress(){return!this._realCount||this._realCount<2?0:w(this._activeIndex/(this._realCount-1),0,1)}getState(){return{index:this._activeIndex,realIndex:this._activeIndex,progress:this.getProgress(),total:this._realCount,slidesPerView:this.params.slidesPerView,isLooping:!!this._loopActive,isAutoplay:!!this._autoplayPlaying,isAutoplayRunning:!!this._autoplayRunning,isAnimating:!!this._animating,isDragging:!!(this._drag&&this._drag.started),isDisabled:!!this._disabled,isDestroyed:!!this.destroyed,isBroken:!this.ready,type:this.params.type,axis:this.params.axis,dir:this.params.dir,backend:this._backend||null}}_disconnectMedia(){this._mediaLoadListeners.forEach(({img:t,onLoad:e,onError:s})=>{t.removeEventListener("load",e),t.removeEventListener("error",s)}),this._mediaLoadListeners=[]}destroy(){if(this.destroyed)return this;if(!this.el)return this.destroyed=!0,this;this._emit("destroy",{instance:this}),this._clearAutoplay(),this._cancelAnimations(),this._resetParallax(),this._stopMomentum(),this._destroyBreakpoints(),this._disconnectMedia(),this._announceTimer&&(clearTimeout(this._announceTimer),this._timers.delete(this._announceTimer),this._announceTimer=null),this._timers.forEach(i=>clearTimeout(i)),this._timers.clear(),this._recalcRaf&&cancelAnimationFrame(this._recalcRaf),this._progressRaf&&cancelAnimationFrame(this._progressRaf),this._ro&&this._ro.disconnect(),N.forEach(i=>{!i||i===this||i.destroyed||(i._syncTargets=(i._syncTargets||[]).filter(r=>r!==this),i._thumbHostEl===this.el&&(i._thumbHostEl.removeAttribute("data-zs-thumbnails"),i._thumbHostEl=null))}),this._unbindSync(),this._notifyPlugins("destroy"),this._pluginList=[],this._destroyControls(),V(this._listeners),this._waapi=[];const t=this.el,e=this._slides||[],s=this._slideSnapshots||[];return e.forEach((i,r)=>{i.parentNode!==t&&t.appendChild(i);const a=s[r];a&&(i.className=a.className,a.id==null?i.removeAttribute("id"):i.setAttribute("id",a.id),["role","aria-roledescription","aria-label"].forEach(n=>{a[n]==null?i.removeAttribute(n):i.setAttribute(n,a[n])}),a["aria-hidden"]==null?i.removeAttribute("aria-hidden"):i.setAttribute("aria-hidden",a["aria-hidden"]),a.inert?i.setAttribute("inert",""):("inert"in i&&(i.inert=!1),i.removeAttribute("inert"))),i.removeAttribute("data-zs-index"),a&&(a.style==null?i.removeAttribute("style"):i.setAttribute("style",a.style))}),this._slideSnapshots=[],this._generated.forEach(i=>{i&&i.parentNode&&i.parentNode.removeChild(i)}),this._generated=[],this._viewport&&this._viewport.parentNode&&this._viewport.parentNode.removeChild(this._viewport),t.className=this._original.className,Object.keys(this._original.attrs||{}).forEach(i=>{const r=this._original.attrs[i];r==null?t.removeAttribute(i):t.setAttribute(i,r)}),!this._hadId&&t.id===this.id&&t.removeAttribute("id"),this._original.style==null?t.removeAttribute("style"):t.setAttribute("style",this._original.style),N.delete(this),R.delete(t),this._events.clear(),this.ready=!1,this.destroyed=!0,this}}function M(d,t){return new F(d,t)}return M.prototype=F.prototype,M.VERSION=B,M.defaults=Y,M.ZikraSlider=F,M.get=d=>{const t=q(d);return t&&R.get(t)||null},M.instances=()=>Array.from(N),M});
|
package/dist/zikraslider.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Zikra Slider Pro v1.2.
|
|
1
|
+
/*! Zikra Slider Pro v1.2.1 | MIT | zero dependencies */
|
|
2
2
|
(function (root, factory) {
|
|
3
3
|
if (typeof module === 'object' && module.exports) module.exports = factory();
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
9
|
/*!
|
|
10
|
-
* Zikra Slider Pro v1.2.
|
|
10
|
+
* Zikra Slider Pro v1.2.1
|
|
11
11
|
* Zero-dependency slider / carousel engine for Vanilla JS, React, Next.js and Vue 3.
|
|
12
12
|
* MIT License.
|
|
13
13
|
*
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* - Every animation backend (GSAP, anime.js, Motion One, WAAPI, CSS) receives
|
|
21
21
|
* the same from/to style descriptors, so falling back is just a strategy swap.
|
|
22
22
|
*/
|
|
23
|
-
const VERSION = '1.2.
|
|
23
|
+
const VERSION = '1.2.1';
|
|
24
24
|
|
|
25
25
|
const TYPES = ['slide', 'fade', 'scale', 'coverflow', 'stack', 'cards', 'custom'];
|
|
26
26
|
const AXES = ['x', 'y'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zikra-slider-pro",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "A small, accessible, zero-dependency carousel engine with seven layouts, parallax and a GSAP/anime.js/Motion → WAAPI → CSS animation ladder.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "dist/zikraslider.d.ts",
|