react-material-overlay
Version:
A fully featured Material UI implementation of overlays like modals, alert dialogs, lightboxes, and bottom sheets featuring easy stack management and browser history integration
1 lines • 250 kB
JavaScript
import{Mutex as e}from"async-mutex";import*as t from"react";import n,{isValidElement as r,createElement as o,useLayoutEffect as i,useEffect as a,useState as s,useCallback as c,useRef as l,useMemo as u,useImperativeHandle as d,forwardRef as f,useDebugValue as h}from"react";import{mergeWith as p,isFunction as v,merge as m,omitBy as y,isNull as g}from"lodash";import b from"clsx";import{jsx as _,jsxs as w,Fragment as x}from"react/jsx-runtime";import{Slide as E,Zoom as S,Grow as k,Collapse as O,Fade as P,Box as C,Typography as I,Button as N,Dialog as T,DialogTitle as R,DialogContent as D,DialogActions as M,IconButton as A,CardHeader as L,GlobalStyles as z,useTheme as j,alpha as F}from"@mui/material";import{Global as V,css as B,CacheProvider as H}from"@emotion/react";import{createPortal as W}from"react-dom";import $ from"@emotion/cache";const G=e=>"number"==typeof e&&!isNaN(e),q=e=>"string"==typeof e,X=e=>"function"==typeof e,Z=e=>q(e)||G(e);function U(e){return!!e&&"object"==typeof e&&"current"in e}const Y=e=>r(e)||q(e)||X(e)||G(e);let K=1;const J=new Map,Q=[],ee=new e;function te(e,t=!1){t||J.get(e)?.(),J.delete(e)}async function ne(e=1){return new Promise((t=>{window.addEventListener("popstate",(function e(n){(n.state?.rmoStackLength||0)===Q.length&&(window.removeEventListener("popstate",e),t())})),window.history.go(-e)}))}"undefined"!=typeof window&&function(){const e=window.history.state?.rmoStackLength;G(e)&&e>0&&window.history.go(-e),window.addEventListener("popstate",(e=>{ee.isLocked()||(e.state?.rmoStackLength||0)<Q.length&&ee.runExclusive((()=>{const e=Q.pop();e&&te(e)}))}))}();const re={push:async e=>ee.runExclusive((()=>{const t=e.id&&Z(e.id)?e.id:""+K++;if(Q.some((e=>e===t)))throw new Error(`The push request is duplicate with id: ${t}. \n Each push must be made with a unique id.`);return Q.push(t),J.set(t,e.onPopState),window.history.pushState({...window.history.state,rmoStackLength:Q.length},""),{id:t,index:Q.length-1}})),pop:(e,t)=>ee.runExclusive((async()=>{G(e)?(e<2&&console.warn("for multiple pops, count must be at least 2, otherwise use pop without count parameter."),await async function(e,t=!1){const n=Q.splice(-Math.abs(e));0!==n.length&&(n.forEach((e=>te(e,t))),await ne(n.length))}(e,t)):await async function(e){const t=Q.at(-1);!t||e?.id&&e.id!==t||(Q.pop(),te(t,e?.preventEventTriggering),await ne())}(e)})),flush:async(e=!1)=>ee.runExclusive((async()=>{const t=Q.splice(0);0!==t.length&&(t.forEach((t=>te(t,e))),await ne(t.length))})),findIndexById:e=>Q.indexOf(e),get length(){return Q.length}};function oe(){return re.flush()}function ie(e){return re.pop(e)}let ae=1;var se;!function(e){e[e.CONTAINER_ID=1]="CONTAINER_ID"}(se||(se={}));var ce=Object.freeze({__proto__:null,get Default(){return se}});function le(e,t){return p({},e,t,((e,t,r)=>U(t)||n.isValidElement(t)||X(t)?t:"sx"===r&&e&&t&&(v(e)||v(t))?n=>m({},v(e)?e(n):e??{},v(t)?t(n):t??{}):void 0))}function ue(e,t){const n={};for(const t in e)t in e&&(n[t]=e[t]);for(const e in t)e in t&&(n[e]=n[e]?`${n[e]} ${t[e]}`:t[e]);return n}function de(e,t){let n=0,r=[],o=[],i=t;const a=new Map,s=new Set,c=()=>{o=Array.from(a.values()),s.forEach((e=>e()))};const l=()=>{r=r.slice(0,-1),c()};return{id:e,defaultOptions:i,observe:e=>(s.add(e),()=>s.delete(e)),pushAlertDialog:async e=>{const{alertDialogId:t,onOpen:n}=e;a.set(t,e),r=[...r,t],c(),X(n)&&n()},popAlertDialog:l,get alertDialogCount(){return n},buildAlertDialog:t=>{if(a.has(t.alertDialogId))throw new Error("alert dialog is duplicated!");const{alertDialogId:o}=t;n++;const{classes:s,...u}=i,{classes:d,...f}=t,h={...le(u,y(f,g)),alertDialogId:o,containerId:e,closeAlertDialog:async()=>{(function(e){return r.at(-1)!==e})(o)||(l(),await re.pop({id:o,preventEventTriggering:!0}))},deleteAlertDialog(){const e=a.get(o),{onClose:t}=e;X(t)&&t(),a.delete(o),n--,n<0&&(n=0),c()}};return X(d)?h.classes=d(s):h.classes=s&&d?ue(s,d):s||d,h},setDefaultOptions(e){i=e},isAlertDialogActive:e=>r.some((t=>t===e)),getSnapshot:()=>o}}const fe=new Map;function he(e,t){if(t)return!!fe.get(t)?.isAlertDialogActive(e);let n=!1;return fe.forEach((t=>{t.isAlertDialogActive(e)&&(n=!0)})),n}function pe(e){if(!(fe.size>0))throw new Error("there is no container for push new alert dialog!");const t=e.containerId||se.CONTAINER_ID,n=fe.get(t);if(!n)throw new Error(`there is no container with id: ${t} for push new alert dialog!`);return n.buildAlertDialog(e)}function ve(e){return e&&Z(e.alertDialogId)?e.alertDialogId:"ad_"+ae++}async function me(e){try{const t=function(e){return{...e,alertDialogId:ve(e)}}(e),n=pe(t);return await re.push({id:t.alertDialogId,onPopState:()=>function(e=se.CONTAINER_ID){fe.get(e)?.popAlertDialog()}(e?.containerId)}),function(e){fe.get(e.containerId)?.pushAlertDialog(e)}(n),t.alertDialogId}catch(e){return console.error(e),null}}let ye=1;function ge(e,t){let r=0,o=[],i=[],a=t;const s=new Map,c=new Set,l=()=>{i=Array.from(s.values()),c.forEach((e=>e()))};const u=()=>{o=o.slice(0,-1),l()};return{id:e,defaultOptions:a,observe:e=>(c.add(e),()=>c.delete(e)),popBottomSheet:u,pushBottomSheet:async e=>{const{bottomSheetId:t,onOpen:n}=e.props;s.set(t,e),o=[...o,t],l(),X(n)&&n()},get bottomSheetCount(){return r},buildBottomSheet:(t,i)=>{if(s.has(i.bottomSheetId))throw new Error("bottom sheet is duplicated!");const{bottomSheetId:c}=i,d=async()=>{(function(e){return o.at(-1)!==e})(c)||(u(),await re.pop({id:c,preventEventTriggering:!0}))};r++;const{className:f,footer:h,header:p,sibling:v,closeButton:m,..._}=a,{className:w,footer:x,sibling:E,header:S,closeButton:k,...O}=i,P={...le(_,y(O,g)),bottomSheetId:c,containerId:e,closeBottomSheet:d,deleteBottomSheet(){const e=s.get(c),{onClose:t}=e.props;X(t)&&t(),s.delete(c),r--,r<0&&(r=0),l()}};X(w)?P.className=w(f):P.className=f&&w?b(f,w):f||w;const C={closeBottomSheet:d,bottomSheetProps:P};P.closeButton=m,!1===k||Y(k)?P.closeButton=k:!0===k&&(P.closeButton=!Y(m)||m),P.header=p,!1===S||Y(S)?P.header=S:!0===S&&(P.header=!Y(p)||p);let I=h;(!1===x||Y(x))&&(I=x),I&&(X(I)?P.footer=I(C):n.isValidElement(I)&&(P.footer=n.cloneElement(I,C)));let N=v;(!1===E||Y(E))&&(N=E),N&&(X(N)?P.sibling=N(C):n.isValidElement(N)&&(P.sibling=n.cloneElement(N,C)));let T=t;n.isValidElement(t)&&!q(t.type)?T=n.cloneElement(t,C):X(t)&&(T=t(C));return{content:T,props:P}},setDefaultOptions(e){a=e},isBottomSheetActive:e=>o.some((t=>t===e)),getSnapshot:()=>i}}const be=new Map;function _e(e,t){if(t)return!!be.get(t)?.isBottomSheetActive(e);let n=!1;return be.forEach((t=>{t.isBottomSheetActive(e)&&(n=!0)})),n}function we(e,t){if(!Y(e))throw new Error("bottom sheet contnet can not be rendered!");if(!(be.size>0))throw new Error("there is no container for push new bottom sheet!");const n=t.containerId||se.CONTAINER_ID,r=be.get(n);if(!r)throw new Error(`there is no container with id: ${n} for push new bottom sheet!`);return r.buildBottomSheet(e,t)}function xe(e){return e&&Z(e.bottomSheetId)?e.bottomSheetId:"bs_"+ye++}async function Ee(e,t){try{const n=function(e){return{...e,bottomSheetId:xe(e)}}(t),r=we(e,n);return await re.push({id:n.bottomSheetId,onPopState:()=>function(e=se.CONTAINER_ID){be.get(e)?.popBottomSheet()}(t?.containerId)}),function(e){be.get(e.props.containerId)?.pushBottomSheet(e)}(r),n.bottomSheetId}catch(e){return console.error(e),null}}function Se(e,t){let n=0,r=[],o=[],i=t;const a=new Map,s=new Set,c=()=>{o=Array.from(a.values()),s.forEach((e=>e()))};const l=()=>{r=r.slice(0,-1),c()};return{id:e,defaultOptions:i,observe:e=>(s.add(e),()=>s.delete(e)),pushLightbox:async e=>{const{lightboxId:t,onOpen:n}=e;a.set(t,e),r=[...r,t],c(),X(n)&&n()},popLightbox:l,get alertDialogCount(){return n},buildLightbox:t=>{if(a.has(t.lightboxId))throw new Error("lightbox is already opened!");const{lightboxId:o}=t;n++;const{className:s,styles:u,...d}=i,{className:f,styles:h,...p}=t,v={...le(d,y(p,g)),lightboxId:o,containerId:e,closeLightbox:async()=>{(function(e){return r.at(-1)!==e})(o)||(l(),await re.pop({id:o,preventEventTriggering:!0}))},deleteLightbox(){const e=a.get(o),{onClose:t}=e;X(t)&&t(),a.delete(o),n--,n<0&&(n=0),c()}};return X(f)?v.className=f(s):v.className=s&&f?b(s,f):s||f,v.styles=u&&h?e=>m({},X(u)?u(e):u,X(h)?h(e):h):h||u,v},setDefaultOptions(e){i=e},isLightboxActive:e=>r.some((t=>t===e)),getSnapshot:()=>o}}const ke=new Map;function Oe(e,t){if(t)return!!ke.get(t)?.isLightboxActive(e);let n=!1;return ke.forEach((t=>{t.isLightboxActive(e)&&(n=!0)})),n}function Pe(e){if(!(ke.size>0))throw new Error("there is no container for push new lightbox!");const t=e.containerId||se.CONTAINER_ID,n=ke.get(t);if(!n)throw new Error(`there is no container with id: ${t} for push new lightbox!`);return n.buildLightbox(e)}function Ce(e){return e&&Z(e.lightboxId)?e.lightboxId:"lightbox-overlay"}async function Ie(e){try{const t=function(e){return{...e,lightboxId:Ce(e)}}(e),n=Pe(t);return await re.push({id:t.lightboxId,onPopState:()=>function(e=se.CONTAINER_ID){ke.get(e)?.popLightbox()}(e?.containerId)}),function(e){ke.get(e.containerId)?.pushLightbox(e)}(n),t.lightboxId}catch(e){return console.error(e),null}}let Ne=1;function Te(e,t){let r=0,o=[],i=[],a=t;const s=new Map,c=new Set,l=()=>{i=Array.from(s.values()),c.forEach((e=>e()))};const u=()=>{o=o.slice(0,-1),l()};return{id:e,defaultOptions:a,observe:e=>(c.add(e),()=>c.delete(e)),popModal:u,pushModal:e=>{const{modalId:t,onOpen:n}=e.props;s.set(t,e),o=[...o,t],l(),X(n)&&n()},get modalCount(){return r},buildModal:(t,i)=>{if(s.has(i.modalId))throw new Error("modal is duplicated!");const{modalId:c}=i,d=async()=>{(function(e){return o.at(-1)!==e})(c)||(u(),await re.pop({id:c,preventEventTriggering:!0}))};r++;const{classes:f,closeButton:h,header:p,closeButtonIcon:v,contentWrapper:m,...b}=a,{classes:_,closeButton:w,header:x,closeButtonIcon:E,contentWrapper:S,...k}=i,O={...le(b,y(k,g)),modalId:c,containerId:e,closeModal:d,deleteModal(){const e=s.get(c),{onClose:t}=e.props;X(t)&&t(),s.delete(c),r--,r<0&&(r=0),l()}};X(_)?O.classes=_(f):O.classes=f&&_?ue(f,_):f||_,O.closeButton=h,!1===w||Y(w)?O.closeButton=w:!0===w&&(O.closeButton=!Y(h)||h),O.closeButtonIcon=E||v,O.header=p,!1===x||Y(x)?O.header=x:!0===x&&(O.header=!Y(p)||p),O.contentWrapper=m,!1===S||Y(S)?O.contentWrapper=S:!0===S&&(O.contentWrapper=!Y(m)||m);let P=t;n.isValidElement(t)&&!q(t.type)?P=n.cloneElement(t,{closeModal:d,modalProps:O}):X(t)&&(P=t({closeModal:d,modalProps:O}));return{content:P,props:O}},setDefaultOptions(e){a=e},isModalActive:e=>o.some((t=>t===e)),getSnapshot:()=>i}}const Re=new Map;function De(e,t){if(t)return!!Re.get(t)?.isModalActive(e);let n=!1;return Re.forEach((t=>{t.isModalActive(e)&&(n=!0)})),n}function Me(e,t){if(!Y(e))throw new Error("modal contnet can not be rendered!");if(!(Re.size>0))throw new Error("there is no container for push new modal!");const n=t.containerId||se.CONTAINER_ID,r=Re.get(n);if(!r)throw new Error(`there is no container with id: ${n} for push new modal!`);return r.buildModal(e,t)}function Ae(e){return e&&Z(e.modalId)?e.modalId:"m_"+Ne++}async function Le(e,t){try{const n=function(e){return{...e,modalId:Ae(e)}}(t),r=Me(e,n);return await re.push({id:n.modalId,onPopState:()=>function(e=se.CONTAINER_ID){Re.get(e)?.popModal()}(t?.containerId)}),function(e){Re.get(e.props.containerId)?.pushModal(e)}(r),n.modalId}catch(e){return console.error(e),null}}function ze(e){const{subscribe:t,getSnapshot:r,setDefaultOptions:o}=n.useRef(function({defaultOptions:e,containerId:t}){const n=t||se.CONTAINER_ID;return{subscribe(t){const r=de(n,e);fe.set(n,r);const o=r.observe(t);return()=>{o(),fe.delete(n)}},setDefaultOptions(e){fe.get(n)?.setDefaultOptions(e)},getSnapshot:()=>fe.get(n)?.getSnapshot()}}(e)).current;o(e.defaultOptions);return{alertDialogList:n.useSyncExternalStore(t,r,r)||[],isAlertDialogActive:he}}function je(e){const{subscribe:t,getSnapshot:r,setDefaultOptions:o}=n.useRef(function({defaultOptions:e,containerId:t}){const n=t||se.CONTAINER_ID;return{subscribe(t){const r=ge(n,e);be.set(n,r);const o=r.observe(t);return()=>{o(),be.delete(n)}},setDefaultOptions(e){be.get(n)?.setDefaultOptions(e)},getSnapshot:()=>be.get(n)?.getSnapshot()}}(e)).current;o(e.defaultOptions);return{bottomSheetList:n.useSyncExternalStore(t,r,r)||[],isBottomSheetActive:_e}}const Fe="carousel",Ve="controller",Be="portal",He="toolbar",We="captions",$e="fullscreen",Ge="slideshow",qe="thumbnails",Xe="zoom",Ze="loading",Ue="playing",Ye="error",Ke="complete",Je=e=>`active-slide-${e}`,Qe=Je(Ze),et=Je(Ue),tt=Je(Ye),nt=Je(Ke),rt="fullsize",ot="flex_center",it="no_scroll_padding",at="slide",st="slide_wrapper",ct="prev",lt="next",ut="swipe",dt="close",ft="onPointerDown",ht="onPointerMove",pt="onPointerUp",vt="onPointerLeave",mt="onPointerCancel",yt="onKeyDown",gt="onWheel",bt="icon",_t="contain",wt="cover",xt="Unknown action type",Et="yarl__";function St(...e){return[...e].filter(Boolean).join(" ")}function kt(e){return`${Et}${e}`}function Ot(e){return`--${Et}${e}`}function Pt(e,t){return`${e}${t?`_${t}`:""}`}function Ct(e){return t=>Pt(e,t)}function It(...e){return()=>{e.forEach((e=>{e()}))}}function Nt(e,n,r){return()=>{const o=t.useContext(r);if(!o)throw new Error(`${e} must be used within a ${n}.Provider`);return o}}function Tt(){return"undefined"!=typeof window}function Rt(e,t=0){const n=10**t;return Math.round((e+Number.EPSILON)*n)/n}function Dt(e){return void 0===e.type||"image"===e.type}function Mt(e,t){return e.imageFit===wt||e.imageFit!==_t&&t===wt}function At(e){return"string"==typeof e?Number.parseInt(e,10):e}function Lt(e){if("number"==typeof e)return{pixel:e};if("string"==typeof e){const t=At(e);return e.endsWith("%")?{percent:t}:{pixel:t}}return{pixel:0}}function zt(e,t){const n=Lt(t),r=void 0!==n.percent?e.width/100*n.percent:n.pixel;return{width:Math.max(e.width-2*r,0),height:Math.max(e.height-2*r,0)}}function jt(e,t){return t>0?(e%t+t)%t:0}function Ft(e){return e.length>0}function Vt(e,t){return e[jt(t,e.length)]}function Bt(e,t){return Ft(e)?Vt(e,t):void 0}function Ht(e){return Dt(e)?e.src:void 0}function Wt(e,n,r){if(!r)return e;const{buttons:o,...i}=e,a=o.findIndex((e=>e===n)),s=t.isValidElement(r)?t.cloneElement(r,{key:n},null):r;if(a>=0){const e=[...o];return e.splice(a,1,s),{buttons:e,...i}}return{buttons:[s,...o],...i}}function $t(e,t,n=0){return Math.min(e.preload,Math.max(e.finite?t.length-1:Math.floor(t.length/2),n))}const Gt=Number(t.version.split(".")[0])>=19;function qt(e){e.scrollTop}const Xt={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[dt]},labels:{},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},carousel:{finite:!1,preload:2,padding:"16px",spacing:"30%",imageFit:_t,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,preventDefaultWheelX:!0,preventDefaultWheelY:!1,disableSwipeNavigation:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function Zt(e,t){return{name:e,component:t}}function Ut(e,t){return{module:e,children:t}}function Yt(e,t,n){return e.module.name===t?n(e):e.children?[Ut(e.module,e.children.flatMap((e=>{var r;return null!==(r=Yt(e,t,n))&&void 0!==r?r:[]})))]:[e]}function Kt(e,t,n){return e.flatMap((e=>{var r;return null!==(r=Yt(e,t,n))&&void 0!==r?r:[]}))}const Jt=t.createContext(null),Qt=Nt("useDocument","DocumentContext",Jt);function en({nodeRef:e,children:n}){const r=t.useMemo((()=>{const t=t=>{var n;return(null===(n=t||e.current)||void 0===n?void 0:n.ownerDocument)||document};return{getOwnerDocument:t,getOwnerWindow:e=>{var n;return(null===(n=t(e))||void 0===n?void 0:n.defaultView)||window}}}),[e]);return t.createElement(Jt.Provider,{value:r},n)}const tn=t.createContext(null),nn=Nt("useEvents","EventsContext",tn);function rn({children:e}){const[n]=t.useState({});t.useEffect((()=>()=>{Object.keys(n).forEach((e=>delete n[e]))}),[n]);const r=t.useMemo((()=>{const e=(e,t)=>{var r;null===(r=n[e])||void 0===r||r.splice(0,n[e].length,...n[e].filter((e=>e!==t)))};return{publish:(...[e,t])=>{var r;null===(r=n[e])||void 0===r||r.forEach((e=>e(t)))},subscribe:(t,r)=>(n[t]||(n[t]=[]),n[t].push(r),()=>e(t,r)),unsubscribe:e}}),[n]);return t.createElement(tn.Provider,{value:r},e)}const on=t.createContext(null),an=Nt("useLightboxProps","LightboxPropsContext",on);function sn({children:e,...n}){return t.createElement(on.Provider,{value:n},e)}const cn=t.createContext(null),ln=Nt("useLightboxState","LightboxStateContext",cn),un=t.createContext(null),dn=Nt("useLightboxDispatch","LightboxDispatchContext",un);function fn(e,t){switch(t.type){case"swipe":{const{slides:n}=e,r=(null==t?void 0:t.increment)||0,o=e.globalIndex+r,i=jt(o,n.length);return{slides:n,currentIndex:i,globalIndex:o,currentSlide:Bt(n,i),animation:r||void 0!==t.duration?{increment:r,duration:t.duration,easing:t.easing}:void 0}}case"update":return t.slides!==e.slides||t.index!==e.currentIndex?{slides:t.slides,currentIndex:t.index,globalIndex:t.index,currentSlide:Bt(t.slides,t.index)}:e;default:throw new Error(xt)}}function hn({slides:e,index:n,children:r}){const[o,i]=t.useReducer(fn,{slides:e,currentIndex:n,globalIndex:n,currentSlide:Bt(e,n)});t.useEffect((()=>{i({type:"update",slides:e,index:n})}),[e,n]);const a=t.useMemo((()=>({...o,state:o,dispatch:i})),[o,i]);return t.createElement(un.Provider,{value:i},t.createElement(cn.Provider,{value:a},r))}const pn=t.createContext(null),vn=Nt("useTimeouts","TimeoutsContext",pn);function mn({children:e}){const[n]=t.useState([]);t.useEffect((()=>()=>{n.forEach((e=>window.clearTimeout(e))),n.splice(0,n.length)}),[n]);const r=t.useMemo((()=>{const e=e=>{n.splice(0,n.length,...n.filter((t=>t!==e)))};return{setTimeout:(t,r)=>{const o=window.setTimeout((()=>{e(o),t()}),r);return n.push(o),o},clearTimeout:t=>{void 0!==t&&(e(t),window.clearTimeout(t))}}}),[n]);return t.createElement(pn.Provider,{value:r},e)}const yn=t.forwardRef((function({label:e,className:n,icon:r,renderIcon:o,onClick:i,style:a,...s},c){const{styles:l,labels:u}=an(),d=function(e,t){var n;return null!==(n=null==e?void 0:e[t])&&void 0!==n?n:t}(u,e);return t.createElement("button",{ref:c,type:"button",title:d,"aria-label":d,className:St(kt("button"),n),onClick:i,style:{...a,...l.button},...s},o?o():t.createElement(r,{className:kt(bt),style:l.icon}))}));function gn(e,n){const r=e=>t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",...e},n);return r.displayName=e,r}function bn(e,n){return gn(e,t.createElement("g",{fill:"currentColor"},t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),n))}function _n(e,n){return gn(e,t.createElement(t.Fragment,null,t.createElement("defs",null,t.createElement("mask",{id:"strike"},t.createElement("path",{d:"M0 0h24v24H0z",fill:"white"}),t.createElement("path",{d:"M0 0L24 24",stroke:"black",strokeWidth:4}))),t.createElement("path",{d:"M0.70707 2.121320L21.878680 23.292883",stroke:"currentColor",strokeWidth:2}),t.createElement("g",{fill:"currentColor",mask:"url(#strike)"},t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),n)))}const wn=bn("Close",t.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),xn=bn("Previous",t.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),En=bn("Next",t.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),Sn=bn("Loading",t.createElement(t.Fragment,null,Array.from({length:8}).map(((e,n,r)=>t.createElement("line",{key:n,x1:"12",y1:"6.5",x2:"12",y2:"1.8",strokeLinecap:"round",strokeWidth:"2.6",stroke:"currentColor",strokeOpacity:1/r.length*(n+1),transform:`rotate(${360/r.length*n}, 12, 12)`}))))),kn=bn("Error",t.createElement("path",{d:"M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z"})),On=Tt()?t.useLayoutEffect:t.useEffect;function Pn(){const[e,n]=t.useState(!1);return t.useEffect((()=>{var e,t;const r=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-reduced-motion: reduce)");n(null==r?void 0:r.matches);const o=e=>n(e.matches);return null===(t=null==r?void 0:r.addEventListener)||void 0===t||t.call(r,"change",o),()=>{var e;return null===(e=null==r?void 0:r.removeEventListener)||void 0===e?void 0:e.call(r,"change",o)}}),[]),e}function Cn(e,n){const r=t.useRef(void 0),o=t.useRef(void 0),i=Pn();return On((()=>{var t,a,s;if(e.current&&void 0!==r.current&&!i){const{keyframes:i,duration:c,easing:l,onfinish:u}=n(r.current,e.current.getBoundingClientRect(),function(e){let t=0,n=0,r=0;const o=window.getComputedStyle(e).transform.match(/matrix.*\((.+)\)/);if(o){const e=o[1].split(",").map(At);6===e.length?(t=e[4],n=e[5]):16===e.length&&(t=e[12],n=e[13],r=e[14])}return{x:t,y:n,z:r}}(e.current))||{};if(i&&c){null===(t=o.current)||void 0===t||t.cancel(),o.current=void 0;try{o.current=null===(s=(a=e.current).animate)||void 0===s?void 0:s.call(a,i,{duration:c,easing:l})}catch(e){console.error(e)}o.current&&(o.current.onfinish=()=>{o.current=void 0,null==u||u()})}}r.current=void 0})),{prepareAnimation:e=>{r.current=e},isAnimationPlaying:()=>{var e;return"running"===(null===(e=o.current)||void 0===e?void 0:e.playState)}}}function In(){const e=t.useRef(null),n=t.useRef(void 0),[r,o]=t.useState();return{setContainerRef:t.useCallback((t=>{e.current=t,n.current&&(n.current.disconnect(),n.current=void 0);const r=()=>{if(t){const e=window.getComputedStyle(t),n=e=>parseFloat(e)||0;o({width:Math.round(t.clientWidth-n(e.paddingLeft)-n(e.paddingRight)),height:Math.round(t.clientHeight-n(e.paddingTop)-n(e.paddingBottom))})}else o(void 0)};r(),t&&"undefined"!=typeof ResizeObserver&&(n.current=new ResizeObserver(r),n.current.observe(t))}),[]),containerRef:e,containerRect:r}}function Nn(){const e=t.useRef(void 0),{setTimeout:n,clearTimeout:r}=vn();return t.useCallback(((t,o)=>{r(e.current),e.current=n(t,o>0?o:0)}),[n,r])}function Tn(e){const n=t.useRef(e);return On((()=>{n.current=e})),t.useCallback(((...e)=>{var t;return null===(t=n.current)||void 0===t?void 0:t.call(n,...e)}),[])}function Rn(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function Dn(e,n){return t.useMemo((()=>null==e&&null==n?null:t=>{Rn(e,t),Rn(n,t)}),[e,n])}function Mn(e,n=!1){const r=t.useRef(!1);On((()=>{n&&r.current&&(r.current=!1,e())}),[n,e]);return{onFocus:t.useCallback((()=>{r.current=!0}),[]),onBlur:t.useCallback((()=>{r.current=!1}),[])}}function An(){const[e,n]=t.useState(!1);return On((()=>{n("rtl"===window.getComputedStyle(window.document.documentElement).direction)}),[]),e}function Ln(){const[e]=t.useState({}),n=t.useCallback(((t,n)=>{var r;null===(r=e[t])||void 0===r||r.forEach((e=>{n.isPropagationStopped()||e(n)}))}),[e]),r=t.useMemo((()=>({onPointerDown:e=>n(ft,e),onPointerMove:e=>n(ht,e),onPointerUp:e=>n(pt,e),onPointerLeave:e=>n(vt,e),onPointerCancel:e=>n(mt,e),onKeyDown:e=>n(yt,e),onKeyUp:e=>n("onKeyUp",e),onWheel:e=>n(gt,e)})),[n]),o=t.useCallback(((t,n)=>(e[t]||(e[t]=[]),e[t].unshift(n),()=>{const r=e[t];r&&r.splice(0,r.length,...r.filter((e=>e!==n)))})),[e]);return{registerSensors:r,subscribeSensors:o}}function zn(e,n){const r=t.useRef(0),o=Nn(),i=Tn(((...t)=>{r.current=Date.now(),e(t)}));return t.useCallback(((...e)=>{o((()=>{i(e)}),n-(Date.now()-r.current))}),[n,i,o])}const jn=Ct("slide"),Fn=Ct("slide_image");function Vn({slide:e,offset:n,render:r,rect:o,imageFit:i,imageProps:a,onClick:s,onLoad:c,onError:l,style:u}){var d,f,h,p,v,m,y;const[g,b]=t.useState(Ze),{publish:_}=nn(),{setTimeout:w}=vn(),x=t.useRef(null);t.useEffect((()=>{0===n&&_(Je(g))}),[n,g,_]);const E=Tn((e=>{("decode"in e?e.decode():Promise.resolve()).catch((()=>{})).then((()=>{e.parentNode&&(b(Ke),w((()=>{null==c||c(e)}),0))}))})),S=t.useCallback((e=>{x.current=e,(null==e?void 0:e.complete)&&E(e)}),[E]),k=t.useCallback((e=>{E(e.currentTarget)}),[E]),O=Tn((()=>{b(Ye),null==l||l()})),P=Mt(e,i),C=(e,t)=>Number.isFinite(e)?e:t,I=C(Math.max(...(null!==(f=null===(d=e.srcSet)||void 0===d?void 0:d.map((e=>e.width)))&&void 0!==f?f:[]).concat(e.width?[e.width]:[]).filter(Boolean)),(null===(h=x.current)||void 0===h?void 0:h.naturalWidth)||0),N=C(Math.max(...(null!==(v=null===(p=e.srcSet)||void 0===p?void 0:p.map((e=>e.height)))&&void 0!==v?v:[]).concat(e.height?[e.height]:[]).filter(Boolean)),(null===(m=x.current)||void 0===m?void 0:m.naturalHeight)||0),T=I&&N?{maxWidth:`min(${I}px, 100%)`,maxHeight:`min(${N}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},R=null===(y=e.srcSet)||void 0===y?void 0:y.sort(((e,t)=>e.width-t.width)).map((e=>`${e.src} ${e.width}w`)).join(", "),D=R&&o&&Tt()?`${Math.round(Math.min(o&&!P&&e.width&&e.height?o.height/e.height*e.width:Number.MAX_VALUE,o.width))}px`:void 0,{style:M,className:A,...L}=a||{};return t.createElement(t.Fragment,null,t.createElement("img",{ref:S,onLoad:k,onError:O,onClick:s,draggable:!1,className:St(kt(Fn()),P&&kt(Fn("cover")),g!==Ke&&kt(Fn("loading")),A),style:{...T,...u,...M},...L,alt:e.alt,sizes:D,srcSet:R,src:e.src}),g!==Ke&&t.createElement("div",{className:kt(jn("placeholder"))},g===Ze&&((null==r?void 0:r.iconLoading)?r.iconLoading():t.createElement(Sn,{className:St(kt(bt),kt(jn(Ze)))})),g===Ye&&((null==r?void 0:r.iconError)?r.iconError():t.createElement(kn,{className:St(kt(bt),kt(jn(Ye)))}))))}const Bn=t.forwardRef((function({className:e,children:n,...r},o){const i=t.useRef(null);return t.createElement(en,{nodeRef:i},t.createElement("div",{ref:Dn(o,i),className:St(kt("root"),e),...r},n))}));var Hn,Wn;function $n(e,n,r,o,i){t.useEffect((()=>i?()=>{}:It(e(ft,n),e(ht,r),e(pt,o),e(vt,o),e(mt,o))),[e,n,r,o,i])}!function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL",e[e.ANIMATION=3]="ANIMATION"}(Hn||(Hn={})),function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL"}(Wn||(Wn={}));const Gn=Ct("container"),qn=t.createContext(null),Xn=Nt("useController","ControllerContext",qn);const Zn=Zt(Ve,(function({children:e,...n}){var r;const{carousel:o,animation:i,controller:a,on:s,styles:c,render:l}=n,{closeOnPullUp:u,closeOnPullDown:d,preventDefaultWheelX:f,preventDefaultWheelY:h}=a,[p,v]=t.useState(),m=ln(),y=dn(),[g,b]=t.useState(Hn.NONE),_=t.useRef(0),w=t.useRef(0),x=t.useRef(1),{registerSensors:E,subscribeSensors:S}=Ln(),{subscribe:k,publish:O}=nn(),P=Nn(),C=Nn(),I=Nn(),{containerRef:N,setContainerRef:T,containerRect:R}=In(),D=Dn(function({preventDefaultWheelX:e,preventDefaultWheelY:n}){const r=t.useRef(null),o=Tn((t=>{const r=Math.abs(t.deltaX)>Math.abs(t.deltaY);(r&&e||!r&&n||t.ctrlKey)&&t.preventDefault()}));return t.useCallback((e=>{var t;e?e.addEventListener("wheel",o,{passive:!1}):null===(t=r.current)||void 0===t||t.removeEventListener("wheel",o),r.current=e}),[o])}({preventDefaultWheelX:f,preventDefaultWheelY:h}),T),M=t.useRef(null),A=Dn(M,void 0),{getOwnerDocument:L}=Qt(),z=An(),j=e=>(z?-1:1)*("number"==typeof e?e:1),F=Tn((()=>{var e;return null===(e=N.current)||void 0===e?void 0:e.focus()})),V=Tn((()=>n)),B=Tn((()=>m)),H=t.useCallback((e=>O(ct,e)),[O]),W=t.useCallback((e=>O(lt,e)),[O]),$=t.useCallback((()=>O(dt)),[O]),G=e=>!(o.finite&&(j(e)>0&&0===m.currentIndex||j(e)<0&&m.currentIndex===m.slides.length-1)),q=e=>{var t;_.current=e,null===(t=N.current)||void 0===t||t.style.setProperty(Ot("swipe_offset"),`${Math.round(e)}px`)},X=e=>{var t,n;w.current=e,x.current=(()=>{const t=d&&e>0?e:u&&e<0?-e:0;return Math.min(Math.max(Rt(1-t/60*.5,2),.5),1)})(),null===(t=N.current)||void 0===t||t.style.setProperty(Ot("pull_offset"),`${Math.round(e)}px`),null===(n=N.current)||void 0===n||n.style.setProperty(Ot("pull_opacity"),`${x.current}`)},{prepareAnimation:Z}=Cn(M,((e,t,n)=>{if(M.current&&R)return{keyframes:[{transform:`translate(0, ${e.rect.y-t.y+n.y}px)`,opacity:e.opacity},{transform:"translate(0, 0)",opacity:1}],duration:e.duration,easing:i.easing.fade}})),U=(e,t)=>{if(u||d){X(e);let n=0;M.current&&(n=i.fade*(t?2:1),Z({rect:M.current.getBoundingClientRect(),opacity:x.current,duration:n})),I((()=>{X(0),b(Hn.NONE)}),n),b(Hn.ANIMATION),t||$()}},{prepareAnimation:Y,isAnimationPlaying:K}=Cn(M,((e,t,n)=>{var r;if(M.current&&R&&(null===(r=m.animation)||void 0===r?void 0:r.duration)){const r=Lt(o.spacing),i=(r.percent?r.percent*R.width/100:r.pixel)||0;return{keyframes:[{transform:`translate(${j(m.globalIndex-e.index)*(R.width+i)+e.rect.x-t.x+n.x}px, 0)`},{transform:"translate(0, 0)"}],duration:m.animation.duration,easing:m.animation.easing}}})),J=Tn((e=>{var t,n;const r=e.offset||0,o=r?i.swipe:null!==(t=i.navigation)&&void 0!==t?t:i.swipe,a=r||K()?i.easing.swipe:i.easing.navigation;let{direction:s}=e;const c=null!==(n=e.count)&&void 0!==n?n:1;let l=Hn.ANIMATION,u=o*c;if(!s){const t=null==R?void 0:R.width,n=e.duration||0,i=t?o/t*Math.abs(r):o;0!==c?(n<i?u=u/i*Math.max(n,i/5):t&&(u=o/t*(t-Math.abs(r))),s=j(r)>0?ct:lt):u=o/2}let d=0;s===ct?G(j(1))?d=-c:(l=Hn.NONE,u=o):s===lt&&(G(j(-1))?d=c:(l=Hn.NONE,u=o)),u=Math.round(u),C((()=>{q(0),b(Hn.NONE)}),u),M.current&&Y({rect:M.current.getBoundingClientRect(),index:m.globalIndex}),b(l),O(ut,{type:"swipe",increment:d,duration:u,easing:a})}));t.useEffect((()=>{var e,t;(null===(e=m.animation)||void 0===e?void 0:e.increment)&&(null===(t=m.animation)||void 0===t?void 0:t.duration)&&P((()=>y({type:"swipe",increment:0})),m.animation.duration)}),[m.animation,y,P]);const Q=[S,G,(null==R?void 0:R.width)||0,i.swipe,()=>b(Hn.SWIPE),e=>q(e),(e,t)=>J({offset:e,duration:t,count:1}),e=>J({offset:e,count:0})],ee=[()=>{d&&b(Hn.PULL)},e=>X(e),e=>U(e),e=>U(e,!0)];!function({disableSwipeNavigation:e,closeOnBackdropClick:n},r,o,i,a,s,c,l,u,d,f,h,p,v,m,y){const g=t.useRef(0),b=t.useRef([]),_=t.useRef(void 0),w=t.useRef(0),x=t.useRef(Wn.NONE),E=t.useCallback((e=>{_.current===e.pointerId&&(_.current=void 0,x.current=Wn.NONE);const t=b.current;t.splice(0,t.length,...t.filter((t=>t.pointerId!==e.pointerId)))}),[]),S=t.useCallback((e=>{E(e),e.persist(),b.current.push(e)}),[E]),k=t.useCallback((e=>b.current.find((({pointerId:t})=>e.pointerId===t))),[]),O=Tn((e=>{S(e)})),P=(e,t)=>f&&e>t||d&&e<-t,C=Tn((e=>{const t=k(e);if(t)if(_.current===e.pointerId){const e=Date.now()-w.current,t=g.current;x.current===Wn.SWIPE?Math.abs(t)>.3*i||Math.abs(t)>5&&e<a?l(t,e):u(t):x.current===Wn.PULL&&(P(t,60)?v(t,e):m(t)),g.current=0,x.current=Wn.NONE}else{const{target:r}=e;n&&r instanceof HTMLElement&&r===t.target&&(r.classList.contains(kt(at))||r.classList.contains(kt(st)))&&y()}E(e)}));$n(r,O,Tn((t=>{const n=k(t);if(n){const r=_.current===t.pointerId;if(0===t.buttons)return void(r&&0!==g.current?C(t):E(n));const i=t.clientX-n.clientX,a=t.clientY-n.clientY;if(void 0===_.current){const n=e=>{S(t),_.current=t.pointerId,w.current=Date.now(),x.current=e};Math.abs(i)>Math.abs(a)&&Math.abs(i)>30&&o(i)?e||(n(Wn.SWIPE),s()):Math.abs(a)>Math.abs(i)&&P(a,30)&&(n(Wn.PULL),h())}else r&&(x.current===Wn.SWIPE?(g.current=i,c(i)):x.current===Wn.PULL&&(g.current=a,p(a)))}})),C)}(a,...Q,u,d,...ee,$),function(e,n,r,o,i,a,s,c,l){const u=t.useRef(0),d=t.useRef(0),f=t.useRef(void 0),h=t.useRef(void 0),p=t.useRef(0),v=t.useRef(void 0),m=t.useRef(0),{setTimeout:y,clearTimeout:g}=vn(),b=t.useCallback((()=>{f.current&&(g(f.current),f.current=void 0)}),[g]),_=t.useCallback((()=>{h.current&&(g(h.current),h.current=void 0)}),[g]),w=Tn((()=>{e!==Hn.SWIPE&&(u.current=0,m.current=0,b(),_())}));t.useEffect(w,[e,w]);const x=Tn((e=>{h.current=void 0,u.current===e&&l(u.current)})),E=Tn((t=>{if(t.ctrlKey)return;if(Math.abs(t.deltaY)>Math.abs(t.deltaX))return;const n=e=>{p.current=e,g(v.current),v.current=e>0?y((()=>{p.current=0,v.current=void 0}),300):void 0};if(e===Hn.NONE){if(Math.abs(t.deltaX)<=1.2*Math.abs(p.current))return void n(t.deltaX);if(!r(-t.deltaX))return;if(d.current+=t.deltaX,b(),Math.abs(d.current)>30)d.current=0,n(0),m.current=Date.now(),a();else{const e=d.current;f.current=y((()=>{f.current=void 0,e===d.current&&(d.current=0)}),i)}}else if(e===Hn.SWIPE){let e=u.current-t.deltaX;if(e=Math.min(Math.abs(e),o)*Math.sign(e),u.current=e,s(e),_(),Math.abs(e)>.2*o)return n(t.deltaX),void c(e,Date.now()-m.current);h.current=y((()=>x(e)),2*i)}else n(t.deltaX)}));t.useEffect((()=>n(gt,E)),[n,E])}(g,...Q);const te=Tn((()=>{a.focus&&L().querySelector(`.${kt(Be)} .${kt(Gn())}`)&&F()}));t.useEffect(te,[te]);const ne=Tn((()=>{var e;null===(e=s.view)||void 0===e||e.call(s,{index:m.currentIndex})}));t.useEffect(ne,[m.globalIndex,ne]),t.useEffect((()=>It(k(ct,(e=>J({direction:ct,...e}))),k(lt,(e=>J({direction:lt,...e}))),k(ut,(e=>y(e))))),[k,J,y]);const re=t.useMemo((()=>({prev:H,next:W,close:$,focus:F,slideRect:R?zt(R,o.padding):{width:0,height:0},containerRect:R||{width:0,height:0},subscribeSensors:S,containerRef:N,setCarouselRef:A,toolbarWidth:p,setToolbarWidth:v})),[H,W,$,F,S,R,N,A,p,v,o.padding]);return t.useImperativeHandle(a.ref,(()=>({prev:H,next:W,close:$,focus:F,getLightboxProps:V,getLightboxState:B})),[H,W,$,F,V,B]),t.createElement("div",{ref:D,className:St(kt(Gn()),kt(ot)),style:{...g===Hn.SWIPE?{[Ot("swipe_offset")]:`${Math.round(_.current)}px`}:null,...g===Hn.PULL?{[Ot("pull_offset")]:`${Math.round(w.current)}px`,[Ot("pull_opacity")]:`${x.current}`}:null,..."none"!==a.touchAction?{[Ot("controller_touch_action")]:a.touchAction}:null,...c.container},...a.aria?{role:"region","aria-live":"polite","aria-roledescription":"carousel"}:null,tabIndex:-1,...E},R&&t.createElement(qn.Provider,{value:re},e,null===(r=l.controls)||void 0===r?void 0:r.call(l)))}));function Un(e){return Pt(Fe,e)}function Yn(e){return Pt(at,e)}function Kn({slide:e,offset:n}){const r=t.useRef(null),{currentIndex:o}=ln(),{slideRect:i,focus:a}=Xn(),{render:s,carousel:{imageFit:c,imageProps:l},on:{click:u},styles:{slide:d}}=an(),{getOwnerDocument:f}=Qt(),h=0!==n;t.useEffect((()=>{var e;h&&(null===(e=r.current)||void 0===e?void 0:e.contains(f().activeElement))&&a()}),[h,a,f]);return t.createElement("div",{ref:r,className:St(kt(Yn()),!h&&kt(Yn("current")),kt(ot)),...(p=h,{inert:Gt?p:p?"":void 0}),style:d,role:"region","aria-roledescription":"slide"},(()=>{var r,a,d,f;let p=null===(r=s.slide)||void 0===r?void 0:r.call(s,{slide:e,offset:n,rect:i});return!p&&Dt(e)&&(p=t.createElement(Vn,{slide:e,offset:n,render:s,rect:i,imageFit:c,imageProps:l,onClick:h?void 0:()=>null==u?void 0:u({index:o})})),p?t.createElement(t.Fragment,null,null===(a=s.slideHeader)||void 0===a?void 0:a.call(s,{slide:e}),(null!==(d=s.slideContainer)&&void 0!==d?d:({children:e})=>e)({slide:e,children:p}),null===(f=s.slideFooter)||void 0===f?void 0:f.call(s,{slide:e})):null})());var p}function Jn(){const e=an().styles.slide;return t.createElement("div",{className:kt(at),style:e})}const Qn=Zt(Fe,(function({carousel:e}){const{slides:n,currentIndex:r,globalIndex:o}=ln(),{setCarouselRef:i}=Xn(),a=Lt(e.spacing),s=Lt(e.padding),c=$t(e,n,1),l=[];if(Ft(n))for(let t=r-c;t<=r+c;t+=1){const i=Vt(n,t),a=o-r+t,s=e.finite&&(t<0||t>n.length-1);l.push(s?{key:a}:{key:[`${a}`,Ht(i)].filter(Boolean).join("|"),offset:t-r,slide:i})}return t.createElement("div",{ref:i,className:St(kt(Un()),l.length>0&&kt(Un("with_slides"))),style:{[`${Ot(Un("slides_count"))}`]:l.length,[`${Ot(Un("spacing_px"))}`]:a.pixel||0,[`${Ot(Un("spacing_percent"))}`]:a.percent||0,[`${Ot(Un("padding_px"))}`]:s.pixel||0,[`${Ot(Un("padding_percent"))}`]:s.percent||0}},l.map((({key:e,slide:n,offset:r})=>n?t.createElement(Kn,{key:e,slide:n,offset:r}):t.createElement(Jn,{key:e}))))}));function er(){const{carousel:e}=an(),{slides:t,currentIndex:n}=ln();return{prevDisabled:0===t.length||e.finite&&0===n,nextDisabled:0===t.length||e.finite&&n===t.length-1}}function tr(e){var n;const r=An(),{publish:o}=nn(),{animation:i}=an(),{prevDisabled:a,nextDisabled:s}=er(),c=(null!==(n=i.navigation)&&void 0!==n?n:i.swipe)/2,l=zn((()=>o(ct)),c),u=zn((()=>o(lt)),c),d=Tn((e=>{switch(e.key){case"Escape":o(dt);break;case"ArrowLeft":(r?s:a)||(r?u:l)();break;case"ArrowRight":(r?a:s)||(r?l:u)()}}));t.useEffect((()=>e(yt,d)),[e,d])}function nr({label:e,icon:n,renderIcon:r,action:o,onClick:i,disabled:a,style:s}){return t.createElement(yn,{label:e,icon:n,renderIcon:r,className:kt(`navigation_${o}`),disabled:a,onClick:i,style:s,...Mn(Xn().focus,a)})}const rr=Zt("navigation",(function({render:{buttonPrev:e,buttonNext:n,iconPrev:r,iconNext:o},styles:i}){const{prev:a,next:s,subscribeSensors:c}=Xn(),{prevDisabled:l,nextDisabled:u}=er();return tr(c),t.createElement(t.Fragment,null,e?e():t.createElement(nr,{label:"Previous",action:ct,icon:xn,renderIcon:r,style:i.navigationPrev,disabled:l,onClick:a}),n?n():t.createElement(nr,{label:"Next",action:lt,icon:En,renderIcon:o,style:i.navigationNext,disabled:u,onClick:s}))})),or=kt("no_scroll"),ir=kt(it);function ar(e){return"style"in e}function sr(e,t,n){const r=window.getComputedStyle(e),o=n?"padding-left":"padding-right",i=n?r.paddingLeft:r.paddingRight,a=e.style.getPropertyValue(o);return e.style.setProperty(o,`${(At(i)||0)+t}px`),()=>{a?e.style.setProperty(o,a):e.style.removeProperty(o)}}const cr=Zt("no-scroll",(function({noScroll:{disabled:e},children:n}){const r=An(),{getOwnerDocument:o,getOwnerWindow:i}=Qt();return t.useEffect((()=>{if(e)return()=>{};const t=[],n=i(),{body:a,documentElement:s}=o(),c=Math.round(n.innerWidth-s.clientWidth);if(c>0){t.push(sr(a,c,r));const e=a.getElementsByTagName("*");for(let o=0;o<e.length;o+=1){const i=e[o];ar(i)&&"fixed"===n.getComputedStyle(i).getPropertyValue("position")&&!i.classList.contains(ir)&&t.push(sr(i,c,r))}}return a.classList.add(or),()=>{a.classList.remove(or),t.forEach((e=>e()))}}),[r,e,o,i]),t.createElement(t.Fragment,null,n)}));function lr(e){return Pt(Be,e)}function ur(e,t,n){const r=e.getAttribute(t);return e.setAttribute(t,n),()=>{r?e.setAttribute(t,r):e.removeAttribute(t)}}const dr=Zt(Be,(function({children:e,animation:n,styles:r,className:o,on:i,portal:a,close:s}){const[c,l]=t.useState(!1),[u,d]=t.useState(!1),f=t.useRef([]),h=t.useRef(null),{setTimeout:p}=vn(),{subscribe:v}=nn(),m=Pn()?0:n.fade;t.useEffect((()=>(l(!0),()=>{l(!1),d(!1)})),[]);const y=Tn((()=>{f.current.forEach((e=>e())),f.current=[]})),g=Tn((()=>{var e;d(!1),y(),null===(e=i.exiting)||void 0===e||e.call(i),p((()=>{var e;null===(e=i.exited)||void 0===e||e.call(i),s()}),m)}));t.useEffect((()=>v(dt,g)),[v,g]);const b=Tn((e=>{var t,n,r;qt(e),d(!0),null===(t=i.entering)||void 0===t||t.call(i);const o=null!==(r=null===(n=e.parentNode)||void 0===n?void 0:n.children)&&void 0!==r?r:[];for(let t=0;t<o.length;t+=1){const n=o[t];-1===["TEMPLATE","SCRIPT","STYLE"].indexOf(n.tagName)&&n!==e&&(f.current.push(ur(n,"inert","")),f.current.push(ur(n,"aria-hidden","true")))}f.current.push((()=>{var e,t;null===(t=null===(e=h.current)||void 0===e?void 0:e.focus)||void 0===t||t.call(e)})),p((()=>{var e;null===(e=i.entered)||void 0===e||e.call(i)}),m)})),_=t.useCallback((e=>{e?b(e):y()}),[b,y]);return c?W(t.createElement(Bn,{ref:_,className:St(o,kt(lr()),kt(it),u&&kt(lr("open"))),"aria-modal":!0,role:"dialog","aria-live":"polite","aria-roledescription":"lightbox",style:{...n.fade!==Xt.animation.fade?{[Ot("fade_animation_duration")]:`${m}ms`}:null,...n.easing.fade!==Xt.animation.easing.fade?{[Ot("fade_animation_timing_function")]:n.easing.fade}:null,...r.root},onFocus:e=>{h.current||(h.current=e.relatedTarget)}},e),a.root||document.body):null}));const fr=Zt("root",(function({children:e}){return t.createElement(t.Fragment,null,e)}));const hr=Zt(He,(function({toolbar:{buttons:e},render:{buttonClose:n,iconClose:r},styles:o}){const{close:i,setToolbarWidth:a}=Xn(),{setContainerRef:s,containerRect:c}=In();return On((()=>{a(null==c?void 0:c.width)}),[a,null==c?void 0:c.width]),t.createElement("div",{ref:s,style:o.toolbar,className:kt(Pt(He,l))},null==e?void 0:e.map((e=>e===dt?n?n():t.createElement(yn,{key:dt,label:"Close",icon:wn,renderIcon:r,onClick:i}):e)));var l}));function pr(e,n){var r;return t.createElement(e.module.component,{key:e.module.name,...n},null===(r=e.children)||void 0===r?void 0:r.map((e=>pr(e,n))))}function vr(e,t={}){const{easing:n,...r}=e,{easing:o,...i}=t;return{easing:{...n,...o},...r,...i}}function mr({carousel:e,animation:n,render:r,toolbar:o,controller:i,noScroll:a,on:s,plugins:c,slides:l,index:u,...d}){const{animation:f,carousel:h,render:p,toolbar:v,controller:m,noScroll:y,on:g,slides:b,index:_,plugins:w,...x}=Xt,{config:E,augmentation:S}=function(e,t=[],n=[]){let r=e;const o=e=>{const t=[...r];for(;t.length>0;){const n=t.pop();if((null==n?void 0:n.module.name)===e)return!0;(null==n?void 0:n.children)&&t.push(...n.children)}return!1},i=(e,t)=>{r=""!==e?Kt(r,e,(e=>[Ut(t,[e])])):[Ut(t,r)]},a=(e,t)=>{r=Kt(r,e,(e=>[Ut(e.module,[Ut(t,e.children)])]))},s=(e,t,n)=>{r=Kt(r,e,(e=>{var r;return[Ut(e.module,[...n?[Ut(t)]:[],...null!==(r=e.children)&&void 0!==r?r:[],...n?[]:[Ut(t)]])]}))},c=(e,t,n)=>{r=Kt(r,e,(e=>[...n?[Ut(t)]:[],e,...n?[]:[Ut(t)]]))},l=e=>{a(Ve,e)},u=(e,t)=>{r=Kt(r,e,(e=>[Ut(t,e.children)]))},d=e=>{r=Kt(r,e,(e=>e.children))},f=e=>{n.push(e)};return t.forEach((e=>{e({contains:o,addParent:i,append:a,addChild:s,addSibling:c,addModule:l,replace:u,remove:d,augment:f})})),{config:r,augmentation:e=>n.reduce(((e,t)=>t(e)),e)}}([Ut(dr,[Ut(cr,[Ut(Zn,[Ut(Qn),Ut(hr),Ut(rr)])])])],c||w),k=S({animation:vr(f,n),carousel:{...h,...e},render:{...p,...r},toolbar:{...v,...o},controller:{...m,...i},noScroll:{...y,...a},on:{...g,...s},...x,...d});return k.open?t.createElement(sn,{...k},t.createElement(hn,{slides:l||b,index:At(u||_)},t.createElement(mn,null,t.createElement(rn,null,pr(Ut(fr,E),k))))):null}const yr=e=>kt(`slide_${e}`),gr={descriptionTextAlign:"start",descriptionMaxLines:3,showToggle:!1,hidden:!1},br=e=>({...gr,...e});const _r=t.createContext(null),wr=Nt("useCaptions","CaptionsContext",_r);function xr({captions:e,children:n}){const{ref:r,hidden:o}=br(e),[i,a]=t.useState(!o),s=t.useMemo((()=>({visible:i,show:()=>a(!0),hide:()=>a(!1)})),[i]);return t.useImperativeHandle(r,(()=>s),[s]),t.createElement(_r.Provider,{value:s},n)}function Er({title:e}){const{toolbarWidth:n}=Xn(),{styles:r}=an(),{visible:o}=wr();return o?t.createElement("div",{style:r.captionsTitleContainer,className:St(yr("captions_container"),yr("title_container"))},t.createElement("div",{className:yr("title"),style:{...n?{[Ot("toolbar_width")]:`${n}px`}:null,...r.captionsTitle}},e)):null}function Sr({description:e}){const{descriptionTextAlign:n,descriptionMaxLines:r}=function(){const{captions:e}=an();return br(e)}(),{styles:o}=an(),{visible:i}=wr();return i?t.createElement("div",{style:o.captionsDescriptionContainer,className:St(yr("captions_container"),yr("description_container"))},t.createElement("div",{className:yr("description"),style:{...n!==gr.descriptionTextAlign||r!==gr.descriptionMaxLines?{[Ot("slide_description_text_align")]:n,[Ot("slide_description_max_lines")]:r}:null,...o.captionsDescription}},"string"==typeof e?e.split("\n").flatMap(((e,n)=>[...n>0?[t.createElement("br",{key:n})]:[],e])):e)):null}const kr=()=>t.createElement(t.Fragment,null,t.createElement("path",{strokeWidth:2,stroke:"currentColor",strokeLinejoin:"round",fill:"none",d:"M3 5l18 0l0 14l-18 0l0-14z"}),t.createElement("path",{d:"M7 15h3c.55 0 1-.45 1-1v-1H9.5v.5h-2v-3h2v.5H11v-1c0-.55-.45-1-1-1H7c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1zm7 0h3c.55 0 1-.45 1-1v-1h-1.5v.5h-2v-3h2v.5H18v-1c0-.55-.45-1-1-1h-3c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1z"})),Or=bn("CaptionsVisible",kr()),Pr=_n("CaptionsVisible",kr());function Cr(){const{visible:e,show:n,hide:r}=wr(),{render:o}=an();return o.buttonCaptions?t.createElement(t.Fragment,null,o.buttonCaptions({visible:e,show:n,hide:r})):t.createElement(yn,{label:e?"Hide captions":"Show captions",icon:e?Or:Pr,renderIcon:e?o.iconCaptionsVisible:o.iconCaptionsHidden,onClick:e?r:n})}function Ir({augment:e,addModule:n}){e((({captions:e,render:{slideFooter:n,...r},toolbar:o,...i})=>{const a=br(e);return{render:{slideFooter:({slide:e})=>t.createElement(t.Fragment,null,null==n?void 0:n({slide:e}),e.title&&t.createElement(Er,{title:e.title}),e.description&&t.createElement(Sr,{description:e.description})),...r},toolbar:Wt(o,We,a.showToggle?t.createElement(Cr,null):null),captions:a,...i}})),n(Zt(We,xr))}const Nr={separator:"/",container:{}},Tr=e=>({...Nr,...e});function Rr({counter:e}){const{slides:n,currentIndex:r}=ln(),{separator:o,container:{className:i,...a},className:s,...c}=Tr(e);return 0===n.length?null:t.createElement("div",{className:St(kt("counter"),i||s),...c,...a},r+1," ",o," ",n.length)}function Dr({augment:e,addChild:t}){e((({counter:e,...t})=>({counter:Tr(e),...t}))),t(Ve,Zt("counter",Rr))}const Mr={download:void 0},Ar=e=>({...Mr,...e});function Lr(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(t){const n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(n)}}function zr(e,t){const n=document.createElement("a");n.rel="noopener",n.download=t||"",n.download||(n.target="_blank"),"string"==typeof e?(n.href=e,n.origin!==window.location.origin?function(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return t.status>=200&&t.status<=299}(n.href)?function(e,t){const n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=()=>{zr(n.response,t)},n.onerror=()=>{console.error("Failed to download file")},n.send()}(e,t):(n.target="_blank",Lr(n)):Lr(n)):(n.href=URL.createObjectURL(e),setTimeout((()=>URL.revokeObjectURL(n.href)),3e4),setTimeout((()=>Lr(n)),0))}const jr=bn("DownloadIcon",t.createElement("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}));function Fr(){const{render:e,on:n,download:r}=an(),{download:o}=Ar(r),{currentSlide:i,currentIndex:a}=ln();if(e.buttonDownload)return t.createElement(t.Fragment,null,e.buttonDownload());const s=i&&(i.downloadUrl||"string"==typeof i.download&&i.download||"object"==typeof i.download&&i.download.url||Dt(i)&&i.src)||void 0,c=o?!1!==(null==i?void 0:i.download):Boolean(s),l=()=>{if(i&&s){const e=i.downloadFilename||"object"==typeof i.download&&i.download.filename||void 0;zr(s,e)}};return t.createElement(yn,{label:"Download",icon:jr,renderIcon:e.iconDownload,disabled:!c,onClick:()=>{var e;i&&((o||l)({slide:i,saveAs:zr}),null===(e=n.download)||void 0===e||e.call(n,{index:a}))}})}function Vr({augment:e}){e((({toolbar:e,download:n,...r})=>({toolbar:Wt(e,"download",t.createElement(Fr,null)),download:Ar(n),...r})))}const Br={auto:!1,ref:null},Hr=e=>({...Br,...e}),Wr=t.createContext(null),$r=Nt("useFullscreen","FullscreenContext",Wr);function Gr({fullscreen:e,on:n,children:r}){const{auto:o,ref:i}=Hr(e),a=t.useRef(null),[s,c]=t.useState(),[l,u]=t.useState(!1),d=t.useRef(!1),{getOwnerDocument:f}=Qt();On((()=>{var e,t,n,r;const o=f();c(!(null!==(r=null!==(n=null!==(t=null!==(e=o.fullscreenEnabled)&&void 0!==e?e:o.webkitFullscreenEnabled)&&void 0!==t?t:o.mozFullScreenEnabled)&&void 0!==n?n:o.msFullscreenEnabled)&&void 0!==r&&r))}),[f]);const h=t.useCallback((()=>{var e;const t=f(),n=t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement;return(null===(e=null==n?void 0:n.shadowRoot)||void 0===e?void 0:e.fullscreenElement)||n}),[f]),p=t.useCallback((()=>{const e=a.current;try{e.requestFullscreen?e.requestFullscreen().catch((()=>{})):e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen&&e.msRequestFullscreen()}catch(e){}}),[]),v=t.useCallback((()=>{if(!h())return;const e=f();try{e.exitFullscreen?e.exitFullscreen().catch((()=>{})):e.webkitExitFullscreen?e.webkitExitFullscreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.msExitFullscreen&&e.msExitFullscreen()}catch(e){}}),[h,f]);t.useEffect((()=>{const e=f(),t=()=>{u(h()===a.current)};return It(...["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"].map((n=>(e.addEventListener(n,t),()=>e.removeEventListener(n,t)))))}),[h,f]);const m=Tn((()=>{var e;return null===(e=n.enterFullscreen)||void 0===e?void 0:e.call(n)})),y=Tn((()=>{var e;return null===(e=n.exitFullscreen)||void 0===e?void 0:e.call(n)}));t.useEffect((()=>{l&&(d.current=!0),d.current&&(l?m:y)()}),[l,m,y]);const g=Tn((()=>{var e;return null===(e=o?p:null)||void 0===e||e(),v}));t.useEffect(g,[g]);const b=t.useMemo((()=>({fullscreen:l,disabled:s,enter:p,exit:v})),[l,s,p,v]);return t.useImperativeHandle(i,(()=>b),[b]),t.createElement("div",{ref:a,className:St(kt($e),kt(rt))},t.createElement(Wr.Provider,{value:b},r))}const qr=bn("EnterFullscreen",t.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})),Xr=bn("ExitFullscreen",t.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}));function Zr(){var e;const{fullscreen:n,disabled:r,enter:o,exit:i}=$r(),{render:a}=an();return r?null:a.buttonFullscreen?t.createElement(t.Fragment,null,null===(e=a.buttonFullscreen)||void 0===e?void 0:e.call(a,{fullscreen:n,disabled:r,enter:o,exit:i})):t.createElement(yn,{disabled:r,label:n?"Exit Fullscreen":"Enter Fullscreen",icon:n?Xr:qr,renderIcon:n?a.iconExitFullscreen:a.iconEnterFullscreen,onClick:n?i:o})}function Ur({augment:e,contains:n,addParent:r}){e((({fullscreen:e,toolbar:n,...r})=>({toolbar:Wt(n,$e,t.createElement(Zr,null)),fullscreen:Hr(e),...r}))),r(n(qe)?qe:Ve,Zt($e,Gr))}const Yr={share:void 0},Kr=e=>({...Yr,...e});const Jr=bn("ShareIcon",t.createElement("path",{d:"m16 5-1.42 1.42-1.59-1.59V16h-1.98V4.83L9.42 6.42 8 5l4-4 4 4zm4 5v11c0 1.1-.9 2-2 2H6c-1.11 0-2-.9-2-2V10c0-1.11.89-2 2-2h3v2H6v11h12V10h-3V8h3c1.1 0 2 .89 2 2z"}));function Qr(){const{render:e,on:n,share:r}=an(),{share:o}=Kr(r),{currentSlide:i,currentIndex:a}=ln();if("undefined"==typeof navigator||!Boolean(navigator.canShare))return null;if(e.buttonShare)return t.createElement(t.Fragment,null,e.buttonShare());const s=i&&("object"==typeof i.share&&i.share||"string"==typeof i.share&&{url:i.share}||Dt(i)&&{url:i.src})||void 0,c=o?!1!==(null==i?void 0:i.share):s&&navigator.canShare(s),l=()=>{s&&navigator.share(s).catch((()=>{})