maz-ui
Version:
A standalone components library for Vue.Js 3 & Nuxt.Js 3
103 lines (92 loc) • 81 kB
JavaScript
"use strict";require('../assets/index.B3s7AfaL.css');var Bt=Object.defineProperty;var Pt=(o,e,t)=>e in o?Bt(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var d=(o,e,t)=>Pt(o,typeof e!="symbol"?e+"":e,t);const n=require("vue");function J(o,e){const t=n.inject(o,e);if(!t)throw new TypeError(`[maz-ui](injectStrict) Could not resolve ${o.toString()}`);return t}function Nt(){return J("aos")}function Mt(o){const e={};for(const[t,s]of Object.entries(o))e[t]=Number.parseInt(s,10);return e}function D(){return typeof document<"u"}function $e(o={}){const{internalWindow:e=D()?window:void 0,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:s=Number.POSITIVE_INFINITY,includeScrollbar:r=!0}=o,i=n.ref(t),a=n.ref(s);function l(){e&&(r?(i.value=e.innerWidth,a.value=e.innerHeight):(i.value=e.document.documentElement.clientWidth,a.value=e.document.documentElement.clientHeight))}return l(),n.onMounted(()=>{e&&window.addEventListener("resize",l,{passive:!0})}),n.onUnmounted(()=>{e&&window.removeEventListener("resize",l)}),{width:i,height:a}}function $t({initialWidth:o=0,initialHeight:e,includeScrollbar:t,internalWindow:s,listenOrientation:r,breakpoints:i,mediumBreakPoint:a="md",largeBreakPoint:l="lg"}){const{width:u}=$e({initialWidth:o,initialHeight:e,includeScrollbar:t,internalWindow:s,listenOrientation:r}),c=Mt(i),y=n.computed(()=>u.value>=c[l]),E=n.computed(()=>u.value>=c[a]&&u.value<c[l]),b=n.computed(()=>u.value>=0&&u.value<c[a]);return{width:u,numericBreakpoints:c,isSmallScreen:b,isLargeScreen:y,isMediumScreen:E,breakpoints:i}}function Ht(){return J("dialog")}function ze(o,e,t){const s={maxAttempts:20,interval:100,...t};let r=0;function i(){const a=o();a!=null?s.expectedValue!==void 0&&a!==s.expectedValue?r<s.maxAttempts?(r++,setTimeout(i,s.interval)):console.warn(s.errorMessage||`[maz-ui](checkAvailability) Nothing found after ${s.maxAttempts} attempts for ref ${a}`):e(a):r<s.maxAttempts?(r++,setTimeout(i,s.interval)):console.warn(s.errorMessage||`[maz-ui](checkAvailability) Nothing found or expected value after ${s.maxAttempts} attempts for ref ${a}`)}i()}function He(o){const e=n.toValue(o);return Array.isArray(e)?Object.freeze([...e]):typeof e=="object"&&e!==null?Object.freeze({...e}):e}function Se(o){return o==null||typeof o=="string"||typeof o=="number"||typeof o=="boolean"||typeof o=="symbol"||typeof o=="bigint"}function Ft(o,e){if(o.length!==e.length)return!1;for(const[t,s]of o.entries())if(!ee(s,e[t]))return!1;return!0}function jt(o,e){const t=Object.keys(o),s=Object.keys(e);if(t.length!==s.length)return!1;for(const r of t)if(!s.includes(r)||!ee(o[r],e[r]))return!1;return!0}function ee(o,e){return Se(o)||Se(e)?o===e:o instanceof Date&&e instanceof Date?o.getTime()===e.getTime():typeof o!=typeof e||Array.isArray(o)!==Array.isArray(e)?!1:Array.isArray(o)&&Array.isArray(e)?Ft(o,e):typeof o=="object"&&typeof e=="object"?jt(o,e):!1}function qt(o,e,t){const s={};return function(...r){s[o]||(s[o]={timer:null,promise:null});const i=s[o];return i.timer&&clearTimeout(i.timer),i.promise=new Promise((a,l)=>{i.timer=setTimeout(async()=>{try{a(await e(...r))}catch(u){l(u)}finally{delete s[o]}},t)}),i.promise}}function Ut(o,e,t){const s={};return async(...r)=>{const i=Date.now();return s[o]||(s[o]={promise:null,lastCall:0,lastArgs:[]}),i-s[o].lastCall>=t?(s[o].lastCall=i,e(...r)):(s[o].lastArgs=r,s[o].promise||(s[o].promise=new Promise(a=>{setTimeout(async()=>{s[o].lastCall=Date.now();const l=await e(...s[o].lastArgs);s[o].promise=null,a(l)},t-(i-s[o].lastCall))})),s[o].promise)}}const F={mode:"lazy",scrollToErrorSelector:".has-field-error",debounceTime:300,throttleTime:1e3};function Fe(o,e){return Object.keys(e).includes(o)}function xe(o=F.scrollToErrorSelector){const e=document.querySelector(o);e&&e.scrollIntoView({behavior:"smooth",block:"center"})}function Wt(o,e){const t={};for(const[s,r]of Object.entries(o)){const i=r;t[s]=e[s].error&&i[0]?i[0].message:void 0}return t}function Le(o){return o==null||o===""}function Rt({name:o,hasValidation:e,debouncedFields:t,throttledFields:s}){if(!e)return;const r=String(o);if(t!=null&&t[r]&&(s!=null&&s[r]))throw new Error(`The field "${r}" cannot be both debounced and throttled`);return t!=null&&t[r]?qt(r,Q,typeof t[r]=="number"?t[r]:F.debounceTime):s!=null&&s[r]?Ut(r,Q,typeof s[r]=="number"?s[r]:F.throttleTime):Q}function je({name:o,schema:e,initialValue:t,fieldState:s,options:r}){const i=e?Fe(o,e):!1,a=Rt({name:o,hasValidation:i,debouncedFields:r==null?void 0:r.debouncedFields,throttledFields:r==null?void 0:r.throttledFields});return{blurred:!1,dirty:!1,errors:[],error:!1,valid:!i,validating:!1,validated:!1,initialValue:He(t),validateFunction:a,mode:i?(r==null?void 0:r.mode)??(s==null?void 0:s.mode)??F.mode:void 0}}function _t({schema:o,payload:e,options:t}){const s={};for(const r in o){const i=r;s[i]=je({name:i,schema:o,options:t,fieldState:s[i],initialValue:e==null?void 0:e[i]})}return s}function Kt({fieldsStates:o,payload:e,schema:t,options:s,updateMode:r=!1}){for(const i in t){const a=i;o[a]=qe({name:a,fieldState:o[a],payload:e,schema:t,options:s,updateMode:r})}}function qe({name:o,fieldState:e,payload:t,schema:s,options:r,updateMode:i=!0}){const{initialValue:a,mode:l,...u}=je({name:o,schema:s,initialValue:r.defaultValue??t[o],fieldState:e,options:r}),c=i?l??e.mode??F.mode:e.mode;return{...e,initialValue:a,mode:c,...e!=null&&e.mode&&c!==e.mode?u:{}}}function Yt(o){const e={};for(const[t,{errors:s}]of Object.entries(o))e[t]=s;return e}function Zt(o){return o instanceof HTMLInputElement||o instanceof HTMLSelectElement||o instanceof HTMLTextAreaElement?[o]:o.querySelectorAll("input, select, textarea")}function Xt({interactiveElements:o,onBlur:e,mode:t}){o.forEach(s=>{te(["eager","blur","progressive"],t)&&s.addEventListener("blur",e)})}function Gt({interactiveElements:o,onBlur:e}){o.forEach(t=>{t.removeEventListener("blur",e)})}async function Qt(o,e,t){const s=await so(e),i=await(await Re("safeParseAsync"))(s.entries[o],t??"");return{result:i,isValid:i.success}}async function Q({name:o,fieldState:e,schema:t,payload:s,setError:r=!0,setErrorIfInvalidAndNotEmpty:i=!1}){if(await n.nextTick(),e.validating=!0,!t[o]){e.valid=!0,e.validating=!1,e.validated=!0,e.errors=[],e.error=!1;return}const{result:a,isValid:l}=await Qt(o,t,s[o]);e.valid=l,(r||i&&!l&&!Le(s[o]))&&(e.error=!l),e.errors=a.issues??[],e.validating=!1,e.validated=!0}function Ue({name:o,fieldState:e,payload:t,schema:s}){var i;const r={name:o,fieldState:e,payload:t,schema:s,setError:e.mode==="progressive"?e.valid||e.blurred:!0};return(i=e.validateFunction)==null?void 0:i.call(e,r)}function Jt({fieldsStates:o,payload:e,showErrors:t=!0,schema:s}){return Promise.all(Object.keys(o).map(r=>Q({name:r,setError:t,fieldState:o[r],payload:e,schema:s,setErrorIfInvalidAndNotEmpty:o[r].mode==="lazy"})))}function We({eventName:o,fieldState:e,isSubmitted:t}){const{dirty:s,blurred:r,mode:i,valid:a}=e;return o==="blur"&&(te(["lazy","aggressive"],i)||a)||o==="input"&&i==="blur"||!i?!1:t||i==="eager"&&r||i==="blur"&&r||i==="aggressive"&&s||i==="lazy"&&s||i==="progressive"}function eo({name:o,force:e=!1,payload:t,fieldState:s,schema:r,isSubmitted:i}){const a=t[o],l=!Le(a)&&!ee(a,s.initialValue);if(s.dirty=l,s.blurred=s.blurred||(s.mode==="eager"?l:!0),!!(e||We({eventName:"blur",fieldState:s,isSubmitted:i})))return Ue({name:o,fieldState:s,schema:r,payload:t})}function to({name:o,payload:e,fieldState:t,schema:s,isSubmitted:r,forceValidation:i=!1}){const a=e[o];t.validated=!1;const l=!Le(a)&&!ee(a,t.initialValue);if(t.dirty=l,!!(i||We({eventName:"input",fieldState:t,isSubmitted:r})))return Ue({name:o,fieldState:t,schema:s,payload:e})}function Ie(o){const e=n.getCurrentInstance();if(!e)throw new Error(`${o} must be called within setup()`);return e}function oo(o,e){var r;const s=((r=Ie(e).formContexts)==null?void 0:r.get(o))??n.inject(o);if(!s)throw new Error("useFormField must be used within a form (useFormValidator)");return s}function no({ref:o,fieldState:e,onBlur:t}){if(!(o||te(["aggressive","lazy"],e.mode)))return{onBlur:t}}const ye={};async function Re(o){if(ye[o])return ye[o];const e=await Promise.resolve().then(()=>require("./index.CXVZhyjw.cjs"));return ye[o]=e[o],e[o]}async function so(o){return(await Re("objectAsync"))(o)}function te(o,e){return e?o.includes(e):!1}function ro(o,e){const t={formIdentifier:"main-form-validator",...e},{fieldsStates:s,payload:r,options:i,internalSchema:a,errorMessages:l,isSubmitted:u}=oo(t.formIdentifier,"useFormField"),c=Fe(o,a.value)?(e==null?void 0:e.mode)??i.mode:void 0;t.mode=c;const y=n.computed(()=>s.value[o]);if(s.value[o]=qe({name:o,fieldState:y.value,payload:r.value,schema:a.value,options:{...i,...t}}),t.defaultValue!==void 0&&!ee(r.value[o],t.defaultValue)){const h=t.defaultValue;r.value[o]=h,s.value[o].initialValue=He(h)}c&&Q({name:o,fieldState:y.value,payload:r.value,schema:a.value,setError:c==="aggressive",setErrorIfInvalidAndNotEmpty:c==="lazy"});function E(){eo({name:o,fieldState:y.value,payload:r.value,schema:a.value,isSubmitted:u.value})}const b=n.computed(()=>no({ref:t.ref,onBlur:E,fieldState:y.value}));if(t.ref&&te(["eager","blur","progressive"],c)){let h=[];const T=k=>{h=Zt(k),Xt({interactiveElements:h,onBlur:E,mode:c})};n.onMounted(()=>{const k=Ie(`useFormField of ${o}`);ze(()=>k.refs[t.ref],f=>{const m=f instanceof HTMLElement?f:f==null?void 0:f.$el;m&&T(m)},{errorMessage:`[maz-ui](useFormField) No element found for ref ${t.ref} for field ${o}`})}),n.onUnmounted(()=>{Gt({interactiveElements:h,onBlur:E})})}return{hasError:n.computed(()=>y.value.error),errors:n.computed(()=>y.value.errors),errorMessage:n.computed(()=>l.value[o]),isValid:n.computed(()=>y.value.valid),isDirty:n.computed(()=>y.value.dirty),isBlurred:n.computed(()=>y.value.blurred),isValidated:n.computed(()=>y.value.validated),isValidating:n.computed(()=>y.value.validating),mode:n.computed(()=>y.value.mode),value:n.computed({get:()=>r.value[o],set:h=>r.value[o]=h}),validationEvents:b,onBlur:E}}function io({schema:o,defaultValues:e,model:t,options:s}){const r=Ie("useFormValidator"),i={mode:F.mode,scrollToError:F.scrollToErrorSelector,debouncedFields:null,throttledFields:null,identifier:"main-form-validator",...s},a=n.ref(e),l=n.ref({...a.value,...t==null?void 0:t.value}),u=n.ref(o),c=n.ref(_t({schema:u.value,payload:l.value,options:i})),y=n.ref(!1),E=n.ref(!1),b=n.computed(()=>Object.values(c.value).every(({valid:C})=>C)),h=n.computed(()=>Object.values(c.value).some(({dirty:C})=>C)),T=n.computed(()=>Yt(c.value)),k=n.computed(()=>Wt(T.value,c.value));t&&n.watch(l,C=>{t.value={...a.value,...C}},{deep:!0}),n.watch(a,C=>{l.value={...C,...l.value}},{deep:!0}),n.watch(u,C=>{Kt({schema:C,fieldsStates:c.value,payload:l.value,options:i}),f()},{deep:!0}),f();function f(C=i.mode==="aggressive"){return Jt({fieldsStates:c.value,payload:l.value,schema:u.value,showErrors:C})}const m=[];async function z(C){await n.nextTick();const x=n.watch(()=>l.value[C],()=>{const B=c.value[C];to({name:C,fieldState:B,payload:l.value,schema:u.value,isSubmitted:E.value,forceValidation:te(["aggressive","lazy","progressive"],B.mode)})},{deep:typeof u.value[C]=="object"});m.push(x)}function p(){for(const C of m)C();for(const C of Object.keys(u.value))z(C)}function I(C,x){return async B=>{if(B==null||B.preventDefault(),!y.value){E.value=!0,y.value=!0;try{await f(!0);const j=typeof x=="string"?x:i.scrollToError;let H;return b.value?H=await C(l.value):typeof j!="boolean"&&xe(j),y.value=!1,H}finally{y.value=!1}}}}const S={fieldsStates:c,payload:l,options:i,internalSchema:u,errorMessages:k,isSubmitted:E};return r.formContexts??(r.formContexts=new Map),r.formContexts.set(i.identifier,S),n.provide(i.identifier,S),p(),{identifier:i.identifier,isDirty:h,isSubmitting:y,isSubmitted:E,isValid:b,errors:T,model:l,fieldsStates:c,validateForm:f,scrollToError:xe,handleSubmit:I,errorMessages:k}}class _e{constructor(e,t){d(this,"defaultOptions",{element:void 0,timeout:60*1e3*5,once:!1,immediate:!0});d(this,"options");d(this,"timeoutHandler");d(this,"isIdle",!1);d(this,"isDestroy",!1);d(this,"startTime",0);d(this,"remainingTime",0);d(this,"lastClientX",-1);d(this,"lastClientY",-1);d(this,"eventNames",["DOMMouseScroll","mousedown","mousemove","mousewheel","MSPointerDown","MSPointerMove","keydown","touchmove","touchstart","wheel","click"]);d(this,"handleEvent",e=>{try{if(this.remainingTime>0)return;if(e.type==="mousemove"){const{clientX:t,clientY:s}=e;if(t===void 0&&s===void 0||t===this.lastClientX&&s===this.lastClientY)return;this.lastClientX=t,this.lastClientY=s}this.resetTimeout(),this.callback({isIdle:this.isIdle,eventType:e.type,instance:this})}catch(t){throw new Error(`[IdleTimeout](handleEvent) ${t}`)}});this.callback=e,this.options={...this.defaultOptions,...t},D()&&this.start()}get element(){return this.options.element??document.body}start(){if(!D()){console.warn("[IdleTimeout](start) you should run this method on client side");return}for(const e of this.eventNames)this.element.addEventListener(e,this.handleEvent);this.resetTimeout(),this.options.immediate&&this.callback({isIdle:!1,instance:this})}pause(){const e=this.startTime+this.options.timeout-Date.now();e<=0||(this.remainingTime=e,this.timeoutHandler&&(clearTimeout(this.timeoutHandler),this.timeoutHandler=void 0))}resume(){this.remainingTime<=0||(this.resetTimeout(),this.callback({isIdle:this.isIdle,instance:this}),this.remainingTime=0)}reset(){this.isDestroy=!1,this.isIdle=!1,this.remainingTime=0,this.resetTimeout(),this.callback({isIdle:this.isIdle,instance:this})}destroy(){if(!D()){console.warn("[IdleTimeout](destroy) you should run this method on client side");return}this.isDestroy=!0;for(const e of this.eventNames)this.element.removeEventListener(e,this.handleEvent);this.timeoutHandler&&clearTimeout(this.timeoutHandler)}resetTimeout(){this.isIdle=!1,this.timeoutHandler&&(clearTimeout(this.timeoutHandler),this.timeoutHandler=void 0),this.timeoutHandler=setTimeout(this.handleTimeout.bind(this),this.remainingTime||this.options.timeout),this.startTime=Date.now()}handleTimeout(){this.isIdle=!0,this.callback({isIdle:this.isIdle,instance:this}),this.options.once&&this.destroy()}get destroyed(){return this.isDestroy}get timeout(){return this.options.timeout}set timeout(e){this.options.timeout=e}get idle(){return this.isIdle}set idle(e){e?this.handleTimeout():this.reset(),this.callback({isIdle:this.isIdle,instance:this})}}function ao({callback:o,options:e}){return new _e(o,e)}function lo({componentName:o,providedId:e}){return n.computed(()=>e??`${o}-${n.useId().replace(/:/g,"")}`)}const uo=["af-ZA","sq-AL","ar-DZ","ar-BH","ar-EG","ar-IQ","ar-JO","ar-KW","ar-LB","ar-LY","ar-MA","ar-OM","ar-QA","ar-SA","ar-SY","ar-TN","ar-AE","ar-YE","hy-AM","Cy-az-AZ","Lt-az-AZ","eu-ES","be-BY","bg-BG","ca-ES","zh-CN","zh-HK","zh-MO","zh-SG","zh-TW","zh-CHS","zh-CHT","hr-HR","cs-CZ","da-DK","div-MV","nl-BE","nl-NL","en-AU","en-BZ","en-CA","en-CB","en-IE","en-JM","en-NZ","en-PH","en-ZA","en-TT","en-GB","en-US","en-ZW","et-EE","fo-FO","fa-IR","fi-FI","fr-BE","fr-CA","fr-FR","fr-LU","fr-MC","fr-CH","gl-ES","ka-GE","de-AT","de-DE","de-LI","de-LU","de-CH","el-GR","gu-IN","he-IL","hi-IN","hu-HU","is-IS","id-ID","it-IT","it-CH","ja-JP","kn-IN","kk-KZ","kok-IN","ko-KR","ky-KZ","lv-LV","lt-LT","mk-MK","ms-BN","ms-MY","mr-IN","mn-MN","nb-NO","nn-NO","pl-PL","pt-BR","pt-PT","pa-IN","ro-RO","ru-RU","sa-IN","Cy-sr-SP","Lt-sr-SP","sk-SK","sl-SI","es-AR","es-BO","es-CL","es-CO","es-CR","es-DO","es-EC","es-SV","es-GT","es-HN","es-MX","es-NI","es-PA","es-PY","es-PE","es-PR","es-ES","es-UY","es-VE","sw-KE","sv-FI","sv-SE","syr-SY","ta-IN","tt-RU","te-IN","th-TH","tr-TR","uk-UA","ur-PK","Cy-uz-UZ","Lt-uz-UZ","vi-VN"],Ke=["aa","ab","ae","af","ak","am","an","ar","as","av","ay","az","ba","be","bg","bh","bi","bm","bn","bo","br","bs","ca","ce","ch","co","cr","cs","cu","cv","cy","da","de","dv","dz","ee","el","en","eo","es","et","eu","fa","ff","fi","fj","fo","fr","fy","ga","gd","gl","gn","gu","gv","ha","he","hi","ho","hr","ht","hu","hy","hz","ia","id","ie","ig","ii","ik","io","is","it","iu","ja","jv","ka","kg","ki","kj","kk","kl","km","kn","ko","kr","ks","ku","kv","kw","ky","la","lb","lg","li","ln","lo","lt","lu","lv","mg","mh","mi","mk","ml","mn","mr","ms","mt","my","na","nb","nd","ne","ng","nl","nn","no","nr","nv","ny","oc","oj","om","or","os","pa","pi","pl","ps","pt","qu","rm","rn","ro","ru","rw","sa","sc","sd","se","sg","si","sk","sl","sm","sn","so","sq","sr","ss","st","su","sv","sw","ta","te","tg","th","ti","tk","tl","tn","to","tr","ts","tt","tw","ty","ug","uk","ur","uz","ve","vi","vo","wa","wo","xh","yi","yo","za","zh","zu"],Ye=[...Ke,...uo];let P;function Oe(o,e){return!o||(o==null?void 0:o.toLocaleLowerCase())===e.toLocaleLowerCase()}function co(o){function e(s,r){return n.computed(()=>{const i=n.toValue(r),a=n.toValue(s);try{if(!i||!a)return a;(!P||i!==P.resolvedOptions().locale)&&(P=new Intl.DisplayNames([i],{type:"language"}));const l=P.of(a);return!l||Oe(l,a)?void 0:l}catch{return a}})}function t(s){return n.computed(()=>{const r=n.toValue(s);return r?((!P||r!==P.resolvedOptions().locale)&&(P=new Intl.DisplayNames([r],{type:"language"})),Ye.map(i=>{try{const a=P==null?void 0:P.of(i);return!a||Oe(a,i)?void 0:{language:a,code:i}}catch{return}}).filter(Boolean)):[]})}return{getLanguageDisplayName:({code:s,locale:r})=>e(s,r||o),getAllLanguageDisplayNames:s=>t(s||o)}}function Ze(o){const e=o.join(", ").match(/\b\w+\b/g);return e?e.length:0}function mo(o,e=150){const t=Ze([o]);return Math.ceil(t/e)}function fo(o){const e=n.computed(()=>{var a;return typeof o.velocity=="number"?o.velocity:((a=o.velocity)==null?void 0:a.value)??150}),t=n.computed(()=>{var a;return typeof o.contentSelector=="string"?o.contentSelector:(a=o.contentSelector)==null?void 0:a.value}),s=n.computed(()=>{var a,l,u;if(typeof((a=o.contentRef)==null?void 0:a.value)=="object")return(l=o.contentRef.value)==null?void 0:l.textContent;if(t.value&&typeof document<"u"){const c=document.querySelector(t.value);if(c)return c.textContent}return typeof o.content=="string"?o.content:(u=o.content)==null?void 0:u.value}),r=n.computed(()=>mo(s.value,e.value)),i=n.computed(()=>Ze([s.value]));return{content:s,wordCount:i,velocity:e,duration:r}}const ho={removeAccents:!0,caseSensitive:!1,replaceSpaces:!0,removeSpecialCharacters:!1,trim:!0,normalizeSpaces:!0,removeNumbers:!1,customNormalizationForms:["NFC","NFKD"]};function Ee(o,e){const t={...ho,...e},s={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Î:"I",Ï:"I",í:"I",î:"i",ï:"i",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ç:"C",ç:"c",ÿ:"y",Ñ:"N",ñ:"n",ó:"o"};let r=o.toString();if(t.trim&&(r=r.trim()),t.normalizeSpaces&&(r=r.replaceAll(/\s+/g," ")),t.replaceSpaces&&(r=r.replaceAll(" ","-")),t.removeNumbers&&(r=r.replaceAll(/\d/g,"")),t.removeAccents&&(r=r.replaceAll(/[ÀÁÂÃÄÅÇÈÉÊËÎÏÑÔÕÖØÙÚÛÜàáâãäåçèéêëíîïñóôõöøùúûüÿ]/g,i=>s[i]||i),r=r.replaceAll(/[\u0300-\u036F]/g,"")),t.caseSensitive===!1&&(r=r.toLowerCase()),t.removeSpecialCharacters&&(r=r.replaceAll(/[^\dA-Z-]/gi,"")),t.trim&&(r=r.trim()),t.customNormalizationForms)for(const i of t.customNormalizationForms)r=r.normalize(i);return r}function vo(o,e){const t=o.length,s=e.length,r=[];for(let i=0;i<=t;i++)r[i]=[i];for(let i=0;i<=s;i++)r[0][i]=i;for(let i=1;i<=t;i++)for(let a=1;a<=s;a++){const l=o[i-1]===e[a-1]?0:1;r[i][a]=Math.min(r[i-1][a]+1,r[i][a-1]+1,r[i-1][a-1]+l)}return r[t][s]}function Xe(o,e){const t=vo(o,e),s=Math.max(o.length,e.length);return 1-t/s}function po(o,e,t=.75){return Xe(o,e)>=t}function go(o,e,t=.75){const s=n.computed(()=>Ee(typeof o=="string"?o:o.value)),r=n.computed(()=>Ee(typeof e=="string"?e:e.value)),i=n.computed(()=>typeof t=="number"?t:t.value),a=n.computed(()=>Xe(s.value,r.value));return{isMatching:n.computed(()=>po(s.value,r.value,i.value)),score:a}}const yo={preventDefaultOnTouchMove:!1,preventDefaultOnMouseWheel:!1,threshold:50,immediate:!1,triggerOnEnd:!1};class Ge{constructor(e){d(this,"element");d(this,"xStart");d(this,"yStart");d(this,"xEnd");d(this,"yEnd");d(this,"xDiff");d(this,"yDiff");d(this,"onToucheStartCallback");d(this,"onToucheMoveCallback");d(this,"onToucheEndCallback");d(this,"onMouseWheelCallback");d(this,"start");d(this,"stop");d(this,"options");this.inputOption=e,this.options={...yo,...e},this.onToucheStartCallback=this.toucheStartHandler.bind(this),this.onToucheMoveCallback=this.handleTouchMove.bind(this),this.onToucheEndCallback=this.handleTouchEnd.bind(this),this.onMouseWheelCallback=this.handleMouseWheel.bind(this),this.start=this.startListening.bind(this),this.stop=this.stopListening.bind(this),this.options.element&&this.setElement(this.options.element),this.options.immediate&&this.start()}startListening(){this.setElement(this.options.element),this.element.addEventListener("touchstart",this.onToucheStartCallback,{passive:!0}),this.element.addEventListener("touchmove",this.onToucheMoveCallback,{passive:!0}),this.options.triggerOnEnd&&this.element.addEventListener("touchend",this.onToucheEndCallback,{passive:!0}),this.options.preventDefaultOnMouseWheel&&this.element.addEventListener("mousewheel",this.onMouseWheelCallback,{passive:!1})}stopListening(){this.element.removeEventListener("touchstart",this.onToucheStartCallback),this.element.removeEventListener("touchmove",this.onToucheMoveCallback),this.element.removeEventListener("touchend",this.onToucheEndCallback),this.options.preventDefaultOnMouseWheel&&this.element.removeEventListener("mousewheel",this.onMouseWheelCallback)}setElement(e){if(!e){console.error("[maz-ui][SwipeHandler](setElement) Element should be provided. Its can be a string selector or an HTMLElement");return}if(typeof e=="string"){const t=document.querySelector(e);if(!(t instanceof HTMLElement)){console.error("[maz-ui][SwipeHandler](setElement) String selector for element is not found");return}this.element=t}else this.element=e}handleMouseWheel(e){e.preventDefault()}toucheStartHandler(e){this.xStart=e.touches[0].clientX,this.yStart=e.touches[0].clientY,this.emitValuesChanged()}emitValuesChanged(){var e,t;(t=(e=this.options).onValuesChanged)==null||t.call(e,{xStart:this.xStart,yStart:this.yStart,xEnd:this.xEnd,yEnd:this.yEnd,xDiff:this.xDiff,yDiff:this.yDiff})}handleTouchMove(e){this.options.preventDefaultOnTouchMove&&e.cancelable&&e.preventDefault(),this.xEnd=e.touches[0].clientX,this.yEnd=e.touches[0].clientY,!(!this.xStart||!this.yStart)&&(this.xDiff=this.xStart-this.xEnd,this.yDiff=this.yStart-this.yEnd,this.emitValuesChanged(),this.options.triggerOnEnd||this.runCallbacks(e))}handleTouchEnd(e){this.runCallbacks(e),this.emitValuesChanged()}runCallbacks(e){var t,s,r,i,a,l,u,c;typeof this.xDiff!="number"||typeof this.yDiff!="number"||Math.abs(this.xDiff)<this.options.threshold&&Math.abs(this.yDiff)<this.options.threshold||(Math.abs(this.xDiff)>Math.abs(this.yDiff)?this.xDiff>0?(s=(t=this.options).onLeft)==null||s.call(t,e):(i=(r=this.options).onRight)==null||i.call(r,e):this.yDiff>0?(l=(a=this.options).onUp)==null||l.call(a,e):(c=(u=this.options).onDown)==null||c.call(u,e),this.resetValues())}resetValues(){this.xStart=void 0,this.yStart=void 0,this.xEnd=void 0,this.yEnd=void 0,this.xDiff=void 0,this.yDiff=void 0,this.emitValuesChanged()}}function bo(o){const e=n.ref(),t=n.ref(),s=n.ref(),r=n.ref(),i=n.ref(),a=n.ref(),l=n.computed(()=>n.toValue(o.element)),u=new Ge({...o,element:l.value,onValuesChanged(c){e.value=c.xDiff,t.value=c.yDiff,s.value=c.xStart,r.value=c.xEnd,i.value=c.yStart,a.value=c.yEnd}});return{xDiff:e,yDiff:t,xStart:s,xEnd:r,yStart:i,yEnd:a,start:()=>{l.value&&(u.options.element=l.value),u.start()},stop:u.stop}}const wo={darkClass:"dark",lightClass:"light",storageThemeKey:"theme",storageThemeValueDark:"dark",storageThemeValueLight:"light",storageThemeValueSystem:"system",watchChanges:!0},oe=n.ref("system"),$=n.ref("system");function Ve(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function ne({darkClass:o,lightClass:e,storageThemeKey:t,storageThemeValueDark:s,setLocalStorageValue:r=!0,setSelectedTheme:i=!0}){D()&&(document.documentElement.classList.remove(e),document.documentElement.classList.add(o),oe.value=s,i&&($.value=s),r&&(localStorage[t]=s))}function se({darkClass:o,lightClass:e,storageThemeKey:t,storageThemeValueLight:s,setLocalStorageValue:r=!0,setSelectedTheme:i=!0}){D()&&(document.documentElement.classList.remove(o),document.documentElement.classList.add(e),oe.value=s,i&&($.value=s),r&&(localStorage[t]=s))}function Qe({setLocalStorageValue:o=!0,...e}){if(D())return document.documentElement.classList.remove(e.darkClass),document.documentElement.classList.remove(e.lightClass),oe.value=e.storageThemeValueSystem,$.value=e.storageThemeValueSystem,o&&(localStorage[e.storageThemeKey]=e.storageThemeValueSystem),ke(e)}function Je(o){if(!o.defaultTheme)return console.error("[maz-ui](useThemeHandler) No default theme set");if(!["light","dark"].includes(o.defaultTheme))return console.error('[maz-ui](useThemeHandler) Default theme must be "light" or "dark"');switch(o.defaultTheme){case"dark":return ne({...o,setLocalStorageValue:!1,setSelectedTheme:!0});case"light":return se({...o,setLocalStorageValue:!1,setSelectedTheme:!0})}}function ke(o){return D()?!localStorage[o.storageThemeKey]&&o.defaultTheme?Je(o):localStorage[o.storageThemeKey]===o.storageThemeValueDark||!localStorage[o.storageThemeKey]&&Ve()||localStorage[o.storageThemeKey]===o.storageThemeValueSystem&&Ve()?ne({...o,setLocalStorageValue:!1,setSelectedTheme:!1}):se({...o,setLocalStorageValue:!1,setSelectedTheme:!1}):void 0}function be({theme:o,...e}){return o==="system"?Qe(e):o==="dark"?ne(e):se(e)}function Eo(o){return oe.value===o.storageThemeValueDark?se(o):ne(o)}function ko(o){const e={...wo,...o};function t(){ke(e)}return n.onMounted(()=>{localStorage[e.storageThemeKey]&&($.value=localStorage[e.storageThemeKey]),e.watchChanges&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",t)}),n.onBeforeUnmount(()=>{e.watchChanges&&window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",t)}),n.watch($,s=>{switch(localStorage[e.storageThemeKey]=s,s){case e.storageThemeValueDark:{ne(e);break}case e.storageThemeValueLight:{se(e);break}case e.storageThemeValueSystem:{Qe(e);break}}}),{autoSetTheme:()=>ke(e),toggleTheme:()=>Eo(e),setSystemTheme:()=>be({...e,theme:"system"}),setDarkTheme:()=>be({...e,theme:"dark"}),setLightTheme:()=>be({...e,theme:"light"}),setDefaultTheme:()=>Je(e),hasDarkTheme:n.computed(()=>$.value===e.storageThemeValueDark),hasLightTheme:n.computed(()=>$.value===e.storageThemeValueLight),hasSystemTheme:n.computed(()=>$.value===e.storageThemeValueSystem),theme:oe,selectedTheme:$}}function et({timeout:o=1e3,callback:e,remainingTimeUpdate:t=200,callbackOffsetTime:s=0}){const r=n.ref(o),i=n.ref(o);let a;function l(b){typeof b=="number"&&(i.value=b),typeof b=="number"&&(r.value=b),u()}function u(){a||(a=setInterval(()=>{i.value-=t,i.value<=0&&(E(),setTimeout(()=>e==null?void 0:e(),s))},t))}function c(){a&&(clearInterval(a),a=void 0)}function y(){!a&&i.value>0&&u()}function E(){setTimeout(()=>i.value=r.value,s*2),c()}return{remainingTime:i,start:l,pause:c,resume:y,stop:E}}function Co(){return J("toast")}class tt{constructor(e,t){d(this,"eventHandlerFunction");d(this,"event","visibilitychange");d(this,"timeoutHandler");d(this,"options");d(this,"defaultOptions",{timeout:5e3,once:!1,immediate:!0});d(this,"isVisible",!1);this.callback=e,this.options={...this.defaultOptions,...t},this.eventHandlerFunction=this.eventHandler.bind(this),D()&&this.start()}start(){if(!D()){console.warn("[UserVisibility](start) you should run this method on client side");return}this.options.immediate&&this.emitCallback(),this.addEventListener()}emitCallback(){this.isVisible=document.visibilityState==="visible",this.callback({isVisible:this.isVisible}),this.options.once&&this.destroy()}eventHandler(){document.visibilityState==="visible"&&!this.isVisible?(this.clearTimeout(),this.emitCallback()):document.visibilityState==="hidden"&&this.initTimeout()}clearTimeout(){this.timeoutHandler&&(clearTimeout(this.timeoutHandler),this.timeoutHandler=void 0)}initTimeout(){this.clearTimeout(),this.timeoutHandler=setTimeout(this.emitCallback.bind(this),this.options.timeout)}addEventListener(){document.addEventListener(this.event,this.eventHandlerFunction)}removeEventListener(){document.removeEventListener(this.event,this.eventHandlerFunction)}destroy(){this.removeEventListener(),this.timeoutHandler&&clearTimeout(this.timeoutHandler)}}function To({callback:o,options:e}){return new tt(o,e)}function zo(){return J("wait")}const me="__maz-click-outside__";function ot(){return document.ontouchstart===null?"touchstart":"click"}async function nt(o,e){try{st(o);const t=e.instance,s=e.value,r=typeof s=="function";if(!r)throw new Error("[maz-ui](vClickOutside) the callback should be a function");await n.nextTick(),o[me]=a=>{if((!o||a.target&&!o.contains(a.target))&&s&&r)return s.call(t,a)};const i=ot();document.addEventListener(i,o[me],{passive:!0})}catch(t){console.error("[maz-ui](vClickOutside)",t)}}function st(o){try{const e=ot();document.removeEventListener(e,o[me],!1),delete o[me]}catch(e){console.error("[maz-ui](vClickOutside)",e)}}function Lo(o,e){try{if(e.value===e.oldValue)return;nt(o,e)}catch(t){console.error("[maz-ui](vClickOutside)",t)}}const rt={mounted:nt,updated:Lo,unmounted:st},it={install:o=>{o.directive("click-outside",rt)}};function at(o,e,t){var a,l;o.stopPropagation();const s=typeof t.value=="function"?t.value:t.value.handler,r=typeof t.value=="object"?t.value.exclude:void 0;let i=!1;if(r&&r.length>0){for(const u of r)if(!i&&o.target instanceof HTMLElement){const c=(a=document.querySelector(u))==null?void 0:a.getAttribute("id");i=(o.target.getAttribute("id")===c||((l=document.querySelector(u))==null?void 0:l.contains(o.target)))??!1}}!e.contains(o.target)&&!i&&(s==null||s(o))}function lt(){return document.ontouchstart===null?"touchstart":"click"}function Io(o,e){const t=lt();document.removeEventListener(t,s=>at(s,o,e))}function Ao(o,e){if(typeof e.value!="function"&&typeof e.value=="object"&&typeof e.value.handler!="function"){console.error("[maz-ui](vClosable) v-closable directive requires a handler function");return}const t=lt();document.addEventListener(t,s=>at(s,o,e))}const ut={mounted:Ao,unmounted:Io},ct={install:o=>{o.directive("closable",ut)}},Ce={position:"top"};class dt{constructor(e={}){d(this,"options");this.options={...Ce,...e}}getPosition({modifiers:e,value:t}){return e.top?"top":e.bottom?"bottom":e.left?"left":e.right?"right":typeof t=="string"?"top":t.position??this.options.position}getText({value:e}){return typeof e=="string"?e:e.text}getOpen({value:e}){return typeof e=="string"?!1:e.open??!1}getColor({value:e}){return typeof e=="string"?"default":e.color??"default"}getOffset({value:e}){return typeof e=="string"?"1rem":e.offset??"1rem"}create(e,t){e.setAttribute("data-tooltip",this.getText(t));const s=this.getOffset(t);s&&e.style.setProperty("--tooltip-offset",s),e.classList.add("m-tooltip");const r=this.getPosition(t);e.classList.add(`m-tooltip--${r}`),e.classList.add(`m-tooltip--${this.getColor(t)}`),this.getOpen(t)&&e.classList.add("m-tooltip--open")}update(e,t){this.remove(e,t),this.create(e,t)}remove(e,t){e.removeAttribute("data-tooltip"),e.classList.remove("m-tooltip"),e.classList.remove("m-tooltip--top"),e.classList.remove("m-tooltip--bottom"),e.classList.remove("m-tooltip--left"),e.classList.remove("m-tooltip--right"),e.classList.remove("m-tooltip--open"),e.classList.remove(`m-tooltip--${this.getColor(t)}`)}}let le;const So={beforeMount(o,e){const t=typeof e.value=="object"?e.value:{};return le=new dt(t),le.create(o,e)},updated(o,e){return le.update(o,e)},unmounted(o,e){return le.remove(o,e)}},mt={install:(o,e=Ce)=>{const t={...Ce,...e},s=new dt(t);o.directive("tooltip",{beforeMount:s.create.bind(s),updated:s.update.bind(s),unmounted:s.remove.bind(s)})}};function fe(o,e){let t=e==null?void 0:e.element;function s(){t&&n.render(null,t)}const r={...e==null?void 0:e.props,...e!=null&&e.addDestroyInProps?{destroy:s}:{}},i=n.createVNode(o,r,e==null?void 0:e.children);return e!=null&&e.app?(i.appContext=e.app._context,t?n.render(i,t):typeof document<"u"&&(t=document.createElement("div"),n.render(i,t))):(t=t??document.body,n.render(i,t)),{vNode:i,destroy:s,el:t}}function ft(o){return!!o}function xo(o){return[...o].map(e=>{const t=e.codePointAt(0);return t?t%32+127461:void 0}).filter(ft).map(e=>String.fromCodePoint(e)).join("")}function Oo(o,e){let t;return function(...s){clearTimeout(t),t=setTimeout(()=>{o.apply(this,s)},e)}}class Vo{constructor({src:e,identifier:t,once:s=!0,async:r=!0,defer:i=!0}){d(this,"src");d(this,"script");d(this,"once");d(this,"async");d(this,"defer");d(this,"identifier");if(typeof window>"u")throw new TypeError("[ScriptLoader]: Is supported only on browser side");if(!e)throw new Error('[ScriptLoader]: You should provide the attribut "src"');if(!t)throw new Error('[ScriptLoader]: You should provide the attribut "identifier"');this.src=e,this.identifier=t,this.once=s,this.async=r,this.defer=i}removeTag(e){var t;typeof e=="string"?(t=document.head.querySelector(`[data-identifier="${e}"]`))==null||t.remove():e.remove()}load(){const e=window,t=document.head.querySelectorAll(`[data-identifier="${this.identifier}"]`);if(this.once&&e[this.identifier]&&t.length>0)return this.script=e[this.identifier],Promise.resolve(this.script);if(!this.once&&t.length>0)for(const s of t)this.removeTag(s);return this.injectScript()}injectScript(){const e=window;return new Promise((t,s)=>{try{const r=document.createElement("script");r.src=this.src,r.async=this.async,r.defer=this.defer,r.dataset.identifier=this.identifier,r.addEventListener("error",i=>s(new Error(`[ScriptLoader](injectScript) ${i.message}`))),r.addEventListener("load",i=>(this.script=i,e[this.identifier]=i,t(i))),document.head.append(r)}catch(r){throw new Error(`[ScriptLoader](init) ${r}`)}})}}function ht(o){return new Promise(e=>setTimeout(e,o))}function Do(o,e){let t=!1,s,r;return function(...i){t?(clearTimeout(s),s=setTimeout(()=>{Date.now()-r>=e&&(o.apply(this,i),r=Date.now())},Math.max(e-(Date.now()-r),0))):(o.apply(this,i),r=Date.now(),t=!0)}}const Bo=["onKeypress"],Po={class:"m-fullscreen-img-scroller"},No=["src","alt"],Mo=n.defineComponent({__name:"MazFullscreenImg",props:{src:{},clickedElementBounds:{default:void 0},offset:{default:void 0},animation:{default:()=>({duration:300,easing:"ease-in-out"})},openInstanceClass:{default:"m-fullscreen-img-instance"},clickedElement:{},destroy:{type:Function,default:void 0},alt:{default:void 0},zoom:{type:Boolean,default:!0}},emits:["close","previous","next","before-close"],setup(o,{emit:e}){const t=o,s=e,r=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./MazSpinner.Ci076Hb-.cjs"))),i=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./x-mark.DW2WXkoF.cjs"))),a=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./chevron-left.Byr9GkwI.cjs"))),l=n.ref(!1),u=n.ref(!1),c=n.ref(!1),y=n.ref(!1),E=n.ref(!1),b=n.reactive({running:!1,ended:!1}),h=n.ref(t.clickedElement),T=n.computed(()=>t.clickedElement.getBoundingClientRect()),k=n.ref(),f=n.ref(t.src),m=n.ref(t.alt),z=n.ref(),p=n.ref(),I=n.ref(!0),S=n.computed(()=>({"--is-zoomed":E.value,"--invisible":I.value,"--absolute":!E.value}));function C(){var g,w;p.value&&(k.value=((g=p.value)==null?void 0:g.naturalWidth)>((w=p.value)==null?void 0:w.naturalHeight)),l.value=!0,u.value=!1,c.value=!0}n.watch(c,g=>{g&&A()},{immediate:!0});function x(){s("before-close"),O()}function B(g){g.key==="Escape"&&(g.preventDefault(),x()),(g.key==="ArrowLeft"||g.key==="ArrowRight")&&(g.preventDefault(),Y(g.key==="ArrowRight"?"next":"previous"))}function j(){document.documentElement.classList.add("--m-fullscreen-open")}function H(){document.documentElement.classList.remove("--m-fullscreen-open")}function _(){return[...document.querySelectorAll(".m-fullscreen-img-instance")]}function he(g,w){return w<0?g.length-1:w>=g.length?0:w}function K(g,w){g.classList.remove(t.openInstanceClass),w.classList.add(t.openInstanceClass);const L=w.getAttribute("data-src"),V=w.getAttribute("data-alt");m.value=V,f.value=L??f.value}function Y(g){I.value=!0;const w=document.querySelector(`.m-fullscreen-img-instance.${t.openInstanceClass}`);if(w){const L=_(),V=L.indexOf(w),N=g==="next"?V+1:V-1,M=L[he(L,N)];h.value=M,M&&K(w,M),s(g),l.value=!1,u.value=!0,ze(()=>l.value===!0,()=>{I.value=!1,E.value?Z():v()},{expectedValue:!0,interval:100,maxAttempts:50})}}function Z(){const g=p.value;if(!g){console.error("[maz-ui](vFullscreenImg) ImgElement is not defined");return}g.style.removeProperty("max-width"),g.style.removeProperty("max-height"),g==null||g.style.removeProperty("top"),g==null||g.style.removeProperty("left"),k.value?(g.style.height="100vh",g.style.removeProperty("width")):(g.style.width="100vw",g.style.removeProperty("height"))}function ve(){E.value?(E.value=!E.value,v()):(E.value=!E.value,Z())}function q(g){var L;b.running=!0,I.value=!1;const w=(L=p.value)==null?void 0:L.animate(g,{duration:t.animation.duration,easing:t.animation.easing});if(!w){console.error("[maz-ui](vFullscreenImg) animation is not defined"),b.running=!1,b.ended=!0;return}return w}function ie(g=t.offset??0){const w=h.value.clientWidth||1,L=h.value.clientHeight||1,V=window.innerWidth,N=window.innerHeight,M=Math.min((V-2*g)/w,(N-2*g)/L),pe=(V-w*M)/2,ge=(N-L*M)/2;return{centerX:pe,centerY:ge,width:w,height:L,scale:M}}function ae({trigger:g}){const{width:w,height:L,scale:V,centerX:N,centerY:M}=ie(),{top:pe,left:ge,width:Vt,height:Dt}=T.value,Ae=[{top:`${pe}px`,left:`${ge}px`,width:`${Vt}px`,height:`${Dt}px`,opacity:0},{top:`${M}px`,left:`${N}px`,width:`${w*V}px`,height:`${L*V}px`,opacity:1}];return{frames:g==="open"?Ae:Ae.reverse()}}function v(){const{height:g,width:w,scale:L}=ie(),V=k.value?{width:`${w*L}px`,maxHeight:`${g*L}px`}:{height:`${g*L}px`,maxWidth:`${w*L}px`};if(!p.value){console.error("[maz-ui](vFullscreenImg) ImgElement is not defined");return}k.value?(p.value.style.removeProperty("height"),p.value.style.removeProperty("maxHeight")):(p.value.style.removeProperty("width"),p.value.style.removeProperty("maxWidth")),Object.assign(p.value.style,V)}function A(){const{frames:g}=ae({trigger:"open"}),w=q(g);if(!w){console.error("[maz-ui](vFullscreenImg) open animation is not defined"),v();return}w.onfinish=()=>{v(),b.running=!1,b.ended=!0}}function O(){const{frames:g}=ae({trigger:"close"}),w=q(g);function L(){var V,N;s("close"),(V=z.value)==null||V.remove(),(N=t.destroy)==null||N.call(t),b.running=!1,b.ended=!0}if(!w){console.error("[maz-ui](vFullscreenImg) close animation is not defined"),L();return}w.onfinish=L}function X(){E.value||v()}return n.onMounted(()=>{u.value=!0,document.addEventListener("keydown",B),window.addEventListener("resize",X),j(),y.value=_().length>1}),n.onBeforeUnmount(()=>{document.removeEventListener("keydown",B),window.removeEventListener("resize",X),H()}),(g,w)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"FullscreenImgElement",ref:z,role:"button",class:"m-fullscreen-img m-reset-css",tabindex:"0",onClick:n.withModifiers(x,["stop"]),onKeypress:n.withKeys(n.withModifiers(x,["prevent"]),["esc"])},[c.value&&y.value?(n.openBlock(),n.createElementBlock("button",{key:0,type:"button",class:"m-fullscreen-btn --next",onClick:w[0]||(w[0]=n.withModifiers(L=>Y("next"),["stop"]))},[n.createVNode(n.unref(a),{class:"maz-rotate-180"})])):n.createCommentVNode("v-if",!0),c.value&&y.value?(n.openBlock(),n.createElementBlock("button",{key:1,type:"button",class:"m-fullscreen-btn --previous",onClick:w[1]||(w[1]=n.withModifiers(L=>Y("previous"),["stop"]))},[n.createVNode(n.unref(a))])):n.createCommentVNode("v-if",!0),n.createElementVNode("button",{type:"button",class:"m-fullscreen-btn --close",onClick:x},[n.createVNode(n.unref(i))]),n.createElementVNode("div",Po,[n.createElementVNode("img",{ref_key:"ImgElement",ref:p,src:f.value,alt:m.value??void 0,tabindex:"0",class:n.normalizeClass([S.value]),onLoad:C,onClick:w[2]||(w[2]=n.withModifiers(L=>g.zoom&&ve(),["stop"]))},null,42,No),n.withDirectives(n.createVNode(n.unref(r),{class:"m-fullscreen-img-loader"},null,512),[[n.vShow,u.value]])])],40,Bo))}}),re=(o,e)=>{const t=o.__vccOpts||o;for(const[s,r]of e)t[s]=r;return t},$o=re(Mo,[["__scopeId","data-v-24a18baf"]]),De="m-fullscreen-is-open";class Ho{constructor(){d(this,"options");d(this,"defaultOptions",{scaleOnHover:!1,blurOnHover:!1,disabled:!1,zoom:!0,offset:80,animation:{duration:300,easing:"ease-in-out"}});d(this,"mouseEnterListener");d(this,"mouseLeaveListener");d(this,"renderPreviewListener")}buildOptions(e,t){const s=typeof t.value=="object"?t.value:{src:t.value,alt:void 0},r=(s==null?void 0:s.src)??this.getImgSrc(e),i=(s==null?void 0:s.alt)??this.getImgAlt(e);return{...this.defaultOptions,...s,src:r,alt:i}}get allInstances(){return[...document.querySelectorAll(".m-fullscreen-img-instance")]}getImgSrc(e){var s;const t=((s=this.options)==null?void 0:s.src)||e.getAttribute("src")||e.getAttribute("data-src");if(!t)throw new Error('[maz-ui](fullscreen-img) src of image must be provided by `v-fullscreen=""`, `v-fullscreen="{ src: "" }"`, `src=""` or `data-src=""` atributes');return t}getImgAlt(e){var t;return((t=this.options)==null?void 0:t.alt)||e.getAttribute("alt")||e.getAttribute("data-alt")}create(e,t){if(this.options=this.buildOptions(e,t),this.options.disabled)return;e.style.cursor="move",(this.options.scaleOnHover||this.options.blurOnHover)&&(e.style.transition="all 200ms ease-in-out"),e.classList.add("m-fullscreen-img-instance"),e.setAttribute("data-src",this.getImgSrc(e));const s=this.getImgAlt(e);s&&e.setAttribute("data-alt",s),this.mouseEnterListener=()=>this.mouseEnter(e),this.mouseLeaveListener=()=>this.mouseLeave(e),this.renderPreviewListener=()=>this.renderPreview(e),e.addEventListener("mouseenter",this.mouseEnterListener),e.addEventListener("mouseleave",this.mouseLeaveListener),e.addEventListener("click",this.renderPreviewListener)}update(e,t){this.options=this.buildOptions(e,t)}remove(e){e.removeEventListener("mouseenter",this.mouseEnterListener),e.removeEventListener("mouseleave",this.mouseLeaveListener),e.removeEventListener("click",this.renderPreviewListener),e.classList.remove("m-fullscreen-img-instance"),e.style.cursor=""}renderPreview(e){return e.classList.add(De),fe($o,{props:{...this.options,openInstanceClass:De,clickedElement:e,clickedElementBounds:e.getBoundingClientRect()},addDestroyInProps:!0})}mouseLeave(e){this.options.scaleOnHover&&(e.style.transform=""),this.options.blurOnHover&&(e.style.filter=""),e.style.zIndex=""}mouseEnter(e){e.style.zIndex="1",this.options.scaleOnHover&&(e.style.transform="scale(1.04)"),this.options.blurOnHover&&(e.style.filter="blur(3px)")}}let ue;const vt={mounted(o,e){return ue=new Ho,ue.create(o,e)},updated(o,e){return ue.update(o,e)},unmounted(o){return ue.remove(o)}},pt={install(o){o.directive("fullscreen-img",vt)}},Fo="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Te={baseClass:"m-lazy-img",loadedClass:"m-lazy-loaded",loadingClass:"m-lazy-loading",errorClass:"m-lazy-error",noPhotoClass:"m-lazy-no-photo",noPhoto:!1,observerOnce:!0,loadOnce:!1,noUseErrorPhoto:!1,observerOptions:{threshold:.1}};class gt{constructor(e={}){d(this,"observers",[]);d(this,"defaultOptions",Te);d(this,"options");d(this,"onImgLoadedCallback");d(this,"onImgErrorCallback");d(this,"hasImgLoaded",!1);this.options=this.buildOptions(e),this.onImgLoadedCallback=this.imageIsLoaded.bind(this),this.onImgErrorCallback=this.imageHasError.bind(this)}async loadErrorPhoto(){const{default:e}=await Promise.resolve().then(()=>require("./no-photography.CLNgmzDi.cjs"));return e}buildOptions(e){return{...this.defaultOptions,...e,observerOptions:{...this.defaultOptions.observerOptions,...e.observerOptions}}}removeClass(e,t){e.classList.remove(t)}addClass(e,t){e.classList.add(t)}removeAllStateClasses(e){this.removeClass(e,this.options.loadedClass),this.removeClass(e,this.options.loadingClass),this.removeClass(e,this.options.errorClass),this.removeClass(e,this.options.noPhotoClass)}setBaseClass(e){this.addClass(e,this.options.baseClass)}imageIsLoading(e){var t,s;this.addClass(e,this.options.loadingClass),(s=(t=this.options).onLoading)==null||s.call(t,e)}imageHasNoPhoto(e){this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.noPhotoClass),this.setDefaultPhoto(e)}imageIsLoaded(e){var t,s;this.hasImgLoaded=!0,this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.loadedClass),(s=(t=this.options).onLoaded)==null||s.call(t,e)}imageHasError(e){var t,s;this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.errorClass),(s=(t=this.options).onError)==null||s.call(t,e),this.setDefaultPhoto(e)}getSrc(e){return typeof e.value=="object"?e.value.src:e.value}getImageUrl(e,t){const s=this.getImgElement(e).getAttribute("data-lazy-src");return s||this.getSrc(t)}async setPictureSourceUrls(e){const t=e.querySelectorAll("source");if(t.length>0)for await(const s of t){const r=s.getAttribute("data-lazy-srcset");if(r)s.srcset=r;else return this.imageHasError(e)}else this.imageHasError(e)}hasBgImgMode(e){return e.arg==="bg-image"}isPictureElement(e){return e instanceof HTMLPictureElement}getImgElement(e){return this.isPictureElement(e)?e.querySelector("img"):e}async setDefaultPhoto(e){if(this.options.noUseErrorPhoto)return;const t=this.options.fallbackSrc??this.options.errorPhoto;typeof t=="string"&&this.addClass(e,this.options.noPhotoClass);const s=t??await this.loadErrorPhoto(),r=e.querySelectorAll("source");if(r.length>0)for await(const i of r)i.srcset=s;else this.setImgSrc(e,s)}addEventListenerToImg(e){const t=this.getImgElement(e);t.addEventListener("load",()=>this.onImgLoadedCallback(e),{once:!0}),t.addEventListener("error",s=>this.onImgErrorCallback(e,s),{once:!0})}async loadImage(e,t){if(this.imageIsLoading(e),this.isPictureElement(e))this.addEventListenerToImg(e),await this.setPictureSourceUrls(e);else{const s=this.getImageUrl(e,t);if(!s)return this.imageHasError(e);this.hasBgImgMode(t)?(e.style.backgroundImage=`url('${s}')`,this.imageIsLoaded(e)):(this.addEventListenerToImg(e),this.setImgSrc(e,s))}}setImgSrc(e,t){const s=this.getImgElement(e);s.src=t}handleIntersectionObserver(e,t,s,r){var i,a;this.observers.push(r);for(const l of s)if(l.isIntersecting){if((a=(i=this.options).onIntersecting)==null||a.call(i,l.target),this.options.observerOnce&&r.unobserve(e),this.options.loadOnce&&this.hasImgLoaded)return;this.loadImage(e,t)}}createObserver(e,t){const s=(a,l)=>{this.handleIntersectionObserver(e,t,a,l)},r=this.options.observerOptions;new IntersectionObserver(s,r).observe(e)}async imageHandler(e,t,s){if(s==="update")for await(const r of this.observers)r.unobserve(e);window.IntersectionObserver?this.createObserver(e,t):this.loadImage(e,t)}async bindUpdateHandler(e,t,s){if(this.options.noPhoto)return this.imageHasNoPhoto(e);await this.imageHandler(e,t,s)}async add(e,t){if(this.hasBgImgMode(t)&&this.isPictureElement(e))throw new Error(`[MazLazyImg] You can't use the "bg-image" mode with "<picture />" element`);setTimeout(()=>this.setBaseClass(e),0),e.getAttribute("src")||this.setImgSrc(e,Fo),await this.bindUpdateHandler(e,t,"bind")}async update(e,t){t.value!==t.oldValue&&(this.hasImgLoaded=!1,this.removeAllStateClasses(e),await this.bindUpdateHandler(e,t,"update"))}remove(e,t){this.hasImgLoaded=!1,this.hasBgImgMode(t)&&(e.style.backgroundImage=""),this.removeAllStateClasses(e);for(const s of this.observers)s.unobserve(e);this.observers=[]}}let ce;const jo={created(o,e){const t=typeof e.value=="object"?e.value:{};ce=new gt(t),ce.add(o,e)},updated(o,e){ce.update(o,e)},unmounted(o,e){ce.remove(o,e)}},yt={install(o,e={}){const t={...Te,...e,observerOptions:{...Te.observerOptions,...e.observerOptions}},s=new gt(t);o.directive("lazy-img",{created:s.add.bind(s),updated:s.update.bind(s),unmounted:s.remove.bind(s)})}},qo=`
.maz-zoom-img {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
padding: 1rem;
z-index: 1050;
background-color: hsla(238, 15%, 40%, 0.7);
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.maz-zoom-img,
.maz-zoom-img * {
box-sizing: border-box;
}
.maz-zoom-img .maz-zoom-img__wrapper {
position: relative;
display: flex;
justify-content: center;
align-items: center;
min-width: 0;
min-height: 0;
max-width: 100%;
max-height: 100%;
transition: all 300ms ease-in-out;
opacity: 0;
transform: scale(0.5);
}
.maz-zoom-img.maz-animate .maz-zoom-img__wrapper {
opacity: 1;
transform: scale(1);
}
.maz-zoom-img.maz-animate .maz-zoom-img__loader {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
align-items: center;
justify-content: center;
background-color: hsla(238, 15%, 40%, 0.7);
border-radius: 1rem;
z-index: 2;
min-width: 60px;
min-height: 60px;
}
.maz-zoom-img.maz-animate .maz-zoom-img__loader[hidden] {
display: none;
}
@-webkit-keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.maz-zoom-img.maz-animate .maz-zoom-img__loader__svg {
animation: spin .6s linear infinite;
}
.maz-zoom-img img {
max-width: 100%;
max-height: 100%;
min-width: 0;
border-radius: 1rem;
}
.maz-zoom-img .maz-zoom-btn {
margin: 0 auto;
border: none;
background-color: hsla(0, 0%, 7%, 0.5);
box-shadow: 0 0 0.5rem 0 hsla(0, 0%, 0%, 0.2);
height: 2.2rem;
min-height: 2.2rem;
width: 2.2rem;
min-width: 2.2rem;
display: flex;
align-items: center;
justify-content: center;
border-radius: 2.2rem;
cursor: pointer;
flex: 0 0 auto;
outline: none;
}
.maz-zoom-img .maz-zoom-btn svg {
fill: white;
}
.maz-zoom-