maz-ui 3.47.0 → 3.47.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/MazAvatar.mjs +1 -1
- package/components/MazBottomSheet.mjs +1 -1
- package/components/MazBtn.mjs +1 -1
- package/components/MazCard.mjs +1 -1
- package/components/MazCarousel.mjs +1 -1
- package/components/MazCheckbox.d.ts +1 -6
- package/components/MazChecklist.d.ts +1 -4
- package/components/MazChecklist.mjs +1 -1
- package/components/MazDialog.d.ts +1 -6
- package/components/MazDialog.mjs +1 -1
- package/components/MazDialogPromise.mjs +1 -1
- package/components/MazDrawer.mjs +1 -1
- package/components/MazDropdown.mjs +1 -1
- package/components/MazDropzone.d.ts +1 -22
- package/components/MazDropzone.mjs +1 -1
- package/components/MazFullscreenLoader.d.ts +4 -5
- package/components/MazFullscreenLoader.mjs +29 -20
- package/components/MazGallery.mjs +1 -1
- package/components/MazInput.d.ts +1 -8
- package/components/MazInput.mjs +1 -1
- package/components/MazInputCode.d.ts +1 -4
- package/components/MazInputNumber.mjs +1 -1
- package/components/MazInputPrice.mjs +1 -1
- package/components/MazInputTags.mjs +1 -1
- package/components/MazLazyImg.d.ts +2 -0
- package/components/MazLazyImg.mjs +1 -1
- package/components/MazPagination.mjs +1 -1
- package/components/MazPhoneNumberInput.d.ts +1 -20
- package/components/MazPhoneNumberInput.mjs +1 -1
- package/components/MazPicker.mjs +1 -1
- package/components/MazPullToRefresh.mjs +1 -1
- package/components/MazRadio.d.ts +1 -6
- package/components/MazRadioButtons.d.ts +1 -6
- package/components/MazSelect.d.ts +1 -10
- package/components/MazSelect.mjs +1 -1
- package/components/MazSpinner.d.ts +13 -23
- package/components/MazSpinner.mjs +13 -16
- package/components/MazTable.d.ts +34 -6
- package/components/MazTable.mjs +1 -1
- package/components/assets/MazLazyImg.css +1 -1
- package/components/assets/MazPhoneNumberInput.css +1 -1
- package/components/assets/MazSpinner.css +1 -1
- package/components/chunks/{MazAvatar-BmaVqPui.mjs → MazAvatar-DFoZvWmg.mjs} +1 -1
- package/components/chunks/{MazBottomSheet-BvdiOa8P.mjs → MazBottomSheet-DqK0EOsq.mjs} +1 -1
- package/components/chunks/{MazBtn-CVDDOeLF.mjs → MazBtn-BRUaoP8j.mjs} +1 -1
- package/components/chunks/{MazBtn-D6T9wOxO.mjs → MazBtn-BRnLMzhy.mjs} +2 -2
- package/components/chunks/{MazBtn-B7rKmEGw.mjs → MazBtn-BhnOApJu.mjs} +2 -2
- package/components/chunks/{MazBtn-4g56EBmg.mjs → MazBtn-C28vKP_v.mjs} +1 -1
- package/components/chunks/{MazBtn-BRdMg4tc.mjs → MazBtn-CnqRnXh_.mjs} +2 -2
- package/components/chunks/{MazBtn-DYMxHlYa.mjs → MazBtn-CweCwE_4.mjs} +2 -2
- package/components/chunks/{MazBtn-D_IQO-P2.mjs → MazBtn-D6Jxw9Nr.mjs} +2 -2
- package/components/chunks/{MazBtn-B3i4Ypas.mjs → MazBtn-D7IKoL2c.mjs} +2 -2
- package/components/chunks/MazBtn-DlD5m7T4.mjs +118 -0
- package/components/chunks/{MazBtn-4jMQE2G-.mjs → MazBtn-Dt8lr0GH.mjs} +2 -2
- package/components/chunks/{MazBtn-BvirhKh3.mjs → MazBtn-DzBXfedt.mjs} +1 -1
- package/components/chunks/MazBtn-Mu18egu5.mjs +118 -0
- package/components/chunks/{MazBtn-CEOWwReA.mjs → MazBtn-TkePGm5o.mjs} +2 -2
- package/components/chunks/{MazBtn-BAxR_dt3.mjs → MazBtn-igor8wRn.mjs} +2 -2
- package/components/chunks/{MazCard-StYuQv11.mjs → MazCard-CfkvpcGL.mjs} +1 -1
- package/components/chunks/{MazCarousel-DEO7Tz8F.mjs → MazCarousel-BEl86YGW.mjs} +1 -1
- package/components/chunks/{MazCheckbox-TiwCiE2s.mjs → MazCheckbox-BKCo6EzO.mjs} +1 -1
- package/components/chunks/{MazCheckbox-D9RW0OPf.mjs → MazCheckbox-Byqz8JJB.mjs} +1 -1
- package/components/chunks/{MazCheckbox-CtiUQoBe.mjs → MazCheckbox-CI8ml-P8.mjs} +1 -1
- package/components/chunks/{MazChecklist-B9bw1Mn4.mjs → MazChecklist-BLxsNHMP.mjs} +1 -1
- package/components/chunks/{MazDialog-C3urFx7y.mjs → MazDialog-CPgFpAlq.mjs} +1 -1
- package/components/chunks/{MazDialogPromise-BuOWwo6n.mjs → MazDialogPromise-BCCdkrea.mjs} +119 -112
- package/components/chunks/{MazDropzone-D32tLLpO.mjs → MazDropzone-DKFkgqqD.mjs} +1 -1
- package/components/chunks/{MazGallery-DLNvXEka.mjs → MazGallery-BKL7gfrz.mjs} +2 -2
- package/components/chunks/{MazGallery-BOmH2smL.mjs → MazGallery-BMFwld84.mjs} +1 -1
- package/components/chunks/{MazIcon-DyrYf9Sl.mjs → MazIcon-D8V8ixhf.mjs} +1 -1
- package/components/chunks/{MazInput-BZ2U145p.mjs → MazInput-CBiCdd0F.mjs} +1 -1
- package/components/chunks/{MazInput-Bq_SbBRE.mjs → MazInput-Dx2cCzFS.mjs} +2 -2
- package/components/chunks/{MazInput-_rEW9XWJ.mjs → MazInput-O6Q41Fm0.mjs} +2 -2
- package/components/chunks/{MazInputNumber-G8880Neu.mjs → MazInputNumber-DYPVUz4k.mjs} +1 -1
- package/components/chunks/{MazInputPrice-DROLM9PX.mjs → MazInputPrice-DZD7ZZpm.mjs} +1 -1
- package/components/chunks/{MazInputTags-BRmcZBo4.mjs → MazInputTags-CxXBsTdM.mjs} +1 -1
- package/components/chunks/{MazLazyImg-i-z6hcwF.mjs → MazLazyImg-B-6PQWEi.mjs} +9 -8
- package/components/chunks/{MazLazyImg-RHZ9wOy2.mjs → MazLazyImg-C03sUOXs.mjs} +6 -5
- package/components/chunks/{MazLoadingBar-DHFjKEEm.mjs → MazLoadingBar-Di2OIrPD.mjs} +1 -1
- package/components/chunks/{MazPagination-6MyYnTer.mjs → MazPagination-CHTMRRqE.mjs} +1 -1
- package/components/chunks/{MazPhoneNumberInput-r6OjPeRI.mjs → MazPhoneNumberInput-C4TX1tGw.mjs} +112 -111
- package/components/chunks/{MazPicker-B28fQccE.mjs → MazPicker-BcQ_-AJH.mjs} +2 -2
- package/components/chunks/{MazPickerMonthSwitcher-DrtbXCca.mjs → MazPickerMonthSwitcher-hCAkEd5r.mjs} +1 -1
- package/components/chunks/{MazPickerShortcuts-TbhHaKoJ.mjs → MazPickerShortcuts-vpLyw1de.mjs} +1 -1
- package/components/chunks/{MazPickerYearSwitcher-KwUBj6Cb.mjs → MazPickerYearSwitcher-DvC79vrt.mjs} +1 -1
- package/components/chunks/{MazPullToRefresh-CdVBfDl9.mjs → MazPullToRefresh-CFQX0soS.mjs} +1 -1
- package/components/chunks/{MazSelect-BvC9QQ6M.mjs → MazSelect-BXzgSKmL.mjs} +2 -2
- package/components/chunks/{MazSelect-DyQC9j4n.mjs → MazSelect-Baj2BQH7.mjs} +3 -3
- package/components/chunks/MazSpinner-B5lezvu4.mjs +34 -0
- package/components/chunks/MazSpinner-B8akphXs.mjs +34 -0
- package/components/chunks/MazSpinner-Bvb-lKER.mjs +34 -0
- package/components/chunks/MazSpinner-C-z3-68w.mjs +34 -0
- package/components/chunks/MazSpinner-C1SiKhfK.mjs +34 -0
- package/components/chunks/MazSpinner-CAbYLlEZ.mjs +34 -0
- package/components/chunks/MazSpinner-Cb3_S0zT.mjs +34 -0
- package/components/chunks/MazSpinner-Cg26sBU2.mjs +34 -0
- package/components/chunks/MazSpinner-Cqp-BMvL.mjs +34 -0
- package/components/chunks/MazSpinner-CsEQ9EXb.mjs +34 -0
- package/components/chunks/MazSpinner-CvT-9sC7.mjs +34 -0
- package/components/chunks/MazSpinner-DH6C15pU.mjs +34 -0
- package/components/chunks/MazSpinner-DjM6ktPY.mjs +34 -0
- package/components/chunks/MazSpinner-DlMKBtyt.mjs +34 -0
- package/components/chunks/{MazSpinner-ByWRmwig.mjs → MazSpinner-Du5o8JC_.mjs} +15 -14
- package/components/chunks/MazSpinner-DwSGm0-X.mjs +34 -0
- package/components/chunks/MazSpinner-Dyf9yb51.mjs +34 -0
- package/components/chunks/MazSpinner-M4r0cykl.mjs +34 -0
- package/components/chunks/MazSpinner-QHjOczon.mjs +34 -0
- package/components/chunks/MazSpinner-XB6tX3Ld.mjs +34 -0
- package/components/chunks/MazSpinner-cqcpf_FX.mjs +34 -0
- package/components/chunks/MazSpinner-f6pBzqbu.mjs +34 -0
- package/components/chunks/MazSpinner-yPkPj7Q8.mjs +34 -0
- package/components/chunks/MazSpinner-yr9xVdAa.mjs +34 -0
- package/components/chunks/{MazTable-DozpABdn.mjs → MazTable-CulBGLaj.mjs} +1 -1
- package/components/chunks/{MazTableCell-DPgvJ7vY.mjs → MazTableCell-BXDbkEJq.mjs} +1 -1
- package/components/chunks/{MazTableRow-CCcjwAV1.mjs → MazTableRow-Ds3CDEit.mjs} +1 -1
- package/components/chunks/{MazTableTitle-Df7F9Cjh.mjs → MazTableTitle-uirsgvk_.mjs} +1 -1
- package/components/chunks/{MazTransitionExpand--vHzXjx7.mjs → MazTransitionExpand-4Ll_5LDO.mjs} +1 -1
- package/modules/assets/MazSpinner.css +1 -1
- package/modules/chunks/{MazBtn-BVxI1WwF.mjs → MazBtn-CTqI4qhg.mjs} +2 -2
- package/modules/chunks/{MazBtn-DrB5FzZN.cjs → MazBtn-D_CpNgpD.cjs} +1 -1
- package/modules/chunks/{MazIcon-b8WRy8OV.mjs → MazIcon-BB0DMfOc.mjs} +1 -1
- package/modules/chunks/{MazIcon-BMJqOZnG.cjs → MazIcon-BtomZnkQ.cjs} +1 -1
- package/modules/chunks/MazSpinner-BASKjaLe.cjs +1 -0
- package/modules/chunks/MazSpinner-CDJhmIRl.mjs +34 -0
- package/modules/chunks/index-BIX1NMzX.cjs +149 -0
- package/modules/chunks/{index-Ch4k74ro.mjs → index-C2yAjM0P.mjs} +183 -176
- package/modules/index.cjs +1 -1
- package/modules/index.mjs +1 -1
- package/nuxt/index.json +1 -1
- package/package.json +10 -10
- package/types/components/MazCheckbox.vue.d.ts +1 -6
- package/types/components/MazChecklist.vue.d.ts +1 -4
- package/types/components/MazDialog.vue.d.ts +1 -6
- package/types/components/MazDropzone.vue.d.ts +1 -22
- package/types/components/MazFullscreenLoader.vue.d.ts +4 -5
- package/types/components/MazInput.vue.d.ts +1 -8
- package/types/components/MazInputCode.vue.d.ts +1 -4
- package/types/components/MazLazyImg.vue.d.ts +2 -0
- package/types/components/MazPhoneNumberInput.vue.d.ts +1 -20
- package/types/components/MazRadio.vue.d.ts +1 -6
- package/types/components/MazRadioButtons.vue.d.ts +1 -6
- package/types/components/MazSelect.vue.d.ts +1 -10
- package/types/components/MazSpinner.vue.d.ts +13 -23
- package/types/components/MazTable.vue.d.ts +34 -6
- package/types/modules/helpers/idle-timeout/types.d.ts +5 -3
- package/components/chunks/MazBtn-BF48_wJx.mjs +0 -118
- package/components/chunks/MazBtn-CGYoHDXm.mjs +0 -118
- package/components/chunks/MazSpinner-3vO8e4FF.mjs +0 -37
- package/components/chunks/MazSpinner-5w4SkOOl.mjs +0 -37
- package/components/chunks/MazSpinner-B0291afs.mjs +0 -37
- package/components/chunks/MazSpinner-B0aGd8rG.mjs +0 -37
- package/components/chunks/MazSpinner-BziSiJFV.mjs +0 -37
- package/components/chunks/MazSpinner-CKX-8iim.mjs +0 -37
- package/components/chunks/MazSpinner-CQ2XrZIS.mjs +0 -37
- package/components/chunks/MazSpinner-CQbd8Ovn.mjs +0 -37
- package/components/chunks/MazSpinner-CRW667yE.mjs +0 -37
- package/components/chunks/MazSpinner-Coq7N5iG.mjs +0 -37
- package/components/chunks/MazSpinner-D-7IOf2L.mjs +0 -37
- package/components/chunks/MazSpinner-D0t4IJyq.mjs +0 -37
- package/components/chunks/MazSpinner-D2pssr8S.mjs +0 -37
- package/components/chunks/MazSpinner-D5hiFgo4.mjs +0 -37
- package/components/chunks/MazSpinner-DkXUB0w5.mjs +0 -37
- package/components/chunks/MazSpinner-Dscrgjm1.mjs +0 -41
- package/components/chunks/MazSpinner-DyVjCwmM.mjs +0 -37
- package/components/chunks/MazSpinner-HZYglQFY.mjs +0 -37
- package/components/chunks/MazSpinner-JpzVmSvW.mjs +0 -37
- package/components/chunks/MazSpinner-Nu5h2A6E.mjs +0 -37
- package/components/chunks/MazSpinner-S6Bx7B15.mjs +0 -37
- package/components/chunks/MazSpinner-SgVUnAHk.mjs +0 -37
- package/components/chunks/MazSpinner-wR0F3mAY.mjs +0 -37
- package/modules/chunks/MazSpinner-6H0uaGkV.cjs +0 -1
- package/modules/chunks/MazSpinner-B-Tki1aV.mjs +0 -37
- package/modules/chunks/index-G8fhXnFU.cjs +0 -149
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
"use strict";require('../assets/index.css');var St=Object.defineProperty;var xt=(o,e,t)=>e in o?St(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var m=(o,e,t)=>xt(o,typeof e!="symbol"?e+"":e,t);const s=require("vue");function X(o,e){const t=s.inject(o,e);if(!t)throw new TypeError(`[maz-ui](injectStrict) Could not resolve ${o}`);return t}function Vt(){return X("aos")}function Dt(o){const e={};for(const[t,n]of Object.entries(o))e[t]=Number.parseInt(n,10);return e}function x(){return typeof document<"u"}function Oe(o={}){const{internalWindow:e=x()?window:void 0,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:n=Number.POSITIVE_INFINITY,includeScrollbar:r=!0}=o,i=s.ref(t),a=s.ref(n);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(),s.onMounted(()=>{e&&window.addEventListener("resize",l,{passive:!0})}),s.onUnmounted(()=>{e&&window.removeEventListener("resize",l)}),{width:i,height:a}}function Ot({initialWidth:o=0,initialHeight:e,includeScrollbar:t,internalWindow:n,listenOrientation:r,breakpoints:i,mediumBreakPoint:a="md",largeBreakPoint:l="lg"}){const{width:c}=Oe({initialWidth:o,initialHeight:e,includeScrollbar:t,internalWindow:n,listenOrientation:r}),u=Dt(i),h=s.computed(()=>c.value>=u[l]),v=s.computed(()=>c.value>=u[a]&&c.value<u[l]),w=s.computed(()=>c.value>=0&&c.value<u[a]);return{width:c,numericBreakpoints:u,isSmallScreen:w,isLargeScreen:h,isMediumScreen:v,breakpoints:i}}function Bt(){return X("dialog")}function Be(o,e,t){const n={maxAttempts:20,interval:100,...t};let r=0;function i(){const a=o();a!=null?e(a):r<n.maxAttempts?(r++,setTimeout(i,n.interval)):console.warn(n.errorMessage||`[maz-ui](checkAvailability) Nothing found after ${n.maxAttempts} attempts for ref ${a}`)}i()}function Ne(o){const e=s.toValue(o);return Array.isArray(e)?Object.freeze([...e]):typeof e=="object"&&e!==null?Object.freeze({...e}):e}function ke(o){return o==null||typeof o=="string"||typeof o=="number"||typeof o=="boolean"||typeof o=="symbol"||typeof o=="bigint"}function Nt(o,e){if(o.length!==e.length)return!1;for(const[t,n]of o.entries())if(!G(n,e[t]))return!1;return!0}function Pt(o,e){const t=Object.keys(o),n=Object.keys(e);if(t.length!==n.length)return!1;for(const r of t)if(!n.includes(r)||!G(o[r],e[r]))return!1;return!0}function G(o,e){return ke(o)||ke(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)?Nt(o,e):typeof o=="object"&&typeof e=="object"?Pt(o,e):!1}function Mt(o,e,t){const n={};return async function(...r){n[o]||(n[o]={timer:null,promise:null});const i=n[o];return i.timer&&clearTimeout(i.timer),i.promise=new Promise((a,l)=>{i.timer=setTimeout(async()=>{try{a(await e(...r))}catch(c){l(c)}finally{delete n[o]}},t)}),i.promise}}function $t(o,e,t){const n={};return async(...r)=>{const i=Date.now();return n[o]||(n[o]={promise:null,lastCall:0,lastArgs:[]}),i-n[o].lastCall>=t?(n[o].lastCall=i,e(...r)):(n[o].lastArgs=r,n[o].promise||(n[o].promise=new Promise(a=>{setTimeout(async()=>{n[o].lastCall=Date.now();const l=await e(...n[o].lastArgs);n[o].promise=null,a(l)},t-(i-n[o].lastCall))})),n[o].promise)}}const H={mode:"lazy",scrollToErrorSelector:".has-field-error",debounceTime:300,throttleTime:1e3};function Pe(o,e){return Object.keys(e).includes(o)}function Le(o=H.scrollToErrorSelector){const e=document.querySelector(o);e&&e.scrollIntoView({behavior:"smooth",block:"center"})}function Ht(o,e){const t={};for(const[n,r]of Object.entries(o)){const i=r;t[n]=e[n].error&&i[0]?i[0].message:void 0}return t}function Ce(o){return o==null||o===""}function Ft({name:o,hasValidation:e,debouncedFields:t,throttledFields:n}){if(e){if(t!=null&&t[o]&&(n!=null&&n[o]))throw new Error(`The field "${o}" cannot be both debounced and throttled`);return t!=null&&t[o]?Mt(o,Z,typeof t[o]=="number"?t[o]:H.debounceTime):n!=null&&n[o]?$t(o,Z,typeof n[o]=="number"?n[o]:H.throttleTime):Z}}function Me({name:o,schema:e,initialValue:t,fieldState:n,options:r}){const i=e?Pe(o,e):!1,a=Ft({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:Ne(t),validateFunction:a,mode:i?(r==null?void 0:r.mode)??(n==null?void 0:n.mode)??H.mode:void 0}}function qt({schema:o,payload:e,options:t}){const n={};for(const r in o){const i=r;n[i]=Me({name:i,schema:o,options:t,fieldState:n[i],initialValue:e==null?void 0:e[i]})}return n}function jt({fieldsStates:o,payload:e,schema:t,options:n,updateMode:r=!1}){for(const i in t){const a=i;o[a]=$e({name:a,fieldState:o[a],payload:e,schema:t,options:n,updateMode:r})}}function $e({name:o,fieldState:e,payload:t,schema:n,options:r,updateMode:i=!0}){const{initialValue:a,mode:l,...c}=Me({name:o,schema:n,initialValue:r.defaultValue??t[o],fieldState:e,options:r}),u=i?l??e.mode??H.mode:e.mode;return{...e,initialValue:a,mode:u,...e!=null&&e.mode&&u!==e.mode?c:{}}}function Ut(o){const e={};for(const[t,{errors:n}]of Object.entries(o))e[t]=n;return e}function _t(o){return o instanceof HTMLInputElement||o instanceof HTMLSelectElement||o instanceof HTMLTextAreaElement?[o]:o.querySelectorAll("input, select, textarea")}function Wt({interactiveElements:o,onBlurHandler:e,mode:t}){o.forEach(n=>{Q(["eager","blur","progressive"],t)&&n.addEventListener("blur",e)})}function Rt({interactiveElements:o,onBlurHandler:e}){o.forEach(t=>{t.removeEventListener("blur",e)})}async function Kt(o,e,t){const n=await Jt(e),i=await(await qe("safeParseAsync"))(n.entries[o],t??"");return{result:i,isValid:i.success}}async function Z({name:o,fieldState:e,schema:t,payload:n,setError:r=!0,setErrorIfInvalidAndNotEmpty:i=!1}){if(await s.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 Kt(o,t,n[o]);e.valid=l,(r||i&&!l&&!Ce(n[o]))&&(e.error=!l),e.errors=a.issues??[],e.validating=!1,e.validated=!0}function He({name:o,fieldState:e,payload:t,schema:n}){var i;const r={name:o,fieldState:e,payload:t,schema:n,setError:e.mode==="progressive"?e.valid||e.blurred:!0};return(i=e.validateFunction)==null?void 0:i.call(e,r)}function Yt({fieldsStates:o,payload:e,showErrors:t=!0,schema:n}){return Promise.all(Object.keys(o).map(r=>Z({name:r,setError:t,fieldState:o[r],payload:e,schema:n,setErrorIfInvalidAndNotEmpty:o[r].mode==="lazy"})))}function Fe({eventName:o,fieldState:e,isSubmitted:t}){const{dirty:n,blurred:r,mode:i,valid:a}=e;return o==="blur"&&(Q(["lazy","aggressive"],i)||a)||o==="input"&&i==="blur"||!i?!1:t||i==="eager"&&r||i==="blur"&&r||i==="aggressive"&&n||i==="lazy"&&n||i==="progressive"}function Zt({name:o,force:e=!1,payload:t,fieldState:n,schema:r,isSubmitted:i}){const a=t[o],l=!Ce(a)&&!G(a,n.initialValue);if(n.dirty=l,n.blurred=n.blurred||(n.mode==="eager"?l:!0),!!(e||Fe({eventName:"blur",fieldState:n,isSubmitted:i})))return He({name:o,fieldState:n,schema:r,payload:t})}function Xt({name:o,payload:e,fieldState:t,schema:n,isSubmitted:r,forceValidation:i=!1}){const a=e[o];t.validated=!1;const l=!Ce(a)&&!G(a,t.initialValue);if(t.dirty=l,!!(i||Fe({eventName:"input",fieldState:t,isSubmitted:r})))return He({name:o,fieldState:t,schema:n,payload:e})}function Te(o){const e=s.getCurrentInstance();if(!e)throw new Error(`${o} must be called within setup()`);return e}function Gt(o,e){var r;const n=((r=Te(e).formContexts)==null?void 0:r.get(o))??s.inject(o);if(!n)throw new Error("useFormField must be used within a form (useFormValidator)");return n}function Qt({ref:o,fieldState:e,onBlurHandler:t}){if(!(o||Q(["aggressive","lazy"],e.mode)))return{onBlur:t}}const pe={};async function qe(o){if(pe[o])return pe[o];const e=await Promise.resolve().then(()=>require("./index-CXVZhyjw.cjs"));return pe[o]=e[o],e[o]}async function Jt(o){return(await qe("objectAsync"))(o)}function Q(o,e){return e?o.includes(e):!1}function eo(o,e){const t={formIdentifier:"main-form-validator",...e},{fieldsStates:n,payload:r,options:i,internalSchema:a,errorMessages:l,isSubmitted:c}=Gt(t.formIdentifier,"useFormField"),u=Pe(o,a.value)?(e==null?void 0:e.mode)??i.mode:void 0;t.mode=u;const h=s.computed(()=>n.value[o]);if(n.value[o]=$e({name:o,fieldState:h.value,payload:r.value,schema:a.value,options:{...i,...t}}),t.defaultValue!==void 0&&!G(r.value[o],t.defaultValue)){const C=t.defaultValue;r.value[o]=C,n.value[o].initialValue=Ne(C)}u&&Z({name:o,fieldState:h.value,payload:r.value,schema:a.value,setError:u==="aggressive",setErrorIfInvalidAndNotEmpty:u==="lazy"});function v(){Zt({name:o,fieldState:h.value,payload:r.value,schema:a.value,isSubmitted:c.value})}const w=s.computed(()=>Qt({ref:t.ref,onBlurHandler:v,fieldState:h.value}));if(t.ref&&Q(["eager","blur","progressive"],u)){let C=[];const S=L=>{C=_t(L),Wt({interactiveElements:C,onBlurHandler:v,mode:u})};s.onMounted(()=>{const L=Te(`useFormField of ${o}`);Be(()=>L.refs[t.ref],d=>{const y=d instanceof HTMLElement?d:d==null?void 0:d.$el;y&&S(y)},{errorMessage:`[maz-ui](useFormField) No element found for ref ${t.ref} for field ${o}`})}),s.onUnmounted(()=>{Rt({interactiveElements:C,onBlurHandler:v})})}return{hasError:s.computed(()=>h.value.error),errors:s.computed(()=>h.value.errors),errorMessage:s.computed(()=>l.value[o]),isValid:s.computed(()=>h.value.valid),isDirty:s.computed(()=>h.value.dirty),isBlurred:s.computed(()=>h.value.blurred),isValidated:s.computed(()=>h.value.validated),isValidating:s.computed(()=>h.value.validating),mode:s.computed(()=>h.value.mode),value:s.computed({get:()=>r.value[o],set:C=>r.value[o]=C}),validationEvents:w}}function to({schema:o,defaultValues:e,model:t,options:n}){const r=Te("useFormValidator"),i={mode:H.mode,scrollToError:H.scrollToErrorSelector,debouncedFields:null,throttledFields:null,identifier:"main-form-validator",...n},a=s.ref(e),l=s.ref({...a.value,...t==null?void 0:t.value}),c=s.ref(o),u=s.ref(qt({schema:c.value,payload:l.value,options:i})),h=s.ref(!1),v=s.ref(!1),w=s.computed(()=>Object.values(u.value).every(({valid:E})=>E)),C=s.computed(()=>Object.values(u.value).some(({dirty:E})=>E)),S=s.computed(()=>Ut(u.value)),L=s.computed(()=>Ht(S.value,u.value));t&&s.watch(l,E=>{t.value={...a.value,...E}},{deep:!0}),s.watch(a,E=>{l.value={...E,...l.value}},{deep:!0}),s.watch(c,E=>{jt({schema:E,fieldsStates:u.value,payload:l.value,options:i}),d()},{deep:!0}),d();function d(E=i.mode==="aggressive"){return Yt({fieldsStates:u.value,payload:l.value,schema:c.value,showErrors:E})}const y=[];async function z(E){await s.nextTick();const V=s.watch(()=>l.value[E],()=>{const B=u.value[E];Xt({name:E,fieldState:B,payload:l.value,schema:c.value,isSubmitted:v.value,forceValidation:Q(["aggressive","lazy","progressive"],B.mode)})},{deep:typeof c.value[E]=="object"});y.push(V)}function g(){for(const E of y)E();for(const E of Object.keys(c.value))z(E)}function I(E,V){return async B=>{if(B==null||B.preventDefault(),h.value)return;v.value=!0,h.value=!0,await d(!0);const M=typeof V=="string"?V:i.scrollToError;let $;return w.value?$=await E(l.value):typeof M!="boolean"&&Le(M),h.value=!1,$}}const D={fieldsStates:u,payload:l,options:i,internalSchema:c,errorMessages:L,isSubmitted:v};return r.formContexts??(r.formContexts=new Map),r.formContexts.set(i.identifier,D),s.provide(i.identifier,D),g(),{identifier:i.identifier,isDirty:C,isSubmitting:h,isSubmitted:v,isValid:w,errors:S,model:l,fieldsStates:u,validateForm:d,scrollToError:Le,handleSubmit:I,errorMessages:L}}class je{constructor(e,t){m(this,"defaultOptions",{element:void 0,timeout:60*1e3*5,once:!1,immediate:!0});m(this,"options");m(this,"timeoutHandler");m(this,"isIdle",!1);m(this,"isDestroy",!1);m(this,"startTime",0);m(this,"remainingTime",0);m(this,"lastClientX",-1);m(this,"lastClientY",-1);m(this,"eventNames",["DOMMouseScroll","mousedown","mousemove","mousewheel","MSPointerDown","MSPointerMove","keydown","touchmove","touchstart","wheel","click"]);m(this,"handleEvent",e=>{try{if(this.remainingTime>0)return;if(e.type==="mousemove"){const{clientX:t,clientY:n}=e;if(t===void 0&&n===void 0||t===this.lastClientX&&n===this.lastClientY)return;this.lastClientX=t,this.lastClientY=n}this.resetTimeout(),this.callback({isIdle:this.isIdle,eventType:e.type})}catch(t){throw new Error(`[IdleTimeout](handleEvent) ${t}`)}});this.callback=e,this.options={...this.defaultOptions,...t},x()&&this.start()}get element(){return this.options.element??document.body}start(){if(!x()){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})}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}),this.remainingTime=0)}reset(){this.isDestroy=!1,this.isIdle=!1,this.remainingTime=0,this.resetTimeout(),this.callback({isIdle:this.isIdle})}destroy(){if(!x()){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}),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})}}function oo({callback:o,options:e}){return new je(o,e)}function no({componentName:o,providedId:e}){const t=s.useId();return s.computed(()=>e??`${o}-${t}`)}const Ue=["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"];function so(o,e){return s.computed(()=>{const t=s.toValue(e),n=s.toValue(o);try{return!t||!n?n:new Intl.DisplayNames([t],{type:"language"}).of(n)||n}catch{return n}})}function ro(o){return s.computed(()=>{const e=s.toValue(o);if(!e)return[];const t=65,n=90,r=new Intl.DisplayNames([e],{type:"language"}),i=[];for(let a=t;a<=n;++a)for(let l=t;l<=n;++l){const c=String.fromCodePoint(a)+String.fromCodePoint(l),u=r.of(c);u&&c.toLocaleLowerCase()!==u.toLocaleLowerCase()&&i.push({language:u,code:c})}return i})}function io(o){return s.computed(()=>{const e=s.toValue(o);if(!e)return[];const t=new Intl.DisplayNames([e],{type:"language"});return Ue.map(n=>{try{const r=t.of(n);return!r||n.toLocaleLowerCase()===r.toLocaleLowerCase()?void 0:{language:r,code:n}}catch{return}}).filter(Boolean)})}function ao(o){return{getLanguageDisplayName:({isoCode:e,locale:t})=>so(e,t||o),getAllPossibleLanguages:e=>ro(e||o),getLanguageDisplayNamesForIsoCodes:e=>io(e||o)}}function _e(o){const e=o.join(", ").match(/\b\w+\b/g);return e?e.length:0}function lo(o,e=150){const t=_e([o]);return Math.ceil(t/e)}function uo(o){const e=s.computed(()=>{var a;return typeof o.velocity=="number"?o.velocity:((a=o.velocity)==null?void 0:a.value)??150}),t=s.computed(()=>{var a;return typeof o.contentSelector=="string"?o.contentSelector:(a=o.contentSelector)==null?void 0:a.value}),n=s.computed(()=>{var a,l,c;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 u=document.querySelector(t.value);if(u)return u.textContent}return typeof o.content=="string"?o.content:(c=o.content)==null?void 0:c.value}),r=s.computed(()=>lo(n.value,e.value)),i=s.computed(()=>_e([n.value]));return{content:n,wordCount:i,velocity:e,duration:r}}const co={removeAccents:!0,caseSensitive:!1,replaceSpaces:!0,removeSpecialCharacters:!1,trim:!0,normalizeSpaces:!0,removeNumbers:!1,customNormalizationForms:["NFC","NFKD"]};function ye(o,e){const t={...co,...e},n={À:"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=>n[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 mo(o,e){const t=o.length,n=e.length,r=[];for(let i=0;i<=t;i++)r[i]=[i];for(let i=0;i<=n;i++)r[0][i]=i;for(let i=1;i<=t;i++)for(let a=1;a<=n;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][n]}function We(o,e){const t=mo(o,e),n=Math.max(o.length,e.length);return 1-t/n}function fo(o,e,t=.75){return We(o,e)>=t}function ho(o,e,t=.75){const n=s.computed(()=>ye(typeof o=="string"?o:o.value)),r=s.computed(()=>ye(typeof e=="string"?e:e.value)),i=s.computed(()=>typeof t=="number"?t:t.value),a=s.computed(()=>We(n.value,r.value));return{isMatching:s.computed(()=>fo(n.value,r.value,i.value)),score:a}}const po={preventDefaultOnTouchMove:!1,preventDefaultOnMouseWheel:!1,threshold:50,immediate:!1,triggerOnEnd:!1};class Re{constructor(e){m(this,"element");m(this,"xStart");m(this,"yStart");m(this,"xEnd");m(this,"yEnd");m(this,"xDiff");m(this,"yDiff");m(this,"onToucheStartCallback");m(this,"onToucheMoveCallback");m(this,"onToucheEndCallback");m(this,"onMouseWheelCallback");m(this,"start");m(this,"stop");m(this,"options");this.inputOption=e,this.options={...po,...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,n,r,i,a,l,c,u;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?(n=(t=this.options).onLeft)==null||n.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):(u=(c=this.options).onDown)==null||u.call(c,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 vo(o){const e=s.ref(),t=s.ref(),n=s.ref(),r=s.ref(),i=s.ref(),a=s.ref(),l=s.computed(()=>s.toValue(o.element)),c=new Re({...o,element:l.value,onValuesChanged(u){e.value=u.xDiff,t.value=u.yDiff,n.value=u.xStart,r.value=u.xEnd,i.value=u.yStart,a.value=u.yEnd}});return{xDiff:e,yDiff:t,xStart:n,xEnd:r,yStart:i,yEnd:a,start:()=>{l.value&&(c.options.element=l.value),c.start()},stop:c.stop}}const go={darkClass:"dark",lightClass:"light",storageThemeKey:"theme",storageThemeValueDark:"dark",storageThemeValueLight:"light",storageThemeValueSystem:"system",watchChanges:!0},J=s.ref("system"),P=s.ref("system");function Ie(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function ee({darkClass:o,lightClass:e,storageThemeKey:t,storageThemeValueDark:n,setLocalStorageValue:r=!0,setSelectedTheme:i=!0}){x()&&(document.documentElement.classList.remove(e),document.documentElement.classList.add(o),J.value=n,i&&(P.value=n),r&&(localStorage[t]=n))}function te({darkClass:o,lightClass:e,storageThemeKey:t,storageThemeValueLight:n,setLocalStorageValue:r=!0,setSelectedTheme:i=!0}){x()&&(document.documentElement.classList.remove(o),document.documentElement.classList.add(e),J.value=n,i&&(P.value=n),r&&(localStorage[t]=n))}function Ke({setLocalStorageValue:o=!0,...e}){if(x())return document.documentElement.classList.remove(e.darkClass),document.documentElement.classList.remove(e.lightClass),J.value=e.storageThemeValueSystem,P.value=e.storageThemeValueSystem,o&&(localStorage[e.storageThemeKey]=e.storageThemeValueSystem),be(e)}function Ye(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 ee({...o,setLocalStorageValue:!1,setSelectedTheme:!0});case"light":return te({...o,setLocalStorageValue:!1,setSelectedTheme:!0})}}function be(o){return x()?!localStorage[o.storageThemeKey]&&o.defaultTheme?Ye(o):localStorage[o.storageThemeKey]===o.storageThemeValueDark||!localStorage[o.storageThemeKey]&&Ie()||localStorage[o.storageThemeKey]===o.storageThemeValueSystem&&Ie()?ee({...o,setLocalStorageValue:!1,setSelectedTheme:!1}):te({...o,setLocalStorageValue:!1,setSelectedTheme:!1}):void 0}function ve({theme:o,...e}){return o==="system"?Ke(e):o==="dark"?ee(e):te(e)}function yo(o){return J.value===o.storageThemeValueDark?te(o):ee(o)}function bo(o){const e={...go,...o};function t(){be(e)}return s.onMounted(()=>{localStorage[e.storageThemeKey]&&(P.value=localStorage[e.storageThemeKey]),e.watchChanges&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",t)}),s.onBeforeUnmount(()=>{e.watchChanges&&window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",t)}),s.watch(P,n=>{switch(localStorage[e.storageThemeKey]=n,n){case e.storageThemeValueDark:{ee(e);break}case e.storageThemeValueLight:{te(e);break}case e.storageThemeValueSystem:{Ke(e);break}}}),{autoSetTheme:()=>be(e),toggleTheme:()=>yo(e),setSystemTheme:()=>ve({...e,theme:"system"}),setDarkTheme:()=>ve({...e,theme:"dark"}),setLightTheme:()=>ve({...e,theme:"light"}),setDefaultTheme:()=>Ye(e),hasDarkTheme:s.computed(()=>P.value===e.storageThemeValueDark),hasLightTheme:s.computed(()=>P.value===e.storageThemeValueLight),hasSystemTheme:s.computed(()=>P.value===e.storageThemeValueSystem),theme:J,selectedTheme:P}}function Ze({timeout:o=1e3,callback:e,remainingTimeUpdate:t=200,callbackOffsetTime:n=0}){const r=s.ref(o),i=s.ref(o);let a;function l(w){typeof w=="number"&&(i.value=w),typeof w=="number"&&(r.value=w),c()}function c(){a||(a=setInterval(()=>{i.value-=t,i.value<=0&&(v(),setTimeout(()=>e==null?void 0:e(),n))},t))}function u(){a&&(clearInterval(a),a=void 0)}function h(){!a&&i.value>0&&c()}function v(){setTimeout(()=>i.value=r.value,n*2),u()}return{remainingTime:i,start:l,pause:u,resume:h,stop:v}}function wo(){return X("toast")}class Xe{constructor(e,t){m(this,"eventHandlerFunction");m(this,"event","visibilitychange");m(this,"timeoutHandler");m(this,"options");m(this,"defaultOptions",{timeout:5e3,once:!1,immediate:!0});m(this,"isVisible",!1);this.callback=e,this.options={...this.defaultOptions,...t},this.eventHandlerFunction=this.eventHandler.bind(this),x()&&this.start()}start(){if(!x()){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 Eo({callback:o,options:e}){return new Xe(o,e)}function Co(){return X("wait")}const le="__maz-click-outside__";function Ge(){return document.ontouchstart===null?"touchstart":"click"}async function Qe(o,e){try{Je(o);const t=e.instance,n=e.value,r=typeof n=="function";if(!r)throw new Error("[maz-ui](vClickOutside) the callback should be a function");await s.nextTick(),o[le]=a=>{if((!o||a.target&&!o.contains(a.target))&&n&&r)return n.call(t,a)};const i=Ge();document.addEventListener(i,o[le],{passive:!0})}catch(t){console.error("[maz-ui](vClickOutside)",t)}}function Je(o){try{const e=Ge();document.removeEventListener(e,o[le],!1),delete o[le]}catch(e){console.error("[maz-ui](vClickOutside)",e)}}function To(o,e){try{if(e.value===e.oldValue)return;Qe(o,e)}catch(t){console.error("[maz-ui](vClickOutside)",t)}}const et={mounted:Qe,updated:To,unmounted:Je},tt={install:o=>{o.directive("click-outside",et)}};function ot(o,e,t){var a;o.stopPropagation();const n=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 l of r)if(!i&&o.target instanceof HTMLElement){const c=(a=document.querySelector(l))==null?void 0:a.getAttribute("id");i=o.target.getAttribute("id")===c}}!e.contains(o.target)&&!i&&(n==null||n())}function nt(){return document.ontouchstart===null?"touchstart":"click"}function zo(o,e){const t=nt();document.removeEventListener(t,n=>ot(n,o,e))}function ko(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=nt();document.addEventListener(t,n=>ot(n,o,e))}const st={mounted:ko,unmounted:zo},rt={install:o=>{o.directive("closable",st)}},we={position:"top"};class it{constructor(e={}){m(this,"options");this.options={...we,...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"}create(e,t){e.setAttribute("data-tooltip",this.getText(t)),e.classList.add("m-tooltip");const n=this.getPosition(t);e.classList.add(`m-tooltip--${n}`),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 se;const Lo={beforeMount(o,e){const t=typeof e.value=="object"?e.value:{};return se=new it(t),se.create(o,e)},updated(o,e){return se.update(o,e)},unmounted(o,e){return se.remove(o,e)}},at={install:(o,e=we)=>{const t={...we,...e},n=new it(t);o.directive("tooltip",{beforeMount:n.create.bind(n),updated:n.update.bind(n),unmounted:n.remove.bind(n)})}};function ue(o,e){let t=e==null?void 0:e.element;function n(){t&&s.render(null,t)}const r={...e==null?void 0:e.props,...e!=null&&e.addDestroyInProps?{destroy:n}:{}},i=s.createVNode(o,r,e==null?void 0:e.children);return e!=null&&e.app?(i.appContext=e.app._context,t?s.render(i,t):typeof document<"u"&&(t=document.createElement("div"),s.render(i,t))):(t=t??document.body,s.render(i,t)),{vNode:i,destroy:n,el:t}}const Io=["onKeypress"],Ao={class:"m-fullscreen-img-scroller"},So=["src","alt"],xo=s.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,n=e,r=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./MazSpinner-6H0uaGkV.cjs"))),i=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./x-mark-DW2WXkoF.cjs"))),a=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./chevron-left-Byr9GkwI.cjs"))),l=s.ref(!1),c=s.ref(!1),u=s.ref(!1),h=s.ref(!1),v=s.ref(!1),w=s.ref(t.clickedElement),C=s.computed(()=>t.clickedElement.getBoundingClientRect()),S=s.computed(()=>C.value.height<C.value.width),L=s.ref(t.src),d=s.ref(t.alt),y=s.ref(),z=s.ref(),g=s.computed(()=>v.value?"--is-zoomed maz-cursor-zoom-out":"maz-cursor-zoom-in");function I(){l.value=!0,c.value=!1,u.value=!0}s.watch(()=>u.value,f=>{f&&me()});function D(){n("before-close"),p()}function E(f){f.key==="Escape"&&(f.preventDefault(),D()),(f.key==="ArrowLeft"||f.key==="ArrowRight")&&(f.preventDefault(),R(f.key==="ArrowRight"?"next":"previous"))}function V(){document.documentElement.classList.add("--m-fullscreen-open")}function B(){document.documentElement.classList.remove("--m-fullscreen-open")}function M(){return[...document.querySelectorAll(".m-fullscreen-img-instance")]}function $(f,b){return b<0?f.length-1:b>=f.length?0:b}async function oe(f,b){f.classList.remove(t.openInstanceClass),b.classList.add(t.openInstanceClass);const k=b.getAttribute("data-src"),A=b.getAttribute("data-alt");d.value=A,k&&(L.value=k),l.value=!1,l.value||(c.value=!0)}function R(f){const b=document.querySelector(`.m-fullscreen-img-instance.${t.openInstanceClass}`);if(b){const k=M(),A=k.indexOf(b),N=f==="next"?A+1:A-1,O=k[$(k,N)];w.value=O,O&&oe(b,O),n(f),v.value?F(z.value):j()}}function F(f){S.value?(f.style.width=`${window.innerWidth}px`,f.style.removeProperty("height")):(f.style.height=`${window.innerHeight}px`,f.style.removeProperty("width")),f.style.removeProperty("top"),f.style.removeProperty("left")}async function de(){const f=z.value;v.value?(v.value=!v.value,j()):(v.value=!v.value,F(f))}function K(f){var b;return(b=z.value)==null?void 0:b.animate(f,{duration:t.animation.duration,easing:t.animation.easing})}function ne(f=t.offset??0){const b=(w.value instanceof HTMLImageElement?w.value.naturalWidth:w.value.clientWidth)||1,k=(w.value instanceof HTMLImageElement?w.value.naturalHeight:w.value.clientHeight)||1,A=window.innerWidth,N=window.innerHeight,O=Math.min((A-2*f)/b,(N-2*f)/k),fe=(A-b*O)/2,he=(N-k*O)/2;return{centerX:fe,centerY:he,originalWidth:b,originalHeight:k,scale:O}}function q({trigger:f}){const{originalWidth:b,originalHeight:k,scale:A,centerX:N,centerY:O}=ne(),{top:fe,left:he,width:It,height:At}=C.value,ze=[{top:`${fe}px`,left:`${he}px`,width:`${It}px`,height:`${At}px`,opacity:0},{top:`${O}px`,left:`${N}px`,width:`${b*A}px`,height:`${k*A}px`,opacity:1}];return{frames:f==="open"?ze:ze.reverse()}}function j(){const{centerX:f,centerY:b,originalHeight:k,originalWidth:A,scale:N}=ne(),O={top:`${b}px`,left:`${f}px`,width:`${A*N}px`,height:`${k*N}px`};if(!z.value)throw console.error("[maz-ui](vFullscreenImg) ImgElement is not defined");Object.assign(z.value.style,O)}function me(){const{frames:f}=q({trigger:"open"}),b=K(f);if(!b)throw console.error("[maz-ui](vFullscreenImg) open animation is not defined");b.onfinish=()=>{j()}}function p(){const{frames:f}=q({trigger:"close"}),b=K(f);if(!b)throw console.error("[maz-ui](vFullscreenImg) close animation is not defined");b.onfinish=()=>{var k,A;n("close"),(k=y.value)==null||k.remove(),(A=t.destroy)==null||A.call(t)}}function T(){v.value||j()}return s.onMounted(()=>{c.value=!0,document.addEventListener("keydown",E),window.addEventListener("resize",T),V(),h.value=M().length>1}),s.onBeforeUnmount(()=>{document.removeEventListener("keydown",E),window.removeEventListener("resize",T),B()}),(f,b)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"FullscreenImgElement",ref:y,role:"button",class:"m-fullscreen-img",tabindex:"0",onClick:s.withModifiers(D,["stop"]),onKeypress:s.withKeys(s.withModifiers(D,["prevent"]),["esc"])},[s.withDirectives(s.createVNode(s.unref(r),{class:"m-fullscreen-img-loader maz-h-16"},null,512),[[s.vShow,c.value]]),u.value&&h.value?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"m-fullscreen-btn --next",onClick:b[0]||(b[0]=s.withModifiers(k=>R("next"),["stop"]))},[s.createVNode(s.unref(a),{class:"maz-rotate-180 maz-text-3xl"})])):s.createCommentVNode("v-if",!0),u.value&&h.value?(s.openBlock(),s.createElementBlock("button",{key:1,type:"button",class:"m-fullscreen-btn --previous",onClick:b[1]||(b[1]=s.withModifiers(k=>R("previous"),["stop"]))},[s.createVNode(s.unref(a),{class:"maz-text-3xl"})])):s.createCommentVNode("v-if",!0),s.createElementVNode("button",{type:"button",class:"m-fullscreen-btn --close",onClick:D},[s.createVNode(s.unref(i),{class:"maz-text-3xl"})]),s.createElementVNode("div",Ao,[s.createCommentVNode(" eslint-disable-next-line vuejs-accessibility/no-static-element-interactions, vuejs-accessibility/click-events-have-key-events "),s.createElementVNode("img",{ref_key:"ImgElement",ref:z,src:L.value,alt:d.value??void 0,tabindex:"0",class:s.normalizeClass([g.value]),onLoad:I,onClick:b[2]||(b[2]=s.withModifiers(k=>f.zoom?de():void 0,["stop"]))},null,42,So)])],40,Io))}}),ce=(o,e)=>{const t=o.__vccOpts||o;for(const[n,r]of e)t[n]=r;return t},Vo=ce(xo,[["__scopeId","data-v-42226ee7"]]),Ae="m-fullscreen-is-open";class Do{constructor(){m(this,"options");m(this,"defaultOptions",{scaleOnHover:!1,blurOnHover:!1,disabled:!1,zoom:!0,offset:80,animation:{duration:300,easing:"ease-in-out"}});m(this,"mouseEnterListener");m(this,"mouseLeaveListener");m(this,"renderPreviewListener")}buildOptions(e,t){const n=typeof t.value=="object"?t.value:{src:t.value,alt:void 0},r=(n==null?void 0:n.src)??this.getImgSrc(e),i=(n==null?void 0:n.alt)??this.getImgAlt(e);return{...this.defaultOptions,...n,src:r,alt:i}}get allInstances(){return[...document.querySelectorAll(".m-fullscreen-img-instance")]}getImgSrc(e){var n;const t=((n=this.options)==null?void 0:n.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 n=this.getImgAlt(e);n&&e.setAttribute("data-alt",n),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(Ae),ue(Vo,{props:{...this.options,openInstanceClass:Ae,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 re;const lt={mounted(o,e){return re=new Do,re.create(o,e)},updated(o,e){return re.update(o,e)},unmounted(o){return re.remove(o)}},ut={install(o){o.directive("fullscreen-img",lt)}},Oo="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Ee={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 ct{constructor(e={}){m(this,"observers",[]);m(this,"defaultOptions",Ee);m(this,"options");m(this,"onImgLoadedCallback");m(this,"onImgErrorCallback");m(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,n;this.addClass(e,this.options.loadingClass),(n=(t=this.options).onLoading)==null||n.call(t,e)}imageHasNoPhoto(e){this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.noPhotoClass),this.setDefaultPhoto(e)}imageIsLoaded(e){var t,n;this.hasImgLoaded=!0,this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.loadedClass),(n=(t=this.options).onLoaded)==null||n.call(t,e)}imageHasError(e){var t,n;this.removeClass(e,this.options.loadingClass),this.addClass(e,this.options.errorClass),(n=(t=this.options).onError)==null||n.call(t,e),this.setDefaultPhoto(e)}getSrc(e){return typeof e.value=="object"?e.value.src:e.value}getImageUrl(e,t){const n=this.getImgElement(e).getAttribute("data-lazy-src");return n||this.getSrc(t)}async setPictureSourceUrls(e){const t=e.querySelectorAll("source");if(t.length>0)for await(const n of t){const r=n.getAttribute("data-lazy-srcset");if(r)n.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 n=t??await this.loadErrorPhoto(),r=e.querySelectorAll("source");if(r.length>0)for await(const i of r)i.srcset=n;else this.setImgSrc(e,n)}addEventListenerToImg(e){const t=this.getImgElement(e);t.addEventListener("load",()=>this.onImgLoadedCallback(e),{once:!0}),t.addEventListener("error",n=>this.onImgErrorCallback(e,n),{once:!0})}async loadImage(e,t){if(this.imageIsLoading(e),this.isPictureElement(e))this.addEventListenerToImg(e),await this.setPictureSourceUrls(e);else{const n=this.getImageUrl(e,t);if(!n)return this.imageHasError(e);this.hasBgImgMode(t)?(e.style.backgroundImage=`url('${n}')`,this.imageIsLoaded(e)):(this.addEventListenerToImg(e),this.setImgSrc(e,n))}}setImgSrc(e,t){const n=this.getImgElement(e);n.src=t}handleIntersectionObserver(e,t,n,r){var i,a;this.observers.push(r);for(const l of n)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 n=(a,l)=>{this.handleIntersectionObserver(e,t,a,l)},r=this.options.observerOptions;new IntersectionObserver(n,r).observe(e)}async imageHandler(e,t,n){if(n==="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,n){if(this.options.noPhoto)return this.imageHasNoPhoto(e);await this.imageHandler(e,t,n)}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,Oo),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 n of this.observers)n.unobserve(e);this.observers=[]}}let ie;const Bo={created(o,e){const t=typeof e.value=="object"?e.value:{};ie=new ct(t),ie.add(o,e)},updated(o,e){ie.update(o,e)},unmounted(o,e){ie.remove(o,e)}},dt={install(o,e={}){const t={...Ee,...e,observerOptions:{...Ee.observerOptions,...e.observerOptions}},n=new ct(t);o.directive("lazy-img",{created:n.add.bind(n),updated:n.update.bind(n),unmounted:n.remove.bind(n)})}},No=`
|
|
2
|
-
.maz-zoom-img {
|
|
3
|
-
position: fixed;
|
|
4
|
-
top: 0;
|
|
5
|
-
bottom: 0;
|
|
6
|
-
left: 0;
|
|
7
|
-
right: 0;
|
|
8
|
-
padding: 1rem;
|
|
9
|
-
z-index: 1050;
|
|
10
|
-
background-color: hsla(238, 15%, 40%, 0.7);
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: center;
|
|
13
|
-
justify-content: center;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.maz-zoom-img,
|
|
18
|
-
.maz-zoom-img * {
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.maz-zoom-img .maz-zoom-img__wrapper {
|
|
23
|
-
position: relative;
|
|
24
|
-
display: flex;
|
|
25
|
-
justify-content: center;
|
|
26
|
-
align-items: center;
|
|
27
|
-
min-width: 0;
|
|
28
|
-
min-height: 0;
|
|
29
|
-
max-width: 100%;
|
|
30
|
-
max-height: 100%;
|
|
31
|
-
transition: all 300ms ease-in-out;
|
|
32
|
-
opacity: 0;
|
|
33
|
-
transform: scale(0.5);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.maz-zoom-img.maz-animate .maz-zoom-img__wrapper {
|
|
37
|
-
opacity: 1;
|
|
38
|
-
transform: scale(1);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.maz-zoom-img.maz-animate .maz-zoom-img__loader {
|
|
42
|
-
position: absolute;
|
|
43
|
-
top: 0;
|
|
44
|
-
bottom: 0;
|
|
45
|
-
left: 0;
|
|
46
|
-
right: 0;
|
|
47
|
-
display: flex;
|
|
48
|
-
align-items: center;
|
|
49
|
-
justify-content: center;
|
|
50
|
-
background-color: hsla(238, 15%, 40%, 0.7);
|
|
51
|
-
border-radius: 1rem;
|
|
52
|
-
z-index: 2;
|
|
53
|
-
min-width: 60px;
|
|
54
|
-
min-height: 60px;
|
|
55
|
-
}
|
|
56
|
-
.maz-zoom-img.maz-animate .maz-zoom-img__loader[hidden] {
|
|
57
|
-
display: none;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@-webkit-keyframes spin {
|
|
61
|
-
0% { transform: rotate(0deg); }
|
|
62
|
-
100% { transform: rotate(360deg); }
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
@keyframes spin {
|
|
66
|
-
0% { transform: rotate(0deg); }
|
|
67
|
-
100% { transform: rotate(360deg); }
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.maz-zoom-img.maz-animate .maz-zoom-img__loader__svg {
|
|
71
|
-
animation: spin .6s linear infinite;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.maz-zoom-img img {
|
|
75
|
-
max-width: 100%;
|
|
76
|
-
max-height: 100%;
|
|
77
|
-
min-width: 0;
|
|
78
|
-
border-radius: 1rem;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.maz-zoom-img .maz-zoom-btn {
|
|
82
|
-
margin: 0 auto;
|
|
83
|
-
border: none;
|
|
84
|
-
background-color: hsla(0, 0%, 7%, 0.5);
|
|
85
|
-
box-shadow: 0 0 0.5rem 0 hsla(0, 0%, 0%, 0.2);
|
|
86
|
-
height: 2.2rem;
|
|
87
|
-
min-height: 2.2rem;
|
|
88
|
-
width: 2.2rem;
|
|
89
|
-
min-width: 2.2rem;
|
|
90
|
-
display: flex;
|
|
91
|
-
align-items: center;
|
|
92
|
-
justify-content: center;
|
|
93
|
-
border-radius: 2.2rem;
|
|
94
|
-
cursor: pointer;
|
|
95
|
-
flex: 0 0 auto;
|
|
96
|
-
outline: none;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.maz-zoom-img .maz-zoom-btn svg {
|
|
100
|
-
fill: white;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.maz-zoom-img .maz-zoom-btn.maz-zoom-btn--close {
|
|
104
|
-
position: absolute;
|
|
105
|
-
top: 0.5rem;
|
|
106
|
-
right: 0.5rem;
|
|
107
|
-
z-index: 1;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.maz-zoom-img .maz-zoom-btn.maz-zoom-btn--previous {
|
|
111
|
-
position: absolute;
|
|
112
|
-
left: 0.5rem;
|
|
113
|
-
z-index: 1;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.maz-zoom-img .maz-zoom-btn.maz-zoom-btn--next {
|
|
117
|
-
position: absolute;
|
|
118
|
-
right: 0.5rem;
|
|
119
|
-
z-index: 1;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.maz-zoom-img .maz-zoom-btn:hover {
|
|
123
|
-
background-color: hsl(0, 0%, 0%);
|
|
124
|
-
}`,Se={close:'<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><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"/></svg>',next:'<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>',previous:'<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>',spinner:'<svg width="40px" height="40px" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="currentColor" x="0px" y="0px" viewBox="0 0 50 50" xml:space="preserve" class="maz-zoom-img__loader__svg" data-v-6d1cb50c=""><path d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"></path></svg>'};class Po{constructor(e){m(this,"options");m(this,"loader");m(this,"wrapper");m(this,"img");m(this,"keydownHandler");m(this,"onImgLoadedCallback");m(this,"buttonsAdded");m(this,"defaultOptions",{scale:!0,blur:!0,disabled:!1});m(this,"mouseEnterListener");m(this,"mouseLeaveListener");m(this,"renderPreviewListener");if(!e.value)throw new Error('[MazUI](zoom-img) Image path must be defined. Ex: `v-zoom-img="<PATH_TO_IMAGE>"`');if(typeof e.value=="object"&&!e.value.src)throw new Error("[maz-ui](zoom-img) src of image must be provided");this.buttonsAdded=!1,this.options=this.buildOptions(e),this.keydownHandler=this.keydownLister.bind(this),this.loader=this.getLoader(),this.wrapper=document.createElement("div"),this.wrapper.classList.add("maz-zoom-img__wrapper"),this.wrapper.prepend(this.loader),this.img=document.createElement("img"),this.onImgLoadedCallback=this.onImgLoaded.bind(this),this.imgEventHandler(!0)}buildOptions(e){return{...this.defaultOptions,...typeof e.value=="object"?e.value:{src:e.value}}}get allInstances(){return[...document.querySelectorAll(".maz-zoom-img-instance")]}create(e){this.options.disabled||(e.style.cursor="pointer",setTimeout(()=>e.classList.add("maz-zoom-img-instance")),e.setAttribute("data-zoom-src",this.options.src),this.options.alt&&e.setAttribute("data-zoom-alt",this.options.alt),e.style.transition="all 300ms ease-in-out",this.mouseEnterListener=()=>this.mouseEnter(e),this.mouseLeaveListener=()=>this.mouseLeave(e),this.renderPreviewListener=()=>this.renderPreview(e,this.options),e.addEventListener("mouseenter",this.mouseEnterListener),e.addEventListener("mouseleave",this.mouseLeaveListener),e.addEventListener("click",this.renderPreviewListener))}update(e){this.options=this.buildOptions(e)}remove(e){this.imgEventHandler(!1),e.removeEventListener("mouseenter",this.mouseEnterListener),e.removeEventListener("mouseleave",this.mouseLeaveListener),e.removeEventListener("click",this.renderPreviewListener),e.classList.remove("maz-zoom-img-instance"),e.removeAttribute("data-zoom-src"),e.removeAttribute("data-zoom-alt"),e.style.cursor=""}renderPreview(e,t){e.classList.add("maz-is-open"),this.addStyle(No);const n=document.createElement("div");n.classList.add("maz-zoom-img"),n.setAttribute("id","MazImgPreviewFullsize"),n.addEventListener("click",r=>{n.isEqualNode(r.target)&&this.closePreview()}),typeof t=="object"&&(this.img.setAttribute("src",t.src),t.alt&&this.img.setAttribute("alt",t.alt),this.img.id="MazImgElement"),this.wrapper.append(this.img),n.append(this.wrapper),document.body.append(n),this.keyboardEventHandler(!0),setTimeout(()=>{n&&n.classList.add("maz-animate")},100)}onImgLoaded(){this.wrapper.style.width=`${this.img.width}px`,this.wrapper.style.minWidth="200px",this.loader.hidden=!0;const e=this.getButton(),t=[],n=this.allInstances.length>1;if(!this.buttonsAdded){if(this.buttonsAdded=!0,n){const r=this.getButton("previous"),i=this.getButton("next");t.push(r,i)}this.wrapper.append(e),n&&(this.wrapper.prepend(t[0]),this.wrapper.append(t[1]))}}getLoader(){const e=document.createElement("div");return e.classList.add("maz-zoom-img__loader"),e.innerHTML=Se.spinner,e}mouseLeave(e){this.options.scale&&(e.style.transform=""),this.options.blur&&(e.style.filter=""),e.style.zIndex=""}mouseEnter(e){e.style.zIndex="1",this.options.scale&&(e.style.transform="scale(1.1)"),this.options.blur&&(e.style.filter="blur(2px)")}keydownLister(e){e.preventDefault(),(e.key==="Escape"||e.key===" ")&&this.closePreview(),(e.key==="ArrowLeft"||e.key==="ArrowRight")&&this.nextPreviousImage(e.key==="ArrowRight")}getButton(e="close"){const t=document.createElement("button");t.innerHTML=Se[e];const n=e==="close"?this.closePreview():this.allInstances?this.nextPreviousImage(e==="next"):null;return t.addEventListener("click",()=>n),t.classList.add("maz-zoom-btn"),t.classList.add(`maz-zoom-btn--${e}`),t}closePreview(){const e=document.querySelector("#MazImgPreviewFullsize"),t=document.querySelector("#MazPreviewStyle"),n=document.querySelector(".maz-zoom-img-instance.maz-is-open");n&&n.classList.remove("maz-is-open"),e&&e.classList.remove("maz-animate"),this.keyboardEventHandler(!1),setTimeout(()=>{e&&e.remove(),t&&t.remove()},300)}getNewInstanceIndex(e){return e<0?this.allInstances.length-1:e>=this.allInstances.length?0:e}nextPreviousImage(e){const t=e,n=document.querySelector(".maz-zoom-img-instance.maz-is-open");if(n){const r=this.allInstances.indexOf(n),i=t?r+1:r-1,a=this.allInstances[this.getNewInstanceIndex(i)];a&&this.useNextInstance(n,a)}}useNextInstance(e,t){e.classList.remove("maz-is-open"),t.classList.add("maz-is-open");const n=t.getAttribute("data-zoom-src"),r=t.getAttribute("data-zoom-alt");this.wrapper.style.width="",this.loader.hidden=!1,n&&this.img.setAttribute("src",n),r&&this.img.setAttribute("alt",r)}addStyle(e){const t=document.createElement("style");t.id="MazPreviewStyle",t.textContent=e,document.head.append(t)}keyboardEventHandler(e){if(e)return document.addEventListener("keydown",this.keydownHandler);document.removeEventListener("keydown",this.keydownHandler)}imgEventHandler(e){if(e)return this.img.addEventListener("load",this.onImgLoadedCallback);this.img.removeEventListener("load",this.onImgLoadedCallback)}}let ae;const mt={created(o,e){ae=new Po(e),ae.create(o)},updated(o,e){ae.update(e)},unmounted(o){ae.remove(o)}},ft={install(o){o.directive("zoom-img",mt)}},Mo=[rt,ft,dt,tt,ut,at],$o={install(o){for(const e of Mo)e.install(o,{})}};function ht(o){return o?(o=o.toString(),o.charAt(0).toUpperCase()+o.slice(1)):""}const Ho={style:"currency",minimumFractionDigits:2,round:!1};function Fo(o,e,t){let n=Number(o);return t.round&&(n=Math.floor(n),t.minimumFractionDigits=0),new Intl.NumberFormat(e,t).format(n)}function qo(o,e,t){if(o===void 0)throw new TypeError("[maz-ui](FilterCurrency) The `number` attribute is required.");if(e===void 0)throw new TypeError("[maz-ui](FilterCurrency) The `locale` attribute is required.");if(typeof e!="string")throw new TypeError("[maz-ui](FilterCurrency) The `locale` attribute must be a string.");if(t.currency===void 0)throw new TypeError("[maz-ui](FilterCurrency) The `options.currency` attribute is required.")}function pt(o,e,t){const n={...Ho,...t};qo(o,e,n);try{return Fo(o,e,n)}catch(r){throw new Error(`[maz-ui](FilterCurrency) ${r}`)}}const jo={month:"short",day:"numeric",year:"numeric"};function vt(o,e,t){if(e===void 0)throw new TypeError("[maz-ui](FilterDate) The `locale` attribute is required.");if(typeof e!="string")throw new TypeError("[maz-ui](FilterDate) The `locale` attribute must be a string.");const n=t??jo;try{const r=o instanceof Date?o:new Date(o);return new Intl.DateTimeFormat(e,n).format(r)}catch(r){throw new Error(`[maz-ui](FilterDate) ${r}`)}}const Uo={minimumFractionDigits:2};function gt(o,e,t){const n={...Uo,...t};if(o===void 0)throw new TypeError("[maz-ui](FilterNumber) The `number` attribute is required.");if(e===void 0)throw new TypeError("[maz-ui](FilterNumber) The `locale` attribute is required.");if(typeof e!="string")throw new TypeError("[maz-ui](FilterNumber) The `locale` attribute must be a string.");try{return new Intl.NumberFormat(e,n).format(Number(o))}catch(r){throw new Error(`[maz-ui](FilterNumber) ${r}`)}}const _o={capitalize:ht,currency:pt,date:vt,number:gt},Wo={install(o){o.provide("filters",_o)}};function yt(o){return!!o}function Ro(o){return[...o].map(e=>{const t=e.codePointAt(0);return t?t%32+127461:void 0}).filter(yt).map(e=>String.fromCodePoint(e)).join("")}function Ko(o,e){let t;return function(...n){clearTimeout(t),t=setTimeout(()=>{o.apply(this,n)},e)}}class Yo{constructor({src:e,identifier:t,once:n=!0,async:r=!0,defer:i=!0}){m(this,"src");m(this,"script");m(this,"once");m(this,"async");m(this,"defer");m(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=n,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 n of t)this.removeTag(n);return this.injectScript()}injectScript(){const e=window;return new Promise((t,n)=>{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=>n(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 bt(o){return new Promise(e=>setTimeout(e,o))}function Zo(o,e){let t=!1,n,r;return function(...i){t?(clearTimeout(n),n=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 ge={delay:100,observer:{root:void 0,rootMargin:"0px",threshold:.2},animation:{once:!0,duration:300,delay:0}};class wt{constructor(e){m(this,"options");this.options={delay:(e==null?void 0:e.delay)??ge.delay,observer:{...ge.observer,...e==null?void 0:e.observer},animation:{...ge.animation,...e==null?void 0:e.animation}}}handleIntersect(e,t){for(const n of e){const i=n.target.getAttribute("data-maz-aos-children")==="true",a=n.target.getAttribute("data-maz-aos")?[n.target]:[];if(i){const l=[...document.querySelectorAll("[data-maz-aos-anchor]")].map(c=>c.getAttribute("data-maz-aos-anchor")===`#${n.target.id}`?c:void 0);for(const c of l)c&&a.push(c)}for(const l of a){const c=l.getAttribute("data-maz-aos-once"),u=typeof c=="string"?c==="true":this.options.animation.once;if(typeof this.options.observer.threshold=="number"&&n.intersectionRatio>this.options.observer.threshold){const h=l.getAttribute("data-maz-aos-duration"),v=l.getAttribute("data-maz-aos-delay");if(h||(l.style.transitionDuration=`${this.options.animation.duration}ms`,setTimeout(()=>{l.style.transitionDuration="0"},1e3)),v||(l.style.transitionDelay=`${this.options.animation.delay}ms`,setTimeout(()=>{l.style.transitionDelay="0"},1e3)),l.classList.add("maz-aos-animate"),u){const w=l.getAttribute("data-maz-aos-anchor");if(w){const C=document.querySelector(w);C&&t.unobserve(C)}t.unobserve(l)}}else l.classList.remove("maz-aos-animate")}}}async handleObserver(){await bt(this.options.delay);const e=new IntersectionObserver(this.handleIntersect.bind(this),this.options.observer);for(const t of document.querySelectorAll("[data-maz-aos]")){const n=t.getAttribute("data-maz-aos-anchor");if(n){const r=document.querySelector(n);r?(r.setAttribute("data-maz-aos-children","true"),e.observe(r)):console.warn(`[maz-ui](aos) no element found with selector "${n}"`)}else e.observe(t)}}runAnimations(){if(x())return this.handleObserver();console.warn("[MazAos](runAnimations) should be executed on client side")}}let Y;const Xo={install:(o,e)=>{Y=new wt(e),o.provide("aos",Y),x()&&(e!=null&&e.router?e.router.afterEach(async()=>{Y.runAnimations()}):Y.runAnimations())}};function Go(){return Y}const xe="--backdrop-present",Qo=s.defineComponent({inheritAttrs:!1,__name:"MazBackdrop",props:{modelValue:{type:Boolean,default:!1},teleportSelector:{default:"body"},beforeClose:{type:Function,default:void 0},persistent:{type:Boolean,default:!1},noCloseOnEscKey:{type:Boolean,default:!1},transitionName:{default:"backdrop-anim"},backdropClass:{default:void 0},backdropContentClass:{default:void 0}},emits:["open","close","update:model-value","before-close"],setup(o,{expose:e,emit:t}){const n=o,r=t;function i(){document.documentElement.classList.add(xe)}async function a(){document.querySelector(".m-backdrop.--present")||document.documentElement.classList.remove(xe)}const l=s.ref(n.modelValue);function c(){u(!1)}async function u(d){var y;d||(r("before-close"),await((y=n.beforeClose)==null?void 0:y.call(n))),l.value=d}function h(){r("open")}function v(){r("update:model-value",!1),r("close"),L()}function w(){n.persistent||c()}function C(d){!n.noCloseOnEscKey&&d.key==="Escape"&&!n.persistent&&c()}function S(){i(),document.addEventListener("keyup",C,!1)}function L(){document.removeEventListener("keyup",C),a()}return s.onMounted(()=>{n.modelValue?S():L()}),s.watch(()=>n.modelValue,d=>{l.value=d,d?S():L()}),e({onBackdropAnimationEnter:h,onBackdropAnimationLeave:v,onBackdropClicked:w,close:c,present:l,toggleModal:u,onKeyPress:C}),(d,y)=>(s.openBlock(),s.createBlock(s.Teleport,{to:d.teleportSelector},[s.createVNode(s.Transition,{appear:"",name:d.transitionName,onAfterEnter:h,onAfterLeave:v},{default:s.withCtx(()=>[l.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:s.normalizeClass(["m-backdrop --present",[d.backdropClass]]),tabindex:"-1",role:"dialog"},[s.createElementVNode("button",{class:s.normalizeClass(["m-backdrop-overlay",{"--disabled":d.persistent}]),tabindex:"-1",onClick:s.withModifiers(w,["self"])},null,2),s.createElementVNode("div",s.mergeProps({class:["m-backdrop-content",d.backdropContentClass]},d.$attrs,{role:"document",tabindex:"0"}),[s.renderSlot(d.$slots,"default",{close:c})],16)],2)):s.createCommentVNode("v-if",!0)]),_:3},8,["name"])],8,["to"]))}}),Jo={key:0,id:"dialogTitle",class:"maz-my-0 maz-text-xl maz-font-semibold"},en={id:"dialogDesc",class:"m-dialog-content"},tn={key:0,class:"m-dialog-footer"},on=s.defineComponent({__name:"MazDialog",props:{modelValue:{type:Boolean},title:{default:void 0},noClose:{type:Boolean,default:!1},width:{default:"500px"},maxWidth:{default:"95vw"},maxHeight:{default:"95vh"},scrollable:{type:Boolean,default:!1},persistent:{type:Boolean,default:!1},teleportSelector:{},beforeClose:{},noCloseOnEscKey:{type:Boolean},transitionName:{},backdropClass:{},backdropContentClass:{}},emits:["open","close","update:model-value"],setup(o,{expose:e}){const t=o,n=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./MazBtn-DrB5FzZN.cjs"))),r=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./x-mark-DW2WXkoF.cjs"))),i=s.useAttrs(),a=s.ref();e({close:()=>{var u,h;return(h=(u=a.value)==null?void 0:u.close)==null?void 0:h.call(u)}});const l=s.computed(()=>({...i,class:void 0,style:void 0})),c=s.computed(()=>({class:i.class,style:i.style}));return(u,h)=>(s.openBlock(),s.createBlock(Qo,s.mergeProps({...l.value,...t},{ref_key:"backdrop",ref:a,persistent:u.persistent,"model-value":u.modelValue,"transition-name":"modal-anim","aria-labelledby":"dialogTitle","aria-describedby":"dialogDesc",onClose:h[0]||(h[0]=v=>u.$emit("close",v)),onOpen:h[1]||(h[1]=v=>u.$emit("open",v)),"onUpdate:modelValue":h[2]||(h[2]=v=>u.$emit("update:model-value",v))}),{default:s.withCtx(({close:v})=>[s.createElementVNode("div",s.mergeProps({class:["m-dialog",{"--scrollable":u.scrollable}],role:"dialog","aria-modal":"true",style:[{width:u.width,maxWidth:u.maxWidth,maxHeight:u.maxHeight}]},c.value),[s.createCommentVNode(`
|
|
125
|
-
@slot Header slot
|
|
126
|
-
@binding {Function} close close function
|
|
127
|
-
`),s.renderSlot(u.$slots,"header",{close:v},()=>[s.createElementVNode("div",{class:s.normalizeClass(["m-dialog-header",{"--has-title":u.$slots.title||u.title}])},[u.$slots.title||u.title?(s.openBlock(),s.createElementBlock("h2",Jo,[s.createCommentVNode(`
|
|
128
|
-
@slot Title slot in the header
|
|
129
|
-
`),s.renderSlot(u.$slots,"title",{},()=>[s.createTextVNode(s.toDisplayString(u.title),1)],!0)])):s.createCommentVNode("v-if",!0),!u.noClose&&!u.persistent?(s.openBlock(),s.createBlock(s.unref(n),{key:1,class:"m-dialog-closebtn",color:"transparent",size:"sm",icon:s.unref(r),onClick:v},null,8,["icon","onClick"])):s.createCommentVNode("v-if",!0)],2)],!0),s.createElementVNode("div",en,[s.createCommentVNode(`
|
|
130
|
-
@slot Default content
|
|
131
|
-
@binding {Function} close close function
|
|
132
|
-
`),s.renderSlot(u.$slots,"default",{close:v},void 0,!0)]),u.$slots.footer?(s.openBlock(),s.createElementBlock("div",tn,[s.createCommentVNode(`
|
|
133
|
-
@slot Footer slot
|
|
134
|
-
@binding {Function} close close function
|
|
135
|
-
`),s.renderSlot(u.$slots,"footer",{close:v},void 0,!0)])):s.createCommentVNode("v-if",!0)],16)]),_:3},16,["persistent","model-value"]))}}),nn=ce(on,[["__scopeId","data-v-50775b17"]]),U={cancelText:"Cancel",confirmText:"Confirm",cancelButton:{text:"Cancel",color:"danger"},confirmButton:{text:"Confirm",color:"success"}},sn=s.ref(U),_=s.ref([]);function rn(o,e){return new Promise((t,n)=>{_.value=[..._.value,{id:o,isActive:!0,resolve:async r=>{t(r),await(e==null?void 0:e())},reject:async r=>{n(r),await(e==null?void 0:e())}}]})}function Et(o){return _.value=_.value.filter(({id:e})=>e!==o),_.value}function Ve(o,e,t){var n;e&&((n=e[o])==null||n.call(e,t),e.isActive=!1,setTimeout(()=>{Et(e.id)},500))}function Ct(){return{data:sn,dialogState:_,showDialogAndWaitChoice:rn,removeDialogFromState:Et,rejectDialog:async(o,e=new Error("cancel"),t)=>(await(t==null?void 0:t()),Ve("reject",o,e)),resolveDialog:async(o,e="accept",t)=>(await(t==null?void 0:t()),Ve("resolve",o,e))}}const an={class:"maz-flex maz-items-center maz-gap-2"},ln=s.defineComponent({__name:"MazDialogPromise",props:{data:{default:void 0},message:{default:void 0},identifier:{default:void 0},buttons:{default:void 0},modelValue:{type:Boolean},title:{},noClose:{type:Boolean},width:{},maxWidth:{},maxHeight:{},scrollable:{type:Boolean},persistent:{type:Boolean},teleportSelector:{},beforeClose:{},noCloseOnEscKey:{type:Boolean},transitionName:{},backdropClass:{},backdropContentClass:{},cancelText:{},cancelButton:{type:[Boolean,Object]},confirmText:{},confirmButton:{type:[Boolean,Object]}},emits:["open","close"],setup(o,{expose:e}){const t=o,n=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./MazBtn-DrB5FzZN.cjs"))),{dialogState:r,rejectDialog:i,resolveDialog:a,data:l}=Ct(),c=s.computed(()=>{var d;return t.buttons??((d=t.data)==null?void 0:d.buttons)??l.value.buttons}),u=s.computed(()=>{var y,z,g,I;if(((y=l.value)==null?void 0:y.cancelButton)??((z=t.data)==null?void 0:z.cancelButton)??U.cancelButton)return{...U.cancelButton,...(g=l.value)==null?void 0:g.cancelButton,...(I=t.data)==null?void 0:I.cancelButton}}),h=s.computed(()=>{var y,z,g,I;if(((y=l.value)==null?void 0:y.confirmButton)??((z=t.data)==null?void 0:z.confirmButton)??U.confirmButton)return{...U.confirmButton,...(g=l.value)==null?void 0:g.confirmButton,...(I=t.data)==null?void 0:I.confirmButton}}),v=s.computed(()=>({...U,...l.value,...t.data})),w=s.computed(()=>r.value.find(({id:d})=>d===t.identifier)),C=s.ref();e({close:()=>{var d,y;return(y=(d=C.value)==null?void 0:d.close)==null?void 0:y.call(d)}});function S(d){return"type"in d&&(d.type==="resolve"||d.type==="reject")}function L(d,y){return S(y)?y.type==="resolve"?a(d,y.response):i(d,y.response):a(d,void 0,y.action)}return(d,y)=>{var z;return s.openBlock(),s.createBlock(nn,s.mergeProps({ref_key:"dialog",ref:C},{...d.$attrs,...t},{"model-value":((z=w.value)==null?void 0:z.isActive)??d.modelValue??!1,onClose:y[2]||(y[2]=g=>d.$emit("close",g)),onOpen:y[3]||(y[3]=g=>d.$emit("open",g)),"onUpdate:modelValue":y[4]||(y[4]=g=>s.unref(i)(w.value))}),{title:s.withCtx(()=>[s.createCommentVNode(`
|
|
136
|
-
@slot title slot - Place your title
|
|
137
|
-
`),s.renderSlot(d.$slots,"title",{},()=>{var g;return[s.createTextVNode(s.toDisplayString(d.title||((g=v.value)==null?void 0:g.title)),1)]})]),default:s.withCtx(()=>[s.createCommentVNode(`
|
|
138
|
-
@slot Default slot - Place your content
|
|
139
|
-
@binding {Function} resolve resolve function
|
|
140
|
-
@binding {Function} reject reject function
|
|
141
|
-
`),s.renderSlot(d.$slots,"default",{resolve:g=>s.unref(a)(w.value,g),reject:g=>s.unref(i)(w.value,g)},()=>{var g;return[s.createTextVNode(s.toDisplayString(d.message||((g=v.value)==null?void 0:g.message)),1)]})]),footer:s.withCtx(()=>[s.createCommentVNode(`
|
|
142
|
-
@slot Footer slot
|
|
143
|
-
@binding {Function} resolve resolve function
|
|
144
|
-
@binding {Function} reject reject function
|
|
145
|
-
`),s.renderSlot(d.$slots,"footer-button",{resolve:g=>s.unref(a)(w.value,g),reject:g=>s.unref(i)(w.value,g)},()=>[s.createElementVNode("div",an,[c.value?(s.openBlock(!0),s.createElementBlock(s.Fragment,{key:0},s.renderList(c.value,(g,I)=>(s.openBlock(),s.createBlock(s.unref(n),s.mergeProps({key:I,ref_for:!0},{...g,type:"button"},{onClick:D=>L(w.value,g)}),{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(g.text),1)]),_:2},1040,["onClick"]))),128)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[u.value?(s.openBlock(),s.createBlock(s.unref(n),s.mergeProps({key:0},u.value,{onClick:y[0]||(y[0]=g=>s.unref(i)(w.value))}),{default:s.withCtx(()=>[s.createCommentVNode(`
|
|
146
|
-
@slot cancel-text slot - Place your cancel text
|
|
147
|
-
`),s.renderSlot(d.$slots,"cancel-text",{},()=>{var g;return[s.createTextVNode(s.toDisplayString(u.value.text||((g=v.value)==null?void 0:g.cancelText)),1)]})]),_:3},16)):s.createCommentVNode("v-if",!0),h.value?(s.openBlock(),s.createBlock(s.unref(n),s.mergeProps({key:1},h.value,{onClick:y[1]||(y[1]=g=>s.unref(a)(w.value))}),{default:s.withCtx(()=>[s.createCommentVNode(`
|
|
148
|
-
@slot confirm-text slot - Place your confirm text
|
|
149
|
-
`),s.renderSlot(d.$slots,"confirm-text",{},()=>[s.createTextVNode(s.toDisplayString(h.value.text||v.value.confirmText),1)])]),_:3},16)):s.createCommentVNode("v-if",!0)],64))])])]),_:3},16,["model-value"])}}}),De={identifier:"main-dialog"};class Tt{constructor(e,t=De){this.app=e,this.globalOptions=t}open(e){const t={...De,...this.globalOptions,...e},{destroy:n,vNode:r}=ue(ln,{props:t,app:this.app}),{showDialogAndWaitChoice:i}=Ct();function a(){var c,u,h;(u=(c=r.component)==null?void 0:c.exposed)==null||u.close(),(h=t.promiseCallback)==null||h.call(t),setTimeout(()=>{n()},700)}return{promise:i(t.identifier,()=>{a()}),destroy:n,close:a}}}const un={install(o,e){o.provide("dialog",new Tt(o,e))}},cn={class:"m-toast__message-wrapper"},dn={class:"m-toast__message"},mn={class:"maz-flex maz-items-center maz-gap-2"},fn={key:0},hn={key:4,class:"progress-bar maz-absolute maz-inset-x-0 maz-bottom-0 maz-h-1"},pn=s.defineComponent({__name:"MazToast",props:{message:{default:void 0},position:{default:"bottom-right"},maxToasts:{type:[Number,Boolean],default:!1},timeout:{type:[Number,Boolean],default:1e4},queue:{type:Boolean},noPauseOnHover:{type:Boolean},type:{default:"info"},link:{default:void 0},action:{default:void 0},persistent:{type:Boolean},icon:{type:Boolean,default:!0}},emits:["close","click","open"],setup(o,{expose:e,emit:t}){const n=o,r=t,i=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./MazBtn-DrB5FzZN.cjs"))),a=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./x-mark-DW2WXkoF.cjs"))),l=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./arrow-top-right-on-square-PZtr8Zs0.cjs"))),c=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./exclamation-triangle-BtW3be9S.cjs"))),u=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./exclamation-circle-BXs0Yj0f.cjs"))),h=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./information-circle-89FseEuJ.cjs"))),v=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./check-circle-D3i-p-t3.cjs"))),w=s.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./link-CUxj8BQ5.cjs"))),C=s.ref(),S=s.computed(()=>{if(n.icon)switch(n.type){case"danger":return c;case"info":return h;case"success":return v;case"warning":return u;default:return}}),L=s.computed(()=>n.position.includes("top")?"top":"bottom"),d=s.computed(()=>n.position.includes("left")?"left":n.position.includes("right")?"right":"center"),y=s.computed(()=>d.value!=="center"?d.value==="right"?"m-slide-right":"m-slide-left":L.value==="top"?"m-slide-top":"m-slide-bottom"),z=s.ref(!1),g=s.ref(!1),I=s.ref(),D=`m-toast-container --${L.value} --${d.value}`,E=`.${D.replaceAll(" ",".")}`,V=Ze({callback:q,timeout:typeof n.timeout=="number"?n.timeout:0,callbackOffsetTime:200});function B(){const p=document.querySelector(E);if(!p&&!p){const T=document.body,f=document.createElement("div");f.className=D,T.append(f)}}function M(){const p=document.querySelector(E);return!n.queue&&n.maxToasts===!1?!1:typeof n.maxToasts=="number"&&p?n.maxToasts<=p.childElementCount:p&&p.childElementCount>0}function $(){if(M()){I.value=setTimeout($,250);return}const p=document.querySelector(E);C.value&&p&&p.prepend(C.value),g.value=!0,typeof n.timeout=="number"&&n.timeout>0&&V.start()}const oe=s.ref("100%");function R(){switch(n.type){case"danger":return"maz-bg-danger-700";case"info":return"maz-bg-info-700";case"success":return"maz-bg-success-700";case"warning":return"maz-bg-warning-700";default:return"maz-bg-secondary"}}s.watch(V.remainingTime,p=>{if(typeof n.timeout=="number"){const T=100*p/n.timeout;oe.value=`${T}%`}});function F(p){r("click",p),n.persistent||q()}async function de(p,T){var f;z.value=!0,await p(),z.value=!1,(f=n.action)!=null&&f.closeToast&&F(T)}function K(p){n.noPauseOnHover||(p?V.pause():V.resume())}function ne(){V.stop(),I.value&&clearTimeout(I.value)}function q(){ne(),g.value=!1}e({closeToast:q});function j(){r("open")}function me(){var T;r("close"),(T=C.value)==null||T.remove();const p=document.querySelector(E);p&&!(p!=null&&p.hasChildNodes())&&p.remove()}return s.onMounted(()=>{B(),$()}),(p,T)=>(s.openBlock(),s.createBlock(s.Transition,{name:y.value,onAfterLeave:me,onAfterEnter:j,persisted:""},{default:s.withCtx(()=>[s.withDirectives(s.createElementVNode("button",{ref_key:"Toaster",ref:C,class:s.normalizeClass(["m-toast",[`--${p.type}`,`--${L.value}`,`--${d.value}`,{"maz-pb-1":typeof p.timeout=="number"&&p.timeout>0,"--persistent":p.persistent}]]),role:"alert",onMouseover:T[2]||(T[2]=f=>K(!0)),onMouseleave:T[3]||(T[3]=f=>K(!1)),onClick:T[4]||(T[4]=s.withModifiers(f=>{var b;return p.link&&!((b=p.link)!=null&&b.closeToast)?void 0:F(f)},["stop"]))},[S.value?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(S.value),{key:0,class:"maz-text-2xl"})):s.createCommentVNode("v-if",!0),s.createElementVNode("div",cn,[s.createElementVNode("p",dn,s.toDisplayString(p.message),1)]),p.action?(s.openBlock(),s.createBlock(s.unref(i),{key:1,"data-test":"action-btn",color:p.type,pastel:"",loading:z.value,size:"sm",onClick:T[0]||(T[0]=s.withModifiers(f=>p.action?de(p.action.func,f):void 0,["stop"]))},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(p.action.text),1)]),_:1},8,["color","loading"])):s.createCommentVNode("v-if",!0),p.link?(s.openBlock(),s.createBlock(s.unref(i),{key:2,"data-test":"link-btn",color:p.type,pastel:"",size:"xs",href:p.link.href,target:p.link.target??"_self"},{default:s.withCtx(()=>{var f;return[s.createElementVNode("div",mn,[p.link.text?(s.openBlock(),s.createElementBlock("span",fn,s.toDisplayString(p.link.text),1)):s.createCommentVNode("v-if",!0),((f=p.link)==null?void 0:f.target)==="_blank"?(s.openBlock(),s.createBlock(s.unref(l),{key:1,class:"maz-text-xl"})):(s.openBlock(),s.createBlock(s.unref(w),{key:2,class:"maz-text-xl"}))])]}),_:1},8,["color","href","target"])):s.createCommentVNode("v-if",!0),p.persistent?s.createCommentVNode("v-if",!0):(s.openBlock(),s.createElementBlock("button",{key:3,class:"--close",onClick:T[1]||(T[1]=s.withModifiers(f=>F(f),["stop"]))},[s.createVNode(s.unref(a),{class:"--icon maz-text-xl"})])),typeof p.timeout=="number"&&p.timeout>0?(s.openBlock(),s.createElementBlock("div",hn,[s.createElementVNode("div",{style:s.normalizeStyle({width:oe.value}),class:s.normalizeClass(["maz-h-full !maz-transition-all !maz-duration-200 !maz-ease-linear",R()])},null,6)])):s.createCommentVNode("v-if",!0)],34),[[s.vShow,g.value]])]),_:1},8,["name"]))}}),vn=ce(pn,[["__scopeId","data-v-309639e4"]]),gn={position:"bottom-right",timeout:1e4,persistent:!1,icon:!0};class zt{constructor(e,t){this.app=e,this.globalOptions=t}show(e,t){const n={...gn,...this.globalOptions,...t,message:e},{destroy:r,vNode:i}=ue(vn,{props:n,app:this.app});return{destroy:r,close:()=>{var a,l;return(l=(a=i.component)==null?void 0:a.exposed)==null?void 0:l.closeToast()}}}getLocalOptions(e,t){return{type:e,...t}}message(e,t){return this.show(e,this.getLocalOptions("theme",t))}success(e,t){return this.show(e,this.getLocalOptions("success",t))}error(e,t){return this.show(e,this.getLocalOptions("danger",t))}info(e,t){return this.show(e,this.getLocalOptions("info",t))}warning(e,t){return this.show(e,this.getLocalOptions("warning",t))}}function yn(o,e){return new zt(o,e)}const bn={install(o,e){o.provide("toast",yn(o,e))}},W="";function wn(o){return o.filter((e,t,n)=>t===n.indexOf(e))}function En(o){return(e=W)=>typeof e=="function"?o.findIndex((...t)=>e(...t))>-1:o.includes(e)}const Cn=o=>o.length>0;function Tn(o){return(e=W)=>wn([...o,e])}function zn(o){return(e=W)=>o.filter(t=>t!==e)}class kt{constructor(){m(this,"_loaders",s.ref([]))}get loaders(){return s.computed(()=>this._loaders.value)}stop(e=W){this._loaders.value=zn(this._loaders.value)(e)}start(e=W){return this._loaders.value=Tn(this._loaders.value)(e),()=>this.stop(e)}get anyLoading(){return s.computed(()=>Cn(this._loaders.value))}isLoading(e=W){return s.computed(()=>En(this._loaders.value)(e)).value}}const Lt=new kt,kn={install:o=>{o.provide("wait",Lt)}};exports.AosHandler=wt;exports.DialogHandler=Tt;exports.IdleTimeout=je;exports.ScriptLoader=Yo;exports.Swipe=Re;exports.ToasterHandler=zt;exports.UserVisibility=Xe;exports.WaitHandler=kt;exports._export_sfc=ce;exports.capitalize=ht;exports.checkAvailability=Be;exports.countryCodeToUnicodeFlag=Ro;exports.currency=pt;exports.date=vt;exports.debounce=Ko;exports.directive=et;exports.directive$1=st;exports.directive$2=Lo;exports.directive$3=lt;exports.directive$4=Bo;exports.getInstance=Go;exports.injectStrict=X;exports.installDialog=un;exports.installFilters=Wo;exports.installToaster=bn;exports.instance=Lt;exports.isClient=x;exports.isoCodes=Ue;exports.mount=ue;exports.normalizeString=ye;exports.number=gt;exports.plugin=$o;exports.plugin$1=tt;exports.plugin$2=rt;exports.plugin$3=at;exports.plugin$4=ut;exports.plugin$5=dt;exports.plugin$6=ft;exports.plugin$7=Xo;exports.plugin$8=kn;exports.sleep=bt;exports.throttle=Zo;exports.truthyFilter=yt;exports.useAos=Vt;exports.useBreakpoints=Ot;exports.useDialog=Bt;exports.useFormField=eo;exports.useFormValidator=to;exports.useIdleTimeout=oo;exports.useInstanceUniqId=no;exports.useLanguageDisplayNames=ao;exports.useReadingTime=uo;exports.useStringMatching=ho;exports.useSwipe=vo;exports.useThemeHandler=bo;exports.useTimer=Ze;exports.useToast=wo;exports.useUserVisibility=Eo;exports.useWait=Co;exports.useWindowSize=Oe;exports.vZoomImg=mt;
|