diff --git a/CHANGELOG.md b/CHANGELOG.md index ffa6322a..44dfaaa9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# 5.0.4 (2023-03-01) + +### Bug Fixes + +- **Fancybox** Fix blurry images in Safari + +### Features + +- **Fancybox** Improved accessibility + # 5.0.3 (2023-02-26) ### Bug Fixes diff --git a/dist/carousel/carousel.autoplay.esm.js b/dist/carousel/carousel.autoplay.esm.js index 5780e2b3..f172b1aa 100644 --- a/dist/carousel/carousel.autoplay.esm.js +++ b/dist/carousel/carousel.autoplay.esm.js @@ -1 +1 @@ -const e=(t,...s)=>{const i=s.length;for(let n=0;n{const n=Array.isArray(i)?[]:{};var r;t[s]||Object.assign(t,{[s]:n}),"object"==typeof(r=i)&&null!==r&&r.constructor===Object&&"[object Object]"===Object.prototype.toString.call(r)?Object.assign(t[s],e(n,i)):Array.isArray(i)?Object.assign(t,{[s]:[...i]}):Object.assign(t,{[s]:i})}))}return t},t=function(e,t){return e.split(".").reduce(((e,t)=>"object"==typeof e?e[t]:void 0),t)};class s{constructor(e={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(e);for(const e of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))e.startsWith("on")&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}setOptions(t){this.options=t?e({},this.constructor.defaults,t):{};for(const[e,t]of Object.entries(this.option("on")||{}))this.on(e,t)}option(e,...s){let i=t(e,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...s)),i}optionFor(e,s,i,...n){let r=t(s,e);var o;"string"!=typeof(o=r)||isNaN(o)||isNaN(parseFloat(o))||(r=parseFloat(r)),"true"===r&&(r=!0),"false"===r&&(r=!1),r&&"function"==typeof r&&(r=r.call(this,this,e,...n));let a=t(s,this.options);return a&&"function"==typeof a?r=a.call(this,this,e,...n,r):void 0===r&&(r=a),void 0===r?i:r}cn(e){const t=this.options.classes;return t&&t[e]||""}localize(e,t=[]){e=String(e).replace(/\{\{(\w+).?(\w+)?\}\}/g,((e,t,s)=>{let i="";return s?i=this.option(`${t[0]+t.toLowerCase().substring(1)}.l10n.${s}`):t&&(i=this.option(`l10n.${t}`)),i||(i=e),i}));for(let s=0;st))}on(e,t){let s=[];"string"==typeof e?s=e.split(" "):Array.isArray(e)&&(s=e),this.events||(this.events=new Map),s.forEach((e=>{let s=this.events.get(e);s||(this.events.set(e,[]),s=[]),s.includes(t)||s.push(t),this.events.set(e,s)}))}off(e,t){let s=[];"string"==typeof e?s=e.split(" "):Array.isArray(e)&&(s=e),s.forEach((e=>{const s=this.events.get(e);if(Array.isArray(s)){const e=s.indexOf(t);e>-1&&s.splice(e,1)}}))}emit(e,...t){[...this.events.get(e)||[]].forEach((e=>e(this,...t))),"*"!==e&&this.emit("*",e,...t)}}Object.defineProperty(s,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(s,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class i extends s{constructor(e,t){super(t),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}}const n=e=>`${e||""}`.split(" ").filter((e=>!!e)),r=(e,t)=>{n(t).forEach((t=>{e&&e.classList.add(t)}))};class o extends i{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:"ready"}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return"ready"!==this.state}onReady(e){this.option("autoStart")&&(e.isInfinite||e.page{this.timer=null,this.inHover||this.onTimerEnd()}),t),e.style.transitionDuration=`${t}ms`,e.style.transform="scaleX(1)"}this.emit("set")}clear(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.removeProgressBar()}start(){if(this.set(),this.option("pauseOnHover")){const e=this.instance.container;e.addEventListener("mouseenter",this.onMouseEnter,!1),e.addEventListener("mouseleave",this.onMouseLeave,!1)}document.addEventListener("visibilitychange",this.onVisibilityChange,!1)}stop(){const e=this.instance.container;var t;this.clear(),this.state="ready",e.removeEventListener("mouseenter",this.onMouseEnter,!1),e.removeEventListener("mouseleave",this.onMouseLeave,!1),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),t=e,n("has-autoplay").forEach((e=>{t&&t.classList.remove(e)})),this.emit("stop")}pause(){"play"===this.state&&(this.state="pause",this.clear(),this.emit("pause"))}resume(){const e=this.instance;if(e.isInfinite||e.page!==e.pages.length-1)if("play"!==this.state){if("pause"===this.state&&!this.inHover){const e=new Event("resume",{bubbles:!0,cancelable:!0});this.emit("resume",event),e.defaultPrevented||this.set()}}else this.set();else this.stop()}toggle(){"play"===this.state||"pause"===this.state?this.stop():this.set()}attach(){this.instance.on("ready",this.onReady),this.instance.on("Panzoom.startAnimation",this.onChange),this.instance.on("Panzoom.endAnimation",this.onSettle),this.instance.on("Panzoom.touchMove",this.onChange)}detach(){this.instance.off("ready",this.onReady),this.instance.off("Panzoom.startAnimation",this.onChange),this.instance.off("Panzoom.endAnimation",this.onSettle),this.instance.off("Panzoom.touchMove",this.onChange),this.stop()}}Object.defineProperty(o,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});export{o as Autoplay}; +const e=(t,...s)=>{const i=s.length;for(let n=0;n{const n=Array.isArray(i)?[]:{};var r;t[s]||Object.assign(t,{[s]:n}),"object"==typeof(r=i)&&null!==r&&r.constructor===Object&&"[object Object]"===Object.prototype.toString.call(r)?Object.assign(t[s],e(n,i)):Array.isArray(i)?Object.assign(t,{[s]:[...i]}):Object.assign(t,{[s]:i})}))}return t},t=function(e,t){return e.split(".").reduce(((e,t)=>"object"==typeof e?e[t]:void 0),t)};class s{constructor(e={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(e);for(const e of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))e.startsWith("on")&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}setOptions(t){this.options=t?e({},this.constructor.defaults,t):{};for(const[e,t]of Object.entries(this.option("on")||{}))this.on(e,t)}option(e,...s){let i=t(e,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...s)),i}optionFor(e,s,i,...n){let r=t(s,e);var o;"string"!=typeof(o=r)||isNaN(o)||isNaN(parseFloat(o))||(r=parseFloat(r)),"true"===r&&(r=!0),"false"===r&&(r=!1),r&&"function"==typeof r&&(r=r.call(this,this,e,...n));let a=t(s,this.options);return a&&"function"==typeof a?r=a.call(this,this,e,...n,r):void 0===r&&(r=a),void 0===r?i:r}cn(e){const t=this.options.classes;return t&&t[e]||""}localize(e,t=[]){e=String(e).replace(/\{\{(\w+).?(\w+)?\}\}/g,((e,t,s)=>{let i="";return s?i=this.option(`${t[0]+t.toLowerCase().substring(1)}.l10n.${s}`):t&&(i=this.option(`l10n.${t}`)),i||(i=e),i}));for(let s=0;st))}on(e,t){let s=[];"string"==typeof e?s=e.split(" "):Array.isArray(e)&&(s=e),this.events||(this.events=new Map),s.forEach((e=>{let s=this.events.get(e);s||(this.events.set(e,[]),s=[]),s.includes(t)||s.push(t),this.events.set(e,s)}))}off(e,t){let s=[];"string"==typeof e?s=e.split(" "):Array.isArray(e)&&(s=e),s.forEach((e=>{const s=this.events.get(e);if(Array.isArray(s)){const e=s.indexOf(t);e>-1&&s.splice(e,1)}}))}emit(e,...t){[...this.events.get(e)||[]].forEach((e=>e(this,...t))),"*"!==e&&this.emit("*",e,...t)}}Object.defineProperty(s,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(s,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class i extends s{constructor(e,t){super(t),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}}const n=e=>`${e||""}`.split(" ").filter((e=>!!e)),r=(e,t)=>{n(t).forEach((t=>{e&&e.classList.add(t)}))};class o extends i{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:"ready"}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return"ready"!==this.state}onReady(e){this.option("autoStart")&&(e.isInfinite||e.page{this.timer=null,this.inHover||this.onTimerEnd()}),t),e.style.transitionDuration=`${t}ms`,e.style.transform="scaleX(1)"}this.emit("set")}clear(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.removeProgressBar()}start(){if(this.set(),this.option("pauseOnHover")){const e=this.instance.container;e.addEventListener("mouseenter",this.onMouseEnter,!1),e.addEventListener("mouseleave",this.onMouseLeave,!1)}document.addEventListener("visibilitychange",this.onVisibilityChange,!1)}stop(){const e=this.instance.container;var t;this.clear(),this.state="ready",e.removeEventListener("mouseenter",this.onMouseEnter,!1),e.removeEventListener("mouseleave",this.onMouseLeave,!1),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),t=e,n("has-autoplay").forEach((e=>{t&&t.classList.remove(e)})),this.emit("stop")}pause(){"play"===this.state&&(this.state="pause",this.clear(),this.emit("pause"))}resume(){const e=this.instance;if(e.isInfinite||e.page!==e.pages.length-1)if("play"!==this.state){if("pause"===this.state&&!this.inHover){const e=new Event("resume",{bubbles:!0,cancelable:!0});this.emit("resume",event),e.defaultPrevented||this.set()}}else this.set();else this.stop()}toggle(){"play"===this.state||"pause"===this.state?this.stop():this.set()}attach(){this.instance.on("ready",this.onReady),this.instance.on("Panzoom.startAnimation",this.onChange),this.instance.on("Panzoom.endAnimation",this.onSettle),this.instance.on("Panzoom.touchMove",this.onChange)}detach(){this.instance.off("ready",this.onReady),this.instance.off("Panzoom.startAnimation",this.onChange),this.instance.off("Panzoom.endAnimation",this.onSettle),this.instance.off("Panzoom.touchMove",this.onChange),this.stop()}}Object.defineProperty(o,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});export{o as Autoplay}; diff --git a/dist/carousel/carousel.autoplay.umd.js b/dist/carousel/carousel.autoplay.umd.js index 0a6fab52..ad381808 100644 --- a/dist/carousel/carousel.autoplay.umd.js +++ b/dist/carousel/carousel.autoplay.umd.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).window=e.window||{})}(this,(function(e){"use strict";const t=(e,...s)=>{const i=s.length;for(let n=0;n{const n=Array.isArray(i)?[]:{};var o;e[s]||Object.assign(e,{[s]:n}),"object"==typeof(o=i)&&null!==o&&o.constructor===Object&&"[object Object]"===Object.prototype.toString.call(o)?Object.assign(e[s],t(n,i)):Array.isArray(i)?Object.assign(e,{[s]:[...i]}):Object.assign(e,{[s]:i})}))}return e},s=function(e,t){return e.split(".").reduce(((e,t)=>"object"==typeof e?e[t]:void 0),t)};class i{constructor(e={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(e);for(const e of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))e.startsWith("on")&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}setOptions(e){this.options=e?t({},this.constructor.defaults,e):{};for(const[e,t]of Object.entries(this.option("on")||{}))this.on(e,t)}option(e,...t){let i=s(e,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...t)),i}optionFor(e,t,i,...n){let o=s(t,e);var r;"string"!=typeof(r=o)||isNaN(r)||isNaN(parseFloat(r))||(o=parseFloat(o)),"true"===o&&(o=!0),"false"===o&&(o=!1),o&&"function"==typeof o&&(o=o.call(this,this,e,...n));let a=s(t,this.options);return a&&"function"==typeof a?o=a.call(this,this,e,...n,o):void 0===o&&(o=a),void 0===o?i:o}cn(e){const t=this.options.classes;return t&&t[e]||""}localize(e,t=[]){e=String(e).replace(/\{\{(\w+).?(\w+)?\}\}/g,((e,t,s)=>{let i="";return s?i=this.option(`${t[0]+t.toLowerCase().substring(1)}.l10n.${s}`):t&&(i=this.option(`l10n.${t}`)),i||(i=e),i}));for(let s=0;st))}on(e,t){let s=[];"string"==typeof e?s=e.split(" "):Array.isArray(e)&&(s=e),this.events||(this.events=new Map),s.forEach((e=>{let s=this.events.get(e);s||(this.events.set(e,[]),s=[]),s.includes(t)||s.push(t),this.events.set(e,s)}))}off(e,t){let s=[];"string"==typeof e?s=e.split(" "):Array.isArray(e)&&(s=e),s.forEach((e=>{const s=this.events.get(e);if(Array.isArray(s)){const e=s.indexOf(t);e>-1&&s.splice(e,1)}}))}emit(e,...t){[...this.events.get(e)||[]].forEach((e=>e(this,...t))),"*"!==e&&this.emit("*",e,...t)}}Object.defineProperty(i,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(i,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class n extends i{constructor(e,t){super(t),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}}const o=e=>`${e||""}`.split(" ").filter((e=>!!e)),r=(e,t)=>{o(t).forEach((t=>{e&&e.classList.add(t)}))};class a extends n{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:"ready"}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return"ready"!==this.state}onReady(e){this.option("autoStart")&&(e.isInfinite||e.page{this.timer=null,this.inHover||this.onTimerEnd()}),t),e.style.transitionDuration=`${t}ms`,e.style.transform="scaleX(1)"}this.emit("set")}clear(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.removeProgressBar()}start(){if(this.set(),this.option("pauseOnHover")){const e=this.instance.container;e.addEventListener("mouseenter",this.onMouseEnter,!1),e.addEventListener("mouseleave",this.onMouseLeave,!1)}document.addEventListener("visibilitychange",this.onVisibilityChange,!1)}stop(){const e=this.instance.container;var t;this.clear(),this.state="ready",e.removeEventListener("mouseenter",this.onMouseEnter,!1),e.removeEventListener("mouseleave",this.onMouseLeave,!1),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),t=e,o("has-autoplay").forEach((e=>{t&&t.classList.remove(e)})),this.emit("stop")}pause(){"play"===this.state&&(this.state="pause",this.clear(),this.emit("pause"))}resume(){const e=this.instance;if(e.isInfinite||e.page!==e.pages.length-1)if("play"!==this.state){if("pause"===this.state&&!this.inHover){const e=new Event("resume",{bubbles:!0,cancelable:!0});this.emit("resume",event),e.defaultPrevented||this.set()}}else this.set();else this.stop()}toggle(){"play"===this.state||"pause"===this.state?this.stop():this.set()}attach(){this.instance.on("ready",this.onReady),this.instance.on("Panzoom.startAnimation",this.onChange),this.instance.on("Panzoom.endAnimation",this.onSettle),this.instance.on("Panzoom.touchMove",this.onChange)}detach(){this.instance.off("ready",this.onReady),this.instance.off("Panzoom.startAnimation",this.onChange),this.instance.off("Panzoom.endAnimation",this.onSettle),this.instance.off("Panzoom.touchMove",this.onChange),this.stop()}}Object.defineProperty(a,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}}),e.Autoplay=a})); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).window=e.window||{})}(this,(function(e){"use strict";const t=(e,...s)=>{const i=s.length;for(let n=0;n{const n=Array.isArray(i)?[]:{};var o;e[s]||Object.assign(e,{[s]:n}),"object"==typeof(o=i)&&null!==o&&o.constructor===Object&&"[object Object]"===Object.prototype.toString.call(o)?Object.assign(e[s],t(n,i)):Array.isArray(i)?Object.assign(e,{[s]:[...i]}):Object.assign(e,{[s]:i})}))}return e},s=function(e,t){return e.split(".").reduce(((e,t)=>"object"==typeof e?e[t]:void 0),t)};class i{constructor(e={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(e);for(const e of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))e.startsWith("on")&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}setOptions(e){this.options=e?t({},this.constructor.defaults,e):{};for(const[e,t]of Object.entries(this.option("on")||{}))this.on(e,t)}option(e,...t){let i=s(e,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...t)),i}optionFor(e,t,i,...n){let o=s(t,e);var r;"string"!=typeof(r=o)||isNaN(r)||isNaN(parseFloat(r))||(o=parseFloat(o)),"true"===o&&(o=!0),"false"===o&&(o=!1),o&&"function"==typeof o&&(o=o.call(this,this,e,...n));let a=s(t,this.options);return a&&"function"==typeof a?o=a.call(this,this,e,...n,o):void 0===o&&(o=a),void 0===o?i:o}cn(e){const t=this.options.classes;return t&&t[e]||""}localize(e,t=[]){e=String(e).replace(/\{\{(\w+).?(\w+)?\}\}/g,((e,t,s)=>{let i="";return s?i=this.option(`${t[0]+t.toLowerCase().substring(1)}.l10n.${s}`):t&&(i=this.option(`l10n.${t}`)),i||(i=e),i}));for(let s=0;st))}on(e,t){let s=[];"string"==typeof e?s=e.split(" "):Array.isArray(e)&&(s=e),this.events||(this.events=new Map),s.forEach((e=>{let s=this.events.get(e);s||(this.events.set(e,[]),s=[]),s.includes(t)||s.push(t),this.events.set(e,s)}))}off(e,t){let s=[];"string"==typeof e?s=e.split(" "):Array.isArray(e)&&(s=e),s.forEach((e=>{const s=this.events.get(e);if(Array.isArray(s)){const e=s.indexOf(t);e>-1&&s.splice(e,1)}}))}emit(e,...t){[...this.events.get(e)||[]].forEach((e=>e(this,...t))),"*"!==e&&this.emit("*",e,...t)}}Object.defineProperty(i,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(i,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class n extends i{constructor(e,t){super(t),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:e})}attach(){}detach(){}}const o=e=>`${e||""}`.split(" ").filter((e=>!!e)),r=(e,t)=>{o(t).forEach((t=>{e&&e.classList.add(t)}))};class a extends n{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:"ready"}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return"ready"!==this.state}onReady(e){this.option("autoStart")&&(e.isInfinite||e.page{this.timer=null,this.inHover||this.onTimerEnd()}),t),e.style.transitionDuration=`${t}ms`,e.style.transform="scaleX(1)"}this.emit("set")}clear(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.removeProgressBar()}start(){if(this.set(),this.option("pauseOnHover")){const e=this.instance.container;e.addEventListener("mouseenter",this.onMouseEnter,!1),e.addEventListener("mouseleave",this.onMouseLeave,!1)}document.addEventListener("visibilitychange",this.onVisibilityChange,!1)}stop(){const e=this.instance.container;var t;this.clear(),this.state="ready",e.removeEventListener("mouseenter",this.onMouseEnter,!1),e.removeEventListener("mouseleave",this.onMouseLeave,!1),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),t=e,o("has-autoplay").forEach((e=>{t&&t.classList.remove(e)})),this.emit("stop")}pause(){"play"===this.state&&(this.state="pause",this.clear(),this.emit("pause"))}resume(){const e=this.instance;if(e.isInfinite||e.page!==e.pages.length-1)if("play"!==this.state){if("pause"===this.state&&!this.inHover){const e=new Event("resume",{bubbles:!0,cancelable:!0});this.emit("resume",event),e.defaultPrevented||this.set()}}else this.set();else this.stop()}toggle(){"play"===this.state||"pause"===this.state?this.stop():this.set()}attach(){this.instance.on("ready",this.onReady),this.instance.on("Panzoom.startAnimation",this.onChange),this.instance.on("Panzoom.endAnimation",this.onSettle),this.instance.on("Panzoom.touchMove",this.onChange)}detach(){this.instance.off("ready",this.onReady),this.instance.off("Panzoom.startAnimation",this.onChange),this.instance.off("Panzoom.endAnimation",this.onSettle),this.instance.off("Panzoom.touchMove",this.onChange),this.stop()}}Object.defineProperty(a,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}}),e.Autoplay=a})); diff --git a/dist/carousel/carousel.css b/dist/carousel/carousel.css index 5db998c8..d60dae55 100644 --- a/dist/carousel/carousel.css +++ b/dist/carousel/carousel.css @@ -1 +1 @@ -:root{--f-spinner-width: 36px;--f-spinner-height: 36px;--f-spinner-color-1: rgba(0, 0, 0, 0.1);--f-spinner-color-2: rgba(17, 24, 28, 0.8);--f-spinner-stroke: 2.75}.f-spinner{margin:auto;padding:0;width:var(--f-spinner-width);height:var(--f-spinner-height)}.f-spinner svg{width:100%;height:100%;vertical-align:top;animation:f-spinner-rotate 2s linear infinite}.f-spinner svg *{stroke-width:var(--f-spinner-stroke);fill:none}.f-spinner svg *:first-child{stroke:var(--f-spinner-color-1)}.f-spinner svg *:last-child{stroke:var(--f-spinner-color-2);animation:f-spinner-dash 2s ease-in-out infinite}@keyframes f-spinner-rotate{100%{transform:rotate(360deg)}}@keyframes f-spinner-dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}.f-zoomInUp{animation:.2s ease-out .1s both f-zoomInUp}.f-zoomOutDown{animation:.2s ease-in both f-zoomOutDown}@keyframes f-zoomInUp{from{transform:scale(0.975) translate3d(0, 16px, 0);opacity:0}to{transform:scale(1) translate3d(0, 0, 0);opacity:1}}@keyframes f-zoomOutDown{to{transform:scale(0.975) translate3d(0, -16px, 0);opacity:0}}.f-throwOutUp{animation:.175s ease-out both f-throwOutUp}.f-throwOutDown{animation:.175s ease-out both f-throwOutDown}@keyframes f-throwOutUp{to{transform:translate3d(0, -150px, 0);opacity:0}}@keyframes f-throwOutDown{to{transform:translate3d(0, 150px, 0);opacity:0}}.f-fadeIn{animation:.2s ease both f-fadeIn;z-index:2}.f-fadeOut{animation:.2s ease both f-fadeOut;z-index:1}@keyframes f-fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes f-fadeOut{100%{opacity:0}}.f-fadeSlowIn{animation:.5s ease both f-fadeSlowIn;z-index:2}.f-fadeSlowOut{animation:.5s ease both f-fadeSlowOut;z-index:1}@keyframes f-fadeSlowIn{0%{opacity:0}100%{opacity:1}}@keyframes f-fadeSlowOut{100%{opacity:0}}.f-fadeFastIn{animation:.2s ease-out both f-fadeFastIn;z-index:2}.f-fadeFastOut{animation:.2s ease-out both f-fadeFastOut;z-index:2}@keyframes f-fadeFastIn{0%{opacity:.75}100%{opacity:1}}@keyframes f-fadeFastOut{100%{opacity:0}}.f-crossfadeIn{animation:.2s ease-out both f-crossfadeIn;z-index:2}.f-crossfadeOut{animation:.1s linear .1s both f-crossfadeOut;z-index:1}@keyframes f-crossfadeIn{0%{opacity:0}100%{opacity:1}}@keyframes f-crossfadeOut{100%{opacity:0}}.f-slideIn.from-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideInNext}.f-slideIn.from-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideInPrev}.f-slideOut.to-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideOutNext}.f-slideOut.to-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideOutPrev}@keyframes f-slideInPrev{0%{transform:translateX(100%)}100%{transform:translate3d(0, 0, 0)}}@keyframes f-slideInNext{0%{transform:translateX(-100%)}100%{transform:translate3d(0, 0, 0)}}@keyframes f-slideOutNext{100%{transform:translateX(-100%)}}@keyframes f-slideOutPrev{100%{transform:translateX(100%)}}.f-classicIn.from-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicInNext;z-index:2}.f-classicIn.from-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicInPrev;z-index:2}.f-classicOut.to-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicOutNext;z-index:1}.f-classicOut.to-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicOutPrev;z-index:1}@keyframes f-classicInNext{0%{transform:translateX(-75px);opacity:0}100%{transform:translate3d(0, 0, 0);opacity:1}}@keyframes f-classicInPrev{0%{transform:translateX(75px);opacity:0}100%{transform:translate3d(0, 0, 0);opacity:1}}@keyframes f-classicOutNext{100%{transform:translateX(-75px);opacity:0}}@keyframes f-classicOutPrev{100%{transform:translateX(75px);opacity:0}}.f-carousel{--f-carousel-theme-color: #706f6c;--f-carousel-spacing: 0px;--f-carousel-slide-width: 100%;--f-carousel-slide-height: auto;--f-carousel-slide-padding: 0;--f-button-width: 42px;--f-button-height: 42px;--f-button-color: var(--f-carousel-theme-color, currentColor);--f-button-hover-color: var(--f-carousel-theme-color, currentColor);--f-button-bg: transparent;--f-button-hover-bg: var(--f-button-bg);--f-button-active-bg: var(--f-button-bg);--f-button-svg-width: 24px;--f-button-svg-height: 24px;--f-button-next-pos: 10px;--f-button-prev-pos: 10px;position:relative;box-sizing:border-box}.f-carousel *,.f-carousel *:before,.f-carousel *:after{box-sizing:inherit}.f-carousel.is-ltr{direction:ltr}.f-carousel.is-rtl{direction:rtl}.f-carousel__viewport{overflow:hidden;transform:translate3d(0, 0, 0);backface-visibility:hidden;width:100%;height:100%}.f-carousel__viewport.is-draggable{cursor:move;cursor:grab}.f-carousel__viewport.is-dragging{cursor:move;cursor:grabbing}.f-carousel__track{display:flex;margin:0 auto;padding:0;height:100%;-webkit-tap-highlight-color:rgba(0,0,0,0)}.f-carousel__slide{position:relative;flex:0 0 auto;width:var(--f-carousel-slide-width);max-width:100%;height:var(--f-carousel-slide-height);margin:0 var(--f-carousel-spacing) 0 0;padding:var(--f-carousel-slide-padding);overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;outline:0;transform-origin:center center}.f-carousel__slide.is-loading{min-height:88px;min-width:88px}.f-carousel.is-vertical{--f-carousel-slide-height: 100%}.f-carousel.is-vertical .f-carousel__track{flex-wrap:wrap}.f-carousel.is-vertical .f-carousel__slide{margin:0 0 var(--f-carousel-spacing) 0}:root{--f-carousel-dots-width: 24px;--f-carousel-dots-height: 30px;--f-carousel-dot-width: 8px;--f-carousel-dot-height: 8px;--f-carousel-dot-radius: 50%;--f-carousel-dot-color: var(--f-carousel-theme-color, currentColor);--f-carousel-dot-opacity: 0.2;--f-carousel-dot-hover-opacity: 0.4}.f-carousel__dots{position:absolute;bottom:calc(var(--f-carousel-dots-height)*-1);left:0;right:0;display:flex;justify-content:center;align-items:center;flex-wrap:wrap;margin:0 auto !important;padding:0;list-style:none !important;user-select:none}.f-carousel__dots li{margin:0;padding:0;border:0;opacity:var(--f-carousel-dot-opacity);transition:opacity .15s ease-in-out}.f-carousel__dots li+li{margin:0}.f-carousel__dots li:hover{opacity:var(--f-carousel-dot-hover-opacity)}.f-carousel__dots li.is-current{opacity:1}.f-carousel__dots li button{appearance:none;display:flex;align-items:center;justify-content:center;margin:0;padding:0;width:var(--f-carousel-dots-width);height:var(--f-carousel-dots-height);border:0;background:rgba(0,0,0,0);cursor:pointer;transition:all .2s linear}.f-carousel__dot{display:block;margin:0;padding:0;border:0;width:var(--f-carousel-dot-width);height:var(--f-carousel-dot-height);border-radius:var(--f-carousel-dot-radius);background-color:var(--f-carousel-dot-color);line-height:0;font-size:0;cursor:pointer;pointer-events:none}.f-carousel__dots.is-dynamic li:not(.is-prev,.is-next,.is-current,.is-after-next,.is-before-prev) button{transform:scale(0);width:0}.f-carousel__dots.is-dynamic li.is-before-prev button,.f-carousel__dots.is-dynamic li.is-after-next button{transform:scale(0.22)}.f-carousel__dots.is-dynamic li.is-prev button,.f-carousel__dots.is-dynamic li.is-next button{transform:scale(0.66)}.f-carousel__dots.is-dynamic li.is-current button{transform:scale(1)}.f-carousel__dots.is-dynamic li.is-before-prev button,.f-carousel__dots.is-dynamic li.is-after-next button{transform:scale(0.33)}.f-carousel__dots.is-dynamic li.is-current:first-child{margin-left:calc(var(--f-carousel-dots-width)*2)}.f-carousel__dots.is-dynamic li.is-prev:first-child{margin-left:var(--f-carousel-dots-width)}.f-carousel__dots.is-dynamic li.is-next:last-child{margin-right:var(--f-carousel-dots-width)}.f-carousel__dots.is-dynamic li.is-current:last-child{margin-right:calc(var(--f-carousel-dots-width)*2)}.f-carousel.is-rtl .f-carousel__dots.is-dynamic .is-current:first-child{margin-left:0;margin-right:var(--f-carousel-dots-width)}.f-carousel.is-rtl .f-carousel__dots.is-dynamic .is-prev:first-child{margin-left:0;margin-right:var(--f-carousel-dots-width)}.f-carousel.is-rtl .f-carousel__dots.is-dynamic .is-current:last-child{margin-left:0;margin-right:var(--f-carousel-dots-width)}.f-carousel.is-rtl .f-carousel__dots.is-dynamic .is-next:last-child{margin-right:0;margin-left:var(--f-carousel-dots-width)}:root{--f-button-width: 40px;--f-button-height: 40px;--f-button-border: 0;--f-button-border-radius: 0;--f-button-color: #374151;--f-button-bg: #f8f8f8;--f-button-hover-bg: #e0e0e0;--f-button-active-bg: #d0d0d0;--f-button-shadow: none;--f-button-transition: all 0.15s ease;--f-button-transform: none;--f-button-svg-width: 20px;--f-button-svg-height: 20px;--f-button-svg-stroke-width: 1.5;--f-button-svg-fill: none;--f-button-svg-filter: none;--f-button-svg-disabled-opacity: 0.65}.f-button{display:flex;justify-content:center;align-items:center;box-sizing:content-box;position:relative;margin:0;padding:0;width:var(--f-button-width);height:var(--f-button-height);border:var(--f-button-border);border-radius:var(--f-button-border-radius);color:var(--f-button-color);background:var(--f-button-bg);box-shadow:var(--f-button-shadow);pointer-events:all;cursor:pointer;transition:var(--f-button-transition)}@media(hover: hover){.f-button:hover{color:var(--f-button-hover-color);background-color:var(--f-button-hover-bg)}}.f-button:active:not([disabled]){background-color:var(--f-button-active-bg)}.f-button svg{width:var(--f-button-svg-width);height:var(--f-button-svg-height);fill:var(--f-button-svg-fill);stroke:currentColor;stroke-width:var(--f-button-svg-stroke-width);stroke-linecap:round;stroke-linejoin:round;transform:var(--f-button-transform);filter:var(--f-button-svg-filter);pointer-events:none}.f-button[disabled]{cursor:default}.f-button[disabled] svg{opacity:var(--f-button-svg-disabled-opacity)}.f-carousel__nav .f-button.is-prev,.f-carousel__nav .f-button.is-next,.fancybox__nav .f-button.is-prev,.fancybox__nav .f-button.is-next{position:absolute;z-index:1}.is-horizontal .f-carousel__nav .f-button.is-prev,.is-horizontal .f-carousel__nav .f-button.is-next,.is-horizontal .fancybox__nav .f-button.is-prev,.is-horizontal .fancybox__nav .f-button.is-next{top:50%;transform:translateY(-50%)}.is-horizontal .f-carousel__nav .f-button.is-prev,.is-horizontal .fancybox__nav .f-button.is-prev{left:var(--f-button-prev-pos)}.is-horizontal .f-carousel__nav .f-button.is-next,.is-horizontal .fancybox__nav .f-button.is-next{right:var(--f-button-next-pos)}.is-horizontal.is-rtl .f-carousel__nav .f-button.is-prev,.is-horizontal.is-rtl .fancybox__nav .f-button.is-prev{left:auto;right:var(--f-button-next-pos)}.is-horizontal.is-rtl .f-carousel__nav .f-button.is-next,.is-horizontal.is-rtl .fancybox__nav .f-button.is-next{right:auto;left:var(--f-button-prev-pos)}.is-vertical .f-carousel__nav .f-button.is-prev,.is-vertical .f-carousel__nav .f-button.is-next,.is-vertical .fancybox__nav .f-button.is-prev,.is-vertical .fancybox__nav .f-button.is-next{top:auto;left:50%;transform:translateX(-50%)}.is-vertical .f-carousel__nav .f-button.is-prev,.is-vertical .fancybox__nav .f-button.is-prev{top:var(--f-button-next-pos)}.is-vertical .f-carousel__nav .f-button.is-next,.is-vertical .fancybox__nav .f-button.is-next{bottom:var(--f-button-next-pos)}.is-vertical .f-carousel__nav .f-button.is-prev svg,.is-vertical .f-carousel__nav .f-button.is-next svg,.is-vertical .fancybox__nav .f-button.is-prev svg,.is-vertical .fancybox__nav .f-button.is-next svg{transform:rotate(90deg)} \ No newline at end of file +:root{--f-spinner-width: 36px;--f-spinner-height: 36px;--f-spinner-color-1: rgba(0, 0, 0, 0.1);--f-spinner-color-2: rgba(17, 24, 28, 0.8);--f-spinner-stroke: 2.75}.f-spinner{margin:auto;padding:0;width:var(--f-spinner-width);height:var(--f-spinner-height)}.f-spinner svg{width:100%;height:100%;vertical-align:top;animation:f-spinner-rotate 2s linear infinite}.f-spinner svg *{stroke-width:var(--f-spinner-stroke);fill:none}.f-spinner svg *:first-child{stroke:var(--f-spinner-color-1)}.f-spinner svg *:last-child{stroke:var(--f-spinner-color-2);animation:f-spinner-dash 2s ease-in-out infinite}@keyframes f-spinner-rotate{100%{transform:rotate(360deg)}}@keyframes f-spinner-dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}.f-zoomInUp{animation:.2s ease-out .1s both f-zoomInUp}.f-zoomOutDown{animation:.2s ease-in both f-zoomOutDown}@keyframes f-zoomInUp{from{transform:scale(0.975) translate3d(0, 16px, 0);opacity:0}to{transform:scale(1) translate3d(0, 0, 0);opacity:1}}@keyframes f-zoomOutDown{to{transform:scale(0.975) translate3d(0, -16px, 0);opacity:0}}.f-throwOutUp{animation:.175s ease-out both f-throwOutUp}.f-throwOutDown{animation:.175s ease-out both f-throwOutDown}@keyframes f-throwOutUp{to{transform:translate3d(0, -150px, 0);opacity:0}}@keyframes f-throwOutDown{to{transform:translate3d(0, 150px, 0);opacity:0}}.f-fadeIn{animation:.2s ease both f-fadeIn;z-index:2}.f-fadeOut{animation:.2s ease both f-fadeOut;z-index:1}@keyframes f-fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes f-fadeOut{100%{opacity:0}}.f-fadeSlowIn{animation:.5s ease both f-fadeSlowIn;z-index:2}.f-fadeSlowOut{animation:.5s ease both f-fadeSlowOut;z-index:1}@keyframes f-fadeSlowIn{0%{opacity:0}100%{opacity:1}}@keyframes f-fadeSlowOut{100%{opacity:0}}.f-fadeFastIn{animation:.2s ease-out both f-fadeFastIn;z-index:2}.f-fadeFastOut{animation:.2s ease-out both f-fadeFastOut;z-index:2}@keyframes f-fadeFastIn{0%{opacity:.75}100%{opacity:1}}@keyframes f-fadeFastOut{100%{opacity:0}}.f-crossfadeIn{animation:.2s ease-out both f-crossfadeIn;z-index:2}.f-crossfadeOut{animation:.1s linear .1s both f-crossfadeOut;z-index:1}@keyframes f-crossfadeIn{0%{opacity:0}100%{opacity:1}}@keyframes f-crossfadeOut{100%{opacity:0}}.f-slideIn.from-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideInNext}.f-slideIn.from-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideInPrev}.f-slideOut.to-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideOutNext}.f-slideOut.to-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideOutPrev}@keyframes f-slideInPrev{0%{transform:translateX(100%)}100%{transform:translate3d(0, 0, 0)}}@keyframes f-slideInNext{0%{transform:translateX(-100%)}100%{transform:translate3d(0, 0, 0)}}@keyframes f-slideOutNext{100%{transform:translateX(-100%)}}@keyframes f-slideOutPrev{100%{transform:translateX(100%)}}.f-classicIn.from-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicInNext;z-index:2}.f-classicIn.from-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicInPrev;z-index:2}.f-classicOut.to-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicOutNext;z-index:1}.f-classicOut.to-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicOutPrev;z-index:1}@keyframes f-classicInNext{0%{transform:translateX(-75px);opacity:0}100%{transform:translate3d(0, 0, 0);opacity:1}}@keyframes f-classicInPrev{0%{transform:translateX(75px);opacity:0}100%{transform:translate3d(0, 0, 0);opacity:1}}@keyframes f-classicOutNext{100%{transform:translateX(-75px);opacity:0}}@keyframes f-classicOutPrev{100%{transform:translateX(75px);opacity:0}}.f-carousel{--f-carousel-theme-color: #706f6c;--f-carousel-spacing: 0px;--f-carousel-slide-width: 100%;--f-carousel-slide-height: auto;--f-carousel-slide-padding: 0;--f-button-width: 42px;--f-button-height: 42px;--f-button-color: var(--f-carousel-theme-color, currentColor);--f-button-hover-color: var(--f-carousel-theme-color, currentColor);--f-button-bg: transparent;--f-button-hover-bg: var(--f-button-bg);--f-button-active-bg: var(--f-button-bg);--f-button-svg-width: 24px;--f-button-svg-height: 24px;--f-button-next-pos: 10px;--f-button-prev-pos: 10px;position:relative;box-sizing:border-box}.f-carousel *,.f-carousel *:before,.f-carousel *:after{box-sizing:inherit}.f-carousel.is-ltr{direction:ltr}.f-carousel.is-rtl{direction:rtl}.f-carousel__viewport{overflow:hidden;transform:translate3d(0, 0, 0);backface-visibility:hidden;width:100%;height:100%}.f-carousel__viewport.is-draggable{cursor:move;cursor:grab}.f-carousel__viewport.is-dragging{cursor:move;cursor:grabbing}.f-carousel__track{display:flex;margin:0 auto;padding:0;height:100%;-webkit-tap-highlight-color:rgba(0,0,0,0)}.f-carousel__slide{position:relative;flex:0 0 auto;width:var(--f-carousel-slide-width);max-width:100%;height:var(--f-carousel-slide-height);margin:0 var(--f-carousel-spacing) 0 0;padding:var(--f-carousel-slide-padding);overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;outline:0;transform-origin:center center}.f-carousel__slide.is-loading{min-height:88px;min-width:88px}.f-carousel.is-vertical{--f-carousel-slide-height: 100%}.f-carousel.is-vertical .f-carousel__track{flex-wrap:wrap}.f-carousel.is-vertical .f-carousel__slide{margin:0 0 var(--f-carousel-spacing) 0}:root{--f-carousel-dots-width: 24px;--f-carousel-dots-height: 30px;--f-carousel-dot-width: 8px;--f-carousel-dot-height: 8px;--f-carousel-dot-radius: 50%;--f-carousel-dot-color: var(--f-carousel-theme-color, currentColor);--f-carousel-dot-opacity: 0.2;--f-carousel-dot-hover-opacity: 0.4}.f-carousel__dots{position:absolute;bottom:calc(var(--f-carousel-dots-height)*-1);left:0;right:0;display:flex;justify-content:center;align-items:center;flex-wrap:wrap;margin:0 auto !important;padding:0;list-style:none !important;user-select:none}.f-carousel__dots li{margin:0;padding:0;border:0;opacity:var(--f-carousel-dot-opacity);transition:opacity .15s ease-in-out}.f-carousel__dots li+li{margin:0}.f-carousel__dots li:hover{opacity:var(--f-carousel-dot-hover-opacity)}.f-carousel__dots li.is-current{opacity:1}.f-carousel__dots li button{appearance:none;display:flex;align-items:center;justify-content:center;margin:0;padding:0;width:var(--f-carousel-dots-width);height:var(--f-carousel-dots-height);border:0;background:rgba(0,0,0,0);cursor:pointer;transition:all .2s linear}.f-carousel__dot{display:block;margin:0;padding:0;border:0;width:var(--f-carousel-dot-width);height:var(--f-carousel-dot-height);border-radius:var(--f-carousel-dot-radius);background-color:var(--f-carousel-dot-color);line-height:0;font-size:0;cursor:pointer;pointer-events:none}.f-carousel__dots.is-dynamic li:not(.is-prev,.is-next,.is-current,.is-after-next,.is-before-prev) button{transform:scale(0);width:0}.f-carousel__dots.is-dynamic li.is-before-prev button,.f-carousel__dots.is-dynamic li.is-after-next button{transform:scale(0.22)}.f-carousel__dots.is-dynamic li.is-prev button,.f-carousel__dots.is-dynamic li.is-next button{transform:scale(0.66)}.f-carousel__dots.is-dynamic li.is-current button{transform:scale(1)}.f-carousel__dots.is-dynamic li.is-before-prev button,.f-carousel__dots.is-dynamic li.is-after-next button{transform:scale(0.33)}.f-carousel__dots.is-dynamic li.is-current:first-child{margin-left:calc(var(--f-carousel-dots-width)*2)}.f-carousel__dots.is-dynamic li.is-prev:first-child{margin-left:var(--f-carousel-dots-width)}.f-carousel__dots.is-dynamic li.is-next:last-child{margin-right:var(--f-carousel-dots-width)}.f-carousel__dots.is-dynamic li.is-current:last-child{margin-right:calc(var(--f-carousel-dots-width)*2)}.f-carousel.is-rtl .f-carousel__dots.is-dynamic .is-current:first-child{margin-left:0;margin-right:var(--f-carousel-dots-width)}.f-carousel.is-rtl .f-carousel__dots.is-dynamic .is-prev:first-child{margin-left:0;margin-right:var(--f-carousel-dots-width)}.f-carousel.is-rtl .f-carousel__dots.is-dynamic .is-current:last-child{margin-left:0;margin-right:var(--f-carousel-dots-width)}.f-carousel.is-rtl .f-carousel__dots.is-dynamic .is-next:last-child{margin-right:0;margin-left:var(--f-carousel-dots-width)}:root{--f-button-width: 40px;--f-button-height: 40px;--f-button-border: 0;--f-button-border-radius: 0;--f-button-color: #374151;--f-button-bg: #f8f8f8;--f-button-hover-bg: #e0e0e0;--f-button-active-bg: #d0d0d0;--f-button-shadow: none;--f-button-transition: all 0.15s ease;--f-button-transform: none;--f-button-svg-width: 20px;--f-button-svg-height: 20px;--f-button-svg-stroke-width: 1.5;--f-button-svg-fill: none;--f-button-svg-filter: none;--f-button-svg-disabled-opacity: 0.65}.f-button{display:flex;justify-content:center;align-items:center;box-sizing:content-box;position:relative;margin:0;padding:0;width:var(--f-button-width);height:var(--f-button-height);border:var(--f-button-border);border-radius:var(--f-button-border-radius);color:var(--f-button-color);background:var(--f-button-bg);box-shadow:var(--f-button-shadow);pointer-events:all;cursor:pointer;transition:var(--f-button-transition)}@media(hover: hover){.f-button:hover{color:var(--f-button-hover-color);background-color:var(--f-button-hover-bg)}}.f-button:active:not([disabled]){background-color:var(--f-button-active-bg)}.f-button:focus-visible{outline:none}.f-button svg{width:var(--f-button-svg-width);height:var(--f-button-svg-height);fill:var(--f-button-svg-fill);stroke:currentColor;stroke-width:var(--f-button-svg-stroke-width);stroke-linecap:round;stroke-linejoin:round;transition:opacity .15s ease;transform:var(--f-button-transform);filter:var(--f-button-svg-filter);pointer-events:none}.f-button[disabled]{cursor:default}.f-button[disabled] svg{opacity:var(--f-button-svg-disabled-opacity)}.f-carousel__nav .f-button.is-prev,.f-carousel__nav .f-button.is-next,.fancybox__nav .f-button.is-prev,.fancybox__nav .f-button.is-next{position:absolute;z-index:1}.is-horizontal .f-carousel__nav .f-button.is-prev,.is-horizontal .f-carousel__nav .f-button.is-next,.is-horizontal .fancybox__nav .f-button.is-prev,.is-horizontal .fancybox__nav .f-button.is-next{top:50%;transform:translateY(-50%)}.is-horizontal .f-carousel__nav .f-button.is-prev,.is-horizontal .fancybox__nav .f-button.is-prev{left:var(--f-button-prev-pos)}.is-horizontal .f-carousel__nav .f-button.is-next,.is-horizontal .fancybox__nav .f-button.is-next{right:var(--f-button-next-pos)}.is-horizontal.is-rtl .f-carousel__nav .f-button.is-prev,.is-horizontal.is-rtl .fancybox__nav .f-button.is-prev{left:auto;right:var(--f-button-next-pos)}.is-horizontal.is-rtl .f-carousel__nav .f-button.is-next,.is-horizontal.is-rtl .fancybox__nav .f-button.is-next{right:auto;left:var(--f-button-prev-pos)}.is-vertical .f-carousel__nav .f-button.is-prev,.is-vertical .f-carousel__nav .f-button.is-next,.is-vertical .fancybox__nav .f-button.is-prev,.is-vertical .fancybox__nav .f-button.is-next{top:auto;left:50%;transform:translateX(-50%)}.is-vertical .f-carousel__nav .f-button.is-prev,.is-vertical .fancybox__nav .f-button.is-prev{top:var(--f-button-next-pos)}.is-vertical .f-carousel__nav .f-button.is-next,.is-vertical .fancybox__nav .f-button.is-next{bottom:var(--f-button-next-pos)}.is-vertical .f-carousel__nav .f-button.is-prev svg,.is-vertical .f-carousel__nav .f-button.is-next svg,.is-vertical .fancybox__nav .f-button.is-prev svg,.is-vertical .fancybox__nav .f-button.is-next svg{transform:rotate(90deg)} \ No newline at end of file diff --git a/dist/carousel/carousel.esm.js b/dist/carousel/carousel.esm.js index f8bb2b10..aa340396 100644 --- a/dist/carousel/carousel.esm.js +++ b/dist/carousel/carousel.esm.js @@ -1 +1 @@ -const t=t=>"object"==typeof t&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t),e=(i,...s)=>{const n=s.length;for(let o=0;o{const o=Array.isArray(n)?[]:{};i[s]||Object.assign(i,{[s]:o}),t(n)?Object.assign(i[s],e(o,n)):Array.isArray(n)?Object.assign(i,{[s]:[...n]}):Object.assign(i,{[s]:n})}))}return i},i=function(t,e){let i=!0;return(...s)=>{i&&(i=!1,t(...s),setTimeout((()=>{i=!0}),e))}},s=(t,e)=>{let i=[];return t.childNodes.forEach((t=>{t.nodeType!==Node.ELEMENT_NODE||e&&!t.matches(e)||i.push(t)})),i},n=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},o=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),a=t=>`${t||""}`.split(" ").filter((t=>!!t)),r=(t,e)=>{a(e).forEach((e=>{t&&t.classList.add(e)}))},h=(t,e)=>{a(e).forEach((e=>{t&&t.classList.remove(e)}))},l=(t,e,i)=>{a(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))},c='
',d=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class u{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?e({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=d(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...s){let n=d(e,t);var o;"string"!=typeof(o=n)||isNaN(o)||isNaN(parseFloat(o))||(n=parseFloat(n)),"true"===n&&(n=!0),"false"===n&&(n=!1),n&&"function"==typeof n&&(n=n.call(this,this,t,...s));let a=d(e,this.options);return a&&"function"==typeof a?n=a.call(this,this,t,...s,n):void 0===n&&(n=a),void 0===n?i:n}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let s="";return i?s=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(s=this.option(`l10n.${e}`)),s||(s=t),s}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(u,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(u,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class g extends u{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,s]of Object.entries(t)){const t=this.option(i),n=this.plugins[i];n||!1===t?n&&!1===t&&(n.detach(),delete this.plugins[i]):e.set(i,new s(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}const p=function(t,e){return!(!t||t===document.body||e&&t===e)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,s=-1!==i.indexOf("hidden"),n=-1!==i.indexOf("visible");return e&&!s&&!n}(t)?t:p(t.parentElement,e))};class f{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const m={passive:!1};class b{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:s=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=s;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,m),this.element.addEventListener("touchmove",this.onMove,m),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,m)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new f(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new f(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new f(t))):[new f(t)],s=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(s.push(t),this.currentPointers[e]=t)}s.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new f(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new f(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,m),this.element.removeEventListener("touchstart",this.onTouchStart,m),this.element.removeEventListener("touchmove",this.onMove,m),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function v(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function y(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}var x;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(x||(x={}));const w=["a","b","c","d","e","f"],P={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:{PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"}},S=t=>t&&null!==t&&t instanceof Element&&"nodeType"in t,T={a:1,b:0,c:0,d:1,e:0,f:0};let M=null,O=null;class E extends g{get isTouchDevice(){return null===O&&(O=window.matchMedia("(hover: none)").matches),O}get isMobile(){return null===M&&(M=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),M}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){return this.content instanceof HTMLImageElement&&!this.content.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of w){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var s;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:x.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},T)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},T)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},E.Plugins),i)),this.emit("init"),this.isContentLoading){if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const e=n(c);t.contains(this.content)?this.spinner=(null===(s=this.content.parentElement)||void 0===s?void 0:s.insertBefore(e,this.content))||null:this.spinner=t.appendChild(e)}this.emit("beforeLoad"),this.content.addEventListener("load",this.onLoad),this.content.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===x.Init&&this.enable()}onError(){this.state!==x.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=x.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new b(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of w)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of w)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,s=i.e+t,n=i.f+e,o=this.getBounds(),{x:a,y:r}=o,h=a.min,l=a.max,c=r.min,d=r.max;let u=0,g=0;return h!==1/0&&sl&&(u=l-s),c!==1/0&&nd&&(g=d-n),Math.abs(u)<.001&&(u=0),Math.abs(g)<.001&&(g=0),Object.assign(Object.assign({},o),{xDiff:u,yDiff:g,inBounds:!u&&!g})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:s,fitHeight:n,fullWidth:o,fullHeight:a}=i;let r=o,h=a;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),l=i?o:s,c=i?a:n,d=this.getMatrix(t),u=new DOMPoint(0,0).matrixTransform(d),g=new DOMPoint(0+l,0).matrixTransform(d),p=new DOMPoint(0+l,0+c).matrixTransform(d),f=new DOMPoint(0,0+c).matrixTransform(d),m=Math.abs(p.x-u.x),b=Math.abs(p.y-u.y),v=Math.abs(f.x-g.x),y=Math.abs(f.y-g.y);r=Math.max(m,v),h=Math.max(b,y)}return{contentWidth:r,contentHeight:h}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const s=i.closest("[data-panzoom-action]"),n=i.closest("[data-panzoom-change]"),o=s||n,a=o&&S(o)?o.dataset:null;if(a){const e=a.panzoomChange,i=a.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const r=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(r.x-this.dragStart.x)>2||Math.abs(r.y-this.dragStart.y)>2))return;this.dragStart.time=0;const h=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},l=this.option("click",t),c=this.option("dblClick",t);c?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&l&&h(l)):(this.emit("dblClick",t),t.defaultPrevented||h(c)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&l&&h(l))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(t,e,i){var s;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const n=this.content.getBoundingClientRect();if(this.dragStart={x:n.x,y:n.y,top:n.top,left:n.left,time:Date.now()},!1===this.option("touch",t))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;if(!i.length){const e=t.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(e.nodeName)||e.closest("[contenteditable]")||e.closest("[data-selectable]")||e.closest("[data-panzoom-change]")||e.closest("[data-panzoom-action]"))return!1;null===(s=window.getSelection())||void 0===s||s.removeAllRanges()}return"mousedown"===t.type&&t.preventDefault(),o(this.targetScale,1e3)===o(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(e),this.emit("touchStart",t),!0}onPointerMove(t,e,i){if(!this.isDragging)return;if(e.length<2&&this.panOnlyZoomed&&o(this.targetScale)<=o(this.minScale))return;if(this.emit("touchMove",t),t.defaultPrevented)return;this.addTrackingPoint(e[0]);const{content:s}=this,n=y(i[0],i[1]),a=y(e[0],e[1]);let r=0,h=0;if(e.length>1){const t=s.getBoundingClientRect();r=n.clientX-t.left-.5*t.width,h=n.clientY-t.top-.5*t.height}const l=v(i[0],i[1]),c=v(e[0],e[1]);let d=l?c/l:1,u=a.clientX-n.clientX,g=a.clientY-n.clientY;this.dragOffset.x+=u,this.dragOffset.y+=g,this.dragOffset.time=Date.now()-this.dragStart.time;let f=o(this.targetScale)===o(this.minScale)&&this.option("lockAxis");if(f&&!this.lockedAxis)if("xy"===f||"y"===f||"touchmove"===t.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void t.preventDefault();const e=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=e>45&&e<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,u=0,g=0}else this.lockedAxis=f;if(p(t.target,this.content)&&(f="x",this.dragOffset.y=0),f&&"xy"!==f&&this.lockedAxis!==f&&o(this.targetScale)===o(this.minScale))return;t.cancelable&&t.preventDefault(),this.container.classList.add(this.cn("isDragging"));const m=this.checkBounds(u,g);this.option("rubberband")?("x"!==this.isInfinite&&(m.xDiff>0&&u<0||m.xDiff<0&&u>0)&&(u*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*m.xDiff))),"y"!==this.isInfinite&&(m.yDiff>0&&g<0||m.yDiff<0&&g>0)&&(g*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*m.yDiff)))):(m.xDiff&&(u=0),m.yDiff&&(g=0));const b=this.targetScale,x=this.minScale,w=this.maxScale;b<.5*x&&(d=Math.max(d,x)),b>1.5*w&&(d=Math.min(d,w)),"y"===this.lockedAxis&&o(b)===o(x)&&(u=0),"x"===this.lockedAxis&&o(b)===o(x)&&(g=0),this.applyChange({originX:r,originY:h,panX:u,panY:g,scale:d,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,e,i){if(i.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(e),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),p(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==x.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of w)this.velocity[t]=0,this.target[t]=this.current[t];const{trackingPoints:t}=this,e=t[0],i=t[t.length-1];let s=0,n=0,a=0;i&&e&&(s=i.clientX-e.clientX,n=i.clientY-e.clientY,a=i.time-e.time);let r=0,h=0,l=0,c=0,d=this.option("decelFriction");const u=this.targetScale;if((uthis.maxScale+1e-5)&&(d=.35),a>0){l=Math.abs(s)>3?s/(a/30):0,c=Math.abs(n)>3?n/(a/30):0;const t=this.option("maxVelocity");t&&(l=Math.max(Math.min(l,t),-1*t),c=Math.max(Math.min(c,t),-1*t))}l&&(r=l/(1/(1-d)-1)),c&&(h=c/(1/(1-d)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&o(u)===this.minScale)&&(r=l=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&o(u)===this.minScale)&&(h=c=0);const g=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(s)),"auto"===p&&(p=parseFloat(s.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(s));const f=(this.option("transformParent")?s.parentElement:null)||s,m=f.getAttribute("style")||"";f.style.setProperty("transform","none","important"),f.style.setProperty("transition","none","important"),f.style.setProperty("animation","none","important"),s instanceof HTMLImageElement&&(f.style.width="",f.style.height=""),f.offsetHeight;const b=s.getBoundingClientRect();let v=b.width,y=b.height,w=0,P=0;if(s instanceof HTMLImageElement&&({width:v,height:y,top:w,left:P}=((t,e,i,s)=>{const n=i/s;return n>t/e?(i=t,s=t/n):(i=e*n,s=e),{width:i,height:s,top:.5*(e-s),left:.5*(t-i)}})(b.width,b.height,g,p)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:b.top-r.top+w,bottom:r.bottom-b.bottom+w,left:b.left-r.left+P,right:r.right-b.right+P,fitWidth:v,fitHeight:y,width:v,height:y,fullWidth:g,fullHeight:p}),f.style.cssText=m,s instanceof HTMLImageElement&&(f.style.width=`${v}px`,f.style.height=`${y}px`),this.setTransform(),!0!==t){let t="";Math.abs(l-n)>1&&(t+="x"),Math.abs(c-a)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(o(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===x.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const t=this.option("bounds");if("auto"!==t)return t;const{contentWidth:e,contentHeight:i}=this.calculateContentDim(this.target);let s=0,n=0,a=0,r=0;const h=this.option("infinite");if(!0===h||this.lockedAxis&&h===this.lockedAxis)s=-1/0,a=1/0,n=-1/0,r=1/0;else{let{containerRect:t,contentRect:h}=this,l=o(this.contentRect.fitWidth*this.targetScale,1e3),c=o(this.contentRect.fitHeight*this.targetScale,1e3),{innerWidth:d,innerHeight:u}=t;if(this.containerRect.width===l&&(d=t.width),this.containerRect.width===c&&(u=t.height),e>d){a=.5*(e-d),s=-1*a;let t=.5*(h.right-h.left);s+=t,a+=t}if(this.contentRect.fitWidth>d&&eu){r=.5*(i-u),n=-1*r;let t=.5*(h.bottom-h.top);n+=t,r+=t}this.contentRect.fitHeight>u&&ithis.maxScale?this.minScale:this.maxScale,toggleCover:this.targetScale>this.coverScale?this.minScale:this.coverScale,toggleZoom:this.targetScale>this.fullScale?this.minScale:this.fullScale}[this.option("click")||""]||this.minScale,s=t.canZoomIn(),n=t.canZoomOut(),a="drag"===this.panMode,r=n&&a;this.targetScale<=this.minScale&&!this.panOnlyZoomed&&(r=!0),(this.contentRect.width-this.contentRect.fitWidth>-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(r=!0),this.contentRect.width*this.targetScalethis.minScale,c=!s&&!r&&n&&o(i)===o(this.minScale);l(e,this.cn("canZoomIn"),h),l(e,this.cn("canZoomOut"),c),l(e,this.cn("isDraggable"),r);for(const t of e.querySelectorAll('[data-panzoom-action="zoomIn"]'))s?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const t of e.querySelectorAll('[data-panzoom-action="zoomOut"]'))n?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const i of e.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){s=t.targetScale.9*t.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:s=this.option("friction"),angle:n=0,originX:o=0,originY:a=0,flipX:r=!1,flipY:h=!1,ignoreBounds:l=!1}){this.state!==x.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:n,originX:o,originY:a,friction:s,flipX:r,flipY:h,ignoreBounds:l})}applyChange({panX:t=0,panY:e=0,scale:i=1,angle:s=0,originX:n=-this.current.e,originY:a=-this.current.f,friction:r=this.option("friction"),flipX:h=!1,flipY:l=!1,ignoreBounds:c=!1,bounce:d=this.option("bounce")}){if(this.state===x.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of w)this.velocity[t]=0;this.friction=r||0,this.ignoreBounds=c;const{current:u}=this,g=u.e,p=u.f,f=this.getMatrix(this.target);let m=(new DOMMatrix).translate(g,p).translate(n,a).translate(t,e);if(this.option("zoom")){if(!c){const t=this.targetScale,e=this.minScale,s=this.maxScale;t*is&&(i=s/t)}m=m.scale(i)}m=m.translate(-n,-a).translate(-g,-p).multiply(f),s&&(m=m.rotate(s)),h&&(m=m.scale(-1,1)),l&&(m=m.scale(1,-1));for(const t of w)"a"!=t&&"d"!=t||!(m[t]>this.minScale+1e-5||m[t].1||"mousemove"===this.panMode||!1===d)&&!c&&this.clampTargetBounds(),this.isResting||(this.state=x.Panning,this.requestTick())}stop(t=!1){if(this.state!==x.Init&&this.state!==x.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of w)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=x.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls()),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(t,e=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=t,"mousemove"!==this.panMode||!t)return;if(o(this.targetScale)<=o(this.minScale))return;this.emit("mouseMove",t);const{container:i,containerRect:s,contentRect:n}=this,a=s.width,r=s.height,h=i.getBoundingClientRect(),l=(t.clientX||0)-h.left,c=(t.clientY||0)-h.top;let{contentWidth:d,contentHeight:u}=this.calculateContentDim(this.target);const g=this.option("mouseMoveFactor");g>1&&(d!==a&&(d*=g),u!==r&&(u*=g));let p=.5*(d-a)-l/a*100/100*(d-a);p+=.5*(n.right-n.left);let f=.5*(u-r)-c/r*100/100*(u-r);f+=.5*(n.bottom-n.top),this.applyChange({panX:p-this.target.e,panY:f-this.target.f,friction:e})}zoomWithWheel(t){if(this.state===x.Destroy||this.state===x.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),s=this.targetScale,n=this.maxScale,o=this.minScale;let a=s*(100+i*e)/100;an&&s>=n?(this.wheelDelta+=Math.abs(i),a=n):(this.wheelDelta=0,a=Math.max(Math.min(a,n),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),a!==s&&this.zoomTo(a,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale>.9*this.maxScale?"fit":"max",t)}toggleCover(t){this.zoomTo(this.targetScale>.9*this.coverScale?"fit":"cover",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:s=0,event:n}={}){if(this.isContentLoading||this.state===x.Destroy)return;this.stop();const{targetScale:o}=this;let a=1;if("mousemove"===this.panMode&&(n=this.prevMouseMoveEvent||n),n){const t=this.content.getBoundingClientRect(),e=n.clientX||0,o=n.clientY||0;i=e-t.left-.5*t.width,s=o-t.top-.5*t.height}const r=this.fullScale,h=this.maxScale;let l=this.coverScale;"number"==typeof t?a=t/o:("next"===t&&(r-l<.2&&(l=r),t=o1?.15:.25:e,this.applyChange({scale:a,originX:i,originY:s,friction:e}),n&&"mousemove"===this.panMode&&this.panWithMouse(n,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const s=t.classList.contains(e);s?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(s?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:s,d:n,e:o,f:a}=t;return new DOMMatrix([e,i,s,n,o,a])}reset(t){if(this.state!==x.Init&&this.state!==x.Destroy){this.stop("current");for(const t of w)this.target[t]=T[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=x.Panning,this.requestTick())}}destroy(){this.stop(),this.state=x.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(E,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:P}),Object.defineProperty(E,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const z={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var k;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"}(k||(k={}));const R=t=>{if("string"==typeof t&&(t={html:t}),!(t instanceof String||t instanceof HTMLElement)){const e=t.thumb;void 0!==e&&("string"==typeof e&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},D=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class L extends u{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const A={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'',dynamicFrom:11,maxCount:1/0,minCount:2};class C extends L{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let t=this.list;return t||(t=document.createElement("ul"),r(t,this.cn("list")),t.setAttribute("role","tablist"),this.instance.container.appendChild(t),r(this.instance.container,this.cn("hasDots")),this.list=t),t}refresh(){var t;const e=this.instance.pages.length,i=Math.min(2,this.option("minCount")),s=Math.max(2e3,this.option("maxCount")),n=this.option("dynamicFrom");if(es)return void this.cleanup();const o="number"==typeof n&&e>5&&e>=n,a=!this.list||this.isDynamic!==o||this.list.children.length!==e;a&&this.cleanup();const c=this.build();if(l(c,this.cn("isDynamic"),!!o),a)for(let t=0;t=e-1&&n.setAttribute("disabled","")))}createButton(t){const e=this.instance,i=document.createElement("button");i.setAttribute("tabindex","0"),i.setAttribute("title",e.localize(`{{${t.toUpperCase()}}}`)),r(i,this.cn("button")+" "+this.cn("next"===t?"isNext":"isPrev"));const s=e.isRTL?"next"===t?"prev":"next":t;var n;return i.innerHTML=e.localize(this.option(`${s}Tpl`)),i.dataset[`carousel${n=t,n?n.match("^[a-z]")?n.charAt(0).toUpperCase()+n.substring(1):n:""}`]="true",i}build(){let t=this.container;t||(this.container=t=document.createElement("div"),r(t,this.cn("container")),this.instance.container.appendChild(t)),this.next||(this.next=t.appendChild(this.createButton("next"))),this.prev||(this.prev=t.appendChild(this.createButton("prev")))}cleanup(){this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove(),this.prev=null,this.next=null,this.container=null}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(j,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'',prevTpl:''}});class F extends L{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){this.nav&&this.target&&(this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.state===k.Ready&&this.onNavReady(this.nav),this.target.on("ready",this.onTargetReady),this.target.state===k.Ready&&this.onTargetReady(this.target))}onNavReady(t){t.on("createSlide",this.onNavCreateSlide),t.on("Panzoom.click",this.onNavClick),this.onTargetChange()}onTargetReady(t){t.on("change",this.onTargetChange),t.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(t,e,i){var s,n;const o=i.target,{nav:a,target:r}=this;if(!a||!r||!o)return;const h=o.closest("[data-index]");if(!h)return;i.stopPropagation();const l=parseInt(h.dataset.index||"",10)||0,c=a.getPageForSlide(l);a.page!==c&&a.slideTo(c);const d=r.getPageForSlide(l);r.page!==d&&r.slideTo(d,{friction:null===(n=null===(s=this.nav)||void 0===s?void 0:s.plugins)||void 0===n?void 0:n.Sync.option("friction")}),this.markSelectedSlide(l)}onNavCreateSlide(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}onTargetChange(){const{target:t,nav:e}=this;if(!t||!e)return;if(e.state!==k.Ready||t.state!==k.Ready)return;const i=t.pages[t.page].slides[0].index,s=e.getPageForSlide(i);e.slideTo(s),this.markSelectedSlide(i)}markSelectedSlide(t){const{nav:e}=this;if(!e)return;this.selectedIndex=t,[...e.slides].filter((t=>t.el&&t.el.classList.remove("is-nav-selected")));const i=e.slides[t];i&&i.el&&i.el.classList.add("is-nav-selected")}attach(){let t=this.options.target,e=this.options.nav;t?this.addAsNavFor(t):e&&this.addAsTargetFor(e)}detach(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.nav=null,this.target&&(this.target.off("ready",this.onTargetReady),this.target.off("refresh",this.onTargetChange),this.target.off("change",this.onTargetChange)),this.target=null}}Object.defineProperty(F,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const H={Navigation:j,Dots:C,Sync:F};class I extends g{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===k.Ready}get isInfinite(){let t=!1;const e=this.contentDim,i=this.viewportDim;return this.pages.length>=2&&e>1.5*i&&(t=this.option("infinite")),t}get isRTL(){return"rtl"===this.option("direction")}get isHorizontal(){return"x"===this.option("axis")}constructor(t,e={},s={}){if(super(),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:k.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),"string"==typeof t&&(t=document.querySelector(t)),!t||!S(t))throw new Error("No Element found");this.container=t,this.slideNext=i(this.slideNext.bind(this),175),this.slidePrev=i(this.slidePrev.bind(this),175),this.userOptions=e,this.userPlugins=s,queueMicrotask((()=>{this.processOptions()}))}processOptions(){const i=e({},I.defaults,this.userOptions);let s="";const n=i.breakpoints;if(n&&t(n))for(const[o,a]of Object.entries(n))window.matchMedia(o).matches&&t(a)&&(s+=o,e(i,a));s===this.bp&&this.state!==k.Init||(this.bp=s,this.state===k.Ready&&(i.initialSlide=this.pages[this.page].slides[0].index),this.state!==k.Init&&this.destroy(),super.setOptions(i),!1===this.option("enabled")?this.attachEvents():setTimeout((()=>{this.init()}),0))}init(){this.state=k.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},I.Plugins),this.userPlugins)),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=k.Ready,this.emit("ready")}initLayout(){const{container:t}=this,e=this.option("classes");r(t,this.cn("container")),l(t,e.isLTR,!this.isRTL),l(t,e.isRTL,this.isRTL),l(t,e.isVertical,!this.isHorizontal),l(t,e.isHorizontal,this.isHorizontal);let i=this.option("viewport")||t.querySelector(`.${e.viewport}`);i||(i=document.createElement("div"),r(i,e.viewport),i.append(...s(t,`.${e.slide}`)),t.prepend(i));let n=this.option("track")||t.querySelector(`.${e.track}`);n||(n=document.createElement("div"),r(n,e.track),n.append(...Array.from(i.childNodes))),n.setAttribute("aria-live","polite"),i.contains(n)||i.prepend(n),this.viewport=i,this.track=n,this.emit("initLayout")}initSlides(){const{track:t}=this;if(t){this.slides=[],[...s(t,`.${this.cn("slide")}`)].forEach((t=>{if(S(t)){const e=R({el:t,isDom:!0,index:this.slides.length});this.slides.push(e),this.emit("initSlide",e,this.slides.length)}}));for(let t of this.option("slides",[])){const e=R(t);e.index=this.slides.length,this.slides.push(e),this.emit("initSlide",t,this.slides.length)}this.emit("initSlides")}}setInitialPage(){let t=0;const e=this.option("initialSlide");t="number"==typeof e?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0,this.page=t}setInitialPosition(){if(!this.track||!this.pages.length)return;let t=this.page;this.pages[t]||(this.page=t=0);const e=this.pages[t].pos*(this.isRTL&&this.isHorizontal?1:-1),i=this.isHorizontal?`${e}px`:"0",s=this.isHorizontal?"0":`${e}px`;this.track.style.transform=`translate3d(${i}, ${s}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const t=this.option("Panzoom")||{};this.panzoom=new E(this.viewport,e({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,decelFriction:.12,click:!1,dblClick:!1,touch:t=>!(this.pages.length<2&&!t.options.infinite),bounds:()=>this.getBounds(),maxVelocity:t=>Math.abs(t.target[this.axis]-t.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on("*",((t,e,...i)=>{this.emit(`Panzoom.${e}`,t,...i)})),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation),this.panzoom.on("touchStart",((t,e)=>{this.inTransition.size&&e.preventDefault()}))}attachEvents(){const t=this.container;t&&(t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let t=[];const{contentDim:e,viewportDim:i}=this,s=this.option("slidesPerPage");if("number"==typeof s&&e>i){for(let e=0;ei)&&(t.push(D()),n=t.length-1,o=0),o+=e.dim+e.gap,t[n].slides.push(e);return t}processPages(){const t=this.pages,{contentDim:e,viewportDim:i}=this,s=this.option("center"),n=this.option("fill");if(t.forEach(((t,e)=>{t.index=e,t.pos=t.slides[0].pos,t.dim=0;for(const[e,i]of t.slides.entries())t.dim+=i.dim,e{n&&!this.isInfinite&&e>i&&(t.pos=Math.max(t.pos,0),t.pos=Math.min(t.pos,e-i)),t.pos=o(t.pos,1e3),t.dim=o(t.dim,1e3)})),this.isInfinite)return t;const a=[];let r;return t.forEach((t=>{const e=Object.assign({},t);r&&e.pos===r.pos?(r.dim+=e.dim,r.slides=[...r.slides,...e.slides]):(e.index=a.length,r=e,a.push(e))})),a}getPageFromIndex(t=0){const e=this.pages.length;let i;return t=parseInt((t||0).toString())||0,i=this.isInfinite?(t%e+e)%e:Math.max(Math.min(t,this.pages.length-1),0),i}getSlideMetrics(t){const e=this.isHorizontal?"width":"height";let i=0,s=0,n=t.el;n?i=parseFloat(n.dataset[e]||"")||0:(n=document.createElement("div"),n.style.visibility="hidden",r(n,this.cn("slide")+" "+t.class),(this.track||document.body).prepend(n)),i?(n.style[e]=`${i}px`,n.style["width"===e?"height":"width"]=""):i=n.getBoundingClientRect()[e];const o=getComputedStyle(n);return"content-box"===o.boxSizing&&(this.isHorizontal?(i+=parseFloat(o.paddingLeft)||0,i+=parseFloat(o.paddingRight)||0):(i+=parseFloat(o.paddingTop)||0,i+=parseFloat(o.paddingBottom)||0)),s=parseFloat(o[this.isHorizontal?"marginRight":"marginBottom"])||0,this.isHorizontal,t.el||n.remove(),{dim:i,gap:s}}getBounds(){let t={min:0,max:0};if(this.isInfinite)t={min:-1/0,max:1/0};else if(this.pages.length){const e=this.pages[0].pos,i=this.pages[this.pages.length-1].pos;t=this.isRTL&&this.isHorizontal?{min:e,max:i}:{min:-1*i,max:-1*e}}return{x:this.isHorizontal?t:{min:0,max:0},y:this.isHorizontal?{min:0,max:0}:t}}repositionSlides(){const{viewportDim:t,contentDim:e,page:i,pages:s}=this;let n,a=0,r=0,h=0,l=0;this.panzoom?l=-1*this.panzoom.current[this.isHorizontal?"e":"f"]:s[i]&&(l=s[i].pos||0),n=this.isHorizontal?this.isRTL?"right":"left":"top",this.isRTL&&this.isHorizontal&&(l*=-1);for(const t of this.slides)t.el?("top"===n?(t.el.style.right="",t.el.style.left=""):t.el.style.top="",t.index!==a?t.el.style[n]=0===r?"":`${r}px`:t.el.style[n]="",h+=t.dim+t.gap,a++):r+=t.dim+t.gap;if(this.isInfinite&&h)for(const i of this.slides)i.el&&(o(i.pos)o(e-t)&&(i.el.style[n]=`${r+h}px`),o(i.pos+i.gap)>=o(e-t)&&o(i.pos)>o(l+t)&&o(l)1&&(c=this.pages[u[0]],d=this.pages[u[1]]),c&&d){let t=0;for(const e of this.slides)e.el?this.inTransition.has(e.index)&&c.slides.indexOf(e)<0&&(e.el.style[n]=`${t+(c.pos-d.pos)}px`):t+=e.dim+e.gap}}createSlideEl(t){if(!this.track||!t)return;if(t.el)return;const e=document.createElement("div");r(e,this.cn("slide")),r(e,t.class),t.html&&(e.innerHTML=t.html);const i=[];this.slides.forEach(((t,e)=>{t.el&&i.push(e)}));const s=t.index;let n=null;if(i.length){let t=i.reduce(((t,e)=>Math.abs(e-s)this.page?1:-1,a=this.pages[n].pos*(this.isRTL?1:-1);if(this.page===n&&a===s.target[this.axis])return!1;this.clearTransitions();const h=s.isResting;r(this.container,this.cn("inTransition"));const l=this.pages[this.page].slides[0],c=this.pages[n].slides[0];this.inTransition.add(c.index),this.createSlideEl(c);let d=l.el,u=c.el;h||"slide"===e||(e="fadeFast",d=null);const g=this.isRTL?"next":"prev",p=this.isRTL?"prev":"next";return d&&(this.inTransition.add(l.index),l.transition=e,d.addEventListener("animationend",this.onAnimationEnd),d.classList.add(`f-${e}Out`,`to-${o>0?p:g}`)),u&&(c.transition=e,u.addEventListener("animationend",this.onAnimationEnd),u.classList.add(`f-${e}In`,`from-${o>0?g:p}`)),s.panTo({x:this.isHorizontal?a:0,y:this.isHorizontal?0:a,friction:0}),this.onChange(n),!0}manageSlideVisiblity(){const t=new Set,e=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const s of this.slides)i.has(s)?t.add(s):e.add(s);for(const e of this.inTransition)t.add(this.slides[e]);for(const e of t)this.createSlideEl(e),this.lazyLoadSlide(e);for(const i of e)t.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t="aria-hidden";let e=this.cn("isSelected");if(e)for(const i of this.slides)i.el&&(i.el.dataset.index=`${i.index}`,this.pages[this.page].slides.includes(i)?(i.el.classList.contains(e)||(r(i.el,e),this.emit("selectSlide",i)),i.el.removeAttribute(t)):(i.el.classList.contains(e)&&(h(i.el,e),this.emit("unselectSlide",i)),i.el.setAttribute(t,"true")))}flipInfiniteTrack(){const t=this.panzoom;if(!t||!this.isInfinite)return;const e="x"===this.option("axis")?"e":"f",{viewportDim:i,contentDim:s}=this;let n=t.current[e],o=t.target[e]-n,a=0,r=.5*i,h=s;this.isRTL&&this.isHorizontal?(n<-r&&(a=-1,n+=h),n>h-r&&(a=1,n-=h)):(n>r&&(a=1,n-=h),n<-h+r&&(a=-1,n+=h)),a&&(t.current[e]=n,t.target[e]=n+o)}lazyLoadSlide(t){const e=this,i=t&&t.el;if(!i)return;const s=new Set;i.querySelectorAll("[data-lazy-srcset]").forEach((t=>{t instanceof HTMLImageElement&&s.add(t)})),i.querySelectorAll("[data-lazy-src]").forEach((t=>{t instanceof HTMLImageElement?s.add(t):S(t)&&(t.style.backgroundImage=`url('${t.dataset.lazySrc||""}')`)}));const o=(t,i,s)=>{s&&(s.remove(),s=null),i.complete&&(i.style.display=""),this.option("adaptiveHeight")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&e.setViewportHeight()};for(const e of s){let i=null;e.src=e.dataset.lazySrcset||e.dataset.lazySrc||"",delete e.dataset.lazySrc,delete e.dataset.lazySrcset,e.style.display="none",e.addEventListener("error",(()=>{o(t,e,i)})),e.addEventListener("load",(()=>{o(t,e,i)})),setTimeout((()=>{!e.complete&&e.parentNode&&t.el&&(i=n(c),e.parentNode.insertBefore(i,e))}),300)}let a=i.dataset.lazySrc;a&&a.length&&(i.style.backgroundImage=`url('${a}')`)}clearTransitions(){this.inTransition.clear(),h(this.container,this.cn("inTransition"));const t=["to-prev","to-next","from-prev","from-next"];for(const e of this.slides){const i=e.el;if(i){i.removeEventListener("animationend",this.onAnimationEnd),i.classList.remove(...t);const s=e.transition;s&&i.classList.remove(`f-${s}Out`,`f-${s}In`)}}this.manageSlideVisiblity()}onAnimationEnd(t){const e=t.target,i=e?parseInt(e.dataset.index||"",10)||0:-1,s=this.slides[i],n=t.animationName;if(!e||!s||!n)return;const o=!!this.inTransition.has(i)&&s.transition;o&&n.substring(0,o.length+2)===`f-${o}`&&this.inTransition.delete(i),this.inTransition.size||this.clearTransitions(),i===this.page&&this.emit("settle")}onDecel(t,e=0,i=0){const s=this.isInfinite,n=this.isHorizontal?e:i,o=this.pages.length;if(!o)return;const a=this.option("dragFree");let r=this.page,h=0;const l=this.axis;!s&&(t.target[l],this.viewportDim);const c=t.current[l]*(this.isRTL&&this.isHorizontal?1:-1);let{pageIndex:d}=this.getPageFromPosition(c);if(a||Math.abs(n)<10){const e=t.target[l]*(this.isRTL&&this.isHorizontal?1:-1),{pageIndex:i}=this.getPageFromPosition(e);r=i}else r=this.isRTL&&this.isHorizontal?n<0?d-1:d+1:n<0?d+1:d-1,s||(r=Math.max(0,Math.min(r,this.pages.length-1)));if(s&&(h=Math.floor(r/o)||0),r=(r%o+o)%o,a&&t.dragOffset["e"===l?"x":"y"]);else{const e=this.contentDim;let i=(this.pages[r].pos+h*e)*(this.isRTL&&this.isHorizontal?1:-1);if(Math.abs(t.target[l]-i)<.1&&t.lockedAxis===("e"==l?"y":"x"))return;if(t.target[l]===i)return;t.applyChange({panX:this.isHorizontal?i-t.target.e:0,panY:this.isHorizontal?0:i-t.target.f,friction:t.option("decelFriction")})}r!==this.page&&this.onChange(r)}onClick(t){const e=t.target,i=e&&S(e)?e.dataset:null;let s;i&&(void 0!==i.carouselPage?s="slideTo":void 0!==i.carouselNext?s="slideNext":void 0!==i.carouselPrev&&(s="slidePrev")),s?(t.preventDefault(),t.stopPropagation(),e&&!e.hasAttribute("disabled")&&this[s](i&&"slideTo"===s?i.carouselPage:void 0)):this.emit("click",t)}onSlideTo(t){const e=t.detail||0;this.slideTo(this.getPageForSlide(e),{friction:0})}onChange(t,e=0){const i=this.page;this.prevPage=i,this.page=t,this.option("adaptiveHeight")&&this.setViewportHeight(),this.emit("change",t,i,e)}onRefresh(t,e=""){let i=this.contentDim,s=this.viewportDim;this.updateMetrics(),this.contentDim===i&&this.viewportDim===s||this.slideTo(this.page,{friction:0,transition:!1})}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(){this.flipInfiniteTrack(),this.manageSlideVisiblity()}onEndAnimation(){this.emit("settle")}reInit(t=null,e=null){this.destroy(),this.state=k.Init,this.userOptions=t||this.userOptions,this.userPlugins=e||this.userPlugins,this.processOptions()}slideTo(t=0,{friction:e=this.option("friction"),transition:i=this.option("transition")}={}){const s=this.panzoom,n=this.pages.length;if(!s||!n)return;if(this.transitionTo(t,i))return;const o=this.axis,a=this.getPageFromIndex(t);let r=this.pages[a].pos,h=0;if(this.isInfinite){const t=s.current[o]*(this.isRTL&&this.isHorizontal?1:-1),e=this.contentDim,i=r+e,n=r-e;Math.abs(t-i){t.el&&(n=Math.max(n,t.el.offsetHeight))}))),i.style.height=n?`${n}px`:""}getPageForSlide(t){for(const e of this.pages)for(const i of e.slides)if(i.index===t)return e.index;return-1}getVisibleSlides(t=0){var e;const i=new Set;let{contentDim:s,viewportDim:n,pages:a,page:r}=this;s=s+(null===(e=this.slides[this.slides.length-1])||void 0===e?void 0:e.gap)||0;let h=0;h=this.panzoom?-1*this.panzoom.current[this.axis]:a[r]&&a[r].pos||0,this.isInfinite&&(h-=Math.floor(h/s)*s),this.isRTL&&this.isHorizontal&&(h*=-1),h=o(h,1e3);const l=o(h-n*t,1e3),c=o(h+n*(t+1),1e3),d=this.isInfinite?[-1,0,1]:[0];for(const t of this.slides)for(const e of d){const n=t.pos+e*s,o=t.pos+t.dim+t.gap+e*s;nl&&i.add(t)}return i}getPageFromPosition(t){const{viewportDim:e,contentDim:i}=this,s=this.pages.length;let n=0,o=0;const a=this.option("center");a&&(t+=.5*e),this.isInfinite||(t=Math.max(this.slides[0].pos,Math.min(t,this.slides[this.slides.length-1].pos)));const r=i+this.slides[this.slides.length-1].gap,h=Math.floor(t/r)||0;t-=h*r;let l=this.slides[this.slides.length-1],c=this.slides.find((e=>{const i=t+(l&&!a?.5*l.dim:0);return l=e,e.pos<=i&&e.pos+e.dim+e.gap>i}));return c||(c=this.slides[this.slides.length-1]),o=this.getPageForSlide(c.index),n=o+h*s,{page:n,pageIndex:o}}destroy(){if([k.Destroy].includes(this.state))return;this.state=k.Destroy;const{container:t,viewport:e,track:i,slides:s,panzoom:n}=this,o=this.option("classes");t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),t.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),n&&(n.destroy(),this.panzoom=null),s&&s.forEach((t=>{this.removeSlideEl(t)})),this.detachPlugins(),this.track=null,this.viewport=null,this.page=0,e&&i&&e.replaceWith(...i.childNodes);for(const[e,i]of Object.entries(o))"container"!==e&&i&&t.classList.remove(i);this.slides=[];const a=this.events.get("ready");this.events=new Map,a&&this.events.set("ready",a)}}Object.defineProperty(I,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:E}),Object.defineProperty(I,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:z}),Object.defineProperty(I,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:H});export{I as Carousel}; +const t=t=>"object"==typeof t&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t),e=(i,...s)=>{const n=s.length;for(let o=0;o{const o=Array.isArray(n)?[]:{};i[s]||Object.assign(i,{[s]:o}),t(n)?Object.assign(i[s],e(o,n)):Array.isArray(n)?Object.assign(i,{[s]:[...n]}):Object.assign(i,{[s]:n})}))}return i},i=function(t,e){let i=!0;return(...s)=>{i&&(i=!1,t(...s),setTimeout((()=>{i=!0}),e))}},s=(t,e)=>{let i=[];return t.childNodes.forEach((t=>{t.nodeType!==Node.ELEMENT_NODE||e&&!t.matches(e)||i.push(t)})),i},n=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},o=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),a=t=>`${t||""}`.split(" ").filter((t=>!!t)),r=(t,e)=>{a(e).forEach((e=>{t&&t.classList.add(e)}))},h=(t,e)=>{a(e).forEach((e=>{t&&t.classList.remove(e)}))},l=(t,e,i)=>{a(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))},c='
',d=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class u{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?e({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=d(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...s){let n=d(e,t);var o;"string"!=typeof(o=n)||isNaN(o)||isNaN(parseFloat(o))||(n=parseFloat(n)),"true"===n&&(n=!0),"false"===n&&(n=!1),n&&"function"==typeof n&&(n=n.call(this,this,t,...s));let a=d(e,this.options);return a&&"function"==typeof a?n=a.call(this,this,t,...s,n):void 0===n&&(n=a),void 0===n?i:n}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let s="";return i?s=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(s=this.option(`l10n.${e}`)),s||(s=t),s}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(u,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(u,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class g extends u{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,s]of Object.entries(t)){const t=this.option(i),n=this.plugins[i];n||!1===t?n&&!1===t&&(n.detach(),delete this.plugins[i]):e.set(i,new s(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}const p=function(t,e){return!(!t||t===document.body||e&&t===e)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,s=-1!==i.indexOf("hidden"),n=-1!==i.indexOf("visible");return e&&!s&&!n}(t)?t:p(t.parentElement,e))};class f{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const m={passive:!1};class b{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:s=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=s;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,m),this.element.addEventListener("touchmove",this.onMove,m),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,m)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new f(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new f(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new f(t))):[new f(t)],s=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(s.push(t),this.currentPointers[e]=t)}s.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new f(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new f(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,m),this.element.removeEventListener("touchstart",this.onTouchStart,m),this.element.removeEventListener("touchmove",this.onMove,m),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function v(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function y(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}var x;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(x||(x={}));const w=["a","b","c","d","e","f"],P={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:{PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"}},S=t=>t&&null!==t&&t instanceof Element&&"nodeType"in t,T={a:1,b:0,c:0,d:1,e:0,f:0};let M=null,O=null;class E extends g{get isTouchDevice(){return null===O&&(O=window.matchMedia("(hover: none)").matches),O}get isMobile(){return null===M&&(M=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),M}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const t=this.content;return!!(t&&t instanceof HTMLImageElement)&&!t.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of w){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var s;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:x.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},T)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},T)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},E.Plugins),i)),this.emit("init"),this.isContentLoading){const e=this.content;if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const i=n(c);t.contains(e)?this.spinner=(null===(s=e.parentElement)||void 0===s?void 0:s.insertBefore(i,e))||null:this.spinner=t.appendChild(i)}this.emit("beforeLoad"),e.addEventListener("load",this.onLoad),e.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===x.Init&&this.enable()}onError(){this.state!==x.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=x.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new b(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of w)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of w)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,s=i.e+t,n=i.f+e,o=this.getBounds(),{x:a,y:r}=o,h=a.min,l=a.max,c=r.min,d=r.max;let u=0,g=0;return h!==1/0&&sl&&(u=l-s),c!==1/0&&nd&&(g=d-n),Math.abs(u)<.001&&(u=0),Math.abs(g)<.001&&(g=0),Object.assign(Object.assign({},o),{xDiff:u,yDiff:g,inBounds:!u&&!g})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:s,fitHeight:n,fullWidth:o,fullHeight:a}=i;let r=o,h=a;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),l=i?o:s,c=i?a:n,d=this.getMatrix(t),u=new DOMPoint(0,0).matrixTransform(d),g=new DOMPoint(0+l,0).matrixTransform(d),p=new DOMPoint(0+l,0+c).matrixTransform(d),f=new DOMPoint(0,0+c).matrixTransform(d),m=Math.abs(p.x-u.x),b=Math.abs(p.y-u.y),v=Math.abs(f.x-g.x),y=Math.abs(f.y-g.y);r=Math.max(m,v),h=Math.max(b,y)}return{contentWidth:r,contentHeight:h}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const s=i.closest("[data-panzoom-action]"),n=i.closest("[data-panzoom-change]"),o=s||n,a=o&&S(o)?o.dataset:null;if(a){const e=a.panzoomChange,i=a.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const r=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(r.x-this.dragStart.x)>2||Math.abs(r.y-this.dragStart.y)>2))return;this.dragStart.time=0;const h=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},l=this.option("click",t),c=this.option("dblClick",t);c?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&l&&h(l)):(this.emit("dblClick",t),t.defaultPrevented||h(c)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&l&&h(l))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(t,e,i){var s;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const n=this.content.getBoundingClientRect();if(this.dragStart={x:n.x,y:n.y,top:n.top,left:n.left,time:Date.now()},!1===this.option("touch",t))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;if(!i.length){const e=t.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(e.nodeName)||e.closest("[contenteditable]")||e.closest("[data-selectable]")||e.closest("[data-panzoom-change]")||e.closest("[data-panzoom-action]"))return!1;null===(s=window.getSelection())||void 0===s||s.removeAllRanges()}return"mousedown"===t.type&&t.preventDefault(),o(this.targetScale,1e3)===o(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(e),this.emit("touchStart",t),!0}onPointerMove(t,e,i){if(!this.isDragging)return;if(e.length<2&&this.panOnlyZoomed&&o(this.targetScale)<=o(this.minScale))return;if(this.emit("touchMove",t),t.defaultPrevented)return;this.addTrackingPoint(e[0]);const{content:s}=this,n=y(i[0],i[1]),a=y(e[0],e[1]);let r=0,h=0;if(e.length>1){const t=s.getBoundingClientRect();r=n.clientX-t.left-.5*t.width,h=n.clientY-t.top-.5*t.height}const l=v(i[0],i[1]),c=v(e[0],e[1]);let d=l?c/l:1,u=a.clientX-n.clientX,g=a.clientY-n.clientY;this.dragOffset.x+=u,this.dragOffset.y+=g,this.dragOffset.time=Date.now()-this.dragStart.time;let f=o(this.targetScale)===o(this.minScale)&&this.option("lockAxis");if(f&&!this.lockedAxis)if("xy"===f||"y"===f||"touchmove"===t.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void t.preventDefault();const e=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=e>45&&e<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,u=0,g=0}else this.lockedAxis=f;if(p(t.target,this.content)&&(f="x",this.dragOffset.y=0),f&&"xy"!==f&&this.lockedAxis!==f&&o(this.targetScale)===o(this.minScale))return;t.cancelable&&t.preventDefault(),this.container.classList.add(this.cn("isDragging"));const m=this.checkBounds(u,g);this.option("rubberband")?("x"!==this.isInfinite&&(m.xDiff>0&&u<0||m.xDiff<0&&u>0)&&(u*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*m.xDiff))),"y"!==this.isInfinite&&(m.yDiff>0&&g<0||m.yDiff<0&&g>0)&&(g*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*m.yDiff)))):(m.xDiff&&(u=0),m.yDiff&&(g=0));const b=this.targetScale,x=this.minScale,w=this.maxScale;b<.5*x&&(d=Math.max(d,x)),b>1.5*w&&(d=Math.min(d,w)),"y"===this.lockedAxis&&o(b)===o(x)&&(u=0),"x"===this.lockedAxis&&o(b)===o(x)&&(g=0),this.applyChange({originX:r,originY:h,panX:u,panY:g,scale:d,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,e,i){if(i.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(e),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),p(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==x.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of w)this.velocity[t]=0,this.target[t]=this.current[t];h(this.container,"is-scaling"),h(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:t}=this,e=t[0],i=t[t.length-1];let s=0,n=0,a=0;i&&e&&(s=i.clientX-e.clientX,n=i.clientY-e.clientY,a=i.time-e.time);let r=0,l=0,c=0,d=0,u=this.option("decelFriction");const g=this.targetScale;if((gthis.maxScale+1e-5)&&(u=.35),a>0){c=Math.abs(s)>3?s/(a/30):0,d=Math.abs(n)>3?n/(a/30):0;const t=this.option("maxVelocity");t&&(c=Math.max(Math.min(c,t),-1*t),d=Math.max(Math.min(d,t),-1*t))}c&&(r=c/(1/(1-u)-1)),d&&(l=d/(1/(1-u)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&o(g)===this.minScale)&&(r=c=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&o(g)===this.minScale)&&(l=d=0);const p=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(s)),"auto"===p&&(p=parseFloat(s.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(s));const f=(this.option("transformParent")?s.parentElement:null)||s,m=f.getAttribute("style")||"";f.style.setProperty("transform","none","important"),f.style.setProperty("transition","none","important"),f.style.setProperty("animation","none","important"),s instanceof HTMLImageElement&&(f.style.width="",f.style.height=""),f.offsetHeight;const b=s.getBoundingClientRect();let v=b.width,y=b.height,w=0,P=0;if(s instanceof HTMLImageElement&&({width:v,height:y,top:w,left:P}=((t,e,i,s)=>{const n=i/s;return n>t/e?(i=t,s=t/n):(i=e*n,s=e),{width:i,height:s,top:.5*(e-s),left:.5*(t-i)}})(b.width,b.height,g,p)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:b.top-r.top+w,bottom:r.bottom-b.bottom+w,left:b.left-r.left+P,right:r.right-b.right+P,fitWidth:v,fitHeight:y,width:v,height:y,fullWidth:g,fullHeight:p}),f.style.cssText=m,s instanceof HTMLImageElement&&(f.style.width=`${v}px`,f.style.height=`${y}px`),this.setTransform(),!0!==t){let t="";Math.abs(l-n)>1&&(t+="x"),Math.abs(c-a)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(o(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===x.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const t=this.option("bounds");if("auto"!==t)return t;const{contentWidth:e,contentHeight:i}=this.calculateContentDim(this.target);let s=0,n=0,a=0,r=0;const h=this.option("infinite");if(!0===h||this.lockedAxis&&h===this.lockedAxis)s=-1/0,a=1/0,n=-1/0,r=1/0;else{let{containerRect:t,contentRect:h}=this,l=o(this.contentRect.fitWidth*this.targetScale,1e3),c=o(this.contentRect.fitHeight*this.targetScale,1e3),{innerWidth:d,innerHeight:u}=t;if(this.containerRect.width===l&&(d=t.width),this.containerRect.width===c&&(u=t.height),e>d){a=.5*(e-d),s=-1*a;let t=.5*(h.right-h.left);s+=t,a+=t}if(this.contentRect.fitWidth>d&&eu){r=.5*(i-u),n=-1*r;let t=.5*(h.bottom-h.top);n+=t,r+=t}this.contentRect.fitHeight>u&&i-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(r=!0),this.contentRect.width*this.targetScaleo(this.targetScale),c=!h&&!r&&n&&o(i).9*t.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:s=this.option("friction"),angle:n=0,originX:o=0,originY:a=0,flipX:r=!1,flipY:h=!1,ignoreBounds:l=!1}){this.state!==x.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:n,originX:o,originY:a,friction:s,flipX:r,flipY:h,ignoreBounds:l})}applyChange({panX:t=0,panY:e=0,scale:i=1,angle:s=0,originX:n=-this.current.e,originY:a=-this.current.f,friction:r=this.option("friction"),flipX:h=!1,flipY:l=!1,ignoreBounds:c=!1,bounce:d=this.option("bounce")}){const u=this.state;if(u===x.Init||u===x.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of w)this.velocity[t]=0;this.friction=r||0,this.ignoreBounds=c;const{current:g}=this,p=g.e,f=g.f,m=this.getMatrix(this.target);let b=(new DOMMatrix).translate(p,f).translate(n,a).translate(t,e);if(this.option("zoom")){if(!c){const t=this.targetScale,e=this.minScale,s=this.maxScale;t*is&&(i=s/t)}b=b.scale(i)}b=b.translate(-n,-a).translate(-p,-f).multiply(m),s&&(b=b.rotate(s)),h&&(b=b.scale(-1,1)),l&&(b=b.scale(1,-1));for(const t of w)"a"!=t&&"d"!=t||!(b[t]>this.minScale+1e-5||b[t].1||"mousemove"===this.panMode||!1===d)&&!c&&this.clampTargetBounds(),this.isResting||(this.state=x.Panning,this.requestTick())}stop(t=!1){if(this.state!==x.Init&&this.state!==x.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of w)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),h(this.container,"is-scaling"),h(this.container,"is-animating"),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=x.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),r(this.container,"is-animating"),this.isScaling&&r(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(t,e=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=t,"mousemove"!==this.panMode||!t)return;if(o(this.targetScale)<=o(this.minScale))return;this.emit("mouseMove",t);const{container:i,containerRect:s,contentRect:n}=this,a=s.width,r=s.height,h=i.getBoundingClientRect(),l=(t.clientX||0)-h.left,c=(t.clientY||0)-h.top;let{contentWidth:d,contentHeight:u}=this.calculateContentDim(this.target);const g=this.option("mouseMoveFactor");g>1&&(d!==a&&(d*=g),u!==r&&(u*=g));let p=.5*(d-a)-l/a*100/100*(d-a);p+=.5*(n.right-n.left);let f=.5*(u-r)-c/r*100/100*(u-r);f+=.5*(n.bottom-n.top),this.applyChange({panX:p-this.target.e,panY:f-this.target.f,friction:e})}zoomWithWheel(t){if(this.state===x.Destroy||this.state===x.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),s=this.targetScale,n=this.maxScale,o=this.minScale;let a=s*(100+i*e)/100;an&&s>=n?(this.wheelDelta+=Math.abs(i),a=n):(this.wheelDelta=0,a=Math.max(Math.min(a,n),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),a!==s&&this.zoomTo(a,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.maxScale-this.minScale)?"max":"fit",t)}toggleCover(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.coverScale-this.minScale)?"cover":"fit",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:s=0,event:n}={}){if(this.isContentLoading||this.state===x.Destroy)return;this.stop();const{targetScale:o}=this;let a=1;if("mousemove"===this.panMode&&(n=this.prevMouseMoveEvent||n),n){const t=this.content.getBoundingClientRect(),e=n.clientX||0,o=n.clientY||0;i=e-t.left-.5*t.width,s=o-t.top-.5*t.height}const r=this.fullScale,h=this.maxScale;let l=this.coverScale;"number"==typeof t?a=t/o:("next"===t&&(r-l<.2&&(l=r),t=o1?.15:.25:e,this.applyChange({scale:a,originX:i,originY:s,friction:e}),n&&"mousemove"===this.panMode&&this.panWithMouse(n,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const s=t.classList.contains(e);s?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(s?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:s,d:n,e:o,f:a}=t;return new DOMMatrix([e,i,s,n,o,a])}reset(t){if(this.state!==x.Init&&this.state!==x.Destroy){this.stop("current");for(const t of w)this.target[t]=T[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=x.Panning,this.requestTick())}}destroy(){this.stop(),this.state=x.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(E,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:P}),Object.defineProperty(E,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const z={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var k;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"}(k||(k={}));const R=t=>{if("string"==typeof t&&(t={html:t}),!(t instanceof String||t instanceof HTMLElement)){const e=t.thumb;void 0!==e&&("string"==typeof e&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},D=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class L extends u{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const A={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'',dynamicFrom:11,maxCount:1/0,minCount:2};class C extends L{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let t=this.list;return t||(t=document.createElement("ul"),r(t,this.cn("list")),t.setAttribute("role","tablist"),this.instance.container.appendChild(t),r(this.instance.container,this.cn("hasDots")),this.list=t),t}refresh(){var t;const e=this.instance.pages.length,i=Math.min(2,this.option("minCount")),s=Math.max(2e3,this.option("maxCount")),n=this.option("dynamicFrom");if(es)return void this.cleanup();const o="number"==typeof n&&e>5&&e>=n,a=!this.list||this.isDynamic!==o||this.list.children.length!==e;a&&this.cleanup();const c=this.build();if(l(c,this.cn("isDynamic"),!!o),a)for(let t=0;t=e-1&&n.setAttribute("disabled","")))}createButton(t){const e=this.instance,i=document.createElement("button");i.setAttribute("tabindex","0"),i.setAttribute("title",e.localize(`{{${t.toUpperCase()}}}`)),r(i,this.cn("button")+" "+this.cn("next"===t?"isNext":"isPrev"));const s=e.isRTL?"next"===t?"prev":"next":t;var n;return i.innerHTML=e.localize(this.option(`${s}Tpl`)),i.dataset[`carousel${n=t,n?n.match("^[a-z]")?n.charAt(0).toUpperCase()+n.substring(1):n:""}`]="true",i}build(){let t=this.container;t||(this.container=t=document.createElement("div"),r(t,this.cn("container")),this.instance.container.appendChild(t)),this.next||(this.next=t.appendChild(this.createButton("next"))),this.prev||(this.prev=t.appendChild(this.createButton("prev")))}cleanup(){this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove(),this.prev=null,this.next=null,this.container=null}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(j,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'',prevTpl:''}});class F extends L{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){this.nav&&this.target&&(this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.state===k.Ready&&this.onNavReady(this.nav),this.target.on("ready",this.onTargetReady),this.target.state===k.Ready&&this.onTargetReady(this.target))}onNavReady(t){t.on("createSlide",this.onNavCreateSlide),t.on("Panzoom.click",this.onNavClick),this.onTargetChange()}onTargetReady(t){t.on("change",this.onTargetChange),t.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(t,e,i){var s,n;const o=i.target,{nav:a,target:r}=this;if(!a||!r||!o)return;const h=o.closest("[data-index]");if(!h)return;i.stopPropagation(),i.preventDefault();const l=parseInt(h.dataset.index||"",10)||0,c=r.getPageForSlide(l),d=a.getPageForSlide(l);r.page!==c&&r.slideTo(c,{friction:null===(n=null===(s=this.nav)||void 0===s?void 0:s.plugins)||void 0===n?void 0:n.Sync.option("friction")}),this.markSelectedSlide(l),a.page!==d&&a.slideTo(d)}onNavCreateSlide(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}onTargetChange(){const{target:t,nav:e}=this;if(!t||!e)return;if(e.state!==k.Ready||t.state!==k.Ready)return;const i=t.pages[t.page].slides[0].index,s=e.getPageForSlide(i);this.markSelectedSlide(i),e.slideTo(s)}markSelectedSlide(t){const{nav:e}=this;if(!e||e.state!==k.Ready)return;this.selectedIndex=t,[...e.slides].filter((t=>t.el&&t.el.classList.remove("is-nav-selected")));const i=e.slides[t];i&&i.el&&i.el.classList.add("is-nav-selected")}attach(){let t=this.options.target,e=this.options.nav;t?this.addAsNavFor(t):e&&this.addAsTargetFor(e)}detach(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.nav=null,this.target&&(this.target.off("ready",this.onTargetReady),this.target.off("refresh",this.onTargetChange),this.target.off("change",this.onTargetChange)),this.target=null}}Object.defineProperty(F,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const I={Navigation:j,Dots:C,Sync:F};class H extends g{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===k.Ready}get isInfinite(){let t=!1;const e=this.contentDim,i=this.viewportDim;return this.pages.length>=2&&e>1.5*i&&(t=this.option("infinite")),t}get isRTL(){return"rtl"===this.option("direction")}get isHorizontal(){return"x"===this.option("axis")}constructor(t,e={},s={}){if(super(),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:k.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),"string"==typeof t&&(t=document.querySelector(t)),!t||!S(t))throw new Error("No Element found");this.container=t,this.slideNext=i(this.slideNext.bind(this),175),this.slidePrev=i(this.slidePrev.bind(this),175),this.userOptions=e,this.userPlugins=s,queueMicrotask((()=>{this.processOptions()}))}processOptions(){const i=e({},H.defaults,this.userOptions);let s="";const n=i.breakpoints;if(n&&t(n))for(const[o,a]of Object.entries(n))window.matchMedia(o).matches&&t(a)&&(s+=o,e(i,a));s===this.bp&&this.state!==k.Init||(this.bp=s,this.state===k.Ready&&(i.initialSlide=this.pages[this.page].slides[0].index),this.state!==k.Init&&this.destroy(),super.setOptions(i),!1===this.option("enabled")?this.attachEvents():setTimeout((()=>{this.init()}),0))}init(){this.state=k.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},H.Plugins),this.userPlugins)),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=k.Ready,this.emit("ready")}initLayout(){const{container:t}=this,e=this.option("classes");r(t,this.cn("container")),l(t,e.isLTR,!this.isRTL),l(t,e.isRTL,this.isRTL),l(t,e.isVertical,!this.isHorizontal),l(t,e.isHorizontal,this.isHorizontal);let i=this.option("viewport")||t.querySelector(`.${e.viewport}`);i||(i=document.createElement("div"),r(i,e.viewport),i.append(...s(t,`.${e.slide}`)),t.prepend(i));let n=this.option("track")||t.querySelector(`.${e.track}`);n||(n=document.createElement("div"),r(n,e.track),n.append(...Array.from(i.childNodes))),n.setAttribute("aria-live","polite"),i.contains(n)||i.prepend(n),this.viewport=i,this.track=n,this.emit("initLayout")}initSlides(){const{track:t}=this;if(t){this.slides=[],[...s(t,`.${this.cn("slide")}`)].forEach((t=>{if(S(t)){const e=R({el:t,isDom:!0,index:this.slides.length});this.slides.push(e),this.emit("initSlide",e,this.slides.length)}}));for(let t of this.option("slides",[])){const e=R(t);e.index=this.slides.length,this.slides.push(e),this.emit("initSlide",t,this.slides.length)}this.emit("initSlides")}}setInitialPage(){let t=0;const e=this.option("initialSlide");t="number"==typeof e?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0,this.page=t}setInitialPosition(){if(!this.track||!this.pages.length)return;let t=this.page;this.pages[t]||(this.page=t=0);const e=this.pages[t].pos*(this.isRTL&&this.isHorizontal?1:-1),i=this.isHorizontal?`${e}px`:"0",s=this.isHorizontal?"0":`${e}px`;this.track.style.transform=`translate3d(${i}, ${s}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const t=this.option("Panzoom")||{};this.panzoom=new E(this.viewport,e({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,decelFriction:.12,click:!1,dblClick:!1,touch:t=>!(this.pages.length<2&&!t.options.infinite),bounds:()=>this.getBounds(),maxVelocity:t=>Math.abs(t.target[this.axis]-t.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on("*",((t,e,...i)=>{this.emit(`Panzoom.${e}`,t,...i)})),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation),this.panzoom.on("touchStart",((t,e)=>{this.inTransition.size&&e.preventDefault()}))}attachEvents(){const t=this.container;t&&(t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let t=[];const{contentDim:e,viewportDim:i}=this,s=this.option("slidesPerPage");if("number"==typeof s&&e>i){for(let e=0;ei)&&(t.push(D()),n=t.length-1,o=0),o+=e.dim+e.gap,t[n].slides.push(e);return t}processPages(){const t=this.pages,{contentDim:e,viewportDim:i}=this,s=this.option("center"),n=this.option("fill");if(t.forEach(((t,e)=>{t.index=e,t.pos=t.slides[0].pos,t.dim=0;for(const[e,i]of t.slides.entries())t.dim+=i.dim,e{n&&!this.isInfinite&&e>i&&(t.pos=Math.max(t.pos,0),t.pos=Math.min(t.pos,e-i)),t.pos=o(t.pos,1e3),t.dim=o(t.dim,1e3)})),this.isInfinite)return t;const a=[];let r;return t.forEach((t=>{const e=Object.assign({},t);r&&e.pos===r.pos?(r.dim+=e.dim,r.slides=[...r.slides,...e.slides]):(e.index=a.length,r=e,a.push(e))})),a}getPageFromIndex(t=0){const e=this.pages.length;let i;return t=parseInt((t||0).toString())||0,i=this.isInfinite?(t%e+e)%e:Math.max(Math.min(t,this.pages.length-1),0),i}getSlideMetrics(t){const e=this.isHorizontal?"width":"height";let i=0,s=0,n=t.el;n?i=parseFloat(n.dataset[e]||"")||0:(n=document.createElement("div"),n.style.visibility="hidden",r(n,this.cn("slide")+" "+t.class),(this.track||document.body).prepend(n)),i?(n.style[e]=`${i}px`,n.style["width"===e?"height":"width"]=""):i=n.getBoundingClientRect()[e];const o=getComputedStyle(n);return"content-box"===o.boxSizing&&(this.isHorizontal?(i+=parseFloat(o.paddingLeft)||0,i+=parseFloat(o.paddingRight)||0):(i+=parseFloat(o.paddingTop)||0,i+=parseFloat(o.paddingBottom)||0)),s=parseFloat(o[this.isHorizontal?"marginRight":"marginBottom"])||0,this.isHorizontal,t.el||n.remove(),{dim:i,gap:s}}getBounds(){let t={min:0,max:0};if(this.isInfinite)t={min:-1/0,max:1/0};else if(this.pages.length){const e=this.pages[0].pos,i=this.pages[this.pages.length-1].pos;t=this.isRTL&&this.isHorizontal?{min:e,max:i}:{min:-1*i,max:-1*e}}return{x:this.isHorizontal?t:{min:0,max:0},y:this.isHorizontal?{min:0,max:0}:t}}repositionSlides(){const{viewportDim:t,contentDim:e,page:i,pages:s}=this;let n,a=0,r=0,h=0,l=0;this.panzoom?l=-1*this.panzoom.current[this.isHorizontal?"e":"f"]:s[i]&&(l=s[i].pos||0),n=this.isHorizontal?this.isRTL?"right":"left":"top",this.isRTL&&this.isHorizontal&&(l*=-1);for(const t of this.slides)t.el?("top"===n?(t.el.style.right="",t.el.style.left=""):t.el.style.top="",t.index!==a?t.el.style[n]=0===r?"":`${r}px`:t.el.style[n]="",h+=t.dim+t.gap,a++):r+=t.dim+t.gap;if(this.isInfinite&&h)for(const i of this.slides)i.el&&(o(i.pos)o(e-t)&&(i.el.style[n]=`${r+h}px`),o(i.pos+i.gap)>=o(e-t)&&o(i.pos)>o(l+t)&&o(l)1&&(c=this.pages[u[0]],d=this.pages[u[1]]),c&&d){let t=0;for(const e of this.slides)e.el?this.inTransition.has(e.index)&&c.slides.indexOf(e)<0&&(e.el.style[n]=`${t+(c.pos-d.pos)}px`):t+=e.dim+e.gap}}createSlideEl(t){if(!this.track||!t)return;if(t.el)return;const e=document.createElement("div");r(e,this.cn("slide")),r(e,t.class),t.html&&(e.innerHTML=t.html);const i=[];this.slides.forEach(((t,e)=>{t.el&&i.push(e)}));const s=t.index;let n=null;if(i.length){let t=i.reduce(((t,e)=>Math.abs(e-s)this.page?1:-1,a=this.pages[n].pos*(this.isRTL?1:-1);if(this.page===n&&a===s.target[this.axis])return!1;this.clearTransitions();const h=s.isResting;r(this.container,this.cn("inTransition"));const l=this.pages[this.page].slides[0],c=this.pages[n].slides[0];this.inTransition.add(c.index),this.createSlideEl(c);let d=l.el,u=c.el;h||"slide"===e||(e="fadeFast",d=null);const g=this.isRTL?"next":"prev",p=this.isRTL?"prev":"next";return d&&(this.inTransition.add(l.index),l.transition=e,d.addEventListener("animationend",this.onAnimationEnd),d.classList.add(`f-${e}Out`,`to-${o>0?p:g}`)),u&&(c.transition=e,u.addEventListener("animationend",this.onAnimationEnd),u.classList.add(`f-${e}In`,`from-${o>0?g:p}`)),s.panTo({x:this.isHorizontal?a:0,y:this.isHorizontal?0:a,friction:0}),this.onChange(n),!0}manageSlideVisiblity(){const t=new Set,e=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const s of this.slides)i.has(s)?t.add(s):e.add(s);for(const e of this.inTransition)t.add(this.slides[e]);for(const e of t)this.createSlideEl(e),this.lazyLoadSlide(e);for(const i of e)t.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t="aria-hidden";let e=this.cn("isSelected");if(e)for(const i of this.slides)i.el&&(i.el.dataset.index=`${i.index}`,this.pages[this.page].slides.includes(i)?(i.el.classList.contains(e)||(r(i.el,e),this.emit("selectSlide",i)),i.el.removeAttribute(t)):(i.el.classList.contains(e)&&(h(i.el,e),this.emit("unselectSlide",i)),i.el.setAttribute(t,"true")))}flipInfiniteTrack(){const t=this.panzoom;if(!t||!this.isInfinite)return;const e="x"===this.option("axis")?"e":"f",{viewportDim:i,contentDim:s}=this;let n=t.current[e],o=t.target[e]-n,a=0,r=.5*i,h=s;this.isRTL&&this.isHorizontal?(n<-r&&(a=-1,n+=h),n>h-r&&(a=1,n-=h)):(n>r&&(a=1,n-=h),n<-h+r&&(a=-1,n+=h)),a&&(t.current[e]=n,t.target[e]=n+o)}lazyLoadSlide(t){const e=this,i=t&&t.el;if(!i)return;const s=new Set;i.querySelectorAll("[data-lazy-srcset]").forEach((t=>{t instanceof HTMLImageElement&&s.add(t)})),i.querySelectorAll("[data-lazy-src]").forEach((t=>{t instanceof HTMLImageElement?s.add(t):S(t)&&(t.style.backgroundImage=`url('${t.dataset.lazySrc||""}')`)}));const o=(t,i,s)=>{s&&(s.remove(),s=null),i.complete&&(i.style.display=""),this.option("adaptiveHeight")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&e.setViewportHeight()};for(const e of s){let i=null;e.src=e.dataset.lazySrcset||e.dataset.lazySrc||"",delete e.dataset.lazySrc,delete e.dataset.lazySrcset,e.style.display="none",e.addEventListener("error",(()=>{o(t,e,i)})),e.addEventListener("load",(()=>{o(t,e,i)})),setTimeout((()=>{e.parentNode&&t.el&&(e.complete?o(t,e,i):(i=n(c),e.parentNode.insertBefore(i,e)))}),300)}let a=i.dataset.lazySrc;a&&a.length&&(i.style.backgroundImage=`url('${a}')`)}clearTransitions(){this.inTransition.clear(),h(this.container,this.cn("inTransition"));const t=["to-prev","to-next","from-prev","from-next"];for(const e of this.slides){const i=e.el;if(i){i.removeEventListener("animationend",this.onAnimationEnd),i.classList.remove(...t);const s=e.transition;s&&i.classList.remove(`f-${s}Out`,`f-${s}In`)}}this.manageSlideVisiblity()}onAnimationEnd(t){const e=t.target,i=e?parseInt(e.dataset.index||"",10)||0:-1,s=this.slides[i],n=t.animationName;if(!e||!s||!n)return;const o=!!this.inTransition.has(i)&&s.transition;o&&n.substring(0,o.length+2)===`f-${o}`&&this.inTransition.delete(i),this.inTransition.size||this.clearTransitions(),i===this.page&&this.emit("settle")}onDecel(t,e=0,i=0){const s=this.isInfinite,n=this.isHorizontal?e:i,o=this.pages.length;if(!o)return;const a=this.option("dragFree");let r=this.page,h=0;const l=this.axis;!s&&(t.target[l],this.viewportDim);const c=t.current[l]*(this.isRTL&&this.isHorizontal?1:-1);let{pageIndex:d}=this.getPageFromPosition(c);if(a||Math.abs(n)<10){const e=t.target[l]*(this.isRTL&&this.isHorizontal?1:-1),{pageIndex:i}=this.getPageFromPosition(e);r=i}else r=this.isRTL&&this.isHorizontal?n<0?d-1:d+1:n<0?d+1:d-1,s||(r=Math.max(0,Math.min(r,this.pages.length-1)));if(s&&(h=Math.floor(r/o)||0),r=(r%o+o)%o,a&&t.dragOffset["e"===l?"x":"y"]);else{const e=this.contentDim;let i=(this.pages[r].pos+h*e)*(this.isRTL&&this.isHorizontal?1:-1);if(Math.abs(t.target[l]-i)<.1&&t.lockedAxis===("e"==l?"y":"x"))return;if(t.target[l]===i)return;t.applyChange({panX:this.isHorizontal?i-t.target.e:0,panY:this.isHorizontal?0:i-t.target.f,friction:t.option("decelFriction")})}r!==this.page&&this.onChange(r)}onClick(t){const e=t.target,i=e&&S(e)?e.dataset:null;let s;i&&(void 0!==i.carouselPage?s="slideTo":void 0!==i.carouselNext?s="slideNext":void 0!==i.carouselPrev&&(s="slidePrev")),s?(t.preventDefault(),t.stopPropagation(),e&&!e.hasAttribute("disabled")&&this[s](i&&"slideTo"===s?i.carouselPage:void 0)):this.emit("click",t)}onSlideTo(t){const e=t.detail||0;this.slideTo(this.getPageForSlide(e),{friction:0})}onChange(t,e=0){const i=this.page;this.prevPage=i,this.page=t,this.option("adaptiveHeight")&&this.setViewportHeight(),this.emit("change",t,i,e)}onRefresh(t,e=""){let i=this.contentDim,s=this.viewportDim;this.updateMetrics(),this.contentDim===i&&this.viewportDim===s||this.slideTo(this.page,{friction:0,transition:!1})}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(){this.flipInfiniteTrack(),this.manageSlideVisiblity()}onEndAnimation(){this.emit("settle")}reInit(t=null,e=null){this.destroy(),this.state=k.Init,this.userOptions=t||this.userOptions,this.userPlugins=e||this.userPlugins,this.processOptions()}slideTo(t=0,{friction:e=this.option("friction"),transition:i=this.option("transition")}={}){if(this.state===k.Destroy)return;const s=this.panzoom,n=this.pages.length;if(!s||!n)return;if(this.transitionTo(t,i))return;const o=this.axis,a=this.getPageFromIndex(t);let r=this.pages[a].pos,h=0;if(this.isInfinite){const t=s.current[o]*(this.isRTL&&this.isHorizontal?1:-1),e=this.contentDim,i=r+e,n=r-e;Math.abs(t-i){t.el&&(n=Math.max(n,t.el.offsetHeight))}))),i.style.height=n?`${n}px`:""}getPageForSlide(t){for(const e of this.pages)for(const i of e.slides)if(i.index===t)return e.index;return-1}getVisibleSlides(t=0){var e;const i=new Set;let{contentDim:s,viewportDim:n,pages:a,page:r}=this;s=s+(null===(e=this.slides[this.slides.length-1])||void 0===e?void 0:e.gap)||0;let h=0;h=this.panzoom?-1*this.panzoom.current[this.axis]:a[r]&&a[r].pos||0,this.isInfinite&&(h-=Math.floor(h/s)*s),this.isRTL&&this.isHorizontal&&(h*=-1),h=o(h,1e3);const l=o(h-n*t,1e3),c=o(h+n*(t+1),1e3),d=this.isInfinite?[-1,0,1]:[0];for(const t of this.slides)for(const e of d){const n=t.pos+e*s,o=t.pos+t.dim+t.gap+e*s;nl&&i.add(t)}return i}getPageFromPosition(t){const{viewportDim:e,contentDim:i}=this,s=this.pages.length;let n=0,o=0;const a=this.option("center");a&&(t+=.5*e),this.isInfinite||(t=Math.max(this.slides[0].pos,Math.min(t,this.slides[this.slides.length-1].pos)));const r=i+this.slides[this.slides.length-1].gap,h=Math.floor(t/r)||0;t-=h*r;let l=this.slides[this.slides.length-1],c=this.slides.find((e=>{const i=t+(l&&!a?.5*l.dim:0);return l=e,e.pos<=i&&e.pos+e.dim+e.gap>i}));return c||(c=this.slides[this.slides.length-1]),o=this.getPageForSlide(c.index),n=o+h*s,{page:n,pageIndex:o}}destroy(){if([k.Destroy].includes(this.state))return;this.state=k.Destroy;const{container:t,viewport:e,track:i,slides:s,panzoom:n}=this,o=this.option("classes");t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),t.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),n&&(n.destroy(),this.panzoom=null),s&&s.forEach((t=>{this.removeSlideEl(t)})),this.detachPlugins(),this.track=null,this.viewport=null,this.page=0,e&&i&&e.replaceWith(...i.childNodes);for(const[e,i]of Object.entries(o))"container"!==e&&i&&t.classList.remove(i);this.slides=[];const a=this.events.get("ready");this.events=new Map,a&&this.events.set("ready",a)}}Object.defineProperty(H,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:E}),Object.defineProperty(H,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:z}),Object.defineProperty(H,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:I});export{H as Carousel}; diff --git a/dist/carousel/carousel.thumbs.css b/dist/carousel/carousel.thumbs.css index 97e3bc17..7b9baf72 100644 --- a/dist/carousel/carousel.thumbs.css +++ b/dist/carousel/carousel.thumbs.css @@ -1 +1 @@ -.f-thumbs{--f-thumb-width: 96px;--f-thumb-height: 72px;--f-thumb-gap: 4px;--f-thumb-outline: 0;--f-thumb-outline-color: #5eb0ef;--f-thumb-opacity: 1;--f-thumb-hover-opacity: 1;--f-thumb-selected-opacity: 1;--f-thumb-border-radius: 2px;--f-thumb-offset: 0px;position:relative;margin:0;padding:0 var(--f-thumb-gap);overflow:hidden;-webkit-tap-highlight-color:rgba(0,0,0,0);user-select:none;perspective:1000px;transform:translateZ(0)}.f-thumbs.is-classic{--f-thumb-opacity: 0.5;--f-thumb-hover-opacity: 1;--f-thumb-selected-opacity: 1}.f-thumbs.is-modern{--f-thumb-extra-gap: 20px;--f-thumb-clip-width: 46px}.f-thumbs .f-spinner{position:absolute;top:0;left:0;width:100%;height:100%;border-radius:2px;background-image:linear-gradient(#ebeff2, #e2e8f0);z-index:-1}.f-thumbs .f-spinner svg{display:none}.f-thumbs__viewport{width:100%;height:auto;overflow:hidden;transform:translate3d(0, 0, 0);backface-visibility:hidden}.f-thumbs__track{display:flex;margin:0 auto;padding:8px 0 12px 0}.f-thumbs__slide{position:relative;flex:0 0 auto;box-sizing:content-box;display:flex;align-items:center;justify-content:center;padding:0;margin:0;width:var(--f-thumb-width);min-width:var(--f-thumb-width);height:var(--f-thumb-height);overflow:visible;cursor:pointer}.f-thumbs__slide.is-loading img{opacity:0}.is-classic .f-thumbs__slide{margin:0 var(--f-thumb-gap) 0 0}.is-modern .f-thumbs__track{width:max-content}.is-modern .f-thumbs__track::before{content:"";position:absolute;top:0;bottom:0;left:calc(var(--left, 0)*1px);width:calc(100% - var(--width, 0)*1px);cursor:pointer}.is-modern .f-thumbs__slide{--clip-path: inset( 0 calc( (var(--f-thumb-width, 0) - var(--f-thumb-clip-width, 0)) * 0.5 * (1 - var(--progress, 0)) ) round var(--f-thumb-border-radius, 0) );transform:translate3d(calc(var(--shift, 0) * -1px), 0, 0);transition:none;pointer-events:none}.is-modern .f-thumbs__slide:focus-within{filter:drop-shadow(-1px 0px 0px var(--f-thumb-outline-color)) drop-shadow(2px 0px 0px var(--f-thumb-outline-color)) drop-shadow(0px -1px 0px var(--f-thumb-outline-color)) drop-shadow(0px 2px 0px var(--f-thumb-outline-color))}.is-modern .f-thumbs__slide>*{clip-path:var(--clip-path);will-change:clip-path}.is-modern.is-resting .f-thumbs__slide{transition:all .33s ease}.is-modern.is-resting .f-thumbs__slide>*{transition:all .33s ease}.f-thumbs__slide__button{appearance:none;width:100%;height:100%;margin:0;padding:0;border:0;position:relative;border-radius:var(--f-thumb-border-radius);overflow:hidden;background:rgba(0,0,0,0);outline:none;cursor:pointer;pointer-events:auto;touch-action:manipulation;transition:opacity .2s ease;opacity:var(--f-thumb-opacity)}.f-thumbs__slide__button:hover{opacity:var(--f-thumb-hover-opacity)}.f-thumbs__slide__button:focus-visible{opacity:var(--f-thumb-selected-opacity)}.is-nav-selected .f-thumbs__slide__button{opacity:var(--f-thumb-selected-opacity)}.is-nav-selected .f-thumbs__slide__button::after{content:"";position:absolute;top:0;left:0;right:0;height:auto;bottom:0;border:var(--f-thumb-outline, 0) solid var(--f-thumb-outline-color, transparent);border-radius:var(--f-thumb-border-radius);animation:f-fadeIn .2s ease}.f-thumbs__slide__img{position:absolute;overflow:hidden;top:0;right:0;bottom:0;left:0;width:100%;height:100%;padding:var(--f-thumb-offset);box-sizing:border-box;object-fit:cover} \ No newline at end of file +.f-carousel__thumbs{--f-thumb-width: 96px;--f-thumb-height: 72px;--f-thumb-gap: 4px;--f-thumb-outline: 0;--f-thumb-outline-color: #5eb0ef;--f-thumb-opacity: 1;--f-thumb-hover-opacity: 1;--f-thumb-selected-opacity: 1;--f-thumb-border-radius: 2px;--f-thumb-offset: 0px;--f-button-next-pos: 0;--f-button-prev-pos: 0}.f-carousel__thumbs.is-classic{--f-thumb-opacity: 0.5;--f-thumb-hover-opacity: 1;--f-thumb-selected-opacity: 1}.f-carousel__thumbs.is-modern{--f-thumb-extra-gap: 20px;--f-thumb-clip-width: 46px}.f-thumbs{position:relative;flex:0 0 auto;margin:0;padding:0 var(--f-thumb-gap);overflow:hidden;-webkit-tap-highlight-color:rgba(0,0,0,0);user-select:none;perspective:1000px;transform:translateZ(0)}.f-thumbs .f-spinner{position:absolute;top:0;left:0;width:100%;height:100%;border-radius:2px;background-image:linear-gradient(#ebeff2, #e2e8f0);z-index:-1}.f-thumbs .f-spinner svg{display:none}.f-thumbs__viewport{width:100%;height:auto;overflow:hidden}.f-thumbs__track{display:flex;margin:0 auto;padding:8px 0 12px 0;will-change:transform}.f-thumbs__slide{position:relative;flex:0 0 auto;box-sizing:content-box;display:flex;align-items:center;justify-content:center;padding:0;margin:0;width:var(--f-thumb-width);min-width:var(--f-thumb-width);height:var(--f-thumb-height);overflow:visible;cursor:pointer}.f-thumbs__slide.is-loading img{opacity:0}.is-classic .f-thumbs__viewport{height:100%}.is-classic .f-thumbs__slide{margin:0 var(--f-thumb-gap) 0 0}.is-modern .f-thumbs__track{width:max-content}.is-modern .f-thumbs__track::before{content:"";position:absolute;top:0;bottom:0;left:calc(var(--left, 0)*1px);width:calc(100% - var(--width, 0)*1px);cursor:pointer}.is-modern .f-thumbs__slide{--clip-path: inset( 0 calc( (var(--f-thumb-width, 0) - var(--f-thumb-clip-width, 0)) * 0.5 * (1 - var(--progress, 0)) ) round var(--f-thumb-border-radius, 0) );transform:translate3d(calc(var(--shift, 0) * -1px), 0, 0);transition:none;pointer-events:none}.is-modern .f-thumbs__slide:focus-within{filter:drop-shadow(-1px 0px 0px var(--f-thumb-outline-color)) drop-shadow(2px 0px 0px var(--f-thumb-outline-color)) drop-shadow(0px -1px 0px var(--f-thumb-outline-color)) drop-shadow(0px 2px 0px var(--f-thumb-outline-color))}.is-modern .f-thumbs__slide>*{clip-path:var(--clip-path);will-change:clip-path}.is-modern.is-resting .f-thumbs__slide{transition:all .33s ease}.is-modern.is-resting .f-thumbs__slide>*{transition:all .33s ease}.f-thumbs__slide__button{appearance:none;width:100%;height:100%;margin:0;padding:0;border:0;position:relative;border-radius:var(--f-thumb-border-radius);overflow:hidden;background:rgba(0,0,0,0);outline:none;cursor:pointer;pointer-events:auto;touch-action:manipulation;transition:opacity .2s ease;opacity:var(--f-thumb-opacity)}.f-thumbs__slide__button:hover{opacity:var(--f-thumb-hover-opacity)}.f-thumbs__slide__button:focus-visible{outline:none;opacity:var(--f-thumb-selected-opacity)}.is-nav-selected .f-thumbs__slide__button{opacity:var(--f-thumb-selected-opacity)}.is-nav-selected .f-thumbs__slide__button::after{content:"";position:absolute;top:0;left:0;right:0;height:auto;bottom:0;border:var(--f-thumb-outline, 0) solid var(--f-thumb-outline-color, transparent);border-radius:var(--f-thumb-border-radius);animation:f-fadeIn .2s ease}.f-thumbs__slide__img{position:absolute;overflow:hidden;top:0;right:0;bottom:0;left:0;width:100%;height:100%;padding:var(--f-thumb-offset);box-sizing:border-box;object-fit:cover}.f-thumbs.is-vertical{--f-carousel-slide-height: 100%}.f-thumbs.is-vertical .f-thumbs__track{flex-wrap:wrap}.f-thumbs.is-vertical .f-thumbs__slide{margin:0 0 var(--f-thumb-gap) 0} \ No newline at end of file diff --git a/dist/carousel/carousel.thumbs.esm.js b/dist/carousel/carousel.thumbs.esm.js index 0c4205e7..89bf6a5b 100644 --- a/dist/carousel/carousel.thumbs.esm.js +++ b/dist/carousel/carousel.thumbs.esm.js @@ -1 +1 @@ -const t=(e,...i)=>{const s=i.length;for(let n=0;n{const n=Array.isArray(s)?[]:{};var r;e[i]||Object.assign(e,{[i]:n}),"object"==typeof(r=s)&&null!==r&&r.constructor===Object&&"[object Object]"===Object.prototype.toString.call(r)?Object.assign(e[i],t(n,s)):Array.isArray(s)?Object.assign(e,{[i]:[...s]}):Object.assign(e,{[i]:s})}))}return e},e=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},i=t=>`${t||""}`.split(" ").filter((t=>!!t)),s=(t,e)=>{i(e).forEach((e=>{t&&t.classList.add(e)}))},n=(t,e,s)=>{i(e).forEach((e=>{t&&t.classList.toggle(e,s||!1)}))},r=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class o{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(e){this.options=e?t({},this.constructor.defaults,e):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=r(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...s){let n=r(e,t);var o;"string"!=typeof(o=n)||isNaN(o)||isNaN(parseFloat(o))||(n=parseFloat(n)),"true"===n&&(n=!0),"false"===n&&(n=!1),n&&"function"==typeof n&&(n=n.call(this,this,t,...s));let a=r(e,this.options);return a&&"function"==typeof a?n=a.call(this,this,t,...s,n):void 0===n&&(n=a),void 0===n?i:n}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let s="";return i?s=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(s=this.option(`l10n.${e}`)),s||(s=t),s}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(o,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(o,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class a extends o{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}var h;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(h||(h={}));const l=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),c={classes:{container:"f-thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'',type:"modern"};var u;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden",t[t.Disabled=3]="Disabled"}(u||(u={}));class d extends a{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"shouldCenter",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:u.Init})}formatThumb(t,e){return this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}getSlides(){const t=[],e=this.option("thumbTpl")||"";if(e)for(const i of this.instance.slides||[])t.push({html:this.formatThumb(i,e),customClass:`has-thumb for-${i.type||"image"}`});return t}getProgress(t){const e=this.instance,i=e.panzoom,s=e.pages[t]||0;if(!s||!i)return 0;let n=-1*i.current.e,r=e.contentDim,o=(n-s.pos)/(1*s.dim),a=(n+r-s.pos)/(1*s.dim),h=(n-r-s.pos)/(1*s.dim);return o=Math.max(0,Math.min(1,Math.abs(o))),a=Math.max(0,Math.min(1,Math.abs(a))),h=Math.max(0,Math.min(1,Math.abs(h))),o=Math.min(o,a,h),o}onInitSlide(t,e){const i=e.el;i&&(e.thumbSrc=i.dataset.thumbSrc||e.thumbSrc||"",e.thumbClipWidth=parseFloat(i.dataset.thumbClipWidth||"")||e.thumbClipWidth||0,e.thumbHeight=parseFloat(i.dataset.thumbHeight||"")||e.thumbHeight||0)}onInitSlides(){this.state===u.Init&&this.build()}onRefreshM(){this.refreshModern()}onChangeM(){"modern"===this.type&&(this.shouldCenter=!0,this.centerModern())}onClickModern(t){t.preventDefault(),t.stopPropagation();const e=this.instance,i=e.page,s=t=>{if(t){const e=t.closest("[data-carousel-page]");if(e)return parseInt(e.dataset.carouselPage||"",10)||0}return-1},n=(t,e)=>{const i=document.elementFromPoint(t,e);return i?s(i):-1};let r=s(t.target);r<0&&(r=n(t.clientX+this.thumbGap,t.clientY),r===i&&(r=i-1)),r<0&&(r=n(t.clientX-this.thumbGap,t.clientY),r===i&&(r=i+1)),r<0&&(r=(e=>{let s=n(t.clientX-e,t.clientY),o=n(t.clientX+e,t.clientY);return r<0&&s===i&&(r=i+1),r<0&&o===i&&(r=i-1),r})(this.thumbExtraGap)),r===i?this.centerModern():r>-1&&r{this.emit("ready")}))}buildModern(){if("modern"!==this.type)return;const{container:t,track:i,instance:n}=this,r=this.option("thumbTpl")||"";if(!t||!i||!r)return;this.updateModern();for(const t of n.slides||[]){const n=document.createElement("div");s(n,this.cn("slide")),n.appendChild(e(this.formatThumb(t,r))),t.thumbSlideEl=n,i.appendChild(n),this.resizeModernSlide(t)}const o=new n.constructor.Panzoom(t,{content:i,lockAxis:"x",zoom:!1,panOnlyZoomed:!1,bounds:()=>{let t=0,e=0,i=n.slides[0],s=n.slides[n.slides.length-1],r=n.slides[n.page];return i&&s&&r&&(e=-1*this.getModernThumbPos(0),0!==n.page&&(e+=.5*(i.thumbWidth||0)),t=-1*this.getModernThumbPos(n.slides.length-1),n.page!==n.slides.length-1&&(t+=(s.thumbWidth||0)-(r.thumbWidth||0)-.5*(s.thumbWidth||0))),{x:{min:t,max:e},y:{min:0,max:0}}}});o.on("touchStart",(()=>{this.shouldCenter=!1})),o.on("click",((t,e)=>this.onClickModern(e))),o.on("ready",(()=>{this.centerModern(),this.emit("ready")})),o.on(["afterTransform","refresh"],(t=>{this.lazyLoadModern()})),this.panzoom=o,this.refreshModern()}updateModern(){if("modern"!==this.type)return;const{container:t}=this;t&&(this.thumbGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-gap"))||0,this.thumbExtraGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-extra-gap"))||0,this.thumbWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-width"))||40,this.thumbClipWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-clip-width"))||40,this.thumbHeight=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-height"))||40)}refreshModern(){var t;if("modern"===this.type){this.updateModern();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.onTransformM(),null===(t=this.panzoom)||void 0===t||t.updateMetrics(!0),this.centerModern(0)}}centerModern(t){const e=this.instance,{container:i,panzoom:s}=this;if(!i||!s||s.state===h.Init)return;const n=e.page;let r=this.getModernThumbPos(n),o=r;for(let t=e.page-3;te.pages.length-1||t===e.page)continue;const i=1-this.getProgress(t);i>0&&i<1&&(o+=i*(this.getModernThumbPos(t)-r))}let a=100;void 0===t&&(t=.2,e.inTransition.size>0&&(t=.12),Math.abs(-1*s.current.e-o)>s.containerRect.width&&(t=.5,a=0)),s.options.maxVelocity=a,s.applyChange({panX:l(-1*o-s.target.e,1e3),friction:null===e.prevPage?0:t})}lazyLoadModern(){const{instance:t,panzoom:i}=this;if(!i)return;const n=-1*i.current.e||0;let r=this.getModernThumbPos(t.page);if(i.state!==h.Init||0===r)for(const r of t.slides||[]){const t=r.thumbSlideEl;if(!t)continue;const o=t.querySelector("img[data-lazy-src]"),a=r.index,h=this.getModernThumbPos(a),l=n-.5*i.containerRect.innerWidth,c=l+i.containerRect.innerWidth;if(!o||hc)continue;let u=o.dataset.lazySrc;if(!u||!u.length)continue;if(delete o.dataset.lazySrc,o.src=u,o.complete)continue;s(t,this.cn("isLoading"));const d=e('
');t.appendChild(d),o.addEventListener("load",(()=>{t.offsetParent&&(t.classList.remove(this.cn("isLoading")),d.remove())}),!1)}}resizeModernSlide(t){if("modern"!==this.type)return;if(!t.thumbSlideEl)return;const e=t.thumbClipWidth&&t.thumbHeight?Math.round(this.thumbHeight*(t.thumbClipWidth/t.thumbHeight)):this.thumbWidth;t.thumbWidth=e}getModernThumbPos(t){const e=this.instance.slides[t],i=this.panzoom;if(!i||!i.contentRect.fitWidth)return 0;let s=i.containerRect.innerWidth,n=i.contentRect.width;2===this.instance.slides.length&&(t-=1,n=2*this.thumbClipWidth);let r=t*(this.thumbClipWidth+this.thumbGap)+this.thumbExtraGap+.5*(e.thumbWidth||0);return r-=n>s?.5*s:.5*n,l(r||0,1)}build(){const t=this.instance,e=t.container,i=this.option("minCount")||0;if(i){let e=0;for(const i of t.slides||[])i.thumbSrc&&e++;if(e{t&&t.classList.remove(e)}))}attach(){this.instance.on("initSlide",this.onInitSlide),this.instance.on("initSlides",this.onInitSlides),this.instance.on("Panzoom.afterTransform",this.onTransformM),this.instance.on("Panzoom.refresh",this.onRefreshM),this.instance.on("change",this.onChangeM)}detach(){this.instance.off("initSlide",this.onInitSlide),this.instance.off("initSlides",this.onInitSlides),this.instance.off("Panzoom.afterTransform",this.onTransformM),this.instance.off("Panzoom.refresh",this.onRefreshM),this.instance.off("change",this.onChangeM),this.cleanup()}}Object.defineProperty(d,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:c});export{u as States,d as Thumbs,c as defaultOptions}; +const t=(e,...i)=>{const s=i.length;for(let n=0;n{const n=Array.isArray(s)?[]:{};var r;e[i]||Object.assign(e,{[i]:n}),"object"==typeof(r=s)&&null!==r&&r.constructor===Object&&"[object Object]"===Object.prototype.toString.call(r)?Object.assign(e[i],t(n,s)):Array.isArray(s)?Object.assign(e,{[i]:[...s]}):Object.assign(e,{[i]:s})}))}return e},e=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},i=t=>`${t||""}`.split(" ").filter((t=>!!t)),s=(t,e)=>{i(e).forEach((e=>{t&&t.classList.add(e)}))},n=(t,e,s)=>{i(e).forEach((e=>{t&&t.classList.toggle(e,s||!1)}))},r=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class o{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(e){this.options=e?t({},this.constructor.defaults,e):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=r(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...s){let n=r(e,t);var o;"string"!=typeof(o=n)||isNaN(o)||isNaN(parseFloat(o))||(n=parseFloat(n)),"true"===n&&(n=!0),"false"===n&&(n=!1),n&&"function"==typeof n&&(n=n.call(this,this,t,...s));let a=r(e,this.options);return a&&"function"==typeof a?n=a.call(this,this,t,...s,n):void 0===n&&(n=a),void 0===n?i:n}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let s="";return i?s=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(s=this.option(`l10n.${e}`)),s||(s=t),s}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(o,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(o,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class a extends o{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}var h;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(h||(h={}));const l=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),c={classes:{container:"f-thumbs f-carousel__thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'',type:"modern"};var u;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden",t[t.Disabled=3]="Disabled"}(u||(u={}));class d extends a{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"shouldCenter",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:u.Init})}formatThumb(t,e){return this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}getSlides(){const t=[],e=this.option("thumbTpl")||"";if(e)for(const i of this.instance.slides||[])t.push({html:this.formatThumb(i,e),customClass:`has-thumb for-${i.type||"image"}`});return t}getProgress(t){const e=this.instance,i=e.panzoom,s=e.pages[t]||0;if(!s||!i)return 0;let n=-1*i.current.e,r=e.contentDim,o=(n-s.pos)/(1*s.dim),a=(n+r-s.pos)/(1*s.dim),h=(n-r-s.pos)/(1*s.dim);return o=Math.max(0,Math.min(1,Math.abs(o))),a=Math.max(0,Math.min(1,Math.abs(a))),h=Math.max(0,Math.min(1,Math.abs(h))),o=Math.min(o,a,h),o}onInitSlide(t,e){const i=e.el;i&&(e.thumbSrc=i.dataset.thumbSrc||e.thumbSrc||"",e.thumbClipWidth=parseFloat(i.dataset.thumbClipWidth||"")||e.thumbClipWidth||0,e.thumbHeight=parseFloat(i.dataset.thumbHeight||"")||e.thumbHeight||0)}onInitSlides(){this.state===u.Init&&this.build()}onRefreshM(){this.refreshModern()}onChangeM(){"modern"===this.type&&(this.shouldCenter=!0,this.centerModern())}onClickModern(t){t.preventDefault(),t.stopPropagation();const e=this.instance,i=e.page,s=t=>{if(t){const e=t.closest("[data-carousel-page]");if(e)return parseInt(e.dataset.carouselPage||"",10)||0}return-1},n=(t,e)=>{const i=document.elementFromPoint(t,e);return i?s(i):-1};let r=s(t.target);r<0&&(r=n(t.clientX+this.thumbGap,t.clientY),r===i&&(r=i-1)),r<0&&(r=n(t.clientX-this.thumbGap,t.clientY),r===i&&(r=i+1)),r<0&&(r=(e=>{let s=n(t.clientX-e,t.clientY),o=n(t.clientX+e,t.clientY);return r<0&&s===i&&(r=i+1),r<0&&o===i&&(r=i-1),r})(this.thumbExtraGap)),r===i?this.centerModern():r>-1&&r{this.emit("ready")}))}buildModern(){if("modern"!==this.type)return;const{container:t,track:i,instance:n}=this,r=this.option("thumbTpl")||"";if(!t||!i||!r)return;this.updateModern();for(const t of n.slides||[]){const n=document.createElement("div");s(n,this.cn("slide")),n.appendChild(e(this.formatThumb(t,r))),t.thumbSlideEl=n,i.appendChild(n),this.resizeModernSlide(t)}const o=new n.constructor.Panzoom(t,{content:i,lockAxis:"x",zoom:!1,panOnlyZoomed:!1,bounds:()=>{let t=0,e=0,i=n.slides[0],s=n.slides[n.slides.length-1],r=n.slides[n.page];return i&&s&&r&&(e=-1*this.getModernThumbPos(0),0!==n.page&&(e+=.5*(i.thumbWidth||0)),t=-1*this.getModernThumbPos(n.slides.length-1),n.page!==n.slides.length-1&&(t+=(s.thumbWidth||0)-(r.thumbWidth||0)-.5*(s.thumbWidth||0))),{x:{min:t,max:e},y:{min:0,max:0}}}});o.on("touchStart",(()=>{this.shouldCenter=!1})),o.on("click",((t,e)=>this.onClickModern(e))),o.on("ready",(()=>{this.centerModern(),this.emit("ready")})),o.on(["afterTransform","refresh"],(t=>{this.lazyLoadModern()})),this.panzoom=o,this.refreshModern()}updateModern(){if("modern"!==this.type)return;const{container:t}=this;t&&(this.thumbGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-gap"))||0,this.thumbExtraGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-extra-gap"))||0,this.thumbWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-width"))||40,this.thumbClipWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-clip-width"))||40,this.thumbHeight=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-height"))||40)}refreshModern(){var t;if("modern"===this.type){this.updateModern();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.onTransformM(),null===(t=this.panzoom)||void 0===t||t.updateMetrics(!0),this.centerModern(0)}}centerModern(t){const e=this.instance,{container:i,panzoom:s}=this;if(!i||!s||s.state===h.Init)return;const n=e.page;let r=this.getModernThumbPos(n),o=r;for(let t=e.page-3;te.pages.length-1||t===e.page)continue;const i=1-this.getProgress(t);i>0&&i<1&&(o+=i*(this.getModernThumbPos(t)-r))}let a=100;void 0===t&&(t=.2,e.inTransition.size>0&&(t=.12),Math.abs(-1*s.current.e-o)>s.containerRect.width&&(t=.5,a=0)),s.options.maxVelocity=a,s.applyChange({panX:l(-1*o-s.target.e,1e3),friction:null===e.prevPage?0:t})}lazyLoadModern(){const{instance:t,panzoom:i}=this;if(!i)return;const n=-1*i.current.e||0;let r=this.getModernThumbPos(t.page);if(i.state!==h.Init||0===r)for(const r of t.slides||[]){const t=r.thumbSlideEl;if(!t)continue;const o=t.querySelector("img[data-lazy-src]"),a=r.index,h=this.getModernThumbPos(a),l=n-.5*i.containerRect.innerWidth,c=l+i.containerRect.innerWidth;if(!o||hc)continue;let u=o.dataset.lazySrc;if(!u||!u.length)continue;if(delete o.dataset.lazySrc,o.src=u,o.complete)continue;s(t,this.cn("isLoading"));const d=e('
');t.appendChild(d),o.addEventListener("load",(()=>{t.offsetParent&&(t.classList.remove(this.cn("isLoading")),d.remove())}),!1)}}resizeModernSlide(t){if("modern"!==this.type)return;if(!t.thumbSlideEl)return;const e=t.thumbClipWidth&&t.thumbHeight?Math.round(this.thumbHeight*(t.thumbClipWidth/t.thumbHeight)):this.thumbWidth;t.thumbWidth=e}getModernThumbPos(t){const e=this.instance.slides[t],i=this.panzoom;if(!i||!i.contentRect.fitWidth)return 0;let s=i.containerRect.innerWidth,n=i.contentRect.width;2===this.instance.slides.length&&(t-=1,n=2*this.thumbClipWidth);let r=t*(this.thumbClipWidth+this.thumbGap)+this.thumbExtraGap+.5*(e.thumbWidth||0);return r-=n>s?.5*s:.5*n,l(r||0,1)}build(){const t=this.instance,e=t.container,i=this.option("minCount")||0;if(i){let e=0;for(const i of t.slides||[])i.thumbSrc&&e++;if(e{t&&t.classList.remove(e)}))}attach(){this.instance.on("initSlide",this.onInitSlide),this.instance.on("initSlides",this.onInitSlides),this.instance.on("Panzoom.afterTransform",this.onTransformM),this.instance.on("Panzoom.refresh",this.onRefreshM),this.instance.on("change",this.onChangeM)}detach(){this.instance.off("initSlide",this.onInitSlide),this.instance.off("initSlides",this.onInitSlides),this.instance.off("Panzoom.afterTransform",this.onTransformM),this.instance.off("Panzoom.refresh",this.onRefreshM),this.instance.off("change",this.onChangeM),this.cleanup()}}Object.defineProperty(d,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:c});export{u as States,d as Thumbs,c as defaultOptions}; diff --git a/dist/carousel/carousel.thumbs.umd.js b/dist/carousel/carousel.thumbs.umd.js index 09307dc9..1726405b 100644 --- a/dist/carousel/carousel.thumbs.umd.js +++ b/dist/carousel/carousel.thumbs.umd.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";const e=(t,...i)=>{const s=i.length;for(let n=0;n{const n=Array.isArray(s)?[]:{};var r;t[i]||Object.assign(t,{[i]:n}),"object"==typeof(r=s)&&null!==r&&r.constructor===Object&&"[object Object]"===Object.prototype.toString.call(r)?Object.assign(t[i],e(n,s)):Array.isArray(s)?Object.assign(t,{[i]:[...s]}):Object.assign(t,{[i]:s})}))}return t},i=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},s=t=>`${t||""}`.split(" ").filter((t=>!!t)),n=(t,e)=>{s(e).forEach((e=>{t&&t.classList.add(e)}))},r=(t,e,i)=>{s(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))},o=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class a{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?e({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=o(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...s){let n=o(e,t);var r;"string"!=typeof(r=n)||isNaN(r)||isNaN(parseFloat(r))||(n=parseFloat(n)),"true"===n&&(n=!0),"false"===n&&(n=!1),n&&"function"==typeof n&&(n=n.call(this,this,t,...s));let a=o(e,this.options);return a&&"function"==typeof a?n=a.call(this,this,t,...s,n):void 0===n&&(n=a),void 0===n?i:n}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let s="";return i?s=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(s=this.option(`l10n.${e}`)),s||(s=t),s}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(a,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(a,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class h extends a{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}var l;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(l||(l={}));const c=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),u={classes:{container:"f-thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'',type:"modern"};t.States=void 0,function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden",t[t.Disabled=3]="Disabled"}(t.States||(t.States={}));class d extends h{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"shouldCenter",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:t.States.Init})}formatThumb(t,e){return this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}getSlides(){const t=[],e=this.option("thumbTpl")||"";if(e)for(const i of this.instance.slides||[])t.push({html:this.formatThumb(i,e),customClass:`has-thumb for-${i.type||"image"}`});return t}getProgress(t){const e=this.instance,i=e.panzoom,s=e.pages[t]||0;if(!s||!i)return 0;let n=-1*i.current.e,r=e.contentDim,o=(n-s.pos)/(1*s.dim),a=(n+r-s.pos)/(1*s.dim),h=(n-r-s.pos)/(1*s.dim);return o=Math.max(0,Math.min(1,Math.abs(o))),a=Math.max(0,Math.min(1,Math.abs(a))),h=Math.max(0,Math.min(1,Math.abs(h))),o=Math.min(o,a,h),o}onInitSlide(t,e){const i=e.el;i&&(e.thumbSrc=i.dataset.thumbSrc||e.thumbSrc||"",e.thumbClipWidth=parseFloat(i.dataset.thumbClipWidth||"")||e.thumbClipWidth||0,e.thumbHeight=parseFloat(i.dataset.thumbHeight||"")||e.thumbHeight||0)}onInitSlides(){this.state===t.States.Init&&this.build()}onRefreshM(){this.refreshModern()}onChangeM(){"modern"===this.type&&(this.shouldCenter=!0,this.centerModern())}onClickModern(t){t.preventDefault(),t.stopPropagation();const e=this.instance,i=e.page,s=t=>{if(t){const e=t.closest("[data-carousel-page]");if(e)return parseInt(e.dataset.carouselPage||"",10)||0}return-1},n=(t,e)=>{const i=document.elementFromPoint(t,e);return i?s(i):-1};let r=s(t.target);r<0&&(r=n(t.clientX+this.thumbGap,t.clientY),r===i&&(r=i-1)),r<0&&(r=n(t.clientX-this.thumbGap,t.clientY),r===i&&(r=i+1)),r<0&&(r=(e=>{let s=n(t.clientX-e,t.clientY),o=n(t.clientX+e,t.clientY);return r<0&&s===i&&(r=i+1),r<0&&o===i&&(r=i-1),r})(this.thumbExtraGap)),r===i?this.centerModern():r>-1&&r{this.emit("ready")}))}buildModern(){if("modern"!==this.type)return;const{container:t,track:e,instance:s}=this,r=this.option("thumbTpl")||"";if(!t||!e||!r)return;this.updateModern();for(const t of s.slides||[]){const s=document.createElement("div");n(s,this.cn("slide")),s.appendChild(i(this.formatThumb(t,r))),t.thumbSlideEl=s,e.appendChild(s),this.resizeModernSlide(t)}const o=new s.constructor.Panzoom(t,{content:e,lockAxis:"x",zoom:!1,panOnlyZoomed:!1,bounds:()=>{let t=0,e=0,i=s.slides[0],n=s.slides[s.slides.length-1],r=s.slides[s.page];return i&&n&&r&&(e=-1*this.getModernThumbPos(0),0!==s.page&&(e+=.5*(i.thumbWidth||0)),t=-1*this.getModernThumbPos(s.slides.length-1),s.page!==s.slides.length-1&&(t+=(n.thumbWidth||0)-(r.thumbWidth||0)-.5*(n.thumbWidth||0))),{x:{min:t,max:e},y:{min:0,max:0}}}});o.on("touchStart",(()=>{this.shouldCenter=!1})),o.on("click",((t,e)=>this.onClickModern(e))),o.on("ready",(()=>{this.centerModern(),this.emit("ready")})),o.on(["afterTransform","refresh"],(t=>{this.lazyLoadModern()})),this.panzoom=o,this.refreshModern()}updateModern(){if("modern"!==this.type)return;const{container:t}=this;t&&(this.thumbGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-gap"))||0,this.thumbExtraGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-extra-gap"))||0,this.thumbWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-width"))||40,this.thumbClipWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-clip-width"))||40,this.thumbHeight=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-height"))||40)}refreshModern(){var t;if("modern"===this.type){this.updateModern();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.onTransformM(),null===(t=this.panzoom)||void 0===t||t.updateMetrics(!0),this.centerModern(0)}}centerModern(t){const e=this.instance,{container:i,panzoom:s}=this;if(!i||!s||s.state===l.Init)return;const n=e.page;let r=this.getModernThumbPos(n),o=r;for(let t=e.page-3;te.pages.length-1||t===e.page)continue;const i=1-this.getProgress(t);i>0&&i<1&&(o+=i*(this.getModernThumbPos(t)-r))}let a=100;void 0===t&&(t=.2,e.inTransition.size>0&&(t=.12),Math.abs(-1*s.current.e-o)>s.containerRect.width&&(t=.5,a=0)),s.options.maxVelocity=a,s.applyChange({panX:c(-1*o-s.target.e,1e3),friction:null===e.prevPage?0:t})}lazyLoadModern(){const{instance:t,panzoom:e}=this;if(!e)return;const s=-1*e.current.e||0;let r=this.getModernThumbPos(t.page);if(e.state!==l.Init||0===r)for(const r of t.slides||[]){const t=r.thumbSlideEl;if(!t)continue;const o=t.querySelector("img[data-lazy-src]"),a=r.index,h=this.getModernThumbPos(a),l=s-.5*e.containerRect.innerWidth,c=l+e.containerRect.innerWidth;if(!o||hc)continue;let u=o.dataset.lazySrc;if(!u||!u.length)continue;if(delete o.dataset.lazySrc,o.src=u,o.complete)continue;n(t,this.cn("isLoading"));const d=i('
');t.appendChild(d),o.addEventListener("load",(()=>{t.offsetParent&&(t.classList.remove(this.cn("isLoading")),d.remove())}),!1)}}resizeModernSlide(t){if("modern"!==this.type)return;if(!t.thumbSlideEl)return;const e=t.thumbClipWidth&&t.thumbHeight?Math.round(this.thumbHeight*(t.thumbClipWidth/t.thumbHeight)):this.thumbWidth;t.thumbWidth=e}getModernThumbPos(t){const e=this.instance.slides[t],i=this.panzoom;if(!i||!i.contentRect.fitWidth)return 0;let s=i.containerRect.innerWidth,n=i.contentRect.width;2===this.instance.slides.length&&(t-=1,n=2*this.thumbClipWidth);let r=t*(this.thumbClipWidth+this.thumbGap)+this.thumbExtraGap+.5*(e.thumbWidth||0);return r-=n>s?.5*s:.5*n,c(r||0,1)}build(){const e=this.instance,i=e.container,s=this.option("minCount")||0;if(s){let i=0;for(const t of e.slides||[])t.thumbSrc&&i++;if(i{e&&e.classList.remove(t)}))}attach(){this.instance.on("initSlide",this.onInitSlide),this.instance.on("initSlides",this.onInitSlides),this.instance.on("Panzoom.afterTransform",this.onTransformM),this.instance.on("Panzoom.refresh",this.onRefreshM),this.instance.on("change",this.onChangeM)}detach(){this.instance.off("initSlide",this.onInitSlide),this.instance.off("initSlides",this.onInitSlides),this.instance.off("Panzoom.afterTransform",this.onTransformM),this.instance.off("Panzoom.refresh",this.onRefreshM),this.instance.off("change",this.onChangeM),this.cleanup()}}Object.defineProperty(d,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:u}),t.Thumbs=d,t.defaultOptions=u})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";const e=(t,...i)=>{const s=i.length;for(let n=0;n{const n=Array.isArray(s)?[]:{};var r;t[i]||Object.assign(t,{[i]:n}),"object"==typeof(r=s)&&null!==r&&r.constructor===Object&&"[object Object]"===Object.prototype.toString.call(r)?Object.assign(t[i],e(n,s)):Array.isArray(s)?Object.assign(t,{[i]:[...s]}):Object.assign(t,{[i]:s})}))}return t},i=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},s=t=>`${t||""}`.split(" ").filter((t=>!!t)),n=(t,e)=>{s(e).forEach((e=>{t&&t.classList.add(e)}))},r=(t,e,i)=>{s(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))},o=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class a{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?e({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=o(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...s){let n=o(e,t);var r;"string"!=typeof(r=n)||isNaN(r)||isNaN(parseFloat(r))||(n=parseFloat(n)),"true"===n&&(n=!0),"false"===n&&(n=!1),n&&"function"==typeof n&&(n=n.call(this,this,t,...s));let a=o(e,this.options);return a&&"function"==typeof a?n=a.call(this,this,t,...s,n):void 0===n&&(n=a),void 0===n?i:n}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let s="";return i?s=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(s=this.option(`l10n.${e}`)),s||(s=t),s}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(a,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(a,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class h extends a{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}var l;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(l||(l={}));const c=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),u={classes:{container:"f-thumbs f-carousel__thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'',type:"modern"};t.States=void 0,function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden",t[t.Disabled=3]="Disabled"}(t.States||(t.States={}));class d extends h{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"shouldCenter",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:t.States.Init})}formatThumb(t,e){return this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}getSlides(){const t=[],e=this.option("thumbTpl")||"";if(e)for(const i of this.instance.slides||[])t.push({html:this.formatThumb(i,e),customClass:`has-thumb for-${i.type||"image"}`});return t}getProgress(t){const e=this.instance,i=e.panzoom,s=e.pages[t]||0;if(!s||!i)return 0;let n=-1*i.current.e,r=e.contentDim,o=(n-s.pos)/(1*s.dim),a=(n+r-s.pos)/(1*s.dim),h=(n-r-s.pos)/(1*s.dim);return o=Math.max(0,Math.min(1,Math.abs(o))),a=Math.max(0,Math.min(1,Math.abs(a))),h=Math.max(0,Math.min(1,Math.abs(h))),o=Math.min(o,a,h),o}onInitSlide(t,e){const i=e.el;i&&(e.thumbSrc=i.dataset.thumbSrc||e.thumbSrc||"",e.thumbClipWidth=parseFloat(i.dataset.thumbClipWidth||"")||e.thumbClipWidth||0,e.thumbHeight=parseFloat(i.dataset.thumbHeight||"")||e.thumbHeight||0)}onInitSlides(){this.state===t.States.Init&&this.build()}onRefreshM(){this.refreshModern()}onChangeM(){"modern"===this.type&&(this.shouldCenter=!0,this.centerModern())}onClickModern(t){t.preventDefault(),t.stopPropagation();const e=this.instance,i=e.page,s=t=>{if(t){const e=t.closest("[data-carousel-page]");if(e)return parseInt(e.dataset.carouselPage||"",10)||0}return-1},n=(t,e)=>{const i=document.elementFromPoint(t,e);return i?s(i):-1};let r=s(t.target);r<0&&(r=n(t.clientX+this.thumbGap,t.clientY),r===i&&(r=i-1)),r<0&&(r=n(t.clientX-this.thumbGap,t.clientY),r===i&&(r=i+1)),r<0&&(r=(e=>{let s=n(t.clientX-e,t.clientY),o=n(t.clientX+e,t.clientY);return r<0&&s===i&&(r=i+1),r<0&&o===i&&(r=i-1),r})(this.thumbExtraGap)),r===i?this.centerModern():r>-1&&r{this.emit("ready")}))}buildModern(){if("modern"!==this.type)return;const{container:t,track:e,instance:s}=this,r=this.option("thumbTpl")||"";if(!t||!e||!r)return;this.updateModern();for(const t of s.slides||[]){const s=document.createElement("div");n(s,this.cn("slide")),s.appendChild(i(this.formatThumb(t,r))),t.thumbSlideEl=s,e.appendChild(s),this.resizeModernSlide(t)}const o=new s.constructor.Panzoom(t,{content:e,lockAxis:"x",zoom:!1,panOnlyZoomed:!1,bounds:()=>{let t=0,e=0,i=s.slides[0],n=s.slides[s.slides.length-1],r=s.slides[s.page];return i&&n&&r&&(e=-1*this.getModernThumbPos(0),0!==s.page&&(e+=.5*(i.thumbWidth||0)),t=-1*this.getModernThumbPos(s.slides.length-1),s.page!==s.slides.length-1&&(t+=(n.thumbWidth||0)-(r.thumbWidth||0)-.5*(n.thumbWidth||0))),{x:{min:t,max:e},y:{min:0,max:0}}}});o.on("touchStart",(()=>{this.shouldCenter=!1})),o.on("click",((t,e)=>this.onClickModern(e))),o.on("ready",(()=>{this.centerModern(),this.emit("ready")})),o.on(["afterTransform","refresh"],(t=>{this.lazyLoadModern()})),this.panzoom=o,this.refreshModern()}updateModern(){if("modern"!==this.type)return;const{container:t}=this;t&&(this.thumbGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-gap"))||0,this.thumbExtraGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-extra-gap"))||0,this.thumbWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-width"))||40,this.thumbClipWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-clip-width"))||40,this.thumbHeight=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-height"))||40)}refreshModern(){var t;if("modern"===this.type){this.updateModern();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.onTransformM(),null===(t=this.panzoom)||void 0===t||t.updateMetrics(!0),this.centerModern(0)}}centerModern(t){const e=this.instance,{container:i,panzoom:s}=this;if(!i||!s||s.state===l.Init)return;const n=e.page;let r=this.getModernThumbPos(n),o=r;for(let t=e.page-3;te.pages.length-1||t===e.page)continue;const i=1-this.getProgress(t);i>0&&i<1&&(o+=i*(this.getModernThumbPos(t)-r))}let a=100;void 0===t&&(t=.2,e.inTransition.size>0&&(t=.12),Math.abs(-1*s.current.e-o)>s.containerRect.width&&(t=.5,a=0)),s.options.maxVelocity=a,s.applyChange({panX:c(-1*o-s.target.e,1e3),friction:null===e.prevPage?0:t})}lazyLoadModern(){const{instance:t,panzoom:e}=this;if(!e)return;const s=-1*e.current.e||0;let r=this.getModernThumbPos(t.page);if(e.state!==l.Init||0===r)for(const r of t.slides||[]){const t=r.thumbSlideEl;if(!t)continue;const o=t.querySelector("img[data-lazy-src]"),a=r.index,h=this.getModernThumbPos(a),l=s-.5*e.containerRect.innerWidth,c=l+e.containerRect.innerWidth;if(!o||hc)continue;let u=o.dataset.lazySrc;if(!u||!u.length)continue;if(delete o.dataset.lazySrc,o.src=u,o.complete)continue;n(t,this.cn("isLoading"));const d=i('
');t.appendChild(d),o.addEventListener("load",(()=>{t.offsetParent&&(t.classList.remove(this.cn("isLoading")),d.remove())}),!1)}}resizeModernSlide(t){if("modern"!==this.type)return;if(!t.thumbSlideEl)return;const e=t.thumbClipWidth&&t.thumbHeight?Math.round(this.thumbHeight*(t.thumbClipWidth/t.thumbHeight)):this.thumbWidth;t.thumbWidth=e}getModernThumbPos(t){const e=this.instance.slides[t],i=this.panzoom;if(!i||!i.contentRect.fitWidth)return 0;let s=i.containerRect.innerWidth,n=i.contentRect.width;2===this.instance.slides.length&&(t-=1,n=2*this.thumbClipWidth);let r=t*(this.thumbClipWidth+this.thumbGap)+this.thumbExtraGap+.5*(e.thumbWidth||0);return r-=n>s?.5*s:.5*n,c(r||0,1)}build(){const e=this.instance,i=e.container,s=this.option("minCount")||0;if(s){let i=0;for(const t of e.slides||[])t.thumbSrc&&i++;if(i{e&&e.classList.remove(t)}))}attach(){this.instance.on("initSlide",this.onInitSlide),this.instance.on("initSlides",this.onInitSlides),this.instance.on("Panzoom.afterTransform",this.onTransformM),this.instance.on("Panzoom.refresh",this.onRefreshM),this.instance.on("change",this.onChangeM)}detach(){this.instance.off("initSlide",this.onInitSlide),this.instance.off("initSlides",this.onInitSlides),this.instance.off("Panzoom.afterTransform",this.onTransformM),this.instance.off("Panzoom.refresh",this.onRefreshM),this.instance.off("change",this.onChangeM),this.cleanup()}}Object.defineProperty(d,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:u}),t.Thumbs=d,t.defaultOptions=u})); diff --git a/dist/carousel/carousel.umd.js b/dist/carousel/carousel.umd.js index aaa2bc3c..3fe496a7 100644 --- a/dist/carousel/carousel.umd.js +++ b/dist/carousel/carousel.umd.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";const e=t=>"object"==typeof t&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t),i=(t,...s)=>{const n=s.length;for(let o=0;o{const o=Array.isArray(n)?[]:{};t[s]||Object.assign(t,{[s]:o}),e(n)?Object.assign(t[s],i(o,n)):Array.isArray(n)?Object.assign(t,{[s]:[...n]}):Object.assign(t,{[s]:n})}))}return t},s=function(t,e){let i=!0;return(...s)=>{i&&(i=!1,t(...s),setTimeout((()=>{i=!0}),e))}},n=(t,e)=>{let i=[];return t.childNodes.forEach((t=>{t.nodeType!==Node.ELEMENT_NODE||e&&!t.matches(e)||i.push(t)})),i},o=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},a=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),r=t=>`${t||""}`.split(" ").filter((t=>!!t)),h=(t,e)=>{r(e).forEach((e=>{t&&t.classList.add(e)}))},l=(t,e)=>{r(e).forEach((e=>{t&&t.classList.remove(e)}))},c=(t,e,i)=>{r(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))},d='
',u=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class g{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?i({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=u(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...s){let n=u(e,t);var o;"string"!=typeof(o=n)||isNaN(o)||isNaN(parseFloat(o))||(n=parseFloat(n)),"true"===n&&(n=!0),"false"===n&&(n=!1),n&&"function"==typeof n&&(n=n.call(this,this,t,...s));let a=u(e,this.options);return a&&"function"==typeof a?n=a.call(this,this,t,...s,n):void 0===n&&(n=a),void 0===n?i:n}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let s="";return i?s=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(s=this.option(`l10n.${e}`)),s||(s=t),s}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(g,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(g,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class f extends g{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,s]of Object.entries(t)){const t=this.option(i),n=this.plugins[i];n||!1===t?n&&!1===t&&(n.detach(),delete this.plugins[i]):e.set(i,new s(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}const p=function(t,e){return!(!t||t===document.body||e&&t===e)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,s=-1!==i.indexOf("hidden"),n=-1!==i.indexOf("visible");return e&&!s&&!n}(t)?t:p(t.parentElement,e))};class m{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const b={passive:!1};class v{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:s=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=s;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,b),this.element.addEventListener("touchmove",this.onMove,b),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,b)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new m(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new m(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new m(t))):[new m(t)],s=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(s.push(t),this.currentPointers[e]=t)}s.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new m(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new m(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,b),this.element.removeEventListener("touchstart",this.onTouchStart,b),this.element.removeEventListener("touchmove",this.onMove,b),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function y(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function x(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}var w;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(w||(w={}));const P=["a","b","c","d","e","f"],S={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:{PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"}},T=t=>t&&null!==t&&t instanceof Element&&"nodeType"in t,M={a:1,b:0,c:0,d:1,e:0,f:0},O=1e5,E=1e3;let z=null,k=null;class R extends f{get isTouchDevice(){return null===k&&(k=window.matchMedia("(hover: none)").matches),k}get isMobile(){return null===z&&(z=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),z}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){return this.content instanceof HTMLImageElement&&!this.content.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of P){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var s;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:w.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},M)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},M)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},R.Plugins),i)),this.emit("init"),this.isContentLoading){if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const e=o(d);t.contains(this.content)?this.spinner=(null===(s=this.content.parentElement)||void 0===s?void 0:s.insertBefore(e,this.content))||null:this.spinner=t.appendChild(e)}this.emit("beforeLoad"),this.content.addEventListener("load",this.onLoad),this.content.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===w.Init&&this.enable()}onError(){this.state!==w.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=w.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new v(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of P)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of P)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,s=i.e+t,n=i.f+e,o=this.getBounds(),{x:a,y:r}=o,h=a.min,l=a.max,c=r.min,d=r.max;let u=0,g=0;return h!==1/0&&sl&&(u=l-s),c!==1/0&&nd&&(g=d-n),Math.abs(u)<.001&&(u=0),Math.abs(g)<.001&&(g=0),Object.assign(Object.assign({},o),{xDiff:u,yDiff:g,inBounds:!u&&!g})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:s,fitHeight:n,fullWidth:o,fullHeight:a}=i;let r=o,h=a;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),l=i?o:s,c=i?a:n,d=this.getMatrix(t),u=new DOMPoint(0,0).matrixTransform(d),g=new DOMPoint(0+l,0).matrixTransform(d),f=new DOMPoint(0+l,0+c).matrixTransform(d),p=new DOMPoint(0,0+c).matrixTransform(d),m=Math.abs(f.x-u.x),b=Math.abs(f.y-u.y),v=Math.abs(p.x-g.x),y=Math.abs(p.y-g.y);r=Math.max(m,v),h=Math.max(b,y)}return{contentWidth:r,contentHeight:h}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const s=i.closest("[data-panzoom-action]"),n=i.closest("[data-panzoom-change]"),o=s||n,a=o&&T(o)?o.dataset:null;if(a){const e=a.panzoomChange,i=a.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const r=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(r.x-this.dragStart.x)>2||Math.abs(r.y-this.dragStart.y)>2))return;this.dragStart.time=0;const h=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},l=this.option("click",t),c=this.option("dblClick",t);c?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&l&&h(l)):(this.emit("dblClick",t),t.defaultPrevented||h(c)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&l&&h(l))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(t,e,i){var s;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const n=this.content.getBoundingClientRect();if(this.dragStart={x:n.x,y:n.y,top:n.top,left:n.left,time:Date.now()},!1===this.option("touch",t))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;if(!i.length){const e=t.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(e.nodeName)||e.closest("[contenteditable]")||e.closest("[data-selectable]")||e.closest("[data-panzoom-change]")||e.closest("[data-panzoom-action]"))return!1;null===(s=window.getSelection())||void 0===s||s.removeAllRanges()}return"mousedown"===t.type&&t.preventDefault(),a(this.targetScale,1e3)===a(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(e),this.emit("touchStart",t),!0}onPointerMove(t,e,i){if(!this.isDragging)return;if(e.length<2&&this.panOnlyZoomed&&a(this.targetScale)<=a(this.minScale))return;if(this.emit("touchMove",t),t.defaultPrevented)return;this.addTrackingPoint(e[0]);const{content:s}=this,n=x(i[0],i[1]),o=x(e[0],e[1]);let r=0,h=0;if(e.length>1){const t=s.getBoundingClientRect();r=n.clientX-t.left-.5*t.width,h=n.clientY-t.top-.5*t.height}const l=y(i[0],i[1]),c=y(e[0],e[1]);let d=l?c/l:1,u=o.clientX-n.clientX,g=o.clientY-n.clientY;this.dragOffset.x+=u,this.dragOffset.y+=g,this.dragOffset.time=Date.now()-this.dragStart.time;let f=a(this.targetScale)===a(this.minScale)&&this.option("lockAxis");if(f&&!this.lockedAxis)if("xy"===f||"y"===f||"touchmove"===t.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void t.preventDefault();const e=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=e>45&&e<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,u=0,g=0}else this.lockedAxis=f;if(p(t.target,this.content)&&(f="x",this.dragOffset.y=0),f&&"xy"!==f&&this.lockedAxis!==f&&a(this.targetScale)===a(this.minScale))return;t.cancelable&&t.preventDefault(),this.container.classList.add(this.cn("isDragging"));const m=this.checkBounds(u,g);this.option("rubberband")?("x"!==this.isInfinite&&(m.xDiff>0&&u<0||m.xDiff<0&&u>0)&&(u*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*m.xDiff))),"y"!==this.isInfinite&&(m.yDiff>0&&g<0||m.yDiff<0&&g>0)&&(g*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*m.yDiff)))):(m.xDiff&&(u=0),m.yDiff&&(g=0));const b=this.targetScale,v=this.minScale,w=this.maxScale;b<.5*v&&(d=Math.max(d,v)),b>1.5*w&&(d=Math.min(d,w)),"y"===this.lockedAxis&&a(b)===a(v)&&(u=0),"x"===this.lockedAxis&&a(b)===a(v)&&(g=0),this.applyChange({originX:r,originY:h,panX:u,panY:g,scale:d,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,e,i){if(i.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(e),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),p(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==w.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of P)this.velocity[t]=0,this.target[t]=this.current[t];const{trackingPoints:t}=this,e=t[0],i=t[t.length-1];let s=0,n=0,o=0;i&&e&&(s=i.clientX-e.clientX,n=i.clientY-e.clientY,o=i.time-e.time);let r=0,h=0,l=0,c=0,d=this.option("decelFriction");const u=this.targetScale;if((uthis.maxScale+1e-5)&&(d=.35),o>0){l=Math.abs(s)>3?s/(o/30):0,c=Math.abs(n)>3?n/(o/30):0;const t=this.option("maxVelocity");t&&(l=Math.max(Math.min(l,t),-1*t),c=Math.max(Math.min(c,t),-1*t))}l&&(r=l/(1/(1-d)-1)),c&&(h=c/(1/(1-d)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&a(u)===this.minScale)&&(r=l=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&a(u)===this.minScale)&&(h=c=0);const g=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(s)),"auto"===f&&(f=parseFloat(s.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(s));const p=(this.option("transformParent")?s.parentElement:null)||s,m=p.getAttribute("style")||"";p.style.setProperty("transform","none","important"),p.style.setProperty("transition","none","important"),p.style.setProperty("animation","none","important"),s instanceof HTMLImageElement&&(p.style.width="",p.style.height=""),p.offsetHeight;const b=s.getBoundingClientRect();let v=b.width,y=b.height,x=0,P=0;if(s instanceof HTMLImageElement&&({width:v,height:y,top:x,left:P}=((t,e,i,s)=>{const n=i/s;return n>t/e?(i=t,s=t/n):(i=e*n,s=e),{width:i,height:s,top:.5*(e-s),left:.5*(t-i)}})(b.width,b.height,g,f)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:b.top-r.top+x,bottom:r.bottom-b.bottom+x,left:b.left-r.left+P,right:r.right-b.right+P,fitWidth:v,fitHeight:y,width:v,height:y,fullWidth:g,fullHeight:f}),p.style.cssText=m,s instanceof HTMLImageElement&&(p.style.width=`${v}px`,p.style.height=`${y}px`),this.setTransform(),!0!==t){let t="";Math.abs(l-n)>1&&(t+="x"),Math.abs(c-o)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(a(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===w.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const t=this.option("bounds");if("auto"!==t)return t;const{contentWidth:e,contentHeight:i}=this.calculateContentDim(this.target);let s=0,n=0,o=0,r=0;const h=this.option("infinite");if(!0===h||this.lockedAxis&&h===this.lockedAxis)s=-1/0,o=1/0,n=-1/0,r=1/0;else{let{containerRect:t,contentRect:h}=this,l=a(this.contentRect.fitWidth*this.targetScale,E),c=a(this.contentRect.fitHeight*this.targetScale,E),{innerWidth:d,innerHeight:u}=t;if(this.containerRect.width===l&&(d=t.width),this.containerRect.width===c&&(u=t.height),e>d){o=.5*(e-d),s=-1*o;let t=.5*(h.right-h.left);s+=t,o+=t}if(this.contentRect.fitWidth>d&&eu){r=.5*(i-u),n=-1*r;let t=.5*(h.bottom-h.top);n+=t,r+=t}this.contentRect.fitHeight>u&&ithis.maxScale?this.minScale:this.maxScale,toggleCover:this.targetScale>this.coverScale?this.minScale:this.coverScale,toggleZoom:this.targetScale>this.fullScale?this.minScale:this.fullScale}[this.option("click")||""]||this.minScale,s=t.canZoomIn(),n=t.canZoomOut(),o="drag"===this.panMode,r=n&&o;this.targetScale<=this.minScale&&!this.panOnlyZoomed&&(r=!0),(this.contentRect.width-this.contentRect.fitWidth>-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(r=!0),this.contentRect.width*this.targetScalethis.minScale,l=!s&&!r&&n&&a(i)===a(this.minScale);c(e,this.cn("canZoomIn"),h),c(e,this.cn("canZoomOut"),l),c(e,this.cn("isDraggable"),r);for(const t of e.querySelectorAll('[data-panzoom-action="zoomIn"]'))s?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const t of e.querySelectorAll('[data-panzoom-action="zoomOut"]'))n?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const i of e.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){s=t.targetScale.9*t.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:s=this.option("friction"),angle:n=0,originX:o=0,originY:a=0,flipX:r=!1,flipY:h=!1,ignoreBounds:l=!1}){this.state!==w.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:n,originX:o,originY:a,friction:s,flipX:r,flipY:h,ignoreBounds:l})}applyChange({panX:t=0,panY:e=0,scale:i=1,angle:s=0,originX:n=-this.current.e,originY:o=-this.current.f,friction:r=this.option("friction"),flipX:h=!1,flipY:l=!1,ignoreBounds:c=!1,bounce:d=this.option("bounce")}){if(this.state===w.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of P)this.velocity[t]=0;this.friction=r||0,this.ignoreBounds=c;const{current:u}=this,g=u.e,f=u.f,p=this.getMatrix(this.target);let m=(new DOMMatrix).translate(g,f).translate(n,o).translate(t,e);if(this.option("zoom")){if(!c){const t=this.targetScale,e=this.minScale,s=this.maxScale;t*is&&(i=s/t)}m=m.scale(i)}m=m.translate(-n,-o).translate(-g,-f).multiply(p),s&&(m=m.rotate(s)),h&&(m=m.scale(-1,1)),l&&(m=m.scale(1,-1));for(const t of P)"a"!=t&&"d"!=t||!(m[t]>this.minScale+1e-5||m[t].1||"mousemove"===this.panMode||!1===d)&&!c&&this.clampTargetBounds(),this.isResting||(this.state=w.Panning,this.requestTick())}stop(t=!1){if(this.state!==w.Init&&this.state!==w.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of P)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=w.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls()),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(t,e=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=t,"mousemove"!==this.panMode||!t)return;if(a(this.targetScale)<=a(this.minScale))return;this.emit("mouseMove",t);const{container:i,containerRect:s,contentRect:n}=this,o=s.width,r=s.height,h=i.getBoundingClientRect(),l=(t.clientX||0)-h.left,c=(t.clientY||0)-h.top;let{contentWidth:d,contentHeight:u}=this.calculateContentDim(this.target);const g=this.option("mouseMoveFactor");g>1&&(d!==o&&(d*=g),u!==r&&(u*=g));let f=.5*(d-o)-l/o*100/100*(d-o);f+=.5*(n.right-n.left);let p=.5*(u-r)-c/r*100/100*(u-r);p+=.5*(n.bottom-n.top),this.applyChange({panX:f-this.target.e,panY:p-this.target.f,friction:e})}zoomWithWheel(t){if(this.state===w.Destroy||this.state===w.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),s=this.targetScale,n=this.maxScale,o=this.minScale;let a=s*(100+i*e)/100;an&&s>=n?(this.wheelDelta+=Math.abs(i),a=n):(this.wheelDelta=0,a=Math.max(Math.min(a,n),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),a!==s&&this.zoomTo(a,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale>.9*this.maxScale?"fit":"max",t)}toggleCover(t){this.zoomTo(this.targetScale>.9*this.coverScale?"fit":"cover",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:s=0,event:n}={}){if(this.isContentLoading||this.state===w.Destroy)return;this.stop();const{targetScale:o}=this;let a=1;if("mousemove"===this.panMode&&(n=this.prevMouseMoveEvent||n),n){const t=this.content.getBoundingClientRect(),e=n.clientX||0,o=n.clientY||0;i=e-t.left-.5*t.width,s=o-t.top-.5*t.height}const r=this.fullScale,h=this.maxScale;let l=this.coverScale;"number"==typeof t?a=t/o:("next"===t&&(r-l<.2&&(l=r),t=o1?.15:.25:e,this.applyChange({scale:a,originX:i,originY:s,friction:e}),n&&"mousemove"===this.panMode&&this.panWithMouse(n,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const s=t.classList.contains(e);s?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(s?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:s,d:n,e:o,f:a}=t;return new DOMMatrix([e,i,s,n,o,a])}reset(t){if(this.state!==w.Init&&this.state!==w.Destroy){this.stop("current");for(const t of P)this.target[t]=M[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=w.Panning,this.requestTick())}}destroy(){this.stop(),this.state=w.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(R,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:S}),Object.defineProperty(R,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const D={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var L;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"}(L||(L={}));const A=t=>{if("string"==typeof t&&(t={html:t}),!(t instanceof String||t instanceof HTMLElement)){const e=t.thumb;void 0!==e&&("string"==typeof e&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},C=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class j extends g{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const F={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'',dynamicFrom:11,maxCount:1/0,minCount:2};class H extends j{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let t=this.list;return t||(t=document.createElement("ul"),h(t,this.cn("list")),t.setAttribute("role","tablist"),this.instance.container.appendChild(t),h(this.instance.container,this.cn("hasDots")),this.list=t),t}refresh(){var t;const e=this.instance.pages.length,i=Math.min(2,this.option("minCount")),s=Math.max(2e3,this.option("maxCount")),n=this.option("dynamicFrom");if(es)return void this.cleanup();const o="number"==typeof n&&e>5&&e>=n,a=!this.list||this.isDynamic!==o||this.list.children.length!==e;a&&this.cleanup();const r=this.build();if(c(r,this.cn("isDynamic"),!!o),a)for(let t=0;t=e-1&&n.setAttribute("disabled","")))}createButton(t){const e=this.instance,i=document.createElement("button");i.setAttribute("tabindex","0"),i.setAttribute("title",e.localize(`{{${t.toUpperCase()}}}`)),h(i,this.cn("button")+" "+this.cn("next"===t?"isNext":"isPrev"));const s=e.isRTL?"next"===t?"prev":"next":t;var n;return i.innerHTML=e.localize(this.option(`${s}Tpl`)),i.dataset[`carousel${n=t,n?n.match("^[a-z]")?n.charAt(0).toUpperCase()+n.substring(1):n:""}`]="true",i}build(){let t=this.container;t||(this.container=t=document.createElement("div"),h(t,this.cn("container")),this.instance.container.appendChild(t)),this.next||(this.next=t.appendChild(this.createButton("next"))),this.prev||(this.prev=t.appendChild(this.createButton("prev")))}cleanup(){this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove(),this.prev=null,this.next=null,this.container=null}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(I,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'',prevTpl:''}});class B extends j{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){this.nav&&this.target&&(this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.state===L.Ready&&this.onNavReady(this.nav),this.target.on("ready",this.onTargetReady),this.target.state===L.Ready&&this.onTargetReady(this.target))}onNavReady(t){t.on("createSlide",this.onNavCreateSlide),t.on("Panzoom.click",this.onNavClick),this.onTargetChange()}onTargetReady(t){t.on("change",this.onTargetChange),t.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(t,e,i){var s,n;const o=i.target,{nav:a,target:r}=this;if(!a||!r||!o)return;const h=o.closest("[data-index]");if(!h)return;i.stopPropagation();const l=parseInt(h.dataset.index||"",10)||0,c=a.getPageForSlide(l);a.page!==c&&a.slideTo(c);const d=r.getPageForSlide(l);r.page!==d&&r.slideTo(d,{friction:null===(n=null===(s=this.nav)||void 0===s?void 0:s.plugins)||void 0===n?void 0:n.Sync.option("friction")}),this.markSelectedSlide(l)}onNavCreateSlide(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}onTargetChange(){const{target:t,nav:e}=this;if(!t||!e)return;if(e.state!==L.Ready||t.state!==L.Ready)return;const i=t.pages[t.page].slides[0].index,s=e.getPageForSlide(i);e.slideTo(s),this.markSelectedSlide(i)}markSelectedSlide(t){const{nav:e}=this;if(!e)return;this.selectedIndex=t,[...e.slides].filter((t=>t.el&&t.el.classList.remove("is-nav-selected")));const i=e.slides[t];i&&i.el&&i.el.classList.add("is-nav-selected")}attach(){let t=this.options.target,e=this.options.nav;t?this.addAsNavFor(t):e&&this.addAsTargetFor(e)}detach(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.nav=null,this.target&&(this.target.off("ready",this.onTargetReady),this.target.off("refresh",this.onTargetChange),this.target.off("change",this.onTargetChange)),this.target=null}}Object.defineProperty(B,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const W={Navigation:I,Dots:H,Sync:B};class X extends f{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===L.Ready}get isInfinite(){let t=!1;const e=this.contentDim,i=this.viewportDim;return this.pages.length>=2&&e>1.5*i&&(t=this.option("infinite")),t}get isRTL(){return"rtl"===this.option("direction")}get isHorizontal(){return"x"===this.option("axis")}constructor(t,e={},i={}){if(super(),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:L.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),"string"==typeof t&&(t=document.querySelector(t)),!t||!T(t))throw new Error("No Element found");this.container=t,this.slideNext=s(this.slideNext.bind(this),175),this.slidePrev=s(this.slidePrev.bind(this),175),this.userOptions=e,this.userPlugins=i,queueMicrotask((()=>{this.processOptions()}))}processOptions(){const t=i({},X.defaults,this.userOptions);let s="";const n=t.breakpoints;if(n&&e(n))for(const[o,a]of Object.entries(n))window.matchMedia(o).matches&&e(a)&&(s+=o,i(t,a));s===this.bp&&this.state!==L.Init||(this.bp=s,this.state===L.Ready&&(t.initialSlide=this.pages[this.page].slides[0].index),this.state!==L.Init&&this.destroy(),super.setOptions(t),!1===this.option("enabled")?this.attachEvents():setTimeout((()=>{this.init()}),0))}init(){this.state=L.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},X.Plugins),this.userPlugins)),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=L.Ready,this.emit("ready")}initLayout(){const{container:t}=this,e=this.option("classes");h(t,this.cn("container")),c(t,e.isLTR,!this.isRTL),c(t,e.isRTL,this.isRTL),c(t,e.isVertical,!this.isHorizontal),c(t,e.isHorizontal,this.isHorizontal);let i=this.option("viewport")||t.querySelector(`.${e.viewport}`);i||(i=document.createElement("div"),h(i,e.viewport),i.append(...n(t,`.${e.slide}`)),t.prepend(i));let s=this.option("track")||t.querySelector(`.${e.track}`);s||(s=document.createElement("div"),h(s,e.track),s.append(...Array.from(i.childNodes))),s.setAttribute("aria-live","polite"),i.contains(s)||i.prepend(s),this.viewport=i,this.track=s,this.emit("initLayout")}initSlides(){const{track:t}=this;if(t){this.slides=[],[...n(t,`.${this.cn("slide")}`)].forEach((t=>{if(T(t)){const e=A({el:t,isDom:!0,index:this.slides.length});this.slides.push(e),this.emit("initSlide",e,this.slides.length)}}));for(let t of this.option("slides",[])){const e=A(t);e.index=this.slides.length,this.slides.push(e),this.emit("initSlide",t,this.slides.length)}this.emit("initSlides")}}setInitialPage(){let t=0;const e=this.option("initialSlide");t="number"==typeof e?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0,this.page=t}setInitialPosition(){if(!this.track||!this.pages.length)return;let t=this.page;this.pages[t]||(this.page=t=0);const e=this.pages[t].pos*(this.isRTL&&this.isHorizontal?1:-1),i=this.isHorizontal?`${e}px`:"0",s=this.isHorizontal?"0":`${e}px`;this.track.style.transform=`translate3d(${i}, ${s}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const t=this.option("Panzoom")||{};this.panzoom=new R(this.viewport,i({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,decelFriction:.12,click:!1,dblClick:!1,touch:t=>!(this.pages.length<2&&!t.options.infinite),bounds:()=>this.getBounds(),maxVelocity:t=>Math.abs(t.target[this.axis]-t.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on("*",((t,e,...i)=>{this.emit(`Panzoom.${e}`,t,...i)})),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation),this.panzoom.on("touchStart",((t,e)=>{this.inTransition.size&&e.preventDefault()}))}attachEvents(){const t=this.container;t&&(t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let t=[];const{contentDim:e,viewportDim:i}=this,s=this.option("slidesPerPage");if("number"==typeof s&&e>i){for(let e=0;ei)&&(t.push(C()),n=t.length-1,o=0),o+=e.dim+e.gap,t[n].slides.push(e);return t}processPages(){const t=this.pages,{contentDim:e,viewportDim:i}=this,s=this.option("center"),n=this.option("fill");if(t.forEach(((t,e)=>{t.index=e,t.pos=t.slides[0].pos,t.dim=0;for(const[e,i]of t.slides.entries())t.dim+=i.dim,e{n&&!this.isInfinite&&e>i&&(t.pos=Math.max(t.pos,0),t.pos=Math.min(t.pos,e-i)),t.pos=a(t.pos,1e3),t.dim=a(t.dim,1e3)})),this.isInfinite)return t;const o=[];let r;return t.forEach((t=>{const e=Object.assign({},t);r&&e.pos===r.pos?(r.dim+=e.dim,r.slides=[...r.slides,...e.slides]):(e.index=o.length,r=e,o.push(e))})),o}getPageFromIndex(t=0){const e=this.pages.length;let i;return t=parseInt((t||0).toString())||0,i=this.isInfinite?(t%e+e)%e:Math.max(Math.min(t,this.pages.length-1),0),i}getSlideMetrics(t){const e=this.isHorizontal?"width":"height";let i=0,s=0,n=t.el;n?i=parseFloat(n.dataset[e]||"")||0:(n=document.createElement("div"),n.style.visibility="hidden",h(n,this.cn("slide")+" "+t.class),(this.track||document.body).prepend(n)),i?(n.style[e]=`${i}px`,n.style["width"===e?"height":"width"]=""):i=n.getBoundingClientRect()[e];const o=getComputedStyle(n);return"content-box"===o.boxSizing&&(this.isHorizontal?(i+=parseFloat(o.paddingLeft)||0,i+=parseFloat(o.paddingRight)||0):(i+=parseFloat(o.paddingTop)||0,i+=parseFloat(o.paddingBottom)||0)),s=parseFloat(o[this.isHorizontal?"marginRight":"marginBottom"])||0,this.isHorizontal,t.el||n.remove(),{dim:i,gap:s}}getBounds(){let t={min:0,max:0};if(this.isInfinite)t={min:-1/0,max:1/0};else if(this.pages.length){const e=this.pages[0].pos,i=this.pages[this.pages.length-1].pos;t=this.isRTL&&this.isHorizontal?{min:e,max:i}:{min:-1*i,max:-1*e}}return{x:this.isHorizontal?t:{min:0,max:0},y:this.isHorizontal?{min:0,max:0}:t}}repositionSlides(){const{viewportDim:t,contentDim:e,page:i,pages:s}=this;let n,o=0,r=0,h=0,l=0;this.panzoom?l=-1*this.panzoom.current[this.isHorizontal?"e":"f"]:s[i]&&(l=s[i].pos||0),n=this.isHorizontal?this.isRTL?"right":"left":"top",this.isRTL&&this.isHorizontal&&(l*=-1);for(const t of this.slides)t.el?("top"===n?(t.el.style.right="",t.el.style.left=""):t.el.style.top="",t.index!==o?t.el.style[n]=0===r?"":`${r}px`:t.el.style[n]="",h+=t.dim+t.gap,o++):r+=t.dim+t.gap;if(this.isInfinite&&h)for(const i of this.slides)i.el&&(a(i.pos)a(e-t)&&(i.el.style[n]=`${r+h}px`),a(i.pos+i.gap)>=a(e-t)&&a(i.pos)>a(l+t)&&a(l)1&&(c=this.pages[u[0]],d=this.pages[u[1]]),c&&d){let t=0;for(const e of this.slides)e.el?this.inTransition.has(e.index)&&c.slides.indexOf(e)<0&&(e.el.style[n]=`${t+(c.pos-d.pos)}px`):t+=e.dim+e.gap}}createSlideEl(t){if(!this.track||!t)return;if(t.el)return;const e=document.createElement("div");h(e,this.cn("slide")),h(e,t.class),t.html&&(e.innerHTML=t.html);const i=[];this.slides.forEach(((t,e)=>{t.el&&i.push(e)}));const s=t.index;let n=null;if(i.length){let t=i.reduce(((t,e)=>Math.abs(e-s)this.page?1:-1,a=this.pages[n].pos*(this.isRTL?1:-1);if(this.page===n&&a===s.target[this.axis])return!1;this.clearTransitions();const r=s.isResting;h(this.container,this.cn("inTransition"));const l=this.pages[this.page].slides[0],c=this.pages[n].slides[0];this.inTransition.add(c.index),this.createSlideEl(c);let d=l.el,u=c.el;r||"slide"===e||(e="fadeFast",d=null);const g=this.isRTL?"next":"prev",f=this.isRTL?"prev":"next";return d&&(this.inTransition.add(l.index),l.transition=e,d.addEventListener("animationend",this.onAnimationEnd),d.classList.add(`f-${e}Out`,`to-${o>0?f:g}`)),u&&(c.transition=e,u.addEventListener("animationend",this.onAnimationEnd),u.classList.add(`f-${e}In`,`from-${o>0?g:f}`)),s.panTo({x:this.isHorizontal?a:0,y:this.isHorizontal?0:a,friction:0}),this.onChange(n),!0}manageSlideVisiblity(){const t=new Set,e=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const s of this.slides)i.has(s)?t.add(s):e.add(s);for(const e of this.inTransition)t.add(this.slides[e]);for(const e of t)this.createSlideEl(e),this.lazyLoadSlide(e);for(const i of e)t.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t="aria-hidden";let e=this.cn("isSelected");if(e)for(const i of this.slides)i.el&&(i.el.dataset.index=`${i.index}`,this.pages[this.page].slides.includes(i)?(i.el.classList.contains(e)||(h(i.el,e),this.emit("selectSlide",i)),i.el.removeAttribute(t)):(i.el.classList.contains(e)&&(l(i.el,e),this.emit("unselectSlide",i)),i.el.setAttribute(t,"true")))}flipInfiniteTrack(){const t=this.panzoom;if(!t||!this.isInfinite)return;const e="x"===this.option("axis")?"e":"f",{viewportDim:i,contentDim:s}=this;let n=t.current[e],o=t.target[e]-n,a=0,r=.5*i,h=s;this.isRTL&&this.isHorizontal?(n<-r&&(a=-1,n+=h),n>h-r&&(a=1,n-=h)):(n>r&&(a=1,n-=h),n<-h+r&&(a=-1,n+=h)),a&&(t.current[e]=n,t.target[e]=n+o)}lazyLoadSlide(t){const e=this,i=t&&t.el;if(!i)return;const s=new Set;i.querySelectorAll("[data-lazy-srcset]").forEach((t=>{t instanceof HTMLImageElement&&s.add(t)})),i.querySelectorAll("[data-lazy-src]").forEach((t=>{t instanceof HTMLImageElement?s.add(t):T(t)&&(t.style.backgroundImage=`url('${t.dataset.lazySrc||""}')`)}));const n=(t,i,s)=>{s&&(s.remove(),s=null),i.complete&&(i.style.display=""),this.option("adaptiveHeight")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&e.setViewportHeight()};for(const e of s){let i=null;e.src=e.dataset.lazySrcset||e.dataset.lazySrc||"",delete e.dataset.lazySrc,delete e.dataset.lazySrcset,e.style.display="none",e.addEventListener("error",(()=>{n(t,e,i)})),e.addEventListener("load",(()=>{n(t,e,i)})),setTimeout((()=>{!e.complete&&e.parentNode&&t.el&&(i=o(d),e.parentNode.insertBefore(i,e))}),300)}let a=i.dataset.lazySrc;a&&a.length&&(i.style.backgroundImage=`url('${a}')`)}clearTransitions(){this.inTransition.clear(),l(this.container,this.cn("inTransition"));const t=["to-prev","to-next","from-prev","from-next"];for(const e of this.slides){const i=e.el;if(i){i.removeEventListener("animationend",this.onAnimationEnd),i.classList.remove(...t);const s=e.transition;s&&i.classList.remove(`f-${s}Out`,`f-${s}In`)}}this.manageSlideVisiblity()}onAnimationEnd(t){const e=t.target,i=e?parseInt(e.dataset.index||"",10)||0:-1,s=this.slides[i],n=t.animationName;if(!e||!s||!n)return;const o=!!this.inTransition.has(i)&&s.transition;o&&n.substring(0,o.length+2)===`f-${o}`&&this.inTransition.delete(i),this.inTransition.size||this.clearTransitions(),i===this.page&&this.emit("settle")}onDecel(t,e=0,i=0){const s=this.isInfinite,n=this.isHorizontal?e:i,o=this.pages.length;if(!o)return;const a=this.option("dragFree");let r=this.page,h=0;const l=this.axis;!s&&(t.target[l],this.viewportDim);const c=t.current[l]*(this.isRTL&&this.isHorizontal?1:-1);let{pageIndex:d}=this.getPageFromPosition(c);if(a||Math.abs(n)<10){const e=t.target[l]*(this.isRTL&&this.isHorizontal?1:-1),{pageIndex:i}=this.getPageFromPosition(e);r=i}else r=this.isRTL&&this.isHorizontal?n<0?d-1:d+1:n<0?d+1:d-1,s||(r=Math.max(0,Math.min(r,this.pages.length-1)));if(s&&(h=Math.floor(r/o)||0),r=(r%o+o)%o,a&&t.dragOffset["e"===l?"x":"y"]);else{const e=this.contentDim;let i=(this.pages[r].pos+h*e)*(this.isRTL&&this.isHorizontal?1:-1);if(Math.abs(t.target[l]-i)<.1&&t.lockedAxis===("e"==l?"y":"x"))return;if(t.target[l]===i)return;t.applyChange({panX:this.isHorizontal?i-t.target.e:0,panY:this.isHorizontal?0:i-t.target.f,friction:t.option("decelFriction")})}r!==this.page&&this.onChange(r)}onClick(t){const e=t.target,i=e&&T(e)?e.dataset:null;let s;i&&(void 0!==i.carouselPage?s="slideTo":void 0!==i.carouselNext?s="slideNext":void 0!==i.carouselPrev&&(s="slidePrev")),s?(t.preventDefault(),t.stopPropagation(),e&&!e.hasAttribute("disabled")&&this[s](i&&"slideTo"===s?i.carouselPage:void 0)):this.emit("click",t)}onSlideTo(t){const e=t.detail||0;this.slideTo(this.getPageForSlide(e),{friction:0})}onChange(t,e=0){const i=this.page;this.prevPage=i,this.page=t,this.option("adaptiveHeight")&&this.setViewportHeight(),this.emit("change",t,i,e)}onRefresh(t,e=""){let i=this.contentDim,s=this.viewportDim;this.updateMetrics(),this.contentDim===i&&this.viewportDim===s||this.slideTo(this.page,{friction:0,transition:!1})}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(){this.flipInfiniteTrack(),this.manageSlideVisiblity()}onEndAnimation(){this.emit("settle")}reInit(t=null,e=null){this.destroy(),this.state=L.Init,this.userOptions=t||this.userOptions,this.userPlugins=e||this.userPlugins,this.processOptions()}slideTo(t=0,{friction:e=this.option("friction"),transition:i=this.option("transition")}={}){const s=this.panzoom,n=this.pages.length;if(!s||!n)return;if(this.transitionTo(t,i))return;const o=this.axis,a=this.getPageFromIndex(t);let r=this.pages[a].pos,h=0;if(this.isInfinite){const t=s.current[o]*(this.isRTL&&this.isHorizontal?1:-1),e=this.contentDim,i=r+e,n=r-e;Math.abs(t-i){t.el&&(n=Math.max(n,t.el.offsetHeight))}))),i.style.height=n?`${n}px`:""}getPageForSlide(t){for(const e of this.pages)for(const i of e.slides)if(i.index===t)return e.index;return-1}getVisibleSlides(t=0){var e;const i=new Set;let{contentDim:s,viewportDim:n,pages:o,page:r}=this;s=s+(null===(e=this.slides[this.slides.length-1])||void 0===e?void 0:e.gap)||0;let h=0;h=this.panzoom?-1*this.panzoom.current[this.axis]:o[r]&&o[r].pos||0,this.isInfinite&&(h-=Math.floor(h/s)*s),this.isRTL&&this.isHorizontal&&(h*=-1),h=a(h,1e3);const l=a(h-n*t,1e3),c=a(h+n*(t+1),1e3),d=this.isInfinite?[-1,0,1]:[0];for(const t of this.slides)for(const e of d){const n=t.pos+e*s,o=t.pos+t.dim+t.gap+e*s;nl&&i.add(t)}return i}getPageFromPosition(t){const{viewportDim:e,contentDim:i}=this,s=this.pages.length;let n=0,o=0;const a=this.option("center");a&&(t+=.5*e),this.isInfinite||(t=Math.max(this.slides[0].pos,Math.min(t,this.slides[this.slides.length-1].pos)));const r=i+this.slides[this.slides.length-1].gap,h=Math.floor(t/r)||0;t-=h*r;let l=this.slides[this.slides.length-1],c=this.slides.find((e=>{const i=t+(l&&!a?.5*l.dim:0);return l=e,e.pos<=i&&e.pos+e.dim+e.gap>i}));return c||(c=this.slides[this.slides.length-1]),o=this.getPageForSlide(c.index),n=o+h*s,{page:n,pageIndex:o}}destroy(){if([L.Destroy].includes(this.state))return;this.state=L.Destroy;const{container:t,viewport:e,track:i,slides:s,panzoom:n}=this,o=this.option("classes");t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),t.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),n&&(n.destroy(),this.panzoom=null),s&&s.forEach((t=>{this.removeSlideEl(t)})),this.detachPlugins(),this.track=null,this.viewport=null,this.page=0,e&&i&&e.replaceWith(...i.childNodes);for(const[e,i]of Object.entries(o))"container"!==e&&i&&t.classList.remove(i);this.slides=[];const a=this.events.get("ready");this.events=new Map,a&&this.events.set("ready",a)}}Object.defineProperty(X,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:R}),Object.defineProperty(X,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:D}),Object.defineProperty(X,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:W}),t.Carousel=X})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";const e=t=>"object"==typeof t&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t),i=(t,...s)=>{const n=s.length;for(let o=0;o{const o=Array.isArray(n)?[]:{};t[s]||Object.assign(t,{[s]:o}),e(n)?Object.assign(t[s],i(o,n)):Array.isArray(n)?Object.assign(t,{[s]:[...n]}):Object.assign(t,{[s]:n})}))}return t},s=function(t,e){let i=!0;return(...s)=>{i&&(i=!1,t(...s),setTimeout((()=>{i=!0}),e))}},n=(t,e)=>{let i=[];return t.childNodes.forEach((t=>{t.nodeType!==Node.ELEMENT_NODE||e&&!t.matches(e)||i.push(t)})),i},o=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},a=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),r=t=>`${t||""}`.split(" ").filter((t=>!!t)),h=(t,e)=>{r(e).forEach((e=>{t&&t.classList.add(e)}))},l=(t,e)=>{r(e).forEach((e=>{t&&t.classList.remove(e)}))},c=(t,e,i)=>{r(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))},d='
',u=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class g{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?i({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=u(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...s){let n=u(e,t);var o;"string"!=typeof(o=n)||isNaN(o)||isNaN(parseFloat(o))||(n=parseFloat(n)),"true"===n&&(n=!0),"false"===n&&(n=!1),n&&"function"==typeof n&&(n=n.call(this,this,t,...s));let a=u(e,this.options);return a&&"function"==typeof a?n=a.call(this,this,t,...s,n):void 0===n&&(n=a),void 0===n?i:n}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let s="";return i?s=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(s=this.option(`l10n.${e}`)),s||(s=t),s}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(g,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(g,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class f extends g{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,s]of Object.entries(t)){const t=this.option(i),n=this.plugins[i];n||!1===t?n&&!1===t&&(n.detach(),delete this.plugins[i]):e.set(i,new s(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}const p=function(t,e){return!(!t||t===document.body||e&&t===e)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,s=-1!==i.indexOf("hidden"),n=-1!==i.indexOf("visible");return e&&!s&&!n}(t)?t:p(t.parentElement,e))};class m{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const b={passive:!1};class v{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:s=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=s;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,b),this.element.addEventListener("touchmove",this.onMove,b),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,b)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new m(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new m(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new m(t))):[new m(t)],s=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(s.push(t),this.currentPointers[e]=t)}s.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new m(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new m(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,b),this.element.removeEventListener("touchstart",this.onTouchStart,b),this.element.removeEventListener("touchmove",this.onMove,b),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function y(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function x(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}var w;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(w||(w={}));const P=["a","b","c","d","e","f"],S={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:{PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"}},T=t=>t&&null!==t&&t instanceof Element&&"nodeType"in t,M={a:1,b:0,c:0,d:1,e:0,f:0},O=1e5,E=1e3;let z=null,k=null;class R extends f{get isTouchDevice(){return null===k&&(k=window.matchMedia("(hover: none)").matches),k}get isMobile(){return null===z&&(z=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),z}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const t=this.content;return!!(t&&t instanceof HTMLImageElement)&&!t.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of P){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var s;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:w.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},M)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},M)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},R.Plugins),i)),this.emit("init"),this.isContentLoading){const e=this.content;if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const i=o(d);t.contains(e)?this.spinner=(null===(s=e.parentElement)||void 0===s?void 0:s.insertBefore(i,e))||null:this.spinner=t.appendChild(i)}this.emit("beforeLoad"),e.addEventListener("load",this.onLoad),e.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===w.Init&&this.enable()}onError(){this.state!==w.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=w.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new v(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of P)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of P)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,s=i.e+t,n=i.f+e,o=this.getBounds(),{x:a,y:r}=o,h=a.min,l=a.max,c=r.min,d=r.max;let u=0,g=0;return h!==1/0&&sl&&(u=l-s),c!==1/0&&nd&&(g=d-n),Math.abs(u)<.001&&(u=0),Math.abs(g)<.001&&(g=0),Object.assign(Object.assign({},o),{xDiff:u,yDiff:g,inBounds:!u&&!g})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:s,fitHeight:n,fullWidth:o,fullHeight:a}=i;let r=o,h=a;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),l=i?o:s,c=i?a:n,d=this.getMatrix(t),u=new DOMPoint(0,0).matrixTransform(d),g=new DOMPoint(0+l,0).matrixTransform(d),f=new DOMPoint(0+l,0+c).matrixTransform(d),p=new DOMPoint(0,0+c).matrixTransform(d),m=Math.abs(f.x-u.x),b=Math.abs(f.y-u.y),v=Math.abs(p.x-g.x),y=Math.abs(p.y-g.y);r=Math.max(m,v),h=Math.max(b,y)}return{contentWidth:r,contentHeight:h}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const s=i.closest("[data-panzoom-action]"),n=i.closest("[data-panzoom-change]"),o=s||n,a=o&&T(o)?o.dataset:null;if(a){const e=a.panzoomChange,i=a.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const r=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(r.x-this.dragStart.x)>2||Math.abs(r.y-this.dragStart.y)>2))return;this.dragStart.time=0;const h=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},l=this.option("click",t),c=this.option("dblClick",t);c?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&l&&h(l)):(this.emit("dblClick",t),t.defaultPrevented||h(c)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&l&&h(l))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(t,e,i){var s;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const n=this.content.getBoundingClientRect();if(this.dragStart={x:n.x,y:n.y,top:n.top,left:n.left,time:Date.now()},!1===this.option("touch",t))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;if(!i.length){const e=t.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(e.nodeName)||e.closest("[contenteditable]")||e.closest("[data-selectable]")||e.closest("[data-panzoom-change]")||e.closest("[data-panzoom-action]"))return!1;null===(s=window.getSelection())||void 0===s||s.removeAllRanges()}return"mousedown"===t.type&&t.preventDefault(),a(this.targetScale,1e3)===a(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(e),this.emit("touchStart",t),!0}onPointerMove(t,e,i){if(!this.isDragging)return;if(e.length<2&&this.panOnlyZoomed&&a(this.targetScale)<=a(this.minScale))return;if(this.emit("touchMove",t),t.defaultPrevented)return;this.addTrackingPoint(e[0]);const{content:s}=this,n=x(i[0],i[1]),o=x(e[0],e[1]);let r=0,h=0;if(e.length>1){const t=s.getBoundingClientRect();r=n.clientX-t.left-.5*t.width,h=n.clientY-t.top-.5*t.height}const l=y(i[0],i[1]),c=y(e[0],e[1]);let d=l?c/l:1,u=o.clientX-n.clientX,g=o.clientY-n.clientY;this.dragOffset.x+=u,this.dragOffset.y+=g,this.dragOffset.time=Date.now()-this.dragStart.time;let f=a(this.targetScale)===a(this.minScale)&&this.option("lockAxis");if(f&&!this.lockedAxis)if("xy"===f||"y"===f||"touchmove"===t.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void t.preventDefault();const e=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=e>45&&e<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,u=0,g=0}else this.lockedAxis=f;if(p(t.target,this.content)&&(f="x",this.dragOffset.y=0),f&&"xy"!==f&&this.lockedAxis!==f&&a(this.targetScale)===a(this.minScale))return;t.cancelable&&t.preventDefault(),this.container.classList.add(this.cn("isDragging"));const m=this.checkBounds(u,g);this.option("rubberband")?("x"!==this.isInfinite&&(m.xDiff>0&&u<0||m.xDiff<0&&u>0)&&(u*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*m.xDiff))),"y"!==this.isInfinite&&(m.yDiff>0&&g<0||m.yDiff<0&&g>0)&&(g*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*m.yDiff)))):(m.xDiff&&(u=0),m.yDiff&&(g=0));const b=this.targetScale,v=this.minScale,w=this.maxScale;b<.5*v&&(d=Math.max(d,v)),b>1.5*w&&(d=Math.min(d,w)),"y"===this.lockedAxis&&a(b)===a(v)&&(u=0),"x"===this.lockedAxis&&a(b)===a(v)&&(g=0),this.applyChange({originX:r,originY:h,panX:u,panY:g,scale:d,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,e,i){if(i.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(e),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),p(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==w.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of P)this.velocity[t]=0,this.target[t]=this.current[t];l(this.container,"is-scaling"),l(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:t}=this,e=t[0],i=t[t.length-1];let s=0,n=0,o=0;i&&e&&(s=i.clientX-e.clientX,n=i.clientY-e.clientY,o=i.time-e.time);let r=0,h=0,c=0,d=0,u=this.option("decelFriction");const g=this.targetScale;if((gthis.maxScale+1e-5)&&(u=.35),o>0){c=Math.abs(s)>3?s/(o/30):0,d=Math.abs(n)>3?n/(o/30):0;const t=this.option("maxVelocity");t&&(c=Math.max(Math.min(c,t),-1*t),d=Math.max(Math.min(d,t),-1*t))}c&&(r=c/(1/(1-u)-1)),d&&(h=d/(1/(1-u)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&a(g)===this.minScale)&&(r=c=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&a(g)===this.minScale)&&(h=d=0);const f=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(s)),"auto"===f&&(f=parseFloat(s.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(s));const p=(this.option("transformParent")?s.parentElement:null)||s,m=p.getAttribute("style")||"";p.style.setProperty("transform","none","important"),p.style.setProperty("transition","none","important"),p.style.setProperty("animation","none","important"),s instanceof HTMLImageElement&&(p.style.width="",p.style.height=""),p.offsetHeight;const b=s.getBoundingClientRect();let v=b.width,y=b.height,x=0,P=0;if(s instanceof HTMLImageElement&&({width:v,height:y,top:x,left:P}=((t,e,i,s)=>{const n=i/s;return n>t/e?(i=t,s=t/n):(i=e*n,s=e),{width:i,height:s,top:.5*(e-s),left:.5*(t-i)}})(b.width,b.height,g,f)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:b.top-r.top+x,bottom:r.bottom-b.bottom+x,left:b.left-r.left+P,right:r.right-b.right+P,fitWidth:v,fitHeight:y,width:v,height:y,fullWidth:g,fullHeight:f}),p.style.cssText=m,s instanceof HTMLImageElement&&(p.style.width=`${v}px`,p.style.height=`${y}px`),this.setTransform(),!0!==t){let t="";Math.abs(l-n)>1&&(t+="x"),Math.abs(c-o)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(a(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===w.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const t=this.option("bounds");if("auto"!==t)return t;const{contentWidth:e,contentHeight:i}=this.calculateContentDim(this.target);let s=0,n=0,o=0,r=0;const h=this.option("infinite");if(!0===h||this.lockedAxis&&h===this.lockedAxis)s=-1/0,o=1/0,n=-1/0,r=1/0;else{let{containerRect:t,contentRect:h}=this,l=a(this.contentRect.fitWidth*this.targetScale,E),c=a(this.contentRect.fitHeight*this.targetScale,E),{innerWidth:d,innerHeight:u}=t;if(this.containerRect.width===l&&(d=t.width),this.containerRect.width===c&&(u=t.height),e>d){o=.5*(e-d),s=-1*o;let t=.5*(h.right-h.left);s+=t,o+=t}if(this.contentRect.fitWidth>d&&eu){r=.5*(i-u),n=-1*r;let t=.5*(h.bottom-h.top);n+=t,r+=t}this.contentRect.fitHeight>u&&i-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(r=!0),this.contentRect.width*this.targetScalea(this.targetScale),l=!h&&!r&&n&&a(i).9*t.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:s=this.option("friction"),angle:n=0,originX:o=0,originY:a=0,flipX:r=!1,flipY:h=!1,ignoreBounds:l=!1}){this.state!==w.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:n,originX:o,originY:a,friction:s,flipX:r,flipY:h,ignoreBounds:l})}applyChange({panX:t=0,panY:e=0,scale:i=1,angle:s=0,originX:n=-this.current.e,originY:o=-this.current.f,friction:r=this.option("friction"),flipX:h=!1,flipY:l=!1,ignoreBounds:c=!1,bounce:d=this.option("bounce")}){const u=this.state;if(u===w.Init||u===w.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of P)this.velocity[t]=0;this.friction=r||0,this.ignoreBounds=c;const{current:g}=this,f=g.e,p=g.f,m=this.getMatrix(this.target);let b=(new DOMMatrix).translate(f,p).translate(n,o).translate(t,e);if(this.option("zoom")){if(!c){const t=this.targetScale,e=this.minScale,s=this.maxScale;t*is&&(i=s/t)}b=b.scale(i)}b=b.translate(-n,-o).translate(-f,-p).multiply(m),s&&(b=b.rotate(s)),h&&(b=b.scale(-1,1)),l&&(b=b.scale(1,-1));for(const t of P)"a"!=t&&"d"!=t||!(b[t]>this.minScale+1e-5||b[t].1||"mousemove"===this.panMode||!1===d)&&!c&&this.clampTargetBounds(),this.isResting||(this.state=w.Panning,this.requestTick())}stop(t=!1){if(this.state!==w.Init&&this.state!==w.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of P)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),l(this.container,"is-scaling"),l(this.container,"is-animating"),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=w.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),h(this.container,"is-animating"),this.isScaling&&h(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(t,e=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=t,"mousemove"!==this.panMode||!t)return;if(a(this.targetScale)<=a(this.minScale))return;this.emit("mouseMove",t);const{container:i,containerRect:s,contentRect:n}=this,o=s.width,r=s.height,h=i.getBoundingClientRect(),l=(t.clientX||0)-h.left,c=(t.clientY||0)-h.top;let{contentWidth:d,contentHeight:u}=this.calculateContentDim(this.target);const g=this.option("mouseMoveFactor");g>1&&(d!==o&&(d*=g),u!==r&&(u*=g));let f=.5*(d-o)-l/o*100/100*(d-o);f+=.5*(n.right-n.left);let p=.5*(u-r)-c/r*100/100*(u-r);p+=.5*(n.bottom-n.top),this.applyChange({panX:f-this.target.e,panY:p-this.target.f,friction:e})}zoomWithWheel(t){if(this.state===w.Destroy||this.state===w.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),s=this.targetScale,n=this.maxScale,o=this.minScale;let a=s*(100+i*e)/100;an&&s>=n?(this.wheelDelta+=Math.abs(i),a=n):(this.wheelDelta=0,a=Math.max(Math.min(a,n),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),a!==s&&this.zoomTo(a,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.maxScale-this.minScale)?"max":"fit",t)}toggleCover(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.coverScale-this.minScale)?"cover":"fit",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:s=0,event:n}={}){if(this.isContentLoading||this.state===w.Destroy)return;this.stop();const{targetScale:o}=this;let a=1;if("mousemove"===this.panMode&&(n=this.prevMouseMoveEvent||n),n){const t=this.content.getBoundingClientRect(),e=n.clientX||0,o=n.clientY||0;i=e-t.left-.5*t.width,s=o-t.top-.5*t.height}const r=this.fullScale,h=this.maxScale;let l=this.coverScale;"number"==typeof t?a=t/o:("next"===t&&(r-l<.2&&(l=r),t=o1?.15:.25:e,this.applyChange({scale:a,originX:i,originY:s,friction:e}),n&&"mousemove"===this.panMode&&this.panWithMouse(n,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const s=t.classList.contains(e);s?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(s?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:s,d:n,e:o,f:a}=t;return new DOMMatrix([e,i,s,n,o,a])}reset(t){if(this.state!==w.Init&&this.state!==w.Destroy){this.stop("current");for(const t of P)this.target[t]=M[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=w.Panning,this.requestTick())}}destroy(){this.stop(),this.state=w.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(R,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:S}),Object.defineProperty(R,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const D={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var L;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"}(L||(L={}));const A=t=>{if("string"==typeof t&&(t={html:t}),!(t instanceof String||t instanceof HTMLElement)){const e=t.thumb;void 0!==e&&("string"==typeof e&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},C=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class j extends g{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const F={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'',dynamicFrom:11,maxCount:1/0,minCount:2};class I extends j{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let t=this.list;return t||(t=document.createElement("ul"),h(t,this.cn("list")),t.setAttribute("role","tablist"),this.instance.container.appendChild(t),h(this.instance.container,this.cn("hasDots")),this.list=t),t}refresh(){var t;const e=this.instance.pages.length,i=Math.min(2,this.option("minCount")),s=Math.max(2e3,this.option("maxCount")),n=this.option("dynamicFrom");if(es)return void this.cleanup();const o="number"==typeof n&&e>5&&e>=n,a=!this.list||this.isDynamic!==o||this.list.children.length!==e;a&&this.cleanup();const r=this.build();if(c(r,this.cn("isDynamic"),!!o),a)for(let t=0;t=e-1&&n.setAttribute("disabled","")))}createButton(t){const e=this.instance,i=document.createElement("button");i.setAttribute("tabindex","0"),i.setAttribute("title",e.localize(`{{${t.toUpperCase()}}}`)),h(i,this.cn("button")+" "+this.cn("next"===t?"isNext":"isPrev"));const s=e.isRTL?"next"===t?"prev":"next":t;var n;return i.innerHTML=e.localize(this.option(`${s}Tpl`)),i.dataset[`carousel${n=t,n?n.match("^[a-z]")?n.charAt(0).toUpperCase()+n.substring(1):n:""}`]="true",i}build(){let t=this.container;t||(this.container=t=document.createElement("div"),h(t,this.cn("container")),this.instance.container.appendChild(t)),this.next||(this.next=t.appendChild(this.createButton("next"))),this.prev||(this.prev=t.appendChild(this.createButton("prev")))}cleanup(){this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove(),this.prev=null,this.next=null,this.container=null}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(H,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'',prevTpl:''}});class B extends j{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){this.nav&&this.target&&(this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.state===L.Ready&&this.onNavReady(this.nav),this.target.on("ready",this.onTargetReady),this.target.state===L.Ready&&this.onTargetReady(this.target))}onNavReady(t){t.on("createSlide",this.onNavCreateSlide),t.on("Panzoom.click",this.onNavClick),this.onTargetChange()}onTargetReady(t){t.on("change",this.onTargetChange),t.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(t,e,i){var s,n;const o=i.target,{nav:a,target:r}=this;if(!a||!r||!o)return;const h=o.closest("[data-index]");if(!h)return;i.stopPropagation(),i.preventDefault();const l=parseInt(h.dataset.index||"",10)||0,c=r.getPageForSlide(l),d=a.getPageForSlide(l);r.page!==c&&r.slideTo(c,{friction:null===(n=null===(s=this.nav)||void 0===s?void 0:s.plugins)||void 0===n?void 0:n.Sync.option("friction")}),this.markSelectedSlide(l),a.page!==d&&a.slideTo(d)}onNavCreateSlide(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}onTargetChange(){const{target:t,nav:e}=this;if(!t||!e)return;if(e.state!==L.Ready||t.state!==L.Ready)return;const i=t.pages[t.page].slides[0].index,s=e.getPageForSlide(i);this.markSelectedSlide(i),e.slideTo(s)}markSelectedSlide(t){const{nav:e}=this;if(!e||e.state!==L.Ready)return;this.selectedIndex=t,[...e.slides].filter((t=>t.el&&t.el.classList.remove("is-nav-selected")));const i=e.slides[t];i&&i.el&&i.el.classList.add("is-nav-selected")}attach(){let t=this.options.target,e=this.options.nav;t?this.addAsNavFor(t):e&&this.addAsTargetFor(e)}detach(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.nav=null,this.target&&(this.target.off("ready",this.onTargetReady),this.target.off("refresh",this.onTargetChange),this.target.off("change",this.onTargetChange)),this.target=null}}Object.defineProperty(B,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const W={Navigation:H,Dots:I,Sync:B};class X extends f{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===L.Ready}get isInfinite(){let t=!1;const e=this.contentDim,i=this.viewportDim;return this.pages.length>=2&&e>1.5*i&&(t=this.option("infinite")),t}get isRTL(){return"rtl"===this.option("direction")}get isHorizontal(){return"x"===this.option("axis")}constructor(t,e={},i={}){if(super(),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:L.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),"string"==typeof t&&(t=document.querySelector(t)),!t||!T(t))throw new Error("No Element found");this.container=t,this.slideNext=s(this.slideNext.bind(this),175),this.slidePrev=s(this.slidePrev.bind(this),175),this.userOptions=e,this.userPlugins=i,queueMicrotask((()=>{this.processOptions()}))}processOptions(){const t=i({},X.defaults,this.userOptions);let s="";const n=t.breakpoints;if(n&&e(n))for(const[o,a]of Object.entries(n))window.matchMedia(o).matches&&e(a)&&(s+=o,i(t,a));s===this.bp&&this.state!==L.Init||(this.bp=s,this.state===L.Ready&&(t.initialSlide=this.pages[this.page].slides[0].index),this.state!==L.Init&&this.destroy(),super.setOptions(t),!1===this.option("enabled")?this.attachEvents():setTimeout((()=>{this.init()}),0))}init(){this.state=L.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},X.Plugins),this.userPlugins)),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=L.Ready,this.emit("ready")}initLayout(){const{container:t}=this,e=this.option("classes");h(t,this.cn("container")),c(t,e.isLTR,!this.isRTL),c(t,e.isRTL,this.isRTL),c(t,e.isVertical,!this.isHorizontal),c(t,e.isHorizontal,this.isHorizontal);let i=this.option("viewport")||t.querySelector(`.${e.viewport}`);i||(i=document.createElement("div"),h(i,e.viewport),i.append(...n(t,`.${e.slide}`)),t.prepend(i));let s=this.option("track")||t.querySelector(`.${e.track}`);s||(s=document.createElement("div"),h(s,e.track),s.append(...Array.from(i.childNodes))),s.setAttribute("aria-live","polite"),i.contains(s)||i.prepend(s),this.viewport=i,this.track=s,this.emit("initLayout")}initSlides(){const{track:t}=this;if(t){this.slides=[],[...n(t,`.${this.cn("slide")}`)].forEach((t=>{if(T(t)){const e=A({el:t,isDom:!0,index:this.slides.length});this.slides.push(e),this.emit("initSlide",e,this.slides.length)}}));for(let t of this.option("slides",[])){const e=A(t);e.index=this.slides.length,this.slides.push(e),this.emit("initSlide",t,this.slides.length)}this.emit("initSlides")}}setInitialPage(){let t=0;const e=this.option("initialSlide");t="number"==typeof e?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0,this.page=t}setInitialPosition(){if(!this.track||!this.pages.length)return;let t=this.page;this.pages[t]||(this.page=t=0);const e=this.pages[t].pos*(this.isRTL&&this.isHorizontal?1:-1),i=this.isHorizontal?`${e}px`:"0",s=this.isHorizontal?"0":`${e}px`;this.track.style.transform=`translate3d(${i}, ${s}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const t=this.option("Panzoom")||{};this.panzoom=new R(this.viewport,i({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,decelFriction:.12,click:!1,dblClick:!1,touch:t=>!(this.pages.length<2&&!t.options.infinite),bounds:()=>this.getBounds(),maxVelocity:t=>Math.abs(t.target[this.axis]-t.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on("*",((t,e,...i)=>{this.emit(`Panzoom.${e}`,t,...i)})),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation),this.panzoom.on("touchStart",((t,e)=>{this.inTransition.size&&e.preventDefault()}))}attachEvents(){const t=this.container;t&&(t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let t=[];const{contentDim:e,viewportDim:i}=this,s=this.option("slidesPerPage");if("number"==typeof s&&e>i){for(let e=0;ei)&&(t.push(C()),n=t.length-1,o=0),o+=e.dim+e.gap,t[n].slides.push(e);return t}processPages(){const t=this.pages,{contentDim:e,viewportDim:i}=this,s=this.option("center"),n=this.option("fill");if(t.forEach(((t,e)=>{t.index=e,t.pos=t.slides[0].pos,t.dim=0;for(const[e,i]of t.slides.entries())t.dim+=i.dim,e{n&&!this.isInfinite&&e>i&&(t.pos=Math.max(t.pos,0),t.pos=Math.min(t.pos,e-i)),t.pos=a(t.pos,1e3),t.dim=a(t.dim,1e3)})),this.isInfinite)return t;const o=[];let r;return t.forEach((t=>{const e=Object.assign({},t);r&&e.pos===r.pos?(r.dim+=e.dim,r.slides=[...r.slides,...e.slides]):(e.index=o.length,r=e,o.push(e))})),o}getPageFromIndex(t=0){const e=this.pages.length;let i;return t=parseInt((t||0).toString())||0,i=this.isInfinite?(t%e+e)%e:Math.max(Math.min(t,this.pages.length-1),0),i}getSlideMetrics(t){const e=this.isHorizontal?"width":"height";let i=0,s=0,n=t.el;n?i=parseFloat(n.dataset[e]||"")||0:(n=document.createElement("div"),n.style.visibility="hidden",h(n,this.cn("slide")+" "+t.class),(this.track||document.body).prepend(n)),i?(n.style[e]=`${i}px`,n.style["width"===e?"height":"width"]=""):i=n.getBoundingClientRect()[e];const o=getComputedStyle(n);return"content-box"===o.boxSizing&&(this.isHorizontal?(i+=parseFloat(o.paddingLeft)||0,i+=parseFloat(o.paddingRight)||0):(i+=parseFloat(o.paddingTop)||0,i+=parseFloat(o.paddingBottom)||0)),s=parseFloat(o[this.isHorizontal?"marginRight":"marginBottom"])||0,this.isHorizontal,t.el||n.remove(),{dim:i,gap:s}}getBounds(){let t={min:0,max:0};if(this.isInfinite)t={min:-1/0,max:1/0};else if(this.pages.length){const e=this.pages[0].pos,i=this.pages[this.pages.length-1].pos;t=this.isRTL&&this.isHorizontal?{min:e,max:i}:{min:-1*i,max:-1*e}}return{x:this.isHorizontal?t:{min:0,max:0},y:this.isHorizontal?{min:0,max:0}:t}}repositionSlides(){const{viewportDim:t,contentDim:e,page:i,pages:s}=this;let n,o=0,r=0,h=0,l=0;this.panzoom?l=-1*this.panzoom.current[this.isHorizontal?"e":"f"]:s[i]&&(l=s[i].pos||0),n=this.isHorizontal?this.isRTL?"right":"left":"top",this.isRTL&&this.isHorizontal&&(l*=-1);for(const t of this.slides)t.el?("top"===n?(t.el.style.right="",t.el.style.left=""):t.el.style.top="",t.index!==o?t.el.style[n]=0===r?"":`${r}px`:t.el.style[n]="",h+=t.dim+t.gap,o++):r+=t.dim+t.gap;if(this.isInfinite&&h)for(const i of this.slides)i.el&&(a(i.pos)a(e-t)&&(i.el.style[n]=`${r+h}px`),a(i.pos+i.gap)>=a(e-t)&&a(i.pos)>a(l+t)&&a(l)1&&(c=this.pages[u[0]],d=this.pages[u[1]]),c&&d){let t=0;for(const e of this.slides)e.el?this.inTransition.has(e.index)&&c.slides.indexOf(e)<0&&(e.el.style[n]=`${t+(c.pos-d.pos)}px`):t+=e.dim+e.gap}}createSlideEl(t){if(!this.track||!t)return;if(t.el)return;const e=document.createElement("div");h(e,this.cn("slide")),h(e,t.class),t.html&&(e.innerHTML=t.html);const i=[];this.slides.forEach(((t,e)=>{t.el&&i.push(e)}));const s=t.index;let n=null;if(i.length){let t=i.reduce(((t,e)=>Math.abs(e-s)this.page?1:-1,a=this.pages[n].pos*(this.isRTL?1:-1);if(this.page===n&&a===s.target[this.axis])return!1;this.clearTransitions();const r=s.isResting;h(this.container,this.cn("inTransition"));const l=this.pages[this.page].slides[0],c=this.pages[n].slides[0];this.inTransition.add(c.index),this.createSlideEl(c);let d=l.el,u=c.el;r||"slide"===e||(e="fadeFast",d=null);const g=this.isRTL?"next":"prev",f=this.isRTL?"prev":"next";return d&&(this.inTransition.add(l.index),l.transition=e,d.addEventListener("animationend",this.onAnimationEnd),d.classList.add(`f-${e}Out`,`to-${o>0?f:g}`)),u&&(c.transition=e,u.addEventListener("animationend",this.onAnimationEnd),u.classList.add(`f-${e}In`,`from-${o>0?g:f}`)),s.panTo({x:this.isHorizontal?a:0,y:this.isHorizontal?0:a,friction:0}),this.onChange(n),!0}manageSlideVisiblity(){const t=new Set,e=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const s of this.slides)i.has(s)?t.add(s):e.add(s);for(const e of this.inTransition)t.add(this.slides[e]);for(const e of t)this.createSlideEl(e),this.lazyLoadSlide(e);for(const i of e)t.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t="aria-hidden";let e=this.cn("isSelected");if(e)for(const i of this.slides)i.el&&(i.el.dataset.index=`${i.index}`,this.pages[this.page].slides.includes(i)?(i.el.classList.contains(e)||(h(i.el,e),this.emit("selectSlide",i)),i.el.removeAttribute(t)):(i.el.classList.contains(e)&&(l(i.el,e),this.emit("unselectSlide",i)),i.el.setAttribute(t,"true")))}flipInfiniteTrack(){const t=this.panzoom;if(!t||!this.isInfinite)return;const e="x"===this.option("axis")?"e":"f",{viewportDim:i,contentDim:s}=this;let n=t.current[e],o=t.target[e]-n,a=0,r=.5*i,h=s;this.isRTL&&this.isHorizontal?(n<-r&&(a=-1,n+=h),n>h-r&&(a=1,n-=h)):(n>r&&(a=1,n-=h),n<-h+r&&(a=-1,n+=h)),a&&(t.current[e]=n,t.target[e]=n+o)}lazyLoadSlide(t){const e=this,i=t&&t.el;if(!i)return;const s=new Set;i.querySelectorAll("[data-lazy-srcset]").forEach((t=>{t instanceof HTMLImageElement&&s.add(t)})),i.querySelectorAll("[data-lazy-src]").forEach((t=>{t instanceof HTMLImageElement?s.add(t):T(t)&&(t.style.backgroundImage=`url('${t.dataset.lazySrc||""}')`)}));const n=(t,i,s)=>{s&&(s.remove(),s=null),i.complete&&(i.style.display=""),this.option("adaptiveHeight")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&e.setViewportHeight()};for(const e of s){let i=null;e.src=e.dataset.lazySrcset||e.dataset.lazySrc||"",delete e.dataset.lazySrc,delete e.dataset.lazySrcset,e.style.display="none",e.addEventListener("error",(()=>{n(t,e,i)})),e.addEventListener("load",(()=>{n(t,e,i)})),setTimeout((()=>{e.parentNode&&t.el&&(e.complete?n(t,e,i):(i=o(d),e.parentNode.insertBefore(i,e)))}),300)}let a=i.dataset.lazySrc;a&&a.length&&(i.style.backgroundImage=`url('${a}')`)}clearTransitions(){this.inTransition.clear(),l(this.container,this.cn("inTransition"));const t=["to-prev","to-next","from-prev","from-next"];for(const e of this.slides){const i=e.el;if(i){i.removeEventListener("animationend",this.onAnimationEnd),i.classList.remove(...t);const s=e.transition;s&&i.classList.remove(`f-${s}Out`,`f-${s}In`)}}this.manageSlideVisiblity()}onAnimationEnd(t){const e=t.target,i=e?parseInt(e.dataset.index||"",10)||0:-1,s=this.slides[i],n=t.animationName;if(!e||!s||!n)return;const o=!!this.inTransition.has(i)&&s.transition;o&&n.substring(0,o.length+2)===`f-${o}`&&this.inTransition.delete(i),this.inTransition.size||this.clearTransitions(),i===this.page&&this.emit("settle")}onDecel(t,e=0,i=0){const s=this.isInfinite,n=this.isHorizontal?e:i,o=this.pages.length;if(!o)return;const a=this.option("dragFree");let r=this.page,h=0;const l=this.axis;!s&&(t.target[l],this.viewportDim);const c=t.current[l]*(this.isRTL&&this.isHorizontal?1:-1);let{pageIndex:d}=this.getPageFromPosition(c);if(a||Math.abs(n)<10){const e=t.target[l]*(this.isRTL&&this.isHorizontal?1:-1),{pageIndex:i}=this.getPageFromPosition(e);r=i}else r=this.isRTL&&this.isHorizontal?n<0?d-1:d+1:n<0?d+1:d-1,s||(r=Math.max(0,Math.min(r,this.pages.length-1)));if(s&&(h=Math.floor(r/o)||0),r=(r%o+o)%o,a&&t.dragOffset["e"===l?"x":"y"]);else{const e=this.contentDim;let i=(this.pages[r].pos+h*e)*(this.isRTL&&this.isHorizontal?1:-1);if(Math.abs(t.target[l]-i)<.1&&t.lockedAxis===("e"==l?"y":"x"))return;if(t.target[l]===i)return;t.applyChange({panX:this.isHorizontal?i-t.target.e:0,panY:this.isHorizontal?0:i-t.target.f,friction:t.option("decelFriction")})}r!==this.page&&this.onChange(r)}onClick(t){const e=t.target,i=e&&T(e)?e.dataset:null;let s;i&&(void 0!==i.carouselPage?s="slideTo":void 0!==i.carouselNext?s="slideNext":void 0!==i.carouselPrev&&(s="slidePrev")),s?(t.preventDefault(),t.stopPropagation(),e&&!e.hasAttribute("disabled")&&this[s](i&&"slideTo"===s?i.carouselPage:void 0)):this.emit("click",t)}onSlideTo(t){const e=t.detail||0;this.slideTo(this.getPageForSlide(e),{friction:0})}onChange(t,e=0){const i=this.page;this.prevPage=i,this.page=t,this.option("adaptiveHeight")&&this.setViewportHeight(),this.emit("change",t,i,e)}onRefresh(t,e=""){let i=this.contentDim,s=this.viewportDim;this.updateMetrics(),this.contentDim===i&&this.viewportDim===s||this.slideTo(this.page,{friction:0,transition:!1})}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(){this.flipInfiniteTrack(),this.manageSlideVisiblity()}onEndAnimation(){this.emit("settle")}reInit(t=null,e=null){this.destroy(),this.state=L.Init,this.userOptions=t||this.userOptions,this.userPlugins=e||this.userPlugins,this.processOptions()}slideTo(t=0,{friction:e=this.option("friction"),transition:i=this.option("transition")}={}){if(this.state===L.Destroy)return;const s=this.panzoom,n=this.pages.length;if(!s||!n)return;if(this.transitionTo(t,i))return;const o=this.axis,a=this.getPageFromIndex(t);let r=this.pages[a].pos,h=0;if(this.isInfinite){const t=s.current[o]*(this.isRTL&&this.isHorizontal?1:-1),e=this.contentDim,i=r+e,n=r-e;Math.abs(t-i){t.el&&(n=Math.max(n,t.el.offsetHeight))}))),i.style.height=n?`${n}px`:""}getPageForSlide(t){for(const e of this.pages)for(const i of e.slides)if(i.index===t)return e.index;return-1}getVisibleSlides(t=0){var e;const i=new Set;let{contentDim:s,viewportDim:n,pages:o,page:r}=this;s=s+(null===(e=this.slides[this.slides.length-1])||void 0===e?void 0:e.gap)||0;let h=0;h=this.panzoom?-1*this.panzoom.current[this.axis]:o[r]&&o[r].pos||0,this.isInfinite&&(h-=Math.floor(h/s)*s),this.isRTL&&this.isHorizontal&&(h*=-1),h=a(h,1e3);const l=a(h-n*t,1e3),c=a(h+n*(t+1),1e3),d=this.isInfinite?[-1,0,1]:[0];for(const t of this.slides)for(const e of d){const n=t.pos+e*s,o=t.pos+t.dim+t.gap+e*s;nl&&i.add(t)}return i}getPageFromPosition(t){const{viewportDim:e,contentDim:i}=this,s=this.pages.length;let n=0,o=0;const a=this.option("center");a&&(t+=.5*e),this.isInfinite||(t=Math.max(this.slides[0].pos,Math.min(t,this.slides[this.slides.length-1].pos)));const r=i+this.slides[this.slides.length-1].gap,h=Math.floor(t/r)||0;t-=h*r;let l=this.slides[this.slides.length-1],c=this.slides.find((e=>{const i=t+(l&&!a?.5*l.dim:0);return l=e,e.pos<=i&&e.pos+e.dim+e.gap>i}));return c||(c=this.slides[this.slides.length-1]),o=this.getPageForSlide(c.index),n=o+h*s,{page:n,pageIndex:o}}destroy(){if([L.Destroy].includes(this.state))return;this.state=L.Destroy;const{container:t,viewport:e,track:i,slides:s,panzoom:n}=this,o=this.option("classes");t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),t.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),n&&(n.destroy(),this.panzoom=null),s&&s.forEach((t=>{this.removeSlideEl(t)})),this.detachPlugins(),this.track=null,this.viewport=null,this.page=0,e&&i&&e.replaceWith(...i.childNodes);for(const[e,i]of Object.entries(o))"container"!==e&&i&&t.classList.remove(i);this.slides=[];const a=this.events.get("ready");this.events=new Map,a&&this.events.set("ready",a)}}Object.defineProperty(X,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:R}),Object.defineProperty(X,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:D}),Object.defineProperty(X,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:W}),t.Carousel=X})); diff --git a/dist/fancybox/fancybox.css b/dist/fancybox/fancybox.css index 78ad2e9d..58f917c7 100644 --- a/dist/fancybox/fancybox.css +++ b/dist/fancybox/fancybox.css @@ -1 +1 @@ -:root{--f-spinner-width: 36px;--f-spinner-height: 36px;--f-spinner-color-1: rgba(0, 0, 0, 0.1);--f-spinner-color-2: rgba(17, 24, 28, 0.8);--f-spinner-stroke: 2.75}.f-spinner{margin:auto;padding:0;width:var(--f-spinner-width);height:var(--f-spinner-height)}.f-spinner svg{width:100%;height:100%;vertical-align:top;animation:f-spinner-rotate 2s linear infinite}.f-spinner svg *{stroke-width:var(--f-spinner-stroke);fill:none}.f-spinner svg *:first-child{stroke:var(--f-spinner-color-1)}.f-spinner svg *:last-child{stroke:var(--f-spinner-color-2);animation:f-spinner-dash 2s ease-in-out infinite}@keyframes f-spinner-rotate{100%{transform:rotate(360deg)}}@keyframes f-spinner-dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}.f-zoomInUp{animation:.2s ease-out .1s both f-zoomInUp}.f-zoomOutDown{animation:.2s ease-in both f-zoomOutDown}@keyframes f-zoomInUp{from{transform:scale(0.975) translate3d(0, 16px, 0);opacity:0}to{transform:scale(1) translate3d(0, 0, 0);opacity:1}}@keyframes f-zoomOutDown{to{transform:scale(0.975) translate3d(0, -16px, 0);opacity:0}}.f-throwOutUp{animation:.175s ease-out both f-throwOutUp}.f-throwOutDown{animation:.175s ease-out both f-throwOutDown}@keyframes f-throwOutUp{to{transform:translate3d(0, -150px, 0);opacity:0}}@keyframes f-throwOutDown{to{transform:translate3d(0, 150px, 0);opacity:0}}.f-fadeIn{animation:.2s ease both f-fadeIn;z-index:2}.f-fadeOut{animation:.2s ease both f-fadeOut;z-index:1}@keyframes f-fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes f-fadeOut{100%{opacity:0}}.f-fadeSlowIn{animation:.5s ease both f-fadeSlowIn;z-index:2}.f-fadeSlowOut{animation:.5s ease both f-fadeSlowOut;z-index:1}@keyframes f-fadeSlowIn{0%{opacity:0}100%{opacity:1}}@keyframes f-fadeSlowOut{100%{opacity:0}}.f-fadeFastIn{animation:.2s ease-out both f-fadeFastIn;z-index:2}.f-fadeFastOut{animation:.2s ease-out both f-fadeFastOut;z-index:2}@keyframes f-fadeFastIn{0%{opacity:.75}100%{opacity:1}}@keyframes f-fadeFastOut{100%{opacity:0}}.f-crossfadeIn{animation:.2s ease-out both f-crossfadeIn;z-index:2}.f-crossfadeOut{animation:.1s linear .1s both f-crossfadeOut;z-index:1}@keyframes f-crossfadeIn{0%{opacity:0}100%{opacity:1}}@keyframes f-crossfadeOut{100%{opacity:0}}.f-slideIn.from-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideInNext}.f-slideIn.from-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideInPrev}.f-slideOut.to-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideOutNext}.f-slideOut.to-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideOutPrev}@keyframes f-slideInPrev{0%{transform:translateX(100%)}100%{transform:translate3d(0, 0, 0)}}@keyframes f-slideInNext{0%{transform:translateX(-100%)}100%{transform:translate3d(0, 0, 0)}}@keyframes f-slideOutNext{100%{transform:translateX(-100%)}}@keyframes f-slideOutPrev{100%{transform:translateX(100%)}}.f-classicIn.from-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicInNext;z-index:2}.f-classicIn.from-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicInPrev;z-index:2}.f-classicOut.to-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicOutNext;z-index:1}.f-classicOut.to-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicOutPrev;z-index:1}@keyframes f-classicInNext{0%{transform:translateX(-75px);opacity:0}100%{transform:translate3d(0, 0, 0);opacity:1}}@keyframes f-classicInPrev{0%{transform:translateX(75px);opacity:0}100%{transform:translate3d(0, 0, 0);opacity:1}}@keyframes f-classicOutNext{100%{transform:translateX(-75px);opacity:0}}@keyframes f-classicOutPrev{100%{transform:translateX(75px);opacity:0}}:root{--f-button-width: 40px;--f-button-height: 40px;--f-button-border: 0;--f-button-border-radius: 0;--f-button-color: #374151;--f-button-bg: #f8f8f8;--f-button-hover-bg: #e0e0e0;--f-button-active-bg: #d0d0d0;--f-button-shadow: none;--f-button-transition: all 0.15s ease;--f-button-transform: none;--f-button-svg-width: 20px;--f-button-svg-height: 20px;--f-button-svg-stroke-width: 1.5;--f-button-svg-fill: none;--f-button-svg-filter: none;--f-button-svg-disabled-opacity: 0.65}.f-button{display:flex;justify-content:center;align-items:center;box-sizing:content-box;position:relative;margin:0;padding:0;width:var(--f-button-width);height:var(--f-button-height);border:var(--f-button-border);border-radius:var(--f-button-border-radius);color:var(--f-button-color);background:var(--f-button-bg);box-shadow:var(--f-button-shadow);pointer-events:all;cursor:pointer;transition:var(--f-button-transition)}@media(hover: hover){.f-button:hover{color:var(--f-button-hover-color);background-color:var(--f-button-hover-bg)}}.f-button:active:not([disabled]){background-color:var(--f-button-active-bg)}.f-button svg{width:var(--f-button-svg-width);height:var(--f-button-svg-height);fill:var(--f-button-svg-fill);stroke:currentColor;stroke-width:var(--f-button-svg-stroke-width);stroke-linecap:round;stroke-linejoin:round;transform:var(--f-button-transform);filter:var(--f-button-svg-filter);pointer-events:none}.f-button[disabled]{cursor:default}.f-button[disabled] svg{opacity:var(--f-button-svg-disabled-opacity)}.f-carousel__nav .f-button.is-prev,.f-carousel__nav .f-button.is-next,.fancybox__nav .f-button.is-prev,.fancybox__nav .f-button.is-next{position:absolute;z-index:1}.is-horizontal .f-carousel__nav .f-button.is-prev,.is-horizontal .f-carousel__nav .f-button.is-next,.is-horizontal .fancybox__nav .f-button.is-prev,.is-horizontal .fancybox__nav .f-button.is-next{top:50%;transform:translateY(-50%)}.is-horizontal .f-carousel__nav .f-button.is-prev,.is-horizontal .fancybox__nav .f-button.is-prev{left:var(--f-button-prev-pos)}.is-horizontal .f-carousel__nav .f-button.is-next,.is-horizontal .fancybox__nav .f-button.is-next{right:var(--f-button-next-pos)}.is-horizontal.is-rtl .f-carousel__nav .f-button.is-prev,.is-horizontal.is-rtl .fancybox__nav .f-button.is-prev{left:auto;right:var(--f-button-next-pos)}.is-horizontal.is-rtl .f-carousel__nav .f-button.is-next,.is-horizontal.is-rtl .fancybox__nav .f-button.is-next{right:auto;left:var(--f-button-prev-pos)}.is-vertical .f-carousel__nav .f-button.is-prev,.is-vertical .f-carousel__nav .f-button.is-next,.is-vertical .fancybox__nav .f-button.is-prev,.is-vertical .fancybox__nav .f-button.is-next{top:auto;left:50%;transform:translateX(-50%)}.is-vertical .f-carousel__nav .f-button.is-prev,.is-vertical .fancybox__nav .f-button.is-prev{top:var(--f-button-next-pos)}.is-vertical .f-carousel__nav .f-button.is-next,.is-vertical .fancybox__nav .f-button.is-next{bottom:var(--f-button-next-pos)}.is-vertical .f-carousel__nav .f-button.is-prev svg,.is-vertical .f-carousel__nav .f-button.is-next svg,.is-vertical .fancybox__nav .f-button.is-prev svg,.is-vertical .fancybox__nav .f-button.is-next svg{transform:rotate(90deg)}html.with-fancybox{scroll-behavior:auto;width:auto;overflow:visible}html.with-fancybox body{touch-action:none}html.with-fancybox body.compensate-for-scrollbar{width:auto;overflow:hidden !important;overscroll-behavior-y:none;margin-right:var(--fancybox-scrollbar-compensate, 0)}.fancybox__container{--fancybox-color: #dbdbdb;--fancybox-hover-color: #fff;--fancybox-bg: rgba(24, 24, 27, 0.98);--fancybox-slide-gap: 10px;--f-spinner-width: 50px;--f-spinner-height: 50px;--f-spinner-color-1: rgba(255, 255, 255, 0.1);--f-spinner-color-2: #bbb;--f-spinner-stroke: 3.65;position:fixed;top:0;left:0;bottom:0;right:0;direction:ltr;display:flex;flex-direction:column;box-sizing:border-box;margin:0;padding:0;color:#f8f8f8;-webkit-tap-highlight-color:rgba(0,0,0,0);overflow:visible;z-index:1050;outline:none;-webkit-text-size-adjust:100%;-moz-text-size-adjust:none;-ms-text-size-adjust:100%;text-size-adjust:100%}.fancybox__container *,.fancybox__container *::before,.fancybox__container *::after{box-sizing:inherit}.fancybox__backdrop{position:fixed;top:0;left:0;bottom:0;right:0;z-index:-1;background:var(--fancybox-bg);opacity:var(--fancybox-opacity, 1);will-change:opacity}.fancybox__carousel{position:relative;box-sizing:border-box;flex:1;min-height:0;z-index:10;overflow-y:visible;overflow-x:clip}.fancybox__viewport{width:100%;height:100%}.fancybox__track{display:flex;margin:0 auto;height:100%;transform:matrix(1, 0, 0, 1, 0, 0);will-change:transform}.fancybox__slide{flex:0 0 auto;position:relative;display:flex;flex-direction:column;align-items:center;margin:0 var(--fancybox-slide-gap) 0 0;padding:4px;width:100%;height:100%;overflow:auto}.fancybox__container:not(.is-compact) .fancybox__slide.has-close-btn{padding-top:40px}.fancybox__slide.has-iframe,.fancybox__slide.has-video,.fancybox__slide.has-html5video{overflow:hidden}.fancybox__slide.has-image{overflow:hidden}.fancybox__slide.has-image.is-selected{overflow:visible}.fancybox__slide::before,.fancybox__slide::after{content:"";flex:0 0 0;margin:auto}.fancybox__content{align-self:center;display:flex;flex-direction:column;position:relative;margin:0;padding:2rem;max-width:100%;color:var(--fancybox-content-color, #374151);background:var(--fancybox-content-bg, #fff);cursor:default;border-radius:0;z-index:20}.is-loading .fancybox__content{opacity:0}.is-draggable .fancybox__content{cursor:move;cursor:grab}.can-zoom_in .fancybox__content{cursor:zoom-in}.can-zoom_out .fancybox__content{cursor:zoom-out}.is-dragging .fancybox__content{cursor:move;cursor:grabbing}.fancybox__content [data-selectable],.fancybox__content [contenteditable]{cursor:auto}.fancybox__slide.has-image>.fancybox__content{padding:0;background:rgba(0,0,0,0);min-height:1px;background-repeat:no-repeat;background-size:contain;background-position:center center;transition:none;transform:matrix(1, 0, 0, 1, 0, 0);will-change:transform,width,height}.fancybox-image{margin:auto;display:block;width:100%;height:100%;min-height:0;object-fit:contain;user-select:none}.hide-image .fancybox-image{opacity:0}.fancybox__caption{align-self:center;max-width:100%;flex-shrink:0;margin:0;padding:14px 0 4px 0;overflow-wrap:anywhere;line-height:1.375;color:var(--fancybox-color, currentColor);opacity:var(--fancybox-opacity, 1);cursor:auto;visibility:visible}.is-loading .fancybox__caption,.is-closing .fancybox__caption{opacity:0;visibility:hidden}.is-compact .fancybox__caption{padding-bottom:0}.f-button.is-close-btn{--f-button-svg-stroke-width: 2;position:absolute;top:0;right:8px;z-index:40}.fancybox__content>.f-button.is-close-btn{--f-button-color: #fff;--f-button-bg: transparent;--f-button-hover-bg: transparent;--f-button-active-bg: transparent;--f-button-svg-width: 22px;--f-button-svg-height: 22px;position:absolute;top:-38px;right:0;width:34px;height:34px;border-radius:4px;color:var(--fancybox-color, #fff);opacity:.75}.is-loading .fancybox__content>.f-button.is-close-btn{visibility:hidden}.is-zooming-out .fancybox__content>.f-button.is-close-btn{visibility:hidden}.fancybox__content>.f-button.is-close-btn:hover{opacity:1}.fancybox__footer{padding:0;margin:0;position:relative}.fancybox__footer .fancybox__caption{width:100%;padding:24px;opacity:var(--fancybox-opacity, 1);transition:all .25s ease}.is-compact .fancybox__footer{position:absolute;bottom:0;left:0;right:0;z-index:20;background:rgba(24,24,27,.5)}.is-compact .fancybox__footer .fancybox__caption{padding:12px}.is-compact .fancybox__content>.f-button.is-close-btn{--f-button-svg-width: 18px;--f-button-svg-height: 18px;--f-button-svg-filter: none;top:5px;right:5px;border-radius:50%;color:#fff;background:rgba(0,0,0,.6)}.fancybox__nav{--f-button-width: 50px;--f-button-height: 50px;--f-button-border: 0;--f-button-border-radius: 50%;--f-button-color: var(--fancybox-color);--f-button-hover-color: var(--fancybox-hover-color);--f-button-bg: transparent;--f-button-hover-bg: rgba(24, 24, 27, 0.3);--f-button-active-bg: rgba(24, 24, 27, 0.5);--f-button-shadow: none;--f-button-transition: all 0.15s ease;--f-button-transform: none;--f-button-svg-width: 26px;--f-button-svg-height: 26px;--f-button-svg-stroke-width: 2.5;--f-button-svg-fill: none;--f-button-svg-filter: drop-shadow(1px 1px 1px rgba(24, 24, 27, 0.5));--f-button-svg-disabled-opacity: 0.65;--f-button-next-pos: 1rem;--f-button-prev-pos: 1rem;opacity:var(--fancybox-opacity, 1)}.fancybox__nav :focus{outline:none}.fancybox__nav :focus-visible{box-shadow:inset 0 0 0 1px #f8f8f8}.fancybox__nav .f-button:before{position:absolute;content:"";top:-30px;right:-20px;left:-20px;bottom:-30px;z-index:1}.is-idle .fancybox__nav{animation:.15s ease-out both f-fadeOut}.is-idle.is-compact .fancybox__footer{animation:.15s ease-out both f-fadeOut}.fancybox__slide>.f-spinner{position:absolute;top:50%;left:50%;margin:var(--f-spinner-top, calc(var(--f-spinner-width) * -0.5)) 0 0 var(--f-spinner-left, calc(var(--f-spinner-height) * -0.5));z-index:30;cursor:pointer}.fancybox-protected{position:absolute;top:0;left:0;right:0;bottom:0;z-index:40;user-select:none}.fancybox-ghost{position:absolute;top:0;left:0;width:100%;height:100%;min-height:0;object-fit:contain;z-index:40;user-select:none;pointer-events:none}.fancybox-focus-guard{position:fixed;top:1px;left:1px;width:1px;height:0px;padding:0px;margin:-1px;overflow:hidden;clip:rect(0px, 0px, 0px, 0px);white-space:nowrap;border-width:0px}.fancybox__container:not([aria-hidden]){opacity:0}.fancybox__container.is-animated[aria-hidden=false]>*:not(.fancybox__backdrop,.fancybox__carousel),.fancybox__container.is-animated[aria-hidden=false] .fancybox__carousel>*:not(.fancybox__viewport),.fancybox__container.is-animated[aria-hidden=false] .fancybox__slide>*:not(.fancybox__content){animation:.25s ease .1s backwards f-fadeIn}.fancybox__container.is-animated[aria-hidden=false] .fancybox__backdrop{animation:.35s ease backwards f-fadeIn}.fancybox__container.is-animated[aria-hidden=true]>*:not(.fancybox__backdrop,.fancybox__carousel),.fancybox__container.is-animated[aria-hidden=true] .fancybox__carousel>*:not(.fancybox__viewport),.fancybox__container.is-animated[aria-hidden=true] .fancybox__slide>*:not(.fancybox__content){animation:.15s ease forwards f-fadeOut}.fancybox__container.is-animated[aria-hidden=true] .fancybox__backdrop{animation:.35s ease forwards f-fadeOut}.has-iframe .fancybox__content,.has-map .fancybox__content,.has-pdf .fancybox__content,.has-youtube .fancybox__content,.has-vimeo .fancybox__content,.has-html5video .fancybox__content{max-width:100%;flex-shrink:1;min-height:1px;overflow:visible}.has-iframe .fancybox__content,.has-map .fancybox__content,.has-pdf .fancybox__content{width:100%;height:100%}.fancybox__container:not(.is-compact) .has-iframe .fancybox__content,.fancybox__container:not(.is-compact) .has-map .fancybox__content,.fancybox__container:not(.is-compact) .has-pdf .fancybox__content{width:calc(100% - 120px);height:90%}.has-youtube .fancybox__content,.has-vimeo .fancybox__content,.has-html5video .fancybox__content{width:960px;height:540px;max-width:100%;max-height:100%}.has-map .fancybox__content,.has-pdf .fancybox__content,.has-youtube .fancybox__content,.has-vimeo .fancybox__content,.has-html5video .fancybox__content{padding:0;background:rgba(24,24,27,.9);color:#fff}.has-map .fancybox__content{background:#e5e3df}.fancybox__html5video,.fancybox__iframe{border:0;display:block;height:100%;width:100%;background:rgba(0,0,0,0)}.fancybox-placeholder{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}.f-thumbs{--f-thumb-width: 96px;--f-thumb-height: 72px;--f-thumb-gap: 4px;--f-thumb-outline: 0;--f-thumb-outline-color: #5eb0ef;--f-thumb-opacity: 1;--f-thumb-hover-opacity: 1;--f-thumb-selected-opacity: 1;--f-thumb-border-radius: 2px;--f-thumb-offset: 0px;position:relative;margin:0;padding:0 var(--f-thumb-gap);overflow:hidden;-webkit-tap-highlight-color:rgba(0,0,0,0);user-select:none;perspective:1000px;transform:translateZ(0)}.f-thumbs.is-classic{--f-thumb-opacity: 0.5;--f-thumb-hover-opacity: 1;--f-thumb-selected-opacity: 1}.f-thumbs.is-modern{--f-thumb-extra-gap: 20px;--f-thumb-clip-width: 46px}.f-thumbs .f-spinner{position:absolute;top:0;left:0;width:100%;height:100%;border-radius:2px;background-image:linear-gradient(#ebeff2, #e2e8f0);z-index:-1}.f-thumbs .f-spinner svg{display:none}.f-thumbs__viewport{width:100%;height:auto;overflow:hidden;transform:translate3d(0, 0, 0);backface-visibility:hidden}.f-thumbs__track{display:flex;margin:0 auto;padding:8px 0 12px 0}.f-thumbs__slide{position:relative;flex:0 0 auto;box-sizing:content-box;display:flex;align-items:center;justify-content:center;padding:0;margin:0;width:var(--f-thumb-width);min-width:var(--f-thumb-width);height:var(--f-thumb-height);overflow:visible;cursor:pointer}.f-thumbs__slide.is-loading img{opacity:0}.is-classic .f-thumbs__slide{margin:0 var(--f-thumb-gap) 0 0}.is-modern .f-thumbs__track{width:max-content}.is-modern .f-thumbs__track::before{content:"";position:absolute;top:0;bottom:0;left:calc(var(--left, 0)*1px);width:calc(100% - var(--width, 0)*1px);cursor:pointer}.is-modern .f-thumbs__slide{--clip-path: inset( 0 calc( (var(--f-thumb-width, 0) - var(--f-thumb-clip-width, 0)) * 0.5 * (1 - var(--progress, 0)) ) round var(--f-thumb-border-radius, 0) );transform:translate3d(calc(var(--shift, 0) * -1px), 0, 0);transition:none;pointer-events:none}.is-modern .f-thumbs__slide:focus-within{filter:drop-shadow(-1px 0px 0px var(--f-thumb-outline-color)) drop-shadow(2px 0px 0px var(--f-thumb-outline-color)) drop-shadow(0px -1px 0px var(--f-thumb-outline-color)) drop-shadow(0px 2px 0px var(--f-thumb-outline-color))}.is-modern .f-thumbs__slide>*{clip-path:var(--clip-path);will-change:clip-path}.is-modern.is-resting .f-thumbs__slide{transition:all .33s ease}.is-modern.is-resting .f-thumbs__slide>*{transition:all .33s ease}.f-thumbs__slide__button{appearance:none;width:100%;height:100%;margin:0;padding:0;border:0;position:relative;border-radius:var(--f-thumb-border-radius);overflow:hidden;background:rgba(0,0,0,0);outline:none;cursor:pointer;pointer-events:auto;touch-action:manipulation;transition:opacity .2s ease;opacity:var(--f-thumb-opacity)}.f-thumbs__slide__button:hover{opacity:var(--f-thumb-hover-opacity)}.f-thumbs__slide__button:focus-visible{opacity:var(--f-thumb-selected-opacity)}.is-nav-selected .f-thumbs__slide__button{opacity:var(--f-thumb-selected-opacity)}.is-nav-selected .f-thumbs__slide__button::after{content:"";position:absolute;top:0;left:0;right:0;height:auto;bottom:0;border:var(--f-thumb-outline, 0) solid var(--f-thumb-outline-color, transparent);border-radius:var(--f-thumb-border-radius);animation:f-fadeIn .2s ease}.f-thumbs__slide__img{position:absolute;overflow:hidden;top:0;right:0;bottom:0;left:0;width:100%;height:100%;padding:var(--f-thumb-offset);box-sizing:border-box;object-fit:cover}.fancybox__thumbs{position:relative;opacity:var(--fancybox-opacity, 1);transition:all .25s ease}.fancybox__thumbs.is-modern{--f-thumb-outline: 2px;--f-thumb-outline-color: #ededed;--f-thumb-opacity: 1;--f-thumb-hover-opacity: 1;--f-thumb-border-radius: 2px;--f-thumb-width: 96px;--f-thumb-clip-width: 46px;--f-thumb-height: 72px;--f-thumb-gap: 6px;--f-thumb-extra-gap: 20px}.fancybox__thumbs.is-classic{--f-thumb-outline: 2px;--f-thumb-outline-color: #ededed;--f-thumb-opacity: 0.5;--f-thumb-hover-opacity: 1;--f-thumb-border-radius: 2px;--f-thumb-width: 96px;--f-thumb-height: 72px;--f-thumb-gap: 8px}.is-compact .fancybox__thumbs{--f-thumb-width: 64px;--f-thumb-clip-width: 32px;--f-thumb-height: 48px;--f-thumb-extra-gap: 12px}.is-closing .fancybox__thumbs{transition:none !important}.fancybox__thumbs.is-hidden{height:0px !important}.fancybox__thumbs .f-spinner{background-image:linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05))}.fancybox__toolbar{--f-progress-color: var(--fancybox-color, rgba(255, 255, 255, 0.94));--f-button-width: 46px;--f-button-height: 46px;--f-button-color: var(--fancybox-color);--f-button-hover-color: var(--fancybox-hover-color);--f-button-bg: rgba(24, 24, 27, 0.65);--f-button-hover-bg: rgba(70, 70, 73, 0.65);--f-button-active-bg: rgba(90, 90, 93, 0.65);--f-button-border-radius: 0;--f-button-svg-width: 24px;--f-button-svg-height: 24px;--f-button-svg-stroke-width: 1.5;--f-button-svg-filter: drop-shadow(1px 1px 1px rgba(24, 24, 27, 0.15));--f-button-svg-fill: none;--f-button-svg-disabled-opacity: 0.65;display:flex;flex-direction:row;justify-content:space-between;margin:0;padding:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI Adjusted","Segoe UI","Liberation Sans",sans-serif;color:var(--fancybox-color, currentColor);opacity:var(--fancybox-opacity, 1);text-shadow:var(--fancybox-toolbar-text-shadow, 1px 1px 1px rgba(0, 0, 0, 0.5));pointer-events:none;z-index:20}.fancybox__toolbar :focus-visible{z-index:1}.fancybox__toolbar.is-absolute,.is-compact .fancybox__toolbar{position:absolute;top:0;left:0;right:0}.is-idle .fancybox__toolbar{pointer-events:none;animation:.15s ease-out both f-fadeOut}.fancybox__toolbar__column{display:flex;flex-direction:row;flex-wrap:wrap;align-content:flex-start}.fancybox__toolbar__column.is-left,.fancybox__toolbar__column.is-right{flex-grow:1;flex-basis:0}.fancybox__toolbar__column.is-right{display:flex;justify-content:flex-end;flex-wrap:nowrap}.fancybox__infobar{padding:0 5px;line-height:var(--f-button-height);text-align:center;font-size:17px;font-variant-numeric:tabular-nums;-webkit-font-smoothing:subpixel-antialiased;cursor:default;user-select:none}.fancybox__infobar span{padding:0 5px}.fancybox__infobar:not(:first-child):not(:last-child){background:var(--f-button-bg)}[data-fancybox-toggle-slideshow]{position:relative}[data-fancybox-toggle-slideshow] .f-progress{height:100%;opacity:.3}[data-fancybox-toggle-slideshow] svg g:first-child{display:flex}[data-fancybox-toggle-slideshow] svg g:last-child{display:none}.has-slideshow [data-fancybox-toggle-slideshow] svg g:first-child{display:none}.has-slideshow [data-fancybox-toggle-slideshow] svg g:last-child{display:flex}[data-fancybox-toggle-fullscreen] svg g:first-child{display:flex}[data-fancybox-toggle-fullscreen] svg g:last-child{display:none}:fullscreen [data-fancybox-toggle-fullscreen] svg g:first-child{display:none}:fullscreen [data-fancybox-toggle-fullscreen] svg g:last-child{display:flex}.f-progress{position:absolute;top:0;left:0;right:0;height:3px;transform:scaleX(0);transform-origin:0;transition-property:transform;transition-timing-function:linear;background:var(--f-progress-color, var(--f-carousel-theme-color, #0091ff));z-index:30;user-select:none;pointer-events:none} \ No newline at end of file +:root{--f-spinner-width: 36px;--f-spinner-height: 36px;--f-spinner-color-1: rgba(0, 0, 0, 0.1);--f-spinner-color-2: rgba(17, 24, 28, 0.8);--f-spinner-stroke: 2.75}.f-spinner{margin:auto;padding:0;width:var(--f-spinner-width);height:var(--f-spinner-height)}.f-spinner svg{width:100%;height:100%;vertical-align:top;animation:f-spinner-rotate 2s linear infinite}.f-spinner svg *{stroke-width:var(--f-spinner-stroke);fill:none}.f-spinner svg *:first-child{stroke:var(--f-spinner-color-1)}.f-spinner svg *:last-child{stroke:var(--f-spinner-color-2);animation:f-spinner-dash 2s ease-in-out infinite}@keyframes f-spinner-rotate{100%{transform:rotate(360deg)}}@keyframes f-spinner-dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}.f-zoomInUp{animation:.2s ease-out .1s both f-zoomInUp}.f-zoomOutDown{animation:.2s ease-in both f-zoomOutDown}@keyframes f-zoomInUp{from{transform:scale(0.975) translate3d(0, 16px, 0);opacity:0}to{transform:scale(1) translate3d(0, 0, 0);opacity:1}}@keyframes f-zoomOutDown{to{transform:scale(0.975) translate3d(0, -16px, 0);opacity:0}}.f-throwOutUp{animation:.175s ease-out both f-throwOutUp}.f-throwOutDown{animation:.175s ease-out both f-throwOutDown}@keyframes f-throwOutUp{to{transform:translate3d(0, -150px, 0);opacity:0}}@keyframes f-throwOutDown{to{transform:translate3d(0, 150px, 0);opacity:0}}.f-fadeIn{animation:.2s ease both f-fadeIn;z-index:2}.f-fadeOut{animation:.2s ease both f-fadeOut;z-index:1}@keyframes f-fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes f-fadeOut{100%{opacity:0}}.f-fadeSlowIn{animation:.5s ease both f-fadeSlowIn;z-index:2}.f-fadeSlowOut{animation:.5s ease both f-fadeSlowOut;z-index:1}@keyframes f-fadeSlowIn{0%{opacity:0}100%{opacity:1}}@keyframes f-fadeSlowOut{100%{opacity:0}}.f-fadeFastIn{animation:.2s ease-out both f-fadeFastIn;z-index:2}.f-fadeFastOut{animation:.2s ease-out both f-fadeFastOut;z-index:2}@keyframes f-fadeFastIn{0%{opacity:.75}100%{opacity:1}}@keyframes f-fadeFastOut{100%{opacity:0}}.f-crossfadeIn{animation:.2s ease-out both f-crossfadeIn;z-index:2}.f-crossfadeOut{animation:.1s linear .1s both f-crossfadeOut;z-index:1}@keyframes f-crossfadeIn{0%{opacity:0}100%{opacity:1}}@keyframes f-crossfadeOut{100%{opacity:0}}.f-slideIn.from-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideInNext}.f-slideIn.from-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideInPrev}.f-slideOut.to-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideOutNext}.f-slideOut.to-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-slideOutPrev}@keyframes f-slideInPrev{0%{transform:translateX(100%)}100%{transform:translate3d(0, 0, 0)}}@keyframes f-slideInNext{0%{transform:translateX(-100%)}100%{transform:translate3d(0, 0, 0)}}@keyframes f-slideOutNext{100%{transform:translateX(-100%)}}@keyframes f-slideOutPrev{100%{transform:translateX(100%)}}.f-classicIn.from-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicInNext;z-index:2}.f-classicIn.from-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicInPrev;z-index:2}.f-classicOut.to-next{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicOutNext;z-index:1}.f-classicOut.to-prev{animation:.85s cubic-bezier(0.16, 1, 0.3, 1) f-classicOutPrev;z-index:1}@keyframes f-classicInNext{0%{transform:translateX(-75px);opacity:0}100%{transform:translate3d(0, 0, 0);opacity:1}}@keyframes f-classicInPrev{0%{transform:translateX(75px);opacity:0}100%{transform:translate3d(0, 0, 0);opacity:1}}@keyframes f-classicOutNext{100%{transform:translateX(-75px);opacity:0}}@keyframes f-classicOutPrev{100%{transform:translateX(75px);opacity:0}}:root{--f-button-width: 40px;--f-button-height: 40px;--f-button-border: 0;--f-button-border-radius: 0;--f-button-color: #374151;--f-button-bg: #f8f8f8;--f-button-hover-bg: #e0e0e0;--f-button-active-bg: #d0d0d0;--f-button-shadow: none;--f-button-transition: all 0.15s ease;--f-button-transform: none;--f-button-svg-width: 20px;--f-button-svg-height: 20px;--f-button-svg-stroke-width: 1.5;--f-button-svg-fill: none;--f-button-svg-filter: none;--f-button-svg-disabled-opacity: 0.65}.f-button{display:flex;justify-content:center;align-items:center;box-sizing:content-box;position:relative;margin:0;padding:0;width:var(--f-button-width);height:var(--f-button-height);border:var(--f-button-border);border-radius:var(--f-button-border-radius);color:var(--f-button-color);background:var(--f-button-bg);box-shadow:var(--f-button-shadow);pointer-events:all;cursor:pointer;transition:var(--f-button-transition)}@media(hover: hover){.f-button:hover{color:var(--f-button-hover-color);background-color:var(--f-button-hover-bg)}}.f-button:active:not([disabled]){background-color:var(--f-button-active-bg)}.f-button:focus-visible{outline:none}.f-button svg{width:var(--f-button-svg-width);height:var(--f-button-svg-height);fill:var(--f-button-svg-fill);stroke:currentColor;stroke-width:var(--f-button-svg-stroke-width);stroke-linecap:round;stroke-linejoin:round;transition:opacity .15s ease;transform:var(--f-button-transform);filter:var(--f-button-svg-filter);pointer-events:none}.f-button[disabled]{cursor:default}.f-button[disabled] svg{opacity:var(--f-button-svg-disabled-opacity)}.f-carousel__nav .f-button.is-prev,.f-carousel__nav .f-button.is-next,.fancybox__nav .f-button.is-prev,.fancybox__nav .f-button.is-next{position:absolute;z-index:1}.is-horizontal .f-carousel__nav .f-button.is-prev,.is-horizontal .f-carousel__nav .f-button.is-next,.is-horizontal .fancybox__nav .f-button.is-prev,.is-horizontal .fancybox__nav .f-button.is-next{top:50%;transform:translateY(-50%)}.is-horizontal .f-carousel__nav .f-button.is-prev,.is-horizontal .fancybox__nav .f-button.is-prev{left:var(--f-button-prev-pos)}.is-horizontal .f-carousel__nav .f-button.is-next,.is-horizontal .fancybox__nav .f-button.is-next{right:var(--f-button-next-pos)}.is-horizontal.is-rtl .f-carousel__nav .f-button.is-prev,.is-horizontal.is-rtl .fancybox__nav .f-button.is-prev{left:auto;right:var(--f-button-next-pos)}.is-horizontal.is-rtl .f-carousel__nav .f-button.is-next,.is-horizontal.is-rtl .fancybox__nav .f-button.is-next{right:auto;left:var(--f-button-prev-pos)}.is-vertical .f-carousel__nav .f-button.is-prev,.is-vertical .f-carousel__nav .f-button.is-next,.is-vertical .fancybox__nav .f-button.is-prev,.is-vertical .fancybox__nav .f-button.is-next{top:auto;left:50%;transform:translateX(-50%)}.is-vertical .f-carousel__nav .f-button.is-prev,.is-vertical .fancybox__nav .f-button.is-prev{top:var(--f-button-next-pos)}.is-vertical .f-carousel__nav .f-button.is-next,.is-vertical .fancybox__nav .f-button.is-next{bottom:var(--f-button-next-pos)}.is-vertical .f-carousel__nav .f-button.is-prev svg,.is-vertical .f-carousel__nav .f-button.is-next svg,.is-vertical .fancybox__nav .f-button.is-prev svg,.is-vertical .fancybox__nav .f-button.is-next svg{transform:rotate(90deg)}html.with-fancybox{scroll-behavior:auto;width:auto;overflow:visible}html.with-fancybox body{touch-action:none}html.with-fancybox body.compensate-for-scrollbar{width:auto;overflow:hidden !important;overscroll-behavior-y:none;margin-right:var(--fancybox-scrollbar-compensate, 0)}.fancybox__container{--fancybox-color: #dbdbdb;--fancybox-hover-color: #fff;--fancybox-bg: rgba(24, 24, 27, 0.98);--fancybox-slide-gap: 10px;--f-spinner-width: 50px;--f-spinner-height: 50px;--f-spinner-color-1: rgba(255, 255, 255, 0.1);--f-spinner-color-2: #bbb;--f-spinner-stroke: 3.65;position:fixed;top:0;left:0;bottom:0;right:0;direction:ltr;display:flex;flex-direction:column;box-sizing:border-box;margin:0;padding:0;color:#f8f8f8;-webkit-tap-highlight-color:rgba(0,0,0,0);overflow:visible;z-index:1050;outline:none;-webkit-text-size-adjust:100%;-moz-text-size-adjust:none;-ms-text-size-adjust:100%;text-size-adjust:100%}.fancybox__container *,.fancybox__container *::before,.fancybox__container *::after{box-sizing:inherit}.fancybox__backdrop{position:fixed;top:0;left:0;bottom:0;right:0;z-index:-1;background:var(--fancybox-bg);opacity:var(--fancybox-opacity, 1);will-change:opacity}.fancybox__carousel{position:relative;box-sizing:border-box;flex:1;min-height:0;z-index:10;overflow-y:visible;overflow-x:clip}.fancybox__viewport{width:100%;height:100%}.fancybox__track{display:flex;margin:0 auto;height:100%}.fancybox__slide{flex:0 0 auto;position:relative;display:flex;flex-direction:column;align-items:center;width:100%;height:100%;margin:0 var(--fancybox-slide-gap) 0 0;padding:4px;overflow:auto;transform:translate3d(0, 0, 0);backface-visibility:hidden}.fancybox__container:not(.is-compact) .fancybox__slide.has-close-btn{padding-top:40px}.fancybox__slide.has-iframe,.fancybox__slide.has-video,.fancybox__slide.has-html5video{overflow:hidden}.fancybox__slide.has-image{overflow:hidden}.fancybox__slide.has-image.is-selected{overflow:visible}.fancybox__slide::before,.fancybox__slide::after{content:"";flex:0 0 0;margin:auto}.fancybox__content{align-self:center;display:flex;flex-direction:column;position:relative;margin:0;padding:2rem;max-width:100%;color:var(--fancybox-content-color, #374151);background:var(--fancybox-content-bg, #fff);cursor:default;border-radius:0;z-index:20}.is-loading .fancybox__content{opacity:0}.is-draggable .fancybox__content{cursor:move;cursor:grab}.can-zoom_in .fancybox__content{cursor:zoom-in}.can-zoom_out .fancybox__content{cursor:zoom-out}.is-dragging .fancybox__content{cursor:move;cursor:grabbing}.fancybox__content [data-selectable],.fancybox__content [contenteditable]{cursor:auto}.fancybox__slide.has-image>.fancybox__content{padding:0;background:rgba(0,0,0,0);min-height:1px;background-repeat:no-repeat;background-size:contain;background-position:center center;transition:none;transform:translate3d(0, 0, 0);backface-visibility:hidden}.fancybox__slide.is-animating>.fancybox__content{filter:blur(0px);will-change:transform,width,height}.fancybox-image{margin:auto;display:block;width:100%;height:100%;min-height:0;object-fit:contain;user-select:none}.hide-image .fancybox-image{opacity:0}.fancybox__caption{align-self:center;max-width:100%;flex-shrink:0;margin:0;padding:14px 0 4px 0;overflow-wrap:anywhere;line-height:1.375;color:var(--fancybox-color, currentColor);opacity:var(--fancybox-opacity, 1);cursor:auto;visibility:visible}.is-loading .fancybox__caption,.is-closing .fancybox__caption{opacity:0;visibility:hidden}.is-compact .fancybox__caption{padding-bottom:0}.f-button.is-close-btn{--f-button-svg-stroke-width: 2;position:absolute;top:0;right:8px;z-index:40}.fancybox__content>.f-button.is-close-btn{--f-button-color: #fff;--f-button-bg: transparent;--f-button-hover-bg: transparent;--f-button-active-bg: transparent;--f-button-svg-width: 22px;--f-button-svg-height: 22px;position:absolute;top:-38px;right:0;width:34px;height:34px;border-radius:4px;color:var(--fancybox-color, #fff);opacity:.75}.is-loading .fancybox__content>.f-button.is-close-btn{visibility:hidden}.is-zooming-out .fancybox__content>.f-button.is-close-btn{visibility:hidden}.fancybox__content>.f-button.is-close-btn:hover{opacity:1}.fancybox__footer{padding:0;margin:0;position:relative}.fancybox__footer .fancybox__caption{width:100%;padding:24px;opacity:var(--fancybox-opacity, 1);transition:all .25s ease}.is-compact .fancybox__footer{position:absolute;bottom:0;left:0;right:0;z-index:20;background:rgba(24,24,27,.5)}.is-compact .fancybox__footer .fancybox__caption{padding:12px}.is-compact .fancybox__content>.f-button.is-close-btn{--f-button-svg-width: 18px;--f-button-svg-height: 18px;--f-button-svg-filter: none;top:5px;right:5px;border-radius:50%;color:#fff;background:rgba(0,0,0,.6)}.fancybox__nav{--f-button-width: 50px;--f-button-height: 50px;--f-button-border: 0;--f-button-border-radius: 50%;--f-button-color: var(--fancybox-color);--f-button-hover-color: var(--fancybox-hover-color);--f-button-bg: transparent;--f-button-hover-bg: rgba(24, 24, 27, 0.3);--f-button-active-bg: rgba(24, 24, 27, 0.5);--f-button-shadow: none;--f-button-transition: all 0.15s ease;--f-button-transform: none;--f-button-svg-width: 26px;--f-button-svg-height: 26px;--f-button-svg-stroke-width: 2.5;--f-button-svg-fill: none;--f-button-svg-filter: drop-shadow(1px 1px 1px rgba(24, 24, 27, 0.5));--f-button-svg-disabled-opacity: 0.65;--f-button-next-pos: 1rem;--f-button-prev-pos: 1rem;opacity:var(--fancybox-opacity, 1)}.fancybox__nav :focus{outline:none}.fancybox__nav :focus-visible{box-shadow:inset 0 0 0 1px #f8f8f8}.fancybox__nav .f-button:before{position:absolute;content:"";top:-30px;right:-20px;left:-20px;bottom:-30px;z-index:1}.is-idle .fancybox__nav{animation:.15s ease-out both f-fadeOut}.is-idle.is-compact .fancybox__footer{pointer-events:none;animation:.15s ease-out both f-fadeOut}.fancybox__slide>.f-spinner{position:absolute;top:50%;left:50%;margin:var(--f-spinner-top, calc(var(--f-spinner-width) * -0.5)) 0 0 var(--f-spinner-left, calc(var(--f-spinner-height) * -0.5));z-index:30;cursor:pointer}.fancybox-protected{position:absolute;top:0;left:0;right:0;bottom:0;z-index:40;user-select:none}.fancybox-ghost{position:absolute;top:0;left:0;width:100%;height:100%;min-height:0;object-fit:contain;z-index:40;user-select:none;pointer-events:none}.fancybox-focus-guard{position:fixed;top:1px;left:1px;width:1px;height:0px;padding:0px;margin:-1px;overflow:hidden;clip:rect(0px, 0px, 0px, 0px);white-space:nowrap;border-width:0px}.fancybox__container:not([aria-hidden]){opacity:0}.fancybox__container.is-animated[aria-hidden=false]>*:not(.fancybox__backdrop,.fancybox__carousel),.fancybox__container.is-animated[aria-hidden=false] .fancybox__carousel>*:not(.fancybox__viewport),.fancybox__container.is-animated[aria-hidden=false] .fancybox__slide>*:not(.fancybox__content){animation:.25s ease .1s backwards f-fadeIn}.fancybox__container.is-animated[aria-hidden=false] .fancybox__backdrop{animation:.35s ease backwards f-fadeIn}.fancybox__container.is-animated[aria-hidden=true]>*:not(.fancybox__backdrop,.fancybox__carousel),.fancybox__container.is-animated[aria-hidden=true] .fancybox__carousel>*:not(.fancybox__viewport),.fancybox__container.is-animated[aria-hidden=true] .fancybox__slide>*:not(.fancybox__content){animation:.15s ease forwards f-fadeOut}.fancybox__container.is-animated[aria-hidden=true] .fancybox__backdrop{animation:.35s ease forwards f-fadeOut}.has-iframe .fancybox__content,.has-map .fancybox__content,.has-pdf .fancybox__content,.has-youtube .fancybox__content,.has-vimeo .fancybox__content,.has-html5video .fancybox__content{max-width:100%;flex-shrink:1;min-height:1px;overflow:visible}.has-iframe .fancybox__content,.has-map .fancybox__content,.has-pdf .fancybox__content{width:100%;height:100%}.fancybox__container:not(.is-compact) .has-iframe .fancybox__content,.fancybox__container:not(.is-compact) .has-map .fancybox__content,.fancybox__container:not(.is-compact) .has-pdf .fancybox__content{width:calc(100% - 120px);height:90%}.has-youtube .fancybox__content,.has-vimeo .fancybox__content,.has-html5video .fancybox__content{width:960px;height:540px;max-width:100%;max-height:100%}.has-map .fancybox__content,.has-pdf .fancybox__content,.has-youtube .fancybox__content,.has-vimeo .fancybox__content,.has-html5video .fancybox__content{padding:0;background:rgba(24,24,27,.9);color:#fff}.has-map .fancybox__content{background:#e5e3df}.fancybox__html5video,.fancybox__iframe{border:0;display:block;height:100%;width:100%;background:rgba(0,0,0,0)}.fancybox-placeholder{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}.f-carousel__thumbs{--f-thumb-width: 96px;--f-thumb-height: 72px;--f-thumb-gap: 4px;--f-thumb-outline: 0;--f-thumb-outline-color: #5eb0ef;--f-thumb-opacity: 1;--f-thumb-hover-opacity: 1;--f-thumb-selected-opacity: 1;--f-thumb-border-radius: 2px;--f-thumb-offset: 0px;--f-button-next-pos: 0;--f-button-prev-pos: 0}.f-carousel__thumbs.is-classic{--f-thumb-opacity: 0.5;--f-thumb-hover-opacity: 1;--f-thumb-selected-opacity: 1}.f-carousel__thumbs.is-modern{--f-thumb-extra-gap: 20px;--f-thumb-clip-width: 46px}.f-thumbs{position:relative;flex:0 0 auto;margin:0;padding:0 var(--f-thumb-gap);overflow:hidden;-webkit-tap-highlight-color:rgba(0,0,0,0);user-select:none;perspective:1000px;transform:translateZ(0)}.f-thumbs .f-spinner{position:absolute;top:0;left:0;width:100%;height:100%;border-radius:2px;background-image:linear-gradient(#ebeff2, #e2e8f0);z-index:-1}.f-thumbs .f-spinner svg{display:none}.f-thumbs__viewport{width:100%;height:auto;overflow:hidden}.f-thumbs__track{display:flex;margin:0 auto;padding:8px 0 12px 0;will-change:transform}.f-thumbs__slide{position:relative;flex:0 0 auto;box-sizing:content-box;display:flex;align-items:center;justify-content:center;padding:0;margin:0;width:var(--f-thumb-width);min-width:var(--f-thumb-width);height:var(--f-thumb-height);overflow:visible;cursor:pointer}.f-thumbs__slide.is-loading img{opacity:0}.is-classic .f-thumbs__viewport{height:100%}.is-classic .f-thumbs__slide{margin:0 var(--f-thumb-gap) 0 0}.is-modern .f-thumbs__track{width:max-content}.is-modern .f-thumbs__track::before{content:"";position:absolute;top:0;bottom:0;left:calc(var(--left, 0)*1px);width:calc(100% - var(--width, 0)*1px);cursor:pointer}.is-modern .f-thumbs__slide{--clip-path: inset( 0 calc( (var(--f-thumb-width, 0) - var(--f-thumb-clip-width, 0)) * 0.5 * (1 - var(--progress, 0)) ) round var(--f-thumb-border-radius, 0) );transform:translate3d(calc(var(--shift, 0) * -1px), 0, 0);transition:none;pointer-events:none}.is-modern .f-thumbs__slide:focus-within{filter:drop-shadow(-1px 0px 0px var(--f-thumb-outline-color)) drop-shadow(2px 0px 0px var(--f-thumb-outline-color)) drop-shadow(0px -1px 0px var(--f-thumb-outline-color)) drop-shadow(0px 2px 0px var(--f-thumb-outline-color))}.is-modern .f-thumbs__slide>*{clip-path:var(--clip-path);will-change:clip-path}.is-modern.is-resting .f-thumbs__slide{transition:all .33s ease}.is-modern.is-resting .f-thumbs__slide>*{transition:all .33s ease}.f-thumbs__slide__button{appearance:none;width:100%;height:100%;margin:0;padding:0;border:0;position:relative;border-radius:var(--f-thumb-border-radius);overflow:hidden;background:rgba(0,0,0,0);outline:none;cursor:pointer;pointer-events:auto;touch-action:manipulation;transition:opacity .2s ease;opacity:var(--f-thumb-opacity)}.f-thumbs__slide__button:hover{opacity:var(--f-thumb-hover-opacity)}.f-thumbs__slide__button:focus-visible{outline:none;opacity:var(--f-thumb-selected-opacity)}.is-nav-selected .f-thumbs__slide__button{opacity:var(--f-thumb-selected-opacity)}.is-nav-selected .f-thumbs__slide__button::after{content:"";position:absolute;top:0;left:0;right:0;height:auto;bottom:0;border:var(--f-thumb-outline, 0) solid var(--f-thumb-outline-color, transparent);border-radius:var(--f-thumb-border-radius);animation:f-fadeIn .2s ease}.f-thumbs__slide__img{position:absolute;overflow:hidden;top:0;right:0;bottom:0;left:0;width:100%;height:100%;padding:var(--f-thumb-offset);box-sizing:border-box;object-fit:cover}.f-thumbs.is-vertical{--f-carousel-slide-height: 100%}.f-thumbs.is-vertical .f-thumbs__track{flex-wrap:wrap}.f-thumbs.is-vertical .f-thumbs__slide{margin:0 0 var(--f-thumb-gap) 0}.fancybox__thumbs{--f-thumb-width: 96px;--f-thumb-clip-width: 46px;--f-thumb-height: 72px;--f-thumb-border-radius: 2px;--f-thumb-gap: 6px;--f-thumb-extra-gap: 20px;--f-thumb-outline: 2px;--f-thumb-outline-color: #ededed;position:relative;opacity:var(--fancybox-opacity, 1);transition:max-height .2s ease}.fancybox__thumbs.is-modern{--f-thumb-opacity: 1;--f-thumb-hover-opacity: 1}.fancybox__thumbs.is-classic{--f-thumb-opacity: 0.5;--f-thumb-hover-opacity: 1}.is-compact .fancybox__thumbs{--f-thumb-width: 64px;--f-thumb-clip-width: 32px;--f-thumb-height: 48px;--f-thumb-extra-gap: 12px}.fancybox__thumbs.is-hidden{max-height:0px !important}.is-closing .fancybox__thumbs{transition:none !important}.fancybox__thumbs .f-spinner{background-image:linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05))}.fancybox__toolbar{--f-progress-color: var(--fancybox-color, rgba(255, 255, 255, 0.94));--f-button-width: 46px;--f-button-height: 46px;--f-button-color: var(--fancybox-color);--f-button-hover-color: var(--fancybox-hover-color);--f-button-bg: rgba(24, 24, 27, 0.65);--f-button-hover-bg: rgba(70, 70, 73, 0.65);--f-button-active-bg: rgba(90, 90, 93, 0.65);--f-button-border-radius: 0;--f-button-svg-width: 24px;--f-button-svg-height: 24px;--f-button-svg-stroke-width: 1.5;--f-button-svg-filter: drop-shadow(1px 1px 1px rgba(24, 24, 27, 0.15));--f-button-svg-fill: none;--f-button-svg-disabled-opacity: 0.65;display:flex;flex-direction:row;justify-content:space-between;margin:0;padding:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI Adjusted","Segoe UI","Liberation Sans",sans-serif;color:var(--fancybox-color, currentColor);opacity:var(--fancybox-opacity, 1);text-shadow:var(--fancybox-toolbar-text-shadow, 1px 1px 1px rgba(0, 0, 0, 0.5));pointer-events:none;z-index:20}.fancybox__toolbar :focus-visible{z-index:1}.fancybox__toolbar.is-absolute,.is-compact .fancybox__toolbar{position:absolute;top:0;left:0;right:0}.is-idle .fancybox__toolbar{pointer-events:none;animation:.15s ease-out both f-fadeOut}.fancybox__toolbar__column{display:flex;flex-direction:row;flex-wrap:wrap;align-content:flex-start}.fancybox__toolbar__column.is-left,.fancybox__toolbar__column.is-right{flex-grow:1;flex-basis:0}.fancybox__toolbar__column.is-right{display:flex;justify-content:flex-end;flex-wrap:nowrap}.fancybox__infobar{padding:0 5px;line-height:var(--f-button-height);text-align:center;font-size:17px;font-variant-numeric:tabular-nums;-webkit-font-smoothing:subpixel-antialiased;cursor:default;user-select:none}.fancybox__infobar span{padding:0 5px}.fancybox__infobar:not(:first-child):not(:last-child){background:var(--f-button-bg)}[data-fancybox-toggle-slideshow]{position:relative}[data-fancybox-toggle-slideshow] .f-progress{height:100%;opacity:.3}[data-fancybox-toggle-slideshow] svg g:first-child{display:flex}[data-fancybox-toggle-slideshow] svg g:last-child{display:none}.has-slideshow [data-fancybox-toggle-slideshow] svg g:first-child{display:none}.has-slideshow [data-fancybox-toggle-slideshow] svg g:last-child{display:flex}[data-fancybox-toggle-fullscreen] svg g:first-child{display:flex}[data-fancybox-toggle-fullscreen] svg g:last-child{display:none}:fullscreen [data-fancybox-toggle-fullscreen] svg g:first-child{display:none}:fullscreen [data-fancybox-toggle-fullscreen] svg g:last-child{display:flex}.f-progress{position:absolute;top:0;left:0;right:0;height:3px;transform:scaleX(0);transform-origin:0;transition-property:transform;transition-timing-function:linear;background:var(--f-progress-color, var(--f-carousel-theme-color, #0091ff));z-index:30;user-select:none;pointer-events:none} \ No newline at end of file diff --git a/dist/fancybox/fancybox.esm.js b/dist/fancybox/fancybox.esm.js index 9b0982cd..e3166509 100644 --- a/dist/fancybox/fancybox.esm.js +++ b/dist/fancybox/fancybox.esm.js @@ -1 +1 @@ -const t=t=>"object"==typeof t&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t),e=(i,...n)=>{const s=n.length;for(let o=0;o{const o=Array.isArray(s)?[]:{};i[n]||Object.assign(i,{[n]:o}),t(s)?Object.assign(i[n],e(o,s)):Array.isArray(s)?Object.assign(i,{[n]:[...s]}):Object.assign(i,{[n]:s})}))}return i},i=function(t,e){let i=!0;return(...n)=>{i&&(i=!1,t(...n),setTimeout((()=>{i=!0}),e))}},n=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},s=!("undefined"==typeof window||!window.document||!window.document.createElement);let o;const a=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","),r='
',l={PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"},c={dragToClose:!0,hideScrollbar:!0,Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},contentClick:"toggleZoom",contentDblClick:!1,backdropClick:"close",animated:!0,idle:3500,showClass:"f-zoomInUp",hideClass:"f-fadeOut",commonCaption:!1,parentEl:null,startIndex:0,l10n:Object.assign(Object.assign({},l),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),tpl:{closeButton:'',main:''},groupAll:!1,groupAttr:"data-fancybox",defaultType:"image",defaultDisplay:"block",autoFocus:!0,trapFocus:!0,placeFocusBack:!0,closeButton:"auto",keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"next",ArrowDown:"prev",ArrowRight:"next",ArrowLeft:"prev"},Fullscreen:{autoStart:!1},compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,wheel:"zoom"};var h,d;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Closing=2]="Closing",t[t.CustomClosing=3]="CustomClosing",t[t.Destroy=4]="Destroy"}(h||(h={})),function(t){t[t.Loading=0]="Loading",t[t.Opening=1]="Opening",t[t.Ready=2]="Ready",t[t.Closing=3]="Closing"}(d||(d={}));const u=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class p{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?e({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=u(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...n){let s=u(e,t);var o;"string"!=typeof(o=s)||isNaN(o)||isNaN(parseFloat(o))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...n));let a=u(e,this.options);return a&&"function"==typeof a?s=a.call(this,this,t,...n,s):void 0===s&&(s=a),void 0===s?i:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(p,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(p,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class m extends p{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,n]of Object.entries(t)){const t=this.option(i),s=this.plugins[i];s||!1===t?s&&!1===t&&(s.detach(),delete this.plugins[i]):e.set(i,new n(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}class f extends p{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const g=()=>{queueMicrotask((()=>{(()=>{const{slug:t,index:e}=b.parseURL(),i=vt.getInstance();if(i&&!1!==i.option("Hash")){const n=i.carousel;if(t&&n){for(let e of n.slides)if(e.slug&&e.slug===t)return n.slideTo(e.index);if(t===i.option("slug"))return n.slideTo(e-1);const s=i.getSlide(),o=s&&s.triggerEl&&s.triggerEl.dataset;if(o&&o.fancybox===t)return n.slideTo(e-1)}b.hasSilentClose=!0,i.close()}b.startFromUrl()})()}))};class b extends f{constructor(){super(...arguments),Object.defineProperty(this,"origHash",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null})}onChange(){const t=this.instance,e=t.carousel;this.timer&&clearTimeout(this.timer);const i=t.getSlide();if(!e||!i)return;const n=t.isOpeningSlide(i),s=new URL(document.URL).hash;let o,a=i.slug||void 0;o=a||this.instance.option("slug"),!o&&i.triggerEl&&i.triggerEl.dataset&&(o=i.triggerEl.dataset.fancybox);let r="";o&&"true"!==o&&(r="#"+o+(!a&&e.slides.length>1?"-"+(i.index+1):"")),n&&(this.origHash=s!==r?s:""),r&&s!==r&&(this.timer=setTimeout((()=>{try{window.history[n?"pushState":"replaceState"]({},document.title,window.location.pathname+window.location.search+r)}catch(t){}}),300))}onClose(){if(this.timer&&clearTimeout(this.timer),!0!==b.hasSilentClose)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(this.origHash||""))}catch(t){}}attach(){this.instance.on("Carousel.ready",this.onChange),this.instance.on("Carousel.change",this.onChange),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.ready",this.onChange),this.instance.off("Carousel.change",this.onChange),this.instance.off("close",this.onClose)}static parseURL(){const t=window.location.hash.slice(1),e=t.split("-"),i=e[e.length-1],n=i&&/^\+?\d+$/.test(i)&&parseInt(e.pop()||"1",10)||1;return{hash:t,slug:e.join("-"),index:n}}static startFromUrl(){if(b.hasSilentClose=!1,vt.getInstance()||!1===vt.defaults.Hash)return;const{hash:t,slug:e,index:i}=b.parseURL();if(!e)return;let n=document.querySelector(`[data-slug="${t}"]`);if(n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),vt.getInstance())return;const s=document.querySelectorAll(`[data-fancybox="${e}"]`);s.length&&(n=s[i-1],n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))}static destroy(){window.removeEventListener("hashchange",g,!1)}}function v(){window.addEventListener("hashchange",g,!1),setTimeout((()=>{b.startFromUrl()}),500)}Object.defineProperty(b,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(b,"hasSilentClose",{enumerable:!0,configurable:!0,writable:!0,value:!1}),s&&(/complete|interactive|loaded/.test(document.readyState)?v():document.addEventListener("DOMContentLoaded",v));const y=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),w=function(t,e){return!(!t||t===document.body||e&&t===e)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,n=-1!==i.indexOf("hidden"),s=-1!==i.indexOf("visible");return e&&!n&&!s}(t)?t:w(t.parentElement,e))},x=t=>`${t||""}`.split(" ").filter((t=>!!t)),S=(t,e,i)=>{x(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))};class E{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const P={passive:!1};class M{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:n=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=n;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,P),this.element.addEventListener("touchmove",this.onMove,P),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,P)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new E(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new E(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new E(t))):[new E(t)],n=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(n.push(t),this.currentPointers[e]=t)}n.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new E(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new E(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,P),this.element.removeEventListener("touchstart",this.onTouchStart,P),this.element.removeEventListener("touchmove",this.onMove,P),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function C(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function T(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}var O;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(O||(O={}));const A=["a","b","c","d","e","f"],L={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:l},z=t=>t&&null!==t&&t instanceof Element&&"nodeType"in t,R={a:1,b:0,c:0,d:1,e:0,f:0};let k=null,I=null;class D extends m{get isTouchDevice(){return null===I&&(I=window.matchMedia("(hover: none)").matches),I}get isMobile(){return null===k&&(k=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),k}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){return this.content instanceof HTMLImageElement&&!this.content.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of A){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var s;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:O.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},R)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},R)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},D.Plugins),i)),this.emit("init"),this.isContentLoading){if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const e=n(r);t.contains(this.content)?this.spinner=(null===(s=this.content.parentElement)||void 0===s?void 0:s.insertBefore(e,this.content))||null:this.spinner=t.appendChild(e)}this.emit("beforeLoad"),this.content.addEventListener("load",this.onLoad),this.content.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===O.Init&&this.enable()}onError(){this.state!==O.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=O.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new M(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of A)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of A)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,n=i.e+t,s=i.f+e,o=this.getBounds(),{x:a,y:r}=o,l=a.min,c=a.max,h=r.min,d=r.max;let u=0,p=0;return l!==1/0&&nc&&(u=c-n),h!==1/0&&sd&&(p=d-s),Math.abs(u)<.001&&(u=0),Math.abs(p)<.001&&(p=0),Object.assign(Object.assign({},o),{xDiff:u,yDiff:p,inBounds:!u&&!p})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:n,fitHeight:s,fullWidth:o,fullHeight:a}=i;let r=o,l=a;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),c=i?o:n,h=i?a:s,d=this.getMatrix(t),u=new DOMPoint(0,0).matrixTransform(d),p=new DOMPoint(0+c,0).matrixTransform(d),m=new DOMPoint(0+c,0+h).matrixTransform(d),f=new DOMPoint(0,0+h).matrixTransform(d),g=Math.abs(m.x-u.x),b=Math.abs(m.y-u.y),v=Math.abs(f.x-p.x),y=Math.abs(f.y-p.y);r=Math.max(g,v),l=Math.max(b,y)}return{contentWidth:r,contentHeight:l}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const n=i.closest("[data-panzoom-action]"),s=i.closest("[data-panzoom-change]"),o=n||s,a=o&&z(o)?o.dataset:null;if(a){const e=a.panzoomChange,i=a.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const r=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(r.x-this.dragStart.x)>2||Math.abs(r.y-this.dragStart.y)>2))return;this.dragStart.time=0;const l=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},c=this.option("click",t),h=this.option("dblClick",t);h?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&c&&l(c)):(this.emit("dblClick",t),t.defaultPrevented||l(h)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&c&&l(c))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(t,e,i){var n;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const s=this.content.getBoundingClientRect();if(this.dragStart={x:s.x,y:s.y,top:s.top,left:s.left,time:Date.now()},!1===this.option("touch",t))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;if(!i.length){const e=t.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(e.nodeName)||e.closest("[contenteditable]")||e.closest("[data-selectable]")||e.closest("[data-panzoom-change]")||e.closest("[data-panzoom-action]"))return!1;null===(n=window.getSelection())||void 0===n||n.removeAllRanges()}return"mousedown"===t.type&&t.preventDefault(),y(this.targetScale,1e3)===y(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(e),this.emit("touchStart",t),!0}onPointerMove(t,e,i){if(!this.isDragging)return;if(e.length<2&&this.panOnlyZoomed&&y(this.targetScale)<=y(this.minScale))return;if(this.emit("touchMove",t),t.defaultPrevented)return;this.addTrackingPoint(e[0]);const{content:n}=this,s=T(i[0],i[1]),o=T(e[0],e[1]);let a=0,r=0;if(e.length>1){const t=n.getBoundingClientRect();a=s.clientX-t.left-.5*t.width,r=s.clientY-t.top-.5*t.height}const l=C(i[0],i[1]),c=C(e[0],e[1]);let h=l?c/l:1,d=o.clientX-s.clientX,u=o.clientY-s.clientY;this.dragOffset.x+=d,this.dragOffset.y+=u,this.dragOffset.time=Date.now()-this.dragStart.time;let p=y(this.targetScale)===y(this.minScale)&&this.option("lockAxis");if(p&&!this.lockedAxis)if("xy"===p||"y"===p||"touchmove"===t.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void t.preventDefault();const e=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=e>45&&e<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,d=0,u=0}else this.lockedAxis=p;if(w(t.target,this.content)&&(p="x",this.dragOffset.y=0),p&&"xy"!==p&&this.lockedAxis!==p&&y(this.targetScale)===y(this.minScale))return;t.cancelable&&t.preventDefault(),this.container.classList.add(this.cn("isDragging"));const m=this.checkBounds(d,u);this.option("rubberband")?("x"!==this.isInfinite&&(m.xDiff>0&&d<0||m.xDiff<0&&d>0)&&(d*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*m.xDiff))),"y"!==this.isInfinite&&(m.yDiff>0&&u<0||m.yDiff<0&&u>0)&&(u*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*m.yDiff)))):(m.xDiff&&(d=0),m.yDiff&&(u=0));const f=this.targetScale,g=this.minScale,b=this.maxScale;f<.5*g&&(h=Math.max(h,g)),f>1.5*b&&(h=Math.min(h,b)),"y"===this.lockedAxis&&y(f)===y(g)&&(d=0),"x"===this.lockedAxis&&y(f)===y(g)&&(u=0),this.applyChange({originX:a,originY:r,panX:d,panY:u,scale:h,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,e,i){if(i.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(e),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),w(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==O.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of A)this.velocity[t]=0,this.target[t]=this.current[t];const{trackingPoints:t}=this,e=t[0],i=t[t.length-1];let n=0,s=0,o=0;i&&e&&(n=i.clientX-e.clientX,s=i.clientY-e.clientY,o=i.time-e.time);let a=0,r=0,l=0,c=0,h=this.option("decelFriction");const d=this.targetScale;if((dthis.maxScale+1e-5)&&(h=.35),o>0){l=Math.abs(n)>3?n/(o/30):0,c=Math.abs(s)>3?s/(o/30):0;const t=this.option("maxVelocity");t&&(l=Math.max(Math.min(l,t),-1*t),c=Math.max(Math.min(c,t),-1*t))}l&&(a=l/(1/(1-h)-1)),c&&(r=c/(1/(1-h)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&y(d)===this.minScale)&&(a=l=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&y(d)===this.minScale)&&(r=c=0);const u=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(n)),"auto"===p&&(p=parseFloat(n.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(n));const m=(this.option("transformParent")?n.parentElement:null)||n,f=m.getAttribute("style")||"";m.style.setProperty("transform","none","important"),m.style.setProperty("transition","none","important"),m.style.setProperty("animation","none","important"),n instanceof HTMLImageElement&&(m.style.width="",m.style.height=""),m.offsetHeight;const g=n.getBoundingClientRect();let b=g.width,v=g.height,w=0,x=0;if(n instanceof HTMLImageElement&&({width:b,height:v,top:w,left:x}=((t,e,i,n)=>{const s=i/n;return s>t/e?(i=t,n=t/s):(i=e*s,n=e),{width:i,height:n,top:.5*(e-n),left:.5*(t-i)}})(g.width,g.height,u,p)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:g.top-a.top+w,bottom:a.bottom-g.bottom+w,left:g.left-a.left+x,right:a.right-g.right+x,fitWidth:b,fitHeight:v,width:b,height:v,fullWidth:u,fullHeight:p}),m.style.cssText=f,n instanceof HTMLImageElement&&(m.style.width=`${b}px`,m.style.height=`${v}px`),this.setTransform(),!0!==t){let t="";Math.abs(l-s)>1&&(t+="x"),Math.abs(c-o)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(y(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===O.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const t=this.option("bounds");if("auto"!==t)return t;const{contentWidth:e,contentHeight:i}=this.calculateContentDim(this.target);let n=0,s=0,o=0,a=0;const r=this.option("infinite");if(!0===r||this.lockedAxis&&r===this.lockedAxis)n=-1/0,o=1/0,s=-1/0,a=1/0;else{let{containerRect:t,contentRect:r}=this,l=y(this.contentRect.fitWidth*this.targetScale,1e3),c=y(this.contentRect.fitHeight*this.targetScale,1e3),{innerWidth:h,innerHeight:d}=t;if(this.containerRect.width===l&&(h=t.width),this.containerRect.width===c&&(d=t.height),e>h){o=.5*(e-h),n=-1*o;let t=.5*(r.right-r.left);n+=t,o+=t}if(this.contentRect.fitWidth>h&&ed){a=.5*(i-d),s=-1*a;let t=.5*(r.bottom-r.top);s+=t,a+=t}this.contentRect.fitHeight>d&&ithis.maxScale?this.minScale:this.maxScale,toggleCover:this.targetScale>this.coverScale?this.minScale:this.coverScale,toggleZoom:this.targetScale>this.fullScale?this.minScale:this.fullScale}[this.option("click")||""]||this.minScale,n=t.canZoomIn(),s=t.canZoomOut(),o="drag"===this.panMode,a=s&&o;this.targetScale<=this.minScale&&!this.panOnlyZoomed&&(a=!0),(this.contentRect.width-this.contentRect.fitWidth>-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(a=!0),this.contentRect.width*this.targetScalethis.minScale,l=!n&&!a&&s&&y(i)===y(this.minScale);S(e,this.cn("canZoomIn"),r),S(e,this.cn("canZoomOut"),l),S(e,this.cn("isDraggable"),a);for(const t of e.querySelectorAll('[data-panzoom-action="zoomIn"]'))n?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const t of e.querySelectorAll('[data-panzoom-action="zoomOut"]'))s?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const i of e.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){n=t.targetScale.9*t.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:n=this.option("friction"),angle:s=0,originX:o=0,originY:a=0,flipX:r=!1,flipY:l=!1,ignoreBounds:c=!1}){this.state!==O.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:s,originX:o,originY:a,friction:n,flipX:r,flipY:l,ignoreBounds:c})}applyChange({panX:t=0,panY:e=0,scale:i=1,angle:n=0,originX:s=-this.current.e,originY:o=-this.current.f,friction:a=this.option("friction"),flipX:r=!1,flipY:l=!1,ignoreBounds:c=!1,bounce:h=this.option("bounce")}){if(this.state===O.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of A)this.velocity[t]=0;this.friction=a||0,this.ignoreBounds=c;const{current:d}=this,u=d.e,p=d.f,m=this.getMatrix(this.target);let f=(new DOMMatrix).translate(u,p).translate(s,o).translate(t,e);if(this.option("zoom")){if(!c){const t=this.targetScale,e=this.minScale,n=this.maxScale;t*in&&(i=n/t)}f=f.scale(i)}f=f.translate(-s,-o).translate(-u,-p).multiply(m),n&&(f=f.rotate(n)),r&&(f=f.scale(-1,1)),l&&(f=f.scale(1,-1));for(const t of A)"a"!=t&&"d"!=t||!(f[t]>this.minScale+1e-5||f[t].1||"mousemove"===this.panMode||!1===h)&&!c&&this.clampTargetBounds(),this.isResting||(this.state=O.Panning,this.requestTick())}stop(t=!1){if(this.state!==O.Init&&this.state!==O.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of A)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=O.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls()),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(t,e=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=t,"mousemove"!==this.panMode||!t)return;if(y(this.targetScale)<=y(this.minScale))return;this.emit("mouseMove",t);const{container:i,containerRect:n,contentRect:s}=this,o=n.width,a=n.height,r=i.getBoundingClientRect(),l=(t.clientX||0)-r.left,c=(t.clientY||0)-r.top;let{contentWidth:h,contentHeight:d}=this.calculateContentDim(this.target);const u=this.option("mouseMoveFactor");u>1&&(h!==o&&(h*=u),d!==a&&(d*=u));let p=.5*(h-o)-l/o*100/100*(h-o);p+=.5*(s.right-s.left);let m=.5*(d-a)-c/a*100/100*(d-a);m+=.5*(s.bottom-s.top),this.applyChange({panX:p-this.target.e,panY:m-this.target.f,friction:e})}zoomWithWheel(t){if(this.state===O.Destroy||this.state===O.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),n=this.targetScale,s=this.maxScale,o=this.minScale;let a=n*(100+i*e)/100;as&&n>=s?(this.wheelDelta+=Math.abs(i),a=s):(this.wheelDelta=0,a=Math.max(Math.min(a,s),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),a!==n&&this.zoomTo(a,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale>.9*this.maxScale?"fit":"max",t)}toggleCover(t){this.zoomTo(this.targetScale>.9*this.coverScale?"fit":"cover",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:n=0,event:s}={}){if(this.isContentLoading||this.state===O.Destroy)return;this.stop();const{targetScale:o}=this;let a=1;if("mousemove"===this.panMode&&(s=this.prevMouseMoveEvent||s),s){const t=this.content.getBoundingClientRect(),e=s.clientX||0,o=s.clientY||0;i=e-t.left-.5*t.width,n=o-t.top-.5*t.height}const r=this.fullScale,l=this.maxScale;let c=this.coverScale;"number"==typeof t?a=t/o:("next"===t&&(r-c<.2&&(c=r),t=o1?.15:.25:e,this.applyChange({scale:a,originX:i,originY:n,friction:e}),s&&"mousemove"===this.panMode&&this.panWithMouse(s,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const n=t.classList.contains(e);n?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(n?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:n,d:s,e:o,f:a}=t;return new DOMMatrix([e,i,n,s,o,a])}reset(t){if(this.state!==O.Init&&this.state!==O.Destroy){this.stop("current");for(const t of A)this.target[t]=R[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=O.Panning,this.requestTick())}}destroy(){this.stop(),this.state=O.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(D,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:L}),Object.defineProperty(D,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const F=(t,e)=>{x(e).forEach((e=>{t&&t.classList.add(e)}))},j=t=>new Promise(((e,i)=>{const n=new Image;n.onload=e,n.onerror=i,n.src=t}));class H extends f{onCreateSlide(t,e,i){const n=this.instance,s=n.optionFor(i,"src")||"",{el:o,type:a}=i;o&&"image"===a&&"string"==typeof s&&this.setContent(i,s).then((t=>{if(n.isClosing())return;const e=i.contentEl,s=i.imageEl,o=i.thumbElSrc,a=this.optionFor(i,"initialSize"),r=this.optionFor(i,"zoom"),l={event:"mousemove"===t.panMode?n.prevMouseMoveEvent||n.options.event:void 0,friction:r?.12:0};if(e&&s&&o&&n.isOpeningSlide(i)&&this.getZoomInfo(i)){let t=document.createElement("img");F(t,"fancybox-ghost"),e.appendChild(t),t.src=o,s.naturalWidth<2e3&&s.naturalHeight<2e3&&setTimeout((()=>{n.animate(t,"f-fadeFastOut",(()=>{t&&(t.remove(),t=null)}))}),300),j(o).then((()=>{i.state=d.Opening,this.instance.emit("reveal",i),this.zoomIn(i).then((()=>{t&&(t.remove(),t=null),this.instance.done(i)}),(()=>{n.hideLoading(i)}))}),(()=>{n.hideLoading(i),n.revealContent(i)}))}else{let e=n.optionFor(i,"showClass")||void 0,s=!0;n.isOpeningSlide(i)&&("full"===a?t.zoomToFull(l):"cover"===a?t.zoomToCover(l):"max"===a?t.zoomToMax(l):s=!1,t.stop("current")),s&&e&&(e="f-fadeIn"),n.revealContent(i,e)}}),(()=>{n.setError(i,"{{IMAGE_ERROR}}")}))}onRemoveSlide(t){t.panzoom&&t.panzoom.destroy(),t.panzoom=void 0,t.imageEl=void 0}onChange(t,e,i,n){for(const t of e.slides){const e=t.panzoom;e&&t.index!==i&&e.reset(.15)}}onClose(){const t=this.instance,e=t.container,i=t.getSlide();if(!e||!e.parentElement||!i)return;const{el:n,contentEl:s,panzoom:o}=i,a=i.thumbElSrc;if(!n||!a||!s||!o||o.isContentLoading||o.state===O.Init||o.state===O.Destroy)return;o.updateMetrics();let r=this.getZoomInfo(i);if(!r)return;this.instance.state=h.CustomClosing,n.classList.remove("is-zooming-in"),n.classList.add("is-zooming-out"),s.style.backgroundImage=`url('${a}')`,j(a).then((()=>{n.classList.add("hide-image")}),(()=>{}));const l=e.getBoundingClientRect();Object.assign(e.style,{position:"absolute",top:`${window.pageYOffset}px`,left:`${window.pageXOffset}px`,bottom:"auto",right:"auto",width:`${l.width}px`,height:`${l.height}px`});const{x:c,y:d,scale:u,opacity:p}=r;if(p){const t=((t,e,i,n)=>{const s=e-t,o=n-i;return e=>i+((e-t)/s*o||0)})(o.scale,u,1,0);o.on("afterTransform",(()=>{s.style.opacity=t(o.scale)+""}))}o.on("endAnimation",(()=>{t.destroy()})),o.target.a=u,o.target.b=0,o.target.c=0,o.target.d=u,o.panTo({x:c,y:d,scale:u,friction:p?.2:.33,ignoreBounds:!0}),o.isResting&&t.destroy()}setContent(t,i){return new Promise(((n,s)=>{const o=this.instance,a=t.el;if(!a)return void s();o.showLoading(t);const r=document.createElement("img");if(r.classList.add("fancybox-image"),r.src=i||"",t.imageEl=r,o.setContent(t,r,!1),this.option("protected")){a.addEventListener("contextmenu",(t=>{t.preventDefault()}));const e=t.contentEl;if(e){const t=document.createElement("div");F(t,"fancybox-protected"),e.append(t)}}t.panzoom=new D(a,e({},this.option("Panzoom")||{},{content:r,width:o.optionFor(t,"width","auto"),height:o.optionFor(t,"height","auto"),wheel:()=>{const t=o.option("wheel");return("zoom"===t||"pan"==t)&&t},click:(e,i)=>{var n;if(o.isCompact||o.isClosing())return!1;let s=!i||i.target&&(null===(n=t.contentEl)||void 0===n?void 0:n.contains(i.target));return o.option(s?"contentClick":"backdropClick")||!1},dblClick:()=>o.isCompact?"toggleZoom":o.option("contentDblClick")||!1,spinner:!1,panOnlyZoomed:!0,wheelLimit:1/0,transformParent:!0,on:{ready:t=>{n(t)},error:()=>{s()},destroy:()=>{s()}}}))}))}zoomIn(t){return new Promise(((e,i)=>{const{panzoom:n,contentEl:s,el:o}=t,a=this.getZoomInfo(t);if(!(a&&o&&s&&n))return void i();const{x:r,y:l,scale:c,opacity:h}=a,u=()=>{t.state!==d.Closing&&(h&&(s.style.opacity=Math.max(Math.min(1,1-(1-n.scale)/(1-c)),0)+""),n.scale>=1&&n.scale>n.targetScale-.1&&e(n))},p=t=>{t.scale<.99||(o.classList.remove("is-zooming-in"),t.off("endAnimation",p),t.off("touchStart",p),t.off("afterTransform",u),e(t))};n.on("endAnimation",p),n.on("touchStart",p),n.on("afterTransform",u),n.on(["error","destroy"],(()=>{i()})),n.panTo({x:r,y:l,scale:c,friction:0,ignoreBounds:!0}),n.stop("current");const m=this.instance,f={event:"mousemove"===n.panMode?m.prevMouseMoveEvent||m.options.event:void 0},g=this.optionFor(t,"initialSize");F(o,"is-zooming-in"),m.hideLoading(t),"full"===g?n.zoomToFull(f):"cover"===g?n.zoomToCover(f):"max"===g?n.zoomToMax(f):n.reset(.2)}))}getZoomInfo(t){const{el:e,imageEl:i,thumbEl:n,panzoom:s}=t;if(!e||!i||!n||!s||(t=>{const e=window.pageYOffset,i=window.pageYOffset+window.innerHeight;if(!z(t))return 0;const n=t.getBoundingClientRect(),s=n.y+window.pageYOffset,o=n.y+n.height+window.pageYOffset;if(e>o||io)return 100;if(si)return 100;let a=n.height;si&&(a-=o-i);const r=a/window.innerHeight*100;return Math.round(r)})(n)<5||!this.optionFor(t,"zoom")||this.instance.state===h.Destroy)return!1;const{top:o,left:a,width:r,height:l}=n.getBoundingClientRect();let{top:c,left:d,fitWidth:u,fitHeight:p}=s.contentRect;if(!(r&&l&&u&&p))return!1;const m=r/u,f=s.container.getBoundingClientRect();c+=f.top,d+=f.left;const g=-1*(d+.5*u-(a+.5*r)),b=-1*(c+.5*p-(o+.5*l));let v=this.option("zoomOpacity")||!1;return"auto"===v&&(v=Math.abs(r/l-u/p)>.1),{x:g,y:b,scale:m,opacity:v}}attach(){this.instance.on("Carousel.change",this.onChange),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.change",this.onChange),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("close",this.onClose)}}Object.defineProperty(H,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}});const B=(t,e={})=>{const i=new URL(t),n=new URLSearchParams(i.search),s=new URLSearchParams;for(const[t,i]of[...n,...Object.entries(e)]){let e=i.toString();"t"===t?s.set("start",parseInt(e).toString()):s.set(t,e)}let o=s.toString(),a=t.match(/#t=((.*)?\d+s)/);return a&&(o+=`#t=${a[1]}`),o},_={ajax:null,autoSize:!0,preload:!0,videoAutoplay:!0,videoRatio:16/9,videoTpl:'',videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,rel:0,fs:1}},N=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo","video"];class W extends f{onInitSlides(t,e){for(const t of e.slides)this.processType(t)}onCreateSlide(t,e,i){this.setContent(i)}onRemoveSlide(t,e,i){i.closeBtnEl&&(i.closeBtnEl.remove(),i.closeBtnEl=void 0),i.xhr&&(i.xhr.abort(),i.xhr=null),i.iframeEl&&(i.iframeEl.onload=i.iframeEl.onerror=null,i.iframeEl.src="//about:blank",i.iframeEl=null);const n=i.contentEl,s=i.placeholderEl;if("inline"===i.type&&n&&s)n.classList.remove("fancybox__content"),"none"!==n.style.display&&(n.style.display="none"),s.parentNode&&s.parentNode.insertBefore(n,s),s.remove(),i.placeholderEl=null;else for(;i.el&&i.el.firstChild;)i.el.removeChild(i.el.firstChild)}onSelectSlide(t,e,i){i.state===d.Ready&&this.playVideo()}onUnselectSlide(t,e,i){var n,s;if("html5video"===i.type){try{null===(s=null===(n=i.el)||void 0===n?void 0:n.querySelector("video"))||void 0===s||s.pause()}catch(t){}return}let o;"vimeo"===i.type?o={method:"pause",value:"true"}:"youtube"===i.type&&(o={event:"command",func:"pauseVideo"}),o&&i.iframeEl&&i.iframeEl.contentWindow&&i.iframeEl.contentWindow.postMessage(JSON.stringify(o),"*"),i.poller&&clearTimeout(i.poller)}onDone(t,e){t.isCurrentSlide(e)&&!t.isClosing()&&this.playVideo()}onRefresh(t,e){e.slides.forEach((t=>{t.el&&(this.setAspectRatio(t),this.resizeIframe(t))}))}onMessage(t){try{let e=JSON.parse(t.data);if("https://player.vimeo.com"===t.origin){if("ready"===e.event)for(let e of Array.from(document.getElementsByClassName("fancybox__iframe")))e instanceof HTMLIFrameElement&&e.contentWindow===t.source&&(e.dataset.ready="true")}else if("https://www.youtube-nocookie.com"===t.origin&&"onReady"===e.event){const t=document.getElementById(e.id);t&&(t.dataset.ready="true")}}catch(t){}}loadAjaxContent(t){const e=this.instance.optionFor(t,"src")||"";this.instance.showLoading(t);const i=this.instance,n=new XMLHttpRequest;i.showLoading(t),n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&i.state===h.Ready&&(i.hideLoading(t),200===n.status?i.setContent(t,n.responseText):i.setError(t,404===n.status?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const s=t.ajax||null;n.open(s?"POST":"GET",e+""),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send(s),t.xhr=n}setInlineContent(t){let e=null;if(z(t.src))e=t.src;else if("string"==typeof t.src){const i=t.src.split("#",2).pop();e=i?document.getElementById(i):null}if(e){if("clone"===t.type||e.dataset.placeholderId){e=e.cloneNode(!0);const i=e.dataset.animationName;i&&(e.classList.remove(i),delete e.dataset.animationName),delete e.dataset.placeholderId;let n=e.getAttribute("id");n=n?`${n}--clone`:`clone-${this.instance.id}-${t.index}`,e.setAttribute("id",n)}else if(e.parentNode){const i=document.createElement("div");i.classList.add("fancybox-placeholder"),e.parentNode.insertBefore(i,e),t.placeholderEl=i}this.instance.setContent(t,e)}else this.instance.setError(t,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(t){const{src:e,el:i}=t;if(!e||"string"!=typeof e||!i)return;const n=this.instance,s=document.createElement("iframe");s.className="fancybox__iframe",s.setAttribute("id",`fancybox__iframe_${n.id}_${t.index}`),s.setAttribute("allow","autoplay; fullscreen"),s.setAttribute("scrolling","auto"),s.onerror=()=>{n.setError(t,"{{IFRAME_ERROR}}")},t.iframeEl=s;const o=this.optionFor(t,"preload");if(i.classList.add("is-loading"),"iframe"!==t.type||!1===o)return s.setAttribute("src",t.src+""),this.resizeIframe(t),void n.setContent(t,s);n.showLoading(t),s.onload=()=>{if(!s.src.length)return;const e="true"!==s.dataset.ready;s.dataset.ready="true",this.resizeIframe(t),e?n.revealContent(t):n.hideLoading(t)},s.setAttribute("src",e),n.setContent(t,s,!1)}resizeIframe(t){const e=t.iframeEl,i=null==e?void 0:e.parentElement;if(!e||!i)return;let n=t.autoSize,s=t.width||0,o=t.height||0;s&&o&&(n=!1);const a=i&&i.style;if(!1!==t.preload&&!1!==n&&a)try{const t=window.getComputedStyle(i),n=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),r=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),l=e.contentWindow;if(l){const t=l.document,e=t.getElementsByTagName("html")[0],i=t.body;a.width="",i.style.overflow="hidden",s=s||e.scrollWidth+n,a.width=`${s}px`,i.style.overflow="",a.flex="0 0 auto",a.height=`${i.scrollHeight}px`,o=e.scrollHeight+r}}catch(t){}if(s||o){const t={flex:"0 1 auto",width:"",height:""};s&&(t.width=`${s}px`),o&&(t.height=`${o}px`),Object.assign(a,t)}}playVideo(){const t=this.instance.getSlide();if(!t)return;const{el:e}=t;if(!e||!e.offsetParent)return;if(!this.optionFor(t,"videoAutoplay"))return;if("html5video"===t.type)try{const t=e.querySelector("video");if(t){const e=t.play();void 0!==e&&e.then((()=>{})).catch((e=>{t.muted=!0,t.play()}))}}catch(t){}if("youtube"!==t.type&&"vimeo"!==t.type)return;const i=()=>{if(t.iframeEl&&t.iframeEl.contentWindow){let e;if("true"===t.iframeEl.dataset.ready)return e="youtube"===t.type?{event:"command",func:"playVideo"}:{method:"play",value:"true"},e&&t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"),void(t.poller=void 0);"youtube"===t.type&&(e={event:"listening",id:t.iframeEl.getAttribute("id")},t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"))}t.poller=setTimeout(i,250)};i()}processType(t){if(t.html)return t.type="html",t.src=t.html,void(t.html="");const e=this.instance.optionFor(t,"src","");if(!e||"string"!=typeof e)return;let i=t.type,n=null;if(n=e.match(/(?:youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const s=B(e,this.optionFor(t,"youtube")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://www.youtube-nocookie.com/embed/${o}?${s}`,t.thumbSrc=t.thumbSrc||`https://i.ytimg.com/vi/${o}/mqdefault.jpg`,i="youtube"}else if(n=e.match(/^.+vimeo.com\/(?:\/)?([\d]+)(.*)?/)){const s=B(e,this.optionFor(t,"vimeo")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://player.vimeo.com/video/${o}?${s}`,i="vimeo"}if(!i&&t.triggerEl){const e=t.triggerEl.dataset.type;N.includes(e)&&(i=e)}i||"string"==typeof e&&("#"===e.charAt(0)?i="inline":(n=e.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(i="html5video",t.videoFormat=t.videoFormat||"video/"+("ogv"===n[1]?"ogg":n[1])):e.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?i="image":e.match(/\.(pdf)((\?|#).*)?$/i)?i="pdf":(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src=`https://maps.google.${n[1]}/?ll=${(n[2]?n[2]+"&z="+Math.floor(parseFloat(n[3]))+(n[4]?n[4].replace(/^\//,"&"):""):n[4]+"").replace(/\?/,"&")}&output=${n[4]&&n[4].indexOf("layer=c")>0?"svembed":"embed"}`,i="map"):(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src=`https://maps.google.${n[1]}/maps?q=${n[2].replace("query=","q=").replace("api=1","")}&output=embed`,i="map")),t.type=i||this.instance.option("defaultType")}setContent(t){const e=this.instance.optionFor(t,"src")||"";if(t&&t.type&&e){switch(t.type){case"html":this.instance.setContent(t,e);break;case"html5video":const i=this.option("videoTpl");i&&this.instance.setContent(t,i.replace(/\{\{src\}\}/gi,e+"").replace(/\{\{format\}\}/gi,this.optionFor(t,"videoFormat")||"").replace(/\{\{poster\}\}/gi,t.poster||t.thumbSrc||""));break;case"inline":case"clone":this.setInlineContent(t);break;case"ajax":this.loadAjaxContent(t);break;case"pdf":case"map":case"youtube":case"vimeo":t.preload=!1;case"iframe":this.setIframeContent(t)}this.setAspectRatio(t)}}setAspectRatio(t){var e;const i=t.contentEl,n=this.optionFor(t,"videoRatio"),s=null===(e=t.el)||void 0===e?void 0:e.getBoundingClientRect();if(!(i&&s&&n&&1!==n&&t.type&&["video","youtube","vimeo","html5video"].includes(t.type)))return;const o=s.width,a=s.height;i.style.aspectRatio=n+"",i.style.width=o/a>n?"auto":"",i.style.height=o/a>n?"":"auto"}attach(){this.instance.on("Carousel.initSlides",this.onInitSlides),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("Carousel.selectSlide",this.onSelectSlide),this.instance.on("Carousel.unselectSlide",this.onUnselectSlide),this.instance.on("Carousel.Panzoom.refresh",this.onRefresh),this.instance.on("done",this.onDone),window.addEventListener("message",this.onMessage)}detach(){this.instance.off("Carousel.initSlides",this.onInitSlides),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("Carousel.selectSlide",this.onSelectSlide),this.instance.off("Carousel.unselectSlide",this.onUnselectSlide),this.instance.off("Carousel.Panzoom.refresh",this.onRefresh),this.instance.off("done",this.onDone),window.removeEventListener("message",this.onMessage)}}Object.defineProperty(W,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:_});const X=(t,e)=>{x(e).forEach((e=>{t&&t.classList.remove(e)}))};class $ extends f{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:"ready"}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return"ready"!==this.state}onReady(t){this.option("autoStart")&&(t.isInfinite||t.page{this.timer=null,this.inHover||this.onTimerEnd()}),e),t.style.transitionDuration=`${e}ms`,t.style.transform="scaleX(1)"}this.emit("set")}clear(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.removeProgressBar()}start(){if(this.set(),this.option("pauseOnHover")){const t=this.instance.container;t.addEventListener("mouseenter",this.onMouseEnter,!1),t.addEventListener("mouseleave",this.onMouseLeave,!1)}document.addEventListener("visibilitychange",this.onVisibilityChange,!1)}stop(){const t=this.instance.container;this.clear(),this.state="ready",t.removeEventListener("mouseenter",this.onMouseEnter,!1),t.removeEventListener("mouseleave",this.onMouseLeave,!1),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),X(t,"has-autoplay"),this.emit("stop")}pause(){"play"===this.state&&(this.state="pause",this.clear(),this.emit("pause"))}resume(){const t=this.instance;if(t.isInfinite||t.page!==t.pages.length-1)if("play"!==this.state){if("pause"===this.state&&!this.inHover){const t=new Event("resume",{bubbles:!0,cancelable:!0});this.emit("resume",event),t.defaultPrevented||this.set()}}else this.set();else this.stop()}toggle(){"play"===this.state||"pause"===this.state?this.stop():this.set()}attach(){this.instance.on("ready",this.onReady),this.instance.on("Panzoom.startAnimation",this.onChange),this.instance.on("Panzoom.endAnimation",this.onSettle),this.instance.on("Panzoom.touchMove",this.onChange)}detach(){this.instance.off("ready",this.onReady),this.instance.off("Panzoom.startAnimation",this.onChange),this.instance.off("Panzoom.endAnimation",this.onSettle),this.instance.off("Panzoom.touchMove",this.onChange),this.stop()}}Object.defineProperty($,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class Y extends f{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(t){const i=t.carousel;if(!i)return;const n=t.container;n&&(i.options.Autoplay=e(this.option("Autoplay")||{},{pauseOnHover:!1,autoStart:!1,timeout:this.option("timeout"),progressParentEl:()=>n.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]")||n,on:{set:e=>{var i;n.classList.add("has-slideshow"),(null===(i=t.getSlide())||void 0===i?void 0:i.state)!==d.Ready&&e.pause()},stop:()=>{n.classList.remove("has-slideshow"),t.isCompact||t.endIdle()},resume:(e,i)=>{var n,s,o;!i||!i.cancelable||(null===(n=t.getSlide())||void 0===n?void 0:n.state)===d.Ready&&(null===(o=null===(s=t.carousel)||void 0===s?void 0:s.panzoom)||void 0===o?void 0:o.isResting)||i.preventDefault()}}}),i.attachPlugins({Autoplay:$}),this.ref=i.plugins.Autoplay)}onReady(t){const e=t.carousel,i=this.ref;e&&i&&this.option("playOnStart")&&(e.isInfinite||e.page{t.isCurrentSlide(e)&&i.stop()})),t.isCurrentSlide(e)&&i.resume()}onKeydown(t,e){var i;const n=this.ref;n&&e===this.option("key")&&"BUTTON"!==(null===(i=document.activeElement)||void 0===i?void 0:i.nodeName)&&n.toggle()}attach(){this.instance.on("Carousel.init",this.onPrepare),this.instance.on("Carousel.ready",this.onReady),this.instance.on("done",this.onDone),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onPrepare),this.instance.off("Carousel.ready",this.onReady),this.instance.off("done",this.onDone),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(Y,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{key:" ",playOnStart:!1,timeout:3e3}});const q={classes:{container:"f-thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'',type:"modern"};var Z;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden",t[t.Disabled=3]="Disabled"}(Z||(Z={}));let V=class extends f{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"shouldCenter",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Z.Init})}formatThumb(t,e){return this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}getSlides(){const t=[],e=this.option("thumbTpl")||"";if(e)for(const i of this.instance.slides||[])t.push({html:this.formatThumb(i,e),customClass:`has-thumb for-${i.type||"image"}`});return t}getProgress(t){const e=this.instance,i=e.panzoom,n=e.pages[t]||0;if(!n||!i)return 0;let s=-1*i.current.e,o=e.contentDim,a=(s-n.pos)/(1*n.dim),r=(s+o-n.pos)/(1*n.dim),l=(s-o-n.pos)/(1*n.dim);return a=Math.max(0,Math.min(1,Math.abs(a))),r=Math.max(0,Math.min(1,Math.abs(r))),l=Math.max(0,Math.min(1,Math.abs(l))),a=Math.min(a,r,l),a}onInitSlide(t,e){const i=e.el;i&&(e.thumbSrc=i.dataset.thumbSrc||e.thumbSrc||"",e.thumbClipWidth=parseFloat(i.dataset.thumbClipWidth||"")||e.thumbClipWidth||0,e.thumbHeight=parseFloat(i.dataset.thumbHeight||"")||e.thumbHeight||0)}onInitSlides(){this.state===Z.Init&&this.build()}onRefreshM(){this.refreshModern()}onChangeM(){"modern"===this.type&&(this.shouldCenter=!0,this.centerModern())}onClickModern(t){t.preventDefault(),t.stopPropagation();const e=this.instance,i=e.page,n=t=>{if(t){const e=t.closest("[data-carousel-page]");if(e)return parseInt(e.dataset.carouselPage||"",10)||0}return-1},s=(t,e)=>{const i=document.elementFromPoint(t,e);return i?n(i):-1};let o=n(t.target);o<0&&(o=s(t.clientX+this.thumbGap,t.clientY),o===i&&(o=i-1)),o<0&&(o=s(t.clientX-this.thumbGap,t.clientY),o===i&&(o=i+1)),o<0&&(o=(e=>{let n=s(t.clientX-e,t.clientY),a=s(t.clientX+e,t.clientY);return o<0&&n===i&&(o=i+1),o<0&&a===i&&(o=i-1),o})(this.thumbExtraGap)),o===i?this.centerModern():o>-1&&o{this.emit("ready")}))}buildModern(){if("modern"!==this.type)return;const{container:t,track:e,instance:i}=this,s=this.option("thumbTpl")||"";if(!t||!e||!s)return;this.updateModern();for(const t of i.slides||[]){const i=document.createElement("div");F(i,this.cn("slide")),i.appendChild(n(this.formatThumb(t,s))),t.thumbSlideEl=i,e.appendChild(i),this.resizeModernSlide(t)}const o=new i.constructor.Panzoom(t,{content:e,lockAxis:"x",zoom:!1,panOnlyZoomed:!1,bounds:()=>{let t=0,e=0,n=i.slides[0],s=i.slides[i.slides.length-1],o=i.slides[i.page];return n&&s&&o&&(e=-1*this.getModernThumbPos(0),0!==i.page&&(e+=.5*(n.thumbWidth||0)),t=-1*this.getModernThumbPos(i.slides.length-1),i.page!==i.slides.length-1&&(t+=(s.thumbWidth||0)-(o.thumbWidth||0)-.5*(s.thumbWidth||0))),{x:{min:t,max:e},y:{min:0,max:0}}}});o.on("touchStart",(()=>{this.shouldCenter=!1})),o.on("click",((t,e)=>this.onClickModern(e))),o.on("ready",(()=>{this.centerModern(),this.emit("ready")})),o.on(["afterTransform","refresh"],(t=>{this.lazyLoadModern()})),this.panzoom=o,this.refreshModern()}updateModern(){if("modern"!==this.type)return;const{container:t}=this;t&&(this.thumbGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-gap"))||0,this.thumbExtraGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-extra-gap"))||0,this.thumbWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-width"))||40,this.thumbClipWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-clip-width"))||40,this.thumbHeight=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-height"))||40)}refreshModern(){var t;if("modern"===this.type){this.updateModern();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.onTransformM(),null===(t=this.panzoom)||void 0===t||t.updateMetrics(!0),this.centerModern(0)}}centerModern(t){const e=this.instance,{container:i,panzoom:n}=this;if(!i||!n||n.state===O.Init)return;const s=e.page;let o=this.getModernThumbPos(s),a=o;for(let t=e.page-3;te.pages.length-1||t===e.page)continue;const i=1-this.getProgress(t);i>0&&i<1&&(a+=i*(this.getModernThumbPos(t)-o))}let r=100;void 0===t&&(t=.2,e.inTransition.size>0&&(t=.12),Math.abs(-1*n.current.e-a)>n.containerRect.width&&(t=.5,r=0)),n.options.maxVelocity=r,n.applyChange({panX:y(-1*a-n.target.e,1e3),friction:null===e.prevPage?0:t})}lazyLoadModern(){const{instance:t,panzoom:e}=this;if(!e)return;const i=-1*e.current.e||0;let s=this.getModernThumbPos(t.page);if(e.state!==O.Init||0===s)for(const s of t.slides||[]){const t=s.thumbSlideEl;if(!t)continue;const o=t.querySelector("img[data-lazy-src]"),a=s.index,l=this.getModernThumbPos(a),c=i-.5*e.containerRect.innerWidth,h=c+e.containerRect.innerWidth;if(!o||lh)continue;let d=o.dataset.lazySrc;if(!d||!d.length)continue;if(delete o.dataset.lazySrc,o.src=d,o.complete)continue;F(t,this.cn("isLoading"));const u=n(r);t.appendChild(u),o.addEventListener("load",(()=>{t.offsetParent&&(t.classList.remove(this.cn("isLoading")),u.remove())}),!1)}}resizeModernSlide(t){if("modern"!==this.type)return;if(!t.thumbSlideEl)return;const e=t.thumbClipWidth&&t.thumbHeight?Math.round(this.thumbHeight*(t.thumbClipWidth/t.thumbHeight)):this.thumbWidth;t.thumbWidth=e}getModernThumbPos(t){const e=this.instance.slides[t],i=this.panzoom;if(!i||!i.contentRect.fitWidth)return 0;let n=i.containerRect.innerWidth,s=i.contentRect.width;2===this.instance.slides.length&&(t-=1,s=2*this.thumbClipWidth);let o=t*(this.thumbClipWidth+this.thumbGap)+this.thumbExtraGap+.5*(e.thumbWidth||0);return o-=s>n?.5*n:.5*s,y(o||0,1)}build(){const t=this.instance,e=t.container,i=this.option("minCount")||0;if(i){let e=0;for(const i of t.slides||[])i.thumbSrc&&e++;if(e{var e,i;this.hidden&&(null===(e=t.container)||void 0===e||e.classList.add("is-hidden"),null===(i=t.container)||void 0===i||i.setAttribute("aria-hidden","true"),queueMicrotask((()=>{this.show()})))}}}),i.attachPlugins({Thumbs:V}),this.ref=i.plugins.Thumbs,this.option("showOnStart")||(this.ref.state=Z.Hidden,this.hidden=!0))}onResize(){var t;const e=null===(t=this.ref)||void 0===t?void 0:t.container;e&&(e.style.height="")}onKeydown(t,e){const i=this.option("key");i&&i===e&&this.toggle()}toggle(){const t=this.ref;t&&t.state!==Z.Disabled&&(t.state!==Z.Hidden?this.hidden?this.show():this.hide():t.build())}show(){var t,e;const i=this.ref;i&&i.state!==Z.Disabled&&(this.refresh(),null===(t=i.container)||void 0===t||t.removeAttribute("aria-hidden"),null===(e=i.container)||void 0===e||e.classList.remove("is-hidden"),this.hidden=!1)}hide(){var t,e;const i=this.ref;i&&(this.refresh(),null===(t=i.container)||void 0===t||t.classList.add("is-hidden"),null===(e=i.container)||void 0===e||e.setAttribute("aria-hidden","true")),this.hidden=!0}refresh(){const t=this.ref;if(!t||t.state===Z.Disabled)return;const e=t.container,i=(null==e?void 0:e.firstChild)||null;e&&i&&i.childNodes.length&&(e.style.height=`${i.getBoundingClientRect().height}px`,e.offsetHeight)}attach(){this.instance.on("Carousel.init",this.onInit),this.instance.on("resize",this.onResize),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onInit),this.instance.off("resize",this.onResize),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(U,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:G});const K={panLeft:{icon:'',change:{panX:-100}},panRight:{icon:'',change:{panX:100}},panUp:{icon:'',change:{panY:-100}},panDown:{icon:'',change:{panY:100}},zoomIn:{icon:'',action:"zoomIn"},zoomOut:{icon:'',action:"zoomOut"},toggle1to1:{icon:'',action:"toggleZoom"},toggleZoom:{icon:'',action:"toggleZoom"},iterateZoom:{icon:'',action:"iterateZoom"},rotateCCW:{icon:'',action:"rotateCCW"},rotateCW:{icon:'',action:"rotateCW"},flipX:{icon:'',action:"flipX"},flipY:{icon:'',action:"flipY"},fitX:{icon:'',action:"fitX"},fitY:{icon:'',action:"fitY"},reset:{icon:'',action:"reset"},toggleFS:{icon:'',action:"toggleFS"}};var J;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Disabled=2]="Disabled"}(J||(J={}));const Q={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'
/
'},download:{tpl:''},prev:{tpl:''},next:{tpl:''},slideshow:{tpl:''},fullscreen:{tpl:''},thumbs:{tpl:''},close:{tpl:''}},parentEl:null},tt={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"};class et extends f{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:J.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(t){var e;if(!t.carousel)return;let i=this.option("display"),n=this.option("absolute"),s=this.option("enabled");if("auto"===s){const t=this.instance.carousel;let e=0;if(t)for(const i of t.slides)(i.panzoom||"image"===i.type)&&e++;e||(s=!1)}s||(i=void 0);let o=0;const a={left:[],middle:[],right:[]};if(i)for(const t of["left","middle","right"])for(const n of i[t]){const i=this.createEl(n);i&&(null===(e=a[t])||void 0===e||e.push(i),o++)}let r=null;if(o&&(r=this.createContainer()),r){for(const[t,e]of Object.entries(a)){const i=document.createElement("div");F(i,"fancybox__toolbar__column is-"+t);for(const t of e)i.appendChild(t);"auto"!==n||"middle"!==t||e.length||(n=!0),r.appendChild(i)}!0===n&&F(r,"is-absolute"),this.state=J.Ready,this.onRefresh()}else this.state=J.Disabled}onClick(t){var e,i;const n=this.instance,s=n.getSlide(),o=null==s?void 0:s.panzoom,a=t.target,r=a&&z(a)?a.dataset:null;if(!r)return;if(void 0!==r.fancyboxToggleThumbs)return t.preventDefault(),t.stopPropagation(),void(null===(e=n.plugins.Thumbs)||void 0===e||e.toggle());if(void 0!==r.fancyboxToggleFullscreen)return t.preventDefault(),t.stopPropagation(),void this.instance.toggleFullscreen();if(void 0!==r.fancyboxToggleSlideshow){t.preventDefault(),t.stopPropagation();const e=null===(i=n.carousel)||void 0===i?void 0:i.plugins.Autoplay;let s=e.isActive;return o&&"mousemove"===o.panMode&&!s&&o.reset(),void(s?e.stop():e.start())}const l=r.panzoomAction,c=r.panzoomChange;if((c||l)&&(t.preventDefault(),t.stopPropagation()),c){let t={};try{t=JSON.parse(c)}catch(t){}o&&o.applyChange(t)}else l&&o&&o[l]&&o[l]()}onChange(){this.onRefresh()}onRefresh(){const t=this.container;if(!t)return;const e=this.instance.getSlide();if(!e)return;const i=e&&e.panzoom;for(const e of t.querySelectorAll("[data-panzoom-action]"))i?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));let n=i&&i.canZoomIn(),s=i&&i.canZoomOut();this.instance.isOpeningSlide(e)||e&&e.state!==d.Ready&&(n=s=!0);for(const e of t.querySelectorAll('[data-panzoom-action="zoomIn"]'))n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="zoomOut"]'))s?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){s||n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));const t=e.querySelector("g");t&&(t.style.display=n?"":"none")}}onDone(t,e){var i;null===(i=e.panzoom)||void 0===i||i.on("afterTransform",(()=>{this.instance.isCurrentSlide(e)&&this.onRefresh()})),this.instance.isCurrentSlide(e)&&this.onRefresh()}createContainer(){const t=this.instance.container;if(!t)return null;const e=this.option("parentEl")||t,i=document.createElement("div");return F(i,"fancybox__toolbar"),e.prepend(i),i.addEventListener("click",this.onClick,{passive:!1,capture:!0}),t&&F(t,"has-toolbar"),this.container=i,i}createEl(t){var e;const i=this.instance.carousel;if(!i)return null;if("toggleFS"===t)return null;if("fullscreen"===t&&!this.instance.fsAPI)return null;let s=null;const o=i.slides.length||0;let a=0,r=0;for(const t of i.slides)(t.panzoom||"image"===t.type)&&a++,("image"===t.type||t.downloadSrc)&&r++;if(o<2&&["infobar","prev","next"].includes(t))return s;if(void 0!==K[t]&&!a)return null;if("download"===t&&!r)return null;if("thumbs"===t){const t=this.instance.plugins.Thumbs;if(!t||!t.isEnabled)return null}if("slideshow"===t){if(!(null===(e=this.instance.carousel)||void 0===e?void 0:e.plugins.Autoplay)||o<2)return null}if(void 0!==K[t]){const e=K[t];s=document.createElement("button"),s.setAttribute("title",this.instance.localize(`{{${t.toUpperCase()}}}`)),F(s,"f-button"),e.action&&(s.dataset.panzoomAction=e.action),e.change&&(s.dataset.panzoomChange=JSON.stringify(e.change)),s.appendChild(n(this.instance.localize(e.icon)))}else{const e=(this.option("items")||[])[t];e&&(s=n(this.instance.localize(e.tpl)),e.click&&s.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),"function"==typeof e.click&&e.click(t)})))}const l=null==s?void 0:s.querySelector("svg");if(l)for(const[t,e]of Object.entries(tt))l.getAttribute(t)||l.setAttribute(t,String(e));return s}removeContainer(){var t;const e=this.container;e&&e.removeEventListener("click",this.onClick,{passive:!1,capture:!0}),null===(t=this.container)||void 0===t||t.remove(),this.container=null,this.state=J.Disabled;const i=this.instance.container;i&&X(i,"has-toolbar")}attach(){this.instance.on("Carousel.initSlides",this.onReady),this.instance.on("done",this.onDone),this.instance.on("reveal",this.onChange),this.instance.on("Carousel.change",this.onChange),this.onReady(this.instance)}detach(){this.instance.off("Carousel.initSlides",this.onReady),this.instance.off("done",this.onDone),this.instance.off("reveal",this.onChange),this.instance.off("Carousel.change",this.onChange),this.removeContainer()}}Object.defineProperty(et,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:Q});const it={Hash:b,Html:W,Images:H,Slideshow:Y,Thumbs:U,Toolbar:et},nt=(t,e)=>{let i=[];return t.childNodes.forEach((t=>{t.nodeType!==Node.ELEMENT_NODE||e&&!t.matches(e)||i.push(t)})),i},st={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var ot;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"}(ot||(ot={}));const at=t=>{if("string"==typeof t&&(t={html:t}),!(t instanceof String||t instanceof HTMLElement)){const e=t.thumb;void 0!==e&&("string"==typeof e&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},rt=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t),lt={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'',dynamicFrom:11,maxCount:1/0,minCount:2};class ct extends f{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let t=this.list;return t||(t=document.createElement("ul"),F(t,this.cn("list")),t.setAttribute("role","tablist"),this.instance.container.appendChild(t),F(this.instance.container,this.cn("hasDots")),this.list=t),t}refresh(){var t;const e=this.instance.pages.length,i=Math.min(2,this.option("minCount")),n=Math.max(2e3,this.option("maxCount")),s=this.option("dynamicFrom");if(en)return void this.cleanup();const o="number"==typeof s&&e>5&&e>=s,a=!this.list||this.isDynamic!==o||this.list.children.length!==e;a&&this.cleanup();const r=this.build();if(S(r,this.cn("isDynamic"),!!o),a)for(let t=0;t=e-1&&s.setAttribute("disabled","")))}createButton(t){const e=this.instance,i=document.createElement("button");i.setAttribute("tabindex","0"),i.setAttribute("title",e.localize(`{{${t.toUpperCase()}}}`)),F(i,this.cn("button")+" "+this.cn("next"===t?"isNext":"isPrev"));const n=e.isRTL?"next"===t?"prev":"next":t;var s;return i.innerHTML=e.localize(this.option(`${n}Tpl`)),i.dataset[`carousel${s=t,s?s.match("^[a-z]")?s.charAt(0).toUpperCase()+s.substring(1):s:""}`]="true",i}build(){let t=this.container;t||(this.container=t=document.createElement("div"),F(t,this.cn("container")),this.instance.container.appendChild(t)),this.next||(this.next=t.appendChild(this.createButton("next"))),this.prev||(this.prev=t.appendChild(this.createButton("prev")))}cleanup(){this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove(),this.prev=null,this.next=null,this.container=null}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(ht,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'',prevTpl:''}});class dt extends f{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){this.nav&&this.target&&(this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.state===ot.Ready&&this.onNavReady(this.nav),this.target.on("ready",this.onTargetReady),this.target.state===ot.Ready&&this.onTargetReady(this.target))}onNavReady(t){t.on("createSlide",this.onNavCreateSlide),t.on("Panzoom.click",this.onNavClick),this.onTargetChange()}onTargetReady(t){t.on("change",this.onTargetChange),t.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(t,e,i){var n,s;const o=i.target,{nav:a,target:r}=this;if(!a||!r||!o)return;const l=o.closest("[data-index]");if(!l)return;i.stopPropagation();const c=parseInt(l.dataset.index||"",10)||0,h=a.getPageForSlide(c);a.page!==h&&a.slideTo(h);const d=r.getPageForSlide(c);r.page!==d&&r.slideTo(d,{friction:null===(s=null===(n=this.nav)||void 0===n?void 0:n.plugins)||void 0===s?void 0:s.Sync.option("friction")}),this.markSelectedSlide(c)}onNavCreateSlide(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}onTargetChange(){const{target:t,nav:e}=this;if(!t||!e)return;if(e.state!==ot.Ready||t.state!==ot.Ready)return;const i=t.pages[t.page].slides[0].index,n=e.getPageForSlide(i);e.slideTo(n),this.markSelectedSlide(i)}markSelectedSlide(t){const{nav:e}=this;if(!e)return;this.selectedIndex=t,[...e.slides].filter((t=>t.el&&t.el.classList.remove("is-nav-selected")));const i=e.slides[t];i&&i.el&&i.el.classList.add("is-nav-selected")}attach(){let t=this.options.target,e=this.options.nav;t?this.addAsNavFor(t):e&&this.addAsTargetFor(e)}detach(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.nav=null,this.target&&(this.target.off("ready",this.onTargetReady),this.target.off("refresh",this.onTargetChange),this.target.off("change",this.onTargetChange)),this.target=null}}Object.defineProperty(dt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const ut={Navigation:ht,Dots:ct,Sync:dt};class pt extends m{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===ot.Ready}get isInfinite(){let t=!1;const e=this.contentDim,i=this.viewportDim;return this.pages.length>=2&&e>1.5*i&&(t=this.option("infinite")),t}get isRTL(){return"rtl"===this.option("direction")}get isHorizontal(){return"x"===this.option("axis")}constructor(t,e={},n={}){if(super(),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:ot.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),"string"==typeof t&&(t=document.querySelector(t)),!t||!z(t))throw new Error("No Element found");this.container=t,this.slideNext=i(this.slideNext.bind(this),175),this.slidePrev=i(this.slidePrev.bind(this),175),this.userOptions=e,this.userPlugins=n,queueMicrotask((()=>{this.processOptions()}))}processOptions(){const i=e({},pt.defaults,this.userOptions);let n="";const s=i.breakpoints;if(s&&t(s))for(const[o,a]of Object.entries(s))window.matchMedia(o).matches&&t(a)&&(n+=o,e(i,a));n===this.bp&&this.state!==ot.Init||(this.bp=n,this.state===ot.Ready&&(i.initialSlide=this.pages[this.page].slides[0].index),this.state!==ot.Init&&this.destroy(),super.setOptions(i),!1===this.option("enabled")?this.attachEvents():setTimeout((()=>{this.init()}),0))}init(){this.state=ot.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},pt.Plugins),this.userPlugins)),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=ot.Ready,this.emit("ready")}initLayout(){const{container:t}=this,e=this.option("classes");F(t,this.cn("container")),S(t,e.isLTR,!this.isRTL),S(t,e.isRTL,this.isRTL),S(t,e.isVertical,!this.isHorizontal),S(t,e.isHorizontal,this.isHorizontal);let i=this.option("viewport")||t.querySelector(`.${e.viewport}`);i||(i=document.createElement("div"),F(i,e.viewport),i.append(...nt(t,`.${e.slide}`)),t.prepend(i));let n=this.option("track")||t.querySelector(`.${e.track}`);n||(n=document.createElement("div"),F(n,e.track),n.append(...Array.from(i.childNodes))),n.setAttribute("aria-live","polite"),i.contains(n)||i.prepend(n),this.viewport=i,this.track=n,this.emit("initLayout")}initSlides(){const{track:t}=this;if(t){this.slides=[],[...nt(t,`.${this.cn("slide")}`)].forEach((t=>{if(z(t)){const e=at({el:t,isDom:!0,index:this.slides.length});this.slides.push(e),this.emit("initSlide",e,this.slides.length)}}));for(let t of this.option("slides",[])){const e=at(t);e.index=this.slides.length,this.slides.push(e),this.emit("initSlide",t,this.slides.length)}this.emit("initSlides")}}setInitialPage(){let t=0;const e=this.option("initialSlide");t="number"==typeof e?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0,this.page=t}setInitialPosition(){if(!this.track||!this.pages.length)return;let t=this.page;this.pages[t]||(this.page=t=0);const e=this.pages[t].pos*(this.isRTL&&this.isHorizontal?1:-1),i=this.isHorizontal?`${e}px`:"0",n=this.isHorizontal?"0":`${e}px`;this.track.style.transform=`translate3d(${i}, ${n}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const t=this.option("Panzoom")||{};this.panzoom=new D(this.viewport,e({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,decelFriction:.12,click:!1,dblClick:!1,touch:t=>!(this.pages.length<2&&!t.options.infinite),bounds:()=>this.getBounds(),maxVelocity:t=>Math.abs(t.target[this.axis]-t.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on("*",((t,e,...i)=>{this.emit(`Panzoom.${e}`,t,...i)})),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation),this.panzoom.on("touchStart",((t,e)=>{this.inTransition.size&&e.preventDefault()}))}attachEvents(){const t=this.container;t&&(t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let t=[];const{contentDim:e,viewportDim:i}=this,n=this.option("slidesPerPage");if("number"==typeof n&&e>i){for(let e=0;ei)&&(t.push(rt()),s=t.length-1,o=0),o+=e.dim+e.gap,t[s].slides.push(e);return t}processPages(){const t=this.pages,{contentDim:e,viewportDim:i}=this,n=this.option("center"),s=this.option("fill");if(t.forEach(((t,e)=>{t.index=e,t.pos=t.slides[0].pos,t.dim=0;for(const[e,i]of t.slides.entries())t.dim+=i.dim,e{s&&!this.isInfinite&&e>i&&(t.pos=Math.max(t.pos,0),t.pos=Math.min(t.pos,e-i)),t.pos=y(t.pos,1e3),t.dim=y(t.dim,1e3)})),this.isInfinite)return t;const o=[];let a;return t.forEach((t=>{const e=Object.assign({},t);a&&e.pos===a.pos?(a.dim+=e.dim,a.slides=[...a.slides,...e.slides]):(e.index=o.length,a=e,o.push(e))})),o}getPageFromIndex(t=0){const e=this.pages.length;let i;return t=parseInt((t||0).toString())||0,i=this.isInfinite?(t%e+e)%e:Math.max(Math.min(t,this.pages.length-1),0),i}getSlideMetrics(t){const e=this.isHorizontal?"width":"height";let i=0,n=0,s=t.el;s?i=parseFloat(s.dataset[e]||"")||0:(s=document.createElement("div"),s.style.visibility="hidden",F(s,this.cn("slide")+" "+t.class),(this.track||document.body).prepend(s)),i?(s.style[e]=`${i}px`,s.style["width"===e?"height":"width"]=""):i=s.getBoundingClientRect()[e];const o=getComputedStyle(s);return"content-box"===o.boxSizing&&(this.isHorizontal?(i+=parseFloat(o.paddingLeft)||0,i+=parseFloat(o.paddingRight)||0):(i+=parseFloat(o.paddingTop)||0,i+=parseFloat(o.paddingBottom)||0)),n=parseFloat(o[this.isHorizontal?"marginRight":"marginBottom"])||0,this.isHorizontal,t.el||s.remove(),{dim:i,gap:n}}getBounds(){let t={min:0,max:0};if(this.isInfinite)t={min:-1/0,max:1/0};else if(this.pages.length){const e=this.pages[0].pos,i=this.pages[this.pages.length-1].pos;t=this.isRTL&&this.isHorizontal?{min:e,max:i}:{min:-1*i,max:-1*e}}return{x:this.isHorizontal?t:{min:0,max:0},y:this.isHorizontal?{min:0,max:0}:t}}repositionSlides(){const{viewportDim:t,contentDim:e,page:i,pages:n}=this;let s,o=0,a=0,r=0,l=0;this.panzoom?l=-1*this.panzoom.current[this.isHorizontal?"e":"f"]:n[i]&&(l=n[i].pos||0),s=this.isHorizontal?this.isRTL?"right":"left":"top",this.isRTL&&this.isHorizontal&&(l*=-1);for(const t of this.slides)t.el?("top"===s?(t.el.style.right="",t.el.style.left=""):t.el.style.top="",t.index!==o?t.el.style[s]=0===a?"":`${a}px`:t.el.style[s]="",r+=t.dim+t.gap,o++):a+=t.dim+t.gap;if(this.isInfinite&&r)for(const i of this.slides)i.el&&(y(i.pos)y(e-t)&&(i.el.style[s]=`${a+r}px`),y(i.pos+i.gap)>=y(e-t)&&y(i.pos)>y(l+t)&&y(l)1&&(c=this.pages[d[0]],h=this.pages[d[1]]),c&&h){let t=0;for(const e of this.slides)e.el?this.inTransition.has(e.index)&&c.slides.indexOf(e)<0&&(e.el.style[s]=`${t+(c.pos-h.pos)}px`):t+=e.dim+e.gap}}createSlideEl(t){if(!this.track||!t)return;if(t.el)return;const e=document.createElement("div");F(e,this.cn("slide")),F(e,t.class),t.html&&(e.innerHTML=t.html);const i=[];this.slides.forEach(((t,e)=>{t.el&&i.push(e)}));const n=t.index;let s=null;if(i.length){let t=i.reduce(((t,e)=>Math.abs(e-n)this.page?1:-1,a=this.pages[s].pos*(this.isRTL?1:-1);if(this.page===s&&a===n.target[this.axis])return!1;this.clearTransitions();const r=n.isResting;F(this.container,this.cn("inTransition"));const l=this.pages[this.page].slides[0],c=this.pages[s].slides[0];this.inTransition.add(c.index),this.createSlideEl(c);let h=l.el,d=c.el;r||"slide"===e||(e="fadeFast",h=null);const u=this.isRTL?"next":"prev",p=this.isRTL?"prev":"next";return h&&(this.inTransition.add(l.index),l.transition=e,h.addEventListener("animationend",this.onAnimationEnd),h.classList.add(`f-${e}Out`,`to-${o>0?p:u}`)),d&&(c.transition=e,d.addEventListener("animationend",this.onAnimationEnd),d.classList.add(`f-${e}In`,`from-${o>0?u:p}`)),n.panTo({x:this.isHorizontal?a:0,y:this.isHorizontal?0:a,friction:0}),this.onChange(s),!0}manageSlideVisiblity(){const t=new Set,e=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const n of this.slides)i.has(n)?t.add(n):e.add(n);for(const e of this.inTransition)t.add(this.slides[e]);for(const e of t)this.createSlideEl(e),this.lazyLoadSlide(e);for(const i of e)t.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t="aria-hidden";let e=this.cn("isSelected");if(e)for(const i of this.slides)i.el&&(i.el.dataset.index=`${i.index}`,this.pages[this.page].slides.includes(i)?(i.el.classList.contains(e)||(F(i.el,e),this.emit("selectSlide",i)),i.el.removeAttribute(t)):(i.el.classList.contains(e)&&(X(i.el,e),this.emit("unselectSlide",i)),i.el.setAttribute(t,"true")))}flipInfiniteTrack(){const t=this.panzoom;if(!t||!this.isInfinite)return;const e="x"===this.option("axis")?"e":"f",{viewportDim:i,contentDim:n}=this;let s=t.current[e],o=t.target[e]-s,a=0,r=.5*i,l=n;this.isRTL&&this.isHorizontal?(s<-r&&(a=-1,s+=l),s>l-r&&(a=1,s-=l)):(s>r&&(a=1,s-=l),s<-l+r&&(a=-1,s+=l)),a&&(t.current[e]=s,t.target[e]=s+o)}lazyLoadSlide(t){const e=this,i=t&&t.el;if(!i)return;const s=new Set;i.querySelectorAll("[data-lazy-srcset]").forEach((t=>{t instanceof HTMLImageElement&&s.add(t)})),i.querySelectorAll("[data-lazy-src]").forEach((t=>{t instanceof HTMLImageElement?s.add(t):z(t)&&(t.style.backgroundImage=`url('${t.dataset.lazySrc||""}')`)}));const o=(t,i,n)=>{n&&(n.remove(),n=null),i.complete&&(i.style.display=""),this.option("adaptiveHeight")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&e.setViewportHeight()};for(const e of s){let i=null;e.src=e.dataset.lazySrcset||e.dataset.lazySrc||"",delete e.dataset.lazySrc,delete e.dataset.lazySrcset,e.style.display="none",e.addEventListener("error",(()=>{o(t,e,i)})),e.addEventListener("load",(()=>{o(t,e,i)})),setTimeout((()=>{!e.complete&&e.parentNode&&t.el&&(i=n(r),e.parentNode.insertBefore(i,e))}),300)}let a=i.dataset.lazySrc;a&&a.length&&(i.style.backgroundImage=`url('${a}')`)}clearTransitions(){this.inTransition.clear(),X(this.container,this.cn("inTransition"));const t=["to-prev","to-next","from-prev","from-next"];for(const e of this.slides){const i=e.el;if(i){i.removeEventListener("animationend",this.onAnimationEnd),i.classList.remove(...t);const n=e.transition;n&&i.classList.remove(`f-${n}Out`,`f-${n}In`)}}this.manageSlideVisiblity()}onAnimationEnd(t){const e=t.target,i=e?parseInt(e.dataset.index||"",10)||0:-1,n=this.slides[i],s=t.animationName;if(!e||!n||!s)return;const o=!!this.inTransition.has(i)&&n.transition;o&&s.substring(0,o.length+2)===`f-${o}`&&this.inTransition.delete(i),this.inTransition.size||this.clearTransitions(),i===this.page&&this.emit("settle")}onDecel(t,e=0,i=0){const n=this.isInfinite,s=this.isHorizontal?e:i,o=this.pages.length;if(!o)return;const a=this.option("dragFree");let r=this.page,l=0;const c=this.axis;!n&&(t.target[c],this.viewportDim);const h=t.current[c]*(this.isRTL&&this.isHorizontal?1:-1);let{pageIndex:d}=this.getPageFromPosition(h);if(a||Math.abs(s)<10){const e=t.target[c]*(this.isRTL&&this.isHorizontal?1:-1),{pageIndex:i}=this.getPageFromPosition(e);r=i}else r=this.isRTL&&this.isHorizontal?s<0?d-1:d+1:s<0?d+1:d-1,n||(r=Math.max(0,Math.min(r,this.pages.length-1)));if(n&&(l=Math.floor(r/o)||0),r=(r%o+o)%o,a&&t.dragOffset["e"===c?"x":"y"]);else{const e=this.contentDim;let i=(this.pages[r].pos+l*e)*(this.isRTL&&this.isHorizontal?1:-1);if(Math.abs(t.target[c]-i)<.1&&t.lockedAxis===("e"==c?"y":"x"))return;if(t.target[c]===i)return;t.applyChange({panX:this.isHorizontal?i-t.target.e:0,panY:this.isHorizontal?0:i-t.target.f,friction:t.option("decelFriction")})}r!==this.page&&this.onChange(r)}onClick(t){const e=t.target,i=e&&z(e)?e.dataset:null;let n;i&&(void 0!==i.carouselPage?n="slideTo":void 0!==i.carouselNext?n="slideNext":void 0!==i.carouselPrev&&(n="slidePrev")),n?(t.preventDefault(),t.stopPropagation(),e&&!e.hasAttribute("disabled")&&this[n](i&&"slideTo"===n?i.carouselPage:void 0)):this.emit("click",t)}onSlideTo(t){const e=t.detail||0;this.slideTo(this.getPageForSlide(e),{friction:0})}onChange(t,e=0){const i=this.page;this.prevPage=i,this.page=t,this.option("adaptiveHeight")&&this.setViewportHeight(),this.emit("change",t,i,e)}onRefresh(t,e=""){let i=this.contentDim,n=this.viewportDim;this.updateMetrics(),this.contentDim===i&&this.viewportDim===n||this.slideTo(this.page,{friction:0,transition:!1})}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(){this.flipInfiniteTrack(),this.manageSlideVisiblity()}onEndAnimation(){this.emit("settle")}reInit(t=null,e=null){this.destroy(),this.state=ot.Init,this.userOptions=t||this.userOptions,this.userPlugins=e||this.userPlugins,this.processOptions()}slideTo(t=0,{friction:e=this.option("friction"),transition:i=this.option("transition")}={}){const n=this.panzoom,s=this.pages.length;if(!n||!s)return;if(this.transitionTo(t,i))return;const o=this.axis,a=this.getPageFromIndex(t);let r=this.pages[a].pos,l=0;if(this.isInfinite){const t=n.current[o]*(this.isRTL&&this.isHorizontal?1:-1),e=this.contentDim,i=r+e,s=r-e;Math.abs(t-i){t.el&&(s=Math.max(s,t.el.offsetHeight))}))),i.style.height=s?`${s}px`:""}getPageForSlide(t){for(const e of this.pages)for(const i of e.slides)if(i.index===t)return e.index;return-1}getVisibleSlides(t=0){var e;const i=new Set;let{contentDim:n,viewportDim:s,pages:o,page:a}=this;n=n+(null===(e=this.slides[this.slides.length-1])||void 0===e?void 0:e.gap)||0;let r=0;r=this.panzoom?-1*this.panzoom.current[this.axis]:o[a]&&o[a].pos||0,this.isInfinite&&(r-=Math.floor(r/n)*n),this.isRTL&&this.isHorizontal&&(r*=-1),r=y(r,1e3);const l=y(r-s*t,1e3),c=y(r+s*(t+1),1e3),h=this.isInfinite?[-1,0,1]:[0];for(const t of this.slides)for(const e of h){const s=t.pos+e*n,o=t.pos+t.dim+t.gap+e*n;sl&&i.add(t)}return i}getPageFromPosition(t){const{viewportDim:e,contentDim:i}=this,n=this.pages.length;let s=0,o=0;const a=this.option("center");a&&(t+=.5*e),this.isInfinite||(t=Math.max(this.slides[0].pos,Math.min(t,this.slides[this.slides.length-1].pos)));const r=i+this.slides[this.slides.length-1].gap,l=Math.floor(t/r)||0;t-=l*r;let c=this.slides[this.slides.length-1],h=this.slides.find((e=>{const i=t+(c&&!a?.5*c.dim:0);return c=e,e.pos<=i&&e.pos+e.dim+e.gap>i}));return h||(h=this.slides[this.slides.length-1]),o=this.getPageForSlide(h.index),s=o+l*n,{page:s,pageIndex:o}}destroy(){if([ot.Destroy].includes(this.state))return;this.state=ot.Destroy;const{container:t,viewport:e,track:i,slides:n,panzoom:s}=this,o=this.option("classes");t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),t.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),s&&(s.destroy(),this.panzoom=null),n&&n.forEach((t=>{this.removeSlideEl(t)})),this.detachPlugins(),this.track=null,this.viewport=null,this.page=0,e&&i&&e.replaceWith(...i.childNodes);for(const[e,i]of Object.entries(o))"container"!==e&&i&&t.classList.remove(i);this.slides=[];const a=this.events.get("ready");this.events=new Map,a&&this.events.set("ready",a)}}Object.defineProperty(pt,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:D}),Object.defineProperty(pt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:st}),Object.defineProperty(pt,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:ut});let mt=null,ft=null;const gt=new Map;let bt=0;class vt extends m{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(t=[],e={},n={}){super(e),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:h.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fsAPI",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.onWheel=i(this.onWheel.bind(this),300),this.fsAPI=(()=>{let t,e="",i="",n="";return document.fullscreenEnabled?(e="requestFullscreen",i="exitFullscreen",n="fullscreenElement"):document.webkitFullscreenEnabled&&(e="webkitRequestFullscreen",i="webkitExitFullscreen",n="webkitFullscreenElement"),e&&(t={request:function(t){return"webkitRequestFullscreen"===e?t[e](Element.ALLOW_KEYBOARD_INPUT):t[e]()},exit:function(){return document[n]&&document[i]()},isFullscreen:function(){return document[n]}}),t})(),this.id=e.id||++bt,gt.set(this.id,this),this.userSlides=t,this.userPlugins=n,queueMicrotask((()=>{this.init()}))}init(){this.state=h.Init,this.attachPlugins(Object.assign(Object.assign({},vt.Plugins),this.userPlugins)),this.emit("init"),!0===this.option("hideScrollbar")&&(()=>{if(!s)return;if(document.body.classList.contains("compensate-for-scrollbar"))return;const t=window.innerWidth-document.documentElement.getBoundingClientRect().width;document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",`${t}px`),t&&document.body.classList.add("compensate-for-scrollbar")})(),this.initLayout();const t=()=>{this.initCarousel(this.userSlides),this.state=h.Ready,this.attachEvents(),this.emit("ready"),setTimeout((()=>{this.container&&this.container.setAttribute("aria-hidden","false")}),16)};this.option("Fullscreen.autoStart")&&this.fsAPI&&!this.fsAPI.isFullscreen()?this.fsAPI.request(this.container).then((()=>t())).catch((()=>t())):t()}initLayout(){const t=this.option("parentEl")||document.body,e=n(this.localize(this.option("tpl.main")||""));e&&(e.setAttribute("id",`fancybox-${this.id}`),e.setAttribute("aria-label",this.localize("{{MODAL}}")),e.classList.toggle("is-compact",this.isCompact),this.container=e,this.footer=e.querySelector(".fancybox__footer"),t.appendChild(e),document.documentElement.classList.add("with-fancybox"),mt&&ft||(mt=document.createElement("button"),mt.classList.add("fancybox-focus-guard"),mt.setAttribute("aria-hidden","true"),mt.setAttribute("type","button"),ft=mt.cloneNode(),document.body.prepend(mt),document.body.append(ft)),this.option("animated")&&(e.classList.add("is-animated"),setTimeout((()=>{this.isClosing()||e.classList.remove("is-animated")}),350)),this.emit("initLayout"))}initCarousel(t){const i=this.container;if(!i)return;const n=i.querySelector(".fancybox__carousel");if(!n)return;const s=this.carousel=new pt(n,e({},{slides:t,transition:"fade",Panzoom:{lockAxis:this.option("dragToClose")?"xy":"x",infinite:!!this.option("dragToClose")&&"y"},Dots:!1,Navigation:{classes:{container:"fancybox__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"}},initialPage:this.option("startIndex"),l10n:this.option("l10n")},this.option("Carousel")||{}));s.on("*",((t,e,...i)=>{this.emit(`Carousel.${e}`,t,...i)})),s.on(["ready","change"],(()=>{this.manageCaption(this.getSlide())})),s.on("removeSlide",((t,e)=>{e.closeBtnEl&&e.closeBtnEl.remove(),e.closeBtnEl=void 0,e.captionEl&&e.captionEl.remove(),e.captionEl=void 0,e.spinnerEl&&e.spinnerEl.remove(),e.spinnerEl=void 0,e.state=void 0})),s.on("Panzoom.touchStart",(()=>{this.isCompact||this.endIdle()})),s.on("settle",(()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&this.checkFocus()})),this.option("dragToClose")&&(s.on("Panzoom.afterTransform",((t,e)=>{const i=this.container;if(i){const t=Math.abs(e.current.f),n=t<1?"":Math.max(.5,Math.min(1,1-t/e.contentRect.fitHeight*1.5));i.style.setProperty("--fancybox-ts",n?"0s":""),i.style.setProperty("--fancybox-opacity",n+"")}})),s.on("Panzoom.touchEnd",((t,e,i)=>{const n=Math.abs(e.dragOffset.y);"y"===e.lockedAxis&&(n>=200||n>=50&&e.dragOffset.time<300)&&(i&&i.cancelable&&i.preventDefault(),this.close(i,"f-throwOut"+(e.current.f<0?"Up":"Down")))}))),s.on(["change"],(t=>{var e;let i=null===(e=this.getSlide())||void 0===e?void 0:e.triggerEl;if(i){const e=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:t.page});i.dispatchEvent(e)}})),s.on(["refresh","change"],(t=>{const e=this.container;if(!e)return;for(const i of e.querySelectorAll("[data-fancybox-current-index]"))i.innerHTML=t.page+1;for(const i of e.querySelectorAll("[data-fancybox-count]"))i.innerHTML=t.pages.length;if(!t.isInfinite){for(const i of e.querySelectorAll("[data-fancybox-next]"))t.page0?(i.removeAttribute("disabled"),i.removeAttribute("tabindex")):(i.setAttribute("disabled",""),i.setAttribute("tabindex","-1"))}const i=this.getSlide();let n=(null==i?void 0:i.downloadSrc)||"";n||!i||"image"!==i.type||i.error||"string"!=typeof i.src||(n=i.src);for(const t of e.querySelectorAll("[data-fancybox-download]"))n?(t.removeAttribute("disabled"),t.removeAttribute("tabindex"),t.setAttribute("href",n),t.setAttribute("download",n),t.setAttribute("target","_blank")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"),t.removeAttribute("href"),t.removeAttribute("download"))})),this.emit("initCarousel")}attachEvents(){const t=this.container;t&&(t.addEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),document.addEventListener("mousemove",this.onMousemove),window.addEventListener("resize",this.onResize),this.option("trapFocus")&&document.addEventListener("focus",this.onFocus,!0),document.addEventListener("keydown",this.onKeydown,!0),document.addEventListener("visibilitychange",this.onVisibilityChange,!1))}detachEvents(){const t=this.container;t&&(t.removeEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),document.removeEventListener("mousemove",this.onMousemove),window.removeEventListener("resize",this.onResize),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),document.removeEventListener("focus",this.onFocus,!0),document.removeEventListener("keydown",this.onKeydown,!0))}onClick(t){var e;if(this.isClosing())return;!this.isCompact&&this.option("idle")&&this.resetIdle();const i=t.composedPath()[0];if(i===(null===(e=this.carousel)||void 0===e?void 0:e.container))return;if(i.closest(".f-spinner")||i.closest("[data-fancybox-close]"))return t.preventDefault(),void this.close(t);if(i.closest("[data-fancybox-prev]"))return t.preventDefault(),void this.prev();if(i.closest("[data-fancybox-next]"))return t.preventDefault(),void this.next();if(this.isCompact)return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout((()=>{this.toggleIdle(),this.clickTimer=null}),350));if(this.emit("click",t),t.defaultPrevented)return;let n=!1;const s=document.activeElement;if(i.closest(".fancybox__content")){if(s){if(s.closest("[contenteditable]"))return;i.matches(a)||s.blur()}if((o=window.getSelection())&&"Range"===o.type)return;n=this.option("contentClick")}else i.closest(".fancybox__carousel")&&!i.matches(a)&&(n=this.option("backdropClick"));var o;"close"===n?(t.preventDefault(),this.close(t)):"next"===n?(t.preventDefault(),this.next()):"prev"===n&&(t.preventDefault(),this.prev())}onWheel(t){if(this.emit("wheel",t),t.defaultPrevented)return;const e=this.option("wheel",t);if("close"===e)t.preventDefault(),this.close(t);else if("slide"===e){const e=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail));t.preventDefault(),this[e>0?"next":"prev"]()}}onKeydown(t){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const e=t.key,i=this.option("keyboard");if(!i||t.ctrlKey||t.altKey||t.shiftKey)return;const n=t.composedPath()[0],s=document.activeElement&&document.activeElement.classList,o=s&&s.contains("f-button");if("Escape"!==e&&!o&&z(n)){if(n.isContentEditable||-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(n.nodeName))return}this.emit("keydown",e,t);const a=i[e];"function"==typeof this[a]&&this[a]()}onResize(){const t=this.container;if(!t)return;const e=this.isCompact;t.classList.toggle("is-compact",e),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.emit("resize")}onFocus(t){this.isTopmost()&&this.focus(t)}onMousemove(t){this.prevMouseMoveEvent=t,!this.isCompact&&this.option("idle")&&this.resetIdle()}onVisibilityChange(){"visible"===document.visibilityState?this.checkFocus():this.endIdle()}manageCloseBtn(t){const e=this.optionFor(t,"closeButton")||!1;if("auto"===e){const t=this.plugins.Toolbar;if(t&&t.state===J.Ready)return}if(!e)return;if(!t.contentEl||t.closeBtnEl)return;const i=n(this.localize(this.option("tpl.closeButton")));t.closeBtnEl=t.contentEl.appendChild(i),t.el&&F(t.el,"has-close-btn")}manageCaption(t){var e,i,n;const s=this.container;if(!s)return;const o=this.isCompact||this.option("commonCaption"),a=!o;if(this.caption&&this.stop(this.caption),a&&this.caption&&(this.caption.remove(),this.caption=null),o&&!this.caption)for(const t of(null===(e=this.carousel)||void 0===e?void 0:e.slides)||[])t.captionEl&&(t.captionEl.remove(),t.captionEl=void 0,null===(i=t.el)||void 0===i||i.classList.remove("has-caption"),null===(n=t.el)||void 0===n||n.removeAttribute("aria-labelledby"));if(t||(t=this.getSlide()),!t||o&&!this.isCurrentSlide(t))return;const r=t.el;let l=this.optionFor(t,"caption","");if("string"!=typeof l||!l.length)return void(o&&this.caption&&this.animate(this.caption,"f-fadeOut",(()=>{var t;null===(t=this.caption)||void 0===t||t.remove(),this.caption=null})));let c=null;if(a){if(c=t.captionEl||null,r&&!c){const e=`fancybox__caption_${this.id}_${t.index}`;c=document.createElement("div"),c.className="fancybox__caption",c.setAttribute("id",e),t.captionEl=r.appendChild(c),r.classList.add("has-caption"),r.setAttribute("aria-labelledby",e)}}else{if(c=this.caption,c||(c=s.querySelector(".fancybox__caption")),!c){c=document.createElement("div"),c.dataset.fancyboxCaption="",c.className="fancybox__caption",c.innerHTML=l;(this.footer||s).prepend(c)}s.classList.add("has-caption"),this.caption=c}c&&(c.innerHTML=l)}checkFocus(){var t;const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}focus(t){var e;if(this.ignoreFocusChange)return;const i=document.activeElement||null,n=(null==t?void 0:t.target)||null,r=this.container,l=this.getSlide();if(!r||!(null===(e=this.carousel)||void 0===e?void 0:e.viewport))return;const c=l&&l.state===d.Ready?l.el:null;if(!c||c.contains(i))return;t&&t.cancelable&&t.preventDefault(),this.ignoreFocusChange=!0;const h=Array.from(r.querySelectorAll(a));let u,p=[r];for(let t of h){const e=t.offsetParent&&!t.closest('[aria-hidden="true"]'),i=c&&c.contains(t),n=!this.carousel.viewport.contains(t);e&&(i||n)?(p.push(t),void 0!==t.dataset.origTabindex&&(t.tabIndex=parseFloat(t.dataset.origTabindex)),t.removeAttribute("data-orig-tabindex"),(t.hasAttribute("autoFocus")||!u&&i)&&(u=t)):(t.dataset.origTabindex=void 0===t.dataset.origTabindex?t.getAttribute("tabindex")||void 0:t.dataset.origTabindex,t.tabIndex=-1)}let m=null;t?(!n||p.indexOf(n)<0)&&(m=r,p.length&&(i===ft?m=p[0]:this.lastFocus!==r&&i!==mt||(m=p[p.length-1]))):this.option("autoFocus")&&u?m=u:i&&p.indexOf(i)<0&&(m=r),m&&(t=>{if(t&&s){void 0===o&&document.createElement("div").focus({get preventScroll(){return o=!0,!1}});try{if(o)t.focus({preventScroll:!0});else{const e=window.pageXOffset||document.body.scrollTop,i=window.pageYOffset||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:i,behavior:"auto"})}}catch(t){}}})(m),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const t=this.carousel;t&&t.pages.length>1&&t.slideNext()}prev(){const t=this.carousel;t&&t.pages.length>1&&t.slidePrev()}jumpTo(...t){this.carousel&&this.carousel.slideTo(...t)}isTopmost(){var t;return(null===(t=vt.getInstance())||void 0===t?void 0:t.id)==this.id}animate(t=null,e="",i){if(!t||!e)return void(i&&i());this.stop(t);const n=s=>{s.target===t&&t.dataset.animationName&&(t.removeEventListener("animationend",n),delete t.dataset.animationName,i&&i(),t.classList.remove(e))};t.dataset.animationName=e,t.addEventListener("animationend",n),t.classList.add(e)}stop(t){t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:t}))}setContent(t,e="",i=!0){if(this.isClosing())return;const n=t.el;if(!n)return;let s=null;if(z(e))["img","iframe","video","audio"].includes(e.nodeName.toLowerCase())?(s=document.createElement("div"),s.appendChild(e)):s=e;else{const t=document.createRange().createContextualFragment(e);s=document.createElement("div"),s.appendChild(t)}s instanceof Element&&t.filter&&!t.error&&(s=s.querySelector(t.filter)),s instanceof Element?(s.classList.add("fancybox__content"),t.id&&s.setAttribute("id",t.id),"none"!==s.style.display&&"none"!==getComputedStyle(s).getPropertyValue("display")||(s.style.display=t.display||this.option("defaultDisplay")||"flex"),n.classList.add(`has-${t.error?"error":t.type||"unknown"}`),n.prepend(s),t.contentEl=s,i&&this.revealContent(t),this.manageCloseBtn(t),this.manageCaption(t)):this.setError(t,"{{ELEMENT_NOT_FOUND}}")}revealContent(t,e){const i=t.el,n=t.contentEl;i&&n&&(this.emit("reveal",t),this.hideLoading(t),t.state=d.Opening,(e=this.isOpeningSlide(t)?void 0===e?this.optionFor(t,"showClass"):e:"f-fadeIn")?this.animate(n,e,(()=>{this.done(t)})):this.done(t))}done(t){var e;this.isClosing()||(t.state=d.Ready,this.emit("done",t),null===(e=t.el)||void 0===e||e.classList.add("is-done"),this.isCurrentSlide(t)&&this.option("autoFocus")&&queueMicrotask((()=>{var t;if(this.option("autoFocus")){const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}})),this.isOpeningSlide(t)&&!this.isCompact&&this.option("idle")&&this.setIdle())}isCurrentSlide(t){const e=this.getSlide();return!(!t||!e)&&e.index===t.index}isOpeningSlide(t){var e,i;return null===(null===(e=this.carousel)||void 0===e?void 0:e.prevPage)&&t.index===(null===(i=this.getSlide())||void 0===i?void 0:i.index)}showLoading(t){t.state=d.Loading;const e=t.el;if(!e)return;e.classList.add("is-loading"),this.emit("loading",t),t.spinnerEl||setTimeout((()=>{if(!this.isClosing()&&!t.spinnerEl&&t.state===d.Loading){let i=n(r);t.spinnerEl=i,e.prepend(i),this.animate(i,"f-fadeIn")}}),250)}hideLoading(t){const e=t.el;if(!e)return;const i=t.spinnerEl;this.isClosing()?null==i||i.remove():(e.classList.remove("is-loading"),i&&this.animate(i,"f-fadeOut",(()=>{i.remove()})),t.state===d.Loading&&(this.emit("loaded",t),t.state=d.Ready))}setError(t,e){if(this.isClosing())return;this.emit("error"),t.error=e,this.hideLoading(t),this.clearContent(t);const i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(e||"

{{ERROR}}

"),this.setContent(t,i)}clearContent(t){var e;null===(e=this.carousel)||void 0===e||e.emit("removeSlide",t),t.contentEl&&(t.contentEl.remove(),t.contentEl=void 0),t.closeBtnEl&&(t.closeBtnEl.remove(),t.closeBtnEl=void 0);const i=t.el;i&&(X(i,"is-loading"),X(i,"has-error"),X(i,"has-unknown"),X(i,`has-${t.type||"unknown"}`))}getSlide(){var t;const e=this.carousel;return(null===(t=null==e?void 0:e.pages[null==e?void 0:e.page])||void 0===t?void 0:t.slides[0])||void 0}close(t,e){if(this.isClosing())return;const i=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",i,t),i.defaultPrevented)return;t&&t.cancelable&&(t.preventDefault(),t.stopPropagation());const n=this.fsAPI,s=()=>{this.proceedClose(t,e)};n&&n.isFullscreen()?Promise.resolve(n.exit()).then((()=>s())):s()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(t=!1){const e=()=>{var t;this.clearIdle(),this.idle=!0,null===(t=this.container)||void 0===t||t.classList.add("is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(t)e();else{const t=this.option("idle");t&&(this.idleTimer=setTimeout(e,t))}}endIdle(){var t;this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,null===(t=this.container)||void 0===t||t.classList.remove("is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){const t=this.fsAPI;t&&(t.isFullscreen()?t.exit():this.container&&t.request(this.container))}isClosing(){return[h.Closing,h.CustomClosing,h.Destroy].includes(this.state)}proceedClose(t,e){var i,n;this.state=h.Closing,this.clearIdle(),this.detachEvents();const s=this.container,o=this.carousel,a=this.getSlide(),r=null==a?void 0:a.state;if(a){const t=this.option("placeFocusBack")?(null===(i=this.getSlide())||void 0===i?void 0:i.triggerEl)||this.option("trigger"):null;t&&t.focus()}if(s&&(F(s,"is-closing"),s.setAttribute("aria-hidden","true"),this.option("animated")&&F(s,"is-animated"),s.style.pointerEvents="none"),o){o.clearTransitions(),null===(n=o.panzoom)||void 0===n||n.destroy();for(const t of o.slides){t.state=d.Closing,this.hideLoading(t);const e=t.contentEl;e&&this.stop(e);const i=null==t?void 0:t.panzoom;i&&(i.stop(),i.detachEvents(),i.detachObserver()),this.isCurrentSlide(t)||o.emit("removeSlide",t)}}this.emit("close",t),this.state!==h.CustomClosing?(void 0===e&&a&&(e=this.optionFor(a,"hideClass")),e&&a&&r===d.Ready?(this.animate(a.contentEl,e,(()=>{o&&o.emit("removeSlide",a)})),setTimeout((()=>{this.destroy()}),350)):this.destroy()):setTimeout((()=>{this.destroy()}),350)}destroy(){var t;if(this.state===h.Destroy)return;this.state=h.Destroy,null===(t=this.carousel)||void 0===t||t.destroy();const e=this.container;e&&e.remove(),gt.delete(this.id);const i=vt.getInstance();i?i.focus():(mt&&(mt.remove(),mt=null),ft&&(ft.remove(),ft=null),document.documentElement.classList.remove("with-fancybox"),s&&(document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",""),document.body.classList.remove("compensate-for-scrollbar")))}static bind(t,e,i){if(!s)return;let n,o="",a={};if("string"==typeof t?(n=document.body,o=t,"object"==typeof e&&(a=e||{})):(n=t,"string"==typeof e&&(o=e),"object"==typeof i&&(a=i||{})),!n)return;o=o||"[data-fancybox]";const r=vt.openers.get(n)||new Map;r.set(o,a),vt.openers.set(n,r),1===r.size&&n.addEventListener("click",vt.fromEvent)}static unbind(t,e){let i,n="";if("string"==typeof t?(i=document.body,n=t):(i=t,"string"==typeof e&&(n=e)),!i)return;const s=vt.openers.get(i);s&&n&&s.delete(n),n&&s||(vt.openers.delete(i),i.removeEventListener("click",vt.fromEvent))}static destroy(){let t;for(;t=vt.getInstance();)t.destroy();for(const t of vt.openers.keys())t.removeEventListener("click",vt.fromEvent);vt.openers=new Map}static fromEvent(t){if(t.defaultPrevented)return;if(t.button&&0!==t.button)return;if(t.ctrlKey||t.metaKey||t.shiftKey)return;let i=t.composedPath()[0];const n=i.closest("[data-fancybox-trigger]");if(n){const t=n.dataset.fancyboxTrigger||"",e=document.querySelectorAll(`[data-fancybox="${t}"]`),s=parseInt(n.dataset.fancyboxIndex||"",10)||0;i=e[s]||i}if(!(i&&i instanceof Element))return;let s,o,a,r;if([...vt.openers].reverse().find((([t,e])=>!(!t.contains(i)||![...e].reverse().find((([e,n])=>{let l=i.closest(e);return!!l&&(s=t,o=e,a=l,r=n,!0)}))))),!s||!o||!a)return;r=r||{},t.preventDefault(),i=a;let l=[],h=e({},c,r);h.event=t,h.trigger=i,h.delegate=n;const d=h.groupAll,u=h.groupAttr,p=u&&i?i.getAttribute(`${u}`):"";if((!i||p||d)&&(l=[].slice.call(s.querySelectorAll(o))),i&&!d&&(l=p?l.filter((t=>t.getAttribute(`${u}`)===p)):[i]),!l.length)return;const m=vt.getInstance();return m&&m.options.trigger&&l.indexOf(m.options.trigger)>-1?void 0:(i&&(h.startIndex=l.indexOf(i)),vt.fromNodes(l,h))}static fromNodes(t,i){i=e({},c,i);const n=[];for(const e of t){const t=e.dataset||{},s=t.src||e.getAttribute("href")||e.getAttribute("currentSrc")||e.getAttribute("src")||void 0;let o;const a=i.delegate;let r;a&&n.length===i.startIndex&&(o=a instanceof HTMLImageElement?a:a.querySelector("img:not([aria-hidden])")),o||(o=e instanceof HTMLImageElement?e:e.querySelector("img:not([aria-hidden])")),o&&(r=o.currentSrc||o.src||void 0,!r&&o.dataset&&(r=o.dataset.lazySrc||o.dataset.src||void 0));const l={src:s,triggerEl:e,thumbEl:o,thumbElSrc:r,thumbSrc:r};for(const e in t)"fancybox"!==e&&(l[e]=t[e]+"");n.push(l)}return new vt(n,i)}static getInstance(t){if(t)return gt.get(t);return Array.from(gt.values()).reverse().find((t=>!t.isClosing()&&t))||null}static getSlide(){var t;return(null===(t=vt.getInstance())||void 0===t?void 0:t.getSlide())||null}static show(t=[],e={}){return new vt(t,e)}static next(){const t=vt.getInstance();t&&t.next()}static prev(){const t=vt.getInstance();t&&t.prev()}static close(t=!0,...e){if(t)for(const t of gt.values())t.close(...e);else{const t=vt.getInstance();t&&t.close(...e)}}}Object.defineProperty(vt,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(vt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(vt,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:it}),Object.defineProperty(vt,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map});export{vt as Fancybox}; +const t=t=>"object"==typeof t&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t),e=(i,...n)=>{const s=n.length;for(let o=0;o{const o=Array.isArray(s)?[]:{};i[n]||Object.assign(i,{[n]:o}),t(s)?Object.assign(i[n],e(o,s)):Array.isArray(s)?Object.assign(i,{[n]:[...s]}):Object.assign(i,{[n]:s})}))}return i},i=function(t,e){let i=!0;return(...n)=>{i&&(i=!1,t(...n),setTimeout((()=>{i=!0}),e))}},n=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},s=!("undefined"==typeof window||!window.document||!window.document.createElement);let o;const a=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","),r='
',l={PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"},c={dragToClose:!0,hideScrollbar:!0,Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},contentClick:"toggleZoom",contentDblClick:!1,backdropClick:"close",animated:!0,idle:3500,showClass:"f-zoomInUp",hideClass:"f-fadeOut",commonCaption:!1,parentEl:null,startIndex:0,l10n:Object.assign(Object.assign({},l),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),tpl:{closeButton:'',main:''},groupAll:!1,groupAttr:"data-fancybox",defaultType:"image",defaultDisplay:"block",autoFocus:!0,trapFocus:!0,placeFocusBack:!0,closeButton:"auto",keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"next",ArrowDown:"prev",ArrowRight:"next",ArrowLeft:"prev"},Fullscreen:{autoStart:!1},compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,wheel:"zoom"};var h,d;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Closing=2]="Closing",t[t.CustomClosing=3]="CustomClosing",t[t.Destroy=4]="Destroy"}(h||(h={})),function(t){t[t.Loading=0]="Loading",t[t.Opening=1]="Opening",t[t.Ready=2]="Ready",t[t.Closing=3]="Closing"}(d||(d={}));const u=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class p{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?e({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=u(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...n){let s=u(e,t);var o;"string"!=typeof(o=s)||isNaN(o)||isNaN(parseFloat(o))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...n));let a=u(e,this.options);return a&&"function"==typeof a?s=a.call(this,this,t,...n,s):void 0===s&&(s=a),void 0===s?i:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(p,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(p,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class m extends p{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,n]of Object.entries(t)){const t=this.option(i),s=this.plugins[i];s||!1===t?s&&!1===t&&(s.detach(),delete this.plugins[i]):e.set(i,new n(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}class f extends p{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const g=()=>{queueMicrotask((()=>{(()=>{const{slug:t,index:e}=b.parseURL(),i=vt.getInstance();if(i&&!1!==i.option("Hash")){const n=i.carousel;if(t&&n){for(let e of n.slides)if(e.slug&&e.slug===t)return n.slideTo(e.index);if(t===i.option("slug"))return n.slideTo(e-1);const s=i.getSlide(),o=s&&s.triggerEl&&s.triggerEl.dataset;if(o&&o.fancybox===t)return n.slideTo(e-1)}b.hasSilentClose=!0,i.close()}b.startFromUrl()})()}))};class b extends f{constructor(){super(...arguments),Object.defineProperty(this,"origHash",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null})}onChange(){const t=this.instance,e=t.carousel;this.timer&&clearTimeout(this.timer);const i=t.getSlide();if(!e||!i)return;const n=t.isOpeningSlide(i),s=new URL(document.URL).hash;let o,a=i.slug||void 0;o=a||this.instance.option("slug"),!o&&i.triggerEl&&i.triggerEl.dataset&&(o=i.triggerEl.dataset.fancybox);let r="";o&&"true"!==o&&(r="#"+o+(!a&&e.slides.length>1?"-"+(i.index+1):"")),n&&(this.origHash=s!==r?s:""),r&&s!==r&&(this.timer=setTimeout((()=>{try{window.history[n?"pushState":"replaceState"]({},document.title,window.location.pathname+window.location.search+r)}catch(t){}}),300))}onClose(){if(this.timer&&clearTimeout(this.timer),!0!==b.hasSilentClose)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(this.origHash||""))}catch(t){}}attach(){this.instance.on("Carousel.ready",this.onChange),this.instance.on("Carousel.change",this.onChange),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.ready",this.onChange),this.instance.off("Carousel.change",this.onChange),this.instance.off("close",this.onClose)}static parseURL(){const t=window.location.hash.slice(1),e=t.split("-"),i=e[e.length-1],n=i&&/^\+?\d+$/.test(i)&&parseInt(e.pop()||"1",10)||1;return{hash:t,slug:e.join("-"),index:n}}static startFromUrl(){if(b.hasSilentClose=!1,vt.getInstance()||!1===vt.defaults.Hash)return;const{hash:t,slug:e,index:i}=b.parseURL();if(!e)return;let n=document.querySelector(`[data-slug="${t}"]`);if(n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),vt.getInstance())return;const s=document.querySelectorAll(`[data-fancybox="${e}"]`);s.length&&(n=s[i-1],n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))}static destroy(){window.removeEventListener("hashchange",g,!1)}}function v(){window.addEventListener("hashchange",g,!1),setTimeout((()=>{b.startFromUrl()}),500)}Object.defineProperty(b,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(b,"hasSilentClose",{enumerable:!0,configurable:!0,writable:!0,value:!1}),s&&(/complete|interactive|loaded/.test(document.readyState)?v():document.addEventListener("DOMContentLoaded",v));const y=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),w=function(t,e){return!(!t||t===document.body||e&&t===e)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,n=-1!==i.indexOf("hidden"),s=-1!==i.indexOf("visible");return e&&!n&&!s}(t)?t:w(t.parentElement,e))},x=t=>`${t||""}`.split(" ").filter((t=>!!t)),S=(t,e,i)=>{x(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))};class E{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const P={passive:!1};class C{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:n=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=n;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,P),this.element.addEventListener("touchmove",this.onMove,P),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,P)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new E(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new E(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new E(t))):[new E(t)],n=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(n.push(t),this.currentPointers[e]=t)}n.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new E(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new E(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,P),this.element.removeEventListener("touchstart",this.onTouchStart,P),this.element.removeEventListener("touchmove",this.onMove,P),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function M(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function T(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}var O;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(O||(O={}));const A=["a","b","c","d","e","f"],L={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:l},z=t=>t&&null!==t&&t instanceof Element&&"nodeType"in t,R=(t,e)=>{x(e).forEach((e=>{t&&t.classList.remove(e)}))},k=(t,e)=>{x(e).forEach((e=>{t&&t.classList.add(e)}))},I={a:1,b:0,c:0,d:1,e:0,f:0};let D=null,F=null;class j extends m{get isTouchDevice(){return null===F&&(F=window.matchMedia("(hover: none)").matches),F}get isMobile(){return null===D&&(D=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),D}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const t=this.content;return!!(t&&t instanceof HTMLImageElement)&&!t.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of A){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var s;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:O.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},I)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},I)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},j.Plugins),i)),this.emit("init"),this.isContentLoading){const e=this.content;if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const i=n(r);t.contains(e)?this.spinner=(null===(s=e.parentElement)||void 0===s?void 0:s.insertBefore(i,e))||null:this.spinner=t.appendChild(i)}this.emit("beforeLoad"),e.addEventListener("load",this.onLoad),e.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===O.Init&&this.enable()}onError(){this.state!==O.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=O.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new C(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of A)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of A)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,n=i.e+t,s=i.f+e,o=this.getBounds(),{x:a,y:r}=o,l=a.min,c=a.max,h=r.min,d=r.max;let u=0,p=0;return l!==1/0&&nc&&(u=c-n),h!==1/0&&sd&&(p=d-s),Math.abs(u)<.001&&(u=0),Math.abs(p)<.001&&(p=0),Object.assign(Object.assign({},o),{xDiff:u,yDiff:p,inBounds:!u&&!p})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:n,fitHeight:s,fullWidth:o,fullHeight:a}=i;let r=o,l=a;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),c=i?o:n,h=i?a:s,d=this.getMatrix(t),u=new DOMPoint(0,0).matrixTransform(d),p=new DOMPoint(0+c,0).matrixTransform(d),m=new DOMPoint(0+c,0+h).matrixTransform(d),f=new DOMPoint(0,0+h).matrixTransform(d),g=Math.abs(m.x-u.x),b=Math.abs(m.y-u.y),v=Math.abs(f.x-p.x),y=Math.abs(f.y-p.y);r=Math.max(g,v),l=Math.max(b,y)}return{contentWidth:r,contentHeight:l}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const n=i.closest("[data-panzoom-action]"),s=i.closest("[data-panzoom-change]"),o=n||s,a=o&&z(o)?o.dataset:null;if(a){const e=a.panzoomChange,i=a.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const r=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(r.x-this.dragStart.x)>2||Math.abs(r.y-this.dragStart.y)>2))return;this.dragStart.time=0;const l=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},c=this.option("click",t),h=this.option("dblClick",t);h?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&c&&l(c)):(this.emit("dblClick",t),t.defaultPrevented||l(h)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&c&&l(c))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(t,e,i){var n;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const s=this.content.getBoundingClientRect();if(this.dragStart={x:s.x,y:s.y,top:s.top,left:s.left,time:Date.now()},!1===this.option("touch",t))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;if(!i.length){const e=t.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(e.nodeName)||e.closest("[contenteditable]")||e.closest("[data-selectable]")||e.closest("[data-panzoom-change]")||e.closest("[data-panzoom-action]"))return!1;null===(n=window.getSelection())||void 0===n||n.removeAllRanges()}return"mousedown"===t.type&&t.preventDefault(),y(this.targetScale,1e3)===y(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(e),this.emit("touchStart",t),!0}onPointerMove(t,e,i){if(!this.isDragging)return;if(e.length<2&&this.panOnlyZoomed&&y(this.targetScale)<=y(this.minScale))return;if(this.emit("touchMove",t),t.defaultPrevented)return;this.addTrackingPoint(e[0]);const{content:n}=this,s=T(i[0],i[1]),o=T(e[0],e[1]);let a=0,r=0;if(e.length>1){const t=n.getBoundingClientRect();a=s.clientX-t.left-.5*t.width,r=s.clientY-t.top-.5*t.height}const l=M(i[0],i[1]),c=M(e[0],e[1]);let h=l?c/l:1,d=o.clientX-s.clientX,u=o.clientY-s.clientY;this.dragOffset.x+=d,this.dragOffset.y+=u,this.dragOffset.time=Date.now()-this.dragStart.time;let p=y(this.targetScale)===y(this.minScale)&&this.option("lockAxis");if(p&&!this.lockedAxis)if("xy"===p||"y"===p||"touchmove"===t.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void t.preventDefault();const e=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=e>45&&e<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,d=0,u=0}else this.lockedAxis=p;if(w(t.target,this.content)&&(p="x",this.dragOffset.y=0),p&&"xy"!==p&&this.lockedAxis!==p&&y(this.targetScale)===y(this.minScale))return;t.cancelable&&t.preventDefault(),this.container.classList.add(this.cn("isDragging"));const m=this.checkBounds(d,u);this.option("rubberband")?("x"!==this.isInfinite&&(m.xDiff>0&&d<0||m.xDiff<0&&d>0)&&(d*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*m.xDiff))),"y"!==this.isInfinite&&(m.yDiff>0&&u<0||m.yDiff<0&&u>0)&&(u*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*m.yDiff)))):(m.xDiff&&(d=0),m.yDiff&&(u=0));const f=this.targetScale,g=this.minScale,b=this.maxScale;f<.5*g&&(h=Math.max(h,g)),f>1.5*b&&(h=Math.min(h,b)),"y"===this.lockedAxis&&y(f)===y(g)&&(d=0),"x"===this.lockedAxis&&y(f)===y(g)&&(u=0),this.applyChange({originX:a,originY:r,panX:d,panY:u,scale:h,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,e,i){if(i.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(e),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),w(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==O.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of A)this.velocity[t]=0,this.target[t]=this.current[t];R(this.container,"is-scaling"),R(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:t}=this,e=t[0],i=t[t.length-1];let n=0,s=0,o=0;i&&e&&(n=i.clientX-e.clientX,s=i.clientY-e.clientY,o=i.time-e.time);let a=0,r=0,l=0,c=0,h=this.option("decelFriction");const d=this.targetScale;if((dthis.maxScale+1e-5)&&(h=.35),o>0){l=Math.abs(n)>3?n/(o/30):0,c=Math.abs(s)>3?s/(o/30):0;const t=this.option("maxVelocity");t&&(l=Math.max(Math.min(l,t),-1*t),c=Math.max(Math.min(c,t),-1*t))}l&&(a=l/(1/(1-h)-1)),c&&(r=c/(1/(1-h)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&y(d)===this.minScale)&&(a=l=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&y(d)===this.minScale)&&(r=c=0);const u=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(n)),"auto"===p&&(p=parseFloat(n.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(n));const m=(this.option("transformParent")?n.parentElement:null)||n,f=m.getAttribute("style")||"";m.style.setProperty("transform","none","important"),m.style.setProperty("transition","none","important"),m.style.setProperty("animation","none","important"),n instanceof HTMLImageElement&&(m.style.width="",m.style.height=""),m.offsetHeight;const g=n.getBoundingClientRect();let b=g.width,v=g.height,w=0,x=0;if(n instanceof HTMLImageElement&&({width:b,height:v,top:w,left:x}=((t,e,i,n)=>{const s=i/n;return s>t/e?(i=t,n=t/s):(i=e*s,n=e),{width:i,height:n,top:.5*(e-n),left:.5*(t-i)}})(g.width,g.height,u,p)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:g.top-a.top+w,bottom:a.bottom-g.bottom+w,left:g.left-a.left+x,right:a.right-g.right+x,fitWidth:b,fitHeight:v,width:b,height:v,fullWidth:u,fullHeight:p}),m.style.cssText=f,n instanceof HTMLImageElement&&(m.style.width=`${b}px`,m.style.height=`${v}px`),this.setTransform(),!0!==t){let t="";Math.abs(l-s)>1&&(t+="x"),Math.abs(c-o)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(y(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===O.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const t=this.option("bounds");if("auto"!==t)return t;const{contentWidth:e,contentHeight:i}=this.calculateContentDim(this.target);let n=0,s=0,o=0,a=0;const r=this.option("infinite");if(!0===r||this.lockedAxis&&r===this.lockedAxis)n=-1/0,o=1/0,s=-1/0,a=1/0;else{let{containerRect:t,contentRect:r}=this,l=y(this.contentRect.fitWidth*this.targetScale,1e3),c=y(this.contentRect.fitHeight*this.targetScale,1e3),{innerWidth:h,innerHeight:d}=t;if(this.containerRect.width===l&&(h=t.width),this.containerRect.width===c&&(d=t.height),e>h){o=.5*(e-h),n=-1*o;let t=.5*(r.right-r.left);n+=t,o+=t}if(this.contentRect.fitWidth>h&&ed){a=.5*(i-d),s=-1*a;let t=.5*(r.bottom-r.top);s+=t,a+=t}this.contentRect.fitHeight>d&&i-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(a=!0),this.contentRect.width*this.targetScaley(this.targetScale),l=!r&&!a&&s&&y(i).9*t.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:n=this.option("friction"),angle:s=0,originX:o=0,originY:a=0,flipX:r=!1,flipY:l=!1,ignoreBounds:c=!1}){this.state!==O.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:s,originX:o,originY:a,friction:n,flipX:r,flipY:l,ignoreBounds:c})}applyChange({panX:t=0,panY:e=0,scale:i=1,angle:n=0,originX:s=-this.current.e,originY:o=-this.current.f,friction:a=this.option("friction"),flipX:r=!1,flipY:l=!1,ignoreBounds:c=!1,bounce:h=this.option("bounce")}){const d=this.state;if(d===O.Init||d===O.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of A)this.velocity[t]=0;this.friction=a||0,this.ignoreBounds=c;const{current:u}=this,p=u.e,m=u.f,f=this.getMatrix(this.target);let g=(new DOMMatrix).translate(p,m).translate(s,o).translate(t,e);if(this.option("zoom")){if(!c){const t=this.targetScale,e=this.minScale,n=this.maxScale;t*in&&(i=n/t)}g=g.scale(i)}g=g.translate(-s,-o).translate(-p,-m).multiply(f),n&&(g=g.rotate(n)),r&&(g=g.scale(-1,1)),l&&(g=g.scale(1,-1));for(const t of A)"a"!=t&&"d"!=t||!(g[t]>this.minScale+1e-5||g[t].1||"mousemove"===this.panMode||!1===h)&&!c&&this.clampTargetBounds(),this.isResting||(this.state=O.Panning,this.requestTick())}stop(t=!1){if(this.state!==O.Init&&this.state!==O.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of A)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),R(this.container,"is-scaling"),R(this.container,"is-animating"),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=O.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),k(this.container,"is-animating"),this.isScaling&&k(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(t,e=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=t,"mousemove"!==this.panMode||!t)return;if(y(this.targetScale)<=y(this.minScale))return;this.emit("mouseMove",t);const{container:i,containerRect:n,contentRect:s}=this,o=n.width,a=n.height,r=i.getBoundingClientRect(),l=(t.clientX||0)-r.left,c=(t.clientY||0)-r.top;let{contentWidth:h,contentHeight:d}=this.calculateContentDim(this.target);const u=this.option("mouseMoveFactor");u>1&&(h!==o&&(h*=u),d!==a&&(d*=u));let p=.5*(h-o)-l/o*100/100*(h-o);p+=.5*(s.right-s.left);let m=.5*(d-a)-c/a*100/100*(d-a);m+=.5*(s.bottom-s.top),this.applyChange({panX:p-this.target.e,panY:m-this.target.f,friction:e})}zoomWithWheel(t){if(this.state===O.Destroy||this.state===O.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),n=this.targetScale,s=this.maxScale,o=this.minScale;let a=n*(100+i*e)/100;as&&n>=s?(this.wheelDelta+=Math.abs(i),a=s):(this.wheelDelta=0,a=Math.max(Math.min(a,s),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),a!==n&&this.zoomTo(a,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.maxScale-this.minScale)?"max":"fit",t)}toggleCover(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.coverScale-this.minScale)?"cover":"fit",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:n=0,event:s}={}){if(this.isContentLoading||this.state===O.Destroy)return;this.stop();const{targetScale:o}=this;let a=1;if("mousemove"===this.panMode&&(s=this.prevMouseMoveEvent||s),s){const t=this.content.getBoundingClientRect(),e=s.clientX||0,o=s.clientY||0;i=e-t.left-.5*t.width,n=o-t.top-.5*t.height}const r=this.fullScale,l=this.maxScale;let c=this.coverScale;"number"==typeof t?a=t/o:("next"===t&&(r-c<.2&&(c=r),t=o1?.15:.25:e,this.applyChange({scale:a,originX:i,originY:n,friction:e}),s&&"mousemove"===this.panMode&&this.panWithMouse(s,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const n=t.classList.contains(e);n?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(n?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:n,d:s,e:o,f:a}=t;return new DOMMatrix([e,i,n,s,o,a])}reset(t){if(this.state!==O.Init&&this.state!==O.Destroy){this.stop("current");for(const t of A)this.target[t]=I[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=O.Panning,this.requestTick())}}destroy(){this.stop(),this.state=O.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(j,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:L}),Object.defineProperty(j,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const H=t=>new Promise(((e,i)=>{const n=new Image;n.onload=e,n.onerror=i,n.src=t}));class B extends f{onCreateSlide(t,e,i){const n=this.instance,s=n.optionFor(i,"src")||"",{el:o,type:a}=i;o&&"image"===a&&"string"==typeof s&&this.setContent(i,s).then((t=>{if(n.isClosing())return;const e=i.contentEl,s=i.imageEl,o=i.thumbElSrc,a=this.optionFor(i,"initialSize"),r=this.optionFor(i,"zoom"),l={event:n.prevMouseMoveEvent||n.options.event,friction:r?.12:0};if(e&&s&&o&&n.isOpeningSlide(i)&&this.getZoomInfo(i)){let t=document.createElement("img");k(t,"fancybox-ghost"),e.appendChild(t),t.src=o,setTimeout((()=>{n.animate(t,"f-fadeFastOut",(()=>{t&&(t.remove(),t=null)}))}),333),H(o).then((()=>{i.state=d.Opening,this.instance.emit("reveal",i),this.zoomIn(i).then((()=>{this.instance.done(i)}),(()=>{n.hideLoading(i)}))}),(()=>{n.hideLoading(i),n.revealContent(i)}))}else{let e=n.optionFor(i,"showClass")||void 0,s=!0;n.isOpeningSlide(i)&&("full"===a?t.zoomToFull(l):"cover"===a?t.zoomToCover(l):"max"===a?t.zoomToMax(l):s=!1,t.stop("current")),s&&e&&(e="f-fadeIn"),n.revealContent(i,e)}}),(()=>{n.setError(i,"{{IMAGE_ERROR}}")}))}onRemoveSlide(t){t.panzoom&&t.panzoom.destroy(),t.panzoom=void 0,t.imageEl=void 0}onChange(t,e,i,n){for(const t of e.slides){const e=t.panzoom;e&&t.index!==i&&e.reset(0)}}onClose(){const t=this.instance,e=t.container,i=t.getSlide();if(!e||!e.parentElement||!i)return;const{el:n,contentEl:s,panzoom:o}=i,a=i.thumbElSrc;if(!n||!a||!s||!o||o.isContentLoading||o.state===O.Init||o.state===O.Destroy)return;o.updateMetrics();let r=this.getZoomInfo(i);if(!r)return;this.instance.state=h.CustomClosing,n.classList.remove("is-zooming-in"),n.classList.add("is-zooming-out"),s.style.backgroundImage=`url('${a}')`,H(a).then((()=>{n.classList.add("hide-image")}),(()=>{}));const l=e.getBoundingClientRect();Object.assign(e.style,{position:"absolute",top:`${window.pageYOffset}px`,left:`${window.pageXOffset}px`,bottom:"auto",right:"auto",width:`${l.width}px`,height:`${l.height}px`});const{x:c,y:d,scale:u,opacity:p}=r;if(p){const t=((t,e,i,n)=>{const s=e-t,o=n-i;return e=>i+((e-t)/s*o||0)})(o.scale,u,1,0);o.on("afterTransform",(()=>{s.style.opacity=t(o.scale)+""}))}o.on("endAnimation",(()=>{t.destroy()})),o.target.a=u,o.target.b=0,o.target.c=0,o.target.d=u,o.panTo({x:c,y:d,scale:u,friction:p?.2:.33,ignoreBounds:!0}),o.isResting&&t.destroy()}setContent(t,i){return new Promise(((n,s)=>{var o,a;const r=this.instance,l=t.el;if(!l)return void s();r.showLoading(t);const c=document.createElement("img");if(c.classList.add("fancybox-image"),c.src=i||"",c.alt=(null===(o=t.caption)||void 0===o?void 0:o.replace(/<[^>]+>/gi,"").substring(0,1e3))||`Image ${t.index+1} of ${null===(a=r.carousel)||void 0===a?void 0:a.pages.length}`,t.imageEl=c,r.setContent(t,c,!1),this.option("protected")){l.addEventListener("contextmenu",(t=>{t.preventDefault()}));const e=t.contentEl;if(e){const t=document.createElement("div");k(t,"fancybox-protected"),e.append(t)}}t.panzoom=new j(l,e({},this.option("Panzoom")||{},{content:c,width:r.optionFor(t,"width","auto"),height:r.optionFor(t,"height","auto"),wheel:()=>{const t=r.option("wheel");return("zoom"===t||"pan"==t)&&t},click:(e,i)=>{var n;if(r.isCompact||r.isClosing())return!1;let s=!i||i.target&&(null===(n=t.contentEl)||void 0===n?void 0:n.contains(i.target));return r.option(s?"contentClick":"backdropClick")||!1},dblClick:()=>r.isCompact?"toggleZoom":r.option("contentDblClick")||!1,spinner:!1,panOnlyZoomed:!0,wheelLimit:1/0,transformParent:!0,on:{ready:t=>{n(t)},error:()=>{s()},destroy:()=>{s()}}}))}))}zoomIn(t){return new Promise(((e,i)=>{const{panzoom:n,contentEl:s,el:o}=t,a=this.getZoomInfo(t);if(!(a&&o&&s&&n))return void i();const{x:r,y:l,scale:c,opacity:h}=a,u=()=>{t.state!==d.Closing&&(h&&(s.style.opacity=Math.max(Math.min(1,1-(1-n.scale)/(1-c)),0)+""),n.scale>=1&&n.scale>n.targetScale-.1&&e(n))},p=t=>{t.scale<.99||(o.classList.remove("is-zooming-in"),t.off("endAnimation",p),t.off("touchStart",p),t.off("afterTransform",u),e(t))};n.on("endAnimation",p),n.on("touchStart",p),n.on("afterTransform",u),n.on(["error","destroy"],(()=>{i()})),n.panTo({x:r,y:l,scale:c,friction:0,ignoreBounds:!0}),n.stop("current");const m=this.instance,f={event:"mousemove"===n.panMode?m.prevMouseMoveEvent||m.options.event:void 0},g=this.optionFor(t,"initialSize");k(o,"is-zooming-in"),m.hideLoading(t),"full"===g?n.zoomToFull(f):"cover"===g?n.zoomToCover(f):"max"===g?n.zoomToMax(f):n.reset(.175)}))}getZoomInfo(t){const{el:e,imageEl:i,thumbEl:n,panzoom:s}=t;if(!e||!i||!n||!s||(t=>{const e=window.pageYOffset,i=window.pageYOffset+window.innerHeight;if(!z(t))return 0;const n=t.getBoundingClientRect(),s=n.y+window.pageYOffset,o=n.y+n.height+window.pageYOffset;if(e>o||io)return 100;if(si)return 100;let a=n.height;si&&(a-=o-i);const r=a/window.innerHeight*100;return Math.round(r)})(n)<5||!this.optionFor(t,"zoom")||this.instance.state===h.Destroy)return!1;const{top:o,left:a,width:r,height:l}=n.getBoundingClientRect();let{top:c,left:d,fitWidth:u,fitHeight:p}=s.contentRect;if(!(r&&l&&u&&p))return!1;const m=r/u,f=s.container.getBoundingClientRect();c+=f.top,d+=f.left;const g=-1*(d+.5*u-(a+.5*r)),b=-1*(c+.5*p-(o+.5*l));let v=this.option("zoomOpacity")||!1;return"auto"===v&&(v=Math.abs(r/l-u/p)>.1),{x:g,y:b,scale:m,opacity:v}}attach(){this.instance.on("Carousel.change",this.onChange),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.change",this.onChange),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("close",this.onClose)}}Object.defineProperty(B,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}});const _=(t,e={})=>{const i=new URL(t),n=new URLSearchParams(i.search),s=new URLSearchParams;for(const[t,i]of[...n,...Object.entries(e)]){let e=i.toString();"t"===t?s.set("start",parseInt(e).toString()):s.set(t,e)}let o=s.toString(),a=t.match(/#t=((.*)?\d+s)/);return a&&(o+=`#t=${a[1]}`),o},N={ajax:null,autoSize:!0,preload:!0,videoAutoplay:!0,videoRatio:16/9,videoTpl:'',videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,rel:0,fs:1}},W=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo","video"];class $ extends f{onInitSlides(t,e){for(const t of e.slides)this.processType(t)}onCreateSlide(t,e,i){this.setContent(i)}onRemoveSlide(t,e,i){i.closeBtnEl&&(i.closeBtnEl.remove(),i.closeBtnEl=void 0),i.xhr&&(i.xhr.abort(),i.xhr=null),i.iframeEl&&(i.iframeEl.onload=i.iframeEl.onerror=null,i.iframeEl.src="//about:blank",i.iframeEl=null);const n=i.contentEl,s=i.placeholderEl;if("inline"===i.type&&n&&s)n.classList.remove("fancybox__content"),"none"!==n.style.display&&(n.style.display="none"),s.parentNode&&s.parentNode.insertBefore(n,s),s.remove(),i.placeholderEl=null;else for(;i.el&&i.el.firstChild;)i.el.removeChild(i.el.firstChild)}onSelectSlide(t,e,i){i.state===d.Ready&&this.playVideo()}onUnselectSlide(t,e,i){var n,s;if("html5video"===i.type){try{null===(s=null===(n=i.el)||void 0===n?void 0:n.querySelector("video"))||void 0===s||s.pause()}catch(t){}return}let o;"vimeo"===i.type?o={method:"pause",value:"true"}:"youtube"===i.type&&(o={event:"command",func:"pauseVideo"}),o&&i.iframeEl&&i.iframeEl.contentWindow&&i.iframeEl.contentWindow.postMessage(JSON.stringify(o),"*"),i.poller&&clearTimeout(i.poller)}onDone(t,e){t.isCurrentSlide(e)&&!t.isClosing()&&this.playVideo()}onRefresh(t,e){e.slides.forEach((t=>{t.el&&(this.setAspectRatio(t),this.resizeIframe(t))}))}onMessage(t){try{let e=JSON.parse(t.data);if("https://player.vimeo.com"===t.origin){if("ready"===e.event)for(let e of Array.from(document.getElementsByClassName("fancybox__iframe")))e instanceof HTMLIFrameElement&&e.contentWindow===t.source&&(e.dataset.ready="true")}else if("https://www.youtube-nocookie.com"===t.origin&&"onReady"===e.event){const t=document.getElementById(e.id);t&&(t.dataset.ready="true")}}catch(t){}}loadAjaxContent(t){const e=this.instance.optionFor(t,"src")||"";this.instance.showLoading(t);const i=this.instance,n=new XMLHttpRequest;i.showLoading(t),n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&i.state===h.Ready&&(i.hideLoading(t),200===n.status?i.setContent(t,n.responseText):i.setError(t,404===n.status?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const s=t.ajax||null;n.open(s?"POST":"GET",e+""),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send(s),t.xhr=n}setInlineContent(t){let e=null;if(z(t.src))e=t.src;else if("string"==typeof t.src){const i=t.src.split("#",2).pop();e=i?document.getElementById(i):null}if(e){if("clone"===t.type||e.dataset.placeholderId){e=e.cloneNode(!0);const i=e.dataset.animationName;i&&(e.classList.remove(i),delete e.dataset.animationName),delete e.dataset.placeholderId;let n=e.getAttribute("id");n=n?`${n}--clone`:`clone-${this.instance.id}-${t.index}`,e.setAttribute("id",n)}else if(e.parentNode){const i=document.createElement("div");i.classList.add("fancybox-placeholder"),e.parentNode.insertBefore(i,e),t.placeholderEl=i}this.instance.setContent(t,e)}else this.instance.setError(t,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(t){const{src:e,el:i}=t;if(!e||"string"!=typeof e||!i)return;const n=this.instance,s=document.createElement("iframe");s.className="fancybox__iframe",s.setAttribute("id",`fancybox__iframe_${n.id}_${t.index}`),s.setAttribute("allow","autoplay; fullscreen"),s.setAttribute("scrolling","auto"),s.onerror=()=>{n.setError(t,"{{IFRAME_ERROR}}")},t.iframeEl=s;const o=this.optionFor(t,"preload");if(i.classList.add("is-loading"),"iframe"!==t.type||!1===o)return s.setAttribute("src",t.src+""),this.resizeIframe(t),void n.setContent(t,s);n.showLoading(t),s.onload=()=>{if(!s.src.length)return;const e="true"!==s.dataset.ready;s.dataset.ready="true",this.resizeIframe(t),e?n.revealContent(t):n.hideLoading(t)},s.setAttribute("src",e),n.setContent(t,s,!1)}resizeIframe(t){const e=t.iframeEl,i=null==e?void 0:e.parentElement;if(!e||!i)return;let n=t.autoSize,s=t.width||0,o=t.height||0;s&&o&&(n=!1);const a=i&&i.style;if(!1!==t.preload&&!1!==n&&a)try{const t=window.getComputedStyle(i),n=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),r=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),l=e.contentWindow;if(l){const t=l.document,e=t.getElementsByTagName("html")[0],i=t.body;a.width="",i.style.overflow="hidden",s=s||e.scrollWidth+n,a.width=`${s}px`,i.style.overflow="",a.flex="0 0 auto",a.height=`${i.scrollHeight}px`,o=e.scrollHeight+r}}catch(t){}if(s||o){const t={flex:"0 1 auto",width:"",height:""};s&&(t.width=`${s}px`),o&&(t.height=`${o}px`),Object.assign(a,t)}}playVideo(){const t=this.instance.getSlide();if(!t)return;const{el:e}=t;if(!e||!e.offsetParent)return;if(!this.optionFor(t,"videoAutoplay"))return;if("html5video"===t.type)try{const t=e.querySelector("video");if(t){const e=t.play();void 0!==e&&e.then((()=>{})).catch((e=>{t.muted=!0,t.play()}))}}catch(t){}if("youtube"!==t.type&&"vimeo"!==t.type)return;const i=()=>{if(t.iframeEl&&t.iframeEl.contentWindow){let e;if("true"===t.iframeEl.dataset.ready)return e="youtube"===t.type?{event:"command",func:"playVideo"}:{method:"play",value:"true"},e&&t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"),void(t.poller=void 0);"youtube"===t.type&&(e={event:"listening",id:t.iframeEl.getAttribute("id")},t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"))}t.poller=setTimeout(i,250)};i()}processType(t){if(t.html)return t.type="html",t.src=t.html,void(t.html="");const e=this.instance.optionFor(t,"src","");if(!e||"string"!=typeof e)return;let i=t.type,n=null;if(n=e.match(/(?:youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const s=_(e,this.optionFor(t,"youtube")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://www.youtube-nocookie.com/embed/${o}?${s}`,t.thumbSrc=t.thumbSrc||`https://i.ytimg.com/vi/${o}/mqdefault.jpg`,i="youtube"}else if(n=e.match(/^.+vimeo.com\/(?:\/)?([\d]+)(.*)?/)){const s=_(e,this.optionFor(t,"vimeo")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://player.vimeo.com/video/${o}?${s}`,i="vimeo"}if(!i&&t.triggerEl){const e=t.triggerEl.dataset.type;W.includes(e)&&(i=e)}i||"string"==typeof e&&("#"===e.charAt(0)?i="inline":(n=e.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(i="html5video",t.videoFormat=t.videoFormat||"video/"+("ogv"===n[1]?"ogg":n[1])):e.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?i="image":e.match(/\.(pdf)((\?|#).*)?$/i)?i="pdf":(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src=`https://maps.google.${n[1]}/?ll=${(n[2]?n[2]+"&z="+Math.floor(parseFloat(n[3]))+(n[4]?n[4].replace(/^\//,"&"):""):n[4]+"").replace(/\?/,"&")}&output=${n[4]&&n[4].indexOf("layer=c")>0?"svembed":"embed"}`,i="map"):(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src=`https://maps.google.${n[1]}/maps?q=${n[2].replace("query=","q=").replace("api=1","")}&output=embed`,i="map")),t.type=i||this.instance.option("defaultType")}setContent(t){const e=this.instance.optionFor(t,"src")||"";if(t&&t.type&&e){switch(t.type){case"html":this.instance.setContent(t,e);break;case"html5video":const i=this.option("videoTpl");i&&this.instance.setContent(t,i.replace(/\{\{src\}\}/gi,e+"").replace(/\{\{format\}\}/gi,this.optionFor(t,"videoFormat")||"").replace(/\{\{poster\}\}/gi,t.poster||t.thumbSrc||""));break;case"inline":case"clone":this.setInlineContent(t);break;case"ajax":this.loadAjaxContent(t);break;case"pdf":case"map":case"youtube":case"vimeo":t.preload=!1;case"iframe":this.setIframeContent(t)}this.setAspectRatio(t)}}setAspectRatio(t){var e;const i=t.contentEl,n=this.optionFor(t,"videoRatio"),s=null===(e=t.el)||void 0===e?void 0:e.getBoundingClientRect();if(!(i&&s&&n&&1!==n&&t.type&&["video","youtube","vimeo","html5video"].includes(t.type)))return;const o=s.width,a=s.height;i.style.aspectRatio=n+"",i.style.width=o/a>n?"auto":"",i.style.height=o/a>n?"":"auto"}attach(){this.instance.on("Carousel.initSlides",this.onInitSlides),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("Carousel.selectSlide",this.onSelectSlide),this.instance.on("Carousel.unselectSlide",this.onUnselectSlide),this.instance.on("Carousel.Panzoom.refresh",this.onRefresh),this.instance.on("done",this.onDone),window.addEventListener("message",this.onMessage)}detach(){this.instance.off("Carousel.initSlides",this.onInitSlides),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("Carousel.selectSlide",this.onSelectSlide),this.instance.off("Carousel.unselectSlide",this.onUnselectSlide),this.instance.off("Carousel.Panzoom.refresh",this.onRefresh),this.instance.off("done",this.onDone),window.removeEventListener("message",this.onMessage)}}Object.defineProperty($,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:N});class X extends f{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:"ready"}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return"ready"!==this.state}onReady(t){this.option("autoStart")&&(t.isInfinite||t.page{this.timer=null,this.inHover||this.onTimerEnd()}),e),t.style.transitionDuration=`${e}ms`,t.style.transform="scaleX(1)"}this.emit("set")}clear(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.removeProgressBar()}start(){if(this.set(),this.option("pauseOnHover")){const t=this.instance.container;t.addEventListener("mouseenter",this.onMouseEnter,!1),t.addEventListener("mouseleave",this.onMouseLeave,!1)}document.addEventListener("visibilitychange",this.onVisibilityChange,!1)}stop(){const t=this.instance.container;this.clear(),this.state="ready",t.removeEventListener("mouseenter",this.onMouseEnter,!1),t.removeEventListener("mouseleave",this.onMouseLeave,!1),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),R(t,"has-autoplay"),this.emit("stop")}pause(){"play"===this.state&&(this.state="pause",this.clear(),this.emit("pause"))}resume(){const t=this.instance;if(t.isInfinite||t.page!==t.pages.length-1)if("play"!==this.state){if("pause"===this.state&&!this.inHover){const t=new Event("resume",{bubbles:!0,cancelable:!0});this.emit("resume",event),t.defaultPrevented||this.set()}}else this.set();else this.stop()}toggle(){"play"===this.state||"pause"===this.state?this.stop():this.set()}attach(){this.instance.on("ready",this.onReady),this.instance.on("Panzoom.startAnimation",this.onChange),this.instance.on("Panzoom.endAnimation",this.onSettle),this.instance.on("Panzoom.touchMove",this.onChange)}detach(){this.instance.off("ready",this.onReady),this.instance.off("Panzoom.startAnimation",this.onChange),this.instance.off("Panzoom.endAnimation",this.onSettle),this.instance.off("Panzoom.touchMove",this.onChange),this.stop()}}Object.defineProperty(X,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class Y extends f{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(t){const i=t.carousel;if(!i)return;const n=t.container;n&&(i.options.Autoplay=e(this.option("Autoplay")||{},{pauseOnHover:!1,autoStart:!1,timeout:this.option("timeout"),progressParentEl:()=>n.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]")||n,on:{set:e=>{var i;n.classList.add("has-slideshow"),(null===(i=t.getSlide())||void 0===i?void 0:i.state)!==d.Ready&&e.pause()},stop:()=>{n.classList.remove("has-slideshow"),t.isCompact||t.endIdle()},resume:(e,i)=>{var n,s,o;!i||!i.cancelable||(null===(n=t.getSlide())||void 0===n?void 0:n.state)===d.Ready&&(null===(o=null===(s=t.carousel)||void 0===s?void 0:s.panzoom)||void 0===o?void 0:o.isResting)||i.preventDefault()}}}),i.attachPlugins({Autoplay:X}),this.ref=i.plugins.Autoplay)}onReady(t){const e=t.carousel,i=this.ref;e&&i&&this.option("playOnStart")&&(e.isInfinite||e.page{t.isCurrentSlide(e)&&i.stop()})),t.isCurrentSlide(e)&&i.resume()}onKeydown(t,e){var i;const n=this.ref;n&&e===this.option("key")&&"BUTTON"!==(null===(i=document.activeElement)||void 0===i?void 0:i.nodeName)&&n.toggle()}attach(){this.instance.on("Carousel.init",this.onPrepare),this.instance.on("Carousel.ready",this.onReady),this.instance.on("done",this.onDone),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onPrepare),this.instance.off("Carousel.ready",this.onReady),this.instance.off("done",this.onDone),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(Y,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{key:" ",playOnStart:!1,timeout:3e3}});const q={classes:{container:"f-thumbs f-carousel__thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'',type:"modern"};var Z;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden",t[t.Disabled=3]="Disabled"}(Z||(Z={}));let V=class extends f{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"shouldCenter",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Z.Init})}formatThumb(t,e){return this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}getSlides(){const t=[],e=this.option("thumbTpl")||"";if(e)for(const i of this.instance.slides||[])t.push({html:this.formatThumb(i,e),customClass:`has-thumb for-${i.type||"image"}`});return t}getProgress(t){const e=this.instance,i=e.panzoom,n=e.pages[t]||0;if(!n||!i)return 0;let s=-1*i.current.e,o=e.contentDim,a=(s-n.pos)/(1*n.dim),r=(s+o-n.pos)/(1*n.dim),l=(s-o-n.pos)/(1*n.dim);return a=Math.max(0,Math.min(1,Math.abs(a))),r=Math.max(0,Math.min(1,Math.abs(r))),l=Math.max(0,Math.min(1,Math.abs(l))),a=Math.min(a,r,l),a}onInitSlide(t,e){const i=e.el;i&&(e.thumbSrc=i.dataset.thumbSrc||e.thumbSrc||"",e.thumbClipWidth=parseFloat(i.dataset.thumbClipWidth||"")||e.thumbClipWidth||0,e.thumbHeight=parseFloat(i.dataset.thumbHeight||"")||e.thumbHeight||0)}onInitSlides(){this.state===Z.Init&&this.build()}onRefreshM(){this.refreshModern()}onChangeM(){"modern"===this.type&&(this.shouldCenter=!0,this.centerModern())}onClickModern(t){t.preventDefault(),t.stopPropagation();const e=this.instance,i=e.page,n=t=>{if(t){const e=t.closest("[data-carousel-page]");if(e)return parseInt(e.dataset.carouselPage||"",10)||0}return-1},s=(t,e)=>{const i=document.elementFromPoint(t,e);return i?n(i):-1};let o=n(t.target);o<0&&(o=s(t.clientX+this.thumbGap,t.clientY),o===i&&(o=i-1)),o<0&&(o=s(t.clientX-this.thumbGap,t.clientY),o===i&&(o=i+1)),o<0&&(o=(e=>{let n=s(t.clientX-e,t.clientY),a=s(t.clientX+e,t.clientY);return o<0&&n===i&&(o=i+1),o<0&&a===i&&(o=i-1),o})(this.thumbExtraGap)),o===i?this.centerModern():o>-1&&o{this.emit("ready")}))}buildModern(){if("modern"!==this.type)return;const{container:t,track:e,instance:i}=this,s=this.option("thumbTpl")||"";if(!t||!e||!s)return;this.updateModern();for(const t of i.slides||[]){const i=document.createElement("div");k(i,this.cn("slide")),i.appendChild(n(this.formatThumb(t,s))),t.thumbSlideEl=i,e.appendChild(i),this.resizeModernSlide(t)}const o=new i.constructor.Panzoom(t,{content:e,lockAxis:"x",zoom:!1,panOnlyZoomed:!1,bounds:()=>{let t=0,e=0,n=i.slides[0],s=i.slides[i.slides.length-1],o=i.slides[i.page];return n&&s&&o&&(e=-1*this.getModernThumbPos(0),0!==i.page&&(e+=.5*(n.thumbWidth||0)),t=-1*this.getModernThumbPos(i.slides.length-1),i.page!==i.slides.length-1&&(t+=(s.thumbWidth||0)-(o.thumbWidth||0)-.5*(s.thumbWidth||0))),{x:{min:t,max:e},y:{min:0,max:0}}}});o.on("touchStart",(()=>{this.shouldCenter=!1})),o.on("click",((t,e)=>this.onClickModern(e))),o.on("ready",(()=>{this.centerModern(),this.emit("ready")})),o.on(["afterTransform","refresh"],(t=>{this.lazyLoadModern()})),this.panzoom=o,this.refreshModern()}updateModern(){if("modern"!==this.type)return;const{container:t}=this;t&&(this.thumbGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-gap"))||0,this.thumbExtraGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-extra-gap"))||0,this.thumbWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-width"))||40,this.thumbClipWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-clip-width"))||40,this.thumbHeight=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-height"))||40)}refreshModern(){var t;if("modern"===this.type){this.updateModern();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.onTransformM(),null===(t=this.panzoom)||void 0===t||t.updateMetrics(!0),this.centerModern(0)}}centerModern(t){const e=this.instance,{container:i,panzoom:n}=this;if(!i||!n||n.state===O.Init)return;const s=e.page;let o=this.getModernThumbPos(s),a=o;for(let t=e.page-3;te.pages.length-1||t===e.page)continue;const i=1-this.getProgress(t);i>0&&i<1&&(a+=i*(this.getModernThumbPos(t)-o))}let r=100;void 0===t&&(t=.2,e.inTransition.size>0&&(t=.12),Math.abs(-1*n.current.e-a)>n.containerRect.width&&(t=.5,r=0)),n.options.maxVelocity=r,n.applyChange({panX:y(-1*a-n.target.e,1e3),friction:null===e.prevPage?0:t})}lazyLoadModern(){const{instance:t,panzoom:e}=this;if(!e)return;const i=-1*e.current.e||0;let s=this.getModernThumbPos(t.page);if(e.state!==O.Init||0===s)for(const s of t.slides||[]){const t=s.thumbSlideEl;if(!t)continue;const o=t.querySelector("img[data-lazy-src]"),a=s.index,l=this.getModernThumbPos(a),c=i-.5*e.containerRect.innerWidth,h=c+e.containerRect.innerWidth;if(!o||lh)continue;let d=o.dataset.lazySrc;if(!d||!d.length)continue;if(delete o.dataset.lazySrc,o.src=d,o.complete)continue;k(t,this.cn("isLoading"));const u=n(r);t.appendChild(u),o.addEventListener("load",(()=>{t.offsetParent&&(t.classList.remove(this.cn("isLoading")),u.remove())}),!1)}}resizeModernSlide(t){if("modern"!==this.type)return;if(!t.thumbSlideEl)return;const e=t.thumbClipWidth&&t.thumbHeight?Math.round(this.thumbHeight*(t.thumbClipWidth/t.thumbHeight)):this.thumbWidth;t.thumbWidth=e}getModernThumbPos(t){const e=this.instance.slides[t],i=this.panzoom;if(!i||!i.contentRect.fitWidth)return 0;let n=i.containerRect.innerWidth,s=i.contentRect.width;2===this.instance.slides.length&&(t-=1,s=2*this.thumbClipWidth);let o=t*(this.thumbClipWidth+this.thumbGap)+this.thumbExtraGap+.5*(e.thumbWidth||0);return o-=s>n?.5*n:.5*s,y(o||0,1)}build(){const t=this.instance,e=t.container,i=this.option("minCount")||0;if(i){let e=0;for(const i of t.slides||[])i.thumbSrc&&e++;if(e{e.stopPropagation()}}},on:{ready:t=>{const e=t.container;e&&this.hidden&&(this.refresh(),e.style.transition="none",this.hide(),e.offsetHeight,queueMicrotask((()=>{e.style.transition="",this.show()})))}}}),i.attachPlugins({Thumbs:V}),this.ref=i.plugins.Thumbs,this.option("showOnStart")||(this.ref.state=Z.Hidden,this.hidden=!0))}onResize(){var t;const e=null===(t=this.ref)||void 0===t?void 0:t.container;e&&(e.style.maxHeight="")}onKeydown(t,e){const i=this.option("key");i&&i===e&&this.toggle()}toggle(){const t=this.ref;t&&t.state!==Z.Disabled&&(t.state!==Z.Hidden?this.hidden?this.show():this.hide():t.build())}show(){const t=this.ref,e=t&&t.state!==Z.Disabled&&t.container;e&&(this.refresh(),e.offsetHeight,e.removeAttribute("aria-hidden"),e.classList.remove("is-hidden"),this.hidden=!1)}hide(){const t=this.ref,e=t&&t.container;e&&(this.refresh(),e.offsetHeight,e.classList.add("is-hidden"),e.setAttribute("aria-hidden","true")),this.hidden=!0}refresh(){const t=this.ref;if(!t||t.state===Z.Disabled)return;const e=t.container,i=(null==e?void 0:e.firstChild)||null;e&&i&&i.childNodes.length&&(e.style.maxHeight=`${i.getBoundingClientRect().height}px`)}attach(){this.instance.on("Carousel.init",this.onInit),this.instance.on("resize",this.onResize),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onInit),this.instance.off("resize",this.onResize),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(U,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:G});const K={panLeft:{icon:'',change:{panX:-100}},panRight:{icon:'',change:{panX:100}},panUp:{icon:'',change:{panY:-100}},panDown:{icon:'',change:{panY:100}},zoomIn:{icon:'',action:"zoomIn"},zoomOut:{icon:'',action:"zoomOut"},toggle1to1:{icon:'',action:"toggleZoom"},toggleZoom:{icon:'',action:"toggleZoom"},iterateZoom:{icon:'',action:"iterateZoom"},rotateCCW:{icon:'',action:"rotateCCW"},rotateCW:{icon:'',action:"rotateCW"},flipX:{icon:'',action:"flipX"},flipY:{icon:'',action:"flipY"},fitX:{icon:'',action:"fitX"},fitY:{icon:'',action:"fitY"},reset:{icon:'',action:"reset"},toggleFS:{icon:'',action:"toggleFS"}};var J;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Disabled=2]="Disabled"}(J||(J={}));const Q={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'
/
'},download:{tpl:''},prev:{tpl:''},next:{tpl:''},slideshow:{tpl:''},fullscreen:{tpl:''},thumbs:{tpl:''},close:{tpl:''}},parentEl:null},tt={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"};class et extends f{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:J.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(t){var e;if(!t.carousel)return;let i=this.option("display"),n=this.option("absolute"),s=this.option("enabled");if("auto"===s){const t=this.instance.carousel;let e=0;if(t)for(const i of t.slides)(i.panzoom||"image"===i.type)&&e++;e||(s=!1)}s||(i=void 0);let o=0;const a={left:[],middle:[],right:[]};if(i)for(const t of["left","middle","right"])for(const n of i[t]){const i=this.createEl(n);i&&(null===(e=a[t])||void 0===e||e.push(i),o++)}let r=null;if(o&&(r=this.createContainer()),r){for(const[t,e]of Object.entries(a)){const i=document.createElement("div");k(i,"fancybox__toolbar__column is-"+t);for(const t of e)i.appendChild(t);"auto"!==n||"middle"!==t||e.length||(n=!0),r.appendChild(i)}!0===n&&k(r,"is-absolute"),this.state=J.Ready,this.onRefresh()}else this.state=J.Disabled}onClick(t){var e,i;const n=this.instance,s=n.getSlide(),o=null==s?void 0:s.panzoom,a=t.target,r=a&&z(a)?a.dataset:null;if(!r)return;if(void 0!==r.fancyboxToggleThumbs)return t.preventDefault(),t.stopPropagation(),void(null===(e=n.plugins.Thumbs)||void 0===e||e.toggle());if(void 0!==r.fancyboxToggleFullscreen)return t.preventDefault(),t.stopPropagation(),void this.instance.toggleFullscreen();if(void 0!==r.fancyboxToggleSlideshow){t.preventDefault(),t.stopPropagation();const e=null===(i=n.carousel)||void 0===i?void 0:i.plugins.Autoplay;let s=e.isActive;return o&&"mousemove"===o.panMode&&!s&&o.reset(),void(s?e.stop():e.start())}const l=r.panzoomAction,c=r.panzoomChange;if((c||l)&&(t.preventDefault(),t.stopPropagation()),c){let t={};try{t=JSON.parse(c)}catch(t){}o&&o.applyChange(t)}else l&&o&&o[l]&&o[l]()}onChange(){this.onRefresh()}onRefresh(){if(this.instance.isClosing())return;const t=this.container;if(!t)return;const e=this.instance.getSlide();if(!e||e.state!==d.Ready)return;const i=e&&!e.error&&e.panzoom;for(const e of t.querySelectorAll("[data-panzoom-action]"))i?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));let n=i&&i.canZoomIn(),s=i&&i.canZoomOut();for(const e of t.querySelectorAll('[data-panzoom-action="zoomIn"]'))n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="zoomOut"]'))s?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){s||n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));const t=e.querySelector("g");t&&(t.style.display=n?"":"none")}}onDone(t,e){var i;null===(i=e.panzoom)||void 0===i||i.on("afterTransform",(()=>{this.instance.isCurrentSlide(e)&&this.onRefresh()})),this.instance.isCurrentSlide(e)&&this.onRefresh()}createContainer(){const t=this.instance.container;if(!t)return null;const e=this.option("parentEl")||t,i=document.createElement("div");return k(i,"fancybox__toolbar"),e.prepend(i),i.addEventListener("click",this.onClick,{passive:!1,capture:!0}),t&&k(t,"has-toolbar"),this.container=i,i}createEl(t){var e;const i=this.instance.carousel;if(!i)return null;if("toggleFS"===t)return null;if("fullscreen"===t&&!this.instance.fsAPI)return null;let s=null;const o=i.slides.length||0;let a=0,r=0;for(const t of i.slides)(t.panzoom||"image"===t.type)&&a++,("image"===t.type||t.downloadSrc)&&r++;if(o<2&&["infobar","prev","next"].includes(t))return s;if(void 0!==K[t]&&!a)return null;if("download"===t&&!r)return null;if("thumbs"===t){const t=this.instance.plugins.Thumbs;if(!t||!t.isEnabled)return null}if("slideshow"===t){if(!(null===(e=this.instance.carousel)||void 0===e?void 0:e.plugins.Autoplay)||o<2)return null}if(void 0!==K[t]){const e=K[t];s=document.createElement("button"),s.setAttribute("title",this.instance.localize(`{{${t.toUpperCase()}}}`)),k(s,"f-button"),e.action&&(s.dataset.panzoomAction=e.action),e.change&&(s.dataset.panzoomChange=JSON.stringify(e.change)),s.appendChild(n(this.instance.localize(e.icon)))}else{const e=(this.option("items")||[])[t];e&&(s=n(this.instance.localize(e.tpl)),e.click&&s.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),"function"==typeof e.click&&e.click(t)})))}const l=null==s?void 0:s.querySelector("svg");if(l)for(const[t,e]of Object.entries(tt))l.getAttribute(t)||l.setAttribute(t,String(e));return s}removeContainer(){var t;const e=this.container;e&&e.removeEventListener("click",this.onClick,{passive:!1,capture:!0}),null===(t=this.container)||void 0===t||t.remove(),this.container=null,this.state=J.Disabled;const i=this.instance.container;i&&R(i,"has-toolbar")}attach(){this.instance.on("Carousel.initSlides",this.onReady),this.instance.on("done",this.onDone),this.instance.on("reveal",this.onChange),this.instance.on("Carousel.change",this.onChange),this.onReady(this.instance)}detach(){this.instance.off("Carousel.initSlides",this.onReady),this.instance.off("done",this.onDone),this.instance.off("reveal",this.onChange),this.instance.off("Carousel.change",this.onChange),this.removeContainer()}}Object.defineProperty(et,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:Q});const it={Hash:b,Html:$,Images:B,Slideshow:Y,Thumbs:U,Toolbar:et},nt=(t,e)=>{let i=[];return t.childNodes.forEach((t=>{t.nodeType!==Node.ELEMENT_NODE||e&&!t.matches(e)||i.push(t)})),i},st={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var ot;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"}(ot||(ot={}));const at=t=>{if("string"==typeof t&&(t={html:t}),!(t instanceof String||t instanceof HTMLElement)){const e=t.thumb;void 0!==e&&("string"==typeof e&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},rt=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t),lt={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'',dynamicFrom:11,maxCount:1/0,minCount:2};class ct extends f{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let t=this.list;return t||(t=document.createElement("ul"),k(t,this.cn("list")),t.setAttribute("role","tablist"),this.instance.container.appendChild(t),k(this.instance.container,this.cn("hasDots")),this.list=t),t}refresh(){var t;const e=this.instance.pages.length,i=Math.min(2,this.option("minCount")),n=Math.max(2e3,this.option("maxCount")),s=this.option("dynamicFrom");if(en)return void this.cleanup();const o="number"==typeof s&&e>5&&e>=s,a=!this.list||this.isDynamic!==o||this.list.children.length!==e;a&&this.cleanup();const r=this.build();if(S(r,this.cn("isDynamic"),!!o),a)for(let t=0;t=e-1&&s.setAttribute("disabled","")))}createButton(t){const e=this.instance,i=document.createElement("button");i.setAttribute("tabindex","0"),i.setAttribute("title",e.localize(`{{${t.toUpperCase()}}}`)),k(i,this.cn("button")+" "+this.cn("next"===t?"isNext":"isPrev"));const n=e.isRTL?"next"===t?"prev":"next":t;var s;return i.innerHTML=e.localize(this.option(`${n}Tpl`)),i.dataset[`carousel${s=t,s?s.match("^[a-z]")?s.charAt(0).toUpperCase()+s.substring(1):s:""}`]="true",i}build(){let t=this.container;t||(this.container=t=document.createElement("div"),k(t,this.cn("container")),this.instance.container.appendChild(t)),this.next||(this.next=t.appendChild(this.createButton("next"))),this.prev||(this.prev=t.appendChild(this.createButton("prev")))}cleanup(){this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove(),this.prev=null,this.next=null,this.container=null}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(ht,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'',prevTpl:''}});class dt extends f{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){this.nav&&this.target&&(this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.state===ot.Ready&&this.onNavReady(this.nav),this.target.on("ready",this.onTargetReady),this.target.state===ot.Ready&&this.onTargetReady(this.target))}onNavReady(t){t.on("createSlide",this.onNavCreateSlide),t.on("Panzoom.click",this.onNavClick),this.onTargetChange()}onTargetReady(t){t.on("change",this.onTargetChange),t.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(t,e,i){var n,s;const o=i.target,{nav:a,target:r}=this;if(!a||!r||!o)return;const l=o.closest("[data-index]");if(!l)return;i.stopPropagation(),i.preventDefault();const c=parseInt(l.dataset.index||"",10)||0,h=r.getPageForSlide(c),d=a.getPageForSlide(c);r.page!==h&&r.slideTo(h,{friction:null===(s=null===(n=this.nav)||void 0===n?void 0:n.plugins)||void 0===s?void 0:s.Sync.option("friction")}),this.markSelectedSlide(c),a.page!==d&&a.slideTo(d)}onNavCreateSlide(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}onTargetChange(){const{target:t,nav:e}=this;if(!t||!e)return;if(e.state!==ot.Ready||t.state!==ot.Ready)return;const i=t.pages[t.page].slides[0].index,n=e.getPageForSlide(i);this.markSelectedSlide(i),e.slideTo(n)}markSelectedSlide(t){const{nav:e}=this;if(!e||e.state!==ot.Ready)return;this.selectedIndex=t,[...e.slides].filter((t=>t.el&&t.el.classList.remove("is-nav-selected")));const i=e.slides[t];i&&i.el&&i.el.classList.add("is-nav-selected")}attach(){let t=this.options.target,e=this.options.nav;t?this.addAsNavFor(t):e&&this.addAsTargetFor(e)}detach(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.nav=null,this.target&&(this.target.off("ready",this.onTargetReady),this.target.off("refresh",this.onTargetChange),this.target.off("change",this.onTargetChange)),this.target=null}}Object.defineProperty(dt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const ut={Navigation:ht,Dots:ct,Sync:dt};class pt extends m{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===ot.Ready}get isInfinite(){let t=!1;const e=this.contentDim,i=this.viewportDim;return this.pages.length>=2&&e>1.5*i&&(t=this.option("infinite")),t}get isRTL(){return"rtl"===this.option("direction")}get isHorizontal(){return"x"===this.option("axis")}constructor(t,e={},n={}){if(super(),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:ot.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),"string"==typeof t&&(t=document.querySelector(t)),!t||!z(t))throw new Error("No Element found");this.container=t,this.slideNext=i(this.slideNext.bind(this),175),this.slidePrev=i(this.slidePrev.bind(this),175),this.userOptions=e,this.userPlugins=n,queueMicrotask((()=>{this.processOptions()}))}processOptions(){const i=e({},pt.defaults,this.userOptions);let n="";const s=i.breakpoints;if(s&&t(s))for(const[o,a]of Object.entries(s))window.matchMedia(o).matches&&t(a)&&(n+=o,e(i,a));n===this.bp&&this.state!==ot.Init||(this.bp=n,this.state===ot.Ready&&(i.initialSlide=this.pages[this.page].slides[0].index),this.state!==ot.Init&&this.destroy(),super.setOptions(i),!1===this.option("enabled")?this.attachEvents():setTimeout((()=>{this.init()}),0))}init(){this.state=ot.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},pt.Plugins),this.userPlugins)),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=ot.Ready,this.emit("ready")}initLayout(){const{container:t}=this,e=this.option("classes");k(t,this.cn("container")),S(t,e.isLTR,!this.isRTL),S(t,e.isRTL,this.isRTL),S(t,e.isVertical,!this.isHorizontal),S(t,e.isHorizontal,this.isHorizontal);let i=this.option("viewport")||t.querySelector(`.${e.viewport}`);i||(i=document.createElement("div"),k(i,e.viewport),i.append(...nt(t,`.${e.slide}`)),t.prepend(i));let n=this.option("track")||t.querySelector(`.${e.track}`);n||(n=document.createElement("div"),k(n,e.track),n.append(...Array.from(i.childNodes))),n.setAttribute("aria-live","polite"),i.contains(n)||i.prepend(n),this.viewport=i,this.track=n,this.emit("initLayout")}initSlides(){const{track:t}=this;if(t){this.slides=[],[...nt(t,`.${this.cn("slide")}`)].forEach((t=>{if(z(t)){const e=at({el:t,isDom:!0,index:this.slides.length});this.slides.push(e),this.emit("initSlide",e,this.slides.length)}}));for(let t of this.option("slides",[])){const e=at(t);e.index=this.slides.length,this.slides.push(e),this.emit("initSlide",t,this.slides.length)}this.emit("initSlides")}}setInitialPage(){let t=0;const e=this.option("initialSlide");t="number"==typeof e?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0,this.page=t}setInitialPosition(){if(!this.track||!this.pages.length)return;let t=this.page;this.pages[t]||(this.page=t=0);const e=this.pages[t].pos*(this.isRTL&&this.isHorizontal?1:-1),i=this.isHorizontal?`${e}px`:"0",n=this.isHorizontal?"0":`${e}px`;this.track.style.transform=`translate3d(${i}, ${n}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const t=this.option("Panzoom")||{};this.panzoom=new j(this.viewport,e({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,decelFriction:.12,click:!1,dblClick:!1,touch:t=>!(this.pages.length<2&&!t.options.infinite),bounds:()=>this.getBounds(),maxVelocity:t=>Math.abs(t.target[this.axis]-t.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on("*",((t,e,...i)=>{this.emit(`Panzoom.${e}`,t,...i)})),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation),this.panzoom.on("touchStart",((t,e)=>{this.inTransition.size&&e.preventDefault()}))}attachEvents(){const t=this.container;t&&(t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let t=[];const{contentDim:e,viewportDim:i}=this,n=this.option("slidesPerPage");if("number"==typeof n&&e>i){for(let e=0;ei)&&(t.push(rt()),s=t.length-1,o=0),o+=e.dim+e.gap,t[s].slides.push(e);return t}processPages(){const t=this.pages,{contentDim:e,viewportDim:i}=this,n=this.option("center"),s=this.option("fill");if(t.forEach(((t,e)=>{t.index=e,t.pos=t.slides[0].pos,t.dim=0;for(const[e,i]of t.slides.entries())t.dim+=i.dim,e{s&&!this.isInfinite&&e>i&&(t.pos=Math.max(t.pos,0),t.pos=Math.min(t.pos,e-i)),t.pos=y(t.pos,1e3),t.dim=y(t.dim,1e3)})),this.isInfinite)return t;const o=[];let a;return t.forEach((t=>{const e=Object.assign({},t);a&&e.pos===a.pos?(a.dim+=e.dim,a.slides=[...a.slides,...e.slides]):(e.index=o.length,a=e,o.push(e))})),o}getPageFromIndex(t=0){const e=this.pages.length;let i;return t=parseInt((t||0).toString())||0,i=this.isInfinite?(t%e+e)%e:Math.max(Math.min(t,this.pages.length-1),0),i}getSlideMetrics(t){const e=this.isHorizontal?"width":"height";let i=0,n=0,s=t.el;s?i=parseFloat(s.dataset[e]||"")||0:(s=document.createElement("div"),s.style.visibility="hidden",k(s,this.cn("slide")+" "+t.class),(this.track||document.body).prepend(s)),i?(s.style[e]=`${i}px`,s.style["width"===e?"height":"width"]=""):i=s.getBoundingClientRect()[e];const o=getComputedStyle(s);return"content-box"===o.boxSizing&&(this.isHorizontal?(i+=parseFloat(o.paddingLeft)||0,i+=parseFloat(o.paddingRight)||0):(i+=parseFloat(o.paddingTop)||0,i+=parseFloat(o.paddingBottom)||0)),n=parseFloat(o[this.isHorizontal?"marginRight":"marginBottom"])||0,this.isHorizontal,t.el||s.remove(),{dim:i,gap:n}}getBounds(){let t={min:0,max:0};if(this.isInfinite)t={min:-1/0,max:1/0};else if(this.pages.length){const e=this.pages[0].pos,i=this.pages[this.pages.length-1].pos;t=this.isRTL&&this.isHorizontal?{min:e,max:i}:{min:-1*i,max:-1*e}}return{x:this.isHorizontal?t:{min:0,max:0},y:this.isHorizontal?{min:0,max:0}:t}}repositionSlides(){const{viewportDim:t,contentDim:e,page:i,pages:n}=this;let s,o=0,a=0,r=0,l=0;this.panzoom?l=-1*this.panzoom.current[this.isHorizontal?"e":"f"]:n[i]&&(l=n[i].pos||0),s=this.isHorizontal?this.isRTL?"right":"left":"top",this.isRTL&&this.isHorizontal&&(l*=-1);for(const t of this.slides)t.el?("top"===s?(t.el.style.right="",t.el.style.left=""):t.el.style.top="",t.index!==o?t.el.style[s]=0===a?"":`${a}px`:t.el.style[s]="",r+=t.dim+t.gap,o++):a+=t.dim+t.gap;if(this.isInfinite&&r)for(const i of this.slides)i.el&&(y(i.pos)y(e-t)&&(i.el.style[s]=`${a+r}px`),y(i.pos+i.gap)>=y(e-t)&&y(i.pos)>y(l+t)&&y(l)1&&(c=this.pages[d[0]],h=this.pages[d[1]]),c&&h){let t=0;for(const e of this.slides)e.el?this.inTransition.has(e.index)&&c.slides.indexOf(e)<0&&(e.el.style[s]=`${t+(c.pos-h.pos)}px`):t+=e.dim+e.gap}}createSlideEl(t){if(!this.track||!t)return;if(t.el)return;const e=document.createElement("div");k(e,this.cn("slide")),k(e,t.class),t.html&&(e.innerHTML=t.html);const i=[];this.slides.forEach(((t,e)=>{t.el&&i.push(e)}));const n=t.index;let s=null;if(i.length){let t=i.reduce(((t,e)=>Math.abs(e-n)this.page?1:-1,a=this.pages[s].pos*(this.isRTL?1:-1);if(this.page===s&&a===n.target[this.axis])return!1;this.clearTransitions();const r=n.isResting;k(this.container,this.cn("inTransition"));const l=this.pages[this.page].slides[0],c=this.pages[s].slides[0];this.inTransition.add(c.index),this.createSlideEl(c);let h=l.el,d=c.el;r||"slide"===e||(e="fadeFast",h=null);const u=this.isRTL?"next":"prev",p=this.isRTL?"prev":"next";return h&&(this.inTransition.add(l.index),l.transition=e,h.addEventListener("animationend",this.onAnimationEnd),h.classList.add(`f-${e}Out`,`to-${o>0?p:u}`)),d&&(c.transition=e,d.addEventListener("animationend",this.onAnimationEnd),d.classList.add(`f-${e}In`,`from-${o>0?u:p}`)),n.panTo({x:this.isHorizontal?a:0,y:this.isHorizontal?0:a,friction:0}),this.onChange(s),!0}manageSlideVisiblity(){const t=new Set,e=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const n of this.slides)i.has(n)?t.add(n):e.add(n);for(const e of this.inTransition)t.add(this.slides[e]);for(const e of t)this.createSlideEl(e),this.lazyLoadSlide(e);for(const i of e)t.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t="aria-hidden";let e=this.cn("isSelected");if(e)for(const i of this.slides)i.el&&(i.el.dataset.index=`${i.index}`,this.pages[this.page].slides.includes(i)?(i.el.classList.contains(e)||(k(i.el,e),this.emit("selectSlide",i)),i.el.removeAttribute(t)):(i.el.classList.contains(e)&&(R(i.el,e),this.emit("unselectSlide",i)),i.el.setAttribute(t,"true")))}flipInfiniteTrack(){const t=this.panzoom;if(!t||!this.isInfinite)return;const e="x"===this.option("axis")?"e":"f",{viewportDim:i,contentDim:n}=this;let s=t.current[e],o=t.target[e]-s,a=0,r=.5*i,l=n;this.isRTL&&this.isHorizontal?(s<-r&&(a=-1,s+=l),s>l-r&&(a=1,s-=l)):(s>r&&(a=1,s-=l),s<-l+r&&(a=-1,s+=l)),a&&(t.current[e]=s,t.target[e]=s+o)}lazyLoadSlide(t){const e=this,i=t&&t.el;if(!i)return;const s=new Set;i.querySelectorAll("[data-lazy-srcset]").forEach((t=>{t instanceof HTMLImageElement&&s.add(t)})),i.querySelectorAll("[data-lazy-src]").forEach((t=>{t instanceof HTMLImageElement?s.add(t):z(t)&&(t.style.backgroundImage=`url('${t.dataset.lazySrc||""}')`)}));const o=(t,i,n)=>{n&&(n.remove(),n=null),i.complete&&(i.style.display=""),this.option("adaptiveHeight")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&e.setViewportHeight()};for(const e of s){let i=null;e.src=e.dataset.lazySrcset||e.dataset.lazySrc||"",delete e.dataset.lazySrc,delete e.dataset.lazySrcset,e.style.display="none",e.addEventListener("error",(()=>{o(t,e,i)})),e.addEventListener("load",(()=>{o(t,e,i)})),setTimeout((()=>{e.parentNode&&t.el&&(e.complete?o(t,e,i):(i=n(r),e.parentNode.insertBefore(i,e)))}),300)}let a=i.dataset.lazySrc;a&&a.length&&(i.style.backgroundImage=`url('${a}')`)}clearTransitions(){this.inTransition.clear(),R(this.container,this.cn("inTransition"));const t=["to-prev","to-next","from-prev","from-next"];for(const e of this.slides){const i=e.el;if(i){i.removeEventListener("animationend",this.onAnimationEnd),i.classList.remove(...t);const n=e.transition;n&&i.classList.remove(`f-${n}Out`,`f-${n}In`)}}this.manageSlideVisiblity()}onAnimationEnd(t){const e=t.target,i=e?parseInt(e.dataset.index||"",10)||0:-1,n=this.slides[i],s=t.animationName;if(!e||!n||!s)return;const o=!!this.inTransition.has(i)&&n.transition;o&&s.substring(0,o.length+2)===`f-${o}`&&this.inTransition.delete(i),this.inTransition.size||this.clearTransitions(),i===this.page&&this.emit("settle")}onDecel(t,e=0,i=0){const n=this.isInfinite,s=this.isHorizontal?e:i,o=this.pages.length;if(!o)return;const a=this.option("dragFree");let r=this.page,l=0;const c=this.axis;!n&&(t.target[c],this.viewportDim);const h=t.current[c]*(this.isRTL&&this.isHorizontal?1:-1);let{pageIndex:d}=this.getPageFromPosition(h);if(a||Math.abs(s)<10){const e=t.target[c]*(this.isRTL&&this.isHorizontal?1:-1),{pageIndex:i}=this.getPageFromPosition(e);r=i}else r=this.isRTL&&this.isHorizontal?s<0?d-1:d+1:s<0?d+1:d-1,n||(r=Math.max(0,Math.min(r,this.pages.length-1)));if(n&&(l=Math.floor(r/o)||0),r=(r%o+o)%o,a&&t.dragOffset["e"===c?"x":"y"]);else{const e=this.contentDim;let i=(this.pages[r].pos+l*e)*(this.isRTL&&this.isHorizontal?1:-1);if(Math.abs(t.target[c]-i)<.1&&t.lockedAxis===("e"==c?"y":"x"))return;if(t.target[c]===i)return;t.applyChange({panX:this.isHorizontal?i-t.target.e:0,panY:this.isHorizontal?0:i-t.target.f,friction:t.option("decelFriction")})}r!==this.page&&this.onChange(r)}onClick(t){const e=t.target,i=e&&z(e)?e.dataset:null;let n;i&&(void 0!==i.carouselPage?n="slideTo":void 0!==i.carouselNext?n="slideNext":void 0!==i.carouselPrev&&(n="slidePrev")),n?(t.preventDefault(),t.stopPropagation(),e&&!e.hasAttribute("disabled")&&this[n](i&&"slideTo"===n?i.carouselPage:void 0)):this.emit("click",t)}onSlideTo(t){const e=t.detail||0;this.slideTo(this.getPageForSlide(e),{friction:0})}onChange(t,e=0){const i=this.page;this.prevPage=i,this.page=t,this.option("adaptiveHeight")&&this.setViewportHeight(),this.emit("change",t,i,e)}onRefresh(t,e=""){let i=this.contentDim,n=this.viewportDim;this.updateMetrics(),this.contentDim===i&&this.viewportDim===n||this.slideTo(this.page,{friction:0,transition:!1})}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(){this.flipInfiniteTrack(),this.manageSlideVisiblity()}onEndAnimation(){this.emit("settle")}reInit(t=null,e=null){this.destroy(),this.state=ot.Init,this.userOptions=t||this.userOptions,this.userPlugins=e||this.userPlugins,this.processOptions()}slideTo(t=0,{friction:e=this.option("friction"),transition:i=this.option("transition")}={}){if(this.state===ot.Destroy)return;const n=this.panzoom,s=this.pages.length;if(!n||!s)return;if(this.transitionTo(t,i))return;const o=this.axis,a=this.getPageFromIndex(t);let r=this.pages[a].pos,l=0;if(this.isInfinite){const t=n.current[o]*(this.isRTL&&this.isHorizontal?1:-1),e=this.contentDim,i=r+e,s=r-e;Math.abs(t-i){t.el&&(s=Math.max(s,t.el.offsetHeight))}))),i.style.height=s?`${s}px`:""}getPageForSlide(t){for(const e of this.pages)for(const i of e.slides)if(i.index===t)return e.index;return-1}getVisibleSlides(t=0){var e;const i=new Set;let{contentDim:n,viewportDim:s,pages:o,page:a}=this;n=n+(null===(e=this.slides[this.slides.length-1])||void 0===e?void 0:e.gap)||0;let r=0;r=this.panzoom?-1*this.panzoom.current[this.axis]:o[a]&&o[a].pos||0,this.isInfinite&&(r-=Math.floor(r/n)*n),this.isRTL&&this.isHorizontal&&(r*=-1),r=y(r,1e3);const l=y(r-s*t,1e3),c=y(r+s*(t+1),1e3),h=this.isInfinite?[-1,0,1]:[0];for(const t of this.slides)for(const e of h){const s=t.pos+e*n,o=t.pos+t.dim+t.gap+e*n;sl&&i.add(t)}return i}getPageFromPosition(t){const{viewportDim:e,contentDim:i}=this,n=this.pages.length;let s=0,o=0;const a=this.option("center");a&&(t+=.5*e),this.isInfinite||(t=Math.max(this.slides[0].pos,Math.min(t,this.slides[this.slides.length-1].pos)));const r=i+this.slides[this.slides.length-1].gap,l=Math.floor(t/r)||0;t-=l*r;let c=this.slides[this.slides.length-1],h=this.slides.find((e=>{const i=t+(c&&!a?.5*c.dim:0);return c=e,e.pos<=i&&e.pos+e.dim+e.gap>i}));return h||(h=this.slides[this.slides.length-1]),o=this.getPageForSlide(h.index),s=o+l*n,{page:s,pageIndex:o}}destroy(){if([ot.Destroy].includes(this.state))return;this.state=ot.Destroy;const{container:t,viewport:e,track:i,slides:n,panzoom:s}=this,o=this.option("classes");t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),t.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),s&&(s.destroy(),this.panzoom=null),n&&n.forEach((t=>{this.removeSlideEl(t)})),this.detachPlugins(),this.track=null,this.viewport=null,this.page=0,e&&i&&e.replaceWith(...i.childNodes);for(const[e,i]of Object.entries(o))"container"!==e&&i&&t.classList.remove(i);this.slides=[];const a=this.events.get("ready");this.events=new Map,a&&this.events.set("ready",a)}}Object.defineProperty(pt,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:j}),Object.defineProperty(pt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:st}),Object.defineProperty(pt,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:ut});let mt=null,ft=null;const gt=new Map;let bt=0;class vt extends m{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(t=[],e={},n={}){super(e),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:h.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fsAPI",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.onWheel=i(this.onWheel.bind(this),300),this.fsAPI=(()=>{let t,e="",i="",n="";return document.fullscreenEnabled?(e="requestFullscreen",i="exitFullscreen",n="fullscreenElement"):document.webkitFullscreenEnabled&&(e="webkitRequestFullscreen",i="webkitExitFullscreen",n="webkitFullscreenElement"),e&&(t={request:function(t){return"webkitRequestFullscreen"===e?t[e](Element.ALLOW_KEYBOARD_INPUT):t[e]()},exit:function(){return document[n]&&document[i]()},isFullscreen:function(){return document[n]}}),t})(),this.id=e.id||++bt,gt.set(this.id,this),this.userSlides=t,this.userPlugins=n,queueMicrotask((()=>{this.init()}))}init(){this.state=h.Init,this.attachPlugins(Object.assign(Object.assign({},vt.Plugins),this.userPlugins)),this.emit("init"),!0===this.option("hideScrollbar")&&(()=>{if(!s)return;if(document.body.classList.contains("compensate-for-scrollbar"))return;const t=window.innerWidth-document.documentElement.getBoundingClientRect().width;document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",`${t}px`),t&&document.body.classList.add("compensate-for-scrollbar")})(),this.initLayout();const t=()=>{this.initCarousel(this.userSlides),this.state=h.Ready,this.attachEvents(),this.emit("ready"),setTimeout((()=>{this.container&&this.container.setAttribute("aria-hidden","false")}),16)};this.option("Fullscreen.autoStart")&&this.fsAPI&&!this.fsAPI.isFullscreen()?this.fsAPI.request(this.container).then((()=>t())).catch((()=>t())):t()}initLayout(){const t=this.option("parentEl")||document.body,e=n(this.localize(this.option("tpl.main")||""));e&&(e.setAttribute("id",`fancybox-${this.id}`),e.setAttribute("aria-label",this.localize("{{MODAL}}")),e.classList.toggle("is-compact",this.isCompact),this.container=e,this.footer=e.querySelector(".fancybox__footer"),t.appendChild(e),document.documentElement.classList.add("with-fancybox"),mt&&ft||(mt=document.createElement("button"),mt.classList.add("fancybox-focus-guard"),mt.setAttribute("aria-hidden","true"),mt.setAttribute("aria-label","Focus guard"),mt.setAttribute("type","button"),ft=mt.cloneNode(),document.body.prepend(mt),document.body.append(ft)),this.option("animated")&&(e.classList.add("is-animated"),setTimeout((()=>{this.isClosing()||e.classList.remove("is-animated")}),350)),this.emit("initLayout"))}initCarousel(t){const i=this.container;if(!i)return;const n=i.querySelector(".fancybox__carousel");if(!n)return;const s=this.carousel=new pt(n,e({},{slides:t,transition:"fade",Panzoom:{lockAxis:this.option("dragToClose")?"xy":"x",infinite:!!this.option("dragToClose")&&"y"},Dots:!1,Navigation:{classes:{container:"fancybox__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"}},initialPage:this.option("startIndex"),l10n:this.option("l10n")},this.option("Carousel")||{}));s.on("*",((t,e,...i)=>{this.emit(`Carousel.${e}`,t,...i)})),s.on(["ready","change"],(()=>{this.manageCaption(this.getSlide())})),s.on("removeSlide",((t,e)=>{e.closeBtnEl&&e.closeBtnEl.remove(),e.closeBtnEl=void 0,e.captionEl&&e.captionEl.remove(),e.captionEl=void 0,e.spinnerEl&&e.spinnerEl.remove(),e.spinnerEl=void 0,e.state=void 0})),s.on("Panzoom.touchStart",(()=>{this.isCompact||this.endIdle()})),s.on("settle",(()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&this.checkFocus()})),this.option("dragToClose")&&(s.on("Panzoom.afterTransform",((t,e)=>{const i=this.container;if(i){const t=Math.abs(e.current.f),n=t<1?"":Math.max(.5,Math.min(1,1-t/e.contentRect.fitHeight*1.5));i.style.setProperty("--fancybox-ts",n?"0s":""),i.style.setProperty("--fancybox-opacity",n+"")}})),s.on("Panzoom.touchEnd",((t,e,i)=>{const n=Math.abs(e.dragOffset.y);"y"===e.lockedAxis&&(n>=200||n>=50&&e.dragOffset.time<300)&&(i&&i.cancelable&&i.preventDefault(),this.close(i,"f-throwOut"+(e.current.f<0?"Up":"Down")))}))),s.on(["change"],(t=>{var e;let i=null===(e=this.getSlide())||void 0===e?void 0:e.triggerEl;if(i){const e=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:t.page});i.dispatchEvent(e)}})),s.on(["refresh","change"],(t=>{const e=this.container;if(!e)return;for(const i of e.querySelectorAll("[data-fancybox-current-index]"))i.innerHTML=t.page+1;for(const i of e.querySelectorAll("[data-fancybox-count]"))i.innerHTML=t.pages.length;if(!t.isInfinite){for(const i of e.querySelectorAll("[data-fancybox-next]"))t.page0?(i.removeAttribute("disabled"),i.removeAttribute("tabindex")):(i.setAttribute("disabled",""),i.setAttribute("tabindex","-1"))}const i=this.getSlide();let n=(null==i?void 0:i.downloadSrc)||"";n||!i||"image"!==i.type||i.error||"string"!=typeof i.src||(n=i.src);for(const t of e.querySelectorAll("[data-fancybox-download]"))n?(t.removeAttribute("disabled"),t.removeAttribute("tabindex"),t.setAttribute("href",n),t.setAttribute("download",n),t.setAttribute("target","_blank")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"),t.removeAttribute("href"),t.removeAttribute("download"))})),this.emit("initCarousel")}attachEvents(){const t=this.container;t&&(document.addEventListener("keydown",this.onKeydown,{passive:!1,capture:!0}),t.addEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),document.addEventListener("mousemove",this.onMousemove),window.addEventListener("resize",this.onResize),this.option("trapFocus")&&document.addEventListener("focus",this.onFocus,!0),document.addEventListener("visibilitychange",this.onVisibilityChange,!1))}detachEvents(){const t=this.container;t&&(document.removeEventListener("keydown",this.onKeydown,{passive:!1,capture:!0}),t.removeEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),document.removeEventListener("mousemove",this.onMousemove),window.removeEventListener("resize",this.onResize),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),document.removeEventListener("focus",this.onFocus,!0))}onClick(t){var e;if(this.isClosing())return;!this.isCompact&&this.option("idle")&&this.resetIdle();const i=t.composedPath()[0];if(i===(null===(e=this.carousel)||void 0===e?void 0:e.container))return;if(i.closest(".f-spinner")||i.closest("[data-fancybox-close]"))return t.preventDefault(),void this.close(t);if(i.closest("[data-fancybox-prev]"))return t.preventDefault(),void this.prev();if(i.closest("[data-fancybox-next]"))return t.preventDefault(),void this.next();if(this.isCompact)return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout((()=>{this.toggleIdle(),this.clickTimer=null}),350));if(this.emit("click",t),t.defaultPrevented)return;let n=!1;const s=document.activeElement;if(i.closest(".fancybox__content")){if(s){if(s.closest("[contenteditable]"))return;i.matches(a)||s.blur()}if((o=window.getSelection())&&"Range"===o.type)return;n=this.option("contentClick")}else i.closest(".fancybox__carousel")&&!i.matches(a)&&(n=this.option("backdropClick"));var o;"close"===n?(t.preventDefault(),this.close(t)):"next"===n?(t.preventDefault(),this.next()):"prev"===n&&(t.preventDefault(),this.prev())}onWheel(t){if(this.emit("wheel",t),t.defaultPrevented)return;const e=this.option("wheel",t);if("close"===e)t.preventDefault(),this.close(t);else if("slide"===e){const e=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail));t.preventDefault(),this[e>0?"next":"prev"]()}}onKeydown(t){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const e=t.key,i=this.option("keyboard");if(!i||t.ctrlKey||t.altKey||t.shiftKey)return;const n=t.composedPath()[0],s=document.activeElement&&document.activeElement.classList,o=s&&s.contains("f-button")||n.dataset.carouselPage;if("Escape"!==e&&!o&&z(n)){if(n.isContentEditable||-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(n.nodeName))return}this.emit("keydown",e,t);const a=i[e];"function"==typeof this[a]&&this[a]()}onResize(){const t=this.container;if(!t)return;const e=this.isCompact;t.classList.toggle("is-compact",e),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.emit("resize")}onFocus(t){this.isTopmost()&&this.focus(t)}onMousemove(t){this.prevMouseMoveEvent=t,!this.isCompact&&this.option("idle")&&this.resetIdle()}onVisibilityChange(){"visible"===document.visibilityState?this.checkFocus():this.endIdle()}manageCloseBtn(t){const e=this.optionFor(t,"closeButton")||!1;if("auto"===e){const t=this.plugins.Toolbar;if(t&&t.state===J.Ready)return}if(!e)return;if(!t.contentEl||t.closeBtnEl)return;const i=n(this.localize(this.option("tpl.closeButton")));t.closeBtnEl=t.contentEl.appendChild(i),t.el&&k(t.el,"has-close-btn")}manageCaption(t){var e,i,n;const s=this.container;if(!s)return;const o=this.isCompact||this.option("commonCaption"),a=!o;if(this.caption&&this.stop(this.caption),a&&this.caption&&(this.caption.remove(),this.caption=null),o&&!this.caption)for(const t of(null===(e=this.carousel)||void 0===e?void 0:e.slides)||[])t.captionEl&&(t.captionEl.remove(),t.captionEl=void 0,null===(i=t.el)||void 0===i||i.classList.remove("has-caption"),null===(n=t.el)||void 0===n||n.removeAttribute("aria-labelledby"));if(t||(t=this.getSlide()),!t||o&&!this.isCurrentSlide(t))return;const r=t.el;let l=this.optionFor(t,"caption","");if("string"!=typeof l||!l.length)return void(o&&this.caption&&this.animate(this.caption,"f-fadeOut",(()=>{var t;null===(t=this.caption)||void 0===t||t.remove(),this.caption=null})));let c=null;if(a){if(c=t.captionEl||null,r&&!c){const e=`fancybox__caption_${this.id}_${t.index}`;c=document.createElement("div"),c.className="fancybox__caption",c.setAttribute("id",e),t.captionEl=r.appendChild(c),r.classList.add("has-caption"),r.setAttribute("aria-labelledby",e)}}else{if(c=this.caption,c||(c=s.querySelector(".fancybox__caption")),!c){c=document.createElement("div"),c.dataset.fancyboxCaption="",c.className="fancybox__caption",c.innerHTML=l;(this.footer||s).prepend(c)}s.classList.add("has-caption"),this.caption=c}c&&(c.innerHTML=l)}checkFocus(){var t;const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}focus(t){var e;if(this.ignoreFocusChange)return;const i=document.activeElement||null,n=(null==t?void 0:t.target)||null,r=this.container,l=this.getSlide();if(!r||!(null===(e=this.carousel)||void 0===e?void 0:e.viewport))return;const c=l&&l.state===d.Ready?l.el:null;if(!c||c.contains(i))return;t&&t.cancelable&&t.preventDefault(),this.ignoreFocusChange=!0;const h=Array.from(r.querySelectorAll(a));let u,p=[r];for(let t of h){const e=t.offsetParent&&!t.closest('[aria-hidden="true"]'),i=c&&c.contains(t),n=!this.carousel.viewport.contains(t);e&&(i||n)?(p.push(t),void 0!==t.dataset.origTabindex&&(t.tabIndex=parseFloat(t.dataset.origTabindex)),t.removeAttribute("data-orig-tabindex"),(t.hasAttribute("autoFocus")||!u&&i)&&(u=t)):(t.dataset.origTabindex=void 0===t.dataset.origTabindex?t.getAttribute("tabindex")||void 0:t.dataset.origTabindex,t.tabIndex=-1)}let m=null;t?(!n||p.indexOf(n)<0)&&(m=r,p.length&&(i===ft?m=p[0]:this.lastFocus!==r&&i!==mt||(m=p[p.length-1]))):this.option("autoFocus")&&u?m=u:i&&p.indexOf(i)<0&&(m=r),m&&(t=>{if(t&&s){void 0===o&&document.createElement("div").focus({get preventScroll(){return o=!0,!1}});try{if(o)t.focus({preventScroll:!0});else{const e=window.pageXOffset||document.body.scrollTop,i=window.pageYOffset||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:i,behavior:"auto"})}}catch(t){}}})(m),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const t=this.carousel;t&&t.pages.length>1&&t.slideNext()}prev(){const t=this.carousel;t&&t.pages.length>1&&t.slidePrev()}jumpTo(...t){this.carousel&&this.carousel.slideTo(...t)}isTopmost(){var t;return(null===(t=vt.getInstance())||void 0===t?void 0:t.id)==this.id}animate(t=null,e="",i){if(!t||!e)return void(i&&i());this.stop(t);const n=s=>{s.target===t&&t.dataset.animationName&&(t.removeEventListener("animationend",n),delete t.dataset.animationName,i&&i(),t.classList.remove(e))};t.dataset.animationName=e,t.addEventListener("animationend",n),t.classList.add(e)}stop(t){t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:t}))}setContent(t,e="",i=!0){if(this.isClosing())return;const n=t.el;if(!n)return;let s=null;if(z(e))["img","iframe","video","audio"].includes(e.nodeName.toLowerCase())?(s=document.createElement("div"),s.appendChild(e)):s=e;else{const t=document.createRange().createContextualFragment(e);s=document.createElement("div"),s.appendChild(t)}s instanceof Element&&t.filter&&!t.error&&(s=s.querySelector(t.filter)),s instanceof Element?(s.classList.add("fancybox__content"),t.id&&s.setAttribute("id",t.id),"none"!==s.style.display&&"none"!==getComputedStyle(s).getPropertyValue("display")||(s.style.display=t.display||this.option("defaultDisplay")||"flex"),n.classList.add(`has-${t.error?"error":t.type||"unknown"}`),n.prepend(s),t.contentEl=s,i&&this.revealContent(t),this.manageCloseBtn(t),this.manageCaption(t)):this.setError(t,"{{ELEMENT_NOT_FOUND}}")}revealContent(t,e){const i=t.el,n=t.contentEl;i&&n&&(this.emit("reveal",t),this.hideLoading(t),t.state=d.Opening,(e=this.isOpeningSlide(t)?void 0===e?this.optionFor(t,"showClass"):e:"f-fadeIn")?this.animate(n,e,(()=>{this.done(t)})):this.done(t))}done(t){var e;this.isClosing()||(t.state=d.Ready,this.emit("done",t),null===(e=t.el)||void 0===e||e.classList.add("is-done"),this.isCurrentSlide(t)&&this.option("autoFocus")&&queueMicrotask((()=>{var t;if(this.option("autoFocus")){const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}})),this.isOpeningSlide(t)&&!this.isCompact&&this.option("idle")&&this.setIdle())}isCurrentSlide(t){const e=this.getSlide();return!(!t||!e)&&e.index===t.index}isOpeningSlide(t){var e,i;return null===(null===(e=this.carousel)||void 0===e?void 0:e.prevPage)&&t.index===(null===(i=this.getSlide())||void 0===i?void 0:i.index)}showLoading(t){t.state=d.Loading;const e=t.el;if(!e)return;e.classList.add("is-loading"),this.emit("loading",t),t.spinnerEl||setTimeout((()=>{if(!this.isClosing()&&!t.spinnerEl&&t.state===d.Loading){let i=n(r);t.spinnerEl=i,e.prepend(i),this.animate(i,"f-fadeIn")}}),250)}hideLoading(t){const e=t.el;if(!e)return;const i=t.spinnerEl;this.isClosing()?null==i||i.remove():(e.classList.remove("is-loading"),i&&this.animate(i,"f-fadeOut",(()=>{i.remove()})),t.state===d.Loading&&(this.emit("loaded",t),t.state=d.Ready))}setError(t,e){if(this.isClosing())return;this.emit("error"),t.error=e,this.hideLoading(t),this.clearContent(t);const i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(e||"

{{ERROR}}

"),this.setContent(t,i)}clearContent(t){var e;null===(e=this.carousel)||void 0===e||e.emit("removeSlide",t),t.contentEl&&(t.contentEl.remove(),t.contentEl=void 0),t.closeBtnEl&&(t.closeBtnEl.remove(),t.closeBtnEl=void 0);const i=t.el;i&&(R(i,"is-loading"),R(i,"has-error"),R(i,"has-unknown"),R(i,`has-${t.type||"unknown"}`))}getSlide(){var t;const e=this.carousel;return(null===(t=null==e?void 0:e.pages[null==e?void 0:e.page])||void 0===t?void 0:t.slides[0])||void 0}close(t,e){if(this.isClosing())return;const i=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",i,t),i.defaultPrevented)return;t&&t.cancelable&&(t.preventDefault(),t.stopPropagation());const n=this.fsAPI,s=()=>{this.proceedClose(t,e)};n&&n.isFullscreen()?Promise.resolve(n.exit()).then((()=>s())):s()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(t=!1){const e=()=>{var t;this.clearIdle(),this.idle=!0,null===(t=this.container)||void 0===t||t.classList.add("is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(t)e();else{const t=this.option("idle");t&&(this.idleTimer=setTimeout(e,t))}}endIdle(){var t;this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,null===(t=this.container)||void 0===t||t.classList.remove("is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){const t=this.fsAPI;t&&(t.isFullscreen()?t.exit():this.container&&t.request(this.container))}isClosing(){return[h.Closing,h.CustomClosing,h.Destroy].includes(this.state)}proceedClose(t,e){var i,n;this.state=h.Closing,this.clearIdle(),this.detachEvents();const s=this.container,o=this.carousel,a=this.getSlide(),r=null==a?void 0:a.state;if(a){const t=this.option("placeFocusBack")?(null===(i=this.getSlide())||void 0===i?void 0:i.triggerEl)||this.option("trigger"):null;t&&t.focus()}if(s&&(k(s,"is-closing"),s.setAttribute("aria-hidden","true"),this.option("animated")&&k(s,"is-animated"),s.style.pointerEvents="none"),o){o.clearTransitions(),null===(n=o.panzoom)||void 0===n||n.destroy();for(const t of o.slides){t.state=d.Closing,this.hideLoading(t);const e=t.contentEl;e&&this.stop(e);const i=null==t?void 0:t.panzoom;i&&(i.stop(),i.detachEvents(),i.detachObserver()),this.isCurrentSlide(t)||o.emit("removeSlide",t)}}this.emit("close",t),this.state!==h.CustomClosing?(void 0===e&&a&&(e=this.optionFor(a,"hideClass")),e&&a&&r===d.Ready?(this.animate(a.contentEl,e,(()=>{o&&o.emit("removeSlide",a)})),setTimeout((()=>{this.destroy()}),350)):this.destroy()):setTimeout((()=>{this.destroy()}),350)}destroy(){var t;if(this.state===h.Destroy)return;this.state=h.Destroy,null===(t=this.carousel)||void 0===t||t.destroy();const e=this.container;e&&e.remove(),gt.delete(this.id);const i=vt.getInstance();i?i.focus():(mt&&(mt.remove(),mt=null),ft&&(ft.remove(),ft=null),document.documentElement.classList.remove("with-fancybox"),s&&(document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",""),document.body.classList.remove("compensate-for-scrollbar")))}static bind(t,e,i){if(!s)return;let n,o="",a={};if("string"==typeof t?(n=document.body,o=t,"object"==typeof e&&(a=e||{})):(n=t,"string"==typeof e&&(o=e),"object"==typeof i&&(a=i||{})),!n)return;o=o||"[data-fancybox]";const r=vt.openers.get(n)||new Map;r.set(o,a),vt.openers.set(n,r),1===r.size&&n.addEventListener("click",vt.fromEvent)}static unbind(t,e){let i,n="";if("string"==typeof t?(i=document.body,n=t):(i=t,"string"==typeof e&&(n=e)),!i)return;const s=vt.openers.get(i);s&&n&&s.delete(n),n&&s||(vt.openers.delete(i),i.removeEventListener("click",vt.fromEvent))}static destroy(){let t;for(;t=vt.getInstance();)t.destroy();for(const t of vt.openers.keys())t.removeEventListener("click",vt.fromEvent);vt.openers=new Map}static fromEvent(t){if(t.defaultPrevented)return;if(t.button&&0!==t.button)return;if(t.ctrlKey||t.metaKey||t.shiftKey)return;let i=t.composedPath()[0];const n=i.closest("[data-fancybox-trigger]");if(n){const t=n.dataset.fancyboxTrigger||"",e=document.querySelectorAll(`[data-fancybox="${t}"]`),s=parseInt(n.dataset.fancyboxIndex||"",10)||0;i=e[s]||i}if(!(i&&i instanceof Element))return;let s,o,a,r;if([...vt.openers].reverse().find((([t,e])=>!(!t.contains(i)||![...e].reverse().find((([e,n])=>{let l=i.closest(e);return!!l&&(s=t,o=e,a=l,r=n,!0)}))))),!s||!o||!a)return;r=r||{},t.preventDefault(),i=a;let l=[],h=e({},c,r);h.event=t,h.trigger=i,h.delegate=n;const d=h.groupAll,u=h.groupAttr,p=u&&i?i.getAttribute(`${u}`):"";if((!i||p||d)&&(l=[].slice.call(s.querySelectorAll(o))),i&&!d&&(l=p?l.filter((t=>t.getAttribute(`${u}`)===p)):[i]),!l.length)return;const m=vt.getInstance();return m&&m.options.trigger&&l.indexOf(m.options.trigger)>-1?void 0:(i&&(h.startIndex=l.indexOf(i)),vt.fromNodes(l,h))}static fromNodes(t,i){i=e({},c,i);const n=[];for(const e of t){const t=e.dataset||{},s=t.src||e.getAttribute("href")||e.getAttribute("currentSrc")||e.getAttribute("src")||void 0;let o;const a=i.delegate;let r;a&&n.length===i.startIndex&&(o=a instanceof HTMLImageElement?a:a.querySelector("img:not([aria-hidden])")),o||(o=e instanceof HTMLImageElement?e:e.querySelector("img:not([aria-hidden])")),o&&(r=o.currentSrc||o.src||void 0,!r&&o.dataset&&(r=o.dataset.lazySrc||o.dataset.src||void 0));const l={src:s,triggerEl:e,thumbEl:o,thumbElSrc:r,thumbSrc:r};for(const e in t)"fancybox"!==e&&(l[e]=t[e]+"");n.push(l)}return new vt(n,i)}static getInstance(t){if(t)return gt.get(t);return Array.from(gt.values()).reverse().find((t=>!t.isClosing()&&t))||null}static getSlide(){var t;return(null===(t=vt.getInstance())||void 0===t?void 0:t.getSlide())||null}static show(t=[],e={}){return new vt(t,e)}static next(){const t=vt.getInstance();t&&t.next()}static prev(){const t=vt.getInstance();t&&t.prev()}static close(t=!0,...e){if(t)for(const t of gt.values())t.close(...e);else{const t=vt.getInstance();t&&t.close(...e)}}}Object.defineProperty(vt,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(vt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(vt,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:it}),Object.defineProperty(vt,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map});export{vt as Fancybox}; diff --git a/dist/fancybox/fancybox.umd.js b/dist/fancybox/fancybox.umd.js index df693d33..43d8c351 100644 --- a/dist/fancybox/fancybox.umd.js +++ b/dist/fancybox/fancybox.umd.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";const e=t=>"object"==typeof t&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t),i=(t,...n)=>{const s=n.length;for(let o=0;o{const o=Array.isArray(s)?[]:{};t[n]||Object.assign(t,{[n]:o}),e(s)?Object.assign(t[n],i(o,s)):Array.isArray(s)?Object.assign(t,{[n]:[...s]}):Object.assign(t,{[n]:s})}))}return t},n=function(t,e){let i=!0;return(...n)=>{i&&(i=!1,t(...n),setTimeout((()=>{i=!0}),e))}},s=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},o=!("undefined"==typeof window||!window.document||!window.document.createElement);let a;const r=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","),l='
',c={PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"},h={dragToClose:!0,hideScrollbar:!0,Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},contentClick:"toggleZoom",contentDblClick:!1,backdropClick:"close",animated:!0,idle:3500,showClass:"f-zoomInUp",hideClass:"f-fadeOut",commonCaption:!1,parentEl:null,startIndex:0,l10n:Object.assign(Object.assign({},c),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),tpl:{closeButton:'',main:''},groupAll:!1,groupAttr:"data-fancybox",defaultType:"image",defaultDisplay:"block",autoFocus:!0,trapFocus:!0,placeFocusBack:!0,closeButton:"auto",keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"next",ArrowDown:"prev",ArrowRight:"next",ArrowLeft:"prev"},Fullscreen:{autoStart:!1},compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,wheel:"zoom"};var d,u;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Closing=2]="Closing",t[t.CustomClosing=3]="CustomClosing",t[t.Destroy=4]="Destroy"}(d||(d={})),function(t){t[t.Loading=0]="Loading",t[t.Opening=1]="Opening",t[t.Ready=2]="Ready",t[t.Closing=3]="Closing"}(u||(u={}));const p=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class m{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?i({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=p(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...n){let s=p(e,t);var o;"string"!=typeof(o=s)||isNaN(o)||isNaN(parseFloat(o))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...n));let a=p(e,this.options);return a&&"function"==typeof a?s=a.call(this,this,t,...n,s):void 0===s&&(s=a),void 0===s?i:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(m,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(m,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class f extends m{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,n]of Object.entries(t)){const t=this.option(i),s=this.plugins[i];s||!1===t?s&&!1===t&&(s.detach(),delete this.plugins[i]):e.set(i,new n(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}class g extends m{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const b=()=>{queueMicrotask((()=>{(()=>{const{slug:t,index:e}=v.parseURL(),i=xt.getInstance();if(i&&!1!==i.option("Hash")){const n=i.carousel;if(t&&n){for(let e of n.slides)if(e.slug&&e.slug===t)return n.slideTo(e.index);if(t===i.option("slug"))return n.slideTo(e-1);const s=i.getSlide(),o=s&&s.triggerEl&&s.triggerEl.dataset;if(o&&o.fancybox===t)return n.slideTo(e-1)}v.hasSilentClose=!0,i.close()}v.startFromUrl()})()}))};class v extends g{constructor(){super(...arguments),Object.defineProperty(this,"origHash",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null})}onChange(){const t=this.instance,e=t.carousel;this.timer&&clearTimeout(this.timer);const i=t.getSlide();if(!e||!i)return;const n=t.isOpeningSlide(i),s=new URL(document.URL).hash;let o,a=i.slug||void 0;o=a||this.instance.option("slug"),!o&&i.triggerEl&&i.triggerEl.dataset&&(o=i.triggerEl.dataset.fancybox);let r="";o&&"true"!==o&&(r="#"+o+(!a&&e.slides.length>1?"-"+(i.index+1):"")),n&&(this.origHash=s!==r?s:""),r&&s!==r&&(this.timer=setTimeout((()=>{try{window.history[n?"pushState":"replaceState"]({},document.title,window.location.pathname+window.location.search+r)}catch(t){}}),300))}onClose(){if(this.timer&&clearTimeout(this.timer),!0!==v.hasSilentClose)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(this.origHash||""))}catch(t){}}attach(){this.instance.on("Carousel.ready",this.onChange),this.instance.on("Carousel.change",this.onChange),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.ready",this.onChange),this.instance.off("Carousel.change",this.onChange),this.instance.off("close",this.onClose)}static parseURL(){const t=window.location.hash.slice(1),e=t.split("-"),i=e[e.length-1],n=i&&/^\+?\d+$/.test(i)&&parseInt(e.pop()||"1",10)||1;return{hash:t,slug:e.join("-"),index:n}}static startFromUrl(){if(v.hasSilentClose=!1,xt.getInstance()||!1===xt.defaults.Hash)return;const{hash:t,slug:e,index:i}=v.parseURL();if(!e)return;let n=document.querySelector(`[data-slug="${t}"]`);if(n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),xt.getInstance())return;const s=document.querySelectorAll(`[data-fancybox="${e}"]`);s.length&&(n=s[i-1],n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))}static destroy(){window.removeEventListener("hashchange",b,!1)}}function y(){window.addEventListener("hashchange",b,!1),setTimeout((()=>{v.startFromUrl()}),500)}Object.defineProperty(v,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(v,"hasSilentClose",{enumerable:!0,configurable:!0,writable:!0,value:!1}),o&&(/complete|interactive|loaded/.test(document.readyState)?y():document.addEventListener("DOMContentLoaded",y));const w=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),x=function(t,e){return!(!t||t===document.body||e&&t===e)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,n=-1!==i.indexOf("hidden"),s=-1!==i.indexOf("visible");return e&&!n&&!s}(t)?t:x(t.parentElement,e))},S=t=>`${t||""}`.split(" ").filter((t=>!!t)),E=(t,e,i)=>{S(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))};class P{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const M={passive:!1};class C{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:n=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=n;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,M),this.element.addEventListener("touchmove",this.onMove,M),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,M)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new P(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new P(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new P(t))):[new P(t)],n=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(n.push(t),this.currentPointers[e]=t)}n.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new P(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new P(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,M),this.element.removeEventListener("touchstart",this.onTouchStart,M),this.element.removeEventListener("touchmove",this.onMove,M),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function T(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function O(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}var A;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(A||(A={}));const L=["a","b","c","d","e","f"],z={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:c},R=t=>t&&null!==t&&t instanceof Element&&"nodeType"in t,k={a:1,b:0,c:0,d:1,e:0,f:0},I=1e5,D=1e3;let F=null,j=null;class H extends f{get isTouchDevice(){return null===j&&(j=window.matchMedia("(hover: none)").matches),j}get isMobile(){return null===F&&(F=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),F}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){return this.content instanceof HTMLImageElement&&!this.content.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of L){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var n;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:A.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},k)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},k)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},H.Plugins),i)),this.emit("init"),this.isContentLoading){if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const e=s(l);t.contains(this.content)?this.spinner=(null===(n=this.content.parentElement)||void 0===n?void 0:n.insertBefore(e,this.content))||null:this.spinner=t.appendChild(e)}this.emit("beforeLoad"),this.content.addEventListener("load",this.onLoad),this.content.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===A.Init&&this.enable()}onError(){this.state!==A.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=A.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new C(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of L)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of L)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,n=i.e+t,s=i.f+e,o=this.getBounds(),{x:a,y:r}=o,l=a.min,c=a.max,h=r.min,d=r.max;let u=0,p=0;return l!==1/0&&nc&&(u=c-n),h!==1/0&&sd&&(p=d-s),Math.abs(u)<.001&&(u=0),Math.abs(p)<.001&&(p=0),Object.assign(Object.assign({},o),{xDiff:u,yDiff:p,inBounds:!u&&!p})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:n,fitHeight:s,fullWidth:o,fullHeight:a}=i;let r=o,l=a;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),c=i?o:n,h=i?a:s,d=this.getMatrix(t),u=new DOMPoint(0,0).matrixTransform(d),p=new DOMPoint(0+c,0).matrixTransform(d),m=new DOMPoint(0+c,0+h).matrixTransform(d),f=new DOMPoint(0,0+h).matrixTransform(d),g=Math.abs(m.x-u.x),b=Math.abs(m.y-u.y),v=Math.abs(f.x-p.x),y=Math.abs(f.y-p.y);r=Math.max(g,v),l=Math.max(b,y)}return{contentWidth:r,contentHeight:l}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const n=i.closest("[data-panzoom-action]"),s=i.closest("[data-panzoom-change]"),o=n||s,a=o&&R(o)?o.dataset:null;if(a){const e=a.panzoomChange,i=a.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const r=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(r.x-this.dragStart.x)>2||Math.abs(r.y-this.dragStart.y)>2))return;this.dragStart.time=0;const l=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},c=this.option("click",t),h=this.option("dblClick",t);h?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&c&&l(c)):(this.emit("dblClick",t),t.defaultPrevented||l(h)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&c&&l(c))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(t,e,i){var n;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const s=this.content.getBoundingClientRect();if(this.dragStart={x:s.x,y:s.y,top:s.top,left:s.left,time:Date.now()},!1===this.option("touch",t))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;if(!i.length){const e=t.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(e.nodeName)||e.closest("[contenteditable]")||e.closest("[data-selectable]")||e.closest("[data-panzoom-change]")||e.closest("[data-panzoom-action]"))return!1;null===(n=window.getSelection())||void 0===n||n.removeAllRanges()}return"mousedown"===t.type&&t.preventDefault(),w(this.targetScale,1e3)===w(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(e),this.emit("touchStart",t),!0}onPointerMove(t,e,i){if(!this.isDragging)return;if(e.length<2&&this.panOnlyZoomed&&w(this.targetScale)<=w(this.minScale))return;if(this.emit("touchMove",t),t.defaultPrevented)return;this.addTrackingPoint(e[0]);const{content:n}=this,s=O(i[0],i[1]),o=O(e[0],e[1]);let a=0,r=0;if(e.length>1){const t=n.getBoundingClientRect();a=s.clientX-t.left-.5*t.width,r=s.clientY-t.top-.5*t.height}const l=T(i[0],i[1]),c=T(e[0],e[1]);let h=l?c/l:1,d=o.clientX-s.clientX,u=o.clientY-s.clientY;this.dragOffset.x+=d,this.dragOffset.y+=u,this.dragOffset.time=Date.now()-this.dragStart.time;let p=w(this.targetScale)===w(this.minScale)&&this.option("lockAxis");if(p&&!this.lockedAxis)if("xy"===p||"y"===p||"touchmove"===t.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void t.preventDefault();const e=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=e>45&&e<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,d=0,u=0}else this.lockedAxis=p;if(x(t.target,this.content)&&(p="x",this.dragOffset.y=0),p&&"xy"!==p&&this.lockedAxis!==p&&w(this.targetScale)===w(this.minScale))return;t.cancelable&&t.preventDefault(),this.container.classList.add(this.cn("isDragging"));const m=this.checkBounds(d,u);this.option("rubberband")?("x"!==this.isInfinite&&(m.xDiff>0&&d<0||m.xDiff<0&&d>0)&&(d*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*m.xDiff))),"y"!==this.isInfinite&&(m.yDiff>0&&u<0||m.yDiff<0&&u>0)&&(u*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*m.yDiff)))):(m.xDiff&&(d=0),m.yDiff&&(u=0));const f=this.targetScale,g=this.minScale,b=this.maxScale;f<.5*g&&(h=Math.max(h,g)),f>1.5*b&&(h=Math.min(h,b)),"y"===this.lockedAxis&&w(f)===w(g)&&(d=0),"x"===this.lockedAxis&&w(f)===w(g)&&(u=0),this.applyChange({originX:a,originY:r,panX:d,panY:u,scale:h,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,e,i){if(i.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(e),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),x(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==A.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of L)this.velocity[t]=0,this.target[t]=this.current[t];const{trackingPoints:t}=this,e=t[0],i=t[t.length-1];let n=0,s=0,o=0;i&&e&&(n=i.clientX-e.clientX,s=i.clientY-e.clientY,o=i.time-e.time);let a=0,r=0,l=0,c=0,h=this.option("decelFriction");const d=this.targetScale;if((dthis.maxScale+1e-5)&&(h=.35),o>0){l=Math.abs(n)>3?n/(o/30):0,c=Math.abs(s)>3?s/(o/30):0;const t=this.option("maxVelocity");t&&(l=Math.max(Math.min(l,t),-1*t),c=Math.max(Math.min(c,t),-1*t))}l&&(a=l/(1/(1-h)-1)),c&&(r=c/(1/(1-h)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&w(d)===this.minScale)&&(a=l=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&w(d)===this.minScale)&&(r=c=0);const u=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(n)),"auto"===p&&(p=parseFloat(n.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(n));const m=(this.option("transformParent")?n.parentElement:null)||n,f=m.getAttribute("style")||"";m.style.setProperty("transform","none","important"),m.style.setProperty("transition","none","important"),m.style.setProperty("animation","none","important"),n instanceof HTMLImageElement&&(m.style.width="",m.style.height=""),m.offsetHeight;const g=n.getBoundingClientRect();let b=g.width,v=g.height,y=0,x=0;if(n instanceof HTMLImageElement&&({width:b,height:v,top:y,left:x}=((t,e,i,n)=>{const s=i/n;return s>t/e?(i=t,n=t/s):(i=e*s,n=e),{width:i,height:n,top:.5*(e-n),left:.5*(t-i)}})(g.width,g.height,u,p)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:g.top-a.top+y,bottom:a.bottom-g.bottom+y,left:g.left-a.left+x,right:a.right-g.right+x,fitWidth:b,fitHeight:v,width:b,height:v,fullWidth:u,fullHeight:p}),m.style.cssText=f,n instanceof HTMLImageElement&&(m.style.width=`${b}px`,m.style.height=`${v}px`),this.setTransform(),!0!==t){let t="";Math.abs(l-s)>1&&(t+="x"),Math.abs(c-o)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(w(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===A.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const t=this.option("bounds");if("auto"!==t)return t;const{contentWidth:e,contentHeight:i}=this.calculateContentDim(this.target);let n=0,s=0,o=0,a=0;const r=this.option("infinite");if(!0===r||this.lockedAxis&&r===this.lockedAxis)n=-1/0,o=1/0,s=-1/0,a=1/0;else{let{containerRect:t,contentRect:r}=this,l=w(this.contentRect.fitWidth*this.targetScale,D),c=w(this.contentRect.fitHeight*this.targetScale,D),{innerWidth:h,innerHeight:d}=t;if(this.containerRect.width===l&&(h=t.width),this.containerRect.width===c&&(d=t.height),e>h){o=.5*(e-h),n=-1*o;let t=.5*(r.right-r.left);n+=t,o+=t}if(this.contentRect.fitWidth>h&&ed){a=.5*(i-d),s=-1*a;let t=.5*(r.bottom-r.top);s+=t,a+=t}this.contentRect.fitHeight>d&&ithis.maxScale?this.minScale:this.maxScale,toggleCover:this.targetScale>this.coverScale?this.minScale:this.coverScale,toggleZoom:this.targetScale>this.fullScale?this.minScale:this.fullScale}[this.option("click")||""]||this.minScale,n=t.canZoomIn(),s=t.canZoomOut(),o="drag"===this.panMode,a=s&&o;this.targetScale<=this.minScale&&!this.panOnlyZoomed&&(a=!0),(this.contentRect.width-this.contentRect.fitWidth>-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(a=!0),this.contentRect.width*this.targetScalethis.minScale,l=!n&&!a&&s&&w(i)===w(this.minScale);E(e,this.cn("canZoomIn"),r),E(e,this.cn("canZoomOut"),l),E(e,this.cn("isDraggable"),a);for(const t of e.querySelectorAll('[data-panzoom-action="zoomIn"]'))n?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const t of e.querySelectorAll('[data-panzoom-action="zoomOut"]'))s?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const i of e.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){n=t.targetScale.9*t.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:n=this.option("friction"),angle:s=0,originX:o=0,originY:a=0,flipX:r=!1,flipY:l=!1,ignoreBounds:c=!1}){this.state!==A.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:s,originX:o,originY:a,friction:n,flipX:r,flipY:l,ignoreBounds:c})}applyChange({panX:t=0,panY:e=0,scale:i=1,angle:n=0,originX:s=-this.current.e,originY:o=-this.current.f,friction:a=this.option("friction"),flipX:r=!1,flipY:l=!1,ignoreBounds:c=!1,bounce:h=this.option("bounce")}){if(this.state===A.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of L)this.velocity[t]=0;this.friction=a||0,this.ignoreBounds=c;const{current:d}=this,u=d.e,p=d.f,m=this.getMatrix(this.target);let f=(new DOMMatrix).translate(u,p).translate(s,o).translate(t,e);if(this.option("zoom")){if(!c){const t=this.targetScale,e=this.minScale,n=this.maxScale;t*in&&(i=n/t)}f=f.scale(i)}f=f.translate(-s,-o).translate(-u,-p).multiply(m),n&&(f=f.rotate(n)),r&&(f=f.scale(-1,1)),l&&(f=f.scale(1,-1));for(const t of L)"a"!=t&&"d"!=t||!(f[t]>this.minScale+1e-5||f[t].1||"mousemove"===this.panMode||!1===h)&&!c&&this.clampTargetBounds(),this.isResting||(this.state=A.Panning,this.requestTick())}stop(t=!1){if(this.state!==A.Init&&this.state!==A.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of L)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=A.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls()),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(t,e=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=t,"mousemove"!==this.panMode||!t)return;if(w(this.targetScale)<=w(this.minScale))return;this.emit("mouseMove",t);const{container:i,containerRect:n,contentRect:s}=this,o=n.width,a=n.height,r=i.getBoundingClientRect(),l=(t.clientX||0)-r.left,c=(t.clientY||0)-r.top;let{contentWidth:h,contentHeight:d}=this.calculateContentDim(this.target);const u=this.option("mouseMoveFactor");u>1&&(h!==o&&(h*=u),d!==a&&(d*=u));let p=.5*(h-o)-l/o*100/100*(h-o);p+=.5*(s.right-s.left);let m=.5*(d-a)-c/a*100/100*(d-a);m+=.5*(s.bottom-s.top),this.applyChange({panX:p-this.target.e,panY:m-this.target.f,friction:e})}zoomWithWheel(t){if(this.state===A.Destroy||this.state===A.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),n=this.targetScale,s=this.maxScale,o=this.minScale;let a=n*(100+i*e)/100;as&&n>=s?(this.wheelDelta+=Math.abs(i),a=s):(this.wheelDelta=0,a=Math.max(Math.min(a,s),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),a!==n&&this.zoomTo(a,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale>.9*this.maxScale?"fit":"max",t)}toggleCover(t){this.zoomTo(this.targetScale>.9*this.coverScale?"fit":"cover",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:n=0,event:s}={}){if(this.isContentLoading||this.state===A.Destroy)return;this.stop();const{targetScale:o}=this;let a=1;if("mousemove"===this.panMode&&(s=this.prevMouseMoveEvent||s),s){const t=this.content.getBoundingClientRect(),e=s.clientX||0,o=s.clientY||0;i=e-t.left-.5*t.width,n=o-t.top-.5*t.height}const r=this.fullScale,l=this.maxScale;let c=this.coverScale;"number"==typeof t?a=t/o:("next"===t&&(r-c<.2&&(c=r),t=o1?.15:.25:e,this.applyChange({scale:a,originX:i,originY:n,friction:e}),s&&"mousemove"===this.panMode&&this.panWithMouse(s,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const n=t.classList.contains(e);n?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(n?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:n,d:s,e:o,f:a}=t;return new DOMMatrix([e,i,n,s,o,a])}reset(t){if(this.state!==A.Init&&this.state!==A.Destroy){this.stop("current");for(const t of L)this.target[t]=k[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=A.Panning,this.requestTick())}}destroy(){this.stop(),this.state=A.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(H,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:z}),Object.defineProperty(H,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const B=(t,e)=>{S(e).forEach((e=>{t&&t.classList.add(e)}))},_=t=>new Promise(((e,i)=>{const n=new Image;n.onload=e,n.onerror=i,n.src=t}));class N extends g{onCreateSlide(t,e,i){const n=this.instance,s=n.optionFor(i,"src")||"",{el:o,type:a}=i;o&&"image"===a&&"string"==typeof s&&this.setContent(i,s).then((t=>{if(n.isClosing())return;const e=i.contentEl,s=i.imageEl,o=i.thumbElSrc,a=this.optionFor(i,"initialSize"),r=this.optionFor(i,"zoom"),l={event:"mousemove"===t.panMode?n.prevMouseMoveEvent||n.options.event:void 0,friction:r?.12:0};if(e&&s&&o&&n.isOpeningSlide(i)&&this.getZoomInfo(i)){let t=document.createElement("img");B(t,"fancybox-ghost"),e.appendChild(t),t.src=o,s.naturalWidth<2e3&&s.naturalHeight<2e3&&setTimeout((()=>{n.animate(t,"f-fadeFastOut",(()=>{t&&(t.remove(),t=null)}))}),300),_(o).then((()=>{i.state=u.Opening,this.instance.emit("reveal",i),this.zoomIn(i).then((()=>{t&&(t.remove(),t=null),this.instance.done(i)}),(()=>{n.hideLoading(i)}))}),(()=>{n.hideLoading(i),n.revealContent(i)}))}else{let e=n.optionFor(i,"showClass")||void 0,s=!0;n.isOpeningSlide(i)&&("full"===a?t.zoomToFull(l):"cover"===a?t.zoomToCover(l):"max"===a?t.zoomToMax(l):s=!1,t.stop("current")),s&&e&&(e="f-fadeIn"),n.revealContent(i,e)}}),(()=>{n.setError(i,"{{IMAGE_ERROR}}")}))}onRemoveSlide(t){t.panzoom&&t.panzoom.destroy(),t.panzoom=void 0,t.imageEl=void 0}onChange(t,e,i,n){for(const t of e.slides){const e=t.panzoom;e&&t.index!==i&&e.reset(.15)}}onClose(){const t=this.instance,e=t.container,i=t.getSlide();if(!e||!e.parentElement||!i)return;const{el:n,contentEl:s,panzoom:o}=i,a=i.thumbElSrc;if(!n||!a||!s||!o||o.isContentLoading||o.state===A.Init||o.state===A.Destroy)return;o.updateMetrics();let r=this.getZoomInfo(i);if(!r)return;this.instance.state=d.CustomClosing,n.classList.remove("is-zooming-in"),n.classList.add("is-zooming-out"),s.style.backgroundImage=`url('${a}')`,_(a).then((()=>{n.classList.add("hide-image")}),(()=>{}));const l=e.getBoundingClientRect();Object.assign(e.style,{position:"absolute",top:`${window.pageYOffset}px`,left:`${window.pageXOffset}px`,bottom:"auto",right:"auto",width:`${l.width}px`,height:`${l.height}px`});const{x:c,y:h,scale:u,opacity:p}=r;if(p){const t=((t,e,i,n)=>{const s=e-t,o=n-i;return e=>i+((e-t)/s*o||0)})(o.scale,u,1,0);o.on("afterTransform",(()=>{s.style.opacity=t(o.scale)+""}))}o.on("endAnimation",(()=>{t.destroy()})),o.target.a=u,o.target.b=0,o.target.c=0,o.target.d=u,o.panTo({x:c,y:h,scale:u,friction:p?.2:.33,ignoreBounds:!0}),o.isResting&&t.destroy()}setContent(t,e){return new Promise(((n,s)=>{const o=this.instance,a=t.el;if(!a)return void s();o.showLoading(t);const r=document.createElement("img");if(r.classList.add("fancybox-image"),r.src=e||"",t.imageEl=r,o.setContent(t,r,!1),this.option("protected")){a.addEventListener("contextmenu",(t=>{t.preventDefault()}));const e=t.contentEl;if(e){const t=document.createElement("div");B(t,"fancybox-protected"),e.append(t)}}t.panzoom=new H(a,i({},this.option("Panzoom")||{},{content:r,width:o.optionFor(t,"width","auto"),height:o.optionFor(t,"height","auto"),wheel:()=>{const t=o.option("wheel");return("zoom"===t||"pan"==t)&&t},click:(e,i)=>{var n;if(o.isCompact||o.isClosing())return!1;let s=!i||i.target&&(null===(n=t.contentEl)||void 0===n?void 0:n.contains(i.target));return o.option(s?"contentClick":"backdropClick")||!1},dblClick:()=>o.isCompact?"toggleZoom":o.option("contentDblClick")||!1,spinner:!1,panOnlyZoomed:!0,wheelLimit:1/0,transformParent:!0,on:{ready:t=>{n(t)},error:()=>{s()},destroy:()=>{s()}}}))}))}zoomIn(t){return new Promise(((e,i)=>{const{panzoom:n,contentEl:s,el:o}=t,a=this.getZoomInfo(t);if(!(a&&o&&s&&n))return void i();const{x:r,y:l,scale:c,opacity:h}=a,d=()=>{t.state!==u.Closing&&(h&&(s.style.opacity=Math.max(Math.min(1,1-(1-n.scale)/(1-c)),0)+""),n.scale>=1&&n.scale>n.targetScale-.1&&e(n))},p=t=>{t.scale<.99||(o.classList.remove("is-zooming-in"),t.off("endAnimation",p),t.off("touchStart",p),t.off("afterTransform",d),e(t))};n.on("endAnimation",p),n.on("touchStart",p),n.on("afterTransform",d),n.on(["error","destroy"],(()=>{i()})),n.panTo({x:r,y:l,scale:c,friction:0,ignoreBounds:!0}),n.stop("current");const m=this.instance,f={event:"mousemove"===n.panMode?m.prevMouseMoveEvent||m.options.event:void 0},g=this.optionFor(t,"initialSize");B(o,"is-zooming-in"),m.hideLoading(t),"full"===g?n.zoomToFull(f):"cover"===g?n.zoomToCover(f):"max"===g?n.zoomToMax(f):n.reset(.2)}))}getZoomInfo(t){const{el:e,imageEl:i,thumbEl:n,panzoom:s}=t;if(!e||!i||!n||!s||(t=>{const e=window.pageYOffset,i=window.pageYOffset+window.innerHeight;if(!R(t))return 0;const n=t.getBoundingClientRect(),s=n.y+window.pageYOffset,o=n.y+n.height+window.pageYOffset;if(e>o||io)return 100;if(si)return 100;let a=n.height;si&&(a-=o-i);const r=a/window.innerHeight*100;return Math.round(r)})(n)<5||!this.optionFor(t,"zoom")||this.instance.state===d.Destroy)return!1;const{top:o,left:a,width:r,height:l}=n.getBoundingClientRect();let{top:c,left:h,fitWidth:u,fitHeight:p}=s.contentRect;if(!(r&&l&&u&&p))return!1;const m=r/u,f=s.container.getBoundingClientRect();c+=f.top,h+=f.left;const g=-1*(h+.5*u-(a+.5*r)),b=-1*(c+.5*p-(o+.5*l));let v=this.option("zoomOpacity")||!1;return"auto"===v&&(v=Math.abs(r/l-u/p)>.1),{x:g,y:b,scale:m,opacity:v}}attach(){this.instance.on("Carousel.change",this.onChange),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.change",this.onChange),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("close",this.onClose)}}Object.defineProperty(N,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}});const W=(t,e={})=>{const i=new URL(t),n=new URLSearchParams(i.search),s=new URLSearchParams;for(const[t,i]of[...n,...Object.entries(e)]){let e=i.toString();"t"===t?s.set("start",parseInt(e).toString()):s.set(t,e)}let o=s.toString(),a=t.match(/#t=((.*)?\d+s)/);return a&&(o+=`#t=${a[1]}`),o},X={ajax:null,autoSize:!0,preload:!0,videoAutoplay:!0,videoRatio:16/9,videoTpl:'',videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,rel:0,fs:1}},$=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo","video"];class Y extends g{onInitSlides(t,e){for(const t of e.slides)this.processType(t)}onCreateSlide(t,e,i){this.setContent(i)}onRemoveSlide(t,e,i){i.closeBtnEl&&(i.closeBtnEl.remove(),i.closeBtnEl=void 0),i.xhr&&(i.xhr.abort(),i.xhr=null),i.iframeEl&&(i.iframeEl.onload=i.iframeEl.onerror=null,i.iframeEl.src="//about:blank",i.iframeEl=null);const n=i.contentEl,s=i.placeholderEl;if("inline"===i.type&&n&&s)n.classList.remove("fancybox__content"),"none"!==n.style.display&&(n.style.display="none"),s.parentNode&&s.parentNode.insertBefore(n,s),s.remove(),i.placeholderEl=null;else for(;i.el&&i.el.firstChild;)i.el.removeChild(i.el.firstChild)}onSelectSlide(t,e,i){i.state===u.Ready&&this.playVideo()}onUnselectSlide(t,e,i){var n,s;if("html5video"===i.type){try{null===(s=null===(n=i.el)||void 0===n?void 0:n.querySelector("video"))||void 0===s||s.pause()}catch(t){}return}let o;"vimeo"===i.type?o={method:"pause",value:"true"}:"youtube"===i.type&&(o={event:"command",func:"pauseVideo"}),o&&i.iframeEl&&i.iframeEl.contentWindow&&i.iframeEl.contentWindow.postMessage(JSON.stringify(o),"*"),i.poller&&clearTimeout(i.poller)}onDone(t,e){t.isCurrentSlide(e)&&!t.isClosing()&&this.playVideo()}onRefresh(t,e){e.slides.forEach((t=>{t.el&&(this.setAspectRatio(t),this.resizeIframe(t))}))}onMessage(t){try{let e=JSON.parse(t.data);if("https://player.vimeo.com"===t.origin){if("ready"===e.event)for(let e of Array.from(document.getElementsByClassName("fancybox__iframe")))e instanceof HTMLIFrameElement&&e.contentWindow===t.source&&(e.dataset.ready="true")}else if("https://www.youtube-nocookie.com"===t.origin&&"onReady"===e.event){const t=document.getElementById(e.id);t&&(t.dataset.ready="true")}}catch(t){}}loadAjaxContent(t){const e=this.instance.optionFor(t,"src")||"";this.instance.showLoading(t);const i=this.instance,n=new XMLHttpRequest;i.showLoading(t),n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&i.state===d.Ready&&(i.hideLoading(t),200===n.status?i.setContent(t,n.responseText):i.setError(t,404===n.status?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const s=t.ajax||null;n.open(s?"POST":"GET",e+""),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send(s),t.xhr=n}setInlineContent(t){let e=null;if(R(t.src))e=t.src;else if("string"==typeof t.src){const i=t.src.split("#",2).pop();e=i?document.getElementById(i):null}if(e){if("clone"===t.type||e.dataset.placeholderId){e=e.cloneNode(!0);const i=e.dataset.animationName;i&&(e.classList.remove(i),delete e.dataset.animationName),delete e.dataset.placeholderId;let n=e.getAttribute("id");n=n?`${n}--clone`:`clone-${this.instance.id}-${t.index}`,e.setAttribute("id",n)}else if(e.parentNode){const i=document.createElement("div");i.classList.add("fancybox-placeholder"),e.parentNode.insertBefore(i,e),t.placeholderEl=i}this.instance.setContent(t,e)}else this.instance.setError(t,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(t){const{src:e,el:i}=t;if(!e||"string"!=typeof e||!i)return;const n=this.instance,s=document.createElement("iframe");s.className="fancybox__iframe",s.setAttribute("id",`fancybox__iframe_${n.id}_${t.index}`),s.setAttribute("allow","autoplay; fullscreen"),s.setAttribute("scrolling","auto"),s.onerror=()=>{n.setError(t,"{{IFRAME_ERROR}}")},t.iframeEl=s;const o=this.optionFor(t,"preload");if(i.classList.add("is-loading"),"iframe"!==t.type||!1===o)return s.setAttribute("src",t.src+""),this.resizeIframe(t),void n.setContent(t,s);n.showLoading(t),s.onload=()=>{if(!s.src.length)return;const e="true"!==s.dataset.ready;s.dataset.ready="true",this.resizeIframe(t),e?n.revealContent(t):n.hideLoading(t)},s.setAttribute("src",e),n.setContent(t,s,!1)}resizeIframe(t){const e=t.iframeEl,i=null==e?void 0:e.parentElement;if(!e||!i)return;let n=t.autoSize,s=t.width||0,o=t.height||0;s&&o&&(n=!1);const a=i&&i.style;if(!1!==t.preload&&!1!==n&&a)try{const t=window.getComputedStyle(i),n=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),r=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),l=e.contentWindow;if(l){const t=l.document,e=t.getElementsByTagName("html")[0],i=t.body;a.width="",i.style.overflow="hidden",s=s||e.scrollWidth+n,a.width=`${s}px`,i.style.overflow="",a.flex="0 0 auto",a.height=`${i.scrollHeight}px`,o=e.scrollHeight+r}}catch(t){}if(s||o){const t={flex:"0 1 auto",width:"",height:""};s&&(t.width=`${s}px`),o&&(t.height=`${o}px`),Object.assign(a,t)}}playVideo(){const t=this.instance.getSlide();if(!t)return;const{el:e}=t;if(!e||!e.offsetParent)return;if(!this.optionFor(t,"videoAutoplay"))return;if("html5video"===t.type)try{const t=e.querySelector("video");if(t){const e=t.play();void 0!==e&&e.then((()=>{})).catch((e=>{t.muted=!0,t.play()}))}}catch(t){}if("youtube"!==t.type&&"vimeo"!==t.type)return;const i=()=>{if(t.iframeEl&&t.iframeEl.contentWindow){let e;if("true"===t.iframeEl.dataset.ready)return e="youtube"===t.type?{event:"command",func:"playVideo"}:{method:"play",value:"true"},e&&t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"),void(t.poller=void 0);"youtube"===t.type&&(e={event:"listening",id:t.iframeEl.getAttribute("id")},t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"))}t.poller=setTimeout(i,250)};i()}processType(t){if(t.html)return t.type="html",t.src=t.html,void(t.html="");const e=this.instance.optionFor(t,"src","");if(!e||"string"!=typeof e)return;let i=t.type,n=null;if(n=e.match(/(?:youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const s=W(e,this.optionFor(t,"youtube")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://www.youtube-nocookie.com/embed/${o}?${s}`,t.thumbSrc=t.thumbSrc||`https://i.ytimg.com/vi/${o}/mqdefault.jpg`,i="youtube"}else if(n=e.match(/^.+vimeo.com\/(?:\/)?([\d]+)(.*)?/)){const s=W(e,this.optionFor(t,"vimeo")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://player.vimeo.com/video/${o}?${s}`,i="vimeo"}if(!i&&t.triggerEl){const e=t.triggerEl.dataset.type;$.includes(e)&&(i=e)}i||"string"==typeof e&&("#"===e.charAt(0)?i="inline":(n=e.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(i="html5video",t.videoFormat=t.videoFormat||"video/"+("ogv"===n[1]?"ogg":n[1])):e.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?i="image":e.match(/\.(pdf)((\?|#).*)?$/i)?i="pdf":(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src=`https://maps.google.${n[1]}/?ll=${(n[2]?n[2]+"&z="+Math.floor(parseFloat(n[3]))+(n[4]?n[4].replace(/^\//,"&"):""):n[4]+"").replace(/\?/,"&")}&output=${n[4]&&n[4].indexOf("layer=c")>0?"svembed":"embed"}`,i="map"):(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src=`https://maps.google.${n[1]}/maps?q=${n[2].replace("query=","q=").replace("api=1","")}&output=embed`,i="map")),t.type=i||this.instance.option("defaultType")}setContent(t){const e=this.instance.optionFor(t,"src")||"";if(t&&t.type&&e){switch(t.type){case"html":this.instance.setContent(t,e);break;case"html5video":const i=this.option("videoTpl");i&&this.instance.setContent(t,i.replace(/\{\{src\}\}/gi,e+"").replace(/\{\{format\}\}/gi,this.optionFor(t,"videoFormat")||"").replace(/\{\{poster\}\}/gi,t.poster||t.thumbSrc||""));break;case"inline":case"clone":this.setInlineContent(t);break;case"ajax":this.loadAjaxContent(t);break;case"pdf":case"map":case"youtube":case"vimeo":t.preload=!1;case"iframe":this.setIframeContent(t)}this.setAspectRatio(t)}}setAspectRatio(t){var e;const i=t.contentEl,n=this.optionFor(t,"videoRatio"),s=null===(e=t.el)||void 0===e?void 0:e.getBoundingClientRect();if(!(i&&s&&n&&1!==n&&t.type&&["video","youtube","vimeo","html5video"].includes(t.type)))return;const o=s.width,a=s.height;i.style.aspectRatio=n+"",i.style.width=o/a>n?"auto":"",i.style.height=o/a>n?"":"auto"}attach(){this.instance.on("Carousel.initSlides",this.onInitSlides),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("Carousel.selectSlide",this.onSelectSlide),this.instance.on("Carousel.unselectSlide",this.onUnselectSlide),this.instance.on("Carousel.Panzoom.refresh",this.onRefresh),this.instance.on("done",this.onDone),window.addEventListener("message",this.onMessage)}detach(){this.instance.off("Carousel.initSlides",this.onInitSlides),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("Carousel.selectSlide",this.onSelectSlide),this.instance.off("Carousel.unselectSlide",this.onUnselectSlide),this.instance.off("Carousel.Panzoom.refresh",this.onRefresh),this.instance.off("done",this.onDone),window.removeEventListener("message",this.onMessage)}}Object.defineProperty(Y,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:X});const q=(t,e)=>{S(e).forEach((e=>{t&&t.classList.remove(e)}))};class Z extends g{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:"ready"}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return"ready"!==this.state}onReady(t){this.option("autoStart")&&(t.isInfinite||t.page{this.timer=null,this.inHover||this.onTimerEnd()}),e),t.style.transitionDuration=`${e}ms`,t.style.transform="scaleX(1)"}this.emit("set")}clear(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.removeProgressBar()}start(){if(this.set(),this.option("pauseOnHover")){const t=this.instance.container;t.addEventListener("mouseenter",this.onMouseEnter,!1),t.addEventListener("mouseleave",this.onMouseLeave,!1)}document.addEventListener("visibilitychange",this.onVisibilityChange,!1)}stop(){const t=this.instance.container;this.clear(),this.state="ready",t.removeEventListener("mouseenter",this.onMouseEnter,!1),t.removeEventListener("mouseleave",this.onMouseLeave,!1),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),q(t,"has-autoplay"),this.emit("stop")}pause(){"play"===this.state&&(this.state="pause",this.clear(),this.emit("pause"))}resume(){const t=this.instance;if(t.isInfinite||t.page!==t.pages.length-1)if("play"!==this.state){if("pause"===this.state&&!this.inHover){const t=new Event("resume",{bubbles:!0,cancelable:!0});this.emit("resume",event),t.defaultPrevented||this.set()}}else this.set();else this.stop()}toggle(){"play"===this.state||"pause"===this.state?this.stop():this.set()}attach(){this.instance.on("ready",this.onReady),this.instance.on("Panzoom.startAnimation",this.onChange),this.instance.on("Panzoom.endAnimation",this.onSettle),this.instance.on("Panzoom.touchMove",this.onChange)}detach(){this.instance.off("ready",this.onReady),this.instance.off("Panzoom.startAnimation",this.onChange),this.instance.off("Panzoom.endAnimation",this.onSettle),this.instance.off("Panzoom.touchMove",this.onChange),this.stop()}}Object.defineProperty(Z,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class V extends g{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(t){const e=t.carousel;if(!e)return;const n=t.container;n&&(e.options.Autoplay=i(this.option("Autoplay")||{},{pauseOnHover:!1,autoStart:!1,timeout:this.option("timeout"),progressParentEl:()=>n.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]")||n,on:{set:e=>{var i;n.classList.add("has-slideshow"),(null===(i=t.getSlide())||void 0===i?void 0:i.state)!==u.Ready&&e.pause()},stop:()=>{n.classList.remove("has-slideshow"),t.isCompact||t.endIdle()},resume:(e,i)=>{var n,s,o;!i||!i.cancelable||(null===(n=t.getSlide())||void 0===n?void 0:n.state)===u.Ready&&(null===(o=null===(s=t.carousel)||void 0===s?void 0:s.panzoom)||void 0===o?void 0:o.isResting)||i.preventDefault()}}}),e.attachPlugins({Autoplay:Z}),this.ref=e.plugins.Autoplay)}onReady(t){const e=t.carousel,i=this.ref;e&&i&&this.option("playOnStart")&&(e.isInfinite||e.page{t.isCurrentSlide(e)&&i.stop()})),t.isCurrentSlide(e)&&i.resume()}onKeydown(t,e){var i;const n=this.ref;n&&e===this.option("key")&&"BUTTON"!==(null===(i=document.activeElement)||void 0===i?void 0:i.nodeName)&&n.toggle()}attach(){this.instance.on("Carousel.init",this.onPrepare),this.instance.on("Carousel.ready",this.onReady),this.instance.on("done",this.onDone),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onPrepare),this.instance.off("Carousel.ready",this.onReady),this.instance.off("done",this.onDone),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(V,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{key:" ",playOnStart:!1,timeout:3e3}});const G={classes:{container:"f-thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'',type:"modern"};var U;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden",t[t.Disabled=3]="Disabled"}(U||(U={}));let K=class extends g{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"shouldCenter",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:U.Init})}formatThumb(t,e){return this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}getSlides(){const t=[],e=this.option("thumbTpl")||"";if(e)for(const i of this.instance.slides||[])t.push({html:this.formatThumb(i,e),customClass:`has-thumb for-${i.type||"image"}`});return t}getProgress(t){const e=this.instance,i=e.panzoom,n=e.pages[t]||0;if(!n||!i)return 0;let s=-1*i.current.e,o=e.contentDim,a=(s-n.pos)/(1*n.dim),r=(s+o-n.pos)/(1*n.dim),l=(s-o-n.pos)/(1*n.dim);return a=Math.max(0,Math.min(1,Math.abs(a))),r=Math.max(0,Math.min(1,Math.abs(r))),l=Math.max(0,Math.min(1,Math.abs(l))),a=Math.min(a,r,l),a}onInitSlide(t,e){const i=e.el;i&&(e.thumbSrc=i.dataset.thumbSrc||e.thumbSrc||"",e.thumbClipWidth=parseFloat(i.dataset.thumbClipWidth||"")||e.thumbClipWidth||0,e.thumbHeight=parseFloat(i.dataset.thumbHeight||"")||e.thumbHeight||0)}onInitSlides(){this.state===U.Init&&this.build()}onRefreshM(){this.refreshModern()}onChangeM(){"modern"===this.type&&(this.shouldCenter=!0,this.centerModern())}onClickModern(t){t.preventDefault(),t.stopPropagation();const e=this.instance,i=e.page,n=t=>{if(t){const e=t.closest("[data-carousel-page]");if(e)return parseInt(e.dataset.carouselPage||"",10)||0}return-1},s=(t,e)=>{const i=document.elementFromPoint(t,e);return i?n(i):-1};let o=n(t.target);o<0&&(o=s(t.clientX+this.thumbGap,t.clientY),o===i&&(o=i-1)),o<0&&(o=s(t.clientX-this.thumbGap,t.clientY),o===i&&(o=i+1)),o<0&&(o=(e=>{let n=s(t.clientX-e,t.clientY),a=s(t.clientX+e,t.clientY);return o<0&&n===i&&(o=i+1),o<0&&a===i&&(o=i-1),o})(this.thumbExtraGap)),o===i?this.centerModern():o>-1&&o{this.emit("ready")}))}buildModern(){if("modern"!==this.type)return;const{container:t,track:e,instance:i}=this,n=this.option("thumbTpl")||"";if(!t||!e||!n)return;this.updateModern();for(const t of i.slides||[]){const i=document.createElement("div");B(i,this.cn("slide")),i.appendChild(s(this.formatThumb(t,n))),t.thumbSlideEl=i,e.appendChild(i),this.resizeModernSlide(t)}const o=new i.constructor.Panzoom(t,{content:e,lockAxis:"x",zoom:!1,panOnlyZoomed:!1,bounds:()=>{let t=0,e=0,n=i.slides[0],s=i.slides[i.slides.length-1],o=i.slides[i.page];return n&&s&&o&&(e=-1*this.getModernThumbPos(0),0!==i.page&&(e+=.5*(n.thumbWidth||0)),t=-1*this.getModernThumbPos(i.slides.length-1),i.page!==i.slides.length-1&&(t+=(s.thumbWidth||0)-(o.thumbWidth||0)-.5*(s.thumbWidth||0))),{x:{min:t,max:e},y:{min:0,max:0}}}});o.on("touchStart",(()=>{this.shouldCenter=!1})),o.on("click",((t,e)=>this.onClickModern(e))),o.on("ready",(()=>{this.centerModern(),this.emit("ready")})),o.on(["afterTransform","refresh"],(t=>{this.lazyLoadModern()})),this.panzoom=o,this.refreshModern()}updateModern(){if("modern"!==this.type)return;const{container:t}=this;t&&(this.thumbGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-gap"))||0,this.thumbExtraGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-extra-gap"))||0,this.thumbWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-width"))||40,this.thumbClipWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-clip-width"))||40,this.thumbHeight=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-height"))||40)}refreshModern(){var t;if("modern"===this.type){this.updateModern();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.onTransformM(),null===(t=this.panzoom)||void 0===t||t.updateMetrics(!0),this.centerModern(0)}}centerModern(t){const e=this.instance,{container:i,panzoom:n}=this;if(!i||!n||n.state===A.Init)return;const s=e.page;let o=this.getModernThumbPos(s),a=o;for(let t=e.page-3;te.pages.length-1||t===e.page)continue;const i=1-this.getProgress(t);i>0&&i<1&&(a+=i*(this.getModernThumbPos(t)-o))}let r=100;void 0===t&&(t=.2,e.inTransition.size>0&&(t=.12),Math.abs(-1*n.current.e-a)>n.containerRect.width&&(t=.5,r=0)),n.options.maxVelocity=r,n.applyChange({panX:w(-1*a-n.target.e,1e3),friction:null===e.prevPage?0:t})}lazyLoadModern(){const{instance:t,panzoom:e}=this;if(!e)return;const i=-1*e.current.e||0;let n=this.getModernThumbPos(t.page);if(e.state!==A.Init||0===n)for(const n of t.slides||[]){const t=n.thumbSlideEl;if(!t)continue;const o=t.querySelector("img[data-lazy-src]"),a=n.index,r=this.getModernThumbPos(a),c=i-.5*e.containerRect.innerWidth,h=c+e.containerRect.innerWidth;if(!o||rh)continue;let d=o.dataset.lazySrc;if(!d||!d.length)continue;if(delete o.dataset.lazySrc,o.src=d,o.complete)continue;B(t,this.cn("isLoading"));const u=s(l);t.appendChild(u),o.addEventListener("load",(()=>{t.offsetParent&&(t.classList.remove(this.cn("isLoading")),u.remove())}),!1)}}resizeModernSlide(t){if("modern"!==this.type)return;if(!t.thumbSlideEl)return;const e=t.thumbClipWidth&&t.thumbHeight?Math.round(this.thumbHeight*(t.thumbClipWidth/t.thumbHeight)):this.thumbWidth;t.thumbWidth=e}getModernThumbPos(t){const e=this.instance.slides[t],i=this.panzoom;if(!i||!i.contentRect.fitWidth)return 0;let n=i.containerRect.innerWidth,s=i.contentRect.width;2===this.instance.slides.length&&(t-=1,s=2*this.thumbClipWidth);let o=t*(this.thumbClipWidth+this.thumbGap)+this.thumbExtraGap+.5*(e.thumbWidth||0);return o-=s>n?.5*n:.5*s,w(o||0,1)}build(){const t=this.instance,e=t.container,i=this.option("minCount")||0;if(i){let e=0;for(const i of t.slides||[])i.thumbSrc&&e++;if(e{var e,i;this.hidden&&(null===(e=t.container)||void 0===e||e.classList.add("is-hidden"),null===(i=t.container)||void 0===i||i.setAttribute("aria-hidden","true"),queueMicrotask((()=>{this.show()})))}}}),e.attachPlugins({Thumbs:K}),this.ref=e.plugins.Thumbs,this.option("showOnStart")||(this.ref.state=U.Hidden,this.hidden=!0))}onResize(){var t;const e=null===(t=this.ref)||void 0===t?void 0:t.container;e&&(e.style.height="")}onKeydown(t,e){const i=this.option("key");i&&i===e&&this.toggle()}toggle(){const t=this.ref;t&&t.state!==U.Disabled&&(t.state!==U.Hidden?this.hidden?this.show():this.hide():t.build())}show(){var t,e;const i=this.ref;i&&i.state!==U.Disabled&&(this.refresh(),null===(t=i.container)||void 0===t||t.removeAttribute("aria-hidden"),null===(e=i.container)||void 0===e||e.classList.remove("is-hidden"),this.hidden=!1)}hide(){var t,e;const i=this.ref;i&&(this.refresh(),null===(t=i.container)||void 0===t||t.classList.add("is-hidden"),null===(e=i.container)||void 0===e||e.setAttribute("aria-hidden","true")),this.hidden=!0}refresh(){const t=this.ref;if(!t||t.state===U.Disabled)return;const e=t.container,i=(null==e?void 0:e.firstChild)||null;e&&i&&i.childNodes.length&&(e.style.height=`${i.getBoundingClientRect().height}px`,e.offsetHeight)}attach(){this.instance.on("Carousel.init",this.onInit),this.instance.on("resize",this.onResize),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onInit),this.instance.off("resize",this.onResize),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(Q,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:J});const tt={panLeft:{icon:'',change:{panX:-100}},panRight:{icon:'',change:{panX:100}},panUp:{icon:'',change:{panY:-100}},panDown:{icon:'',change:{panY:100}},zoomIn:{icon:'',action:"zoomIn"},zoomOut:{icon:'',action:"zoomOut"},toggle1to1:{icon:'',action:"toggleZoom"},toggleZoom:{icon:'',action:"toggleZoom"},iterateZoom:{icon:'',action:"iterateZoom"},rotateCCW:{icon:'',action:"rotateCCW"},rotateCW:{icon:'',action:"rotateCW"},flipX:{icon:'',action:"flipX"},flipY:{icon:'',action:"flipY"},fitX:{icon:'',action:"fitX"},fitY:{icon:'',action:"fitY"},reset:{icon:'',action:"reset"},toggleFS:{icon:'',action:"toggleFS"}};var et;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Disabled=2]="Disabled"}(et||(et={}));const it={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'
/
'},download:{tpl:''},prev:{tpl:''},next:{tpl:''},slideshow:{tpl:''},fullscreen:{tpl:''},thumbs:{tpl:''},close:{tpl:''}},parentEl:null},nt={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"};class st extends g{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:et.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(t){var e;if(!t.carousel)return;let i=this.option("display"),n=this.option("absolute"),s=this.option("enabled");if("auto"===s){const t=this.instance.carousel;let e=0;if(t)for(const i of t.slides)(i.panzoom||"image"===i.type)&&e++;e||(s=!1)}s||(i=void 0);let o=0;const a={left:[],middle:[],right:[]};if(i)for(const t of["left","middle","right"])for(const n of i[t]){const i=this.createEl(n);i&&(null===(e=a[t])||void 0===e||e.push(i),o++)}let r=null;if(o&&(r=this.createContainer()),r){for(const[t,e]of Object.entries(a)){const i=document.createElement("div");B(i,"fancybox__toolbar__column is-"+t);for(const t of e)i.appendChild(t);"auto"!==n||"middle"!==t||e.length||(n=!0),r.appendChild(i)}!0===n&&B(r,"is-absolute"),this.state=et.Ready,this.onRefresh()}else this.state=et.Disabled}onClick(t){var e,i;const n=this.instance,s=n.getSlide(),o=null==s?void 0:s.panzoom,a=t.target,r=a&&R(a)?a.dataset:null;if(!r)return;if(void 0!==r.fancyboxToggleThumbs)return t.preventDefault(),t.stopPropagation(),void(null===(e=n.plugins.Thumbs)||void 0===e||e.toggle());if(void 0!==r.fancyboxToggleFullscreen)return t.preventDefault(),t.stopPropagation(),void this.instance.toggleFullscreen();if(void 0!==r.fancyboxToggleSlideshow){t.preventDefault(),t.stopPropagation();const e=null===(i=n.carousel)||void 0===i?void 0:i.plugins.Autoplay;let s=e.isActive;return o&&"mousemove"===o.panMode&&!s&&o.reset(),void(s?e.stop():e.start())}const l=r.panzoomAction,c=r.panzoomChange;if((c||l)&&(t.preventDefault(),t.stopPropagation()),c){let t={};try{t=JSON.parse(c)}catch(t){}o&&o.applyChange(t)}else l&&o&&o[l]&&o[l]()}onChange(){this.onRefresh()}onRefresh(){const t=this.container;if(!t)return;const e=this.instance.getSlide();if(!e)return;const i=e&&e.panzoom;for(const e of t.querySelectorAll("[data-panzoom-action]"))i?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));let n=i&&i.canZoomIn(),s=i&&i.canZoomOut();this.instance.isOpeningSlide(e)||e&&e.state!==u.Ready&&(n=s=!0);for(const e of t.querySelectorAll('[data-panzoom-action="zoomIn"]'))n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="zoomOut"]'))s?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){s||n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));const t=e.querySelector("g");t&&(t.style.display=n?"":"none")}}onDone(t,e){var i;null===(i=e.panzoom)||void 0===i||i.on("afterTransform",(()=>{this.instance.isCurrentSlide(e)&&this.onRefresh()})),this.instance.isCurrentSlide(e)&&this.onRefresh()}createContainer(){const t=this.instance.container;if(!t)return null;const e=this.option("parentEl")||t,i=document.createElement("div");return B(i,"fancybox__toolbar"),e.prepend(i),i.addEventListener("click",this.onClick,{passive:!1,capture:!0}),t&&B(t,"has-toolbar"),this.container=i,i}createEl(t){var e;const i=this.instance.carousel;if(!i)return null;if("toggleFS"===t)return null;if("fullscreen"===t&&!this.instance.fsAPI)return null;let n=null;const o=i.slides.length||0;let a=0,r=0;for(const t of i.slides)(t.panzoom||"image"===t.type)&&a++,("image"===t.type||t.downloadSrc)&&r++;if(o<2&&["infobar","prev","next"].includes(t))return n;if(void 0!==tt[t]&&!a)return null;if("download"===t&&!r)return null;if("thumbs"===t){const t=this.instance.plugins.Thumbs;if(!t||!t.isEnabled)return null}if("slideshow"===t){if(!(null===(e=this.instance.carousel)||void 0===e?void 0:e.plugins.Autoplay)||o<2)return null}if(void 0!==tt[t]){const e=tt[t];n=document.createElement("button"),n.setAttribute("title",this.instance.localize(`{{${t.toUpperCase()}}}`)),B(n,"f-button"),e.action&&(n.dataset.panzoomAction=e.action),e.change&&(n.dataset.panzoomChange=JSON.stringify(e.change)),n.appendChild(s(this.instance.localize(e.icon)))}else{const e=(this.option("items")||[])[t];e&&(n=s(this.instance.localize(e.tpl)),e.click&&n.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),"function"==typeof e.click&&e.click(t)})))}const l=null==n?void 0:n.querySelector("svg");if(l)for(const[t,e]of Object.entries(nt))l.getAttribute(t)||l.setAttribute(t,String(e));return n}removeContainer(){var t;const e=this.container;e&&e.removeEventListener("click",this.onClick,{passive:!1,capture:!0}),null===(t=this.container)||void 0===t||t.remove(),this.container=null,this.state=et.Disabled;const i=this.instance.container;i&&q(i,"has-toolbar")}attach(){this.instance.on("Carousel.initSlides",this.onReady),this.instance.on("done",this.onDone),this.instance.on("reveal",this.onChange),this.instance.on("Carousel.change",this.onChange),this.onReady(this.instance)}detach(){this.instance.off("Carousel.initSlides",this.onReady),this.instance.off("done",this.onDone),this.instance.off("reveal",this.onChange),this.instance.off("Carousel.change",this.onChange),this.removeContainer()}}Object.defineProperty(st,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:it});const ot={Hash:v,Html:Y,Images:N,Slideshow:V,Thumbs:Q,Toolbar:st},at=(t,e)=>{let i=[];return t.childNodes.forEach((t=>{t.nodeType!==Node.ELEMENT_NODE||e&&!t.matches(e)||i.push(t)})),i},rt={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var lt;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"}(lt||(lt={}));const ct=t=>{if("string"==typeof t&&(t={html:t}),!(t instanceof String||t instanceof HTMLElement)){const e=t.thumb;void 0!==e&&("string"==typeof e&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},ht=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t),dt={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'',dynamicFrom:11,maxCount:1/0,minCount:2};class ut extends g{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let t=this.list;return t||(t=document.createElement("ul"),B(t,this.cn("list")),t.setAttribute("role","tablist"),this.instance.container.appendChild(t),B(this.instance.container,this.cn("hasDots")),this.list=t),t}refresh(){var t;const e=this.instance.pages.length,i=Math.min(2,this.option("minCount")),n=Math.max(2e3,this.option("maxCount")),s=this.option("dynamicFrom");if(en)return void this.cleanup();const o="number"==typeof s&&e>5&&e>=s,a=!this.list||this.isDynamic!==o||this.list.children.length!==e;a&&this.cleanup();const r=this.build();if(E(r,this.cn("isDynamic"),!!o),a)for(let t=0;t=e-1&&s.setAttribute("disabled","")))}createButton(t){const e=this.instance,i=document.createElement("button");i.setAttribute("tabindex","0"),i.setAttribute("title",e.localize(`{{${t.toUpperCase()}}}`)),B(i,this.cn("button")+" "+this.cn("next"===t?"isNext":"isPrev"));const n=e.isRTL?"next"===t?"prev":"next":t;var s;return i.innerHTML=e.localize(this.option(`${n}Tpl`)),i.dataset[`carousel${s=t,s?s.match("^[a-z]")?s.charAt(0).toUpperCase()+s.substring(1):s:""}`]="true",i}build(){let t=this.container;t||(this.container=t=document.createElement("div"),B(t,this.cn("container")),this.instance.container.appendChild(t)),this.next||(this.next=t.appendChild(this.createButton("next"))),this.prev||(this.prev=t.appendChild(this.createButton("prev")))}cleanup(){this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove(),this.prev=null,this.next=null,this.container=null}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(pt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'',prevTpl:''}});class mt extends g{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){this.nav&&this.target&&(this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.state===lt.Ready&&this.onNavReady(this.nav),this.target.on("ready",this.onTargetReady),this.target.state===lt.Ready&&this.onTargetReady(this.target))}onNavReady(t){t.on("createSlide",this.onNavCreateSlide),t.on("Panzoom.click",this.onNavClick),this.onTargetChange()}onTargetReady(t){t.on("change",this.onTargetChange),t.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(t,e,i){var n,s;const o=i.target,{nav:a,target:r}=this;if(!a||!r||!o)return;const l=o.closest("[data-index]");if(!l)return;i.stopPropagation();const c=parseInt(l.dataset.index||"",10)||0,h=a.getPageForSlide(c);a.page!==h&&a.slideTo(h);const d=r.getPageForSlide(c);r.page!==d&&r.slideTo(d,{friction:null===(s=null===(n=this.nav)||void 0===n?void 0:n.plugins)||void 0===s?void 0:s.Sync.option("friction")}),this.markSelectedSlide(c)}onNavCreateSlide(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}onTargetChange(){const{target:t,nav:e}=this;if(!t||!e)return;if(e.state!==lt.Ready||t.state!==lt.Ready)return;const i=t.pages[t.page].slides[0].index,n=e.getPageForSlide(i);e.slideTo(n),this.markSelectedSlide(i)}markSelectedSlide(t){const{nav:e}=this;if(!e)return;this.selectedIndex=t,[...e.slides].filter((t=>t.el&&t.el.classList.remove("is-nav-selected")));const i=e.slides[t];i&&i.el&&i.el.classList.add("is-nav-selected")}attach(){let t=this.options.target,e=this.options.nav;t?this.addAsNavFor(t):e&&this.addAsTargetFor(e)}detach(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.nav=null,this.target&&(this.target.off("ready",this.onTargetReady),this.target.off("refresh",this.onTargetChange),this.target.off("change",this.onTargetChange)),this.target=null}}Object.defineProperty(mt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const ft={Navigation:pt,Dots:ut,Sync:mt};class gt extends f{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===lt.Ready}get isInfinite(){let t=!1;const e=this.contentDim,i=this.viewportDim;return this.pages.length>=2&&e>1.5*i&&(t=this.option("infinite")),t}get isRTL(){return"rtl"===this.option("direction")}get isHorizontal(){return"x"===this.option("axis")}constructor(t,e={},i={}){if(super(),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:lt.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),"string"==typeof t&&(t=document.querySelector(t)),!t||!R(t))throw new Error("No Element found");this.container=t,this.slideNext=n(this.slideNext.bind(this),175),this.slidePrev=n(this.slidePrev.bind(this),175),this.userOptions=e,this.userPlugins=i,queueMicrotask((()=>{this.processOptions()}))}processOptions(){const t=i({},gt.defaults,this.userOptions);let n="";const s=t.breakpoints;if(s&&e(s))for(const[o,a]of Object.entries(s))window.matchMedia(o).matches&&e(a)&&(n+=o,i(t,a));n===this.bp&&this.state!==lt.Init||(this.bp=n,this.state===lt.Ready&&(t.initialSlide=this.pages[this.page].slides[0].index),this.state!==lt.Init&&this.destroy(),super.setOptions(t),!1===this.option("enabled")?this.attachEvents():setTimeout((()=>{this.init()}),0))}init(){this.state=lt.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},gt.Plugins),this.userPlugins)),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=lt.Ready,this.emit("ready")}initLayout(){const{container:t}=this,e=this.option("classes");B(t,this.cn("container")),E(t,e.isLTR,!this.isRTL),E(t,e.isRTL,this.isRTL),E(t,e.isVertical,!this.isHorizontal),E(t,e.isHorizontal,this.isHorizontal);let i=this.option("viewport")||t.querySelector(`.${e.viewport}`);i||(i=document.createElement("div"),B(i,e.viewport),i.append(...at(t,`.${e.slide}`)),t.prepend(i));let n=this.option("track")||t.querySelector(`.${e.track}`);n||(n=document.createElement("div"),B(n,e.track),n.append(...Array.from(i.childNodes))),n.setAttribute("aria-live","polite"),i.contains(n)||i.prepend(n),this.viewport=i,this.track=n,this.emit("initLayout")}initSlides(){const{track:t}=this;if(t){this.slides=[],[...at(t,`.${this.cn("slide")}`)].forEach((t=>{if(R(t)){const e=ct({el:t,isDom:!0,index:this.slides.length});this.slides.push(e),this.emit("initSlide",e,this.slides.length)}}));for(let t of this.option("slides",[])){const e=ct(t);e.index=this.slides.length,this.slides.push(e),this.emit("initSlide",t,this.slides.length)}this.emit("initSlides")}}setInitialPage(){let t=0;const e=this.option("initialSlide");t="number"==typeof e?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0,this.page=t}setInitialPosition(){if(!this.track||!this.pages.length)return;let t=this.page;this.pages[t]||(this.page=t=0);const e=this.pages[t].pos*(this.isRTL&&this.isHorizontal?1:-1),i=this.isHorizontal?`${e}px`:"0",n=this.isHorizontal?"0":`${e}px`;this.track.style.transform=`translate3d(${i}, ${n}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const t=this.option("Panzoom")||{};this.panzoom=new H(this.viewport,i({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,decelFriction:.12,click:!1,dblClick:!1,touch:t=>!(this.pages.length<2&&!t.options.infinite),bounds:()=>this.getBounds(),maxVelocity:t=>Math.abs(t.target[this.axis]-t.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on("*",((t,e,...i)=>{this.emit(`Panzoom.${e}`,t,...i)})),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation),this.panzoom.on("touchStart",((t,e)=>{this.inTransition.size&&e.preventDefault()}))}attachEvents(){const t=this.container;t&&(t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let t=[];const{contentDim:e,viewportDim:i}=this,n=this.option("slidesPerPage");if("number"==typeof n&&e>i){for(let e=0;ei)&&(t.push(ht()),s=t.length-1,o=0),o+=e.dim+e.gap,t[s].slides.push(e);return t}processPages(){const t=this.pages,{contentDim:e,viewportDim:i}=this,n=this.option("center"),s=this.option("fill");if(t.forEach(((t,e)=>{t.index=e,t.pos=t.slides[0].pos,t.dim=0;for(const[e,i]of t.slides.entries())t.dim+=i.dim,e{s&&!this.isInfinite&&e>i&&(t.pos=Math.max(t.pos,0),t.pos=Math.min(t.pos,e-i)),t.pos=w(t.pos,1e3),t.dim=w(t.dim,1e3)})),this.isInfinite)return t;const o=[];let a;return t.forEach((t=>{const e=Object.assign({},t);a&&e.pos===a.pos?(a.dim+=e.dim,a.slides=[...a.slides,...e.slides]):(e.index=o.length,a=e,o.push(e))})),o}getPageFromIndex(t=0){const e=this.pages.length;let i;return t=parseInt((t||0).toString())||0,i=this.isInfinite?(t%e+e)%e:Math.max(Math.min(t,this.pages.length-1),0),i}getSlideMetrics(t){const e=this.isHorizontal?"width":"height";let i=0,n=0,s=t.el;s?i=parseFloat(s.dataset[e]||"")||0:(s=document.createElement("div"),s.style.visibility="hidden",B(s,this.cn("slide")+" "+t.class),(this.track||document.body).prepend(s)),i?(s.style[e]=`${i}px`,s.style["width"===e?"height":"width"]=""):i=s.getBoundingClientRect()[e];const o=getComputedStyle(s);return"content-box"===o.boxSizing&&(this.isHorizontal?(i+=parseFloat(o.paddingLeft)||0,i+=parseFloat(o.paddingRight)||0):(i+=parseFloat(o.paddingTop)||0,i+=parseFloat(o.paddingBottom)||0)),n=parseFloat(o[this.isHorizontal?"marginRight":"marginBottom"])||0,this.isHorizontal,t.el||s.remove(),{dim:i,gap:n}}getBounds(){let t={min:0,max:0};if(this.isInfinite)t={min:-1/0,max:1/0};else if(this.pages.length){const e=this.pages[0].pos,i=this.pages[this.pages.length-1].pos;t=this.isRTL&&this.isHorizontal?{min:e,max:i}:{min:-1*i,max:-1*e}}return{x:this.isHorizontal?t:{min:0,max:0},y:this.isHorizontal?{min:0,max:0}:t}}repositionSlides(){const{viewportDim:t,contentDim:e,page:i,pages:n}=this;let s,o=0,a=0,r=0,l=0;this.panzoom?l=-1*this.panzoom.current[this.isHorizontal?"e":"f"]:n[i]&&(l=n[i].pos||0),s=this.isHorizontal?this.isRTL?"right":"left":"top",this.isRTL&&this.isHorizontal&&(l*=-1);for(const t of this.slides)t.el?("top"===s?(t.el.style.right="",t.el.style.left=""):t.el.style.top="",t.index!==o?t.el.style[s]=0===a?"":`${a}px`:t.el.style[s]="",r+=t.dim+t.gap,o++):a+=t.dim+t.gap;if(this.isInfinite&&r)for(const i of this.slides)i.el&&(w(i.pos)w(e-t)&&(i.el.style[s]=`${a+r}px`),w(i.pos+i.gap)>=w(e-t)&&w(i.pos)>w(l+t)&&w(l)1&&(c=this.pages[d[0]],h=this.pages[d[1]]),c&&h){let t=0;for(const e of this.slides)e.el?this.inTransition.has(e.index)&&c.slides.indexOf(e)<0&&(e.el.style[s]=`${t+(c.pos-h.pos)}px`):t+=e.dim+e.gap}}createSlideEl(t){if(!this.track||!t)return;if(t.el)return;const e=document.createElement("div");B(e,this.cn("slide")),B(e,t.class),t.html&&(e.innerHTML=t.html);const i=[];this.slides.forEach(((t,e)=>{t.el&&i.push(e)}));const n=t.index;let s=null;if(i.length){let t=i.reduce(((t,e)=>Math.abs(e-n)this.page?1:-1,a=this.pages[s].pos*(this.isRTL?1:-1);if(this.page===s&&a===n.target[this.axis])return!1;this.clearTransitions();const r=n.isResting;B(this.container,this.cn("inTransition"));const l=this.pages[this.page].slides[0],c=this.pages[s].slides[0];this.inTransition.add(c.index),this.createSlideEl(c);let h=l.el,d=c.el;r||"slide"===e||(e="fadeFast",h=null);const u=this.isRTL?"next":"prev",p=this.isRTL?"prev":"next";return h&&(this.inTransition.add(l.index),l.transition=e,h.addEventListener("animationend",this.onAnimationEnd),h.classList.add(`f-${e}Out`,`to-${o>0?p:u}`)),d&&(c.transition=e,d.addEventListener("animationend",this.onAnimationEnd),d.classList.add(`f-${e}In`,`from-${o>0?u:p}`)),n.panTo({x:this.isHorizontal?a:0,y:this.isHorizontal?0:a,friction:0}),this.onChange(s),!0}manageSlideVisiblity(){const t=new Set,e=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const n of this.slides)i.has(n)?t.add(n):e.add(n);for(const e of this.inTransition)t.add(this.slides[e]);for(const e of t)this.createSlideEl(e),this.lazyLoadSlide(e);for(const i of e)t.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t="aria-hidden";let e=this.cn("isSelected");if(e)for(const i of this.slides)i.el&&(i.el.dataset.index=`${i.index}`,this.pages[this.page].slides.includes(i)?(i.el.classList.contains(e)||(B(i.el,e),this.emit("selectSlide",i)),i.el.removeAttribute(t)):(i.el.classList.contains(e)&&(q(i.el,e),this.emit("unselectSlide",i)),i.el.setAttribute(t,"true")))}flipInfiniteTrack(){const t=this.panzoom;if(!t||!this.isInfinite)return;const e="x"===this.option("axis")?"e":"f",{viewportDim:i,contentDim:n}=this;let s=t.current[e],o=t.target[e]-s,a=0,r=.5*i,l=n;this.isRTL&&this.isHorizontal?(s<-r&&(a=-1,s+=l),s>l-r&&(a=1,s-=l)):(s>r&&(a=1,s-=l),s<-l+r&&(a=-1,s+=l)),a&&(t.current[e]=s,t.target[e]=s+o)}lazyLoadSlide(t){const e=this,i=t&&t.el;if(!i)return;const n=new Set;i.querySelectorAll("[data-lazy-srcset]").forEach((t=>{t instanceof HTMLImageElement&&n.add(t)})),i.querySelectorAll("[data-lazy-src]").forEach((t=>{t instanceof HTMLImageElement?n.add(t):R(t)&&(t.style.backgroundImage=`url('${t.dataset.lazySrc||""}')`)}));const o=(t,i,n)=>{n&&(n.remove(),n=null),i.complete&&(i.style.display=""),this.option("adaptiveHeight")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&e.setViewportHeight()};for(const e of n){let i=null;e.src=e.dataset.lazySrcset||e.dataset.lazySrc||"",delete e.dataset.lazySrc,delete e.dataset.lazySrcset,e.style.display="none",e.addEventListener("error",(()=>{o(t,e,i)})),e.addEventListener("load",(()=>{o(t,e,i)})),setTimeout((()=>{!e.complete&&e.parentNode&&t.el&&(i=s(l),e.parentNode.insertBefore(i,e))}),300)}let a=i.dataset.lazySrc;a&&a.length&&(i.style.backgroundImage=`url('${a}')`)}clearTransitions(){this.inTransition.clear(),q(this.container,this.cn("inTransition"));const t=["to-prev","to-next","from-prev","from-next"];for(const e of this.slides){const i=e.el;if(i){i.removeEventListener("animationend",this.onAnimationEnd),i.classList.remove(...t);const n=e.transition;n&&i.classList.remove(`f-${n}Out`,`f-${n}In`)}}this.manageSlideVisiblity()}onAnimationEnd(t){const e=t.target,i=e?parseInt(e.dataset.index||"",10)||0:-1,n=this.slides[i],s=t.animationName;if(!e||!n||!s)return;const o=!!this.inTransition.has(i)&&n.transition;o&&s.substring(0,o.length+2)===`f-${o}`&&this.inTransition.delete(i),this.inTransition.size||this.clearTransitions(),i===this.page&&this.emit("settle")}onDecel(t,e=0,i=0){const n=this.isInfinite,s=this.isHorizontal?e:i,o=this.pages.length;if(!o)return;const a=this.option("dragFree");let r=this.page,l=0;const c=this.axis;!n&&(t.target[c],this.viewportDim);const h=t.current[c]*(this.isRTL&&this.isHorizontal?1:-1);let{pageIndex:d}=this.getPageFromPosition(h);if(a||Math.abs(s)<10){const e=t.target[c]*(this.isRTL&&this.isHorizontal?1:-1),{pageIndex:i}=this.getPageFromPosition(e);r=i}else r=this.isRTL&&this.isHorizontal?s<0?d-1:d+1:s<0?d+1:d-1,n||(r=Math.max(0,Math.min(r,this.pages.length-1)));if(n&&(l=Math.floor(r/o)||0),r=(r%o+o)%o,a&&t.dragOffset["e"===c?"x":"y"]);else{const e=this.contentDim;let i=(this.pages[r].pos+l*e)*(this.isRTL&&this.isHorizontal?1:-1);if(Math.abs(t.target[c]-i)<.1&&t.lockedAxis===("e"==c?"y":"x"))return;if(t.target[c]===i)return;t.applyChange({panX:this.isHorizontal?i-t.target.e:0,panY:this.isHorizontal?0:i-t.target.f,friction:t.option("decelFriction")})}r!==this.page&&this.onChange(r)}onClick(t){const e=t.target,i=e&&R(e)?e.dataset:null;let n;i&&(void 0!==i.carouselPage?n="slideTo":void 0!==i.carouselNext?n="slideNext":void 0!==i.carouselPrev&&(n="slidePrev")),n?(t.preventDefault(),t.stopPropagation(),e&&!e.hasAttribute("disabled")&&this[n](i&&"slideTo"===n?i.carouselPage:void 0)):this.emit("click",t)}onSlideTo(t){const e=t.detail||0;this.slideTo(this.getPageForSlide(e),{friction:0})}onChange(t,e=0){const i=this.page;this.prevPage=i,this.page=t,this.option("adaptiveHeight")&&this.setViewportHeight(),this.emit("change",t,i,e)}onRefresh(t,e=""){let i=this.contentDim,n=this.viewportDim;this.updateMetrics(),this.contentDim===i&&this.viewportDim===n||this.slideTo(this.page,{friction:0,transition:!1})}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(){this.flipInfiniteTrack(),this.manageSlideVisiblity()}onEndAnimation(){this.emit("settle")}reInit(t=null,e=null){this.destroy(),this.state=lt.Init,this.userOptions=t||this.userOptions,this.userPlugins=e||this.userPlugins,this.processOptions()}slideTo(t=0,{friction:e=this.option("friction"),transition:i=this.option("transition")}={}){const n=this.panzoom,s=this.pages.length;if(!n||!s)return;if(this.transitionTo(t,i))return;const o=this.axis,a=this.getPageFromIndex(t);let r=this.pages[a].pos,l=0;if(this.isInfinite){const t=n.current[o]*(this.isRTL&&this.isHorizontal?1:-1),e=this.contentDim,i=r+e,s=r-e;Math.abs(t-i){t.el&&(s=Math.max(s,t.el.offsetHeight))}))),i.style.height=s?`${s}px`:""}getPageForSlide(t){for(const e of this.pages)for(const i of e.slides)if(i.index===t)return e.index;return-1}getVisibleSlides(t=0){var e;const i=new Set;let{contentDim:n,viewportDim:s,pages:o,page:a}=this;n=n+(null===(e=this.slides[this.slides.length-1])||void 0===e?void 0:e.gap)||0;let r=0;r=this.panzoom?-1*this.panzoom.current[this.axis]:o[a]&&o[a].pos||0,this.isInfinite&&(r-=Math.floor(r/n)*n),this.isRTL&&this.isHorizontal&&(r*=-1),r=w(r,1e3);const l=w(r-s*t,1e3),c=w(r+s*(t+1),1e3),h=this.isInfinite?[-1,0,1]:[0];for(const t of this.slides)for(const e of h){const s=t.pos+e*n,o=t.pos+t.dim+t.gap+e*n;sl&&i.add(t)}return i}getPageFromPosition(t){const{viewportDim:e,contentDim:i}=this,n=this.pages.length;let s=0,o=0;const a=this.option("center");a&&(t+=.5*e),this.isInfinite||(t=Math.max(this.slides[0].pos,Math.min(t,this.slides[this.slides.length-1].pos)));const r=i+this.slides[this.slides.length-1].gap,l=Math.floor(t/r)||0;t-=l*r;let c=this.slides[this.slides.length-1],h=this.slides.find((e=>{const i=t+(c&&!a?.5*c.dim:0);return c=e,e.pos<=i&&e.pos+e.dim+e.gap>i}));return h||(h=this.slides[this.slides.length-1]),o=this.getPageForSlide(h.index),s=o+l*n,{page:s,pageIndex:o}}destroy(){if([lt.Destroy].includes(this.state))return;this.state=lt.Destroy;const{container:t,viewport:e,track:i,slides:n,panzoom:s}=this,o=this.option("classes");t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),t.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),s&&(s.destroy(),this.panzoom=null),n&&n.forEach((t=>{this.removeSlideEl(t)})),this.detachPlugins(),this.track=null,this.viewport=null,this.page=0,e&&i&&e.replaceWith(...i.childNodes);for(const[e,i]of Object.entries(o))"container"!==e&&i&&t.classList.remove(i);this.slides=[];const a=this.events.get("ready");this.events=new Map,a&&this.events.set("ready",a)}}Object.defineProperty(gt,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:H}),Object.defineProperty(gt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:rt}),Object.defineProperty(gt,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:ft});let bt=null,vt=null;const yt=new Map;let wt=0;class xt extends f{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(t=[],e={},i={}){super(e),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:d.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fsAPI",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.onWheel=n(this.onWheel.bind(this),300),this.fsAPI=(()=>{let t,e="",i="",n="";return document.fullscreenEnabled?(e="requestFullscreen",i="exitFullscreen",n="fullscreenElement"):document.webkitFullscreenEnabled&&(e="webkitRequestFullscreen",i="webkitExitFullscreen",n="webkitFullscreenElement"),e&&(t={request:function(t){return"webkitRequestFullscreen"===e?t[e](Element.ALLOW_KEYBOARD_INPUT):t[e]()},exit:function(){return document[n]&&document[i]()},isFullscreen:function(){return document[n]}}),t})(),this.id=e.id||++wt,yt.set(this.id,this),this.userSlides=t,this.userPlugins=i,queueMicrotask((()=>{this.init()}))}init(){this.state=d.Init,this.attachPlugins(Object.assign(Object.assign({},xt.Plugins),this.userPlugins)),this.emit("init"),!0===this.option("hideScrollbar")&&(()=>{if(!o)return;if(document.body.classList.contains("compensate-for-scrollbar"))return;const t=window.innerWidth-document.documentElement.getBoundingClientRect().width;document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",`${t}px`),t&&document.body.classList.add("compensate-for-scrollbar")})(),this.initLayout();const t=()=>{this.initCarousel(this.userSlides),this.state=d.Ready,this.attachEvents(),this.emit("ready"),setTimeout((()=>{this.container&&this.container.setAttribute("aria-hidden","false")}),16)};this.option("Fullscreen.autoStart")&&this.fsAPI&&!this.fsAPI.isFullscreen()?this.fsAPI.request(this.container).then((()=>t())).catch((()=>t())):t()}initLayout(){const t=this.option("parentEl")||document.body,e=s(this.localize(this.option("tpl.main")||""));e&&(e.setAttribute("id",`fancybox-${this.id}`),e.setAttribute("aria-label",this.localize("{{MODAL}}")),e.classList.toggle("is-compact",this.isCompact),this.container=e,this.footer=e.querySelector(".fancybox__footer"),t.appendChild(e),document.documentElement.classList.add("with-fancybox"),bt&&vt||(bt=document.createElement("button"),bt.classList.add("fancybox-focus-guard"),bt.setAttribute("aria-hidden","true"),bt.setAttribute("type","button"),vt=bt.cloneNode(),document.body.prepend(bt),document.body.append(vt)),this.option("animated")&&(e.classList.add("is-animated"),setTimeout((()=>{this.isClosing()||e.classList.remove("is-animated")}),350)),this.emit("initLayout"))}initCarousel(t){const e=this.container;if(!e)return;const n=e.querySelector(".fancybox__carousel");if(!n)return;const s=this.carousel=new gt(n,i({},{slides:t,transition:"fade",Panzoom:{lockAxis:this.option("dragToClose")?"xy":"x",infinite:!!this.option("dragToClose")&&"y"},Dots:!1,Navigation:{classes:{container:"fancybox__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"}},initialPage:this.option("startIndex"),l10n:this.option("l10n")},this.option("Carousel")||{}));s.on("*",((t,e,...i)=>{this.emit(`Carousel.${e}`,t,...i)})),s.on(["ready","change"],(()=>{this.manageCaption(this.getSlide())})),s.on("removeSlide",((t,e)=>{e.closeBtnEl&&e.closeBtnEl.remove(),e.closeBtnEl=void 0,e.captionEl&&e.captionEl.remove(),e.captionEl=void 0,e.spinnerEl&&e.spinnerEl.remove(),e.spinnerEl=void 0,e.state=void 0})),s.on("Panzoom.touchStart",(()=>{this.isCompact||this.endIdle()})),s.on("settle",(()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&this.checkFocus()})),this.option("dragToClose")&&(s.on("Panzoom.afterTransform",((t,e)=>{const i=this.container;if(i){const t=Math.abs(e.current.f),n=t<1?"":Math.max(.5,Math.min(1,1-t/e.contentRect.fitHeight*1.5));i.style.setProperty("--fancybox-ts",n?"0s":""),i.style.setProperty("--fancybox-opacity",n+"")}})),s.on("Panzoom.touchEnd",((t,e,i)=>{const n=Math.abs(e.dragOffset.y);"y"===e.lockedAxis&&(n>=200||n>=50&&e.dragOffset.time<300)&&(i&&i.cancelable&&i.preventDefault(),this.close(i,"f-throwOut"+(e.current.f<0?"Up":"Down")))}))),s.on(["change"],(t=>{var e;let i=null===(e=this.getSlide())||void 0===e?void 0:e.triggerEl;if(i){const e=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:t.page});i.dispatchEvent(e)}})),s.on(["refresh","change"],(t=>{const e=this.container;if(!e)return;for(const i of e.querySelectorAll("[data-fancybox-current-index]"))i.innerHTML=t.page+1;for(const i of e.querySelectorAll("[data-fancybox-count]"))i.innerHTML=t.pages.length;if(!t.isInfinite){for(const i of e.querySelectorAll("[data-fancybox-next]"))t.page0?(i.removeAttribute("disabled"),i.removeAttribute("tabindex")):(i.setAttribute("disabled",""),i.setAttribute("tabindex","-1"))}const i=this.getSlide();let n=(null==i?void 0:i.downloadSrc)||"";n||!i||"image"!==i.type||i.error||"string"!=typeof i.src||(n=i.src);for(const t of e.querySelectorAll("[data-fancybox-download]"))n?(t.removeAttribute("disabled"),t.removeAttribute("tabindex"),t.setAttribute("href",n),t.setAttribute("download",n),t.setAttribute("target","_blank")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"),t.removeAttribute("href"),t.removeAttribute("download"))})),this.emit("initCarousel")}attachEvents(){const t=this.container;t&&(t.addEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),document.addEventListener("mousemove",this.onMousemove),window.addEventListener("resize",this.onResize),this.option("trapFocus")&&document.addEventListener("focus",this.onFocus,!0),document.addEventListener("keydown",this.onKeydown,!0),document.addEventListener("visibilitychange",this.onVisibilityChange,!1))}detachEvents(){const t=this.container;t&&(t.removeEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),document.removeEventListener("mousemove",this.onMousemove),window.removeEventListener("resize",this.onResize),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),document.removeEventListener("focus",this.onFocus,!0),document.removeEventListener("keydown",this.onKeydown,!0))}onClick(t){var e;if(this.isClosing())return;!this.isCompact&&this.option("idle")&&this.resetIdle();const i=t.composedPath()[0];if(i===(null===(e=this.carousel)||void 0===e?void 0:e.container))return;if(i.closest(".f-spinner")||i.closest("[data-fancybox-close]"))return t.preventDefault(),void this.close(t);if(i.closest("[data-fancybox-prev]"))return t.preventDefault(),void this.prev();if(i.closest("[data-fancybox-next]"))return t.preventDefault(),void this.next();if(this.isCompact)return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout((()=>{this.toggleIdle(),this.clickTimer=null}),350));if(this.emit("click",t),t.defaultPrevented)return;let n=!1;const s=document.activeElement;if(i.closest(".fancybox__content")){if(s){if(s.closest("[contenteditable]"))return;i.matches(r)||s.blur()}if((o=window.getSelection())&&"Range"===o.type)return;n=this.option("contentClick")}else i.closest(".fancybox__carousel")&&!i.matches(r)&&(n=this.option("backdropClick"));var o;"close"===n?(t.preventDefault(),this.close(t)):"next"===n?(t.preventDefault(),this.next()):"prev"===n&&(t.preventDefault(),this.prev())}onWheel(t){if(this.emit("wheel",t),t.defaultPrevented)return;const e=this.option("wheel",t);if("close"===e)t.preventDefault(),this.close(t);else if("slide"===e){const e=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail));t.preventDefault(),this[e>0?"next":"prev"]()}}onKeydown(t){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const e=t.key,i=this.option("keyboard");if(!i||t.ctrlKey||t.altKey||t.shiftKey)return;const n=t.composedPath()[0],s=document.activeElement&&document.activeElement.classList,o=s&&s.contains("f-button");if("Escape"!==e&&!o&&R(n)){if(n.isContentEditable||-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(n.nodeName))return}this.emit("keydown",e,t);const a=i[e];"function"==typeof this[a]&&this[a]()}onResize(){const t=this.container;if(!t)return;const e=this.isCompact;t.classList.toggle("is-compact",e),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.emit("resize")}onFocus(t){this.isTopmost()&&this.focus(t)}onMousemove(t){this.prevMouseMoveEvent=t,!this.isCompact&&this.option("idle")&&this.resetIdle()}onVisibilityChange(){"visible"===document.visibilityState?this.checkFocus():this.endIdle()}manageCloseBtn(t){const e=this.optionFor(t,"closeButton")||!1;if("auto"===e){const t=this.plugins.Toolbar;if(t&&t.state===et.Ready)return}if(!e)return;if(!t.contentEl||t.closeBtnEl)return;const i=s(this.localize(this.option("tpl.closeButton")));t.closeBtnEl=t.contentEl.appendChild(i),t.el&&B(t.el,"has-close-btn")}manageCaption(t){var e,i,n;const s=this.container;if(!s)return;const o=this.isCompact||this.option("commonCaption"),a=!o;if(this.caption&&this.stop(this.caption),a&&this.caption&&(this.caption.remove(),this.caption=null),o&&!this.caption)for(const t of(null===(e=this.carousel)||void 0===e?void 0:e.slides)||[])t.captionEl&&(t.captionEl.remove(),t.captionEl=void 0,null===(i=t.el)||void 0===i||i.classList.remove("has-caption"),null===(n=t.el)||void 0===n||n.removeAttribute("aria-labelledby"));if(t||(t=this.getSlide()),!t||o&&!this.isCurrentSlide(t))return;const r=t.el;let l=this.optionFor(t,"caption","");if("string"!=typeof l||!l.length)return void(o&&this.caption&&this.animate(this.caption,"f-fadeOut",(()=>{var t;null===(t=this.caption)||void 0===t||t.remove(),this.caption=null})));let c=null;if(a){if(c=t.captionEl||null,r&&!c){const e=`fancybox__caption_${this.id}_${t.index}`;c=document.createElement("div"),c.className="fancybox__caption",c.setAttribute("id",e),t.captionEl=r.appendChild(c),r.classList.add("has-caption"),r.setAttribute("aria-labelledby",e)}}else{if(c=this.caption,c||(c=s.querySelector(".fancybox__caption")),!c){c=document.createElement("div"),c.dataset.fancyboxCaption="",c.className="fancybox__caption",c.innerHTML=l;(this.footer||s).prepend(c)}s.classList.add("has-caption"),this.caption=c}c&&(c.innerHTML=l)}checkFocus(){var t;const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}focus(t){var e;if(this.ignoreFocusChange)return;const i=document.activeElement||null,n=(null==t?void 0:t.target)||null,s=this.container,l=this.getSlide();if(!s||!(null===(e=this.carousel)||void 0===e?void 0:e.viewport))return;const c=l&&l.state===u.Ready?l.el:null;if(!c||c.contains(i))return;t&&t.cancelable&&t.preventDefault(),this.ignoreFocusChange=!0;const h=Array.from(s.querySelectorAll(r));let d,p=[s];for(let t of h){const e=t.offsetParent&&!t.closest('[aria-hidden="true"]'),i=c&&c.contains(t),n=!this.carousel.viewport.contains(t);e&&(i||n)?(p.push(t),void 0!==t.dataset.origTabindex&&(t.tabIndex=parseFloat(t.dataset.origTabindex)),t.removeAttribute("data-orig-tabindex"),(t.hasAttribute("autoFocus")||!d&&i)&&(d=t)):(t.dataset.origTabindex=void 0===t.dataset.origTabindex?t.getAttribute("tabindex")||void 0:t.dataset.origTabindex,t.tabIndex=-1)}let m=null;t?(!n||p.indexOf(n)<0)&&(m=s,p.length&&(i===vt?m=p[0]:this.lastFocus!==s&&i!==bt||(m=p[p.length-1]))):this.option("autoFocus")&&d?m=d:i&&p.indexOf(i)<0&&(m=s),m&&(t=>{if(t&&o){void 0===a&&document.createElement("div").focus({get preventScroll(){return a=!0,!1}});try{if(a)t.focus({preventScroll:!0});else{const e=window.pageXOffset||document.body.scrollTop,i=window.pageYOffset||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:i,behavior:"auto"})}}catch(t){}}})(m),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const t=this.carousel;t&&t.pages.length>1&&t.slideNext()}prev(){const t=this.carousel;t&&t.pages.length>1&&t.slidePrev()}jumpTo(...t){this.carousel&&this.carousel.slideTo(...t)}isTopmost(){var t;return(null===(t=xt.getInstance())||void 0===t?void 0:t.id)==this.id}animate(t=null,e="",i){if(!t||!e)return void(i&&i());this.stop(t);const n=s=>{s.target===t&&t.dataset.animationName&&(t.removeEventListener("animationend",n),delete t.dataset.animationName,i&&i(),t.classList.remove(e))};t.dataset.animationName=e,t.addEventListener("animationend",n),t.classList.add(e)}stop(t){t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:t}))}setContent(t,e="",i=!0){if(this.isClosing())return;const n=t.el;if(!n)return;let s=null;if(R(e))["img","iframe","video","audio"].includes(e.nodeName.toLowerCase())?(s=document.createElement("div"),s.appendChild(e)):s=e;else{const t=document.createRange().createContextualFragment(e);s=document.createElement("div"),s.appendChild(t)}s instanceof Element&&t.filter&&!t.error&&(s=s.querySelector(t.filter)),s instanceof Element?(s.classList.add("fancybox__content"),t.id&&s.setAttribute("id",t.id),"none"!==s.style.display&&"none"!==getComputedStyle(s).getPropertyValue("display")||(s.style.display=t.display||this.option("defaultDisplay")||"flex"),n.classList.add(`has-${t.error?"error":t.type||"unknown"}`),n.prepend(s),t.contentEl=s,i&&this.revealContent(t),this.manageCloseBtn(t),this.manageCaption(t)):this.setError(t,"{{ELEMENT_NOT_FOUND}}")}revealContent(t,e){const i=t.el,n=t.contentEl;i&&n&&(this.emit("reveal",t),this.hideLoading(t),t.state=u.Opening,(e=this.isOpeningSlide(t)?void 0===e?this.optionFor(t,"showClass"):e:"f-fadeIn")?this.animate(n,e,(()=>{this.done(t)})):this.done(t))}done(t){var e;this.isClosing()||(t.state=u.Ready,this.emit("done",t),null===(e=t.el)||void 0===e||e.classList.add("is-done"),this.isCurrentSlide(t)&&this.option("autoFocus")&&queueMicrotask((()=>{var t;if(this.option("autoFocus")){const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}})),this.isOpeningSlide(t)&&!this.isCompact&&this.option("idle")&&this.setIdle())}isCurrentSlide(t){const e=this.getSlide();return!(!t||!e)&&e.index===t.index}isOpeningSlide(t){var e,i;return null===(null===(e=this.carousel)||void 0===e?void 0:e.prevPage)&&t.index===(null===(i=this.getSlide())||void 0===i?void 0:i.index)}showLoading(t){t.state=u.Loading;const e=t.el;if(!e)return;e.classList.add("is-loading"),this.emit("loading",t),t.spinnerEl||setTimeout((()=>{if(!this.isClosing()&&!t.spinnerEl&&t.state===u.Loading){let i=s(l);t.spinnerEl=i,e.prepend(i),this.animate(i,"f-fadeIn")}}),250)}hideLoading(t){const e=t.el;if(!e)return;const i=t.spinnerEl;this.isClosing()?null==i||i.remove():(e.classList.remove("is-loading"),i&&this.animate(i,"f-fadeOut",(()=>{i.remove()})),t.state===u.Loading&&(this.emit("loaded",t),t.state=u.Ready))}setError(t,e){if(this.isClosing())return;this.emit("error"),t.error=e,this.hideLoading(t),this.clearContent(t);const i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(e||"

{{ERROR}}

"),this.setContent(t,i)}clearContent(t){var e;null===(e=this.carousel)||void 0===e||e.emit("removeSlide",t),t.contentEl&&(t.contentEl.remove(),t.contentEl=void 0),t.closeBtnEl&&(t.closeBtnEl.remove(),t.closeBtnEl=void 0);const i=t.el;i&&(q(i,"is-loading"),q(i,"has-error"),q(i,"has-unknown"),q(i,`has-${t.type||"unknown"}`))}getSlide(){var t;const e=this.carousel;return(null===(t=null==e?void 0:e.pages[null==e?void 0:e.page])||void 0===t?void 0:t.slides[0])||void 0}close(t,e){if(this.isClosing())return;const i=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",i,t),i.defaultPrevented)return;t&&t.cancelable&&(t.preventDefault(),t.stopPropagation());const n=this.fsAPI,s=()=>{this.proceedClose(t,e)};n&&n.isFullscreen()?Promise.resolve(n.exit()).then((()=>s())):s()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(t=!1){const e=()=>{var t;this.clearIdle(),this.idle=!0,null===(t=this.container)||void 0===t||t.classList.add("is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(t)e();else{const t=this.option("idle");t&&(this.idleTimer=setTimeout(e,t))}}endIdle(){var t;this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,null===(t=this.container)||void 0===t||t.classList.remove("is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){const t=this.fsAPI;t&&(t.isFullscreen()?t.exit():this.container&&t.request(this.container))}isClosing(){return[d.Closing,d.CustomClosing,d.Destroy].includes(this.state)}proceedClose(t,e){var i,n;this.state=d.Closing,this.clearIdle(),this.detachEvents();const s=this.container,o=this.carousel,a=this.getSlide(),r=null==a?void 0:a.state;if(a){const t=this.option("placeFocusBack")?(null===(i=this.getSlide())||void 0===i?void 0:i.triggerEl)||this.option("trigger"):null;t&&t.focus()}if(s&&(B(s,"is-closing"),s.setAttribute("aria-hidden","true"),this.option("animated")&&B(s,"is-animated"),s.style.pointerEvents="none"),o){o.clearTransitions(),null===(n=o.panzoom)||void 0===n||n.destroy();for(const t of o.slides){t.state=u.Closing,this.hideLoading(t);const e=t.contentEl;e&&this.stop(e);const i=null==t?void 0:t.panzoom;i&&(i.stop(),i.detachEvents(),i.detachObserver()),this.isCurrentSlide(t)||o.emit("removeSlide",t)}}this.emit("close",t),this.state!==d.CustomClosing?(void 0===e&&a&&(e=this.optionFor(a,"hideClass")),e&&a&&r===u.Ready?(this.animate(a.contentEl,e,(()=>{o&&o.emit("removeSlide",a)})),setTimeout((()=>{this.destroy()}),350)):this.destroy()):setTimeout((()=>{this.destroy()}),350)}destroy(){var t;if(this.state===d.Destroy)return;this.state=d.Destroy,null===(t=this.carousel)||void 0===t||t.destroy();const e=this.container;e&&e.remove(),yt.delete(this.id);const i=xt.getInstance();i?i.focus():(bt&&(bt.remove(),bt=null),vt&&(vt.remove(),vt=null),document.documentElement.classList.remove("with-fancybox"),o&&(document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",""),document.body.classList.remove("compensate-for-scrollbar")))}static bind(t,e,i){if(!o)return;let n,s="",a={};if("string"==typeof t?(n=document.body,s=t,"object"==typeof e&&(a=e||{})):(n=t,"string"==typeof e&&(s=e),"object"==typeof i&&(a=i||{})),!n)return;s=s||"[data-fancybox]";const r=xt.openers.get(n)||new Map;r.set(s,a),xt.openers.set(n,r),1===r.size&&n.addEventListener("click",xt.fromEvent)}static unbind(t,e){let i,n="";if("string"==typeof t?(i=document.body,n=t):(i=t,"string"==typeof e&&(n=e)),!i)return;const s=xt.openers.get(i);s&&n&&s.delete(n),n&&s||(xt.openers.delete(i),i.removeEventListener("click",xt.fromEvent))}static destroy(){let t;for(;t=xt.getInstance();)t.destroy();for(const t of xt.openers.keys())t.removeEventListener("click",xt.fromEvent);xt.openers=new Map}static fromEvent(t){if(t.defaultPrevented)return;if(t.button&&0!==t.button)return;if(t.ctrlKey||t.metaKey||t.shiftKey)return;let e=t.composedPath()[0];const n=e.closest("[data-fancybox-trigger]");if(n){const t=n.dataset.fancyboxTrigger||"",i=document.querySelectorAll(`[data-fancybox="${t}"]`),s=parseInt(n.dataset.fancyboxIndex||"",10)||0;e=i[s]||e}if(!(e&&e instanceof Element))return;let s,o,a,r;if([...xt.openers].reverse().find((([t,i])=>!(!t.contains(e)||![...i].reverse().find((([i,n])=>{let l=e.closest(i);return!!l&&(s=t,o=i,a=l,r=n,!0)}))))),!s||!o||!a)return;r=r||{},t.preventDefault(),e=a;let l=[],c=i({},h,r);c.event=t,c.trigger=e,c.delegate=n;const d=c.groupAll,u=c.groupAttr,p=u&&e?e.getAttribute(`${u}`):"";if((!e||p||d)&&(l=[].slice.call(s.querySelectorAll(o))),e&&!d&&(l=p?l.filter((t=>t.getAttribute(`${u}`)===p)):[e]),!l.length)return;const m=xt.getInstance();return m&&m.options.trigger&&l.indexOf(m.options.trigger)>-1?void 0:(e&&(c.startIndex=l.indexOf(e)),xt.fromNodes(l,c))}static fromNodes(t,e){e=i({},h,e);const n=[];for(const i of t){const t=i.dataset||{},s=t.src||i.getAttribute("href")||i.getAttribute("currentSrc")||i.getAttribute("src")||void 0;let o;const a=e.delegate;let r;a&&n.length===e.startIndex&&(o=a instanceof HTMLImageElement?a:a.querySelector("img:not([aria-hidden])")),o||(o=i instanceof HTMLImageElement?i:i.querySelector("img:not([aria-hidden])")),o&&(r=o.currentSrc||o.src||void 0,!r&&o.dataset&&(r=o.dataset.lazySrc||o.dataset.src||void 0));const l={src:s,triggerEl:i,thumbEl:o,thumbElSrc:r,thumbSrc:r};for(const e in t)"fancybox"!==e&&(l[e]=t[e]+"");n.push(l)}return new xt(n,e)}static getInstance(t){if(t)return yt.get(t);return Array.from(yt.values()).reverse().find((t=>!t.isClosing()&&t))||null}static getSlide(){var t;return(null===(t=xt.getInstance())||void 0===t?void 0:t.getSlide())||null}static show(t=[],e={}){return new xt(t,e)}static next(){const t=xt.getInstance();t&&t.next()}static prev(){const t=xt.getInstance();t&&t.prev()}static close(t=!0,...e){if(t)for(const t of yt.values())t.close(...e);else{const t=xt.getInstance();t&&t.close(...e)}}}Object.defineProperty(xt,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(xt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:h}),Object.defineProperty(xt,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:ot}),Object.defineProperty(xt,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),t.Fancybox=xt})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";const e=t=>"object"==typeof t&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t),i=(t,...n)=>{const s=n.length;for(let o=0;o{const o=Array.isArray(s)?[]:{};t[n]||Object.assign(t,{[n]:o}),e(s)?Object.assign(t[n],i(o,s)):Array.isArray(s)?Object.assign(t,{[n]:[...s]}):Object.assign(t,{[n]:s})}))}return t},n=function(t,e){let i=!0;return(...n)=>{i&&(i=!1,t(...n),setTimeout((()=>{i=!0}),e))}},s=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},o=!("undefined"==typeof window||!window.document||!window.document.createElement);let a;const r=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","),l='
',c={PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"},h={dragToClose:!0,hideScrollbar:!0,Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},contentClick:"toggleZoom",contentDblClick:!1,backdropClick:"close",animated:!0,idle:3500,showClass:"f-zoomInUp",hideClass:"f-fadeOut",commonCaption:!1,parentEl:null,startIndex:0,l10n:Object.assign(Object.assign({},c),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),tpl:{closeButton:'',main:''},groupAll:!1,groupAttr:"data-fancybox",defaultType:"image",defaultDisplay:"block",autoFocus:!0,trapFocus:!0,placeFocusBack:!0,closeButton:"auto",keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"next",ArrowDown:"prev",ArrowRight:"next",ArrowLeft:"prev"},Fullscreen:{autoStart:!1},compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,wheel:"zoom"};var d,u;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Closing=2]="Closing",t[t.CustomClosing=3]="CustomClosing",t[t.Destroy=4]="Destroy"}(d||(d={})),function(t){t[t.Loading=0]="Loading",t[t.Opening=1]="Opening",t[t.Ready=2]="Ready",t[t.Closing=3]="Closing"}(u||(u={}));const p=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class m{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?i({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=p(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...n){let s=p(e,t);var o;"string"!=typeof(o=s)||isNaN(o)||isNaN(parseFloat(o))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...n));let a=p(e,this.options);return a&&"function"==typeof a?s=a.call(this,this,t,...n,s):void 0===s&&(s=a),void 0===s?i:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(m,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(m,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class f extends m{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,n]of Object.entries(t)){const t=this.option(i),s=this.plugins[i];s||!1===t?s&&!1===t&&(s.detach(),delete this.plugins[i]):e.set(i,new n(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}class g extends m{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const b=()=>{queueMicrotask((()=>{(()=>{const{slug:t,index:e}=v.parseURL(),i=xt.getInstance();if(i&&!1!==i.option("Hash")){const n=i.carousel;if(t&&n){for(let e of n.slides)if(e.slug&&e.slug===t)return n.slideTo(e.index);if(t===i.option("slug"))return n.slideTo(e-1);const s=i.getSlide(),o=s&&s.triggerEl&&s.triggerEl.dataset;if(o&&o.fancybox===t)return n.slideTo(e-1)}v.hasSilentClose=!0,i.close()}v.startFromUrl()})()}))};class v extends g{constructor(){super(...arguments),Object.defineProperty(this,"origHash",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null})}onChange(){const t=this.instance,e=t.carousel;this.timer&&clearTimeout(this.timer);const i=t.getSlide();if(!e||!i)return;const n=t.isOpeningSlide(i),s=new URL(document.URL).hash;let o,a=i.slug||void 0;o=a||this.instance.option("slug"),!o&&i.triggerEl&&i.triggerEl.dataset&&(o=i.triggerEl.dataset.fancybox);let r="";o&&"true"!==o&&(r="#"+o+(!a&&e.slides.length>1?"-"+(i.index+1):"")),n&&(this.origHash=s!==r?s:""),r&&s!==r&&(this.timer=setTimeout((()=>{try{window.history[n?"pushState":"replaceState"]({},document.title,window.location.pathname+window.location.search+r)}catch(t){}}),300))}onClose(){if(this.timer&&clearTimeout(this.timer),!0!==v.hasSilentClose)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(this.origHash||""))}catch(t){}}attach(){this.instance.on("Carousel.ready",this.onChange),this.instance.on("Carousel.change",this.onChange),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.ready",this.onChange),this.instance.off("Carousel.change",this.onChange),this.instance.off("close",this.onClose)}static parseURL(){const t=window.location.hash.slice(1),e=t.split("-"),i=e[e.length-1],n=i&&/^\+?\d+$/.test(i)&&parseInt(e.pop()||"1",10)||1;return{hash:t,slug:e.join("-"),index:n}}static startFromUrl(){if(v.hasSilentClose=!1,xt.getInstance()||!1===xt.defaults.Hash)return;const{hash:t,slug:e,index:i}=v.parseURL();if(!e)return;let n=document.querySelector(`[data-slug="${t}"]`);if(n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),xt.getInstance())return;const s=document.querySelectorAll(`[data-fancybox="${e}"]`);s.length&&(n=s[i-1],n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))}static destroy(){window.removeEventListener("hashchange",b,!1)}}function y(){window.addEventListener("hashchange",b,!1),setTimeout((()=>{v.startFromUrl()}),500)}Object.defineProperty(v,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(v,"hasSilentClose",{enumerable:!0,configurable:!0,writable:!0,value:!1}),o&&(/complete|interactive|loaded/.test(document.readyState)?y():document.addEventListener("DOMContentLoaded",y));const w=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),x=function(t,e){return!(!t||t===document.body||e&&t===e)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,n=-1!==i.indexOf("hidden"),s=-1!==i.indexOf("visible");return e&&!n&&!s}(t)?t:x(t.parentElement,e))},S=t=>`${t||""}`.split(" ").filter((t=>!!t)),E=(t,e,i)=>{S(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))};class P{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const C={passive:!1};class M{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:n=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=n;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,C),this.element.addEventListener("touchmove",this.onMove,C),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,C)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new P(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new P(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new P(t))):[new P(t)],n=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(n.push(t),this.currentPointers[e]=t)}n.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new P(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new P(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,C),this.element.removeEventListener("touchstart",this.onTouchStart,C),this.element.removeEventListener("touchmove",this.onMove,C),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function T(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function O(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}var A;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(A||(A={}));const L=["a","b","c","d","e","f"],z={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:c},R=t=>t&&null!==t&&t instanceof Element&&"nodeType"in t,k=(t,e)=>{S(e).forEach((e=>{t&&t.classList.remove(e)}))},I=(t,e)=>{S(e).forEach((e=>{t&&t.classList.add(e)}))},D={a:1,b:0,c:0,d:1,e:0,f:0},F=1e5,j=1e3;let H=null,B=null;class _ extends f{get isTouchDevice(){return null===B&&(B=window.matchMedia("(hover: none)").matches),B}get isMobile(){return null===H&&(H=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),H}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const t=this.content;return!!(t&&t instanceof HTMLImageElement)&&!t.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of L){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var n;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:A.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},D)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},D)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},_.Plugins),i)),this.emit("init"),this.isContentLoading){const e=this.content;if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const i=s(l);t.contains(e)?this.spinner=(null===(n=e.parentElement)||void 0===n?void 0:n.insertBefore(i,e))||null:this.spinner=t.appendChild(i)}this.emit("beforeLoad"),e.addEventListener("load",this.onLoad),e.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===A.Init&&this.enable()}onError(){this.state!==A.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=A.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new M(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of L)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of L)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,n=i.e+t,s=i.f+e,o=this.getBounds(),{x:a,y:r}=o,l=a.min,c=a.max,h=r.min,d=r.max;let u=0,p=0;return l!==1/0&&nc&&(u=c-n),h!==1/0&&sd&&(p=d-s),Math.abs(u)<.001&&(u=0),Math.abs(p)<.001&&(p=0),Object.assign(Object.assign({},o),{xDiff:u,yDiff:p,inBounds:!u&&!p})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:n,fitHeight:s,fullWidth:o,fullHeight:a}=i;let r=o,l=a;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),c=i?o:n,h=i?a:s,d=this.getMatrix(t),u=new DOMPoint(0,0).matrixTransform(d),p=new DOMPoint(0+c,0).matrixTransform(d),m=new DOMPoint(0+c,0+h).matrixTransform(d),f=new DOMPoint(0,0+h).matrixTransform(d),g=Math.abs(m.x-u.x),b=Math.abs(m.y-u.y),v=Math.abs(f.x-p.x),y=Math.abs(f.y-p.y);r=Math.max(g,v),l=Math.max(b,y)}return{contentWidth:r,contentHeight:l}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const n=i.closest("[data-panzoom-action]"),s=i.closest("[data-panzoom-change]"),o=n||s,a=o&&R(o)?o.dataset:null;if(a){const e=a.panzoomChange,i=a.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const r=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(r.x-this.dragStart.x)>2||Math.abs(r.y-this.dragStart.y)>2))return;this.dragStart.time=0;const l=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},c=this.option("click",t),h=this.option("dblClick",t);h?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&c&&l(c)):(this.emit("dblClick",t),t.defaultPrevented||l(h)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&c&&l(c))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(t,e,i){var n;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const s=this.content.getBoundingClientRect();if(this.dragStart={x:s.x,y:s.y,top:s.top,left:s.left,time:Date.now()},!1===this.option("touch",t))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;if(!i.length){const e=t.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(e.nodeName)||e.closest("[contenteditable]")||e.closest("[data-selectable]")||e.closest("[data-panzoom-change]")||e.closest("[data-panzoom-action]"))return!1;null===(n=window.getSelection())||void 0===n||n.removeAllRanges()}return"mousedown"===t.type&&t.preventDefault(),w(this.targetScale,1e3)===w(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(e),this.emit("touchStart",t),!0}onPointerMove(t,e,i){if(!this.isDragging)return;if(e.length<2&&this.panOnlyZoomed&&w(this.targetScale)<=w(this.minScale))return;if(this.emit("touchMove",t),t.defaultPrevented)return;this.addTrackingPoint(e[0]);const{content:n}=this,s=O(i[0],i[1]),o=O(e[0],e[1]);let a=0,r=0;if(e.length>1){const t=n.getBoundingClientRect();a=s.clientX-t.left-.5*t.width,r=s.clientY-t.top-.5*t.height}const l=T(i[0],i[1]),c=T(e[0],e[1]);let h=l?c/l:1,d=o.clientX-s.clientX,u=o.clientY-s.clientY;this.dragOffset.x+=d,this.dragOffset.y+=u,this.dragOffset.time=Date.now()-this.dragStart.time;let p=w(this.targetScale)===w(this.minScale)&&this.option("lockAxis");if(p&&!this.lockedAxis)if("xy"===p||"y"===p||"touchmove"===t.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void t.preventDefault();const e=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=e>45&&e<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,d=0,u=0}else this.lockedAxis=p;if(x(t.target,this.content)&&(p="x",this.dragOffset.y=0),p&&"xy"!==p&&this.lockedAxis!==p&&w(this.targetScale)===w(this.minScale))return;t.cancelable&&t.preventDefault(),this.container.classList.add(this.cn("isDragging"));const m=this.checkBounds(d,u);this.option("rubberband")?("x"!==this.isInfinite&&(m.xDiff>0&&d<0||m.xDiff<0&&d>0)&&(d*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*m.xDiff))),"y"!==this.isInfinite&&(m.yDiff>0&&u<0||m.yDiff<0&&u>0)&&(u*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*m.yDiff)))):(m.xDiff&&(d=0),m.yDiff&&(u=0));const f=this.targetScale,g=this.minScale,b=this.maxScale;f<.5*g&&(h=Math.max(h,g)),f>1.5*b&&(h=Math.min(h,b)),"y"===this.lockedAxis&&w(f)===w(g)&&(d=0),"x"===this.lockedAxis&&w(f)===w(g)&&(u=0),this.applyChange({originX:a,originY:r,panX:d,panY:u,scale:h,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,e,i){if(i.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(e),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),x(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==A.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of L)this.velocity[t]=0,this.target[t]=this.current[t];k(this.container,"is-scaling"),k(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:t}=this,e=t[0],i=t[t.length-1];let n=0,s=0,o=0;i&&e&&(n=i.clientX-e.clientX,s=i.clientY-e.clientY,o=i.time-e.time);let a=0,r=0,l=0,c=0,h=this.option("decelFriction");const d=this.targetScale;if((dthis.maxScale+1e-5)&&(h=.35),o>0){l=Math.abs(n)>3?n/(o/30):0,c=Math.abs(s)>3?s/(o/30):0;const t=this.option("maxVelocity");t&&(l=Math.max(Math.min(l,t),-1*t),c=Math.max(Math.min(c,t),-1*t))}l&&(a=l/(1/(1-h)-1)),c&&(r=c/(1/(1-h)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&w(d)===this.minScale)&&(a=l=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&w(d)===this.minScale)&&(r=c=0);const u=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(n)),"auto"===p&&(p=parseFloat(n.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(n));const m=(this.option("transformParent")?n.parentElement:null)||n,f=m.getAttribute("style")||"";m.style.setProperty("transform","none","important"),m.style.setProperty("transition","none","important"),m.style.setProperty("animation","none","important"),n instanceof HTMLImageElement&&(m.style.width="",m.style.height=""),m.offsetHeight;const g=n.getBoundingClientRect();let b=g.width,v=g.height,y=0,x=0;if(n instanceof HTMLImageElement&&({width:b,height:v,top:y,left:x}=((t,e,i,n)=>{const s=i/n;return s>t/e?(i=t,n=t/s):(i=e*s,n=e),{width:i,height:n,top:.5*(e-n),left:.5*(t-i)}})(g.width,g.height,u,p)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:g.top-a.top+y,bottom:a.bottom-g.bottom+y,left:g.left-a.left+x,right:a.right-g.right+x,fitWidth:b,fitHeight:v,width:b,height:v,fullWidth:u,fullHeight:p}),m.style.cssText=f,n instanceof HTMLImageElement&&(m.style.width=`${b}px`,m.style.height=`${v}px`),this.setTransform(),!0!==t){let t="";Math.abs(l-s)>1&&(t+="x"),Math.abs(c-o)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(w(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===A.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const t=this.option("bounds");if("auto"!==t)return t;const{contentWidth:e,contentHeight:i}=this.calculateContentDim(this.target);let n=0,s=0,o=0,a=0;const r=this.option("infinite");if(!0===r||this.lockedAxis&&r===this.lockedAxis)n=-1/0,o=1/0,s=-1/0,a=1/0;else{let{containerRect:t,contentRect:r}=this,l=w(this.contentRect.fitWidth*this.targetScale,j),c=w(this.contentRect.fitHeight*this.targetScale,j),{innerWidth:h,innerHeight:d}=t;if(this.containerRect.width===l&&(h=t.width),this.containerRect.width===c&&(d=t.height),e>h){o=.5*(e-h),n=-1*o;let t=.5*(r.right-r.left);n+=t,o+=t}if(this.contentRect.fitWidth>h&&ed){a=.5*(i-d),s=-1*a;let t=.5*(r.bottom-r.top);s+=t,a+=t}this.contentRect.fitHeight>d&&i-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(a=!0),this.contentRect.width*this.targetScalew(this.targetScale),l=!r&&!a&&s&&w(i).9*t.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:n=this.option("friction"),angle:s=0,originX:o=0,originY:a=0,flipX:r=!1,flipY:l=!1,ignoreBounds:c=!1}){this.state!==A.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:s,originX:o,originY:a,friction:n,flipX:r,flipY:l,ignoreBounds:c})}applyChange({panX:t=0,panY:e=0,scale:i=1,angle:n=0,originX:s=-this.current.e,originY:o=-this.current.f,friction:a=this.option("friction"),flipX:r=!1,flipY:l=!1,ignoreBounds:c=!1,bounce:h=this.option("bounce")}){const d=this.state;if(d===A.Init||d===A.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of L)this.velocity[t]=0;this.friction=a||0,this.ignoreBounds=c;const{current:u}=this,p=u.e,m=u.f,f=this.getMatrix(this.target);let g=(new DOMMatrix).translate(p,m).translate(s,o).translate(t,e);if(this.option("zoom")){if(!c){const t=this.targetScale,e=this.minScale,n=this.maxScale;t*in&&(i=n/t)}g=g.scale(i)}g=g.translate(-s,-o).translate(-p,-m).multiply(f),n&&(g=g.rotate(n)),r&&(g=g.scale(-1,1)),l&&(g=g.scale(1,-1));for(const t of L)"a"!=t&&"d"!=t||!(g[t]>this.minScale+1e-5||g[t].1||"mousemove"===this.panMode||!1===h)&&!c&&this.clampTargetBounds(),this.isResting||(this.state=A.Panning,this.requestTick())}stop(t=!1){if(this.state!==A.Init&&this.state!==A.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of L)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),k(this.container,"is-scaling"),k(this.container,"is-animating"),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=A.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),I(this.container,"is-animating"),this.isScaling&&I(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(t,e=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=t,"mousemove"!==this.panMode||!t)return;if(w(this.targetScale)<=w(this.minScale))return;this.emit("mouseMove",t);const{container:i,containerRect:n,contentRect:s}=this,o=n.width,a=n.height,r=i.getBoundingClientRect(),l=(t.clientX||0)-r.left,c=(t.clientY||0)-r.top;let{contentWidth:h,contentHeight:d}=this.calculateContentDim(this.target);const u=this.option("mouseMoveFactor");u>1&&(h!==o&&(h*=u),d!==a&&(d*=u));let p=.5*(h-o)-l/o*100/100*(h-o);p+=.5*(s.right-s.left);let m=.5*(d-a)-c/a*100/100*(d-a);m+=.5*(s.bottom-s.top),this.applyChange({panX:p-this.target.e,panY:m-this.target.f,friction:e})}zoomWithWheel(t){if(this.state===A.Destroy||this.state===A.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),n=this.targetScale,s=this.maxScale,o=this.minScale;let a=n*(100+i*e)/100;as&&n>=s?(this.wheelDelta+=Math.abs(i),a=s):(this.wheelDelta=0,a=Math.max(Math.min(a,s),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),a!==n&&this.zoomTo(a,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.maxScale-this.minScale)?"max":"fit",t)}toggleCover(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.coverScale-this.minScale)?"cover":"fit",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:n=0,event:s}={}){if(this.isContentLoading||this.state===A.Destroy)return;this.stop();const{targetScale:o}=this;let a=1;if("mousemove"===this.panMode&&(s=this.prevMouseMoveEvent||s),s){const t=this.content.getBoundingClientRect(),e=s.clientX||0,o=s.clientY||0;i=e-t.left-.5*t.width,n=o-t.top-.5*t.height}const r=this.fullScale,l=this.maxScale;let c=this.coverScale;"number"==typeof t?a=t/o:("next"===t&&(r-c<.2&&(c=r),t=o1?.15:.25:e,this.applyChange({scale:a,originX:i,originY:n,friction:e}),s&&"mousemove"===this.panMode&&this.panWithMouse(s,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const n=t.classList.contains(e);n?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(n?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:n,d:s,e:o,f:a}=t;return new DOMMatrix([e,i,n,s,o,a])}reset(t){if(this.state!==A.Init&&this.state!==A.Destroy){this.stop("current");for(const t of L)this.target[t]=D[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=A.Panning,this.requestTick())}}destroy(){this.stop(),this.state=A.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(_,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:z}),Object.defineProperty(_,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const N=t=>new Promise(((e,i)=>{const n=new Image;n.onload=e,n.onerror=i,n.src=t}));class W extends g{onCreateSlide(t,e,i){const n=this.instance,s=n.optionFor(i,"src")||"",{el:o,type:a}=i;o&&"image"===a&&"string"==typeof s&&this.setContent(i,s).then((t=>{if(n.isClosing())return;const e=i.contentEl,s=i.imageEl,o=i.thumbElSrc,a=this.optionFor(i,"initialSize"),r=this.optionFor(i,"zoom"),l={event:n.prevMouseMoveEvent||n.options.event,friction:r?.12:0};if(e&&s&&o&&n.isOpeningSlide(i)&&this.getZoomInfo(i)){let t=document.createElement("img");I(t,"fancybox-ghost"),e.appendChild(t),t.src=o,setTimeout((()=>{n.animate(t,"f-fadeFastOut",(()=>{t&&(t.remove(),t=null)}))}),333),N(o).then((()=>{i.state=u.Opening,this.instance.emit("reveal",i),this.zoomIn(i).then((()=>{this.instance.done(i)}),(()=>{n.hideLoading(i)}))}),(()=>{n.hideLoading(i),n.revealContent(i)}))}else{let e=n.optionFor(i,"showClass")||void 0,s=!0;n.isOpeningSlide(i)&&("full"===a?t.zoomToFull(l):"cover"===a?t.zoomToCover(l):"max"===a?t.zoomToMax(l):s=!1,t.stop("current")),s&&e&&(e="f-fadeIn"),n.revealContent(i,e)}}),(()=>{n.setError(i,"{{IMAGE_ERROR}}")}))}onRemoveSlide(t){t.panzoom&&t.panzoom.destroy(),t.panzoom=void 0,t.imageEl=void 0}onChange(t,e,i,n){for(const t of e.slides){const e=t.panzoom;e&&t.index!==i&&e.reset(0)}}onClose(){const t=this.instance,e=t.container,i=t.getSlide();if(!e||!e.parentElement||!i)return;const{el:n,contentEl:s,panzoom:o}=i,a=i.thumbElSrc;if(!n||!a||!s||!o||o.isContentLoading||o.state===A.Init||o.state===A.Destroy)return;o.updateMetrics();let r=this.getZoomInfo(i);if(!r)return;this.instance.state=d.CustomClosing,n.classList.remove("is-zooming-in"),n.classList.add("is-zooming-out"),s.style.backgroundImage=`url('${a}')`,N(a).then((()=>{n.classList.add("hide-image")}),(()=>{}));const l=e.getBoundingClientRect();Object.assign(e.style,{position:"absolute",top:`${window.pageYOffset}px`,left:`${window.pageXOffset}px`,bottom:"auto",right:"auto",width:`${l.width}px`,height:`${l.height}px`});const{x:c,y:h,scale:u,opacity:p}=r;if(p){const t=((t,e,i,n)=>{const s=e-t,o=n-i;return e=>i+((e-t)/s*o||0)})(o.scale,u,1,0);o.on("afterTransform",(()=>{s.style.opacity=t(o.scale)+""}))}o.on("endAnimation",(()=>{t.destroy()})),o.target.a=u,o.target.b=0,o.target.c=0,o.target.d=u,o.panTo({x:c,y:h,scale:u,friction:p?.2:.33,ignoreBounds:!0}),o.isResting&&t.destroy()}setContent(t,e){return new Promise(((n,s)=>{var o,a;const r=this.instance,l=t.el;if(!l)return void s();r.showLoading(t);const c=document.createElement("img");if(c.classList.add("fancybox-image"),c.src=e||"",c.alt=(null===(o=t.caption)||void 0===o?void 0:o.replace(/<[^>]+>/gi,"").substring(0,1e3))||`Image ${t.index+1} of ${null===(a=r.carousel)||void 0===a?void 0:a.pages.length}`,t.imageEl=c,r.setContent(t,c,!1),this.option("protected")){l.addEventListener("contextmenu",(t=>{t.preventDefault()}));const e=t.contentEl;if(e){const t=document.createElement("div");I(t,"fancybox-protected"),e.append(t)}}t.panzoom=new _(l,i({},this.option("Panzoom")||{},{content:c,width:r.optionFor(t,"width","auto"),height:r.optionFor(t,"height","auto"),wheel:()=>{const t=r.option("wheel");return("zoom"===t||"pan"==t)&&t},click:(e,i)=>{var n;if(r.isCompact||r.isClosing())return!1;let s=!i||i.target&&(null===(n=t.contentEl)||void 0===n?void 0:n.contains(i.target));return r.option(s?"contentClick":"backdropClick")||!1},dblClick:()=>r.isCompact?"toggleZoom":r.option("contentDblClick")||!1,spinner:!1,panOnlyZoomed:!0,wheelLimit:1/0,transformParent:!0,on:{ready:t=>{n(t)},error:()=>{s()},destroy:()=>{s()}}}))}))}zoomIn(t){return new Promise(((e,i)=>{const{panzoom:n,contentEl:s,el:o}=t,a=this.getZoomInfo(t);if(!(a&&o&&s&&n))return void i();const{x:r,y:l,scale:c,opacity:h}=a,d=()=>{t.state!==u.Closing&&(h&&(s.style.opacity=Math.max(Math.min(1,1-(1-n.scale)/(1-c)),0)+""),n.scale>=1&&n.scale>n.targetScale-.1&&e(n))},p=t=>{t.scale<.99||(o.classList.remove("is-zooming-in"),t.off("endAnimation",p),t.off("touchStart",p),t.off("afterTransform",d),e(t))};n.on("endAnimation",p),n.on("touchStart",p),n.on("afterTransform",d),n.on(["error","destroy"],(()=>{i()})),n.panTo({x:r,y:l,scale:c,friction:0,ignoreBounds:!0}),n.stop("current");const m=this.instance,f={event:"mousemove"===n.panMode?m.prevMouseMoveEvent||m.options.event:void 0},g=this.optionFor(t,"initialSize");I(o,"is-zooming-in"),m.hideLoading(t),"full"===g?n.zoomToFull(f):"cover"===g?n.zoomToCover(f):"max"===g?n.zoomToMax(f):n.reset(.175)}))}getZoomInfo(t){const{el:e,imageEl:i,thumbEl:n,panzoom:s}=t;if(!e||!i||!n||!s||(t=>{const e=window.pageYOffset,i=window.pageYOffset+window.innerHeight;if(!R(t))return 0;const n=t.getBoundingClientRect(),s=n.y+window.pageYOffset,o=n.y+n.height+window.pageYOffset;if(e>o||io)return 100;if(si)return 100;let a=n.height;si&&(a-=o-i);const r=a/window.innerHeight*100;return Math.round(r)})(n)<5||!this.optionFor(t,"zoom")||this.instance.state===d.Destroy)return!1;const{top:o,left:a,width:r,height:l}=n.getBoundingClientRect();let{top:c,left:h,fitWidth:u,fitHeight:p}=s.contentRect;if(!(r&&l&&u&&p))return!1;const m=r/u,f=s.container.getBoundingClientRect();c+=f.top,h+=f.left;const g=-1*(h+.5*u-(a+.5*r)),b=-1*(c+.5*p-(o+.5*l));let v=this.option("zoomOpacity")||!1;return"auto"===v&&(v=Math.abs(r/l-u/p)>.1),{x:g,y:b,scale:m,opacity:v}}attach(){this.instance.on("Carousel.change",this.onChange),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.change",this.onChange),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("close",this.onClose)}}Object.defineProperty(W,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}});const $=(t,e={})=>{const i=new URL(t),n=new URLSearchParams(i.search),s=new URLSearchParams;for(const[t,i]of[...n,...Object.entries(e)]){let e=i.toString();"t"===t?s.set("start",parseInt(e).toString()):s.set(t,e)}let o=s.toString(),a=t.match(/#t=((.*)?\d+s)/);return a&&(o+=`#t=${a[1]}`),o},X={ajax:null,autoSize:!0,preload:!0,videoAutoplay:!0,videoRatio:16/9,videoTpl:'',videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,rel:0,fs:1}},Y=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo","video"];class q extends g{onInitSlides(t,e){for(const t of e.slides)this.processType(t)}onCreateSlide(t,e,i){this.setContent(i)}onRemoveSlide(t,e,i){i.closeBtnEl&&(i.closeBtnEl.remove(),i.closeBtnEl=void 0),i.xhr&&(i.xhr.abort(),i.xhr=null),i.iframeEl&&(i.iframeEl.onload=i.iframeEl.onerror=null,i.iframeEl.src="//about:blank",i.iframeEl=null);const n=i.contentEl,s=i.placeholderEl;if("inline"===i.type&&n&&s)n.classList.remove("fancybox__content"),"none"!==n.style.display&&(n.style.display="none"),s.parentNode&&s.parentNode.insertBefore(n,s),s.remove(),i.placeholderEl=null;else for(;i.el&&i.el.firstChild;)i.el.removeChild(i.el.firstChild)}onSelectSlide(t,e,i){i.state===u.Ready&&this.playVideo()}onUnselectSlide(t,e,i){var n,s;if("html5video"===i.type){try{null===(s=null===(n=i.el)||void 0===n?void 0:n.querySelector("video"))||void 0===s||s.pause()}catch(t){}return}let o;"vimeo"===i.type?o={method:"pause",value:"true"}:"youtube"===i.type&&(o={event:"command",func:"pauseVideo"}),o&&i.iframeEl&&i.iframeEl.contentWindow&&i.iframeEl.contentWindow.postMessage(JSON.stringify(o),"*"),i.poller&&clearTimeout(i.poller)}onDone(t,e){t.isCurrentSlide(e)&&!t.isClosing()&&this.playVideo()}onRefresh(t,e){e.slides.forEach((t=>{t.el&&(this.setAspectRatio(t),this.resizeIframe(t))}))}onMessage(t){try{let e=JSON.parse(t.data);if("https://player.vimeo.com"===t.origin){if("ready"===e.event)for(let e of Array.from(document.getElementsByClassName("fancybox__iframe")))e instanceof HTMLIFrameElement&&e.contentWindow===t.source&&(e.dataset.ready="true")}else if("https://www.youtube-nocookie.com"===t.origin&&"onReady"===e.event){const t=document.getElementById(e.id);t&&(t.dataset.ready="true")}}catch(t){}}loadAjaxContent(t){const e=this.instance.optionFor(t,"src")||"";this.instance.showLoading(t);const i=this.instance,n=new XMLHttpRequest;i.showLoading(t),n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&i.state===d.Ready&&(i.hideLoading(t),200===n.status?i.setContent(t,n.responseText):i.setError(t,404===n.status?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const s=t.ajax||null;n.open(s?"POST":"GET",e+""),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send(s),t.xhr=n}setInlineContent(t){let e=null;if(R(t.src))e=t.src;else if("string"==typeof t.src){const i=t.src.split("#",2).pop();e=i?document.getElementById(i):null}if(e){if("clone"===t.type||e.dataset.placeholderId){e=e.cloneNode(!0);const i=e.dataset.animationName;i&&(e.classList.remove(i),delete e.dataset.animationName),delete e.dataset.placeholderId;let n=e.getAttribute("id");n=n?`${n}--clone`:`clone-${this.instance.id}-${t.index}`,e.setAttribute("id",n)}else if(e.parentNode){const i=document.createElement("div");i.classList.add("fancybox-placeholder"),e.parentNode.insertBefore(i,e),t.placeholderEl=i}this.instance.setContent(t,e)}else this.instance.setError(t,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(t){const{src:e,el:i}=t;if(!e||"string"!=typeof e||!i)return;const n=this.instance,s=document.createElement("iframe");s.className="fancybox__iframe",s.setAttribute("id",`fancybox__iframe_${n.id}_${t.index}`),s.setAttribute("allow","autoplay; fullscreen"),s.setAttribute("scrolling","auto"),s.onerror=()=>{n.setError(t,"{{IFRAME_ERROR}}")},t.iframeEl=s;const o=this.optionFor(t,"preload");if(i.classList.add("is-loading"),"iframe"!==t.type||!1===o)return s.setAttribute("src",t.src+""),this.resizeIframe(t),void n.setContent(t,s);n.showLoading(t),s.onload=()=>{if(!s.src.length)return;const e="true"!==s.dataset.ready;s.dataset.ready="true",this.resizeIframe(t),e?n.revealContent(t):n.hideLoading(t)},s.setAttribute("src",e),n.setContent(t,s,!1)}resizeIframe(t){const e=t.iframeEl,i=null==e?void 0:e.parentElement;if(!e||!i)return;let n=t.autoSize,s=t.width||0,o=t.height||0;s&&o&&(n=!1);const a=i&&i.style;if(!1!==t.preload&&!1!==n&&a)try{const t=window.getComputedStyle(i),n=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),r=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),l=e.contentWindow;if(l){const t=l.document,e=t.getElementsByTagName("html")[0],i=t.body;a.width="",i.style.overflow="hidden",s=s||e.scrollWidth+n,a.width=`${s}px`,i.style.overflow="",a.flex="0 0 auto",a.height=`${i.scrollHeight}px`,o=e.scrollHeight+r}}catch(t){}if(s||o){const t={flex:"0 1 auto",width:"",height:""};s&&(t.width=`${s}px`),o&&(t.height=`${o}px`),Object.assign(a,t)}}playVideo(){const t=this.instance.getSlide();if(!t)return;const{el:e}=t;if(!e||!e.offsetParent)return;if(!this.optionFor(t,"videoAutoplay"))return;if("html5video"===t.type)try{const t=e.querySelector("video");if(t){const e=t.play();void 0!==e&&e.then((()=>{})).catch((e=>{t.muted=!0,t.play()}))}}catch(t){}if("youtube"!==t.type&&"vimeo"!==t.type)return;const i=()=>{if(t.iframeEl&&t.iframeEl.contentWindow){let e;if("true"===t.iframeEl.dataset.ready)return e="youtube"===t.type?{event:"command",func:"playVideo"}:{method:"play",value:"true"},e&&t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"),void(t.poller=void 0);"youtube"===t.type&&(e={event:"listening",id:t.iframeEl.getAttribute("id")},t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"))}t.poller=setTimeout(i,250)};i()}processType(t){if(t.html)return t.type="html",t.src=t.html,void(t.html="");const e=this.instance.optionFor(t,"src","");if(!e||"string"!=typeof e)return;let i=t.type,n=null;if(n=e.match(/(?:youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const s=$(e,this.optionFor(t,"youtube")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://www.youtube-nocookie.com/embed/${o}?${s}`,t.thumbSrc=t.thumbSrc||`https://i.ytimg.com/vi/${o}/mqdefault.jpg`,i="youtube"}else if(n=e.match(/^.+vimeo.com\/(?:\/)?([\d]+)(.*)?/)){const s=$(e,this.optionFor(t,"vimeo")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://player.vimeo.com/video/${o}?${s}`,i="vimeo"}if(!i&&t.triggerEl){const e=t.triggerEl.dataset.type;Y.includes(e)&&(i=e)}i||"string"==typeof e&&("#"===e.charAt(0)?i="inline":(n=e.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(i="html5video",t.videoFormat=t.videoFormat||"video/"+("ogv"===n[1]?"ogg":n[1])):e.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?i="image":e.match(/\.(pdf)((\?|#).*)?$/i)?i="pdf":(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src=`https://maps.google.${n[1]}/?ll=${(n[2]?n[2]+"&z="+Math.floor(parseFloat(n[3]))+(n[4]?n[4].replace(/^\//,"&"):""):n[4]+"").replace(/\?/,"&")}&output=${n[4]&&n[4].indexOf("layer=c")>0?"svembed":"embed"}`,i="map"):(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src=`https://maps.google.${n[1]}/maps?q=${n[2].replace("query=","q=").replace("api=1","")}&output=embed`,i="map")),t.type=i||this.instance.option("defaultType")}setContent(t){const e=this.instance.optionFor(t,"src")||"";if(t&&t.type&&e){switch(t.type){case"html":this.instance.setContent(t,e);break;case"html5video":const i=this.option("videoTpl");i&&this.instance.setContent(t,i.replace(/\{\{src\}\}/gi,e+"").replace(/\{\{format\}\}/gi,this.optionFor(t,"videoFormat")||"").replace(/\{\{poster\}\}/gi,t.poster||t.thumbSrc||""));break;case"inline":case"clone":this.setInlineContent(t);break;case"ajax":this.loadAjaxContent(t);break;case"pdf":case"map":case"youtube":case"vimeo":t.preload=!1;case"iframe":this.setIframeContent(t)}this.setAspectRatio(t)}}setAspectRatio(t){var e;const i=t.contentEl,n=this.optionFor(t,"videoRatio"),s=null===(e=t.el)||void 0===e?void 0:e.getBoundingClientRect();if(!(i&&s&&n&&1!==n&&t.type&&["video","youtube","vimeo","html5video"].includes(t.type)))return;const o=s.width,a=s.height;i.style.aspectRatio=n+"",i.style.width=o/a>n?"auto":"",i.style.height=o/a>n?"":"auto"}attach(){this.instance.on("Carousel.initSlides",this.onInitSlides),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("Carousel.selectSlide",this.onSelectSlide),this.instance.on("Carousel.unselectSlide",this.onUnselectSlide),this.instance.on("Carousel.Panzoom.refresh",this.onRefresh),this.instance.on("done",this.onDone),window.addEventListener("message",this.onMessage)}detach(){this.instance.off("Carousel.initSlides",this.onInitSlides),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("Carousel.selectSlide",this.onSelectSlide),this.instance.off("Carousel.unselectSlide",this.onUnselectSlide),this.instance.off("Carousel.Panzoom.refresh",this.onRefresh),this.instance.off("done",this.onDone),window.removeEventListener("message",this.onMessage)}}Object.defineProperty(q,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:X});class Z extends g{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:"ready"}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return"ready"!==this.state}onReady(t){this.option("autoStart")&&(t.isInfinite||t.page{this.timer=null,this.inHover||this.onTimerEnd()}),e),t.style.transitionDuration=`${e}ms`,t.style.transform="scaleX(1)"}this.emit("set")}clear(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.removeProgressBar()}start(){if(this.set(),this.option("pauseOnHover")){const t=this.instance.container;t.addEventListener("mouseenter",this.onMouseEnter,!1),t.addEventListener("mouseleave",this.onMouseLeave,!1)}document.addEventListener("visibilitychange",this.onVisibilityChange,!1)}stop(){const t=this.instance.container;this.clear(),this.state="ready",t.removeEventListener("mouseenter",this.onMouseEnter,!1),t.removeEventListener("mouseleave",this.onMouseLeave,!1),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),k(t,"has-autoplay"),this.emit("stop")}pause(){"play"===this.state&&(this.state="pause",this.clear(),this.emit("pause"))}resume(){const t=this.instance;if(t.isInfinite||t.page!==t.pages.length-1)if("play"!==this.state){if("pause"===this.state&&!this.inHover){const t=new Event("resume",{bubbles:!0,cancelable:!0});this.emit("resume",event),t.defaultPrevented||this.set()}}else this.set();else this.stop()}toggle(){"play"===this.state||"pause"===this.state?this.stop():this.set()}attach(){this.instance.on("ready",this.onReady),this.instance.on("Panzoom.startAnimation",this.onChange),this.instance.on("Panzoom.endAnimation",this.onSettle),this.instance.on("Panzoom.touchMove",this.onChange)}detach(){this.instance.off("ready",this.onReady),this.instance.off("Panzoom.startAnimation",this.onChange),this.instance.off("Panzoom.endAnimation",this.onSettle),this.instance.off("Panzoom.touchMove",this.onChange),this.stop()}}Object.defineProperty(Z,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class V extends g{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(t){const e=t.carousel;if(!e)return;const n=t.container;n&&(e.options.Autoplay=i(this.option("Autoplay")||{},{pauseOnHover:!1,autoStart:!1,timeout:this.option("timeout"),progressParentEl:()=>n.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]")||n,on:{set:e=>{var i;n.classList.add("has-slideshow"),(null===(i=t.getSlide())||void 0===i?void 0:i.state)!==u.Ready&&e.pause()},stop:()=>{n.classList.remove("has-slideshow"),t.isCompact||t.endIdle()},resume:(e,i)=>{var n,s,o;!i||!i.cancelable||(null===(n=t.getSlide())||void 0===n?void 0:n.state)===u.Ready&&(null===(o=null===(s=t.carousel)||void 0===s?void 0:s.panzoom)||void 0===o?void 0:o.isResting)||i.preventDefault()}}}),e.attachPlugins({Autoplay:Z}),this.ref=e.plugins.Autoplay)}onReady(t){const e=t.carousel,i=this.ref;e&&i&&this.option("playOnStart")&&(e.isInfinite||e.page{t.isCurrentSlide(e)&&i.stop()})),t.isCurrentSlide(e)&&i.resume()}onKeydown(t,e){var i;const n=this.ref;n&&e===this.option("key")&&"BUTTON"!==(null===(i=document.activeElement)||void 0===i?void 0:i.nodeName)&&n.toggle()}attach(){this.instance.on("Carousel.init",this.onPrepare),this.instance.on("Carousel.ready",this.onReady),this.instance.on("done",this.onDone),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onPrepare),this.instance.off("Carousel.ready",this.onReady),this.instance.off("done",this.onDone),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(V,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{key:" ",playOnStart:!1,timeout:3e3}});const G={classes:{container:"f-thumbs f-carousel__thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'',type:"modern"};var U;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden",t[t.Disabled=3]="Disabled"}(U||(U={}));let K=class extends g{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"shouldCenter",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:U.Init})}formatThumb(t,e){return this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}getSlides(){const t=[],e=this.option("thumbTpl")||"";if(e)for(const i of this.instance.slides||[])t.push({html:this.formatThumb(i,e),customClass:`has-thumb for-${i.type||"image"}`});return t}getProgress(t){const e=this.instance,i=e.panzoom,n=e.pages[t]||0;if(!n||!i)return 0;let s=-1*i.current.e,o=e.contentDim,a=(s-n.pos)/(1*n.dim),r=(s+o-n.pos)/(1*n.dim),l=(s-o-n.pos)/(1*n.dim);return a=Math.max(0,Math.min(1,Math.abs(a))),r=Math.max(0,Math.min(1,Math.abs(r))),l=Math.max(0,Math.min(1,Math.abs(l))),a=Math.min(a,r,l),a}onInitSlide(t,e){const i=e.el;i&&(e.thumbSrc=i.dataset.thumbSrc||e.thumbSrc||"",e.thumbClipWidth=parseFloat(i.dataset.thumbClipWidth||"")||e.thumbClipWidth||0,e.thumbHeight=parseFloat(i.dataset.thumbHeight||"")||e.thumbHeight||0)}onInitSlides(){this.state===U.Init&&this.build()}onRefreshM(){this.refreshModern()}onChangeM(){"modern"===this.type&&(this.shouldCenter=!0,this.centerModern())}onClickModern(t){t.preventDefault(),t.stopPropagation();const e=this.instance,i=e.page,n=t=>{if(t){const e=t.closest("[data-carousel-page]");if(e)return parseInt(e.dataset.carouselPage||"",10)||0}return-1},s=(t,e)=>{const i=document.elementFromPoint(t,e);return i?n(i):-1};let o=n(t.target);o<0&&(o=s(t.clientX+this.thumbGap,t.clientY),o===i&&(o=i-1)),o<0&&(o=s(t.clientX-this.thumbGap,t.clientY),o===i&&(o=i+1)),o<0&&(o=(e=>{let n=s(t.clientX-e,t.clientY),a=s(t.clientX+e,t.clientY);return o<0&&n===i&&(o=i+1),o<0&&a===i&&(o=i-1),o})(this.thumbExtraGap)),o===i?this.centerModern():o>-1&&o{this.emit("ready")}))}buildModern(){if("modern"!==this.type)return;const{container:t,track:e,instance:i}=this,n=this.option("thumbTpl")||"";if(!t||!e||!n)return;this.updateModern();for(const t of i.slides||[]){const i=document.createElement("div");I(i,this.cn("slide")),i.appendChild(s(this.formatThumb(t,n))),t.thumbSlideEl=i,e.appendChild(i),this.resizeModernSlide(t)}const o=new i.constructor.Panzoom(t,{content:e,lockAxis:"x",zoom:!1,panOnlyZoomed:!1,bounds:()=>{let t=0,e=0,n=i.slides[0],s=i.slides[i.slides.length-1],o=i.slides[i.page];return n&&s&&o&&(e=-1*this.getModernThumbPos(0),0!==i.page&&(e+=.5*(n.thumbWidth||0)),t=-1*this.getModernThumbPos(i.slides.length-1),i.page!==i.slides.length-1&&(t+=(s.thumbWidth||0)-(o.thumbWidth||0)-.5*(s.thumbWidth||0))),{x:{min:t,max:e},y:{min:0,max:0}}}});o.on("touchStart",(()=>{this.shouldCenter=!1})),o.on("click",((t,e)=>this.onClickModern(e))),o.on("ready",(()=>{this.centerModern(),this.emit("ready")})),o.on(["afterTransform","refresh"],(t=>{this.lazyLoadModern()})),this.panzoom=o,this.refreshModern()}updateModern(){if("modern"!==this.type)return;const{container:t}=this;t&&(this.thumbGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-gap"))||0,this.thumbExtraGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-extra-gap"))||0,this.thumbWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-width"))||40,this.thumbClipWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-clip-width"))||40,this.thumbHeight=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-height"))||40)}refreshModern(){var t;if("modern"===this.type){this.updateModern();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.onTransformM(),null===(t=this.panzoom)||void 0===t||t.updateMetrics(!0),this.centerModern(0)}}centerModern(t){const e=this.instance,{container:i,panzoom:n}=this;if(!i||!n||n.state===A.Init)return;const s=e.page;let o=this.getModernThumbPos(s),a=o;for(let t=e.page-3;te.pages.length-1||t===e.page)continue;const i=1-this.getProgress(t);i>0&&i<1&&(a+=i*(this.getModernThumbPos(t)-o))}let r=100;void 0===t&&(t=.2,e.inTransition.size>0&&(t=.12),Math.abs(-1*n.current.e-a)>n.containerRect.width&&(t=.5,r=0)),n.options.maxVelocity=r,n.applyChange({panX:w(-1*a-n.target.e,1e3),friction:null===e.prevPage?0:t})}lazyLoadModern(){const{instance:t,panzoom:e}=this;if(!e)return;const i=-1*e.current.e||0;let n=this.getModernThumbPos(t.page);if(e.state!==A.Init||0===n)for(const n of t.slides||[]){const t=n.thumbSlideEl;if(!t)continue;const o=t.querySelector("img[data-lazy-src]"),a=n.index,r=this.getModernThumbPos(a),c=i-.5*e.containerRect.innerWidth,h=c+e.containerRect.innerWidth;if(!o||rh)continue;let d=o.dataset.lazySrc;if(!d||!d.length)continue;if(delete o.dataset.lazySrc,o.src=d,o.complete)continue;I(t,this.cn("isLoading"));const u=s(l);t.appendChild(u),o.addEventListener("load",(()=>{t.offsetParent&&(t.classList.remove(this.cn("isLoading")),u.remove())}),!1)}}resizeModernSlide(t){if("modern"!==this.type)return;if(!t.thumbSlideEl)return;const e=t.thumbClipWidth&&t.thumbHeight?Math.round(this.thumbHeight*(t.thumbClipWidth/t.thumbHeight)):this.thumbWidth;t.thumbWidth=e}getModernThumbPos(t){const e=this.instance.slides[t],i=this.panzoom;if(!i||!i.contentRect.fitWidth)return 0;let n=i.containerRect.innerWidth,s=i.contentRect.width;2===this.instance.slides.length&&(t-=1,s=2*this.thumbClipWidth);let o=t*(this.thumbClipWidth+this.thumbGap)+this.thumbExtraGap+.5*(e.thumbWidth||0);return o-=s>n?.5*n:.5*s,w(o||0,1)}build(){const t=this.instance,e=t.container,i=this.option("minCount")||0;if(i){let e=0;for(const i of t.slides||[])i.thumbSrc&&e++;if(e{e.stopPropagation()}}},on:{ready:t=>{const e=t.container;e&&this.hidden&&(this.refresh(),e.style.transition="none",this.hide(),e.offsetHeight,queueMicrotask((()=>{e.style.transition="",this.show()})))}}}),e.attachPlugins({Thumbs:K}),this.ref=e.plugins.Thumbs,this.option("showOnStart")||(this.ref.state=U.Hidden,this.hidden=!0))}onResize(){var t;const e=null===(t=this.ref)||void 0===t?void 0:t.container;e&&(e.style.maxHeight="")}onKeydown(t,e){const i=this.option("key");i&&i===e&&this.toggle()}toggle(){const t=this.ref;t&&t.state!==U.Disabled&&(t.state!==U.Hidden?this.hidden?this.show():this.hide():t.build())}show(){const t=this.ref,e=t&&t.state!==U.Disabled&&t.container;e&&(this.refresh(),e.offsetHeight,e.removeAttribute("aria-hidden"),e.classList.remove("is-hidden"),this.hidden=!1)}hide(){const t=this.ref,e=t&&t.container;e&&(this.refresh(),e.offsetHeight,e.classList.add("is-hidden"),e.setAttribute("aria-hidden","true")),this.hidden=!0}refresh(){const t=this.ref;if(!t||t.state===U.Disabled)return;const e=t.container,i=(null==e?void 0:e.firstChild)||null;e&&i&&i.childNodes.length&&(e.style.maxHeight=`${i.getBoundingClientRect().height}px`)}attach(){this.instance.on("Carousel.init",this.onInit),this.instance.on("resize",this.onResize),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onInit),this.instance.off("resize",this.onResize),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(Q,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:J});const tt={panLeft:{icon:'',change:{panX:-100}},panRight:{icon:'',change:{panX:100}},panUp:{icon:'',change:{panY:-100}},panDown:{icon:'',change:{panY:100}},zoomIn:{icon:'',action:"zoomIn"},zoomOut:{icon:'',action:"zoomOut"},toggle1to1:{icon:'',action:"toggleZoom"},toggleZoom:{icon:'',action:"toggleZoom"},iterateZoom:{icon:'',action:"iterateZoom"},rotateCCW:{icon:'',action:"rotateCCW"},rotateCW:{icon:'',action:"rotateCW"},flipX:{icon:'',action:"flipX"},flipY:{icon:'',action:"flipY"},fitX:{icon:'',action:"fitX"},fitY:{icon:'',action:"fitY"},reset:{icon:'',action:"reset"},toggleFS:{icon:'',action:"toggleFS"}};var et;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Disabled=2]="Disabled"}(et||(et={}));const it={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'
/
'},download:{tpl:''},prev:{tpl:''},next:{tpl:''},slideshow:{tpl:''},fullscreen:{tpl:''},thumbs:{tpl:''},close:{tpl:''}},parentEl:null},nt={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"};class st extends g{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:et.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(t){var e;if(!t.carousel)return;let i=this.option("display"),n=this.option("absolute"),s=this.option("enabled");if("auto"===s){const t=this.instance.carousel;let e=0;if(t)for(const i of t.slides)(i.panzoom||"image"===i.type)&&e++;e||(s=!1)}s||(i=void 0);let o=0;const a={left:[],middle:[],right:[]};if(i)for(const t of["left","middle","right"])for(const n of i[t]){const i=this.createEl(n);i&&(null===(e=a[t])||void 0===e||e.push(i),o++)}let r=null;if(o&&(r=this.createContainer()),r){for(const[t,e]of Object.entries(a)){const i=document.createElement("div");I(i,"fancybox__toolbar__column is-"+t);for(const t of e)i.appendChild(t);"auto"!==n||"middle"!==t||e.length||(n=!0),r.appendChild(i)}!0===n&&I(r,"is-absolute"),this.state=et.Ready,this.onRefresh()}else this.state=et.Disabled}onClick(t){var e,i;const n=this.instance,s=n.getSlide(),o=null==s?void 0:s.panzoom,a=t.target,r=a&&R(a)?a.dataset:null;if(!r)return;if(void 0!==r.fancyboxToggleThumbs)return t.preventDefault(),t.stopPropagation(),void(null===(e=n.plugins.Thumbs)||void 0===e||e.toggle());if(void 0!==r.fancyboxToggleFullscreen)return t.preventDefault(),t.stopPropagation(),void this.instance.toggleFullscreen();if(void 0!==r.fancyboxToggleSlideshow){t.preventDefault(),t.stopPropagation();const e=null===(i=n.carousel)||void 0===i?void 0:i.plugins.Autoplay;let s=e.isActive;return o&&"mousemove"===o.panMode&&!s&&o.reset(),void(s?e.stop():e.start())}const l=r.panzoomAction,c=r.panzoomChange;if((c||l)&&(t.preventDefault(),t.stopPropagation()),c){let t={};try{t=JSON.parse(c)}catch(t){}o&&o.applyChange(t)}else l&&o&&o[l]&&o[l]()}onChange(){this.onRefresh()}onRefresh(){if(this.instance.isClosing())return;const t=this.container;if(!t)return;const e=this.instance.getSlide();if(!e||e.state!==u.Ready)return;const i=e&&!e.error&&e.panzoom;for(const e of t.querySelectorAll("[data-panzoom-action]"))i?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));let n=i&&i.canZoomIn(),s=i&&i.canZoomOut();for(const e of t.querySelectorAll('[data-panzoom-action="zoomIn"]'))n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="zoomOut"]'))s?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){s||n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));const t=e.querySelector("g");t&&(t.style.display=n?"":"none")}}onDone(t,e){var i;null===(i=e.panzoom)||void 0===i||i.on("afterTransform",(()=>{this.instance.isCurrentSlide(e)&&this.onRefresh()})),this.instance.isCurrentSlide(e)&&this.onRefresh()}createContainer(){const t=this.instance.container;if(!t)return null;const e=this.option("parentEl")||t,i=document.createElement("div");return I(i,"fancybox__toolbar"),e.prepend(i),i.addEventListener("click",this.onClick,{passive:!1,capture:!0}),t&&I(t,"has-toolbar"),this.container=i,i}createEl(t){var e;const i=this.instance.carousel;if(!i)return null;if("toggleFS"===t)return null;if("fullscreen"===t&&!this.instance.fsAPI)return null;let n=null;const o=i.slides.length||0;let a=0,r=0;for(const t of i.slides)(t.panzoom||"image"===t.type)&&a++,("image"===t.type||t.downloadSrc)&&r++;if(o<2&&["infobar","prev","next"].includes(t))return n;if(void 0!==tt[t]&&!a)return null;if("download"===t&&!r)return null;if("thumbs"===t){const t=this.instance.plugins.Thumbs;if(!t||!t.isEnabled)return null}if("slideshow"===t){if(!(null===(e=this.instance.carousel)||void 0===e?void 0:e.plugins.Autoplay)||o<2)return null}if(void 0!==tt[t]){const e=tt[t];n=document.createElement("button"),n.setAttribute("title",this.instance.localize(`{{${t.toUpperCase()}}}`)),I(n,"f-button"),e.action&&(n.dataset.panzoomAction=e.action),e.change&&(n.dataset.panzoomChange=JSON.stringify(e.change)),n.appendChild(s(this.instance.localize(e.icon)))}else{const e=(this.option("items")||[])[t];e&&(n=s(this.instance.localize(e.tpl)),e.click&&n.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),"function"==typeof e.click&&e.click(t)})))}const l=null==n?void 0:n.querySelector("svg");if(l)for(const[t,e]of Object.entries(nt))l.getAttribute(t)||l.setAttribute(t,String(e));return n}removeContainer(){var t;const e=this.container;e&&e.removeEventListener("click",this.onClick,{passive:!1,capture:!0}),null===(t=this.container)||void 0===t||t.remove(),this.container=null,this.state=et.Disabled;const i=this.instance.container;i&&k(i,"has-toolbar")}attach(){this.instance.on("Carousel.initSlides",this.onReady),this.instance.on("done",this.onDone),this.instance.on("reveal",this.onChange),this.instance.on("Carousel.change",this.onChange),this.onReady(this.instance)}detach(){this.instance.off("Carousel.initSlides",this.onReady),this.instance.off("done",this.onDone),this.instance.off("reveal",this.onChange),this.instance.off("Carousel.change",this.onChange),this.removeContainer()}}Object.defineProperty(st,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:it});const ot={Hash:v,Html:q,Images:W,Slideshow:V,Thumbs:Q,Toolbar:st},at=(t,e)=>{let i=[];return t.childNodes.forEach((t=>{t.nodeType!==Node.ELEMENT_NODE||e&&!t.matches(e)||i.push(t)})),i},rt={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var lt;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"}(lt||(lt={}));const ct=t=>{if("string"==typeof t&&(t={html:t}),!(t instanceof String||t instanceof HTMLElement)){const e=t.thumb;void 0!==e&&("string"==typeof e&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},ht=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t),dt={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'',dynamicFrom:11,maxCount:1/0,minCount:2};class ut extends g{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let t=this.list;return t||(t=document.createElement("ul"),I(t,this.cn("list")),t.setAttribute("role","tablist"),this.instance.container.appendChild(t),I(this.instance.container,this.cn("hasDots")),this.list=t),t}refresh(){var t;const e=this.instance.pages.length,i=Math.min(2,this.option("minCount")),n=Math.max(2e3,this.option("maxCount")),s=this.option("dynamicFrom");if(en)return void this.cleanup();const o="number"==typeof s&&e>5&&e>=s,a=!this.list||this.isDynamic!==o||this.list.children.length!==e;a&&this.cleanup();const r=this.build();if(E(r,this.cn("isDynamic"),!!o),a)for(let t=0;t=e-1&&s.setAttribute("disabled","")))}createButton(t){const e=this.instance,i=document.createElement("button");i.setAttribute("tabindex","0"),i.setAttribute("title",e.localize(`{{${t.toUpperCase()}}}`)),I(i,this.cn("button")+" "+this.cn("next"===t?"isNext":"isPrev"));const n=e.isRTL?"next"===t?"prev":"next":t;var s;return i.innerHTML=e.localize(this.option(`${n}Tpl`)),i.dataset[`carousel${s=t,s?s.match("^[a-z]")?s.charAt(0).toUpperCase()+s.substring(1):s:""}`]="true",i}build(){let t=this.container;t||(this.container=t=document.createElement("div"),I(t,this.cn("container")),this.instance.container.appendChild(t)),this.next||(this.next=t.appendChild(this.createButton("next"))),this.prev||(this.prev=t.appendChild(this.createButton("prev")))}cleanup(){this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove(),this.prev=null,this.next=null,this.container=null}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(pt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'',prevTpl:''}});class mt extends g{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){this.nav&&this.target&&(this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.state===lt.Ready&&this.onNavReady(this.nav),this.target.on("ready",this.onTargetReady),this.target.state===lt.Ready&&this.onTargetReady(this.target))}onNavReady(t){t.on("createSlide",this.onNavCreateSlide),t.on("Panzoom.click",this.onNavClick),this.onTargetChange()}onTargetReady(t){t.on("change",this.onTargetChange),t.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(t,e,i){var n,s;const o=i.target,{nav:a,target:r}=this;if(!a||!r||!o)return;const l=o.closest("[data-index]");if(!l)return;i.stopPropagation(),i.preventDefault();const c=parseInt(l.dataset.index||"",10)||0,h=r.getPageForSlide(c),d=a.getPageForSlide(c);r.page!==h&&r.slideTo(h,{friction:null===(s=null===(n=this.nav)||void 0===n?void 0:n.plugins)||void 0===s?void 0:s.Sync.option("friction")}),this.markSelectedSlide(c),a.page!==d&&a.slideTo(d)}onNavCreateSlide(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}onTargetChange(){const{target:t,nav:e}=this;if(!t||!e)return;if(e.state!==lt.Ready||t.state!==lt.Ready)return;const i=t.pages[t.page].slides[0].index,n=e.getPageForSlide(i);this.markSelectedSlide(i),e.slideTo(n)}markSelectedSlide(t){const{nav:e}=this;if(!e||e.state!==lt.Ready)return;this.selectedIndex=t,[...e.slides].filter((t=>t.el&&t.el.classList.remove("is-nav-selected")));const i=e.slides[t];i&&i.el&&i.el.classList.add("is-nav-selected")}attach(){let t=this.options.target,e=this.options.nav;t?this.addAsNavFor(t):e&&this.addAsTargetFor(e)}detach(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.nav=null,this.target&&(this.target.off("ready",this.onTargetReady),this.target.off("refresh",this.onTargetChange),this.target.off("change",this.onTargetChange)),this.target=null}}Object.defineProperty(mt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const ft={Navigation:pt,Dots:ut,Sync:mt};class gt extends f{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===lt.Ready}get isInfinite(){let t=!1;const e=this.contentDim,i=this.viewportDim;return this.pages.length>=2&&e>1.5*i&&(t=this.option("infinite")),t}get isRTL(){return"rtl"===this.option("direction")}get isHorizontal(){return"x"===this.option("axis")}constructor(t,e={},i={}){if(super(),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:lt.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),"string"==typeof t&&(t=document.querySelector(t)),!t||!R(t))throw new Error("No Element found");this.container=t,this.slideNext=n(this.slideNext.bind(this),175),this.slidePrev=n(this.slidePrev.bind(this),175),this.userOptions=e,this.userPlugins=i,queueMicrotask((()=>{this.processOptions()}))}processOptions(){const t=i({},gt.defaults,this.userOptions);let n="";const s=t.breakpoints;if(s&&e(s))for(const[o,a]of Object.entries(s))window.matchMedia(o).matches&&e(a)&&(n+=o,i(t,a));n===this.bp&&this.state!==lt.Init||(this.bp=n,this.state===lt.Ready&&(t.initialSlide=this.pages[this.page].slides[0].index),this.state!==lt.Init&&this.destroy(),super.setOptions(t),!1===this.option("enabled")?this.attachEvents():setTimeout((()=>{this.init()}),0))}init(){this.state=lt.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},gt.Plugins),this.userPlugins)),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=lt.Ready,this.emit("ready")}initLayout(){const{container:t}=this,e=this.option("classes");I(t,this.cn("container")),E(t,e.isLTR,!this.isRTL),E(t,e.isRTL,this.isRTL),E(t,e.isVertical,!this.isHorizontal),E(t,e.isHorizontal,this.isHorizontal);let i=this.option("viewport")||t.querySelector(`.${e.viewport}`);i||(i=document.createElement("div"),I(i,e.viewport),i.append(...at(t,`.${e.slide}`)),t.prepend(i));let n=this.option("track")||t.querySelector(`.${e.track}`);n||(n=document.createElement("div"),I(n,e.track),n.append(...Array.from(i.childNodes))),n.setAttribute("aria-live","polite"),i.contains(n)||i.prepend(n),this.viewport=i,this.track=n,this.emit("initLayout")}initSlides(){const{track:t}=this;if(t){this.slides=[],[...at(t,`.${this.cn("slide")}`)].forEach((t=>{if(R(t)){const e=ct({el:t,isDom:!0,index:this.slides.length});this.slides.push(e),this.emit("initSlide",e,this.slides.length)}}));for(let t of this.option("slides",[])){const e=ct(t);e.index=this.slides.length,this.slides.push(e),this.emit("initSlide",t,this.slides.length)}this.emit("initSlides")}}setInitialPage(){let t=0;const e=this.option("initialSlide");t="number"==typeof e?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0,this.page=t}setInitialPosition(){if(!this.track||!this.pages.length)return;let t=this.page;this.pages[t]||(this.page=t=0);const e=this.pages[t].pos*(this.isRTL&&this.isHorizontal?1:-1),i=this.isHorizontal?`${e}px`:"0",n=this.isHorizontal?"0":`${e}px`;this.track.style.transform=`translate3d(${i}, ${n}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const t=this.option("Panzoom")||{};this.panzoom=new _(this.viewport,i({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,decelFriction:.12,click:!1,dblClick:!1,touch:t=>!(this.pages.length<2&&!t.options.infinite),bounds:()=>this.getBounds(),maxVelocity:t=>Math.abs(t.target[this.axis]-t.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on("*",((t,e,...i)=>{this.emit(`Panzoom.${e}`,t,...i)})),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation),this.panzoom.on("touchStart",((t,e)=>{this.inTransition.size&&e.preventDefault()}))}attachEvents(){const t=this.container;t&&(t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let t=[];const{contentDim:e,viewportDim:i}=this,n=this.option("slidesPerPage");if("number"==typeof n&&e>i){for(let e=0;ei)&&(t.push(ht()),s=t.length-1,o=0),o+=e.dim+e.gap,t[s].slides.push(e);return t}processPages(){const t=this.pages,{contentDim:e,viewportDim:i}=this,n=this.option("center"),s=this.option("fill");if(t.forEach(((t,e)=>{t.index=e,t.pos=t.slides[0].pos,t.dim=0;for(const[e,i]of t.slides.entries())t.dim+=i.dim,e{s&&!this.isInfinite&&e>i&&(t.pos=Math.max(t.pos,0),t.pos=Math.min(t.pos,e-i)),t.pos=w(t.pos,1e3),t.dim=w(t.dim,1e3)})),this.isInfinite)return t;const o=[];let a;return t.forEach((t=>{const e=Object.assign({},t);a&&e.pos===a.pos?(a.dim+=e.dim,a.slides=[...a.slides,...e.slides]):(e.index=o.length,a=e,o.push(e))})),o}getPageFromIndex(t=0){const e=this.pages.length;let i;return t=parseInt((t||0).toString())||0,i=this.isInfinite?(t%e+e)%e:Math.max(Math.min(t,this.pages.length-1),0),i}getSlideMetrics(t){const e=this.isHorizontal?"width":"height";let i=0,n=0,s=t.el;s?i=parseFloat(s.dataset[e]||"")||0:(s=document.createElement("div"),s.style.visibility="hidden",I(s,this.cn("slide")+" "+t.class),(this.track||document.body).prepend(s)),i?(s.style[e]=`${i}px`,s.style["width"===e?"height":"width"]=""):i=s.getBoundingClientRect()[e];const o=getComputedStyle(s);return"content-box"===o.boxSizing&&(this.isHorizontal?(i+=parseFloat(o.paddingLeft)||0,i+=parseFloat(o.paddingRight)||0):(i+=parseFloat(o.paddingTop)||0,i+=parseFloat(o.paddingBottom)||0)),n=parseFloat(o[this.isHorizontal?"marginRight":"marginBottom"])||0,this.isHorizontal,t.el||s.remove(),{dim:i,gap:n}}getBounds(){let t={min:0,max:0};if(this.isInfinite)t={min:-1/0,max:1/0};else if(this.pages.length){const e=this.pages[0].pos,i=this.pages[this.pages.length-1].pos;t=this.isRTL&&this.isHorizontal?{min:e,max:i}:{min:-1*i,max:-1*e}}return{x:this.isHorizontal?t:{min:0,max:0},y:this.isHorizontal?{min:0,max:0}:t}}repositionSlides(){const{viewportDim:t,contentDim:e,page:i,pages:n}=this;let s,o=0,a=0,r=0,l=0;this.panzoom?l=-1*this.panzoom.current[this.isHorizontal?"e":"f"]:n[i]&&(l=n[i].pos||0),s=this.isHorizontal?this.isRTL?"right":"left":"top",this.isRTL&&this.isHorizontal&&(l*=-1);for(const t of this.slides)t.el?("top"===s?(t.el.style.right="",t.el.style.left=""):t.el.style.top="",t.index!==o?t.el.style[s]=0===a?"":`${a}px`:t.el.style[s]="",r+=t.dim+t.gap,o++):a+=t.dim+t.gap;if(this.isInfinite&&r)for(const i of this.slides)i.el&&(w(i.pos)w(e-t)&&(i.el.style[s]=`${a+r}px`),w(i.pos+i.gap)>=w(e-t)&&w(i.pos)>w(l+t)&&w(l)1&&(c=this.pages[d[0]],h=this.pages[d[1]]),c&&h){let t=0;for(const e of this.slides)e.el?this.inTransition.has(e.index)&&c.slides.indexOf(e)<0&&(e.el.style[s]=`${t+(c.pos-h.pos)}px`):t+=e.dim+e.gap}}createSlideEl(t){if(!this.track||!t)return;if(t.el)return;const e=document.createElement("div");I(e,this.cn("slide")),I(e,t.class),t.html&&(e.innerHTML=t.html);const i=[];this.slides.forEach(((t,e)=>{t.el&&i.push(e)}));const n=t.index;let s=null;if(i.length){let t=i.reduce(((t,e)=>Math.abs(e-n)this.page?1:-1,a=this.pages[s].pos*(this.isRTL?1:-1);if(this.page===s&&a===n.target[this.axis])return!1;this.clearTransitions();const r=n.isResting;I(this.container,this.cn("inTransition"));const l=this.pages[this.page].slides[0],c=this.pages[s].slides[0];this.inTransition.add(c.index),this.createSlideEl(c);let h=l.el,d=c.el;r||"slide"===e||(e="fadeFast",h=null);const u=this.isRTL?"next":"prev",p=this.isRTL?"prev":"next";return h&&(this.inTransition.add(l.index),l.transition=e,h.addEventListener("animationend",this.onAnimationEnd),h.classList.add(`f-${e}Out`,`to-${o>0?p:u}`)),d&&(c.transition=e,d.addEventListener("animationend",this.onAnimationEnd),d.classList.add(`f-${e}In`,`from-${o>0?u:p}`)),n.panTo({x:this.isHorizontal?a:0,y:this.isHorizontal?0:a,friction:0}),this.onChange(s),!0}manageSlideVisiblity(){const t=new Set,e=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const n of this.slides)i.has(n)?t.add(n):e.add(n);for(const e of this.inTransition)t.add(this.slides[e]);for(const e of t)this.createSlideEl(e),this.lazyLoadSlide(e);for(const i of e)t.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t="aria-hidden";let e=this.cn("isSelected");if(e)for(const i of this.slides)i.el&&(i.el.dataset.index=`${i.index}`,this.pages[this.page].slides.includes(i)?(i.el.classList.contains(e)||(I(i.el,e),this.emit("selectSlide",i)),i.el.removeAttribute(t)):(i.el.classList.contains(e)&&(k(i.el,e),this.emit("unselectSlide",i)),i.el.setAttribute(t,"true")))}flipInfiniteTrack(){const t=this.panzoom;if(!t||!this.isInfinite)return;const e="x"===this.option("axis")?"e":"f",{viewportDim:i,contentDim:n}=this;let s=t.current[e],o=t.target[e]-s,a=0,r=.5*i,l=n;this.isRTL&&this.isHorizontal?(s<-r&&(a=-1,s+=l),s>l-r&&(a=1,s-=l)):(s>r&&(a=1,s-=l),s<-l+r&&(a=-1,s+=l)),a&&(t.current[e]=s,t.target[e]=s+o)}lazyLoadSlide(t){const e=this,i=t&&t.el;if(!i)return;const n=new Set;i.querySelectorAll("[data-lazy-srcset]").forEach((t=>{t instanceof HTMLImageElement&&n.add(t)})),i.querySelectorAll("[data-lazy-src]").forEach((t=>{t instanceof HTMLImageElement?n.add(t):R(t)&&(t.style.backgroundImage=`url('${t.dataset.lazySrc||""}')`)}));const o=(t,i,n)=>{n&&(n.remove(),n=null),i.complete&&(i.style.display=""),this.option("adaptiveHeight")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&e.setViewportHeight()};for(const e of n){let i=null;e.src=e.dataset.lazySrcset||e.dataset.lazySrc||"",delete e.dataset.lazySrc,delete e.dataset.lazySrcset,e.style.display="none",e.addEventListener("error",(()=>{o(t,e,i)})),e.addEventListener("load",(()=>{o(t,e,i)})),setTimeout((()=>{e.parentNode&&t.el&&(e.complete?o(t,e,i):(i=s(l),e.parentNode.insertBefore(i,e)))}),300)}let a=i.dataset.lazySrc;a&&a.length&&(i.style.backgroundImage=`url('${a}')`)}clearTransitions(){this.inTransition.clear(),k(this.container,this.cn("inTransition"));const t=["to-prev","to-next","from-prev","from-next"];for(const e of this.slides){const i=e.el;if(i){i.removeEventListener("animationend",this.onAnimationEnd),i.classList.remove(...t);const n=e.transition;n&&i.classList.remove(`f-${n}Out`,`f-${n}In`)}}this.manageSlideVisiblity()}onAnimationEnd(t){const e=t.target,i=e?parseInt(e.dataset.index||"",10)||0:-1,n=this.slides[i],s=t.animationName;if(!e||!n||!s)return;const o=!!this.inTransition.has(i)&&n.transition;o&&s.substring(0,o.length+2)===`f-${o}`&&this.inTransition.delete(i),this.inTransition.size||this.clearTransitions(),i===this.page&&this.emit("settle")}onDecel(t,e=0,i=0){const n=this.isInfinite,s=this.isHorizontal?e:i,o=this.pages.length;if(!o)return;const a=this.option("dragFree");let r=this.page,l=0;const c=this.axis;!n&&(t.target[c],this.viewportDim);const h=t.current[c]*(this.isRTL&&this.isHorizontal?1:-1);let{pageIndex:d}=this.getPageFromPosition(h);if(a||Math.abs(s)<10){const e=t.target[c]*(this.isRTL&&this.isHorizontal?1:-1),{pageIndex:i}=this.getPageFromPosition(e);r=i}else r=this.isRTL&&this.isHorizontal?s<0?d-1:d+1:s<0?d+1:d-1,n||(r=Math.max(0,Math.min(r,this.pages.length-1)));if(n&&(l=Math.floor(r/o)||0),r=(r%o+o)%o,a&&t.dragOffset["e"===c?"x":"y"]);else{const e=this.contentDim;let i=(this.pages[r].pos+l*e)*(this.isRTL&&this.isHorizontal?1:-1);if(Math.abs(t.target[c]-i)<.1&&t.lockedAxis===("e"==c?"y":"x"))return;if(t.target[c]===i)return;t.applyChange({panX:this.isHorizontal?i-t.target.e:0,panY:this.isHorizontal?0:i-t.target.f,friction:t.option("decelFriction")})}r!==this.page&&this.onChange(r)}onClick(t){const e=t.target,i=e&&R(e)?e.dataset:null;let n;i&&(void 0!==i.carouselPage?n="slideTo":void 0!==i.carouselNext?n="slideNext":void 0!==i.carouselPrev&&(n="slidePrev")),n?(t.preventDefault(),t.stopPropagation(),e&&!e.hasAttribute("disabled")&&this[n](i&&"slideTo"===n?i.carouselPage:void 0)):this.emit("click",t)}onSlideTo(t){const e=t.detail||0;this.slideTo(this.getPageForSlide(e),{friction:0})}onChange(t,e=0){const i=this.page;this.prevPage=i,this.page=t,this.option("adaptiveHeight")&&this.setViewportHeight(),this.emit("change",t,i,e)}onRefresh(t,e=""){let i=this.contentDim,n=this.viewportDim;this.updateMetrics(),this.contentDim===i&&this.viewportDim===n||this.slideTo(this.page,{friction:0,transition:!1})}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(){this.flipInfiniteTrack(),this.manageSlideVisiblity()}onEndAnimation(){this.emit("settle")}reInit(t=null,e=null){this.destroy(),this.state=lt.Init,this.userOptions=t||this.userOptions,this.userPlugins=e||this.userPlugins,this.processOptions()}slideTo(t=0,{friction:e=this.option("friction"),transition:i=this.option("transition")}={}){if(this.state===lt.Destroy)return;const n=this.panzoom,s=this.pages.length;if(!n||!s)return;if(this.transitionTo(t,i))return;const o=this.axis,a=this.getPageFromIndex(t);let r=this.pages[a].pos,l=0;if(this.isInfinite){const t=n.current[o]*(this.isRTL&&this.isHorizontal?1:-1),e=this.contentDim,i=r+e,s=r-e;Math.abs(t-i){t.el&&(s=Math.max(s,t.el.offsetHeight))}))),i.style.height=s?`${s}px`:""}getPageForSlide(t){for(const e of this.pages)for(const i of e.slides)if(i.index===t)return e.index;return-1}getVisibleSlides(t=0){var e;const i=new Set;let{contentDim:n,viewportDim:s,pages:o,page:a}=this;n=n+(null===(e=this.slides[this.slides.length-1])||void 0===e?void 0:e.gap)||0;let r=0;r=this.panzoom?-1*this.panzoom.current[this.axis]:o[a]&&o[a].pos||0,this.isInfinite&&(r-=Math.floor(r/n)*n),this.isRTL&&this.isHorizontal&&(r*=-1),r=w(r,1e3);const l=w(r-s*t,1e3),c=w(r+s*(t+1),1e3),h=this.isInfinite?[-1,0,1]:[0];for(const t of this.slides)for(const e of h){const s=t.pos+e*n,o=t.pos+t.dim+t.gap+e*n;sl&&i.add(t)}return i}getPageFromPosition(t){const{viewportDim:e,contentDim:i}=this,n=this.pages.length;let s=0,o=0;const a=this.option("center");a&&(t+=.5*e),this.isInfinite||(t=Math.max(this.slides[0].pos,Math.min(t,this.slides[this.slides.length-1].pos)));const r=i+this.slides[this.slides.length-1].gap,l=Math.floor(t/r)||0;t-=l*r;let c=this.slides[this.slides.length-1],h=this.slides.find((e=>{const i=t+(c&&!a?.5*c.dim:0);return c=e,e.pos<=i&&e.pos+e.dim+e.gap>i}));return h||(h=this.slides[this.slides.length-1]),o=this.getPageForSlide(h.index),s=o+l*n,{page:s,pageIndex:o}}destroy(){if([lt.Destroy].includes(this.state))return;this.state=lt.Destroy;const{container:t,viewport:e,track:i,slides:n,panzoom:s}=this,o=this.option("classes");t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),t.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),s&&(s.destroy(),this.panzoom=null),n&&n.forEach((t=>{this.removeSlideEl(t)})),this.detachPlugins(),this.track=null,this.viewport=null,this.page=0,e&&i&&e.replaceWith(...i.childNodes);for(const[e,i]of Object.entries(o))"container"!==e&&i&&t.classList.remove(i);this.slides=[];const a=this.events.get("ready");this.events=new Map,a&&this.events.set("ready",a)}}Object.defineProperty(gt,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:_}),Object.defineProperty(gt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:rt}),Object.defineProperty(gt,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:ft});let bt=null,vt=null;const yt=new Map;let wt=0;class xt extends f{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(t=[],e={},i={}){super(e),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:d.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fsAPI",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.onWheel=n(this.onWheel.bind(this),300),this.fsAPI=(()=>{let t,e="",i="",n="";return document.fullscreenEnabled?(e="requestFullscreen",i="exitFullscreen",n="fullscreenElement"):document.webkitFullscreenEnabled&&(e="webkitRequestFullscreen",i="webkitExitFullscreen",n="webkitFullscreenElement"),e&&(t={request:function(t){return"webkitRequestFullscreen"===e?t[e](Element.ALLOW_KEYBOARD_INPUT):t[e]()},exit:function(){return document[n]&&document[i]()},isFullscreen:function(){return document[n]}}),t})(),this.id=e.id||++wt,yt.set(this.id,this),this.userSlides=t,this.userPlugins=i,queueMicrotask((()=>{this.init()}))}init(){this.state=d.Init,this.attachPlugins(Object.assign(Object.assign({},xt.Plugins),this.userPlugins)),this.emit("init"),!0===this.option("hideScrollbar")&&(()=>{if(!o)return;if(document.body.classList.contains("compensate-for-scrollbar"))return;const t=window.innerWidth-document.documentElement.getBoundingClientRect().width;document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",`${t}px`),t&&document.body.classList.add("compensate-for-scrollbar")})(),this.initLayout();const t=()=>{this.initCarousel(this.userSlides),this.state=d.Ready,this.attachEvents(),this.emit("ready"),setTimeout((()=>{this.container&&this.container.setAttribute("aria-hidden","false")}),16)};this.option("Fullscreen.autoStart")&&this.fsAPI&&!this.fsAPI.isFullscreen()?this.fsAPI.request(this.container).then((()=>t())).catch((()=>t())):t()}initLayout(){const t=this.option("parentEl")||document.body,e=s(this.localize(this.option("tpl.main")||""));e&&(e.setAttribute("id",`fancybox-${this.id}`),e.setAttribute("aria-label",this.localize("{{MODAL}}")),e.classList.toggle("is-compact",this.isCompact),this.container=e,this.footer=e.querySelector(".fancybox__footer"),t.appendChild(e),document.documentElement.classList.add("with-fancybox"),bt&&vt||(bt=document.createElement("button"),bt.classList.add("fancybox-focus-guard"),bt.setAttribute("aria-hidden","true"),bt.setAttribute("aria-label","Focus guard"),bt.setAttribute("type","button"),vt=bt.cloneNode(),document.body.prepend(bt),document.body.append(vt)),this.option("animated")&&(e.classList.add("is-animated"),setTimeout((()=>{this.isClosing()||e.classList.remove("is-animated")}),350)),this.emit("initLayout"))}initCarousel(t){const e=this.container;if(!e)return;const n=e.querySelector(".fancybox__carousel");if(!n)return;const s=this.carousel=new gt(n,i({},{slides:t,transition:"fade",Panzoom:{lockAxis:this.option("dragToClose")?"xy":"x",infinite:!!this.option("dragToClose")&&"y"},Dots:!1,Navigation:{classes:{container:"fancybox__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"}},initialPage:this.option("startIndex"),l10n:this.option("l10n")},this.option("Carousel")||{}));s.on("*",((t,e,...i)=>{this.emit(`Carousel.${e}`,t,...i)})),s.on(["ready","change"],(()=>{this.manageCaption(this.getSlide())})),s.on("removeSlide",((t,e)=>{e.closeBtnEl&&e.closeBtnEl.remove(),e.closeBtnEl=void 0,e.captionEl&&e.captionEl.remove(),e.captionEl=void 0,e.spinnerEl&&e.spinnerEl.remove(),e.spinnerEl=void 0,e.state=void 0})),s.on("Panzoom.touchStart",(()=>{this.isCompact||this.endIdle()})),s.on("settle",(()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&this.checkFocus()})),this.option("dragToClose")&&(s.on("Panzoom.afterTransform",((t,e)=>{const i=this.container;if(i){const t=Math.abs(e.current.f),n=t<1?"":Math.max(.5,Math.min(1,1-t/e.contentRect.fitHeight*1.5));i.style.setProperty("--fancybox-ts",n?"0s":""),i.style.setProperty("--fancybox-opacity",n+"")}})),s.on("Panzoom.touchEnd",((t,e,i)=>{const n=Math.abs(e.dragOffset.y);"y"===e.lockedAxis&&(n>=200||n>=50&&e.dragOffset.time<300)&&(i&&i.cancelable&&i.preventDefault(),this.close(i,"f-throwOut"+(e.current.f<0?"Up":"Down")))}))),s.on(["change"],(t=>{var e;let i=null===(e=this.getSlide())||void 0===e?void 0:e.triggerEl;if(i){const e=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:t.page});i.dispatchEvent(e)}})),s.on(["refresh","change"],(t=>{const e=this.container;if(!e)return;for(const i of e.querySelectorAll("[data-fancybox-current-index]"))i.innerHTML=t.page+1;for(const i of e.querySelectorAll("[data-fancybox-count]"))i.innerHTML=t.pages.length;if(!t.isInfinite){for(const i of e.querySelectorAll("[data-fancybox-next]"))t.page0?(i.removeAttribute("disabled"),i.removeAttribute("tabindex")):(i.setAttribute("disabled",""),i.setAttribute("tabindex","-1"))}const i=this.getSlide();let n=(null==i?void 0:i.downloadSrc)||"";n||!i||"image"!==i.type||i.error||"string"!=typeof i.src||(n=i.src);for(const t of e.querySelectorAll("[data-fancybox-download]"))n?(t.removeAttribute("disabled"),t.removeAttribute("tabindex"),t.setAttribute("href",n),t.setAttribute("download",n),t.setAttribute("target","_blank")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"),t.removeAttribute("href"),t.removeAttribute("download"))})),this.emit("initCarousel")}attachEvents(){const t=this.container;t&&(document.addEventListener("keydown",this.onKeydown,{passive:!1,capture:!0}),t.addEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),document.addEventListener("mousemove",this.onMousemove),window.addEventListener("resize",this.onResize),this.option("trapFocus")&&document.addEventListener("focus",this.onFocus,!0),document.addEventListener("visibilitychange",this.onVisibilityChange,!1))}detachEvents(){const t=this.container;t&&(document.removeEventListener("keydown",this.onKeydown,{passive:!1,capture:!0}),t.removeEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),document.removeEventListener("mousemove",this.onMousemove),window.removeEventListener("resize",this.onResize),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),document.removeEventListener("focus",this.onFocus,!0))}onClick(t){var e;if(this.isClosing())return;!this.isCompact&&this.option("idle")&&this.resetIdle();const i=t.composedPath()[0];if(i===(null===(e=this.carousel)||void 0===e?void 0:e.container))return;if(i.closest(".f-spinner")||i.closest("[data-fancybox-close]"))return t.preventDefault(),void this.close(t);if(i.closest("[data-fancybox-prev]"))return t.preventDefault(),void this.prev();if(i.closest("[data-fancybox-next]"))return t.preventDefault(),void this.next();if(this.isCompact)return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout((()=>{this.toggleIdle(),this.clickTimer=null}),350));if(this.emit("click",t),t.defaultPrevented)return;let n=!1;const s=document.activeElement;if(i.closest(".fancybox__content")){if(s){if(s.closest("[contenteditable]"))return;i.matches(r)||s.blur()}if((o=window.getSelection())&&"Range"===o.type)return;n=this.option("contentClick")}else i.closest(".fancybox__carousel")&&!i.matches(r)&&(n=this.option("backdropClick"));var o;"close"===n?(t.preventDefault(),this.close(t)):"next"===n?(t.preventDefault(),this.next()):"prev"===n&&(t.preventDefault(),this.prev())}onWheel(t){if(this.emit("wheel",t),t.defaultPrevented)return;const e=this.option("wheel",t);if("close"===e)t.preventDefault(),this.close(t);else if("slide"===e){const e=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail));t.preventDefault(),this[e>0?"next":"prev"]()}}onKeydown(t){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const e=t.key,i=this.option("keyboard");if(!i||t.ctrlKey||t.altKey||t.shiftKey)return;const n=t.composedPath()[0],s=document.activeElement&&document.activeElement.classList,o=s&&s.contains("f-button")||n.dataset.carouselPage;if("Escape"!==e&&!o&&R(n)){if(n.isContentEditable||-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(n.nodeName))return}this.emit("keydown",e,t);const a=i[e];"function"==typeof this[a]&&this[a]()}onResize(){const t=this.container;if(!t)return;const e=this.isCompact;t.classList.toggle("is-compact",e),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.emit("resize")}onFocus(t){this.isTopmost()&&this.focus(t)}onMousemove(t){this.prevMouseMoveEvent=t,!this.isCompact&&this.option("idle")&&this.resetIdle()}onVisibilityChange(){"visible"===document.visibilityState?this.checkFocus():this.endIdle()}manageCloseBtn(t){const e=this.optionFor(t,"closeButton")||!1;if("auto"===e){const t=this.plugins.Toolbar;if(t&&t.state===et.Ready)return}if(!e)return;if(!t.contentEl||t.closeBtnEl)return;const i=s(this.localize(this.option("tpl.closeButton")));t.closeBtnEl=t.contentEl.appendChild(i),t.el&&I(t.el,"has-close-btn")}manageCaption(t){var e,i,n;const s=this.container;if(!s)return;const o=this.isCompact||this.option("commonCaption"),a=!o;if(this.caption&&this.stop(this.caption),a&&this.caption&&(this.caption.remove(),this.caption=null),o&&!this.caption)for(const t of(null===(e=this.carousel)||void 0===e?void 0:e.slides)||[])t.captionEl&&(t.captionEl.remove(),t.captionEl=void 0,null===(i=t.el)||void 0===i||i.classList.remove("has-caption"),null===(n=t.el)||void 0===n||n.removeAttribute("aria-labelledby"));if(t||(t=this.getSlide()),!t||o&&!this.isCurrentSlide(t))return;const r=t.el;let l=this.optionFor(t,"caption","");if("string"!=typeof l||!l.length)return void(o&&this.caption&&this.animate(this.caption,"f-fadeOut",(()=>{var t;null===(t=this.caption)||void 0===t||t.remove(),this.caption=null})));let c=null;if(a){if(c=t.captionEl||null,r&&!c){const e=`fancybox__caption_${this.id}_${t.index}`;c=document.createElement("div"),c.className="fancybox__caption",c.setAttribute("id",e),t.captionEl=r.appendChild(c),r.classList.add("has-caption"),r.setAttribute("aria-labelledby",e)}}else{if(c=this.caption,c||(c=s.querySelector(".fancybox__caption")),!c){c=document.createElement("div"),c.dataset.fancyboxCaption="",c.className="fancybox__caption",c.innerHTML=l;(this.footer||s).prepend(c)}s.classList.add("has-caption"),this.caption=c}c&&(c.innerHTML=l)}checkFocus(){var t;const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}focus(t){var e;if(this.ignoreFocusChange)return;const i=document.activeElement||null,n=(null==t?void 0:t.target)||null,s=this.container,l=this.getSlide();if(!s||!(null===(e=this.carousel)||void 0===e?void 0:e.viewport))return;const c=l&&l.state===u.Ready?l.el:null;if(!c||c.contains(i))return;t&&t.cancelable&&t.preventDefault(),this.ignoreFocusChange=!0;const h=Array.from(s.querySelectorAll(r));let d,p=[s];for(let t of h){const e=t.offsetParent&&!t.closest('[aria-hidden="true"]'),i=c&&c.contains(t),n=!this.carousel.viewport.contains(t);e&&(i||n)?(p.push(t),void 0!==t.dataset.origTabindex&&(t.tabIndex=parseFloat(t.dataset.origTabindex)),t.removeAttribute("data-orig-tabindex"),(t.hasAttribute("autoFocus")||!d&&i)&&(d=t)):(t.dataset.origTabindex=void 0===t.dataset.origTabindex?t.getAttribute("tabindex")||void 0:t.dataset.origTabindex,t.tabIndex=-1)}let m=null;t?(!n||p.indexOf(n)<0)&&(m=s,p.length&&(i===vt?m=p[0]:this.lastFocus!==s&&i!==bt||(m=p[p.length-1]))):this.option("autoFocus")&&d?m=d:i&&p.indexOf(i)<0&&(m=s),m&&(t=>{if(t&&o){void 0===a&&document.createElement("div").focus({get preventScroll(){return a=!0,!1}});try{if(a)t.focus({preventScroll:!0});else{const e=window.pageXOffset||document.body.scrollTop,i=window.pageYOffset||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:i,behavior:"auto"})}}catch(t){}}})(m),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const t=this.carousel;t&&t.pages.length>1&&t.slideNext()}prev(){const t=this.carousel;t&&t.pages.length>1&&t.slidePrev()}jumpTo(...t){this.carousel&&this.carousel.slideTo(...t)}isTopmost(){var t;return(null===(t=xt.getInstance())||void 0===t?void 0:t.id)==this.id}animate(t=null,e="",i){if(!t||!e)return void(i&&i());this.stop(t);const n=s=>{s.target===t&&t.dataset.animationName&&(t.removeEventListener("animationend",n),delete t.dataset.animationName,i&&i(),t.classList.remove(e))};t.dataset.animationName=e,t.addEventListener("animationend",n),t.classList.add(e)}stop(t){t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:t}))}setContent(t,e="",i=!0){if(this.isClosing())return;const n=t.el;if(!n)return;let s=null;if(R(e))["img","iframe","video","audio"].includes(e.nodeName.toLowerCase())?(s=document.createElement("div"),s.appendChild(e)):s=e;else{const t=document.createRange().createContextualFragment(e);s=document.createElement("div"),s.appendChild(t)}s instanceof Element&&t.filter&&!t.error&&(s=s.querySelector(t.filter)),s instanceof Element?(s.classList.add("fancybox__content"),t.id&&s.setAttribute("id",t.id),"none"!==s.style.display&&"none"!==getComputedStyle(s).getPropertyValue("display")||(s.style.display=t.display||this.option("defaultDisplay")||"flex"),n.classList.add(`has-${t.error?"error":t.type||"unknown"}`),n.prepend(s),t.contentEl=s,i&&this.revealContent(t),this.manageCloseBtn(t),this.manageCaption(t)):this.setError(t,"{{ELEMENT_NOT_FOUND}}")}revealContent(t,e){const i=t.el,n=t.contentEl;i&&n&&(this.emit("reveal",t),this.hideLoading(t),t.state=u.Opening,(e=this.isOpeningSlide(t)?void 0===e?this.optionFor(t,"showClass"):e:"f-fadeIn")?this.animate(n,e,(()=>{this.done(t)})):this.done(t))}done(t){var e;this.isClosing()||(t.state=u.Ready,this.emit("done",t),null===(e=t.el)||void 0===e||e.classList.add("is-done"),this.isCurrentSlide(t)&&this.option("autoFocus")&&queueMicrotask((()=>{var t;if(this.option("autoFocus")){const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}})),this.isOpeningSlide(t)&&!this.isCompact&&this.option("idle")&&this.setIdle())}isCurrentSlide(t){const e=this.getSlide();return!(!t||!e)&&e.index===t.index}isOpeningSlide(t){var e,i;return null===(null===(e=this.carousel)||void 0===e?void 0:e.prevPage)&&t.index===(null===(i=this.getSlide())||void 0===i?void 0:i.index)}showLoading(t){t.state=u.Loading;const e=t.el;if(!e)return;e.classList.add("is-loading"),this.emit("loading",t),t.spinnerEl||setTimeout((()=>{if(!this.isClosing()&&!t.spinnerEl&&t.state===u.Loading){let i=s(l);t.spinnerEl=i,e.prepend(i),this.animate(i,"f-fadeIn")}}),250)}hideLoading(t){const e=t.el;if(!e)return;const i=t.spinnerEl;this.isClosing()?null==i||i.remove():(e.classList.remove("is-loading"),i&&this.animate(i,"f-fadeOut",(()=>{i.remove()})),t.state===u.Loading&&(this.emit("loaded",t),t.state=u.Ready))}setError(t,e){if(this.isClosing())return;this.emit("error"),t.error=e,this.hideLoading(t),this.clearContent(t);const i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(e||"

{{ERROR}}

"),this.setContent(t,i)}clearContent(t){var e;null===(e=this.carousel)||void 0===e||e.emit("removeSlide",t),t.contentEl&&(t.contentEl.remove(),t.contentEl=void 0),t.closeBtnEl&&(t.closeBtnEl.remove(),t.closeBtnEl=void 0);const i=t.el;i&&(k(i,"is-loading"),k(i,"has-error"),k(i,"has-unknown"),k(i,`has-${t.type||"unknown"}`))}getSlide(){var t;const e=this.carousel;return(null===(t=null==e?void 0:e.pages[null==e?void 0:e.page])||void 0===t?void 0:t.slides[0])||void 0}close(t,e){if(this.isClosing())return;const i=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",i,t),i.defaultPrevented)return;t&&t.cancelable&&(t.preventDefault(),t.stopPropagation());const n=this.fsAPI,s=()=>{this.proceedClose(t,e)};n&&n.isFullscreen()?Promise.resolve(n.exit()).then((()=>s())):s()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(t=!1){const e=()=>{var t;this.clearIdle(),this.idle=!0,null===(t=this.container)||void 0===t||t.classList.add("is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(t)e();else{const t=this.option("idle");t&&(this.idleTimer=setTimeout(e,t))}}endIdle(){var t;this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,null===(t=this.container)||void 0===t||t.classList.remove("is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){const t=this.fsAPI;t&&(t.isFullscreen()?t.exit():this.container&&t.request(this.container))}isClosing(){return[d.Closing,d.CustomClosing,d.Destroy].includes(this.state)}proceedClose(t,e){var i,n;this.state=d.Closing,this.clearIdle(),this.detachEvents();const s=this.container,o=this.carousel,a=this.getSlide(),r=null==a?void 0:a.state;if(a){const t=this.option("placeFocusBack")?(null===(i=this.getSlide())||void 0===i?void 0:i.triggerEl)||this.option("trigger"):null;t&&t.focus()}if(s&&(I(s,"is-closing"),s.setAttribute("aria-hidden","true"),this.option("animated")&&I(s,"is-animated"),s.style.pointerEvents="none"),o){o.clearTransitions(),null===(n=o.panzoom)||void 0===n||n.destroy();for(const t of o.slides){t.state=u.Closing,this.hideLoading(t);const e=t.contentEl;e&&this.stop(e);const i=null==t?void 0:t.panzoom;i&&(i.stop(),i.detachEvents(),i.detachObserver()),this.isCurrentSlide(t)||o.emit("removeSlide",t)}}this.emit("close",t),this.state!==d.CustomClosing?(void 0===e&&a&&(e=this.optionFor(a,"hideClass")),e&&a&&r===u.Ready?(this.animate(a.contentEl,e,(()=>{o&&o.emit("removeSlide",a)})),setTimeout((()=>{this.destroy()}),350)):this.destroy()):setTimeout((()=>{this.destroy()}),350)}destroy(){var t;if(this.state===d.Destroy)return;this.state=d.Destroy,null===(t=this.carousel)||void 0===t||t.destroy();const e=this.container;e&&e.remove(),yt.delete(this.id);const i=xt.getInstance();i?i.focus():(bt&&(bt.remove(),bt=null),vt&&(vt.remove(),vt=null),document.documentElement.classList.remove("with-fancybox"),o&&(document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",""),document.body.classList.remove("compensate-for-scrollbar")))}static bind(t,e,i){if(!o)return;let n,s="",a={};if("string"==typeof t?(n=document.body,s=t,"object"==typeof e&&(a=e||{})):(n=t,"string"==typeof e&&(s=e),"object"==typeof i&&(a=i||{})),!n)return;s=s||"[data-fancybox]";const r=xt.openers.get(n)||new Map;r.set(s,a),xt.openers.set(n,r),1===r.size&&n.addEventListener("click",xt.fromEvent)}static unbind(t,e){let i,n="";if("string"==typeof t?(i=document.body,n=t):(i=t,"string"==typeof e&&(n=e)),!i)return;const s=xt.openers.get(i);s&&n&&s.delete(n),n&&s||(xt.openers.delete(i),i.removeEventListener("click",xt.fromEvent))}static destroy(){let t;for(;t=xt.getInstance();)t.destroy();for(const t of xt.openers.keys())t.removeEventListener("click",xt.fromEvent);xt.openers=new Map}static fromEvent(t){if(t.defaultPrevented)return;if(t.button&&0!==t.button)return;if(t.ctrlKey||t.metaKey||t.shiftKey)return;let e=t.composedPath()[0];const n=e.closest("[data-fancybox-trigger]");if(n){const t=n.dataset.fancyboxTrigger||"",i=document.querySelectorAll(`[data-fancybox="${t}"]`),s=parseInt(n.dataset.fancyboxIndex||"",10)||0;e=i[s]||e}if(!(e&&e instanceof Element))return;let s,o,a,r;if([...xt.openers].reverse().find((([t,i])=>!(!t.contains(e)||![...i].reverse().find((([i,n])=>{let l=e.closest(i);return!!l&&(s=t,o=i,a=l,r=n,!0)}))))),!s||!o||!a)return;r=r||{},t.preventDefault(),e=a;let l=[],c=i({},h,r);c.event=t,c.trigger=e,c.delegate=n;const d=c.groupAll,u=c.groupAttr,p=u&&e?e.getAttribute(`${u}`):"";if((!e||p||d)&&(l=[].slice.call(s.querySelectorAll(o))),e&&!d&&(l=p?l.filter((t=>t.getAttribute(`${u}`)===p)):[e]),!l.length)return;const m=xt.getInstance();return m&&m.options.trigger&&l.indexOf(m.options.trigger)>-1?void 0:(e&&(c.startIndex=l.indexOf(e)),xt.fromNodes(l,c))}static fromNodes(t,e){e=i({},h,e);const n=[];for(const i of t){const t=i.dataset||{},s=t.src||i.getAttribute("href")||i.getAttribute("currentSrc")||i.getAttribute("src")||void 0;let o;const a=e.delegate;let r;a&&n.length===e.startIndex&&(o=a instanceof HTMLImageElement?a:a.querySelector("img:not([aria-hidden])")),o||(o=i instanceof HTMLImageElement?i:i.querySelector("img:not([aria-hidden])")),o&&(r=o.currentSrc||o.src||void 0,!r&&o.dataset&&(r=o.dataset.lazySrc||o.dataset.src||void 0));const l={src:s,triggerEl:i,thumbEl:o,thumbElSrc:r,thumbSrc:r};for(const e in t)"fancybox"!==e&&(l[e]=t[e]+"");n.push(l)}return new xt(n,e)}static getInstance(t){if(t)return yt.get(t);return Array.from(yt.values()).reverse().find((t=>!t.isClosing()&&t))||null}static getSlide(){var t;return(null===(t=xt.getInstance())||void 0===t?void 0:t.getSlide())||null}static show(t=[],e={}){return new xt(t,e)}static next(){const t=xt.getInstance();t&&t.next()}static prev(){const t=xt.getInstance();t&&t.prev()}static close(t=!0,...e){if(t)for(const t of yt.values())t.close(...e);else{const t=xt.getInstance();t&&t.close(...e)}}}Object.defineProperty(xt,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(xt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:h}),Object.defineProperty(xt,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:ot}),Object.defineProperty(xt,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),t.Fancybox=xt})); diff --git a/dist/index.esm.js b/dist/index.esm.js index c27fa07e..a78f24de 100644 --- a/dist/index.esm.js +++ b/dist/index.esm.js @@ -1 +1 @@ -const t=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),e=function(t,i){return!(!t||t===document.body||i&&t===i)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,n=-1!==i.indexOf("hidden"),s=-1!==i.indexOf("visible");return e&&!n&&!s}(t)?t:e(t.parentElement,i))},i=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},n=t=>`${t||""}`.split(" ").filter((t=>!!t)),s=(t,e,i)=>{n(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))};class o{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const a={passive:!1};class r{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:n=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=n;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,a),this.element.addEventListener("touchmove",this.onMove,a),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,a)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new o(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new o(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new o(t))):[new o(t)],n=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(n.push(t),this.currentPointers[e]=t)}n.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new o(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new o(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,a),this.element.removeEventListener("touchstart",this.onTouchStart,a),this.element.removeEventListener("touchmove",this.onMove,a),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function l(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function c(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const h=t=>"object"==typeof t&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t),d=(t,...e)=>{const i=e.length;for(let n=0;n{const n=Array.isArray(i)?[]:{};t[e]||Object.assign(t,{[e]:n}),h(i)?Object.assign(t[e],d(n,i)):Array.isArray(i)?Object.assign(t,{[e]:[...i]}):Object.assign(t,{[e]:i})}))}return t},u=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class p{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?d({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=u(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...n){let s=u(e,t);var o;"string"!=typeof(o=s)||isNaN(o)||isNaN(parseFloat(o))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...n));let a=u(e,this.options);return a&&"function"==typeof a?s=a.call(this,this,t,...n,s):void 0===s&&(s=a),void 0===s?i:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(p,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(p,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class m extends p{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,n]of Object.entries(t)){const t=this.option(i),s=this.plugins[i];s||!1===t?s&&!1===t&&(s.detach(),delete this.plugins[i]):e.set(i,new n(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}var f;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(f||(f={}));const g=["a","b","c","d","e","f"],b={PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"},v={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:b},y='
',w=t=>t&&null!==t&&t instanceof Element&&"nodeType"in t,x={a:1,b:0,c:0,d:1,e:0,f:0};let S=null,E=null;class P extends m{get isTouchDevice(){return null===E&&(E=window.matchMedia("(hover: none)").matches),E}get isMobile(){return null===S&&(S=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),S}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){return this.content instanceof HTMLImageElement&&!this.content.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of g){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},n={}){var s;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:f.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},x)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},x)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},P.Plugins),n)),this.emit("init"),this.isContentLoading){if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const e=i(y);t.contains(this.content)?this.spinner=(null===(s=this.content.parentElement)||void 0===s?void 0:s.insertBefore(e,this.content))||null:this.spinner=t.appendChild(e)}this.emit("beforeLoad"),this.content.addEventListener("load",this.onLoad),this.content.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===f.Init&&this.enable()}onError(){this.state!==f.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=f.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new r(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of g)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of g)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,n=i.e+t,s=i.f+e,o=this.getBounds(),{x:a,y:r}=o,l=a.min,c=a.max,h=r.min,d=r.max;let u=0,p=0;return l!==1/0&&nc&&(u=c-n),h!==1/0&&sd&&(p=d-s),Math.abs(u)<.001&&(u=0),Math.abs(p)<.001&&(p=0),Object.assign(Object.assign({},o),{xDiff:u,yDiff:p,inBounds:!u&&!p})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:n,fitHeight:s,fullWidth:o,fullHeight:a}=i;let r=o,l=a;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),c=i?o:n,h=i?a:s,d=this.getMatrix(t),u=new DOMPoint(0,0).matrixTransform(d),p=new DOMPoint(0+c,0).matrixTransform(d),m=new DOMPoint(0+c,0+h).matrixTransform(d),f=new DOMPoint(0,0+h).matrixTransform(d),g=Math.abs(m.x-u.x),b=Math.abs(m.y-u.y),v=Math.abs(f.x-p.x),y=Math.abs(f.y-p.y);r=Math.max(g,v),l=Math.max(b,y)}return{contentWidth:r,contentHeight:l}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const n=i.closest("[data-panzoom-action]"),s=i.closest("[data-panzoom-change]"),o=n||s,a=o&&w(o)?o.dataset:null;if(a){const e=a.panzoomChange,i=a.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const r=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(r.x-this.dragStart.x)>2||Math.abs(r.y-this.dragStart.y)>2))return;this.dragStart.time=0;const l=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},c=this.option("click",t),h=this.option("dblClick",t);h?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&c&&l(c)):(this.emit("dblClick",t),t.defaultPrevented||l(h)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&c&&l(c))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(e,i,n){var s;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const o=this.content.getBoundingClientRect();if(this.dragStart={x:o.x,y:o.y,top:o.top,left:o.left,time:Date.now()},!1===this.option("touch",e))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return e.preventDefault(),e.stopPropagation(),!1;if(!n.length){const t=e.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(t.nodeName)||t.closest("[contenteditable]")||t.closest("[data-selectable]")||t.closest("[data-panzoom-change]")||t.closest("[data-panzoom-action]"))return!1;null===(s=window.getSelection())||void 0===s||s.removeAllRanges()}return"mousedown"===e.type&&e.preventDefault(),t(this.targetScale,1e3)===t(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(i),this.emit("touchStart",e),!0}onPointerMove(i,n,s){if(!this.isDragging)return;if(n.length<2&&this.panOnlyZoomed&&t(this.targetScale)<=t(this.minScale))return;if(this.emit("touchMove",i),i.defaultPrevented)return;this.addTrackingPoint(n[0]);const{content:o}=this,a=c(s[0],s[1]),r=c(n[0],n[1]);let h=0,d=0;if(n.length>1){const t=o.getBoundingClientRect();h=a.clientX-t.left-.5*t.width,d=a.clientY-t.top-.5*t.height}const u=l(s[0],s[1]),p=l(n[0],n[1]);let m=u?p/u:1,f=r.clientX-a.clientX,g=r.clientY-a.clientY;this.dragOffset.x+=f,this.dragOffset.y+=g,this.dragOffset.time=Date.now()-this.dragStart.time;let b=t(this.targetScale)===t(this.minScale)&&this.option("lockAxis");if(b&&!this.lockedAxis)if("xy"===b||"y"===b||"touchmove"===i.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void i.preventDefault();const t=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=t>45&&t<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,f=0,g=0}else this.lockedAxis=b;if(e(i.target,this.content)&&(b="x",this.dragOffset.y=0),b&&"xy"!==b&&this.lockedAxis!==b&&t(this.targetScale)===t(this.minScale))return;i.cancelable&&i.preventDefault(),this.container.classList.add(this.cn("isDragging"));const v=this.checkBounds(f,g);this.option("rubberband")?("x"!==this.isInfinite&&(v.xDiff>0&&f<0||v.xDiff<0&&f>0)&&(f*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*v.xDiff))),"y"!==this.isInfinite&&(v.yDiff>0&&g<0||v.yDiff<0&&g>0)&&(g*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*v.yDiff)))):(v.xDiff&&(f=0),v.yDiff&&(g=0));const y=this.targetScale,w=this.minScale,x=this.maxScale;y<.5*w&&(m=Math.max(m,w)),y>1.5*x&&(m=Math.min(m,x)),"y"===this.lockedAxis&&t(y)===t(w)&&(f=0),"x"===this.lockedAxis&&t(y)===t(w)&&(g=0),this.applyChange({originX:h,originY:d,panX:f,panY:g,scale:m,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,i,n){if(n.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(i),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),e(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==f.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of g)this.velocity[t]=0,this.target[t]=this.current[t];const{trackingPoints:e}=this,i=e[0],n=e[e.length-1];let s=0,o=0,a=0;n&&i&&(s=n.clientX-i.clientX,o=n.clientY-i.clientY,a=n.time-i.time);let r=0,l=0,c=0,h=0,d=this.option("decelFriction");const u=this.targetScale;if((uthis.maxScale+1e-5)&&(d=.35),a>0){c=Math.abs(s)>3?s/(a/30):0,h=Math.abs(o)>3?o/(a/30):0;const t=this.option("maxVelocity");t&&(c=Math.max(Math.min(c,t),-1*t),h=Math.max(Math.min(h,t),-1*t))}c&&(r=c/(1/(1-d)-1)),h&&(l=h/(1/(1-d)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&t(u)===this.minScale)&&(r=c=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&t(u)===this.minScale)&&(l=h=0);const p=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(s)),"auto"===m&&(m=parseFloat(s.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(s));const g=(this.option("transformParent")?s.parentElement:null)||s,b=g.getAttribute("style")||"";g.style.setProperty("transform","none","important"),g.style.setProperty("transition","none","important"),g.style.setProperty("animation","none","important"),s instanceof HTMLImageElement&&(g.style.width="",g.style.height=""),g.offsetHeight;const v=s.getBoundingClientRect();let y=v.width,w=v.height,x=0,S=0;if(s instanceof HTMLImageElement&&({width:y,height:w,top:x,left:S}=((t,e,i,n)=>{const s=i/n;return s>t/e?(i=t,n=t/s):(i=e*s,n=e),{width:i,height:n,top:.5*(e-n),left:.5*(t-i)}})(v.width,v.height,p,m)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:v.top-r.top+x,bottom:r.bottom-v.bottom+x,left:v.left-r.left+S,right:r.right-v.right+S,fitWidth:y,fitHeight:w,width:y,height:w,fullWidth:p,fullHeight:m}),g.style.cssText=b,s instanceof HTMLImageElement&&(g.style.width=`${y}px`,g.style.height=`${w}px`),this.setTransform(),!0!==e){let t="";Math.abs(c-o)>1&&(t+="x"),Math.abs(h-a)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(t(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===f.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const e=this.option("bounds");if("auto"!==e)return e;const{contentWidth:i,contentHeight:n}=this.calculateContentDim(this.target);let s=0,o=0,a=0,r=0;const l=this.option("infinite");if(!0===l||this.lockedAxis&&l===this.lockedAxis)s=-1/0,a=1/0,o=-1/0,r=1/0;else{let{containerRect:e,contentRect:l}=this,c=t(this.contentRect.fitWidth*this.targetScale,1e3),h=t(this.contentRect.fitHeight*this.targetScale,1e3),{innerWidth:d,innerHeight:u}=e;if(this.containerRect.width===c&&(d=e.width),this.containerRect.width===h&&(u=e.height),i>d){a=.5*(i-d),s=-1*a;let t=.5*(l.right-l.left);s+=t,a+=t}if(this.contentRect.fitWidth>d&&iu){r=.5*(n-u),o=-1*r;let t=.5*(l.bottom-l.top);o+=t,r+=t}this.contentRect.fitHeight>u&&nthis.maxScale?this.minScale:this.maxScale,toggleCover:this.targetScale>this.coverScale?this.minScale:this.coverScale,toggleZoom:this.targetScale>this.fullScale?this.minScale:this.fullScale}[this.option("click")||""]||this.minScale,o=e.canZoomIn(),a=e.canZoomOut(),r="drag"===this.panMode,l=a&&r;this.targetScale<=this.minScale&&!this.panOnlyZoomed&&(l=!0),(this.contentRect.width-this.contentRect.fitWidth>-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(l=!0),this.contentRect.width*this.targetScalethis.minScale,h=!o&&!l&&a&&t(n)===t(this.minScale);s(i,this.cn("canZoomIn"),c),s(i,this.cn("canZoomOut"),h),s(i,this.cn("isDraggable"),l);for(const t of i.querySelectorAll('[data-panzoom-action="zoomIn"]'))o?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const t of i.querySelectorAll('[data-panzoom-action="zoomOut"]'))a?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const t of i.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){o=e.targetScale.9*e.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:n=this.option("friction"),angle:s=0,originX:o=0,originY:a=0,flipX:r=!1,flipY:l=!1,ignoreBounds:c=!1}){this.state!==f.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:s,originX:o,originY:a,friction:n,flipX:r,flipY:l,ignoreBounds:c})}applyChange({panX:e=0,panY:i=0,scale:n=1,angle:s=0,originX:o=-this.current.e,originY:a=-this.current.f,friction:r=this.option("friction"),flipX:l=!1,flipY:c=!1,ignoreBounds:h=!1,bounce:d=this.option("bounce")}){if(this.state===f.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of g)this.velocity[t]=0;this.friction=r||0,this.ignoreBounds=h;const{current:u}=this,p=u.e,m=u.f,b=this.getMatrix(this.target);let v=(new DOMMatrix).translate(p,m).translate(o,a).translate(e,i);if(this.option("zoom")){if(!h){const t=this.targetScale,e=this.minScale,i=this.maxScale;t*ni&&(n=i/t)}v=v.scale(n)}v=v.translate(-o,-a).translate(-p,-m).multiply(b),s&&(v=v.rotate(s)),l&&(v=v.scale(-1,1)),c&&(v=v.scale(1,-1));for(const e of g)"a"!=e&&"d"!=e||!(v[e]>this.minScale+1e-5||v[e].1||"mousemove"===this.panMode||!1===d)&&!h&&this.clampTargetBounds(),this.isResting||(this.state=f.Panning,this.requestTick())}stop(t=!1){if(this.state!==f.Init&&this.state!==f.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of g)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=f.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls()),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(e,i=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=e,"mousemove"!==this.panMode||!e)return;if(t(this.targetScale)<=t(this.minScale))return;this.emit("mouseMove",e);const{container:n,containerRect:s,contentRect:o}=this,a=s.width,r=s.height,l=n.getBoundingClientRect(),c=(e.clientX||0)-l.left,h=(e.clientY||0)-l.top;let{contentWidth:d,contentHeight:u}=this.calculateContentDim(this.target);const p=this.option("mouseMoveFactor");p>1&&(d!==a&&(d*=p),u!==r&&(u*=p));let m=.5*(d-a)-c/a*100/100*(d-a);m+=.5*(o.right-o.left);let f=.5*(u-r)-h/r*100/100*(u-r);f+=.5*(o.bottom-o.top),this.applyChange({panX:m-this.target.e,panY:f-this.target.f,friction:i})}zoomWithWheel(t){if(this.state===f.Destroy||this.state===f.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),n=this.targetScale,s=this.maxScale,o=this.minScale;let a=n*(100+i*e)/100;as&&n>=s?(this.wheelDelta+=Math.abs(i),a=s):(this.wheelDelta=0,a=Math.max(Math.min(a,s),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),a!==n&&this.zoomTo(a,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale>.9*this.maxScale?"fit":"max",t)}toggleCover(t){this.zoomTo(this.targetScale>.9*this.coverScale?"fit":"cover",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:n=0,event:s}={}){if(this.isContentLoading||this.state===f.Destroy)return;this.stop();const{targetScale:o}=this;let a=1;if("mousemove"===this.panMode&&(s=this.prevMouseMoveEvent||s),s){const t=this.content.getBoundingClientRect(),e=s.clientX||0,o=s.clientY||0;i=e-t.left-.5*t.width,n=o-t.top-.5*t.height}const r=this.fullScale,l=this.maxScale;let c=this.coverScale;"number"==typeof t?a=t/o:("next"===t&&(r-c<.2&&(c=r),t=o1?.15:.25:e,this.applyChange({scale:a,originX:i,originY:n,friction:e}),s&&"mousemove"===this.panMode&&this.panWithMouse(s,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const n=t.classList.contains(e);n?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(n?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:n,d:s,e:o,f:a}=t;return new DOMMatrix([e,i,n,s,o,a])}reset(t){if(this.state!==f.Init&&this.state!==f.Destroy){this.stop("current");for(const t of g)this.target[t]=x[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=f.Panning,this.requestTick())}}destroy(){this.stop(),this.state=f.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(P,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:v}),Object.defineProperty(P,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const M=function(t,e){let i=!0;return(...n)=>{i&&(i=!1,t(...n),setTimeout((()=>{i=!0}),e))}},C=(t,e)=>{let i=[];return t.childNodes.forEach((t=>{t.nodeType!==Node.ELEMENT_NODE||e&&!t.matches(e)||i.push(t)})),i},T=(t,e)=>{n(e).forEach((e=>{t&&t.classList.add(e)}))},O=(t,e)=>{n(e).forEach((e=>{t&&t.classList.remove(e)}))},A={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var L;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"}(L||(L={}));const z=t=>{if("string"==typeof t&&(t={html:t}),!(t instanceof String||t instanceof HTMLElement)){const e=t.thumb;void 0!==e&&("string"==typeof e&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},R=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class k extends p{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const I={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'',dynamicFrom:11,maxCount:1/0,minCount:2};class D extends k{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let t=this.list;return t||(t=document.createElement("ul"),T(t,this.cn("list")),t.setAttribute("role","tablist"),this.instance.container.appendChild(t),T(this.instance.container,this.cn("hasDots")),this.list=t),t}refresh(){var t;const e=this.instance.pages.length,i=Math.min(2,this.option("minCount")),n=Math.max(2e3,this.option("maxCount")),o=this.option("dynamicFrom");if(en)return void this.cleanup();const a="number"==typeof o&&e>5&&e>=o,r=!this.list||this.isDynamic!==a||this.list.children.length!==e;r&&this.cleanup();const l=this.build();if(s(l,this.cn("isDynamic"),!!a),r)for(let t=0;t=e-1&&s.setAttribute("disabled","")))}createButton(t){const e=this.instance,i=document.createElement("button");i.setAttribute("tabindex","0"),i.setAttribute("title",e.localize(`{{${t.toUpperCase()}}}`)),T(i,this.cn("button")+" "+this.cn("next"===t?"isNext":"isPrev"));const n=e.isRTL?"next"===t?"prev":"next":t;var s;return i.innerHTML=e.localize(this.option(`${n}Tpl`)),i.dataset[`carousel${s=t,s?s.match("^[a-z]")?s.charAt(0).toUpperCase()+s.substring(1):s:""}`]="true",i}build(){let t=this.container;t||(this.container=t=document.createElement("div"),T(t,this.cn("container")),this.instance.container.appendChild(t)),this.next||(this.next=t.appendChild(this.createButton("next"))),this.prev||(this.prev=t.appendChild(this.createButton("prev")))}cleanup(){this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove(),this.prev=null,this.next=null,this.container=null}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(F,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'',prevTpl:''}});class j extends k{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){this.nav&&this.target&&(this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.state===L.Ready&&this.onNavReady(this.nav),this.target.on("ready",this.onTargetReady),this.target.state===L.Ready&&this.onTargetReady(this.target))}onNavReady(t){t.on("createSlide",this.onNavCreateSlide),t.on("Panzoom.click",this.onNavClick),this.onTargetChange()}onTargetReady(t){t.on("change",this.onTargetChange),t.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(t,e,i){var n,s;const o=i.target,{nav:a,target:r}=this;if(!a||!r||!o)return;const l=o.closest("[data-index]");if(!l)return;i.stopPropagation();const c=parseInt(l.dataset.index||"",10)||0,h=a.getPageForSlide(c);a.page!==h&&a.slideTo(h);const d=r.getPageForSlide(c);r.page!==d&&r.slideTo(d,{friction:null===(s=null===(n=this.nav)||void 0===n?void 0:n.plugins)||void 0===s?void 0:s.Sync.option("friction")}),this.markSelectedSlide(c)}onNavCreateSlide(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}onTargetChange(){const{target:t,nav:e}=this;if(!t||!e)return;if(e.state!==L.Ready||t.state!==L.Ready)return;const i=t.pages[t.page].slides[0].index,n=e.getPageForSlide(i);e.slideTo(n),this.markSelectedSlide(i)}markSelectedSlide(t){const{nav:e}=this;if(!e)return;this.selectedIndex=t,[...e.slides].filter((t=>t.el&&t.el.classList.remove("is-nav-selected")));const i=e.slides[t];i&&i.el&&i.el.classList.add("is-nav-selected")}attach(){let t=this.options.target,e=this.options.nav;t?this.addAsNavFor(t):e&&this.addAsTargetFor(e)}detach(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.nav=null,this.target&&(this.target.off("ready",this.onTargetReady),this.target.off("refresh",this.onTargetChange),this.target.off("change",this.onTargetChange)),this.target=null}}Object.defineProperty(j,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const H={Navigation:F,Dots:D,Sync:j};class B extends m{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===L.Ready}get isInfinite(){let t=!1;const e=this.contentDim,i=this.viewportDim;return this.pages.length>=2&&e>1.5*i&&(t=this.option("infinite")),t}get isRTL(){return"rtl"===this.option("direction")}get isHorizontal(){return"x"===this.option("axis")}constructor(t,e={},i={}){if(super(),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:L.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),"string"==typeof t&&(t=document.querySelector(t)),!t||!w(t))throw new Error("No Element found");this.container=t,this.slideNext=M(this.slideNext.bind(this),175),this.slidePrev=M(this.slidePrev.bind(this),175),this.userOptions=e,this.userPlugins=i,queueMicrotask((()=>{this.processOptions()}))}processOptions(){const t=d({},B.defaults,this.userOptions);let e="";const i=t.breakpoints;if(i&&h(i))for(const[n,s]of Object.entries(i))window.matchMedia(n).matches&&h(s)&&(e+=n,d(t,s));e===this.bp&&this.state!==L.Init||(this.bp=e,this.state===L.Ready&&(t.initialSlide=this.pages[this.page].slides[0].index),this.state!==L.Init&&this.destroy(),super.setOptions(t),!1===this.option("enabled")?this.attachEvents():setTimeout((()=>{this.init()}),0))}init(){this.state=L.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},B.Plugins),this.userPlugins)),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=L.Ready,this.emit("ready")}initLayout(){const{container:t}=this,e=this.option("classes");T(t,this.cn("container")),s(t,e.isLTR,!this.isRTL),s(t,e.isRTL,this.isRTL),s(t,e.isVertical,!this.isHorizontal),s(t,e.isHorizontal,this.isHorizontal);let i=this.option("viewport")||t.querySelector(`.${e.viewport}`);i||(i=document.createElement("div"),T(i,e.viewport),i.append(...C(t,`.${e.slide}`)),t.prepend(i));let n=this.option("track")||t.querySelector(`.${e.track}`);n||(n=document.createElement("div"),T(n,e.track),n.append(...Array.from(i.childNodes))),n.setAttribute("aria-live","polite"),i.contains(n)||i.prepend(n),this.viewport=i,this.track=n,this.emit("initLayout")}initSlides(){const{track:t}=this;if(t){this.slides=[],[...C(t,`.${this.cn("slide")}`)].forEach((t=>{if(w(t)){const e=z({el:t,isDom:!0,index:this.slides.length});this.slides.push(e),this.emit("initSlide",e,this.slides.length)}}));for(let t of this.option("slides",[])){const e=z(t);e.index=this.slides.length,this.slides.push(e),this.emit("initSlide",t,this.slides.length)}this.emit("initSlides")}}setInitialPage(){let t=0;const e=this.option("initialSlide");t="number"==typeof e?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0,this.page=t}setInitialPosition(){if(!this.track||!this.pages.length)return;let t=this.page;this.pages[t]||(this.page=t=0);const e=this.pages[t].pos*(this.isRTL&&this.isHorizontal?1:-1),i=this.isHorizontal?`${e}px`:"0",n=this.isHorizontal?"0":`${e}px`;this.track.style.transform=`translate3d(${i}, ${n}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const t=this.option("Panzoom")||{};this.panzoom=new P(this.viewport,d({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,decelFriction:.12,click:!1,dblClick:!1,touch:t=>!(this.pages.length<2&&!t.options.infinite),bounds:()=>this.getBounds(),maxVelocity:t=>Math.abs(t.target[this.axis]-t.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on("*",((t,e,...i)=>{this.emit(`Panzoom.${e}`,t,...i)})),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation),this.panzoom.on("touchStart",((t,e)=>{this.inTransition.size&&e.preventDefault()}))}attachEvents(){const t=this.container;t&&(t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let t=[];const{contentDim:e,viewportDim:i}=this,n=this.option("slidesPerPage");if("number"==typeof n&&e>i){for(let e=0;ei)&&(t.push(R()),s=t.length-1,o=0),o+=e.dim+e.gap,t[s].slides.push(e);return t}processPages(){const e=this.pages,{contentDim:i,viewportDim:n}=this,s=this.option("center"),o=this.option("fill");if(e.forEach(((t,e)=>{t.index=e,t.pos=t.slides[0].pos,t.dim=0;for(const[e,i]of t.slides.entries())t.dim+=i.dim,e{o&&!this.isInfinite&&i>n&&(e.pos=Math.max(e.pos,0),e.pos=Math.min(e.pos,i-n)),e.pos=t(e.pos,1e3),e.dim=t(e.dim,1e3)})),this.isInfinite)return e;const a=[];let r;return e.forEach((t=>{const e=Object.assign({},t);r&&e.pos===r.pos?(r.dim+=e.dim,r.slides=[...r.slides,...e.slides]):(e.index=a.length,r=e,a.push(e))})),a}getPageFromIndex(t=0){const e=this.pages.length;let i;return t=parseInt((t||0).toString())||0,i=this.isInfinite?(t%e+e)%e:Math.max(Math.min(t,this.pages.length-1),0),i}getSlideMetrics(t){const e=this.isHorizontal?"width":"height";let i=0,n=0,s=t.el;s?i=parseFloat(s.dataset[e]||"")||0:(s=document.createElement("div"),s.style.visibility="hidden",T(s,this.cn("slide")+" "+t.class),(this.track||document.body).prepend(s)),i?(s.style[e]=`${i}px`,s.style["width"===e?"height":"width"]=""):i=s.getBoundingClientRect()[e];const o=getComputedStyle(s);return"content-box"===o.boxSizing&&(this.isHorizontal?(i+=parseFloat(o.paddingLeft)||0,i+=parseFloat(o.paddingRight)||0):(i+=parseFloat(o.paddingTop)||0,i+=parseFloat(o.paddingBottom)||0)),n=parseFloat(o[this.isHorizontal?"marginRight":"marginBottom"])||0,this.isHorizontal,t.el||s.remove(),{dim:i,gap:n}}getBounds(){let t={min:0,max:0};if(this.isInfinite)t={min:-1/0,max:1/0};else if(this.pages.length){const e=this.pages[0].pos,i=this.pages[this.pages.length-1].pos;t=this.isRTL&&this.isHorizontal?{min:e,max:i}:{min:-1*i,max:-1*e}}return{x:this.isHorizontal?t:{min:0,max:0},y:this.isHorizontal?{min:0,max:0}:t}}repositionSlides(){const{viewportDim:e,contentDim:i,page:n,pages:s}=this;let o,a=0,r=0,l=0,c=0;this.panzoom?c=-1*this.panzoom.current[this.isHorizontal?"e":"f"]:s[n]&&(c=s[n].pos||0),o=this.isHorizontal?this.isRTL?"right":"left":"top",this.isRTL&&this.isHorizontal&&(c*=-1);for(const t of this.slides)t.el?("top"===o?(t.el.style.right="",t.el.style.left=""):t.el.style.top="",t.index!==a?t.el.style[o]=0===r?"":`${r}px`:t.el.style[o]="",l+=t.dim+t.gap,a++):r+=t.dim+t.gap;if(this.isInfinite&&l)for(const n of this.slides)n.el&&(t(n.pos)t(i-e)&&(n.el.style[o]=`${r+l}px`),t(n.pos+n.gap)>=t(i-e)&&t(n.pos)>t(c+e)&&t(c)1&&(h=this.pages[u[0]],d=this.pages[u[1]]),h&&d){let t=0;for(const e of this.slides)e.el?this.inTransition.has(e.index)&&h.slides.indexOf(e)<0&&(e.el.style[o]=`${t+(h.pos-d.pos)}px`):t+=e.dim+e.gap}}createSlideEl(t){if(!this.track||!t)return;if(t.el)return;const e=document.createElement("div");T(e,this.cn("slide")),T(e,t.class),t.html&&(e.innerHTML=t.html);const i=[];this.slides.forEach(((t,e)=>{t.el&&i.push(e)}));const n=t.index;let s=null;if(i.length){let t=i.reduce(((t,e)=>Math.abs(e-n)this.page?1:-1,a=this.pages[s].pos*(this.isRTL?1:-1);if(this.page===s&&a===n.target[this.axis])return!1;this.clearTransitions();const r=n.isResting;T(this.container,this.cn("inTransition"));const l=this.pages[this.page].slides[0],c=this.pages[s].slides[0];this.inTransition.add(c.index),this.createSlideEl(c);let h=l.el,d=c.el;r||"slide"===e||(e="fadeFast",h=null);const u=this.isRTL?"next":"prev",p=this.isRTL?"prev":"next";return h&&(this.inTransition.add(l.index),l.transition=e,h.addEventListener("animationend",this.onAnimationEnd),h.classList.add(`f-${e}Out`,`to-${o>0?p:u}`)),d&&(c.transition=e,d.addEventListener("animationend",this.onAnimationEnd),d.classList.add(`f-${e}In`,`from-${o>0?u:p}`)),n.panTo({x:this.isHorizontal?a:0,y:this.isHorizontal?0:a,friction:0}),this.onChange(s),!0}manageSlideVisiblity(){const t=new Set,e=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const n of this.slides)i.has(n)?t.add(n):e.add(n);for(const e of this.inTransition)t.add(this.slides[e]);for(const e of t)this.createSlideEl(e),this.lazyLoadSlide(e);for(const i of e)t.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t="aria-hidden";let e=this.cn("isSelected");if(e)for(const i of this.slides)i.el&&(i.el.dataset.index=`${i.index}`,this.pages[this.page].slides.includes(i)?(i.el.classList.contains(e)||(T(i.el,e),this.emit("selectSlide",i)),i.el.removeAttribute(t)):(i.el.classList.contains(e)&&(O(i.el,e),this.emit("unselectSlide",i)),i.el.setAttribute(t,"true")))}flipInfiniteTrack(){const t=this.panzoom;if(!t||!this.isInfinite)return;const e="x"===this.option("axis")?"e":"f",{viewportDim:i,contentDim:n}=this;let s=t.current[e],o=t.target[e]-s,a=0,r=.5*i,l=n;this.isRTL&&this.isHorizontal?(s<-r&&(a=-1,s+=l),s>l-r&&(a=1,s-=l)):(s>r&&(a=1,s-=l),s<-l+r&&(a=-1,s+=l)),a&&(t.current[e]=s,t.target[e]=s+o)}lazyLoadSlide(t){const e=this,n=t&&t.el;if(!n)return;const s=new Set;n.querySelectorAll("[data-lazy-srcset]").forEach((t=>{t instanceof HTMLImageElement&&s.add(t)})),n.querySelectorAll("[data-lazy-src]").forEach((t=>{t instanceof HTMLImageElement?s.add(t):w(t)&&(t.style.backgroundImage=`url('${t.dataset.lazySrc||""}')`)}));const o=(t,i,n)=>{n&&(n.remove(),n=null),i.complete&&(i.style.display=""),this.option("adaptiveHeight")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&e.setViewportHeight()};for(const e of s){let n=null;e.src=e.dataset.lazySrcset||e.dataset.lazySrc||"",delete e.dataset.lazySrc,delete e.dataset.lazySrcset,e.style.display="none",e.addEventListener("error",(()=>{o(t,e,n)})),e.addEventListener("load",(()=>{o(t,e,n)})),setTimeout((()=>{!e.complete&&e.parentNode&&t.el&&(n=i(y),e.parentNode.insertBefore(n,e))}),300)}let a=n.dataset.lazySrc;a&&a.length&&(n.style.backgroundImage=`url('${a}')`)}clearTransitions(){this.inTransition.clear(),O(this.container,this.cn("inTransition"));const t=["to-prev","to-next","from-prev","from-next"];for(const e of this.slides){const i=e.el;if(i){i.removeEventListener("animationend",this.onAnimationEnd),i.classList.remove(...t);const n=e.transition;n&&i.classList.remove(`f-${n}Out`,`f-${n}In`)}}this.manageSlideVisiblity()}onAnimationEnd(t){const e=t.target,i=e?parseInt(e.dataset.index||"",10)||0:-1,n=this.slides[i],s=t.animationName;if(!e||!n||!s)return;const o=!!this.inTransition.has(i)&&n.transition;o&&s.substring(0,o.length+2)===`f-${o}`&&this.inTransition.delete(i),this.inTransition.size||this.clearTransitions(),i===this.page&&this.emit("settle")}onDecel(t,e=0,i=0){const n=this.isInfinite,s=this.isHorizontal?e:i,o=this.pages.length;if(!o)return;const a=this.option("dragFree");let r=this.page,l=0;const c=this.axis;!n&&(t.target[c],this.viewportDim);const h=t.current[c]*(this.isRTL&&this.isHorizontal?1:-1);let{pageIndex:d}=this.getPageFromPosition(h);if(a||Math.abs(s)<10){const e=t.target[c]*(this.isRTL&&this.isHorizontal?1:-1),{pageIndex:i}=this.getPageFromPosition(e);r=i}else r=this.isRTL&&this.isHorizontal?s<0?d-1:d+1:s<0?d+1:d-1,n||(r=Math.max(0,Math.min(r,this.pages.length-1)));if(n&&(l=Math.floor(r/o)||0),r=(r%o+o)%o,a&&t.dragOffset["e"===c?"x":"y"]);else{const e=this.contentDim;let i=(this.pages[r].pos+l*e)*(this.isRTL&&this.isHorizontal?1:-1);if(Math.abs(t.target[c]-i)<.1&&t.lockedAxis===("e"==c?"y":"x"))return;if(t.target[c]===i)return;t.applyChange({panX:this.isHorizontal?i-t.target.e:0,panY:this.isHorizontal?0:i-t.target.f,friction:t.option("decelFriction")})}r!==this.page&&this.onChange(r)}onClick(t){const e=t.target,i=e&&w(e)?e.dataset:null;let n;i&&(void 0!==i.carouselPage?n="slideTo":void 0!==i.carouselNext?n="slideNext":void 0!==i.carouselPrev&&(n="slidePrev")),n?(t.preventDefault(),t.stopPropagation(),e&&!e.hasAttribute("disabled")&&this[n](i&&"slideTo"===n?i.carouselPage:void 0)):this.emit("click",t)}onSlideTo(t){const e=t.detail||0;this.slideTo(this.getPageForSlide(e),{friction:0})}onChange(t,e=0){const i=this.page;this.prevPage=i,this.page=t,this.option("adaptiveHeight")&&this.setViewportHeight(),this.emit("change",t,i,e)}onRefresh(t,e=""){let i=this.contentDim,n=this.viewportDim;this.updateMetrics(),this.contentDim===i&&this.viewportDim===n||this.slideTo(this.page,{friction:0,transition:!1})}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(){this.flipInfiniteTrack(),this.manageSlideVisiblity()}onEndAnimation(){this.emit("settle")}reInit(t=null,e=null){this.destroy(),this.state=L.Init,this.userOptions=t||this.userOptions,this.userPlugins=e||this.userPlugins,this.processOptions()}slideTo(t=0,{friction:e=this.option("friction"),transition:i=this.option("transition")}={}){const n=this.panzoom,s=this.pages.length;if(!n||!s)return;if(this.transitionTo(t,i))return;const o=this.axis,a=this.getPageFromIndex(t);let r=this.pages[a].pos,l=0;if(this.isInfinite){const t=n.current[o]*(this.isRTL&&this.isHorizontal?1:-1),e=this.contentDim,i=r+e,s=r-e;Math.abs(t-i){t.el&&(s=Math.max(s,t.el.offsetHeight))}))),i.style.height=s?`${s}px`:""}getPageForSlide(t){for(const e of this.pages)for(const i of e.slides)if(i.index===t)return e.index;return-1}getVisibleSlides(e=0){var i;const n=new Set;let{contentDim:s,viewportDim:o,pages:a,page:r}=this;s=s+(null===(i=this.slides[this.slides.length-1])||void 0===i?void 0:i.gap)||0;let l=0;l=this.panzoom?-1*this.panzoom.current[this.axis]:a[r]&&a[r].pos||0,this.isInfinite&&(l-=Math.floor(l/s)*s),this.isRTL&&this.isHorizontal&&(l*=-1),l=t(l,1e3);const c=t(l-o*e,1e3),h=t(l+o*(e+1),1e3),d=this.isInfinite?[-1,0,1]:[0];for(const t of this.slides)for(const e of d){const i=t.pos+e*s,o=t.pos+t.dim+t.gap+e*s;ic&&n.add(t)}return n}getPageFromPosition(t){const{viewportDim:e,contentDim:i}=this,n=this.pages.length;let s=0,o=0;const a=this.option("center");a&&(t+=.5*e),this.isInfinite||(t=Math.max(this.slides[0].pos,Math.min(t,this.slides[this.slides.length-1].pos)));const r=i+this.slides[this.slides.length-1].gap,l=Math.floor(t/r)||0;t-=l*r;let c=this.slides[this.slides.length-1],h=this.slides.find((e=>{const i=t+(c&&!a?.5*c.dim:0);return c=e,e.pos<=i&&e.pos+e.dim+e.gap>i}));return h||(h=this.slides[this.slides.length-1]),o=this.getPageForSlide(h.index),s=o+l*n,{page:s,pageIndex:o}}destroy(){if([L.Destroy].includes(this.state))return;this.state=L.Destroy;const{container:t,viewport:e,track:i,slides:n,panzoom:s}=this,o=this.option("classes");t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),t.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),s&&(s.destroy(),this.panzoom=null),n&&n.forEach((t=>{this.removeSlideEl(t)})),this.detachPlugins(),this.track=null,this.viewport=null,this.page=0,e&&i&&e.replaceWith(...i.childNodes);for(const[e,i]of Object.entries(o))"container"!==e&&i&&t.classList.remove(i);this.slides=[];const a=this.events.get("ready");this.events=new Map,a&&this.events.set("ready",a)}}Object.defineProperty(B,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:P}),Object.defineProperty(B,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:A}),Object.defineProperty(B,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:H});const _=!("undefined"==typeof window||!window.document||!window.document.createElement);let N;const W=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","),X={dragToClose:!0,hideScrollbar:!0,Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},contentClick:"toggleZoom",contentDblClick:!1,backdropClick:"close",animated:!0,idle:3500,showClass:"f-zoomInUp",hideClass:"f-fadeOut",commonCaption:!1,parentEl:null,startIndex:0,l10n:Object.assign(Object.assign({},b),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),tpl:{closeButton:'',main:''},groupAll:!1,groupAttr:"data-fancybox",defaultType:"image",defaultDisplay:"block",autoFocus:!0,trapFocus:!0,placeFocusBack:!0,closeButton:"auto",keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"next",ArrowDown:"prev",ArrowRight:"next",ArrowLeft:"prev"},Fullscreen:{autoStart:!1},compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,wheel:"zoom"};var $,Y;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Closing=2]="Closing",t[t.CustomClosing=3]="CustomClosing",t[t.Destroy=4]="Destroy"}($||($={})),function(t){t[t.Loading=0]="Loading",t[t.Opening=1]="Opening",t[t.Ready=2]="Ready",t[t.Closing=3]="Closing"}(Y||(Y={}));const q=()=>{queueMicrotask((()=>{(()=>{const{slug:t,index:e}=Z.parseURL(),i=vt.getInstance();if(i&&!1!==i.option("Hash")){const n=i.carousel;if(t&&n){for(let e of n.slides)if(e.slug&&e.slug===t)return n.slideTo(e.index);if(t===i.option("slug"))return n.slideTo(e-1);const s=i.getSlide(),o=s&&s.triggerEl&&s.triggerEl.dataset;if(o&&o.fancybox===t)return n.slideTo(e-1)}Z.hasSilentClose=!0,i.close()}Z.startFromUrl()})()}))};class Z extends k{constructor(){super(...arguments),Object.defineProperty(this,"origHash",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null})}onChange(){const t=this.instance,e=t.carousel;this.timer&&clearTimeout(this.timer);const i=t.getSlide();if(!e||!i)return;const n=t.isOpeningSlide(i),s=new URL(document.URL).hash;let o,a=i.slug||void 0;o=a||this.instance.option("slug"),!o&&i.triggerEl&&i.triggerEl.dataset&&(o=i.triggerEl.dataset.fancybox);let r="";o&&"true"!==o&&(r="#"+o+(!a&&e.slides.length>1?"-"+(i.index+1):"")),n&&(this.origHash=s!==r?s:""),r&&s!==r&&(this.timer=setTimeout((()=>{try{window.history[n?"pushState":"replaceState"]({},document.title,window.location.pathname+window.location.search+r)}catch(t){}}),300))}onClose(){if(this.timer&&clearTimeout(this.timer),!0!==Z.hasSilentClose)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(this.origHash||""))}catch(t){}}attach(){this.instance.on("Carousel.ready",this.onChange),this.instance.on("Carousel.change",this.onChange),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.ready",this.onChange),this.instance.off("Carousel.change",this.onChange),this.instance.off("close",this.onClose)}static parseURL(){const t=window.location.hash.slice(1),e=t.split("-"),i=e[e.length-1],n=i&&/^\+?\d+$/.test(i)&&parseInt(e.pop()||"1",10)||1;return{hash:t,slug:e.join("-"),index:n}}static startFromUrl(){if(Z.hasSilentClose=!1,vt.getInstance()||!1===vt.defaults.Hash)return;const{hash:t,slug:e,index:i}=Z.parseURL();if(!e)return;let n=document.querySelector(`[data-slug="${t}"]`);if(n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),vt.getInstance())return;const s=document.querySelectorAll(`[data-fancybox="${e}"]`);s.length&&(n=s[i-1],n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))}static destroy(){window.removeEventListener("hashchange",q,!1)}}function V(){window.addEventListener("hashchange",q,!1),setTimeout((()=>{Z.startFromUrl()}),500)}Object.defineProperty(Z,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(Z,"hasSilentClose",{enumerable:!0,configurable:!0,writable:!0,value:!1}),_&&(/complete|interactive|loaded/.test(document.readyState)?V():document.addEventListener("DOMContentLoaded",V));const G=t=>new Promise(((e,i)=>{const n=new Image;n.onload=e,n.onerror=i,n.src=t}));class U extends k{onCreateSlide(t,e,i){const n=this.instance,s=n.optionFor(i,"src")||"",{el:o,type:a}=i;o&&"image"===a&&"string"==typeof s&&this.setContent(i,s).then((t=>{if(n.isClosing())return;const e=i.contentEl,s=i.imageEl,o=i.thumbElSrc,a=this.optionFor(i,"initialSize"),r=this.optionFor(i,"zoom"),l={event:"mousemove"===t.panMode?n.prevMouseMoveEvent||n.options.event:void 0,friction:r?.12:0};if(e&&s&&o&&n.isOpeningSlide(i)&&this.getZoomInfo(i)){let t=document.createElement("img");T(t,"fancybox-ghost"),e.appendChild(t),t.src=o,s.naturalWidth<2e3&&s.naturalHeight<2e3&&setTimeout((()=>{n.animate(t,"f-fadeFastOut",(()=>{t&&(t.remove(),t=null)}))}),300),G(o).then((()=>{i.state=Y.Opening,this.instance.emit("reveal",i),this.zoomIn(i).then((()=>{t&&(t.remove(),t=null),this.instance.done(i)}),(()=>{n.hideLoading(i)}))}),(()=>{n.hideLoading(i),n.revealContent(i)}))}else{let e=n.optionFor(i,"showClass")||void 0,s=!0;n.isOpeningSlide(i)&&("full"===a?t.zoomToFull(l):"cover"===a?t.zoomToCover(l):"max"===a?t.zoomToMax(l):s=!1,t.stop("current")),s&&e&&(e="f-fadeIn"),n.revealContent(i,e)}}),(()=>{n.setError(i,"{{IMAGE_ERROR}}")}))}onRemoveSlide(t){t.panzoom&&t.panzoom.destroy(),t.panzoom=void 0,t.imageEl=void 0}onChange(t,e,i,n){for(const t of e.slides){const e=t.panzoom;e&&t.index!==i&&e.reset(.15)}}onClose(){const t=this.instance,e=t.container,i=t.getSlide();if(!e||!e.parentElement||!i)return;const{el:n,contentEl:s,panzoom:o}=i,a=i.thumbElSrc;if(!n||!a||!s||!o||o.isContentLoading||o.state===f.Init||o.state===f.Destroy)return;o.updateMetrics();let r=this.getZoomInfo(i);if(!r)return;this.instance.state=$.CustomClosing,n.classList.remove("is-zooming-in"),n.classList.add("is-zooming-out"),s.style.backgroundImage=`url('${a}')`,G(a).then((()=>{n.classList.add("hide-image")}),(()=>{}));const l=e.getBoundingClientRect();Object.assign(e.style,{position:"absolute",top:`${window.pageYOffset}px`,left:`${window.pageXOffset}px`,bottom:"auto",right:"auto",width:`${l.width}px`,height:`${l.height}px`});const{x:c,y:h,scale:d,opacity:u}=r;if(u){const t=((t,e,i,n)=>{const s=e-t,o=n-i;return e=>i+((e-t)/s*o||0)})(o.scale,d,1,0);o.on("afterTransform",(()=>{s.style.opacity=t(o.scale)+""}))}o.on("endAnimation",(()=>{t.destroy()})),o.target.a=d,o.target.b=0,o.target.c=0,o.target.d=d,o.panTo({x:c,y:h,scale:d,friction:u?.2:.33,ignoreBounds:!0}),o.isResting&&t.destroy()}setContent(t,e){return new Promise(((i,n)=>{const s=this.instance,o=t.el;if(!o)return void n();s.showLoading(t);const a=document.createElement("img");if(a.classList.add("fancybox-image"),a.src=e||"",t.imageEl=a,s.setContent(t,a,!1),this.option("protected")){o.addEventListener("contextmenu",(t=>{t.preventDefault()}));const e=t.contentEl;if(e){const t=document.createElement("div");T(t,"fancybox-protected"),e.append(t)}}t.panzoom=new P(o,d({},this.option("Panzoom")||{},{content:a,width:s.optionFor(t,"width","auto"),height:s.optionFor(t,"height","auto"),wheel:()=>{const t=s.option("wheel");return("zoom"===t||"pan"==t)&&t},click:(e,i)=>{var n;if(s.isCompact||s.isClosing())return!1;let o=!i||i.target&&(null===(n=t.contentEl)||void 0===n?void 0:n.contains(i.target));return s.option(o?"contentClick":"backdropClick")||!1},dblClick:()=>s.isCompact?"toggleZoom":s.option("contentDblClick")||!1,spinner:!1,panOnlyZoomed:!0,wheelLimit:1/0,transformParent:!0,on:{ready:t=>{i(t)},error:()=>{n()},destroy:()=>{n()}}}))}))}zoomIn(t){return new Promise(((e,i)=>{const{panzoom:n,contentEl:s,el:o}=t,a=this.getZoomInfo(t);if(!(a&&o&&s&&n))return void i();const{x:r,y:l,scale:c,opacity:h}=a,d=()=>{t.state!==Y.Closing&&(h&&(s.style.opacity=Math.max(Math.min(1,1-(1-n.scale)/(1-c)),0)+""),n.scale>=1&&n.scale>n.targetScale-.1&&e(n))},u=t=>{t.scale<.99||(o.classList.remove("is-zooming-in"),t.off("endAnimation",u),t.off("touchStart",u),t.off("afterTransform",d),e(t))};n.on("endAnimation",u),n.on("touchStart",u),n.on("afterTransform",d),n.on(["error","destroy"],(()=>{i()})),n.panTo({x:r,y:l,scale:c,friction:0,ignoreBounds:!0}),n.stop("current");const p=this.instance,m={event:"mousemove"===n.panMode?p.prevMouseMoveEvent||p.options.event:void 0},f=this.optionFor(t,"initialSize");T(o,"is-zooming-in"),p.hideLoading(t),"full"===f?n.zoomToFull(m):"cover"===f?n.zoomToCover(m):"max"===f?n.zoomToMax(m):n.reset(.2)}))}getZoomInfo(t){const{el:e,imageEl:i,thumbEl:n,panzoom:s}=t;if(!e||!i||!n||!s||(t=>{const e=window.pageYOffset,i=window.pageYOffset+window.innerHeight;if(!w(t))return 0;const n=t.getBoundingClientRect(),s=n.y+window.pageYOffset,o=n.y+n.height+window.pageYOffset;if(e>o||io)return 100;if(si)return 100;let a=n.height;si&&(a-=o-i);const r=a/window.innerHeight*100;return Math.round(r)})(n)<5||!this.optionFor(t,"zoom")||this.instance.state===$.Destroy)return!1;const{top:o,left:a,width:r,height:l}=n.getBoundingClientRect();let{top:c,left:h,fitWidth:d,fitHeight:u}=s.contentRect;if(!(r&&l&&d&&u))return!1;const p=r/d,m=s.container.getBoundingClientRect();c+=m.top,h+=m.left;const f=-1*(h+.5*d-(a+.5*r)),g=-1*(c+.5*u-(o+.5*l));let b=this.option("zoomOpacity")||!1;return"auto"===b&&(b=Math.abs(r/l-d/u)>.1),{x:f,y:g,scale:p,opacity:b}}attach(){this.instance.on("Carousel.change",this.onChange),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.change",this.onChange),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("close",this.onClose)}}Object.defineProperty(U,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}});const K=(t,e={})=>{const i=new URL(t),n=new URLSearchParams(i.search),s=new URLSearchParams;for(const[t,i]of[...n,...Object.entries(e)]){let e=i.toString();"t"===t?s.set("start",parseInt(e).toString()):s.set(t,e)}let o=s.toString(),a=t.match(/#t=((.*)?\d+s)/);return a&&(o+=`#t=${a[1]}`),o},J={ajax:null,autoSize:!0,preload:!0,videoAutoplay:!0,videoRatio:16/9,videoTpl:'',videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,rel:0,fs:1}},Q=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo","video"];class tt extends k{onInitSlides(t,e){for(const t of e.slides)this.processType(t)}onCreateSlide(t,e,i){this.setContent(i)}onRemoveSlide(t,e,i){i.closeBtnEl&&(i.closeBtnEl.remove(),i.closeBtnEl=void 0),i.xhr&&(i.xhr.abort(),i.xhr=null),i.iframeEl&&(i.iframeEl.onload=i.iframeEl.onerror=null,i.iframeEl.src="//about:blank",i.iframeEl=null);const n=i.contentEl,s=i.placeholderEl;if("inline"===i.type&&n&&s)n.classList.remove("fancybox__content"),"none"!==n.style.display&&(n.style.display="none"),s.parentNode&&s.parentNode.insertBefore(n,s),s.remove(),i.placeholderEl=null;else for(;i.el&&i.el.firstChild;)i.el.removeChild(i.el.firstChild)}onSelectSlide(t,e,i){i.state===Y.Ready&&this.playVideo()}onUnselectSlide(t,e,i){var n,s;if("html5video"===i.type){try{null===(s=null===(n=i.el)||void 0===n?void 0:n.querySelector("video"))||void 0===s||s.pause()}catch(t){}return}let o;"vimeo"===i.type?o={method:"pause",value:"true"}:"youtube"===i.type&&(o={event:"command",func:"pauseVideo"}),o&&i.iframeEl&&i.iframeEl.contentWindow&&i.iframeEl.contentWindow.postMessage(JSON.stringify(o),"*"),i.poller&&clearTimeout(i.poller)}onDone(t,e){t.isCurrentSlide(e)&&!t.isClosing()&&this.playVideo()}onRefresh(t,e){e.slides.forEach((t=>{t.el&&(this.setAspectRatio(t),this.resizeIframe(t))}))}onMessage(t){try{let e=JSON.parse(t.data);if("https://player.vimeo.com"===t.origin){if("ready"===e.event)for(let e of Array.from(document.getElementsByClassName("fancybox__iframe")))e instanceof HTMLIFrameElement&&e.contentWindow===t.source&&(e.dataset.ready="true")}else if("https://www.youtube-nocookie.com"===t.origin&&"onReady"===e.event){const t=document.getElementById(e.id);t&&(t.dataset.ready="true")}}catch(t){}}loadAjaxContent(t){const e=this.instance.optionFor(t,"src")||"";this.instance.showLoading(t);const i=this.instance,n=new XMLHttpRequest;i.showLoading(t),n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&i.state===$.Ready&&(i.hideLoading(t),200===n.status?i.setContent(t,n.responseText):i.setError(t,404===n.status?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const s=t.ajax||null;n.open(s?"POST":"GET",e+""),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send(s),t.xhr=n}setInlineContent(t){let e=null;if(w(t.src))e=t.src;else if("string"==typeof t.src){const i=t.src.split("#",2).pop();e=i?document.getElementById(i):null}if(e){if("clone"===t.type||e.dataset.placeholderId){e=e.cloneNode(!0);const i=e.dataset.animationName;i&&(e.classList.remove(i),delete e.dataset.animationName),delete e.dataset.placeholderId;let n=e.getAttribute("id");n=n?`${n}--clone`:`clone-${this.instance.id}-${t.index}`,e.setAttribute("id",n)}else if(e.parentNode){const i=document.createElement("div");i.classList.add("fancybox-placeholder"),e.parentNode.insertBefore(i,e),t.placeholderEl=i}this.instance.setContent(t,e)}else this.instance.setError(t,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(t){const{src:e,el:i}=t;if(!e||"string"!=typeof e||!i)return;const n=this.instance,s=document.createElement("iframe");s.className="fancybox__iframe",s.setAttribute("id",`fancybox__iframe_${n.id}_${t.index}`),s.setAttribute("allow","autoplay; fullscreen"),s.setAttribute("scrolling","auto"),s.onerror=()=>{n.setError(t,"{{IFRAME_ERROR}}")},t.iframeEl=s;const o=this.optionFor(t,"preload");if(i.classList.add("is-loading"),"iframe"!==t.type||!1===o)return s.setAttribute("src",t.src+""),this.resizeIframe(t),void n.setContent(t,s);n.showLoading(t),s.onload=()=>{if(!s.src.length)return;const e="true"!==s.dataset.ready;s.dataset.ready="true",this.resizeIframe(t),e?n.revealContent(t):n.hideLoading(t)},s.setAttribute("src",e),n.setContent(t,s,!1)}resizeIframe(t){const e=t.iframeEl,i=null==e?void 0:e.parentElement;if(!e||!i)return;let n=t.autoSize,s=t.width||0,o=t.height||0;s&&o&&(n=!1);const a=i&&i.style;if(!1!==t.preload&&!1!==n&&a)try{const t=window.getComputedStyle(i),n=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),r=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),l=e.contentWindow;if(l){const t=l.document,e=t.getElementsByTagName("html")[0],i=t.body;a.width="",i.style.overflow="hidden",s=s||e.scrollWidth+n,a.width=`${s}px`,i.style.overflow="",a.flex="0 0 auto",a.height=`${i.scrollHeight}px`,o=e.scrollHeight+r}}catch(t){}if(s||o){const t={flex:"0 1 auto",width:"",height:""};s&&(t.width=`${s}px`),o&&(t.height=`${o}px`),Object.assign(a,t)}}playVideo(){const t=this.instance.getSlide();if(!t)return;const{el:e}=t;if(!e||!e.offsetParent)return;if(!this.optionFor(t,"videoAutoplay"))return;if("html5video"===t.type)try{const t=e.querySelector("video");if(t){const e=t.play();void 0!==e&&e.then((()=>{})).catch((e=>{t.muted=!0,t.play()}))}}catch(t){}if("youtube"!==t.type&&"vimeo"!==t.type)return;const i=()=>{if(t.iframeEl&&t.iframeEl.contentWindow){let e;if("true"===t.iframeEl.dataset.ready)return e="youtube"===t.type?{event:"command",func:"playVideo"}:{method:"play",value:"true"},e&&t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"),void(t.poller=void 0);"youtube"===t.type&&(e={event:"listening",id:t.iframeEl.getAttribute("id")},t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"))}t.poller=setTimeout(i,250)};i()}processType(t){if(t.html)return t.type="html",t.src=t.html,void(t.html="");const e=this.instance.optionFor(t,"src","");if(!e||"string"!=typeof e)return;let i=t.type,n=null;if(n=e.match(/(?:youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const s=K(e,this.optionFor(t,"youtube")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://www.youtube-nocookie.com/embed/${o}?${s}`,t.thumbSrc=t.thumbSrc||`https://i.ytimg.com/vi/${o}/mqdefault.jpg`,i="youtube"}else if(n=e.match(/^.+vimeo.com\/(?:\/)?([\d]+)(.*)?/)){const s=K(e,this.optionFor(t,"vimeo")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://player.vimeo.com/video/${o}?${s}`,i="vimeo"}if(!i&&t.triggerEl){const e=t.triggerEl.dataset.type;Q.includes(e)&&(i=e)}i||"string"==typeof e&&("#"===e.charAt(0)?i="inline":(n=e.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(i="html5video",t.videoFormat=t.videoFormat||"video/"+("ogv"===n[1]?"ogg":n[1])):e.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?i="image":e.match(/\.(pdf)((\?|#).*)?$/i)?i="pdf":(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src=`https://maps.google.${n[1]}/?ll=${(n[2]?n[2]+"&z="+Math.floor(parseFloat(n[3]))+(n[4]?n[4].replace(/^\//,"&"):""):n[4]+"").replace(/\?/,"&")}&output=${n[4]&&n[4].indexOf("layer=c")>0?"svembed":"embed"}`,i="map"):(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src=`https://maps.google.${n[1]}/maps?q=${n[2].replace("query=","q=").replace("api=1","")}&output=embed`,i="map")),t.type=i||this.instance.option("defaultType")}setContent(t){const e=this.instance.optionFor(t,"src")||"";if(t&&t.type&&e){switch(t.type){case"html":this.instance.setContent(t,e);break;case"html5video":const i=this.option("videoTpl");i&&this.instance.setContent(t,i.replace(/\{\{src\}\}/gi,e+"").replace(/\{\{format\}\}/gi,this.optionFor(t,"videoFormat")||"").replace(/\{\{poster\}\}/gi,t.poster||t.thumbSrc||""));break;case"inline":case"clone":this.setInlineContent(t);break;case"ajax":this.loadAjaxContent(t);break;case"pdf":case"map":case"youtube":case"vimeo":t.preload=!1;case"iframe":this.setIframeContent(t)}this.setAspectRatio(t)}}setAspectRatio(t){var e;const i=t.contentEl,n=this.optionFor(t,"videoRatio"),s=null===(e=t.el)||void 0===e?void 0:e.getBoundingClientRect();if(!(i&&s&&n&&1!==n&&t.type&&["video","youtube","vimeo","html5video"].includes(t.type)))return;const o=s.width,a=s.height;i.style.aspectRatio=n+"",i.style.width=o/a>n?"auto":"",i.style.height=o/a>n?"":"auto"}attach(){this.instance.on("Carousel.initSlides",this.onInitSlides),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("Carousel.selectSlide",this.onSelectSlide),this.instance.on("Carousel.unselectSlide",this.onUnselectSlide),this.instance.on("Carousel.Panzoom.refresh",this.onRefresh),this.instance.on("done",this.onDone),window.addEventListener("message",this.onMessage)}detach(){this.instance.off("Carousel.initSlides",this.onInitSlides),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("Carousel.selectSlide",this.onSelectSlide),this.instance.off("Carousel.unselectSlide",this.onUnselectSlide),this.instance.off("Carousel.Panzoom.refresh",this.onRefresh),this.instance.off("done",this.onDone),window.removeEventListener("message",this.onMessage)}}Object.defineProperty(tt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:J});class et extends k{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:"ready"}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return"ready"!==this.state}onReady(t){this.option("autoStart")&&(t.isInfinite||t.page{this.timer=null,this.inHover||this.onTimerEnd()}),e),t.style.transitionDuration=`${e}ms`,t.style.transform="scaleX(1)"}this.emit("set")}clear(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.removeProgressBar()}start(){if(this.set(),this.option("pauseOnHover")){const t=this.instance.container;t.addEventListener("mouseenter",this.onMouseEnter,!1),t.addEventListener("mouseleave",this.onMouseLeave,!1)}document.addEventListener("visibilitychange",this.onVisibilityChange,!1)}stop(){const t=this.instance.container;this.clear(),this.state="ready",t.removeEventListener("mouseenter",this.onMouseEnter,!1),t.removeEventListener("mouseleave",this.onMouseLeave,!1),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),O(t,"has-autoplay"),this.emit("stop")}pause(){"play"===this.state&&(this.state="pause",this.clear(),this.emit("pause"))}resume(){const t=this.instance;if(t.isInfinite||t.page!==t.pages.length-1)if("play"!==this.state){if("pause"===this.state&&!this.inHover){const t=new Event("resume",{bubbles:!0,cancelable:!0});this.emit("resume",event),t.defaultPrevented||this.set()}}else this.set();else this.stop()}toggle(){"play"===this.state||"pause"===this.state?this.stop():this.set()}attach(){this.instance.on("ready",this.onReady),this.instance.on("Panzoom.startAnimation",this.onChange),this.instance.on("Panzoom.endAnimation",this.onSettle),this.instance.on("Panzoom.touchMove",this.onChange)}detach(){this.instance.off("ready",this.onReady),this.instance.off("Panzoom.startAnimation",this.onChange),this.instance.off("Panzoom.endAnimation",this.onSettle),this.instance.off("Panzoom.touchMove",this.onChange),this.stop()}}Object.defineProperty(et,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class it extends k{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(t){const e=t.carousel;if(!e)return;const i=t.container;i&&(e.options.Autoplay=d(this.option("Autoplay")||{},{pauseOnHover:!1,autoStart:!1,timeout:this.option("timeout"),progressParentEl:()=>i.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]")||i,on:{set:e=>{var n;i.classList.add("has-slideshow"),(null===(n=t.getSlide())||void 0===n?void 0:n.state)!==Y.Ready&&e.pause()},stop:()=>{i.classList.remove("has-slideshow"),t.isCompact||t.endIdle()},resume:(e,i)=>{var n,s,o;!i||!i.cancelable||(null===(n=t.getSlide())||void 0===n?void 0:n.state)===Y.Ready&&(null===(o=null===(s=t.carousel)||void 0===s?void 0:s.panzoom)||void 0===o?void 0:o.isResting)||i.preventDefault()}}}),e.attachPlugins({Autoplay:et}),this.ref=e.plugins.Autoplay)}onReady(t){const e=t.carousel,i=this.ref;e&&i&&this.option("playOnStart")&&(e.isInfinite||e.page{t.isCurrentSlide(e)&&i.stop()})),t.isCurrentSlide(e)&&i.resume()}onKeydown(t,e){var i;const n=this.ref;n&&e===this.option("key")&&"BUTTON"!==(null===(i=document.activeElement)||void 0===i?void 0:i.nodeName)&&n.toggle()}attach(){this.instance.on("Carousel.init",this.onPrepare),this.instance.on("Carousel.ready",this.onReady),this.instance.on("done",this.onDone),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onPrepare),this.instance.off("Carousel.ready",this.onReady),this.instance.off("done",this.onDone),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(it,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{key:" ",playOnStart:!1,timeout:3e3}});const nt={classes:{container:"f-thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'',type:"modern"};var st;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden",t[t.Disabled=3]="Disabled"}(st||(st={}));let ot=class extends k{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"shouldCenter",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:st.Init})}formatThumb(t,e){return this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}getSlides(){const t=[],e=this.option("thumbTpl")||"";if(e)for(const i of this.instance.slides||[])t.push({html:this.formatThumb(i,e),customClass:`has-thumb for-${i.type||"image"}`});return t}getProgress(t){const e=this.instance,i=e.panzoom,n=e.pages[t]||0;if(!n||!i)return 0;let s=-1*i.current.e,o=e.contentDim,a=(s-n.pos)/(1*n.dim),r=(s+o-n.pos)/(1*n.dim),l=(s-o-n.pos)/(1*n.dim);return a=Math.max(0,Math.min(1,Math.abs(a))),r=Math.max(0,Math.min(1,Math.abs(r))),l=Math.max(0,Math.min(1,Math.abs(l))),a=Math.min(a,r,l),a}onInitSlide(t,e){const i=e.el;i&&(e.thumbSrc=i.dataset.thumbSrc||e.thumbSrc||"",e.thumbClipWidth=parseFloat(i.dataset.thumbClipWidth||"")||e.thumbClipWidth||0,e.thumbHeight=parseFloat(i.dataset.thumbHeight||"")||e.thumbHeight||0)}onInitSlides(){this.state===st.Init&&this.build()}onRefreshM(){this.refreshModern()}onChangeM(){"modern"===this.type&&(this.shouldCenter=!0,this.centerModern())}onClickModern(t){t.preventDefault(),t.stopPropagation();const e=this.instance,i=e.page,n=t=>{if(t){const e=t.closest("[data-carousel-page]");if(e)return parseInt(e.dataset.carouselPage||"",10)||0}return-1},s=(t,e)=>{const i=document.elementFromPoint(t,e);return i?n(i):-1};let o=n(t.target);o<0&&(o=s(t.clientX+this.thumbGap,t.clientY),o===i&&(o=i-1)),o<0&&(o=s(t.clientX-this.thumbGap,t.clientY),o===i&&(o=i+1)),o<0&&(o=(e=>{let n=s(t.clientX-e,t.clientY),a=s(t.clientX+e,t.clientY);return o<0&&n===i&&(o=i+1),o<0&&a===i&&(o=i-1),o})(this.thumbExtraGap)),o===i?this.centerModern():o>-1&&o{this.emit("ready")}))}buildModern(){if("modern"!==this.type)return;const{container:t,track:e,instance:n}=this,s=this.option("thumbTpl")||"";if(!t||!e||!s)return;this.updateModern();for(const t of n.slides||[]){const n=document.createElement("div");T(n,this.cn("slide")),n.appendChild(i(this.formatThumb(t,s))),t.thumbSlideEl=n,e.appendChild(n),this.resizeModernSlide(t)}const o=new n.constructor.Panzoom(t,{content:e,lockAxis:"x",zoom:!1,panOnlyZoomed:!1,bounds:()=>{let t=0,e=0,i=n.slides[0],s=n.slides[n.slides.length-1],o=n.slides[n.page];return i&&s&&o&&(e=-1*this.getModernThumbPos(0),0!==n.page&&(e+=.5*(i.thumbWidth||0)),t=-1*this.getModernThumbPos(n.slides.length-1),n.page!==n.slides.length-1&&(t+=(s.thumbWidth||0)-(o.thumbWidth||0)-.5*(s.thumbWidth||0))),{x:{min:t,max:e},y:{min:0,max:0}}}});o.on("touchStart",(()=>{this.shouldCenter=!1})),o.on("click",((t,e)=>this.onClickModern(e))),o.on("ready",(()=>{this.centerModern(),this.emit("ready")})),o.on(["afterTransform","refresh"],(t=>{this.lazyLoadModern()})),this.panzoom=o,this.refreshModern()}updateModern(){if("modern"!==this.type)return;const{container:t}=this;t&&(this.thumbGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-gap"))||0,this.thumbExtraGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-extra-gap"))||0,this.thumbWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-width"))||40,this.thumbClipWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-clip-width"))||40,this.thumbHeight=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-height"))||40)}refreshModern(){var t;if("modern"===this.type){this.updateModern();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.onTransformM(),null===(t=this.panzoom)||void 0===t||t.updateMetrics(!0),this.centerModern(0)}}centerModern(e){const i=this.instance,{container:n,panzoom:s}=this;if(!n||!s||s.state===f.Init)return;const o=i.page;let a=this.getModernThumbPos(o),r=a;for(let t=i.page-3;ti.pages.length-1||t===i.page)continue;const e=1-this.getProgress(t);e>0&&e<1&&(r+=e*(this.getModernThumbPos(t)-a))}let l=100;void 0===e&&(e=.2,i.inTransition.size>0&&(e=.12),Math.abs(-1*s.current.e-r)>s.containerRect.width&&(e=.5,l=0)),s.options.maxVelocity=l,s.applyChange({panX:t(-1*r-s.target.e,1e3),friction:null===i.prevPage?0:e})}lazyLoadModern(){const{instance:t,panzoom:e}=this;if(!e)return;const n=-1*e.current.e||0;let s=this.getModernThumbPos(t.page);if(e.state!==f.Init||0===s)for(const s of t.slides||[]){const t=s.thumbSlideEl;if(!t)continue;const o=t.querySelector("img[data-lazy-src]"),a=s.index,r=this.getModernThumbPos(a),l=n-.5*e.containerRect.innerWidth,c=l+e.containerRect.innerWidth;if(!o||rc)continue;let h=o.dataset.lazySrc;if(!h||!h.length)continue;if(delete o.dataset.lazySrc,o.src=h,o.complete)continue;T(t,this.cn("isLoading"));const d=i(y);t.appendChild(d),o.addEventListener("load",(()=>{t.offsetParent&&(t.classList.remove(this.cn("isLoading")),d.remove())}),!1)}}resizeModernSlide(t){if("modern"!==this.type)return;if(!t.thumbSlideEl)return;const e=t.thumbClipWidth&&t.thumbHeight?Math.round(this.thumbHeight*(t.thumbClipWidth/t.thumbHeight)):this.thumbWidth;t.thumbWidth=e}getModernThumbPos(e){const i=this.instance.slides[e],n=this.panzoom;if(!n||!n.contentRect.fitWidth)return 0;let s=n.containerRect.innerWidth,o=n.contentRect.width;2===this.instance.slides.length&&(e-=1,o=2*this.thumbClipWidth);let a=e*(this.thumbClipWidth+this.thumbGap)+this.thumbExtraGap+.5*(i.thumbWidth||0);return a-=o>s?.5*s:.5*o,t(a||0,1)}build(){const t=this.instance,e=t.container,i=this.option("minCount")||0;if(i){let e=0;for(const i of t.slides||[])i.thumbSrc&&e++;if(e{var e,i;this.hidden&&(null===(e=t.container)||void 0===e||e.classList.add("is-hidden"),null===(i=t.container)||void 0===i||i.setAttribute("aria-hidden","true"),queueMicrotask((()=>{this.show()})))}}}),e.attachPlugins({Thumbs:ot}),this.ref=e.plugins.Thumbs,this.option("showOnStart")||(this.ref.state=st.Hidden,this.hidden=!0))}onResize(){var t;const e=null===(t=this.ref)||void 0===t?void 0:t.container;e&&(e.style.height="")}onKeydown(t,e){const i=this.option("key");i&&i===e&&this.toggle()}toggle(){const t=this.ref;t&&t.state!==st.Disabled&&(t.state!==st.Hidden?this.hidden?this.show():this.hide():t.build())}show(){var t,e;const i=this.ref;i&&i.state!==st.Disabled&&(this.refresh(),null===(t=i.container)||void 0===t||t.removeAttribute("aria-hidden"),null===(e=i.container)||void 0===e||e.classList.remove("is-hidden"),this.hidden=!1)}hide(){var t,e;const i=this.ref;i&&(this.refresh(),null===(t=i.container)||void 0===t||t.classList.add("is-hidden"),null===(e=i.container)||void 0===e||e.setAttribute("aria-hidden","true")),this.hidden=!0}refresh(){const t=this.ref;if(!t||t.state===st.Disabled)return;const e=t.container,i=(null==e?void 0:e.firstChild)||null;e&&i&&i.childNodes.length&&(e.style.height=`${i.getBoundingClientRect().height}px`,e.offsetHeight)}attach(){this.instance.on("Carousel.init",this.onInit),this.instance.on("resize",this.onResize),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onInit),this.instance.off("resize",this.onResize),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(rt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:at});const lt={panLeft:{icon:'',change:{panX:-100}},panRight:{icon:'',change:{panX:100}},panUp:{icon:'',change:{panY:-100}},panDown:{icon:'',change:{panY:100}},zoomIn:{icon:'',action:"zoomIn"},zoomOut:{icon:'',action:"zoomOut"},toggle1to1:{icon:'',action:"toggleZoom"},toggleZoom:{icon:'',action:"toggleZoom"},iterateZoom:{icon:'',action:"iterateZoom"},rotateCCW:{icon:'',action:"rotateCCW"},rotateCW:{icon:'',action:"rotateCW"},flipX:{icon:'',action:"flipX"},flipY:{icon:'',action:"flipY"},fitX:{icon:'',action:"fitX"},fitY:{icon:'',action:"fitY"},reset:{icon:'',action:"reset"},toggleFS:{icon:'',action:"toggleFS"}};var ct;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Disabled=2]="Disabled"}(ct||(ct={}));const ht={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'
/
'},download:{tpl:''},prev:{tpl:''},next:{tpl:''},slideshow:{tpl:''},fullscreen:{tpl:''},thumbs:{tpl:''},close:{tpl:''}},parentEl:null},dt={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"};class ut extends k{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:ct.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(t){var e;if(!t.carousel)return;let i=this.option("display"),n=this.option("absolute"),s=this.option("enabled");if("auto"===s){const t=this.instance.carousel;let e=0;if(t)for(const i of t.slides)(i.panzoom||"image"===i.type)&&e++;e||(s=!1)}s||(i=void 0);let o=0;const a={left:[],middle:[],right:[]};if(i)for(const t of["left","middle","right"])for(const n of i[t]){const i=this.createEl(n);i&&(null===(e=a[t])||void 0===e||e.push(i),o++)}let r=null;if(o&&(r=this.createContainer()),r){for(const[t,e]of Object.entries(a)){const i=document.createElement("div");T(i,"fancybox__toolbar__column is-"+t);for(const t of e)i.appendChild(t);"auto"!==n||"middle"!==t||e.length||(n=!0),r.appendChild(i)}!0===n&&T(r,"is-absolute"),this.state=ct.Ready,this.onRefresh()}else this.state=ct.Disabled}onClick(t){var e,i;const n=this.instance,s=n.getSlide(),o=null==s?void 0:s.panzoom,a=t.target,r=a&&w(a)?a.dataset:null;if(!r)return;if(void 0!==r.fancyboxToggleThumbs)return t.preventDefault(),t.stopPropagation(),void(null===(e=n.plugins.Thumbs)||void 0===e||e.toggle());if(void 0!==r.fancyboxToggleFullscreen)return t.preventDefault(),t.stopPropagation(),void this.instance.toggleFullscreen();if(void 0!==r.fancyboxToggleSlideshow){t.preventDefault(),t.stopPropagation();const e=null===(i=n.carousel)||void 0===i?void 0:i.plugins.Autoplay;let s=e.isActive;return o&&"mousemove"===o.panMode&&!s&&o.reset(),void(s?e.stop():e.start())}const l=r.panzoomAction,c=r.panzoomChange;if((c||l)&&(t.preventDefault(),t.stopPropagation()),c){let t={};try{t=JSON.parse(c)}catch(t){}o&&o.applyChange(t)}else l&&o&&o[l]&&o[l]()}onChange(){this.onRefresh()}onRefresh(){const t=this.container;if(!t)return;const e=this.instance.getSlide();if(!e)return;const i=e&&e.panzoom;for(const e of t.querySelectorAll("[data-panzoom-action]"))i?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));let n=i&&i.canZoomIn(),s=i&&i.canZoomOut();this.instance.isOpeningSlide(e)||e&&e.state!==Y.Ready&&(n=s=!0);for(const e of t.querySelectorAll('[data-panzoom-action="zoomIn"]'))n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="zoomOut"]'))s?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){s||n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));const t=e.querySelector("g");t&&(t.style.display=n?"":"none")}}onDone(t,e){var i;null===(i=e.panzoom)||void 0===i||i.on("afterTransform",(()=>{this.instance.isCurrentSlide(e)&&this.onRefresh()})),this.instance.isCurrentSlide(e)&&this.onRefresh()}createContainer(){const t=this.instance.container;if(!t)return null;const e=this.option("parentEl")||t,i=document.createElement("div");return T(i,"fancybox__toolbar"),e.prepend(i),i.addEventListener("click",this.onClick,{passive:!1,capture:!0}),t&&T(t,"has-toolbar"),this.container=i,i}createEl(t){var e;const n=this.instance.carousel;if(!n)return null;if("toggleFS"===t)return null;if("fullscreen"===t&&!this.instance.fsAPI)return null;let s=null;const o=n.slides.length||0;let a=0,r=0;for(const t of n.slides)(t.panzoom||"image"===t.type)&&a++,("image"===t.type||t.downloadSrc)&&r++;if(o<2&&["infobar","prev","next"].includes(t))return s;if(void 0!==lt[t]&&!a)return null;if("download"===t&&!r)return null;if("thumbs"===t){const t=this.instance.plugins.Thumbs;if(!t||!t.isEnabled)return null}if("slideshow"===t){if(!(null===(e=this.instance.carousel)||void 0===e?void 0:e.plugins.Autoplay)||o<2)return null}if(void 0!==lt[t]){const e=lt[t];s=document.createElement("button"),s.setAttribute("title",this.instance.localize(`{{${t.toUpperCase()}}}`)),T(s,"f-button"),e.action&&(s.dataset.panzoomAction=e.action),e.change&&(s.dataset.panzoomChange=JSON.stringify(e.change)),s.appendChild(i(this.instance.localize(e.icon)))}else{const e=(this.option("items")||[])[t];e&&(s=i(this.instance.localize(e.tpl)),e.click&&s.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),"function"==typeof e.click&&e.click(t)})))}const l=null==s?void 0:s.querySelector("svg");if(l)for(const[t,e]of Object.entries(dt))l.getAttribute(t)||l.setAttribute(t,String(e));return s}removeContainer(){var t;const e=this.container;e&&e.removeEventListener("click",this.onClick,{passive:!1,capture:!0}),null===(t=this.container)||void 0===t||t.remove(),this.container=null,this.state=ct.Disabled;const i=this.instance.container;i&&O(i,"has-toolbar")}attach(){this.instance.on("Carousel.initSlides",this.onReady),this.instance.on("done",this.onDone),this.instance.on("reveal",this.onChange),this.instance.on("Carousel.change",this.onChange),this.onReady(this.instance)}detach(){this.instance.off("Carousel.initSlides",this.onReady),this.instance.off("done",this.onDone),this.instance.off("reveal",this.onChange),this.instance.off("Carousel.change",this.onChange),this.removeContainer()}}Object.defineProperty(ut,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:ht});const pt={Hash:Z,Html:tt,Images:U,Slideshow:it,Thumbs:rt,Toolbar:ut};let mt=null,ft=null;const gt=new Map;let bt=0;class vt extends m{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(t=[],e={},i={}){super(e),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:$.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fsAPI",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.onWheel=M(this.onWheel.bind(this),300),this.fsAPI=(()=>{let t,e="",i="",n="";return document.fullscreenEnabled?(e="requestFullscreen",i="exitFullscreen",n="fullscreenElement"):document.webkitFullscreenEnabled&&(e="webkitRequestFullscreen",i="webkitExitFullscreen",n="webkitFullscreenElement"),e&&(t={request:function(t){return"webkitRequestFullscreen"===e?t[e](Element.ALLOW_KEYBOARD_INPUT):t[e]()},exit:function(){return document[n]&&document[i]()},isFullscreen:function(){return document[n]}}),t})(),this.id=e.id||++bt,gt.set(this.id,this),this.userSlides=t,this.userPlugins=i,queueMicrotask((()=>{this.init()}))}init(){this.state=$.Init,this.attachPlugins(Object.assign(Object.assign({},vt.Plugins),this.userPlugins)),this.emit("init"),!0===this.option("hideScrollbar")&&(()=>{if(!_)return;if(document.body.classList.contains("compensate-for-scrollbar"))return;const t=window.innerWidth-document.documentElement.getBoundingClientRect().width;document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",`${t}px`),t&&document.body.classList.add("compensate-for-scrollbar")})(),this.initLayout();const t=()=>{this.initCarousel(this.userSlides),this.state=$.Ready,this.attachEvents(),this.emit("ready"),setTimeout((()=>{this.container&&this.container.setAttribute("aria-hidden","false")}),16)};this.option("Fullscreen.autoStart")&&this.fsAPI&&!this.fsAPI.isFullscreen()?this.fsAPI.request(this.container).then((()=>t())).catch((()=>t())):t()}initLayout(){const t=this.option("parentEl")||document.body,e=i(this.localize(this.option("tpl.main")||""));e&&(e.setAttribute("id",`fancybox-${this.id}`),e.setAttribute("aria-label",this.localize("{{MODAL}}")),e.classList.toggle("is-compact",this.isCompact),this.container=e,this.footer=e.querySelector(".fancybox__footer"),t.appendChild(e),document.documentElement.classList.add("with-fancybox"),mt&&ft||(mt=document.createElement("button"),mt.classList.add("fancybox-focus-guard"),mt.setAttribute("aria-hidden","true"),mt.setAttribute("type","button"),ft=mt.cloneNode(),document.body.prepend(mt),document.body.append(ft)),this.option("animated")&&(e.classList.add("is-animated"),setTimeout((()=>{this.isClosing()||e.classList.remove("is-animated")}),350)),this.emit("initLayout"))}initCarousel(t){const e=this.container;if(!e)return;const i=e.querySelector(".fancybox__carousel");if(!i)return;const n=this.carousel=new B(i,d({},{slides:t,transition:"fade",Panzoom:{lockAxis:this.option("dragToClose")?"xy":"x",infinite:!!this.option("dragToClose")&&"y"},Dots:!1,Navigation:{classes:{container:"fancybox__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"}},initialPage:this.option("startIndex"),l10n:this.option("l10n")},this.option("Carousel")||{}));n.on("*",((t,e,...i)=>{this.emit(`Carousel.${e}`,t,...i)})),n.on(["ready","change"],(()=>{this.manageCaption(this.getSlide())})),n.on("removeSlide",((t,e)=>{e.closeBtnEl&&e.closeBtnEl.remove(),e.closeBtnEl=void 0,e.captionEl&&e.captionEl.remove(),e.captionEl=void 0,e.spinnerEl&&e.spinnerEl.remove(),e.spinnerEl=void 0,e.state=void 0})),n.on("Panzoom.touchStart",(()=>{this.isCompact||this.endIdle()})),n.on("settle",(()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&this.checkFocus()})),this.option("dragToClose")&&(n.on("Panzoom.afterTransform",((t,e)=>{const i=this.container;if(i){const t=Math.abs(e.current.f),n=t<1?"":Math.max(.5,Math.min(1,1-t/e.contentRect.fitHeight*1.5));i.style.setProperty("--fancybox-ts",n?"0s":""),i.style.setProperty("--fancybox-opacity",n+"")}})),n.on("Panzoom.touchEnd",((t,e,i)=>{const n=Math.abs(e.dragOffset.y);"y"===e.lockedAxis&&(n>=200||n>=50&&e.dragOffset.time<300)&&(i&&i.cancelable&&i.preventDefault(),this.close(i,"f-throwOut"+(e.current.f<0?"Up":"Down")))}))),n.on(["change"],(t=>{var e;let i=null===(e=this.getSlide())||void 0===e?void 0:e.triggerEl;if(i){const e=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:t.page});i.dispatchEvent(e)}})),n.on(["refresh","change"],(t=>{const e=this.container;if(!e)return;for(const i of e.querySelectorAll("[data-fancybox-current-index]"))i.innerHTML=t.page+1;for(const i of e.querySelectorAll("[data-fancybox-count]"))i.innerHTML=t.pages.length;if(!t.isInfinite){for(const i of e.querySelectorAll("[data-fancybox-next]"))t.page0?(i.removeAttribute("disabled"),i.removeAttribute("tabindex")):(i.setAttribute("disabled",""),i.setAttribute("tabindex","-1"))}const i=this.getSlide();let n=(null==i?void 0:i.downloadSrc)||"";n||!i||"image"!==i.type||i.error||"string"!=typeof i.src||(n=i.src);for(const t of e.querySelectorAll("[data-fancybox-download]"))n?(t.removeAttribute("disabled"),t.removeAttribute("tabindex"),t.setAttribute("href",n),t.setAttribute("download",n),t.setAttribute("target","_blank")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"),t.removeAttribute("href"),t.removeAttribute("download"))})),this.emit("initCarousel")}attachEvents(){const t=this.container;t&&(t.addEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),document.addEventListener("mousemove",this.onMousemove),window.addEventListener("resize",this.onResize),this.option("trapFocus")&&document.addEventListener("focus",this.onFocus,!0),document.addEventListener("keydown",this.onKeydown,!0),document.addEventListener("visibilitychange",this.onVisibilityChange,!1))}detachEvents(){const t=this.container;t&&(t.removeEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),document.removeEventListener("mousemove",this.onMousemove),window.removeEventListener("resize",this.onResize),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),document.removeEventListener("focus",this.onFocus,!0),document.removeEventListener("keydown",this.onKeydown,!0))}onClick(t){var e;if(this.isClosing())return;!this.isCompact&&this.option("idle")&&this.resetIdle();const i=t.composedPath()[0];if(i===(null===(e=this.carousel)||void 0===e?void 0:e.container))return;if(i.closest(".f-spinner")||i.closest("[data-fancybox-close]"))return t.preventDefault(),void this.close(t);if(i.closest("[data-fancybox-prev]"))return t.preventDefault(),void this.prev();if(i.closest("[data-fancybox-next]"))return t.preventDefault(),void this.next();if(this.isCompact)return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout((()=>{this.toggleIdle(),this.clickTimer=null}),350));if(this.emit("click",t),t.defaultPrevented)return;let n=!1;const s=document.activeElement;if(i.closest(".fancybox__content")){if(s){if(s.closest("[contenteditable]"))return;i.matches(W)||s.blur()}if((o=window.getSelection())&&"Range"===o.type)return;n=this.option("contentClick")}else i.closest(".fancybox__carousel")&&!i.matches(W)&&(n=this.option("backdropClick"));var o;"close"===n?(t.preventDefault(),this.close(t)):"next"===n?(t.preventDefault(),this.next()):"prev"===n&&(t.preventDefault(),this.prev())}onWheel(t){if(this.emit("wheel",t),t.defaultPrevented)return;const e=this.option("wheel",t);if("close"===e)t.preventDefault(),this.close(t);else if("slide"===e){const e=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail));t.preventDefault(),this[e>0?"next":"prev"]()}}onKeydown(t){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const e=t.key,i=this.option("keyboard");if(!i||t.ctrlKey||t.altKey||t.shiftKey)return;const n=t.composedPath()[0],s=document.activeElement&&document.activeElement.classList,o=s&&s.contains("f-button");if("Escape"!==e&&!o&&w(n)){if(n.isContentEditable||-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(n.nodeName))return}this.emit("keydown",e,t);const a=i[e];"function"==typeof this[a]&&this[a]()}onResize(){const t=this.container;if(!t)return;const e=this.isCompact;t.classList.toggle("is-compact",e),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.emit("resize")}onFocus(t){this.isTopmost()&&this.focus(t)}onMousemove(t){this.prevMouseMoveEvent=t,!this.isCompact&&this.option("idle")&&this.resetIdle()}onVisibilityChange(){"visible"===document.visibilityState?this.checkFocus():this.endIdle()}manageCloseBtn(t){const e=this.optionFor(t,"closeButton")||!1;if("auto"===e){const t=this.plugins.Toolbar;if(t&&t.state===ct.Ready)return}if(!e)return;if(!t.contentEl||t.closeBtnEl)return;const n=i(this.localize(this.option("tpl.closeButton")));t.closeBtnEl=t.contentEl.appendChild(n),t.el&&T(t.el,"has-close-btn")}manageCaption(t){var e,i,n;const s=this.container;if(!s)return;const o=this.isCompact||this.option("commonCaption"),a=!o;if(this.caption&&this.stop(this.caption),a&&this.caption&&(this.caption.remove(),this.caption=null),o&&!this.caption)for(const t of(null===(e=this.carousel)||void 0===e?void 0:e.slides)||[])t.captionEl&&(t.captionEl.remove(),t.captionEl=void 0,null===(i=t.el)||void 0===i||i.classList.remove("has-caption"),null===(n=t.el)||void 0===n||n.removeAttribute("aria-labelledby"));if(t||(t=this.getSlide()),!t||o&&!this.isCurrentSlide(t))return;const r=t.el;let l=this.optionFor(t,"caption","");if("string"!=typeof l||!l.length)return void(o&&this.caption&&this.animate(this.caption,"f-fadeOut",(()=>{var t;null===(t=this.caption)||void 0===t||t.remove(),this.caption=null})));let c=null;if(a){if(c=t.captionEl||null,r&&!c){const e=`fancybox__caption_${this.id}_${t.index}`;c=document.createElement("div"),c.className="fancybox__caption",c.setAttribute("id",e),t.captionEl=r.appendChild(c),r.classList.add("has-caption"),r.setAttribute("aria-labelledby",e)}}else{if(c=this.caption,c||(c=s.querySelector(".fancybox__caption")),!c){c=document.createElement("div"),c.dataset.fancyboxCaption="",c.className="fancybox__caption",c.innerHTML=l;(this.footer||s).prepend(c)}s.classList.add("has-caption"),this.caption=c}c&&(c.innerHTML=l)}checkFocus(){var t;const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}focus(t){var e;if(this.ignoreFocusChange)return;const i=document.activeElement||null,n=(null==t?void 0:t.target)||null,s=this.container,o=this.getSlide();if(!s||!(null===(e=this.carousel)||void 0===e?void 0:e.viewport))return;const a=o&&o.state===Y.Ready?o.el:null;if(!a||a.contains(i))return;t&&t.cancelable&&t.preventDefault(),this.ignoreFocusChange=!0;const r=Array.from(s.querySelectorAll(W));let l,c=[s];for(let t of r){const e=t.offsetParent&&!t.closest('[aria-hidden="true"]'),i=a&&a.contains(t),n=!this.carousel.viewport.contains(t);e&&(i||n)?(c.push(t),void 0!==t.dataset.origTabindex&&(t.tabIndex=parseFloat(t.dataset.origTabindex)),t.removeAttribute("data-orig-tabindex"),(t.hasAttribute("autoFocus")||!l&&i)&&(l=t)):(t.dataset.origTabindex=void 0===t.dataset.origTabindex?t.getAttribute("tabindex")||void 0:t.dataset.origTabindex,t.tabIndex=-1)}let h=null;t?(!n||c.indexOf(n)<0)&&(h=s,c.length&&(i===ft?h=c[0]:this.lastFocus!==s&&i!==mt||(h=c[c.length-1]))):this.option("autoFocus")&&l?h=l:i&&c.indexOf(i)<0&&(h=s),h&&(t=>{if(t&&_){void 0===N&&document.createElement("div").focus({get preventScroll(){return N=!0,!1}});try{if(N)t.focus({preventScroll:!0});else{const e=window.pageXOffset||document.body.scrollTop,i=window.pageYOffset||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:i,behavior:"auto"})}}catch(t){}}})(h),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const t=this.carousel;t&&t.pages.length>1&&t.slideNext()}prev(){const t=this.carousel;t&&t.pages.length>1&&t.slidePrev()}jumpTo(...t){this.carousel&&this.carousel.slideTo(...t)}isTopmost(){var t;return(null===(t=vt.getInstance())||void 0===t?void 0:t.id)==this.id}animate(t=null,e="",i){if(!t||!e)return void(i&&i());this.stop(t);const n=s=>{s.target===t&&t.dataset.animationName&&(t.removeEventListener("animationend",n),delete t.dataset.animationName,i&&i(),t.classList.remove(e))};t.dataset.animationName=e,t.addEventListener("animationend",n),t.classList.add(e)}stop(t){t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:t}))}setContent(t,e="",i=!0){if(this.isClosing())return;const n=t.el;if(!n)return;let s=null;if(w(e))["img","iframe","video","audio"].includes(e.nodeName.toLowerCase())?(s=document.createElement("div"),s.appendChild(e)):s=e;else{const t=document.createRange().createContextualFragment(e);s=document.createElement("div"),s.appendChild(t)}s instanceof Element&&t.filter&&!t.error&&(s=s.querySelector(t.filter)),s instanceof Element?(s.classList.add("fancybox__content"),t.id&&s.setAttribute("id",t.id),"none"!==s.style.display&&"none"!==getComputedStyle(s).getPropertyValue("display")||(s.style.display=t.display||this.option("defaultDisplay")||"flex"),n.classList.add(`has-${t.error?"error":t.type||"unknown"}`),n.prepend(s),t.contentEl=s,i&&this.revealContent(t),this.manageCloseBtn(t),this.manageCaption(t)):this.setError(t,"{{ELEMENT_NOT_FOUND}}")}revealContent(t,e){const i=t.el,n=t.contentEl;i&&n&&(this.emit("reveal",t),this.hideLoading(t),t.state=Y.Opening,(e=this.isOpeningSlide(t)?void 0===e?this.optionFor(t,"showClass"):e:"f-fadeIn")?this.animate(n,e,(()=>{this.done(t)})):this.done(t))}done(t){var e;this.isClosing()||(t.state=Y.Ready,this.emit("done",t),null===(e=t.el)||void 0===e||e.classList.add("is-done"),this.isCurrentSlide(t)&&this.option("autoFocus")&&queueMicrotask((()=>{var t;if(this.option("autoFocus")){const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}})),this.isOpeningSlide(t)&&!this.isCompact&&this.option("idle")&&this.setIdle())}isCurrentSlide(t){const e=this.getSlide();return!(!t||!e)&&e.index===t.index}isOpeningSlide(t){var e,i;return null===(null===(e=this.carousel)||void 0===e?void 0:e.prevPage)&&t.index===(null===(i=this.getSlide())||void 0===i?void 0:i.index)}showLoading(t){t.state=Y.Loading;const e=t.el;if(!e)return;e.classList.add("is-loading"),this.emit("loading",t),t.spinnerEl||setTimeout((()=>{if(!this.isClosing()&&!t.spinnerEl&&t.state===Y.Loading){let n=i(y);t.spinnerEl=n,e.prepend(n),this.animate(n,"f-fadeIn")}}),250)}hideLoading(t){const e=t.el;if(!e)return;const i=t.spinnerEl;this.isClosing()?null==i||i.remove():(e.classList.remove("is-loading"),i&&this.animate(i,"f-fadeOut",(()=>{i.remove()})),t.state===Y.Loading&&(this.emit("loaded",t),t.state=Y.Ready))}setError(t,e){if(this.isClosing())return;this.emit("error"),t.error=e,this.hideLoading(t),this.clearContent(t);const i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(e||"

{{ERROR}}

"),this.setContent(t,i)}clearContent(t){var e;null===(e=this.carousel)||void 0===e||e.emit("removeSlide",t),t.contentEl&&(t.contentEl.remove(),t.contentEl=void 0),t.closeBtnEl&&(t.closeBtnEl.remove(),t.closeBtnEl=void 0);const i=t.el;i&&(O(i,"is-loading"),O(i,"has-error"),O(i,"has-unknown"),O(i,`has-${t.type||"unknown"}`))}getSlide(){var t;const e=this.carousel;return(null===(t=null==e?void 0:e.pages[null==e?void 0:e.page])||void 0===t?void 0:t.slides[0])||void 0}close(t,e){if(this.isClosing())return;const i=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",i,t),i.defaultPrevented)return;t&&t.cancelable&&(t.preventDefault(),t.stopPropagation());const n=this.fsAPI,s=()=>{this.proceedClose(t,e)};n&&n.isFullscreen()?Promise.resolve(n.exit()).then((()=>s())):s()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(t=!1){const e=()=>{var t;this.clearIdle(),this.idle=!0,null===(t=this.container)||void 0===t||t.classList.add("is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(t)e();else{const t=this.option("idle");t&&(this.idleTimer=setTimeout(e,t))}}endIdle(){var t;this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,null===(t=this.container)||void 0===t||t.classList.remove("is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){const t=this.fsAPI;t&&(t.isFullscreen()?t.exit():this.container&&t.request(this.container))}isClosing(){return[$.Closing,$.CustomClosing,$.Destroy].includes(this.state)}proceedClose(t,e){var i,n;this.state=$.Closing,this.clearIdle(),this.detachEvents();const s=this.container,o=this.carousel,a=this.getSlide(),r=null==a?void 0:a.state;if(a){const t=this.option("placeFocusBack")?(null===(i=this.getSlide())||void 0===i?void 0:i.triggerEl)||this.option("trigger"):null;t&&t.focus()}if(s&&(T(s,"is-closing"),s.setAttribute("aria-hidden","true"),this.option("animated")&&T(s,"is-animated"),s.style.pointerEvents="none"),o){o.clearTransitions(),null===(n=o.panzoom)||void 0===n||n.destroy();for(const t of o.slides){t.state=Y.Closing,this.hideLoading(t);const e=t.contentEl;e&&this.stop(e);const i=null==t?void 0:t.panzoom;i&&(i.stop(),i.detachEvents(),i.detachObserver()),this.isCurrentSlide(t)||o.emit("removeSlide",t)}}this.emit("close",t),this.state!==$.CustomClosing?(void 0===e&&a&&(e=this.optionFor(a,"hideClass")),e&&a&&r===Y.Ready?(this.animate(a.contentEl,e,(()=>{o&&o.emit("removeSlide",a)})),setTimeout((()=>{this.destroy()}),350)):this.destroy()):setTimeout((()=>{this.destroy()}),350)}destroy(){var t;if(this.state===$.Destroy)return;this.state=$.Destroy,null===(t=this.carousel)||void 0===t||t.destroy();const e=this.container;e&&e.remove(),gt.delete(this.id);const i=vt.getInstance();i?i.focus():(mt&&(mt.remove(),mt=null),ft&&(ft.remove(),ft=null),document.documentElement.classList.remove("with-fancybox"),_&&(document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",""),document.body.classList.remove("compensate-for-scrollbar")))}static bind(t,e,i){if(!_)return;let n,s="",o={};if("string"==typeof t?(n=document.body,s=t,"object"==typeof e&&(o=e||{})):(n=t,"string"==typeof e&&(s=e),"object"==typeof i&&(o=i||{})),!n)return;s=s||"[data-fancybox]";const a=vt.openers.get(n)||new Map;a.set(s,o),vt.openers.set(n,a),1===a.size&&n.addEventListener("click",vt.fromEvent)}static unbind(t,e){let i,n="";if("string"==typeof t?(i=document.body,n=t):(i=t,"string"==typeof e&&(n=e)),!i)return;const s=vt.openers.get(i);s&&n&&s.delete(n),n&&s||(vt.openers.delete(i),i.removeEventListener("click",vt.fromEvent))}static destroy(){let t;for(;t=vt.getInstance();)t.destroy();for(const t of vt.openers.keys())t.removeEventListener("click",vt.fromEvent);vt.openers=new Map}static fromEvent(t){if(t.defaultPrevented)return;if(t.button&&0!==t.button)return;if(t.ctrlKey||t.metaKey||t.shiftKey)return;let e=t.composedPath()[0];const i=e.closest("[data-fancybox-trigger]");if(i){const t=i.dataset.fancyboxTrigger||"",n=document.querySelectorAll(`[data-fancybox="${t}"]`),s=parseInt(i.dataset.fancyboxIndex||"",10)||0;e=n[s]||e}if(!(e&&e instanceof Element))return;let n,s,o,a;if([...vt.openers].reverse().find((([t,i])=>!(!t.contains(e)||![...i].reverse().find((([i,r])=>{let l=e.closest(i);return!!l&&(n=t,s=i,o=l,a=r,!0)}))))),!n||!s||!o)return;a=a||{},t.preventDefault(),e=o;let r=[],l=d({},X,a);l.event=t,l.trigger=e,l.delegate=i;const c=l.groupAll,h=l.groupAttr,u=h&&e?e.getAttribute(`${h}`):"";if((!e||u||c)&&(r=[].slice.call(n.querySelectorAll(s))),e&&!c&&(r=u?r.filter((t=>t.getAttribute(`${h}`)===u)):[e]),!r.length)return;const p=vt.getInstance();return p&&p.options.trigger&&r.indexOf(p.options.trigger)>-1?void 0:(e&&(l.startIndex=r.indexOf(e)),vt.fromNodes(r,l))}static fromNodes(t,e){e=d({},X,e);const i=[];for(const n of t){const t=n.dataset||{},s=t.src||n.getAttribute("href")||n.getAttribute("currentSrc")||n.getAttribute("src")||void 0;let o;const a=e.delegate;let r;a&&i.length===e.startIndex&&(o=a instanceof HTMLImageElement?a:a.querySelector("img:not([aria-hidden])")),o||(o=n instanceof HTMLImageElement?n:n.querySelector("img:not([aria-hidden])")),o&&(r=o.currentSrc||o.src||void 0,!r&&o.dataset&&(r=o.dataset.lazySrc||o.dataset.src||void 0));const l={src:s,triggerEl:n,thumbEl:o,thumbElSrc:r,thumbSrc:r};for(const e in t)"fancybox"!==e&&(l[e]=t[e]+"");i.push(l)}return new vt(i,e)}static getInstance(t){if(t)return gt.get(t);return Array.from(gt.values()).reverse().find((t=>!t.isClosing()&&t))||null}static getSlide(){var t;return(null===(t=vt.getInstance())||void 0===t?void 0:t.getSlide())||null}static show(t=[],e={}){return new vt(t,e)}static next(){const t=vt.getInstance();t&&t.next()}static prev(){const t=vt.getInstance();t&&t.prev()}static close(t=!0,...e){if(t)for(const t of gt.values())t.close(...e);else{const t=vt.getInstance();t&&t.close(...e)}}}Object.defineProperty(vt,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(vt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:X}),Object.defineProperty(vt,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:pt}),Object.defineProperty(vt,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map});export{B as Carousel,vt as Fancybox,P as Panzoom}; +const t=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),e=function(t,i){return!(!t||t===document.body||i&&t===i)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,n=-1!==i.indexOf("hidden"),s=-1!==i.indexOf("visible");return e&&!n&&!s}(t)?t:e(t.parentElement,i))},i=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},n=t=>`${t||""}`.split(" ").filter((t=>!!t)),s=(t,e,i)=>{n(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))};class o{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const a={passive:!1};class r{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:n=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=n;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,a),this.element.addEventListener("touchmove",this.onMove,a),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,a)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new o(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new o(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new o(t))):[new o(t)],n=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(n.push(t),this.currentPointers[e]=t)}n.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new o(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new o(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,a),this.element.removeEventListener("touchstart",this.onTouchStart,a),this.element.removeEventListener("touchmove",this.onMove,a),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function l(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function c(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const h=t=>"object"==typeof t&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t),d=(t,...e)=>{const i=e.length;for(let n=0;n{const n=Array.isArray(i)?[]:{};t[e]||Object.assign(t,{[e]:n}),h(i)?Object.assign(t[e],d(n,i)):Array.isArray(i)?Object.assign(t,{[e]:[...i]}):Object.assign(t,{[e]:i})}))}return t},u=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class p{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?d({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=u(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...n){let s=u(e,t);var o;"string"!=typeof(o=s)||isNaN(o)||isNaN(parseFloat(o))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...n));let a=u(e,this.options);return a&&"function"==typeof a?s=a.call(this,this,t,...n,s):void 0===s&&(s=a),void 0===s?i:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(p,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(p,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class m extends p{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,n]of Object.entries(t)){const t=this.option(i),s=this.plugins[i];s||!1===t?s&&!1===t&&(s.detach(),delete this.plugins[i]):e.set(i,new n(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}var f;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(f||(f={}));const g=["a","b","c","d","e","f"],b={PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"},v={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:b},y='
',w=t=>t&&null!==t&&t instanceof Element&&"nodeType"in t,x=(t,e)=>{n(e).forEach((e=>{t&&t.classList.remove(e)}))},S=(t,e)=>{n(e).forEach((e=>{t&&t.classList.add(e)}))},E={a:1,b:0,c:0,d:1,e:0,f:0};let P=null,C=null;class M extends m{get isTouchDevice(){return null===C&&(C=window.matchMedia("(hover: none)").matches),C}get isMobile(){return null===P&&(P=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),P}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const t=this.content;return!!(t&&t instanceof HTMLImageElement)&&!t.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of g){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},n={}){var s;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:f.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},E)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},E)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},M.Plugins),n)),this.emit("init"),this.isContentLoading){const e=this.content;if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const n=i(y);t.contains(e)?this.spinner=(null===(s=e.parentElement)||void 0===s?void 0:s.insertBefore(n,e))||null:this.spinner=t.appendChild(n)}this.emit("beforeLoad"),e.addEventListener("load",this.onLoad),e.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===f.Init&&this.enable()}onError(){this.state!==f.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=f.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new r(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of g)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of g)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,n=i.e+t,s=i.f+e,o=this.getBounds(),{x:a,y:r}=o,l=a.min,c=a.max,h=r.min,d=r.max;let u=0,p=0;return l!==1/0&&nc&&(u=c-n),h!==1/0&&sd&&(p=d-s),Math.abs(u)<.001&&(u=0),Math.abs(p)<.001&&(p=0),Object.assign(Object.assign({},o),{xDiff:u,yDiff:p,inBounds:!u&&!p})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:n,fitHeight:s,fullWidth:o,fullHeight:a}=i;let r=o,l=a;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),c=i?o:n,h=i?a:s,d=this.getMatrix(t),u=new DOMPoint(0,0).matrixTransform(d),p=new DOMPoint(0+c,0).matrixTransform(d),m=new DOMPoint(0+c,0+h).matrixTransform(d),f=new DOMPoint(0,0+h).matrixTransform(d),g=Math.abs(m.x-u.x),b=Math.abs(m.y-u.y),v=Math.abs(f.x-p.x),y=Math.abs(f.y-p.y);r=Math.max(g,v),l=Math.max(b,y)}return{contentWidth:r,contentHeight:l}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const n=i.closest("[data-panzoom-action]"),s=i.closest("[data-panzoom-change]"),o=n||s,a=o&&w(o)?o.dataset:null;if(a){const e=a.panzoomChange,i=a.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const r=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(r.x-this.dragStart.x)>2||Math.abs(r.y-this.dragStart.y)>2))return;this.dragStart.time=0;const l=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},c=this.option("click",t),h=this.option("dblClick",t);h?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&c&&l(c)):(this.emit("dblClick",t),t.defaultPrevented||l(h)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&c&&l(c))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(e,i,n){var s;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const o=this.content.getBoundingClientRect();if(this.dragStart={x:o.x,y:o.y,top:o.top,left:o.left,time:Date.now()},!1===this.option("touch",e))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return e.preventDefault(),e.stopPropagation(),!1;if(!n.length){const t=e.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(t.nodeName)||t.closest("[contenteditable]")||t.closest("[data-selectable]")||t.closest("[data-panzoom-change]")||t.closest("[data-panzoom-action]"))return!1;null===(s=window.getSelection())||void 0===s||s.removeAllRanges()}return"mousedown"===e.type&&e.preventDefault(),t(this.targetScale,1e3)===t(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(i),this.emit("touchStart",e),!0}onPointerMove(i,n,s){if(!this.isDragging)return;if(n.length<2&&this.panOnlyZoomed&&t(this.targetScale)<=t(this.minScale))return;if(this.emit("touchMove",i),i.defaultPrevented)return;this.addTrackingPoint(n[0]);const{content:o}=this,a=c(s[0],s[1]),r=c(n[0],n[1]);let h=0,d=0;if(n.length>1){const t=o.getBoundingClientRect();h=a.clientX-t.left-.5*t.width,d=a.clientY-t.top-.5*t.height}const u=l(s[0],s[1]),p=l(n[0],n[1]);let m=u?p/u:1,f=r.clientX-a.clientX,g=r.clientY-a.clientY;this.dragOffset.x+=f,this.dragOffset.y+=g,this.dragOffset.time=Date.now()-this.dragStart.time;let b=t(this.targetScale)===t(this.minScale)&&this.option("lockAxis");if(b&&!this.lockedAxis)if("xy"===b||"y"===b||"touchmove"===i.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void i.preventDefault();const t=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=t>45&&t<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,f=0,g=0}else this.lockedAxis=b;if(e(i.target,this.content)&&(b="x",this.dragOffset.y=0),b&&"xy"!==b&&this.lockedAxis!==b&&t(this.targetScale)===t(this.minScale))return;i.cancelable&&i.preventDefault(),this.container.classList.add(this.cn("isDragging"));const v=this.checkBounds(f,g);this.option("rubberband")?("x"!==this.isInfinite&&(v.xDiff>0&&f<0||v.xDiff<0&&f>0)&&(f*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*v.xDiff))),"y"!==this.isInfinite&&(v.yDiff>0&&g<0||v.yDiff<0&&g>0)&&(g*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*v.yDiff)))):(v.xDiff&&(f=0),v.yDiff&&(g=0));const y=this.targetScale,w=this.minScale,x=this.maxScale;y<.5*w&&(m=Math.max(m,w)),y>1.5*x&&(m=Math.min(m,x)),"y"===this.lockedAxis&&t(y)===t(w)&&(f=0),"x"===this.lockedAxis&&t(y)===t(w)&&(g=0),this.applyChange({originX:h,originY:d,panX:f,panY:g,scale:m,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,i,n){if(n.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(i),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),e(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==f.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of g)this.velocity[t]=0,this.target[t]=this.current[t];x(this.container,"is-scaling"),x(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:e}=this,i=e[0],n=e[e.length-1];let s=0,o=0,a=0;n&&i&&(s=n.clientX-i.clientX,o=n.clientY-i.clientY,a=n.time-i.time);let r=0,l=0,c=0,h=0,d=this.option("decelFriction");const u=this.targetScale;if((uthis.maxScale+1e-5)&&(d=.35),a>0){c=Math.abs(s)>3?s/(a/30):0,h=Math.abs(o)>3?o/(a/30):0;const t=this.option("maxVelocity");t&&(c=Math.max(Math.min(c,t),-1*t),h=Math.max(Math.min(h,t),-1*t))}c&&(r=c/(1/(1-d)-1)),h&&(l=h/(1/(1-d)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&t(u)===this.minScale)&&(r=c=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&t(u)===this.minScale)&&(l=h=0);const p=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(s)),"auto"===m&&(m=parseFloat(s.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(s));const g=(this.option("transformParent")?s.parentElement:null)||s,b=g.getAttribute("style")||"";g.style.setProperty("transform","none","important"),g.style.setProperty("transition","none","important"),g.style.setProperty("animation","none","important"),s instanceof HTMLImageElement&&(g.style.width="",g.style.height=""),g.offsetHeight;const v=s.getBoundingClientRect();let y=v.width,w=v.height,x=0,S=0;if(s instanceof HTMLImageElement&&({width:y,height:w,top:x,left:S}=((t,e,i,n)=>{const s=i/n;return s>t/e?(i=t,n=t/s):(i=e*s,n=e),{width:i,height:n,top:.5*(e-n),left:.5*(t-i)}})(v.width,v.height,p,m)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:v.top-r.top+x,bottom:r.bottom-v.bottom+x,left:v.left-r.left+S,right:r.right-v.right+S,fitWidth:y,fitHeight:w,width:y,height:w,fullWidth:p,fullHeight:m}),g.style.cssText=b,s instanceof HTMLImageElement&&(g.style.width=`${y}px`,g.style.height=`${w}px`),this.setTransform(),!0!==e){let t="";Math.abs(c-o)>1&&(t+="x"),Math.abs(h-a)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(t(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===f.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const e=this.option("bounds");if("auto"!==e)return e;const{contentWidth:i,contentHeight:n}=this.calculateContentDim(this.target);let s=0,o=0,a=0,r=0;const l=this.option("infinite");if(!0===l||this.lockedAxis&&l===this.lockedAxis)s=-1/0,a=1/0,o=-1/0,r=1/0;else{let{containerRect:e,contentRect:l}=this,c=t(this.contentRect.fitWidth*this.targetScale,1e3),h=t(this.contentRect.fitHeight*this.targetScale,1e3),{innerWidth:d,innerHeight:u}=e;if(this.containerRect.width===c&&(d=e.width),this.containerRect.width===h&&(u=e.height),i>d){a=.5*(i-d),s=-1*a;let t=.5*(l.right-l.left);s+=t,a+=t}if(this.contentRect.fitWidth>d&&iu){r=.5*(n-u),o=-1*r;let t=.5*(l.bottom-l.top);o+=t,r+=t}this.contentRect.fitHeight>u&&n-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(l=!0),this.contentRect.width*this.targetScalet(this.targetScale),h=!c&&!l&&a&&t(n).9*e.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:n=this.option("friction"),angle:s=0,originX:o=0,originY:a=0,flipX:r=!1,flipY:l=!1,ignoreBounds:c=!1}){this.state!==f.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:s,originX:o,originY:a,friction:n,flipX:r,flipY:l,ignoreBounds:c})}applyChange({panX:e=0,panY:i=0,scale:n=1,angle:s=0,originX:o=-this.current.e,originY:a=-this.current.f,friction:r=this.option("friction"),flipX:l=!1,flipY:c=!1,ignoreBounds:h=!1,bounce:d=this.option("bounce")}){const u=this.state;if(u===f.Init||u===f.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of g)this.velocity[t]=0;this.friction=r||0,this.ignoreBounds=h;const{current:p}=this,m=p.e,b=p.f,v=this.getMatrix(this.target);let y=(new DOMMatrix).translate(m,b).translate(o,a).translate(e,i);if(this.option("zoom")){if(!h){const t=this.targetScale,e=this.minScale,i=this.maxScale;t*ni&&(n=i/t)}y=y.scale(n)}y=y.translate(-o,-a).translate(-m,-b).multiply(v),s&&(y=y.rotate(s)),l&&(y=y.scale(-1,1)),c&&(y=y.scale(1,-1));for(const e of g)"a"!=e&&"d"!=e||!(y[e]>this.minScale+1e-5||y[e].1||"mousemove"===this.panMode||!1===d)&&!h&&this.clampTargetBounds(),this.isResting||(this.state=f.Panning,this.requestTick())}stop(t=!1){if(this.state!==f.Init&&this.state!==f.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of g)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),x(this.container,"is-scaling"),x(this.container,"is-animating"),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=f.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),S(this.container,"is-animating"),this.isScaling&&S(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(e,i=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=e,"mousemove"!==this.panMode||!e)return;if(t(this.targetScale)<=t(this.minScale))return;this.emit("mouseMove",e);const{container:n,containerRect:s,contentRect:o}=this,a=s.width,r=s.height,l=n.getBoundingClientRect(),c=(e.clientX||0)-l.left,h=(e.clientY||0)-l.top;let{contentWidth:d,contentHeight:u}=this.calculateContentDim(this.target);const p=this.option("mouseMoveFactor");p>1&&(d!==a&&(d*=p),u!==r&&(u*=p));let m=.5*(d-a)-c/a*100/100*(d-a);m+=.5*(o.right-o.left);let f=.5*(u-r)-h/r*100/100*(u-r);f+=.5*(o.bottom-o.top),this.applyChange({panX:m-this.target.e,panY:f-this.target.f,friction:i})}zoomWithWheel(t){if(this.state===f.Destroy||this.state===f.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),n=this.targetScale,s=this.maxScale,o=this.minScale;let a=n*(100+i*e)/100;as&&n>=s?(this.wheelDelta+=Math.abs(i),a=s):(this.wheelDelta=0,a=Math.max(Math.min(a,s),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),a!==n&&this.zoomTo(a,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.maxScale-this.minScale)?"max":"fit",t)}toggleCover(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.coverScale-this.minScale)?"cover":"fit",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:n=0,event:s}={}){if(this.isContentLoading||this.state===f.Destroy)return;this.stop();const{targetScale:o}=this;let a=1;if("mousemove"===this.panMode&&(s=this.prevMouseMoveEvent||s),s){const t=this.content.getBoundingClientRect(),e=s.clientX||0,o=s.clientY||0;i=e-t.left-.5*t.width,n=o-t.top-.5*t.height}const r=this.fullScale,l=this.maxScale;let c=this.coverScale;"number"==typeof t?a=t/o:("next"===t&&(r-c<.2&&(c=r),t=o1?.15:.25:e,this.applyChange({scale:a,originX:i,originY:n,friction:e}),s&&"mousemove"===this.panMode&&this.panWithMouse(s,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const n=t.classList.contains(e);n?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(n?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:n,d:s,e:o,f:a}=t;return new DOMMatrix([e,i,n,s,o,a])}reset(t){if(this.state!==f.Init&&this.state!==f.Destroy){this.stop("current");for(const t of g)this.target[t]=E[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=f.Panning,this.requestTick())}}destroy(){this.stop(),this.state=f.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(M,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:v}),Object.defineProperty(M,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const T=function(t,e){let i=!0;return(...n)=>{i&&(i=!1,t(...n),setTimeout((()=>{i=!0}),e))}},O=(t,e)=>{let i=[];return t.childNodes.forEach((t=>{t.nodeType!==Node.ELEMENT_NODE||e&&!t.matches(e)||i.push(t)})),i},A={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var L;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"}(L||(L={}));const z=t=>{if("string"==typeof t&&(t={html:t}),!(t instanceof String||t instanceof HTMLElement)){const e=t.thumb;void 0!==e&&("string"==typeof e&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},R=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class k extends p{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const I={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'',dynamicFrom:11,maxCount:1/0,minCount:2};class D extends k{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let t=this.list;return t||(t=document.createElement("ul"),S(t,this.cn("list")),t.setAttribute("role","tablist"),this.instance.container.appendChild(t),S(this.instance.container,this.cn("hasDots")),this.list=t),t}refresh(){var t;const e=this.instance.pages.length,i=Math.min(2,this.option("minCount")),n=Math.max(2e3,this.option("maxCount")),o=this.option("dynamicFrom");if(en)return void this.cleanup();const a="number"==typeof o&&e>5&&e>=o,r=!this.list||this.isDynamic!==a||this.list.children.length!==e;r&&this.cleanup();const l=this.build();if(s(l,this.cn("isDynamic"),!!a),r)for(let t=0;t=e-1&&s.setAttribute("disabled","")))}createButton(t){const e=this.instance,i=document.createElement("button");i.setAttribute("tabindex","0"),i.setAttribute("title",e.localize(`{{${t.toUpperCase()}}}`)),S(i,this.cn("button")+" "+this.cn("next"===t?"isNext":"isPrev"));const n=e.isRTL?"next"===t?"prev":"next":t;var s;return i.innerHTML=e.localize(this.option(`${n}Tpl`)),i.dataset[`carousel${s=t,s?s.match("^[a-z]")?s.charAt(0).toUpperCase()+s.substring(1):s:""}`]="true",i}build(){let t=this.container;t||(this.container=t=document.createElement("div"),S(t,this.cn("container")),this.instance.container.appendChild(t)),this.next||(this.next=t.appendChild(this.createButton("next"))),this.prev||(this.prev=t.appendChild(this.createButton("prev")))}cleanup(){this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove(),this.prev=null,this.next=null,this.container=null}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(F,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'',prevTpl:''}});class j extends k{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){this.nav&&this.target&&(this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.state===L.Ready&&this.onNavReady(this.nav),this.target.on("ready",this.onTargetReady),this.target.state===L.Ready&&this.onTargetReady(this.target))}onNavReady(t){t.on("createSlide",this.onNavCreateSlide),t.on("Panzoom.click",this.onNavClick),this.onTargetChange()}onTargetReady(t){t.on("change",this.onTargetChange),t.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(t,e,i){var n,s;const o=i.target,{nav:a,target:r}=this;if(!a||!r||!o)return;const l=o.closest("[data-index]");if(!l)return;i.stopPropagation(),i.preventDefault();const c=parseInt(l.dataset.index||"",10)||0,h=r.getPageForSlide(c),d=a.getPageForSlide(c);r.page!==h&&r.slideTo(h,{friction:null===(s=null===(n=this.nav)||void 0===n?void 0:n.plugins)||void 0===s?void 0:s.Sync.option("friction")}),this.markSelectedSlide(c),a.page!==d&&a.slideTo(d)}onNavCreateSlide(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}onTargetChange(){const{target:t,nav:e}=this;if(!t||!e)return;if(e.state!==L.Ready||t.state!==L.Ready)return;const i=t.pages[t.page].slides[0].index,n=e.getPageForSlide(i);this.markSelectedSlide(i),e.slideTo(n)}markSelectedSlide(t){const{nav:e}=this;if(!e||e.state!==L.Ready)return;this.selectedIndex=t,[...e.slides].filter((t=>t.el&&t.el.classList.remove("is-nav-selected")));const i=e.slides[t];i&&i.el&&i.el.classList.add("is-nav-selected")}attach(){let t=this.options.target,e=this.options.nav;t?this.addAsNavFor(t):e&&this.addAsTargetFor(e)}detach(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.nav=null,this.target&&(this.target.off("ready",this.onTargetReady),this.target.off("refresh",this.onTargetChange),this.target.off("change",this.onTargetChange)),this.target=null}}Object.defineProperty(j,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const H={Navigation:F,Dots:D,Sync:j};class B extends m{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===L.Ready}get isInfinite(){let t=!1;const e=this.contentDim,i=this.viewportDim;return this.pages.length>=2&&e>1.5*i&&(t=this.option("infinite")),t}get isRTL(){return"rtl"===this.option("direction")}get isHorizontal(){return"x"===this.option("axis")}constructor(t,e={},i={}){if(super(),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:L.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),"string"==typeof t&&(t=document.querySelector(t)),!t||!w(t))throw new Error("No Element found");this.container=t,this.slideNext=T(this.slideNext.bind(this),175),this.slidePrev=T(this.slidePrev.bind(this),175),this.userOptions=e,this.userPlugins=i,queueMicrotask((()=>{this.processOptions()}))}processOptions(){const t=d({},B.defaults,this.userOptions);let e="";const i=t.breakpoints;if(i&&h(i))for(const[n,s]of Object.entries(i))window.matchMedia(n).matches&&h(s)&&(e+=n,d(t,s));e===this.bp&&this.state!==L.Init||(this.bp=e,this.state===L.Ready&&(t.initialSlide=this.pages[this.page].slides[0].index),this.state!==L.Init&&this.destroy(),super.setOptions(t),!1===this.option("enabled")?this.attachEvents():setTimeout((()=>{this.init()}),0))}init(){this.state=L.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},B.Plugins),this.userPlugins)),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=L.Ready,this.emit("ready")}initLayout(){const{container:t}=this,e=this.option("classes");S(t,this.cn("container")),s(t,e.isLTR,!this.isRTL),s(t,e.isRTL,this.isRTL),s(t,e.isVertical,!this.isHorizontal),s(t,e.isHorizontal,this.isHorizontal);let i=this.option("viewport")||t.querySelector(`.${e.viewport}`);i||(i=document.createElement("div"),S(i,e.viewport),i.append(...O(t,`.${e.slide}`)),t.prepend(i));let n=this.option("track")||t.querySelector(`.${e.track}`);n||(n=document.createElement("div"),S(n,e.track),n.append(...Array.from(i.childNodes))),n.setAttribute("aria-live","polite"),i.contains(n)||i.prepend(n),this.viewport=i,this.track=n,this.emit("initLayout")}initSlides(){const{track:t}=this;if(t){this.slides=[],[...O(t,`.${this.cn("slide")}`)].forEach((t=>{if(w(t)){const e=z({el:t,isDom:!0,index:this.slides.length});this.slides.push(e),this.emit("initSlide",e,this.slides.length)}}));for(let t of this.option("slides",[])){const e=z(t);e.index=this.slides.length,this.slides.push(e),this.emit("initSlide",t,this.slides.length)}this.emit("initSlides")}}setInitialPage(){let t=0;const e=this.option("initialSlide");t="number"==typeof e?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0,this.page=t}setInitialPosition(){if(!this.track||!this.pages.length)return;let t=this.page;this.pages[t]||(this.page=t=0);const e=this.pages[t].pos*(this.isRTL&&this.isHorizontal?1:-1),i=this.isHorizontal?`${e}px`:"0",n=this.isHorizontal?"0":`${e}px`;this.track.style.transform=`translate3d(${i}, ${n}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const t=this.option("Panzoom")||{};this.panzoom=new M(this.viewport,d({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,decelFriction:.12,click:!1,dblClick:!1,touch:t=>!(this.pages.length<2&&!t.options.infinite),bounds:()=>this.getBounds(),maxVelocity:t=>Math.abs(t.target[this.axis]-t.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on("*",((t,e,...i)=>{this.emit(`Panzoom.${e}`,t,...i)})),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation),this.panzoom.on("touchStart",((t,e)=>{this.inTransition.size&&e.preventDefault()}))}attachEvents(){const t=this.container;t&&(t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let t=[];const{contentDim:e,viewportDim:i}=this,n=this.option("slidesPerPage");if("number"==typeof n&&e>i){for(let e=0;ei)&&(t.push(R()),s=t.length-1,o=0),o+=e.dim+e.gap,t[s].slides.push(e);return t}processPages(){const e=this.pages,{contentDim:i,viewportDim:n}=this,s=this.option("center"),o=this.option("fill");if(e.forEach(((t,e)=>{t.index=e,t.pos=t.slides[0].pos,t.dim=0;for(const[e,i]of t.slides.entries())t.dim+=i.dim,e{o&&!this.isInfinite&&i>n&&(e.pos=Math.max(e.pos,0),e.pos=Math.min(e.pos,i-n)),e.pos=t(e.pos,1e3),e.dim=t(e.dim,1e3)})),this.isInfinite)return e;const a=[];let r;return e.forEach((t=>{const e=Object.assign({},t);r&&e.pos===r.pos?(r.dim+=e.dim,r.slides=[...r.slides,...e.slides]):(e.index=a.length,r=e,a.push(e))})),a}getPageFromIndex(t=0){const e=this.pages.length;let i;return t=parseInt((t||0).toString())||0,i=this.isInfinite?(t%e+e)%e:Math.max(Math.min(t,this.pages.length-1),0),i}getSlideMetrics(t){const e=this.isHorizontal?"width":"height";let i=0,n=0,s=t.el;s?i=parseFloat(s.dataset[e]||"")||0:(s=document.createElement("div"),s.style.visibility="hidden",S(s,this.cn("slide")+" "+t.class),(this.track||document.body).prepend(s)),i?(s.style[e]=`${i}px`,s.style["width"===e?"height":"width"]=""):i=s.getBoundingClientRect()[e];const o=getComputedStyle(s);return"content-box"===o.boxSizing&&(this.isHorizontal?(i+=parseFloat(o.paddingLeft)||0,i+=parseFloat(o.paddingRight)||0):(i+=parseFloat(o.paddingTop)||0,i+=parseFloat(o.paddingBottom)||0)),n=parseFloat(o[this.isHorizontal?"marginRight":"marginBottom"])||0,this.isHorizontal,t.el||s.remove(),{dim:i,gap:n}}getBounds(){let t={min:0,max:0};if(this.isInfinite)t={min:-1/0,max:1/0};else if(this.pages.length){const e=this.pages[0].pos,i=this.pages[this.pages.length-1].pos;t=this.isRTL&&this.isHorizontal?{min:e,max:i}:{min:-1*i,max:-1*e}}return{x:this.isHorizontal?t:{min:0,max:0},y:this.isHorizontal?{min:0,max:0}:t}}repositionSlides(){const{viewportDim:e,contentDim:i,page:n,pages:s}=this;let o,a=0,r=0,l=0,c=0;this.panzoom?c=-1*this.panzoom.current[this.isHorizontal?"e":"f"]:s[n]&&(c=s[n].pos||0),o=this.isHorizontal?this.isRTL?"right":"left":"top",this.isRTL&&this.isHorizontal&&(c*=-1);for(const t of this.slides)t.el?("top"===o?(t.el.style.right="",t.el.style.left=""):t.el.style.top="",t.index!==a?t.el.style[o]=0===r?"":`${r}px`:t.el.style[o]="",l+=t.dim+t.gap,a++):r+=t.dim+t.gap;if(this.isInfinite&&l)for(const n of this.slides)n.el&&(t(n.pos)t(i-e)&&(n.el.style[o]=`${r+l}px`),t(n.pos+n.gap)>=t(i-e)&&t(n.pos)>t(c+e)&&t(c)1&&(h=this.pages[u[0]],d=this.pages[u[1]]),h&&d){let t=0;for(const e of this.slides)e.el?this.inTransition.has(e.index)&&h.slides.indexOf(e)<0&&(e.el.style[o]=`${t+(h.pos-d.pos)}px`):t+=e.dim+e.gap}}createSlideEl(t){if(!this.track||!t)return;if(t.el)return;const e=document.createElement("div");S(e,this.cn("slide")),S(e,t.class),t.html&&(e.innerHTML=t.html);const i=[];this.slides.forEach(((t,e)=>{t.el&&i.push(e)}));const n=t.index;let s=null;if(i.length){let t=i.reduce(((t,e)=>Math.abs(e-n)this.page?1:-1,a=this.pages[s].pos*(this.isRTL?1:-1);if(this.page===s&&a===n.target[this.axis])return!1;this.clearTransitions();const r=n.isResting;S(this.container,this.cn("inTransition"));const l=this.pages[this.page].slides[0],c=this.pages[s].slides[0];this.inTransition.add(c.index),this.createSlideEl(c);let h=l.el,d=c.el;r||"slide"===e||(e="fadeFast",h=null);const u=this.isRTL?"next":"prev",p=this.isRTL?"prev":"next";return h&&(this.inTransition.add(l.index),l.transition=e,h.addEventListener("animationend",this.onAnimationEnd),h.classList.add(`f-${e}Out`,`to-${o>0?p:u}`)),d&&(c.transition=e,d.addEventListener("animationend",this.onAnimationEnd),d.classList.add(`f-${e}In`,`from-${o>0?u:p}`)),n.panTo({x:this.isHorizontal?a:0,y:this.isHorizontal?0:a,friction:0}),this.onChange(s),!0}manageSlideVisiblity(){const t=new Set,e=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const n of this.slides)i.has(n)?t.add(n):e.add(n);for(const e of this.inTransition)t.add(this.slides[e]);for(const e of t)this.createSlideEl(e),this.lazyLoadSlide(e);for(const i of e)t.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t="aria-hidden";let e=this.cn("isSelected");if(e)for(const i of this.slides)i.el&&(i.el.dataset.index=`${i.index}`,this.pages[this.page].slides.includes(i)?(i.el.classList.contains(e)||(S(i.el,e),this.emit("selectSlide",i)),i.el.removeAttribute(t)):(i.el.classList.contains(e)&&(x(i.el,e),this.emit("unselectSlide",i)),i.el.setAttribute(t,"true")))}flipInfiniteTrack(){const t=this.panzoom;if(!t||!this.isInfinite)return;const e="x"===this.option("axis")?"e":"f",{viewportDim:i,contentDim:n}=this;let s=t.current[e],o=t.target[e]-s,a=0,r=.5*i,l=n;this.isRTL&&this.isHorizontal?(s<-r&&(a=-1,s+=l),s>l-r&&(a=1,s-=l)):(s>r&&(a=1,s-=l),s<-l+r&&(a=-1,s+=l)),a&&(t.current[e]=s,t.target[e]=s+o)}lazyLoadSlide(t){const e=this,n=t&&t.el;if(!n)return;const s=new Set;n.querySelectorAll("[data-lazy-srcset]").forEach((t=>{t instanceof HTMLImageElement&&s.add(t)})),n.querySelectorAll("[data-lazy-src]").forEach((t=>{t instanceof HTMLImageElement?s.add(t):w(t)&&(t.style.backgroundImage=`url('${t.dataset.lazySrc||""}')`)}));const o=(t,i,n)=>{n&&(n.remove(),n=null),i.complete&&(i.style.display=""),this.option("adaptiveHeight")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&e.setViewportHeight()};for(const e of s){let n=null;e.src=e.dataset.lazySrcset||e.dataset.lazySrc||"",delete e.dataset.lazySrc,delete e.dataset.lazySrcset,e.style.display="none",e.addEventListener("error",(()=>{o(t,e,n)})),e.addEventListener("load",(()=>{o(t,e,n)})),setTimeout((()=>{e.parentNode&&t.el&&(e.complete?o(t,e,n):(n=i(y),e.parentNode.insertBefore(n,e)))}),300)}let a=n.dataset.lazySrc;a&&a.length&&(n.style.backgroundImage=`url('${a}')`)}clearTransitions(){this.inTransition.clear(),x(this.container,this.cn("inTransition"));const t=["to-prev","to-next","from-prev","from-next"];for(const e of this.slides){const i=e.el;if(i){i.removeEventListener("animationend",this.onAnimationEnd),i.classList.remove(...t);const n=e.transition;n&&i.classList.remove(`f-${n}Out`,`f-${n}In`)}}this.manageSlideVisiblity()}onAnimationEnd(t){const e=t.target,i=e?parseInt(e.dataset.index||"",10)||0:-1,n=this.slides[i],s=t.animationName;if(!e||!n||!s)return;const o=!!this.inTransition.has(i)&&n.transition;o&&s.substring(0,o.length+2)===`f-${o}`&&this.inTransition.delete(i),this.inTransition.size||this.clearTransitions(),i===this.page&&this.emit("settle")}onDecel(t,e=0,i=0){const n=this.isInfinite,s=this.isHorizontal?e:i,o=this.pages.length;if(!o)return;const a=this.option("dragFree");let r=this.page,l=0;const c=this.axis;!n&&(t.target[c],this.viewportDim);const h=t.current[c]*(this.isRTL&&this.isHorizontal?1:-1);let{pageIndex:d}=this.getPageFromPosition(h);if(a||Math.abs(s)<10){const e=t.target[c]*(this.isRTL&&this.isHorizontal?1:-1),{pageIndex:i}=this.getPageFromPosition(e);r=i}else r=this.isRTL&&this.isHorizontal?s<0?d-1:d+1:s<0?d+1:d-1,n||(r=Math.max(0,Math.min(r,this.pages.length-1)));if(n&&(l=Math.floor(r/o)||0),r=(r%o+o)%o,a&&t.dragOffset["e"===c?"x":"y"]);else{const e=this.contentDim;let i=(this.pages[r].pos+l*e)*(this.isRTL&&this.isHorizontal?1:-1);if(Math.abs(t.target[c]-i)<.1&&t.lockedAxis===("e"==c?"y":"x"))return;if(t.target[c]===i)return;t.applyChange({panX:this.isHorizontal?i-t.target.e:0,panY:this.isHorizontal?0:i-t.target.f,friction:t.option("decelFriction")})}r!==this.page&&this.onChange(r)}onClick(t){const e=t.target,i=e&&w(e)?e.dataset:null;let n;i&&(void 0!==i.carouselPage?n="slideTo":void 0!==i.carouselNext?n="slideNext":void 0!==i.carouselPrev&&(n="slidePrev")),n?(t.preventDefault(),t.stopPropagation(),e&&!e.hasAttribute("disabled")&&this[n](i&&"slideTo"===n?i.carouselPage:void 0)):this.emit("click",t)}onSlideTo(t){const e=t.detail||0;this.slideTo(this.getPageForSlide(e),{friction:0})}onChange(t,e=0){const i=this.page;this.prevPage=i,this.page=t,this.option("adaptiveHeight")&&this.setViewportHeight(),this.emit("change",t,i,e)}onRefresh(t,e=""){let i=this.contentDim,n=this.viewportDim;this.updateMetrics(),this.contentDim===i&&this.viewportDim===n||this.slideTo(this.page,{friction:0,transition:!1})}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(){this.flipInfiniteTrack(),this.manageSlideVisiblity()}onEndAnimation(){this.emit("settle")}reInit(t=null,e=null){this.destroy(),this.state=L.Init,this.userOptions=t||this.userOptions,this.userPlugins=e||this.userPlugins,this.processOptions()}slideTo(t=0,{friction:e=this.option("friction"),transition:i=this.option("transition")}={}){if(this.state===L.Destroy)return;const n=this.panzoom,s=this.pages.length;if(!n||!s)return;if(this.transitionTo(t,i))return;const o=this.axis,a=this.getPageFromIndex(t);let r=this.pages[a].pos,l=0;if(this.isInfinite){const t=n.current[o]*(this.isRTL&&this.isHorizontal?1:-1),e=this.contentDim,i=r+e,s=r-e;Math.abs(t-i){t.el&&(s=Math.max(s,t.el.offsetHeight))}))),i.style.height=s?`${s}px`:""}getPageForSlide(t){for(const e of this.pages)for(const i of e.slides)if(i.index===t)return e.index;return-1}getVisibleSlides(e=0){var i;const n=new Set;let{contentDim:s,viewportDim:o,pages:a,page:r}=this;s=s+(null===(i=this.slides[this.slides.length-1])||void 0===i?void 0:i.gap)||0;let l=0;l=this.panzoom?-1*this.panzoom.current[this.axis]:a[r]&&a[r].pos||0,this.isInfinite&&(l-=Math.floor(l/s)*s),this.isRTL&&this.isHorizontal&&(l*=-1),l=t(l,1e3);const c=t(l-o*e,1e3),h=t(l+o*(e+1),1e3),d=this.isInfinite?[-1,0,1]:[0];for(const t of this.slides)for(const e of d){const i=t.pos+e*s,o=t.pos+t.dim+t.gap+e*s;ic&&n.add(t)}return n}getPageFromPosition(t){const{viewportDim:e,contentDim:i}=this,n=this.pages.length;let s=0,o=0;const a=this.option("center");a&&(t+=.5*e),this.isInfinite||(t=Math.max(this.slides[0].pos,Math.min(t,this.slides[this.slides.length-1].pos)));const r=i+this.slides[this.slides.length-1].gap,l=Math.floor(t/r)||0;t-=l*r;let c=this.slides[this.slides.length-1],h=this.slides.find((e=>{const i=t+(c&&!a?.5*c.dim:0);return c=e,e.pos<=i&&e.pos+e.dim+e.gap>i}));return h||(h=this.slides[this.slides.length-1]),o=this.getPageForSlide(h.index),s=o+l*n,{page:s,pageIndex:o}}destroy(){if([L.Destroy].includes(this.state))return;this.state=L.Destroy;const{container:t,viewport:e,track:i,slides:n,panzoom:s}=this,o=this.option("classes");t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),t.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),s&&(s.destroy(),this.panzoom=null),n&&n.forEach((t=>{this.removeSlideEl(t)})),this.detachPlugins(),this.track=null,this.viewport=null,this.page=0,e&&i&&e.replaceWith(...i.childNodes);for(const[e,i]of Object.entries(o))"container"!==e&&i&&t.classList.remove(i);this.slides=[];const a=this.events.get("ready");this.events=new Map,a&&this.events.set("ready",a)}}Object.defineProperty(B,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:M}),Object.defineProperty(B,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:A}),Object.defineProperty(B,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:H});const _=!("undefined"==typeof window||!window.document||!window.document.createElement);let N;const W=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","),$={dragToClose:!0,hideScrollbar:!0,Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},contentClick:"toggleZoom",contentDblClick:!1,backdropClick:"close",animated:!0,idle:3500,showClass:"f-zoomInUp",hideClass:"f-fadeOut",commonCaption:!1,parentEl:null,startIndex:0,l10n:Object.assign(Object.assign({},b),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),tpl:{closeButton:'',main:''},groupAll:!1,groupAttr:"data-fancybox",defaultType:"image",defaultDisplay:"block",autoFocus:!0,trapFocus:!0,placeFocusBack:!0,closeButton:"auto",keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"next",ArrowDown:"prev",ArrowRight:"next",ArrowLeft:"prev"},Fullscreen:{autoStart:!1},compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,wheel:"zoom"};var X,Y;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Closing=2]="Closing",t[t.CustomClosing=3]="CustomClosing",t[t.Destroy=4]="Destroy"}(X||(X={})),function(t){t[t.Loading=0]="Loading",t[t.Opening=1]="Opening",t[t.Ready=2]="Ready",t[t.Closing=3]="Closing"}(Y||(Y={}));const q=()=>{queueMicrotask((()=>{(()=>{const{slug:t,index:e}=Z.parseURL(),i=vt.getInstance();if(i&&!1!==i.option("Hash")){const n=i.carousel;if(t&&n){for(let e of n.slides)if(e.slug&&e.slug===t)return n.slideTo(e.index);if(t===i.option("slug"))return n.slideTo(e-1);const s=i.getSlide(),o=s&&s.triggerEl&&s.triggerEl.dataset;if(o&&o.fancybox===t)return n.slideTo(e-1)}Z.hasSilentClose=!0,i.close()}Z.startFromUrl()})()}))};class Z extends k{constructor(){super(...arguments),Object.defineProperty(this,"origHash",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null})}onChange(){const t=this.instance,e=t.carousel;this.timer&&clearTimeout(this.timer);const i=t.getSlide();if(!e||!i)return;const n=t.isOpeningSlide(i),s=new URL(document.URL).hash;let o,a=i.slug||void 0;o=a||this.instance.option("slug"),!o&&i.triggerEl&&i.triggerEl.dataset&&(o=i.triggerEl.dataset.fancybox);let r="";o&&"true"!==o&&(r="#"+o+(!a&&e.slides.length>1?"-"+(i.index+1):"")),n&&(this.origHash=s!==r?s:""),r&&s!==r&&(this.timer=setTimeout((()=>{try{window.history[n?"pushState":"replaceState"]({},document.title,window.location.pathname+window.location.search+r)}catch(t){}}),300))}onClose(){if(this.timer&&clearTimeout(this.timer),!0!==Z.hasSilentClose)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(this.origHash||""))}catch(t){}}attach(){this.instance.on("Carousel.ready",this.onChange),this.instance.on("Carousel.change",this.onChange),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.ready",this.onChange),this.instance.off("Carousel.change",this.onChange),this.instance.off("close",this.onClose)}static parseURL(){const t=window.location.hash.slice(1),e=t.split("-"),i=e[e.length-1],n=i&&/^\+?\d+$/.test(i)&&parseInt(e.pop()||"1",10)||1;return{hash:t,slug:e.join("-"),index:n}}static startFromUrl(){if(Z.hasSilentClose=!1,vt.getInstance()||!1===vt.defaults.Hash)return;const{hash:t,slug:e,index:i}=Z.parseURL();if(!e)return;let n=document.querySelector(`[data-slug="${t}"]`);if(n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),vt.getInstance())return;const s=document.querySelectorAll(`[data-fancybox="${e}"]`);s.length&&(n=s[i-1],n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))}static destroy(){window.removeEventListener("hashchange",q,!1)}}function V(){window.addEventListener("hashchange",q,!1),setTimeout((()=>{Z.startFromUrl()}),500)}Object.defineProperty(Z,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(Z,"hasSilentClose",{enumerable:!0,configurable:!0,writable:!0,value:!1}),_&&(/complete|interactive|loaded/.test(document.readyState)?V():document.addEventListener("DOMContentLoaded",V));const G=t=>new Promise(((e,i)=>{const n=new Image;n.onload=e,n.onerror=i,n.src=t}));class U extends k{onCreateSlide(t,e,i){const n=this.instance,s=n.optionFor(i,"src")||"",{el:o,type:a}=i;o&&"image"===a&&"string"==typeof s&&this.setContent(i,s).then((t=>{if(n.isClosing())return;const e=i.contentEl,s=i.imageEl,o=i.thumbElSrc,a=this.optionFor(i,"initialSize"),r=this.optionFor(i,"zoom"),l={event:n.prevMouseMoveEvent||n.options.event,friction:r?.12:0};if(e&&s&&o&&n.isOpeningSlide(i)&&this.getZoomInfo(i)){let t=document.createElement("img");S(t,"fancybox-ghost"),e.appendChild(t),t.src=o,setTimeout((()=>{n.animate(t,"f-fadeFastOut",(()=>{t&&(t.remove(),t=null)}))}),333),G(o).then((()=>{i.state=Y.Opening,this.instance.emit("reveal",i),this.zoomIn(i).then((()=>{this.instance.done(i)}),(()=>{n.hideLoading(i)}))}),(()=>{n.hideLoading(i),n.revealContent(i)}))}else{let e=n.optionFor(i,"showClass")||void 0,s=!0;n.isOpeningSlide(i)&&("full"===a?t.zoomToFull(l):"cover"===a?t.zoomToCover(l):"max"===a?t.zoomToMax(l):s=!1,t.stop("current")),s&&e&&(e="f-fadeIn"),n.revealContent(i,e)}}),(()=>{n.setError(i,"{{IMAGE_ERROR}}")}))}onRemoveSlide(t){t.panzoom&&t.panzoom.destroy(),t.panzoom=void 0,t.imageEl=void 0}onChange(t,e,i,n){for(const t of e.slides){const e=t.panzoom;e&&t.index!==i&&e.reset(0)}}onClose(){const t=this.instance,e=t.container,i=t.getSlide();if(!e||!e.parentElement||!i)return;const{el:n,contentEl:s,panzoom:o}=i,a=i.thumbElSrc;if(!n||!a||!s||!o||o.isContentLoading||o.state===f.Init||o.state===f.Destroy)return;o.updateMetrics();let r=this.getZoomInfo(i);if(!r)return;this.instance.state=X.CustomClosing,n.classList.remove("is-zooming-in"),n.classList.add("is-zooming-out"),s.style.backgroundImage=`url('${a}')`,G(a).then((()=>{n.classList.add("hide-image")}),(()=>{}));const l=e.getBoundingClientRect();Object.assign(e.style,{position:"absolute",top:`${window.pageYOffset}px`,left:`${window.pageXOffset}px`,bottom:"auto",right:"auto",width:`${l.width}px`,height:`${l.height}px`});const{x:c,y:h,scale:d,opacity:u}=r;if(u){const t=((t,e,i,n)=>{const s=e-t,o=n-i;return e=>i+((e-t)/s*o||0)})(o.scale,d,1,0);o.on("afterTransform",(()=>{s.style.opacity=t(o.scale)+""}))}o.on("endAnimation",(()=>{t.destroy()})),o.target.a=d,o.target.b=0,o.target.c=0,o.target.d=d,o.panTo({x:c,y:h,scale:d,friction:u?.2:.33,ignoreBounds:!0}),o.isResting&&t.destroy()}setContent(t,e){return new Promise(((i,n)=>{var s,o;const a=this.instance,r=t.el;if(!r)return void n();a.showLoading(t);const l=document.createElement("img");if(l.classList.add("fancybox-image"),l.src=e||"",l.alt=(null===(s=t.caption)||void 0===s?void 0:s.replace(/<[^>]+>/gi,"").substring(0,1e3))||`Image ${t.index+1} of ${null===(o=a.carousel)||void 0===o?void 0:o.pages.length}`,t.imageEl=l,a.setContent(t,l,!1),this.option("protected")){r.addEventListener("contextmenu",(t=>{t.preventDefault()}));const e=t.contentEl;if(e){const t=document.createElement("div");S(t,"fancybox-protected"),e.append(t)}}t.panzoom=new M(r,d({},this.option("Panzoom")||{},{content:l,width:a.optionFor(t,"width","auto"),height:a.optionFor(t,"height","auto"),wheel:()=>{const t=a.option("wheel");return("zoom"===t||"pan"==t)&&t},click:(e,i)=>{var n;if(a.isCompact||a.isClosing())return!1;let s=!i||i.target&&(null===(n=t.contentEl)||void 0===n?void 0:n.contains(i.target));return a.option(s?"contentClick":"backdropClick")||!1},dblClick:()=>a.isCompact?"toggleZoom":a.option("contentDblClick")||!1,spinner:!1,panOnlyZoomed:!0,wheelLimit:1/0,transformParent:!0,on:{ready:t=>{i(t)},error:()=>{n()},destroy:()=>{n()}}}))}))}zoomIn(t){return new Promise(((e,i)=>{const{panzoom:n,contentEl:s,el:o}=t,a=this.getZoomInfo(t);if(!(a&&o&&s&&n))return void i();const{x:r,y:l,scale:c,opacity:h}=a,d=()=>{t.state!==Y.Closing&&(h&&(s.style.opacity=Math.max(Math.min(1,1-(1-n.scale)/(1-c)),0)+""),n.scale>=1&&n.scale>n.targetScale-.1&&e(n))},u=t=>{t.scale<.99||(o.classList.remove("is-zooming-in"),t.off("endAnimation",u),t.off("touchStart",u),t.off("afterTransform",d),e(t))};n.on("endAnimation",u),n.on("touchStart",u),n.on("afterTransform",d),n.on(["error","destroy"],(()=>{i()})),n.panTo({x:r,y:l,scale:c,friction:0,ignoreBounds:!0}),n.stop("current");const p=this.instance,m={event:"mousemove"===n.panMode?p.prevMouseMoveEvent||p.options.event:void 0},f=this.optionFor(t,"initialSize");S(o,"is-zooming-in"),p.hideLoading(t),"full"===f?n.zoomToFull(m):"cover"===f?n.zoomToCover(m):"max"===f?n.zoomToMax(m):n.reset(.175)}))}getZoomInfo(t){const{el:e,imageEl:i,thumbEl:n,panzoom:s}=t;if(!e||!i||!n||!s||(t=>{const e=window.pageYOffset,i=window.pageYOffset+window.innerHeight;if(!w(t))return 0;const n=t.getBoundingClientRect(),s=n.y+window.pageYOffset,o=n.y+n.height+window.pageYOffset;if(e>o||io)return 100;if(si)return 100;let a=n.height;si&&(a-=o-i);const r=a/window.innerHeight*100;return Math.round(r)})(n)<5||!this.optionFor(t,"zoom")||this.instance.state===X.Destroy)return!1;const{top:o,left:a,width:r,height:l}=n.getBoundingClientRect();let{top:c,left:h,fitWidth:d,fitHeight:u}=s.contentRect;if(!(r&&l&&d&&u))return!1;const p=r/d,m=s.container.getBoundingClientRect();c+=m.top,h+=m.left;const f=-1*(h+.5*d-(a+.5*r)),g=-1*(c+.5*u-(o+.5*l));let b=this.option("zoomOpacity")||!1;return"auto"===b&&(b=Math.abs(r/l-d/u)>.1),{x:f,y:g,scale:p,opacity:b}}attach(){this.instance.on("Carousel.change",this.onChange),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.change",this.onChange),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("close",this.onClose)}}Object.defineProperty(U,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}});const K=(t,e={})=>{const i=new URL(t),n=new URLSearchParams(i.search),s=new URLSearchParams;for(const[t,i]of[...n,...Object.entries(e)]){let e=i.toString();"t"===t?s.set("start",parseInt(e).toString()):s.set(t,e)}let o=s.toString(),a=t.match(/#t=((.*)?\d+s)/);return a&&(o+=`#t=${a[1]}`),o},J={ajax:null,autoSize:!0,preload:!0,videoAutoplay:!0,videoRatio:16/9,videoTpl:'',videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,rel:0,fs:1}},Q=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo","video"];class tt extends k{onInitSlides(t,e){for(const t of e.slides)this.processType(t)}onCreateSlide(t,e,i){this.setContent(i)}onRemoveSlide(t,e,i){i.closeBtnEl&&(i.closeBtnEl.remove(),i.closeBtnEl=void 0),i.xhr&&(i.xhr.abort(),i.xhr=null),i.iframeEl&&(i.iframeEl.onload=i.iframeEl.onerror=null,i.iframeEl.src="//about:blank",i.iframeEl=null);const n=i.contentEl,s=i.placeholderEl;if("inline"===i.type&&n&&s)n.classList.remove("fancybox__content"),"none"!==n.style.display&&(n.style.display="none"),s.parentNode&&s.parentNode.insertBefore(n,s),s.remove(),i.placeholderEl=null;else for(;i.el&&i.el.firstChild;)i.el.removeChild(i.el.firstChild)}onSelectSlide(t,e,i){i.state===Y.Ready&&this.playVideo()}onUnselectSlide(t,e,i){var n,s;if("html5video"===i.type){try{null===(s=null===(n=i.el)||void 0===n?void 0:n.querySelector("video"))||void 0===s||s.pause()}catch(t){}return}let o;"vimeo"===i.type?o={method:"pause",value:"true"}:"youtube"===i.type&&(o={event:"command",func:"pauseVideo"}),o&&i.iframeEl&&i.iframeEl.contentWindow&&i.iframeEl.contentWindow.postMessage(JSON.stringify(o),"*"),i.poller&&clearTimeout(i.poller)}onDone(t,e){t.isCurrentSlide(e)&&!t.isClosing()&&this.playVideo()}onRefresh(t,e){e.slides.forEach((t=>{t.el&&(this.setAspectRatio(t),this.resizeIframe(t))}))}onMessage(t){try{let e=JSON.parse(t.data);if("https://player.vimeo.com"===t.origin){if("ready"===e.event)for(let e of Array.from(document.getElementsByClassName("fancybox__iframe")))e instanceof HTMLIFrameElement&&e.contentWindow===t.source&&(e.dataset.ready="true")}else if("https://www.youtube-nocookie.com"===t.origin&&"onReady"===e.event){const t=document.getElementById(e.id);t&&(t.dataset.ready="true")}}catch(t){}}loadAjaxContent(t){const e=this.instance.optionFor(t,"src")||"";this.instance.showLoading(t);const i=this.instance,n=new XMLHttpRequest;i.showLoading(t),n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&i.state===X.Ready&&(i.hideLoading(t),200===n.status?i.setContent(t,n.responseText):i.setError(t,404===n.status?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const s=t.ajax||null;n.open(s?"POST":"GET",e+""),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send(s),t.xhr=n}setInlineContent(t){let e=null;if(w(t.src))e=t.src;else if("string"==typeof t.src){const i=t.src.split("#",2).pop();e=i?document.getElementById(i):null}if(e){if("clone"===t.type||e.dataset.placeholderId){e=e.cloneNode(!0);const i=e.dataset.animationName;i&&(e.classList.remove(i),delete e.dataset.animationName),delete e.dataset.placeholderId;let n=e.getAttribute("id");n=n?`${n}--clone`:`clone-${this.instance.id}-${t.index}`,e.setAttribute("id",n)}else if(e.parentNode){const i=document.createElement("div");i.classList.add("fancybox-placeholder"),e.parentNode.insertBefore(i,e),t.placeholderEl=i}this.instance.setContent(t,e)}else this.instance.setError(t,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(t){const{src:e,el:i}=t;if(!e||"string"!=typeof e||!i)return;const n=this.instance,s=document.createElement("iframe");s.className="fancybox__iframe",s.setAttribute("id",`fancybox__iframe_${n.id}_${t.index}`),s.setAttribute("allow","autoplay; fullscreen"),s.setAttribute("scrolling","auto"),s.onerror=()=>{n.setError(t,"{{IFRAME_ERROR}}")},t.iframeEl=s;const o=this.optionFor(t,"preload");if(i.classList.add("is-loading"),"iframe"!==t.type||!1===o)return s.setAttribute("src",t.src+""),this.resizeIframe(t),void n.setContent(t,s);n.showLoading(t),s.onload=()=>{if(!s.src.length)return;const e="true"!==s.dataset.ready;s.dataset.ready="true",this.resizeIframe(t),e?n.revealContent(t):n.hideLoading(t)},s.setAttribute("src",e),n.setContent(t,s,!1)}resizeIframe(t){const e=t.iframeEl,i=null==e?void 0:e.parentElement;if(!e||!i)return;let n=t.autoSize,s=t.width||0,o=t.height||0;s&&o&&(n=!1);const a=i&&i.style;if(!1!==t.preload&&!1!==n&&a)try{const t=window.getComputedStyle(i),n=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),r=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),l=e.contentWindow;if(l){const t=l.document,e=t.getElementsByTagName("html")[0],i=t.body;a.width="",i.style.overflow="hidden",s=s||e.scrollWidth+n,a.width=`${s}px`,i.style.overflow="",a.flex="0 0 auto",a.height=`${i.scrollHeight}px`,o=e.scrollHeight+r}}catch(t){}if(s||o){const t={flex:"0 1 auto",width:"",height:""};s&&(t.width=`${s}px`),o&&(t.height=`${o}px`),Object.assign(a,t)}}playVideo(){const t=this.instance.getSlide();if(!t)return;const{el:e}=t;if(!e||!e.offsetParent)return;if(!this.optionFor(t,"videoAutoplay"))return;if("html5video"===t.type)try{const t=e.querySelector("video");if(t){const e=t.play();void 0!==e&&e.then((()=>{})).catch((e=>{t.muted=!0,t.play()}))}}catch(t){}if("youtube"!==t.type&&"vimeo"!==t.type)return;const i=()=>{if(t.iframeEl&&t.iframeEl.contentWindow){let e;if("true"===t.iframeEl.dataset.ready)return e="youtube"===t.type?{event:"command",func:"playVideo"}:{method:"play",value:"true"},e&&t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"),void(t.poller=void 0);"youtube"===t.type&&(e={event:"listening",id:t.iframeEl.getAttribute("id")},t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"))}t.poller=setTimeout(i,250)};i()}processType(t){if(t.html)return t.type="html",t.src=t.html,void(t.html="");const e=this.instance.optionFor(t,"src","");if(!e||"string"!=typeof e)return;let i=t.type,n=null;if(n=e.match(/(?:youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const s=K(e,this.optionFor(t,"youtube")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://www.youtube-nocookie.com/embed/${o}?${s}`,t.thumbSrc=t.thumbSrc||`https://i.ytimg.com/vi/${o}/mqdefault.jpg`,i="youtube"}else if(n=e.match(/^.+vimeo.com\/(?:\/)?([\d]+)(.*)?/)){const s=K(e,this.optionFor(t,"vimeo")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://player.vimeo.com/video/${o}?${s}`,i="vimeo"}if(!i&&t.triggerEl){const e=t.triggerEl.dataset.type;Q.includes(e)&&(i=e)}i||"string"==typeof e&&("#"===e.charAt(0)?i="inline":(n=e.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(i="html5video",t.videoFormat=t.videoFormat||"video/"+("ogv"===n[1]?"ogg":n[1])):e.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?i="image":e.match(/\.(pdf)((\?|#).*)?$/i)?i="pdf":(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src=`https://maps.google.${n[1]}/?ll=${(n[2]?n[2]+"&z="+Math.floor(parseFloat(n[3]))+(n[4]?n[4].replace(/^\//,"&"):""):n[4]+"").replace(/\?/,"&")}&output=${n[4]&&n[4].indexOf("layer=c")>0?"svembed":"embed"}`,i="map"):(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src=`https://maps.google.${n[1]}/maps?q=${n[2].replace("query=","q=").replace("api=1","")}&output=embed`,i="map")),t.type=i||this.instance.option("defaultType")}setContent(t){const e=this.instance.optionFor(t,"src")||"";if(t&&t.type&&e){switch(t.type){case"html":this.instance.setContent(t,e);break;case"html5video":const i=this.option("videoTpl");i&&this.instance.setContent(t,i.replace(/\{\{src\}\}/gi,e+"").replace(/\{\{format\}\}/gi,this.optionFor(t,"videoFormat")||"").replace(/\{\{poster\}\}/gi,t.poster||t.thumbSrc||""));break;case"inline":case"clone":this.setInlineContent(t);break;case"ajax":this.loadAjaxContent(t);break;case"pdf":case"map":case"youtube":case"vimeo":t.preload=!1;case"iframe":this.setIframeContent(t)}this.setAspectRatio(t)}}setAspectRatio(t){var e;const i=t.contentEl,n=this.optionFor(t,"videoRatio"),s=null===(e=t.el)||void 0===e?void 0:e.getBoundingClientRect();if(!(i&&s&&n&&1!==n&&t.type&&["video","youtube","vimeo","html5video"].includes(t.type)))return;const o=s.width,a=s.height;i.style.aspectRatio=n+"",i.style.width=o/a>n?"auto":"",i.style.height=o/a>n?"":"auto"}attach(){this.instance.on("Carousel.initSlides",this.onInitSlides),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("Carousel.selectSlide",this.onSelectSlide),this.instance.on("Carousel.unselectSlide",this.onUnselectSlide),this.instance.on("Carousel.Panzoom.refresh",this.onRefresh),this.instance.on("done",this.onDone),window.addEventListener("message",this.onMessage)}detach(){this.instance.off("Carousel.initSlides",this.onInitSlides),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("Carousel.selectSlide",this.onSelectSlide),this.instance.off("Carousel.unselectSlide",this.onUnselectSlide),this.instance.off("Carousel.Panzoom.refresh",this.onRefresh),this.instance.off("done",this.onDone),window.removeEventListener("message",this.onMessage)}}Object.defineProperty(tt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:J});class et extends k{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:"ready"}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return"ready"!==this.state}onReady(t){this.option("autoStart")&&(t.isInfinite||t.page{this.timer=null,this.inHover||this.onTimerEnd()}),e),t.style.transitionDuration=`${e}ms`,t.style.transform="scaleX(1)"}this.emit("set")}clear(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.removeProgressBar()}start(){if(this.set(),this.option("pauseOnHover")){const t=this.instance.container;t.addEventListener("mouseenter",this.onMouseEnter,!1),t.addEventListener("mouseleave",this.onMouseLeave,!1)}document.addEventListener("visibilitychange",this.onVisibilityChange,!1)}stop(){const t=this.instance.container;this.clear(),this.state="ready",t.removeEventListener("mouseenter",this.onMouseEnter,!1),t.removeEventListener("mouseleave",this.onMouseLeave,!1),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),x(t,"has-autoplay"),this.emit("stop")}pause(){"play"===this.state&&(this.state="pause",this.clear(),this.emit("pause"))}resume(){const t=this.instance;if(t.isInfinite||t.page!==t.pages.length-1)if("play"!==this.state){if("pause"===this.state&&!this.inHover){const t=new Event("resume",{bubbles:!0,cancelable:!0});this.emit("resume",event),t.defaultPrevented||this.set()}}else this.set();else this.stop()}toggle(){"play"===this.state||"pause"===this.state?this.stop():this.set()}attach(){this.instance.on("ready",this.onReady),this.instance.on("Panzoom.startAnimation",this.onChange),this.instance.on("Panzoom.endAnimation",this.onSettle),this.instance.on("Panzoom.touchMove",this.onChange)}detach(){this.instance.off("ready",this.onReady),this.instance.off("Panzoom.startAnimation",this.onChange),this.instance.off("Panzoom.endAnimation",this.onSettle),this.instance.off("Panzoom.touchMove",this.onChange),this.stop()}}Object.defineProperty(et,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class it extends k{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(t){const e=t.carousel;if(!e)return;const i=t.container;i&&(e.options.Autoplay=d(this.option("Autoplay")||{},{pauseOnHover:!1,autoStart:!1,timeout:this.option("timeout"),progressParentEl:()=>i.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]")||i,on:{set:e=>{var n;i.classList.add("has-slideshow"),(null===(n=t.getSlide())||void 0===n?void 0:n.state)!==Y.Ready&&e.pause()},stop:()=>{i.classList.remove("has-slideshow"),t.isCompact||t.endIdle()},resume:(e,i)=>{var n,s,o;!i||!i.cancelable||(null===(n=t.getSlide())||void 0===n?void 0:n.state)===Y.Ready&&(null===(o=null===(s=t.carousel)||void 0===s?void 0:s.panzoom)||void 0===o?void 0:o.isResting)||i.preventDefault()}}}),e.attachPlugins({Autoplay:et}),this.ref=e.plugins.Autoplay)}onReady(t){const e=t.carousel,i=this.ref;e&&i&&this.option("playOnStart")&&(e.isInfinite||e.page{t.isCurrentSlide(e)&&i.stop()})),t.isCurrentSlide(e)&&i.resume()}onKeydown(t,e){var i;const n=this.ref;n&&e===this.option("key")&&"BUTTON"!==(null===(i=document.activeElement)||void 0===i?void 0:i.nodeName)&&n.toggle()}attach(){this.instance.on("Carousel.init",this.onPrepare),this.instance.on("Carousel.ready",this.onReady),this.instance.on("done",this.onDone),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onPrepare),this.instance.off("Carousel.ready",this.onReady),this.instance.off("done",this.onDone),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(it,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{key:" ",playOnStart:!1,timeout:3e3}});const nt={classes:{container:"f-thumbs f-carousel__thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'',type:"modern"};var st;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden",t[t.Disabled=3]="Disabled"}(st||(st={}));let ot=class extends k{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"shouldCenter",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:st.Init})}formatThumb(t,e){return this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}getSlides(){const t=[],e=this.option("thumbTpl")||"";if(e)for(const i of this.instance.slides||[])t.push({html:this.formatThumb(i,e),customClass:`has-thumb for-${i.type||"image"}`});return t}getProgress(t){const e=this.instance,i=e.panzoom,n=e.pages[t]||0;if(!n||!i)return 0;let s=-1*i.current.e,o=e.contentDim,a=(s-n.pos)/(1*n.dim),r=(s+o-n.pos)/(1*n.dim),l=(s-o-n.pos)/(1*n.dim);return a=Math.max(0,Math.min(1,Math.abs(a))),r=Math.max(0,Math.min(1,Math.abs(r))),l=Math.max(0,Math.min(1,Math.abs(l))),a=Math.min(a,r,l),a}onInitSlide(t,e){const i=e.el;i&&(e.thumbSrc=i.dataset.thumbSrc||e.thumbSrc||"",e.thumbClipWidth=parseFloat(i.dataset.thumbClipWidth||"")||e.thumbClipWidth||0,e.thumbHeight=parseFloat(i.dataset.thumbHeight||"")||e.thumbHeight||0)}onInitSlides(){this.state===st.Init&&this.build()}onRefreshM(){this.refreshModern()}onChangeM(){"modern"===this.type&&(this.shouldCenter=!0,this.centerModern())}onClickModern(t){t.preventDefault(),t.stopPropagation();const e=this.instance,i=e.page,n=t=>{if(t){const e=t.closest("[data-carousel-page]");if(e)return parseInt(e.dataset.carouselPage||"",10)||0}return-1},s=(t,e)=>{const i=document.elementFromPoint(t,e);return i?n(i):-1};let o=n(t.target);o<0&&(o=s(t.clientX+this.thumbGap,t.clientY),o===i&&(o=i-1)),o<0&&(o=s(t.clientX-this.thumbGap,t.clientY),o===i&&(o=i+1)),o<0&&(o=(e=>{let n=s(t.clientX-e,t.clientY),a=s(t.clientX+e,t.clientY);return o<0&&n===i&&(o=i+1),o<0&&a===i&&(o=i-1),o})(this.thumbExtraGap)),o===i?this.centerModern():o>-1&&o{this.emit("ready")}))}buildModern(){if("modern"!==this.type)return;const{container:t,track:e,instance:n}=this,s=this.option("thumbTpl")||"";if(!t||!e||!s)return;this.updateModern();for(const t of n.slides||[]){const n=document.createElement("div");S(n,this.cn("slide")),n.appendChild(i(this.formatThumb(t,s))),t.thumbSlideEl=n,e.appendChild(n),this.resizeModernSlide(t)}const o=new n.constructor.Panzoom(t,{content:e,lockAxis:"x",zoom:!1,panOnlyZoomed:!1,bounds:()=>{let t=0,e=0,i=n.slides[0],s=n.slides[n.slides.length-1],o=n.slides[n.page];return i&&s&&o&&(e=-1*this.getModernThumbPos(0),0!==n.page&&(e+=.5*(i.thumbWidth||0)),t=-1*this.getModernThumbPos(n.slides.length-1),n.page!==n.slides.length-1&&(t+=(s.thumbWidth||0)-(o.thumbWidth||0)-.5*(s.thumbWidth||0))),{x:{min:t,max:e},y:{min:0,max:0}}}});o.on("touchStart",(()=>{this.shouldCenter=!1})),o.on("click",((t,e)=>this.onClickModern(e))),o.on("ready",(()=>{this.centerModern(),this.emit("ready")})),o.on(["afterTransform","refresh"],(t=>{this.lazyLoadModern()})),this.panzoom=o,this.refreshModern()}updateModern(){if("modern"!==this.type)return;const{container:t}=this;t&&(this.thumbGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-gap"))||0,this.thumbExtraGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-extra-gap"))||0,this.thumbWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-width"))||40,this.thumbClipWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-clip-width"))||40,this.thumbHeight=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-height"))||40)}refreshModern(){var t;if("modern"===this.type){this.updateModern();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.onTransformM(),null===(t=this.panzoom)||void 0===t||t.updateMetrics(!0),this.centerModern(0)}}centerModern(e){const i=this.instance,{container:n,panzoom:s}=this;if(!n||!s||s.state===f.Init)return;const o=i.page;let a=this.getModernThumbPos(o),r=a;for(let t=i.page-3;ti.pages.length-1||t===i.page)continue;const e=1-this.getProgress(t);e>0&&e<1&&(r+=e*(this.getModernThumbPos(t)-a))}let l=100;void 0===e&&(e=.2,i.inTransition.size>0&&(e=.12),Math.abs(-1*s.current.e-r)>s.containerRect.width&&(e=.5,l=0)),s.options.maxVelocity=l,s.applyChange({panX:t(-1*r-s.target.e,1e3),friction:null===i.prevPage?0:e})}lazyLoadModern(){const{instance:t,panzoom:e}=this;if(!e)return;const n=-1*e.current.e||0;let s=this.getModernThumbPos(t.page);if(e.state!==f.Init||0===s)for(const s of t.slides||[]){const t=s.thumbSlideEl;if(!t)continue;const o=t.querySelector("img[data-lazy-src]"),a=s.index,r=this.getModernThumbPos(a),l=n-.5*e.containerRect.innerWidth,c=l+e.containerRect.innerWidth;if(!o||rc)continue;let h=o.dataset.lazySrc;if(!h||!h.length)continue;if(delete o.dataset.lazySrc,o.src=h,o.complete)continue;S(t,this.cn("isLoading"));const d=i(y);t.appendChild(d),o.addEventListener("load",(()=>{t.offsetParent&&(t.classList.remove(this.cn("isLoading")),d.remove())}),!1)}}resizeModernSlide(t){if("modern"!==this.type)return;if(!t.thumbSlideEl)return;const e=t.thumbClipWidth&&t.thumbHeight?Math.round(this.thumbHeight*(t.thumbClipWidth/t.thumbHeight)):this.thumbWidth;t.thumbWidth=e}getModernThumbPos(e){const i=this.instance.slides[e],n=this.panzoom;if(!n||!n.contentRect.fitWidth)return 0;let s=n.containerRect.innerWidth,o=n.contentRect.width;2===this.instance.slides.length&&(e-=1,o=2*this.thumbClipWidth);let a=e*(this.thumbClipWidth+this.thumbGap)+this.thumbExtraGap+.5*(i.thumbWidth||0);return a-=o>s?.5*s:.5*o,t(a||0,1)}build(){const t=this.instance,e=t.container,i=this.option("minCount")||0;if(i){let e=0;for(const i of t.slides||[])i.thumbSrc&&e++;if(e{e.stopPropagation()}}},on:{ready:t=>{const e=t.container;e&&this.hidden&&(this.refresh(),e.style.transition="none",this.hide(),e.offsetHeight,queueMicrotask((()=>{e.style.transition="",this.show()})))}}}),e.attachPlugins({Thumbs:ot}),this.ref=e.plugins.Thumbs,this.option("showOnStart")||(this.ref.state=st.Hidden,this.hidden=!0))}onResize(){var t;const e=null===(t=this.ref)||void 0===t?void 0:t.container;e&&(e.style.maxHeight="")}onKeydown(t,e){const i=this.option("key");i&&i===e&&this.toggle()}toggle(){const t=this.ref;t&&t.state!==st.Disabled&&(t.state!==st.Hidden?this.hidden?this.show():this.hide():t.build())}show(){const t=this.ref,e=t&&t.state!==st.Disabled&&t.container;e&&(this.refresh(),e.offsetHeight,e.removeAttribute("aria-hidden"),e.classList.remove("is-hidden"),this.hidden=!1)}hide(){const t=this.ref,e=t&&t.container;e&&(this.refresh(),e.offsetHeight,e.classList.add("is-hidden"),e.setAttribute("aria-hidden","true")),this.hidden=!0}refresh(){const t=this.ref;if(!t||t.state===st.Disabled)return;const e=t.container,i=(null==e?void 0:e.firstChild)||null;e&&i&&i.childNodes.length&&(e.style.maxHeight=`${i.getBoundingClientRect().height}px`)}attach(){this.instance.on("Carousel.init",this.onInit),this.instance.on("resize",this.onResize),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onInit),this.instance.off("resize",this.onResize),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(rt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:at});const lt={panLeft:{icon:'',change:{panX:-100}},panRight:{icon:'',change:{panX:100}},panUp:{icon:'',change:{panY:-100}},panDown:{icon:'',change:{panY:100}},zoomIn:{icon:'',action:"zoomIn"},zoomOut:{icon:'',action:"zoomOut"},toggle1to1:{icon:'',action:"toggleZoom"},toggleZoom:{icon:'',action:"toggleZoom"},iterateZoom:{icon:'',action:"iterateZoom"},rotateCCW:{icon:'',action:"rotateCCW"},rotateCW:{icon:'',action:"rotateCW"},flipX:{icon:'',action:"flipX"},flipY:{icon:'',action:"flipY"},fitX:{icon:'',action:"fitX"},fitY:{icon:'',action:"fitY"},reset:{icon:'',action:"reset"},toggleFS:{icon:'',action:"toggleFS"}};var ct;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Disabled=2]="Disabled"}(ct||(ct={}));const ht={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'
/
'},download:{tpl:''},prev:{tpl:''},next:{tpl:''},slideshow:{tpl:''},fullscreen:{tpl:''},thumbs:{tpl:''},close:{tpl:''}},parentEl:null},dt={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"};class ut extends k{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:ct.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(t){var e;if(!t.carousel)return;let i=this.option("display"),n=this.option("absolute"),s=this.option("enabled");if("auto"===s){const t=this.instance.carousel;let e=0;if(t)for(const i of t.slides)(i.panzoom||"image"===i.type)&&e++;e||(s=!1)}s||(i=void 0);let o=0;const a={left:[],middle:[],right:[]};if(i)for(const t of["left","middle","right"])for(const n of i[t]){const i=this.createEl(n);i&&(null===(e=a[t])||void 0===e||e.push(i),o++)}let r=null;if(o&&(r=this.createContainer()),r){for(const[t,e]of Object.entries(a)){const i=document.createElement("div");S(i,"fancybox__toolbar__column is-"+t);for(const t of e)i.appendChild(t);"auto"!==n||"middle"!==t||e.length||(n=!0),r.appendChild(i)}!0===n&&S(r,"is-absolute"),this.state=ct.Ready,this.onRefresh()}else this.state=ct.Disabled}onClick(t){var e,i;const n=this.instance,s=n.getSlide(),o=null==s?void 0:s.panzoom,a=t.target,r=a&&w(a)?a.dataset:null;if(!r)return;if(void 0!==r.fancyboxToggleThumbs)return t.preventDefault(),t.stopPropagation(),void(null===(e=n.plugins.Thumbs)||void 0===e||e.toggle());if(void 0!==r.fancyboxToggleFullscreen)return t.preventDefault(),t.stopPropagation(),void this.instance.toggleFullscreen();if(void 0!==r.fancyboxToggleSlideshow){t.preventDefault(),t.stopPropagation();const e=null===(i=n.carousel)||void 0===i?void 0:i.plugins.Autoplay;let s=e.isActive;return o&&"mousemove"===o.panMode&&!s&&o.reset(),void(s?e.stop():e.start())}const l=r.panzoomAction,c=r.panzoomChange;if((c||l)&&(t.preventDefault(),t.stopPropagation()),c){let t={};try{t=JSON.parse(c)}catch(t){}o&&o.applyChange(t)}else l&&o&&o[l]&&o[l]()}onChange(){this.onRefresh()}onRefresh(){if(this.instance.isClosing())return;const t=this.container;if(!t)return;const e=this.instance.getSlide();if(!e||e.state!==Y.Ready)return;const i=e&&!e.error&&e.panzoom;for(const e of t.querySelectorAll("[data-panzoom-action]"))i?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));let n=i&&i.canZoomIn(),s=i&&i.canZoomOut();for(const e of t.querySelectorAll('[data-panzoom-action="zoomIn"]'))n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="zoomOut"]'))s?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){s||n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));const t=e.querySelector("g");t&&(t.style.display=n?"":"none")}}onDone(t,e){var i;null===(i=e.panzoom)||void 0===i||i.on("afterTransform",(()=>{this.instance.isCurrentSlide(e)&&this.onRefresh()})),this.instance.isCurrentSlide(e)&&this.onRefresh()}createContainer(){const t=this.instance.container;if(!t)return null;const e=this.option("parentEl")||t,i=document.createElement("div");return S(i,"fancybox__toolbar"),e.prepend(i),i.addEventListener("click",this.onClick,{passive:!1,capture:!0}),t&&S(t,"has-toolbar"),this.container=i,i}createEl(t){var e;const n=this.instance.carousel;if(!n)return null;if("toggleFS"===t)return null;if("fullscreen"===t&&!this.instance.fsAPI)return null;let s=null;const o=n.slides.length||0;let a=0,r=0;for(const t of n.slides)(t.panzoom||"image"===t.type)&&a++,("image"===t.type||t.downloadSrc)&&r++;if(o<2&&["infobar","prev","next"].includes(t))return s;if(void 0!==lt[t]&&!a)return null;if("download"===t&&!r)return null;if("thumbs"===t){const t=this.instance.plugins.Thumbs;if(!t||!t.isEnabled)return null}if("slideshow"===t){if(!(null===(e=this.instance.carousel)||void 0===e?void 0:e.plugins.Autoplay)||o<2)return null}if(void 0!==lt[t]){const e=lt[t];s=document.createElement("button"),s.setAttribute("title",this.instance.localize(`{{${t.toUpperCase()}}}`)),S(s,"f-button"),e.action&&(s.dataset.panzoomAction=e.action),e.change&&(s.dataset.panzoomChange=JSON.stringify(e.change)),s.appendChild(i(this.instance.localize(e.icon)))}else{const e=(this.option("items")||[])[t];e&&(s=i(this.instance.localize(e.tpl)),e.click&&s.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),"function"==typeof e.click&&e.click(t)})))}const l=null==s?void 0:s.querySelector("svg");if(l)for(const[t,e]of Object.entries(dt))l.getAttribute(t)||l.setAttribute(t,String(e));return s}removeContainer(){var t;const e=this.container;e&&e.removeEventListener("click",this.onClick,{passive:!1,capture:!0}),null===(t=this.container)||void 0===t||t.remove(),this.container=null,this.state=ct.Disabled;const i=this.instance.container;i&&x(i,"has-toolbar")}attach(){this.instance.on("Carousel.initSlides",this.onReady),this.instance.on("done",this.onDone),this.instance.on("reveal",this.onChange),this.instance.on("Carousel.change",this.onChange),this.onReady(this.instance)}detach(){this.instance.off("Carousel.initSlides",this.onReady),this.instance.off("done",this.onDone),this.instance.off("reveal",this.onChange),this.instance.off("Carousel.change",this.onChange),this.removeContainer()}}Object.defineProperty(ut,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:ht});const pt={Hash:Z,Html:tt,Images:U,Slideshow:it,Thumbs:rt,Toolbar:ut};let mt=null,ft=null;const gt=new Map;let bt=0;class vt extends m{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(t=[],e={},i={}){super(e),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:X.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fsAPI",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.onWheel=T(this.onWheel.bind(this),300),this.fsAPI=(()=>{let t,e="",i="",n="";return document.fullscreenEnabled?(e="requestFullscreen",i="exitFullscreen",n="fullscreenElement"):document.webkitFullscreenEnabled&&(e="webkitRequestFullscreen",i="webkitExitFullscreen",n="webkitFullscreenElement"),e&&(t={request:function(t){return"webkitRequestFullscreen"===e?t[e](Element.ALLOW_KEYBOARD_INPUT):t[e]()},exit:function(){return document[n]&&document[i]()},isFullscreen:function(){return document[n]}}),t})(),this.id=e.id||++bt,gt.set(this.id,this),this.userSlides=t,this.userPlugins=i,queueMicrotask((()=>{this.init()}))}init(){this.state=X.Init,this.attachPlugins(Object.assign(Object.assign({},vt.Plugins),this.userPlugins)),this.emit("init"),!0===this.option("hideScrollbar")&&(()=>{if(!_)return;if(document.body.classList.contains("compensate-for-scrollbar"))return;const t=window.innerWidth-document.documentElement.getBoundingClientRect().width;document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",`${t}px`),t&&document.body.classList.add("compensate-for-scrollbar")})(),this.initLayout();const t=()=>{this.initCarousel(this.userSlides),this.state=X.Ready,this.attachEvents(),this.emit("ready"),setTimeout((()=>{this.container&&this.container.setAttribute("aria-hidden","false")}),16)};this.option("Fullscreen.autoStart")&&this.fsAPI&&!this.fsAPI.isFullscreen()?this.fsAPI.request(this.container).then((()=>t())).catch((()=>t())):t()}initLayout(){const t=this.option("parentEl")||document.body,e=i(this.localize(this.option("tpl.main")||""));e&&(e.setAttribute("id",`fancybox-${this.id}`),e.setAttribute("aria-label",this.localize("{{MODAL}}")),e.classList.toggle("is-compact",this.isCompact),this.container=e,this.footer=e.querySelector(".fancybox__footer"),t.appendChild(e),document.documentElement.classList.add("with-fancybox"),mt&&ft||(mt=document.createElement("button"),mt.classList.add("fancybox-focus-guard"),mt.setAttribute("aria-hidden","true"),mt.setAttribute("aria-label","Focus guard"),mt.setAttribute("type","button"),ft=mt.cloneNode(),document.body.prepend(mt),document.body.append(ft)),this.option("animated")&&(e.classList.add("is-animated"),setTimeout((()=>{this.isClosing()||e.classList.remove("is-animated")}),350)),this.emit("initLayout"))}initCarousel(t){const e=this.container;if(!e)return;const i=e.querySelector(".fancybox__carousel");if(!i)return;const n=this.carousel=new B(i,d({},{slides:t,transition:"fade",Panzoom:{lockAxis:this.option("dragToClose")?"xy":"x",infinite:!!this.option("dragToClose")&&"y"},Dots:!1,Navigation:{classes:{container:"fancybox__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"}},initialPage:this.option("startIndex"),l10n:this.option("l10n")},this.option("Carousel")||{}));n.on("*",((t,e,...i)=>{this.emit(`Carousel.${e}`,t,...i)})),n.on(["ready","change"],(()=>{this.manageCaption(this.getSlide())})),n.on("removeSlide",((t,e)=>{e.closeBtnEl&&e.closeBtnEl.remove(),e.closeBtnEl=void 0,e.captionEl&&e.captionEl.remove(),e.captionEl=void 0,e.spinnerEl&&e.spinnerEl.remove(),e.spinnerEl=void 0,e.state=void 0})),n.on("Panzoom.touchStart",(()=>{this.isCompact||this.endIdle()})),n.on("settle",(()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&this.checkFocus()})),this.option("dragToClose")&&(n.on("Panzoom.afterTransform",((t,e)=>{const i=this.container;if(i){const t=Math.abs(e.current.f),n=t<1?"":Math.max(.5,Math.min(1,1-t/e.contentRect.fitHeight*1.5));i.style.setProperty("--fancybox-ts",n?"0s":""),i.style.setProperty("--fancybox-opacity",n+"")}})),n.on("Panzoom.touchEnd",((t,e,i)=>{const n=Math.abs(e.dragOffset.y);"y"===e.lockedAxis&&(n>=200||n>=50&&e.dragOffset.time<300)&&(i&&i.cancelable&&i.preventDefault(),this.close(i,"f-throwOut"+(e.current.f<0?"Up":"Down")))}))),n.on(["change"],(t=>{var e;let i=null===(e=this.getSlide())||void 0===e?void 0:e.triggerEl;if(i){const e=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:t.page});i.dispatchEvent(e)}})),n.on(["refresh","change"],(t=>{const e=this.container;if(!e)return;for(const i of e.querySelectorAll("[data-fancybox-current-index]"))i.innerHTML=t.page+1;for(const i of e.querySelectorAll("[data-fancybox-count]"))i.innerHTML=t.pages.length;if(!t.isInfinite){for(const i of e.querySelectorAll("[data-fancybox-next]"))t.page0?(i.removeAttribute("disabled"),i.removeAttribute("tabindex")):(i.setAttribute("disabled",""),i.setAttribute("tabindex","-1"))}const i=this.getSlide();let n=(null==i?void 0:i.downloadSrc)||"";n||!i||"image"!==i.type||i.error||"string"!=typeof i.src||(n=i.src);for(const t of e.querySelectorAll("[data-fancybox-download]"))n?(t.removeAttribute("disabled"),t.removeAttribute("tabindex"),t.setAttribute("href",n),t.setAttribute("download",n),t.setAttribute("target","_blank")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"),t.removeAttribute("href"),t.removeAttribute("download"))})),this.emit("initCarousel")}attachEvents(){const t=this.container;t&&(document.addEventListener("keydown",this.onKeydown,{passive:!1,capture:!0}),t.addEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),document.addEventListener("mousemove",this.onMousemove),window.addEventListener("resize",this.onResize),this.option("trapFocus")&&document.addEventListener("focus",this.onFocus,!0),document.addEventListener("visibilitychange",this.onVisibilityChange,!1))}detachEvents(){const t=this.container;t&&(document.removeEventListener("keydown",this.onKeydown,{passive:!1,capture:!0}),t.removeEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),document.removeEventListener("mousemove",this.onMousemove),window.removeEventListener("resize",this.onResize),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),document.removeEventListener("focus",this.onFocus,!0))}onClick(t){var e;if(this.isClosing())return;!this.isCompact&&this.option("idle")&&this.resetIdle();const i=t.composedPath()[0];if(i===(null===(e=this.carousel)||void 0===e?void 0:e.container))return;if(i.closest(".f-spinner")||i.closest("[data-fancybox-close]"))return t.preventDefault(),void this.close(t);if(i.closest("[data-fancybox-prev]"))return t.preventDefault(),void this.prev();if(i.closest("[data-fancybox-next]"))return t.preventDefault(),void this.next();if(this.isCompact)return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout((()=>{this.toggleIdle(),this.clickTimer=null}),350));if(this.emit("click",t),t.defaultPrevented)return;let n=!1;const s=document.activeElement;if(i.closest(".fancybox__content")){if(s){if(s.closest("[contenteditable]"))return;i.matches(W)||s.blur()}if((o=window.getSelection())&&"Range"===o.type)return;n=this.option("contentClick")}else i.closest(".fancybox__carousel")&&!i.matches(W)&&(n=this.option("backdropClick"));var o;"close"===n?(t.preventDefault(),this.close(t)):"next"===n?(t.preventDefault(),this.next()):"prev"===n&&(t.preventDefault(),this.prev())}onWheel(t){if(this.emit("wheel",t),t.defaultPrevented)return;const e=this.option("wheel",t);if("close"===e)t.preventDefault(),this.close(t);else if("slide"===e){const e=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail));t.preventDefault(),this[e>0?"next":"prev"]()}}onKeydown(t){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const e=t.key,i=this.option("keyboard");if(!i||t.ctrlKey||t.altKey||t.shiftKey)return;const n=t.composedPath()[0],s=document.activeElement&&document.activeElement.classList,o=s&&s.contains("f-button")||n.dataset.carouselPage;if("Escape"!==e&&!o&&w(n)){if(n.isContentEditable||-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(n.nodeName))return}this.emit("keydown",e,t);const a=i[e];"function"==typeof this[a]&&this[a]()}onResize(){const t=this.container;if(!t)return;const e=this.isCompact;t.classList.toggle("is-compact",e),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.emit("resize")}onFocus(t){this.isTopmost()&&this.focus(t)}onMousemove(t){this.prevMouseMoveEvent=t,!this.isCompact&&this.option("idle")&&this.resetIdle()}onVisibilityChange(){"visible"===document.visibilityState?this.checkFocus():this.endIdle()}manageCloseBtn(t){const e=this.optionFor(t,"closeButton")||!1;if("auto"===e){const t=this.plugins.Toolbar;if(t&&t.state===ct.Ready)return}if(!e)return;if(!t.contentEl||t.closeBtnEl)return;const n=i(this.localize(this.option("tpl.closeButton")));t.closeBtnEl=t.contentEl.appendChild(n),t.el&&S(t.el,"has-close-btn")}manageCaption(t){var e,i,n;const s=this.container;if(!s)return;const o=this.isCompact||this.option("commonCaption"),a=!o;if(this.caption&&this.stop(this.caption),a&&this.caption&&(this.caption.remove(),this.caption=null),o&&!this.caption)for(const t of(null===(e=this.carousel)||void 0===e?void 0:e.slides)||[])t.captionEl&&(t.captionEl.remove(),t.captionEl=void 0,null===(i=t.el)||void 0===i||i.classList.remove("has-caption"),null===(n=t.el)||void 0===n||n.removeAttribute("aria-labelledby"));if(t||(t=this.getSlide()),!t||o&&!this.isCurrentSlide(t))return;const r=t.el;let l=this.optionFor(t,"caption","");if("string"!=typeof l||!l.length)return void(o&&this.caption&&this.animate(this.caption,"f-fadeOut",(()=>{var t;null===(t=this.caption)||void 0===t||t.remove(),this.caption=null})));let c=null;if(a){if(c=t.captionEl||null,r&&!c){const e=`fancybox__caption_${this.id}_${t.index}`;c=document.createElement("div"),c.className="fancybox__caption",c.setAttribute("id",e),t.captionEl=r.appendChild(c),r.classList.add("has-caption"),r.setAttribute("aria-labelledby",e)}}else{if(c=this.caption,c||(c=s.querySelector(".fancybox__caption")),!c){c=document.createElement("div"),c.dataset.fancyboxCaption="",c.className="fancybox__caption",c.innerHTML=l;(this.footer||s).prepend(c)}s.classList.add("has-caption"),this.caption=c}c&&(c.innerHTML=l)}checkFocus(){var t;const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}focus(t){var e;if(this.ignoreFocusChange)return;const i=document.activeElement||null,n=(null==t?void 0:t.target)||null,s=this.container,o=this.getSlide();if(!s||!(null===(e=this.carousel)||void 0===e?void 0:e.viewport))return;const a=o&&o.state===Y.Ready?o.el:null;if(!a||a.contains(i))return;t&&t.cancelable&&t.preventDefault(),this.ignoreFocusChange=!0;const r=Array.from(s.querySelectorAll(W));let l,c=[s];for(let t of r){const e=t.offsetParent&&!t.closest('[aria-hidden="true"]'),i=a&&a.contains(t),n=!this.carousel.viewport.contains(t);e&&(i||n)?(c.push(t),void 0!==t.dataset.origTabindex&&(t.tabIndex=parseFloat(t.dataset.origTabindex)),t.removeAttribute("data-orig-tabindex"),(t.hasAttribute("autoFocus")||!l&&i)&&(l=t)):(t.dataset.origTabindex=void 0===t.dataset.origTabindex?t.getAttribute("tabindex")||void 0:t.dataset.origTabindex,t.tabIndex=-1)}let h=null;t?(!n||c.indexOf(n)<0)&&(h=s,c.length&&(i===ft?h=c[0]:this.lastFocus!==s&&i!==mt||(h=c[c.length-1]))):this.option("autoFocus")&&l?h=l:i&&c.indexOf(i)<0&&(h=s),h&&(t=>{if(t&&_){void 0===N&&document.createElement("div").focus({get preventScroll(){return N=!0,!1}});try{if(N)t.focus({preventScroll:!0});else{const e=window.pageXOffset||document.body.scrollTop,i=window.pageYOffset||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:i,behavior:"auto"})}}catch(t){}}})(h),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const t=this.carousel;t&&t.pages.length>1&&t.slideNext()}prev(){const t=this.carousel;t&&t.pages.length>1&&t.slidePrev()}jumpTo(...t){this.carousel&&this.carousel.slideTo(...t)}isTopmost(){var t;return(null===(t=vt.getInstance())||void 0===t?void 0:t.id)==this.id}animate(t=null,e="",i){if(!t||!e)return void(i&&i());this.stop(t);const n=s=>{s.target===t&&t.dataset.animationName&&(t.removeEventListener("animationend",n),delete t.dataset.animationName,i&&i(),t.classList.remove(e))};t.dataset.animationName=e,t.addEventListener("animationend",n),t.classList.add(e)}stop(t){t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:t}))}setContent(t,e="",i=!0){if(this.isClosing())return;const n=t.el;if(!n)return;let s=null;if(w(e))["img","iframe","video","audio"].includes(e.nodeName.toLowerCase())?(s=document.createElement("div"),s.appendChild(e)):s=e;else{const t=document.createRange().createContextualFragment(e);s=document.createElement("div"),s.appendChild(t)}s instanceof Element&&t.filter&&!t.error&&(s=s.querySelector(t.filter)),s instanceof Element?(s.classList.add("fancybox__content"),t.id&&s.setAttribute("id",t.id),"none"!==s.style.display&&"none"!==getComputedStyle(s).getPropertyValue("display")||(s.style.display=t.display||this.option("defaultDisplay")||"flex"),n.classList.add(`has-${t.error?"error":t.type||"unknown"}`),n.prepend(s),t.contentEl=s,i&&this.revealContent(t),this.manageCloseBtn(t),this.manageCaption(t)):this.setError(t,"{{ELEMENT_NOT_FOUND}}")}revealContent(t,e){const i=t.el,n=t.contentEl;i&&n&&(this.emit("reveal",t),this.hideLoading(t),t.state=Y.Opening,(e=this.isOpeningSlide(t)?void 0===e?this.optionFor(t,"showClass"):e:"f-fadeIn")?this.animate(n,e,(()=>{this.done(t)})):this.done(t))}done(t){var e;this.isClosing()||(t.state=Y.Ready,this.emit("done",t),null===(e=t.el)||void 0===e||e.classList.add("is-done"),this.isCurrentSlide(t)&&this.option("autoFocus")&&queueMicrotask((()=>{var t;if(this.option("autoFocus")){const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}})),this.isOpeningSlide(t)&&!this.isCompact&&this.option("idle")&&this.setIdle())}isCurrentSlide(t){const e=this.getSlide();return!(!t||!e)&&e.index===t.index}isOpeningSlide(t){var e,i;return null===(null===(e=this.carousel)||void 0===e?void 0:e.prevPage)&&t.index===(null===(i=this.getSlide())||void 0===i?void 0:i.index)}showLoading(t){t.state=Y.Loading;const e=t.el;if(!e)return;e.classList.add("is-loading"),this.emit("loading",t),t.spinnerEl||setTimeout((()=>{if(!this.isClosing()&&!t.spinnerEl&&t.state===Y.Loading){let n=i(y);t.spinnerEl=n,e.prepend(n),this.animate(n,"f-fadeIn")}}),250)}hideLoading(t){const e=t.el;if(!e)return;const i=t.spinnerEl;this.isClosing()?null==i||i.remove():(e.classList.remove("is-loading"),i&&this.animate(i,"f-fadeOut",(()=>{i.remove()})),t.state===Y.Loading&&(this.emit("loaded",t),t.state=Y.Ready))}setError(t,e){if(this.isClosing())return;this.emit("error"),t.error=e,this.hideLoading(t),this.clearContent(t);const i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(e||"

{{ERROR}}

"),this.setContent(t,i)}clearContent(t){var e;null===(e=this.carousel)||void 0===e||e.emit("removeSlide",t),t.contentEl&&(t.contentEl.remove(),t.contentEl=void 0),t.closeBtnEl&&(t.closeBtnEl.remove(),t.closeBtnEl=void 0);const i=t.el;i&&(x(i,"is-loading"),x(i,"has-error"),x(i,"has-unknown"),x(i,`has-${t.type||"unknown"}`))}getSlide(){var t;const e=this.carousel;return(null===(t=null==e?void 0:e.pages[null==e?void 0:e.page])||void 0===t?void 0:t.slides[0])||void 0}close(t,e){if(this.isClosing())return;const i=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",i,t),i.defaultPrevented)return;t&&t.cancelable&&(t.preventDefault(),t.stopPropagation());const n=this.fsAPI,s=()=>{this.proceedClose(t,e)};n&&n.isFullscreen()?Promise.resolve(n.exit()).then((()=>s())):s()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(t=!1){const e=()=>{var t;this.clearIdle(),this.idle=!0,null===(t=this.container)||void 0===t||t.classList.add("is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(t)e();else{const t=this.option("idle");t&&(this.idleTimer=setTimeout(e,t))}}endIdle(){var t;this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,null===(t=this.container)||void 0===t||t.classList.remove("is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){const t=this.fsAPI;t&&(t.isFullscreen()?t.exit():this.container&&t.request(this.container))}isClosing(){return[X.Closing,X.CustomClosing,X.Destroy].includes(this.state)}proceedClose(t,e){var i,n;this.state=X.Closing,this.clearIdle(),this.detachEvents();const s=this.container,o=this.carousel,a=this.getSlide(),r=null==a?void 0:a.state;if(a){const t=this.option("placeFocusBack")?(null===(i=this.getSlide())||void 0===i?void 0:i.triggerEl)||this.option("trigger"):null;t&&t.focus()}if(s&&(S(s,"is-closing"),s.setAttribute("aria-hidden","true"),this.option("animated")&&S(s,"is-animated"),s.style.pointerEvents="none"),o){o.clearTransitions(),null===(n=o.panzoom)||void 0===n||n.destroy();for(const t of o.slides){t.state=Y.Closing,this.hideLoading(t);const e=t.contentEl;e&&this.stop(e);const i=null==t?void 0:t.panzoom;i&&(i.stop(),i.detachEvents(),i.detachObserver()),this.isCurrentSlide(t)||o.emit("removeSlide",t)}}this.emit("close",t),this.state!==X.CustomClosing?(void 0===e&&a&&(e=this.optionFor(a,"hideClass")),e&&a&&r===Y.Ready?(this.animate(a.contentEl,e,(()=>{o&&o.emit("removeSlide",a)})),setTimeout((()=>{this.destroy()}),350)):this.destroy()):setTimeout((()=>{this.destroy()}),350)}destroy(){var t;if(this.state===X.Destroy)return;this.state=X.Destroy,null===(t=this.carousel)||void 0===t||t.destroy();const e=this.container;e&&e.remove(),gt.delete(this.id);const i=vt.getInstance();i?i.focus():(mt&&(mt.remove(),mt=null),ft&&(ft.remove(),ft=null),document.documentElement.classList.remove("with-fancybox"),_&&(document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",""),document.body.classList.remove("compensate-for-scrollbar")))}static bind(t,e,i){if(!_)return;let n,s="",o={};if("string"==typeof t?(n=document.body,s=t,"object"==typeof e&&(o=e||{})):(n=t,"string"==typeof e&&(s=e),"object"==typeof i&&(o=i||{})),!n)return;s=s||"[data-fancybox]";const a=vt.openers.get(n)||new Map;a.set(s,o),vt.openers.set(n,a),1===a.size&&n.addEventListener("click",vt.fromEvent)}static unbind(t,e){let i,n="";if("string"==typeof t?(i=document.body,n=t):(i=t,"string"==typeof e&&(n=e)),!i)return;const s=vt.openers.get(i);s&&n&&s.delete(n),n&&s||(vt.openers.delete(i),i.removeEventListener("click",vt.fromEvent))}static destroy(){let t;for(;t=vt.getInstance();)t.destroy();for(const t of vt.openers.keys())t.removeEventListener("click",vt.fromEvent);vt.openers=new Map}static fromEvent(t){if(t.defaultPrevented)return;if(t.button&&0!==t.button)return;if(t.ctrlKey||t.metaKey||t.shiftKey)return;let e=t.composedPath()[0];const i=e.closest("[data-fancybox-trigger]");if(i){const t=i.dataset.fancyboxTrigger||"",n=document.querySelectorAll(`[data-fancybox="${t}"]`),s=parseInt(i.dataset.fancyboxIndex||"",10)||0;e=n[s]||e}if(!(e&&e instanceof Element))return;let n,s,o,a;if([...vt.openers].reverse().find((([t,i])=>!(!t.contains(e)||![...i].reverse().find((([i,r])=>{let l=e.closest(i);return!!l&&(n=t,s=i,o=l,a=r,!0)}))))),!n||!s||!o)return;a=a||{},t.preventDefault(),e=o;let r=[],l=d({},$,a);l.event=t,l.trigger=e,l.delegate=i;const c=l.groupAll,h=l.groupAttr,u=h&&e?e.getAttribute(`${h}`):"";if((!e||u||c)&&(r=[].slice.call(n.querySelectorAll(s))),e&&!c&&(r=u?r.filter((t=>t.getAttribute(`${h}`)===u)):[e]),!r.length)return;const p=vt.getInstance();return p&&p.options.trigger&&r.indexOf(p.options.trigger)>-1?void 0:(e&&(l.startIndex=r.indexOf(e)),vt.fromNodes(r,l))}static fromNodes(t,e){e=d({},$,e);const i=[];for(const n of t){const t=n.dataset||{},s=t.src||n.getAttribute("href")||n.getAttribute("currentSrc")||n.getAttribute("src")||void 0;let o;const a=e.delegate;let r;a&&i.length===e.startIndex&&(o=a instanceof HTMLImageElement?a:a.querySelector("img:not([aria-hidden])")),o||(o=n instanceof HTMLImageElement?n:n.querySelector("img:not([aria-hidden])")),o&&(r=o.currentSrc||o.src||void 0,!r&&o.dataset&&(r=o.dataset.lazySrc||o.dataset.src||void 0));const l={src:s,triggerEl:n,thumbEl:o,thumbElSrc:r,thumbSrc:r};for(const e in t)"fancybox"!==e&&(l[e]=t[e]+"");i.push(l)}return new vt(i,e)}static getInstance(t){if(t)return gt.get(t);return Array.from(gt.values()).reverse().find((t=>!t.isClosing()&&t))||null}static getSlide(){var t;return(null===(t=vt.getInstance())||void 0===t?void 0:t.getSlide())||null}static show(t=[],e={}){return new vt(t,e)}static next(){const t=vt.getInstance();t&&t.next()}static prev(){const t=vt.getInstance();t&&t.prev()}static close(t=!0,...e){if(t)for(const t of gt.values())t.close(...e);else{const t=vt.getInstance();t&&t.close(...e)}}}Object.defineProperty(vt,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(vt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:$}),Object.defineProperty(vt,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:pt}),Object.defineProperty(vt,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map});export{B as Carousel,vt as Fancybox,M as Panzoom}; diff --git a/dist/index.umd.js b/dist/index.umd.js index 234f33b0..0ea0b984 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";const e=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),i=function(t,e){return!(!t||t===document.body||e&&t===e)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,n=-1!==i.indexOf("hidden"),s=-1!==i.indexOf("visible");return e&&!n&&!s}(t)?t:i(t.parentElement,e))},n=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},s=t=>`${t||""}`.split(" ").filter((t=>!!t)),o=(t,e,i)=>{s(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))};class a{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const r={passive:!1};class l{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:n=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=n;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,r),this.element.addEventListener("touchmove",this.onMove,r),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,r)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new a(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new a(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new a(t))):[new a(t)],n=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(n.push(t),this.currentPointers[e]=t)}n.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new a(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new a(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,r),this.element.removeEventListener("touchstart",this.onTouchStart,r),this.element.removeEventListener("touchmove",this.onMove,r),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function c(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function h(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const d=t=>"object"==typeof t&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t),u=(t,...e)=>{const i=e.length;for(let n=0;n{const n=Array.isArray(i)?[]:{};t[e]||Object.assign(t,{[e]:n}),d(i)?Object.assign(t[e],u(n,i)):Array.isArray(i)?Object.assign(t,{[e]:[...i]}):Object.assign(t,{[e]:i})}))}return t},p=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class m{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?u({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=p(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...n){let s=p(e,t);var o;"string"!=typeof(o=s)||isNaN(o)||isNaN(parseFloat(o))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...n));let a=p(e,this.options);return a&&"function"==typeof a?s=a.call(this,this,t,...n,s):void 0===s&&(s=a),void 0===s?i:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(m,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(m,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class f extends m{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,n]of Object.entries(t)){const t=this.option(i),s=this.plugins[i];s||!1===t?s&&!1===t&&(s.detach(),delete this.plugins[i]):e.set(i,new n(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}var g;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(g||(g={}));const b=["a","b","c","d","e","f"],v={PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"},y={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:v},w='
',x=t=>t&&null!==t&&t instanceof Element&&"nodeType"in t,S={a:1,b:0,c:0,d:1,e:0,f:0},E=1e5,P=1e3;let M=null,C=null;class T extends f{get isTouchDevice(){return null===C&&(C=window.matchMedia("(hover: none)").matches),C}get isMobile(){return null===M&&(M=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),M}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){return this.content instanceof HTMLImageElement&&!this.content.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of b){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var s;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:g.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},S)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},S)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},T.Plugins),i)),this.emit("init"),this.isContentLoading){if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const e=n(w);t.contains(this.content)?this.spinner=(null===(s=this.content.parentElement)||void 0===s?void 0:s.insertBefore(e,this.content))||null:this.spinner=t.appendChild(e)}this.emit("beforeLoad"),this.content.addEventListener("load",this.onLoad),this.content.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===g.Init&&this.enable()}onError(){this.state!==g.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=g.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new l(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of b)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of b)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,n=i.e+t,s=i.f+e,o=this.getBounds(),{x:a,y:r}=o,l=a.min,c=a.max,h=r.min,d=r.max;let u=0,p=0;return l!==1/0&&nc&&(u=c-n),h!==1/0&&sd&&(p=d-s),Math.abs(u)<.001&&(u=0),Math.abs(p)<.001&&(p=0),Object.assign(Object.assign({},o),{xDiff:u,yDiff:p,inBounds:!u&&!p})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:n,fitHeight:s,fullWidth:o,fullHeight:a}=i;let r=o,l=a;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),c=i?o:n,h=i?a:s,d=this.getMatrix(t),u=new DOMPoint(0,0).matrixTransform(d),p=new DOMPoint(0+c,0).matrixTransform(d),m=new DOMPoint(0+c,0+h).matrixTransform(d),f=new DOMPoint(0,0+h).matrixTransform(d),g=Math.abs(m.x-u.x),b=Math.abs(m.y-u.y),v=Math.abs(f.x-p.x),y=Math.abs(f.y-p.y);r=Math.max(g,v),l=Math.max(b,y)}return{contentWidth:r,contentHeight:l}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const n=i.closest("[data-panzoom-action]"),s=i.closest("[data-panzoom-change]"),o=n||s,a=o&&x(o)?o.dataset:null;if(a){const e=a.panzoomChange,i=a.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const r=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(r.x-this.dragStart.x)>2||Math.abs(r.y-this.dragStart.y)>2))return;this.dragStart.time=0;const l=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},c=this.option("click",t),h=this.option("dblClick",t);h?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&c&&l(c)):(this.emit("dblClick",t),t.defaultPrevented||l(h)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&c&&l(c))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(t,i,n){var s;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const o=this.content.getBoundingClientRect();if(this.dragStart={x:o.x,y:o.y,top:o.top,left:o.left,time:Date.now()},!1===this.option("touch",t))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;if(!n.length){const e=t.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(e.nodeName)||e.closest("[contenteditable]")||e.closest("[data-selectable]")||e.closest("[data-panzoom-change]")||e.closest("[data-panzoom-action]"))return!1;null===(s=window.getSelection())||void 0===s||s.removeAllRanges()}return"mousedown"===t.type&&t.preventDefault(),e(this.targetScale,1e3)===e(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(i),this.emit("touchStart",t),!0}onPointerMove(t,n,s){if(!this.isDragging)return;if(n.length<2&&this.panOnlyZoomed&&e(this.targetScale)<=e(this.minScale))return;if(this.emit("touchMove",t),t.defaultPrevented)return;this.addTrackingPoint(n[0]);const{content:o}=this,a=h(s[0],s[1]),r=h(n[0],n[1]);let l=0,d=0;if(n.length>1){const t=o.getBoundingClientRect();l=a.clientX-t.left-.5*t.width,d=a.clientY-t.top-.5*t.height}const u=c(s[0],s[1]),p=c(n[0],n[1]);let m=u?p/u:1,f=r.clientX-a.clientX,g=r.clientY-a.clientY;this.dragOffset.x+=f,this.dragOffset.y+=g,this.dragOffset.time=Date.now()-this.dragStart.time;let b=e(this.targetScale)===e(this.minScale)&&this.option("lockAxis");if(b&&!this.lockedAxis)if("xy"===b||"y"===b||"touchmove"===t.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void t.preventDefault();const e=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=e>45&&e<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,f=0,g=0}else this.lockedAxis=b;if(i(t.target,this.content)&&(b="x",this.dragOffset.y=0),b&&"xy"!==b&&this.lockedAxis!==b&&e(this.targetScale)===e(this.minScale))return;t.cancelable&&t.preventDefault(),this.container.classList.add(this.cn("isDragging"));const v=this.checkBounds(f,g);this.option("rubberband")?("x"!==this.isInfinite&&(v.xDiff>0&&f<0||v.xDiff<0&&f>0)&&(f*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*v.xDiff))),"y"!==this.isInfinite&&(v.yDiff>0&&g<0||v.yDiff<0&&g>0)&&(g*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*v.yDiff)))):(v.xDiff&&(f=0),v.yDiff&&(g=0));const y=this.targetScale,w=this.minScale,x=this.maxScale;y<.5*w&&(m=Math.max(m,w)),y>1.5*x&&(m=Math.min(m,x)),"y"===this.lockedAxis&&e(y)===e(w)&&(f=0),"x"===this.lockedAxis&&e(y)===e(w)&&(g=0),this.applyChange({originX:l,originY:d,panX:f,panY:g,scale:m,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,e,n){if(n.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(e),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),i(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==g.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of b)this.velocity[t]=0,this.target[t]=this.current[t];const{trackingPoints:t}=this,i=t[0],n=t[t.length-1];let s=0,o=0,a=0;n&&i&&(s=n.clientX-i.clientX,o=n.clientY-i.clientY,a=n.time-i.time);let r=0,l=0,c=0,h=0,d=this.option("decelFriction");const u=this.targetScale;if((uthis.maxScale+1e-5)&&(d=.35),a>0){c=Math.abs(s)>3?s/(a/30):0,h=Math.abs(o)>3?o/(a/30):0;const t=this.option("maxVelocity");t&&(c=Math.max(Math.min(c,t),-1*t),h=Math.max(Math.min(h,t),-1*t))}c&&(r=c/(1/(1-d)-1)),h&&(l=h/(1/(1-d)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&e(u)===this.minScale)&&(r=c=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&e(u)===this.minScale)&&(l=h=0);const p=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(s)),"auto"===m&&(m=parseFloat(s.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(s));const f=(this.option("transformParent")?s.parentElement:null)||s,b=f.getAttribute("style")||"";f.style.setProperty("transform","none","important"),f.style.setProperty("transition","none","important"),f.style.setProperty("animation","none","important"),s instanceof HTMLImageElement&&(f.style.width="",f.style.height=""),f.offsetHeight;const v=s.getBoundingClientRect();let y=v.width,w=v.height,x=0,S=0;if(s instanceof HTMLImageElement&&({width:y,height:w,top:x,left:S}=((t,e,i,n)=>{const s=i/n;return s>t/e?(i=t,n=t/s):(i=e*s,n=e),{width:i,height:n,top:.5*(e-n),left:.5*(t-i)}})(v.width,v.height,p,m)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:v.top-r.top+x,bottom:r.bottom-v.bottom+x,left:v.left-r.left+S,right:r.right-v.right+S,fitWidth:y,fitHeight:w,width:y,height:w,fullWidth:p,fullHeight:m}),f.style.cssText=b,s instanceof HTMLImageElement&&(f.style.width=`${y}px`,f.style.height=`${w}px`),this.setTransform(),!0!==t){let t="";Math.abs(c-o)>1&&(t+="x"),Math.abs(h-a)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(e(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===g.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const t=this.option("bounds");if("auto"!==t)return t;const{contentWidth:i,contentHeight:n}=this.calculateContentDim(this.target);let s=0,o=0,a=0,r=0;const l=this.option("infinite");if(!0===l||this.lockedAxis&&l===this.lockedAxis)s=-1/0,a=1/0,o=-1/0,r=1/0;else{let{containerRect:t,contentRect:l}=this,c=e(this.contentRect.fitWidth*this.targetScale,P),h=e(this.contentRect.fitHeight*this.targetScale,P),{innerWidth:d,innerHeight:u}=t;if(this.containerRect.width===c&&(d=t.width),this.containerRect.width===h&&(u=t.height),i>d){a=.5*(i-d),s=-1*a;let t=.5*(l.right-l.left);s+=t,a+=t}if(this.contentRect.fitWidth>d&&iu){r=.5*(n-u),o=-1*r;let t=.5*(l.bottom-l.top);o+=t,r+=t}this.contentRect.fitHeight>u&&nthis.maxScale?this.minScale:this.maxScale,toggleCover:this.targetScale>this.coverScale?this.minScale:this.coverScale,toggleZoom:this.targetScale>this.fullScale?this.minScale:this.fullScale}[this.option("click")||""]||this.minScale,s=t.canZoomIn(),a=t.canZoomOut(),r="drag"===this.panMode,l=a&&r;this.targetScale<=this.minScale&&!this.panOnlyZoomed&&(l=!0),(this.contentRect.width-this.contentRect.fitWidth>-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(l=!0),this.contentRect.width*this.targetScalethis.minScale,h=!s&&!l&&a&&e(n)===e(this.minScale);o(i,this.cn("canZoomIn"),c),o(i,this.cn("canZoomOut"),h),o(i,this.cn("isDraggable"),l);for(const t of i.querySelectorAll('[data-panzoom-action="zoomIn"]'))s?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const t of i.querySelectorAll('[data-panzoom-action="zoomOut"]'))a?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const e of i.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){s=t.targetScale.9*t.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:n=this.option("friction"),angle:s=0,originX:o=0,originY:a=0,flipX:r=!1,flipY:l=!1,ignoreBounds:c=!1}){this.state!==g.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:s,originX:o,originY:a,friction:n,flipX:r,flipY:l,ignoreBounds:c})}applyChange({panX:t=0,panY:i=0,scale:n=1,angle:s=0,originX:o=-this.current.e,originY:a=-this.current.f,friction:r=this.option("friction"),flipX:l=!1,flipY:c=!1,ignoreBounds:h=!1,bounce:d=this.option("bounce")}){if(this.state===g.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of b)this.velocity[t]=0;this.friction=r||0,this.ignoreBounds=h;const{current:u}=this,p=u.e,m=u.f,f=this.getMatrix(this.target);let v=(new DOMMatrix).translate(p,m).translate(o,a).translate(t,i);if(this.option("zoom")){if(!h){const t=this.targetScale,e=this.minScale,i=this.maxScale;t*ni&&(n=i/t)}v=v.scale(n)}v=v.translate(-o,-a).translate(-p,-m).multiply(f),s&&(v=v.rotate(s)),l&&(v=v.scale(-1,1)),c&&(v=v.scale(1,-1));for(const t of b)"a"!=t&&"d"!=t||!(v[t]>this.minScale+1e-5||v[t].1||"mousemove"===this.panMode||!1===d)&&!h&&this.clampTargetBounds(),this.isResting||(this.state=g.Panning,this.requestTick())}stop(t=!1){if(this.state!==g.Init&&this.state!==g.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of b)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=g.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls()),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(t,i=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=t,"mousemove"!==this.panMode||!t)return;if(e(this.targetScale)<=e(this.minScale))return;this.emit("mouseMove",t);const{container:n,containerRect:s,contentRect:o}=this,a=s.width,r=s.height,l=n.getBoundingClientRect(),c=(t.clientX||0)-l.left,h=(t.clientY||0)-l.top;let{contentWidth:d,contentHeight:u}=this.calculateContentDim(this.target);const p=this.option("mouseMoveFactor");p>1&&(d!==a&&(d*=p),u!==r&&(u*=p));let m=.5*(d-a)-c/a*100/100*(d-a);m+=.5*(o.right-o.left);let f=.5*(u-r)-h/r*100/100*(u-r);f+=.5*(o.bottom-o.top),this.applyChange({panX:m-this.target.e,panY:f-this.target.f,friction:i})}zoomWithWheel(t){if(this.state===g.Destroy||this.state===g.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),n=this.targetScale,s=this.maxScale,o=this.minScale;let a=n*(100+i*e)/100;as&&n>=s?(this.wheelDelta+=Math.abs(i),a=s):(this.wheelDelta=0,a=Math.max(Math.min(a,s),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),a!==n&&this.zoomTo(a,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale>.9*this.maxScale?"fit":"max",t)}toggleCover(t){this.zoomTo(this.targetScale>.9*this.coverScale?"fit":"cover",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:n=0,event:s}={}){if(this.isContentLoading||this.state===g.Destroy)return;this.stop();const{targetScale:o}=this;let a=1;if("mousemove"===this.panMode&&(s=this.prevMouseMoveEvent||s),s){const t=this.content.getBoundingClientRect(),e=s.clientX||0,o=s.clientY||0;i=e-t.left-.5*t.width,n=o-t.top-.5*t.height}const r=this.fullScale,l=this.maxScale;let c=this.coverScale;"number"==typeof t?a=t/o:("next"===t&&(r-c<.2&&(c=r),t=o1?.15:.25:e,this.applyChange({scale:a,originX:i,originY:n,friction:e}),s&&"mousemove"===this.panMode&&this.panWithMouse(s,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const n=t.classList.contains(e);n?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(n?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:n,d:s,e:o,f:a}=t;return new DOMMatrix([e,i,n,s,o,a])}reset(t){if(this.state!==g.Init&&this.state!==g.Destroy){this.stop("current");for(const t of b)this.target[t]=S[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=g.Panning,this.requestTick())}}destroy(){this.stop(),this.state=g.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(T,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:y}),Object.defineProperty(T,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const O=function(t,e){let i=!0;return(...n)=>{i&&(i=!1,t(...n),setTimeout((()=>{i=!0}),e))}},A=(t,e)=>{let i=[];return t.childNodes.forEach((t=>{t.nodeType!==Node.ELEMENT_NODE||e&&!t.matches(e)||i.push(t)})),i},L=(t,e)=>{s(e).forEach((e=>{t&&t.classList.add(e)}))},z=(t,e)=>{s(e).forEach((e=>{t&&t.classList.remove(e)}))},R={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var k;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"}(k||(k={}));const I=t=>{if("string"==typeof t&&(t={html:t}),!(t instanceof String||t instanceof HTMLElement)){const e=t.thumb;void 0!==e&&("string"==typeof e&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},D=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class F extends m{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const j={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'',dynamicFrom:11,maxCount:1/0,minCount:2};class H extends F{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let t=this.list;return t||(t=document.createElement("ul"),L(t,this.cn("list")),t.setAttribute("role","tablist"),this.instance.container.appendChild(t),L(this.instance.container,this.cn("hasDots")),this.list=t),t}refresh(){var t;const e=this.instance.pages.length,i=Math.min(2,this.option("minCount")),n=Math.max(2e3,this.option("maxCount")),s=this.option("dynamicFrom");if(en)return void this.cleanup();const a="number"==typeof s&&e>5&&e>=s,r=!this.list||this.isDynamic!==a||this.list.children.length!==e;r&&this.cleanup();const l=this.build();if(o(l,this.cn("isDynamic"),!!a),r)for(let t=0;t=e-1&&s.setAttribute("disabled","")))}createButton(t){const e=this.instance,i=document.createElement("button");i.setAttribute("tabindex","0"),i.setAttribute("title",e.localize(`{{${t.toUpperCase()}}}`)),L(i,this.cn("button")+" "+this.cn("next"===t?"isNext":"isPrev"));const n=e.isRTL?"next"===t?"prev":"next":t;var s;return i.innerHTML=e.localize(this.option(`${n}Tpl`)),i.dataset[`carousel${s=t,s?s.match("^[a-z]")?s.charAt(0).toUpperCase()+s.substring(1):s:""}`]="true",i}build(){let t=this.container;t||(this.container=t=document.createElement("div"),L(t,this.cn("container")),this.instance.container.appendChild(t)),this.next||(this.next=t.appendChild(this.createButton("next"))),this.prev||(this.prev=t.appendChild(this.createButton("prev")))}cleanup(){this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove(),this.prev=null,this.next=null,this.container=null}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(B,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'',prevTpl:''}});class _ extends F{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){this.nav&&this.target&&(this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.state===k.Ready&&this.onNavReady(this.nav),this.target.on("ready",this.onTargetReady),this.target.state===k.Ready&&this.onTargetReady(this.target))}onNavReady(t){t.on("createSlide",this.onNavCreateSlide),t.on("Panzoom.click",this.onNavClick),this.onTargetChange()}onTargetReady(t){t.on("change",this.onTargetChange),t.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(t,e,i){var n,s;const o=i.target,{nav:a,target:r}=this;if(!a||!r||!o)return;const l=o.closest("[data-index]");if(!l)return;i.stopPropagation();const c=parseInt(l.dataset.index||"",10)||0,h=a.getPageForSlide(c);a.page!==h&&a.slideTo(h);const d=r.getPageForSlide(c);r.page!==d&&r.slideTo(d,{friction:null===(s=null===(n=this.nav)||void 0===n?void 0:n.plugins)||void 0===s?void 0:s.Sync.option("friction")}),this.markSelectedSlide(c)}onNavCreateSlide(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}onTargetChange(){const{target:t,nav:e}=this;if(!t||!e)return;if(e.state!==k.Ready||t.state!==k.Ready)return;const i=t.pages[t.page].slides[0].index,n=e.getPageForSlide(i);e.slideTo(n),this.markSelectedSlide(i)}markSelectedSlide(t){const{nav:e}=this;if(!e)return;this.selectedIndex=t,[...e.slides].filter((t=>t.el&&t.el.classList.remove("is-nav-selected")));const i=e.slides[t];i&&i.el&&i.el.classList.add("is-nav-selected")}attach(){let t=this.options.target,e=this.options.nav;t?this.addAsNavFor(t):e&&this.addAsTargetFor(e)}detach(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.nav=null,this.target&&(this.target.off("ready",this.onTargetReady),this.target.off("refresh",this.onTargetChange),this.target.off("change",this.onTargetChange)),this.target=null}}Object.defineProperty(_,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const N={Navigation:B,Dots:H,Sync:_};class W extends f{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===k.Ready}get isInfinite(){let t=!1;const e=this.contentDim,i=this.viewportDim;return this.pages.length>=2&&e>1.5*i&&(t=this.option("infinite")),t}get isRTL(){return"rtl"===this.option("direction")}get isHorizontal(){return"x"===this.option("axis")}constructor(t,e={},i={}){if(super(),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:k.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),"string"==typeof t&&(t=document.querySelector(t)),!t||!x(t))throw new Error("No Element found");this.container=t,this.slideNext=O(this.slideNext.bind(this),175),this.slidePrev=O(this.slidePrev.bind(this),175),this.userOptions=e,this.userPlugins=i,queueMicrotask((()=>{this.processOptions()}))}processOptions(){const t=u({},W.defaults,this.userOptions);let e="";const i=t.breakpoints;if(i&&d(i))for(const[n,s]of Object.entries(i))window.matchMedia(n).matches&&d(s)&&(e+=n,u(t,s));e===this.bp&&this.state!==k.Init||(this.bp=e,this.state===k.Ready&&(t.initialSlide=this.pages[this.page].slides[0].index),this.state!==k.Init&&this.destroy(),super.setOptions(t),!1===this.option("enabled")?this.attachEvents():setTimeout((()=>{this.init()}),0))}init(){this.state=k.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},W.Plugins),this.userPlugins)),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=k.Ready,this.emit("ready")}initLayout(){const{container:t}=this,e=this.option("classes");L(t,this.cn("container")),o(t,e.isLTR,!this.isRTL),o(t,e.isRTL,this.isRTL),o(t,e.isVertical,!this.isHorizontal),o(t,e.isHorizontal,this.isHorizontal);let i=this.option("viewport")||t.querySelector(`.${e.viewport}`);i||(i=document.createElement("div"),L(i,e.viewport),i.append(...A(t,`.${e.slide}`)),t.prepend(i));let n=this.option("track")||t.querySelector(`.${e.track}`);n||(n=document.createElement("div"),L(n,e.track),n.append(...Array.from(i.childNodes))),n.setAttribute("aria-live","polite"),i.contains(n)||i.prepend(n),this.viewport=i,this.track=n,this.emit("initLayout")}initSlides(){const{track:t}=this;if(t){this.slides=[],[...A(t,`.${this.cn("slide")}`)].forEach((t=>{if(x(t)){const e=I({el:t,isDom:!0,index:this.slides.length});this.slides.push(e),this.emit("initSlide",e,this.slides.length)}}));for(let t of this.option("slides",[])){const e=I(t);e.index=this.slides.length,this.slides.push(e),this.emit("initSlide",t,this.slides.length)}this.emit("initSlides")}}setInitialPage(){let t=0;const e=this.option("initialSlide");t="number"==typeof e?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0,this.page=t}setInitialPosition(){if(!this.track||!this.pages.length)return;let t=this.page;this.pages[t]||(this.page=t=0);const e=this.pages[t].pos*(this.isRTL&&this.isHorizontal?1:-1),i=this.isHorizontal?`${e}px`:"0",n=this.isHorizontal?"0":`${e}px`;this.track.style.transform=`translate3d(${i}, ${n}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const t=this.option("Panzoom")||{};this.panzoom=new T(this.viewport,u({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,decelFriction:.12,click:!1,dblClick:!1,touch:t=>!(this.pages.length<2&&!t.options.infinite),bounds:()=>this.getBounds(),maxVelocity:t=>Math.abs(t.target[this.axis]-t.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on("*",((t,e,...i)=>{this.emit(`Panzoom.${e}`,t,...i)})),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation),this.panzoom.on("touchStart",((t,e)=>{this.inTransition.size&&e.preventDefault()}))}attachEvents(){const t=this.container;t&&(t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let t=[];const{contentDim:e,viewportDim:i}=this,n=this.option("slidesPerPage");if("number"==typeof n&&e>i){for(let e=0;ei)&&(t.push(D()),s=t.length-1,o=0),o+=e.dim+e.gap,t[s].slides.push(e);return t}processPages(){const t=this.pages,{contentDim:i,viewportDim:n}=this,s=this.option("center"),o=this.option("fill");if(t.forEach(((t,e)=>{t.index=e,t.pos=t.slides[0].pos,t.dim=0;for(const[e,i]of t.slides.entries())t.dim+=i.dim,e{o&&!this.isInfinite&&i>n&&(t.pos=Math.max(t.pos,0),t.pos=Math.min(t.pos,i-n)),t.pos=e(t.pos,1e3),t.dim=e(t.dim,1e3)})),this.isInfinite)return t;const a=[];let r;return t.forEach((t=>{const e=Object.assign({},t);r&&e.pos===r.pos?(r.dim+=e.dim,r.slides=[...r.slides,...e.slides]):(e.index=a.length,r=e,a.push(e))})),a}getPageFromIndex(t=0){const e=this.pages.length;let i;return t=parseInt((t||0).toString())||0,i=this.isInfinite?(t%e+e)%e:Math.max(Math.min(t,this.pages.length-1),0),i}getSlideMetrics(t){const e=this.isHorizontal?"width":"height";let i=0,n=0,s=t.el;s?i=parseFloat(s.dataset[e]||"")||0:(s=document.createElement("div"),s.style.visibility="hidden",L(s,this.cn("slide")+" "+t.class),(this.track||document.body).prepend(s)),i?(s.style[e]=`${i}px`,s.style["width"===e?"height":"width"]=""):i=s.getBoundingClientRect()[e];const o=getComputedStyle(s);return"content-box"===o.boxSizing&&(this.isHorizontal?(i+=parseFloat(o.paddingLeft)||0,i+=parseFloat(o.paddingRight)||0):(i+=parseFloat(o.paddingTop)||0,i+=parseFloat(o.paddingBottom)||0)),n=parseFloat(o[this.isHorizontal?"marginRight":"marginBottom"])||0,this.isHorizontal,t.el||s.remove(),{dim:i,gap:n}}getBounds(){let t={min:0,max:0};if(this.isInfinite)t={min:-1/0,max:1/0};else if(this.pages.length){const e=this.pages[0].pos,i=this.pages[this.pages.length-1].pos;t=this.isRTL&&this.isHorizontal?{min:e,max:i}:{min:-1*i,max:-1*e}}return{x:this.isHorizontal?t:{min:0,max:0},y:this.isHorizontal?{min:0,max:0}:t}}repositionSlides(){const{viewportDim:t,contentDim:i,page:n,pages:s}=this;let o,a=0,r=0,l=0,c=0;this.panzoom?c=-1*this.panzoom.current[this.isHorizontal?"e":"f"]:s[n]&&(c=s[n].pos||0),o=this.isHorizontal?this.isRTL?"right":"left":"top",this.isRTL&&this.isHorizontal&&(c*=-1);for(const t of this.slides)t.el?("top"===o?(t.el.style.right="",t.el.style.left=""):t.el.style.top="",t.index!==a?t.el.style[o]=0===r?"":`${r}px`:t.el.style[o]="",l+=t.dim+t.gap,a++):r+=t.dim+t.gap;if(this.isInfinite&&l)for(const n of this.slides)n.el&&(e(n.pos)e(i-t)&&(n.el.style[o]=`${r+l}px`),e(n.pos+n.gap)>=e(i-t)&&e(n.pos)>e(c+t)&&e(c)1&&(h=this.pages[u[0]],d=this.pages[u[1]]),h&&d){let t=0;for(const e of this.slides)e.el?this.inTransition.has(e.index)&&h.slides.indexOf(e)<0&&(e.el.style[o]=`${t+(h.pos-d.pos)}px`):t+=e.dim+e.gap}}createSlideEl(t){if(!this.track||!t)return;if(t.el)return;const e=document.createElement("div");L(e,this.cn("slide")),L(e,t.class),t.html&&(e.innerHTML=t.html);const i=[];this.slides.forEach(((t,e)=>{t.el&&i.push(e)}));const n=t.index;let s=null;if(i.length){let t=i.reduce(((t,e)=>Math.abs(e-n)this.page?1:-1,a=this.pages[s].pos*(this.isRTL?1:-1);if(this.page===s&&a===n.target[this.axis])return!1;this.clearTransitions();const r=n.isResting;L(this.container,this.cn("inTransition"));const l=this.pages[this.page].slides[0],c=this.pages[s].slides[0];this.inTransition.add(c.index),this.createSlideEl(c);let h=l.el,d=c.el;r||"slide"===e||(e="fadeFast",h=null);const u=this.isRTL?"next":"prev",p=this.isRTL?"prev":"next";return h&&(this.inTransition.add(l.index),l.transition=e,h.addEventListener("animationend",this.onAnimationEnd),h.classList.add(`f-${e}Out`,`to-${o>0?p:u}`)),d&&(c.transition=e,d.addEventListener("animationend",this.onAnimationEnd),d.classList.add(`f-${e}In`,`from-${o>0?u:p}`)),n.panTo({x:this.isHorizontal?a:0,y:this.isHorizontal?0:a,friction:0}),this.onChange(s),!0}manageSlideVisiblity(){const t=new Set,e=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const n of this.slides)i.has(n)?t.add(n):e.add(n);for(const e of this.inTransition)t.add(this.slides[e]);for(const e of t)this.createSlideEl(e),this.lazyLoadSlide(e);for(const i of e)t.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t="aria-hidden";let e=this.cn("isSelected");if(e)for(const i of this.slides)i.el&&(i.el.dataset.index=`${i.index}`,this.pages[this.page].slides.includes(i)?(i.el.classList.contains(e)||(L(i.el,e),this.emit("selectSlide",i)),i.el.removeAttribute(t)):(i.el.classList.contains(e)&&(z(i.el,e),this.emit("unselectSlide",i)),i.el.setAttribute(t,"true")))}flipInfiniteTrack(){const t=this.panzoom;if(!t||!this.isInfinite)return;const e="x"===this.option("axis")?"e":"f",{viewportDim:i,contentDim:n}=this;let s=t.current[e],o=t.target[e]-s,a=0,r=.5*i,l=n;this.isRTL&&this.isHorizontal?(s<-r&&(a=-1,s+=l),s>l-r&&(a=1,s-=l)):(s>r&&(a=1,s-=l),s<-l+r&&(a=-1,s+=l)),a&&(t.current[e]=s,t.target[e]=s+o)}lazyLoadSlide(t){const e=this,i=t&&t.el;if(!i)return;const s=new Set;i.querySelectorAll("[data-lazy-srcset]").forEach((t=>{t instanceof HTMLImageElement&&s.add(t)})),i.querySelectorAll("[data-lazy-src]").forEach((t=>{t instanceof HTMLImageElement?s.add(t):x(t)&&(t.style.backgroundImage=`url('${t.dataset.lazySrc||""}')`)}));const o=(t,i,n)=>{n&&(n.remove(),n=null),i.complete&&(i.style.display=""),this.option("adaptiveHeight")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&e.setViewportHeight()};for(const e of s){let i=null;e.src=e.dataset.lazySrcset||e.dataset.lazySrc||"",delete e.dataset.lazySrc,delete e.dataset.lazySrcset,e.style.display="none",e.addEventListener("error",(()=>{o(t,e,i)})),e.addEventListener("load",(()=>{o(t,e,i)})),setTimeout((()=>{!e.complete&&e.parentNode&&t.el&&(i=n(w),e.parentNode.insertBefore(i,e))}),300)}let a=i.dataset.lazySrc;a&&a.length&&(i.style.backgroundImage=`url('${a}')`)}clearTransitions(){this.inTransition.clear(),z(this.container,this.cn("inTransition"));const t=["to-prev","to-next","from-prev","from-next"];for(const e of this.slides){const i=e.el;if(i){i.removeEventListener("animationend",this.onAnimationEnd),i.classList.remove(...t);const n=e.transition;n&&i.classList.remove(`f-${n}Out`,`f-${n}In`)}}this.manageSlideVisiblity()}onAnimationEnd(t){const e=t.target,i=e?parseInt(e.dataset.index||"",10)||0:-1,n=this.slides[i],s=t.animationName;if(!e||!n||!s)return;const o=!!this.inTransition.has(i)&&n.transition;o&&s.substring(0,o.length+2)===`f-${o}`&&this.inTransition.delete(i),this.inTransition.size||this.clearTransitions(),i===this.page&&this.emit("settle")}onDecel(t,e=0,i=0){const n=this.isInfinite,s=this.isHorizontal?e:i,o=this.pages.length;if(!o)return;const a=this.option("dragFree");let r=this.page,l=0;const c=this.axis;!n&&(t.target[c],this.viewportDim);const h=t.current[c]*(this.isRTL&&this.isHorizontal?1:-1);let{pageIndex:d}=this.getPageFromPosition(h);if(a||Math.abs(s)<10){const e=t.target[c]*(this.isRTL&&this.isHorizontal?1:-1),{pageIndex:i}=this.getPageFromPosition(e);r=i}else r=this.isRTL&&this.isHorizontal?s<0?d-1:d+1:s<0?d+1:d-1,n||(r=Math.max(0,Math.min(r,this.pages.length-1)));if(n&&(l=Math.floor(r/o)||0),r=(r%o+o)%o,a&&t.dragOffset["e"===c?"x":"y"]);else{const e=this.contentDim;let i=(this.pages[r].pos+l*e)*(this.isRTL&&this.isHorizontal?1:-1);if(Math.abs(t.target[c]-i)<.1&&t.lockedAxis===("e"==c?"y":"x"))return;if(t.target[c]===i)return;t.applyChange({panX:this.isHorizontal?i-t.target.e:0,panY:this.isHorizontal?0:i-t.target.f,friction:t.option("decelFriction")})}r!==this.page&&this.onChange(r)}onClick(t){const e=t.target,i=e&&x(e)?e.dataset:null;let n;i&&(void 0!==i.carouselPage?n="slideTo":void 0!==i.carouselNext?n="slideNext":void 0!==i.carouselPrev&&(n="slidePrev")),n?(t.preventDefault(),t.stopPropagation(),e&&!e.hasAttribute("disabled")&&this[n](i&&"slideTo"===n?i.carouselPage:void 0)):this.emit("click",t)}onSlideTo(t){const e=t.detail||0;this.slideTo(this.getPageForSlide(e),{friction:0})}onChange(t,e=0){const i=this.page;this.prevPage=i,this.page=t,this.option("adaptiveHeight")&&this.setViewportHeight(),this.emit("change",t,i,e)}onRefresh(t,e=""){let i=this.contentDim,n=this.viewportDim;this.updateMetrics(),this.contentDim===i&&this.viewportDim===n||this.slideTo(this.page,{friction:0,transition:!1})}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(){this.flipInfiniteTrack(),this.manageSlideVisiblity()}onEndAnimation(){this.emit("settle")}reInit(t=null,e=null){this.destroy(),this.state=k.Init,this.userOptions=t||this.userOptions,this.userPlugins=e||this.userPlugins,this.processOptions()}slideTo(t=0,{friction:e=this.option("friction"),transition:i=this.option("transition")}={}){const n=this.panzoom,s=this.pages.length;if(!n||!s)return;if(this.transitionTo(t,i))return;const o=this.axis,a=this.getPageFromIndex(t);let r=this.pages[a].pos,l=0;if(this.isInfinite){const t=n.current[o]*(this.isRTL&&this.isHorizontal?1:-1),e=this.contentDim,i=r+e,s=r-e;Math.abs(t-i){t.el&&(s=Math.max(s,t.el.offsetHeight))}))),i.style.height=s?`${s}px`:""}getPageForSlide(t){for(const e of this.pages)for(const i of e.slides)if(i.index===t)return e.index;return-1}getVisibleSlides(t=0){var i;const n=new Set;let{contentDim:s,viewportDim:o,pages:a,page:r}=this;s=s+(null===(i=this.slides[this.slides.length-1])||void 0===i?void 0:i.gap)||0;let l=0;l=this.panzoom?-1*this.panzoom.current[this.axis]:a[r]&&a[r].pos||0,this.isInfinite&&(l-=Math.floor(l/s)*s),this.isRTL&&this.isHorizontal&&(l*=-1),l=e(l,1e3);const c=e(l-o*t,1e3),h=e(l+o*(t+1),1e3),d=this.isInfinite?[-1,0,1]:[0];for(const t of this.slides)for(const e of d){const i=t.pos+e*s,o=t.pos+t.dim+t.gap+e*s;ic&&n.add(t)}return n}getPageFromPosition(t){const{viewportDim:e,contentDim:i}=this,n=this.pages.length;let s=0,o=0;const a=this.option("center");a&&(t+=.5*e),this.isInfinite||(t=Math.max(this.slides[0].pos,Math.min(t,this.slides[this.slides.length-1].pos)));const r=i+this.slides[this.slides.length-1].gap,l=Math.floor(t/r)||0;t-=l*r;let c=this.slides[this.slides.length-1],h=this.slides.find((e=>{const i=t+(c&&!a?.5*c.dim:0);return c=e,e.pos<=i&&e.pos+e.dim+e.gap>i}));return h||(h=this.slides[this.slides.length-1]),o=this.getPageForSlide(h.index),s=o+l*n,{page:s,pageIndex:o}}destroy(){if([k.Destroy].includes(this.state))return;this.state=k.Destroy;const{container:t,viewport:e,track:i,slides:n,panzoom:s}=this,o=this.option("classes");t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),t.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),s&&(s.destroy(),this.panzoom=null),n&&n.forEach((t=>{this.removeSlideEl(t)})),this.detachPlugins(),this.track=null,this.viewport=null,this.page=0,e&&i&&e.replaceWith(...i.childNodes);for(const[e,i]of Object.entries(o))"container"!==e&&i&&t.classList.remove(i);this.slides=[];const a=this.events.get("ready");this.events=new Map,a&&this.events.set("ready",a)}}Object.defineProperty(W,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:T}),Object.defineProperty(W,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:R}),Object.defineProperty(W,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:N});const X=!("undefined"==typeof window||!window.document||!window.document.createElement);let $;const Y=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","),q={dragToClose:!0,hideScrollbar:!0,Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},contentClick:"toggleZoom",contentDblClick:!1,backdropClick:"close",animated:!0,idle:3500,showClass:"f-zoomInUp",hideClass:"f-fadeOut",commonCaption:!1,parentEl:null,startIndex:0,l10n:Object.assign(Object.assign({},v),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),tpl:{closeButton:'',main:''},groupAll:!1,groupAttr:"data-fancybox",defaultType:"image",defaultDisplay:"block",autoFocus:!0,trapFocus:!0,placeFocusBack:!0,closeButton:"auto",keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"next",ArrowDown:"prev",ArrowRight:"next",ArrowLeft:"prev"},Fullscreen:{autoStart:!1},compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,wheel:"zoom"};var Z,V;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Closing=2]="Closing",t[t.CustomClosing=3]="CustomClosing",t[t.Destroy=4]="Destroy"}(Z||(Z={})),function(t){t[t.Loading=0]="Loading",t[t.Opening=1]="Opening",t[t.Ready=2]="Ready",t[t.Closing=3]="Closing"}(V||(V={}));const G=()=>{queueMicrotask((()=>{(()=>{const{slug:t,index:e}=U.parseURL(),i=xt.getInstance();if(i&&!1!==i.option("Hash")){const n=i.carousel;if(t&&n){for(let e of n.slides)if(e.slug&&e.slug===t)return n.slideTo(e.index);if(t===i.option("slug"))return n.slideTo(e-1);const s=i.getSlide(),o=s&&s.triggerEl&&s.triggerEl.dataset;if(o&&o.fancybox===t)return n.slideTo(e-1)}U.hasSilentClose=!0,i.close()}U.startFromUrl()})()}))};class U extends F{constructor(){super(...arguments),Object.defineProperty(this,"origHash",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null})}onChange(){const t=this.instance,e=t.carousel;this.timer&&clearTimeout(this.timer);const i=t.getSlide();if(!e||!i)return;const n=t.isOpeningSlide(i),s=new URL(document.URL).hash;let o,a=i.slug||void 0;o=a||this.instance.option("slug"),!o&&i.triggerEl&&i.triggerEl.dataset&&(o=i.triggerEl.dataset.fancybox);let r="";o&&"true"!==o&&(r="#"+o+(!a&&e.slides.length>1?"-"+(i.index+1):"")),n&&(this.origHash=s!==r?s:""),r&&s!==r&&(this.timer=setTimeout((()=>{try{window.history[n?"pushState":"replaceState"]({},document.title,window.location.pathname+window.location.search+r)}catch(t){}}),300))}onClose(){if(this.timer&&clearTimeout(this.timer),!0!==U.hasSilentClose)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(this.origHash||""))}catch(t){}}attach(){this.instance.on("Carousel.ready",this.onChange),this.instance.on("Carousel.change",this.onChange),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.ready",this.onChange),this.instance.off("Carousel.change",this.onChange),this.instance.off("close",this.onClose)}static parseURL(){const t=window.location.hash.slice(1),e=t.split("-"),i=e[e.length-1],n=i&&/^\+?\d+$/.test(i)&&parseInt(e.pop()||"1",10)||1;return{hash:t,slug:e.join("-"),index:n}}static startFromUrl(){if(U.hasSilentClose=!1,xt.getInstance()||!1===xt.defaults.Hash)return;const{hash:t,slug:e,index:i}=U.parseURL();if(!e)return;let n=document.querySelector(`[data-slug="${t}"]`);if(n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),xt.getInstance())return;const s=document.querySelectorAll(`[data-fancybox="${e}"]`);s.length&&(n=s[i-1],n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))}static destroy(){window.removeEventListener("hashchange",G,!1)}}function K(){window.addEventListener("hashchange",G,!1),setTimeout((()=>{U.startFromUrl()}),500)}Object.defineProperty(U,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(U,"hasSilentClose",{enumerable:!0,configurable:!0,writable:!0,value:!1}),X&&(/complete|interactive|loaded/.test(document.readyState)?K():document.addEventListener("DOMContentLoaded",K));const J=t=>new Promise(((e,i)=>{const n=new Image;n.onload=e,n.onerror=i,n.src=t}));class Q extends F{onCreateSlide(t,e,i){const n=this.instance,s=n.optionFor(i,"src")||"",{el:o,type:a}=i;o&&"image"===a&&"string"==typeof s&&this.setContent(i,s).then((t=>{if(n.isClosing())return;const e=i.contentEl,s=i.imageEl,o=i.thumbElSrc,a=this.optionFor(i,"initialSize"),r=this.optionFor(i,"zoom"),l={event:"mousemove"===t.panMode?n.prevMouseMoveEvent||n.options.event:void 0,friction:r?.12:0};if(e&&s&&o&&n.isOpeningSlide(i)&&this.getZoomInfo(i)){let t=document.createElement("img");L(t,"fancybox-ghost"),e.appendChild(t),t.src=o,s.naturalWidth<2e3&&s.naturalHeight<2e3&&setTimeout((()=>{n.animate(t,"f-fadeFastOut",(()=>{t&&(t.remove(),t=null)}))}),300),J(o).then((()=>{i.state=V.Opening,this.instance.emit("reveal",i),this.zoomIn(i).then((()=>{t&&(t.remove(),t=null),this.instance.done(i)}),(()=>{n.hideLoading(i)}))}),(()=>{n.hideLoading(i),n.revealContent(i)}))}else{let e=n.optionFor(i,"showClass")||void 0,s=!0;n.isOpeningSlide(i)&&("full"===a?t.zoomToFull(l):"cover"===a?t.zoomToCover(l):"max"===a?t.zoomToMax(l):s=!1,t.stop("current")),s&&e&&(e="f-fadeIn"),n.revealContent(i,e)}}),(()=>{n.setError(i,"{{IMAGE_ERROR}}")}))}onRemoveSlide(t){t.panzoom&&t.panzoom.destroy(),t.panzoom=void 0,t.imageEl=void 0}onChange(t,e,i,n){for(const t of e.slides){const e=t.panzoom;e&&t.index!==i&&e.reset(.15)}}onClose(){const t=this.instance,e=t.container,i=t.getSlide();if(!e||!e.parentElement||!i)return;const{el:n,contentEl:s,panzoom:o}=i,a=i.thumbElSrc;if(!n||!a||!s||!o||o.isContentLoading||o.state===g.Init||o.state===g.Destroy)return;o.updateMetrics();let r=this.getZoomInfo(i);if(!r)return;this.instance.state=Z.CustomClosing,n.classList.remove("is-zooming-in"),n.classList.add("is-zooming-out"),s.style.backgroundImage=`url('${a}')`,J(a).then((()=>{n.classList.add("hide-image")}),(()=>{}));const l=e.getBoundingClientRect();Object.assign(e.style,{position:"absolute",top:`${window.pageYOffset}px`,left:`${window.pageXOffset}px`,bottom:"auto",right:"auto",width:`${l.width}px`,height:`${l.height}px`});const{x:c,y:h,scale:d,opacity:u}=r;if(u){const t=((t,e,i,n)=>{const s=e-t,o=n-i;return e=>i+((e-t)/s*o||0)})(o.scale,d,1,0);o.on("afterTransform",(()=>{s.style.opacity=t(o.scale)+""}))}o.on("endAnimation",(()=>{t.destroy()})),o.target.a=d,o.target.b=0,o.target.c=0,o.target.d=d,o.panTo({x:c,y:h,scale:d,friction:u?.2:.33,ignoreBounds:!0}),o.isResting&&t.destroy()}setContent(t,e){return new Promise(((i,n)=>{const s=this.instance,o=t.el;if(!o)return void n();s.showLoading(t);const a=document.createElement("img");if(a.classList.add("fancybox-image"),a.src=e||"",t.imageEl=a,s.setContent(t,a,!1),this.option("protected")){o.addEventListener("contextmenu",(t=>{t.preventDefault()}));const e=t.contentEl;if(e){const t=document.createElement("div");L(t,"fancybox-protected"),e.append(t)}}t.panzoom=new T(o,u({},this.option("Panzoom")||{},{content:a,width:s.optionFor(t,"width","auto"),height:s.optionFor(t,"height","auto"),wheel:()=>{const t=s.option("wheel");return("zoom"===t||"pan"==t)&&t},click:(e,i)=>{var n;if(s.isCompact||s.isClosing())return!1;let o=!i||i.target&&(null===(n=t.contentEl)||void 0===n?void 0:n.contains(i.target));return s.option(o?"contentClick":"backdropClick")||!1},dblClick:()=>s.isCompact?"toggleZoom":s.option("contentDblClick")||!1,spinner:!1,panOnlyZoomed:!0,wheelLimit:1/0,transformParent:!0,on:{ready:t=>{i(t)},error:()=>{n()},destroy:()=>{n()}}}))}))}zoomIn(t){return new Promise(((e,i)=>{const{panzoom:n,contentEl:s,el:o}=t,a=this.getZoomInfo(t);if(!(a&&o&&s&&n))return void i();const{x:r,y:l,scale:c,opacity:h}=a,d=()=>{t.state!==V.Closing&&(h&&(s.style.opacity=Math.max(Math.min(1,1-(1-n.scale)/(1-c)),0)+""),n.scale>=1&&n.scale>n.targetScale-.1&&e(n))},u=t=>{t.scale<.99||(o.classList.remove("is-zooming-in"),t.off("endAnimation",u),t.off("touchStart",u),t.off("afterTransform",d),e(t))};n.on("endAnimation",u),n.on("touchStart",u),n.on("afterTransform",d),n.on(["error","destroy"],(()=>{i()})),n.panTo({x:r,y:l,scale:c,friction:0,ignoreBounds:!0}),n.stop("current");const p=this.instance,m={event:"mousemove"===n.panMode?p.prevMouseMoveEvent||p.options.event:void 0},f=this.optionFor(t,"initialSize");L(o,"is-zooming-in"),p.hideLoading(t),"full"===f?n.zoomToFull(m):"cover"===f?n.zoomToCover(m):"max"===f?n.zoomToMax(m):n.reset(.2)}))}getZoomInfo(t){const{el:e,imageEl:i,thumbEl:n,panzoom:s}=t;if(!e||!i||!n||!s||(t=>{const e=window.pageYOffset,i=window.pageYOffset+window.innerHeight;if(!x(t))return 0;const n=t.getBoundingClientRect(),s=n.y+window.pageYOffset,o=n.y+n.height+window.pageYOffset;if(e>o||io)return 100;if(si)return 100;let a=n.height;si&&(a-=o-i);const r=a/window.innerHeight*100;return Math.round(r)})(n)<5||!this.optionFor(t,"zoom")||this.instance.state===Z.Destroy)return!1;const{top:o,left:a,width:r,height:l}=n.getBoundingClientRect();let{top:c,left:h,fitWidth:d,fitHeight:u}=s.contentRect;if(!(r&&l&&d&&u))return!1;const p=r/d,m=s.container.getBoundingClientRect();c+=m.top,h+=m.left;const f=-1*(h+.5*d-(a+.5*r)),g=-1*(c+.5*u-(o+.5*l));let b=this.option("zoomOpacity")||!1;return"auto"===b&&(b=Math.abs(r/l-d/u)>.1),{x:f,y:g,scale:p,opacity:b}}attach(){this.instance.on("Carousel.change",this.onChange),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.change",this.onChange),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("close",this.onClose)}}Object.defineProperty(Q,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}});const tt=(t,e={})=>{const i=new URL(t),n=new URLSearchParams(i.search),s=new URLSearchParams;for(const[t,i]of[...n,...Object.entries(e)]){let e=i.toString();"t"===t?s.set("start",parseInt(e).toString()):s.set(t,e)}let o=s.toString(),a=t.match(/#t=((.*)?\d+s)/);return a&&(o+=`#t=${a[1]}`),o},et={ajax:null,autoSize:!0,preload:!0,videoAutoplay:!0,videoRatio:16/9,videoTpl:'',videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,rel:0,fs:1}},it=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo","video"];class nt extends F{onInitSlides(t,e){for(const t of e.slides)this.processType(t)}onCreateSlide(t,e,i){this.setContent(i)}onRemoveSlide(t,e,i){i.closeBtnEl&&(i.closeBtnEl.remove(),i.closeBtnEl=void 0),i.xhr&&(i.xhr.abort(),i.xhr=null),i.iframeEl&&(i.iframeEl.onload=i.iframeEl.onerror=null,i.iframeEl.src="//about:blank",i.iframeEl=null);const n=i.contentEl,s=i.placeholderEl;if("inline"===i.type&&n&&s)n.classList.remove("fancybox__content"),"none"!==n.style.display&&(n.style.display="none"),s.parentNode&&s.parentNode.insertBefore(n,s),s.remove(),i.placeholderEl=null;else for(;i.el&&i.el.firstChild;)i.el.removeChild(i.el.firstChild)}onSelectSlide(t,e,i){i.state===V.Ready&&this.playVideo()}onUnselectSlide(t,e,i){var n,s;if("html5video"===i.type){try{null===(s=null===(n=i.el)||void 0===n?void 0:n.querySelector("video"))||void 0===s||s.pause()}catch(t){}return}let o;"vimeo"===i.type?o={method:"pause",value:"true"}:"youtube"===i.type&&(o={event:"command",func:"pauseVideo"}),o&&i.iframeEl&&i.iframeEl.contentWindow&&i.iframeEl.contentWindow.postMessage(JSON.stringify(o),"*"),i.poller&&clearTimeout(i.poller)}onDone(t,e){t.isCurrentSlide(e)&&!t.isClosing()&&this.playVideo()}onRefresh(t,e){e.slides.forEach((t=>{t.el&&(this.setAspectRatio(t),this.resizeIframe(t))}))}onMessage(t){try{let e=JSON.parse(t.data);if("https://player.vimeo.com"===t.origin){if("ready"===e.event)for(let e of Array.from(document.getElementsByClassName("fancybox__iframe")))e instanceof HTMLIFrameElement&&e.contentWindow===t.source&&(e.dataset.ready="true")}else if("https://www.youtube-nocookie.com"===t.origin&&"onReady"===e.event){const t=document.getElementById(e.id);t&&(t.dataset.ready="true")}}catch(t){}}loadAjaxContent(t){const e=this.instance.optionFor(t,"src")||"";this.instance.showLoading(t);const i=this.instance,n=new XMLHttpRequest;i.showLoading(t),n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&i.state===Z.Ready&&(i.hideLoading(t),200===n.status?i.setContent(t,n.responseText):i.setError(t,404===n.status?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const s=t.ajax||null;n.open(s?"POST":"GET",e+""),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send(s),t.xhr=n}setInlineContent(t){let e=null;if(x(t.src))e=t.src;else if("string"==typeof t.src){const i=t.src.split("#",2).pop();e=i?document.getElementById(i):null}if(e){if("clone"===t.type||e.dataset.placeholderId){e=e.cloneNode(!0);const i=e.dataset.animationName;i&&(e.classList.remove(i),delete e.dataset.animationName),delete e.dataset.placeholderId;let n=e.getAttribute("id");n=n?`${n}--clone`:`clone-${this.instance.id}-${t.index}`,e.setAttribute("id",n)}else if(e.parentNode){const i=document.createElement("div");i.classList.add("fancybox-placeholder"),e.parentNode.insertBefore(i,e),t.placeholderEl=i}this.instance.setContent(t,e)}else this.instance.setError(t,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(t){const{src:e,el:i}=t;if(!e||"string"!=typeof e||!i)return;const n=this.instance,s=document.createElement("iframe");s.className="fancybox__iframe",s.setAttribute("id",`fancybox__iframe_${n.id}_${t.index}`),s.setAttribute("allow","autoplay; fullscreen"),s.setAttribute("scrolling","auto"),s.onerror=()=>{n.setError(t,"{{IFRAME_ERROR}}")},t.iframeEl=s;const o=this.optionFor(t,"preload");if(i.classList.add("is-loading"),"iframe"!==t.type||!1===o)return s.setAttribute("src",t.src+""),this.resizeIframe(t),void n.setContent(t,s);n.showLoading(t),s.onload=()=>{if(!s.src.length)return;const e="true"!==s.dataset.ready;s.dataset.ready="true",this.resizeIframe(t),e?n.revealContent(t):n.hideLoading(t)},s.setAttribute("src",e),n.setContent(t,s,!1)}resizeIframe(t){const e=t.iframeEl,i=null==e?void 0:e.parentElement;if(!e||!i)return;let n=t.autoSize,s=t.width||0,o=t.height||0;s&&o&&(n=!1);const a=i&&i.style;if(!1!==t.preload&&!1!==n&&a)try{const t=window.getComputedStyle(i),n=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),r=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),l=e.contentWindow;if(l){const t=l.document,e=t.getElementsByTagName("html")[0],i=t.body;a.width="",i.style.overflow="hidden",s=s||e.scrollWidth+n,a.width=`${s}px`,i.style.overflow="",a.flex="0 0 auto",a.height=`${i.scrollHeight}px`,o=e.scrollHeight+r}}catch(t){}if(s||o){const t={flex:"0 1 auto",width:"",height:""};s&&(t.width=`${s}px`),o&&(t.height=`${o}px`),Object.assign(a,t)}}playVideo(){const t=this.instance.getSlide();if(!t)return;const{el:e}=t;if(!e||!e.offsetParent)return;if(!this.optionFor(t,"videoAutoplay"))return;if("html5video"===t.type)try{const t=e.querySelector("video");if(t){const e=t.play();void 0!==e&&e.then((()=>{})).catch((e=>{t.muted=!0,t.play()}))}}catch(t){}if("youtube"!==t.type&&"vimeo"!==t.type)return;const i=()=>{if(t.iframeEl&&t.iframeEl.contentWindow){let e;if("true"===t.iframeEl.dataset.ready)return e="youtube"===t.type?{event:"command",func:"playVideo"}:{method:"play",value:"true"},e&&t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"),void(t.poller=void 0);"youtube"===t.type&&(e={event:"listening",id:t.iframeEl.getAttribute("id")},t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"))}t.poller=setTimeout(i,250)};i()}processType(t){if(t.html)return t.type="html",t.src=t.html,void(t.html="");const e=this.instance.optionFor(t,"src","");if(!e||"string"!=typeof e)return;let i=t.type,n=null;if(n=e.match(/(?:youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const s=tt(e,this.optionFor(t,"youtube")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://www.youtube-nocookie.com/embed/${o}?${s}`,t.thumbSrc=t.thumbSrc||`https://i.ytimg.com/vi/${o}/mqdefault.jpg`,i="youtube"}else if(n=e.match(/^.+vimeo.com\/(?:\/)?([\d]+)(.*)?/)){const s=tt(e,this.optionFor(t,"vimeo")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://player.vimeo.com/video/${o}?${s}`,i="vimeo"}if(!i&&t.triggerEl){const e=t.triggerEl.dataset.type;it.includes(e)&&(i=e)}i||"string"==typeof e&&("#"===e.charAt(0)?i="inline":(n=e.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(i="html5video",t.videoFormat=t.videoFormat||"video/"+("ogv"===n[1]?"ogg":n[1])):e.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?i="image":e.match(/\.(pdf)((\?|#).*)?$/i)?i="pdf":(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src=`https://maps.google.${n[1]}/?ll=${(n[2]?n[2]+"&z="+Math.floor(parseFloat(n[3]))+(n[4]?n[4].replace(/^\//,"&"):""):n[4]+"").replace(/\?/,"&")}&output=${n[4]&&n[4].indexOf("layer=c")>0?"svembed":"embed"}`,i="map"):(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src=`https://maps.google.${n[1]}/maps?q=${n[2].replace("query=","q=").replace("api=1","")}&output=embed`,i="map")),t.type=i||this.instance.option("defaultType")}setContent(t){const e=this.instance.optionFor(t,"src")||"";if(t&&t.type&&e){switch(t.type){case"html":this.instance.setContent(t,e);break;case"html5video":const i=this.option("videoTpl");i&&this.instance.setContent(t,i.replace(/\{\{src\}\}/gi,e+"").replace(/\{\{format\}\}/gi,this.optionFor(t,"videoFormat")||"").replace(/\{\{poster\}\}/gi,t.poster||t.thumbSrc||""));break;case"inline":case"clone":this.setInlineContent(t);break;case"ajax":this.loadAjaxContent(t);break;case"pdf":case"map":case"youtube":case"vimeo":t.preload=!1;case"iframe":this.setIframeContent(t)}this.setAspectRatio(t)}}setAspectRatio(t){var e;const i=t.contentEl,n=this.optionFor(t,"videoRatio"),s=null===(e=t.el)||void 0===e?void 0:e.getBoundingClientRect();if(!(i&&s&&n&&1!==n&&t.type&&["video","youtube","vimeo","html5video"].includes(t.type)))return;const o=s.width,a=s.height;i.style.aspectRatio=n+"",i.style.width=o/a>n?"auto":"",i.style.height=o/a>n?"":"auto"}attach(){this.instance.on("Carousel.initSlides",this.onInitSlides),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("Carousel.selectSlide",this.onSelectSlide),this.instance.on("Carousel.unselectSlide",this.onUnselectSlide),this.instance.on("Carousel.Panzoom.refresh",this.onRefresh),this.instance.on("done",this.onDone),window.addEventListener("message",this.onMessage)}detach(){this.instance.off("Carousel.initSlides",this.onInitSlides),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("Carousel.selectSlide",this.onSelectSlide),this.instance.off("Carousel.unselectSlide",this.onUnselectSlide),this.instance.off("Carousel.Panzoom.refresh",this.onRefresh),this.instance.off("done",this.onDone),window.removeEventListener("message",this.onMessage)}}Object.defineProperty(nt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:et});class st extends F{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:"ready"}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return"ready"!==this.state}onReady(t){this.option("autoStart")&&(t.isInfinite||t.page{this.timer=null,this.inHover||this.onTimerEnd()}),e),t.style.transitionDuration=`${e}ms`,t.style.transform="scaleX(1)"}this.emit("set")}clear(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.removeProgressBar()}start(){if(this.set(),this.option("pauseOnHover")){const t=this.instance.container;t.addEventListener("mouseenter",this.onMouseEnter,!1),t.addEventListener("mouseleave",this.onMouseLeave,!1)}document.addEventListener("visibilitychange",this.onVisibilityChange,!1)}stop(){const t=this.instance.container;this.clear(),this.state="ready",t.removeEventListener("mouseenter",this.onMouseEnter,!1),t.removeEventListener("mouseleave",this.onMouseLeave,!1),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),z(t,"has-autoplay"),this.emit("stop")}pause(){"play"===this.state&&(this.state="pause",this.clear(),this.emit("pause"))}resume(){const t=this.instance;if(t.isInfinite||t.page!==t.pages.length-1)if("play"!==this.state){if("pause"===this.state&&!this.inHover){const t=new Event("resume",{bubbles:!0,cancelable:!0});this.emit("resume",event),t.defaultPrevented||this.set()}}else this.set();else this.stop()}toggle(){"play"===this.state||"pause"===this.state?this.stop():this.set()}attach(){this.instance.on("ready",this.onReady),this.instance.on("Panzoom.startAnimation",this.onChange),this.instance.on("Panzoom.endAnimation",this.onSettle),this.instance.on("Panzoom.touchMove",this.onChange)}detach(){this.instance.off("ready",this.onReady),this.instance.off("Panzoom.startAnimation",this.onChange),this.instance.off("Panzoom.endAnimation",this.onSettle),this.instance.off("Panzoom.touchMove",this.onChange),this.stop()}}Object.defineProperty(st,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class ot extends F{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(t){const e=t.carousel;if(!e)return;const i=t.container;i&&(e.options.Autoplay=u(this.option("Autoplay")||{},{pauseOnHover:!1,autoStart:!1,timeout:this.option("timeout"),progressParentEl:()=>i.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]")||i,on:{set:e=>{var n;i.classList.add("has-slideshow"),(null===(n=t.getSlide())||void 0===n?void 0:n.state)!==V.Ready&&e.pause()},stop:()=>{i.classList.remove("has-slideshow"),t.isCompact||t.endIdle()},resume:(e,i)=>{var n,s,o;!i||!i.cancelable||(null===(n=t.getSlide())||void 0===n?void 0:n.state)===V.Ready&&(null===(o=null===(s=t.carousel)||void 0===s?void 0:s.panzoom)||void 0===o?void 0:o.isResting)||i.preventDefault()}}}),e.attachPlugins({Autoplay:st}),this.ref=e.plugins.Autoplay)}onReady(t){const e=t.carousel,i=this.ref;e&&i&&this.option("playOnStart")&&(e.isInfinite||e.page{t.isCurrentSlide(e)&&i.stop()})),t.isCurrentSlide(e)&&i.resume()}onKeydown(t,e){var i;const n=this.ref;n&&e===this.option("key")&&"BUTTON"!==(null===(i=document.activeElement)||void 0===i?void 0:i.nodeName)&&n.toggle()}attach(){this.instance.on("Carousel.init",this.onPrepare),this.instance.on("Carousel.ready",this.onReady),this.instance.on("done",this.onDone),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onPrepare),this.instance.off("Carousel.ready",this.onReady),this.instance.off("done",this.onDone),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(ot,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{key:" ",playOnStart:!1,timeout:3e3}});const at={classes:{container:"f-thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'',type:"modern"};var rt;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden",t[t.Disabled=3]="Disabled"}(rt||(rt={}));let lt=class extends F{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"shouldCenter",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:rt.Init})}formatThumb(t,e){return this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}getSlides(){const t=[],e=this.option("thumbTpl")||"";if(e)for(const i of this.instance.slides||[])t.push({html:this.formatThumb(i,e),customClass:`has-thumb for-${i.type||"image"}`});return t}getProgress(t){const e=this.instance,i=e.panzoom,n=e.pages[t]||0;if(!n||!i)return 0;let s=-1*i.current.e,o=e.contentDim,a=(s-n.pos)/(1*n.dim),r=(s+o-n.pos)/(1*n.dim),l=(s-o-n.pos)/(1*n.dim);return a=Math.max(0,Math.min(1,Math.abs(a))),r=Math.max(0,Math.min(1,Math.abs(r))),l=Math.max(0,Math.min(1,Math.abs(l))),a=Math.min(a,r,l),a}onInitSlide(t,e){const i=e.el;i&&(e.thumbSrc=i.dataset.thumbSrc||e.thumbSrc||"",e.thumbClipWidth=parseFloat(i.dataset.thumbClipWidth||"")||e.thumbClipWidth||0,e.thumbHeight=parseFloat(i.dataset.thumbHeight||"")||e.thumbHeight||0)}onInitSlides(){this.state===rt.Init&&this.build()}onRefreshM(){this.refreshModern()}onChangeM(){"modern"===this.type&&(this.shouldCenter=!0,this.centerModern())}onClickModern(t){t.preventDefault(),t.stopPropagation();const e=this.instance,i=e.page,n=t=>{if(t){const e=t.closest("[data-carousel-page]");if(e)return parseInt(e.dataset.carouselPage||"",10)||0}return-1},s=(t,e)=>{const i=document.elementFromPoint(t,e);return i?n(i):-1};let o=n(t.target);o<0&&(o=s(t.clientX+this.thumbGap,t.clientY),o===i&&(o=i-1)),o<0&&(o=s(t.clientX-this.thumbGap,t.clientY),o===i&&(o=i+1)),o<0&&(o=(e=>{let n=s(t.clientX-e,t.clientY),a=s(t.clientX+e,t.clientY);return o<0&&n===i&&(o=i+1),o<0&&a===i&&(o=i-1),o})(this.thumbExtraGap)),o===i?this.centerModern():o>-1&&o{this.emit("ready")}))}buildModern(){if("modern"!==this.type)return;const{container:t,track:e,instance:i}=this,s=this.option("thumbTpl")||"";if(!t||!e||!s)return;this.updateModern();for(const t of i.slides||[]){const i=document.createElement("div");L(i,this.cn("slide")),i.appendChild(n(this.formatThumb(t,s))),t.thumbSlideEl=i,e.appendChild(i),this.resizeModernSlide(t)}const o=new i.constructor.Panzoom(t,{content:e,lockAxis:"x",zoom:!1,panOnlyZoomed:!1,bounds:()=>{let t=0,e=0,n=i.slides[0],s=i.slides[i.slides.length-1],o=i.slides[i.page];return n&&s&&o&&(e=-1*this.getModernThumbPos(0),0!==i.page&&(e+=.5*(n.thumbWidth||0)),t=-1*this.getModernThumbPos(i.slides.length-1),i.page!==i.slides.length-1&&(t+=(s.thumbWidth||0)-(o.thumbWidth||0)-.5*(s.thumbWidth||0))),{x:{min:t,max:e},y:{min:0,max:0}}}});o.on("touchStart",(()=>{this.shouldCenter=!1})),o.on("click",((t,e)=>this.onClickModern(e))),o.on("ready",(()=>{this.centerModern(),this.emit("ready")})),o.on(["afterTransform","refresh"],(t=>{this.lazyLoadModern()})),this.panzoom=o,this.refreshModern()}updateModern(){if("modern"!==this.type)return;const{container:t}=this;t&&(this.thumbGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-gap"))||0,this.thumbExtraGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-extra-gap"))||0,this.thumbWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-width"))||40,this.thumbClipWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-clip-width"))||40,this.thumbHeight=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-height"))||40)}refreshModern(){var t;if("modern"===this.type){this.updateModern();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.onTransformM(),null===(t=this.panzoom)||void 0===t||t.updateMetrics(!0),this.centerModern(0)}}centerModern(t){const i=this.instance,{container:n,panzoom:s}=this;if(!n||!s||s.state===g.Init)return;const o=i.page;let a=this.getModernThumbPos(o),r=a;for(let t=i.page-3;ti.pages.length-1||t===i.page)continue;const e=1-this.getProgress(t);e>0&&e<1&&(r+=e*(this.getModernThumbPos(t)-a))}let l=100;void 0===t&&(t=.2,i.inTransition.size>0&&(t=.12),Math.abs(-1*s.current.e-r)>s.containerRect.width&&(t=.5,l=0)),s.options.maxVelocity=l,s.applyChange({panX:e(-1*r-s.target.e,1e3),friction:null===i.prevPage?0:t})}lazyLoadModern(){const{instance:t,panzoom:e}=this;if(!e)return;const i=-1*e.current.e||0;let s=this.getModernThumbPos(t.page);if(e.state!==g.Init||0===s)for(const s of t.slides||[]){const t=s.thumbSlideEl;if(!t)continue;const o=t.querySelector("img[data-lazy-src]"),a=s.index,r=this.getModernThumbPos(a),l=i-.5*e.containerRect.innerWidth,c=l+e.containerRect.innerWidth;if(!o||rc)continue;let h=o.dataset.lazySrc;if(!h||!h.length)continue;if(delete o.dataset.lazySrc,o.src=h,o.complete)continue;L(t,this.cn("isLoading"));const d=n(w);t.appendChild(d),o.addEventListener("load",(()=>{t.offsetParent&&(t.classList.remove(this.cn("isLoading")),d.remove())}),!1)}}resizeModernSlide(t){if("modern"!==this.type)return;if(!t.thumbSlideEl)return;const e=t.thumbClipWidth&&t.thumbHeight?Math.round(this.thumbHeight*(t.thumbClipWidth/t.thumbHeight)):this.thumbWidth;t.thumbWidth=e}getModernThumbPos(t){const i=this.instance.slides[t],n=this.panzoom;if(!n||!n.contentRect.fitWidth)return 0;let s=n.containerRect.innerWidth,o=n.contentRect.width;2===this.instance.slides.length&&(t-=1,o=2*this.thumbClipWidth);let a=t*(this.thumbClipWidth+this.thumbGap)+this.thumbExtraGap+.5*(i.thumbWidth||0);return a-=o>s?.5*s:.5*o,e(a||0,1)}build(){const t=this.instance,e=t.container,i=this.option("minCount")||0;if(i){let e=0;for(const i of t.slides||[])i.thumbSrc&&e++;if(e{var e,i;this.hidden&&(null===(e=t.container)||void 0===e||e.classList.add("is-hidden"),null===(i=t.container)||void 0===i||i.setAttribute("aria-hidden","true"),queueMicrotask((()=>{this.show()})))}}}),e.attachPlugins({Thumbs:lt}),this.ref=e.plugins.Thumbs,this.option("showOnStart")||(this.ref.state=rt.Hidden,this.hidden=!0))}onResize(){var t;const e=null===(t=this.ref)||void 0===t?void 0:t.container;e&&(e.style.height="")}onKeydown(t,e){const i=this.option("key");i&&i===e&&this.toggle()}toggle(){const t=this.ref;t&&t.state!==rt.Disabled&&(t.state!==rt.Hidden?this.hidden?this.show():this.hide():t.build())}show(){var t,e;const i=this.ref;i&&i.state!==rt.Disabled&&(this.refresh(),null===(t=i.container)||void 0===t||t.removeAttribute("aria-hidden"),null===(e=i.container)||void 0===e||e.classList.remove("is-hidden"),this.hidden=!1)}hide(){var t,e;const i=this.ref;i&&(this.refresh(),null===(t=i.container)||void 0===t||t.classList.add("is-hidden"),null===(e=i.container)||void 0===e||e.setAttribute("aria-hidden","true")),this.hidden=!0}refresh(){const t=this.ref;if(!t||t.state===rt.Disabled)return;const e=t.container,i=(null==e?void 0:e.firstChild)||null;e&&i&&i.childNodes.length&&(e.style.height=`${i.getBoundingClientRect().height}px`,e.offsetHeight)}attach(){this.instance.on("Carousel.init",this.onInit),this.instance.on("resize",this.onResize),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onInit),this.instance.off("resize",this.onResize),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(ht,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:ct});const dt={panLeft:{icon:'',change:{panX:-100}},panRight:{icon:'',change:{panX:100}},panUp:{icon:'',change:{panY:-100}},panDown:{icon:'',change:{panY:100}},zoomIn:{icon:'',action:"zoomIn"},zoomOut:{icon:'',action:"zoomOut"},toggle1to1:{icon:'',action:"toggleZoom"},toggleZoom:{icon:'',action:"toggleZoom"},iterateZoom:{icon:'',action:"iterateZoom"},rotateCCW:{icon:'',action:"rotateCCW"},rotateCW:{icon:'',action:"rotateCW"},flipX:{icon:'',action:"flipX"},flipY:{icon:'',action:"flipY"},fitX:{icon:'',action:"fitX"},fitY:{icon:'',action:"fitY"},reset:{icon:'',action:"reset"},toggleFS:{icon:'',action:"toggleFS"}};var ut;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Disabled=2]="Disabled"}(ut||(ut={}));const pt={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'
/
'},download:{tpl:''},prev:{tpl:''},next:{tpl:''},slideshow:{tpl:''},fullscreen:{tpl:''},thumbs:{tpl:''},close:{tpl:''}},parentEl:null},mt={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"};class ft extends F{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:ut.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(t){var e;if(!t.carousel)return;let i=this.option("display"),n=this.option("absolute"),s=this.option("enabled");if("auto"===s){const t=this.instance.carousel;let e=0;if(t)for(const i of t.slides)(i.panzoom||"image"===i.type)&&e++;e||(s=!1)}s||(i=void 0);let o=0;const a={left:[],middle:[],right:[]};if(i)for(const t of["left","middle","right"])for(const n of i[t]){const i=this.createEl(n);i&&(null===(e=a[t])||void 0===e||e.push(i),o++)}let r=null;if(o&&(r=this.createContainer()),r){for(const[t,e]of Object.entries(a)){const i=document.createElement("div");L(i,"fancybox__toolbar__column is-"+t);for(const t of e)i.appendChild(t);"auto"!==n||"middle"!==t||e.length||(n=!0),r.appendChild(i)}!0===n&&L(r,"is-absolute"),this.state=ut.Ready,this.onRefresh()}else this.state=ut.Disabled}onClick(t){var e,i;const n=this.instance,s=n.getSlide(),o=null==s?void 0:s.panzoom,a=t.target,r=a&&x(a)?a.dataset:null;if(!r)return;if(void 0!==r.fancyboxToggleThumbs)return t.preventDefault(),t.stopPropagation(),void(null===(e=n.plugins.Thumbs)||void 0===e||e.toggle());if(void 0!==r.fancyboxToggleFullscreen)return t.preventDefault(),t.stopPropagation(),void this.instance.toggleFullscreen();if(void 0!==r.fancyboxToggleSlideshow){t.preventDefault(),t.stopPropagation();const e=null===(i=n.carousel)||void 0===i?void 0:i.plugins.Autoplay;let s=e.isActive;return o&&"mousemove"===o.panMode&&!s&&o.reset(),void(s?e.stop():e.start())}const l=r.panzoomAction,c=r.panzoomChange;if((c||l)&&(t.preventDefault(),t.stopPropagation()),c){let t={};try{t=JSON.parse(c)}catch(t){}o&&o.applyChange(t)}else l&&o&&o[l]&&o[l]()}onChange(){this.onRefresh()}onRefresh(){const t=this.container;if(!t)return;const e=this.instance.getSlide();if(!e)return;const i=e&&e.panzoom;for(const e of t.querySelectorAll("[data-panzoom-action]"))i?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));let n=i&&i.canZoomIn(),s=i&&i.canZoomOut();this.instance.isOpeningSlide(e)||e&&e.state!==V.Ready&&(n=s=!0);for(const e of t.querySelectorAll('[data-panzoom-action="zoomIn"]'))n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="zoomOut"]'))s?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){s||n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));const t=e.querySelector("g");t&&(t.style.display=n?"":"none")}}onDone(t,e){var i;null===(i=e.panzoom)||void 0===i||i.on("afterTransform",(()=>{this.instance.isCurrentSlide(e)&&this.onRefresh()})),this.instance.isCurrentSlide(e)&&this.onRefresh()}createContainer(){const t=this.instance.container;if(!t)return null;const e=this.option("parentEl")||t,i=document.createElement("div");return L(i,"fancybox__toolbar"),e.prepend(i),i.addEventListener("click",this.onClick,{passive:!1,capture:!0}),t&&L(t,"has-toolbar"),this.container=i,i}createEl(t){var e;const i=this.instance.carousel;if(!i)return null;if("toggleFS"===t)return null;if("fullscreen"===t&&!this.instance.fsAPI)return null;let s=null;const o=i.slides.length||0;let a=0,r=0;for(const t of i.slides)(t.panzoom||"image"===t.type)&&a++,("image"===t.type||t.downloadSrc)&&r++;if(o<2&&["infobar","prev","next"].includes(t))return s;if(void 0!==dt[t]&&!a)return null;if("download"===t&&!r)return null;if("thumbs"===t){const t=this.instance.plugins.Thumbs;if(!t||!t.isEnabled)return null}if("slideshow"===t){if(!(null===(e=this.instance.carousel)||void 0===e?void 0:e.plugins.Autoplay)||o<2)return null}if(void 0!==dt[t]){const e=dt[t];s=document.createElement("button"),s.setAttribute("title",this.instance.localize(`{{${t.toUpperCase()}}}`)),L(s,"f-button"),e.action&&(s.dataset.panzoomAction=e.action),e.change&&(s.dataset.panzoomChange=JSON.stringify(e.change)),s.appendChild(n(this.instance.localize(e.icon)))}else{const e=(this.option("items")||[])[t];e&&(s=n(this.instance.localize(e.tpl)),e.click&&s.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),"function"==typeof e.click&&e.click(t)})))}const l=null==s?void 0:s.querySelector("svg");if(l)for(const[t,e]of Object.entries(mt))l.getAttribute(t)||l.setAttribute(t,String(e));return s}removeContainer(){var t;const e=this.container;e&&e.removeEventListener("click",this.onClick,{passive:!1,capture:!0}),null===(t=this.container)||void 0===t||t.remove(),this.container=null,this.state=ut.Disabled;const i=this.instance.container;i&&z(i,"has-toolbar")}attach(){this.instance.on("Carousel.initSlides",this.onReady),this.instance.on("done",this.onDone),this.instance.on("reveal",this.onChange),this.instance.on("Carousel.change",this.onChange),this.onReady(this.instance)}detach(){this.instance.off("Carousel.initSlides",this.onReady),this.instance.off("done",this.onDone),this.instance.off("reveal",this.onChange),this.instance.off("Carousel.change",this.onChange),this.removeContainer()}}Object.defineProperty(ft,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:pt});const gt={Hash:U,Html:nt,Images:Q,Slideshow:ot,Thumbs:ht,Toolbar:ft};let bt=null,vt=null;const yt=new Map;let wt=0;class xt extends f{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(t=[],e={},i={}){super(e),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Z.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fsAPI",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.onWheel=O(this.onWheel.bind(this),300),this.fsAPI=(()=>{let t,e="",i="",n="";return document.fullscreenEnabled?(e="requestFullscreen",i="exitFullscreen",n="fullscreenElement"):document.webkitFullscreenEnabled&&(e="webkitRequestFullscreen",i="webkitExitFullscreen",n="webkitFullscreenElement"),e&&(t={request:function(t){return"webkitRequestFullscreen"===e?t[e](Element.ALLOW_KEYBOARD_INPUT):t[e]()},exit:function(){return document[n]&&document[i]()},isFullscreen:function(){return document[n]}}),t})(),this.id=e.id||++wt,yt.set(this.id,this),this.userSlides=t,this.userPlugins=i,queueMicrotask((()=>{this.init()}))}init(){this.state=Z.Init,this.attachPlugins(Object.assign(Object.assign({},xt.Plugins),this.userPlugins)),this.emit("init"),!0===this.option("hideScrollbar")&&(()=>{if(!X)return;if(document.body.classList.contains("compensate-for-scrollbar"))return;const t=window.innerWidth-document.documentElement.getBoundingClientRect().width;document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",`${t}px`),t&&document.body.classList.add("compensate-for-scrollbar")})(),this.initLayout();const t=()=>{this.initCarousel(this.userSlides),this.state=Z.Ready,this.attachEvents(),this.emit("ready"),setTimeout((()=>{this.container&&this.container.setAttribute("aria-hidden","false")}),16)};this.option("Fullscreen.autoStart")&&this.fsAPI&&!this.fsAPI.isFullscreen()?this.fsAPI.request(this.container).then((()=>t())).catch((()=>t())):t()}initLayout(){const t=this.option("parentEl")||document.body,e=n(this.localize(this.option("tpl.main")||""));e&&(e.setAttribute("id",`fancybox-${this.id}`),e.setAttribute("aria-label",this.localize("{{MODAL}}")),e.classList.toggle("is-compact",this.isCompact),this.container=e,this.footer=e.querySelector(".fancybox__footer"),t.appendChild(e),document.documentElement.classList.add("with-fancybox"),bt&&vt||(bt=document.createElement("button"),bt.classList.add("fancybox-focus-guard"),bt.setAttribute("aria-hidden","true"),bt.setAttribute("type","button"),vt=bt.cloneNode(),document.body.prepend(bt),document.body.append(vt)),this.option("animated")&&(e.classList.add("is-animated"),setTimeout((()=>{this.isClosing()||e.classList.remove("is-animated")}),350)),this.emit("initLayout"))}initCarousel(t){const e=this.container;if(!e)return;const i=e.querySelector(".fancybox__carousel");if(!i)return;const n=this.carousel=new W(i,u({},{slides:t,transition:"fade",Panzoom:{lockAxis:this.option("dragToClose")?"xy":"x",infinite:!!this.option("dragToClose")&&"y"},Dots:!1,Navigation:{classes:{container:"fancybox__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"}},initialPage:this.option("startIndex"),l10n:this.option("l10n")},this.option("Carousel")||{}));n.on("*",((t,e,...i)=>{this.emit(`Carousel.${e}`,t,...i)})),n.on(["ready","change"],(()=>{this.manageCaption(this.getSlide())})),n.on("removeSlide",((t,e)=>{e.closeBtnEl&&e.closeBtnEl.remove(),e.closeBtnEl=void 0,e.captionEl&&e.captionEl.remove(),e.captionEl=void 0,e.spinnerEl&&e.spinnerEl.remove(),e.spinnerEl=void 0,e.state=void 0})),n.on("Panzoom.touchStart",(()=>{this.isCompact||this.endIdle()})),n.on("settle",(()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&this.checkFocus()})),this.option("dragToClose")&&(n.on("Panzoom.afterTransform",((t,e)=>{const i=this.container;if(i){const t=Math.abs(e.current.f),n=t<1?"":Math.max(.5,Math.min(1,1-t/e.contentRect.fitHeight*1.5));i.style.setProperty("--fancybox-ts",n?"0s":""),i.style.setProperty("--fancybox-opacity",n+"")}})),n.on("Panzoom.touchEnd",((t,e,i)=>{const n=Math.abs(e.dragOffset.y);"y"===e.lockedAxis&&(n>=200||n>=50&&e.dragOffset.time<300)&&(i&&i.cancelable&&i.preventDefault(),this.close(i,"f-throwOut"+(e.current.f<0?"Up":"Down")))}))),n.on(["change"],(t=>{var e;let i=null===(e=this.getSlide())||void 0===e?void 0:e.triggerEl;if(i){const e=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:t.page});i.dispatchEvent(e)}})),n.on(["refresh","change"],(t=>{const e=this.container;if(!e)return;for(const i of e.querySelectorAll("[data-fancybox-current-index]"))i.innerHTML=t.page+1;for(const i of e.querySelectorAll("[data-fancybox-count]"))i.innerHTML=t.pages.length;if(!t.isInfinite){for(const i of e.querySelectorAll("[data-fancybox-next]"))t.page0?(i.removeAttribute("disabled"),i.removeAttribute("tabindex")):(i.setAttribute("disabled",""),i.setAttribute("tabindex","-1"))}const i=this.getSlide();let n=(null==i?void 0:i.downloadSrc)||"";n||!i||"image"!==i.type||i.error||"string"!=typeof i.src||(n=i.src);for(const t of e.querySelectorAll("[data-fancybox-download]"))n?(t.removeAttribute("disabled"),t.removeAttribute("tabindex"),t.setAttribute("href",n),t.setAttribute("download",n),t.setAttribute("target","_blank")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"),t.removeAttribute("href"),t.removeAttribute("download"))})),this.emit("initCarousel")}attachEvents(){const t=this.container;t&&(t.addEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),document.addEventListener("mousemove",this.onMousemove),window.addEventListener("resize",this.onResize),this.option("trapFocus")&&document.addEventListener("focus",this.onFocus,!0),document.addEventListener("keydown",this.onKeydown,!0),document.addEventListener("visibilitychange",this.onVisibilityChange,!1))}detachEvents(){const t=this.container;t&&(t.removeEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),document.removeEventListener("mousemove",this.onMousemove),window.removeEventListener("resize",this.onResize),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),document.removeEventListener("focus",this.onFocus,!0),document.removeEventListener("keydown",this.onKeydown,!0))}onClick(t){var e;if(this.isClosing())return;!this.isCompact&&this.option("idle")&&this.resetIdle();const i=t.composedPath()[0];if(i===(null===(e=this.carousel)||void 0===e?void 0:e.container))return;if(i.closest(".f-spinner")||i.closest("[data-fancybox-close]"))return t.preventDefault(),void this.close(t);if(i.closest("[data-fancybox-prev]"))return t.preventDefault(),void this.prev();if(i.closest("[data-fancybox-next]"))return t.preventDefault(),void this.next();if(this.isCompact)return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout((()=>{this.toggleIdle(),this.clickTimer=null}),350));if(this.emit("click",t),t.defaultPrevented)return;let n=!1;const s=document.activeElement;if(i.closest(".fancybox__content")){if(s){if(s.closest("[contenteditable]"))return;i.matches(Y)||s.blur()}if((o=window.getSelection())&&"Range"===o.type)return;n=this.option("contentClick")}else i.closest(".fancybox__carousel")&&!i.matches(Y)&&(n=this.option("backdropClick"));var o;"close"===n?(t.preventDefault(),this.close(t)):"next"===n?(t.preventDefault(),this.next()):"prev"===n&&(t.preventDefault(),this.prev())}onWheel(t){if(this.emit("wheel",t),t.defaultPrevented)return;const e=this.option("wheel",t);if("close"===e)t.preventDefault(),this.close(t);else if("slide"===e){const e=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail));t.preventDefault(),this[e>0?"next":"prev"]()}}onKeydown(t){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const e=t.key,i=this.option("keyboard");if(!i||t.ctrlKey||t.altKey||t.shiftKey)return;const n=t.composedPath()[0],s=document.activeElement&&document.activeElement.classList,o=s&&s.contains("f-button");if("Escape"!==e&&!o&&x(n)){if(n.isContentEditable||-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(n.nodeName))return}this.emit("keydown",e,t);const a=i[e];"function"==typeof this[a]&&this[a]()}onResize(){const t=this.container;if(!t)return;const e=this.isCompact;t.classList.toggle("is-compact",e),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.emit("resize")}onFocus(t){this.isTopmost()&&this.focus(t)}onMousemove(t){this.prevMouseMoveEvent=t,!this.isCompact&&this.option("idle")&&this.resetIdle()}onVisibilityChange(){"visible"===document.visibilityState?this.checkFocus():this.endIdle()}manageCloseBtn(t){const e=this.optionFor(t,"closeButton")||!1;if("auto"===e){const t=this.plugins.Toolbar;if(t&&t.state===ut.Ready)return}if(!e)return;if(!t.contentEl||t.closeBtnEl)return;const i=n(this.localize(this.option("tpl.closeButton")));t.closeBtnEl=t.contentEl.appendChild(i),t.el&&L(t.el,"has-close-btn")}manageCaption(t){var e,i,n;const s=this.container;if(!s)return;const o=this.isCompact||this.option("commonCaption"),a=!o;if(this.caption&&this.stop(this.caption),a&&this.caption&&(this.caption.remove(),this.caption=null),o&&!this.caption)for(const t of(null===(e=this.carousel)||void 0===e?void 0:e.slides)||[])t.captionEl&&(t.captionEl.remove(),t.captionEl=void 0,null===(i=t.el)||void 0===i||i.classList.remove("has-caption"),null===(n=t.el)||void 0===n||n.removeAttribute("aria-labelledby"));if(t||(t=this.getSlide()),!t||o&&!this.isCurrentSlide(t))return;const r=t.el;let l=this.optionFor(t,"caption","");if("string"!=typeof l||!l.length)return void(o&&this.caption&&this.animate(this.caption,"f-fadeOut",(()=>{var t;null===(t=this.caption)||void 0===t||t.remove(),this.caption=null})));let c=null;if(a){if(c=t.captionEl||null,r&&!c){const e=`fancybox__caption_${this.id}_${t.index}`;c=document.createElement("div"),c.className="fancybox__caption",c.setAttribute("id",e),t.captionEl=r.appendChild(c),r.classList.add("has-caption"),r.setAttribute("aria-labelledby",e)}}else{if(c=this.caption,c||(c=s.querySelector(".fancybox__caption")),!c){c=document.createElement("div"),c.dataset.fancyboxCaption="",c.className="fancybox__caption",c.innerHTML=l;(this.footer||s).prepend(c)}s.classList.add("has-caption"),this.caption=c}c&&(c.innerHTML=l)}checkFocus(){var t;const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}focus(t){var e;if(this.ignoreFocusChange)return;const i=document.activeElement||null,n=(null==t?void 0:t.target)||null,s=this.container,o=this.getSlide();if(!s||!(null===(e=this.carousel)||void 0===e?void 0:e.viewport))return;const a=o&&o.state===V.Ready?o.el:null;if(!a||a.contains(i))return;t&&t.cancelable&&t.preventDefault(),this.ignoreFocusChange=!0;const r=Array.from(s.querySelectorAll(Y));let l,c=[s];for(let t of r){const e=t.offsetParent&&!t.closest('[aria-hidden="true"]'),i=a&&a.contains(t),n=!this.carousel.viewport.contains(t);e&&(i||n)?(c.push(t),void 0!==t.dataset.origTabindex&&(t.tabIndex=parseFloat(t.dataset.origTabindex)),t.removeAttribute("data-orig-tabindex"),(t.hasAttribute("autoFocus")||!l&&i)&&(l=t)):(t.dataset.origTabindex=void 0===t.dataset.origTabindex?t.getAttribute("tabindex")||void 0:t.dataset.origTabindex,t.tabIndex=-1)}let h=null;t?(!n||c.indexOf(n)<0)&&(h=s,c.length&&(i===vt?h=c[0]:this.lastFocus!==s&&i!==bt||(h=c[c.length-1]))):this.option("autoFocus")&&l?h=l:i&&c.indexOf(i)<0&&(h=s),h&&(t=>{if(t&&X){void 0===$&&document.createElement("div").focus({get preventScroll(){return $=!0,!1}});try{if($)t.focus({preventScroll:!0});else{const e=window.pageXOffset||document.body.scrollTop,i=window.pageYOffset||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:i,behavior:"auto"})}}catch(t){}}})(h),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const t=this.carousel;t&&t.pages.length>1&&t.slideNext()}prev(){const t=this.carousel;t&&t.pages.length>1&&t.slidePrev()}jumpTo(...t){this.carousel&&this.carousel.slideTo(...t)}isTopmost(){var t;return(null===(t=xt.getInstance())||void 0===t?void 0:t.id)==this.id}animate(t=null,e="",i){if(!t||!e)return void(i&&i());this.stop(t);const n=s=>{s.target===t&&t.dataset.animationName&&(t.removeEventListener("animationend",n),delete t.dataset.animationName,i&&i(),t.classList.remove(e))};t.dataset.animationName=e,t.addEventListener("animationend",n),t.classList.add(e)}stop(t){t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:t}))}setContent(t,e="",i=!0){if(this.isClosing())return;const n=t.el;if(!n)return;let s=null;if(x(e))["img","iframe","video","audio"].includes(e.nodeName.toLowerCase())?(s=document.createElement("div"),s.appendChild(e)):s=e;else{const t=document.createRange().createContextualFragment(e);s=document.createElement("div"),s.appendChild(t)}s instanceof Element&&t.filter&&!t.error&&(s=s.querySelector(t.filter)),s instanceof Element?(s.classList.add("fancybox__content"),t.id&&s.setAttribute("id",t.id),"none"!==s.style.display&&"none"!==getComputedStyle(s).getPropertyValue("display")||(s.style.display=t.display||this.option("defaultDisplay")||"flex"),n.classList.add(`has-${t.error?"error":t.type||"unknown"}`),n.prepend(s),t.contentEl=s,i&&this.revealContent(t),this.manageCloseBtn(t),this.manageCaption(t)):this.setError(t,"{{ELEMENT_NOT_FOUND}}")}revealContent(t,e){const i=t.el,n=t.contentEl;i&&n&&(this.emit("reveal",t),this.hideLoading(t),t.state=V.Opening,(e=this.isOpeningSlide(t)?void 0===e?this.optionFor(t,"showClass"):e:"f-fadeIn")?this.animate(n,e,(()=>{this.done(t)})):this.done(t))}done(t){var e;this.isClosing()||(t.state=V.Ready,this.emit("done",t),null===(e=t.el)||void 0===e||e.classList.add("is-done"),this.isCurrentSlide(t)&&this.option("autoFocus")&&queueMicrotask((()=>{var t;if(this.option("autoFocus")){const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}})),this.isOpeningSlide(t)&&!this.isCompact&&this.option("idle")&&this.setIdle())}isCurrentSlide(t){const e=this.getSlide();return!(!t||!e)&&e.index===t.index}isOpeningSlide(t){var e,i;return null===(null===(e=this.carousel)||void 0===e?void 0:e.prevPage)&&t.index===(null===(i=this.getSlide())||void 0===i?void 0:i.index)}showLoading(t){t.state=V.Loading;const e=t.el;if(!e)return;e.classList.add("is-loading"),this.emit("loading",t),t.spinnerEl||setTimeout((()=>{if(!this.isClosing()&&!t.spinnerEl&&t.state===V.Loading){let i=n(w);t.spinnerEl=i,e.prepend(i),this.animate(i,"f-fadeIn")}}),250)}hideLoading(t){const e=t.el;if(!e)return;const i=t.spinnerEl;this.isClosing()?null==i||i.remove():(e.classList.remove("is-loading"),i&&this.animate(i,"f-fadeOut",(()=>{i.remove()})),t.state===V.Loading&&(this.emit("loaded",t),t.state=V.Ready))}setError(t,e){if(this.isClosing())return;this.emit("error"),t.error=e,this.hideLoading(t),this.clearContent(t);const i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(e||"

{{ERROR}}

"),this.setContent(t,i)}clearContent(t){var e;null===(e=this.carousel)||void 0===e||e.emit("removeSlide",t),t.contentEl&&(t.contentEl.remove(),t.contentEl=void 0),t.closeBtnEl&&(t.closeBtnEl.remove(),t.closeBtnEl=void 0);const i=t.el;i&&(z(i,"is-loading"),z(i,"has-error"),z(i,"has-unknown"),z(i,`has-${t.type||"unknown"}`))}getSlide(){var t;const e=this.carousel;return(null===(t=null==e?void 0:e.pages[null==e?void 0:e.page])||void 0===t?void 0:t.slides[0])||void 0}close(t,e){if(this.isClosing())return;const i=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",i,t),i.defaultPrevented)return;t&&t.cancelable&&(t.preventDefault(),t.stopPropagation());const n=this.fsAPI,s=()=>{this.proceedClose(t,e)};n&&n.isFullscreen()?Promise.resolve(n.exit()).then((()=>s())):s()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(t=!1){const e=()=>{var t;this.clearIdle(),this.idle=!0,null===(t=this.container)||void 0===t||t.classList.add("is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(t)e();else{const t=this.option("idle");t&&(this.idleTimer=setTimeout(e,t))}}endIdle(){var t;this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,null===(t=this.container)||void 0===t||t.classList.remove("is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){const t=this.fsAPI;t&&(t.isFullscreen()?t.exit():this.container&&t.request(this.container))}isClosing(){return[Z.Closing,Z.CustomClosing,Z.Destroy].includes(this.state)}proceedClose(t,e){var i,n;this.state=Z.Closing,this.clearIdle(),this.detachEvents();const s=this.container,o=this.carousel,a=this.getSlide(),r=null==a?void 0:a.state;if(a){const t=this.option("placeFocusBack")?(null===(i=this.getSlide())||void 0===i?void 0:i.triggerEl)||this.option("trigger"):null;t&&t.focus()}if(s&&(L(s,"is-closing"),s.setAttribute("aria-hidden","true"),this.option("animated")&&L(s,"is-animated"),s.style.pointerEvents="none"),o){o.clearTransitions(),null===(n=o.panzoom)||void 0===n||n.destroy();for(const t of o.slides){t.state=V.Closing,this.hideLoading(t);const e=t.contentEl;e&&this.stop(e);const i=null==t?void 0:t.panzoom;i&&(i.stop(),i.detachEvents(),i.detachObserver()),this.isCurrentSlide(t)||o.emit("removeSlide",t)}}this.emit("close",t),this.state!==Z.CustomClosing?(void 0===e&&a&&(e=this.optionFor(a,"hideClass")),e&&a&&r===V.Ready?(this.animate(a.contentEl,e,(()=>{o&&o.emit("removeSlide",a)})),setTimeout((()=>{this.destroy()}),350)):this.destroy()):setTimeout((()=>{this.destroy()}),350)}destroy(){var t;if(this.state===Z.Destroy)return;this.state=Z.Destroy,null===(t=this.carousel)||void 0===t||t.destroy();const e=this.container;e&&e.remove(),yt.delete(this.id);const i=xt.getInstance();i?i.focus():(bt&&(bt.remove(),bt=null),vt&&(vt.remove(),vt=null),document.documentElement.classList.remove("with-fancybox"),X&&(document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",""),document.body.classList.remove("compensate-for-scrollbar")))}static bind(t,e,i){if(!X)return;let n,s="",o={};if("string"==typeof t?(n=document.body,s=t,"object"==typeof e&&(o=e||{})):(n=t,"string"==typeof e&&(s=e),"object"==typeof i&&(o=i||{})),!n)return;s=s||"[data-fancybox]";const a=xt.openers.get(n)||new Map;a.set(s,o),xt.openers.set(n,a),1===a.size&&n.addEventListener("click",xt.fromEvent)}static unbind(t,e){let i,n="";if("string"==typeof t?(i=document.body,n=t):(i=t,"string"==typeof e&&(n=e)),!i)return;const s=xt.openers.get(i);s&&n&&s.delete(n),n&&s||(xt.openers.delete(i),i.removeEventListener("click",xt.fromEvent))}static destroy(){let t;for(;t=xt.getInstance();)t.destroy();for(const t of xt.openers.keys())t.removeEventListener("click",xt.fromEvent);xt.openers=new Map}static fromEvent(t){if(t.defaultPrevented)return;if(t.button&&0!==t.button)return;if(t.ctrlKey||t.metaKey||t.shiftKey)return;let e=t.composedPath()[0];const i=e.closest("[data-fancybox-trigger]");if(i){const t=i.dataset.fancyboxTrigger||"",n=document.querySelectorAll(`[data-fancybox="${t}"]`),s=parseInt(i.dataset.fancyboxIndex||"",10)||0;e=n[s]||e}if(!(e&&e instanceof Element))return;let n,s,o,a;if([...xt.openers].reverse().find((([t,i])=>!(!t.contains(e)||![...i].reverse().find((([i,r])=>{let l=e.closest(i);return!!l&&(n=t,s=i,o=l,a=r,!0)}))))),!n||!s||!o)return;a=a||{},t.preventDefault(),e=o;let r=[],l=u({},q,a);l.event=t,l.trigger=e,l.delegate=i;const c=l.groupAll,h=l.groupAttr,d=h&&e?e.getAttribute(`${h}`):"";if((!e||d||c)&&(r=[].slice.call(n.querySelectorAll(s))),e&&!c&&(r=d?r.filter((t=>t.getAttribute(`${h}`)===d)):[e]),!r.length)return;const p=xt.getInstance();return p&&p.options.trigger&&r.indexOf(p.options.trigger)>-1?void 0:(e&&(l.startIndex=r.indexOf(e)),xt.fromNodes(r,l))}static fromNodes(t,e){e=u({},q,e);const i=[];for(const n of t){const t=n.dataset||{},s=t.src||n.getAttribute("href")||n.getAttribute("currentSrc")||n.getAttribute("src")||void 0;let o;const a=e.delegate;let r;a&&i.length===e.startIndex&&(o=a instanceof HTMLImageElement?a:a.querySelector("img:not([aria-hidden])")),o||(o=n instanceof HTMLImageElement?n:n.querySelector("img:not([aria-hidden])")),o&&(r=o.currentSrc||o.src||void 0,!r&&o.dataset&&(r=o.dataset.lazySrc||o.dataset.src||void 0));const l={src:s,triggerEl:n,thumbEl:o,thumbElSrc:r,thumbSrc:r};for(const e in t)"fancybox"!==e&&(l[e]=t[e]+"");i.push(l)}return new xt(i,e)}static getInstance(t){if(t)return yt.get(t);return Array.from(yt.values()).reverse().find((t=>!t.isClosing()&&t))||null}static getSlide(){var t;return(null===(t=xt.getInstance())||void 0===t?void 0:t.getSlide())||null}static show(t=[],e={}){return new xt(t,e)}static next(){const t=xt.getInstance();t&&t.next()}static prev(){const t=xt.getInstance();t&&t.prev()}static close(t=!0,...e){if(t)for(const t of yt.values())t.close(...e);else{const t=xt.getInstance();t&&t.close(...e)}}}Object.defineProperty(xt,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(xt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:q}),Object.defineProperty(xt,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:gt}),Object.defineProperty(xt,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),t.Carousel=W,t.Fancybox=xt,t.Panzoom=T})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";const e=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),i=function(t,e){return!(!t||t===document.body||e&&t===e)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,n=-1!==i.indexOf("hidden"),s=-1!==i.indexOf("visible");return e&&!n&&!s}(t)?t:i(t.parentElement,e))},n=function(t){return(new DOMParser).parseFromString(t,"text/html").body.firstChild},s=t=>`${t||""}`.split(" ").filter((t=>!!t)),o=(t,e,i)=>{s(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))};class a{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const r={passive:!1};class l{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:n=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=n;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,r),this.element.addEventListener("touchmove",this.onMove,r),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,r)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new a(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new a(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new a(t))):[new a(t)],n=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(n.push(t),this.currentPointers[e]=t)}n.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new a(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new a(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,r),this.element.removeEventListener("touchstart",this.onTouchStart,r),this.element.removeEventListener("touchmove",this.onMove,r),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function c(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function h(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const d=t=>"object"==typeof t&&null!==t&&t.constructor===Object&&"[object Object]"===Object.prototype.toString.call(t),u=(t,...e)=>{const i=e.length;for(let n=0;n{const n=Array.isArray(i)?[]:{};t[e]||Object.assign(t,{[e]:n}),d(i)?Object.assign(t[e],u(n,i)):Array.isArray(i)?Object.assign(t,{[e]:[...i]}):Object.assign(t,{[e]:i})}))}return t},p=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class m{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?u({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=p(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...n){let s=p(e,t);var o;"string"!=typeof(o=s)||isNaN(o)||isNaN(parseFloat(o))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...n));let a=p(e,this.options);return a&&"function"==typeof a?s=a.call(this,this,t,...n,s):void 0===s&&(s=a),void 0===s?i:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(m,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(m,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class f extends m{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,n]of Object.entries(t)){const t=this.option(i),s=this.plugins[i];s||!1===t?s&&!1===t&&(s.detach(),delete this.plugins[i]):e.set(i,new n(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}var g;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(g||(g={}));const b=["a","b","c","d","e","f"],v={PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"},y={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:v},w='
',x=t=>t&&null!==t&&t instanceof Element&&"nodeType"in t,S=(t,e)=>{s(e).forEach((e=>{t&&t.classList.remove(e)}))},E=(t,e)=>{s(e).forEach((e=>{t&&t.classList.add(e)}))},P={a:1,b:0,c:0,d:1,e:0,f:0},C=1e5,M=1e3;let T=null,O=null;class A extends f{get isTouchDevice(){return null===O&&(O=window.matchMedia("(hover: none)").matches),O}get isMobile(){return null===T&&(T=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),T}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const t=this.content;return!!(t&&t instanceof HTMLImageElement)&&!t.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of b){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var s;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:g.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},P)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},P)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},A.Plugins),i)),this.emit("init"),this.isContentLoading){const e=this.content;if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const i=n(w);t.contains(e)?this.spinner=(null===(s=e.parentElement)||void 0===s?void 0:s.insertBefore(i,e))||null:this.spinner=t.appendChild(i)}this.emit("beforeLoad"),e.addEventListener("load",this.onLoad),e.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===g.Init&&this.enable()}onError(){this.state!==g.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=g.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new l(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of b)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of b)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,n=i.e+t,s=i.f+e,o=this.getBounds(),{x:a,y:r}=o,l=a.min,c=a.max,h=r.min,d=r.max;let u=0,p=0;return l!==1/0&&nc&&(u=c-n),h!==1/0&&sd&&(p=d-s),Math.abs(u)<.001&&(u=0),Math.abs(p)<.001&&(p=0),Object.assign(Object.assign({},o),{xDiff:u,yDiff:p,inBounds:!u&&!p})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:n,fitHeight:s,fullWidth:o,fullHeight:a}=i;let r=o,l=a;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),c=i?o:n,h=i?a:s,d=this.getMatrix(t),u=new DOMPoint(0,0).matrixTransform(d),p=new DOMPoint(0+c,0).matrixTransform(d),m=new DOMPoint(0+c,0+h).matrixTransform(d),f=new DOMPoint(0,0+h).matrixTransform(d),g=Math.abs(m.x-u.x),b=Math.abs(m.y-u.y),v=Math.abs(f.x-p.x),y=Math.abs(f.y-p.y);r=Math.max(g,v),l=Math.max(b,y)}return{contentWidth:r,contentHeight:l}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const n=i.closest("[data-panzoom-action]"),s=i.closest("[data-panzoom-change]"),o=n||s,a=o&&x(o)?o.dataset:null;if(a){const e=a.panzoomChange,i=a.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const r=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(r.x-this.dragStart.x)>2||Math.abs(r.y-this.dragStart.y)>2))return;this.dragStart.time=0;const l=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},c=this.option("click",t),h=this.option("dblClick",t);h?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&c&&l(c)):(this.emit("dblClick",t),t.defaultPrevented||l(h)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&c&&l(c))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(t,i,n){var s;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const o=this.content.getBoundingClientRect();if(this.dragStart={x:o.x,y:o.y,top:o.top,left:o.left,time:Date.now()},!1===this.option("touch",t))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;if(!n.length){const e=t.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(e.nodeName)||e.closest("[contenteditable]")||e.closest("[data-selectable]")||e.closest("[data-panzoom-change]")||e.closest("[data-panzoom-action]"))return!1;null===(s=window.getSelection())||void 0===s||s.removeAllRanges()}return"mousedown"===t.type&&t.preventDefault(),e(this.targetScale,1e3)===e(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(i),this.emit("touchStart",t),!0}onPointerMove(t,n,s){if(!this.isDragging)return;if(n.length<2&&this.panOnlyZoomed&&e(this.targetScale)<=e(this.minScale))return;if(this.emit("touchMove",t),t.defaultPrevented)return;this.addTrackingPoint(n[0]);const{content:o}=this,a=h(s[0],s[1]),r=h(n[0],n[1]);let l=0,d=0;if(n.length>1){const t=o.getBoundingClientRect();l=a.clientX-t.left-.5*t.width,d=a.clientY-t.top-.5*t.height}const u=c(s[0],s[1]),p=c(n[0],n[1]);let m=u?p/u:1,f=r.clientX-a.clientX,g=r.clientY-a.clientY;this.dragOffset.x+=f,this.dragOffset.y+=g,this.dragOffset.time=Date.now()-this.dragStart.time;let b=e(this.targetScale)===e(this.minScale)&&this.option("lockAxis");if(b&&!this.lockedAxis)if("xy"===b||"y"===b||"touchmove"===t.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void t.preventDefault();const e=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=e>45&&e<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,f=0,g=0}else this.lockedAxis=b;if(i(t.target,this.content)&&(b="x",this.dragOffset.y=0),b&&"xy"!==b&&this.lockedAxis!==b&&e(this.targetScale)===e(this.minScale))return;t.cancelable&&t.preventDefault(),this.container.classList.add(this.cn("isDragging"));const v=this.checkBounds(f,g);this.option("rubberband")?("x"!==this.isInfinite&&(v.xDiff>0&&f<0||v.xDiff<0&&f>0)&&(f*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*v.xDiff))),"y"!==this.isInfinite&&(v.yDiff>0&&g<0||v.yDiff<0&&g>0)&&(g*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*v.yDiff)))):(v.xDiff&&(f=0),v.yDiff&&(g=0));const y=this.targetScale,w=this.minScale,x=this.maxScale;y<.5*w&&(m=Math.max(m,w)),y>1.5*x&&(m=Math.min(m,x)),"y"===this.lockedAxis&&e(y)===e(w)&&(f=0),"x"===this.lockedAxis&&e(y)===e(w)&&(g=0),this.applyChange({originX:l,originY:d,panX:f,panY:g,scale:m,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,e,n){if(n.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(e),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),i(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==g.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of b)this.velocity[t]=0,this.target[t]=this.current[t];S(this.container,"is-scaling"),S(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:t}=this,i=t[0],n=t[t.length-1];let s=0,o=0,a=0;n&&i&&(s=n.clientX-i.clientX,o=n.clientY-i.clientY,a=n.time-i.time);let r=0,l=0,c=0,h=0,d=this.option("decelFriction");const u=this.targetScale;if((uthis.maxScale+1e-5)&&(d=.35),a>0){c=Math.abs(s)>3?s/(a/30):0,h=Math.abs(o)>3?o/(a/30):0;const t=this.option("maxVelocity");t&&(c=Math.max(Math.min(c,t),-1*t),h=Math.max(Math.min(h,t),-1*t))}c&&(r=c/(1/(1-d)-1)),h&&(l=h/(1/(1-d)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&e(u)===this.minScale)&&(r=c=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&e(u)===this.minScale)&&(l=h=0);const p=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(s)),"auto"===m&&(m=parseFloat(s.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(s));const f=(this.option("transformParent")?s.parentElement:null)||s,b=f.getAttribute("style")||"";f.style.setProperty("transform","none","important"),f.style.setProperty("transition","none","important"),f.style.setProperty("animation","none","important"),s instanceof HTMLImageElement&&(f.style.width="",f.style.height=""),f.offsetHeight;const v=s.getBoundingClientRect();let y=v.width,w=v.height,x=0,S=0;if(s instanceof HTMLImageElement&&({width:y,height:w,top:x,left:S}=((t,e,i,n)=>{const s=i/n;return s>t/e?(i=t,n=t/s):(i=e*s,n=e),{width:i,height:n,top:.5*(e-n),left:.5*(t-i)}})(v.width,v.height,p,m)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:v.top-r.top+x,bottom:r.bottom-v.bottom+x,left:v.left-r.left+S,right:r.right-v.right+S,fitWidth:y,fitHeight:w,width:y,height:w,fullWidth:p,fullHeight:m}),f.style.cssText=b,s instanceof HTMLImageElement&&(f.style.width=`${y}px`,f.style.height=`${w}px`),this.setTransform(),!0!==t){let t="";Math.abs(c-o)>1&&(t+="x"),Math.abs(h-a)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(e(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===g.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const t=this.option("bounds");if("auto"!==t)return t;const{contentWidth:i,contentHeight:n}=this.calculateContentDim(this.target);let s=0,o=0,a=0,r=0;const l=this.option("infinite");if(!0===l||this.lockedAxis&&l===this.lockedAxis)s=-1/0,a=1/0,o=-1/0,r=1/0;else{let{containerRect:t,contentRect:l}=this,c=e(this.contentRect.fitWidth*this.targetScale,M),h=e(this.contentRect.fitHeight*this.targetScale,M),{innerWidth:d,innerHeight:u}=t;if(this.containerRect.width===c&&(d=t.width),this.containerRect.width===h&&(u=t.height),i>d){a=.5*(i-d),s=-1*a;let t=.5*(l.right-l.left);s+=t,a+=t}if(this.contentRect.fitWidth>d&&iu){r=.5*(n-u),o=-1*r;let t=.5*(l.bottom-l.top);o+=t,r+=t}this.contentRect.fitHeight>u&&n-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(l=!0),this.contentRect.width*this.targetScalee(this.targetScale),h=!c&&!l&&a&&e(n).9*t.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:n=this.option("friction"),angle:s=0,originX:o=0,originY:a=0,flipX:r=!1,flipY:l=!1,ignoreBounds:c=!1}){this.state!==g.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:s,originX:o,originY:a,friction:n,flipX:r,flipY:l,ignoreBounds:c})}applyChange({panX:t=0,panY:i=0,scale:n=1,angle:s=0,originX:o=-this.current.e,originY:a=-this.current.f,friction:r=this.option("friction"),flipX:l=!1,flipY:c=!1,ignoreBounds:h=!1,bounce:d=this.option("bounce")}){const u=this.state;if(u===g.Init||u===g.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of b)this.velocity[t]=0;this.friction=r||0,this.ignoreBounds=h;const{current:p}=this,m=p.e,f=p.f,v=this.getMatrix(this.target);let y=(new DOMMatrix).translate(m,f).translate(o,a).translate(t,i);if(this.option("zoom")){if(!h){const t=this.targetScale,e=this.minScale,i=this.maxScale;t*ni&&(n=i/t)}y=y.scale(n)}y=y.translate(-o,-a).translate(-m,-f).multiply(v),s&&(y=y.rotate(s)),l&&(y=y.scale(-1,1)),c&&(y=y.scale(1,-1));for(const t of b)"a"!=t&&"d"!=t||!(y[t]>this.minScale+1e-5||y[t].1||"mousemove"===this.panMode||!1===d)&&!h&&this.clampTargetBounds(),this.isResting||(this.state=g.Panning,this.requestTick())}stop(t=!1){if(this.state!==g.Init&&this.state!==g.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of b)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),S(this.container,"is-scaling"),S(this.container,"is-animating"),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=g.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),E(this.container,"is-animating"),this.isScaling&&E(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(t,i=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=t,"mousemove"!==this.panMode||!t)return;if(e(this.targetScale)<=e(this.minScale))return;this.emit("mouseMove",t);const{container:n,containerRect:s,contentRect:o}=this,a=s.width,r=s.height,l=n.getBoundingClientRect(),c=(t.clientX||0)-l.left,h=(t.clientY||0)-l.top;let{contentWidth:d,contentHeight:u}=this.calculateContentDim(this.target);const p=this.option("mouseMoveFactor");p>1&&(d!==a&&(d*=p),u!==r&&(u*=p));let m=.5*(d-a)-c/a*100/100*(d-a);m+=.5*(o.right-o.left);let f=.5*(u-r)-h/r*100/100*(u-r);f+=.5*(o.bottom-o.top),this.applyChange({panX:m-this.target.e,panY:f-this.target.f,friction:i})}zoomWithWheel(t){if(this.state===g.Destroy||this.state===g.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),n=this.targetScale,s=this.maxScale,o=this.minScale;let a=n*(100+i*e)/100;as&&n>=s?(this.wheelDelta+=Math.abs(i),a=s):(this.wheelDelta=0,a=Math.max(Math.min(a,s),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),a!==n&&this.zoomTo(a,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.maxScale-this.minScale)?"max":"fit",t)}toggleCover(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.coverScale-this.minScale)?"cover":"fit",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:n=0,event:s}={}){if(this.isContentLoading||this.state===g.Destroy)return;this.stop();const{targetScale:o}=this;let a=1;if("mousemove"===this.panMode&&(s=this.prevMouseMoveEvent||s),s){const t=this.content.getBoundingClientRect(),e=s.clientX||0,o=s.clientY||0;i=e-t.left-.5*t.width,n=o-t.top-.5*t.height}const r=this.fullScale,l=this.maxScale;let c=this.coverScale;"number"==typeof t?a=t/o:("next"===t&&(r-c<.2&&(c=r),t=o1?.15:.25:e,this.applyChange({scale:a,originX:i,originY:n,friction:e}),s&&"mousemove"===this.panMode&&this.panWithMouse(s,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const n=t.classList.contains(e);n?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(n?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:n,d:s,e:o,f:a}=t;return new DOMMatrix([e,i,n,s,o,a])}reset(t){if(this.state!==g.Init&&this.state!==g.Destroy){this.stop("current");for(const t of b)this.target[t]=P[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=g.Panning,this.requestTick())}}destroy(){this.stop(),this.state=g.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(A,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:y}),Object.defineProperty(A,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});const L=function(t,e){let i=!0;return(...n)=>{i&&(i=!1,t(...n),setTimeout((()=>{i=!0}),e))}},z=(t,e)=>{let i=[];return t.childNodes.forEach((t=>{t.nodeType!==Node.ELEMENT_NODE||e&&!t.matches(e)||i.push(t)})),i},R={viewport:null,track:null,enabled:!0,slides:[],axis:"x",transition:"fade",preload:1,slidesPerPage:"auto",initialPage:0,friction:.12,center:!0,infinite:!0,fill:!0,dragFree:!1,adaptiveHeight:!1,direction:"ltr",classes:{container:"f-carousel",viewport:"f-carousel__viewport",track:"f-carousel__track",slide:"f-carousel__slide",isLTR:"is-ltr",isRTL:"is-rtl",isHorizontal:"is-horizontal",isVertical:"is-vertical",inTransition:"in-transition",isSelected:"is-selected"},l10n:{NEXT:"Next slide",PREV:"Previous slide",GOTO:"Go to slide #%d"}};var k;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Destroy=2]="Destroy"}(k||(k={}));const I=t=>{if("string"==typeof t&&(t={html:t}),!(t instanceof String||t instanceof HTMLElement)){const e=t.thumb;void 0!==e&&("string"==typeof e&&(t.thumbSrc=e),e instanceof HTMLImageElement&&(t.thumbEl=e,t.thumbElSrc=e.src,t.thumbSrc=e.src),delete t.thumb)}return Object.assign({html:"",el:null,isDom:!1,class:"",index:-1,dim:0,gap:0,pos:0,transition:!1},t)},D=(t={})=>Object.assign({index:-1,slides:[],dim:0,pos:-1},t);class F extends m{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const j={classes:{list:"f-carousel__dots",isDynamic:"is-dynamic",hasDots:"has-dots",dot:"f-carousel__dot",isBeforePrev:"is-before-prev",isPrev:"is-prev",isCurrent:"is-current",isNext:"is-next",isAfterNext:"is-after-next"},dotTpl:'',dynamicFrom:11,maxCount:1/0,minCount:2};class H extends F{constructor(){super(...arguments),Object.defineProperty(this,"isDynamic",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"list",{enumerable:!0,configurable:!0,writable:!0,value:null})}onRefresh(){this.refresh()}build(){let t=this.list;return t||(t=document.createElement("ul"),E(t,this.cn("list")),t.setAttribute("role","tablist"),this.instance.container.appendChild(t),E(this.instance.container,this.cn("hasDots")),this.list=t),t}refresh(){var t;const e=this.instance.pages.length,i=Math.min(2,this.option("minCount")),n=Math.max(2e3,this.option("maxCount")),s=this.option("dynamicFrom");if(en)return void this.cleanup();const a="number"==typeof s&&e>5&&e>=s,r=!this.list||this.isDynamic!==a||this.list.children.length!==e;r&&this.cleanup();const l=this.build();if(o(l,this.cn("isDynamic"),!!a),r)for(let t=0;t=e-1&&s.setAttribute("disabled","")))}createButton(t){const e=this.instance,i=document.createElement("button");i.setAttribute("tabindex","0"),i.setAttribute("title",e.localize(`{{${t.toUpperCase()}}}`)),E(i,this.cn("button")+" "+this.cn("next"===t?"isNext":"isPrev"));const n=e.isRTL?"next"===t?"prev":"next":t;var s;return i.innerHTML=e.localize(this.option(`${n}Tpl`)),i.dataset[`carousel${s=t,s?s.match("^[a-z]")?s.charAt(0).toUpperCase()+s.substring(1):s:""}`]="true",i}build(){let t=this.container;t||(this.container=t=document.createElement("div"),E(t,this.cn("container")),this.instance.container.appendChild(t)),this.next||(this.next=t.appendChild(this.createButton("next"))),this.prev||(this.prev=t.appendChild(this.createButton("prev")))}cleanup(){this.prev&&this.prev.remove(),this.next&&this.next.remove(),this.container&&this.container.remove(),this.prev=null,this.next=null,this.container=null}attach(){this.instance.on(["refresh","change"],this.onRefresh)}detach(){this.instance.off(["refresh","change"],this.onRefresh),this.cleanup()}}Object.defineProperty(B,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{classes:{container:"f-carousel__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"},nextTpl:'',prevTpl:''}});class _ extends F{constructor(){super(...arguments),Object.defineProperty(this,"selectedIndex",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nav",{enumerable:!0,configurable:!0,writable:!0,value:null})}addAsTargetFor(t){this.target=this.instance,this.nav=t,this.attachEvents()}addAsNavFor(t){this.nav=this.instance,this.target=t,this.attachEvents()}attachEvents(){this.nav&&this.target&&(this.nav.options.initialSlide=this.target.options.initialPage,this.nav.on("ready",this.onNavReady),this.nav.state===k.Ready&&this.onNavReady(this.nav),this.target.on("ready",this.onTargetReady),this.target.state===k.Ready&&this.onTargetReady(this.target))}onNavReady(t){t.on("createSlide",this.onNavCreateSlide),t.on("Panzoom.click",this.onNavClick),this.onTargetChange()}onTargetReady(t){t.on("change",this.onTargetChange),t.on("Panzoom.refresh",this.onTargetChange),this.onTargetChange()}onNavClick(t,e,i){var n,s;const o=i.target,{nav:a,target:r}=this;if(!a||!r||!o)return;const l=o.closest("[data-index]");if(!l)return;i.stopPropagation(),i.preventDefault();const c=parseInt(l.dataset.index||"",10)||0,h=r.getPageForSlide(c),d=a.getPageForSlide(c);r.page!==h&&r.slideTo(h,{friction:null===(s=null===(n=this.nav)||void 0===n?void 0:n.plugins)||void 0===s?void 0:s.Sync.option("friction")}),this.markSelectedSlide(c),a.page!==d&&a.slideTo(d)}onNavCreateSlide(t,e){e.index===this.selectedIndex&&this.markSelectedSlide(e.index)}onTargetChange(){const{target:t,nav:e}=this;if(!t||!e)return;if(e.state!==k.Ready||t.state!==k.Ready)return;const i=t.pages[t.page].slides[0].index,n=e.getPageForSlide(i);this.markSelectedSlide(i),e.slideTo(n)}markSelectedSlide(t){const{nav:e}=this;if(!e||e.state!==k.Ready)return;this.selectedIndex=t,[...e.slides].filter((t=>t.el&&t.el.classList.remove("is-nav-selected")));const i=e.slides[t];i&&i.el&&i.el.classList.add("is-nav-selected")}attach(){let t=this.options.target,e=this.options.nav;t?this.addAsNavFor(t):e&&this.addAsTargetFor(e)}detach(){this.nav&&(this.nav.off("ready",this.onNavReady),this.nav.off("Panzoom.click",this.onNavClick),this.nav.off("createSlide",this.onNavCreateSlide)),this.nav=null,this.target&&(this.target.off("ready",this.onTargetReady),this.target.off("refresh",this.onTargetChange),this.target.off("change",this.onTargetChange)),this.target=null}}Object.defineProperty(_,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{friction:.35}});const N={Navigation:B,Dots:H,Sync:_};class W extends f{get axis(){return this.isHorizontal?"e":"f"}get isEnabled(){return this.state===k.Ready}get isInfinite(){let t=!1;const e=this.contentDim,i=this.viewportDim;return this.pages.length>=2&&e>1.5*i&&(t=this.option("infinite")),t}get isRTL(){return"rtl"===this.option("direction")}get isHorizontal(){return"x"===this.option("axis")}constructor(t,e={},i={}){if(super(),Object.defineProperty(this,"userOptions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"bp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:k.Init}),Object.defineProperty(this,"page",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevPage",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"viewport",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"slides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pages",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"inTransition",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"contentDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"viewportDim",{enumerable:!0,configurable:!0,writable:!0,value:0}),"string"==typeof t&&(t=document.querySelector(t)),!t||!x(t))throw new Error("No Element found");this.container=t,this.slideNext=L(this.slideNext.bind(this),175),this.slidePrev=L(this.slidePrev.bind(this),175),this.userOptions=e,this.userPlugins=i,queueMicrotask((()=>{this.processOptions()}))}processOptions(){const t=u({},W.defaults,this.userOptions);let e="";const i=t.breakpoints;if(i&&d(i))for(const[n,s]of Object.entries(i))window.matchMedia(n).matches&&d(s)&&(e+=n,u(t,s));e===this.bp&&this.state!==k.Init||(this.bp=e,this.state===k.Ready&&(t.initialSlide=this.pages[this.page].slides[0].index),this.state!==k.Init&&this.destroy(),super.setOptions(t),!1===this.option("enabled")?this.attachEvents():setTimeout((()=>{this.init()}),0))}init(){this.state=k.Init,this.emit("init"),this.attachPlugins(Object.assign(Object.assign({},W.Plugins),this.userPlugins)),this.initLayout(),this.initSlides(),this.updateMetrics(),this.setInitialPosition(),this.initPanzoom(),this.attachEvents(),this.state=k.Ready,this.emit("ready")}initLayout(){const{container:t}=this,e=this.option("classes");E(t,this.cn("container")),o(t,e.isLTR,!this.isRTL),o(t,e.isRTL,this.isRTL),o(t,e.isVertical,!this.isHorizontal),o(t,e.isHorizontal,this.isHorizontal);let i=this.option("viewport")||t.querySelector(`.${e.viewport}`);i||(i=document.createElement("div"),E(i,e.viewport),i.append(...z(t,`.${e.slide}`)),t.prepend(i));let n=this.option("track")||t.querySelector(`.${e.track}`);n||(n=document.createElement("div"),E(n,e.track),n.append(...Array.from(i.childNodes))),n.setAttribute("aria-live","polite"),i.contains(n)||i.prepend(n),this.viewport=i,this.track=n,this.emit("initLayout")}initSlides(){const{track:t}=this;if(t){this.slides=[],[...z(t,`.${this.cn("slide")}`)].forEach((t=>{if(x(t)){const e=I({el:t,isDom:!0,index:this.slides.length});this.slides.push(e),this.emit("initSlide",e,this.slides.length)}}));for(let t of this.option("slides",[])){const e=I(t);e.index=this.slides.length,this.slides.push(e),this.emit("initSlide",t,this.slides.length)}this.emit("initSlides")}}setInitialPage(){let t=0;const e=this.option("initialSlide");t="number"==typeof e?this.getPageForSlide(e):parseInt(this.option("initialPage",0)+"",10)||0,this.page=t}setInitialPosition(){if(!this.track||!this.pages.length)return;let t=this.page;this.pages[t]||(this.page=t=0);const e=this.pages[t].pos*(this.isRTL&&this.isHorizontal?1:-1),i=this.isHorizontal?`${e}px`:"0",n=this.isHorizontal?"0":`${e}px`;this.track.style.transform=`translate3d(${i}, ${n}, 0) scale(1)`,this.option("adaptiveHeight")&&this.setViewportHeight()}initPanzoom(){this.panzoom&&(this.panzoom.destroy(),this.panzoom=null);const t=this.option("Panzoom")||{};this.panzoom=new A(this.viewport,u({},{content:this.track,zoom:!1,panOnlyZoomed:!1,lockAxis:this.isHorizontal?"x":"y",infinite:this.isInfinite,decelFriction:.12,click:!1,dblClick:!1,touch:t=>!(this.pages.length<2&&!t.options.infinite),bounds:()=>this.getBounds(),maxVelocity:t=>Math.abs(t.target[this.axis]-t.current[this.axis])<2*this.viewportDim?100:0},t)),this.panzoom.on("*",((t,e,...i)=>{this.emit(`Panzoom.${e}`,t,...i)})),this.panzoom.on("decel",this.onDecel),this.panzoom.on("refresh",this.onRefresh),this.panzoom.on("beforeTransform",this.onBeforeTransform),this.panzoom.on("endAnimation",this.onEndAnimation),this.panzoom.on("touchStart",((t,e)=>{this.inTransition.size&&e.preventDefault()}))}attachEvents(){const t=this.container;t&&(t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("slideTo",this.onSlideTo)),window.addEventListener("resize",this.onResize)}createPages(){let t=[];const{contentDim:e,viewportDim:i}=this,n=this.option("slidesPerPage");if("number"==typeof n&&e>i){for(let e=0;ei)&&(t.push(D()),s=t.length-1,o=0),o+=e.dim+e.gap,t[s].slides.push(e);return t}processPages(){const t=this.pages,{contentDim:i,viewportDim:n}=this,s=this.option("center"),o=this.option("fill");if(t.forEach(((t,e)=>{t.index=e,t.pos=t.slides[0].pos,t.dim=0;for(const[e,i]of t.slides.entries())t.dim+=i.dim,e{o&&!this.isInfinite&&i>n&&(t.pos=Math.max(t.pos,0),t.pos=Math.min(t.pos,i-n)),t.pos=e(t.pos,1e3),t.dim=e(t.dim,1e3)})),this.isInfinite)return t;const a=[];let r;return t.forEach((t=>{const e=Object.assign({},t);r&&e.pos===r.pos?(r.dim+=e.dim,r.slides=[...r.slides,...e.slides]):(e.index=a.length,r=e,a.push(e))})),a}getPageFromIndex(t=0){const e=this.pages.length;let i;return t=parseInt((t||0).toString())||0,i=this.isInfinite?(t%e+e)%e:Math.max(Math.min(t,this.pages.length-1),0),i}getSlideMetrics(t){const e=this.isHorizontal?"width":"height";let i=0,n=0,s=t.el;s?i=parseFloat(s.dataset[e]||"")||0:(s=document.createElement("div"),s.style.visibility="hidden",E(s,this.cn("slide")+" "+t.class),(this.track||document.body).prepend(s)),i?(s.style[e]=`${i}px`,s.style["width"===e?"height":"width"]=""):i=s.getBoundingClientRect()[e];const o=getComputedStyle(s);return"content-box"===o.boxSizing&&(this.isHorizontal?(i+=parseFloat(o.paddingLeft)||0,i+=parseFloat(o.paddingRight)||0):(i+=parseFloat(o.paddingTop)||0,i+=parseFloat(o.paddingBottom)||0)),n=parseFloat(o[this.isHorizontal?"marginRight":"marginBottom"])||0,this.isHorizontal,t.el||s.remove(),{dim:i,gap:n}}getBounds(){let t={min:0,max:0};if(this.isInfinite)t={min:-1/0,max:1/0};else if(this.pages.length){const e=this.pages[0].pos,i=this.pages[this.pages.length-1].pos;t=this.isRTL&&this.isHorizontal?{min:e,max:i}:{min:-1*i,max:-1*e}}return{x:this.isHorizontal?t:{min:0,max:0},y:this.isHorizontal?{min:0,max:0}:t}}repositionSlides(){const{viewportDim:t,contentDim:i,page:n,pages:s}=this;let o,a=0,r=0,l=0,c=0;this.panzoom?c=-1*this.panzoom.current[this.isHorizontal?"e":"f"]:s[n]&&(c=s[n].pos||0),o=this.isHorizontal?this.isRTL?"right":"left":"top",this.isRTL&&this.isHorizontal&&(c*=-1);for(const t of this.slides)t.el?("top"===o?(t.el.style.right="",t.el.style.left=""):t.el.style.top="",t.index!==a?t.el.style[o]=0===r?"":`${r}px`:t.el.style[o]="",l+=t.dim+t.gap,a++):r+=t.dim+t.gap;if(this.isInfinite&&l)for(const n of this.slides)n.el&&(e(n.pos)e(i-t)&&(n.el.style[o]=`${r+l}px`),e(n.pos+n.gap)>=e(i-t)&&e(n.pos)>e(c+t)&&e(c)1&&(h=this.pages[u[0]],d=this.pages[u[1]]),h&&d){let t=0;for(const e of this.slides)e.el?this.inTransition.has(e.index)&&h.slides.indexOf(e)<0&&(e.el.style[o]=`${t+(h.pos-d.pos)}px`):t+=e.dim+e.gap}}createSlideEl(t){if(!this.track||!t)return;if(t.el)return;const e=document.createElement("div");E(e,this.cn("slide")),E(e,t.class),t.html&&(e.innerHTML=t.html);const i=[];this.slides.forEach(((t,e)=>{t.el&&i.push(e)}));const n=t.index;let s=null;if(i.length){let t=i.reduce(((t,e)=>Math.abs(e-n)this.page?1:-1,a=this.pages[s].pos*(this.isRTL?1:-1);if(this.page===s&&a===n.target[this.axis])return!1;this.clearTransitions();const r=n.isResting;E(this.container,this.cn("inTransition"));const l=this.pages[this.page].slides[0],c=this.pages[s].slides[0];this.inTransition.add(c.index),this.createSlideEl(c);let h=l.el,d=c.el;r||"slide"===e||(e="fadeFast",h=null);const u=this.isRTL?"next":"prev",p=this.isRTL?"prev":"next";return h&&(this.inTransition.add(l.index),l.transition=e,h.addEventListener("animationend",this.onAnimationEnd),h.classList.add(`f-${e}Out`,`to-${o>0?p:u}`)),d&&(c.transition=e,d.addEventListener("animationend",this.onAnimationEnd),d.classList.add(`f-${e}In`,`from-${o>0?u:p}`)),n.panTo({x:this.isHorizontal?a:0,y:this.isHorizontal?0:a,friction:0}),this.onChange(s),!0}manageSlideVisiblity(){const t=new Set,e=new Set,i=this.getVisibleSlides(parseFloat(this.option("preload",0)+"")||0);for(const n of this.slides)i.has(n)?t.add(n):e.add(n);for(const e of this.inTransition)t.add(this.slides[e]);for(const e of t)this.createSlideEl(e),this.lazyLoadSlide(e);for(const i of e)t.has(i)||this.removeSlideEl(i);this.markSelectedSlides(),this.repositionSlides()}markSelectedSlides(){if(!this.pages[this.page]||!this.pages[this.page].slides)return;const t="aria-hidden";let e=this.cn("isSelected");if(e)for(const i of this.slides)i.el&&(i.el.dataset.index=`${i.index}`,this.pages[this.page].slides.includes(i)?(i.el.classList.contains(e)||(E(i.el,e),this.emit("selectSlide",i)),i.el.removeAttribute(t)):(i.el.classList.contains(e)&&(S(i.el,e),this.emit("unselectSlide",i)),i.el.setAttribute(t,"true")))}flipInfiniteTrack(){const t=this.panzoom;if(!t||!this.isInfinite)return;const e="x"===this.option("axis")?"e":"f",{viewportDim:i,contentDim:n}=this;let s=t.current[e],o=t.target[e]-s,a=0,r=.5*i,l=n;this.isRTL&&this.isHorizontal?(s<-r&&(a=-1,s+=l),s>l-r&&(a=1,s-=l)):(s>r&&(a=1,s-=l),s<-l+r&&(a=-1,s+=l)),a&&(t.current[e]=s,t.target[e]=s+o)}lazyLoadSlide(t){const e=this,i=t&&t.el;if(!i)return;const s=new Set;i.querySelectorAll("[data-lazy-srcset]").forEach((t=>{t instanceof HTMLImageElement&&s.add(t)})),i.querySelectorAll("[data-lazy-src]").forEach((t=>{t instanceof HTMLImageElement?s.add(t):x(t)&&(t.style.backgroundImage=`url('${t.dataset.lazySrc||""}')`)}));const o=(t,i,n)=>{n&&(n.remove(),n=null),i.complete&&(i.style.display=""),this.option("adaptiveHeight")&&t.el&&this.pages[this.page].slides.indexOf(t)>-1&&e.setViewportHeight()};for(const e of s){let i=null;e.src=e.dataset.lazySrcset||e.dataset.lazySrc||"",delete e.dataset.lazySrc,delete e.dataset.lazySrcset,e.style.display="none",e.addEventListener("error",(()=>{o(t,e,i)})),e.addEventListener("load",(()=>{o(t,e,i)})),setTimeout((()=>{e.parentNode&&t.el&&(e.complete?o(t,e,i):(i=n(w),e.parentNode.insertBefore(i,e)))}),300)}let a=i.dataset.lazySrc;a&&a.length&&(i.style.backgroundImage=`url('${a}')`)}clearTransitions(){this.inTransition.clear(),S(this.container,this.cn("inTransition"));const t=["to-prev","to-next","from-prev","from-next"];for(const e of this.slides){const i=e.el;if(i){i.removeEventListener("animationend",this.onAnimationEnd),i.classList.remove(...t);const n=e.transition;n&&i.classList.remove(`f-${n}Out`,`f-${n}In`)}}this.manageSlideVisiblity()}onAnimationEnd(t){const e=t.target,i=e?parseInt(e.dataset.index||"",10)||0:-1,n=this.slides[i],s=t.animationName;if(!e||!n||!s)return;const o=!!this.inTransition.has(i)&&n.transition;o&&s.substring(0,o.length+2)===`f-${o}`&&this.inTransition.delete(i),this.inTransition.size||this.clearTransitions(),i===this.page&&this.emit("settle")}onDecel(t,e=0,i=0){const n=this.isInfinite,s=this.isHorizontal?e:i,o=this.pages.length;if(!o)return;const a=this.option("dragFree");let r=this.page,l=0;const c=this.axis;!n&&(t.target[c],this.viewportDim);const h=t.current[c]*(this.isRTL&&this.isHorizontal?1:-1);let{pageIndex:d}=this.getPageFromPosition(h);if(a||Math.abs(s)<10){const e=t.target[c]*(this.isRTL&&this.isHorizontal?1:-1),{pageIndex:i}=this.getPageFromPosition(e);r=i}else r=this.isRTL&&this.isHorizontal?s<0?d-1:d+1:s<0?d+1:d-1,n||(r=Math.max(0,Math.min(r,this.pages.length-1)));if(n&&(l=Math.floor(r/o)||0),r=(r%o+o)%o,a&&t.dragOffset["e"===c?"x":"y"]);else{const e=this.contentDim;let i=(this.pages[r].pos+l*e)*(this.isRTL&&this.isHorizontal?1:-1);if(Math.abs(t.target[c]-i)<.1&&t.lockedAxis===("e"==c?"y":"x"))return;if(t.target[c]===i)return;t.applyChange({panX:this.isHorizontal?i-t.target.e:0,panY:this.isHorizontal?0:i-t.target.f,friction:t.option("decelFriction")})}r!==this.page&&this.onChange(r)}onClick(t){const e=t.target,i=e&&x(e)?e.dataset:null;let n;i&&(void 0!==i.carouselPage?n="slideTo":void 0!==i.carouselNext?n="slideNext":void 0!==i.carouselPrev&&(n="slidePrev")),n?(t.preventDefault(),t.stopPropagation(),e&&!e.hasAttribute("disabled")&&this[n](i&&"slideTo"===n?i.carouselPage:void 0)):this.emit("click",t)}onSlideTo(t){const e=t.detail||0;this.slideTo(this.getPageForSlide(e),{friction:0})}onChange(t,e=0){const i=this.page;this.prevPage=i,this.page=t,this.option("adaptiveHeight")&&this.setViewportHeight(),this.emit("change",t,i,e)}onRefresh(t,e=""){let i=this.contentDim,n=this.viewportDim;this.updateMetrics(),this.contentDim===i&&this.viewportDim===n||this.slideTo(this.page,{friction:0,transition:!1})}onResize(){this.option("breakpoints")&&this.processOptions()}onBeforeTransform(){this.flipInfiniteTrack(),this.manageSlideVisiblity()}onEndAnimation(){this.emit("settle")}reInit(t=null,e=null){this.destroy(),this.state=k.Init,this.userOptions=t||this.userOptions,this.userPlugins=e||this.userPlugins,this.processOptions()}slideTo(t=0,{friction:e=this.option("friction"),transition:i=this.option("transition")}={}){if(this.state===k.Destroy)return;const n=this.panzoom,s=this.pages.length;if(!n||!s)return;if(this.transitionTo(t,i))return;const o=this.axis,a=this.getPageFromIndex(t);let r=this.pages[a].pos,l=0;if(this.isInfinite){const t=n.current[o]*(this.isRTL&&this.isHorizontal?1:-1),e=this.contentDim,i=r+e,s=r-e;Math.abs(t-i){t.el&&(s=Math.max(s,t.el.offsetHeight))}))),i.style.height=s?`${s}px`:""}getPageForSlide(t){for(const e of this.pages)for(const i of e.slides)if(i.index===t)return e.index;return-1}getVisibleSlides(t=0){var i;const n=new Set;let{contentDim:s,viewportDim:o,pages:a,page:r}=this;s=s+(null===(i=this.slides[this.slides.length-1])||void 0===i?void 0:i.gap)||0;let l=0;l=this.panzoom?-1*this.panzoom.current[this.axis]:a[r]&&a[r].pos||0,this.isInfinite&&(l-=Math.floor(l/s)*s),this.isRTL&&this.isHorizontal&&(l*=-1),l=e(l,1e3);const c=e(l-o*t,1e3),h=e(l+o*(t+1),1e3),d=this.isInfinite?[-1,0,1]:[0];for(const t of this.slides)for(const e of d){const i=t.pos+e*s,o=t.pos+t.dim+t.gap+e*s;ic&&n.add(t)}return n}getPageFromPosition(t){const{viewportDim:e,contentDim:i}=this,n=this.pages.length;let s=0,o=0;const a=this.option("center");a&&(t+=.5*e),this.isInfinite||(t=Math.max(this.slides[0].pos,Math.min(t,this.slides[this.slides.length-1].pos)));const r=i+this.slides[this.slides.length-1].gap,l=Math.floor(t/r)||0;t-=l*r;let c=this.slides[this.slides.length-1],h=this.slides.find((e=>{const i=t+(c&&!a?.5*c.dim:0);return c=e,e.pos<=i&&e.pos+e.dim+e.gap>i}));return h||(h=this.slides[this.slides.length-1]),o=this.getPageForSlide(h.index),s=o+l*n,{page:s,pageIndex:o}}destroy(){if([k.Destroy].includes(this.state))return;this.state=k.Destroy;const{container:t,viewport:e,track:i,slides:n,panzoom:s}=this,o=this.option("classes");t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),t.removeEventListener("slideTo",this.onSlideTo),window.removeEventListener("resize",this.onResize),s&&(s.destroy(),this.panzoom=null),n&&n.forEach((t=>{this.removeSlideEl(t)})),this.detachPlugins(),this.track=null,this.viewport=null,this.page=0,e&&i&&e.replaceWith(...i.childNodes);for(const[e,i]of Object.entries(o))"container"!==e&&i&&t.classList.remove(i);this.slides=[];const a=this.events.get("ready");this.events=new Map,a&&this.events.set("ready",a)}}Object.defineProperty(W,"Panzoom",{enumerable:!0,configurable:!0,writable:!0,value:A}),Object.defineProperty(W,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:R}),Object.defineProperty(W,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:N});const $=!("undefined"==typeof window||!window.document||!window.document.createElement);let X;const Y=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)","iframe","object","embed","video","audio","[contenteditable]",'[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","),q={dragToClose:!0,hideScrollbar:!0,Carousel:{classes:{container:"fancybox__carousel",viewport:"fancybox__viewport",track:"fancybox__track",slide:"fancybox__slide"}},contentClick:"toggleZoom",contentDblClick:!1,backdropClick:"close",animated:!0,idle:3500,showClass:"f-zoomInUp",hideClass:"f-fadeOut",commonCaption:!1,parentEl:null,startIndex:0,l10n:Object.assign(Object.assign({},v),{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}),tpl:{closeButton:'',main:''},groupAll:!1,groupAttr:"data-fancybox",defaultType:"image",defaultDisplay:"block",autoFocus:!0,trapFocus:!0,placeFocusBack:!0,closeButton:"auto",keyboard:{Escape:"close",Delete:"close",Backspace:"close",PageUp:"next",PageDown:"prev",ArrowUp:"next",ArrowDown:"prev",ArrowRight:"next",ArrowLeft:"prev"},Fullscreen:{autoStart:!1},compact:()=>window.matchMedia("(max-width: 578px), (max-height: 578px)").matches,wheel:"zoom"};var Z,V;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Closing=2]="Closing",t[t.CustomClosing=3]="CustomClosing",t[t.Destroy=4]="Destroy"}(Z||(Z={})),function(t){t[t.Loading=0]="Loading",t[t.Opening=1]="Opening",t[t.Ready=2]="Ready",t[t.Closing=3]="Closing"}(V||(V={}));const G=()=>{queueMicrotask((()=>{(()=>{const{slug:t,index:e}=U.parseURL(),i=xt.getInstance();if(i&&!1!==i.option("Hash")){const n=i.carousel;if(t&&n){for(let e of n.slides)if(e.slug&&e.slug===t)return n.slideTo(e.index);if(t===i.option("slug"))return n.slideTo(e-1);const s=i.getSlide(),o=s&&s.triggerEl&&s.triggerEl.dataset;if(o&&o.fancybox===t)return n.slideTo(e-1)}U.hasSilentClose=!0,i.close()}U.startFromUrl()})()}))};class U extends F{constructor(){super(...arguments),Object.defineProperty(this,"origHash",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null})}onChange(){const t=this.instance,e=t.carousel;this.timer&&clearTimeout(this.timer);const i=t.getSlide();if(!e||!i)return;const n=t.isOpeningSlide(i),s=new URL(document.URL).hash;let o,a=i.slug||void 0;o=a||this.instance.option("slug"),!o&&i.triggerEl&&i.triggerEl.dataset&&(o=i.triggerEl.dataset.fancybox);let r="";o&&"true"!==o&&(r="#"+o+(!a&&e.slides.length>1?"-"+(i.index+1):"")),n&&(this.origHash=s!==r?s:""),r&&s!==r&&(this.timer=setTimeout((()=>{try{window.history[n?"pushState":"replaceState"]({},document.title,window.location.pathname+window.location.search+r)}catch(t){}}),300))}onClose(){if(this.timer&&clearTimeout(this.timer),!0!==U.hasSilentClose)try{window.history.replaceState({},document.title,window.location.pathname+window.location.search+(this.origHash||""))}catch(t){}}attach(){this.instance.on("Carousel.ready",this.onChange),this.instance.on("Carousel.change",this.onChange),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.ready",this.onChange),this.instance.off("Carousel.change",this.onChange),this.instance.off("close",this.onClose)}static parseURL(){const t=window.location.hash.slice(1),e=t.split("-"),i=e[e.length-1],n=i&&/^\+?\d+$/.test(i)&&parseInt(e.pop()||"1",10)||1;return{hash:t,slug:e.join("-"),index:n}}static startFromUrl(){if(U.hasSilentClose=!1,xt.getInstance()||!1===xt.defaults.Hash)return;const{hash:t,slug:e,index:i}=U.parseURL();if(!e)return;let n=document.querySelector(`[data-slug="${t}"]`);if(n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})),xt.getInstance())return;const s=document.querySelectorAll(`[data-fancybox="${e}"]`);s.length&&(n=s[i-1],n&&n.dispatchEvent(new CustomEvent("click",{bubbles:!0,cancelable:!0})))}static destroy(){window.removeEventListener("hashchange",G,!1)}}function K(){window.addEventListener("hashchange",G,!1),setTimeout((()=>{U.startFromUrl()}),500)}Object.defineProperty(U,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(U,"hasSilentClose",{enumerable:!0,configurable:!0,writable:!0,value:!1}),$&&(/complete|interactive|loaded/.test(document.readyState)?K():document.addEventListener("DOMContentLoaded",K));const J=t=>new Promise(((e,i)=>{const n=new Image;n.onload=e,n.onerror=i,n.src=t}));class Q extends F{onCreateSlide(t,e,i){const n=this.instance,s=n.optionFor(i,"src")||"",{el:o,type:a}=i;o&&"image"===a&&"string"==typeof s&&this.setContent(i,s).then((t=>{if(n.isClosing())return;const e=i.contentEl,s=i.imageEl,o=i.thumbElSrc,a=this.optionFor(i,"initialSize"),r=this.optionFor(i,"zoom"),l={event:n.prevMouseMoveEvent||n.options.event,friction:r?.12:0};if(e&&s&&o&&n.isOpeningSlide(i)&&this.getZoomInfo(i)){let t=document.createElement("img");E(t,"fancybox-ghost"),e.appendChild(t),t.src=o,setTimeout((()=>{n.animate(t,"f-fadeFastOut",(()=>{t&&(t.remove(),t=null)}))}),333),J(o).then((()=>{i.state=V.Opening,this.instance.emit("reveal",i),this.zoomIn(i).then((()=>{this.instance.done(i)}),(()=>{n.hideLoading(i)}))}),(()=>{n.hideLoading(i),n.revealContent(i)}))}else{let e=n.optionFor(i,"showClass")||void 0,s=!0;n.isOpeningSlide(i)&&("full"===a?t.zoomToFull(l):"cover"===a?t.zoomToCover(l):"max"===a?t.zoomToMax(l):s=!1,t.stop("current")),s&&e&&(e="f-fadeIn"),n.revealContent(i,e)}}),(()=>{n.setError(i,"{{IMAGE_ERROR}}")}))}onRemoveSlide(t){t.panzoom&&t.panzoom.destroy(),t.panzoom=void 0,t.imageEl=void 0}onChange(t,e,i,n){for(const t of e.slides){const e=t.panzoom;e&&t.index!==i&&e.reset(0)}}onClose(){const t=this.instance,e=t.container,i=t.getSlide();if(!e||!e.parentElement||!i)return;const{el:n,contentEl:s,panzoom:o}=i,a=i.thumbElSrc;if(!n||!a||!s||!o||o.isContentLoading||o.state===g.Init||o.state===g.Destroy)return;o.updateMetrics();let r=this.getZoomInfo(i);if(!r)return;this.instance.state=Z.CustomClosing,n.classList.remove("is-zooming-in"),n.classList.add("is-zooming-out"),s.style.backgroundImage=`url('${a}')`,J(a).then((()=>{n.classList.add("hide-image")}),(()=>{}));const l=e.getBoundingClientRect();Object.assign(e.style,{position:"absolute",top:`${window.pageYOffset}px`,left:`${window.pageXOffset}px`,bottom:"auto",right:"auto",width:`${l.width}px`,height:`${l.height}px`});const{x:c,y:h,scale:d,opacity:u}=r;if(u){const t=((t,e,i,n)=>{const s=e-t,o=n-i;return e=>i+((e-t)/s*o||0)})(o.scale,d,1,0);o.on("afterTransform",(()=>{s.style.opacity=t(o.scale)+""}))}o.on("endAnimation",(()=>{t.destroy()})),o.target.a=d,o.target.b=0,o.target.c=0,o.target.d=d,o.panTo({x:c,y:h,scale:d,friction:u?.2:.33,ignoreBounds:!0}),o.isResting&&t.destroy()}setContent(t,e){return new Promise(((i,n)=>{var s,o;const a=this.instance,r=t.el;if(!r)return void n();a.showLoading(t);const l=document.createElement("img");if(l.classList.add("fancybox-image"),l.src=e||"",l.alt=(null===(s=t.caption)||void 0===s?void 0:s.replace(/<[^>]+>/gi,"").substring(0,1e3))||`Image ${t.index+1} of ${null===(o=a.carousel)||void 0===o?void 0:o.pages.length}`,t.imageEl=l,a.setContent(t,l,!1),this.option("protected")){r.addEventListener("contextmenu",(t=>{t.preventDefault()}));const e=t.contentEl;if(e){const t=document.createElement("div");E(t,"fancybox-protected"),e.append(t)}}t.panzoom=new A(r,u({},this.option("Panzoom")||{},{content:l,width:a.optionFor(t,"width","auto"),height:a.optionFor(t,"height","auto"),wheel:()=>{const t=a.option("wheel");return("zoom"===t||"pan"==t)&&t},click:(e,i)=>{var n;if(a.isCompact||a.isClosing())return!1;let s=!i||i.target&&(null===(n=t.contentEl)||void 0===n?void 0:n.contains(i.target));return a.option(s?"contentClick":"backdropClick")||!1},dblClick:()=>a.isCompact?"toggleZoom":a.option("contentDblClick")||!1,spinner:!1,panOnlyZoomed:!0,wheelLimit:1/0,transformParent:!0,on:{ready:t=>{i(t)},error:()=>{n()},destroy:()=>{n()}}}))}))}zoomIn(t){return new Promise(((e,i)=>{const{panzoom:n,contentEl:s,el:o}=t,a=this.getZoomInfo(t);if(!(a&&o&&s&&n))return void i();const{x:r,y:l,scale:c,opacity:h}=a,d=()=>{t.state!==V.Closing&&(h&&(s.style.opacity=Math.max(Math.min(1,1-(1-n.scale)/(1-c)),0)+""),n.scale>=1&&n.scale>n.targetScale-.1&&e(n))},u=t=>{t.scale<.99||(o.classList.remove("is-zooming-in"),t.off("endAnimation",u),t.off("touchStart",u),t.off("afterTransform",d),e(t))};n.on("endAnimation",u),n.on("touchStart",u),n.on("afterTransform",d),n.on(["error","destroy"],(()=>{i()})),n.panTo({x:r,y:l,scale:c,friction:0,ignoreBounds:!0}),n.stop("current");const p=this.instance,m={event:"mousemove"===n.panMode?p.prevMouseMoveEvent||p.options.event:void 0},f=this.optionFor(t,"initialSize");E(o,"is-zooming-in"),p.hideLoading(t),"full"===f?n.zoomToFull(m):"cover"===f?n.zoomToCover(m):"max"===f?n.zoomToMax(m):n.reset(.175)}))}getZoomInfo(t){const{el:e,imageEl:i,thumbEl:n,panzoom:s}=t;if(!e||!i||!n||!s||(t=>{const e=window.pageYOffset,i=window.pageYOffset+window.innerHeight;if(!x(t))return 0;const n=t.getBoundingClientRect(),s=n.y+window.pageYOffset,o=n.y+n.height+window.pageYOffset;if(e>o||io)return 100;if(si)return 100;let a=n.height;si&&(a-=o-i);const r=a/window.innerHeight*100;return Math.round(r)})(n)<5||!this.optionFor(t,"zoom")||this.instance.state===Z.Destroy)return!1;const{top:o,left:a,width:r,height:l}=n.getBoundingClientRect();let{top:c,left:h,fitWidth:d,fitHeight:u}=s.contentRect;if(!(r&&l&&d&&u))return!1;const p=r/d,m=s.container.getBoundingClientRect();c+=m.top,h+=m.left;const f=-1*(h+.5*d-(a+.5*r)),g=-1*(c+.5*u-(o+.5*l));let b=this.option("zoomOpacity")||!1;return"auto"===b&&(b=Math.abs(r/l-d/u)>.1),{x:f,y:g,scale:p,opacity:b}}attach(){this.instance.on("Carousel.change",this.onChange),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("close",this.onClose)}detach(){this.instance.off("Carousel.change",this.onChange),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("close",this.onClose)}}Object.defineProperty(Q,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{initialSize:"fit",Panzoom:{maxScale:1},protected:!1,zoom:!0,zoomOpacity:"auto"}});const tt=(t,e={})=>{const i=new URL(t),n=new URLSearchParams(i.search),s=new URLSearchParams;for(const[t,i]of[...n,...Object.entries(e)]){let e=i.toString();"t"===t?s.set("start",parseInt(e).toString()):s.set(t,e)}let o=s.toString(),a=t.match(/#t=((.*)?\d+s)/);return a&&(o+=`#t=${a[1]}`),o},et={ajax:null,autoSize:!0,preload:!0,videoAutoplay:!0,videoRatio:16/9,videoTpl:'',videoFormat:"",vimeo:{byline:1,color:"00adef",controls:1,dnt:1,muted:0},youtube:{controls:1,enablejsapi:1,rel:0,fs:1}},it=["image","html","ajax","inline","clone","iframe","map","pdf","html5video","youtube","vimeo","video"];class nt extends F{onInitSlides(t,e){for(const t of e.slides)this.processType(t)}onCreateSlide(t,e,i){this.setContent(i)}onRemoveSlide(t,e,i){i.closeBtnEl&&(i.closeBtnEl.remove(),i.closeBtnEl=void 0),i.xhr&&(i.xhr.abort(),i.xhr=null),i.iframeEl&&(i.iframeEl.onload=i.iframeEl.onerror=null,i.iframeEl.src="//about:blank",i.iframeEl=null);const n=i.contentEl,s=i.placeholderEl;if("inline"===i.type&&n&&s)n.classList.remove("fancybox__content"),"none"!==n.style.display&&(n.style.display="none"),s.parentNode&&s.parentNode.insertBefore(n,s),s.remove(),i.placeholderEl=null;else for(;i.el&&i.el.firstChild;)i.el.removeChild(i.el.firstChild)}onSelectSlide(t,e,i){i.state===V.Ready&&this.playVideo()}onUnselectSlide(t,e,i){var n,s;if("html5video"===i.type){try{null===(s=null===(n=i.el)||void 0===n?void 0:n.querySelector("video"))||void 0===s||s.pause()}catch(t){}return}let o;"vimeo"===i.type?o={method:"pause",value:"true"}:"youtube"===i.type&&(o={event:"command",func:"pauseVideo"}),o&&i.iframeEl&&i.iframeEl.contentWindow&&i.iframeEl.contentWindow.postMessage(JSON.stringify(o),"*"),i.poller&&clearTimeout(i.poller)}onDone(t,e){t.isCurrentSlide(e)&&!t.isClosing()&&this.playVideo()}onRefresh(t,e){e.slides.forEach((t=>{t.el&&(this.setAspectRatio(t),this.resizeIframe(t))}))}onMessage(t){try{let e=JSON.parse(t.data);if("https://player.vimeo.com"===t.origin){if("ready"===e.event)for(let e of Array.from(document.getElementsByClassName("fancybox__iframe")))e instanceof HTMLIFrameElement&&e.contentWindow===t.source&&(e.dataset.ready="true")}else if("https://www.youtube-nocookie.com"===t.origin&&"onReady"===e.event){const t=document.getElementById(e.id);t&&(t.dataset.ready="true")}}catch(t){}}loadAjaxContent(t){const e=this.instance.optionFor(t,"src")||"";this.instance.showLoading(t);const i=this.instance,n=new XMLHttpRequest;i.showLoading(t),n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&i.state===Z.Ready&&(i.hideLoading(t),200===n.status?i.setContent(t,n.responseText):i.setError(t,404===n.status?"{{AJAX_NOT_FOUND}}":"{{AJAX_FORBIDDEN}}"))};const s=t.ajax||null;n.open(s?"POST":"GET",e+""),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.send(s),t.xhr=n}setInlineContent(t){let e=null;if(x(t.src))e=t.src;else if("string"==typeof t.src){const i=t.src.split("#",2).pop();e=i?document.getElementById(i):null}if(e){if("clone"===t.type||e.dataset.placeholderId){e=e.cloneNode(!0);const i=e.dataset.animationName;i&&(e.classList.remove(i),delete e.dataset.animationName),delete e.dataset.placeholderId;let n=e.getAttribute("id");n=n?`${n}--clone`:`clone-${this.instance.id}-${t.index}`,e.setAttribute("id",n)}else if(e.parentNode){const i=document.createElement("div");i.classList.add("fancybox-placeholder"),e.parentNode.insertBefore(i,e),t.placeholderEl=i}this.instance.setContent(t,e)}else this.instance.setError(t,"{{ELEMENT_NOT_FOUND}}")}setIframeContent(t){const{src:e,el:i}=t;if(!e||"string"!=typeof e||!i)return;const n=this.instance,s=document.createElement("iframe");s.className="fancybox__iframe",s.setAttribute("id",`fancybox__iframe_${n.id}_${t.index}`),s.setAttribute("allow","autoplay; fullscreen"),s.setAttribute("scrolling","auto"),s.onerror=()=>{n.setError(t,"{{IFRAME_ERROR}}")},t.iframeEl=s;const o=this.optionFor(t,"preload");if(i.classList.add("is-loading"),"iframe"!==t.type||!1===o)return s.setAttribute("src",t.src+""),this.resizeIframe(t),void n.setContent(t,s);n.showLoading(t),s.onload=()=>{if(!s.src.length)return;const e="true"!==s.dataset.ready;s.dataset.ready="true",this.resizeIframe(t),e?n.revealContent(t):n.hideLoading(t)},s.setAttribute("src",e),n.setContent(t,s,!1)}resizeIframe(t){const e=t.iframeEl,i=null==e?void 0:e.parentElement;if(!e||!i)return;let n=t.autoSize,s=t.width||0,o=t.height||0;s&&o&&(n=!1);const a=i&&i.style;if(!1!==t.preload&&!1!==n&&a)try{const t=window.getComputedStyle(i),n=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight),r=parseFloat(t.paddingTop)+parseFloat(t.paddingBottom),l=e.contentWindow;if(l){const t=l.document,e=t.getElementsByTagName("html")[0],i=t.body;a.width="",i.style.overflow="hidden",s=s||e.scrollWidth+n,a.width=`${s}px`,i.style.overflow="",a.flex="0 0 auto",a.height=`${i.scrollHeight}px`,o=e.scrollHeight+r}}catch(t){}if(s||o){const t={flex:"0 1 auto",width:"",height:""};s&&(t.width=`${s}px`),o&&(t.height=`${o}px`),Object.assign(a,t)}}playVideo(){const t=this.instance.getSlide();if(!t)return;const{el:e}=t;if(!e||!e.offsetParent)return;if(!this.optionFor(t,"videoAutoplay"))return;if("html5video"===t.type)try{const t=e.querySelector("video");if(t){const e=t.play();void 0!==e&&e.then((()=>{})).catch((e=>{t.muted=!0,t.play()}))}}catch(t){}if("youtube"!==t.type&&"vimeo"!==t.type)return;const i=()=>{if(t.iframeEl&&t.iframeEl.contentWindow){let e;if("true"===t.iframeEl.dataset.ready)return e="youtube"===t.type?{event:"command",func:"playVideo"}:{method:"play",value:"true"},e&&t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"),void(t.poller=void 0);"youtube"===t.type&&(e={event:"listening",id:t.iframeEl.getAttribute("id")},t.iframeEl.contentWindow.postMessage(JSON.stringify(e),"*"))}t.poller=setTimeout(i,250)};i()}processType(t){if(t.html)return t.type="html",t.src=t.html,void(t.html="");const e=this.instance.optionFor(t,"src","");if(!e||"string"!=typeof e)return;let i=t.type,n=null;if(n=e.match(/(?:youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)){const s=tt(e,this.optionFor(t,"youtube")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://www.youtube-nocookie.com/embed/${o}?${s}`,t.thumbSrc=t.thumbSrc||`https://i.ytimg.com/vi/${o}/mqdefault.jpg`,i="youtube"}else if(n=e.match(/^.+vimeo.com\/(?:\/)?([\d]+)(.*)?/)){const s=tt(e,this.optionFor(t,"vimeo")),o=encodeURIComponent(n[1]);t.videoId=o,t.src=`https://player.vimeo.com/video/${o}?${s}`,i="vimeo"}if(!i&&t.triggerEl){const e=t.triggerEl.dataset.type;it.includes(e)&&(i=e)}i||"string"==typeof e&&("#"===e.charAt(0)?i="inline":(n=e.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))?(i="html5video",t.videoFormat=t.videoFormat||"video/"+("ogv"===n[1]?"ogg":n[1])):e.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)?i="image":e.match(/\.(pdf)((\?|#).*)?$/i)?i="pdf":(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i))?(t.src=`https://maps.google.${n[1]}/?ll=${(n[2]?n[2]+"&z="+Math.floor(parseFloat(n[3]))+(n[4]?n[4].replace(/^\//,"&"):""):n[4]+"").replace(/\?/,"&")}&output=${n[4]&&n[4].indexOf("layer=c")>0?"svembed":"embed"}`,i="map"):(n=e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i))&&(t.src=`https://maps.google.${n[1]}/maps?q=${n[2].replace("query=","q=").replace("api=1","")}&output=embed`,i="map")),t.type=i||this.instance.option("defaultType")}setContent(t){const e=this.instance.optionFor(t,"src")||"";if(t&&t.type&&e){switch(t.type){case"html":this.instance.setContent(t,e);break;case"html5video":const i=this.option("videoTpl");i&&this.instance.setContent(t,i.replace(/\{\{src\}\}/gi,e+"").replace(/\{\{format\}\}/gi,this.optionFor(t,"videoFormat")||"").replace(/\{\{poster\}\}/gi,t.poster||t.thumbSrc||""));break;case"inline":case"clone":this.setInlineContent(t);break;case"ajax":this.loadAjaxContent(t);break;case"pdf":case"map":case"youtube":case"vimeo":t.preload=!1;case"iframe":this.setIframeContent(t)}this.setAspectRatio(t)}}setAspectRatio(t){var e;const i=t.contentEl,n=this.optionFor(t,"videoRatio"),s=null===(e=t.el)||void 0===e?void 0:e.getBoundingClientRect();if(!(i&&s&&n&&1!==n&&t.type&&["video","youtube","vimeo","html5video"].includes(t.type)))return;const o=s.width,a=s.height;i.style.aspectRatio=n+"",i.style.width=o/a>n?"auto":"",i.style.height=o/a>n?"":"auto"}attach(){this.instance.on("Carousel.initSlides",this.onInitSlides),this.instance.on("Carousel.createSlide",this.onCreateSlide),this.instance.on("Carousel.removeSlide",this.onRemoveSlide),this.instance.on("Carousel.selectSlide",this.onSelectSlide),this.instance.on("Carousel.unselectSlide",this.onUnselectSlide),this.instance.on("Carousel.Panzoom.refresh",this.onRefresh),this.instance.on("done",this.onDone),window.addEventListener("message",this.onMessage)}detach(){this.instance.off("Carousel.initSlides",this.onInitSlides),this.instance.off("Carousel.createSlide",this.onCreateSlide),this.instance.off("Carousel.removeSlide",this.onRemoveSlide),this.instance.off("Carousel.selectSlide",this.onSelectSlide),this.instance.off("Carousel.unselectSlide",this.onUnselectSlide),this.instance.off("Carousel.Panzoom.refresh",this.onRefresh),this.instance.off("done",this.onDone),window.removeEventListener("message",this.onMessage)}}Object.defineProperty(nt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:et});class st extends F{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:"ready"}),Object.defineProperty(this,"inHover",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"progressBar",{enumerable:!0,configurable:!0,writable:!0,value:null})}get isActive(){return"ready"!==this.state}onReady(t){this.option("autoStart")&&(t.isInfinite||t.page{this.timer=null,this.inHover||this.onTimerEnd()}),e),t.style.transitionDuration=`${e}ms`,t.style.transform="scaleX(1)"}this.emit("set")}clear(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.removeProgressBar()}start(){if(this.set(),this.option("pauseOnHover")){const t=this.instance.container;t.addEventListener("mouseenter",this.onMouseEnter,!1),t.addEventListener("mouseleave",this.onMouseLeave,!1)}document.addEventListener("visibilitychange",this.onVisibilityChange,!1)}stop(){const t=this.instance.container;this.clear(),this.state="ready",t.removeEventListener("mouseenter",this.onMouseEnter,!1),t.removeEventListener("mouseleave",this.onMouseLeave,!1),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),S(t,"has-autoplay"),this.emit("stop")}pause(){"play"===this.state&&(this.state="pause",this.clear(),this.emit("pause"))}resume(){const t=this.instance;if(t.isInfinite||t.page!==t.pages.length-1)if("play"!==this.state){if("pause"===this.state&&!this.inHover){const t=new Event("resume",{bubbles:!0,cancelable:!0});this.emit("resume",event),t.defaultPrevented||this.set()}}else this.set();else this.stop()}toggle(){"play"===this.state||"pause"===this.state?this.stop():this.set()}attach(){this.instance.on("ready",this.onReady),this.instance.on("Panzoom.startAnimation",this.onChange),this.instance.on("Panzoom.endAnimation",this.onSettle),this.instance.on("Panzoom.touchMove",this.onChange)}detach(){this.instance.off("ready",this.onReady),this.instance.off("Panzoom.startAnimation",this.onChange),this.instance.off("Panzoom.endAnimation",this.onSettle),this.instance.off("Panzoom.touchMove",this.onChange),this.stop()}}Object.defineProperty(st,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{autoStart:!0,pauseOnHover:!0,progressParentEl:null,showProgress:!0,timeout:3e3}});class ot extends F{constructor(){super(...arguments),Object.defineProperty(this,"ref",{enumerable:!0,configurable:!0,writable:!0,value:null})}onPrepare(t){const e=t.carousel;if(!e)return;const i=t.container;i&&(e.options.Autoplay=u(this.option("Autoplay")||{},{pauseOnHover:!1,autoStart:!1,timeout:this.option("timeout"),progressParentEl:()=>i.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]")||i,on:{set:e=>{var n;i.classList.add("has-slideshow"),(null===(n=t.getSlide())||void 0===n?void 0:n.state)!==V.Ready&&e.pause()},stop:()=>{i.classList.remove("has-slideshow"),t.isCompact||t.endIdle()},resume:(e,i)=>{var n,s,o;!i||!i.cancelable||(null===(n=t.getSlide())||void 0===n?void 0:n.state)===V.Ready&&(null===(o=null===(s=t.carousel)||void 0===s?void 0:s.panzoom)||void 0===o?void 0:o.isResting)||i.preventDefault()}}}),e.attachPlugins({Autoplay:st}),this.ref=e.plugins.Autoplay)}onReady(t){const e=t.carousel,i=this.ref;e&&i&&this.option("playOnStart")&&(e.isInfinite||e.page{t.isCurrentSlide(e)&&i.stop()})),t.isCurrentSlide(e)&&i.resume()}onKeydown(t,e){var i;const n=this.ref;n&&e===this.option("key")&&"BUTTON"!==(null===(i=document.activeElement)||void 0===i?void 0:i.nodeName)&&n.toggle()}attach(){this.instance.on("Carousel.init",this.onPrepare),this.instance.on("Carousel.ready",this.onReady),this.instance.on("done",this.onDone),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onPrepare),this.instance.off("Carousel.ready",this.onReady),this.instance.off("done",this.onDone),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(ot,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{key:" ",playOnStart:!1,timeout:3e3}});const at={classes:{container:"f-thumbs f-carousel__thumbs",viewport:"f-thumbs__viewport",track:"f-thumbs__track",slide:"f-thumbs__slide",isResting:"is-resting",isSelected:"is-selected",isLoading:"is-loading",hasThumbs:"has-thumbs"},minCount:2,parentEl:null,thumbTpl:'',type:"modern"};var rt;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Hidden=2]="Hidden",t[t.Disabled=3]="Disabled"}(rt||(rt={}));let lt=class extends F{constructor(){super(...arguments),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:"modern"}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"track",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"panzoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"thumbWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbClipWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"thumbExtraGap",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"shouldCenter",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:rt.Init})}formatThumb(t,e){return this.instance.localize(e,[["%i",t.index],["%d",t.index+1],["%s",t.thumbSrc||"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"]])}getSlides(){const t=[],e=this.option("thumbTpl")||"";if(e)for(const i of this.instance.slides||[])t.push({html:this.formatThumb(i,e),customClass:`has-thumb for-${i.type||"image"}`});return t}getProgress(t){const e=this.instance,i=e.panzoom,n=e.pages[t]||0;if(!n||!i)return 0;let s=-1*i.current.e,o=e.contentDim,a=(s-n.pos)/(1*n.dim),r=(s+o-n.pos)/(1*n.dim),l=(s-o-n.pos)/(1*n.dim);return a=Math.max(0,Math.min(1,Math.abs(a))),r=Math.max(0,Math.min(1,Math.abs(r))),l=Math.max(0,Math.min(1,Math.abs(l))),a=Math.min(a,r,l),a}onInitSlide(t,e){const i=e.el;i&&(e.thumbSrc=i.dataset.thumbSrc||e.thumbSrc||"",e.thumbClipWidth=parseFloat(i.dataset.thumbClipWidth||"")||e.thumbClipWidth||0,e.thumbHeight=parseFloat(i.dataset.thumbHeight||"")||e.thumbHeight||0)}onInitSlides(){this.state===rt.Init&&this.build()}onRefreshM(){this.refreshModern()}onChangeM(){"modern"===this.type&&(this.shouldCenter=!0,this.centerModern())}onClickModern(t){t.preventDefault(),t.stopPropagation();const e=this.instance,i=e.page,n=t=>{if(t){const e=t.closest("[data-carousel-page]");if(e)return parseInt(e.dataset.carouselPage||"",10)||0}return-1},s=(t,e)=>{const i=document.elementFromPoint(t,e);return i?n(i):-1};let o=n(t.target);o<0&&(o=s(t.clientX+this.thumbGap,t.clientY),o===i&&(o=i-1)),o<0&&(o=s(t.clientX-this.thumbGap,t.clientY),o===i&&(o=i+1)),o<0&&(o=(e=>{let n=s(t.clientX-e,t.clientY),a=s(t.clientX+e,t.clientY);return o<0&&n===i&&(o=i+1),o<0&&a===i&&(o=i-1),o})(this.thumbExtraGap)),o===i?this.centerModern():o>-1&&o{this.emit("ready")}))}buildModern(){if("modern"!==this.type)return;const{container:t,track:e,instance:i}=this,s=this.option("thumbTpl")||"";if(!t||!e||!s)return;this.updateModern();for(const t of i.slides||[]){const i=document.createElement("div");E(i,this.cn("slide")),i.appendChild(n(this.formatThumb(t,s))),t.thumbSlideEl=i,e.appendChild(i),this.resizeModernSlide(t)}const o=new i.constructor.Panzoom(t,{content:e,lockAxis:"x",zoom:!1,panOnlyZoomed:!1,bounds:()=>{let t=0,e=0,n=i.slides[0],s=i.slides[i.slides.length-1],o=i.slides[i.page];return n&&s&&o&&(e=-1*this.getModernThumbPos(0),0!==i.page&&(e+=.5*(n.thumbWidth||0)),t=-1*this.getModernThumbPos(i.slides.length-1),i.page!==i.slides.length-1&&(t+=(s.thumbWidth||0)-(o.thumbWidth||0)-.5*(s.thumbWidth||0))),{x:{min:t,max:e},y:{min:0,max:0}}}});o.on("touchStart",(()=>{this.shouldCenter=!1})),o.on("click",((t,e)=>this.onClickModern(e))),o.on("ready",(()=>{this.centerModern(),this.emit("ready")})),o.on(["afterTransform","refresh"],(t=>{this.lazyLoadModern()})),this.panzoom=o,this.refreshModern()}updateModern(){if("modern"!==this.type)return;const{container:t}=this;t&&(this.thumbGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-gap"))||0,this.thumbExtraGap=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-extra-gap"))||0,this.thumbWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-width"))||40,this.thumbClipWidth=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-clip-width"))||40,this.thumbHeight=parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-height"))||40)}refreshModern(){var t;if("modern"===this.type){this.updateModern();for(const t of this.instance.slides||[])this.resizeModernSlide(t);this.onTransformM(),null===(t=this.panzoom)||void 0===t||t.updateMetrics(!0),this.centerModern(0)}}centerModern(t){const i=this.instance,{container:n,panzoom:s}=this;if(!n||!s||s.state===g.Init)return;const o=i.page;let a=this.getModernThumbPos(o),r=a;for(let t=i.page-3;ti.pages.length-1||t===i.page)continue;const e=1-this.getProgress(t);e>0&&e<1&&(r+=e*(this.getModernThumbPos(t)-a))}let l=100;void 0===t&&(t=.2,i.inTransition.size>0&&(t=.12),Math.abs(-1*s.current.e-r)>s.containerRect.width&&(t=.5,l=0)),s.options.maxVelocity=l,s.applyChange({panX:e(-1*r-s.target.e,1e3),friction:null===i.prevPage?0:t})}lazyLoadModern(){const{instance:t,panzoom:e}=this;if(!e)return;const i=-1*e.current.e||0;let s=this.getModernThumbPos(t.page);if(e.state!==g.Init||0===s)for(const s of t.slides||[]){const t=s.thumbSlideEl;if(!t)continue;const o=t.querySelector("img[data-lazy-src]"),a=s.index,r=this.getModernThumbPos(a),l=i-.5*e.containerRect.innerWidth,c=l+e.containerRect.innerWidth;if(!o||rc)continue;let h=o.dataset.lazySrc;if(!h||!h.length)continue;if(delete o.dataset.lazySrc,o.src=h,o.complete)continue;E(t,this.cn("isLoading"));const d=n(w);t.appendChild(d),o.addEventListener("load",(()=>{t.offsetParent&&(t.classList.remove(this.cn("isLoading")),d.remove())}),!1)}}resizeModernSlide(t){if("modern"!==this.type)return;if(!t.thumbSlideEl)return;const e=t.thumbClipWidth&&t.thumbHeight?Math.round(this.thumbHeight*(t.thumbClipWidth/t.thumbHeight)):this.thumbWidth;t.thumbWidth=e}getModernThumbPos(t){const i=this.instance.slides[t],n=this.panzoom;if(!n||!n.contentRect.fitWidth)return 0;let s=n.containerRect.innerWidth,o=n.contentRect.width;2===this.instance.slides.length&&(t-=1,o=2*this.thumbClipWidth);let a=t*(this.thumbClipWidth+this.thumbGap)+this.thumbExtraGap+.5*(i.thumbWidth||0);return a-=o>s?.5*s:.5*o,e(a||0,1)}build(){const t=this.instance,e=t.container,i=this.option("minCount")||0;if(i){let e=0;for(const i of t.slides||[])i.thumbSrc&&e++;if(e{e.stopPropagation()}}},on:{ready:t=>{const e=t.container;e&&this.hidden&&(this.refresh(),e.style.transition="none",this.hide(),e.offsetHeight,queueMicrotask((()=>{e.style.transition="",this.show()})))}}}),e.attachPlugins({Thumbs:lt}),this.ref=e.plugins.Thumbs,this.option("showOnStart")||(this.ref.state=rt.Hidden,this.hidden=!0))}onResize(){var t;const e=null===(t=this.ref)||void 0===t?void 0:t.container;e&&(e.style.maxHeight="")}onKeydown(t,e){const i=this.option("key");i&&i===e&&this.toggle()}toggle(){const t=this.ref;t&&t.state!==rt.Disabled&&(t.state!==rt.Hidden?this.hidden?this.show():this.hide():t.build())}show(){const t=this.ref,e=t&&t.state!==rt.Disabled&&t.container;e&&(this.refresh(),e.offsetHeight,e.removeAttribute("aria-hidden"),e.classList.remove("is-hidden"),this.hidden=!1)}hide(){const t=this.ref,e=t&&t.container;e&&(this.refresh(),e.offsetHeight,e.classList.add("is-hidden"),e.setAttribute("aria-hidden","true")),this.hidden=!0}refresh(){const t=this.ref;if(!t||t.state===rt.Disabled)return;const e=t.container,i=(null==e?void 0:e.firstChild)||null;e&&i&&i.childNodes.length&&(e.style.maxHeight=`${i.getBoundingClientRect().height}px`)}attach(){this.instance.on("Carousel.init",this.onInit),this.instance.on("resize",this.onResize),this.instance.on("keydown",this.onKeydown)}detach(){this.instance.off("Carousel.init",this.onInit),this.instance.off("resize",this.onResize),this.instance.off("keydown",this.onKeydown)}}Object.defineProperty(ht,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:ct});const dt={panLeft:{icon:'',change:{panX:-100}},panRight:{icon:'',change:{panX:100}},panUp:{icon:'',change:{panY:-100}},panDown:{icon:'',change:{panY:100}},zoomIn:{icon:'',action:"zoomIn"},zoomOut:{icon:'',action:"zoomOut"},toggle1to1:{icon:'',action:"toggleZoom"},toggleZoom:{icon:'',action:"toggleZoom"},iterateZoom:{icon:'',action:"iterateZoom"},rotateCCW:{icon:'',action:"rotateCCW"},rotateCW:{icon:'',action:"rotateCW"},flipX:{icon:'',action:"flipX"},flipY:{icon:'',action:"flipY"},fitX:{icon:'',action:"fitX"},fitY:{icon:'',action:"fitY"},reset:{icon:'',action:"reset"},toggleFS:{icon:'',action:"toggleFS"}};var ut;!function(t){t[t.Init=0]="Init",t[t.Ready=1]="Ready",t[t.Disabled=2]="Disabled"}(ut||(ut={}));const pt={absolute:"auto",display:{left:["infobar"],middle:[],right:["iterateZoom","slideshow","fullscreen","thumbs","close"]},enabled:"auto",items:{infobar:{tpl:'
/
'},download:{tpl:''},prev:{tpl:''},next:{tpl:''},slideshow:{tpl:''},fullscreen:{tpl:''},thumbs:{tpl:''},close:{tpl:''}},parentEl:null},mt={tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"};class ft extends F{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:ut.Init}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}onReady(t){var e;if(!t.carousel)return;let i=this.option("display"),n=this.option("absolute"),s=this.option("enabled");if("auto"===s){const t=this.instance.carousel;let e=0;if(t)for(const i of t.slides)(i.panzoom||"image"===i.type)&&e++;e||(s=!1)}s||(i=void 0);let o=0;const a={left:[],middle:[],right:[]};if(i)for(const t of["left","middle","right"])for(const n of i[t]){const i=this.createEl(n);i&&(null===(e=a[t])||void 0===e||e.push(i),o++)}let r=null;if(o&&(r=this.createContainer()),r){for(const[t,e]of Object.entries(a)){const i=document.createElement("div");E(i,"fancybox__toolbar__column is-"+t);for(const t of e)i.appendChild(t);"auto"!==n||"middle"!==t||e.length||(n=!0),r.appendChild(i)}!0===n&&E(r,"is-absolute"),this.state=ut.Ready,this.onRefresh()}else this.state=ut.Disabled}onClick(t){var e,i;const n=this.instance,s=n.getSlide(),o=null==s?void 0:s.panzoom,a=t.target,r=a&&x(a)?a.dataset:null;if(!r)return;if(void 0!==r.fancyboxToggleThumbs)return t.preventDefault(),t.stopPropagation(),void(null===(e=n.plugins.Thumbs)||void 0===e||e.toggle());if(void 0!==r.fancyboxToggleFullscreen)return t.preventDefault(),t.stopPropagation(),void this.instance.toggleFullscreen();if(void 0!==r.fancyboxToggleSlideshow){t.preventDefault(),t.stopPropagation();const e=null===(i=n.carousel)||void 0===i?void 0:i.plugins.Autoplay;let s=e.isActive;return o&&"mousemove"===o.panMode&&!s&&o.reset(),void(s?e.stop():e.start())}const l=r.panzoomAction,c=r.panzoomChange;if((c||l)&&(t.preventDefault(),t.stopPropagation()),c){let t={};try{t=JSON.parse(c)}catch(t){}o&&o.applyChange(t)}else l&&o&&o[l]&&o[l]()}onChange(){this.onRefresh()}onRefresh(){if(this.instance.isClosing())return;const t=this.container;if(!t)return;const e=this.instance.getSlide();if(!e||e.state!==V.Ready)return;const i=e&&!e.error&&e.panzoom;for(const e of t.querySelectorAll("[data-panzoom-action]"))i?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));let n=i&&i.canZoomIn(),s=i&&i.canZoomOut();for(const e of t.querySelectorAll('[data-panzoom-action="zoomIn"]'))n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="zoomOut"]'))s?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));for(const e of t.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){s||n?(e.removeAttribute("disabled"),e.removeAttribute("tabindex")):(e.setAttribute("disabled",""),e.setAttribute("tabindex","-1"));const t=e.querySelector("g");t&&(t.style.display=n?"":"none")}}onDone(t,e){var i;null===(i=e.panzoom)||void 0===i||i.on("afterTransform",(()=>{this.instance.isCurrentSlide(e)&&this.onRefresh()})),this.instance.isCurrentSlide(e)&&this.onRefresh()}createContainer(){const t=this.instance.container;if(!t)return null;const e=this.option("parentEl")||t,i=document.createElement("div");return E(i,"fancybox__toolbar"),e.prepend(i),i.addEventListener("click",this.onClick,{passive:!1,capture:!0}),t&&E(t,"has-toolbar"),this.container=i,i}createEl(t){var e;const i=this.instance.carousel;if(!i)return null;if("toggleFS"===t)return null;if("fullscreen"===t&&!this.instance.fsAPI)return null;let s=null;const o=i.slides.length||0;let a=0,r=0;for(const t of i.slides)(t.panzoom||"image"===t.type)&&a++,("image"===t.type||t.downloadSrc)&&r++;if(o<2&&["infobar","prev","next"].includes(t))return s;if(void 0!==dt[t]&&!a)return null;if("download"===t&&!r)return null;if("thumbs"===t){const t=this.instance.plugins.Thumbs;if(!t||!t.isEnabled)return null}if("slideshow"===t){if(!(null===(e=this.instance.carousel)||void 0===e?void 0:e.plugins.Autoplay)||o<2)return null}if(void 0!==dt[t]){const e=dt[t];s=document.createElement("button"),s.setAttribute("title",this.instance.localize(`{{${t.toUpperCase()}}}`)),E(s,"f-button"),e.action&&(s.dataset.panzoomAction=e.action),e.change&&(s.dataset.panzoomChange=JSON.stringify(e.change)),s.appendChild(n(this.instance.localize(e.icon)))}else{const e=(this.option("items")||[])[t];e&&(s=n(this.instance.localize(e.tpl)),e.click&&s.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),"function"==typeof e.click&&e.click(t)})))}const l=null==s?void 0:s.querySelector("svg");if(l)for(const[t,e]of Object.entries(mt))l.getAttribute(t)||l.setAttribute(t,String(e));return s}removeContainer(){var t;const e=this.container;e&&e.removeEventListener("click",this.onClick,{passive:!1,capture:!0}),null===(t=this.container)||void 0===t||t.remove(),this.container=null,this.state=ut.Disabled;const i=this.instance.container;i&&S(i,"has-toolbar")}attach(){this.instance.on("Carousel.initSlides",this.onReady),this.instance.on("done",this.onDone),this.instance.on("reveal",this.onChange),this.instance.on("Carousel.change",this.onChange),this.onReady(this.instance)}detach(){this.instance.off("Carousel.initSlides",this.onReady),this.instance.off("done",this.onDone),this.instance.off("reveal",this.onChange),this.instance.off("Carousel.change",this.onChange),this.removeContainer()}}Object.defineProperty(ft,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:pt});const gt={Hash:U,Html:nt,Images:Q,Slideshow:ot,Thumbs:ht,Toolbar:ft};let bt=null,vt=null;const yt=new Map;let wt=0;class xt extends f{get isIdle(){return this.idle}get isCompact(){return this.option("compact")}constructor(t=[],e={},i={}){super(e),Object.defineProperty(this,"userSlides",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"userPlugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"idle",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"idleTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"ignoreFocusChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:Z.Init}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"footer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"caption",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"carousel",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"lastFocus",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fsAPI",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.onWheel=L(this.onWheel.bind(this),300),this.fsAPI=(()=>{let t,e="",i="",n="";return document.fullscreenEnabled?(e="requestFullscreen",i="exitFullscreen",n="fullscreenElement"):document.webkitFullscreenEnabled&&(e="webkitRequestFullscreen",i="webkitExitFullscreen",n="webkitFullscreenElement"),e&&(t={request:function(t){return"webkitRequestFullscreen"===e?t[e](Element.ALLOW_KEYBOARD_INPUT):t[e]()},exit:function(){return document[n]&&document[i]()},isFullscreen:function(){return document[n]}}),t})(),this.id=e.id||++wt,yt.set(this.id,this),this.userSlides=t,this.userPlugins=i,queueMicrotask((()=>{this.init()}))}init(){this.state=Z.Init,this.attachPlugins(Object.assign(Object.assign({},xt.Plugins),this.userPlugins)),this.emit("init"),!0===this.option("hideScrollbar")&&(()=>{if(!$)return;if(document.body.classList.contains("compensate-for-scrollbar"))return;const t=window.innerWidth-document.documentElement.getBoundingClientRect().width;document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",`${t}px`),t&&document.body.classList.add("compensate-for-scrollbar")})(),this.initLayout();const t=()=>{this.initCarousel(this.userSlides),this.state=Z.Ready,this.attachEvents(),this.emit("ready"),setTimeout((()=>{this.container&&this.container.setAttribute("aria-hidden","false")}),16)};this.option("Fullscreen.autoStart")&&this.fsAPI&&!this.fsAPI.isFullscreen()?this.fsAPI.request(this.container).then((()=>t())).catch((()=>t())):t()}initLayout(){const t=this.option("parentEl")||document.body,e=n(this.localize(this.option("tpl.main")||""));e&&(e.setAttribute("id",`fancybox-${this.id}`),e.setAttribute("aria-label",this.localize("{{MODAL}}")),e.classList.toggle("is-compact",this.isCompact),this.container=e,this.footer=e.querySelector(".fancybox__footer"),t.appendChild(e),document.documentElement.classList.add("with-fancybox"),bt&&vt||(bt=document.createElement("button"),bt.classList.add("fancybox-focus-guard"),bt.setAttribute("aria-hidden","true"),bt.setAttribute("aria-label","Focus guard"),bt.setAttribute("type","button"),vt=bt.cloneNode(),document.body.prepend(bt),document.body.append(vt)),this.option("animated")&&(e.classList.add("is-animated"),setTimeout((()=>{this.isClosing()||e.classList.remove("is-animated")}),350)),this.emit("initLayout"))}initCarousel(t){const e=this.container;if(!e)return;const i=e.querySelector(".fancybox__carousel");if(!i)return;const n=this.carousel=new W(i,u({},{slides:t,transition:"fade",Panzoom:{lockAxis:this.option("dragToClose")?"xy":"x",infinite:!!this.option("dragToClose")&&"y"},Dots:!1,Navigation:{classes:{container:"fancybox__nav",button:"f-button",isNext:"is-next",isPrev:"is-prev"}},initialPage:this.option("startIndex"),l10n:this.option("l10n")},this.option("Carousel")||{}));n.on("*",((t,e,...i)=>{this.emit(`Carousel.${e}`,t,...i)})),n.on(["ready","change"],(()=>{this.manageCaption(this.getSlide())})),n.on("removeSlide",((t,e)=>{e.closeBtnEl&&e.closeBtnEl.remove(),e.closeBtnEl=void 0,e.captionEl&&e.captionEl.remove(),e.captionEl=void 0,e.spinnerEl&&e.spinnerEl.remove(),e.spinnerEl=void 0,e.state=void 0})),n.on("Panzoom.touchStart",(()=>{this.isCompact||this.endIdle()})),n.on("settle",(()=>{this.idleTimer||this.isCompact||!this.option("idle")||this.setIdle(),this.option("autoFocus")&&this.checkFocus()})),this.option("dragToClose")&&(n.on("Panzoom.afterTransform",((t,e)=>{const i=this.container;if(i){const t=Math.abs(e.current.f),n=t<1?"":Math.max(.5,Math.min(1,1-t/e.contentRect.fitHeight*1.5));i.style.setProperty("--fancybox-ts",n?"0s":""),i.style.setProperty("--fancybox-opacity",n+"")}})),n.on("Panzoom.touchEnd",((t,e,i)=>{const n=Math.abs(e.dragOffset.y);"y"===e.lockedAxis&&(n>=200||n>=50&&e.dragOffset.time<300)&&(i&&i.cancelable&&i.preventDefault(),this.close(i,"f-throwOut"+(e.current.f<0?"Up":"Down")))}))),n.on(["change"],(t=>{var e;let i=null===(e=this.getSlide())||void 0===e?void 0:e.triggerEl;if(i){const e=new CustomEvent("slideTo",{bubbles:!0,cancelable:!0,detail:t.page});i.dispatchEvent(e)}})),n.on(["refresh","change"],(t=>{const e=this.container;if(!e)return;for(const i of e.querySelectorAll("[data-fancybox-current-index]"))i.innerHTML=t.page+1;for(const i of e.querySelectorAll("[data-fancybox-count]"))i.innerHTML=t.pages.length;if(!t.isInfinite){for(const i of e.querySelectorAll("[data-fancybox-next]"))t.page0?(i.removeAttribute("disabled"),i.removeAttribute("tabindex")):(i.setAttribute("disabled",""),i.setAttribute("tabindex","-1"))}const i=this.getSlide();let n=(null==i?void 0:i.downloadSrc)||"";n||!i||"image"!==i.type||i.error||"string"!=typeof i.src||(n=i.src);for(const t of e.querySelectorAll("[data-fancybox-download]"))n?(t.removeAttribute("disabled"),t.removeAttribute("tabindex"),t.setAttribute("href",n),t.setAttribute("download",n),t.setAttribute("target","_blank")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"),t.removeAttribute("href"),t.removeAttribute("download"))})),this.emit("initCarousel")}attachEvents(){const t=this.container;t&&(document.addEventListener("keydown",this.onKeydown,{passive:!1,capture:!0}),t.addEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),document.addEventListener("mousemove",this.onMousemove),window.addEventListener("resize",this.onResize),this.option("trapFocus")&&document.addEventListener("focus",this.onFocus,!0),document.addEventListener("visibilitychange",this.onVisibilityChange,!1))}detachEvents(){const t=this.container;t&&(document.removeEventListener("keydown",this.onKeydown,{passive:!1,capture:!0}),t.removeEventListener("wheel",this.onWheel,{passive:!1,capture:!1}),t.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),document.removeEventListener("mousemove",this.onMousemove),window.removeEventListener("resize",this.onResize),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),document.removeEventListener("focus",this.onFocus,!0))}onClick(t){var e;if(this.isClosing())return;!this.isCompact&&this.option("idle")&&this.resetIdle();const i=t.composedPath()[0];if(i===(null===(e=this.carousel)||void 0===e?void 0:e.container))return;if(i.closest(".f-spinner")||i.closest("[data-fancybox-close]"))return t.preventDefault(),void this.close(t);if(i.closest("[data-fancybox-prev]"))return t.preventDefault(),void this.prev();if(i.closest("[data-fancybox-next]"))return t.preventDefault(),void this.next();if(this.isCompact)return void(this.clickTimer?(clearTimeout(this.clickTimer),this.clickTimer=null):this.clickTimer=setTimeout((()=>{this.toggleIdle(),this.clickTimer=null}),350));if(this.emit("click",t),t.defaultPrevented)return;let n=!1;const s=document.activeElement;if(i.closest(".fancybox__content")){if(s){if(s.closest("[contenteditable]"))return;i.matches(Y)||s.blur()}if((o=window.getSelection())&&"Range"===o.type)return;n=this.option("contentClick")}else i.closest(".fancybox__carousel")&&!i.matches(Y)&&(n=this.option("backdropClick"));var o;"close"===n?(t.preventDefault(),this.close(t)):"next"===n?(t.preventDefault(),this.next()):"prev"===n&&(t.preventDefault(),this.prev())}onWheel(t){if(this.emit("wheel",t),t.defaultPrevented)return;const e=this.option("wheel",t);if("close"===e)t.preventDefault(),this.close(t);else if("slide"===e){const e=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail));t.preventDefault(),this[e>0?"next":"prev"]()}}onKeydown(t){if(!this.isTopmost())return;this.isCompact||!this.option("idle")||this.isClosing()||this.resetIdle();const e=t.key,i=this.option("keyboard");if(!i||t.ctrlKey||t.altKey||t.shiftKey)return;const n=t.composedPath()[0],s=document.activeElement&&document.activeElement.classList,o=s&&s.contains("f-button")||n.dataset.carouselPage;if("Escape"!==e&&!o&&x(n)){if(n.isContentEditable||-1!==["BUTTON","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].indexOf(n.nodeName))return}this.emit("keydown",e,t);const a=i[e];"function"==typeof this[a]&&this[a]()}onResize(){const t=this.container;if(!t)return;const e=this.isCompact;t.classList.toggle("is-compact",e),this.manageCaption(this.getSlide()),this.isCompact?this.clearIdle():this.endIdle(),this.emit("resize")}onFocus(t){this.isTopmost()&&this.focus(t)}onMousemove(t){this.prevMouseMoveEvent=t,!this.isCompact&&this.option("idle")&&this.resetIdle()}onVisibilityChange(){"visible"===document.visibilityState?this.checkFocus():this.endIdle()}manageCloseBtn(t){const e=this.optionFor(t,"closeButton")||!1;if("auto"===e){const t=this.plugins.Toolbar;if(t&&t.state===ut.Ready)return}if(!e)return;if(!t.contentEl||t.closeBtnEl)return;const i=n(this.localize(this.option("tpl.closeButton")));t.closeBtnEl=t.contentEl.appendChild(i),t.el&&E(t.el,"has-close-btn")}manageCaption(t){var e,i,n;const s=this.container;if(!s)return;const o=this.isCompact||this.option("commonCaption"),a=!o;if(this.caption&&this.stop(this.caption),a&&this.caption&&(this.caption.remove(),this.caption=null),o&&!this.caption)for(const t of(null===(e=this.carousel)||void 0===e?void 0:e.slides)||[])t.captionEl&&(t.captionEl.remove(),t.captionEl=void 0,null===(i=t.el)||void 0===i||i.classList.remove("has-caption"),null===(n=t.el)||void 0===n||n.removeAttribute("aria-labelledby"));if(t||(t=this.getSlide()),!t||o&&!this.isCurrentSlide(t))return;const r=t.el;let l=this.optionFor(t,"caption","");if("string"!=typeof l||!l.length)return void(o&&this.caption&&this.animate(this.caption,"f-fadeOut",(()=>{var t;null===(t=this.caption)||void 0===t||t.remove(),this.caption=null})));let c=null;if(a){if(c=t.captionEl||null,r&&!c){const e=`fancybox__caption_${this.id}_${t.index}`;c=document.createElement("div"),c.className="fancybox__caption",c.setAttribute("id",e),t.captionEl=r.appendChild(c),r.classList.add("has-caption"),r.setAttribute("aria-labelledby",e)}}else{if(c=this.caption,c||(c=s.querySelector(".fancybox__caption")),!c){c=document.createElement("div"),c.dataset.fancyboxCaption="",c.className="fancybox__caption",c.innerHTML=l;(this.footer||s).prepend(c)}s.classList.add("has-caption"),this.caption=c}c&&(c.innerHTML=l)}checkFocus(){var t;const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}focus(t){var e;if(this.ignoreFocusChange)return;const i=document.activeElement||null,n=(null==t?void 0:t.target)||null,s=this.container,o=this.getSlide();if(!s||!(null===(e=this.carousel)||void 0===e?void 0:e.viewport))return;const a=o&&o.state===V.Ready?o.el:null;if(!a||a.contains(i))return;t&&t.cancelable&&t.preventDefault(),this.ignoreFocusChange=!0;const r=Array.from(s.querySelectorAll(Y));let l,c=[s];for(let t of r){const e=t.offsetParent&&!t.closest('[aria-hidden="true"]'),i=a&&a.contains(t),n=!this.carousel.viewport.contains(t);e&&(i||n)?(c.push(t),void 0!==t.dataset.origTabindex&&(t.tabIndex=parseFloat(t.dataset.origTabindex)),t.removeAttribute("data-orig-tabindex"),(t.hasAttribute("autoFocus")||!l&&i)&&(l=t)):(t.dataset.origTabindex=void 0===t.dataset.origTabindex?t.getAttribute("tabindex")||void 0:t.dataset.origTabindex,t.tabIndex=-1)}let h=null;t?(!n||c.indexOf(n)<0)&&(h=s,c.length&&(i===vt?h=c[0]:this.lastFocus!==s&&i!==bt||(h=c[c.length-1]))):this.option("autoFocus")&&l?h=l:i&&c.indexOf(i)<0&&(h=s),h&&(t=>{if(t&&$){void 0===X&&document.createElement("div").focus({get preventScroll(){return X=!0,!1}});try{if(X)t.focus({preventScroll:!0});else{const e=window.pageXOffset||document.body.scrollTop,i=window.pageYOffset||document.body.scrollLeft;t.focus(),document.body.scrollTo({top:e,left:i,behavior:"auto"})}}catch(t){}}})(h),this.lastFocus=document.activeElement,this.ignoreFocusChange=!1}next(){const t=this.carousel;t&&t.pages.length>1&&t.slideNext()}prev(){const t=this.carousel;t&&t.pages.length>1&&t.slidePrev()}jumpTo(...t){this.carousel&&this.carousel.slideTo(...t)}isTopmost(){var t;return(null===(t=xt.getInstance())||void 0===t?void 0:t.id)==this.id}animate(t=null,e="",i){if(!t||!e)return void(i&&i());this.stop(t);const n=s=>{s.target===t&&t.dataset.animationName&&(t.removeEventListener("animationend",n),delete t.dataset.animationName,i&&i(),t.classList.remove(e))};t.dataset.animationName=e,t.addEventListener("animationend",n),t.classList.add(e)}stop(t){t&&t.dispatchEvent(new CustomEvent("animationend",{bubbles:!1,cancelable:!0,currentTarget:t}))}setContent(t,e="",i=!0){if(this.isClosing())return;const n=t.el;if(!n)return;let s=null;if(x(e))["img","iframe","video","audio"].includes(e.nodeName.toLowerCase())?(s=document.createElement("div"),s.appendChild(e)):s=e;else{const t=document.createRange().createContextualFragment(e);s=document.createElement("div"),s.appendChild(t)}s instanceof Element&&t.filter&&!t.error&&(s=s.querySelector(t.filter)),s instanceof Element?(s.classList.add("fancybox__content"),t.id&&s.setAttribute("id",t.id),"none"!==s.style.display&&"none"!==getComputedStyle(s).getPropertyValue("display")||(s.style.display=t.display||this.option("defaultDisplay")||"flex"),n.classList.add(`has-${t.error?"error":t.type||"unknown"}`),n.prepend(s),t.contentEl=s,i&&this.revealContent(t),this.manageCloseBtn(t),this.manageCaption(t)):this.setError(t,"{{ELEMENT_NOT_FOUND}}")}revealContent(t,e){const i=t.el,n=t.contentEl;i&&n&&(this.emit("reveal",t),this.hideLoading(t),t.state=V.Opening,(e=this.isOpeningSlide(t)?void 0===e?this.optionFor(t,"showClass"):e:"f-fadeIn")?this.animate(n,e,(()=>{this.done(t)})):this.done(t))}done(t){var e;this.isClosing()||(t.state=V.Ready,this.emit("done",t),null===(e=t.el)||void 0===e||e.classList.add("is-done"),this.isCurrentSlide(t)&&this.option("autoFocus")&&queueMicrotask((()=>{var t;if(this.option("autoFocus")){const e=document.activeElement||null;e&&(null===(t=this.container)||void 0===t?void 0:t.contains(e))||this.focus()}})),this.isOpeningSlide(t)&&!this.isCompact&&this.option("idle")&&this.setIdle())}isCurrentSlide(t){const e=this.getSlide();return!(!t||!e)&&e.index===t.index}isOpeningSlide(t){var e,i;return null===(null===(e=this.carousel)||void 0===e?void 0:e.prevPage)&&t.index===(null===(i=this.getSlide())||void 0===i?void 0:i.index)}showLoading(t){t.state=V.Loading;const e=t.el;if(!e)return;e.classList.add("is-loading"),this.emit("loading",t),t.spinnerEl||setTimeout((()=>{if(!this.isClosing()&&!t.spinnerEl&&t.state===V.Loading){let i=n(w);t.spinnerEl=i,e.prepend(i),this.animate(i,"f-fadeIn")}}),250)}hideLoading(t){const e=t.el;if(!e)return;const i=t.spinnerEl;this.isClosing()?null==i||i.remove():(e.classList.remove("is-loading"),i&&this.animate(i,"f-fadeOut",(()=>{i.remove()})),t.state===V.Loading&&(this.emit("loaded",t),t.state=V.Ready))}setError(t,e){if(this.isClosing())return;this.emit("error"),t.error=e,this.hideLoading(t),this.clearContent(t);const i=document.createElement("div");i.classList.add("fancybox-error"),i.innerHTML=this.localize(e||"

{{ERROR}}

"),this.setContent(t,i)}clearContent(t){var e;null===(e=this.carousel)||void 0===e||e.emit("removeSlide",t),t.contentEl&&(t.contentEl.remove(),t.contentEl=void 0),t.closeBtnEl&&(t.closeBtnEl.remove(),t.closeBtnEl=void 0);const i=t.el;i&&(S(i,"is-loading"),S(i,"has-error"),S(i,"has-unknown"),S(i,`has-${t.type||"unknown"}`))}getSlide(){var t;const e=this.carousel;return(null===(t=null==e?void 0:e.pages[null==e?void 0:e.page])||void 0===t?void 0:t.slides[0])||void 0}close(t,e){if(this.isClosing())return;const i=new Event("shouldClose",{bubbles:!0,cancelable:!0});if(this.emit("shouldClose",i,t),i.defaultPrevented)return;t&&t.cancelable&&(t.preventDefault(),t.stopPropagation());const n=this.fsAPI,s=()=>{this.proceedClose(t,e)};n&&n.isFullscreen()?Promise.resolve(n.exit()).then((()=>s())):s()}clearIdle(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=null}setIdle(t=!1){const e=()=>{var t;this.clearIdle(),this.idle=!0,null===(t=this.container)||void 0===t||t.classList.add("is-idle"),this.emit("setIdle")};if(this.clearIdle(),!this.isClosing())if(t)e();else{const t=this.option("idle");t&&(this.idleTimer=setTimeout(e,t))}}endIdle(){var t;this.clearIdle(),this.idle&&!this.isClosing()&&(this.idle=!1,null===(t=this.container)||void 0===t||t.classList.remove("is-idle"),this.emit("endIdle"))}resetIdle(){this.endIdle(),this.setIdle()}toggleIdle(){this.idle?this.endIdle():this.setIdle(!0)}toggleFullscreen(){const t=this.fsAPI;t&&(t.isFullscreen()?t.exit():this.container&&t.request(this.container))}isClosing(){return[Z.Closing,Z.CustomClosing,Z.Destroy].includes(this.state)}proceedClose(t,e){var i,n;this.state=Z.Closing,this.clearIdle(),this.detachEvents();const s=this.container,o=this.carousel,a=this.getSlide(),r=null==a?void 0:a.state;if(a){const t=this.option("placeFocusBack")?(null===(i=this.getSlide())||void 0===i?void 0:i.triggerEl)||this.option("trigger"):null;t&&t.focus()}if(s&&(E(s,"is-closing"),s.setAttribute("aria-hidden","true"),this.option("animated")&&E(s,"is-animated"),s.style.pointerEvents="none"),o){o.clearTransitions(),null===(n=o.panzoom)||void 0===n||n.destroy();for(const t of o.slides){t.state=V.Closing,this.hideLoading(t);const e=t.contentEl;e&&this.stop(e);const i=null==t?void 0:t.panzoom;i&&(i.stop(),i.detachEvents(),i.detachObserver()),this.isCurrentSlide(t)||o.emit("removeSlide",t)}}this.emit("close",t),this.state!==Z.CustomClosing?(void 0===e&&a&&(e=this.optionFor(a,"hideClass")),e&&a&&r===V.Ready?(this.animate(a.contentEl,e,(()=>{o&&o.emit("removeSlide",a)})),setTimeout((()=>{this.destroy()}),350)):this.destroy()):setTimeout((()=>{this.destroy()}),350)}destroy(){var t;if(this.state===Z.Destroy)return;this.state=Z.Destroy,null===(t=this.carousel)||void 0===t||t.destroy();const e=this.container;e&&e.remove(),yt.delete(this.id);const i=xt.getInstance();i?i.focus():(bt&&(bt.remove(),bt=null),vt&&(vt.remove(),vt=null),document.documentElement.classList.remove("with-fancybox"),$&&(document.documentElement.style.setProperty("--fancybox-scrollbar-compensate",""),document.body.classList.remove("compensate-for-scrollbar")))}static bind(t,e,i){if(!$)return;let n,s="",o={};if("string"==typeof t?(n=document.body,s=t,"object"==typeof e&&(o=e||{})):(n=t,"string"==typeof e&&(s=e),"object"==typeof i&&(o=i||{})),!n)return;s=s||"[data-fancybox]";const a=xt.openers.get(n)||new Map;a.set(s,o),xt.openers.set(n,a),1===a.size&&n.addEventListener("click",xt.fromEvent)}static unbind(t,e){let i,n="";if("string"==typeof t?(i=document.body,n=t):(i=t,"string"==typeof e&&(n=e)),!i)return;const s=xt.openers.get(i);s&&n&&s.delete(n),n&&s||(xt.openers.delete(i),i.removeEventListener("click",xt.fromEvent))}static destroy(){let t;for(;t=xt.getInstance();)t.destroy();for(const t of xt.openers.keys())t.removeEventListener("click",xt.fromEvent);xt.openers=new Map}static fromEvent(t){if(t.defaultPrevented)return;if(t.button&&0!==t.button)return;if(t.ctrlKey||t.metaKey||t.shiftKey)return;let e=t.composedPath()[0];const i=e.closest("[data-fancybox-trigger]");if(i){const t=i.dataset.fancyboxTrigger||"",n=document.querySelectorAll(`[data-fancybox="${t}"]`),s=parseInt(i.dataset.fancyboxIndex||"",10)||0;e=n[s]||e}if(!(e&&e instanceof Element))return;let n,s,o,a;if([...xt.openers].reverse().find((([t,i])=>!(!t.contains(e)||![...i].reverse().find((([i,r])=>{let l=e.closest(i);return!!l&&(n=t,s=i,o=l,a=r,!0)}))))),!n||!s||!o)return;a=a||{},t.preventDefault(),e=o;let r=[],l=u({},q,a);l.event=t,l.trigger=e,l.delegate=i;const c=l.groupAll,h=l.groupAttr,d=h&&e?e.getAttribute(`${h}`):"";if((!e||d||c)&&(r=[].slice.call(n.querySelectorAll(s))),e&&!c&&(r=d?r.filter((t=>t.getAttribute(`${h}`)===d)):[e]),!r.length)return;const p=xt.getInstance();return p&&p.options.trigger&&r.indexOf(p.options.trigger)>-1?void 0:(e&&(l.startIndex=r.indexOf(e)),xt.fromNodes(r,l))}static fromNodes(t,e){e=u({},q,e);const i=[];for(const n of t){const t=n.dataset||{},s=t.src||n.getAttribute("href")||n.getAttribute("currentSrc")||n.getAttribute("src")||void 0;let o;const a=e.delegate;let r;a&&i.length===e.startIndex&&(o=a instanceof HTMLImageElement?a:a.querySelector("img:not([aria-hidden])")),o||(o=n instanceof HTMLImageElement?n:n.querySelector("img:not([aria-hidden])")),o&&(r=o.currentSrc||o.src||void 0,!r&&o.dataset&&(r=o.dataset.lazySrc||o.dataset.src||void 0));const l={src:s,triggerEl:n,thumbEl:o,thumbElSrc:r,thumbSrc:r};for(const e in t)"fancybox"!==e&&(l[e]=t[e]+"");i.push(l)}return new xt(i,e)}static getInstance(t){if(t)return yt.get(t);return Array.from(yt.values()).reverse().find((t=>!t.isClosing()&&t))||null}static getSlide(){var t;return(null===(t=xt.getInstance())||void 0===t?void 0:t.getSlide())||null}static show(t=[],e={}){return new xt(t,e)}static next(){const t=xt.getInstance();t&&t.next()}static prev(){const t=xt.getInstance();t&&t.prev()}static close(t=!0,...e){if(t)for(const t of yt.values())t.close(...e);else{const t=xt.getInstance();t&&t.close(...e)}}}Object.defineProperty(xt,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(xt,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:q}),Object.defineProperty(xt,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:gt}),Object.defineProperty(xt,"openers",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),t.Carousel=W,t.Fancybox=xt,t.Panzoom=A})); diff --git a/dist/panzoom/panzoom.css b/dist/panzoom/panzoom.css index a447346f..07594d4d 100644 --- a/dist/panzoom/panzoom.css +++ b/dist/panzoom/panzoom.css @@ -1 +1 @@ -:root{--f-spinner-width: 36px;--f-spinner-height: 36px;--f-spinner-color-1: rgba(0, 0, 0, 0.1);--f-spinner-color-2: rgba(17, 24, 28, 0.8);--f-spinner-stroke: 2.75}.f-spinner{margin:auto;padding:0;width:var(--f-spinner-width);height:var(--f-spinner-height)}.f-spinner svg{width:100%;height:100%;vertical-align:top;animation:f-spinner-rotate 2s linear infinite}.f-spinner svg *{stroke-width:var(--f-spinner-stroke);fill:none}.f-spinner svg *:first-child{stroke:var(--f-spinner-color-1)}.f-spinner svg *:last-child{stroke:var(--f-spinner-color-2);animation:f-spinner-dash 2s ease-in-out infinite}@keyframes f-spinner-rotate{100%{transform:rotate(360deg)}}@keyframes f-spinner-dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}.f-panzoom{position:relative;overflow:hidden;display:flex;flex-direction:column;justify-content:center;align-items:center;transform:translate3d(0, 0, 0);background:#fff}.f-panzoom.is-draggable{cursor:move;cursor:grab}.f-panzoom.can-zoom_in{cursor:zoom-in}.f-panzoom.can-zoom_out{cursor:zoom-out}.f-panzoom.is-dragging{cursor:move;cursor:grabbing}.f-panzoom.in-fullscreen{position:fixed;top:0;left:0;margin:0 !important;width:100% !important;height:100% !important;max-width:none !important;max-height:none !important;aspect-ratio:unset !important;z-index:9999}.f-panzoom__content{display:block;margin:auto;position:relative;max-width:100%;max-height:100%;min-height:0;object-fit:contain;transform:translate3d(0, 0, 0) scale(1) rotate(0) skew(0);transform-origin:center center;transition:none;user-select:none}.is-loading .f-panzoom__content{display:none}.f-panzoom__content:not(:last-child){margin-bottom:0}.f-panzoom__viewport{margin:auto;position:relative;width:fit-content;height:fit-content;min-height:1px}.f-panzoom__viewport:not(:last-child){margin-bottom:0}.f-panzoom__caption:not(:first-child){margin-bottom:auto}html.with-panzoom-in-fullscreen{overflow:hidden} \ No newline at end of file +:root{--f-spinner-width: 36px;--f-spinner-height: 36px;--f-spinner-color-1: rgba(0, 0, 0, 0.1);--f-spinner-color-2: rgba(17, 24, 28, 0.8);--f-spinner-stroke: 2.75}.f-spinner{margin:auto;padding:0;width:var(--f-spinner-width);height:var(--f-spinner-height)}.f-spinner svg{width:100%;height:100%;vertical-align:top;animation:f-spinner-rotate 2s linear infinite}.f-spinner svg *{stroke-width:var(--f-spinner-stroke);fill:none}.f-spinner svg *:first-child{stroke:var(--f-spinner-color-1)}.f-spinner svg *:last-child{stroke:var(--f-spinner-color-2);animation:f-spinner-dash 2s ease-in-out infinite}@keyframes f-spinner-rotate{100%{transform:rotate(360deg)}}@keyframes f-spinner-dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}.f-panzoom{position:relative;overflow:hidden;display:flex;flex-direction:column;justify-content:center;align-items:center;transform:translate3d(0, 0, 0);background:#fff}.f-panzoom.is-draggable{cursor:move;cursor:grab}.f-panzoom.can-zoom_in{cursor:zoom-in}.f-panzoom.can-zoom_out{cursor:zoom-out}.f-panzoom.is-dragging{cursor:move;cursor:grabbing}.f-panzoom.in-fullscreen{position:fixed;top:0;left:0;margin:0 !important;width:100% !important;height:100% !important;max-width:none !important;max-height:none !important;aspect-ratio:unset !important;z-index:9999}.f-panzoom__content{display:block;margin:auto;position:relative;max-width:100%;max-height:100%;min-height:0;object-fit:contain;transform:translate3d(0, 0, 0) scale(1) rotate(0) skew(0);transform-origin:center center;transition:none;user-select:none}.is-loading .f-panzoom__content{display:none}.is-scaling .f-panzoom__content{filter:blur(0px);will-change:transform,width,height;backface-visibility:hidden}.f-panzoom__content:not(:last-child){margin-bottom:0}.f-panzoom__viewport{margin:auto;position:relative;width:fit-content;height:fit-content;min-height:1px}.f-panzoom__viewport:not(:last-child){margin-bottom:0}.f-panzoom__caption:not(:first-child){margin-bottom:auto}html.with-panzoom-in-fullscreen{overflow:hidden} \ No newline at end of file diff --git a/dist/panzoom/panzoom.esm.js b/dist/panzoom/panzoom.esm.js index 24fe886d..6ee15a79 100644 --- a/dist/panzoom/panzoom.esm.js +++ b/dist/panzoom/panzoom.esm.js @@ -1 +1 @@ -const t=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),e=function(t,i){return!(!t||t===document.body||i&&t===i)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,n=-1!==i.indexOf("hidden"),s=-1!==i.indexOf("visible");return e&&!n&&!s}(t)?t:e(t.parentElement,i))},i=(t,e,i)=>{(t=>`${t||""}`.split(" ").filter((t=>!!t)))(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))};class n{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const s={passive:!1};class o{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:n=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=n;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,s),this.element.addEventListener("touchmove",this.onMove,s),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,s)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new n(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new n(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new n(t))):[new n(t)],s=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(s.push(t),this.currentPointers[e]=t)}s.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new n(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new n(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,s),this.element.removeEventListener("touchstart",this.onTouchStart,s),this.element.removeEventListener("touchmove",this.onMove,s),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function r(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function a(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const h=(t,...e)=>{const i=e.length;for(let n=0;n{const n=Array.isArray(i)?[]:{};var s;t[e]||Object.assign(t,{[e]:n}),"object"==typeof(s=i)&&null!==s&&s.constructor===Object&&"[object Object]"===Object.prototype.toString.call(s)?Object.assign(t[e],h(n,i)):Array.isArray(i)?Object.assign(t,{[e]:[...i]}):Object.assign(t,{[e]:i})}))}return t},c=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class l{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?h({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=c(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...n){let s=c(e,t);var o;"string"!=typeof(o=s)||isNaN(o)||isNaN(parseFloat(o))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...n));let r=c(e,this.options);return r&&"function"==typeof r?s=r.call(this,this,t,...n,s):void 0===s&&(s=r),void 0===s?i:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(l,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(l,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class u extends l{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,n]of Object.entries(t)){const t=this.option(i),s=this.plugins[i];s||!1===t?s&&!1===t&&(s.detach(),delete this.plugins[i]):e.set(i,new n(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}var g;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(g||(g={}));const d=["a","b","c","d","e","f"],f={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:{PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"}},m={a:1,b:0,c:0,d:1,e:0,f:0};let p=null,b=null;class v extends u{get isTouchDevice(){return null===b&&(b=window.matchMedia("(hover: none)").matches),b}get isMobile(){return null===p&&(p=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),p}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){return this.content instanceof HTMLImageElement&&!this.content.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of d){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var n,s;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:g.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},m)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},m)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},v.Plugins),i)),this.emit("init"),this.isContentLoading){if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const e=(s='
',(new DOMParser).parseFromString(s,"text/html").body.firstChild);t.contains(this.content)?this.spinner=(null===(n=this.content.parentElement)||void 0===n?void 0:n.insertBefore(e,this.content))||null:this.spinner=t.appendChild(e)}this.emit("beforeLoad"),this.content.addEventListener("load",this.onLoad),this.content.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===g.Init&&this.enable()}onError(){this.state!==g.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=g.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new o(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of d)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of d)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,n=i.e+t,s=i.f+e,o=this.getBounds(),{x:r,y:a}=o,h=r.min,c=r.max,l=a.min,u=a.max;let g=0,d=0;return h!==1/0&&nc&&(g=c-n),l!==1/0&&su&&(d=u-s),Math.abs(g)<.001&&(g=0),Math.abs(d)<.001&&(d=0),Object.assign(Object.assign({},o),{xDiff:g,yDiff:d,inBounds:!g&&!d})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:n,fitHeight:s,fullWidth:o,fullHeight:r}=i;let a=o,h=r;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),c=i?o:n,l=i?r:s,u=this.getMatrix(t),g=new DOMPoint(0,0).matrixTransform(u),d=new DOMPoint(0+c,0).matrixTransform(u),f=new DOMPoint(0+c,0+l).matrixTransform(u),m=new DOMPoint(0,0+l).matrixTransform(u),p=Math.abs(f.x-g.x),b=Math.abs(f.y-g.y),v=Math.abs(m.x-d.x),y=Math.abs(m.y-d.y);a=Math.max(p,v),h=Math.max(b,y)}return{contentWidth:a,contentHeight:h}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const n=i.closest("[data-panzoom-action]"),s=i.closest("[data-panzoom-change]"),o=n||s,r=o&&((a=o)&&null!==a&&a instanceof Element&&"nodeType"in a)?o.dataset:null;var a;if(r){const e=r.panzoomChange,i=r.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const h=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(h.x-this.dragStart.x)>2||Math.abs(h.y-this.dragStart.y)>2))return;this.dragStart.time=0;const c=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},l=this.option("click",t),u=this.option("dblClick",t);u?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&l&&c(l)):(this.emit("dblClick",t),t.defaultPrevented||c(u)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&l&&c(l))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(e,i,n){var s;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const o=this.content.getBoundingClientRect();if(this.dragStart={x:o.x,y:o.y,top:o.top,left:o.left,time:Date.now()},!1===this.option("touch",e))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return e.preventDefault(),e.stopPropagation(),!1;if(!n.length){const t=e.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(t.nodeName)||t.closest("[contenteditable]")||t.closest("[data-selectable]")||t.closest("[data-panzoom-change]")||t.closest("[data-panzoom-action]"))return!1;null===(s=window.getSelection())||void 0===s||s.removeAllRanges()}return"mousedown"===e.type&&e.preventDefault(),t(this.targetScale,1e3)===t(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(i),this.emit("touchStart",e),!0}onPointerMove(i,n,s){if(!this.isDragging)return;if(n.length<2&&this.panOnlyZoomed&&t(this.targetScale)<=t(this.minScale))return;if(this.emit("touchMove",i),i.defaultPrevented)return;this.addTrackingPoint(n[0]);const{content:o}=this,h=a(s[0],s[1]),c=a(n[0],n[1]);let l=0,u=0;if(n.length>1){const t=o.getBoundingClientRect();l=h.clientX-t.left-.5*t.width,u=h.clientY-t.top-.5*t.height}const g=r(s[0],s[1]),d=r(n[0],n[1]);let f=g?d/g:1,m=c.clientX-h.clientX,p=c.clientY-h.clientY;this.dragOffset.x+=m,this.dragOffset.y+=p,this.dragOffset.time=Date.now()-this.dragStart.time;let b=t(this.targetScale)===t(this.minScale)&&this.option("lockAxis");if(b&&!this.lockedAxis)if("xy"===b||"y"===b||"touchmove"===i.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void i.preventDefault();const t=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=t>45&&t<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,m=0,p=0}else this.lockedAxis=b;if(e(i.target,this.content)&&(b="x",this.dragOffset.y=0),b&&"xy"!==b&&this.lockedAxis!==b&&t(this.targetScale)===t(this.minScale))return;i.cancelable&&i.preventDefault(),this.container.classList.add(this.cn("isDragging"));const v=this.checkBounds(m,p);this.option("rubberband")?("x"!==this.isInfinite&&(v.xDiff>0&&m<0||v.xDiff<0&&m>0)&&(m*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*v.xDiff))),"y"!==this.isInfinite&&(v.yDiff>0&&p<0||v.yDiff<0&&p>0)&&(p*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*v.yDiff)))):(v.xDiff&&(m=0),v.yDiff&&(p=0));const y=this.targetScale,w=this.minScale,M=this.maxScale;y<.5*w&&(f=Math.max(f,w)),y>1.5*M&&(f=Math.min(f,M)),"y"===this.lockedAxis&&t(y)===t(w)&&(m=0),"x"===this.lockedAxis&&t(y)===t(w)&&(p=0),this.applyChange({originX:l,originY:u,panX:m,panY:p,scale:f,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,i,n){if(n.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(i),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),e(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==g.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of d)this.velocity[t]=0,this.target[t]=this.current[t];const{trackingPoints:e}=this,i=e[0],n=e[e.length-1];let s=0,o=0,r=0;n&&i&&(s=n.clientX-i.clientX,o=n.clientY-i.clientY,r=n.time-i.time);let a=0,h=0,c=0,l=0,u=this.option("decelFriction");const g=this.targetScale;if((gthis.maxScale+1e-5)&&(u=.35),r>0){c=Math.abs(s)>3?s/(r/30):0,l=Math.abs(o)>3?o/(r/30):0;const t=this.option("maxVelocity");t&&(c=Math.max(Math.min(c,t),-1*t),l=Math.max(Math.min(l,t),-1*t))}c&&(a=c/(1/(1-u)-1)),l&&(h=l/(1/(1-u)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&t(g)===this.minScale)&&(a=c=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&t(g)===this.minScale)&&(h=l=0);const f=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(s)),"auto"===m&&(m=parseFloat(s.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(s));const p=(this.option("transformParent")?s.parentElement:null)||s,b=p.getAttribute("style")||"";p.style.setProperty("transform","none","important"),p.style.setProperty("transition","none","important"),p.style.setProperty("animation","none","important"),s instanceof HTMLImageElement&&(p.style.width="",p.style.height=""),p.offsetHeight;const v=s.getBoundingClientRect();let y=v.width,w=v.height,M=0,P=0;if(s instanceof HTMLImageElement&&({width:y,height:w,top:M,left:P}=((t,e,i,n)=>{const s=i/n;return s>t/e?(i=t,n=t/s):(i=e*s,n=e),{width:i,height:n,top:.5*(e-n),left:.5*(t-i)}})(v.width,v.height,f,m)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:v.top-a.top+M,bottom:a.bottom-v.bottom+M,left:v.left-a.left+P,right:a.right-v.right+P,fitWidth:y,fitHeight:w,width:y,height:w,fullWidth:f,fullHeight:m}),p.style.cssText=b,s instanceof HTMLImageElement&&(p.style.width=`${y}px`,p.style.height=`${w}px`),this.setTransform(),!0!==e){let t="";Math.abs(c-o)>1&&(t+="x"),Math.abs(l-r)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(t(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===g.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const e=this.option("bounds");if("auto"!==e)return e;const{contentWidth:i,contentHeight:n}=this.calculateContentDim(this.target);let s=0,o=0,r=0,a=0;const h=this.option("infinite");if(!0===h||this.lockedAxis&&h===this.lockedAxis)s=-1/0,r=1/0,o=-1/0,a=1/0;else{let{containerRect:e,contentRect:h}=this,c=t(this.contentRect.fitWidth*this.targetScale,1e3),l=t(this.contentRect.fitHeight*this.targetScale,1e3),{innerWidth:u,innerHeight:g}=e;if(this.containerRect.width===c&&(u=e.width),this.containerRect.width===l&&(g=e.height),i>u){r=.5*(i-u),s=-1*r;let t=.5*(h.right-h.left);s+=t,r+=t}if(this.contentRect.fitWidth>u&&ig){a=.5*(n-g),o=-1*a;let t=.5*(h.bottom-h.top);o+=t,a+=t}this.contentRect.fitHeight>g&&nthis.maxScale?this.minScale:this.maxScale,toggleCover:this.targetScale>this.coverScale?this.minScale:this.coverScale,toggleZoom:this.targetScale>this.fullScale?this.minScale:this.fullScale}[this.option("click")||""]||this.minScale,o=e.canZoomIn(),r=e.canZoomOut(),a="drag"===this.panMode,h=r&&a;this.targetScale<=this.minScale&&!this.panOnlyZoomed&&(h=!0),(this.contentRect.width-this.contentRect.fitWidth>-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(h=!0),this.contentRect.width*this.targetScalethis.minScale,l=!o&&!h&&r&&t(s)===t(this.minScale);i(n,this.cn("canZoomIn"),c),i(n,this.cn("canZoomOut"),l),i(n,this.cn("isDraggable"),h);for(const t of n.querySelectorAll('[data-panzoom-action="zoomIn"]'))o?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const t of n.querySelectorAll('[data-panzoom-action="zoomOut"]'))r?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const t of n.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){o=e.targetScale.9*e.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:n=this.option("friction"),angle:s=0,originX:o=0,originY:r=0,flipX:a=!1,flipY:h=!1,ignoreBounds:c=!1}){this.state!==g.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:s,originX:o,originY:r,friction:n,flipX:a,flipY:h,ignoreBounds:c})}applyChange({panX:e=0,panY:i=0,scale:n=1,angle:s=0,originX:o=-this.current.e,originY:r=-this.current.f,friction:a=this.option("friction"),flipX:h=!1,flipY:c=!1,ignoreBounds:l=!1,bounce:u=this.option("bounce")}){if(this.state===g.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of d)this.velocity[t]=0;this.friction=a||0,this.ignoreBounds=l;const{current:f}=this,m=f.e,p=f.f,b=this.getMatrix(this.target);let v=(new DOMMatrix).translate(m,p).translate(o,r).translate(e,i);if(this.option("zoom")){if(!l){const t=this.targetScale,e=this.minScale,i=this.maxScale;t*ni&&(n=i/t)}v=v.scale(n)}v=v.translate(-o,-r).translate(-m,-p).multiply(b),s&&(v=v.rotate(s)),h&&(v=v.scale(-1,1)),c&&(v=v.scale(1,-1));for(const e of d)"a"!=e&&"d"!=e||!(v[e]>this.minScale+1e-5||v[e].1||"mousemove"===this.panMode||!1===u)&&!l&&this.clampTargetBounds(),this.isResting||(this.state=g.Panning,this.requestTick())}stop(t=!1){if(this.state!==g.Init&&this.state!==g.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of d)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=g.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls()),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(e,i=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=e,"mousemove"!==this.panMode||!e)return;if(t(this.targetScale)<=t(this.minScale))return;this.emit("mouseMove",e);const{container:n,containerRect:s,contentRect:o}=this,r=s.width,a=s.height,h=n.getBoundingClientRect(),c=(e.clientX||0)-h.left,l=(e.clientY||0)-h.top;let{contentWidth:u,contentHeight:g}=this.calculateContentDim(this.target);const d=this.option("mouseMoveFactor");d>1&&(u!==r&&(u*=d),g!==a&&(g*=d));let f=.5*(u-r)-c/r*100/100*(u-r);f+=.5*(o.right-o.left);let m=.5*(g-a)-l/a*100/100*(g-a);m+=.5*(o.bottom-o.top),this.applyChange({panX:f-this.target.e,panY:m-this.target.f,friction:i})}zoomWithWheel(t){if(this.state===g.Destroy||this.state===g.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),n=this.targetScale,s=this.maxScale,o=this.minScale;let r=n*(100+i*e)/100;rs&&n>=s?(this.wheelDelta+=Math.abs(i),r=s):(this.wheelDelta=0,r=Math.max(Math.min(r,s),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),r!==n&&this.zoomTo(r,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale>.9*this.maxScale?"fit":"max",t)}toggleCover(t){this.zoomTo(this.targetScale>.9*this.coverScale?"fit":"cover",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:n=0,event:s}={}){if(this.isContentLoading||this.state===g.Destroy)return;this.stop();const{targetScale:o}=this;let r=1;if("mousemove"===this.panMode&&(s=this.prevMouseMoveEvent||s),s){const t=this.content.getBoundingClientRect(),e=s.clientX||0,o=s.clientY||0;i=e-t.left-.5*t.width,n=o-t.top-.5*t.height}const a=this.fullScale,h=this.maxScale;let c=this.coverScale;"number"==typeof t?r=t/o:("next"===t&&(a-c<.2&&(c=a),t=o1?.15:.25:e,this.applyChange({scale:r,originX:i,originY:n,friction:e}),s&&"mousemove"===this.panMode&&this.panWithMouse(s,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const n=t.classList.contains(e);n?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(n?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:n,d:s,e:o,f:r}=t;return new DOMMatrix([e,i,n,s,o,r])}reset(t){if(this.state!==g.Init&&this.state!==g.Destroy){this.stop("current");for(const t of d)this.target[t]=m[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=g.Panning,this.requestTick())}}destroy(){this.stop(),this.state=g.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(v,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:f}),Object.defineProperty(v,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});export{v as Panzoom}; +const t=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),e=function(t,i){return!(!t||t===document.body||i&&t===i)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,n=-1!==i.indexOf("hidden"),s=-1!==i.indexOf("visible");return e&&!n&&!s}(t)?t:e(t.parentElement,i))},i=t=>`${t||""}`.split(" ").filter((t=>!!t)),n=(t,e,n)=>{i(e).forEach((e=>{t&&t.classList.toggle(e,n||!1)}))};class s{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const o={passive:!1};class r{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:n=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=n;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,o),this.element.addEventListener("touchmove",this.onMove,o),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,o)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new s(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new s(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new s(t))):[new s(t)],n=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(n.push(t),this.currentPointers[e]=t)}n.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new s(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new s(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,o),this.element.removeEventListener("touchstart",this.onTouchStart,o),this.element.removeEventListener("touchmove",this.onMove,o),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function a(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function h(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const c=(t,...e)=>{const i=e.length;for(let n=0;n{const n=Array.isArray(i)?[]:{};var s;t[e]||Object.assign(t,{[e]:n}),"object"==typeof(s=i)&&null!==s&&s.constructor===Object&&"[object Object]"===Object.prototype.toString.call(s)?Object.assign(t[e],c(n,i)):Array.isArray(i)?Object.assign(t,{[e]:[...i]}):Object.assign(t,{[e]:i})}))}return t},l=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class u{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?c({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=l(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...n){let s=l(e,t);var o;"string"!=typeof(o=s)||isNaN(o)||isNaN(parseFloat(o))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...n));let r=l(e,this.options);return r&&"function"==typeof r?s=r.call(this,this,t,...n,s):void 0===s&&(s=r),void 0===s?i:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(u,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(u,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class g extends u{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,n]of Object.entries(t)){const t=this.option(i),s=this.plugins[i];s||!1===t?s&&!1===t&&(s.detach(),delete this.plugins[i]):e.set(i,new n(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}var d;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(d||(d={}));const f=["a","b","c","d","e","f"],m={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:{PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"}},p=(t,e)=>{i(e).forEach((e=>{t&&t.classList.remove(e)}))},b=(t,e)=>{i(e).forEach((e=>{t&&t.classList.add(e)}))},v={a:1,b:0,c:0,d:1,e:0,f:0};let y=null,w=null;class M extends g{get isTouchDevice(){return null===w&&(w=window.matchMedia("(hover: none)").matches),w}get isMobile(){return null===y&&(y=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),y}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const t=this.content;return!!(t&&t instanceof HTMLImageElement)&&!t.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of f){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var n,s;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:d.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},v)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},v)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},M.Plugins),i)),this.emit("init"),this.isContentLoading){const e=this.content;if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const i=(s='
',(new DOMParser).parseFromString(s,"text/html").body.firstChild);t.contains(e)?this.spinner=(null===(n=e.parentElement)||void 0===n?void 0:n.insertBefore(i,e))||null:this.spinner=t.appendChild(i)}this.emit("beforeLoad"),e.addEventListener("load",this.onLoad),e.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===d.Init&&this.enable()}onError(){this.state!==d.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=d.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new r(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of f)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of f)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,n=i.e+t,s=i.f+e,o=this.getBounds(),{x:r,y:a}=o,h=r.min,c=r.max,l=a.min,u=a.max;let g=0,d=0;return h!==1/0&&nc&&(g=c-n),l!==1/0&&su&&(d=u-s),Math.abs(g)<.001&&(g=0),Math.abs(d)<.001&&(d=0),Object.assign(Object.assign({},o),{xDiff:g,yDiff:d,inBounds:!g&&!d})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:n,fitHeight:s,fullWidth:o,fullHeight:r}=i;let a=o,h=r;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),c=i?o:n,l=i?r:s,u=this.getMatrix(t),g=new DOMPoint(0,0).matrixTransform(u),d=new DOMPoint(0+c,0).matrixTransform(u),f=new DOMPoint(0+c,0+l).matrixTransform(u),m=new DOMPoint(0,0+l).matrixTransform(u),p=Math.abs(f.x-g.x),b=Math.abs(f.y-g.y),v=Math.abs(m.x-d.x),y=Math.abs(m.y-d.y);a=Math.max(p,v),h=Math.max(b,y)}return{contentWidth:a,contentHeight:h}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const n=i.closest("[data-panzoom-action]"),s=i.closest("[data-panzoom-change]"),o=n||s,r=o&&((a=o)&&null!==a&&a instanceof Element&&"nodeType"in a)?o.dataset:null;var a;if(r){const e=r.panzoomChange,i=r.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const h=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(h.x-this.dragStart.x)>2||Math.abs(h.y-this.dragStart.y)>2))return;this.dragStart.time=0;const c=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},l=this.option("click",t),u=this.option("dblClick",t);u?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&l&&c(l)):(this.emit("dblClick",t),t.defaultPrevented||c(u)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&l&&c(l))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(e,i,n){var s;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const o=this.content.getBoundingClientRect();if(this.dragStart={x:o.x,y:o.y,top:o.top,left:o.left,time:Date.now()},!1===this.option("touch",e))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return e.preventDefault(),e.stopPropagation(),!1;if(!n.length){const t=e.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(t.nodeName)||t.closest("[contenteditable]")||t.closest("[data-selectable]")||t.closest("[data-panzoom-change]")||t.closest("[data-panzoom-action]"))return!1;null===(s=window.getSelection())||void 0===s||s.removeAllRanges()}return"mousedown"===e.type&&e.preventDefault(),t(this.targetScale,1e3)===t(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(i),this.emit("touchStart",e),!0}onPointerMove(i,n,s){if(!this.isDragging)return;if(n.length<2&&this.panOnlyZoomed&&t(this.targetScale)<=t(this.minScale))return;if(this.emit("touchMove",i),i.defaultPrevented)return;this.addTrackingPoint(n[0]);const{content:o}=this,r=h(s[0],s[1]),c=h(n[0],n[1]);let l=0,u=0;if(n.length>1){const t=o.getBoundingClientRect();l=r.clientX-t.left-.5*t.width,u=r.clientY-t.top-.5*t.height}const g=a(s[0],s[1]),d=a(n[0],n[1]);let f=g?d/g:1,m=c.clientX-r.clientX,p=c.clientY-r.clientY;this.dragOffset.x+=m,this.dragOffset.y+=p,this.dragOffset.time=Date.now()-this.dragStart.time;let b=t(this.targetScale)===t(this.minScale)&&this.option("lockAxis");if(b&&!this.lockedAxis)if("xy"===b||"y"===b||"touchmove"===i.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void i.preventDefault();const t=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=t>45&&t<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,m=0,p=0}else this.lockedAxis=b;if(e(i.target,this.content)&&(b="x",this.dragOffset.y=0),b&&"xy"!==b&&this.lockedAxis!==b&&t(this.targetScale)===t(this.minScale))return;i.cancelable&&i.preventDefault(),this.container.classList.add(this.cn("isDragging"));const v=this.checkBounds(m,p);this.option("rubberband")?("x"!==this.isInfinite&&(v.xDiff>0&&m<0||v.xDiff<0&&m>0)&&(m*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*v.xDiff))),"y"!==this.isInfinite&&(v.yDiff>0&&p<0||v.yDiff<0&&p>0)&&(p*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*v.yDiff)))):(v.xDiff&&(m=0),v.yDiff&&(p=0));const y=this.targetScale,w=this.minScale,M=this.maxScale;y<.5*w&&(f=Math.max(f,w)),y>1.5*M&&(f=Math.min(f,M)),"y"===this.lockedAxis&&t(y)===t(w)&&(m=0),"x"===this.lockedAxis&&t(y)===t(w)&&(p=0),this.applyChange({originX:l,originY:u,panX:m,panY:p,scale:f,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,i,n){if(n.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(i),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),e(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==d.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of f)this.velocity[t]=0,this.target[t]=this.current[t];p(this.container,"is-scaling"),p(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:e}=this,i=e[0],n=e[e.length-1];let s=0,o=0,r=0;n&&i&&(s=n.clientX-i.clientX,o=n.clientY-i.clientY,r=n.time-i.time);let a=0,h=0,c=0,l=0,u=this.option("decelFriction");const g=this.targetScale;if((gthis.maxScale+1e-5)&&(u=.35),r>0){c=Math.abs(s)>3?s/(r/30):0,l=Math.abs(o)>3?o/(r/30):0;const t=this.option("maxVelocity");t&&(c=Math.max(Math.min(c,t),-1*t),l=Math.max(Math.min(l,t),-1*t))}c&&(a=c/(1/(1-u)-1)),l&&(h=l/(1/(1-u)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&t(g)===this.minScale)&&(a=c=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&t(g)===this.minScale)&&(h=l=0);const d=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(s)),"auto"===m&&(m=parseFloat(s.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(s));const p=(this.option("transformParent")?s.parentElement:null)||s,b=p.getAttribute("style")||"";p.style.setProperty("transform","none","important"),p.style.setProperty("transition","none","important"),p.style.setProperty("animation","none","important"),s instanceof HTMLImageElement&&(p.style.width="",p.style.height=""),p.offsetHeight;const v=s.getBoundingClientRect();let y=v.width,w=v.height,M=0,P=0;if(s instanceof HTMLImageElement&&({width:y,height:w,top:M,left:P}=((t,e,i,n)=>{const s=i/n;return s>t/e?(i=t,n=t/s):(i=e*s,n=e),{width:i,height:n,top:.5*(e-n),left:.5*(t-i)}})(v.width,v.height,f,m)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:v.top-a.top+M,bottom:a.bottom-v.bottom+M,left:v.left-a.left+P,right:a.right-v.right+P,fitWidth:y,fitHeight:w,width:y,height:w,fullWidth:f,fullHeight:m}),p.style.cssText=b,s instanceof HTMLImageElement&&(p.style.width=`${y}px`,p.style.height=`${w}px`),this.setTransform(),!0!==e){let t="";Math.abs(c-o)>1&&(t+="x"),Math.abs(l-r)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(t(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===d.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const e=this.option("bounds");if("auto"!==e)return e;const{contentWidth:i,contentHeight:n}=this.calculateContentDim(this.target);let s=0,o=0,r=0,a=0;const h=this.option("infinite");if(!0===h||this.lockedAxis&&h===this.lockedAxis)s=-1/0,r=1/0,o=-1/0,a=1/0;else{let{containerRect:e,contentRect:h}=this,c=t(this.contentRect.fitWidth*this.targetScale,1e3),l=t(this.contentRect.fitHeight*this.targetScale,1e3),{innerWidth:u,innerHeight:g}=e;if(this.containerRect.width===c&&(u=e.width),this.containerRect.width===l&&(g=e.height),i>u){r=.5*(i-u),s=-1*r;let t=.5*(h.right-h.left);s+=t,r+=t}if(this.contentRect.fitWidth>u&&ig){a=.5*(n-g),o=-1*a;let t=.5*(h.bottom-h.top);o+=t,a+=t}this.contentRect.fitHeight>g&&n-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(h=!0),this.contentRect.width*this.targetScalet(this.targetScale),l=!c&&!h&&r&&t(s).9*e.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:n=this.option("friction"),angle:s=0,originX:o=0,originY:r=0,flipX:a=!1,flipY:h=!1,ignoreBounds:c=!1}){this.state!==d.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:s,originX:o,originY:r,friction:n,flipX:a,flipY:h,ignoreBounds:c})}applyChange({panX:e=0,panY:i=0,scale:n=1,angle:s=0,originX:o=-this.current.e,originY:r=-this.current.f,friction:a=this.option("friction"),flipX:h=!1,flipY:c=!1,ignoreBounds:l=!1,bounce:u=this.option("bounce")}){const g=this.state;if(g===d.Init||g===d.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of f)this.velocity[t]=0;this.friction=a||0,this.ignoreBounds=l;const{current:m}=this,p=m.e,b=m.f,v=this.getMatrix(this.target);let y=(new DOMMatrix).translate(p,b).translate(o,r).translate(e,i);if(this.option("zoom")){if(!l){const t=this.targetScale,e=this.minScale,i=this.maxScale;t*ni&&(n=i/t)}y=y.scale(n)}y=y.translate(-o,-r).translate(-p,-b).multiply(v),s&&(y=y.rotate(s)),h&&(y=y.scale(-1,1)),c&&(y=y.scale(1,-1));for(const e of f)"a"!=e&&"d"!=e||!(y[e]>this.minScale+1e-5||y[e].1||"mousemove"===this.panMode||!1===u)&&!l&&this.clampTargetBounds(),this.isResting||(this.state=d.Panning,this.requestTick())}stop(t=!1){if(this.state!==d.Init&&this.state!==d.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of f)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),p(this.container,"is-scaling"),p(this.container,"is-animating"),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=d.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),b(this.container,"is-animating"),this.isScaling&&b(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(e,i=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=e,"mousemove"!==this.panMode||!e)return;if(t(this.targetScale)<=t(this.minScale))return;this.emit("mouseMove",e);const{container:n,containerRect:s,contentRect:o}=this,r=s.width,a=s.height,h=n.getBoundingClientRect(),c=(e.clientX||0)-h.left,l=(e.clientY||0)-h.top;let{contentWidth:u,contentHeight:g}=this.calculateContentDim(this.target);const d=this.option("mouseMoveFactor");d>1&&(u!==r&&(u*=d),g!==a&&(g*=d));let f=.5*(u-r)-c/r*100/100*(u-r);f+=.5*(o.right-o.left);let m=.5*(g-a)-l/a*100/100*(g-a);m+=.5*(o.bottom-o.top),this.applyChange({panX:f-this.target.e,panY:m-this.target.f,friction:i})}zoomWithWheel(t){if(this.state===d.Destroy||this.state===d.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),n=this.targetScale,s=this.maxScale,o=this.minScale;let r=n*(100+i*e)/100;rs&&n>=s?(this.wheelDelta+=Math.abs(i),r=s):(this.wheelDelta=0,r=Math.max(Math.min(r,s),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),r!==n&&this.zoomTo(r,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.maxScale-this.minScale)?"max":"fit",t)}toggleCover(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.coverScale-this.minScale)?"cover":"fit",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:n=0,event:s}={}){if(this.isContentLoading||this.state===d.Destroy)return;this.stop();const{targetScale:o}=this;let r=1;if("mousemove"===this.panMode&&(s=this.prevMouseMoveEvent||s),s){const t=this.content.getBoundingClientRect(),e=s.clientX||0,o=s.clientY||0;i=e-t.left-.5*t.width,n=o-t.top-.5*t.height}const a=this.fullScale,h=this.maxScale;let c=this.coverScale;"number"==typeof t?r=t/o:("next"===t&&(a-c<.2&&(c=a),t=o1?.15:.25:e,this.applyChange({scale:r,originX:i,originY:n,friction:e}),s&&"mousemove"===this.panMode&&this.panWithMouse(s,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const n=t.classList.contains(e);n?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(n?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:n,d:s,e:o,f:r}=t;return new DOMMatrix([e,i,n,s,o,r])}reset(t){if(this.state!==d.Init&&this.state!==d.Destroy){this.stop("current");for(const t of f)this.target[t]=v[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=d.Panning,this.requestTick())}}destroy(){this.stop(),this.state=d.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(M,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:m}),Object.defineProperty(M,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}});export{M as Panzoom}; diff --git a/dist/panzoom/panzoom.pins.esm.js b/dist/panzoom/panzoom.pins.esm.js index cdb2d3e9..4eda5b4c 100644 --- a/dist/panzoom/panzoom.pins.esm.js +++ b/dist/panzoom/panzoom.pins.esm.js @@ -1 +1 @@ -const t=(e,...s)=>{const n=s.length;for(let i=0;i{const i=Array.isArray(n)?[]:{};var r;e[s]||Object.assign(e,{[s]:i}),"object"==typeof(r=n)&&null!==r&&r.constructor===Object&&"[object Object]"===Object.prototype.toString.call(r)?Object.assign(e[s],t(i,n)):Array.isArray(n)?Object.assign(e,{[s]:[...n]}):Object.assign(e,{[s]:n})}))}return e},e=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class s{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(e){this.options=e?t({},this.constructor.defaults,e):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...s){let n=e(t,this.options);return n&&"function"==typeof n&&(n=n.call(this,this,...s)),n}optionFor(t,s,n,...i){let r=e(s,t);var o;"string"!=typeof(o=r)||isNaN(o)||isNaN(parseFloat(o))||(r=parseFloat(r)),"true"===r&&(r=!0),"false"===r&&(r=!1),r&&"function"==typeof r&&(r=r.call(this,this,t,...i));let a=e(s,this.options);return a&&"function"==typeof a?r=a.call(this,this,t,...i,r):void 0===r&&(r=a),void 0===r?n:r}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,s)=>{let n="";return s?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${s}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let s=0;se))}on(t,e){let s=[];"string"==typeof t?s=t.split(" "):Array.isArray(t)&&(s=t),this.events||(this.events=new Map),s.forEach((t=>{let s=this.events.get(t);s||(this.events.set(t,[]),s=[]),s.includes(e)||s.push(e),this.events.set(t,s)}))}off(t,e){let s=[];"string"==typeof t?s=t.split(" "):Array.isArray(t)&&(s=t),s.forEach((t=>{const s=this.events.get(t);if(Array.isArray(s)){const t=s.indexOf(e);t>-1&&s.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(s,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(s,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class n extends s{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}class i extends n{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pins",{enumerable:!0,configurable:!0,writable:!0,value:[]})}onTransform(t){for(const s of this.pins){if(!((e=s)&&null!==e&&e instanceof Element&&"nodeType"in e))continue;const{fitWidth:n,fitHeight:i,fullWidth:r,fullHeight:o}=t.contentRect,a=s.dataset.x||"",c=s.dataset.y||"";let l=0,f=0;l=a.includes("%")?n*(parseFloat(a)/100):parseFloat(a)/r*n,l-=.5*n,f=c.includes("%")?i*(parseFloat(c)/100):parseFloat(c)/o*i,f-=.5*i;const h=new DOMPoint(l,f).matrixTransform(t.getMatrix());s.style.transform=`translate3d(${h.x||0}px, ${h.y||0}px, 0)`}var e}attach(){this.pins=Array.from(this.instance.container.querySelectorAll("[data-panzoom-pin]")),this.pins.length&&(this.instance.container.classList.add("has-pins"),this.instance.on("afterTransform",this.onTransform))}detach(){this.pins=[],this.instance.container.classList.remove("has-pins"),this.instance.off("afterTransform",this.onTransform)}}Object.defineProperty(i,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});export{i as Pins}; +const t=(e,...s)=>{const n=s.length;for(let i=0;i{const i=Array.isArray(n)?[]:{};var r;e[s]||Object.assign(e,{[s]:i}),"object"==typeof(r=n)&&null!==r&&r.constructor===Object&&"[object Object]"===Object.prototype.toString.call(r)?Object.assign(e[s],t(i,n)):Array.isArray(n)?Object.assign(e,{[s]:[...n]}):Object.assign(e,{[s]:n})}))}return e},e=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class s{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(e){this.options=e?t({},this.constructor.defaults,e):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...s){let n=e(t,this.options);return n&&"function"==typeof n&&(n=n.call(this,this,...s)),n}optionFor(t,s,n,...i){let r=e(s,t);var o;"string"!=typeof(o=r)||isNaN(o)||isNaN(parseFloat(o))||(r=parseFloat(r)),"true"===r&&(r=!0),"false"===r&&(r=!1),r&&"function"==typeof r&&(r=r.call(this,this,t,...i));let a=e(s,this.options);return a&&"function"==typeof a?r=a.call(this,this,t,...i,r):void 0===r&&(r=a),void 0===r?n:r}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,s)=>{let n="";return s?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${s}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let s=0;se))}on(t,e){let s=[];"string"==typeof t?s=t.split(" "):Array.isArray(t)&&(s=t),this.events||(this.events=new Map),s.forEach((t=>{let s=this.events.get(t);s||(this.events.set(t,[]),s=[]),s.includes(e)||s.push(e),this.events.set(t,s)}))}off(t,e){let s=[];"string"==typeof t?s=t.split(" "):Array.isArray(t)&&(s=t),s.forEach((t=>{const s=this.events.get(t);if(Array.isArray(s)){const t=s.indexOf(e);t>-1&&s.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(s,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(s,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class n extends s{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}class i extends n{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pins",{enumerable:!0,configurable:!0,writable:!0,value:[]})}onTransform(t){for(const s of this.pins){if(!((e=s)&&null!==e&&e instanceof Element&&"nodeType"in e))continue;const{fitWidth:n,fitHeight:i,fullWidth:r,fullHeight:o}=t.contentRect,a=s.dataset.x||"",c=s.dataset.y||"";let l=0,f=0;l=a.includes("%")?n*(parseFloat(a)/100):parseFloat(a)/r*n,l-=.5*n,f=c.includes("%")?i*(parseFloat(c)/100):parseFloat(c)/o*i,f-=.5*i;const h=new DOMPoint(l,f).matrixTransform(t.getMatrix());s.style.transform=`translate3d(${h.x||0}px, ${h.y||0}px, 0)`}var e}attach(){this.pins=Array.from(this.instance.container.querySelectorAll("[data-panzoom-pin]")),this.pins.length&&(this.instance.container.classList.add("has-pins"),this.instance.on("afterTransform",this.onTransform))}detach(){this.pins=[],this.instance.container.classList.remove("has-pins"),this.instance.off("afterTransform",this.onTransform)}}Object.defineProperty(i,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});export{i as Pins}; diff --git a/dist/panzoom/panzoom.pins.umd.js b/dist/panzoom/panzoom.pins.umd.js index 1d727c24..c22b2286 100644 --- a/dist/panzoom/panzoom.pins.umd.js +++ b/dist/panzoom/panzoom.pins.umd.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";const e=(t,...s)=>{const n=s.length;for(let i=0;i{const i=Array.isArray(n)?[]:{};var o;t[s]||Object.assign(t,{[s]:i}),"object"==typeof(o=n)&&null!==o&&o.constructor===Object&&"[object Object]"===Object.prototype.toString.call(o)?Object.assign(t[s],e(i,n)):Array.isArray(n)?Object.assign(t,{[s]:[...n]}):Object.assign(t,{[s]:n})}))}return t},s=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class n{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?e({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let n=s(t,this.options);return n&&"function"==typeof n&&(n=n.call(this,this,...e)),n}optionFor(t,e,n,...i){let o=s(e,t);var r;"string"!=typeof(r=o)||isNaN(r)||isNaN(parseFloat(r))||(o=parseFloat(o)),"true"===o&&(o=!0),"false"===o&&(o=!1),o&&"function"==typeof o&&(o=o.call(this,this,t,...i));let a=s(e,this.options);return a&&"function"==typeof a?o=a.call(this,this,t,...i,o):void 0===o&&(o=a),void 0===o?n:o}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,s)=>{let n="";return s?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${s}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let s=0;se))}on(t,e){let s=[];"string"==typeof t?s=t.split(" "):Array.isArray(t)&&(s=t),this.events||(this.events=new Map),s.forEach((t=>{let s=this.events.get(t);s||(this.events.set(t,[]),s=[]),s.includes(e)||s.push(e),this.events.set(t,s)}))}off(t,e){let s=[];"string"==typeof t?s=t.split(" "):Array.isArray(t)&&(s=t),s.forEach((t=>{const s=this.events.get(t);if(Array.isArray(s)){const t=s.indexOf(e);t>-1&&s.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(n,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(n,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class i extends n{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}class o extends i{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pins",{enumerable:!0,configurable:!0,writable:!0,value:[]})}onTransform(t){for(const s of this.pins){if(!((e=s)&&null!==e&&e instanceof Element&&"nodeType"in e))continue;const{fitWidth:n,fitHeight:i,fullWidth:o,fullHeight:r}=t.contentRect,a=s.dataset.x||"",l=s.dataset.y||"";let c=0,f=0;c=a.includes("%")?n*(parseFloat(a)/100):parseFloat(a)/o*n,c-=.5*n,f=l.includes("%")?i*(parseFloat(l)/100):parseFloat(l)/r*i,f-=.5*i;const p=new DOMPoint(c,f).matrixTransform(t.getMatrix());s.style.transform=`translate3d(${p.x||0}px, ${p.y||0}px, 0)`}var e}attach(){this.pins=Array.from(this.instance.container.querySelectorAll("[data-panzoom-pin]")),this.pins.length&&(this.instance.container.classList.add("has-pins"),this.instance.on("afterTransform",this.onTransform))}detach(){this.pins=[],this.instance.container.classList.remove("has-pins"),this.instance.off("afterTransform",this.onTransform)}}Object.defineProperty(o,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}}),t.Pins=o})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";const e=(t,...s)=>{const n=s.length;for(let i=0;i{const i=Array.isArray(n)?[]:{};var o;t[s]||Object.assign(t,{[s]:i}),"object"==typeof(o=n)&&null!==o&&o.constructor===Object&&"[object Object]"===Object.prototype.toString.call(o)?Object.assign(t[s],e(i,n)):Array.isArray(n)?Object.assign(t,{[s]:[...n]}):Object.assign(t,{[s]:n})}))}return t},s=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class n{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?e({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let n=s(t,this.options);return n&&"function"==typeof n&&(n=n.call(this,this,...e)),n}optionFor(t,e,n,...i){let o=s(e,t);var r;"string"!=typeof(r=o)||isNaN(r)||isNaN(parseFloat(r))||(o=parseFloat(o)),"true"===o&&(o=!0),"false"===o&&(o=!1),o&&"function"==typeof o&&(o=o.call(this,this,t,...i));let a=s(e,this.options);return a&&"function"==typeof a?o=a.call(this,this,t,...i,o):void 0===o&&(o=a),void 0===o?n:o}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,s)=>{let n="";return s?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${s}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let s=0;se))}on(t,e){let s=[];"string"==typeof t?s=t.split(" "):Array.isArray(t)&&(s=t),this.events||(this.events=new Map),s.forEach((t=>{let s=this.events.get(t);s||(this.events.set(t,[]),s=[]),s.includes(e)||s.push(e),this.events.set(t,s)}))}off(t,e){let s=[];"string"==typeof t?s=t.split(" "):Array.isArray(t)&&(s=t),s.forEach((t=>{const s=this.events.get(t);if(Array.isArray(s)){const t=s.indexOf(e);t>-1&&s.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(n,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(n,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class i extends n{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}class o extends i{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pins",{enumerable:!0,configurable:!0,writable:!0,value:[]})}onTransform(t){for(const s of this.pins){if(!((e=s)&&null!==e&&e instanceof Element&&"nodeType"in e))continue;const{fitWidth:n,fitHeight:i,fullWidth:o,fullHeight:r}=t.contentRect,a=s.dataset.x||"",l=s.dataset.y||"";let c=0,f=0;c=a.includes("%")?n*(parseFloat(a)/100):parseFloat(a)/o*n,c-=.5*n,f=l.includes("%")?i*(parseFloat(l)/100):parseFloat(l)/r*i,f-=.5*i;const p=new DOMPoint(c,f).matrixTransform(t.getMatrix());s.style.transform=`translate3d(${p.x||0}px, ${p.y||0}px, 0)`}var e}attach(){this.pins=Array.from(this.instance.container.querySelectorAll("[data-panzoom-pin]")),this.pins.length&&(this.instance.container.classList.add("has-pins"),this.instance.on("afterTransform",this.onTransform))}detach(){this.pins=[],this.instance.container.classList.remove("has-pins"),this.instance.off("afterTransform",this.onTransform)}}Object.defineProperty(o,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}}),t.Pins=o})); diff --git a/dist/panzoom/panzoom.toolbar.css b/dist/panzoom/panzoom.toolbar.css index b5b7fb27..78ebdd15 100644 --- a/dist/panzoom/panzoom.toolbar.css +++ b/dist/panzoom/panzoom.toolbar.css @@ -1 +1 @@ -:root{--f-button-width: 40px;--f-button-height: 40px;--f-button-border: 0;--f-button-border-radius: 0;--f-button-color: #374151;--f-button-bg: #f8f8f8;--f-button-hover-bg: #e0e0e0;--f-button-active-bg: #d0d0d0;--f-button-shadow: none;--f-button-transition: all 0.15s ease;--f-button-transform: none;--f-button-svg-width: 20px;--f-button-svg-height: 20px;--f-button-svg-stroke-width: 1.5;--f-button-svg-fill: none;--f-button-svg-filter: none;--f-button-svg-disabled-opacity: 0.65}.f-button{display:flex;justify-content:center;align-items:center;box-sizing:content-box;position:relative;margin:0;padding:0;width:var(--f-button-width);height:var(--f-button-height);border:var(--f-button-border);border-radius:var(--f-button-border-radius);color:var(--f-button-color);background:var(--f-button-bg);box-shadow:var(--f-button-shadow);pointer-events:all;cursor:pointer;transition:var(--f-button-transition)}@media(hover: hover){.f-button:hover{color:var(--f-button-hover-color);background-color:var(--f-button-hover-bg)}}.f-button:active:not([disabled]){background-color:var(--f-button-active-bg)}.f-button svg{width:var(--f-button-svg-width);height:var(--f-button-svg-height);fill:var(--f-button-svg-fill);stroke:currentColor;stroke-width:var(--f-button-svg-stroke-width);stroke-linecap:round;stroke-linejoin:round;transform:var(--f-button-transform);filter:var(--f-button-svg-filter);pointer-events:none}.f-button[disabled]{cursor:default}.f-button[disabled] svg{opacity:var(--f-button-svg-disabled-opacity)}.f-panzoom__toolbar{display:flex;justify-content:center;flex-wrap:wrap;margin:4px;padding:0;opacity:1;transition:opacity .15s ease;z-index:1}.is-idle .panzoom__toolbar{opacity:0}[data-panzoom-action=toggleFS] g:first-child{display:flex}[data-panzoom-action=toggleFS] g:last-child{display:none}.in-fullscreen [data-panzoom-action=toggleFS] g:first-child{display:none}.in-fullscreen [data-panzoom-action=toggleFS] g:last-child{display:flex} \ No newline at end of file +:root{--f-button-width: 40px;--f-button-height: 40px;--f-button-border: 0;--f-button-border-radius: 0;--f-button-color: #374151;--f-button-bg: #f8f8f8;--f-button-hover-bg: #e0e0e0;--f-button-active-bg: #d0d0d0;--f-button-shadow: none;--f-button-transition: all 0.15s ease;--f-button-transform: none;--f-button-svg-width: 20px;--f-button-svg-height: 20px;--f-button-svg-stroke-width: 1.5;--f-button-svg-fill: none;--f-button-svg-filter: none;--f-button-svg-disabled-opacity: 0.65}.f-button{display:flex;justify-content:center;align-items:center;box-sizing:content-box;position:relative;margin:0;padding:0;width:var(--f-button-width);height:var(--f-button-height);border:var(--f-button-border);border-radius:var(--f-button-border-radius);color:var(--f-button-color);background:var(--f-button-bg);box-shadow:var(--f-button-shadow);pointer-events:all;cursor:pointer;transition:var(--f-button-transition)}@media(hover: hover){.f-button:hover{color:var(--f-button-hover-color);background-color:var(--f-button-hover-bg)}}.f-button:active:not([disabled]){background-color:var(--f-button-active-bg)}.f-button:focus-visible{outline:none}.f-button svg{width:var(--f-button-svg-width);height:var(--f-button-svg-height);fill:var(--f-button-svg-fill);stroke:currentColor;stroke-width:var(--f-button-svg-stroke-width);stroke-linecap:round;stroke-linejoin:round;transition:opacity .15s ease;transform:var(--f-button-transform);filter:var(--f-button-svg-filter);pointer-events:none}.f-button[disabled]{cursor:default}.f-button[disabled] svg{opacity:var(--f-button-svg-disabled-opacity)}.f-panzoom__toolbar{display:flex;justify-content:center;flex-wrap:wrap;margin:4px;padding:0;opacity:1;transition:opacity .15s ease;z-index:1}.is-idle .panzoom__toolbar{opacity:0}[data-panzoom-action=toggleFS] g:first-child{display:flex}[data-panzoom-action=toggleFS] g:last-child{display:none}.in-fullscreen [data-panzoom-action=toggleFS] g:first-child{display:none}.in-fullscreen [data-panzoom-action=toggleFS] g:last-child{display:flex} \ No newline at end of file diff --git a/dist/panzoom/panzoom.toolbar.esm.js b/dist/panzoom/panzoom.toolbar.esm.js index 0deec0fb..647884f8 100644 --- a/dist/panzoom/panzoom.toolbar.esm.js +++ b/dist/panzoom/panzoom.toolbar.esm.js @@ -1 +1 @@ -const t=(e,...i)=>{const n=i.length;for(let o=0;o{const o=Array.isArray(n)?[]:{};var s;e[i]||Object.assign(e,{[i]:o}),"object"==typeof(s=n)&&null!==s&&s.constructor===Object&&"[object Object]"===Object.prototype.toString.call(s)?Object.assign(e[i],t(o,n)):Array.isArray(n)?Object.assign(e,{[i]:[...n]}):Object.assign(e,{[i]:n})}))}return e},e=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class i{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(e){this.options=e?t({},this.constructor.defaults,e):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...i){let n=e(t,this.options);return n&&"function"==typeof n&&(n=n.call(this,this,...i)),n}optionFor(t,i,n,...o){let s=e(i,t);var a;"string"!=typeof(a=s)||isNaN(a)||isNaN(parseFloat(a))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...o));let r=e(i,this.options);return r&&"function"==typeof r?s=r.call(this,this,t,...o,s):void 0===s&&(s=r),void 0===s?n:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(i,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(i,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class n extends i{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const o={display:["zoomIn","zoomOut","toggle1to1","rotateCCW","rotateCW","flipX","flipY","reset","toggleFS"],items:{panLeft:{icon:'',change:{panX:-100}},panRight:{icon:'',change:{panX:100}},panUp:{icon:'',change:{panY:-100}},panDown:{icon:'',change:{panY:100}},zoomIn:{icon:'',action:"zoomIn"},zoomOut:{icon:'',action:"zoomOut"},toggle1to1:{icon:'',action:"toggleZoom"},toggleZoom:{icon:'',action:"toggleZoom"},iterateZoom:{icon:'',action:"iterateZoom"},rotateCCW:{icon:'',action:"rotateCCW"},rotateCW:{icon:'',action:"rotateCW"},flipX:{icon:'',action:"flipX"},flipY:{icon:'',action:"flipY"},fitX:{icon:'',action:"fitX"},fitY:{icon:'',action:"fitY"},reset:{icon:'',action:"reset"},toggleFS:{icon:'',action:"toggleFS"}},svgAttr:{tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"}};class s extends n{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}addItem(t){const e=this.option("items")[t];if(!e||!this.container)return;const i=document.createElement("button");i.setAttribute("title",e.title||this.instance.localize(`{{${t.toUpperCase()}}}`)),i.classList.add("f-button");const n=(o=this.instance.localize(e.icon),(new DOMParser).parseFromString(o,"text/html").body.firstChild);var o;if(n instanceof SVGElement)for(const[t,e]of Object.entries(this.option("svgAttr")))n.getAttribute(t)||n.setAttribute(t,String(e));i.appendChild(n),e.action&&(i.dataset.panzoomAction=e.action),e.change&&(i.dataset.panzoomChange=JSON.stringify(e.change)),e.click&&i.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),e&&"function"==typeof e.click&&e.click(this.instance)})),this.container.appendChild(i)}createContainer(){if(this.container)return;const t=document.createElement("div");t.classList.add("f-panzoom__toolbar"),t.dataset.selectable="true",this.instance.container.prepend(t),this.container=t;for(const t of this.option("display"))this.addItem(t);this.instance.container.classList.add("has-toolbar")}removeContainer(){this.container&&this.container.remove(),this.container=null,this.instance.container.classList.remove("has-toolbar")}attach(){this.createContainer()}detach(){this.removeContainer()}}Object.defineProperty(s,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:o});export{s as Toolbar}; +const t=(e,...i)=>{const n=i.length;for(let o=0;o{const o=Array.isArray(n)?[]:{};var s;e[i]||Object.assign(e,{[i]:o}),"object"==typeof(s=n)&&null!==s&&s.constructor===Object&&"[object Object]"===Object.prototype.toString.call(s)?Object.assign(e[i],t(o,n)):Array.isArray(n)?Object.assign(e,{[i]:[...n]}):Object.assign(e,{[i]:n})}))}return e},e=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class i{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(e){this.options=e?t({},this.constructor.defaults,e):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...i){let n=e(t,this.options);return n&&"function"==typeof n&&(n=n.call(this,this,...i)),n}optionFor(t,i,n,...o){let s=e(i,t);var a;"string"!=typeof(a=s)||isNaN(a)||isNaN(parseFloat(a))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...o));let r=e(i,this.options);return r&&"function"==typeof r?s=r.call(this,this,t,...o,s):void 0===s&&(s=r),void 0===s?n:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(i,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(i,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class n extends i{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const o={display:["zoomIn","zoomOut","toggle1to1","rotateCCW","rotateCW","flipX","flipY","reset","toggleFS"],items:{panLeft:{icon:'',change:{panX:-100}},panRight:{icon:'',change:{panX:100}},panUp:{icon:'',change:{panY:-100}},panDown:{icon:'',change:{panY:100}},zoomIn:{icon:'',action:"zoomIn"},zoomOut:{icon:'',action:"zoomOut"},toggle1to1:{icon:'',action:"toggleZoom"},toggleZoom:{icon:'',action:"toggleZoom"},iterateZoom:{icon:'',action:"iterateZoom"},rotateCCW:{icon:'',action:"rotateCCW"},rotateCW:{icon:'',action:"rotateCW"},flipX:{icon:'',action:"flipX"},flipY:{icon:'',action:"flipY"},fitX:{icon:'',action:"fitX"},fitY:{icon:'',action:"fitY"},reset:{icon:'',action:"reset"},toggleFS:{icon:'',action:"toggleFS"}},svgAttr:{tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"}};class s extends n{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}addItem(t){const e=this.option("items")[t];if(!e||!this.container)return;const i=document.createElement("button");i.setAttribute("title",e.title||this.instance.localize(`{{${t.toUpperCase()}}}`)),i.classList.add("f-button");const n=(o=this.instance.localize(e.icon),(new DOMParser).parseFromString(o,"text/html").body.firstChild);var o;if(n instanceof SVGElement)for(const[t,e]of Object.entries(this.option("svgAttr")))n.getAttribute(t)||n.setAttribute(t,String(e));i.appendChild(n),e.action&&(i.dataset.panzoomAction=e.action),e.change&&(i.dataset.panzoomChange=JSON.stringify(e.change)),e.click&&i.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),e&&"function"==typeof e.click&&e.click(this.instance)})),this.container.appendChild(i)}createContainer(){if(this.container)return;const t=document.createElement("div");t.classList.add("f-panzoom__toolbar"),t.dataset.selectable="true",this.instance.container.prepend(t),this.container=t;for(const t of this.option("display"))this.addItem(t);this.instance.container.classList.add("has-toolbar")}removeContainer(){this.container&&this.container.remove(),this.container=null,this.instance.container.classList.remove("has-toolbar")}attach(){this.createContainer()}detach(){this.removeContainer()}}Object.defineProperty(s,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:o});export{s as Toolbar}; diff --git a/dist/panzoom/panzoom.toolbar.umd.js b/dist/panzoom/panzoom.toolbar.umd.js index 330b8469..86bccf8a 100644 --- a/dist/panzoom/panzoom.toolbar.umd.js +++ b/dist/panzoom/panzoom.toolbar.umd.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";const e=(t,...i)=>{const n=i.length;for(let o=0;o{const o=Array.isArray(n)?[]:{};var s;t[i]||Object.assign(t,{[i]:o}),"object"==typeof(s=n)&&null!==s&&s.constructor===Object&&"[object Object]"===Object.prototype.toString.call(s)?Object.assign(t[i],e(o,n)):Array.isArray(n)?Object.assign(t,{[i]:[...n]}):Object.assign(t,{[i]:n})}))}return t},i=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class n{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?e({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let n=i(t,this.options);return n&&"function"==typeof n&&(n=n.call(this,this,...e)),n}optionFor(t,e,n,...o){let s=i(e,t);var a;"string"!=typeof(a=s)||isNaN(a)||isNaN(parseFloat(a))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...o));let r=i(e,this.options);return r&&"function"==typeof r?s=r.call(this,this,t,...o,s):void 0===s&&(s=r),void 0===s?n:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(n,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(n,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class o extends n{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const s={display:["zoomIn","zoomOut","toggle1to1","rotateCCW","rotateCW","flipX","flipY","reset","toggleFS"],items:{panLeft:{icon:'',change:{panX:-100}},panRight:{icon:'',change:{panX:100}},panUp:{icon:'',change:{panY:-100}},panDown:{icon:'',change:{panY:100}},zoomIn:{icon:'',action:"zoomIn"},zoomOut:{icon:'',action:"zoomOut"},toggle1to1:{icon:'',action:"toggleZoom"},toggleZoom:{icon:'',action:"toggleZoom"},iterateZoom:{icon:'',action:"iterateZoom"},rotateCCW:{icon:'',action:"rotateCCW"},rotateCW:{icon:'',action:"rotateCW"},flipX:{icon:'',action:"flipX"},flipY:{icon:'',action:"flipY"},fitX:{icon:'',action:"fitX"},fitY:{icon:'',action:"fitY"},reset:{icon:'',action:"reset"},toggleFS:{icon:'',action:"toggleFS"}},svgAttr:{tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"}};class a extends o{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}addItem(t){const e=this.option("items")[t];if(!e||!this.container)return;const i=document.createElement("button");i.setAttribute("title",e.title||this.instance.localize(`{{${t.toUpperCase()}}}`)),i.classList.add("f-button");const n=(o=this.instance.localize(e.icon),(new DOMParser).parseFromString(o,"text/html").body.firstChild);var o;if(n instanceof SVGElement)for(const[t,e]of Object.entries(this.option("svgAttr")))n.getAttribute(t)||n.setAttribute(t,String(e));i.appendChild(n),e.action&&(i.dataset.panzoomAction=e.action),e.change&&(i.dataset.panzoomChange=JSON.stringify(e.change)),e.click&&i.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),e&&"function"==typeof e.click&&e.click(this.instance)})),this.container.appendChild(i)}createContainer(){if(this.container)return;const t=document.createElement("div");t.classList.add("f-panzoom__toolbar"),t.dataset.selectable="true",this.instance.container.prepend(t),this.container=t;for(const t of this.option("display"))this.addItem(t);this.instance.container.classList.add("has-toolbar")}removeContainer(){this.container&&this.container.remove(),this.container=null,this.instance.container.classList.remove("has-toolbar")}attach(){this.createContainer()}detach(){this.removeContainer()}}Object.defineProperty(a,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:s}),t.Toolbar=a})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";const e=(t,...i)=>{const n=i.length;for(let o=0;o{const o=Array.isArray(n)?[]:{};var s;t[i]||Object.assign(t,{[i]:o}),"object"==typeof(s=n)&&null!==s&&s.constructor===Object&&"[object Object]"===Object.prototype.toString.call(s)?Object.assign(t[i],e(o,n)):Array.isArray(n)?Object.assign(t,{[i]:[...n]}):Object.assign(t,{[i]:n})}))}return t},i=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class n{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?e({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let n=i(t,this.options);return n&&"function"==typeof n&&(n=n.call(this,this,...e)),n}optionFor(t,e,n,...o){let s=i(e,t);var a;"string"!=typeof(a=s)||isNaN(a)||isNaN(parseFloat(a))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...o));let r=i(e,this.options);return r&&"function"==typeof r?s=r.call(this,this,t,...o,s):void 0===s&&(s=r),void 0===s?n:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(n,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(n,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class o extends n{constructor(t,e){super(e),Object.defineProperty(this,"instance",{enumerable:!0,configurable:!0,writable:!0,value:t})}attach(){}detach(){}}const s={display:["zoomIn","zoomOut","toggle1to1","rotateCCW","rotateCW","flipX","flipY","reset","toggleFS"],items:{panLeft:{icon:'',change:{panX:-100}},panRight:{icon:'',change:{panX:100}},panUp:{icon:'',change:{panY:-100}},panDown:{icon:'',change:{panY:100}},zoomIn:{icon:'',action:"zoomIn"},zoomOut:{icon:'',action:"zoomOut"},toggle1to1:{icon:'',action:"toggleZoom"},toggleZoom:{icon:'',action:"toggleZoom"},iterateZoom:{icon:'',action:"iterateZoom"},rotateCCW:{icon:'',action:"rotateCCW"},rotateCW:{icon:'',action:"rotateCW"},flipX:{icon:'',action:"flipX"},flipY:{icon:'',action:"flipY"},fitX:{icon:'',action:"fitX"},fitY:{icon:'',action:"fitY"},reset:{icon:'',action:"reset"},toggleFS:{icon:'',action:"toggleFS"}},svgAttr:{tabindex:"-1",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"}};class a extends o{constructor(){super(...arguments),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:null})}addItem(t){const e=this.option("items")[t];if(!e||!this.container)return;const i=document.createElement("button");i.setAttribute("title",e.title||this.instance.localize(`{{${t.toUpperCase()}}}`)),i.classList.add("f-button");const n=(o=this.instance.localize(e.icon),(new DOMParser).parseFromString(o,"text/html").body.firstChild);var o;if(n instanceof SVGElement)for(const[t,e]of Object.entries(this.option("svgAttr")))n.getAttribute(t)||n.setAttribute(t,String(e));i.appendChild(n),e.action&&(i.dataset.panzoomAction=e.action),e.change&&(i.dataset.panzoomChange=JSON.stringify(e.change)),e.click&&i.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation(),e&&"function"==typeof e.click&&e.click(this.instance)})),this.container.appendChild(i)}createContainer(){if(this.container)return;const t=document.createElement("div");t.classList.add("f-panzoom__toolbar"),t.dataset.selectable="true",this.instance.container.prepend(t),this.container=t;for(const t of this.option("display"))this.addItem(t);this.instance.container.classList.add("has-toolbar")}removeContainer(){this.container&&this.container.remove(),this.container=null,this.instance.container.classList.remove("has-toolbar")}attach(){this.createContainer()}detach(){this.removeContainer()}}Object.defineProperty(a,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:s}),t.Toolbar=a})); diff --git a/dist/panzoom/panzoom.umd.js b/dist/panzoom/panzoom.umd.js index cb83ef12..454a549d 100644 --- a/dist/panzoom/panzoom.umd.js +++ b/dist/panzoom/panzoom.umd.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";const e=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),i=function(t,e){return!(!t||t===document.body||e&&t===e)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,n=-1!==i.indexOf("hidden"),s=-1!==i.indexOf("visible");return e&&!n&&!s}(t)?t:i(t.parentElement,e))},n=(t,e,i)=>{(t=>`${t||""}`.split(" ").filter((t=>!!t)))(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))};class s{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const o={passive:!1};class r{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:n=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=n;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,o),this.element.addEventListener("touchmove",this.onMove,o),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,o)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new s(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new s(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new s(t))):[new s(t)],n=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(n.push(t),this.currentPointers[e]=t)}n.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new s(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new s(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,o),this.element.removeEventListener("touchstart",this.onTouchStart,o),this.element.removeEventListener("touchmove",this.onMove,o),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function a(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function h(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const c=(t,...e)=>{const i=e.length;for(let n=0;n{const n=Array.isArray(i)?[]:{};var s;t[e]||Object.assign(t,{[e]:n}),"object"==typeof(s=i)&&null!==s&&s.constructor===Object&&"[object Object]"===Object.prototype.toString.call(s)?Object.assign(t[e],c(n,i)):Array.isArray(i)?Object.assign(t,{[e]:[...i]}):Object.assign(t,{[e]:i})}))}return t},l=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class u{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?c({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=l(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...n){let s=l(e,t);var o;"string"!=typeof(o=s)||isNaN(o)||isNaN(parseFloat(o))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...n));let r=l(e,this.options);return r&&"function"==typeof r?s=r.call(this,this,t,...n,s):void 0===s&&(s=r),void 0===s?i:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(u,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.3"}),Object.defineProperty(u,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class g extends u{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,n]of Object.entries(t)){const t=this.option(i),s=this.plugins[i];s||!1===t?s&&!1===t&&(s.detach(),delete this.plugins[i]):e.set(i,new n(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}var d;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(d||(d={}));const f=["a","b","c","d","e","f"],m={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:{PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"}},p={a:1,b:0,c:0,d:1,e:0,f:0},b=1e5,v=1e3;let y=null,w=null;class M extends g{get isTouchDevice(){return null===w&&(w=window.matchMedia("(hover: none)").matches),w}get isMobile(){return null===y&&(y=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),y}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){return this.content instanceof HTMLImageElement&&!this.content.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of f){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var n,s;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:d.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},p)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},p)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},M.Plugins),i)),this.emit("init"),this.isContentLoading){if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const e=(s='
',(new DOMParser).parseFromString(s,"text/html").body.firstChild);t.contains(this.content)?this.spinner=(null===(n=this.content.parentElement)||void 0===n?void 0:n.insertBefore(e,this.content))||null:this.spinner=t.appendChild(e)}this.emit("beforeLoad"),this.content.addEventListener("load",this.onLoad),this.content.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===d.Init&&this.enable()}onError(){this.state!==d.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=d.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new r(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of f)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of f)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,n=i.e+t,s=i.f+e,o=this.getBounds(),{x:r,y:a}=o,h=r.min,c=r.max,l=a.min,u=a.max;let g=0,d=0;return h!==1/0&&nc&&(g=c-n),l!==1/0&&su&&(d=u-s),Math.abs(g)<.001&&(g=0),Math.abs(d)<.001&&(d=0),Object.assign(Object.assign({},o),{xDiff:g,yDiff:d,inBounds:!g&&!d})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:n,fitHeight:s,fullWidth:o,fullHeight:r}=i;let a=o,h=r;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),c=i?o:n,l=i?r:s,u=this.getMatrix(t),g=new DOMPoint(0,0).matrixTransform(u),d=new DOMPoint(0+c,0).matrixTransform(u),f=new DOMPoint(0+c,0+l).matrixTransform(u),m=new DOMPoint(0,0+l).matrixTransform(u),p=Math.abs(f.x-g.x),b=Math.abs(f.y-g.y),v=Math.abs(m.x-d.x),y=Math.abs(m.y-d.y);a=Math.max(p,v),h=Math.max(b,y)}return{contentWidth:a,contentHeight:h}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const n=i.closest("[data-panzoom-action]"),s=i.closest("[data-panzoom-change]"),o=n||s,r=o&&((a=o)&&null!==a&&a instanceof Element&&"nodeType"in a)?o.dataset:null;var a;if(r){const e=r.panzoomChange,i=r.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const h=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(h.x-this.dragStart.x)>2||Math.abs(h.y-this.dragStart.y)>2))return;this.dragStart.time=0;const c=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},l=this.option("click",t),u=this.option("dblClick",t);u?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&l&&c(l)):(this.emit("dblClick",t),t.defaultPrevented||c(u)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&l&&c(l))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(t,i,n){var s;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const o=this.content.getBoundingClientRect();if(this.dragStart={x:o.x,y:o.y,top:o.top,left:o.left,time:Date.now()},!1===this.option("touch",t))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;if(!n.length){const e=t.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(e.nodeName)||e.closest("[contenteditable]")||e.closest("[data-selectable]")||e.closest("[data-panzoom-change]")||e.closest("[data-panzoom-action]"))return!1;null===(s=window.getSelection())||void 0===s||s.removeAllRanges()}return"mousedown"===t.type&&t.preventDefault(),e(this.targetScale,1e3)===e(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(i),this.emit("touchStart",t),!0}onPointerMove(t,n,s){if(!this.isDragging)return;if(n.length<2&&this.panOnlyZoomed&&e(this.targetScale)<=e(this.minScale))return;if(this.emit("touchMove",t),t.defaultPrevented)return;this.addTrackingPoint(n[0]);const{content:o}=this,r=h(s[0],s[1]),c=h(n[0],n[1]);let l=0,u=0;if(n.length>1){const t=o.getBoundingClientRect();l=r.clientX-t.left-.5*t.width,u=r.clientY-t.top-.5*t.height}const g=a(s[0],s[1]),d=a(n[0],n[1]);let f=g?d/g:1,m=c.clientX-r.clientX,p=c.clientY-r.clientY;this.dragOffset.x+=m,this.dragOffset.y+=p,this.dragOffset.time=Date.now()-this.dragStart.time;let b=e(this.targetScale)===e(this.minScale)&&this.option("lockAxis");if(b&&!this.lockedAxis)if("xy"===b||"y"===b||"touchmove"===t.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void t.preventDefault();const e=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=e>45&&e<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,m=0,p=0}else this.lockedAxis=b;if(i(t.target,this.content)&&(b="x",this.dragOffset.y=0),b&&"xy"!==b&&this.lockedAxis!==b&&e(this.targetScale)===e(this.minScale))return;t.cancelable&&t.preventDefault(),this.container.classList.add(this.cn("isDragging"));const v=this.checkBounds(m,p);this.option("rubberband")?("x"!==this.isInfinite&&(v.xDiff>0&&m<0||v.xDiff<0&&m>0)&&(m*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*v.xDiff))),"y"!==this.isInfinite&&(v.yDiff>0&&p<0||v.yDiff<0&&p>0)&&(p*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*v.yDiff)))):(v.xDiff&&(m=0),v.yDiff&&(p=0));const y=this.targetScale,w=this.minScale,M=this.maxScale;y<.5*w&&(f=Math.max(f,w)),y>1.5*M&&(f=Math.min(f,M)),"y"===this.lockedAxis&&e(y)===e(w)&&(m=0),"x"===this.lockedAxis&&e(y)===e(w)&&(p=0),this.applyChange({originX:l,originY:u,panX:m,panY:p,scale:f,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,e,n){if(n.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(e),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),i(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==d.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of f)this.velocity[t]=0,this.target[t]=this.current[t];const{trackingPoints:t}=this,i=t[0],n=t[t.length-1];let s=0,o=0,r=0;n&&i&&(s=n.clientX-i.clientX,o=n.clientY-i.clientY,r=n.time-i.time);let a=0,h=0,c=0,l=0,u=this.option("decelFriction");const g=this.targetScale;if((gthis.maxScale+1e-5)&&(u=.35),r>0){c=Math.abs(s)>3?s/(r/30):0,l=Math.abs(o)>3?o/(r/30):0;const t=this.option("maxVelocity");t&&(c=Math.max(Math.min(c,t),-1*t),l=Math.max(Math.min(l,t),-1*t))}c&&(a=c/(1/(1-u)-1)),l&&(h=l/(1/(1-u)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&e(g)===this.minScale)&&(a=c=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&e(g)===this.minScale)&&(h=l=0);const d=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(s)),"auto"===m&&(m=parseFloat(s.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(s));const p=(this.option("transformParent")?s.parentElement:null)||s,b=p.getAttribute("style")||"";p.style.setProperty("transform","none","important"),p.style.setProperty("transition","none","important"),p.style.setProperty("animation","none","important"),s instanceof HTMLImageElement&&(p.style.width="",p.style.height=""),p.offsetHeight;const v=s.getBoundingClientRect();let y=v.width,w=v.height,M=0,P=0;if(s instanceof HTMLImageElement&&({width:y,height:w,top:M,left:P}=((t,e,i,n)=>{const s=i/n;return s>t/e?(i=t,n=t/s):(i=e*s,n=e),{width:i,height:n,top:.5*(e-n),left:.5*(t-i)}})(v.width,v.height,f,m)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:v.top-a.top+M,bottom:a.bottom-v.bottom+M,left:v.left-a.left+P,right:a.right-v.right+P,fitWidth:y,fitHeight:w,width:y,height:w,fullWidth:f,fullHeight:m}),p.style.cssText=b,s instanceof HTMLImageElement&&(p.style.width=`${y}px`,p.style.height=`${w}px`),this.setTransform(),!0!==t){let t="";Math.abs(c-o)>1&&(t+="x"),Math.abs(l-r)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(e(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===d.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const t=this.option("bounds");if("auto"!==t)return t;const{contentWidth:i,contentHeight:n}=this.calculateContentDim(this.target);let s=0,o=0,r=0,a=0;const h=this.option("infinite");if(!0===h||this.lockedAxis&&h===this.lockedAxis)s=-1/0,r=1/0,o=-1/0,a=1/0;else{let{containerRect:t,contentRect:h}=this,c=e(this.contentRect.fitWidth*this.targetScale,v),l=e(this.contentRect.fitHeight*this.targetScale,v),{innerWidth:u,innerHeight:g}=t;if(this.containerRect.width===c&&(u=t.width),this.containerRect.width===l&&(g=t.height),i>u){r=.5*(i-u),s=-1*r;let t=.5*(h.right-h.left);s+=t,r+=t}if(this.contentRect.fitWidth>u&&ig){a=.5*(n-g),o=-1*a;let t=.5*(h.bottom-h.top);o+=t,a+=t}this.contentRect.fitHeight>g&&nthis.maxScale?this.minScale:this.maxScale,toggleCover:this.targetScale>this.coverScale?this.minScale:this.coverScale,toggleZoom:this.targetScale>this.fullScale?this.minScale:this.fullScale}[this.option("click")||""]||this.minScale,o=t.canZoomIn(),r=t.canZoomOut(),a="drag"===this.panMode,h=r&&a;this.targetScale<=this.minScale&&!this.panOnlyZoomed&&(h=!0),(this.contentRect.width-this.contentRect.fitWidth>-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(h=!0),this.contentRect.width*this.targetScalethis.minScale,l=!o&&!h&&r&&e(s)===e(this.minScale);n(i,this.cn("canZoomIn"),c),n(i,this.cn("canZoomOut"),l),n(i,this.cn("isDraggable"),h);for(const t of i.querySelectorAll('[data-panzoom-action="zoomIn"]'))o?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const t of i.querySelectorAll('[data-panzoom-action="zoomOut"]'))r?(t.removeAttribute("disabled"),t.removeAttribute("tabindex")):(t.setAttribute("disabled",""),t.setAttribute("tabindex","-1"));for(const e of i.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')){o=t.targetScale.9*t.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:n=this.option("friction"),angle:s=0,originX:o=0,originY:r=0,flipX:a=!1,flipY:h=!1,ignoreBounds:c=!1}){this.state!==d.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:s,originX:o,originY:r,friction:n,flipX:a,flipY:h,ignoreBounds:c})}applyChange({panX:t=0,panY:i=0,scale:n=1,angle:s=0,originX:o=-this.current.e,originY:r=-this.current.f,friction:a=this.option("friction"),flipX:h=!1,flipY:c=!1,ignoreBounds:l=!1,bounce:u=this.option("bounce")}){if(this.state===d.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of f)this.velocity[t]=0;this.friction=a||0,this.ignoreBounds=l;const{current:g}=this,m=g.e,p=g.f,b=this.getMatrix(this.target);let y=(new DOMMatrix).translate(m,p).translate(o,r).translate(t,i);if(this.option("zoom")){if(!l){const t=this.targetScale,e=this.minScale,i=this.maxScale;t*ni&&(n=i/t)}y=y.scale(n)}y=y.translate(-o,-r).translate(-m,-p).multiply(b),s&&(y=y.rotate(s)),h&&(y=y.scale(-1,1)),c&&(y=y.scale(1,-1));for(const t of f)"a"!=t&&"d"!=t||!(y[t]>this.minScale+1e-5||y[t].1||"mousemove"===this.panMode||!1===u)&&!l&&this.clampTargetBounds(),this.isResting||(this.state=d.Panning,this.requestTick())}stop(t=!1){if(this.state!==d.Init&&this.state!==d.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of f)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=d.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls()),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(t,i=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=t,"mousemove"!==this.panMode||!t)return;if(e(this.targetScale)<=e(this.minScale))return;this.emit("mouseMove",t);const{container:n,containerRect:s,contentRect:o}=this,r=s.width,a=s.height,h=n.getBoundingClientRect(),c=(t.clientX||0)-h.left,l=(t.clientY||0)-h.top;let{contentWidth:u,contentHeight:g}=this.calculateContentDim(this.target);const d=this.option("mouseMoveFactor");d>1&&(u!==r&&(u*=d),g!==a&&(g*=d));let f=.5*(u-r)-c/r*100/100*(u-r);f+=.5*(o.right-o.left);let m=.5*(g-a)-l/a*100/100*(g-a);m+=.5*(o.bottom-o.top),this.applyChange({panX:f-this.target.e,panY:m-this.target.f,friction:i})}zoomWithWheel(t){if(this.state===d.Destroy||this.state===d.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),n=this.targetScale,s=this.maxScale,o=this.minScale;let r=n*(100+i*e)/100;rs&&n>=s?(this.wheelDelta+=Math.abs(i),r=s):(this.wheelDelta=0,r=Math.max(Math.min(r,s),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),r!==n&&this.zoomTo(r,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale>.9*this.maxScale?"fit":"max",t)}toggleCover(t){this.zoomTo(this.targetScale>.9*this.coverScale?"fit":"cover",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:n=0,event:s}={}){if(this.isContentLoading||this.state===d.Destroy)return;this.stop();const{targetScale:o}=this;let r=1;if("mousemove"===this.panMode&&(s=this.prevMouseMoveEvent||s),s){const t=this.content.getBoundingClientRect(),e=s.clientX||0,o=s.clientY||0;i=e-t.left-.5*t.width,n=o-t.top-.5*t.height}const a=this.fullScale,h=this.maxScale;let c=this.coverScale;"number"==typeof t?r=t/o:("next"===t&&(a-c<.2&&(c=a),t=o1?.15:.25:e,this.applyChange({scale:r,originX:i,originY:n,friction:e}),s&&"mousemove"===this.panMode&&this.panWithMouse(s,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const n=t.classList.contains(e);n?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(n?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:n,d:s,e:o,f:r}=t;return new DOMMatrix([e,i,n,s,o,r])}reset(t){if(this.state!==d.Init&&this.state!==d.Destroy){this.stop("current");for(const t of f)this.target[t]=p[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=d.Panning,this.requestTick())}}destroy(){this.stop(),this.state=d.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(M,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:m}),Object.defineProperty(M,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),t.Panzoom=M})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).window=t.window||{})}(this,(function(t){"use strict";const e=(t,e=1e4)=>(t=parseFloat(t+"")||0,Math.round((t+Number.EPSILON)*e)/e),i=function(t,e){return!(!t||t===document.body||e&&t===e)&&(function(t){if(!(t&&t instanceof Element&&t.offsetParent))return!1;const e=t.scrollHeight>t.clientHeight,i=window.getComputedStyle(t).overflowY,n=-1!==i.indexOf("hidden"),s=-1!==i.indexOf("visible");return e&&!n&&!s}(t)?t:i(t.parentElement,e))},n=t=>`${t||""}`.split(" ").filter((t=>!!t)),s=(t,e,i)=>{n(e).forEach((e=>{t&&t.classList.toggle(e,i||!1)}))};class o{constructor(t){Object.defineProperty(this,"pageX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pageY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nativePointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.nativePointer=t,this.pageX=t.pageX,this.pageY=t.pageY,this.clientX=t.clientX,this.clientY=t.clientY,this.id=self.Touch&&t instanceof Touch?t.identifier:-1,this.time=Date.now()}}const r={passive:!1};class a{constructor(t,{start:e=(()=>!0),move:i=(()=>{}),end:n=(()=>{})}){Object.defineProperty(this,"element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"moveCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"endCallback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"startPointers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this.element=t,this.startCallback=e,this.moveCallback=i,this.endCallback=n;for(const t of["onPointerStart","onTouchStart","onMove","onTouchEnd","onPointerEnd","onWindowBlur"])this[t]=this[t].bind(this);this.element.addEventListener("touchstart",this.onTouchStart,r),this.element.addEventListener("touchmove",this.onMove,r),this.element.addEventListener("touchend",this.onTouchEnd),this.element.addEventListener("touchcancel",this.onTouchEnd),this.element.addEventListener("mousedown",this.onPointerStart,r)}onPointerStart(t){if(!t.buttons||0!==t.button)return;const e=new o(t);this.currentPointers.some((t=>t.id===e.id))||this.triggerPointerStart(e,t)&&(window.addEventListener("mousemove",this.onMove),window.addEventListener("mouseup",this.onPointerEnd),window.addEventListener("blur",this.onWindowBlur))}onTouchStart(t){for(const e of Array.from(t.changedTouches))this.triggerPointerStart(new o(e),t);window.addEventListener("blur",this.onWindowBlur)}onMove(t){const e=this.currentPointers.slice(),i="changedTouches"in t?Array.from(t.changedTouches).map((t=>new o(t))):[new o(t)],n=[];for(const t of i){const e=this.currentPointers.findIndex((e=>e.id===t.id));e<0||(n.push(t),this.currentPointers[e]=t)}n.length&&this.moveCallback(t,this.currentPointers.slice(),e)}onPointerEnd(t){t.buttons>0&&0!==t.button||(this.triggerPointerEnd(t,new o(t)),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur))}onTouchEnd(t){for(const e of Array.from(t.changedTouches))this.triggerPointerEnd(t,new o(e))}triggerPointerStart(t,e){return!!this.startCallback(e,t,this.currentPointers.slice())&&(this.currentPointers.push(t),this.startPointers.push(t),!0)}triggerPointerEnd(t,e){const i=this.currentPointers.findIndex((t=>t.id===e.id));i<0||(this.currentPointers.splice(i,1),this.startPointers.splice(i,1),this.endCallback(t,e,this.currentPointers.slice()))}onWindowBlur(){this.clear()}clear(){for(;this.currentPointers.length;){const t=this.currentPointers[this.currentPointers.length-1];this.currentPointers.splice(this.currentPointers.length-1,1),this.startPointers.splice(this.currentPointers.length-1,1),this.endCallback(new Event("touchend",{bubbles:!0,cancelable:!0,clientX:t.clientX,clientY:t.clientY}),t,this.currentPointers.slice())}}stop(){this.element.removeEventListener("mousedown",this.onPointerStart,r),this.element.removeEventListener("touchstart",this.onTouchStart,r),this.element.removeEventListener("touchmove",this.onMove,r),this.element.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("touchcancel",this.onTouchEnd),window.removeEventListener("mousemove",this.onMove),window.removeEventListener("mouseup",this.onPointerEnd),window.removeEventListener("blur",this.onWindowBlur)}}function h(t,e){return e?Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2)):0}function c(t,e){return e?{clientX:(t.clientX+e.clientX)/2,clientY:(t.clientY+e.clientY)/2}:t}const l=(t,...e)=>{const i=e.length;for(let n=0;n{const n=Array.isArray(i)?[]:{};var s;t[e]||Object.assign(t,{[e]:n}),"object"==typeof(s=i)&&null!==s&&s.constructor===Object&&"[object Object]"===Object.prototype.toString.call(s)?Object.assign(t[e],l(n,i)):Array.isArray(i)?Object.assign(t,{[e]:[...i]}):Object.assign(t,{[e]:i})}))}return t},u=function(t,e){return t.split(".").reduce(((t,e)=>"object"==typeof t?t[e]:void 0),e)};class g{constructor(t={}){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),this.setOptions(t);for(const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))t.startsWith("on")&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}setOptions(t){this.options=t?l({},this.constructor.defaults,t):{};for(const[t,e]of Object.entries(this.option("on")||{}))this.on(t,e)}option(t,...e){let i=u(t,this.options);return i&&"function"==typeof i&&(i=i.call(this,this,...e)),i}optionFor(t,e,i,...n){let s=u(e,t);var o;"string"!=typeof(o=s)||isNaN(o)||isNaN(parseFloat(o))||(s=parseFloat(s)),"true"===s&&(s=!0),"false"===s&&(s=!1),s&&"function"==typeof s&&(s=s.call(this,this,t,...n));let r=u(e,this.options);return r&&"function"==typeof r?s=r.call(this,this,t,...n,s):void 0===s&&(s=r),void 0===s?i:s}cn(t){const e=this.options.classes;return e&&e[t]||""}localize(t,e=[]){t=String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g,((t,e,i)=>{let n="";return i?n=this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`):e&&(n=this.option(`l10n.${e}`)),n||(n=t),n}));for(let i=0;ie))}on(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),this.events||(this.events=new Map),i.forEach((t=>{let i=this.events.get(t);i||(this.events.set(t,[]),i=[]),i.includes(e)||i.push(e),this.events.set(t,i)}))}off(t,e){let i=[];"string"==typeof t?i=t.split(" "):Array.isArray(t)&&(i=t),i.forEach((t=>{const i=this.events.get(t);if(Array.isArray(i)){const t=i.indexOf(e);t>-1&&i.splice(t,1)}}))}emit(t,...e){[...this.events.get(t)||[]].forEach((t=>t(this,...e))),"*"!==t&&this.emit("*",t,...e)}}Object.defineProperty(g,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.0.4"}),Object.defineProperty(g,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:{}});class d extends g{constructor(t={}){super(t),Object.defineProperty(this,"plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}})}attachPlugins(t={}){const e=new Map;for(const[i,n]of Object.entries(t)){const t=this.option(i),s=this.plugins[i];s||!1===t?s&&!1===t&&(s.detach(),delete this.plugins[i]):e.set(i,new n(this,t||{}))}for(const[t,i]of e)this.plugins[t]=i,i.attach();this.emit("attachPlugins")}detachPlugins(){for(const t of Object.values(this.plugins))t.detach();return this.plugins={},this.emit("detachPlugins"),this}}var f;!function(t){t[t.Init=0]="Init",t[t.Error=1]="Error",t[t.Ready=2]="Ready",t[t.Panning=3]="Panning",t[t.Mousemove=4]="Mousemove",t[t.Destroy=5]="Destroy"}(f||(f={}));const m=["a","b","c","d","e","f"],p={content:null,width:"auto",height:"auto",panMode:"drag",touch:!0,dragMinThreshold:3,lockAxis:!1,mouseMoveFactor:1,mouseMoveFriction:.12,zoom:!0,pinchToZoom:!0,panOnlyZoomed:"auto",minScale:1,maxScale:2,friction:.25,dragFriction:.35,decelFriction:.05,click:"toggleZoom",dblClick:!1,wheel:"zoom",wheelLimit:7,spinner:!0,bounds:"auto",infinite:!1,rubberband:!0,bounce:!0,maxVelocity:75,transformParent:!1,classes:{content:"f-panzoom__content",isLoading:"is-loading",canZoomIn:"can-zoom_in",canZoomOut:"can-zoom_out",isDraggable:"is-draggable",isDragging:"is-dragging",inFullscreen:"in-fullscreen",htmlHasFullscreen:"with-panzoom-in-fullscreen"},l10n:{PANUP:"Move up",PANDOWN:"Move down",PANLEFT:"Move left",PANRIGHT:"Move right",ZOOMIN:"Zoom in",ZOOMOUT:"Zoom out",TOGGLEZOOM:"Toggle zoom level",TOGGLE1TO1:"Toggle zoom level",ITERATEZOOM:"Toggle zoom level",ROTATECCW:"Rotate counterclockwise",ROTATECW:"Rotate clockwise",FLIPX:"Flip horizontally",FLIPY:"Flip vertically",FITX:"Fit horizontally",FITY:"Fit vertically",RESET:"Reset",TOGGLEFS:"Toggle fullscreen"}},b=(t,e)=>{n(e).forEach((e=>{t&&t.classList.remove(e)}))},v=(t,e)=>{n(e).forEach((e=>{t&&t.classList.add(e)}))},y={a:1,b:0,c:0,d:1,e:0,f:0},w=1e5,M=1e3;let P=null,x=null;class S extends d{get isTouchDevice(){return null===x&&(x=window.matchMedia("(hover: none)").matches),x}get isMobile(){return null===P&&(P=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)),P}get panMode(){return"mousemove"!==this.options.panMode||this.isTouchDevice?"drag":"mousemove"}get panOnlyZoomed(){const t=this.options.panOnlyZoomed;return"auto"===t?this.isTouchDevice:t}get isInfinite(){return this.option("infinite")}get angle(){return 180*Math.atan2(this.current.b,this.current.a)/Math.PI||0}get targetAngle(){return 180*Math.atan2(this.target.b,this.target.a)/Math.PI||0}get scale(){const{a:t,b:e}=this.current;return Math.sqrt(t*t+e*e)||1}get targetScale(){const{a:t,b:e}=this.target;return Math.sqrt(t*t+e*e)||1}get minScale(){return this.option("minScale")||1}get fullScale(){const{contentRect:t}=this;return t.fullWidth/t.fitWidth||1}get maxScale(){return this.fullScale*(this.option("maxScale")||1)||1}get coverScale(){const{containerRect:t,contentRect:e}=this,i=Math.max(t.height/e.fitHeight,t.width/e.fitWidth)||1;return Math.min(this.fullScale,i)}get isScaling(){return Math.abs(this.targetScale-this.scale)>1e-5&&!this.isResting}get isContentLoading(){const t=this.content;return!!(t&&t instanceof HTMLImageElement)&&!t.complete}get isResting(){if(this.isBouncingX||this.isBouncingY)return!1;for(const t of m){const e="e"==t||"f"===t?.001:1e-5;if(Math.abs(this.target[t]-this.current[t])>e)return!1}return!(!this.ignoreBounds&&!this.checkBounds().inBounds)}constructor(t,e={},i={}){var n,s;if(super(e),Object.defineProperty(this,"pointerTracker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"resizeObserver",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"updateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"clickTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"rAF",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"isTicking",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"friction",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"ignoreBounds",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isBouncingY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"clicks",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"trackingPoints",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"wheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelDelta",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevWheelTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"prevMouseMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:f.Init}),Object.defineProperty(this,"isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"spinner",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"containerRect",{enumerable:!0,configurable:!0,writable:!0,value:{width:0,height:0,innerWidth:0,innerHeight:0}}),Object.defineProperty(this,"contentRect",{enumerable:!0,configurable:!0,writable:!0,value:{top:0,right:0,bottom:0,left:0,fullWidth:0,fullHeight:0,fitWidth:0,fitHeight:0,width:0,height:0}}),Object.defineProperty(this,"dragStart",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,top:0,left:0,time:0}}),Object.defineProperty(this,"dragOffset",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0,time:0}}),Object.defineProperty(this,"current",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},y)}),Object.defineProperty(this,"target",{enumerable:!0,configurable:!0,writable:!0,value:Object.assign({},y)}),Object.defineProperty(this,"velocity",{enumerable:!0,configurable:!0,writable:!0,value:{a:0,b:0,c:0,d:0,e:0,f:0}}),Object.defineProperty(this,"lockedAxis",{enumerable:!0,configurable:!0,writable:!0,value:!1}),!t)throw new Error("No Element found");if(this.container=t,this.initContent(),this.attachPlugins(Object.assign(Object.assign({},S.Plugins),i)),this.emit("init"),this.isContentLoading){const e=this.content;if(this.option("spinner")){t.classList.add(this.cn("isLoading"));const i=(s='
',(new DOMParser).parseFromString(s,"text/html").body.firstChild);t.contains(e)?this.spinner=(null===(n=e.parentElement)||void 0===n?void 0:n.insertBefore(i,e))||null:this.spinner=t.appendChild(i)}this.emit("beforeLoad"),e.addEventListener("load",this.onLoad),e.addEventListener("error",this.onError)}else queueMicrotask((()=>{this.enable()}))}initContent(){const{container:t}=this;let e=this.option("content")||t.querySelector(`.${this.cn("content")}`);if(e||(e=t.querySelector("img")||t.firstElementChild,e&&e.classList.add(this.cn("content"))),!e)throw new Error("No content found");this.content=e}onLoad(){this.spinner&&(this.spinner.remove(),this.spinner=null),this.option("spinner")&&this.container.classList.remove(this.cn("isLoading")),this.emit("afterLoad"),this.state===f.Init&&this.enable()}onError(){this.state!==f.Destroy&&(this.spinner&&(this.spinner.remove(),this.spinner=null),this.stop(),this.detachEvents(),this.state=f.Error,this.emit("error"))}attachObserver(){var t;let e=!1;this.resizeObserver||void 0===window.ResizeObserver||(this.resizeObserver=new ResizeObserver((t=>{if(e)if(Math.abs(this.containerRect.width-t[0].contentRect.width)<.1&&Math.abs(this.containerRect.height-t[0].contentRect.height)<.1)this.updateTimer=null;else{if(this.updateTimer)return;this.onResize(),this.isMobile&&(this.updateTimer=setTimeout((()=>{this.onResize(),this.updateTimer=null}),300))}else e=!0}))),null===(t=this.resizeObserver)||void 0===t||t.observe(this.container)}detachObserver(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}attachEvents(){const{container:t}=this;t.addEventListener("click",this.onClick,{passive:!1,capture:!1}),t.addEventListener("wheel",this.onWheel,{passive:!1}),this.pointerTracker=new a(t,{start:this.onPointerDown,move:this.onPointerMove,end:this.onPointerUp}),document.addEventListener("mousemove",this.onMouseMove)}detachEvents(){var t;const{container:e}=this;e.removeEventListener("click",this.onClick,{passive:!1,capture:!1}),e.removeEventListener("wheel",this.onWheel,{passive:!1}),null===(t=this.pointerTracker)||void 0===t||t.stop(),this.pointerTracker=null,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("keydown",this.onKeydown,!0),this.clickTimer&&(clearTimeout(this.clickTimer),this.clickTimer=null),this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}animate(){this.setTargetForce();const t=this.option("maxVelocity");for(const e of m)this.friction?(this.velocity[e]*=1-this.friction,t&&!this.isScaling&&(this.velocity[e]=Math.max(Math.min(this.velocity[e],t),-1*t)),this.current[e]+=this.velocity[e]):this.current[e]=this.target[e];this.setTransform(),this.setEdgeForce(),!this.isResting||this.isDragging?this.rAF=requestAnimationFrame((()=>this.animate())):this.stop("current")}setTargetForce(){for(const t of m)"e"===t&&this.isBouncingX||"f"===t&&this.isBouncingY||(this.velocity[t]=(1/(1-this.friction)-1)*(this.target[t]-this.current[t]))}checkBounds(t=0,e=0){const{current:i}=this,n=i.e+t,s=i.f+e,o=this.getBounds(),{x:r,y:a}=o,h=r.min,c=r.max,l=a.min,u=a.max;let g=0,d=0;return h!==1/0&&nc&&(g=c-n),l!==1/0&&su&&(d=u-s),Math.abs(g)<.001&&(g=0),Math.abs(d)<.001&&(d=0),Object.assign(Object.assign({},o),{xDiff:g,yDiff:d,inBounds:!g&&!d})}clampTargetBounds(){const{target:t}=this,{x:e,y:i}=this.getBounds();e.min!==1/0&&(t.e=Math.max(t.e,e.min)),e.max!==1/0&&(t.e=Math.min(t.e,e.max)),i.min!==1/0&&(t.f=Math.max(t.f,i.min)),i.max!==1/0&&(t.f=Math.min(t.f,i.max))}calculateContentDim(t=this.current){const{content:e,contentRect:i}=this,{fitWidth:n,fitHeight:s,fullWidth:o,fullHeight:r}=i;let a=o,h=r;if(this.option("zoom")||0!==this.angle){const i=!(e instanceof HTMLImageElement)&&("none"===window.getComputedStyle(e).maxWidth||"none"===window.getComputedStyle(e).maxHeight),c=i?o:n,l=i?r:s,u=this.getMatrix(t),g=new DOMPoint(0,0).matrixTransform(u),d=new DOMPoint(0+c,0).matrixTransform(u),f=new DOMPoint(0+c,0+l).matrixTransform(u),m=new DOMPoint(0,0+l).matrixTransform(u),p=Math.abs(f.x-g.x),b=Math.abs(f.y-g.y),v=Math.abs(m.x-d.x),y=Math.abs(m.y-d.y);a=Math.max(p,v),h=Math.max(b,y)}return{contentWidth:a,contentHeight:h}}setEdgeForce(){if(this.ignoreBounds||this.isDragging||"mousemove"===this.panMode||this.targetScale{const t=window.getSelection();return t&&"Range"===t.type})()&&!i.closest("button"))return;const n=i.closest("[data-panzoom-action]"),s=i.closest("[data-panzoom-change]"),o=n||s,r=o&&((a=o)&&null!==a&&a instanceof Element&&"nodeType"in a)?o.dataset:null;var a;if(r){const e=r.panzoomChange,i=r.panzoomAction;if((e||i)&&t.preventDefault(),e){let t={};try{t=JSON.parse(e)}catch(t){console&&console.warn("The given data was not valid JSON")}return void this.applyChange(t)}if(i)return void(this[i]&&this[i]())}if(Math.abs(this.dragOffset.x)>3||Math.abs(this.dragOffset.y)>3)return t.preventDefault(),void t.stopPropagation();const h=this.content.getBoundingClientRect();if(this.dragStart.time&&!this.canZoomOut()&&(Math.abs(h.x-this.dragStart.x)>2||Math.abs(h.y-this.dragStart.y)>2))return;this.dragStart.time=0;const c=e=>{!this.option("zoom")||Math.abs(this.velocity.a)>.3||e&&"string"==typeof e&&/(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e)&&"function"==typeof this[e]&&(t.preventDefault(),this[e]({event:t}))},l=this.option("click",t),u=this.option("dblClick",t);u?(this.clicks++,1==this.clicks&&(this.clickTimer=setTimeout((()=>{1===this.clicks?(this.emit("click",t),!t.defaultPrevented&&l&&c(l)):(this.emit("dblClick",t),t.defaultPrevented||c(u)),this.clicks=0,this.clickTimer=null}),350))):(this.emit("click",t),!t.defaultPrevented&&l&&c(l))}addTrackingPoint(t){const e=this.trackingPoints.filter((t=>t.time>Date.now()-100));e.push(t),this.trackingPoints=e}onPointerDown(t,i,n){var s;this.dragOffset={x:0,y:0,time:0},this.trackingPoints=[];const o=this.content.getBoundingClientRect();if(this.dragStart={x:o.x,y:o.y,top:o.top,left:o.left,time:Date.now()},!1===this.option("touch",t))return!1;if(this.clickTimer)return!1;if("mousemove"===this.panMode&&this.targetScale>1)return t.preventDefault(),t.stopPropagation(),!1;if(!n.length){const e=t.composedPath()[0];if(["A","TEXTAREA","OPTION","INPUT","SELECT","VIDEO"].includes(e.nodeName)||e.closest("[contenteditable]")||e.closest("[data-selectable]")||e.closest("[data-panzoom-change]")||e.closest("[data-panzoom-action]"))return!1;null===(s=window.getSelection())||void 0===s||s.removeAllRanges()}return"mousedown"===t.type&&t.preventDefault(),e(this.targetScale,1e3)===e(this.minScale,1e3)?(this.stop(),this.target.e=this.current.e,this.target.f=this.current.f):this.stop("target"),this.isDragging=!0,this.addTrackingPoint(i),this.emit("touchStart",t),!0}onPointerMove(t,n,s){if(!this.isDragging)return;if(n.length<2&&this.panOnlyZoomed&&e(this.targetScale)<=e(this.minScale))return;if(this.emit("touchMove",t),t.defaultPrevented)return;this.addTrackingPoint(n[0]);const{content:o}=this,r=c(s[0],s[1]),a=c(n[0],n[1]);let l=0,u=0;if(n.length>1){const t=o.getBoundingClientRect();l=r.clientX-t.left-.5*t.width,u=r.clientY-t.top-.5*t.height}const g=h(s[0],s[1]),d=h(n[0],n[1]);let f=g?d/g:1,m=a.clientX-r.clientX,p=a.clientY-r.clientY;this.dragOffset.x+=m,this.dragOffset.y+=p,this.dragOffset.time=Date.now()-this.dragStart.time;let b=e(this.targetScale)===e(this.minScale)&&this.option("lockAxis");if(b&&!this.lockedAxis)if("xy"===b||"y"===b||"touchmove"===t.type){if(Math.abs(this.dragOffset.x)<6&&Math.abs(this.dragOffset.y)<6)return void t.preventDefault();const e=Math.abs(180*Math.atan2(this.dragOffset.y,this.dragOffset.x)/Math.PI);this.lockedAxis=e>45&&e<135?"y":"x",this.dragOffset.x=0,this.dragOffset.y=0,m=0,p=0}else this.lockedAxis=b;if(i(t.target,this.content)&&(b="x",this.dragOffset.y=0),b&&"xy"!==b&&this.lockedAxis!==b&&e(this.targetScale)===e(this.minScale))return;t.cancelable&&t.preventDefault(),this.container.classList.add(this.cn("isDragging"));const v=this.checkBounds(m,p);this.option("rubberband")?("x"!==this.isInfinite&&(v.xDiff>0&&m<0||v.xDiff<0&&m>0)&&(m*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitWidth*v.xDiff))),"y"!==this.isInfinite&&(v.yDiff>0&&p<0||v.yDiff<0&&p>0)&&(p*=Math.max(0,.5-Math.abs(.75/this.contentRect.fitHeight*v.yDiff)))):(v.xDiff&&(m=0),v.yDiff&&(p=0));const y=this.targetScale,w=this.minScale,M=this.maxScale;y<.5*w&&(f=Math.max(f,w)),y>1.5*M&&(f=Math.min(f,M)),"y"===this.lockedAxis&&e(y)===e(w)&&(m=0),"x"===this.lockedAxis&&e(y)===e(w)&&(p=0),this.applyChange({originX:l,originY:u,panX:m,panY:p,scale:f,friction:this.option("dragFriction"),ignoreBounds:!0})}onPointerUp(t,e,n){if(n.length)return this.dragOffset.x=0,this.dragOffset.y=0,void(this.trackingPoints=[]);this.container.classList.remove(this.cn("isDragging")),this.isDragging&&(this.isDragging=!1,this.addTrackingPoint(e),this.panOnlyZoomed&&this.contentRect.width-this.contentRect.fitWidth<1&&this.contentRect.height-this.contentRect.fitHeight<1&&(this.trackingPoints=[]),i(t.target,this.content)&&"y"===this.lockedAxis&&(this.trackingPoints=[]),this.emit("touchEnd",t),this.state!==f.Destroy&&(t.defaultPrevented||this.startDecelAnim()))}startDecelAnim(){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of m)this.velocity[t]=0,this.target[t]=this.current[t];b(this.container,"is-scaling"),b(this.container,"is-animating"),this.isTicking=!1;const{trackingPoints:t}=this,i=t[0],n=t[t.length-1];let s=0,o=0,r=0;n&&i&&(s=n.clientX-i.clientX,o=n.clientY-i.clientY,r=n.time-i.time);let a=0,h=0,c=0,l=0,u=this.option("decelFriction");const g=this.targetScale;if((gthis.maxScale+1e-5)&&(u=.35),r>0){c=Math.abs(s)>3?s/(r/30):0,l=Math.abs(o)>3?o/(r/30):0;const t=this.option("maxVelocity");t&&(c=Math.max(Math.min(c,t),-1*t),l=Math.max(Math.min(l,t),-1*t))}c&&(a=c/(1/(1-u)-1)),l&&(h=l/(1/(1-u)-1)),("y"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"y"===this.lockedAxis&&e(g)===this.minScale)&&(a=c=0),("x"===this.option("lockAxis")||"xy"===this.option("lockAxis")&&"x"===this.lockedAxis&&e(g)===this.minScale)&&(h=l=0);const d=this.option("dragMinThreshold")||0;Math.abs(this.dragOffset.x){let e=0;return e=t instanceof HTMLImageElement?t.naturalWidth:t instanceof SVGElement?t.width.baseVal.value:t.offsetWidth,Math.max(e,t.scrollWidth)})(s)),"auto"===m&&(m=parseFloat(s.dataset.height||"")||(t=>{let e=0;return e=t instanceof HTMLImageElement?t.naturalHeight:t instanceof SVGElement?t.height.baseVal.value:t.offsetHeight,Math.max(e,t.scrollHeight)})(s));const p=(this.option("transformParent")?s.parentElement:null)||s,b=p.getAttribute("style")||"";p.style.setProperty("transform","none","important"),p.style.setProperty("transition","none","important"),p.style.setProperty("animation","none","important"),s instanceof HTMLImageElement&&(p.style.width="",p.style.height=""),p.offsetHeight;const v=s.getBoundingClientRect();let y=v.width,w=v.height,M=0,P=0;if(s instanceof HTMLImageElement&&({width:y,height:w,top:M,left:P}=((t,e,i,n)=>{const s=i/n;return s>t/e?(i=t,n=t/s):(i=e*s,n=e),{width:i,height:n,top:.5*(e-n),left:.5*(t-i)}})(v.width,v.height,d,m)),this.contentRect=Object.assign(Object.assign({},this.contentRect),{top:v.top-a.top+M,bottom:a.bottom-v.bottom+M,left:v.left-a.left+P,right:a.right-v.right+P,fitWidth:y,fitHeight:w,width:y,height:w,fullWidth:d,fullHeight:m}),p.style.cssText=b,s instanceof HTMLImageElement&&(p.style.width=`${y}px`,p.style.height=`${w}px`),this.setTransform(),!0!==t){let t="";Math.abs(c-o)>1&&(t+="x"),Math.abs(l-r)>1&&(t+="y"),t&&this.emit("refresh",t)}this.ignoreBounds||(e(this.targetScale)this.maxScale?this.zoomTo(this.maxScale,{friction:0}):this.state===f.Init||this.checkBounds().inBounds||this.requestTick()),this.updateControls()}getBounds(){const t=this.option("bounds");if("auto"!==t)return t;const{contentWidth:i,contentHeight:n}=this.calculateContentDim(this.target);let s=0,o=0,r=0,a=0;const h=this.option("infinite");if(!0===h||this.lockedAxis&&h===this.lockedAxis)s=-1/0,r=1/0,o=-1/0,a=1/0;else{let{containerRect:t,contentRect:h}=this,c=e(this.contentRect.fitWidth*this.targetScale,M),l=e(this.contentRect.fitHeight*this.targetScale,M),{innerWidth:u,innerHeight:g}=t;if(this.containerRect.width===c&&(u=t.width),this.containerRect.width===l&&(g=t.height),i>u){r=.5*(i-u),s=-1*r;let t=.5*(h.right-h.left);s+=t,r+=t}if(this.contentRect.fitWidth>u&&ig){a=.5*(n-g),o=-1*a;let t=.5*(h.bottom-h.top);o+=t,a+=t}this.contentRect.fitHeight>g&&n-1||this.contentRect.height-this.contentRect.fitHeight>-1)&&(h=!0),this.contentRect.width*this.targetScalee(this.targetScale),l=!c&&!h&&r&&e(n).9*t.fullScale?"none":"")}}panTo({x:t=this.target.e,y:e=this.target.f,scale:i=this.targetScale,friction:n=this.option("friction"),angle:s=0,originX:o=0,originY:r=0,flipX:a=!1,flipY:h=!1,ignoreBounds:c=!1}){this.state!==f.Destroy&&this.applyChange({panX:t-this.target.e,panY:e-this.target.f,scale:i/this.targetScale,angle:s,originX:o,originY:r,friction:n,flipX:a,flipY:h,ignoreBounds:c})}applyChange({panX:t=0,panY:i=0,scale:n=1,angle:s=0,originX:o=-this.current.e,originY:r=-this.current.f,friction:a=this.option("friction"),flipX:h=!1,flipY:c=!1,ignoreBounds:l=!1,bounce:u=this.option("bounce")}){const g=this.state;if(g===f.Init||g===f.Destroy)return;this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const t of m)this.velocity[t]=0;this.friction=a||0,this.ignoreBounds=l;const{current:d}=this,p=d.e,b=d.f,v=this.getMatrix(this.target);let y=(new DOMMatrix).translate(p,b).translate(o,r).translate(t,i);if(this.option("zoom")){if(!l){const t=this.targetScale,e=this.minScale,i=this.maxScale;t*ni&&(n=i/t)}y=y.scale(n)}y=y.translate(-o,-r).translate(-p,-b).multiply(v),s&&(y=y.rotate(s)),h&&(y=y.scale(-1,1)),c&&(y=y.scale(1,-1));for(const t of m)"a"!=t&&"d"!=t||!(y[t]>this.minScale+1e-5||y[t].1||"mousemove"===this.panMode||!1===u)&&!l&&this.clampTargetBounds(),this.isResting||(this.state=f.Panning,this.requestTick())}stop(t=!1){if(this.state!==f.Init&&this.state!==f.Destroy){this.rAF&&(cancelAnimationFrame(this.rAF),this.rAF=null),this.isBouncingX=!1,this.isBouncingY=!1;for(const e of m)this.velocity[e]=0,"current"===t?this.current[e]=this.target[e]:"target"===t&&(this.target[e]=this.current[e]);this.setTransform(),this.isTicking&&(this.emit("endAnimation"),this.updateControls()),b(this.container,"is-scaling"),b(this.container,"is-animating"),this.isTicking=!1,this.isDragging=!1,this.lockedAxis=!1,this.state=f.Ready}}requestTick(){this.isTicking||(this.emit("startAnimation"),this.updateControls(),v(this.container,"is-animating"),this.isScaling&&v(this.container,"is-scaling")),this.isTicking=!0,this.rAF||(this.rAF=requestAnimationFrame((()=>this.animate())))}panWithMouse(t,i=this.option("mouseMoveFriction")){if(this.prevMouseMoveEvent=t,"mousemove"!==this.panMode||!t)return;if(e(this.targetScale)<=e(this.minScale))return;this.emit("mouseMove",t);const{container:n,containerRect:s,contentRect:o}=this,r=s.width,a=s.height,h=n.getBoundingClientRect(),c=(t.clientX||0)-h.left,l=(t.clientY||0)-h.top;let{contentWidth:u,contentHeight:g}=this.calculateContentDim(this.target);const d=this.option("mouseMoveFactor");d>1&&(u!==r&&(u*=d),g!==a&&(g*=d));let f=.5*(u-r)-c/r*100/100*(u-r);f+=.5*(o.right-o.left);let m=.5*(g-a)-l/a*100/100*(g-a);m+=.5*(o.bottom-o.top),this.applyChange({panX:f-this.target.e,panY:m-this.target.f,friction:i})}zoomWithWheel(t){if(this.state===f.Destroy||this.state===f.Init)return;const e=Math.abs(t.deltaY)<100&&Math.abs(t.deltaX)<100?25:50,i=Math.max(-1,Math.min(1,-t.deltaY||-t.deltaX||-t.detail)),n=this.targetScale,s=this.maxScale,o=this.minScale;let r=n*(100+i*e)/100;rs&&n>=s?(this.wheelDelta+=Math.abs(i),r=s):(this.wheelDelta=0,r=Math.max(Math.min(r,s),o)),this.wheelDelta>this.option("wheelLimit")||(t.preventDefault(),r!==n&&this.zoomTo(r,{event:t}))}canZoomIn(){return this.option("zoom")&&(this.contentRect.widththis.minScale+1e-5}zoomIn(t=1.25,e){this.zoomTo(this.targetScale*t,e)}zoomOut(t=.8,e){this.zoomTo(this.targetScale*t,e)}zoomToFit(t){this.zoomTo("fit",t)}zoomToCover(t){this.zoomTo("cover",t)}zoomToFull(t){this.zoomTo("full",t)}zoomToMax(t){this.zoomTo("max",t)}toggleZoom(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.fullScale-this.minScale)?"full":"fit",t)}toggleMax(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.maxScale-this.minScale)?"max":"fit",t)}toggleCover(t){this.zoomTo(this.targetScale-this.minScale<.5*(this.coverScale-this.minScale)?"cover":"fit",t)}iterateZoom(t){this.zoomTo("next",t)}zoomTo(t=1,{friction:e="auto",originX:i=0,originY:n=0,event:s}={}){if(this.isContentLoading||this.state===f.Destroy)return;this.stop();const{targetScale:o}=this;let r=1;if("mousemove"===this.panMode&&(s=this.prevMouseMoveEvent||s),s){const t=this.content.getBoundingClientRect(),e=s.clientX||0,o=s.clientY||0;i=e-t.left-.5*t.width,n=o-t.top-.5*t.height}const a=this.fullScale,h=this.maxScale;let c=this.coverScale;"number"==typeof t?r=t/o:("next"===t&&(a-c<.2&&(c=a),t=o1?.15:.25:e,this.applyChange({scale:r,originX:i,originY:n,friction:e}),s&&"mousemove"===this.panMode&&this.panWithMouse(s,e)}rotateCCW(){this.applyChange({angle:-90})}rotateCW(){this.applyChange({angle:90})}flipX(){this.applyChange({flipX:!0})}flipY(){this.applyChange({flipY:!0})}fitX(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.width/e.fitWidth/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}fitY(){this.stop("target");const{containerRect:t,contentRect:e,target:i}=this;this.applyChange({panX:.5*t.width-(e.left+.5*e.fitWidth)-i.e,panY:.5*t.height-(e.top+.5*e.fitHeight)-i.f,scale:t.height/e.fitHeight/this.targetScale,originX:0,originY:0,ignoreBounds:!0})}toggleFS(){const{container:t}=this,e=this.cn("inFullscreen"),i=this.cn("htmlHasFullscreen");t.classList.toggle(e);const n=t.classList.contains(e);n?(document.documentElement.classList.add(i),document.addEventListener("keydown",this.onKeydown,!0)):(document.documentElement.classList.remove(i),document.removeEventListener("keydown",this.onKeydown,!0)),this.updateMetrics(),this.emit(n?"enterFS":"exitFS")}getMatrix(t=this.current){const{a:e,b:i,c:n,d:s,e:o,f:r}=t;return new DOMMatrix([e,i,n,s,o,r])}reset(t){if(this.state!==f.Init&&this.state!==f.Destroy){this.stop("current");for(const t of m)this.target[t]=y[t];this.target.a=this.minScale,this.target.d=this.minScale,this.isResting||(this.friction=void 0===t?this.option("friction"):t,this.state=f.Panning,this.requestTick())}}destroy(){this.stop(),this.state=f.Destroy,this.detachEvents(),this.detachObserver();const{container:t,content:e}=this,i=this.option("classes")||{};for(const e of Object.values(i))t.classList.remove(e+"");e&&(e.removeEventListener("load",this.onLoad),e.removeEventListener("error",this.onError)),this.detachPlugins()}}Object.defineProperty(S,"defaults",{enumerable:!0,configurable:!0,writable:!0,value:p}),Object.defineProperty(S,"Plugins",{enumerable:!0,configurable:!0,writable:!0,value:{}}),t.Panzoom=S})); diff --git a/package.json b/package.json index 1534cb87..4ef895f7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fancyapps/ui", - "version": "5.0.3", + "version": "5.0.4", "description": "Robust JavaScript UI Component Library", "files": [ "dist", @@ -8,15 +8,9 @@ "LICENSE.md", "README.md" ], - "type": "module", - "main": "./dist/index.esm.js", - "exports": { - ".": { - "import": "./dist/index.esm.js", - "require": "./dist/index.umd.js" - } - }, - "types": "./types/index.d.ts", + "main": "dist/index.umd.js", + "module": "dist/index.esm.js", + "types": "types/index.d.ts", "keywords": [ "javascript", "modal",