@ldmjs/ui 1.0.75 → 1.0.76
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/dist/css/index.css +1 -1
- package/dist/index.js +66 -40
- package/dist/lib/calendar.js +1 -1
- package/dist/lib/floating.js +1 -1
- package/dist/lib/imask.js +1 -1
- package/dist/lib/multiselect.js +1 -1
- package/dist/lib/runtime-template.js +1 -1
- package/dist/lib/toastification.js +1 -1
- package/dist/scss/_multiselect.scss +0 -1
- package/dist/utils/validators.js +1 -1
- package/package.json +6 -4
package/dist/lib/floating.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function webpackUniversalModuleDefinition(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["ldmui"]=t():e["ldmui"]=t()})(self,(()=>(()=>{"use strict";var e={};(()=>{e.d=(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})}})(),(()=>{e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{e.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var t={};e.r(t),e.d(t,{arrow:()=>x,autoPlacement:()=>p,autoUpdate:()=>autoUpdate,computePosition:()=>floating_ui_dom_esm_computePosition,detectOverflow:()=>d,flip:()=>w,getOverflowAncestors:()=>getOverflowAncestors,hide:()=>v,inline:()=>b,limitShift:()=>A,offset:()=>m,platform:()=>u,shift:()=>h,size:()=>y});const n=["top","right","bottom","left"],i=["start","end"],o=n.reduce(((e,t)=>e.concat(t,t+"-"+i[0],t+"-"+i[1])),[]),r=Math.min,l=Math.max,s=Math.round,c=Math.floor,createCoords=e=>({x:e,y:e}),a={left:"right",right:"left",bottom:"top",top:"bottom"},f={start:"end",end:"start"};function clamp(e,t,n){return l(e,r(t,n))}function evaluate(e,t){return"function"===typeof e?e(t):e}function getSide(e){return e.split("-")[0]}function getAlignment(e){return e.split("-")[1]}function getOppositeAxis(e){return"x"===e?"y":"x"}function getAxisLength(e){return"y"===e?"height":"width"}function getSideAxis(e){return["top","bottom"].includes(getSide(e))?"y":"x"}function getAlignmentAxis(e){return getOppositeAxis(getSideAxis(e))}function getAlignmentSides(e,t,n){void 0===n&&(n=!1);const i=getAlignment(e),o=getAlignmentAxis(e),r=getAxisLength(o);let l="x"===o?i===(n?"end":"start")?"right":"left":"start"===i?"bottom":"top";return t.reference[r]>t.floating[r]&&(l=getOppositePlacement(l)),[l,getOppositePlacement(l)]}function getExpandedPlacements(e){const t=getOppositePlacement(e);return[getOppositeAlignmentPlacement(e),t,getOppositeAlignmentPlacement(t)]}function getOppositeAlignmentPlacement(e){return e.replace(/start|end/g,(e=>f[e]))}function getSideList(e,t,n){const i=["left","right"],o=["right","left"],r=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:i:t?i:o;case"left":case"right":return t?r:l;default:return[]}}function getOppositeAxisPlacements(e,t,n,i){const o=getAlignment(e);let r=getSideList(getSide(e),"start"===n,i);return o&&(r=r.map((e=>e+"-"+o)),t&&(r=r.concat(r.map(getOppositeAlignmentPlacement)))),r}function getOppositePlacement(e){return e.replace(/left|right|bottom|top/g,(e=>a[e]))}function expandPaddingObject(e){return{top:0,right:0,bottom:0,left:0,...e}}function getPaddingObject(e){return"number"!==typeof e?expandPaddingObject(e):{top:e,right:e,bottom:e,left:e}}function rectToClientRect(e){const{x:t,y:n,width:i,height:o}=e;return{width:i,height:o,top:n,left:t,right:t+i,bottom:n+o,x:t,y:n}}function computeCoordsFromPlacement(e,t,n){let{reference:i,floating:o}=e;const r=getSideAxis(t),l=getAlignmentAxis(t),s=getAxisLength(l),c=getSide(t),a="y"===r,f=i.x+i.width/2-o.width/2,g=i.y+i.height/2-o.height/2,u=i[s]/2-o[s]/2;let d;switch(c){case"top":d={x:f,y:i.y-o.height};break;case"bottom":d={x:f,y:i.y+i.height};break;case"right":d={x:i.x+i.width,y:g};break;case"left":d={x:i.x-o.width,y:g};break;default:d={x:i.x,y:i.y}}switch(getAlignment(t)){case"start":d[l]-=u*(n&&a?-1:1);break;case"end":d[l]+=u*(n&&a?-1:1);break}return d}const computePosition=async(e,t,n)=>{const{placement:i="bottom",strategy:o="absolute",middleware:r=[],platform:l}=n,s=r.filter(Boolean),c=await(null==l.isRTL?void 0:l.isRTL(t));let a=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:g}=computeCoordsFromPlacement(a,i,c),u=i,d={},m=0;for(let n=0;n<s.length;n++){const{name:r,fn:p}=s[n],{x:h,y:w,data:y,reset:v}=await p({x:f,y:g,initialPlacement:i,placement:u,strategy:o,middlewareData:d,rects:a,platform:l,elements:{reference:e,floating:t}});f=null!=h?h:f,g=null!=w?w:g,d={...d,[r]:{...d[r],...y}},v&&m<=50&&(m++,"object"===typeof v&&(v.placement&&(u=v.placement),v.rects&&(a=!0===v.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):v.rects),({x:f,y:g}=computeCoordsFromPlacement(a,u,c))),n=-1)}return{x:f,y:g,placement:u,strategy:o,middlewareData:d}};async function detectOverflow(e,t){var n;void 0===t&&(t={});const{x:i,y:o,platform:r,rects:l,elements:s,strategy:c}=e,{boundary:a="clippingAncestors",rootBoundary:f="viewport",elementContext:g="floating",altBoundary:u=!1,padding:d=0}=evaluate(t,e),m=getPaddingObject(d),p="floating"===g?"reference":"floating",h=s[u?p:g],w=rectToClientRect(await r.getClippingRect({element:null==(n=await(null==r.isElement?void 0:r.isElement(h)))||n?h:h.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(s.floating)),boundary:a,rootBoundary:f,strategy:c})),y="floating"===g?{x:i,y:o,width:l.floating.width,height:l.floating.height}:l.reference,v=await(null==r.getOffsetParent?void 0:r.getOffsetParent(s.floating)),x=await(null==r.isElement?void 0:r.isElement(v))&&await(null==r.getScale?void 0:r.getScale(v))||{x:1,y:1},b=rectToClientRect(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:y,offsetParent:v,strategy:c}):y);return{top:(w.top-b.top+m.top)/x.y,bottom:(b.bottom-w.bottom+m.bottom)/x.y,left:(w.left-b.left+m.left)/x.x,right:(b.right-w.right+m.right)/x.x}}const arrow=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:i,placement:o,rects:l,platform:s,elements:c,middlewareData:a}=t,{element:f,padding:g=0}=evaluate(e,t)||{};if(null==f)return{};const u=getPaddingObject(g),d={x:n,y:i},m=getAlignmentAxis(o),p=getAxisLength(m),h=await s.getDimensions(f),w="y"===m,y=w?"top":"left",v=w?"bottom":"right",x=w?"clientHeight":"clientWidth",b=l.reference[p]+l.reference[m]-d[m]-l.floating[p],A=d[m]-l.reference[m],R=await(null==s.getOffsetParent?void 0:s.getOffsetParent(f));let O=R?R[x]:0;O&&await(null==s.isElement?void 0:s.isElement(R))||(O=c.floating[x]||l.floating[p]);const S=b/2-A/2,T=O/2-h[p]/2-1,E=r(u[y],T),L=r(u[v],T),C=E,P=O-h[p]-L,N=O/2-h[p]/2+S,D=clamp(C,N,P),B=!a.arrow&&null!=getAlignment(o)&&N!==D&&l.reference[p]/2-(N<C?E:L)-h[p]/2<0,W=B?N<C?N-C:N-P:0;return{[m]:d[m]+W,data:{[m]:D,centerOffset:N-D-W,...B&&{alignmentOffset:W}},reset:B}}});function getPlacementList(e,t,n){const i=e?[...n.filter((t=>getAlignment(t)===e)),...n.filter((t=>getAlignment(t)!==e))]:n.filter((e=>getSide(e)===e));return i.filter((n=>!e||(getAlignment(n)===e||!!t&&getOppositeAlignmentPlacement(n)!==n)))}const autoPlacement=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,i,r;const{rects:l,middlewareData:s,placement:c,platform:a,elements:f}=t,{crossAxis:g=!1,alignment:u,allowedPlacements:d=o,autoAlignment:m=!0,...p}=evaluate(e,t),h=void 0!==u||d===o?getPlacementList(u||null,m,d):d,w=await detectOverflow(t,p),y=(null==(n=s.autoPlacement)?void 0:n.index)||0,v=h[y];if(null==v)return{};const x=getAlignmentSides(v,l,await(null==a.isRTL?void 0:a.isRTL(f.floating)));if(c!==v)return{reset:{placement:h[0]}};const b=[w[getSide(v)],w[x[0]],w[x[1]]],A=[...(null==(i=s.autoPlacement)?void 0:i.overflows)||[],{placement:v,overflows:b}],R=h[y+1];if(R)return{data:{index:y+1,overflows:A},reset:{placement:R}};const O=A.map((e=>{const t=getAlignment(e.placement);return[e.placement,t&&g?e.overflows.slice(0,2).reduce(((e,t)=>e+t),0):e.overflows[0],e.overflows]})).sort(((e,t)=>e[1]-t[1])),S=O.filter((e=>e[2].slice(0,getAlignment(e[0])?2:3).every((e=>e<=0)))),T=(null==(r=S[0])?void 0:r[0])||O[0][0];return T!==c?{data:{index:y+1,overflows:A},reset:{placement:T}}:{}}}},flip=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,i;const{placement:o,middlewareData:r,rects:l,initialPlacement:s,platform:c,elements:a}=t,{mainAxis:f=!0,crossAxis:g=!0,fallbackPlacements:u,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:p=!0,...h}=evaluate(e,t);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const w=getSide(o),y=getSideAxis(s),v=getSide(s)===s,x=await(null==c.isRTL?void 0:c.isRTL(a.floating)),b=u||(v||!p?[getOppositePlacement(s)]:getExpandedPlacements(s)),A="none"!==m;!u&&A&&b.push(...getOppositeAxisPlacements(s,p,m,x));const R=[s,...b],O=await detectOverflow(t,h),S=[];let T=(null==(i=r.flip)?void 0:i.overflows)||[];if(f&&S.push(O[w]),g){const e=getAlignmentSides(o,l,x);S.push(O[e[0]],O[e[1]])}if(T=[...T,{placement:o,overflows:S}],!S.every((e=>e<=0))){var E,L;const e=((null==(E=r.flip)?void 0:E.index)||0)+1,t=R[e];if(t){var C;const n="alignment"===g&&y!==getSideAxis(t),i=(null==(C=T[0])?void 0:C.overflows[0])>0;if(!n||i)return{data:{index:e,overflows:T},reset:{placement:t}}}let n=null==(L=T.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:L.placement;if(!n)switch(d){case"bestFit":{var P;const e=null==(P=T.filter((e=>{if(A){const t=getSideAxis(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:P[0];e&&(n=e);break}case"initialPlacement":n=s;break}if(o!==n)return{reset:{placement:n}}}return{}}}};function getSideOffsets(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function isAnySideFullyClipped(e){return n.some((t=>e[t]>=0))}const hide=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:i="referenceHidden",...o}=evaluate(e,t);switch(i){case"referenceHidden":{const e=await detectOverflow(t,{...o,elementContext:"reference"}),i=getSideOffsets(e,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:isAnySideFullyClipped(i)}}}case"escaped":{const e=await detectOverflow(t,{...o,altBoundary:!0}),i=getSideOffsets(e,n.floating);return{data:{escapedOffsets:i,escaped:isAnySideFullyClipped(i)}}}default:return{}}}}};function getBoundingRect(e){const t=r(...e.map((e=>e.left))),n=r(...e.map((e=>e.top))),i=l(...e.map((e=>e.right))),o=l(...e.map((e=>e.bottom)));return{x:t,y:n,width:i-t,height:o-n}}function getRectsByLine(e){const t=e.slice().sort(((e,t)=>e.y-t.y)),n=[];let i=null;for(let e=0;e<t.length;e++){const o=t[e];!i||o.y-i.y>i.height/2?n.push([o]):n[n.length-1].push(o),i=o}return n.map((e=>rectToClientRect(getBoundingRect(e))))}const inline=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:i,rects:o,platform:s,strategy:c}=t,{padding:a=2,x:f,y:g}=evaluate(e,t),u=Array.from(await(null==s.getClientRects?void 0:s.getClientRects(i.reference))||[]),d=getRectsByLine(u),m=rectToClientRect(getBoundingRect(u)),p=getPaddingObject(a);function getBoundingClientRect(){if(2===d.length&&d[0].left>d[1].right&&null!=f&&null!=g)return d.find((e=>f>e.left-p.left&&f<e.right+p.right&&g>e.top-p.top&&g<e.bottom+p.bottom))||m;if(d.length>=2){if("y"===getSideAxis(n)){const e=d[0],t=d[d.length-1],i="top"===getSide(n),o=e.top,r=t.bottom,l=i?e.left:t.left,s=i?e.right:t.right,c=s-l,a=r-o;return{top:o,bottom:r,left:l,right:s,width:c,height:a,x:l,y:o}}const e="left"===getSide(n),t=l(...d.map((e=>e.right))),i=r(...d.map((e=>e.left))),o=d.filter((n=>e?n.left===i:n.right===t)),s=o[0].top,c=o[o.length-1].bottom,a=i,f=t,g=f-a,u=c-s;return{top:s,bottom:c,left:a,right:f,width:g,height:u,x:a,y:s}}return m}const h=await s.getElementRects({reference:{getBoundingClientRect},floating:i.floating,strategy:c});return o.reference.x!==h.reference.x||o.reference.y!==h.reference.y||o.reference.width!==h.reference.width||o.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}};async function convertValueToCoords(e,t){const{placement:n,platform:i,elements:o}=e,r=await(null==i.isRTL?void 0:i.isRTL(o.floating)),l=getSide(n),s=getAlignment(n),c="y"===getSideAxis(n),a=["left","top"].includes(l)?-1:1,f=r&&c?-1:1,g=evaluate(t,e);let{mainAxis:u,crossAxis:d,alignmentAxis:m}="number"===typeof g?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return s&&"number"===typeof m&&(d="end"===s?-1*m:m),c?{x:d*f,y:u*a}:{x:u*a,y:d*f}}const offset=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,i;const{x:o,y:r,placement:l,middlewareData:s}=t,c=await convertValueToCoords(t,e);return l===(null==(n=s.offset)?void 0:n.placement)&&null!=(i=s.arrow)&&i.alignmentOffset?{}:{x:o+c.x,y:r+c.y,data:{...c,placement:l}}}}},shift=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:i,placement:o}=t,{mainAxis:r=!0,crossAxis:l=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=evaluate(e,t),a={x:n,y:i},f=await detectOverflow(t,c),g=getSideAxis(getSide(o)),u=getOppositeAxis(g);let d=a[u],m=a[g];if(r){const e="y"===u?"top":"left",t="y"===u?"bottom":"right",n=d+f[e],i=d-f[t];d=clamp(n,d,i)}if(l){const e="y"===g?"top":"left",t="y"===g?"bottom":"right",n=m+f[e],i=m-f[t];m=clamp(n,m,i)}const p=s.fn({...t,[u]:d,[g]:m});return{...p,data:{x:p.x-n,y:p.y-i,enabled:{[u]:r,[g]:l}}}}}},limitShift=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:i,placement:o,rects:r,middlewareData:l}=t,{offset:s=0,mainAxis:c=!0,crossAxis:a=!0}=evaluate(e,t),f={x:n,y:i},g=getSideAxis(o),u=getOppositeAxis(g);let d=f[u],m=f[g];const p=evaluate(s,t),h="number"===typeof p?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const e="y"===u?"height":"width",t=r.reference[u]-r.floating[e]+h.mainAxis,n=r.reference[u]+r.reference[e]-h.mainAxis;d<t?d=t:d>n&&(d=n)}if(a){var w,y;const e="y"===u?"width":"height",t=["top","left"].includes(getSide(o)),n=r.reference[g]-r.floating[e]+(t&&(null==(w=l.offset)?void 0:w[g])||0)+(t?0:h.crossAxis),i=r.reference[g]+r.reference[e]+(t?0:(null==(y=l.offset)?void 0:y[g])||0)-(t?h.crossAxis:0);m<n?m=n:m>i&&(m=i)}return{[u]:d,[g]:m}}}},size=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,i;const{placement:o,rects:s,platform:c,elements:a}=t,{apply:f=(()=>{}),...g}=evaluate(e,t),u=await detectOverflow(t,g),d=getSide(o),m=getAlignment(o),p="y"===getSideAxis(o),{width:h,height:w}=s.floating;let y,v;"top"===d||"bottom"===d?(y=d,v=m===(await(null==c.isRTL?void 0:c.isRTL(a.floating))?"start":"end")?"left":"right"):(v=d,y="end"===m?"top":"bottom");const x=w-u.top-u.bottom,b=h-u.left-u.right,A=r(w-u[y],x),R=r(h-u[v],b),O=!t.middlewareData.shift;let S=A,T=R;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(T=b),null!=(i=t.middlewareData.shift)&&i.enabled.y&&(S=x),O&&!m){const e=l(u.left,0),t=l(u.right,0),n=l(u.top,0),i=l(u.bottom,0);p?T=h-2*(0!==e||0!==t?e+t:l(u.left,u.right)):S=w-2*(0!==n||0!==i?n+i:l(u.top,u.bottom))}await f({...t,availableWidth:T,availableHeight:S});const E=await c.getDimensions(a.floating);return h!==E.width||w!==E.height?{reset:{rects:!0}}:{}}}};function hasWindow(){return"undefined"!==typeof window}function getNodeName(e){return isNode(e)?(e.nodeName||"").toLowerCase():"#document"}function getWindow(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function getDocumentElement(e){var t;return null==(t=(isNode(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function isNode(e){return!!hasWindow()&&(e instanceof Node||e instanceof getWindow(e).Node)}function isElement(e){return!!hasWindow()&&(e instanceof Element||e instanceof getWindow(e).Element)}function isHTMLElement(e){return!!hasWindow()&&(e instanceof HTMLElement||e instanceof getWindow(e).HTMLElement)}function isShadowRoot(e){return!(!hasWindow()||"undefined"===typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof getWindow(e).ShadowRoot)}function isOverflowElement(e){const{overflow:t,overflowX:n,overflowY:i,display:o}=getComputedStyle(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!["inline","contents"].includes(o)}function isTableElement(e){return["table","td","th"].includes(getNodeName(e))}function isTopLayer(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function isContainingBlock(e){const t=isWebKit(),n=isElement(e)?getComputedStyle(e):e;return["transform","translate","scale","rotate","perspective"].some((e=>!!n[e]&&"none"!==n[e]))||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","translate","scale","rotate","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function getContainingBlock(e){let t=getParentNode(e);while(isHTMLElement(t)&&!isLastTraversableNode(t)){if(isContainingBlock(t))return t;if(isTopLayer(t))return null;t=getParentNode(t)}return null}function isWebKit(){return!("undefined"===typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function isLastTraversableNode(e){return["html","body","#document"].includes(getNodeName(e))}function getComputedStyle(e){return getWindow(e).getComputedStyle(e)}function getNodeScroll(e){return isElement(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function getParentNode(e){if("html"===getNodeName(e))return e;const t=e.assignedSlot||e.parentNode||isShadowRoot(e)&&e.host||getDocumentElement(e);return isShadowRoot(t)?t.host:t}function getNearestOverflowAncestor(e){const t=getParentNode(e);return isLastTraversableNode(t)?e.ownerDocument?e.ownerDocument.body:e.body:isHTMLElement(t)&&isOverflowElement(t)?t:getNearestOverflowAncestor(t)}function getOverflowAncestors(e,t,n){var i;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=getNearestOverflowAncestor(e),r=o===(null==(i=e.ownerDocument)?void 0:i.body),l=getWindow(o);if(r){const e=getFrameElement(l);return t.concat(l,l.visualViewport||[],isOverflowElement(o)?o:[],e&&n?getOverflowAncestors(e):[])}return t.concat(o,getOverflowAncestors(o,[],n))}function getFrameElement(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function getCssDimensions(e){const t=getComputedStyle(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const o=isHTMLElement(e),r=o?e.offsetWidth:n,l=o?e.offsetHeight:i,c=s(n)!==r||s(i)!==l;return c&&(n=r,i=l),{width:n,height:i,$:c}}function unwrapElement(e){return isElement(e)?e:e.contextElement}function getScale(e){const t=unwrapElement(e);if(!isHTMLElement(t))return createCoords(1);const n=t.getBoundingClientRect(),{width:i,height:o,$:r}=getCssDimensions(t);let l=(r?s(n.width):n.width)/i,c=(r?s(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const g=createCoords(0);function getVisualOffsets(e){const t=getWindow(e);return isWebKit()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:g}function shouldAddVisualOffsets(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==getWindow(e))&&t}function getBoundingClientRect(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),r=unwrapElement(e);let l=createCoords(1);t&&(i?isElement(i)&&(l=getScale(i)):l=getScale(e));const s=shouldAddVisualOffsets(r,n,i)?getVisualOffsets(r):createCoords(0);let c=(o.left+s.x)/l.x,a=(o.top+s.y)/l.y,f=o.width/l.x,g=o.height/l.y;if(r){const e=getWindow(r),t=i&&isElement(i)?getWindow(i):i;let n=e,o=getFrameElement(n);while(o&&i&&t!==n){const e=getScale(o),t=o.getBoundingClientRect(),i=getComputedStyle(o),r=t.left+(o.clientLeft+parseFloat(i.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(i.paddingTop))*e.y;c*=e.x,a*=e.y,f*=e.x,g*=e.y,c+=r,a+=l,n=getWindow(o),o=getFrameElement(n)}}return rectToClientRect({width:f,height:g,x:c,y:a})}function getWindowScrollBarX(e,t){const n=getNodeScroll(e).scrollLeft;return t?t.left+n:getBoundingClientRect(getDocumentElement(e)).left+n}function getHTMLOffset(e,t,n){void 0===n&&(n=!1);const i=e.getBoundingClientRect(),o=i.left+t.scrollLeft-(n?0:getWindowScrollBarX(e,i)),r=i.top+t.scrollTop;return{x:o,y:r}}function convertOffsetParentRelativeRectToViewportRelativeRect(e){let{elements:t,rect:n,offsetParent:i,strategy:o}=e;const r="fixed"===o,l=getDocumentElement(i),s=!!t&&isTopLayer(t.floating);if(i===l||s&&r)return n;let c={scrollLeft:0,scrollTop:0},a=createCoords(1);const f=createCoords(0),g=isHTMLElement(i);if((g||!g&&!r)&&(("body"!==getNodeName(i)||isOverflowElement(l))&&(c=getNodeScroll(i)),isHTMLElement(i))){const e=getBoundingClientRect(i);a=getScale(i),f.x=e.x+i.clientLeft,f.y=e.y+i.clientTop}const u=!l||g||r?createCoords(0):getHTMLOffset(l,c,!0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-c.scrollLeft*a.x+f.x+u.x,y:n.y*a.y-c.scrollTop*a.y+f.y+u.y}}function getClientRects(e){return Array.from(e.getClientRects())}function getDocumentRect(e){const t=getDocumentElement(e),n=getNodeScroll(e),i=e.ownerDocument.body,o=l(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),r=l(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let s=-n.scrollLeft+getWindowScrollBarX(e);const c=-n.scrollTop;return"rtl"===getComputedStyle(i).direction&&(s+=l(t.clientWidth,i.clientWidth)-o),{width:o,height:r,x:s,y:c}}function getViewportRect(e,t){const n=getWindow(e),i=getDocumentElement(e),o=n.visualViewport;let r=i.clientWidth,l=i.clientHeight,s=0,c=0;if(o){r=o.width,l=o.height;const e=isWebKit();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,c=o.offsetTop)}return{width:r,height:l,x:s,y:c}}function getInnerBoundingClientRect(e,t){const n=getBoundingClientRect(e,!0,"fixed"===t),i=n.top+e.clientTop,o=n.left+e.clientLeft,r=isHTMLElement(e)?getScale(e):createCoords(1),l=e.clientWidth*r.x,s=e.clientHeight*r.y,c=o*r.x,a=i*r.y;return{width:l,height:s,x:c,y:a}}function getClientRectFromClippingAncestor(e,t,n){let i;if("viewport"===t)i=getViewportRect(e,n);else if("document"===t)i=getDocumentRect(getDocumentElement(e));else if(isElement(t))i=getInnerBoundingClientRect(t,n);else{const n=getVisualOffsets(e);i={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return rectToClientRect(i)}function hasFixedPositionAncestor(e,t){const n=getParentNode(e);return!(n===t||!isElement(n)||isLastTraversableNode(n))&&("fixed"===getComputedStyle(n).position||hasFixedPositionAncestor(n,t))}function getClippingElementAncestors(e,t){const n=t.get(e);if(n)return n;let i=getOverflowAncestors(e,[],!1).filter((e=>isElement(e)&&"body"!==getNodeName(e))),o=null;const r="fixed"===getComputedStyle(e).position;let l=r?getParentNode(e):e;while(isElement(l)&&!isLastTraversableNode(l)){const t=getComputedStyle(l),n=isContainingBlock(l);n||"fixed"!==t.position||(o=null);const s=r?!n&&!o:!n&&"static"===t.position&&!!o&&["absolute","fixed"].includes(o.position)||isOverflowElement(l)&&!n&&hasFixedPositionAncestor(e,l);s?i=i.filter((e=>e!==l)):o=t,l=getParentNode(l)}return t.set(e,i),i}function getClippingRect(e){let{element:t,boundary:n,rootBoundary:i,strategy:o}=e;const s="clippingAncestors"===n?isTopLayer(t)?[]:getClippingElementAncestors(t,this._c):[].concat(n),c=[...s,i],a=c[0],f=c.reduce(((e,n)=>{const i=getClientRectFromClippingAncestor(t,n,o);return e.top=l(i.top,e.top),e.right=r(i.right,e.right),e.bottom=r(i.bottom,e.bottom),e.left=l(i.left,e.left),e}),getClientRectFromClippingAncestor(t,a,o));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function getDimensions(e){const{width:t,height:n}=getCssDimensions(e);return{width:t,height:n}}function getRectRelativeToOffsetParent(e,t,n){const i=isHTMLElement(t),o=getDocumentElement(t),r="fixed"===n,l=getBoundingClientRect(e,!0,r,t);let s={scrollLeft:0,scrollTop:0};const c=createCoords(0);function setLeftRTLScrollbarOffset(){c.x=getWindowScrollBarX(o)}if(i||!i&&!r)if(("body"!==getNodeName(t)||isOverflowElement(o))&&(s=getNodeScroll(t)),i){const e=getBoundingClientRect(t,!0,r,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else o&&setLeftRTLScrollbarOffset();r&&!i&&o&&setLeftRTLScrollbarOffset();const a=!o||i||r?createCoords(0):getHTMLOffset(o,s),f=l.left+s.scrollLeft-c.x-a.x,g=l.top+s.scrollTop-c.y-a.y;return{x:f,y:g,width:l.width,height:l.height}}function isStaticPositioned(e){return"static"===getComputedStyle(e).position}function getTrueOffsetParent(e,t){if(!isHTMLElement(e)||"fixed"===getComputedStyle(e).position)return null;if(t)return t(e);let n=e.offsetParent;return getDocumentElement(e)===n&&(n=n.ownerDocument.body),n}function getOffsetParent(e,t){const n=getWindow(e);if(isTopLayer(e))return n;if(!isHTMLElement(e)){let t=getParentNode(e);while(t&&!isLastTraversableNode(t)){if(isElement(t)&&!isStaticPositioned(t))return t;t=getParentNode(t)}return n}let i=getTrueOffsetParent(e,t);while(i&&isTableElement(i)&&isStaticPositioned(i))i=getTrueOffsetParent(i,t);return i&&isLastTraversableNode(i)&&isStaticPositioned(i)&&!isContainingBlock(i)?n:i||getContainingBlock(e)||n}const getElementRects=async function(e){const t=this.getOffsetParent||getOffsetParent,n=this.getDimensions,i=await n(e.floating);return{reference:getRectRelativeToOffsetParent(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function isRTL(e){return"rtl"===getComputedStyle(e).direction}const u={convertOffsetParentRelativeRectToViewportRelativeRect,getDocumentElement,getClippingRect,getOffsetParent,getElementRects,getClientRects,getDimensions,getScale,isElement,isRTL};function rectsAreEqual(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function observeMove(e,t){let n,i=null;const o=getDocumentElement(e);function cleanup(){var e;clearTimeout(n),null==(e=i)||e.disconnect(),i=null}function refresh(s,a){void 0===s&&(s=!1),void 0===a&&(a=1),cleanup();const f=e.getBoundingClientRect(),{left:g,top:u,width:d,height:m}=f;if(s||t(),!d||!m)return;const p=c(u),h=c(o.clientWidth-(g+d)),w=c(o.clientHeight-(u+m)),y=c(g),v=-p+"px "+-h+"px "+-w+"px "+-y+"px",x={rootMargin:v,threshold:l(0,r(1,a))||1};let b=!0;function handleObserve(t){const i=t[0].intersectionRatio;if(i!==a){if(!b)return refresh();i?refresh(!1,i):n=setTimeout((()=>{refresh(!1,1e-7)}),1e3)}1!==i||rectsAreEqual(f,e.getBoundingClientRect())||refresh(),b=!1}try{i=new IntersectionObserver(handleObserve,{...x,root:o.ownerDocument})}catch(e){i=new IntersectionObserver(handleObserve,x)}i.observe(e)}return refresh(!0),cleanup}function autoUpdate(e,t,n,i){void 0===i&&(i={});const{ancestorScroll:o=!0,ancestorResize:r=!0,elementResize:l="function"===typeof ResizeObserver,layoutShift:s="function"===typeof IntersectionObserver,animationFrame:c=!1}=i,a=unwrapElement(e),f=o||r?[...a?getOverflowAncestors(a):[],...getOverflowAncestors(t)]:[];f.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),r&&e.addEventListener("resize",n)}));const g=a&&s?observeMove(a,n):null;let u,d=-1,m=null;l&&(m=new ResizeObserver((e=>{let[i]=e;i&&i.target===a&&m&&(m.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame((()=>{var e;null==(e=m)||e.observe(t)}))),n()})),a&&!c&&m.observe(a),m.observe(t));let p=c?getBoundingClientRect(e):null;function frameLoop(){const t=getBoundingClientRect(e);p&&!rectsAreEqual(p,t)&&n(),p=t,u=requestAnimationFrame(frameLoop)}return c&&frameLoop(),n(),()=>{var e;f.forEach((e=>{o&&e.removeEventListener("scroll",n),r&&e.removeEventListener("resize",n)})),null==g||g(),null==(e=m)||e.disconnect(),m=null,c&&cancelAnimationFrame(u)}}const d=detectOverflow,m=offset,p=autoPlacement,h=shift,w=flip,y=size,v=hide,x=arrow,b=inline,A=limitShift,floating_ui_dom_esm_computePosition=(e,t,n)=>{const i=new Map,o={platform:u,...n},r={...o.platform,_c:i};return computePosition(e,t,{...o,platform:r})};return t})()));
|
|
1
|
+
(function webpackUniversalModuleDefinition(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["ldmui"]=t():e["ldmui"]=t()})(self,()=>(()=>{"use strict";var e={};(()=>{e.d=(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})}})(),(()=>{e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{e.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var t={};e.r(t),e.d(t,{arrow:()=>B,autoPlacement:()=>L,autoUpdate:()=>autoUpdate,computePosition:()=>floating_ui_dom_esm_computePosition,detectOverflow:()=>T,flip:()=>P,getOverflowAncestors:()=>getOverflowAncestors,hide:()=>D,inline:()=>W,limitShift:()=>F,offset:()=>E,platform:()=>O,shift:()=>C,size:()=>N});const n=["top","right","bottom","left"],i=["start","end"],o=n.reduce((e,t)=>e.concat(t,t+"-"+i[0],t+"-"+i[1]),[]),r=Math.min,l=Math.max,s=Math.round,c=Math.floor,createCoords=e=>({x:e,y:e}),a={left:"right",right:"left",bottom:"top",top:"bottom"},f={start:"end",end:"start"};function clamp(e,t,n){return l(e,r(t,n))}function evaluate(e,t){return"function"===typeof e?e(t):e}function getSide(e){return e.split("-")[0]}function getAlignment(e){return e.split("-")[1]}function getOppositeAxis(e){return"x"===e?"y":"x"}function getAxisLength(e){return"y"===e?"height":"width"}const g=new Set(["top","bottom"]);function getSideAxis(e){return g.has(getSide(e))?"y":"x"}function getAlignmentAxis(e){return getOppositeAxis(getSideAxis(e))}function getAlignmentSides(e,t,n){void 0===n&&(n=!1);const i=getAlignment(e),o=getAlignmentAxis(e),r=getAxisLength(o);let l="x"===o?i===(n?"end":"start")?"right":"left":"start"===i?"bottom":"top";return t.reference[r]>t.floating[r]&&(l=getOppositePlacement(l)),[l,getOppositePlacement(l)]}function getExpandedPlacements(e){const t=getOppositePlacement(e);return[getOppositeAlignmentPlacement(e),t,getOppositeAlignmentPlacement(t)]}function getOppositeAlignmentPlacement(e){return e.replace(/start|end/g,e=>f[e])}const d=["left","right"],u=["right","left"],m=["top","bottom"],p=["bottom","top"];function getSideList(e,t,n){switch(e){case"top":case"bottom":return n?t?u:d:t?d:u;case"left":case"right":return t?m:p;default:return[]}}function getOppositeAxisPlacements(e,t,n,i){const o=getAlignment(e);let r=getSideList(getSide(e),"start"===n,i);return o&&(r=r.map(e=>e+"-"+o),t&&(r=r.concat(r.map(getOppositeAlignmentPlacement)))),r}function getOppositePlacement(e){return e.replace(/left|right|bottom|top/g,e=>a[e])}function expandPaddingObject(e){return{top:0,right:0,bottom:0,left:0,...e}}function getPaddingObject(e){return"number"!==typeof e?expandPaddingObject(e):{top:e,right:e,bottom:e,left:e}}function rectToClientRect(e){const{x:t,y:n,width:i,height:o}=e;return{width:i,height:o,top:n,left:t,right:t+i,bottom:n+o,x:t,y:n}}function computeCoordsFromPlacement(e,t,n){let{reference:i,floating:o}=e;const r=getSideAxis(t),l=getAlignmentAxis(t),s=getAxisLength(l),c=getSide(t),a="y"===r,f=i.x+i.width/2-o.width/2,g=i.y+i.height/2-o.height/2,d=i[s]/2-o[s]/2;let u;switch(c){case"top":u={x:f,y:i.y-o.height};break;case"bottom":u={x:f,y:i.y+i.height};break;case"right":u={x:i.x+i.width,y:g};break;case"left":u={x:i.x-o.width,y:g};break;default:u={x:i.x,y:i.y}}switch(getAlignment(t)){case"start":u[l]-=d*(n&&a?-1:1);break;case"end":u[l]+=d*(n&&a?-1:1);break}return u}const computePosition=async(e,t,n)=>{const{placement:i="bottom",strategy:o="absolute",middleware:r=[],platform:l}=n,s=r.filter(Boolean),c=await(null==l.isRTL?void 0:l.isRTL(t));let a=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:g}=computeCoordsFromPlacement(a,i,c),d=i,u={},m=0;for(let n=0;n<s.length;n++){const{name:r,fn:p}=s[n],{x:h,y:w,data:y,reset:v}=await p({x:f,y:g,initialPlacement:i,placement:d,strategy:o,middlewareData:u,rects:a,platform:l,elements:{reference:e,floating:t}});f=null!=h?h:f,g=null!=w?w:g,u={...u,[r]:{...u[r],...y}},v&&m<=50&&(m++,"object"===typeof v&&(v.placement&&(d=v.placement),v.rects&&(a=!0===v.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):v.rects),({x:f,y:g}=computeCoordsFromPlacement(a,d,c))),n=-1)}return{x:f,y:g,placement:d,strategy:o,middlewareData:u}};async function detectOverflow(e,t){var n;void 0===t&&(t={});const{x:i,y:o,platform:r,rects:l,elements:s,strategy:c}=e,{boundary:a="clippingAncestors",rootBoundary:f="viewport",elementContext:g="floating",altBoundary:d=!1,padding:u=0}=evaluate(t,e),m=getPaddingObject(u),p="floating"===g?"reference":"floating",h=s[d?p:g],w=rectToClientRect(await r.getClippingRect({element:null==(n=await(null==r.isElement?void 0:r.isElement(h)))||n?h:h.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(s.floating)),boundary:a,rootBoundary:f,strategy:c})),y="floating"===g?{x:i,y:o,width:l.floating.width,height:l.floating.height}:l.reference,v=await(null==r.getOffsetParent?void 0:r.getOffsetParent(s.floating)),x=await(null==r.isElement?void 0:r.isElement(v))&&await(null==r.getScale?void 0:r.getScale(v))||{x:1,y:1},b=rectToClientRect(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:y,offsetParent:v,strategy:c}):y);return{top:(w.top-b.top+m.top)/x.y,bottom:(b.bottom-w.bottom+m.bottom)/x.y,left:(w.left-b.left+m.left)/x.x,right:(b.right-w.right+m.right)/x.x}}const arrow=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:i,placement:o,rects:l,platform:s,elements:c,middlewareData:a}=t,{element:f,padding:g=0}=evaluate(e,t)||{};if(null==f)return{};const d=getPaddingObject(g),u={x:n,y:i},m=getAlignmentAxis(o),p=getAxisLength(m),h=await s.getDimensions(f),w="y"===m,y=w?"top":"left",v=w?"bottom":"right",x=w?"clientHeight":"clientWidth",b=l.reference[p]+l.reference[m]-u[m]-l.floating[p],A=u[m]-l.reference[m],S=await(null==s.getOffsetParent?void 0:s.getOffsetParent(f));let R=S?S[x]:0;R&&await(null==s.isElement?void 0:s.isElement(S))||(R=c.floating[x]||l.floating[p]);const O=b/2-A/2,T=R/2-h[p]/2-1,E=r(d[y],T),L=r(d[v],T),C=E,P=R-h[p]-L,N=R/2-h[p]/2+O,D=clamp(C,N,P),B=!a.arrow&&null!=getAlignment(o)&&N!==D&&l.reference[p]/2-(N<C?E:L)-h[p]/2<0,W=B?N<C?N-C:N-P:0;return{[m]:u[m]+W,data:{[m]:D,centerOffset:N-D-W,...B&&{alignmentOffset:W}},reset:B}}});function getPlacementList(e,t,n){const i=e?[...n.filter(t=>getAlignment(t)===e),...n.filter(t=>getAlignment(t)!==e)]:n.filter(e=>getSide(e)===e);return i.filter(n=>!e||(getAlignment(n)===e||!!t&&getOppositeAlignmentPlacement(n)!==n))}const autoPlacement=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,i,r;const{rects:l,middlewareData:s,placement:c,platform:a,elements:f}=t,{crossAxis:g=!1,alignment:d,allowedPlacements:u=o,autoAlignment:m=!0,...p}=evaluate(e,t),h=void 0!==d||u===o?getPlacementList(d||null,m,u):u,w=await detectOverflow(t,p),y=(null==(n=s.autoPlacement)?void 0:n.index)||0,v=h[y];if(null==v)return{};const x=getAlignmentSides(v,l,await(null==a.isRTL?void 0:a.isRTL(f.floating)));if(c!==v)return{reset:{placement:h[0]}};const b=[w[getSide(v)],w[x[0]],w[x[1]]],A=[...(null==(i=s.autoPlacement)?void 0:i.overflows)||[],{placement:v,overflows:b}],S=h[y+1];if(S)return{data:{index:y+1,overflows:A},reset:{placement:S}};const R=A.map(e=>{const t=getAlignment(e.placement);return[e.placement,t&&g?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),O=R.filter(e=>e[2].slice(0,getAlignment(e[0])?2:3).every(e=>e<=0)),T=(null==(r=O[0])?void 0:r[0])||R[0][0];return T!==c?{data:{index:y+1,overflows:A},reset:{placement:T}}:{}}}},flip=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,i;const{placement:o,middlewareData:r,rects:l,initialPlacement:s,platform:c,elements:a}=t,{mainAxis:f=!0,crossAxis:g=!0,fallbackPlacements:d,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:p=!0,...h}=evaluate(e,t);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const w=getSide(o),y=getSideAxis(s),v=getSide(s)===s,x=await(null==c.isRTL?void 0:c.isRTL(a.floating)),b=d||(v||!p?[getOppositePlacement(s)]:getExpandedPlacements(s)),A="none"!==m;!d&&A&&b.push(...getOppositeAxisPlacements(s,p,m,x));const S=[s,...b],R=await detectOverflow(t,h),O=[];let T=(null==(i=r.flip)?void 0:i.overflows)||[];if(f&&O.push(R[w]),g){const e=getAlignmentSides(o,l,x);O.push(R[e[0]],R[e[1]])}if(T=[...T,{placement:o,overflows:O}],!O.every(e=>e<=0)){var E,L;const e=((null==(E=r.flip)?void 0:E.index)||0)+1,t=S[e];if(t){const n="alignment"===g&&y!==getSideAxis(t);if(!n||T.every(e=>getSideAxis(e.placement)!==y||e.overflows[0]>0))return{data:{index:e,overflows:T},reset:{placement:t}}}let n=null==(L=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:L.placement;if(!n)switch(u){case"bestFit":{var C;const e=null==(C=T.filter(e=>{if(A){const t=getSideAxis(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:C[0];e&&(n=e);break}case"initialPlacement":n=s;break}if(o!==n)return{reset:{placement:n}}}return{}}}};function getSideOffsets(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function isAnySideFullyClipped(e){return n.some(t=>e[t]>=0)}const hide=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:i="referenceHidden",...o}=evaluate(e,t);switch(i){case"referenceHidden":{const e=await detectOverflow(t,{...o,elementContext:"reference"}),i=getSideOffsets(e,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:isAnySideFullyClipped(i)}}}case"escaped":{const e=await detectOverflow(t,{...o,altBoundary:!0}),i=getSideOffsets(e,n.floating);return{data:{escapedOffsets:i,escaped:isAnySideFullyClipped(i)}}}default:return{}}}}};function getBoundingRect(e){const t=r(...e.map(e=>e.left)),n=r(...e.map(e=>e.top)),i=l(...e.map(e=>e.right)),o=l(...e.map(e=>e.bottom));return{x:t,y:n,width:i-t,height:o-n}}function getRectsByLine(e){const t=e.slice().sort((e,t)=>e.y-t.y),n=[];let i=null;for(let e=0;e<t.length;e++){const o=t[e];!i||o.y-i.y>i.height/2?n.push([o]):n[n.length-1].push(o),i=o}return n.map(e=>rectToClientRect(getBoundingRect(e)))}const inline=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:i,rects:o,platform:s,strategy:c}=t,{padding:a=2,x:f,y:g}=evaluate(e,t),d=Array.from(await(null==s.getClientRects?void 0:s.getClientRects(i.reference))||[]),u=getRectsByLine(d),m=rectToClientRect(getBoundingRect(d)),p=getPaddingObject(a);function getBoundingClientRect(){if(2===u.length&&u[0].left>u[1].right&&null!=f&&null!=g)return u.find(e=>f>e.left-p.left&&f<e.right+p.right&&g>e.top-p.top&&g<e.bottom+p.bottom)||m;if(u.length>=2){if("y"===getSideAxis(n)){const e=u[0],t=u[u.length-1],i="top"===getSide(n),o=e.top,r=t.bottom,l=i?e.left:t.left,s=i?e.right:t.right,c=s-l,a=r-o;return{top:o,bottom:r,left:l,right:s,width:c,height:a,x:l,y:o}}const e="left"===getSide(n),t=l(...u.map(e=>e.right)),i=r(...u.map(e=>e.left)),o=u.filter(n=>e?n.left===i:n.right===t),s=o[0].top,c=o[o.length-1].bottom,a=i,f=t,g=f-a,d=c-s;return{top:s,bottom:c,left:a,right:f,width:g,height:d,x:a,y:s}}return m}const h=await s.getElementRects({reference:{getBoundingClientRect},floating:i.floating,strategy:c});return o.reference.x!==h.reference.x||o.reference.y!==h.reference.y||o.reference.width!==h.reference.width||o.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},h=new Set(["left","top"]);async function convertValueToCoords(e,t){const{placement:n,platform:i,elements:o}=e,r=await(null==i.isRTL?void 0:i.isRTL(o.floating)),l=getSide(n),s=getAlignment(n),c="y"===getSideAxis(n),a=h.has(l)?-1:1,f=r&&c?-1:1,g=evaluate(t,e);let{mainAxis:d,crossAxis:u,alignmentAxis:m}="number"===typeof g?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return s&&"number"===typeof m&&(u="end"===s?-1*m:m),c?{x:u*f,y:d*a}:{x:d*a,y:u*f}}const offset=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,i;const{x:o,y:r,placement:l,middlewareData:s}=t,c=await convertValueToCoords(t,e);return l===(null==(n=s.offset)?void 0:n.placement)&&null!=(i=s.arrow)&&i.alignmentOffset?{}:{x:o+c.x,y:r+c.y,data:{...c,placement:l}}}}},shift=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:i,placement:o}=t,{mainAxis:r=!0,crossAxis:l=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=evaluate(e,t),a={x:n,y:i},f=await detectOverflow(t,c),g=getSideAxis(getSide(o)),d=getOppositeAxis(g);let u=a[d],m=a[g];if(r){const e="y"===d?"top":"left",t="y"===d?"bottom":"right",n=u+f[e],i=u-f[t];u=clamp(n,u,i)}if(l){const e="y"===g?"top":"left",t="y"===g?"bottom":"right",n=m+f[e],i=m-f[t];m=clamp(n,m,i)}const p=s.fn({...t,[d]:u,[g]:m});return{...p,data:{x:p.x-n,y:p.y-i,enabled:{[d]:r,[g]:l}}}}}},limitShift=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:i,placement:o,rects:r,middlewareData:l}=t,{offset:s=0,mainAxis:c=!0,crossAxis:a=!0}=evaluate(e,t),f={x:n,y:i},g=getSideAxis(o),d=getOppositeAxis(g);let u=f[d],m=f[g];const p=evaluate(s,t),w="number"===typeof p?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const e="y"===d?"height":"width",t=r.reference[d]-r.floating[e]+w.mainAxis,n=r.reference[d]+r.reference[e]-w.mainAxis;u<t?u=t:u>n&&(u=n)}if(a){var y,v;const e="y"===d?"width":"height",t=h.has(getSide(o)),n=r.reference[g]-r.floating[e]+(t&&(null==(y=l.offset)?void 0:y[g])||0)+(t?0:w.crossAxis),i=r.reference[g]+r.reference[e]+(t?0:(null==(v=l.offset)?void 0:v[g])||0)-(t?w.crossAxis:0);m<n?m=n:m>i&&(m=i)}return{[d]:u,[g]:m}}}},size=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,i;const{placement:o,rects:s,platform:c,elements:a}=t,{apply:f=()=>{},...g}=evaluate(e,t),d=await detectOverflow(t,g),u=getSide(o),m=getAlignment(o),p="y"===getSideAxis(o),{width:h,height:w}=s.floating;let y,v;"top"===u||"bottom"===u?(y=u,v=m===(await(null==c.isRTL?void 0:c.isRTL(a.floating))?"start":"end")?"left":"right"):(v=u,y="end"===m?"top":"bottom");const x=w-d.top-d.bottom,b=h-d.left-d.right,A=r(w-d[y],x),S=r(h-d[v],b),R=!t.middlewareData.shift;let O=A,T=S;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(T=b),null!=(i=t.middlewareData.shift)&&i.enabled.y&&(O=x),R&&!m){const e=l(d.left,0),t=l(d.right,0),n=l(d.top,0),i=l(d.bottom,0);p?T=h-2*(0!==e||0!==t?e+t:l(d.left,d.right)):O=w-2*(0!==n||0!==i?n+i:l(d.top,d.bottom))}await f({...t,availableWidth:T,availableHeight:O});const E=await c.getDimensions(a.floating);return h!==E.width||w!==E.height?{reset:{rects:!0}}:{}}}};function hasWindow(){return"undefined"!==typeof window}function getNodeName(e){return isNode(e)?(e.nodeName||"").toLowerCase():"#document"}function getWindow(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function getDocumentElement(e){var t;return null==(t=(isNode(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function isNode(e){return!!hasWindow()&&(e instanceof Node||e instanceof getWindow(e).Node)}function isElement(e){return!!hasWindow()&&(e instanceof Element||e instanceof getWindow(e).Element)}function isHTMLElement(e){return!!hasWindow()&&(e instanceof HTMLElement||e instanceof getWindow(e).HTMLElement)}function isShadowRoot(e){return!(!hasWindow()||"undefined"===typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof getWindow(e).ShadowRoot)}const w=new Set(["inline","contents"]);function isOverflowElement(e){const{overflow:t,overflowX:n,overflowY:i,display:o}=getComputedStyle(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!w.has(o)}const y=new Set(["table","td","th"]);function isTableElement(e){return y.has(getNodeName(e))}const v=[":popover-open",":modal"];function isTopLayer(e){return v.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const x=["transform","translate","scale","rotate","perspective"],b=["transform","translate","scale","rotate","perspective","filter"],A=["paint","layout","strict","content"];function isContainingBlock(e){const t=isWebKit(),n=isElement(e)?getComputedStyle(e):e;return x.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||b.some(e=>(n.willChange||"").includes(e))||A.some(e=>(n.contain||"").includes(e))}function getContainingBlock(e){let t=getParentNode(e);while(isHTMLElement(t)&&!isLastTraversableNode(t)){if(isContainingBlock(t))return t;if(isTopLayer(t))return null;t=getParentNode(t)}return null}function isWebKit(){return!("undefined"===typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const S=new Set(["html","body","#document"]);function isLastTraversableNode(e){return S.has(getNodeName(e))}function getComputedStyle(e){return getWindow(e).getComputedStyle(e)}function getNodeScroll(e){return isElement(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function getParentNode(e){if("html"===getNodeName(e))return e;const t=e.assignedSlot||e.parentNode||isShadowRoot(e)&&e.host||getDocumentElement(e);return isShadowRoot(t)?t.host:t}function getNearestOverflowAncestor(e){const t=getParentNode(e);return isLastTraversableNode(t)?e.ownerDocument?e.ownerDocument.body:e.body:isHTMLElement(t)&&isOverflowElement(t)?t:getNearestOverflowAncestor(t)}function getOverflowAncestors(e,t,n){var i;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=getNearestOverflowAncestor(e),r=o===(null==(i=e.ownerDocument)?void 0:i.body),l=getWindow(o);if(r){const e=getFrameElement(l);return t.concat(l,l.visualViewport||[],isOverflowElement(o)?o:[],e&&n?getOverflowAncestors(e):[])}return t.concat(o,getOverflowAncestors(o,[],n))}function getFrameElement(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function getCssDimensions(e){const t=getComputedStyle(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const o=isHTMLElement(e),r=o?e.offsetWidth:n,l=o?e.offsetHeight:i,c=s(n)!==r||s(i)!==l;return c&&(n=r,i=l),{width:n,height:i,$:c}}function unwrapElement(e){return isElement(e)?e:e.contextElement}function getScale(e){const t=unwrapElement(e);if(!isHTMLElement(t))return createCoords(1);const n=t.getBoundingClientRect(),{width:i,height:o,$:r}=getCssDimensions(t);let l=(r?s(n.width):n.width)/i,c=(r?s(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const R=createCoords(0);function getVisualOffsets(e){const t=getWindow(e);return isWebKit()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:R}function shouldAddVisualOffsets(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==getWindow(e))&&t}function getBoundingClientRect(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),r=unwrapElement(e);let l=createCoords(1);t&&(i?isElement(i)&&(l=getScale(i)):l=getScale(e));const s=shouldAddVisualOffsets(r,n,i)?getVisualOffsets(r):createCoords(0);let c=(o.left+s.x)/l.x,a=(o.top+s.y)/l.y,f=o.width/l.x,g=o.height/l.y;if(r){const e=getWindow(r),t=i&&isElement(i)?getWindow(i):i;let n=e,o=getFrameElement(n);while(o&&i&&t!==n){const e=getScale(o),t=o.getBoundingClientRect(),i=getComputedStyle(o),r=t.left+(o.clientLeft+parseFloat(i.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(i.paddingTop))*e.y;c*=e.x,a*=e.y,f*=e.x,g*=e.y,c+=r,a+=l,n=getWindow(o),o=getFrameElement(n)}}return rectToClientRect({width:f,height:g,x:c,y:a})}function getWindowScrollBarX(e,t){const n=getNodeScroll(e).scrollLeft;return t?t.left+n:getBoundingClientRect(getDocumentElement(e)).left+n}function getHTMLOffset(e,t,n){void 0===n&&(n=!1);const i=e.getBoundingClientRect(),o=i.left+t.scrollLeft-(n?0:getWindowScrollBarX(e,i)),r=i.top+t.scrollTop;return{x:o,y:r}}function convertOffsetParentRelativeRectToViewportRelativeRect(e){let{elements:t,rect:n,offsetParent:i,strategy:o}=e;const r="fixed"===o,l=getDocumentElement(i),s=!!t&&isTopLayer(t.floating);if(i===l||s&&r)return n;let c={scrollLeft:0,scrollTop:0},a=createCoords(1);const f=createCoords(0),g=isHTMLElement(i);if((g||!g&&!r)&&(("body"!==getNodeName(i)||isOverflowElement(l))&&(c=getNodeScroll(i)),isHTMLElement(i))){const e=getBoundingClientRect(i);a=getScale(i),f.x=e.x+i.clientLeft,f.y=e.y+i.clientTop}const d=!l||g||r?createCoords(0):getHTMLOffset(l,c,!0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-c.scrollLeft*a.x+f.x+d.x,y:n.y*a.y-c.scrollTop*a.y+f.y+d.y}}function getClientRects(e){return Array.from(e.getClientRects())}function getDocumentRect(e){const t=getDocumentElement(e),n=getNodeScroll(e),i=e.ownerDocument.body,o=l(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),r=l(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let s=-n.scrollLeft+getWindowScrollBarX(e);const c=-n.scrollTop;return"rtl"===getComputedStyle(i).direction&&(s+=l(t.clientWidth,i.clientWidth)-o),{width:o,height:r,x:s,y:c}}function getViewportRect(e,t){const n=getWindow(e),i=getDocumentElement(e),o=n.visualViewport;let r=i.clientWidth,l=i.clientHeight,s=0,c=0;if(o){r=o.width,l=o.height;const e=isWebKit();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,c=o.offsetTop)}return{width:r,height:l,x:s,y:c}}function getInnerBoundingClientRect(e,t){const n=getBoundingClientRect(e,!0,"fixed"===t),i=n.top+e.clientTop,o=n.left+e.clientLeft,r=isHTMLElement(e)?getScale(e):createCoords(1),l=e.clientWidth*r.x,s=e.clientHeight*r.y,c=o*r.x,a=i*r.y;return{width:l,height:s,x:c,y:a}}function getClientRectFromClippingAncestor(e,t,n){let i;if("viewport"===t)i=getViewportRect(e,n);else if("document"===t)i=getDocumentRect(getDocumentElement(e));else if(isElement(t))i=getInnerBoundingClientRect(t,n);else{const n=getVisualOffsets(e);i={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return rectToClientRect(i)}function hasFixedPositionAncestor(e,t){const n=getParentNode(e);return!(n===t||!isElement(n)||isLastTraversableNode(n))&&("fixed"===getComputedStyle(n).position||hasFixedPositionAncestor(n,t))}function getClippingElementAncestors(e,t){const n=t.get(e);if(n)return n;let i=getOverflowAncestors(e,[],!1).filter(e=>isElement(e)&&"body"!==getNodeName(e)),o=null;const r="fixed"===getComputedStyle(e).position;let l=r?getParentNode(e):e;while(isElement(l)&&!isLastTraversableNode(l)){const t=getComputedStyle(l),n=isContainingBlock(l);n||"fixed"!==t.position||(o=null);const s=r?!n&&!o:!n&&"static"===t.position&&!!o&&["absolute","fixed"].includes(o.position)||isOverflowElement(l)&&!n&&hasFixedPositionAncestor(e,l);s?i=i.filter(e=>e!==l):o=t,l=getParentNode(l)}return t.set(e,i),i}function getClippingRect(e){let{element:t,boundary:n,rootBoundary:i,strategy:o}=e;const s="clippingAncestors"===n?isTopLayer(t)?[]:getClippingElementAncestors(t,this._c):[].concat(n),c=[...s,i],a=c[0],f=c.reduce((e,n)=>{const i=getClientRectFromClippingAncestor(t,n,o);return e.top=l(i.top,e.top),e.right=r(i.right,e.right),e.bottom=r(i.bottom,e.bottom),e.left=l(i.left,e.left),e},getClientRectFromClippingAncestor(t,a,o));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function getDimensions(e){const{width:t,height:n}=getCssDimensions(e);return{width:t,height:n}}function getRectRelativeToOffsetParent(e,t,n){const i=isHTMLElement(t),o=getDocumentElement(t),r="fixed"===n,l=getBoundingClientRect(e,!0,r,t);let s={scrollLeft:0,scrollTop:0};const c=createCoords(0);function setLeftRTLScrollbarOffset(){c.x=getWindowScrollBarX(o)}if(i||!i&&!r)if(("body"!==getNodeName(t)||isOverflowElement(o))&&(s=getNodeScroll(t)),i){const e=getBoundingClientRect(t,!0,r,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else o&&setLeftRTLScrollbarOffset();r&&!i&&o&&setLeftRTLScrollbarOffset();const a=!o||i||r?createCoords(0):getHTMLOffset(o,s),f=l.left+s.scrollLeft-c.x-a.x,g=l.top+s.scrollTop-c.y-a.y;return{x:f,y:g,width:l.width,height:l.height}}function isStaticPositioned(e){return"static"===getComputedStyle(e).position}function getTrueOffsetParent(e,t){if(!isHTMLElement(e)||"fixed"===getComputedStyle(e).position)return null;if(t)return t(e);let n=e.offsetParent;return getDocumentElement(e)===n&&(n=n.ownerDocument.body),n}function getOffsetParent(e,t){const n=getWindow(e);if(isTopLayer(e))return n;if(!isHTMLElement(e)){let t=getParentNode(e);while(t&&!isLastTraversableNode(t)){if(isElement(t)&&!isStaticPositioned(t))return t;t=getParentNode(t)}return n}let i=getTrueOffsetParent(e,t);while(i&&isTableElement(i)&&isStaticPositioned(i))i=getTrueOffsetParent(i,t);return i&&isLastTraversableNode(i)&&isStaticPositioned(i)&&!isContainingBlock(i)?n:i||getContainingBlock(e)||n}const getElementRects=async function(e){const t=this.getOffsetParent||getOffsetParent,n=this.getDimensions,i=await n(e.floating);return{reference:getRectRelativeToOffsetParent(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function isRTL(e){return"rtl"===getComputedStyle(e).direction}const O={convertOffsetParentRelativeRectToViewportRelativeRect,getDocumentElement,getClippingRect,getOffsetParent,getElementRects,getClientRects,getDimensions,getScale,isElement,isRTL};function rectsAreEqual(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function observeMove(e,t){let n,i=null;const o=getDocumentElement(e);function cleanup(){var e;clearTimeout(n),null==(e=i)||e.disconnect(),i=null}function refresh(s,a){void 0===s&&(s=!1),void 0===a&&(a=1),cleanup();const f=e.getBoundingClientRect(),{left:g,top:d,width:u,height:m}=f;if(s||t(),!u||!m)return;const p=c(d),h=c(o.clientWidth-(g+u)),w=c(o.clientHeight-(d+m)),y=c(g),v=-p+"px "+-h+"px "+-w+"px "+-y+"px",x={rootMargin:v,threshold:l(0,r(1,a))||1};let b=!0;function handleObserve(t){const i=t[0].intersectionRatio;if(i!==a){if(!b)return refresh();i?refresh(!1,i):n=setTimeout(()=>{refresh(!1,1e-7)},1e3)}1!==i||rectsAreEqual(f,e.getBoundingClientRect())||refresh(),b=!1}try{i=new IntersectionObserver(handleObserve,{...x,root:o.ownerDocument})}catch(e){i=new IntersectionObserver(handleObserve,x)}i.observe(e)}return refresh(!0),cleanup}function autoUpdate(e,t,n,i){void 0===i&&(i={});const{ancestorScroll:o=!0,ancestorResize:r=!0,elementResize:l="function"===typeof ResizeObserver,layoutShift:s="function"===typeof IntersectionObserver,animationFrame:c=!1}=i,a=unwrapElement(e),f=o||r?[...a?getOverflowAncestors(a):[],...getOverflowAncestors(t)]:[];f.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),r&&e.addEventListener("resize",n)});const g=a&&s?observeMove(a,n):null;let d,u=-1,m=null;l&&(m=new ResizeObserver(e=>{let[i]=e;i&&i.target===a&&m&&(m.unobserve(t),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),n()}),a&&!c&&m.observe(a),m.observe(t));let p=c?getBoundingClientRect(e):null;function frameLoop(){const t=getBoundingClientRect(e);p&&!rectsAreEqual(p,t)&&n(),p=t,d=requestAnimationFrame(frameLoop)}return c&&frameLoop(),n(),()=>{var e;f.forEach(e=>{o&&e.removeEventListener("scroll",n),r&&e.removeEventListener("resize",n)}),null==g||g(),null==(e=m)||e.disconnect(),m=null,c&&cancelAnimationFrame(d)}}const T=detectOverflow,E=offset,L=autoPlacement,C=shift,P=flip,N=size,D=hide,B=arrow,W=inline,F=limitShift,floating_ui_dom_esm_computePosition=(e,t,n)=>{const i=new Map,o={platform:O,...n},r={...o.platform,_c:i};return computePosition(e,t,{...o,platform:r})};return t})());
|
package/dist/lib/imask.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function webpackUniversalModuleDefinition(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define(["vue"],t):"object"===typeof exports?exports["ldmui"]=t(require("vue")):e["ldmui"]=t(e["vue"])})(self,(e=>(()=>{"use strict";var t={2380:t=>{t.exports=e}},s={};function __webpack_require__(e){var a=s[e];if(void 0!==a)return a.exports;var i=s[e]={exports:{}};return t[e](i,i.exports,__webpack_require__),i.exports}(()=>{__webpack_require__.d=(e,t)=>{for(var s in t)__webpack_require__.o(t,s)&&!__webpack_require__.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})}})(),(()=>{__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{__webpack_require__.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var a={};function isString(e){return"string"===typeof e||e instanceof String}function isObject(e){var t;return"object"===typeof e&&null!=e&&"Object"===(null==e||null==(t=e.constructor)?void 0:t.name)}function pick(e,t){return Array.isArray(t)?pick(e,((e,s)=>t.includes(s))):Object.entries(e).reduce(((e,s)=>{let[a,i]=s;return t(i,a)&&(e[a]=i),e}),{})}__webpack_require__.r(a),__webpack_require__.d(a,{IMask:()=>IMask,IMaskComponent:()=>_,IMaskDirective:()=>v,IMaskProps:()=>c,useIMask:()=>useIMask});const i={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function forceDirection(e){switch(e){case i.LEFT:return i.FORCE_LEFT;case i.RIGHT:return i.FORCE_RIGHT;default:return e}}function escapeRegExp(e){return e.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function objectIncludes(e,t){if(t===e)return!0;const s=Array.isArray(t),a=Array.isArray(e);let i;if(s&&a){if(t.length!=e.length)return!1;for(i=0;i<t.length;i++)if(!objectIncludes(t[i],e[i]))return!1;return!0}if(s!=a)return!1;if(t&&e&&"object"===typeof t&&"object"===typeof e){const s=t instanceof Date,a=e instanceof Date;if(s&&a)return t.getTime()==e.getTime();if(s!=a)return!1;const n=t instanceof RegExp,u=e instanceof RegExp;if(n&&u)return t.toString()==e.toString();if(n!=u)return!1;const r=Object.keys(t);for(i=0;i<r.length;i++)if(!Object.prototype.hasOwnProperty.call(e,r[i]))return!1;for(i=0;i<r.length;i++)if(!objectIncludes(e[r[i]],t[r[i]]))return!1;return!0}return!(!t||!e||"function"!==typeof t||"function"!==typeof e)&&t.toString()===e.toString()}class ActionDetails{constructor(e){Object.assign(this,e);while(this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos))--this.oldSelection.start;if(this.insertedCount)while(this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end))this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?i.NONE:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?i.LEFT:i.RIGHT}}function IMask(e,t){return new IMask.InputMask(e,t)}function maskedClass(e){if(null==e)throw new Error("mask property should be defined");return e instanceof RegExp?IMask.MaskedRegExp:isString(e)?IMask.MaskedPattern:e===Date?IMask.MaskedDate:e===Number?IMask.MaskedNumber:Array.isArray(e)||e===Array?IMask.MaskedDynamic:IMask.Masked&&e.prototype instanceof IMask.Masked?e:IMask.Masked&&e instanceof IMask.Masked?e.constructor:e instanceof Function?IMask.MaskedFunction:(console.warn("Mask not found for mask",e),IMask.Masked)}function normalizeOpts(e){if(!e)throw new Error("Options in not defined");if(IMask.Masked){if(e.prototype instanceof IMask.Masked)return{mask:e};const{mask:t,...s}=e instanceof IMask.Masked?{mask:e}:isObject(e)&&e.mask instanceof IMask.Masked?e:{};if(t){const e=t.mask;return{...pick(t,((e,t)=>!t.startsWith("_"))),mask:t.constructor,_mask:e,...s}}}return isObject(e)?{...e}:{mask:e}}function createMask(e){if(IMask.Masked&&e instanceof IMask.Masked)return e;const t=normalizeOpts(e),s=maskedClass(t.mask);if(!s)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===s&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new s(t)}IMask.createMask=createMask;class MaskElement{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return null!=e?e:this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return null!=e?e:this.value.length}select(e,t){if(null!=e&&null!=t&&(e!==this.selectionStart||t!==this.selectionEnd))try{this._unsafeSelect(e,t)}catch{}}get isActive(){return!1}}IMask.MaskElement=MaskElement;const n=90,u=89;class HTMLMaskElement extends MaskElement{constructor(e){super(),this.input=e,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var e,t,s;return null!=(e=null==(t=(s=this.input).getRootNode)?void 0:t.call(s))?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){return this._handlers.redo&&(e.keyCode===n&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===u&&e.ctrlKey)?(e.preventDefault(),this._handlers.redo(e)):this._handlers.undo&&e.keyCode===n&&(e.metaKey||e.ctrlKey)?(e.preventDefault(),this._handlers.undo(e)):void(e.isComposing||this._handlers.selectionChange(e))}_onBeforeinput(e){return"historyUndo"===e.inputType&&this._handlers.undo?(e.preventDefault(),this._handlers.undo(e)):"historyRedo"===e.inputType&&this._handlers.redo?(e.preventDefault(),this._handlers.redo(e)):void 0}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}IMask.HTMLMaskElement=HTMLMaskElement;class HTMLInputMaskElement extends HTMLMaskElement{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return null!=this.input.selectionStart?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,t){this.input.setSelectionRange(e,t)}get value(){return this.input.value}set value(e){this.input.value=e}}IMask.HTMLMaskElement=HTMLMaskElement;class HTMLContenteditableMaskElement extends HTMLMaskElement{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,a=t&&t.focusOffset;return null==a||null==s||s<a?s:a}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,a=t&&t.focusOffset;return null==a||null==s||s>a?s:a}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,e),s.setEnd(this.input.lastChild||this.input,t);const a=this.rootElement,i=a.getSelection&&a.getSelection();i&&(i.removeAllRanges(),i.addRange(s))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}IMask.HTMLContenteditableMaskElement=HTMLContenteditableMaskElement;class InputHistory{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return 0===this.states.length}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>InputHistory.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}InputHistory.MAX_LENGTH=100;class InputMask{constructor(e,t){this.el=e instanceof MaskElement?e:e.isContentEditable&&"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?new HTMLContenteditableMaskElement(e):new HTMLInputMaskElement(e),this.masked=createMask(t),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new InputHistory,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(e){var t;return null==e||(null==(t=this.masked)?void 0:t.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof IMask.Masked)&&this.masked.constructor===maskedClass(e))return void this.masked.updateOptions({mask:e});const t=e instanceof IMask.Masked?e:createMask({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e,t){const s=this._listeners[e];s&&s.forEach((e=>e(t)))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){this.el&&this.el.isActive&&(this.el.select(e,e),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(e){const t=this.masked.unmaskedValue,s=this.masked.value,a=this.masked.rawInputValue,i=this.displayValue,n=this.unmaskedValue!==t||this.value!==s||this._rawInputValue!==a;this._unmaskedValue=t,this._value=s,this._rawInputValue=a,this.el.value!==i&&(this.el.value=i),"auto"===e?this.alignCursor():null!=e&&(this.cursorPos=e),n&&this._fireChangeEvents(),this._historyChanging||!n&&!this.history.isEmpty||this.history.push({unmaskedValue:t,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:t,...s}=e,a=!this.maskEquals(t),i=this.masked.optionsIsChanged(s);a&&(this.mask=t),i&&this.masked.updateOptions(s),(a||i)&&this.updateControl()}updateCursor(e){null!=e&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout((()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())}),10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,i.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return this;if(!t)return delete this._listeners[e],this;const s=this._listeners[e].indexOf(t);return s>=0&&this._listeners[e].splice(s,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const t=new ActionDetails({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,a=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,n=s===this.masked.rawInputValue?t.removeDirection:i.NONE;let u=this.masked.nearestInputPos(t.startChangePos+a,n);n!==i.NONE&&(u=this.masked.nearestInputPos(u,i.NONE)),this.updateControl(u),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}IMask.InputMask=InputMask;class ChangeDetails{static normalize(e){return Array.isArray(e)?e:[e,new ChangeDetails]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return Boolean(this.rawInserted)||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}IMask.ChangeDetails=ChangeDetails;class ContinuousTailDetails{constructor(e,t,s){void 0===e&&(e=""),void 0===t&&(t=0),this.value=e,this.from=t,this.stop=s}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||null!=e&&this.from>=e)return"";const t=this.value[0];return this.value=this.value.slice(1),t}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class Masked{constructor(e){this._value="",this._update({...Masked.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,t){void 0===t&&(t={input:!0}),this.reset(),this.append(e,t,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,t){return e}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),Math.min(this.displayValue.length,t-e)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),this.displayValue.slice(e,t)}extractTail(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),new ContinuousTailDetails(this.extractInput(e,t),e)}appendTail(e){return isString(e)&&(e=new ContinuousTailDetails(String(e))),e.appendTo(this)}_appendCharRaw(e,t){return e?(this._value+=e,new ChangeDetails({inserted:e,rawInserted:e})):new ChangeDetails}_appendChar(e,t,s){void 0===t&&(t={});const a=this.state;let i;if([e,i]=this.doPrepareChar(e,t),e&&(i=i.aggregate(this._appendCharRaw(e,t)),!i.rawInserted&&"pad"===this.autofix)){const s=this.state;this.state=a;let n=this.pad(t);const u=this._appendCharRaw(e,t);n=n.aggregate(u),u.rawInserted||n.equals(i)?i=n:this.state=s}if(i.inserted){let e,n=!1!==this.doValidate(t);if(n&&null!=s){const t=this.state;if(!0===this.overwrite){e=s.state;for(let e=0;e<i.rawInserted.length;++e)s.unshift(this.displayValue.length-i.tailShift)}let a=this.appendTail(s);if(n=a.rawInserted.length===s.toString().length,(!n||!a.inserted)&&"shift"===this.overwrite){this.state=t,e=s.state;for(let e=0;e<i.rawInserted.length;++e)s.shift();a=this.appendTail(s),n=a.rawInserted.length===s.toString().length}n&&a.inserted&&(this.state=t)}n||(i=new ChangeDetails,this.state=a,s&&e&&(s.state=e))}return i}_appendPlaceholder(){return new ChangeDetails}_appendEager(){return new ChangeDetails}append(e,t,s){if(!isString(e))throw new Error("value should be string");const a=isString(s)?new ContinuousTailDetails(String(s)):s;let i;null!=t&&t.tail&&(t._beforeTailState=this.state),[e,i]=this.doPrepare(e,t);for(let s=0;s<e.length;++s){const n=this._appendChar(e[s],t,a);if(!n.rawInserted&&!this.doSkipInvalid(e[s],t,a))break;i.aggregate(n)}return(!0===this.eager||"append"===this.eager)&&null!=t&&t.input&&e&&i.aggregate(this._appendEager()),null!=a&&(i.tailShift+=this.appendTail(a).tailShift),i}remove(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(t),new ChangeDetails}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const t=this.rawInputValue,s=this.value,a=e();return this.rawInputValue=t,this.value&&this.value!==s&&0===s.indexOf(this.value)&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,a}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const t=this.state,s=e(this);return this.state=t,delete this._isolated,s}doSkipInvalid(e,t,s){return Boolean(this.skipInvalid)}doPrepare(e,t){return void 0===t&&(t={}),ChangeDetails.normalize(this.prepare?this.prepare(e,this,t):e)}doPrepareChar(e,t){return void 0===t&&(t={}),ChangeDetails.normalize(this.prepareChar?this.prepareChar(e,this,t):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,t,s,a,n){void 0===s&&(s=""),void 0===a&&(a=i.NONE),void 0===n&&(n={input:!0});const u=e+t,r=this.extractTail(u),l=!0===this.eager||"remove"===this.eager;let o;l&&(a=forceDirection(a),o=this.extractInput(0,u,{raw:!0}));let h=e;const d=new ChangeDetails;if(a!==i.NONE&&(h=this.nearestInputPos(e,t>1&&0!==e&&!l?i.NONE:a),d.tailShift=h-e),d.aggregate(this.remove(h)),l&&a!==i.NONE&&o===this.rawInputValue)if(a===i.FORCE_LEFT){let e;while(o===this.rawInputValue&&(e=this.displayValue.length))d.aggregate(new ChangeDetails({tailShift:-1})).aggregate(this.remove(e-1))}else a===i.FORCE_RIGHT&&r.unshift();return d.aggregate(this.append(s,n,r))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!objectIncludes(this,e)}typedValueEquals(e){const t=this.typedValue;return e===t||Masked.EMPTY_VALUES.includes(e)&&Masked.EMPTY_VALUES.includes(t)||!!this.format&&this.format(e,this)===this.format(this.typedValue,this)}pad(e){return new ChangeDetails}}Masked.DEFAULTS={skipInvalid:!0},Masked.EMPTY_VALUES=[void 0,null,""],IMask.Masked=Masked;class ChunksTailDetails{constructor(e,t){void 0===e&&(e=[]),void 0===t&&(t=0),this.chunks=e,this.from=t}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=isString(e)?new ContinuousTailDetails(String(e)):e;const t=this.chunks[this.chunks.length-1],s=t&&(t.stop===e.stop||null==e.stop)&&e.from===t.from+t.toString().length;if(e instanceof ContinuousTailDetails)s?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof ChunksTailDetails){if(null==e.stop){let t;while(e.chunks.length&&null==e.chunks[0].stop)t=e.chunks.shift(),t.from+=e.from,this.extend(t)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof IMask.MaskedPattern)){const t=new ContinuousTailDetails(this.toString());return t.appendTo(e)}const t=new ChangeDetails;for(let s=0;s<this.chunks.length;++s){const a=this.chunks[s],i=e._mapPosToBlock(e.displayValue.length),n=a.stop;let u;if(null!=n&&(!i||i.index<=n)&&((a instanceof ChunksTailDetails||e._stops.indexOf(n)>=0)&&t.aggregate(e._appendPlaceholder(n)),u=a instanceof ChunksTailDetails&&e._blocks[n]),u){const s=u.appendTail(a);t.aggregate(s);const i=a.toString().slice(s.rawInserted.length);i&&t.aggregate(e.append(i,{tail:!0}))}else t.aggregate(e.append(a.toString(),{tail:!0}))}return t}get state(){return{chunks:this.chunks.map((e=>e.state)),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:t,...s}=e;Object.assign(this,s),this.chunks=t.map((e=>{const t="chunks"in e?new ChunksTailDetails:new ContinuousTailDetails;return t.state=e,t}))}unshift(e){if(!this.chunks.length||null!=e&&this.from>=e)return"";const t=null!=e?e-this.from:e;let s=0;while(s<this.chunks.length){const e=this.chunks[s],a=e.unshift(t);if(e.toString()){if(!a)break;++s}else this.chunks.splice(s,1);if(a)return a}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;while(0<=e){const t=this.chunks[e],s=t.shift();if(t.toString()){if(!s)break;--e}else this.chunks.splice(e,1);if(s)return s}return""}}class PatternCursor{constructor(e,t){this.masked=e,this._log=[];const{offset:s,index:a}=e._mapPosToBlock(t)||(t<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=s,this.index=a,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null==(t=this.block)?void 0:t.displayValue.length)||0){var t;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft((()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,i.FORCE_LEFT),0!==this.offset||void 0}))}pushLeftBeforeInput(){return this._pushLeft((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,i.LEFT),!0}))}pushLeftBeforeRequired(){return this._pushLeft((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,i.LEFT),!0}))}pushRightBeforeFilled(){return this._pushRight((()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,i.FORCE_RIGHT),this.offset!==this.block.value.length||void 0}))}pushRightBeforeInput(){return this._pushRight((()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,i.NONE),!0}))}pushRightBeforeRequired(){return this._pushRight((()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,i.NONE),!0}))}}class PatternFixedDefinition{constructor(e){Object.assign(this,e),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(e,t){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(t),this._value||(this._isRawInput=!1),new ChangeDetails}nearestInputPos(e,t){void 0===t&&(t=i.NONE);const s=0,a=this._value.length;switch(t){case i.LEFT:case i.FORCE_LEFT:return s;case i.NONE:case i.RIGHT:case i.FORCE_RIGHT:default:return a}}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),this._isRawInput?t-e:0}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),void 0===s&&(s={}),s.raw&&this._isRawInput&&this._value.slice(e,t)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(e,t){if(void 0===t&&(t={}),this.isFilled)return new ChangeDetails;const s=!0===this.eager||"append"===this.eager,a=this.char===e,i=a&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!s)&&!t.tail,n=new ChangeDetails({inserted:this.char,rawInserted:i?this.char:""});return this._value=this.char,this._isRawInput=i&&(t.raw||t.input),n}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new ChangeDetails;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new ContinuousTailDetails("")}appendTail(e){return isString(e)&&(e=new ContinuousTailDetails(String(e))),e.appendTo(this)}append(e,t,s){const a=this._appendChar(e[0],t);return null!=s&&(a.tailShift+=this.appendTail(s).tailShift),a}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=Boolean(e._rawInputValue)}pad(e){return this._appendPlaceholder()}}class PatternInputDefinition{constructor(e){const{parent:t,isOptional:s,placeholderChar:a,displayChar:i,lazy:n,eager:u,...r}=e;this.masked=createMask(r),Object.assign(this,{parent:t,isOptional:s,placeholderChar:a,displayChar:i,lazy:n,eager:u})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),0===e&&t>=1?(this.isFilled=!1,this.masked.remove(e,t)):new ChangeDetails}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return Boolean(this.masked.value)||this.isOptional}_appendChar(e,t){if(void 0===t&&(t={}),this.isFilled)return new ChangeDetails;const s=this.masked.state;let a=this.masked._appendChar(e,this.currentMaskFlags(t));return a.inserted&&!1===this.doValidate(t)&&(a=new ChangeDetails,this.masked.state=s),a.inserted||this.isOptional||this.lazy||t.input||(a.inserted=this.placeholderChar),a.skip=!a.inserted&&!this.isOptional,this.isFilled=Boolean(a.inserted),a}append(e,t,s){return this.masked.append(e,this.currentMaskFlags(t),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new ChangeDetails:(this.isFilled=!0,new ChangeDetails({inserted:this.placeholderChar}))}_appendEager(){return new ChangeDetails}extractTail(e,t){return this.masked.extractTail(e,t)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),this.masked.extractInput(e,t,s)}nearestInputPos(e,t){void 0===t&&(t=i.NONE);const s=0,a=this.value.length,n=Math.min(Math.max(e,s),a);switch(t){case i.LEFT:case i.FORCE_LEFT:return this.isComplete?n:s;case i.RIGHT:case i.FORCE_RIGHT:return this.isComplete?n:a;case i.NONE:default:return n}}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),this.value.slice(e,t).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var t;return{...e,_beforeTailState:(null==e||null==(t=e._beforeTailState)?void 0:t.masked)||(null==e?void 0:e._beforeTailState)}}pad(e){return new ChangeDetails}}PatternInputDefinition.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class MaskedRegExp extends Masked{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=e=>e.search(t)>=0),super._update(e)}}IMask.MaskedRegExp=MaskedRegExp;class MaskedPattern extends Masked{constructor(e){super({...MaskedPattern.DEFAULTS,...e,definitions:Object.assign({},PatternInputDefinition.DEFAULT_DEFINITIONS,null==e?void 0:e.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const t=this.mask;if(!t||!e)return;let s=!1,a=!1;for(let i=0;i<t.length;++i){if(this.blocks){const e=t.slice(i),s=Object.keys(this.blocks).filter((t=>0===e.indexOf(t)));s.sort(((e,t)=>t.length-e.length));const a=s[0];if(a){const{expose:e,repeat:t,...s}=normalizeOpts(this.blocks[a]),n={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...s,repeat:t,parent:this},u=null!=t?new IMask.RepeatBlock(n):createMask(n);u&&(this._blocks.push(u),e&&(this.exposeBlock=u),this._maskedBlocks[a]||(this._maskedBlocks[a]=[]),this._maskedBlocks[a].push(this._blocks.length-1)),i+=a.length-1;continue}}let n=t[i],u=n in e;if(n===MaskedPattern.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===n||"}"===n){s=!s;continue}if("["===n||"]"===n){a=!a;continue}if(n===MaskedPattern.ESCAPE_CHAR){if(++i,n=t[i],!n)break;u=!1}const r=u?new PatternInputDefinition({isOptional:a,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...normalizeOpts(e[n]),parent:this}):new PatternFixedDefinition({char:n,eager:this.eager,isUnmasking:s});this._blocks.push(r)}}get state(){return{...super.state,_blocks:this._blocks.map((e=>e.state))}}set state(e){if(!e)return void this.reset();const{_blocks:t,...s}=e;this._blocks.forEach(((e,s)=>e.state=t[s])),super.state=s}reset(){super.reset(),this._blocks.forEach((e=>e.reset()))}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every((e=>e.isComplete))}get isFilled(){return this._blocks.every((e=>e.isFilled))}get isFixed(){return this._blocks.every((e=>e.isFixed))}get isOptional(){return this._blocks.every((e=>e.isOptional))}doCommit(){this._blocks.forEach((e=>e.doCommit())),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce(((e,t)=>e+t.unmaskedValue),"")}set unmaskedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(t),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce(((e,t)=>e+t.value),"")}set value(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(t),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(t),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce(((e,t)=>e+t.displayValue),"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const t=new ChangeDetails;let s=null==(e=this._mapPosToBlock(this.displayValue.length))?void 0:e.index;if(null==s)return t;this._blocks[s].isFilled&&++s;for(let e=s;e<this._blocks.length;++e){const s=this._blocks[e]._appendEager();if(!s.inserted)break;t.aggregate(s)}return t}_appendCharRaw(e,t){void 0===t&&(t={});const s=this._mapPosToBlock(this.displayValue.length),a=new ChangeDetails;if(!s)return a;for(let n,u=s.index;n=this._blocks[u];++u){var i;const s=n._appendChar(e,{...t,_beforeTailState:null==(i=t._beforeTailState)||null==(i=i._blocks)?void 0:i[u]});if(a.aggregate(s),s.consumed)break}return a}extractTail(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=new ChunksTailDetails;return e===t||this._forEachBlocksInRange(e,t,((e,t,a,i)=>{const n=e.extractTail(a,i);n.stop=this._findStopBefore(t),n.from=this._blockStartPos(t),n instanceof ChunksTailDetails&&(n.blockIndex=t),s.extend(n)})),s}extractInput(e,t,s){if(void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),void 0===s&&(s={}),e===t)return"";let a="";return this._forEachBlocksInRange(e,t,((e,t,i,n)=>{a+=e.extractInput(i,n,s)})),a}_findStopBefore(e){let t;for(let s=0;s<this._stops.length;++s){const a=this._stops[s];if(!(a<=e))break;t=a}return t}_appendPlaceholder(e){const t=new ChangeDetails;if(this.lazy&&null==e)return t;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return t;const a=s.index,i=null!=e?e:this._blocks.length;return this._blocks.slice(a,i).forEach((s=>{var a;s.lazy&&null==e||t.aggregate(s._appendPlaceholder(null==(a=s._blocks)?void 0:a.length))})),t}_mapPosToBlock(e){let t="";for(let s=0;s<this._blocks.length;++s){const a=this._blocks[s],i=t.length;if(t+=a.displayValue,e<=t.length)return{index:s,offset:e-i}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce(((e,t)=>e+t.displayValue.length),0)}_forEachBlocksInRange(e,t,s){void 0===t&&(t=this.displayValue.length);const a=this._mapPosToBlock(e);if(a){const e=this._mapPosToBlock(t),i=e&&a.index===e.index,n=a.offset,u=e&&i?e.offset:this._blocks[a.index].displayValue.length;if(s(this._blocks[a.index],a.index,n,u),e&&!i){for(let t=a.index+1;t<e.index;++t)s(this._blocks[t],t,0,this._blocks[t].displayValue.length);s(this._blocks[e.index],e.index,0,e.offset)}}}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=super.remove(e,t);return this._forEachBlocksInRange(e,t,((e,t,a,i)=>{s.aggregate(e.remove(a,i))})),s}nearestInputPos(e,t){if(void 0===t&&(t=i.NONE),!this._blocks.length)return 0;const s=new PatternCursor(this,e);if(t===i.NONE)return s.pushRightBeforeInput()?s.pos:(s.popState(),s.pushLeftBeforeInput()?s.pos:this.displayValue.length);if(t===i.LEFT||t===i.FORCE_LEFT){if(t===i.LEFT){if(s.pushRightBeforeFilled(),s.ok&&s.pos===e)return e;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),t===i.LEFT){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=e)return s.pos;if(s.popState(),s.ok&&s.pos<=e)return s.pos;s.popState()}return s.ok?s.pos:t===i.FORCE_LEFT?0:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:0))}return t===i.RIGHT||t===i.FORCE_RIGHT?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:t===i.FORCE_RIGHT?this.displayValue.length:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:this.nearestInputPos(e,i.LEFT)))):e}totalInputPositions(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);let s=0;return this._forEachBlocksInRange(e,t,((e,t,a,i)=>{s+=e.totalInputPositions(a,i)})),s}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map((e=>this._blocks[e])):[]}pad(e){const t=new ChangeDetails;return this._forEachBlocksInRange(0,this.displayValue.length,(s=>t.aggregate(s.pad(e)))),t}}MaskedPattern.DEFAULTS={...Masked.DEFAULTS,lazy:!0,placeholderChar:"_"},MaskedPattern.STOP_CHAR="`",MaskedPattern.ESCAPE_CHAR="\\",MaskedPattern.InputDefinition=PatternInputDefinition,MaskedPattern.FixedDefinition=PatternFixedDefinition,IMask.MaskedPattern=MaskedPattern;class MaskedRange extends MaskedPattern{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:t=this.to||0,from:s=this.from||0,maxLength:a=this.maxLength||0,autofix:i=this.autofix,...n}=e;this.to=t,this.from=s,this.maxLength=Math.max(String(t).length,a),this.autofix=i;const u=String(this.from).padStart(this.maxLength,"0"),r=String(this.to).padStart(this.maxLength,"0");let l=0;while(l<r.length&&r[l]===u[l])++l;n.mask=r.slice(0,l).replace(/0/g,"\\0")+"0".repeat(this.maxLength-l),super._update(n)}get isComplete(){return super.isComplete&&Boolean(this.value)}boundaries(e){let t="",s="";const[,a,i]=e.match(/^(\D*)(\d*)(\D*)/)||[];return i&&(t="0".repeat(a.length)+i,s="9".repeat(a.length)+i),t=t.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[t,s]}doPrepareChar(e,t){let s;return void 0===t&&(t={}),[e,s]=super.doPrepareChar(e.replace(/\D/g,""),t),e||(s.skip=!this.isComplete),[e,s]}_appendCharRaw(e,t){if(void 0===t&&(t={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,t);const s=String(this.from).padStart(this.maxLength,"0"),a=String(this.to).padStart(this.maxLength,"0"),[i,n]=this.boundaries(this.value+e);return Number(n)<this.from?super._appendCharRaw(s[this.value.length],t):Number(i)>this.to?!t.tail&&"pad"===this.autofix&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],t).aggregate(this._appendCharRaw(e,t)):super._appendCharRaw(a[this.value.length],t):super._appendCharRaw(e,t)}doValidate(e){const t=this.value,s=t.search(/[^0]/);if(-1===s&&t.length<=this._matchFrom)return!0;const[a,i]=this.boundaries(t);return this.from<=Number(i)&&Number(a)<=this.to&&super.doValidate(e)}pad(e){const t=new ChangeDetails;if(this.value.length===this.maxLength)return t;const s=this.value,a=this.maxLength-this.value.length;if(a){this.reset();for(let s=0;s<a;++s)t.aggregate(super._appendCharRaw("0",e));s.split("").forEach((e=>this._appendCharRaw(e)))}return t}}IMask.MaskedRange=MaskedRange;const r="d{.}`m{.}`Y";class MaskedDate extends MaskedPattern{static extractPatternOptions(e){const{mask:t,pattern:s,...a}=e;return{...a,mask:isString(t)?t:s}}constructor(e){super(MaskedDate.extractPatternOptions({...MaskedDate.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:t,pattern:s,blocks:a,...i}={...MaskedDate.DEFAULTS,...e},n=Object.assign({},MaskedDate.GET_DEFAULT_BLOCKS());e.min&&(n.Y.from=e.min.getFullYear()),e.max&&(n.Y.to=e.max.getFullYear()),e.min&&e.max&&n.Y.from===n.Y.to&&(n.m.from=e.min.getMonth()+1,n.m.to=e.max.getMonth()+1,n.m.from===n.m.to&&(n.d.from=e.min.getDate(),n.d.to=e.max.getDate())),Object.assign(n,this.blocks,a),super._update({...i,mask:isString(t)?t:s,blocks:n})}doValidate(e){const t=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&null!=t&&(null==this.min||this.min<=t)&&(null==this.max||t<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(MaskedDate.extractPatternOptions(e))}}MaskedDate.GET_DEFAULT_BLOCKS=()=>({d:{mask:MaskedRange,from:1,to:31,maxLength:2},m:{mask:MaskedRange,from:1,to:12,maxLength:2},Y:{mask:MaskedRange,from:1900,to:9999}}),MaskedDate.DEFAULTS={...MaskedPattern.DEFAULTS,mask:Date,pattern:r,format:(e,t)=>{if(!e)return"";const s=String(e.getDate()).padStart(2,"0"),a=String(e.getMonth()+1).padStart(2,"0"),i=e.getFullYear();return[s,a,i].join(".")},parse:(e,t)=>{const[s,a,i]=e.split(".").map(Number);return new Date(i,a-1,s)}},IMask.MaskedDate=MaskedDate;class MaskedDynamic extends Masked{constructor(e){super({...MaskedDynamic.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map((e=>{const{expose:t,...s}=normalizeOpts(e),a=createMask({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return t&&(this.exposeMask=a),a})):[])}_appendCharRaw(e,t){void 0===t&&(t={});const s=this._applyDispatch(e,t);return this.currentMask&&s.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),s}_applyDispatch(e,t,s){void 0===e&&(e=""),void 0===t&&(t={}),void 0===s&&(s="");const a=t.tail&&null!=t._beforeTailState?t._beforeTailState._value:this.value,i=this.rawInputValue,n=t.tail&&null!=t._beforeTailState?t._beforeTailState._rawInputValue:i,u=i.slice(n.length),r=this.currentMask,l=new ChangeDetails,o=null==r?void 0:r.state;return this.currentMask=this.doDispatch(e,{...t},s),this.currentMask&&(this.currentMask!==r?(this.currentMask.reset(),n&&(this.currentMask.append(n,{raw:!0}),l.tailShift=this.currentMask.value.length-a.length),u&&(l.tailShift+=this.currentMask.append(u,{raw:!0,tail:!0}).tailShift)):o&&(this.currentMask.state=o)),l}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const t=new ChangeDetails;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,s;return{...e,_beforeTailState:(null==(t=e._beforeTailState)?void 0:t.currentMaskRef)===this.currentMask&&(null==(s=e._beforeTailState)?void 0:s.currentMask)||e._beforeTailState}}doDispatch(e,t,s){return void 0===t&&(t={}),void 0===s&&(s=""),this.dispatch(e,this,t,s)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,t){void 0===t&&(t={});let[s,a]=super.doPrepare(e,t);if(this.currentMask){let e;[s,e]=super.doPrepare(s,this.currentMaskFlags(t)),a=a.aggregate(e)}return[s,a]}doPrepareChar(e,t){void 0===t&&(t={});let[s,a]=super.doPrepareChar(e,t);if(this.currentMask){let e;[s,e]=super.doPrepareChar(s,this.currentMaskFlags(t)),a=a.aggregate(e)}return[s,a]}reset(){var e;null==(e=this.currentMask)||e.reset(),this.compiledMasks.forEach((e=>e.reset()))}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask)return this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,void this._applyDispatch();let t=String(e);this.currentMask&&(this.currentMask.typedValue=e,t=this.currentMask.unmaskedValue),this.unmaskedValue=t}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return Boolean(null==(e=this.currentMask)?void 0:e.isComplete)}get isFilled(){var e;return Boolean(null==(e=this.currentMask)?void 0:e.isFilled)}remove(e,t){const s=new ChangeDetails;return this.currentMask&&s.aggregate(this.currentMask.remove(e,t)).aggregate(this._applyDispatch()),s}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map((e=>e.state)),currentMaskRef:this.currentMask,currentMask:null==(e=this.currentMask)?void 0:e.state}}set state(e){const{compiledMasks:t,currentMaskRef:s,currentMask:a,...i}=e;t&&this.compiledMasks.forEach(((e,s)=>e.state=t[s])),null!=s&&(this.currentMask=s,this.currentMask.state=a),super.state=i}extractInput(e,t,s){return this.currentMask?this.currentMask.extractInput(e,t,s):""}extractTail(e,t){return this.currentMask?this.currentMask.extractTail(e,t):super.extractTail(e,t)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,t){return this.currentMask?this.currentMask.nearestInputPos(e,t):super.nearestInputPos(e,t)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every(((t,s)=>{if(!e[s])return;const{mask:a,...i}=e[s];return objectIncludes(t,i)&&t.maskEquals(a)})):super.maskEquals(e)}typedValueEquals(e){var t;return Boolean(null==(t=this.currentMask)?void 0:t.typedValueEquals(e))}}MaskedDynamic.DEFAULTS={...Masked.DEFAULTS,dispatch:(e,t,s,a)=>{if(!t.compiledMasks.length)return;const n=t.rawInputValue,u=t.compiledMasks.map(((u,r)=>{const l=t.currentMask===u,o=l?u.displayValue.length:u.nearestInputPos(u.displayValue.length,i.FORCE_LEFT);return u.rawInputValue!==n?(u.reset(),u.append(n,{raw:!0})):l||u.remove(o),u.append(e,t.currentMaskFlags(s)),u.appendTail(a),{index:r,weight:u.rawInputValue.length,totalInputPositions:u.totalInputPositions(0,Math.max(o,u.nearestInputPos(u.displayValue.length,i.FORCE_LEFT)))}}));return u.sort(((e,t)=>t.weight-e.weight||t.totalInputPositions-e.totalInputPositions)),t.compiledMasks[u[0].index]}},IMask.MaskedDynamic=MaskedDynamic;class MaskedEnum extends MaskedPattern{constructor(e){super({...MaskedEnum.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:t,...s}=e;if(t){const e=t.map((e=>e.length)),a=Math.min(...e),i=Math.max(...e)-a;s.mask="*".repeat(a),i&&(s.mask+="["+"*".repeat(i)+"]"),this.enum=t}super._update(s)}_appendCharRaw(e,t){void 0===t&&(t={});const s=Math.min(this.nearestInputPos(0,i.FORCE_RIGHT),this.value.length),a=this.enum.filter((t=>this.matchValue(t,this.unmaskedValue+e,s)));if(a.length){1===a.length&&this._forEachBlocksInRange(0,this.value.length,((e,s)=>{const i=a[0][s];s>=this.value.length||i===e.value||(e.reset(),e._appendChar(i,t))}));const e=super._appendCharRaw(a[0][this.value.length],t);return 1===a.length&&a[0].slice(this.unmaskedValue.length).split("").forEach((t=>e.aggregate(super._appendCharRaw(t)))),e}return new ChangeDetails({skip:!this.isComplete})}extractTail(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),new ContinuousTailDetails("",e)}remove(e,t){if(void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),e===t)return new ChangeDetails;const s=Math.min(super.nearestInputPos(0,i.FORCE_RIGHT),this.value.length);let a;for(a=e;a>=0;--a){const e=this.enum.filter((e=>this.matchValue(e,this.value.slice(s,a),s)));if(e.length>1)break}const n=super.remove(a,t);return n.tailShift+=a-e,n}get isComplete(){return this.enum.indexOf(this.value)>=0}}MaskedEnum.DEFAULTS={...MaskedPattern.DEFAULTS,matchValue:(e,t,s)=>e.indexOf(t,s)===s},IMask.MaskedEnum=MaskedEnum;class MaskedFunction extends Masked{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}var l;IMask.MaskedFunction=MaskedFunction;class MaskedNumber extends Masked{constructor(e){super({...MaskedNumber.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),t="\\d*",s=(this.scale?"("+escapeRegExp(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+t+s),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(escapeRegExp).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(escapeRegExp(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const t=e.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepareChar(e,t){void 0===t&&(t={});const[s,a]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(t.input&&t.raw||!t.input&&!t.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),t);return e&&!s&&(a.skip=!0),!s||this.allowPositive||this.value||"-"===s||a.aggregate(this._appendChar("-")),[s,a]}_separatorsCount(e,t){void 0===t&&(t=!1);let s=0;for(let a=0;a<e;++a)this._value.indexOf(this.thousandsSeparator,a)===a&&(++s,t&&(e+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(e){return void 0===e&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t),this._removeThousandsSeparators(super.extractInput(e,t,s))}_appendCharRaw(e,t){void 0===t&&(t={});const s=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,a=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const i=this._value;this._value+=e;const n=this.number;let u,r=!isNaN(n),l=!1;if(r){let e;null!=this.min&&this.min<0&&this.number<this.min&&(e=this.min),null!=this.max&&this.max>0&&this.number>this.max&&(e=this.max),null!=e&&(this.autofix?(this._value=this.format(e,this).replace(MaskedNumber.UNMASKED_RADIX,this.radix),l||(l=i===this._value&&!t.tail)):r=!1),r&&(r=Boolean(this._value.match(this._numberRegExp)))}r?u=new ChangeDetails({inserted:this._value.slice(i.length),rawInserted:l?"":e,skip:l}):(this._value=i,u=new ChangeDetails),this._value=this._insertThousandsSeparators(this._value);const o=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(o);return u.tailShift+=(h-a)*this.thousandsSeparator.length,u}_findSeparatorAround(e){if(this.thousandsSeparator){const t=e-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,t);if(s<=e)return s}return-1}_adjustRangeWithSeparators(e,t){const s=this._findSeparatorAround(e);s>=0&&(e=s);const a=this._findSeparatorAround(t);return a>=0&&(t=a+this.thousandsSeparator.length),[e,t]}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t);const s=this.value.slice(0,e),a=this.value.slice(t),i=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+a));const n=this._separatorsCountFromSlice(s);return new ChangeDetails({tailShift:(n-i)*this.thousandsSeparator.length})}nearestInputPos(e,t){if(!this.thousandsSeparator)return e;switch(t){case i.NONE:case i.LEFT:case i.FORCE_LEFT:{const s=this._findSeparatorAround(e-1);if(s>=0){const a=s+this.thousandsSeparator.length;if(e<a||this.value.length<=a||t===i.FORCE_LEFT)return s}break}case i.RIGHT:case i.FORCE_RIGHT:{const t=this._findSeparatorAround(e);if(t>=0)return t+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let t=e;null!=this.min&&(t=Math.max(t,this.min)),null!=this.max&&(t=Math.min(t,this.max)),t!==e&&(this.unmaskedValue=this.format(t,this));let s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&this.scale>0&&(s=this._padFractionalZeros(s)),this._value=s}super.doCommit()}_normalizeZeros(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,((e,t,s,a)=>t+a)),e.length&&!/\d$/.test(t[0])&&(t[0]=t[0]+"0"),t.length>1&&(t[1]=t[1].replace(/0*$/,""),t[1].length||(t.length=1)),this._insertThousandsSeparators(t.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const t=e.split(this.radix);return t.length<2&&t.push(""),t[1]=t[1].padEnd(this.scale,"0"),t.join(this.radix)}doSkipInvalid(e,t,s){void 0===t&&(t={});const a=0===this.scale&&e!==this.thousandsSeparator&&(e===this.radix||e===MaskedNumber.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,t,s)&&!a}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,MaskedNumber.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(MaskedNumber.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}get allowNegative(){return null!=this.min&&this.min<0||null!=this.max&&this.max<0}get allowPositive(){return null!=this.min&&this.min>0||null!=this.max&&this.max>0}typedValueEquals(e){return(super.typedValueEquals(e)||MaskedNumber.EMPTY_VALUES.includes(e)&&MaskedNumber.EMPTY_VALUES.includes(this.typedValue))&&!(0===e&&""===this.value)}}l=MaskedNumber,MaskedNumber.UNMASKED_RADIX=".",MaskedNumber.EMPTY_VALUES=[...Masked.EMPTY_VALUES,0],MaskedNumber.DEFAULTS={...Masked.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[l.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:e=>e.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},IMask.MaskedNumber=MaskedNumber;const o={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function createPipe(e,t,s){void 0===t&&(t=o.MASKED),void 0===s&&(s=o.MASKED);const a=createMask(e);return e=>a.runIsolated((a=>(a[t]=e,a[s])))}function pipe(e,t,s,a){return createPipe(t,s,a)(e)}IMask.PIPE_TYPE=o,IMask.createPipe=createPipe,IMask.pipe=pipe;class RepeatBlock extends MaskedPattern{get repeatFrom(){var e;return null!=(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)?e:0}get repeatTo(){var e;return null!=(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var t,s,a;const{repeat:i,...n}=normalizeOpts(e);this._blockOpts=Object.assign({},this._blockOpts,n);const u=createMask(this._blockOpts);this.repeat=null!=(t=null!=(s=null!=i?i:u.repeat)?s:this.repeat)?t:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&(null==(a=this._blocks)?void 0:a.length)||0,this.repeatFrom)),blocks:{m:u},eager:u.eager,overwrite:u.overwrite,skipInvalid:u.skipInvalid,lazy:u.lazy,placeholderChar:u.placeholderChar,displayChar:u.displayChar})}_allocateBlock(e){return e<this._blocks.length?this._blocks[e]:this.repeatTo===1/0||this._blocks.length<this.repeatTo?(this._blocks.push(createMask(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]):void 0}_appendCharRaw(e,t){void 0===t&&(t={});const s=new ChangeDetails;for(let r,l,o=null!=(a=null==(i=this._mapPosToBlock(this.displayValue.length))?void 0:i.index)?a:Math.max(this._blocks.length-1,0);r=null!=(n=this._blocks[o])?n:l=!l&&this._allocateBlock(o);++o){var a,i,n,u;const h=r._appendChar(e,{...t,_beforeTailState:null==(u=t._beforeTailState)||null==(u=u._blocks)?void 0:u[o]});if(h.skip&&l){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(s.aggregate(h),h.consumed)break}return s}_trimEmptyTail(e,t){var s,a;void 0===e&&(e=0);const i=Math.max((null==(s=this._mapPosToBlock(e))?void 0:s.index)||0,this.repeatFrom,0);let n;null!=t&&(n=null==(a=this._mapPosToBlock(t))?void 0:a.index),null==n&&(n=this._blocks.length-1);let u=0;for(let e=n;i<=e;--e,++u)if(this._blocks[e].unmaskedValue)break;u&&(this._blocks.splice(n-u+1,u),this.mask=this.mask.slice(u))}reset(){super.reset(),this._trimEmptyTail()}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=super.remove(e,t);return this._trimEmptyTail(e,t),s}totalInputPositions(e,t){return void 0===e&&(e=0),null==t&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,t)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}}IMask.RepeatBlock=RepeatBlock;try{globalThis.IMask=IMask}catch{}var h=__webpack_require__(2380),d=!0,p=void 0;var c={mask:void 0,prepare:Function,prepareChar:Function,validate:Function,commit:Function,overwrite:{type:Boolean,required:!1,default:void 0},eager:{required:!1,default:void 0,validator:e=>["append","remove"].includes(e)||"boolean"===typeof e},skipInvalid:{type:Boolean,required:!1,default:void 0},placeholderChar:String,displayChar:String,lazy:{type:Boolean,required:!1,default:void 0},definitions:Object,blocks:Object,enum:Array,maxLength:Number,from:Number,to:Number,pattern:String,format:Function,parse:Function,autofix:{required:!1,default:void 0,validator:e=>"pad"===e||"boolean"===typeof e},radix:String,thousandsSeparator:String,mapToRadix:Array,scale:Number,normalizeZeros:{type:Boolean,required:!1,default:void 0},padFractionalZeros:{type:Boolean,required:!1,default:void 0},min:[Number,Date],max:[Number,Date],dispatch:Function};function useIMask(e,t){let{emit:s,onAccept:a,onComplete:i,defaultValue:n,defaultUnmaskedValue:u,defaultTypedValue:r}=void 0===t?{}:t;const l=(0,h.isRef)(e)?e:(0,h.ref)(e),o=(0,h.ref)(),d=(0,h.ref)(),p=(0,h.ref)(""),c=(0,h.ref)(""),k=(0,h.ref)();let m,g=p.value,_=c.value,v=k.value;function storeLastAcceptedValues(){v=k.value=d.value.typedValue,_=c.value=d.value.unmaskedValue,g=p.value=d.value.value}function _onAccept(e){storeLastAcceptedValues(),s&&(s("accept",p.value,e),s("accept:masked",p.value,e),s("accept:typed",k.value,e),s("accept:unmasked",c.value,e)),null==a||a(e)}function _onComplete(e){s&&(s("complete",d.value.value,e),s("complete:masked",d.value.value,e),s("complete:typed",d.value.typedValue,e),s("complete:unmasked",d.value.unmaskedValue,e)),null==i||i(e)}const updateUnmaskedValue=()=>{d.value&&void 0!==c.value&&(_!==c.value&&(d.value.unmaskedValue=c.value,d.value.unmaskedValue!==c.value&&_onAccept()),_=void 0)};(0,h.watch)(c,updateUnmaskedValue);const updateMaskedValue=()=>{d.value&&void 0!==p.value&&(g!==p.value&&(d.value.value=p.value,d.value.value!==p.value&&_onAccept()),g=void 0)};(0,h.watch)(p,updateMaskedValue);const updateTypedValue=()=>{d.value&&void 0!==k.value&&(v!==k.value&&(d.value.typedValue=k.value,d.value.masked.typedValueEquals(k.value)||_onAccept()),v=void 0)};function _initMask(){m=o.value;const e=l.value;m&&null!=e&&e.mask&&(d.value=IMask(m,e),void 0!==n&&(p.value=n),void 0!==u&&(c.value=u),void 0!==r&&(k.value=r),updateUnmaskedValue(),updateMaskedValue(),updateTypedValue(),storeLastAcceptedValues(),d.value.on("accept",_onAccept).on("complete",_onComplete))}function _destroyMask(){var e;null==(e=d.value)||e.destroy(),d.value=void 0}return(0,h.watch)(k,updateTypedValue),(0,h.onMounted)(_initMask),(0,h.onUnmounted)(_destroyMask),(0,h.watch)([o,l],(()=>{const e=o.value,t=l.value;null!=t&&t.mask&&e===m||_destroyMask(),e&&(d.value?d.value.updateOptions(t):_initMask())})),{el:o,mask:(0,h.readonly)(d),masked:p,unmasked:c,typed:k}}function extractOptionsFromProps(e,t){return e={...e},Object.keys(e).forEach((s=>{(void 0===e[s]||t.includes(s))&&delete e[s]})),e}const k=["typed","unmasked","value","modelValue"];var m=(0,h.defineComponent)({name:"imask-input",inheritAttrs:!1,props:{modelValue:String,value:String,unmasked:String,typed:{validator:()=>!0},...c},emits:["update:modelValue","update:masked","update:value","update:unmasked","update:typed","accept","accept:value","accept:masked","accept:unmasked","accept:typed","complete","complete:value","complete:masked","complete:unmasked","complete:typed"],setup(e,t){let{attrs:s,emit:a}=t;const{el:i,mask:n,masked:u,unmasked:r,typed:l}=useIMask(extractOptionsFromProps(e,k),{emit:a,onAccept:e=>{const t=u.value;a("accept:value",t,e),a("update:value",t,e),a("update:masked",t,e),a("update:modelValue",t,e),a("update:unmasked",r.value,e),a("update:typed",l.value,e)},onComplete:e=>{a("complete:value",u.value,e)}}),o=(0,h.toRef)(e,"value"),d=(0,h.toRef)(e,"modelValue"),p=(0,h.toRef)(e,"unmasked"),c=(0,h.toRef)(e,"typed");return u.value=d.value||o.value||"",r.value=p.value||"",l.value=c.value,(0,h.watch)(o,(e=>u.value=e)),(0,h.watch)(d,(e=>u.value=e)),(0,h.watch)(p,(e=>r.value=e)),(0,h.watch)(c,(e=>l.value=e)),()=>{const t={...s,value:null!=e.value?e.value:null!=e.modelValue?e.modelValue:n.value?n.value.displayValue:"",ref:i};return e.mask||(t.onInput=e=>{a("update:modelValue",e.target.value),a("update:value",e.target.value)}),(0,h.h)("input",t)}}}),g=null==p?void 0:p.extend({name:"imask-input",data(){return{}},render(e){const t={domProps:{value:this.maskRef?this.maskRef.value:this.value},on:{...this.$listeners}};return this.$props.mask?delete t.on.input:t.on.input=e=>this.$emit("input",e.target.value),e("input",t)},mounted(){this.$props.mask&&this._initMask()},destroyed(){this._destroyMask()},computed:{maskOptions(){return extractOptionsFromProps(this.$props,["value","unmask"])}},watch:{$props:{handler(e){const t=this.maskOptions;t.mask?this.maskRef?(this.maskRef.updateOptions(t),"value"in e&&this._updateValue()):(this._initMask(t),e.value!==this._maskValue()&&this._onAccept()):(this._destroyMask(),"value"in e&&(this.$el.value=e.value))},deep:!0}},methods:{_maskValue(){var e,t,s;return"typed"===this.unmask?null==(e=this.maskRef)?void 0:e.typedValue:this.unmask?null==(t=this.maskRef)?void 0:t.unmaskedValue:null==(s=this.maskRef)?void 0:s.value},_updateValue(){if(!this.maskRef)return;const e=null==this.value&&"typed"!==this.unmask?"":this.value;"typed"===this.unmask?this.maskRef.typedValue=e:this.unmask?this.maskRef.unmaskedValue=e:this.maskRef.value=e},_onAccept(){const e=this._maskValue();this.$emit("input",e),this.$emit("accept",e)},_onComplete(){this.$emit("complete",this._maskValue())},_initMask(e){e||(e=this.maskOptions),this.maskRef=IMask(this.$el,e).on("accept",this._onAccept.bind(this)).on("complete",this._onComplete.bind(this)),this._updateValue()},_destroyMask(){this.maskRef&&(this.maskRef.destroy(),delete this.maskRef)}},props:{value:{},unmask:{validator:e=>"typed"===e||"boolean"===typeof e},...c}}),_=d?m:g,v={name:"imask",[d?"beforeMount":"bind"]:(e,t)=>{let{value:s}=t;s&&initMask(e,s)},[d?"updated":"update"]:(e,t)=>{let{value:s}=t;s?e.maskRef?(e.maskRef.updateOptions(s),e.value!==e.maskRef.value&&e.maskRef._onChange()):initMask(e,s):destroyMask(e)},[d?"unmounted":"unbind"]:e=>{destroyMask(e)}};function fireEvent(e,t,s){const a=document.createEvent("CustomEvent");a.initCustomEvent(t,!0,!0,s),e.dispatchEvent(a)}function initMask(e,t){e.maskRef=IMask(e,t).on("accept",(()=>fireEvent(e,"accept",e.maskRef))).on("complete",(()=>fireEvent(e,"complete",e.maskRef)))}function destroyMask(e){e.maskRef&&(e.maskRef.destroy(),delete e.maskRef)}return a})()));
|
|
1
|
+
(function webpackUniversalModuleDefinition(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define(["vue"],t):"object"===typeof exports?exports["ldmui"]=t(require("vue")):e["ldmui"]=t(e["vue"])})(self,e=>(()=>{"use strict";var t={2380:t=>{t.exports=e}},s={};function __webpack_require__(e){var a=s[e];if(void 0!==a)return a.exports;var i=s[e]={exports:{}};return t[e](i,i.exports,__webpack_require__),i.exports}(()=>{__webpack_require__.d=(e,t)=>{for(var s in t)__webpack_require__.o(t,s)&&!__webpack_require__.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})}})(),(()=>{__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{__webpack_require__.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var a={};function isString(e){return"string"===typeof e||e instanceof String}function isObject(e){var t;return"object"===typeof e&&null!=e&&"Object"===(null==e||null==(t=e.constructor)?void 0:t.name)}function pick(e,t){return Array.isArray(t)?pick(e,(e,s)=>t.includes(s)):Object.entries(e).reduce((e,s)=>{let[a,i]=s;return t(i,a)&&(e[a]=i),e},{})}__webpack_require__.r(a),__webpack_require__.d(a,{IMask:()=>IMask,IMaskComponent:()=>_,IMaskDirective:()=>v,IMaskProps:()=>c,useIMask:()=>useIMask});const i={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function forceDirection(e){switch(e){case i.LEFT:return i.FORCE_LEFT;case i.RIGHT:return i.FORCE_RIGHT;default:return e}}function escapeRegExp(e){return e.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function objectIncludes(e,t){if(t===e)return!0;const s=Array.isArray(t),a=Array.isArray(e);let i;if(s&&a){if(t.length!=e.length)return!1;for(i=0;i<t.length;i++)if(!objectIncludes(t[i],e[i]))return!1;return!0}if(s!=a)return!1;if(t&&e&&"object"===typeof t&&"object"===typeof e){const s=t instanceof Date,a=e instanceof Date;if(s&&a)return t.getTime()==e.getTime();if(s!=a)return!1;const n=t instanceof RegExp,u=e instanceof RegExp;if(n&&u)return t.toString()==e.toString();if(n!=u)return!1;const r=Object.keys(t);for(i=0;i<r.length;i++)if(!Object.prototype.hasOwnProperty.call(e,r[i]))return!1;for(i=0;i<r.length;i++)if(!objectIncludes(e[r[i]],t[r[i]]))return!1;return!0}return!(!t||!e||"function"!==typeof t||"function"!==typeof e)&&t.toString()===e.toString()}class ActionDetails{constructor(e){Object.assign(this,e);while(this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos))--this.oldSelection.start;if(this.insertedCount)while(this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end))this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?i.NONE:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?i.LEFT:i.RIGHT}}function IMask(e,t){return new IMask.InputMask(e,t)}function maskedClass(e){if(null==e)throw new Error("mask property should be defined");return e instanceof RegExp?IMask.MaskedRegExp:isString(e)?IMask.MaskedPattern:e===Date?IMask.MaskedDate:e===Number?IMask.MaskedNumber:Array.isArray(e)||e===Array?IMask.MaskedDynamic:IMask.Masked&&e.prototype instanceof IMask.Masked?e:IMask.Masked&&e instanceof IMask.Masked?e.constructor:e instanceof Function?IMask.MaskedFunction:(console.warn("Mask not found for mask",e),IMask.Masked)}function normalizeOpts(e){if(!e)throw new Error("Options in not defined");if(IMask.Masked){if(e.prototype instanceof IMask.Masked)return{mask:e};const{mask:t,...s}=e instanceof IMask.Masked?{mask:e}:isObject(e)&&e.mask instanceof IMask.Masked?e:{};if(t){const e=t.mask;return{...pick(t,(e,t)=>!t.startsWith("_")),mask:t.constructor,_mask:e,...s}}}return isObject(e)?{...e}:{mask:e}}function createMask(e){if(IMask.Masked&&e instanceof IMask.Masked)return e;const t=normalizeOpts(e),s=maskedClass(t.mask);if(!s)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===s&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new s(t)}IMask.createMask=createMask;class MaskElement{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return null!=e?e:this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return null!=e?e:this.value.length}select(e,t){if(null!=e&&null!=t&&(e!==this.selectionStart||t!==this.selectionEnd))try{this._unsafeSelect(e,t)}catch{}}get isActive(){return!1}}IMask.MaskElement=MaskElement;const n=90,u=89;class HTMLMaskElement extends MaskElement{constructor(e){super(),this.input=e,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var e,t,s;return null!=(e=null==(t=(s=this.input).getRootNode)?void 0:t.call(s))?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){return this._handlers.redo&&(e.keyCode===n&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===u&&e.ctrlKey)?(e.preventDefault(),this._handlers.redo(e)):this._handlers.undo&&e.keyCode===n&&(e.metaKey||e.ctrlKey)?(e.preventDefault(),this._handlers.undo(e)):void(e.isComposing||this._handlers.selectionChange(e))}_onBeforeinput(e){return"historyUndo"===e.inputType&&this._handlers.undo?(e.preventDefault(),this._handlers.undo(e)):"historyRedo"===e.inputType&&this._handlers.redo?(e.preventDefault(),this._handlers.redo(e)):void 0}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}IMask.HTMLMaskElement=HTMLMaskElement;class HTMLInputMaskElement extends HTMLMaskElement{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return null!=this.input.selectionStart?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,t){this.input.setSelectionRange(e,t)}get value(){return this.input.value}set value(e){this.input.value=e}}IMask.HTMLMaskElement=HTMLMaskElement;class HTMLContenteditableMaskElement extends HTMLMaskElement{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,a=t&&t.focusOffset;return null==a||null==s||s<a?s:a}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,a=t&&t.focusOffset;return null==a||null==s||s>a?s:a}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,e),s.setEnd(this.input.lastChild||this.input,t);const a=this.rootElement,i=a.getSelection&&a.getSelection();i&&(i.removeAllRanges(),i.addRange(s))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}IMask.HTMLContenteditableMaskElement=HTMLContenteditableMaskElement;class InputHistory{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return 0===this.states.length}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>InputHistory.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}InputHistory.MAX_LENGTH=100;class InputMask{constructor(e,t){this.el=e instanceof MaskElement?e:e.isContentEditable&&"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?new HTMLContenteditableMaskElement(e):new HTMLInputMaskElement(e),this.masked=createMask(t),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new InputHistory,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(e){var t;return null==e||(null==(t=this.masked)?void 0:t.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof IMask.Masked)&&this.masked.constructor===maskedClass(e))return void this.masked.updateOptions({mask:e});const t=e instanceof IMask.Masked?e:createMask({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e,t){const s=this._listeners[e];s&&s.forEach(e=>e(t))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){this.el&&this.el.isActive&&(this.el.select(e,e),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(e){const t=this.masked.unmaskedValue,s=this.masked.value,a=this.masked.rawInputValue,i=this.displayValue,n=this.unmaskedValue!==t||this.value!==s||this._rawInputValue!==a;this._unmaskedValue=t,this._value=s,this._rawInputValue=a,this.el.value!==i&&(this.el.value=i),"auto"===e?this.alignCursor():null!=e&&(this.cursorPos=e),n&&this._fireChangeEvents(),this._historyChanging||!n&&!this.history.isEmpty||this.history.push({unmaskedValue:t,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:t,...s}=e,a=!this.maskEquals(t),i=this.masked.optionsIsChanged(s);a&&(this.mask=t),i&&this.masked.updateOptions(s),(a||i)&&this.updateControl()}updateCursor(e){null!=e&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,i.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return this;if(!t)return delete this._listeners[e],this;const s=this._listeners[e].indexOf(t);return s>=0&&this._listeners[e].splice(s,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const t=new ActionDetails({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,a=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,n=s===this.masked.rawInputValue?t.removeDirection:i.NONE;let u=this.masked.nearestInputPos(t.startChangePos+a,n);n!==i.NONE&&(u=this.masked.nearestInputPos(u,i.NONE)),this.updateControl(u),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}IMask.InputMask=InputMask;class ChangeDetails{static normalize(e){return Array.isArray(e)?e:[e,new ChangeDetails]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return Boolean(this.rawInserted)||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}IMask.ChangeDetails=ChangeDetails;class ContinuousTailDetails{constructor(e,t,s){void 0===e&&(e=""),void 0===t&&(t=0),this.value=e,this.from=t,this.stop=s}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||null!=e&&this.from>=e)return"";const t=this.value[0];return this.value=this.value.slice(1),t}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class Masked{constructor(e){this._value="",this._update({...Masked.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,t){void 0===t&&(t={input:!0}),this.reset(),this.append(e,t,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,t){return e}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),Math.min(this.displayValue.length,t-e)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),this.displayValue.slice(e,t)}extractTail(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),new ContinuousTailDetails(this.extractInput(e,t),e)}appendTail(e){return isString(e)&&(e=new ContinuousTailDetails(String(e))),e.appendTo(this)}_appendCharRaw(e,t){return e?(this._value+=e,new ChangeDetails({inserted:e,rawInserted:e})):new ChangeDetails}_appendChar(e,t,s){void 0===t&&(t={});const a=this.state;let i;if([e,i]=this.doPrepareChar(e,t),e&&(i=i.aggregate(this._appendCharRaw(e,t)),!i.rawInserted&&"pad"===this.autofix)){const s=this.state;this.state=a;let n=this.pad(t);const u=this._appendCharRaw(e,t);n=n.aggregate(u),u.rawInserted||n.equals(i)?i=n:this.state=s}if(i.inserted){let e,n=!1!==this.doValidate(t);if(n&&null!=s){const t=this.state;if(!0===this.overwrite){e=s.state;for(let e=0;e<i.rawInserted.length;++e)s.unshift(this.displayValue.length-i.tailShift)}let a=this.appendTail(s);if(n=a.rawInserted.length===s.toString().length,(!n||!a.inserted)&&"shift"===this.overwrite){this.state=t,e=s.state;for(let e=0;e<i.rawInserted.length;++e)s.shift();a=this.appendTail(s),n=a.rawInserted.length===s.toString().length}n&&a.inserted&&(this.state=t)}n||(i=new ChangeDetails,this.state=a,s&&e&&(s.state=e))}return i}_appendPlaceholder(){return new ChangeDetails}_appendEager(){return new ChangeDetails}append(e,t,s){if(!isString(e))throw new Error("value should be string");const a=isString(s)?new ContinuousTailDetails(String(s)):s;let i;null!=t&&t.tail&&(t._beforeTailState=this.state),[e,i]=this.doPrepare(e,t);for(let s=0;s<e.length;++s){const n=this._appendChar(e[s],t,a);if(!n.rawInserted&&!this.doSkipInvalid(e[s],t,a))break;i.aggregate(n)}return(!0===this.eager||"append"===this.eager)&&null!=t&&t.input&&e&&i.aggregate(this._appendEager()),null!=a&&(i.tailShift+=this.appendTail(a).tailShift),i}remove(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(t),new ChangeDetails}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const t=this.rawInputValue,s=this.value,a=e();return this.rawInputValue=t,this.value&&this.value!==s&&0===s.indexOf(this.value)&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,a}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const t=this.state,s=e(this);return this.state=t,delete this._isolated,s}doSkipInvalid(e,t,s){return Boolean(this.skipInvalid)}doPrepare(e,t){return void 0===t&&(t={}),ChangeDetails.normalize(this.prepare?this.prepare(e,this,t):e)}doPrepareChar(e,t){return void 0===t&&(t={}),ChangeDetails.normalize(this.prepareChar?this.prepareChar(e,this,t):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,t,s,a,n){void 0===s&&(s=""),void 0===a&&(a=i.NONE),void 0===n&&(n={input:!0});const u=e+t,r=this.extractTail(u),l=!0===this.eager||"remove"===this.eager;let o;l&&(a=forceDirection(a),o=this.extractInput(0,u,{raw:!0}));let h=e;const d=new ChangeDetails;if(a!==i.NONE&&(h=this.nearestInputPos(e,t>1&&0!==e&&!l?i.NONE:a),d.tailShift=h-e),d.aggregate(this.remove(h)),l&&a!==i.NONE&&o===this.rawInputValue)if(a===i.FORCE_LEFT){let e;while(o===this.rawInputValue&&(e=this.displayValue.length))d.aggregate(new ChangeDetails({tailShift:-1})).aggregate(this.remove(e-1))}else a===i.FORCE_RIGHT&&r.unshift();return d.aggregate(this.append(s,n,r))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!objectIncludes(this,e)}typedValueEquals(e){const t=this.typedValue;return e===t||Masked.EMPTY_VALUES.includes(e)&&Masked.EMPTY_VALUES.includes(t)||!!this.format&&this.format(e,this)===this.format(this.typedValue,this)}pad(e){return new ChangeDetails}}Masked.DEFAULTS={skipInvalid:!0},Masked.EMPTY_VALUES=[void 0,null,""],IMask.Masked=Masked;class ChunksTailDetails{constructor(e,t){void 0===e&&(e=[]),void 0===t&&(t=0),this.chunks=e,this.from=t}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=isString(e)?new ContinuousTailDetails(String(e)):e;const t=this.chunks[this.chunks.length-1],s=t&&(t.stop===e.stop||null==e.stop)&&e.from===t.from+t.toString().length;if(e instanceof ContinuousTailDetails)s?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof ChunksTailDetails){if(null==e.stop){let t;while(e.chunks.length&&null==e.chunks[0].stop)t=e.chunks.shift(),t.from+=e.from,this.extend(t)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof IMask.MaskedPattern)){const t=new ContinuousTailDetails(this.toString());return t.appendTo(e)}const t=new ChangeDetails;for(let s=0;s<this.chunks.length;++s){const a=this.chunks[s],i=e._mapPosToBlock(e.displayValue.length),n=a.stop;let u;if(null!=n&&(!i||i.index<=n)&&((a instanceof ChunksTailDetails||e._stops.indexOf(n)>=0)&&t.aggregate(e._appendPlaceholder(n)),u=a instanceof ChunksTailDetails&&e._blocks[n]),u){const s=u.appendTail(a);t.aggregate(s);const i=a.toString().slice(s.rawInserted.length);i&&t.aggregate(e.append(i,{tail:!0}))}else t.aggregate(e.append(a.toString(),{tail:!0}))}return t}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:t,...s}=e;Object.assign(this,s),this.chunks=t.map(e=>{const t="chunks"in e?new ChunksTailDetails:new ContinuousTailDetails;return t.state=e,t})}unshift(e){if(!this.chunks.length||null!=e&&this.from>=e)return"";const t=null!=e?e-this.from:e;let s=0;while(s<this.chunks.length){const e=this.chunks[s],a=e.unshift(t);if(e.toString()){if(!a)break;++s}else this.chunks.splice(s,1);if(a)return a}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;while(0<=e){const t=this.chunks[e],s=t.shift();if(t.toString()){if(!s)break;--e}else this.chunks.splice(e,1);if(s)return s}return""}}class PatternCursor{constructor(e,t){this.masked=e,this._log=[];const{offset:s,index:a}=e._mapPosToBlock(t)||(t<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=s,this.index=a,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null==(t=this.block)?void 0:t.displayValue.length)||0){var t;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,i.FORCE_LEFT),0!==this.offset||void 0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,i.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,i.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,i.FORCE_RIGHT),this.offset!==this.block.value.length||void 0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,i.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,i.NONE),!0})}}class PatternFixedDefinition{constructor(e){Object.assign(this,e),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(e,t){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(t),this._value||(this._isRawInput=!1),new ChangeDetails}nearestInputPos(e,t){void 0===t&&(t=i.NONE);const s=0,a=this._value.length;switch(t){case i.LEFT:case i.FORCE_LEFT:return s;case i.NONE:case i.RIGHT:case i.FORCE_RIGHT:default:return a}}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),this._isRawInput?t-e:0}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this._value.length),void 0===s&&(s={}),s.raw&&this._isRawInput&&this._value.slice(e,t)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(e,t){if(void 0===t&&(t={}),this.isFilled)return new ChangeDetails;const s=!0===this.eager||"append"===this.eager,a=this.char===e,i=a&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!s)&&!t.tail,n=new ChangeDetails({inserted:this.char,rawInserted:i?this.char:""});return this._value=this.char,this._isRawInput=i&&(t.raw||t.input),n}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new ChangeDetails;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new ContinuousTailDetails("")}appendTail(e){return isString(e)&&(e=new ContinuousTailDetails(String(e))),e.appendTo(this)}append(e,t,s){const a=this._appendChar(e[0],t);return null!=s&&(a.tailShift+=this.appendTail(s).tailShift),a}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=Boolean(e._rawInputValue)}pad(e){return this._appendPlaceholder()}}class PatternInputDefinition{constructor(e){const{parent:t,isOptional:s,placeholderChar:a,displayChar:i,lazy:n,eager:u,...r}=e;this.masked=createMask(r),Object.assign(this,{parent:t,isOptional:s,placeholderChar:a,displayChar:i,lazy:n,eager:u})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),0===e&&t>=1?(this.isFilled=!1,this.masked.remove(e,t)):new ChangeDetails}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return Boolean(this.masked.value)||this.isOptional}_appendChar(e,t){if(void 0===t&&(t={}),this.isFilled)return new ChangeDetails;const s=this.masked.state;let a=this.masked._appendChar(e,this.currentMaskFlags(t));return a.inserted&&!1===this.doValidate(t)&&(a=new ChangeDetails,this.masked.state=s),a.inserted||this.isOptional||this.lazy||t.input||(a.inserted=this.placeholderChar),a.skip=!a.inserted&&!this.isOptional,this.isFilled=Boolean(a.inserted),a}append(e,t,s){return this.masked.append(e,this.currentMaskFlags(t),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new ChangeDetails:(this.isFilled=!0,new ChangeDetails({inserted:this.placeholderChar}))}_appendEager(){return new ChangeDetails}extractTail(e,t){return this.masked.extractTail(e,t)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),this.masked.extractInput(e,t,s)}nearestInputPos(e,t){void 0===t&&(t=i.NONE);const s=0,a=this.value.length,n=Math.min(Math.max(e,s),a);switch(t){case i.LEFT:case i.FORCE_LEFT:return this.isComplete?n:s;case i.RIGHT:case i.FORCE_RIGHT:return this.isComplete?n:a;case i.NONE:default:return n}}totalInputPositions(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.value.length),this.value.slice(e,t).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var t;return{...e,_beforeTailState:(null==e||null==(t=e._beforeTailState)?void 0:t.masked)||(null==e?void 0:e._beforeTailState)}}pad(e){return new ChangeDetails}}PatternInputDefinition.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class MaskedRegExp extends Masked{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=e=>e.search(t)>=0),super._update(e)}}IMask.MaskedRegExp=MaskedRegExp;class MaskedPattern extends Masked{constructor(e){super({...MaskedPattern.DEFAULTS,...e,definitions:Object.assign({},PatternInputDefinition.DEFAULT_DEFINITIONS,null==e?void 0:e.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const t=this.mask;if(!t||!e)return;let s=!1,a=!1;for(let i=0;i<t.length;++i){if(this.blocks){const e=t.slice(i),s=Object.keys(this.blocks).filter(t=>0===e.indexOf(t));s.sort((e,t)=>t.length-e.length);const a=s[0];if(a){const{expose:e,repeat:t,...s}=normalizeOpts(this.blocks[a]),n={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...s,repeat:t,parent:this},u=null!=t?new IMask.RepeatBlock(n):createMask(n);u&&(this._blocks.push(u),e&&(this.exposeBlock=u),this._maskedBlocks[a]||(this._maskedBlocks[a]=[]),this._maskedBlocks[a].push(this._blocks.length-1)),i+=a.length-1;continue}}let n=t[i],u=n in e;if(n===MaskedPattern.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===n||"}"===n){s=!s;continue}if("["===n||"]"===n){a=!a;continue}if(n===MaskedPattern.ESCAPE_CHAR){if(++i,n=t[i],!n)break;u=!1}const r=u?new PatternInputDefinition({isOptional:a,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...normalizeOpts(e[n]),parent:this}):new PatternFixedDefinition({char:n,eager:this.eager,isUnmasking:s});this._blocks.push(r)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e)return void this.reset();const{_blocks:t,...s}=e;this._blocks.forEach((e,s)=>e.state=t[s]),super.state=s}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,t)=>e+t.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(t),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,t)=>e+t.value,"")}set value(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(t),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(t),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,t)=>e+t.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const t=new ChangeDetails;let s=null==(e=this._mapPosToBlock(this.displayValue.length))?void 0:e.index;if(null==s)return t;this._blocks[s].isFilled&&++s;for(let e=s;e<this._blocks.length;++e){const s=this._blocks[e]._appendEager();if(!s.inserted)break;t.aggregate(s)}return t}_appendCharRaw(e,t){void 0===t&&(t={});const s=this._mapPosToBlock(this.displayValue.length),a=new ChangeDetails;if(!s)return a;for(let n,u=s.index;n=this._blocks[u];++u){var i;const s=n._appendChar(e,{...t,_beforeTailState:null==(i=t._beforeTailState)||null==(i=i._blocks)?void 0:i[u]});if(a.aggregate(s),s.consumed)break}return a}extractTail(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=new ChunksTailDetails;return e===t||this._forEachBlocksInRange(e,t,(e,t,a,i)=>{const n=e.extractTail(a,i);n.stop=this._findStopBefore(t),n.from=this._blockStartPos(t),n instanceof ChunksTailDetails&&(n.blockIndex=t),s.extend(n)}),s}extractInput(e,t,s){if(void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),void 0===s&&(s={}),e===t)return"";let a="";return this._forEachBlocksInRange(e,t,(e,t,i,n)=>{a+=e.extractInput(i,n,s)}),a}_findStopBefore(e){let t;for(let s=0;s<this._stops.length;++s){const a=this._stops[s];if(!(a<=e))break;t=a}return t}_appendPlaceholder(e){const t=new ChangeDetails;if(this.lazy&&null==e)return t;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return t;const a=s.index,i=null!=e?e:this._blocks.length;return this._blocks.slice(a,i).forEach(s=>{var a;s.lazy&&null==e||t.aggregate(s._appendPlaceholder(null==(a=s._blocks)?void 0:a.length))}),t}_mapPosToBlock(e){let t="";for(let s=0;s<this._blocks.length;++s){const a=this._blocks[s],i=t.length;if(t+=a.displayValue,e<=t.length)return{index:s,offset:e-i}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((e,t)=>e+t.displayValue.length,0)}_forEachBlocksInRange(e,t,s){void 0===t&&(t=this.displayValue.length);const a=this._mapPosToBlock(e);if(a){const e=this._mapPosToBlock(t),i=e&&a.index===e.index,n=a.offset,u=e&&i?e.offset:this._blocks[a.index].displayValue.length;if(s(this._blocks[a.index],a.index,n,u),e&&!i){for(let t=a.index+1;t<e.index;++t)s(this._blocks[t],t,0,this._blocks[t].displayValue.length);s(this._blocks[e.index],e.index,0,e.offset)}}}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=super.remove(e,t);return this._forEachBlocksInRange(e,t,(e,t,a,i)=>{s.aggregate(e.remove(a,i))}),s}nearestInputPos(e,t){if(void 0===t&&(t=i.NONE),!this._blocks.length)return 0;const s=new PatternCursor(this,e);if(t===i.NONE)return s.pushRightBeforeInput()?s.pos:(s.popState(),s.pushLeftBeforeInput()?s.pos:this.displayValue.length);if(t===i.LEFT||t===i.FORCE_LEFT){if(t===i.LEFT){if(s.pushRightBeforeFilled(),s.ok&&s.pos===e)return e;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),t===i.LEFT){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=e)return s.pos;if(s.popState(),s.ok&&s.pos<=e)return s.pos;s.popState()}return s.ok?s.pos:t===i.FORCE_LEFT?0:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:0))}return t===i.RIGHT||t===i.FORCE_RIGHT?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:t===i.FORCE_RIGHT?this.displayValue.length:(s.popState(),s.ok?s.pos:(s.popState(),s.ok?s.pos:this.nearestInputPos(e,i.LEFT)))):e}totalInputPositions(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);let s=0;return this._forEachBlocksInRange(e,t,(e,t,a,i)=>{s+=e.totalInputPositions(a,i)}),s}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map(e=>this._blocks[e]):[]}pad(e){const t=new ChangeDetails;return this._forEachBlocksInRange(0,this.displayValue.length,s=>t.aggregate(s.pad(e))),t}}MaskedPattern.DEFAULTS={...Masked.DEFAULTS,lazy:!0,placeholderChar:"_"},MaskedPattern.STOP_CHAR="`",MaskedPattern.ESCAPE_CHAR="\\",MaskedPattern.InputDefinition=PatternInputDefinition,MaskedPattern.FixedDefinition=PatternFixedDefinition,IMask.MaskedPattern=MaskedPattern;class MaskedRange extends MaskedPattern{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:t=this.to||0,from:s=this.from||0,maxLength:a=this.maxLength||0,autofix:i=this.autofix,...n}=e;this.to=t,this.from=s,this.maxLength=Math.max(String(t).length,a),this.autofix=i;const u=String(this.from).padStart(this.maxLength,"0"),r=String(this.to).padStart(this.maxLength,"0");let l=0;while(l<r.length&&r[l]===u[l])++l;n.mask=r.slice(0,l).replace(/0/g,"\\0")+"0".repeat(this.maxLength-l),super._update(n)}get isComplete(){return super.isComplete&&Boolean(this.value)}boundaries(e){let t="",s="";const[,a,i]=e.match(/^(\D*)(\d*)(\D*)/)||[];return i&&(t="0".repeat(a.length)+i,s="9".repeat(a.length)+i),t=t.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[t,s]}doPrepareChar(e,t){let s;return void 0===t&&(t={}),[e,s]=super.doPrepareChar(e.replace(/\D/g,""),t),e||(s.skip=!this.isComplete),[e,s]}_appendCharRaw(e,t){if(void 0===t&&(t={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,t);const s=String(this.from).padStart(this.maxLength,"0"),a=String(this.to).padStart(this.maxLength,"0"),[i,n]=this.boundaries(this.value+e);return Number(n)<this.from?super._appendCharRaw(s[this.value.length],t):Number(i)>this.to?!t.tail&&"pad"===this.autofix&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],t).aggregate(this._appendCharRaw(e,t)):super._appendCharRaw(a[this.value.length],t):super._appendCharRaw(e,t)}doValidate(e){const t=this.value,s=t.search(/[^0]/);if(-1===s&&t.length<=this._matchFrom)return!0;const[a,i]=this.boundaries(t);return this.from<=Number(i)&&Number(a)<=this.to&&super.doValidate(e)}pad(e){const t=new ChangeDetails;if(this.value.length===this.maxLength)return t;const s=this.value,a=this.maxLength-this.value.length;if(a){this.reset();for(let s=0;s<a;++s)t.aggregate(super._appendCharRaw("0",e));s.split("").forEach(e=>this._appendCharRaw(e))}return t}}IMask.MaskedRange=MaskedRange;const r="d{.}`m{.}`Y";class MaskedDate extends MaskedPattern{static extractPatternOptions(e){const{mask:t,pattern:s,...a}=e;return{...a,mask:isString(t)?t:s}}constructor(e){super(MaskedDate.extractPatternOptions({...MaskedDate.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:t,pattern:s,blocks:a,...i}={...MaskedDate.DEFAULTS,...e},n=Object.assign({},MaskedDate.GET_DEFAULT_BLOCKS());e.min&&(n.Y.from=e.min.getFullYear()),e.max&&(n.Y.to=e.max.getFullYear()),e.min&&e.max&&n.Y.from===n.Y.to&&(n.m.from=e.min.getMonth()+1,n.m.to=e.max.getMonth()+1,n.m.from===n.m.to&&(n.d.from=e.min.getDate(),n.d.to=e.max.getDate())),Object.assign(n,this.blocks,a),super._update({...i,mask:isString(t)?t:s,blocks:n})}doValidate(e){const t=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&null!=t&&(null==this.min||this.min<=t)&&(null==this.max||t<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(MaskedDate.extractPatternOptions(e))}}MaskedDate.GET_DEFAULT_BLOCKS=()=>({d:{mask:MaskedRange,from:1,to:31,maxLength:2},m:{mask:MaskedRange,from:1,to:12,maxLength:2},Y:{mask:MaskedRange,from:1900,to:9999}}),MaskedDate.DEFAULTS={...MaskedPattern.DEFAULTS,mask:Date,pattern:r,format:(e,t)=>{if(!e)return"";const s=String(e.getDate()).padStart(2,"0"),a=String(e.getMonth()+1).padStart(2,"0"),i=e.getFullYear();return[s,a,i].join(".")},parse:(e,t)=>{const[s,a,i]=e.split(".").map(Number);return new Date(i,a-1,s)}},IMask.MaskedDate=MaskedDate;class MaskedDynamic extends Masked{constructor(e){super({...MaskedDynamic.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(e=>{const{expose:t,...s}=normalizeOpts(e),a=createMask({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return t&&(this.exposeMask=a),a}):[])}_appendCharRaw(e,t){void 0===t&&(t={});const s=this._applyDispatch(e,t);return this.currentMask&&s.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),s}_applyDispatch(e,t,s){void 0===e&&(e=""),void 0===t&&(t={}),void 0===s&&(s="");const a=t.tail&&null!=t._beforeTailState?t._beforeTailState._value:this.value,i=this.rawInputValue,n=t.tail&&null!=t._beforeTailState?t._beforeTailState._rawInputValue:i,u=i.slice(n.length),r=this.currentMask,l=new ChangeDetails,o=null==r?void 0:r.state;return this.currentMask=this.doDispatch(e,{...t},s),this.currentMask&&(this.currentMask!==r?(this.currentMask.reset(),n&&(this.currentMask.append(n,{raw:!0}),l.tailShift=this.currentMask.value.length-a.length),u&&(l.tailShift+=this.currentMask.append(u,{raw:!0,tail:!0}).tailShift)):o&&(this.currentMask.state=o)),l}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const t=new ChangeDetails;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,s;return{...e,_beforeTailState:(null==(t=e._beforeTailState)?void 0:t.currentMaskRef)===this.currentMask&&(null==(s=e._beforeTailState)?void 0:s.currentMask)||e._beforeTailState}}doDispatch(e,t,s){return void 0===t&&(t={}),void 0===s&&(s=""),this.dispatch(e,this,t,s)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,t){void 0===t&&(t={});let[s,a]=super.doPrepare(e,t);if(this.currentMask){let e;[s,e]=super.doPrepare(s,this.currentMaskFlags(t)),a=a.aggregate(e)}return[s,a]}doPrepareChar(e,t){void 0===t&&(t={});let[s,a]=super.doPrepareChar(e,t);if(this.currentMask){let e;[s,e]=super.doPrepareChar(s,this.currentMaskFlags(t)),a=a.aggregate(e)}return[s,a]}reset(){var e;null==(e=this.currentMask)||e.reset(),this.compiledMasks.forEach(e=>e.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask)return this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,void this._applyDispatch();let t=String(e);this.currentMask&&(this.currentMask.typedValue=e,t=this.currentMask.unmaskedValue),this.unmaskedValue=t}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return Boolean(null==(e=this.currentMask)?void 0:e.isComplete)}get isFilled(){var e;return Boolean(null==(e=this.currentMask)?void 0:e.isFilled)}remove(e,t){const s=new ChangeDetails;return this.currentMask&&s.aggregate(this.currentMask.remove(e,t)).aggregate(this._applyDispatch()),s}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(e=>e.state),currentMaskRef:this.currentMask,currentMask:null==(e=this.currentMask)?void 0:e.state}}set state(e){const{compiledMasks:t,currentMaskRef:s,currentMask:a,...i}=e;t&&this.compiledMasks.forEach((e,s)=>e.state=t[s]),null!=s&&(this.currentMask=s,this.currentMask.state=a),super.state=i}extractInput(e,t,s){return this.currentMask?this.currentMask.extractInput(e,t,s):""}extractTail(e,t){return this.currentMask?this.currentMask.extractTail(e,t):super.extractTail(e,t)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,t){return this.currentMask?this.currentMask.nearestInputPos(e,t):super.nearestInputPos(e,t)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every((t,s)=>{if(!e[s])return;const{mask:a,...i}=e[s];return objectIncludes(t,i)&&t.maskEquals(a)}):super.maskEquals(e)}typedValueEquals(e){var t;return Boolean(null==(t=this.currentMask)?void 0:t.typedValueEquals(e))}}MaskedDynamic.DEFAULTS={...Masked.DEFAULTS,dispatch:(e,t,s,a)=>{if(!t.compiledMasks.length)return;const n=t.rawInputValue,u=t.compiledMasks.map((u,r)=>{const l=t.currentMask===u,o=l?u.displayValue.length:u.nearestInputPos(u.displayValue.length,i.FORCE_LEFT);return u.rawInputValue!==n?(u.reset(),u.append(n,{raw:!0})):l||u.remove(o),u.append(e,t.currentMaskFlags(s)),u.appendTail(a),{index:r,weight:u.rawInputValue.length,totalInputPositions:u.totalInputPositions(0,Math.max(o,u.nearestInputPos(u.displayValue.length,i.FORCE_LEFT)))}});return u.sort((e,t)=>t.weight-e.weight||t.totalInputPositions-e.totalInputPositions),t.compiledMasks[u[0].index]}},IMask.MaskedDynamic=MaskedDynamic;class MaskedEnum extends MaskedPattern{constructor(e){super({...MaskedEnum.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:t,...s}=e;if(t){const e=t.map(e=>e.length),a=Math.min(...e),i=Math.max(...e)-a;s.mask="*".repeat(a),i&&(s.mask+="["+"*".repeat(i)+"]"),this.enum=t}super._update(s)}_appendCharRaw(e,t){void 0===t&&(t={});const s=Math.min(this.nearestInputPos(0,i.FORCE_RIGHT),this.value.length),a=this.enum.filter(t=>this.matchValue(t,this.unmaskedValue+e,s));if(a.length){1===a.length&&this._forEachBlocksInRange(0,this.value.length,(e,s)=>{const i=a[0][s];s>=this.value.length||i===e.value||(e.reset(),e._appendChar(i,t))});const e=super._appendCharRaw(a[0][this.value.length],t);return 1===a.length&&a[0].slice(this.unmaskedValue.length).split("").forEach(t=>e.aggregate(super._appendCharRaw(t))),e}return new ChangeDetails({skip:!this.isComplete})}extractTail(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),new ContinuousTailDetails("",e)}remove(e,t){if(void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),e===t)return new ChangeDetails;const s=Math.min(super.nearestInputPos(0,i.FORCE_RIGHT),this.value.length);let a;for(a=e;a>=0;--a){const e=this.enum.filter(e=>this.matchValue(e,this.value.slice(s,a),s));if(e.length>1)break}const n=super.remove(a,t);return n.tailShift+=a-e,n}get isComplete(){return this.enum.indexOf(this.value)>=0}}MaskedEnum.DEFAULTS={...MaskedPattern.DEFAULTS,matchValue:(e,t,s)=>e.indexOf(t,s)===s},IMask.MaskedEnum=MaskedEnum;class MaskedFunction extends Masked{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}var l;IMask.MaskedFunction=MaskedFunction;class MaskedNumber extends Masked{constructor(e){super({...MaskedNumber.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),t="\\d*",s=(this.scale?"("+escapeRegExp(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+t+s),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(escapeRegExp).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(escapeRegExp(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const t=e.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepareChar(e,t){void 0===t&&(t={});const[s,a]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(t.input&&t.raw||!t.input&&!t.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),t);return e&&!s&&(a.skip=!0),!s||this.allowPositive||this.value||"-"===s||a.aggregate(this._appendChar("-")),[s,a]}_separatorsCount(e,t){void 0===t&&(t=!1);let s=0;for(let a=0;a<e;++a)this._value.indexOf(this.thousandsSeparator,a)===a&&(++s,t&&(e+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(e){return void 0===e&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,t,s){return void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t),this._removeThousandsSeparators(super.extractInput(e,t,s))}_appendCharRaw(e,t){void 0===t&&(t={});const s=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,a=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const i=this._value;this._value+=e;const n=this.number;let u,r=!isNaN(n),l=!1;if(r){let e;null!=this.min&&this.min<0&&this.number<this.min&&(e=this.min),null!=this.max&&this.max>0&&this.number>this.max&&(e=this.max),null!=e&&(this.autofix?(this._value=this.format(e,this).replace(MaskedNumber.UNMASKED_RADIX,this.radix),l||(l=i===this._value&&!t.tail)):r=!1),r&&(r=Boolean(this._value.match(this._numberRegExp)))}r?u=new ChangeDetails({inserted:this._value.slice(i.length),rawInserted:l?"":e,skip:l}):(this._value=i,u=new ChangeDetails),this._value=this._insertThousandsSeparators(this._value);const o=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(o);return u.tailShift+=(h-a)*this.thousandsSeparator.length,u}_findSeparatorAround(e){if(this.thousandsSeparator){const t=e-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,t);if(s<=e)return s}return-1}_adjustRangeWithSeparators(e,t){const s=this._findSeparatorAround(e);s>=0&&(e=s);const a=this._findSeparatorAround(t);return a>=0&&(t=a+this.thousandsSeparator.length),[e,t]}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t);const s=this.value.slice(0,e),a=this.value.slice(t),i=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+a));const n=this._separatorsCountFromSlice(s);return new ChangeDetails({tailShift:(n-i)*this.thousandsSeparator.length})}nearestInputPos(e,t){if(!this.thousandsSeparator)return e;switch(t){case i.NONE:case i.LEFT:case i.FORCE_LEFT:{const s=this._findSeparatorAround(e-1);if(s>=0){const a=s+this.thousandsSeparator.length;if(e<a||this.value.length<=a||t===i.FORCE_LEFT)return s}break}case i.RIGHT:case i.FORCE_RIGHT:{const t=this._findSeparatorAround(e);if(t>=0)return t+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let t=e;null!=this.min&&(t=Math.max(t,this.min)),null!=this.max&&(t=Math.min(t,this.max)),t!==e&&(this.unmaskedValue=this.format(t,this));let s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&this.scale>0&&(s=this._padFractionalZeros(s)),this._value=s}super.doCommit()}_normalizeZeros(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,(e,t,s,a)=>t+a),e.length&&!/\d$/.test(t[0])&&(t[0]=t[0]+"0"),t.length>1&&(t[1]=t[1].replace(/0*$/,""),t[1].length||(t.length=1)),this._insertThousandsSeparators(t.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const t=e.split(this.radix);return t.length<2&&t.push(""),t[1]=t[1].padEnd(this.scale,"0"),t.join(this.radix)}doSkipInvalid(e,t,s){void 0===t&&(t={});const a=0===this.scale&&e!==this.thousandsSeparator&&(e===this.radix||e===MaskedNumber.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,t,s)&&!a}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,MaskedNumber.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(MaskedNumber.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}get allowNegative(){return null!=this.min&&this.min<0||null!=this.max&&this.max<0}get allowPositive(){return null!=this.min&&this.min>0||null!=this.max&&this.max>0}typedValueEquals(e){return(super.typedValueEquals(e)||MaskedNumber.EMPTY_VALUES.includes(e)&&MaskedNumber.EMPTY_VALUES.includes(this.typedValue))&&!(0===e&&""===this.value)}}l=MaskedNumber,MaskedNumber.UNMASKED_RADIX=".",MaskedNumber.EMPTY_VALUES=[...Masked.EMPTY_VALUES,0],MaskedNumber.DEFAULTS={...Masked.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[l.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:e=>e.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},IMask.MaskedNumber=MaskedNumber;const o={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function createPipe(e,t,s){void 0===t&&(t=o.MASKED),void 0===s&&(s=o.MASKED);const a=createMask(e);return e=>a.runIsolated(a=>(a[t]=e,a[s]))}function pipe(e,t,s,a){return createPipe(t,s,a)(e)}IMask.PIPE_TYPE=o,IMask.createPipe=createPipe,IMask.pipe=pipe;class RepeatBlock extends MaskedPattern{get repeatFrom(){var e;return null!=(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)?e:0}get repeatTo(){var e;return null!=(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var t,s,a;const{repeat:i,...n}=normalizeOpts(e);this._blockOpts=Object.assign({},this._blockOpts,n);const u=createMask(this._blockOpts);this.repeat=null!=(t=null!=(s=null!=i?i:u.repeat)?s:this.repeat)?t:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&(null==(a=this._blocks)?void 0:a.length)||0,this.repeatFrom)),blocks:{m:u},eager:u.eager,overwrite:u.overwrite,skipInvalid:u.skipInvalid,lazy:u.lazy,placeholderChar:u.placeholderChar,displayChar:u.displayChar})}_allocateBlock(e){return e<this._blocks.length?this._blocks[e]:this.repeatTo===1/0||this._blocks.length<this.repeatTo?(this._blocks.push(createMask(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]):void 0}_appendCharRaw(e,t){void 0===t&&(t={});const s=new ChangeDetails;for(let r,l,o=null!=(a=null==(i=this._mapPosToBlock(this.displayValue.length))?void 0:i.index)?a:Math.max(this._blocks.length-1,0);r=null!=(n=this._blocks[o])?n:l=!l&&this._allocateBlock(o);++o){var a,i,n,u;const h=r._appendChar(e,{...t,_beforeTailState:null==(u=t._beforeTailState)||null==(u=u._blocks)?void 0:u[o]});if(h.skip&&l){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(s.aggregate(h),h.consumed)break}return s}_trimEmptyTail(e,t){var s,a;void 0===e&&(e=0);const i=Math.max((null==(s=this._mapPosToBlock(e))?void 0:s.index)||0,this.repeatFrom,0);let n;null!=t&&(n=null==(a=this._mapPosToBlock(t))?void 0:a.index),null==n&&(n=this._blocks.length-1);let u=0;for(let e=n;i<=e;--e,++u)if(this._blocks[e].unmaskedValue)break;u&&(this._blocks.splice(n-u+1,u),this.mask=this.mask.slice(u))}reset(){super.reset(),this._trimEmptyTail()}remove(e,t){void 0===e&&(e=0),void 0===t&&(t=this.displayValue.length);const s=super.remove(e,t);return this._trimEmptyTail(e,t),s}totalInputPositions(e,t){return void 0===e&&(e=0),null==t&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,t)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}}IMask.RepeatBlock=RepeatBlock;try{globalThis.IMask=IMask}catch{}var h=__webpack_require__(2380),d=!0,p=void 0;var c={mask:void 0,prepare:Function,prepareChar:Function,validate:Function,commit:Function,overwrite:{type:Boolean,required:!1,default:void 0},eager:{required:!1,default:void 0,validator:e=>["append","remove"].includes(e)||"boolean"===typeof e},skipInvalid:{type:Boolean,required:!1,default:void 0},placeholderChar:String,displayChar:String,lazy:{type:Boolean,required:!1,default:void 0},definitions:Object,blocks:Object,enum:Array,maxLength:Number,from:Number,to:Number,pattern:String,format:Function,parse:Function,autofix:{required:!1,default:void 0,validator:e=>"pad"===e||"boolean"===typeof e},radix:String,thousandsSeparator:String,mapToRadix:Array,scale:Number,normalizeZeros:{type:Boolean,required:!1,default:void 0},padFractionalZeros:{type:Boolean,required:!1,default:void 0},min:[Number,Date],max:[Number,Date],dispatch:Function};function useIMask(e,t){let{emit:s,onAccept:a,onComplete:i,defaultValue:n,defaultUnmaskedValue:u,defaultTypedValue:r}=void 0===t?{}:t;const l=(0,h.isRef)(e)?e:(0,h.ref)(e),o=(0,h.ref)(),d=(0,h.ref)(),p=(0,h.ref)(""),c=(0,h.ref)(""),k=(0,h.ref)();let m,g=p.value,_=c.value,v=k.value;function storeLastAcceptedValues(){v=k.value=d.value.typedValue,_=c.value=d.value.unmaskedValue,g=p.value=d.value.value}function _onAccept(e){storeLastAcceptedValues(),s&&(s("accept",p.value,e),s("accept:masked",p.value,e),s("accept:typed",k.value,e),s("accept:unmasked",c.value,e)),null==a||a(e)}function _onComplete(e){s&&(s("complete",d.value.value,e),s("complete:masked",d.value.value,e),s("complete:typed",d.value.typedValue,e),s("complete:unmasked",d.value.unmaskedValue,e)),null==i||i(e)}const updateUnmaskedValue=()=>{d.value&&void 0!==c.value&&(_!==c.value&&(d.value.unmaskedValue=c.value,d.value.unmaskedValue!==c.value&&_onAccept()),_=void 0)};(0,h.watch)(c,updateUnmaskedValue);const updateMaskedValue=()=>{d.value&&void 0!==p.value&&(g!==p.value&&(d.value.value=p.value,d.value.value!==p.value&&_onAccept()),g=void 0)};(0,h.watch)(p,updateMaskedValue);const updateTypedValue=()=>{d.value&&void 0!==k.value&&(v!==k.value&&(d.value.typedValue=k.value,d.value.masked.typedValueEquals(k.value)||_onAccept()),v=void 0)};function _initMask(){m=o.value;const e=l.value;m&&null!=e&&e.mask&&(d.value=IMask(m,e),void 0!==n&&(p.value=n),void 0!==u&&(c.value=u),void 0!==r&&(k.value=r),updateUnmaskedValue(),updateMaskedValue(),updateTypedValue(),storeLastAcceptedValues(),d.value.on("accept",_onAccept).on("complete",_onComplete))}function _destroyMask(){var e;null==(e=d.value)||e.destroy(),d.value=void 0}return(0,h.watch)(k,updateTypedValue),(0,h.onMounted)(_initMask),(0,h.onUnmounted)(_destroyMask),(0,h.watch)([o,l],()=>{const e=o.value,t=l.value;null!=t&&t.mask&&e===m||_destroyMask(),e&&(d.value?d.value.updateOptions(t):_initMask())}),{el:o,mask:(0,h.readonly)(d),masked:p,unmasked:c,typed:k}}function extractOptionsFromProps(e,t){return e={...e},Object.keys(e).forEach(s=>{(void 0===e[s]||t.includes(s))&&delete e[s]}),e}const k=["typed","unmasked","value","modelValue"];var m=(0,h.defineComponent)({name:"imask-input",inheritAttrs:!1,props:{modelValue:String,value:String,unmasked:String,typed:{validator:()=>!0},...c},emits:["update:modelValue","update:masked","update:value","update:unmasked","update:typed","accept","accept:value","accept:masked","accept:unmasked","accept:typed","complete","complete:value","complete:masked","complete:unmasked","complete:typed"],setup(e,t){let{attrs:s,emit:a}=t;const{el:i,mask:n,masked:u,unmasked:r,typed:l}=useIMask(extractOptionsFromProps(e,k),{emit:a,onAccept:e=>{const t=u.value;a("accept:value",t,e),a("update:value",t,e),a("update:masked",t,e),a("update:modelValue",t,e),a("update:unmasked",r.value,e),a("update:typed",l.value,e)},onComplete:e=>{a("complete:value",u.value,e)}}),o=(0,h.toRef)(e,"value"),d=(0,h.toRef)(e,"modelValue"),p=(0,h.toRef)(e,"unmasked"),c=(0,h.toRef)(e,"typed");return u.value=d.value||o.value||"",r.value=p.value||"",l.value=c.value,(0,h.watch)(o,e=>u.value=e),(0,h.watch)(d,e=>u.value=e),(0,h.watch)(p,e=>r.value=e),(0,h.watch)(c,e=>l.value=e),()=>{const t={...s,value:null!=e.value?e.value:null!=e.modelValue?e.modelValue:n.value?n.value.displayValue:"",ref:i};return e.mask||(t.onInput=e=>{a("update:modelValue",e.target.value),a("update:value",e.target.value)}),(0,h.h)("input",t)}}}),g=null==p?void 0:p.extend({name:"imask-input",data(){return{}},render(e){const t={domProps:{value:this.maskRef?this.maskRef.value:this.value},on:{...this.$listeners}};return this.$props.mask?delete t.on.input:t.on.input=e=>this.$emit("input",e.target.value),e("input",t)},mounted(){this.$props.mask&&this._initMask()},destroyed(){this._destroyMask()},computed:{maskOptions(){return extractOptionsFromProps(this.$props,["value","unmask"])}},watch:{$props:{handler(e){const t=this.maskOptions;t.mask?this.maskRef?(this.maskRef.updateOptions(t),"value"in e&&this._updateValue()):(this._initMask(t),e.value!==this._maskValue()&&this._onAccept()):(this._destroyMask(),"value"in e&&(this.$el.value=e.value))},deep:!0}},methods:{_maskValue(){var e,t,s;return"typed"===this.unmask?null==(e=this.maskRef)?void 0:e.typedValue:this.unmask?null==(t=this.maskRef)?void 0:t.unmaskedValue:null==(s=this.maskRef)?void 0:s.value},_updateValue(){if(!this.maskRef)return;const e=null==this.value&&"typed"!==this.unmask?"":this.value;"typed"===this.unmask?this.maskRef.typedValue=e:this.unmask?this.maskRef.unmaskedValue=e:this.maskRef.value=e},_onAccept(){const e=this._maskValue();this.$emit("input",e),this.$emit("accept",e)},_onComplete(){this.$emit("complete",this._maskValue())},_initMask(e){e||(e=this.maskOptions),this.maskRef=IMask(this.$el,e).on("accept",this._onAccept.bind(this)).on("complete",this._onComplete.bind(this)),this._updateValue()},_destroyMask(){this.maskRef&&(this.maskRef.destroy(),delete this.maskRef)}},props:{value:{},unmask:{validator:e=>"typed"===e||"boolean"===typeof e},...c}}),_=d?m:g,v={name:"imask",[d?"beforeMount":"bind"]:(e,t)=>{let{value:s}=t;s&&initMask(e,s)},[d?"updated":"update"]:(e,t)=>{let{value:s}=t;s?e.maskRef?(e.maskRef.updateOptions(s),e.value!==e.maskRef.value&&e.maskRef._onChange()):initMask(e,s):destroyMask(e)},[d?"unmounted":"unbind"]:e=>{destroyMask(e)}};function fireEvent(e,t,s){const a=document.createEvent("CustomEvent");a.initCustomEvent(t,!0,!0,s),e.dispatchEvent(a)}function initMask(e,t){e.maskRef=IMask(e,t).on("accept",()=>fireEvent(e,"accept",e.maskRef)).on("complete",()=>fireEvent(e,"complete",e.maskRef))}function destroyMask(e){e.maskRef&&(e.maskRef.destroy(),delete e.maskRef)}return a})());
|