wulf.js 1.9.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +75 -7
  2. package/changelog.md +21 -0
  3. package/dist/focus-trap.cjs.js +430 -0
  4. package/dist/focus-trap.cjs.js.map +7 -0
  5. package/dist/focus-trap.esm.js +407 -0
  6. package/dist/focus-trap.esm.js.map +7 -0
  7. package/dist/focus-trap.global.js +433 -0
  8. package/dist/focus-trap.global.js.map +7 -0
  9. package/dist/focus-trap.global.min.js +6 -0
  10. package/dist/focus-trap.global.min.js.map +7 -0
  11. package/dist/index.cjs.js +590 -8
  12. package/dist/index.cjs.js.map +3 -3
  13. package/dist/index.esm.js +590 -8
  14. package/dist/index.esm.js.map +3 -3
  15. package/dist/index.global.js +590 -8
  16. package/dist/index.global.js.map +3 -3
  17. package/dist/index.global.min.js +4 -1
  18. package/dist/index.global.min.js.map +4 -4
  19. package/dist/mask.cjs.js +106 -2
  20. package/dist/mask.cjs.js.map +3 -3
  21. package/dist/mask.esm.js +106 -2
  22. package/dist/mask.esm.js.map +3 -3
  23. package/dist/mask.global.js +106 -2
  24. package/dist/mask.global.js.map +3 -3
  25. package/dist/mask.global.min.js +4 -1
  26. package/dist/mask.global.min.js.map +4 -4
  27. package/dist/masonry.cjs.js +78 -3
  28. package/dist/masonry.cjs.js.map +3 -3
  29. package/dist/masonry.esm.js +78 -3
  30. package/dist/masonry.esm.js.map +3 -3
  31. package/dist/masonry.global.js +78 -3
  32. package/dist/masonry.global.js.map +3 -3
  33. package/dist/masonry.global.min.js +4 -1
  34. package/dist/masonry.global.min.js.map +4 -4
  35. package/dist/scroll.cjs.js +78 -3
  36. package/dist/scroll.cjs.js.map +3 -3
  37. package/dist/scroll.esm.js +78 -3
  38. package/dist/scroll.esm.js.map +3 -3
  39. package/dist/scroll.global.js +78 -3
  40. package/dist/scroll.global.js.map +3 -3
  41. package/dist/scroll.global.min.js +4 -1
  42. package/dist/scroll.global.min.js.map +4 -4
  43. package/dist/toast.cjs.js +91 -2
  44. package/dist/toast.cjs.js.map +3 -3
  45. package/dist/toast.esm.js +91 -2
  46. package/dist/toast.esm.js.map +3 -3
  47. package/dist/toast.global.js +91 -2
  48. package/dist/toast.global.js.map +3 -3
  49. package/dist/toast.global.min.js +4 -1
  50. package/dist/toast.global.min.js.map +4 -4
  51. package/dist/types/common/AuditableComponent.d.ts +45 -0
  52. package/dist/types/common/LocalizedComponent.d.ts +3 -2
  53. package/dist/types/focus-trap/FocusTrap.d.ts +64 -0
  54. package/dist/types/focus-trap/index.d.ts +3 -0
  55. package/dist/types/focus-trap/types.d.ts +45 -0
  56. package/dist/types/index.d.ts +3 -0
  57. package/dist/types/mask/BaseInputMask.d.ts +14 -1
  58. package/dist/types/mask/InputMask.d.ts +1 -0
  59. package/dist/types/mask/types.d.ts +5 -2
  60. package/dist/types/masonry/Masonry.d.ts +7 -0
  61. package/dist/types/masonry/types.d.ts +7 -2
  62. package/dist/types/scroll/ScrollBlock.d.ts +7 -0
  63. package/dist/types/scroll/types.d.ts +3 -2
  64. package/dist/types/toast/Toast.d.ts +3 -0
  65. package/dist/types/toast/ToastInstance.d.ts +9 -1
  66. package/dist/types/toast/types.d.ts +3 -2
  67. package/package.json +9 -3
@@ -1,3 +1,6 @@
1
- "use strict";var Wulf=(()=>{var N=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var $=(v,e)=>{for(var t in e)N(v,t,{get:e[t],enumerable:!0})},G=(v,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of U(e))!W.call(v,n)&&n!==t&&N(v,n,{get:()=>e[n],enumerable:!(i=K(e,n))||i.enumerable});return v};var z=v=>G(N({},"__esModule",{value:!0}),v);var Z={};$(Z,{AmountEngine:()=>x,BaseInputMask:()=>M,EmailEngine:()=>O,InputAmountMask:()=>V,InputEmailMask:()=>P,InputMask:()=>R,Mask:()=>F,MaskEngine:()=>A,MaskHistory:()=>C,MaskKeyboard:()=>D,default:()=>_,resolveMaskConstructorArgs:()=>T});function T(v,e,t){return e&&typeof e=="object"&&"tagName"in e&&e.tagName==="INPUT"?{wrapper:v||null,input:e,options:t||{}}:{wrapper:null,input:v,options:e&&typeof e=="object"&&!("tagName"in e)?e:{}}}var M=class{constructor(e,t,i){this.ghost=null;this.isWrapperCreated=!1;this.isDestroyed=!1;this.isFocused=!1;this.isDispatchingNativeInput=!1;this.lastTrackedValue="";this.nativeValueDescriptor=null;this.onCutHandler=()=>{};this.mutationObserver=null;this.focusSelectTimerId=null;this.onBaseCopy=e=>{if(!this.options.copyRaw||this.options.disabled||this.input.type==="password")return;let t=this.input.selectionStart??0,i=this.input.selectionEnd??t,n="";t!==i?n=this.extractRawSnippet(this.input.value.slice(t,i)):n=this.getRawValue(),n&&e.clipboardData&&(e.preventDefault(),e.clipboardData.setData("text/plain",n))};this.onBaseFocus=()=>{this.isFocused=!0,this.options.selectAllOnFocus&&this.input.value.length>0&&(this.focusSelectTimerId!==null&&clearTimeout(this.focusSelectTimerId),this.focusSelectTimerId=window.setTimeout(()=>{this.focusSelectTimerId=null,!this.isDestroyed&&document.activeElement===this.input&&this.input.select()},0))};this.onBaseBlur=()=>{this.isFocused=!1};this.onScroll=()=>{this.ghost&&(this.ghost.scrollLeft=this.input.scrollLeft)};let{wrapper:n,input:o,options:s}=T(e,t,i);if(!o||typeof o!="object"||o.nodeType!==1||o.tagName!=="INPUT")throw new Error(`[${new.target.name||"InputMask"}] input (HTMLInputElement) est requis.`);this.input=o;let r=this.input.getAttribute("data-mask-create-wrapper")==="true",a=!!(s.createWrapper??r),u=n;if(!u&&a){let b=document.createElement("span");b.className="wulf-mask-wrapper",b.style.display="inline-grid",b.style.gridTemplateColumns="1fr",b.style.gridTemplateRows="1fr",b.style.verticalAlign="middle",b.style.boxSizing="border-box",b.style.position="relative",this.input.parentNode&&this.input.parentNode.insertBefore(b,this.input),b.appendChild(this.input),this.input.style.gridArea="1 / 1 / 2 / 2",this.input.style.boxSizing="border-box",u=b,this.isWrapperCreated=!0}if(!u)throw new Error(`[${new.target.name||"InputMask"}] wrapper (HTMLElement) et input (HTMLInputElement) sont requis, ou activez l'option createWrapper: true.`);this.wrapper=u,this.normalizeInputType();let d=this.getAttr("data-mask-focus-only")==="true",g=this.hasAttr("data-disabled"),l=this.getAttr("data-mask-select-on-focus")==="true",c=this.getAttr("data-mask-copy-raw")==="true",h=this.getAttr("data-mask-align")||this.getAttr("data-align"),{disabled:p,align:m,...f}=s,y=p!==void 0?p:!!g,k=this.input.type==="password";this.options={...f,createWrapper:a,showMaskOnFocus:s.showMaskOnFocus??d??!1,selectAllOnFocus:s.selectAllOnFocus??l??!1,copyRaw:k?!1:s.copyRaw??c??!1,disabled:y,align:m??(h||void 0),emitNativeInput:s.emitNativeInput??!0},this.options.showMaskOnFocus&&this.wrapper.classList.add("mask-focus-only"),this.options.disabled&&this.wrapper.setAttribute("data-disabled","true"),this.options.align&&this.setAlign(this.options.align),this.createGhost(),this.hookValueProperty(),this.bindBaseEvents(),this.initMutationObserver()}getAttr(e){return this.input.getAttribute(e)||this.wrapper.getAttribute(e)}hasAttr(e){return this.wrapper.hasAttribute(e)||this.input.hasAttribute(e)}hasNativePlaceholder(){return!!(this.input.placeholder&&this.input.placeholder.trim().length>0)}shouldHideGhostForPlaceholder(e){return!this.isFocused&&e&&this.hasNativePlaceholder()}bindBaseEvents(){this.input.addEventListener("copy",this.onBaseCopy),this.input.addEventListener("focus",this.onBaseFocus),this.input.addEventListener("blur",this.onBaseBlur)}extractRawSnippet(e){return e}initMutationObserver(){if(typeof MutationObserver>"u")return;this.mutationObserver=new MutationObserver(t=>{for(let i of t)i.type==="attributes"&&i.attributeName&&this.handleAttributeMutation(i.attributeName)});let e={attributes:!0,attributeFilter:["data-mask","data-mask-placeholder","data-mask-focus-only","data-mask-strict","data-mask-select-on-focus","data-mask-copy-raw","data-mask-pad-decimals","data-mask-auto-lowercase","data-mask-cycle-suggestions","data-mask-default-tld","data-mask-tlds","data-disabled","data-mask-align","data-align","placeholder"]};this.mutationObserver.observe(this.wrapper,e),this.input!==this.wrapper&&this.mutationObserver.observe(this.input,e)}setAlign(e){let t=e||void 0,i=this.wrapper.getAttribute("data-align");this.options.align===t&&i===(e||null)||(this.options.align=t,this.wrapper.classList.remove("align-left","align-right","align-center"),e?(this.wrapper.classList.add(`align-${e}`),this.wrapper.getAttribute("data-align")!==e&&this.wrapper.setAttribute("data-align",e)):this.wrapper.hasAttribute("data-align")&&this.wrapper.removeAttribute("data-align"),this.syncGhostStyles())}handleAttributeMutation(e){if(e==="data-disabled"){let t=this.hasAttr("data-disabled");t!==!!this.options.disabled&&this.setDisabled(t)}else if(e==="data-mask-focus-only"){let t=this.getAttr("data-mask-focus-only")==="true";t!==!!this.options.showMaskOnFocus&&this.setShowMaskOnFocus(t)}else if(e==="data-mask-select-on-focus")this.options.selectAllOnFocus=this.getAttr("data-mask-select-on-focus")==="true";else if(e==="data-mask-copy-raw")this.options.copyRaw=this.getAttr("data-mask-copy-raw")==="true";else if(e==="data-mask-align"||e==="data-align"){let t=this.getAttr("data-mask-align")||this.getAttr("data-align");t!==(this.options.align??null)&&this.setAlign(t)}}normalizeInputType(){let e=["number","email","date","datetime-local","month","week","time","color","file","range"];if(this.input.type&&e.includes(this.input.type.toLowerCase())){let t=this.input.type.toLowerCase();this.input.type="text",t==="number"&&(this.input.inputMode="numeric")}}createGhost(){let e=this.wrapper.querySelector(".mask-ghost");e&&e.remove(),this.ghost=document.createElement("div"),this.ghost.className="mask-ghost",this.ghost.setAttribute("aria-hidden","true"),this.ghost.style.display="flex",this.ghost.style.alignItems="center",this.wrapper.appendChild(this.ghost),this.wrapper.classList.add("has-ghost"),this.syncGhostStyles()}syncGhostStyles(){if(!this.ghost||typeof window>"u")return;let e=window.getComputedStyle(this.input);if(!e)return;this.ghost.style.fontFamily=e.fontFamily,this.ghost.style.fontSize=e.fontSize,this.ghost.style.fontWeight=e.fontWeight,this.ghost.style.fontStyle=e.fontStyle,this.ghost.style.letterSpacing=e.letterSpacing,this.ghost.style.lineHeight=e.lineHeight,this.ghost.style.paddingTop=e.paddingTop,this.ghost.style.paddingBottom=e.paddingBottom,this.ghost.style.paddingLeft=e.paddingLeft,this.ghost.style.paddingRight=e.paddingRight,this.ghost.style.borderTopWidth=e.borderTopWidth,this.ghost.style.borderBottomWidth=e.borderBottomWidth,this.ghost.style.borderLeftWidth=e.borderLeftWidth,this.ghost.style.borderRightWidth=e.borderRightWidth,this.ghost.style.borderTopStyle=e.borderTopStyle==="none"?"none":"solid",this.ghost.style.borderBottomStyle=e.borderBottomStyle==="none"?"none":"solid",this.ghost.style.borderLeftStyle=e.borderLeftStyle==="none"?"none":"solid",this.ghost.style.borderRightStyle=e.borderRightStyle==="none"?"none":"solid",this.ghost.style.borderColor="transparent",this.ghost.style.boxSizing=e.boxSizing,this.ghost.style.textAlign=e.textAlign,this.ghost.style.direction=e.direction;let t=e.direction==="rtl"||this.input.getAttribute("dir")==="rtl"||this.wrapper.getAttribute("dir")==="rtl";e.textAlign==="right"||e.textAlign==="end"||t&&e.textAlign!=="left"&&e.textAlign!=="center"?this.ghost.style.justifyContent="flex-end":e.textAlign==="center"?this.ghost.style.justifyContent="center":this.ghost.style.justifyContent="flex-start"}setNativeValue(e){this.nativeValueDescriptor&&this.nativeValueDescriptor.set?this.nativeValueDescriptor.set.call(this.input,e):this.input.value=e}dispatchNativeInput(){if(!(this.isDestroyed||typeof window>"u")&&this.options.emitNativeInput!==!1){this.isDispatchingNativeInput=!0;try{let e=this.input._valueTracker;e&&typeof e.setValue=="function"&&e.setValue(this.lastTrackedValue),this.lastTrackedValue=this.input.value,this.input.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))}finally{this.isDispatchingNativeInput=!1}}}hookValueProperty(){try{let e=HTMLInputElement.prototype,t=Object.getOwnPropertyDescriptor(e,"value");if(!t||!t.set||!t.get)return;this.nativeValueDescriptor=t;let i=this;Object.defineProperty(this.input,"value",{get(){return t.get.call(this)},set(n){let o=String(n??"");t.set.call(this,o),!i.isDestroyed&&i.onNativeValueSet(o)},configurable:!0})}catch{}}unhookValueProperty(){try{delete this.input.value}catch{}}setShowMaskOnFocus(e){this.options.showMaskOnFocus=e,this.wrapper.classList.toggle("mask-focus-only",e)}disabled(e){if(e===void 0)return!!this.options.disabled;this.setDisabled(e)}setDisabled(e){this.options.disabled=!!e,this.options.disabled?this.wrapper.setAttribute("data-disabled","true"):this.wrapper.removeAttribute("data-disabled"),this.onDisabledChange(this.options.disabled)}getWrapper(){return this.wrapper}getInput(){return this.input}getGhost(){return this.ghost}getElements(){return{wrapper:this.wrapper,input:this.input,ghost:this.ghost}}getValue(){return this.input.value}getRawValue(){return this.input.value}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.focusSelectTimerId!==null&&(clearTimeout(this.focusSelectTimerId),this.focusSelectTimerId=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.input.removeEventListener("copy",this.onBaseCopy),this.input.removeEventListener("focus",this.onBaseFocus),this.input.removeEventListener("blur",this.onBaseBlur),this.unhookValueProperty(),this.ghost&&(this.ghost.remove(),this.ghost=null),this.isWrapperCreated&&this.wrapper?(this.input.style.gridArea="",this.input.style.boxSizing="",this.wrapper.parentNode&&this.wrapper.parentNode.insertBefore(this.input,this.wrapper),this.wrapper.remove()):this.wrapper&&(this.wrapper.removeAttribute("data-mask"),this.wrapper.removeAttribute("data-disabled"),this.wrapper.classList.remove("is-complete","is-focused","mask-focus-only","has-selection","has-ghost")))}};var j={9:{pattern:/[0-9]/},a:{pattern:/[a-zA-Z]/},A:{pattern:/[a-zA-Z]/,transform:v=>v.toUpperCase()},"*":{pattern:/[a-zA-Z0-9]/},"#":{pattern:/[a-zA-Z0-9]/,transform:v=>v.toUpperCase()}},A=class v{constructor(e,t={}){this.patterns=[];this.subEngines=[];this.activeEngine=null;this.slots=[];this.fullMaskTemplate="";this.prefixSlotsCount=0;this.prefixString="";this.strict=!0;this.autoLowercase=!1;let i=t||{};this.placeholderChar=i.placeholderChar||"_",this.tokens={...j,...i.tokens||{}},this.strict=i.strict!==!1,this.autoLowercase=i.autoLowercase??!1,this.pattern="",this.compile(e)}static format(e,t,i={}){return!t||Array.isArray(t)&&t.length===0?e??"":new v(t,i||{}).format(e??"")}compile(e){if(e!==void 0&&(Array.isArray(e)?(this.patterns=[...e],this.pattern=this.patterns[0]||""):(this.patterns=[],this.pattern=e)),this.patterns.length>0)return this.subEngines=this.patterns.map(n=>new v(n,{placeholderChar:this.placeholderChar,tokens:this.tokens,strict:this.strict,autoLowercase:this.autoLowercase})),this.activeEngine=this.subEngines[0],this.slots=this.activeEngine.slots,this.fullMaskTemplate=this.activeEngine.fullMaskTemplate,this.prefixSlotsCount=this.activeEngine.prefixSlotsCount,this.prefixString=this.activeEngine.prefixString,this.slots;this.subEngines=[],this.activeEngine=null,this.slots=[];let t="",i=!0;for(let n=0;n<this.pattern.length;n++){let o=this.pattern[n],s=!1;o==="\\"&&n+1<this.pattern.length&&(s=!0,n++,o=this.pattern[n]);let r=s?void 0:this.tokens[o];r?(i=!1,this.slots.push({char:o,isStatic:!1,isPrefix:!1,token:r,placeholder:this.placeholderChar}),t+=this.placeholderChar):(this.slots.push({char:o,isStatic:!0,isPrefix:i,placeholder:o}),t+=o)}this.fullMaskTemplate=t,this.prefixSlotsCount=0,this.prefixString="";for(let n of this.slots)if(n.isPrefix)this.prefixSlotsCount++,this.prefixString+=n.char;else break;return this.slots}selectEngine(e){if(this.subEngines.length<=1)return this;let t=String(e??""),i=this.subEngines.filter(a=>{let u=a.getPrefix();return u.length>0&&t.toLowerCase().startsWith(u.trim().toLowerCase())}),n=i.length>0?i:this.subEngines,o=[...n].sort((a,u)=>u.getEditableCount()-a.getEditableCount())[0],r=(o?o.extractRaw(t):t).length;for(let a of n)if(a.getEditableCount()>=r)return this.activeEngine=a,a;return this.activeEngine=n[n.length-1],this.activeEngine}getPrefix(){return this.activeEngine?this.activeEngine.getPrefix():this.prefixString}getPrefixLength(){return this.activeEngine?this.activeEngine.getPrefixLength():this.prefixSlotsCount}getFullMaskTemplate(){return this.activeEngine?this.activeEngine.getFullMaskTemplate():this.fullMaskTemplate}getEditableCount(){return this.subEngines.length>0?Math.max(...this.subEngines.map(e=>e.getEditableCount())):this.activeEngine?this.activeEngine.getEditableCount():this.slots.filter(e=>!e.isStatic).length}isNumericOnly(){if(this.subEngines.length>0)return this.subEngines.every(i=>i.isNumericOnly());let t=(this.activeEngine?this.activeEngine.slots:this.slots).filter(i=>!i.isStatic);return t.length===0?!1:t.every(i=>i.char==="9"||i.token&&i.token.pattern.test("0")&&!i.token.pattern.test("a")&&!i.token.pattern.test("Z"))}setStrict(e){this.strict=e}isStrict(){return this.strict}extractRaw(e){if(this.subEngines.length>0){let s=this.selectEngine(e);if(s!==this)return s.extractRaw(e)}let t=String(e??"");if(!t)return"";let i="",n=0,o=0;if(this.prefixSlotsCount>0){for(;n<t.length&&(t[n]===" "||t[n]===" ");)n++;let s=0;for(;n<t.length&&s<this.prefixSlotsCount;){let r=this.slots[s].char,a=t[n];if(a.toUpperCase()===r.toUpperCase())n++,s++;else if(r===" "&&a!==" ")s++;else break}o=this.prefixSlotsCount}for(;n<t.length&&o<this.slots.length;){let s=this.slots[o],r=t[n];if(s.isStatic)r.toUpperCase()===s.char.toUpperCase()&&n++,o++;else if(s.token&&s.token.pattern.test(r)){let a=s.token.transform?s.token.transform(r):r;this.autoLowercase&&!s.token.transform&&(a=a.toLowerCase()),i+=a,n++,o++}else this.strict?n++:(i+=this.autoLowercase?r.toLowerCase():r,n++,o++)}if(!this.strict&&n<t.length){let s=t.slice(n);i+=this.autoLowercase?s.toLowerCase():s}return i}format(e){if(this.subEngines.length>0){let s=this.selectEngine(e);if(s!==this)return s.format(e)}let t=String(e??"");if(!this.slots.length)return t;let i=this.extractRaw(t);if(i.length===0)return this.prefixString;let n="",o=0;for(let s=0;s<this.slots.length;s++){let r=this.slots[s];if(r.isStatic){let a=o<i.length,u=o===0&&!!r.isPrefix,d=o>0&&o===i.length;if(a||u||d)n+=r.char;else break}else if(o<i.length){let a=i[o],u=r.token?.transform?r.token.transform(a):a;this.autoLowercase&&!r.token?.transform&&(u=u.toLowerCase()),n+=u,o++}else break}if(!this.strict&&o<i.length){let s=i.substring(o);n+=this.autoLowercase?s.toLowerCase():s}return n}getRemainingMask(e){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getRemainingMask(e):this.fullMaskTemplate?e.length>=this.fullMaskTemplate.length?e:e+this.fullMaskTemplate.substring(e.length):""}mapCursorPosition(e,t,i){if(this.activeEngine&&this.activeEngine!==this)return this.activeEngine.mapCursorPosition(e,t,i);let n=this.prefixSlotsCount,o=String(e??""),s=String(i??"");if(t<=0||!s)return n;let a=this.extractRaw(o.slice(0,t)).length;if(a===0)return Math.max(n,Math.min(this.getNextEditablePosition(0),s.length));let u=0,d=s.length;for(let g=0;g<s.length&&g<this.slots.length;g++)if(!this.slots[g].isStatic&&(u++,u===a)){d=g+1;break}for(;d<s.length&&this.slots[d]&&this.slots[d].isStatic;)d++;return Math.max(n,Math.min(d,s.length))}isSeparatorAt(e){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.isSeparatorAt(e):e>=0&&e<this.slots.length?this.slots[e].isStatic:!1}getNextEditablePosition(e){if(this.activeEngine&&this.activeEngine!==this)return this.activeEngine.getNextEditablePosition(e);let t=Math.max(0,e);for(let i=t;i<this.slots.length;i++)if(!this.slots[i].isStatic)return i;return this.slots.length}getSlotAt(e){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getSlotAt(e):this.slots[e]}getSlots(){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getSlots():this.slots}};var C=class{constructor(e=50){this.stack=[];this.index=-1;this.maxDepth=e}push(e,t){let i=this.getCurrent();if(i&&i.raw===e){i.cursor=t;return}this.stack=this.stack.slice(0,this.index+1),this.stack.push({raw:e,cursor:t}),this.stack.length>this.maxDepth&&this.stack.shift(),this.index=this.stack.length-1}updateCurrentCursor(e){let t=this.getCurrent();t&&(t.cursor=e)}undo(){return this.canUndo()?(this.index--,this.stack[this.index]):null}redo(){return this.canRedo()?(this.index++,this.stack[this.index]):null}canUndo(){return this.index>0}canRedo(){return this.index>=0&&this.index<this.stack.length-1}getCurrent(){return this.index>=0&&this.index<this.stack.length?this.stack[this.index]:null}clear(){this.stack=[],this.index=-1}};var D=class{constructor(e){this.delegate=e}handleKeyDown(e){let t=this.delegate.getInput(),i=this.delegate.getEngine(),n=this.delegate.getHistory(),o=i.getPrefixLength(),s=t.selectionStart??0,r=t.selectionEnd??s;if((e.ctrlKey||e.metaKey)&&(e.key==="z"||e.key==="Z")&&!e.shiftKey){e.preventDefault(),this.delegate.undo();return}if((e.ctrlKey||e.metaKey)&&(e.key==="y"||e.key==="Y")||(e.ctrlKey||e.metaKey)&&e.shiftKey&&(e.key==="z"||e.key==="Z")){e.preventDefault(),this.delegate.redo();return}n.updateCurrentCursor(s);let a=e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey,u=r>s;if(a&&!u){let l=i.getSlots(),c=s<l.length&&l[s].isStatic&&l[s].char===e.key,h=s>0&&s-1<l.length&&l[s-1].isStatic&&l[s-1].char===e.key;if(c||h){e.preventDefault();let m=c?s:s-1,f=i.getNextEditablePosition(m+1);this.delegate.applyMask(t.value,f,!0);return}let p=-1;for(let m=s;m<l.length;m++)if(l[m].isStatic){l[m].char===e.key&&(p=m);break}if(p!==-1){e.preventDefault();let m=p-1;for(;m>=o&&!l[m].isStatic;)m--;m++;let f=p-m,y=t.value.slice(m,s);if(l.slice(m,p).every(w=>!w.token||w.token.pattern.test("0"))&&f>y.length&&y.length>0){let w=f-y.length,S="0".repeat(w)+y,H=t.value.slice(p),B=t.value.slice(0,m)+S+H,E=i.getNextEditablePosition(p+1);this.delegate.applyMask(B,E,!0);return}let b=i.getNextEditablePosition(p+1);this.delegate.applyMask(t.value,b,!0);return}}if(a&&i.isStrict()){let l=i.getEditableCount();if(l>0){let c=i.extractRaw(t.value),h=l-c.length;if(r>s){let p=i.extractRaw(t.value.slice(s,r));h=l-(c.length-p.length)}if(h<=0){e.preventDefault();return}}}if(r>s){if(e.key==="Backspace"||e.key==="Delete"){e.preventDefault();let l=t.value,c=l.slice(0,s)+l.slice(r);this.delegate.applyMask(c,Math.max(o,s));return}return}if(e.key==="ArrowLeft"&&!e.shiftKey&&s<=o){e.preventDefault(),t.setSelectionRange(o,o);return}if(e.key==="Home"&&!e.shiftKey){e.preventDefault(),t.setSelectionRange(o,o);return}if(e.key==="Backspace"&&s<=o){e.preventDefault(),t.setSelectionRange(o,o);return}if(e.key==="Delete"&&s<o){e.preventDefault(),t.setSelectionRange(o,o);return}if(e.key==="Backspace"&&(e.ctrlKey||e.altKey||e.metaKey)){if(e.preventDefault(),s<=o){t.setSelectionRange(o,o);return}let l=s-1;for(;l>=o&&i.isSeparatorAt(l);)l--;for(;l>=o&&!i.isSeparatorAt(l);)l--;let c=Math.max(o,l+1),h=t.value,p=h.slice(0,c)+h.slice(s);this.delegate.applyMask(p,c);return}if(e.key==="Delete"&&(e.ctrlKey||e.altKey||e.metaKey)){e.preventDefault();let l=t.value;if(s>=l.length)return;let c=s;for(;c<l.length&&i.isSeparatorAt(c);)c++;for(;c<l.length&&!i.isSeparatorAt(c);)c++;for(;c<l.length&&i.isSeparatorAt(c);)c++;let h=c,p=l.slice(0,s)+l.slice(h);this.delegate.applyMask(p,s);return}if(e.key==="Backspace"&&s>o){if(i.isSeparatorAt(s-1)){e.preventDefault();let l=s-1;for(;l>o&&i.isSeparatorAt(l-1);)l--;if(l>o){let c=t.value,h=c.slice(0,l-1)+c.slice(s);this.delegate.applyMask(h,l-1)}else this.delegate.applyMask("",o)}return}if(e.key==="Delete"&&s<t.value.length){if(i.isSeparatorAt(s)){e.preventDefault();let l=s;for(;l<t.value.length&&i.isSeparatorAt(l);)l++;if(l<t.value.length){let c=t.value,h=c.slice(0,l)+c.slice(l+1);this.delegate.applyMask(h,s)}}return}}handleKeyUp(e){let t=this.delegate.getInput(),i=this.delegate.getHistory();(e.key==="ArrowLeft"||e.key==="ArrowRight"||e.key==="Home")&&!e.shiftKey&&this.delegate.enforceMinCursor(),i.updateCurrentCursor(t.selectionStart??0)}};var R=class extends M{constructor(t,i,n){let o=T(t,i,n),s=o.wrapper,r=o.input,a=o.options,u=s?.getAttribute("data-mask")||r?.getAttribute("data-mask"),d=a.mask||u||"";typeof d=="string"&&d.includes("|")&&(d=d.split("|").map(w=>w.trim()));let g=a.placeholderChar||s?.getAttribute("data-mask-placeholder")||r?.getAttribute("data-mask-placeholder")||"_",l=s?.hasAttribute("data-disabled")||r?.hasAttribute("data-disabled"),c=s?.getAttribute("data-mask-strict")||r?.getAttribute("data-mask-strict"),h=s?.getAttribute("data-mask-auto-lowercase")==="true"||r?.getAttribute("data-mask-auto-lowercase")==="true",p=s?.getAttribute("data-mask-infer-inputmode")??r?.getAttribute("data-mask-infer-inputmode"),m=a.inferInputMode??(p!==null?p!=="false":!0),{disabled:f,...y}=a,k=f!==void 0?f:l?!0:!d||Array.isArray(d)&&d.length===0,b={...y,mask:d,placeholderChar:g,strict:a.strict??(c!==null?c!=="false":!0),autoLowercase:a.autoLowercase??h??!1,disabled:k,resetHistoryOnMaskChange:a.resetHistoryOnMaskChange??!1,inferInputMode:m,onInput:a.onInput||a.oninput,onChange:a.onChange||a.onchange,onComplete:a.onComplete||a.oncomplete};super(s,r,b);this.isComposing=!1;this.isUndoingRedoing=!1;this.isMouseDown=!1;this.isApplyingMask=!1;this.lastValue="";this.lastInternalRemainingMask="";this.isNotifying=!1;this.hasPendingNotification=!1;this.onChangeNativeHandler=()=>{};this.wasInputModeInferred=!1;this.cutTimerId=null;this.pasteTimerId=null;this.resetTimerId=null;this.history=new C,this.engine=new A(this.options.mask||"",{placeholderChar:this.options.placeholderChar,tokens:this.options.tokens,strict:this.options.strict,autoLowercase:this.options.autoLowercase}),this.syncInferredInputMode(),this.keyboard=new D({getInput:()=>this.input,getEngine:()=>this.engine,getHistory:()=>this.history,applyMask:(w,S,H)=>this.applyMask(w,S,H),undo:()=>this.undo(),redo:()=>this.redo(),enforceMinCursor:()=>this.enforceMinCursor()}),this.bindEvents(),this.lastValue=this.input.value,this.syncInitialValue()}extractRawSnippet(t){return this.engine.extractRaw(t)}static format(t,i,n={}){return A.format(t,i,n)}onNativeValueSet(t){this.options.disabled?this.checkValueChange():this.applyMask(t,t.length)}onDisabledChange(t){t?(this.wrapper.removeAttribute("data-mask"),this.wrapper.classList.remove("is-complete","has-selection"),this.ghost&&(this.ghost.textContent=""),this.checkValueChange()):this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length)}bindEvents(){this.handleInput=this.handleInput.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onPaste=this.onPaste.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.onClick=this.onClick.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onSelect=this.onSelect.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onCompositionStart=this.onCompositionStart.bind(this),this.onCompositionEnd=this.onCompositionEnd.bind(this),this.onScroll=this.onScroll.bind(this),this.onBeforeInput=this.onBeforeInput.bind(this),this.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{if(this.cutTimerId=null,!this.isDestroyed)if(this.options.disabled)this.checkValueChange();else{let t=this.input.selectionStart??this.input.value.length;this.applyMask(this.input.value,t)}},0)},this.onChangeNativeHandler=()=>{this.isDestroyed||this.checkValueChange()},this.input.addEventListener("beforeinput",this.onBeforeInput),this.input.addEventListener("input",this.handleInput),this.input.addEventListener("keydown",this.onKeyDown),this.input.addEventListener("paste",this.onPaste),this.input.addEventListener("focus",this.onFocus),this.input.addEventListener("blur",this.onBlur),this.input.addEventListener("click",this.onClick),this.input.addEventListener("keyup",this.onKeyUp),this.input.addEventListener("select",this.onSelect),this.input.addEventListener("mousedown",this.onMouseDown),window.addEventListener("mouseup",this.onMouseUp),this.input.addEventListener("compositionstart",this.onCompositionStart),this.input.addEventListener("compositionend",this.onCompositionEnd),this.input.addEventListener("scroll",this.onScroll),this.input.addEventListener("cut",this.onCutHandler),this.input.addEventListener("change",this.onChangeNativeHandler),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!this.isDestroyed&&(this.options.disabled?this.checkValueChange():this.syncInitialValue())},0)},this.input.form.addEventListener("reset",this.onFormResetHandler))}syncInferredInputMode(){if(!this.options.inferInputMode)return;!this.options.disabled&&this.engine.isNumericOnly()?this.input.hasAttribute("inputmode")||(this.input.inputMode="numeric",this.wasInputModeInferred=!0):this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="numeric"&&(this.input.removeAttribute("inputmode"),this.wasInputModeInferred=!1)}destroy(){this.isDestroyed||(this.cutTimerId!==null&&(clearTimeout(this.cutTimerId),this.cutTimerId=null),this.pasteTimerId!==null&&(clearTimeout(this.pasteTimerId),this.pasteTimerId=null),this.resetTimerId!==null&&(clearTimeout(this.resetTimerId),this.resetTimerId=null),this.input.removeEventListener("beforeinput",this.onBeforeInput),this.input.removeEventListener("input",this.handleInput),this.input.removeEventListener("keydown",this.onKeyDown),this.input.removeEventListener("paste",this.onPaste),this.input.removeEventListener("focus",this.onFocus),this.input.removeEventListener("blur",this.onBlur),this.input.removeEventListener("click",this.onClick),this.input.removeEventListener("keyup",this.onKeyUp),this.input.removeEventListener("select",this.onSelect),this.input.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mouseup",this.onMouseUp),this.input.removeEventListener("compositionstart",this.onCompositionStart),this.input.removeEventListener("compositionend",this.onCompositionEnd),this.input.removeEventListener("scroll",this.onScroll),this.input.removeEventListener("cut",this.onCutHandler),this.input.removeEventListener("change",this.onChangeNativeHandler),this.input.form&&this.onFormResetHandler&&this.input.form.removeEventListener("reset",this.onFormResetHandler),this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="numeric"&&this.input.removeAttribute("inputmode"),this.history.clear(),super.destroy())}setStrict(t){this.options.strict=t,this.engine.setStrict(t),this.options.disabled||this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length)}isStrict(){return this.engine.isStrict()}setMask(t,i){let n=typeof i=="boolean"?i:i&&typeof i=="object"&&i.strict!==void 0?i.strict:this.options.strict,o=i&&typeof i=="object"&&i.resetHistory!==void 0?i.resetHistory:!!this.options.resetHistoryOnMaskChange;if(!((!t||Array.isArray(t)&&t.length===0)&&this.options.disabled&&(!this.options.mask||this.options.mask===""))){if(!t||Array.isArray(t)&&t.length===0){this.options.mask="",this.options.strict=n,this.engine.setStrict(n??!0),this.engine.compile(""),o&&this.history.clear(),this.setDisabled(!0),this.syncInferredInputMode();return}this.options.mask=t,this.options.strict=n,this.engine.setStrict(n??!0),this.engine.compile(t),o&&this.history.clear(),this.setDisabled(!1),this.syncInferredInputMode()}}handleAttributeMutation(t){if(super.handleAttributeMutation(t),t==="data-mask"){let i=this.getAttr("data-mask");if(i===this.lastInternalRemainingMask)return;let n=Array.isArray(this.options.mask)?this.options.mask.join("|"):this.options.mask||"";if(i===n)return;if(i){let o=i.includes("|")?i.split("|").map(s=>s.trim()):i;this.setMask(o)}else this.setMask(null)}else if(t==="data-mask-strict"){let i=this.getAttr("data-mask-strict");this.setStrict(i!=="false")}else t==="data-mask-auto-lowercase"?(this.options.autoLowercase=this.getAttr("data-mask-auto-lowercase")==="true",this.engine.compile(this.options.mask||""),this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length)):t==="placeholder"&&this.updateGhost(this.input.value)}setValue(t){let i=t!=null?String(t):"";if(this.options.disabled){this.input.value=i,this.checkValueChange();return}this.applyMask(i,i.length)}getRawValue(){return this.engine.extractRaw(this.input.value)}isComplete(){return this.options.disabled?!0:this.getRawValue().length>=this.engine.getEditableCount()}get onInput(){return this.options.onInput}set onInput(t){this.options.onInput=t}undo(){if(this.options.disabled)return;let t=this.history.undo();t&&(this.isUndoingRedoing=!0,this.applyMask(t.raw,t.cursor),this.isUndoingRedoing=!1)}redo(){if(this.options.disabled)return;let t=this.history.redo();t&&(this.isUndoingRedoing=!0,this.applyMask(t.raw,t.cursor),this.isUndoingRedoing=!1)}checkSelection(){if(this.options.disabled)return;let t=this.input.selectionStart??0,i=this.input.selectionEnd??t,n=t!==i;this.wrapper.classList.toggle("has-selection",n)}onBeforeInput(t){if(!this.options.disabled&&!this.isComposing&&this.engine.isStrict()&&t.inputType!=="insertFromPaste"&&t.inputType&&t.inputType.startsWith("insert")){let i=this.engine.getEditableCount();if(i>0){let n=this.getRawValue(),o=this.input.selectionStart??0,s=this.input.selectionEnd??o,r=Math.max(0,i-n.length);if(s>o){let a=this.engine.extractRaw(this.input.value.slice(o,s));r=Math.max(0,i-(n.length-a.length))}r<=0&&t.preventDefault()}}}handleInput(t){if(this.isDispatchingNativeInput||this.isComposing)return;if(!!(this.options.onInput||this.options.oninput)&&this.input.value!==this.lastValue&&this.checkValueChange(),this.options.disabled){this.checkValueChange();return}let n=this.history.getCurrent(),o=this.engine.getEditableCount();if(o>0&&this.engine.isStrict()&&n&&n.raw.length>=o&&this.engine.extractRaw(this.input.value).length>o){this.applyMask(n.raw,n.cursor);return}let s=this.input.selectionStart??this.input.value.length;this.applyMask(this.input.value,s),this.checkSelection()}onKeyDown(t){this.options.disabled||this.keyboard.handleKeyDown(t)}onMouseDown(){this.isMouseDown=!0}onMouseUp(){this.isMouseDown=!1,this.checkSelection()}onPaste(t){if(this.options.disabled){this.pasteTimerId!==null&&clearTimeout(this.pasteTimerId),this.pasteTimerId=window.setTimeout(()=>{this.pasteTimerId=null,this.isDestroyed||this.checkValueChange()},0);return}t.preventDefault(),this.history.updateCurrentCursor(this.input.selectionStart??0);let n=(t.clipboardData?.getData("text")||"").trim();if(!n)return;let o=this.engine.getPrefixLength(),s=this.input.selectionStart??0,r=this.input.selectionEnd??s,a=this.input.value,u=this.engine.getEditableCount(),d=this.getRawValue(),l=this.engine.getPrefix().replace(/[\s.-]+/g,"").toUpperCase(),c=n.replace(/[\s.-]+/g,"").toUpperCase(),h=l.length>0&&c.startsWith(l),p=a.slice(0,Math.max(o,s)).replace(/[\s.-]+/g,"").toUpperCase(),m=p.length>=2&&c.startsWith(p),f=Math.max(o,s),y=Math.max(o,r);(h||m)&&(f=0,y=a.length);let k=Math.max(0,u-d.length);if(f!==y){let S=this.engine.extractRaw(a.slice(f,y));k=Math.max(0,u-(d.length-S.length))}if(this.engine.isStrict()&&k<=0)return;let b,w;f===0&&y===a.length?(b=n,w=n.length):(b=a.slice(0,f)+n+a.slice(y),w=f+n.length),this.applyMask(b,w),this.checkSelection()}onFocus(){this.syncGhostStyles(),this.wrapper.classList.add("is-focused"),!this.options.disabled&&!this.isMouseDown&&this.enforceMinCursor(),this.updateGhost(this.input.value),this.checkSelection()}onBlur(){this.wrapper.classList.remove("is-focused","has-selection"),this.input.type==="password"&&this.history.clear(),this.updateGhost(this.input.value)}onClick(){this.options.disabled||this.enforceMinCursor(),this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onKeyUp(t){this.options.disabled||this.keyboard.handleKeyUp(t),this.checkSelection()}onSelect(){this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onCompositionStart(){this.isComposing=!0}onCompositionEnd(){if(this.isComposing=!1,this.options.disabled)return;let t=this.input.selectionStart??this.input.value.length;this.applyMask(this.input.value,t),this.checkSelection()}enforceMinCursor(){let t=this.engine.getPrefixLength();if(t<=0)return;let i=this.input.selectionStart??0,n=this.input.selectionEnd??i;i===n&&i<t&&this.input.setSelectionRange(t,t)}updateGhost(t){if(!this.ghost)return;if(this.options.disabled){this.ghost.textContent="";return}let i=!t||t===this.engine.getPrefix();if(this.shouldHideGhostForPlaceholder(i)){this.ghost.textContent="";return}let n=this.engine.getFullMaskTemplate(),o=n.length>t.length?n.substring(t.length):"";this.ghost.textContent="";let s=document.createElement("span");s.className="mask-ghost-typed",s.textContent=t;let r=document.createElement("span");r.className="mask-ghost-remaining",r.textContent=o,this.ghost.appendChild(s),this.ghost.appendChild(r),this.ghost.scrollLeft=this.input.scrollLeft}applyMask(t,i,n=!1){if(this.options.disabled||this.isApplyingMask)return;this.isApplyingMask=!0;let o="",s=!1;try{o=this.engine.format(t);let r=this.engine.getRemainingMask(o);this.input.value=o,this.lastInternalRemainingMask=r,this.wrapper.setAttribute("data-mask",r),this.updateGhost(o);let a=this.engine.getPrefixLength(),u;if(n||this.isUndoingRedoing)u=Math.max(a,Math.min(i,o.length));else{let d=this.engine.mapCursorPosition(t,i,o);u=Math.max(a,d)}this.input.setSelectionRange(u,u),s=this.isComplete(),this.wrapper.classList.toggle("is-complete",s),!this.isUndoingRedoing&&this.input.type!=="password"&&this.history.push(this.getRawValue(),u)}finally{this.isApplyingMask=!1}this.checkValueChange()}syncInitialValue(){if(this.options.disabled){this.wrapper.removeAttribute("data-mask"),this.ghost&&(this.ghost.textContent=""),this.lastValue=this.input.value,this.checkValueChange();return}this.syncGhostStyles();let t=this.input.value||"";if(t)this.applyMask(t,t.length);else{let i=this.engine.getPrefixLength();if(i>0)this.applyMask("",i);else{this.input.type!=="password"&&this.history.push("",0);let n=this.engine.getFullMaskTemplate();this.lastInternalRemainingMask=n,this.wrapper.setAttribute("data-mask",n),this.updateGhost(""),this.checkValueChange()}}}checkValueChange(t=!1){if(!(this.input.value===this.lastValue&&!t&&!this.hasPendingNotification)){if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{for(;this.input.value!==this.lastValue||this.hasPendingNotification||t;){this.hasPendingNotification=!1,t=!1;let n=this.input.value;this.lastValue=n;let o=this.options.disabled?n:this.getRawValue(),s=this.options.disabled?0:this.engine.getEditableCount(),r=this.isComplete(),a={value:n,rawValue:o,isComplete:r,totalSlots:s,filledSlots:this.options.disabled?n.length:o.length},u=this.options.onInput||this.options.oninput;u&&u(n,a),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:!0,detail:a})),this.dispatchNativeInput();let d=this.options.onChange||this.options.onchange;d&&d(a),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!0,detail:a}));let g=this.options.onComplete||this.options.oncomplete;r&&(g&&g(a),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:!0,detail:a})))}}finally{this.isNotifying=!1}}}};var x=class v{constructor(e={}){let t=e.currency??"";!t&&e.unit&&(t=e.unit);let i=t==="$"||t==="\xA3"||t==="\xA5"?"prefix":"suffix";this.options={currency:t,unit:e.unit??t,currencyPosition:e.currencyPosition??i,decimals:e.decimals!==void 0?Math.max(0,e.decimals):2,decimalSeparator:e.decimalSeparator??",",thousandSeparator:e.thousandSeparator??"\xA0",allowNegative:e.allowNegative??!1,min:e.min??-1/0,max:e.max??1/0}}parse(e){let t=e.trim(),i=!1;this.options.allowNegative&&t.includes("-")&&(i=!0),this.options.currency&&(t=t.replace(new RegExp(this.escapeRegExp(this.options.currency),"g"),"")),this.options.thousandSeparator&&(t=t.replace(new RegExp(this.escapeRegExp(this.options.thousandSeparator),"g"),"")),t=t.replace(/[\s\u00A0]/g,"");let n=this.options.decimalSeparator,o=t.indexOf(n);o===-1&&(o=t.search(/[,.]/));let s="",r=null,a=!1;return o!==-1?(s=t.substring(0,o).replace(/\D/g,""),this.options.decimals>0&&(a=!0,r=t.substring(o+1).replace(/\D/g,"").slice(0,this.options.decimals))):s=t.replace(/\D/g,""),s.length>1&&(s=s.replace(/^0+/,"")||"0"),{isNegative:i,integerPart:s,decimalPart:r,hasDecimal:a}}format(e,t=e.length,i=!1){if(!e||e.trim()===""||e===this.options.currency.trim())return{formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0};let n=e.substring(0,t),o=n.replace(/\D/g,"").length,s=this.options.decimals>0&&/[,.]/.test(n),{isNegative:r,integerPart:a,decimalPart:u,hasDecimal:d}=this.parse(e),g=u,l=d;if(i&&this.options.decimals>0&&(a||u!==null)&&(l=!0,g===null?g="0".repeat(this.options.decimals):g.length<this.options.decimals&&(g=g+"0".repeat(this.options.decimals-g.length))),r&&!a&&!g&&!l&&this.options.allowNegative){let E="-",I=1;return this.options.currency&&(this.options.currencyPosition==="prefix"?(E=`${this.options.currency} -`,I=E.length):(E=`- ${this.options.currency}`,I=1)),{formatted:E,rawNumber:null,rawValue:"-",cursor:I,isValid:!0}}if(!a&&!g&&!l)return{formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0};let h=(a||"0").replace(/\B(?=(\d{3})+(?!\d))/g,this.options.thousandSeparator);l&&this.options.decimals>0&&(h+=this.options.decimalSeparator+(g??"")),r&&h!=="0"&&(h="-"+h);let p=h;this.options.currency&&(this.options.currencyPosition==="prefix"?p=`${this.options.currency} ${h}`:p=`${h} ${this.options.currency}`);let m=(r?"-":"")+(a||"0")+(u?"."+u:""),f=parseFloat(m);isNaN(f)&&(f=0);let y=f>=this.options.min&&f<=this.options.max,k=0;this.options.currency&&this.options.currencyPosition==="prefix"&&(k=this.options.currency.length+1);let b=0,w=!1,S=k;for(let E=k;E<p.length;E++){let I=p[E];if(I===this.options.currency.trim()[0]&&this.options.currencyPosition==="suffix")break;if(/\d/.test(I)?(b++,S=E+1):I===this.options.decimalSeparator&&(w=!0,S=E+1),s){if(w&&b>=o){k=E+1;break}}else if(b>=o){k=E+1;break}}o>0&&b<o&&S>k&&(k=S);let H=this.options.currency&&this.options.currencyPosition==="prefix"?this.options.currency.length+1:0,B=this.options.currency&&this.options.currencyPosition==="suffix"?Math.max(0,p.length-this.options.currency.length-1):p.length;return k=Math.max(H,Math.min(k,Math.max(H,B))),{formatted:p,rawNumber:f,rawValue:m,cursor:k,isValid:y}}static format(e,t={}){let i=new v(t),n=typeof e=="number"?e.toString():e;return i.format(n).formatted}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};var V=class extends M{constructor(t,i,n){let o=T(t,i,n),s=o.wrapper,r=o.input,a=o.options,u=s?.getAttribute("data-mask-pad-decimals")==="true"||r?.getAttribute("data-mask-pad-decimals")==="true",d=r?.getAttribute("data-mask-align")||r?.getAttribute("data-align")||s?.getAttribute("data-mask-align")||s?.getAttribute("data-align"),g={align:a.align??d??"right",padDecimalsOnBlur:a.padDecimalsOnBlur??u??!1,...a};super(s,r,g);this.isUndoingRedoing=!1;this.isApplying=!1;this.isComposing=!1;this.lastValue="";this.cutTimerId=null;this.resetTimerId=null;this.input.inputMode="decimal",this.history=new C,this.engine=new x(this.options),this.bindEvents(),this.input.value?this.options.disabled||this.applyAmount(this.input.value,this.input.value.length):this.updateGhost({formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0})}extractRawSnippet(t){let i=this.engine.parse(t);return!i.integerPart&&!i.decimalPart?"":(i.isNegative?"-":"")+(i.integerPart||"0")+(i.decimalPart?"."+i.decimalPart:"")}static format(t,i={}){return x.format(t,i)}onNativeValueSet(t){if(this.options.disabled||this.isComposing){this.lastValue=t;return}this.applyAmount(t,t.length)}onDisabledChange(t){t||this.applyAmount(this.input.value,this.input.selectionStart??this.input.value.length)}bindEvents(){this.handleInput=this.handleInput.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.onCompositionStart=this.onCompositionStart.bind(this),this.onCompositionEnd=this.onCompositionEnd.bind(this),this.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{if(this.cutTimerId=null,this.isDestroyed||this.options.disabled)return;let t=this.input.selectionStart??this.input.value.length;this.applyAmount(this.input.value,t)},0)},this.input.addEventListener("input",this.handleInput),this.input.addEventListener("keydown",this.handleKeyDown),this.input.addEventListener("blur",this.handleBlur),this.input.addEventListener("focus",this.handleFocus),this.input.addEventListener("click",this.handleClick),this.input.addEventListener("scroll",this.onScroll),this.input.addEventListener("cut",this.onCutHandler),this.input.addEventListener("compositionstart",this.onCompositionStart),this.input.addEventListener("compositionend",this.onCompositionEnd),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!this.isDestroyed&&(this.options.disabled||this.applyAmount(this.input.value,this.input.value.length))},0)},this.input.form.addEventListener("reset",this.onFormResetHandler))}onCompositionStart(){this.isComposing=!0}onCompositionEnd(){if(this.isComposing=!1,this.options.disabled)return;let t=this.input.selectionStart??this.input.value.length;this.applyAmount(this.input.value,t)}applyAmount(t,i){if(!(this.isApplying||this.options.disabled)){this.isApplying=!0;try{let n=this.engine.format(t,i);this.setNativeValue(n.formatted),this.input.setSelectionRange(n.cursor,n.cursor),!this.isUndoingRedoing&&this.input.type!=="password"&&this.history.push(n.rawValue,n.cursor),this.updateGhost(n),this.lastValue!==n.formatted&&(this.lastValue=n.formatted,this.notifyChange(n))}finally{this.isApplying=!1}}}updateGhost(t){if(this.ghost){if(!t.formatted){if(this.shouldHideGhostForPlaceholder(!0)){this.ghost.textContent="";return}let i=this.options.currency?this.options.currencyPosition==="prefix"?`${this.options.currency} 0`:`0 ${this.options.currency}`:"0,00";this.ghost.textContent="";let n=document.createElement("span");n.className="mask-ghost-remaining",n.textContent=i,this.ghost.appendChild(n);return}this.ghost.textContent="",this.ghost.scrollLeft=this.input.scrollLeft}}handleInput(){if(this.isDispatchingNativeInput||this.options.disabled||this.isComposing)return;let t=this.input.value,i=this.input.selectionStart??t.length;this.applyAmount(t,i)}handleKeyDown(t){if(!this.options.disabled){if((t.ctrlKey||t.metaKey)&&(t.key==="z"||t.key==="Z")){t.preventDefault(),t.shiftKey?this.redo():this.undo();return}if((t.ctrlKey||t.metaKey)&&(t.key==="y"||t.key==="Y")){t.preventDefault(),this.redo();return}if(t.key==="Backspace"){let i=this.input.selectionStart??0,n=this.input.selectionEnd??0;if(i===n&&i>0){let o=this.input.value,s=o[i-1];if(s===this.engine.options.thousandSeparator||s===" "){t.preventDefault();let r=Math.max(0,i-2),a=o.slice(0,r)+o.slice(i);this.applyAmount(a,r);return}if(this.options.currency&&this.options.currencyPosition==="prefix"&&i<=this.options.currency.length+1){t.preventDefault();return}}}if(t.key==="Delete"){let i=this.input.selectionStart??0,n=this.input.selectionEnd??0;if(i===n&&i<this.input.value.length){let o=this.input.value,s=o[i];if(s===this.engine.options.thousandSeparator||s===" "){t.preventDefault();let r=o.slice(0,i)+o.slice(i+2);this.applyAmount(r,i);return}if(this.options.currency&&this.options.currencyPosition==="suffix"){let r=o.length-this.options.currency.length-1;if(i>=r){t.preventDefault();return}}}}setTimeout(()=>this.enforceCursorBounds(),0)}}enforceCursorBounds(){if(!this.input.value||this.options.disabled)return;let t=this.input.selectionStart??0,i=this.input.selectionEnd??0;if(t!==i)return;let n=this.input.value,o=this.options.currency;if(o){if(this.options.currencyPosition==="prefix"){let s=o.length+1;t<s&&this.input.setSelectionRange(s,s)}else if(this.options.currencyPosition==="suffix"){let s=Math.max(0,n.length-o.length-1);t>s&&this.input.setSelectionRange(s,s)}}}handleClick(){this.enforceCursorBounds()}handleFocus(){this.wrapper.classList.add("is-focused"),this.syncGhostStyles(),this.enforceCursorBounds(),this.updateGhost(this.engine.format(this.input.value))}handleBlur(){if(this.wrapper.classList.remove("is-focused"),this.input.type==="password"&&this.history.clear(),this.options.padDecimalsOnBlur&&!this.options.disabled&&this.input.value.trim().length>0){let i=this.engine.format(this.input.value,this.input.value.length,!0);i.formatted!==this.input.value&&(this.setNativeValue(i.formatted),this.lastValue=i.formatted)}this.updateGhost(this.engine.format(this.input.value));let t=this.getDetail();this.options.onChange&&this.options.onChange(t),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!0,detail:t}))}handleAttributeMutation(t){super.handleAttributeMutation(t),t==="data-mask-pad-decimals"?this.options.padDecimalsOnBlur=this.getAttr("data-mask-pad-decimals")==="true":t==="placeholder"&&this.updateGhost(this.engine.format(this.input.value))}notifyChange(t){let i={value:t.formatted,number:t.rawNumber,rawValue:t.rawValue,isValid:t.isValid};this.options.onInput&&this.options.onInput(i),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:!0,detail:i})),this.dispatchNativeInput()}undo(){let t=this.history.undo();if(t){this.isUndoingRedoing=!0;try{this.applyAmount(t.raw,t.cursor)}finally{this.isUndoingRedoing=!1}}}redo(){let t=this.history.redo();if(t){this.isUndoingRedoing=!0;try{this.applyAmount(t.raw,t.cursor)}finally{this.isUndoingRedoing=!1}}}getDetail(){let t=this.engine.format(this.input.value);return{value:t.formatted,number:t.rawNumber,rawValue:t.rawValue,isValid:t.isValid}}getNumber(){return this.getDetail().number}getRawValue(){return this.getDetail().rawValue}isValid(){return this.getDetail().isValid}setValue(t){let i=t!=null?String(t):"";this.options.disabled?(this.setNativeValue(i),this.lastValue=i):this.applyAmount(i,i.length)}destroy(){this.isDestroyed||(this.cutTimerId!==null&&(clearTimeout(this.cutTimerId),this.cutTimerId=null),this.resetTimerId!==null&&(clearTimeout(this.resetTimerId),this.resetTimerId=null),this.input.removeEventListener("input",this.handleInput),this.input.removeEventListener("keydown",this.handleKeyDown),this.input.removeEventListener("blur",this.handleBlur),this.input.removeEventListener("focus",this.handleFocus),this.input.removeEventListener("click",this.handleClick),this.input.removeEventListener("scroll",this.onScroll),this.input.removeEventListener("cut",this.onCutHandler),this.input.removeEventListener("compositionstart",this.onCompositionStart),this.input.removeEventListener("compositionend",this.onCompositionEnd),this.input.form&&this.onFormResetHandler&&this.input.form.removeEventListener("reset",this.onFormResetHandler),this.history.clear(),super.destroy())}};var L=class L{constructor(e={}){this.defaultDomain=null;this.defaultTld="__";this.domains=e.domains&&e.domains.length>0?e.domains:L.DEFAULT_DOMAINS,this.tlds=e.tlds&&e.tlds.length>0?e.tlds.map(t=>t.trim().replace(/^\./,"")).filter(Boolean):[...L.DEFAULT_TLDS],this.suggestOnAt=e.suggestOnAt??!0,this.setDefaultDomain(e.defaultDomain??null),this.setDefaultTld(e.defaultTld!==void 0?e.defaultTld:"__")}setDefaultDomain(e){e===!0?this.defaultDomain=this.domains.length>0?this.domains[0]:null:typeof e=="string"&&e.trim().length>0?this.defaultDomain=e.trim().replace(/^@/,""):this.defaultDomain=null}setDefaultTld(e){e===!0?this.defaultTld=this.tlds.length>0?this.tlds[0]:null:typeof e=="string"&&e.trim().length>0?this.defaultTld=e.trim().replace(/^\./,""):this.defaultTld=null}setTlds(e){this.tlds=e&&e.length>0?e.map(t=>t.trim().replace(/^\./,"")).filter(Boolean):[...L.DEFAULT_TLDS]}getMatchingTlds(e){let t=(e??"").toLowerCase();return t.length===0?[...this.tlds]:this.tlds.filter(i=>i.toLowerCase().startsWith(t)&&i.toLowerCase()!==t)}getMatchingDomains(e){let t=e??"";if(!t.includes("@"))return this.defaultDomain?[this.defaultDomain]:[];let i=t.indexOf("@");if(t.indexOf("@",i+1)!==-1)return[];let n=t.substring(i+1);if(n.length===0)return this.suggestOnAt?[...this.domains]:[];let o=n.toLowerCase();return this.domains.filter(s=>s.toLowerCase().startsWith(o)&&s.toLowerCase()!==o)}getSuggestion(e,t=0){let i=e??"";if(!i.includes("@"))return this.defaultDomain?{full:i?`${i}@${this.defaultDomain}`:`@${this.defaultDomain}`,remaining:`@${this.defaultDomain}`,matchedDomain:this.defaultDomain,isHintOnly:!1}:{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let n=i.indexOf("@"),o=i.substring(0,n),s=i.substring(n+1);if(i.indexOf("@",n+1)!==-1)return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let r=this.getMatchingDomains(e);if(r.length>0){let h=(t%r.length+r.length)%r.length,p=r[h],m=s.toLowerCase(),f=p.substring(m.length);return{full:`${o}@${p}`,remaining:f,matchedDomain:p,isHintOnly:!1}}if(s.length===0||s.startsWith("."))return{full:e,remaining:"",matchedDomain:null,isHintOnly:!1};let a=s.toLowerCase();if(this.domains.some(h=>h.toLowerCase()===a))return{full:e,remaining:"",matchedDomain:s,isHintOnly:!1};let u=s.lastIndexOf(".");if(u===-1){if(!this.defaultTld)return{full:e,remaining:"",matchedDomain:null,isHintOnly:!1};let h=this.defaultTld.includes("_"),p=`.${this.defaultTld}`,m=`${s}.${this.defaultTld}`;return{full:h?e:`${o}@${m}`,remaining:p,matchedDomain:h?null:m,isHintOnly:h}}let d=s.substring(0,u),g=s.substring(u+1);if(!d||d.endsWith("."))return{full:e,remaining:"",matchedDomain:null,isHintOnly:!1};if(g.length===0){if(this.defaultTld&&!this.defaultTld.includes("_")){let h=`${d}.${this.defaultTld}`;return{full:`${o}@${h}`,remaining:this.defaultTld,matchedDomain:h,isHintOnly:!1}}return this.defaultTld&&this.defaultTld.includes("_")?{full:e,remaining:this.defaultTld,matchedDomain:null,isHintOnly:!0}:{full:e,remaining:"",matchedDomain:null,isHintOnly:!1}}let l=g.toLowerCase(),c=this.getMatchingTlds(g);if(c.length>0){let h=(t%c.length+c.length)%c.length,p=c[h],m=p.substring(l.length),f=`${d}.${p}`;return{full:`${o}@${f}`,remaining:m,matchedDomain:f,isHintOnly:!1}}if(this.defaultTld&&this.defaultTld.includes("_")&&g.length<this.defaultTld.length){let h=this.defaultTld.substring(g.length);if(h.includes("_"))return{full:e,remaining:h,matchedDomain:null,isHintOnly:!0}}return{full:e,remaining:"",matchedDomain:null,isHintOnly:!1}}};L.DEFAULT_DOMAINS=["gmail.com","outlook.com","orange.fr","free.fr","sfr.fr","yahoo.com","hotmail.com","icloud.com","laposte.net","proton.me"],L.DEFAULT_TLDS=["com","fr","net","org","eu","io","co","info","biz","me","tv","fi","be","ch","ca","uk","de","es","it"];var O=L;var P=class extends M{constructor(t,i,n){let o=T(t,i,n),s=o.wrapper,r=o.input,a=o.options,u=s?.getAttribute("data-mask-cycle-suggestions")==="true"||r?.getAttribute("data-mask-cycle-suggestions")==="true",d=s?.getAttribute("data-mask-auto-lowercase")==="true"||r?.getAttribute("data-mask-auto-lowercase")==="true",g=s?.getAttribute("data-mask-aria-autocomplete")??r?.getAttribute("data-mask-aria-autocomplete"),l=a.setAriaAutocomplete??(g!==null?g!=="false":!0),c=s?.getAttribute("data-mask-tlds")??r?.getAttribute("data-mask-tlds"),h=a.tlds??(c?c.split(",").map(y=>y.trim()).filter(Boolean):void 0),p=s?.getAttribute("data-mask-default-tld")??r?.getAttribute("data-mask-default-tld"),m=a.defaultTld!==void 0?a.defaultTld:p!==null?p==="false"||p==="none"?null:p==="true"?!0:p:void 0,f={completeOnTab:!0,completeOnArrowRight:!0,completeOnEnter:!0,cycleSuggestions:a.cycleSuggestions??u??!1,autoLowercase:a.autoLowercase??d??!1,setAriaAutocomplete:l,...a,...h!==void 0?{tlds:h}:{},...m!==void 0?{defaultTld:m}:{}};super(s,r,f);this.currentSuggestion={full:"",remaining:"",matchedDomain:null};this.currentSuggestionIndex=0;this.wasAriaAutocompleteSet=!1;this.cutTimerId=null;this.resetTimerId=null;this.input.inputMode="email",this.options.setAriaAutocomplete&&!this.input.hasAttribute("aria-autocomplete")&&(this.input.setAttribute("aria-autocomplete","inline"),this.wasAriaAutocompleteSet=!0),this.engine=new O(this.options),this.bindEvents(),this.options.disabled||this.updateSuggestion()}onNativeValueSet(t){this.options.disabled||this.updateSuggestion()}onDisabledChange(t){t?this.ghost&&(this.ghost.textContent=""):this.updateSuggestion()}bindEvents(){this.handleInput=this.handleInput.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{this.cutTimerId=null,!(this.isDestroyed||this.options.disabled)&&this.updateSuggestion()},0)},this.input.addEventListener("input",this.handleInput),this.input.addEventListener("keydown",this.handleKeyDown),this.input.addEventListener("blur",this.handleBlur),this.input.addEventListener("focus",this.handleFocus),this.input.addEventListener("scroll",this.onScroll),this.input.addEventListener("cut",this.onCutHandler),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!(this.isDestroyed||this.options.disabled)&&this.updateSuggestion()},0)},this.input.form.addEventListener("reset",this.onFormResetHandler))}updateSuggestion(){if(this.options.disabled){this.ghost&&(this.ghost.textContent="");return}let t=this.input.value;if(this.currentSuggestion=this.engine.getSuggestion(t,this.currentSuggestionIndex),!this.ghost)return;if(this.shouldHideGhostForPlaceholder(t.length===0))this.ghost.textContent="";else if(this.currentSuggestion.remaining){this.ghost.textContent="";let n=document.createElement("span");n.className="mask-ghost-typed",n.textContent=t;let o=document.createElement("span");o.className="mask-ghost-remaining",o.textContent=this.currentSuggestion.remaining,this.ghost.appendChild(n),this.ghost.appendChild(o)}else this.ghost.textContent="";this.ghost.scrollLeft=this.input.scrollLeft;let i=this.getDetail();this.options.onInput&&this.options.onInput(i),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:!0,detail:i})),this.dispatchNativeInput()}handleInput(){if(!this.isDispatchingNativeInput&&!this.options.disabled){if(this.options.autoLowercase){let t=this.input.selectionStart??0,i=this.input.selectionEnd??t,n=this.input.value.toLowerCase();n!==this.input.value&&(this.setNativeValue(n),this.input.setSelectionRange(t,i))}this.currentSuggestionIndex=0,this.updateSuggestion()}}handleKeyDown(t){if(this.options.disabled)return;let i=!!this.currentSuggestion.remaining&&!this.currentSuggestion.isHintOnly,o=(this.input.selectionStart??0)===this.input.value.length,s=this.input.value.length>0;if(this.options.cycleSuggestions&&i&&s&&o){if(t.key==="ArrowDown"){t.preventDefault(),this.currentSuggestionIndex++,this.updateSuggestion();return}if(t.key==="ArrowUp"){t.preventDefault(),this.currentSuggestionIndex--,this.updateSuggestion();return}}if(t.key==="Tab"&&i&&s&&this.options.completeOnTab){t.preventDefault(),this.acceptSuggestion();return}if(t.key==="Enter"&&i&&s&&this.options.completeOnEnter){t.preventDefault(),this.acceptSuggestion();return}if(t.key==="ArrowRight"&&i&&s&&o&&this.options.completeOnArrowRight){t.preventDefault(),this.acceptSuggestion();return}}acceptSuggestion(){if(!this.currentSuggestion.remaining||this.currentSuggestion.isHintOnly||this.options.disabled||this.input.value.length===0)return!1;let t=this.currentSuggestion.full;this.setNativeValue(t),this.input.setSelectionRange(t.length,t.length),this.currentSuggestionIndex=0,this.updateSuggestion();let i=this.getDetail();return this.options.onChange&&this.options.onChange(i),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!0,detail:i})),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:!0,detail:i})),!0}setDefaultDomain(t){this.engine.setDefaultDomain(t),this.updateSuggestion()}setDefaultTld(t){this.engine.setDefaultTld(t),this.updateSuggestion()}setTlds(t){this.engine.setTlds(t),this.currentSuggestionIndex=0,this.updateSuggestion()}handleFocus(){this.wrapper.classList.add("is-focused"),this.syncGhostStyles(),this.updateSuggestion()}handleBlur(){this.wrapper.classList.remove("is-focused"),this.updateSuggestion();let t=this.getDetail();this.options.onChange&&this.options.onChange(t),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!0,detail:t}))}handleAttributeMutation(t){if(super.handleAttributeMutation(t),t==="data-mask-cycle-suggestions")this.options.cycleSuggestions=this.getAttr("data-mask-cycle-suggestions")==="true";else if(t==="data-mask-auto-lowercase")this.options.autoLowercase=this.getAttr("data-mask-auto-lowercase")==="true";else if(t==="data-mask-default-tld"){let i=this.getAttr("data-mask-default-tld");this.setDefaultTld(i===null||i==="false"||i==="none"?null:i==="true"?!0:i)}else if(t==="data-mask-tlds"){let i=this.getAttr("data-mask-tlds");this.setTlds(i?i.split(",").map(n=>n.trim()).filter(Boolean):null)}else t==="placeholder"&&this.updateSuggestion()}getDetail(){return{value:this.input.value,suggestedValue:this.currentSuggestion.isHintOnly?"":this.currentSuggestion.full,domain:this.currentSuggestion.matchedDomain}}setValue(t){let i=t!=null?String(t):"";this.setNativeValue(i),this.updateSuggestion()}destroy(){this.isDestroyed||(this.cutTimerId!==null&&(clearTimeout(this.cutTimerId),this.cutTimerId=null),this.resetTimerId!==null&&(clearTimeout(this.resetTimerId),this.resetTimerId=null),this.input.removeEventListener("input",this.handleInput),this.input.removeEventListener("keydown",this.handleKeyDown),this.input.removeEventListener("blur",this.handleBlur),this.input.removeEventListener("focus",this.handleFocus),this.input.removeEventListener("scroll",this.onScroll),this.input.removeEventListener("cut",this.onCutHandler),this.input.form&&this.onFormResetHandler&&this.input.form.removeEventListener("reset",this.onFormResetHandler),this.wasAriaAutocompleteSet&&this.input.getAttribute("aria-autocomplete")==="inline"&&this.input.removeAttribute("aria-autocomplete"),super.destroy())}};var F={BaseInputMask:M,InputMask:R,MaskEngine:A,MaskHistory:C,MaskKeyboard:D,AmountEngine:x,InputAmountMask:V,EmailEngine:O,InputEmailMask:P};if(typeof window<"u"){let v=window,e=v.Wulf||{};v.Wulf=e,e.Mask=F}var _=R;return z(Z);})();
1
+ "use strict";var Wulf=(()=>{var F=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var G=(b,i)=>{for(var t in i)F(b,t,{get:i[t],enumerable:!0})},z=(b,i,t,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of U(i))!$.call(b,n)&&n!==t&&F(b,n,{get:()=>i[n],enumerable:!(e=W(i,n))||e.enumerable});return b};var q=b=>z(F({},"__esModule",{value:!0}),b);var Z={};G(Z,{AmountEngine:()=>I,BaseInputMask:()=>A,EmailEngine:()=>H,InputAmountMask:()=>P,InputEmailMask:()=>V,InputMask:()=>R,Mask:()=>K,MaskEngine:()=>x,MaskHistory:()=>C,MaskKeyboard:()=>L,default:()=>_,resolveMaskConstructorArgs:()=>T});var B=class{getAuditDisableHint(){return"Passez { audit: false } dans les options pour d\xE9sactiver cet avertissement"}runAuditWarning(i=!0){if(!i)return[];let t=this.audit();return t.length>0&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[${this.getAuditPrefix()}] Audit d'accessibilit\xE9 \u2014 ${t.length} contrainte(s) manquante(s) sur ${this.getAuditTargetLabel()} :
2
+ `+t.map(e=>` - ${e}`).join(`
3
+ `)+`
4
+ (${this.getAuditDisableHint()})`),t}checkAriaIdReferences(i,t,e){let n=i.getAttribute(t)?.trim();if(!n)return!1;let o=i.ownerDocument||document,s=n.split(/\s+/).filter(Boolean),r=s.length>0&&s.every(a=>!!o.getElementById(a));return r||e.push(`Attribut ${t}="${n}" invalide : l'\xE9l\xE9ment cible est introuvable dans le DOM.`),r}};function T(b,i,t){return i&&typeof i=="object"&&"tagName"in i&&i.tagName==="INPUT"?{wrapper:b||null,input:i,options:t||{}}:{wrapper:null,input:b,options:i&&typeof i=="object"&&!("tagName"in i)?i:{}}}var A=class extends B{constructor(t,e,n){super();this.ghost=null;this.isWrapperCreated=!1;this.isDestroyed=!1;this.isFocused=!1;this.isDispatchingNativeInput=!1;this.lastTrackedValue="";this.nativeValueDescriptor=null;this.onCutHandler=()=>{};this.mutationObserver=null;this.focusSelectTimerId=null;this.onBaseCopy=t=>{if(!this.options.copyRaw||this.options.disabled||this.input.type==="password")return;let e=this.input.selectionStart??0,n=this.input.selectionEnd??e,o="";e!==n?o=this.extractRawSnippet(this.input.value.slice(e,n)):o=this.getRawValue(),o&&t.clipboardData&&(t.preventDefault(),t.clipboardData.setData("text/plain",o))};this.onBaseFocus=()=>{this.isFocused=!0,this.options.selectAllOnFocus&&this.input.value.length>0&&(this.focusSelectTimerId!==null&&clearTimeout(this.focusSelectTimerId),this.focusSelectTimerId=window.setTimeout(()=>{this.focusSelectTimerId=null,!this.isDestroyed&&document.activeElement===this.input&&this.input.select()},0))};this.onBaseBlur=()=>{this.isFocused=!1};this.onScroll=()=>{this.ghost&&(this.ghost.scrollLeft=this.input.scrollLeft)};let{wrapper:o,input:s,options:r}=T(t,e,n);if(!s||typeof s!="object"||s.nodeType!==1||s.tagName!=="INPUT")throw new Error(`[${new.target.name||"InputMask"}] input (HTMLInputElement) est requis.`);this.input=s;let a=this.input.getAttribute("data-mask-create-wrapper")==="true",u=!!(r.createWrapper??a),d=o;if(!d&&u){let w=document.createElement("span");w.className="wulf-mask-wrapper",w.style.display="inline-grid",w.style.gridTemplateColumns="1fr",w.style.gridTemplateRows="1fr",w.style.verticalAlign="middle",w.style.boxSizing="border-box",w.style.position="relative",this.input.parentNode&&this.input.parentNode.insertBefore(w,this.input),w.appendChild(this.input),this.input.style.gridArea="1 / 1 / 2 / 2",this.input.style.boxSizing="border-box",d=w,this.isWrapperCreated=!0}if(!d)throw new Error(`[${new.target.name||"InputMask"}] wrapper (HTMLElement) et input (HTMLInputElement) sont requis, ou activez l'option createWrapper: true.`);this.wrapper=d,this.normalizeInputType();let m=this.getAttr("data-mask-focus-only")==="true",l=this.hasAttr("data-disabled"),p=this.getAttr("data-mask-select-on-focus")==="true",h=this.getAttr("data-mask-copy-raw")==="true",c=this.getAttr("data-mask-align")||this.getAttr("data-align"),g=this.getAttr("data-mask-audit"),{disabled:f,align:v,...y}=r,E=f!==void 0?f:!!l,k=r.audit??(g!==null?g!=="false":!0),M=this.input.type==="password";this.options={...y,createWrapper:u,showMaskOnFocus:r.showMaskOnFocus??m??!1,selectAllOnFocus:r.selectAllOnFocus??p??!1,copyRaw:M?!1:r.copyRaw??h??!1,disabled:E,align:v??(c||void 0),emitNativeInput:r.emitNativeInput??!0,audit:k},this.options.showMaskOnFocus&&this.wrapper.classList.add("mask-focus-only"),this.options.disabled&&this.wrapper.setAttribute("data-disabled","true"),this.options.align&&this.setAlign(this.options.align),this.createGhost(),this.hookValueProperty(),this.bindBaseEvents(),this.initMutationObserver()}getAttr(t){return this.input.getAttribute(t)||this.wrapper.getAttribute(t)}hasAttr(t){return this.wrapper.hasAttribute(t)||this.input.hasAttribute(t)}hasNativePlaceholder(){return!!(this.input.placeholder&&this.input.placeholder.trim().length>0)}shouldHideGhostForPlaceholder(t){return!this.isFocused&&t&&this.hasNativePlaceholder()}bindBaseEvents(){this.input.addEventListener("copy",this.onBaseCopy),this.input.addEventListener("focus",this.onBaseFocus),this.input.addEventListener("blur",this.onBaseBlur)}extractRawSnippet(t){return t}initMutationObserver(){if(typeof MutationObserver>"u")return;this.mutationObserver=new MutationObserver(e=>{for(let n of e)n.type==="attributes"&&n.attributeName&&this.handleAttributeMutation(n.attributeName)});let t={attributes:!0,attributeFilter:["data-mask","data-mask-placeholder","data-mask-focus-only","data-mask-strict","data-mask-select-on-focus","data-mask-copy-raw","data-mask-pad-decimals","data-mask-auto-lowercase","data-mask-cycle-suggestions","data-mask-default-tld","data-mask-tlds","data-disabled","data-mask-align","data-align","placeholder"]};this.mutationObserver.observe(this.wrapper,t),this.input!==this.wrapper&&this.mutationObserver.observe(this.input,t)}setAlign(t){let e=t||void 0,n=this.wrapper.getAttribute("data-align");this.options.align===e&&n===(t||null)||(this.options.align=e,this.wrapper.classList.remove("align-left","align-right","align-center"),t?(this.wrapper.classList.add(`align-${t}`),this.wrapper.getAttribute("data-align")!==t&&this.wrapper.setAttribute("data-align",t)):this.wrapper.hasAttribute("data-align")&&this.wrapper.removeAttribute("data-align"),this.syncGhostStyles())}handleAttributeMutation(t){if(t==="data-disabled"){let e=this.hasAttr("data-disabled");e!==!!this.options.disabled&&this.setDisabled(e)}else if(t==="data-mask-focus-only"){let e=this.getAttr("data-mask-focus-only")==="true";e!==!!this.options.showMaskOnFocus&&this.setShowMaskOnFocus(e)}else if(t==="data-mask-select-on-focus")this.options.selectAllOnFocus=this.getAttr("data-mask-select-on-focus")==="true";else if(t==="data-mask-copy-raw")this.options.copyRaw=this.getAttr("data-mask-copy-raw")==="true";else if(t==="data-mask-align"||t==="data-align"){let e=this.getAttr("data-mask-align")||this.getAttr("data-align");e!==(this.options.align??null)&&this.setAlign(e)}}normalizeInputType(){let t=["number","email","date","datetime-local","month","week","time","color","file","range"];if(this.input.type&&t.includes(this.input.type.toLowerCase())){let e=this.input.type.toLowerCase();this.input.type="text",e==="number"&&(this.input.inputMode="numeric")}}createGhost(){let t=this.wrapper.querySelector(".mask-ghost");t&&t.remove(),this.ghost=document.createElement("div"),this.ghost.className="mask-ghost",this.ghost.setAttribute("aria-hidden","true"),this.ghost.style.display="flex",this.ghost.style.alignItems="center",this.wrapper.appendChild(this.ghost),this.wrapper.classList.add("has-ghost"),this.syncGhostStyles()}syncGhostStyles(){if(!this.ghost||typeof window>"u")return;let t=window.getComputedStyle(this.input);if(!t)return;this.ghost.style.fontFamily=t.fontFamily,this.ghost.style.fontSize=t.fontSize,this.ghost.style.fontWeight=t.fontWeight,this.ghost.style.fontStyle=t.fontStyle,this.ghost.style.letterSpacing=t.letterSpacing,this.ghost.style.lineHeight=t.lineHeight,this.ghost.style.paddingTop=t.paddingTop,this.ghost.style.paddingBottom=t.paddingBottom,this.ghost.style.paddingLeft=t.paddingLeft,this.ghost.style.paddingRight=t.paddingRight,this.ghost.style.borderTopWidth=t.borderTopWidth,this.ghost.style.borderBottomWidth=t.borderBottomWidth,this.ghost.style.borderLeftWidth=t.borderLeftWidth,this.ghost.style.borderRightWidth=t.borderRightWidth,this.ghost.style.borderTopStyle=t.borderTopStyle==="none"?"none":"solid",this.ghost.style.borderBottomStyle=t.borderBottomStyle==="none"?"none":"solid",this.ghost.style.borderLeftStyle=t.borderLeftStyle==="none"?"none":"solid",this.ghost.style.borderRightStyle=t.borderRightStyle==="none"?"none":"solid",this.ghost.style.borderColor="transparent",this.ghost.style.boxSizing=t.boxSizing,this.ghost.style.textAlign=t.textAlign,this.ghost.style.direction=t.direction;let e=t.direction==="rtl"||this.input.getAttribute("dir")==="rtl"||this.wrapper.getAttribute("dir")==="rtl";t.textAlign==="right"||t.textAlign==="end"||e&&t.textAlign!=="left"&&t.textAlign!=="center"?this.ghost.style.justifyContent="flex-end":t.textAlign==="center"?this.ghost.style.justifyContent="center":this.ghost.style.justifyContent="flex-start"}setNativeValue(t){this.nativeValueDescriptor&&this.nativeValueDescriptor.set?this.nativeValueDescriptor.set.call(this.input,t):this.input.value=t}dispatchNativeInput(){if(!(this.isDestroyed||typeof window>"u")&&this.options.emitNativeInput!==!1){this.isDispatchingNativeInput=!0;try{let t=this.input._valueTracker;t&&typeof t.setValue=="function"&&t.setValue(this.lastTrackedValue),this.lastTrackedValue=this.input.value,this.input.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))}finally{this.isDispatchingNativeInput=!1}}}hookValueProperty(){try{let t=HTMLInputElement.prototype,e=Object.getOwnPropertyDescriptor(t,"value");if(!e||!e.set||!e.get)return;this.nativeValueDescriptor=e;let n=this;Object.defineProperty(this.input,"value",{get(){return e.get.call(this)},set(o){let s=String(o??"");e.set.call(this,s),!n.isDestroyed&&n.onNativeValueSet(s)},configurable:!0})}catch{}}unhookValueProperty(){try{delete this.input.value}catch{}}setShowMaskOnFocus(t){this.options.showMaskOnFocus=t,this.wrapper.classList.toggle("mask-focus-only",t)}disabled(t){if(t===void 0)return!!this.options.disabled;this.setDisabled(t)}setDisabled(t){this.options.disabled=!!t,this.options.disabled?this.wrapper.setAttribute("data-disabled","true"):this.wrapper.removeAttribute("data-disabled"),this.onDisabledChange(this.options.disabled)}getWrapper(){return this.wrapper}getInput(){return this.input}getGhost(){return this.ghost}getElements(){return{wrapper:this.wrapper,input:this.input,ghost:this.ghost}}getValue(){return this.input.value}getRawValue(){return this.input.value}audit(){let t=[],e=this.input.ownerDocument||document,n=this.input.getAttribute("aria-label")?.trim(),o=this.checkAriaIdReferences(this.input,"aria-labelledby",t),s=!!this.input.closest("label"),r=!!(this.input.labels&&this.input.labels.length>0),a=!1;this.input.id&&typeof CSS<"u"&&typeof CSS.escape=="function"?a=!!e.querySelector(`label[for="${CSS.escape(this.input.id)}"]`):this.input.id&&(a=!!e.querySelector(`label[for="${this.input.id}"]`)),!n&&!o&&!s&&!r&&!a&&t.push(`\xC9tiquetage accessible manquant : associez un <label for="id"> (ou d\xE9finissez aria-label / aria-labelledby) sur l'input (WCAG 4.1.2).`),this.checkAriaIdReferences(this.input,"aria-describedby",t);let u=this.getSpecificAuditWarnings();return t.push(...u),t}getAuditPrefix(){return`Wulf.Mask.${this.constructor.name||"InputMask"}`}getAuditTargetLabel(){return this.input.id?`#${this.input.id}`:this.input.name?`input[name="${this.input.name}"]`:"<input>"}getAuditDisableHint(){return'Passez { audit: false } ou data-mask-audit="false" pour d\xE9sactiver cet avertissement'}getSpecificAuditWarnings(){return[]}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.focusSelectTimerId!==null&&(clearTimeout(this.focusSelectTimerId),this.focusSelectTimerId=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.input.removeEventListener("copy",this.onBaseCopy),this.input.removeEventListener("focus",this.onBaseFocus),this.input.removeEventListener("blur",this.onBaseBlur),this.unhookValueProperty(),this.ghost&&(this.ghost.remove(),this.ghost=null),this.isWrapperCreated&&this.wrapper?(this.input.style.gridArea="",this.input.style.boxSizing="",this.wrapper.parentNode&&this.wrapper.parentNode.insertBefore(this.input,this.wrapper),this.wrapper.remove()):this.wrapper&&(this.wrapper.removeAttribute("data-mask"),this.wrapper.removeAttribute("data-disabled"),this.wrapper.classList.remove("is-complete","is-focused","mask-focus-only","has-selection","has-ghost")))}};var j={9:{pattern:/[0-9]/},a:{pattern:/[a-zA-Z]/},A:{pattern:/[a-zA-Z]/,transform:b=>b.toUpperCase()},"*":{pattern:/[a-zA-Z0-9]/},"#":{pattern:/[a-zA-Z0-9]/,transform:b=>b.toUpperCase()}},x=class b{constructor(i,t={}){this.patterns=[];this.subEngines=[];this.activeEngine=null;this.slots=[];this.fullMaskTemplate="";this.prefixSlotsCount=0;this.prefixString="";this.strict=!0;this.autoLowercase=!1;let e=t||{};this.placeholderChar=e.placeholderChar||"_",this.tokens={...j,...e.tokens||{}},this.strict=e.strict!==!1,this.autoLowercase=e.autoLowercase??!1,this.pattern="",this.compile(i)}static format(i,t,e={}){return!t||Array.isArray(t)&&t.length===0?i??"":new b(t,e||{}).format(i??"")}compile(i){if(i!==void 0&&(Array.isArray(i)?(this.patterns=[...i],this.pattern=this.patterns[0]||""):(this.patterns=[],this.pattern=i)),this.patterns.length>0)return this.subEngines=this.patterns.map(n=>new b(n,{placeholderChar:this.placeholderChar,tokens:this.tokens,strict:this.strict,autoLowercase:this.autoLowercase})),this.activeEngine=this.subEngines[0],this.slots=this.activeEngine.slots,this.fullMaskTemplate=this.activeEngine.fullMaskTemplate,this.prefixSlotsCount=this.activeEngine.prefixSlotsCount,this.prefixString=this.activeEngine.prefixString,this.slots;this.subEngines=[],this.activeEngine=null,this.slots=[];let t="",e=!0;for(let n=0;n<this.pattern.length;n++){let o=this.pattern[n],s=!1;o==="\\"&&n+1<this.pattern.length&&(s=!0,n++,o=this.pattern[n]);let r=s?void 0:this.tokens[o];r?(e=!1,this.slots.push({char:o,isStatic:!1,isPrefix:!1,token:r,placeholder:this.placeholderChar}),t+=this.placeholderChar):(this.slots.push({char:o,isStatic:!0,isPrefix:e,placeholder:o}),t+=o)}this.fullMaskTemplate=t,this.prefixSlotsCount=0,this.prefixString="";for(let n of this.slots)if(n.isPrefix)this.prefixSlotsCount++,this.prefixString+=n.char;else break;return this.slots}selectEngine(i){if(this.subEngines.length<=1)return this;let t=String(i??""),e=this.subEngines.filter(a=>{let u=a.getPrefix();return u.length>0&&t.toLowerCase().startsWith(u.trim().toLowerCase())}),n=e.length>0?e:this.subEngines,o=[...n].sort((a,u)=>u.getEditableCount()-a.getEditableCount())[0],r=(o?o.extractRaw(t):t).length;for(let a of n)if(a.getEditableCount()>=r)return this.activeEngine=a,a;return this.activeEngine=n[n.length-1],this.activeEngine}getPrefix(){return this.activeEngine?this.activeEngine.getPrefix():this.prefixString}getPrefixLength(){return this.activeEngine?this.activeEngine.getPrefixLength():this.prefixSlotsCount}getFullMaskTemplate(){return this.activeEngine?this.activeEngine.getFullMaskTemplate():this.fullMaskTemplate}getEditableCount(){return this.subEngines.length>0?Math.max(...this.subEngines.map(i=>i.getEditableCount())):this.activeEngine?this.activeEngine.getEditableCount():this.slots.filter(i=>!i.isStatic).length}isNumericOnly(){if(this.subEngines.length>0)return this.subEngines.every(e=>e.isNumericOnly());let t=(this.activeEngine?this.activeEngine.slots:this.slots).filter(e=>!e.isStatic);return t.length===0?!1:t.every(e=>e.char==="9"||e.token&&e.token.pattern.test("0")&&!e.token.pattern.test("a")&&!e.token.pattern.test("Z"))}setStrict(i){this.strict=i}isStrict(){return this.strict}extractRaw(i){if(this.subEngines.length>0){let s=this.selectEngine(i);if(s!==this)return s.extractRaw(i)}let t=String(i??"");if(!t)return"";let e="",n=0,o=0;if(this.prefixSlotsCount>0){for(;n<t.length&&(t[n]===" "||t[n]===" ");)n++;let s=0;for(;n<t.length&&s<this.prefixSlotsCount;){let r=this.slots[s].char,a=t[n];if(a.toUpperCase()===r.toUpperCase())n++,s++;else if(r===" "&&a!==" ")s++;else break}o=this.prefixSlotsCount}for(;n<t.length&&o<this.slots.length;){let s=this.slots[o],r=t[n];if(s.isStatic)r.toUpperCase()===s.char.toUpperCase()&&n++,o++;else if(s.token&&s.token.pattern.test(r)){let a=s.token.transform?s.token.transform(r):r;this.autoLowercase&&!s.token.transform&&(a=a.toLowerCase()),e+=a,n++,o++}else this.strict?n++:(e+=this.autoLowercase?r.toLowerCase():r,n++,o++)}if(!this.strict&&n<t.length){let s=t.slice(n);e+=this.autoLowercase?s.toLowerCase():s}return e}format(i){if(this.subEngines.length>0){let s=this.selectEngine(i);if(s!==this)return s.format(i)}let t=String(i??"");if(!this.slots.length)return t;let e=this.extractRaw(t);if(e.length===0)return this.prefixString;let n="",o=0;for(let s=0;s<this.slots.length;s++){let r=this.slots[s];if(r.isStatic){let a=o<e.length,u=o===0&&!!r.isPrefix,d=o>0&&o===e.length;if(a||u||d)n+=r.char;else break}else if(o<e.length){let a=e[o],u=r.token?.transform?r.token.transform(a):a;this.autoLowercase&&!r.token?.transform&&(u=u.toLowerCase()),n+=u,o++}else break}if(!this.strict&&o<e.length){let s=e.substring(o);n+=this.autoLowercase?s.toLowerCase():s}return n}getRemainingMask(i){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getRemainingMask(i):this.fullMaskTemplate?i.length>=this.fullMaskTemplate.length?i:i+this.fullMaskTemplate.substring(i.length):""}mapCursorPosition(i,t,e){if(this.activeEngine&&this.activeEngine!==this)return this.activeEngine.mapCursorPosition(i,t,e);let n=this.prefixSlotsCount,o=String(i??""),s=String(e??"");if(t<=0||!s)return n;let a=this.extractRaw(o.slice(0,t)).length;if(a===0)return Math.max(n,Math.min(this.getNextEditablePosition(0),s.length));let u=0,d=s.length;for(let m=0;m<s.length&&m<this.slots.length;m++)if(!this.slots[m].isStatic&&(u++,u===a)){d=m+1;break}for(;d<s.length&&this.slots[d]&&this.slots[d].isStatic;)d++;return Math.max(n,Math.min(d,s.length))}isSeparatorAt(i){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.isSeparatorAt(i):i>=0&&i<this.slots.length?this.slots[i].isStatic:!1}getNextEditablePosition(i){if(this.activeEngine&&this.activeEngine!==this)return this.activeEngine.getNextEditablePosition(i);let t=Math.max(0,i);for(let e=t;e<this.slots.length;e++)if(!this.slots[e].isStatic)return e;return this.slots.length}getSlotAt(i){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getSlotAt(i):this.slots[i]}getSlots(){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getSlots():this.slots}};var C=class{constructor(i=50){this.stack=[];this.index=-1;this.maxDepth=i}push(i,t){let e=this.getCurrent();if(e&&e.raw===i){e.cursor=t;return}this.stack=this.stack.slice(0,this.index+1),this.stack.push({raw:i,cursor:t}),this.stack.length>this.maxDepth&&this.stack.shift(),this.index=this.stack.length-1}updateCurrentCursor(i){let t=this.getCurrent();t&&(t.cursor=i)}undo(){return this.canUndo()?(this.index--,this.stack[this.index]):null}redo(){return this.canRedo()?(this.index++,this.stack[this.index]):null}canUndo(){return this.index>0}canRedo(){return this.index>=0&&this.index<this.stack.length-1}getCurrent(){return this.index>=0&&this.index<this.stack.length?this.stack[this.index]:null}clear(){this.stack=[],this.index=-1}};var L=class{constructor(i){this.delegate=i}handleKeyDown(i){let t=this.delegate.getInput(),e=this.delegate.getEngine(),n=this.delegate.getHistory(),o=e.getPrefixLength(),s=t.selectionStart??0,r=t.selectionEnd??s;if((i.ctrlKey||i.metaKey)&&(i.key==="z"||i.key==="Z")&&!i.shiftKey){i.preventDefault(),this.delegate.undo();return}if((i.ctrlKey||i.metaKey)&&(i.key==="y"||i.key==="Y")||(i.ctrlKey||i.metaKey)&&i.shiftKey&&(i.key==="z"||i.key==="Z")){i.preventDefault(),this.delegate.redo();return}n.updateCurrentCursor(s);let a=i.key.length===1&&!i.ctrlKey&&!i.metaKey&&!i.altKey,u=r>s;if(a&&!u){let l=e.getSlots(),p=s<l.length&&l[s].isStatic&&l[s].char===i.key,h=s>0&&s-1<l.length&&l[s-1].isStatic&&l[s-1].char===i.key;if(p||h){i.preventDefault();let g=p?s:s-1,f=e.getNextEditablePosition(g+1);this.delegate.applyMask(t.value,f,!0);return}let c=-1;for(let g=s;g<l.length;g++)if(l[g].isStatic){l[g].char===i.key&&(c=g);break}if(c!==-1){i.preventDefault();let g=c-1;for(;g>=o&&!l[g].isStatic;)g--;g++;let f=c-g,v=t.value.slice(g,s);if(l.slice(g,c).every(k=>!k.token||k.token.pattern.test("0"))&&f>v.length&&v.length>0){let k=f-v.length,M="0".repeat(k)+v,w=t.value.slice(c),N=t.value.slice(0,g)+M+w,S=e.getNextEditablePosition(c+1);this.delegate.applyMask(N,S,!0);return}let E=e.getNextEditablePosition(c+1);this.delegate.applyMask(t.value,E,!0);return}}if(a&&e.isStrict()){let l=e.getEditableCount();if(l>0){let p=e.extractRaw(t.value),h=l-p.length;if(r>s){let c=e.extractRaw(t.value.slice(s,r));h=l-(p.length-c.length)}if(h<=0){i.preventDefault();return}}}if(r>s){if(i.key==="Backspace"||i.key==="Delete"){i.preventDefault();let l=t.value,p=l.slice(0,s)+l.slice(r);this.delegate.applyMask(p,Math.max(o,s));return}return}if(i.key==="ArrowLeft"&&!i.shiftKey&&s<=o){i.preventDefault(),t.setSelectionRange(o,o);return}if(i.key==="Home"&&!i.shiftKey){i.preventDefault(),t.setSelectionRange(o,o);return}if(i.key==="Backspace"&&s<=o){i.preventDefault(),t.setSelectionRange(o,o);return}if(i.key==="Delete"&&s<o){i.preventDefault(),t.setSelectionRange(o,o);return}if(i.key==="Backspace"&&(i.ctrlKey||i.altKey||i.metaKey)){if(i.preventDefault(),s<=o){t.setSelectionRange(o,o);return}let l=s-1;for(;l>=o&&e.isSeparatorAt(l);)l--;for(;l>=o&&!e.isSeparatorAt(l);)l--;let p=Math.max(o,l+1),h=t.value,c=h.slice(0,p)+h.slice(s);this.delegate.applyMask(c,p);return}if(i.key==="Delete"&&(i.ctrlKey||i.altKey||i.metaKey)){i.preventDefault();let l=t.value;if(s>=l.length)return;let p=s;for(;p<l.length&&e.isSeparatorAt(p);)p++;for(;p<l.length&&!e.isSeparatorAt(p);)p++;for(;p<l.length&&e.isSeparatorAt(p);)p++;let h=p,c=l.slice(0,s)+l.slice(h);this.delegate.applyMask(c,s);return}if(i.key==="Backspace"&&s>o){if(e.isSeparatorAt(s-1)){i.preventDefault();let l=s-1;for(;l>o&&e.isSeparatorAt(l-1);)l--;if(l>o){let p=t.value,h=p.slice(0,l-1)+p.slice(s);this.delegate.applyMask(h,l-1)}else this.delegate.applyMask("",o)}return}if(i.key==="Delete"&&s<t.value.length){if(e.isSeparatorAt(s)){i.preventDefault();let l=s;for(;l<t.value.length&&e.isSeparatorAt(l);)l++;if(l<t.value.length){let p=t.value,h=p.slice(0,l)+p.slice(l+1);this.delegate.applyMask(h,s)}}return}}handleKeyUp(i){let t=this.delegate.getInput(),e=this.delegate.getHistory();(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="Home")&&!i.shiftKey&&this.delegate.enforceMinCursor(),e.updateCurrentCursor(t.selectionStart??0)}};var R=class extends A{constructor(t,e,n){let o=T(t,e,n),s=o.wrapper,r=o.input,a=o.options,u=s?.getAttribute("data-mask")||r?.getAttribute("data-mask"),d=a.mask||u||"";typeof d=="string"&&d.includes("|")&&(d=d.split("|").map(k=>k.trim()));let m=a.placeholderChar||s?.getAttribute("data-mask-placeholder")||r?.getAttribute("data-mask-placeholder")||"_",l=s?.hasAttribute("data-disabled")||r?.hasAttribute("data-disabled"),p=s?.getAttribute("data-mask-strict")||r?.getAttribute("data-mask-strict"),h=s?.getAttribute("data-mask-auto-lowercase")==="true"||r?.getAttribute("data-mask-auto-lowercase")==="true",c=s?.getAttribute("data-mask-infer-inputmode")??r?.getAttribute("data-mask-infer-inputmode"),g=a.inferInputMode??(c!==null?c!=="false":!0),{disabled:f,...v}=a,y=f!==void 0?f:l?!0:!d||Array.isArray(d)&&d.length===0,E={...v,mask:d,placeholderChar:m,strict:a.strict??(p!==null?p!=="false":!0),autoLowercase:a.autoLowercase??h??!1,disabled:y,resetHistoryOnMaskChange:a.resetHistoryOnMaskChange??!1,inferInputMode:g,onInput:a.onInput||a.oninput,onChange:a.onChange||a.onchange,onComplete:a.onComplete||a.oncomplete};super(s,r,E);this.isComposing=!1;this.isUndoingRedoing=!1;this.isMouseDown=!1;this.isApplyingMask=!1;this.lastValue="";this.lastInternalRemainingMask="";this.isNotifying=!1;this.hasPendingNotification=!1;this.onChangeNativeHandler=()=>{};this.wasInputModeInferred=!1;this.cutTimerId=null;this.pasteTimerId=null;this.resetTimerId=null;this.history=new C,this.engine=new x(this.options.mask||"",{placeholderChar:this.options.placeholderChar,tokens:this.options.tokens,strict:this.options.strict,autoLowercase:this.options.autoLowercase}),this.syncInferredInputMode(),this.keyboard=new L({getInput:()=>this.input,getEngine:()=>this.engine,getHistory:()=>this.history,applyMask:(k,M,w)=>this.applyMask(k,M,w),undo:()=>this.undo(),redo:()=>this.redo(),enforceMinCursor:()=>this.enforceMinCursor()}),this.bindEvents(),this.lastValue=this.input.value,this.syncInitialValue(),this.runAuditWarning(this.options.audit)}getSpecificAuditWarnings(){let t=[],e=!!this.input.getAttribute("aria-describedby")?.trim(),n=!!this.input.getAttribute("placeholder")?.trim(),o=!!this.input.getAttribute("aria-placeholder")?.trim();return!e&&!n&&!o&&!this.options.disabled&&t.push("Indication du format attendu manquante : d\xE9finissez aria-describedby, placeholder ou aria-placeholder pour informer les technologies d'assistance (WCAG 3.3.2)."),t}extractRawSnippet(t){return this.engine.extractRaw(t)}static format(t,e,n={}){return x.format(t,e,n)}onNativeValueSet(t){this.options.disabled?this.checkValueChange():this.applyMask(t,t.length)}onDisabledChange(t){t?(this.wrapper.removeAttribute("data-mask"),this.wrapper.classList.remove("is-complete","has-selection"),this.ghost&&(this.ghost.textContent=""),this.checkValueChange()):this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length)}bindEvents(){this.handleInput=this.handleInput.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onPaste=this.onPaste.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.onClick=this.onClick.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onSelect=this.onSelect.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onCompositionStart=this.onCompositionStart.bind(this),this.onCompositionEnd=this.onCompositionEnd.bind(this),this.onScroll=this.onScroll.bind(this),this.onBeforeInput=this.onBeforeInput.bind(this),this.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{if(this.cutTimerId=null,!this.isDestroyed)if(this.options.disabled)this.checkValueChange();else{let t=this.input.selectionStart??this.input.value.length;this.applyMask(this.input.value,t)}},0)},this.onChangeNativeHandler=()=>{this.isDestroyed||this.checkValueChange()},this.input.addEventListener("beforeinput",this.onBeforeInput),this.input.addEventListener("input",this.handleInput),this.input.addEventListener("keydown",this.onKeyDown),this.input.addEventListener("paste",this.onPaste),this.input.addEventListener("focus",this.onFocus),this.input.addEventListener("blur",this.onBlur),this.input.addEventListener("click",this.onClick),this.input.addEventListener("keyup",this.onKeyUp),this.input.addEventListener("select",this.onSelect),this.input.addEventListener("mousedown",this.onMouseDown),window.addEventListener("mouseup",this.onMouseUp),this.input.addEventListener("compositionstart",this.onCompositionStart),this.input.addEventListener("compositionend",this.onCompositionEnd),this.input.addEventListener("scroll",this.onScroll),this.input.addEventListener("cut",this.onCutHandler),this.input.addEventListener("change",this.onChangeNativeHandler),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!this.isDestroyed&&(this.options.disabled?this.checkValueChange():this.syncInitialValue())},0)},this.input.form.addEventListener("reset",this.onFormResetHandler))}syncInferredInputMode(){if(!this.options.inferInputMode)return;!this.options.disabled&&this.engine.isNumericOnly()?this.input.hasAttribute("inputmode")||(this.input.inputMode="numeric",this.wasInputModeInferred=!0):this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="numeric"&&(this.input.removeAttribute("inputmode"),this.wasInputModeInferred=!1)}destroy(){this.isDestroyed||(this.cutTimerId!==null&&(clearTimeout(this.cutTimerId),this.cutTimerId=null),this.pasteTimerId!==null&&(clearTimeout(this.pasteTimerId),this.pasteTimerId=null),this.resetTimerId!==null&&(clearTimeout(this.resetTimerId),this.resetTimerId=null),this.input.removeEventListener("beforeinput",this.onBeforeInput),this.input.removeEventListener("input",this.handleInput),this.input.removeEventListener("keydown",this.onKeyDown),this.input.removeEventListener("paste",this.onPaste),this.input.removeEventListener("focus",this.onFocus),this.input.removeEventListener("blur",this.onBlur),this.input.removeEventListener("click",this.onClick),this.input.removeEventListener("keyup",this.onKeyUp),this.input.removeEventListener("select",this.onSelect),this.input.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mouseup",this.onMouseUp),this.input.removeEventListener("compositionstart",this.onCompositionStart),this.input.removeEventListener("compositionend",this.onCompositionEnd),this.input.removeEventListener("scroll",this.onScroll),this.input.removeEventListener("cut",this.onCutHandler),this.input.removeEventListener("change",this.onChangeNativeHandler),this.input.form&&this.onFormResetHandler&&this.input.form.removeEventListener("reset",this.onFormResetHandler),this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="numeric"&&this.input.removeAttribute("inputmode"),this.history.clear(),super.destroy())}setStrict(t){this.options.strict=t,this.engine.setStrict(t),this.options.disabled||this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length)}isStrict(){return this.engine.isStrict()}setMask(t,e){let n=typeof e=="boolean"?e:e&&typeof e=="object"&&e.strict!==void 0?e.strict:this.options.strict,o=e&&typeof e=="object"&&e.resetHistory!==void 0?e.resetHistory:!!this.options.resetHistoryOnMaskChange;if(!((!t||Array.isArray(t)&&t.length===0)&&this.options.disabled&&(!this.options.mask||this.options.mask===""))){if(!t||Array.isArray(t)&&t.length===0){this.options.mask="",this.options.strict=n,this.engine.setStrict(n??!0),this.engine.compile(""),o&&this.history.clear(),this.setDisabled(!0),this.syncInferredInputMode();return}this.options.mask=t,this.options.strict=n,this.engine.setStrict(n??!0),this.engine.compile(t),o&&this.history.clear(),this.setDisabled(!1),this.syncInferredInputMode()}}handleAttributeMutation(t){if(super.handleAttributeMutation(t),t==="data-mask"){let e=this.getAttr("data-mask");if(e===this.lastInternalRemainingMask)return;let n=Array.isArray(this.options.mask)?this.options.mask.join("|"):this.options.mask||"";if(e===n)return;if(e){let o=e.includes("|")?e.split("|").map(s=>s.trim()):e;this.setMask(o)}else this.setMask(null)}else if(t==="data-mask-strict"){let e=this.getAttr("data-mask-strict");this.setStrict(e!=="false")}else t==="data-mask-auto-lowercase"?(this.options.autoLowercase=this.getAttr("data-mask-auto-lowercase")==="true",this.engine.compile(this.options.mask||""),this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length)):t==="placeholder"&&this.updateGhost(this.input.value)}setValue(t){let e=t!=null?String(t):"";if(this.options.disabled){this.input.value=e,this.checkValueChange();return}this.applyMask(e,e.length)}getRawValue(){return this.engine.extractRaw(this.input.value)}isComplete(){return this.options.disabled?!0:this.getRawValue().length>=this.engine.getEditableCount()}get onInput(){return this.options.onInput}set onInput(t){this.options.onInput=t}undo(){if(this.options.disabled)return;let t=this.history.undo();t&&(this.isUndoingRedoing=!0,this.applyMask(t.raw,t.cursor),this.isUndoingRedoing=!1)}redo(){if(this.options.disabled)return;let t=this.history.redo();t&&(this.isUndoingRedoing=!0,this.applyMask(t.raw,t.cursor),this.isUndoingRedoing=!1)}checkSelection(){if(this.options.disabled)return;let t=this.input.selectionStart??0,e=this.input.selectionEnd??t,n=t!==e;this.wrapper.classList.toggle("has-selection",n)}onBeforeInput(t){if(!this.options.disabled&&!this.isComposing&&this.engine.isStrict()&&t.inputType!=="insertFromPaste"&&t.inputType&&t.inputType.startsWith("insert")){let e=this.engine.getEditableCount();if(e>0){let n=this.getRawValue(),o=this.input.selectionStart??0,s=this.input.selectionEnd??o,r=Math.max(0,e-n.length);if(s>o){let a=this.engine.extractRaw(this.input.value.slice(o,s));r=Math.max(0,e-(n.length-a.length))}r<=0&&t.preventDefault()}}}handleInput(t){if(this.isDispatchingNativeInput||this.isComposing)return;if(!!(this.options.onInput||this.options.oninput)&&this.input.value!==this.lastValue&&this.checkValueChange(),this.options.disabled){this.checkValueChange();return}let n=this.history.getCurrent(),o=this.engine.getEditableCount();if(o>0&&this.engine.isStrict()&&n&&n.raw.length>=o&&this.engine.extractRaw(this.input.value).length>o){this.applyMask(n.raw,n.cursor);return}let s=this.input.selectionStart??this.input.value.length;this.applyMask(this.input.value,s),this.checkSelection()}onKeyDown(t){this.options.disabled||this.keyboard.handleKeyDown(t)}onMouseDown(){this.isMouseDown=!0}onMouseUp(){this.isMouseDown=!1,this.checkSelection()}onPaste(t){if(this.options.disabled){this.pasteTimerId!==null&&clearTimeout(this.pasteTimerId),this.pasteTimerId=window.setTimeout(()=>{this.pasteTimerId=null,this.isDestroyed||this.checkValueChange()},0);return}t.preventDefault(),this.history.updateCurrentCursor(this.input.selectionStart??0);let n=(t.clipboardData?.getData("text")||"").trim();if(!n)return;let o=this.engine.getPrefixLength(),s=this.input.selectionStart??0,r=this.input.selectionEnd??s,a=this.input.value,u=this.engine.getEditableCount(),d=this.getRawValue(),l=this.engine.getPrefix().replace(/[\s.-]+/g,"").toUpperCase(),p=n.replace(/[\s.-]+/g,"").toUpperCase(),h=l.length>0&&p.startsWith(l),c=a.slice(0,Math.max(o,s)).replace(/[\s.-]+/g,"").toUpperCase(),g=c.length>=2&&p.startsWith(c),f=Math.max(o,s),v=Math.max(o,r);(h||g)&&(f=0,v=a.length);let y=Math.max(0,u-d.length);if(f!==v){let M=this.engine.extractRaw(a.slice(f,v));y=Math.max(0,u-(d.length-M.length))}if(this.engine.isStrict()&&y<=0)return;let E,k;f===0&&v===a.length?(E=n,k=n.length):(E=a.slice(0,f)+n+a.slice(v),k=f+n.length),this.applyMask(E,k),this.checkSelection()}onFocus(){this.syncGhostStyles(),this.wrapper.classList.add("is-focused"),!this.options.disabled&&!this.isMouseDown&&this.enforceMinCursor(),this.updateGhost(this.input.value),this.checkSelection()}onBlur(){this.wrapper.classList.remove("is-focused","has-selection"),this.input.type==="password"&&this.history.clear(),this.updateGhost(this.input.value)}onClick(){this.options.disabled||this.enforceMinCursor(),this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onKeyUp(t){this.options.disabled||this.keyboard.handleKeyUp(t),this.checkSelection()}onSelect(){this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onCompositionStart(){this.isComposing=!0}onCompositionEnd(){if(this.isComposing=!1,this.options.disabled)return;let t=this.input.selectionStart??this.input.value.length;this.applyMask(this.input.value,t),this.checkSelection()}enforceMinCursor(){let t=this.engine.getPrefixLength();if(t<=0)return;let e=this.input.selectionStart??0,n=this.input.selectionEnd??e;e===n&&e<t&&this.input.setSelectionRange(t,t)}updateGhost(t){if(!this.ghost)return;if(this.options.disabled){this.ghost.textContent="";return}let e=!t||t===this.engine.getPrefix();if(this.shouldHideGhostForPlaceholder(e)){this.ghost.textContent="";return}let n=this.engine.getFullMaskTemplate(),o=n.length>t.length?n.substring(t.length):"";this.ghost.textContent="";let s=document.createElement("span");s.className="mask-ghost-typed",s.textContent=t;let r=document.createElement("span");r.className="mask-ghost-remaining",r.textContent=o,this.ghost.appendChild(s),this.ghost.appendChild(r),this.ghost.scrollLeft=this.input.scrollLeft}applyMask(t,e,n=!1){if(this.options.disabled||this.isApplyingMask)return;this.isApplyingMask=!0;let o="",s=!1;try{o=this.engine.format(t);let r=this.engine.getRemainingMask(o);this.input.value=o,this.lastInternalRemainingMask=r,this.wrapper.setAttribute("data-mask",r),this.updateGhost(o);let a=this.engine.getPrefixLength(),u;if(n||this.isUndoingRedoing)u=Math.max(a,Math.min(e,o.length));else{let d=this.engine.mapCursorPosition(t,e,o);u=Math.max(a,d)}this.input.setSelectionRange(u,u),s=this.isComplete(),this.wrapper.classList.toggle("is-complete",s),!this.isUndoingRedoing&&this.input.type!=="password"&&this.history.push(this.getRawValue(),u)}finally{this.isApplyingMask=!1}this.checkValueChange()}syncInitialValue(){if(this.options.disabled){this.wrapper.removeAttribute("data-mask"),this.ghost&&(this.ghost.textContent=""),this.lastValue=this.input.value,this.checkValueChange();return}this.syncGhostStyles();let t=this.input.value||"";if(t)this.applyMask(t,t.length);else{let e=this.engine.getPrefixLength();if(e>0)this.applyMask("",e);else{this.input.type!=="password"&&this.history.push("",0);let n=this.engine.getFullMaskTemplate();this.lastInternalRemainingMask=n,this.wrapper.setAttribute("data-mask",n),this.updateGhost(""),this.checkValueChange()}}}checkValueChange(t=!1){if(!(this.input.value===this.lastValue&&!t&&!this.hasPendingNotification)){if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{for(;this.input.value!==this.lastValue||this.hasPendingNotification||t;){this.hasPendingNotification=!1,t=!1;let n=this.input.value;this.lastValue=n;let o=this.options.disabled?n:this.getRawValue(),s=this.options.disabled?0:this.engine.getEditableCount(),r=this.isComplete(),a={value:n,rawValue:o,isComplete:r,totalSlots:s,filledSlots:this.options.disabled?n.length:o.length},u=this.options.onInput||this.options.oninput;u&&u(n,a),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:!0,detail:a})),this.dispatchNativeInput();let d=this.options.onChange||this.options.onchange;d&&d(a),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!0,detail:a}));let m=this.options.onComplete||this.options.oncomplete;r&&(m&&m(a),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:!0,detail:a})))}}finally{this.isNotifying=!1}}}};var I=class b{constructor(i={}){let t=i.currency??"";!t&&i.unit&&(t=i.unit);let e=t==="$"||t==="\xA3"||t==="\xA5"?"prefix":"suffix";this.options={currency:t,unit:i.unit??t,currencyPosition:i.currencyPosition??e,decimals:i.decimals!==void 0?Math.max(0,i.decimals):2,decimalSeparator:i.decimalSeparator??",",thousandSeparator:i.thousandSeparator??"\xA0",allowNegative:i.allowNegative??!1,min:i.min??-1/0,max:i.max??1/0}}parse(i){let t=i.trim(),e=!1;this.options.allowNegative&&t.includes("-")&&(e=!0),this.options.currency&&(t=t.replace(new RegExp(this.escapeRegExp(this.options.currency),"g"),"")),this.options.thousandSeparator&&(t=t.replace(new RegExp(this.escapeRegExp(this.options.thousandSeparator),"g"),"")),t=t.replace(/[\s\u00A0]/g,"");let n=this.options.decimalSeparator,o=t.indexOf(n);o===-1&&(o=t.search(/[,.]/));let s="",r=null,a=!1;return o!==-1?(s=t.substring(0,o).replace(/\D/g,""),this.options.decimals>0&&(a=!0,r=t.substring(o+1).replace(/\D/g,"").slice(0,this.options.decimals))):s=t.replace(/\D/g,""),s.length>1&&(s=s.replace(/^0+/,"")||"0"),{isNegative:e,integerPart:s,decimalPart:r,hasDecimal:a}}format(i,t=i.length,e=!1){if(!i||i.trim()===""||i===this.options.currency.trim())return{formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0};let n=i.substring(0,t),o=n.replace(/\D/g,"").length,s=this.options.decimals>0&&/[,.]/.test(n),{isNegative:r,integerPart:a,decimalPart:u,hasDecimal:d}=this.parse(i),m=u,l=d;if(e&&this.options.decimals>0&&(a||u!==null)&&(l=!0,m===null?m="0".repeat(this.options.decimals):m.length<this.options.decimals&&(m=m+"0".repeat(this.options.decimals-m.length))),r&&!a&&!m&&!l&&this.options.allowNegative){let S="-",D=1;return this.options.currency&&(this.options.currencyPosition==="prefix"?(S=`${this.options.currency} -`,D=S.length):(S=`- ${this.options.currency}`,D=1)),{formatted:S,rawNumber:null,rawValue:"-",cursor:D,isValid:!0}}if(!a&&!m&&!l)return{formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0};let h=(a||"0").replace(/\B(?=(\d{3})+(?!\d))/g,this.options.thousandSeparator);l&&this.options.decimals>0&&(h+=this.options.decimalSeparator+(m??"")),r&&h!=="0"&&(h="-"+h);let c=h;this.options.currency&&(this.options.currencyPosition==="prefix"?c=`${this.options.currency} ${h}`:c=`${h} ${this.options.currency}`);let g=(r?"-":"")+(a||"0")+(u?"."+u:""),f=parseFloat(g);isNaN(f)&&(f=0);let v=f>=this.options.min&&f<=this.options.max,y=0;this.options.currency&&this.options.currencyPosition==="prefix"&&(y=this.options.currency.length+1);let E=0,k=!1,M=y;for(let S=y;S<c.length;S++){let D=c[S];if(D===this.options.currency.trim()[0]&&this.options.currencyPosition==="suffix")break;if(/\d/.test(D)?(E++,M=S+1):D===this.options.decimalSeparator&&(k=!0,M=S+1),s){if(k&&E>=o){y=S+1;break}}else if(E>=o){y=S+1;break}}o>0&&E<o&&M>y&&(y=M);let w=this.options.currency&&this.options.currencyPosition==="prefix"?this.options.currency.length+1:0,N=this.options.currency&&this.options.currencyPosition==="suffix"?Math.max(0,c.length-this.options.currency.length-1):c.length;return y=Math.max(w,Math.min(y,Math.max(w,N))),{formatted:c,rawNumber:f,rawValue:g,cursor:y,isValid:v}}static format(i,t={}){let e=new b(t),n=typeof i=="number"?i.toString():i;return e.format(n).formatted}escapeRegExp(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};var P=class extends A{constructor(t,e,n){let o=T(t,e,n),s=o.wrapper,r=o.input,a=o.options,u=s?.getAttribute("data-mask-pad-decimals")==="true"||r?.getAttribute("data-mask-pad-decimals")==="true",d=r?.getAttribute("data-mask-align")||r?.getAttribute("data-align")||s?.getAttribute("data-mask-align")||s?.getAttribute("data-align"),m={align:a.align??d??"right",padDecimalsOnBlur:a.padDecimalsOnBlur??u??!1,...a};super(s,r,m);this.isUndoingRedoing=!1;this.isApplying=!1;this.isComposing=!1;this.lastValue="";this.cutTimerId=null;this.resetTimerId=null;this.input.inputMode="decimal",this.history=new C,this.engine=new I(this.options),this.bindEvents(),this.input.value?this.options.disabled||this.applyAmount(this.input.value,this.input.value.length):this.updateGhost({formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0}),this.runAuditWarning(this.options.audit)}extractRawSnippet(t){let e=this.engine.parse(t);return!e.integerPart&&!e.decimalPart?"":(e.isNegative?"-":"")+(e.integerPart||"0")+(e.decimalPart?"."+e.decimalPart:"")}static format(t,e={}){return I.format(t,e)}onNativeValueSet(t){if(this.options.disabled||this.isComposing){this.lastValue=t;return}this.applyAmount(t,t.length)}onDisabledChange(t){t||this.applyAmount(this.input.value,this.input.selectionStart??this.input.value.length)}bindEvents(){this.handleInput=this.handleInput.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.onCompositionStart=this.onCompositionStart.bind(this),this.onCompositionEnd=this.onCompositionEnd.bind(this),this.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{if(this.cutTimerId=null,this.isDestroyed||this.options.disabled)return;let t=this.input.selectionStart??this.input.value.length;this.applyAmount(this.input.value,t)},0)},this.input.addEventListener("input",this.handleInput),this.input.addEventListener("keydown",this.handleKeyDown),this.input.addEventListener("blur",this.handleBlur),this.input.addEventListener("focus",this.handleFocus),this.input.addEventListener("click",this.handleClick),this.input.addEventListener("scroll",this.onScroll),this.input.addEventListener("cut",this.onCutHandler),this.input.addEventListener("compositionstart",this.onCompositionStart),this.input.addEventListener("compositionend",this.onCompositionEnd),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!this.isDestroyed&&(this.options.disabled||this.applyAmount(this.input.value,this.input.value.length))},0)},this.input.form.addEventListener("reset",this.onFormResetHandler))}onCompositionStart(){this.isComposing=!0}onCompositionEnd(){if(this.isComposing=!1,this.options.disabled)return;let t=this.input.selectionStart??this.input.value.length;this.applyAmount(this.input.value,t)}applyAmount(t,e){if(!(this.isApplying||this.options.disabled)){this.isApplying=!0;try{let n=this.engine.format(t,e);this.setNativeValue(n.formatted),this.input.setSelectionRange(n.cursor,n.cursor),!this.isUndoingRedoing&&this.input.type!=="password"&&this.history.push(n.rawValue,n.cursor),this.updateGhost(n),this.lastValue!==n.formatted&&(this.lastValue=n.formatted,this.notifyChange(n))}finally{this.isApplying=!1}}}updateGhost(t){if(this.ghost){if(!t.formatted){if(this.shouldHideGhostForPlaceholder(!0)){this.ghost.textContent="";return}let e=this.options.currency?this.options.currencyPosition==="prefix"?`${this.options.currency} 0`:`0 ${this.options.currency}`:"0,00";this.ghost.textContent="";let n=document.createElement("span");n.className="mask-ghost-remaining",n.textContent=e,this.ghost.appendChild(n);return}this.ghost.textContent="",this.ghost.scrollLeft=this.input.scrollLeft}}handleInput(){if(this.isDispatchingNativeInput||this.options.disabled||this.isComposing)return;let t=this.input.value,e=this.input.selectionStart??t.length;this.applyAmount(t,e)}handleKeyDown(t){if(!this.options.disabled){if((t.ctrlKey||t.metaKey)&&(t.key==="z"||t.key==="Z")){t.preventDefault(),t.shiftKey?this.redo():this.undo();return}if((t.ctrlKey||t.metaKey)&&(t.key==="y"||t.key==="Y")){t.preventDefault(),this.redo();return}if(t.key==="Backspace"){let e=this.input.selectionStart??0,n=this.input.selectionEnd??0;if(e===n&&e>0){let o=this.input.value,s=o[e-1];if(s===this.engine.options.thousandSeparator||s===" "){t.preventDefault();let r=Math.max(0,e-2),a=o.slice(0,r)+o.slice(e);this.applyAmount(a,r);return}if(this.options.currency&&this.options.currencyPosition==="prefix"&&e<=this.options.currency.length+1){t.preventDefault();return}}}if(t.key==="Delete"){let e=this.input.selectionStart??0,n=this.input.selectionEnd??0;if(e===n&&e<this.input.value.length){let o=this.input.value,s=o[e];if(s===this.engine.options.thousandSeparator||s===" "){t.preventDefault();let r=o.slice(0,e)+o.slice(e+2);this.applyAmount(r,e);return}if(this.options.currency&&this.options.currencyPosition==="suffix"){let r=o.length-this.options.currency.length-1;if(e>=r){t.preventDefault();return}}}}setTimeout(()=>this.enforceCursorBounds(),0)}}enforceCursorBounds(){if(!this.input.value||this.options.disabled)return;let t=this.input.selectionStart??0,e=this.input.selectionEnd??0;if(t!==e)return;let n=this.input.value,o=this.options.currency;if(o){if(this.options.currencyPosition==="prefix"){let s=o.length+1;t<s&&this.input.setSelectionRange(s,s)}else if(this.options.currencyPosition==="suffix"){let s=Math.max(0,n.length-o.length-1);t>s&&this.input.setSelectionRange(s,s)}}}handleClick(){this.enforceCursorBounds()}handleFocus(){this.wrapper.classList.add("is-focused"),this.syncGhostStyles(),this.enforceCursorBounds(),this.updateGhost(this.engine.format(this.input.value))}handleBlur(){if(this.wrapper.classList.remove("is-focused"),this.input.type==="password"&&this.history.clear(),this.options.padDecimalsOnBlur&&!this.options.disabled&&this.input.value.trim().length>0){let e=this.engine.format(this.input.value,this.input.value.length,!0);e.formatted!==this.input.value&&(this.setNativeValue(e.formatted),this.lastValue=e.formatted)}this.updateGhost(this.engine.format(this.input.value));let t=this.getDetail();this.options.onChange&&this.options.onChange(t),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!0,detail:t}))}handleAttributeMutation(t){super.handleAttributeMutation(t),t==="data-mask-pad-decimals"?this.options.padDecimalsOnBlur=this.getAttr("data-mask-pad-decimals")==="true":t==="placeholder"&&this.updateGhost(this.engine.format(this.input.value))}notifyChange(t){let e={value:t.formatted,number:t.rawNumber,rawValue:t.rawValue,isValid:t.isValid};this.options.onInput&&this.options.onInput(e),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:!0,detail:e})),this.dispatchNativeInput()}undo(){let t=this.history.undo();if(t){this.isUndoingRedoing=!0;try{this.applyAmount(t.raw,t.cursor)}finally{this.isUndoingRedoing=!1}}}redo(){let t=this.history.redo();if(t){this.isUndoingRedoing=!0;try{this.applyAmount(t.raw,t.cursor)}finally{this.isUndoingRedoing=!1}}}getDetail(){let t=this.engine.format(this.input.value);return{value:t.formatted,number:t.rawNumber,rawValue:t.rawValue,isValid:t.isValid}}getNumber(){return this.getDetail().number}getRawValue(){return this.getDetail().rawValue}isValid(){return this.getDetail().isValid}setValue(t){let e=t!=null?String(t):"";this.options.disabled?(this.setNativeValue(e),this.lastValue=e):this.applyAmount(e,e.length)}destroy(){this.isDestroyed||(this.cutTimerId!==null&&(clearTimeout(this.cutTimerId),this.cutTimerId=null),this.resetTimerId!==null&&(clearTimeout(this.resetTimerId),this.resetTimerId=null),this.input.removeEventListener("input",this.handleInput),this.input.removeEventListener("keydown",this.handleKeyDown),this.input.removeEventListener("blur",this.handleBlur),this.input.removeEventListener("focus",this.handleFocus),this.input.removeEventListener("click",this.handleClick),this.input.removeEventListener("scroll",this.onScroll),this.input.removeEventListener("cut",this.onCutHandler),this.input.removeEventListener("compositionstart",this.onCompositionStart),this.input.removeEventListener("compositionend",this.onCompositionEnd),this.input.form&&this.onFormResetHandler&&this.input.form.removeEventListener("reset",this.onFormResetHandler),this.history.clear(),super.destroy())}};var O=class O{constructor(i={}){this.defaultDomain=null;this.defaultTld="__";this.domains=i.domains&&i.domains.length>0?i.domains:O.DEFAULT_DOMAINS,this.tlds=i.tlds&&i.tlds.length>0?i.tlds.map(t=>t.trim().replace(/^\./,"")).filter(Boolean):[...O.DEFAULT_TLDS],this.suggestOnAt=i.suggestOnAt??!0,this.setDefaultDomain(i.defaultDomain??null),this.setDefaultTld(i.defaultTld!==void 0?i.defaultTld:"__")}setDefaultDomain(i){i===!0?this.defaultDomain=this.domains.length>0?this.domains[0]:null:typeof i=="string"&&i.trim().length>0?this.defaultDomain=i.trim().replace(/^@/,""):this.defaultDomain=null}setDefaultTld(i){i===!0?this.defaultTld=this.tlds.length>0?this.tlds[0]:null:typeof i=="string"&&i.trim().length>0?this.defaultTld=i.trim().replace(/^\./,""):this.defaultTld=null}setTlds(i){this.tlds=i&&i.length>0?i.map(t=>t.trim().replace(/^\./,"")).filter(Boolean):[...O.DEFAULT_TLDS]}getMatchingTlds(i){let t=(i??"").toLowerCase();return t.length===0?[...this.tlds]:this.tlds.filter(e=>e.toLowerCase().startsWith(t)&&e.toLowerCase()!==t)}getMatchingDomains(i){let t=i??"";if(!t.includes("@"))return this.defaultDomain?[this.defaultDomain]:[];let e=t.indexOf("@");if(t.indexOf("@",e+1)!==-1)return[];let n=t.substring(e+1);if(n.length===0)return this.suggestOnAt?[...this.domains]:[];let o=n.toLowerCase();return this.domains.filter(s=>s.toLowerCase().startsWith(o)&&s.toLowerCase()!==o)}getSuggestion(i,t=0){let e=i??"";if(!e.includes("@"))return this.defaultDomain?{full:e?`${e}@${this.defaultDomain}`:`@${this.defaultDomain}`,remaining:`@${this.defaultDomain}`,matchedDomain:this.defaultDomain,isHintOnly:!1}:{full:e,remaining:"",matchedDomain:null,isHintOnly:!1};let n=e.indexOf("@"),o=e.substring(0,n),s=e.substring(n+1);if(e.indexOf("@",n+1)!==-1)return{full:e,remaining:"",matchedDomain:null,isHintOnly:!1};let r=this.getMatchingDomains(i);if(r.length>0){let h=(t%r.length+r.length)%r.length,c=r[h],g=s.toLowerCase(),f=c.substring(g.length);return{full:`${o}@${c}`,remaining:f,matchedDomain:c,isHintOnly:!1}}if(s.length===0||s.startsWith("."))return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let a=s.toLowerCase();if(this.domains.some(h=>h.toLowerCase()===a))return{full:i,remaining:"",matchedDomain:s,isHintOnly:!1};let u=s.lastIndexOf(".");if(u===-1){if(!this.defaultTld)return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let h=this.defaultTld.includes("_"),c=`.${this.defaultTld}`,g=`${s}.${this.defaultTld}`;return{full:h?i:`${o}@${g}`,remaining:c,matchedDomain:h?null:g,isHintOnly:h}}let d=s.substring(0,u),m=s.substring(u+1);if(!d||d.endsWith("."))return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};if(m.length===0){if(this.defaultTld&&!this.defaultTld.includes("_")){let h=`${d}.${this.defaultTld}`;return{full:`${o}@${h}`,remaining:this.defaultTld,matchedDomain:h,isHintOnly:!1}}return this.defaultTld&&this.defaultTld.includes("_")?{full:i,remaining:this.defaultTld,matchedDomain:null,isHintOnly:!0}:{full:i,remaining:"",matchedDomain:null,isHintOnly:!1}}let l=m.toLowerCase(),p=this.getMatchingTlds(m);if(p.length>0){let h=(t%p.length+p.length)%p.length,c=p[h],g=c.substring(l.length),f=`${d}.${c}`;return{full:`${o}@${f}`,remaining:g,matchedDomain:f,isHintOnly:!1}}if(this.defaultTld&&this.defaultTld.includes("_")&&m.length<this.defaultTld.length){let h=this.defaultTld.substring(m.length);if(h.includes("_"))return{full:i,remaining:h,matchedDomain:null,isHintOnly:!0}}return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1}}};O.DEFAULT_DOMAINS=["gmail.com","outlook.com","orange.fr","free.fr","sfr.fr","yahoo.com","hotmail.com","icloud.com","laposte.net","proton.me"],O.DEFAULT_TLDS=["com","fr","net","org","eu","io","co","info","biz","me","tv","fi","be","ch","ca","uk","de","es","it"];var H=O;var V=class extends A{constructor(t,e,n){let o=T(t,e,n),s=o.wrapper,r=o.input,a=o.options,u=s?.getAttribute("data-mask-cycle-suggestions")==="true"||r?.getAttribute("data-mask-cycle-suggestions")==="true",d=s?.getAttribute("data-mask-auto-lowercase")==="true"||r?.getAttribute("data-mask-auto-lowercase")==="true",m=s?.getAttribute("data-mask-aria-autocomplete")??r?.getAttribute("data-mask-aria-autocomplete"),l=a.setAriaAutocomplete??(m!==null?m!=="false":!0),p=s?.getAttribute("data-mask-tlds")??r?.getAttribute("data-mask-tlds"),h=a.tlds??(p?p.split(",").map(v=>v.trim()).filter(Boolean):void 0),c=s?.getAttribute("data-mask-default-tld")??r?.getAttribute("data-mask-default-tld"),g=a.defaultTld!==void 0?a.defaultTld:c!==null?c==="false"||c==="none"?null:c==="true"?!0:c:void 0,f={completeOnTab:!0,completeOnArrowRight:!0,completeOnEnter:!0,cycleSuggestions:a.cycleSuggestions??u??!1,autoLowercase:a.autoLowercase??d??!1,setAriaAutocomplete:l,...a,...h!==void 0?{tlds:h}:{},...g!==void 0?{defaultTld:g}:{}};super(s,r,f);this.currentSuggestion={full:"",remaining:"",matchedDomain:null};this.currentSuggestionIndex=0;this.wasAriaAutocompleteSet=!1;this.cutTimerId=null;this.resetTimerId=null;this.input.inputMode="email",this.options.setAriaAutocomplete&&!this.input.hasAttribute("aria-autocomplete")&&(this.input.setAttribute("aria-autocomplete","inline"),this.wasAriaAutocompleteSet=!0),this.engine=new H(this.options),this.bindEvents(),this.options.disabled||this.updateSuggestion(),this.runAuditWarning(this.options.audit)}onNativeValueSet(t){this.options.disabled||this.updateSuggestion()}onDisabledChange(t){t?this.ghost&&(this.ghost.textContent=""):this.updateSuggestion()}bindEvents(){this.handleInput=this.handleInput.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{this.cutTimerId=null,!(this.isDestroyed||this.options.disabled)&&this.updateSuggestion()},0)},this.input.addEventListener("input",this.handleInput),this.input.addEventListener("keydown",this.handleKeyDown),this.input.addEventListener("blur",this.handleBlur),this.input.addEventListener("focus",this.handleFocus),this.input.addEventListener("scroll",this.onScroll),this.input.addEventListener("cut",this.onCutHandler),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!(this.isDestroyed||this.options.disabled)&&this.updateSuggestion()},0)},this.input.form.addEventListener("reset",this.onFormResetHandler))}updateSuggestion(){if(this.options.disabled){this.ghost&&(this.ghost.textContent="");return}let t=this.input.value;if(this.currentSuggestion=this.engine.getSuggestion(t,this.currentSuggestionIndex),!this.ghost)return;if(this.shouldHideGhostForPlaceholder(t.length===0))this.ghost.textContent="";else if(this.currentSuggestion.remaining){this.ghost.textContent="";let n=document.createElement("span");n.className="mask-ghost-typed",n.textContent=t;let o=document.createElement("span");o.className="mask-ghost-remaining",o.textContent=this.currentSuggestion.remaining,this.ghost.appendChild(n),this.ghost.appendChild(o)}else this.ghost.textContent="";this.ghost.scrollLeft=this.input.scrollLeft;let e=this.getDetail();this.options.onInput&&this.options.onInput(e),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:!0,detail:e})),this.dispatchNativeInput()}handleInput(){if(!this.isDispatchingNativeInput&&!this.options.disabled){if(this.options.autoLowercase){let t=this.input.selectionStart??0,e=this.input.selectionEnd??t,n=this.input.value.toLowerCase();n!==this.input.value&&(this.setNativeValue(n),this.input.setSelectionRange(t,e))}this.currentSuggestionIndex=0,this.updateSuggestion()}}handleKeyDown(t){if(this.options.disabled)return;let e=!!this.currentSuggestion.remaining&&!this.currentSuggestion.isHintOnly,o=(this.input.selectionStart??0)===this.input.value.length,s=this.input.value.length>0;if(this.options.cycleSuggestions&&e&&s&&o){if(t.key==="ArrowDown"){t.preventDefault(),this.currentSuggestionIndex++,this.updateSuggestion();return}if(t.key==="ArrowUp"){t.preventDefault(),this.currentSuggestionIndex--,this.updateSuggestion();return}}if(t.key==="Tab"&&e&&s&&this.options.completeOnTab){t.preventDefault(),this.acceptSuggestion();return}if(t.key==="Enter"&&e&&s&&this.options.completeOnEnter){t.preventDefault(),this.acceptSuggestion();return}if(t.key==="ArrowRight"&&e&&s&&o&&this.options.completeOnArrowRight){t.preventDefault(),this.acceptSuggestion();return}}acceptSuggestion(){if(!this.currentSuggestion.remaining||this.currentSuggestion.isHintOnly||this.options.disabled||this.input.value.length===0)return!1;let t=this.currentSuggestion.full;this.setNativeValue(t),this.input.setSelectionRange(t.length,t.length),this.currentSuggestionIndex=0,this.updateSuggestion();let e=this.getDetail();return this.options.onChange&&this.options.onChange(e),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!0,detail:e})),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:!0,detail:e})),!0}setDefaultDomain(t){this.engine.setDefaultDomain(t),this.updateSuggestion()}setDefaultTld(t){this.engine.setDefaultTld(t),this.updateSuggestion()}setTlds(t){this.engine.setTlds(t),this.currentSuggestionIndex=0,this.updateSuggestion()}handleFocus(){this.wrapper.classList.add("is-focused"),this.syncGhostStyles(),this.updateSuggestion()}handleBlur(){this.wrapper.classList.remove("is-focused"),this.updateSuggestion();let t=this.getDetail();this.options.onChange&&this.options.onChange(t),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!0,detail:t}))}handleAttributeMutation(t){if(super.handleAttributeMutation(t),t==="data-mask-cycle-suggestions")this.options.cycleSuggestions=this.getAttr("data-mask-cycle-suggestions")==="true";else if(t==="data-mask-auto-lowercase")this.options.autoLowercase=this.getAttr("data-mask-auto-lowercase")==="true";else if(t==="data-mask-default-tld"){let e=this.getAttr("data-mask-default-tld");this.setDefaultTld(e===null||e==="false"||e==="none"?null:e==="true"?!0:e)}else if(t==="data-mask-tlds"){let e=this.getAttr("data-mask-tlds");this.setTlds(e?e.split(",").map(n=>n.trim()).filter(Boolean):null)}else t==="placeholder"&&this.updateSuggestion()}getDetail(){return{value:this.input.value,suggestedValue:this.currentSuggestion.isHintOnly?"":this.currentSuggestion.full,domain:this.currentSuggestion.matchedDomain}}setValue(t){let e=t!=null?String(t):"";this.setNativeValue(e),this.updateSuggestion()}destroy(){this.isDestroyed||(this.cutTimerId!==null&&(clearTimeout(this.cutTimerId),this.cutTimerId=null),this.resetTimerId!==null&&(clearTimeout(this.resetTimerId),this.resetTimerId=null),this.input.removeEventListener("input",this.handleInput),this.input.removeEventListener("keydown",this.handleKeyDown),this.input.removeEventListener("blur",this.handleBlur),this.input.removeEventListener("focus",this.handleFocus),this.input.removeEventListener("scroll",this.onScroll),this.input.removeEventListener("cut",this.onCutHandler),this.input.form&&this.onFormResetHandler&&this.input.form.removeEventListener("reset",this.onFormResetHandler),this.wasAriaAutocompleteSet&&this.input.getAttribute("aria-autocomplete")==="inline"&&this.input.removeAttribute("aria-autocomplete"),super.destroy())}};var K={BaseInputMask:A,InputMask:R,MaskEngine:x,MaskHistory:C,MaskKeyboard:L,AmountEngine:I,InputAmountMask:P,EmailEngine:H,InputEmailMask:V};if(typeof window<"u"){let b=window,i=b.Wulf||{};b.Wulf=i,i.Mask=K}var _=R;return q(Z);})();
2
5
  if (typeof window !== "undefined") { window.Wulf = window.Wulf || {}; if (typeof Wulf !== "undefined" && Wulf) { var targets = ["Mask", "Scroll", "Masonry", "Toast"]; for (var i = 0; i < targets.length; i++) { var t = targets[i]; if (Wulf[t] && window.Wulf[t] !== Wulf[t]) { try { Object.defineProperty(window.Wulf, t, { value: Wulf[t], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[t] = Wulf[t]; } catch (__) {} } } } for (var k in Wulf) { if (window.Wulf[k] === undefined) { try { Object.defineProperty(window.Wulf, k, { value: Wulf[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { window.Wulf[k] = Wulf[k]; } catch (__) {} } } } } }
3
6
  //# sourceMappingURL=mask.global.min.js.map