wulf.js 2.1.0 → 2.1.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 (59) hide show
  1. package/changelog.md +10 -0
  2. package/dist/focus-trap.esm.js +88 -30
  3. package/dist/focus-trap.esm.js.map +2 -2
  4. package/dist/focus-trap.global.js +88 -30
  5. package/dist/focus-trap.global.js.map +2 -2
  6. package/dist/focus-trap.global.min.js +2 -2
  7. package/dist/focus-trap.global.min.js.map +3 -3
  8. package/dist/index.esm.js +541 -162
  9. package/dist/index.esm.js.map +2 -2
  10. package/dist/index.global.js +541 -162
  11. package/dist/index.global.js.map +2 -2
  12. package/dist/index.global.min.js +2 -2
  13. package/dist/index.global.min.js.map +3 -3
  14. package/dist/mask.esm.js +4 -4
  15. package/dist/mask.esm.js.map +2 -2
  16. package/dist/mask.global.js +4 -4
  17. package/dist/mask.global.js.map +2 -2
  18. package/dist/mask.global.min.js +2 -2
  19. package/dist/mask.global.min.js.map +3 -3
  20. package/dist/masonry.esm.js +153 -62
  21. package/dist/masonry.esm.js.map +2 -2
  22. package/dist/masonry.global.js +153 -62
  23. package/dist/masonry.global.js.map +2 -2
  24. package/dist/masonry.global.min.js +3 -3
  25. package/dist/masonry.global.min.js.map +3 -3
  26. package/dist/scroll.css +1 -1
  27. package/dist/scroll.css.map +2 -2
  28. package/dist/scroll.esm.js +108 -31
  29. package/dist/scroll.esm.js.map +2 -2
  30. package/dist/scroll.global.js +108 -31
  31. package/dist/scroll.global.js.map +2 -2
  32. package/dist/scroll.global.min.js +2 -2
  33. package/dist/scroll.global.min.js.map +3 -3
  34. package/dist/scroll.layered.css +1 -1
  35. package/dist/scroll.layered.css.map +2 -2
  36. package/dist/shortcut.esm.js +182 -22
  37. package/dist/shortcut.esm.js.map +3 -3
  38. package/dist/shortcut.global.js +182 -22
  39. package/dist/shortcut.global.js.map +3 -3
  40. package/dist/shortcut.global.min.js +4 -1
  41. package/dist/shortcut.global.min.js.map +4 -4
  42. package/dist/toast.css +1 -1
  43. package/dist/toast.css.map +2 -2
  44. package/dist/toast.esm.js +92 -13
  45. package/dist/toast.esm.js.map +2 -2
  46. package/dist/toast.global.js +92 -13
  47. package/dist/toast.global.js.map +2 -2
  48. package/dist/toast.global.min.js +3 -3
  49. package/dist/toast.global.min.js.map +3 -3
  50. package/dist/toast.layered.css +1 -1
  51. package/dist/toast.layered.css.map +2 -2
  52. package/dist/types/common/dom.d.ts +5 -0
  53. package/dist/types/focus-trap/FocusTrap.d.ts +5 -2
  54. package/dist/types/mask/paste.d.ts +2 -5
  55. package/dist/types/masonry/Masonry.d.ts +2 -0
  56. package/dist/types/scroll/ScrollBlock.d.ts +2 -0
  57. package/dist/types/shortcut/ShortcutManager.d.ts +14 -3
  58. package/dist/types/toast/ToastManager.d.ts +2 -0
  59. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- "use strict";var __WulfIIFE=(()=>{var Q=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var lt=Object.getOwnPropertyNames;var ut=Object.prototype.hasOwnProperty;var ht=(g,t)=>{for(var e in t)Q(g,e,{get:t[e],enumerable:!0})},ct=(g,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of lt(t))!ut.call(g,n)&&n!==e&&Q(g,n,{get:()=>t[n],enumerable:!(i=ot(t,n))||i.enumerable});return g};var pt=g=>ct(Q({},"__esModule",{value:!0}),g);var wt={};ht(wt,{AmountEngine:()=>V,BaseInputMask:()=>E,DATE_UTC_PRESETS:()=>_,DateUTCEngine:()=>H,EmailEngine:()=>B,InputAmountMask:()=>W,InputDateUTCMask:()=>j,InputEmailMask:()=>$,InputMask:()=>G,Mask:()=>at,MaskEngine:()=>N,MaskHistory:()=>P,MaskKeyboard:()=>U,default:()=>Tt,sanitizePastedText:()=>R,stripBidiAndInvisibles:()=>Y});function it(){if(typeof window>"u")return null;let g=window,t=g.Wulf;if(!t||typeof t!="object"||typeof Node<"u"&&t instanceof Node||typeof HTMLCollection<"u"&&t instanceof HTMLCollection){let e={};return g.Wulf=e,e}return t}function q(g){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(g):String(g).replace(/["\\\u0000-\u001F\u007F]/g,"\\$&")}function K(g){if(typeof document>"u")return null;let t=(g??document).activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t&&typeof t.focus=="function"?t:null}function tt(g,t,e=null){let i=g.moveBefore;if(typeof i=="function"&&t.isConnected&&g.isConnected&&typeof g.getRootNode=="function"&&typeof t.getRootNode=="function"&&g.getRootNode()===t.getRootNode())try{i.call(g,t,e);return}catch{}g.insertBefore(t,e)}function F(g){return!!(g.isComposing||g.key==="Process"||g.key==="Enter"&&g.keyCode===229)}var Z=class{getAuditDisableHint(){return"Passez { audit: false } dans les options pour d\xE9sactiver cet avertissement"}runAuditWarning(t=!0){if(!t)return[];let e=this.audit();return e.length>0&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[${this.getAuditPrefix()}] Audit d'accessibilit\xE9 \u2014 ${e.length} contrainte(s) manquante(s) sur ${this.getAuditTargetLabel()} :
1
+ "use strict";var __WulfIIFE=(()=>{var Q=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var ht=Object.prototype.hasOwnProperty;var ct=(g,t)=>{for(var e in t)Q(g,e,{get:t[e],enumerable:!0})},pt=(g,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ut(t))!ht.call(g,n)&&n!==e&&Q(g,n,{get:()=>t[n],enumerable:!(i=lt(t,n))||i.enumerable});return g};var dt=g=>pt(Q({},"__esModule",{value:!0}),g);var wt={};ct(wt,{AmountEngine:()=>V,BaseInputMask:()=>E,DATE_UTC_PRESETS:()=>_,DateUTCEngine:()=>H,EmailEngine:()=>K,InputAmountMask:()=>W,InputDateUTCMask:()=>j,InputEmailMask:()=>$,InputMask:()=>G,Mask:()=>ot,MaskEngine:()=>N,MaskHistory:()=>P,MaskKeyboard:()=>B,default:()=>Tt,sanitizePastedText:()=>R,stripBidiAndInvisibles:()=>U});function st(){if(typeof window>"u")return null;let g=window,t=g.Wulf;if(!t||typeof t!="object"||typeof Node<"u"&&t instanceof Node||typeof HTMLCollection<"u"&&t instanceof HTMLCollection){let e={};return g.Wulf=e,e}return t}function q(g){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(g):String(g).replace(/["\\\u0000-\u001F\u007F]/g,"\\$&")}function U(g,t=4096){let e=Math.max(0,t);return String(g??"").slice(0,e).replace(/[\u061C\u200B-\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g,"")}function Y(g){if(typeof document>"u")return null;let t=(g??document).activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t&&typeof t.focus=="function"?t:null}function tt(g,t,e=null){let i=g.moveBefore;if(typeof i=="function"&&t.isConnected&&g.isConnected&&typeof g.getRootNode=="function"&&typeof t.getRootNode=="function"&&g.getRootNode()===t.getRootNode())try{i.call(g,t,e);return}catch{}g.insertBefore(t,e)}function F(g){return!!(g.isComposing||g.key==="Process"||g.key==="Enter"&&g.keyCode===229)}var Z=class{getAuditDisableHint(){return"Passez { audit: false } dans les options pour d\xE9sactiver cet avertissement"}runAuditWarning(t=!0){if(!t)return[];let e=this.audit();return e.length>0&&typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[${this.getAuditPrefix()}] Audit d'accessibilit\xE9 \u2014 ${e.length} contrainte(s) manquante(s) sur ${this.getAuditTargetLabel()} :
2
2
  `+e.map(i=>` - ${i}`).join(`
3
3
  `)+`
4
- (${this.getAuditDisableHint()})`),e}checkAriaIdReferences(t,e,i,n=!1){let s=t.getAttribute(e)?.trim();if(!s)return!1;let r=t.ownerDocument||document,a=typeof t.getRootNode=="function"?t.getRootNode():r,o=s.split(/\s+/).filter(Boolean),l=o.map(p=>typeof ShadowRoot<"u"&&a instanceof ShadowRoot?a.getElementById(p):r.getElementById(p));return o.length>0&&l.every(p=>!!p)?n&&!l.some(u=>u?(u.textContent?.trim()||u.getAttribute("aria-label")?.trim()||"").length>0:!1)?(i.push(`Attribut ${e}="${s}" invalide : l'\xE9l\xE9ment cible ne contient aucun texte accessible.`),!1):!0:(i.push(`Attribut ${e}="${s}" invalide : l'\xE9l\xE9ment cible est introuvable dans le DOM.`),!1)}};function Y(g,t=4096){let e=Math.max(0,t);return String(g??"").slice(0,e).replace(/[\u200B-\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g,"")}function R(g,t=4096){return Y(g,t).replace(/[\u00A0\u202F\u2007]/g," ").replace(/[\u2013\u2014\u2212]/g,"-").trim()}var X=new Set(["left","right","center"]);function O(g,t,e){return t&&typeof t=="object"&&"tagName"in t&&t.tagName==="INPUT"?{wrapper:g||null,input:t,options:e||{}}:{wrapper:null,input:g,options:t&&typeof t=="object"&&!("tagName"in t)?t:{}}}var E=class extends Z{wrapper;input;options;ghost=null;isWrapperCreated=!1;wasWrapperFallbackStyled=!1;wasAlignSet=!1;hadInitialDataAlign=!1;isDestroyed=!1;isFocused=!1;isDispatchingNativeInput=!1;lastTrackedValue="";nativeValueDescriptor=null;onCutHandler=()=>{};onFormResetHandler;mutationObserver=null;resizeObserver=null;focusSelectTimerId=null;abortController=new AbortController;constructor(t,e,i){super();let{wrapper:n,input:s,options:r}=O(t,e,i);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",o=!!(r.createWrapper??a),l=n;if(!l&&o){let D=this.input.ownerDocument||document,C=D.createElement("span");C.className="wulf-mask-wrapper wulf-mask-wrapper--auto",this.input.parentNode&&this.input.parentNode.insertBefore(C,this.input),tt(C,this.input,null);let et=D.defaultView||(typeof window<"u"?window:null);(!C.isConnected||!et||et.getComputedStyle(C).display!=="inline-grid")&&(C.style.display="inline-grid",C.style.gridTemplateColumns="1fr",C.style.gridTemplateRows="1fr",C.style.verticalAlign="middle",C.style.boxSizing="border-box",C.style.position="relative",this.input.style.gridArea="1 / 1 / 2 / 2",this.input.style.boxSizing="border-box",this.wasWrapperFallbackStyled=!0),l=C,this.isWrapperCreated=!0}if(!l)throw new Error(`[${new.target.name||"InputMask"}] wrapper (HTMLElement) et input (HTMLInputElement) sont requis, ou activez l'option createWrapper: true.`);this.wrapper=l,this.normalizeInputType();let h=this.getAttr("data-mask-focus-only")==="true",p=this.hasAttr("data-disabled"),u=this.getAttr("data-mask-select-on-focus")==="true",c=this.getAttr("data-mask-copy-raw")==="true",d=this.getAttr("data-mask-sensitive")==="true",y=this.getAttr("data-mask-align")||this.getAttr("data-align"),f=y&&X.has(y)?y:null;this.hadInitialDataAlign=this.wrapper.hasAttribute("data-align");let m=this.getAttr("data-mask-audit"),{disabled:b,align:v,sensitive:k,...w}=r,S=v&&X.has(v)?v:void 0,I=b!==void 0?b:!!p,A=r.audit??(m!==null?m!=="false":!0),x=!!(k??d),L=this.isPasswordInput()||x;this.options={...w,createWrapper:o,showMaskOnFocus:r.showMaskOnFocus??h??!1,selectAllOnFocus:r.selectAllOnFocus??u??!1,copyRaw:L?!1:r.copyRaw??c??!1,sensitive:x,disabled:I,align:S??(f||void 0),emitNativeInput:r.emitNativeInput??!0,audit:A},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(){let{signal:t}=this.abortController;this.input.addEventListener("copy",this.onBaseCopy,{signal:t}),this.input.addEventListener("focus",this.onBaseFocus,{signal:t}),this.input.addEventListener("blur",this.onBaseBlur,{signal:t})}onBaseCopy=t=>{if(!this.options.copyRaw||this.options.disabled||this.isSensitiveField())return;let e=this.input.selectionStart??0,i=this.input.selectionEnd??e,n="";e!==i?n=this.extractRawSnippet(this.input.value.slice(e,i)):n=this.getRawValue(),n&&t.clipboardData&&(t.preventDefault(),t.clipboardData.setData("text/plain",n))};extractRawSnippet(t){return t}getClipboardPlainText(t){return t.clipboardData&&(t.clipboardData.getData("text")||t.clipboardData.getData("text/plain"))||""}preparePastedText(t,e=4096){let i=R(t,e);if(typeof this.options.transformPaste!="function")return i;try{let n=this.options.transformPaste(i);if(typeof n=="string")return R(n,e)}catch{}return i}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&&K(this.input.ownerDocument)===this.input&&this.input.select()},0))};onBaseBlur=()=>{this.isFocused=!1,this.isSensitiveField()&&(this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask"))};initMutationObserver(){if(typeof MutationObserver>"u")return;this.mutationObserver=new MutationObserver(e=>{for(let i of e)i.type==="attributes"&&i.attributeName&&this.handleAttributeMutation(i.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-sensitive","data-mask-pad-decimals","data-mask-auto-lowercase","data-mask-cycle-suggestions","data-mask-default-tld","data-mask-tlds","data-mask-format","data-mask-utc-indicator","data-disabled","data-mask-align","data-align","placeholder","type"]};this.mutationObserver.observe(this.wrapper,t),this.input!==this.wrapper&&this.mutationObserver.observe(this.input,t)}isPasswordInput(){return(this.input.type||"").toLowerCase()==="password"}isSensitiveField(){return this.isPasswordInput()||!!this.options.sensitive}computePasswordDigest(t){let e=2166136261;for(let i=0;i<t.length;i++)e^=t.charCodeAt(i),e=Math.imul(e,16777619);return`__pwd:${(e>>>0).toString(36)}:${t.length}`}setAlign(t){let e=t&&X.has(t)?t:null,i=e||void 0,n=this.wrapper.getAttribute("data-align"),s=e?this.wrapper.classList.contains(`align-${e}`):!this.wrapper.classList.contains("align-left")&&!this.wrapper.classList.contains("align-right")&&!this.wrapper.classList.contains("align-center");this.options.align===i&&n===e&&s||(this.options.align=i,this.wrapper.classList.remove("align-left","align-right","align-center"),e?(this.wrapper.classList.add(`align-${e}`),this.wasAlignSet=!0,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(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.isSensitiveField()?!1:this.getAttr("data-mask-copy-raw")==="true";else if(t==="data-mask-sensitive"){let e=this.getAttr("data-mask-sensitive")==="true";this.options.sensitive=e,this.isSensitiveField()&&(this.options.copyRaw=!1,this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask"),this.onPasswordModeDetected())}else if(t==="type")this.isSensitiveField()&&(this.options.copyRaw=!1,this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask"),this.onPasswordModeDetected());else if(t==="data-mask-align"||t==="data-align"){let e=this.getAttr("data-mask-align")||this.getAttr("data-align"),i=e&&X.has(e)?e:null;i!==(this.options.align??null)&&this.setAlign(i)}}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();let e=this.input.ownerDocument||document;this.ghost=e.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");let i=e.defaultView||(typeof window<"u"?window:null);(!this.wrapper.isConnected||!i||i.getComputedStyle(this.ghost).pointerEvents!=="none")&&(this.ghost.style.gridArea="1 / 1 / 2 / 2",this.ghost.style.pointerEvents="none"),this.syncGhostStyles(),typeof ResizeObserver<"u"&&(this.resizeObserver?.disconnect(),this.resizeObserver=new ResizeObserver(()=>{this.isDestroyed||this.syncGhostStyles()}),this.resizeObserver.observe(this.input));let n=e;n.fonts?.ready&&typeof n.fonts.ready.then=="function"&&n.fonts.ready.then(()=>{this.isDestroyed||this.syncGhostStyles()}).catch(()=>{})}setGhostContent(...t){if(this.ghost){if(typeof this.ghost.replaceChildren=="function")this.ghost.replaceChildren(...t);else{this.ghost.textContent="";for(let e of t)this.ghost.appendChild(typeof e=="string"?document.createTextNode(e):e)}this.wrapper.classList.toggle("has-visible-ghost",t.length>0)}}clearGhost(){this.setGhostContent()}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.wordSpacing=t.wordSpacing,this.ghost.style.textIndent=t.textIndent,this.ghost.style.fontKerning=t.fontKerning,this.ghost.style.fontVariantNumeric=t.fontVariantNumeric,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",i=t.textAlign;i==="right"?this.ghost.style.justifyContent="right":i==="left"?this.ghost.style.justifyContent="left":i==="center"?this.ghost.style.justifyContent="center":i==="end"?this.ghost.style.justifyContent=e?"left":"right":this.ghost.style.justifyContent=e?"right":"left"}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.isSensitiveField(),e=this.input._valueTracker;!t&&e&&typeof e.setValue=="function"&&e.setValue(this.lastTrackedValue),this.lastTrackedValue=t?"":this.input.value,this.input.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))}finally{this.isDispatchingNativeInput=!1}}}onScroll=()=>{this.ghost&&(this.ghost.scrollLeft=this.input.scrollLeft)};hookValueProperty(){try{let t=HTMLInputElement.prototype,e=Object.getOwnPropertyDescriptor(t,"value");if(!e||!e.set||!e.get)return;this.nativeValueDescriptor=e;let i=this;Object.defineProperty(this.input,"value",{get(){return e.get.call(this)},set(n){let s=String(n??"");e.set.call(this,s),!i.isDestroyed&&i.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}hasAccessibleLabelText(t){if(!t)return!1;if(t.getAttribute("aria-label")?.trim())return!0;let i=n=>{if(n.nodeType===3)return n.textContent||"";if(n.nodeType===1){let s=n,r=s.tagName;if(r==="INPUT"||r==="SELECT"||r==="TEXTAREA"||r==="BUTTON"||s.getAttribute("aria-hidden")==="true")return"";let a="";for(let o=0;o<s.childNodes.length;o++)a+=i(s.childNodes[o]);return a}return""};return i(t).trim().length>0}audit(){let t=[],e=this.input.ownerDocument||document,i=typeof this.input.getRootNode=="function"?this.input.getRootNode():e,n=typeof ShadowRoot<"u"&&i instanceof ShadowRoot?i:e,s=this.input.getAttribute("aria-label")?.trim(),r=this.checkAriaIdReferences(this.input,"aria-labelledby",t,!0),a=this.input.closest("label"),o=this.hasAccessibleLabelText(a),l=!!(this.input.labels&&Array.from(this.input.labels).some(c=>this.hasAccessibleLabelText(c))),h=!1;if(this.input.id)try{let c=n.querySelector(`label[for="${q(this.input.id)}"]`);h=this.hasAccessibleLabelText(c)}catch{h=!1}!s&&!r&&!o&&!l&&!h&&t.push(`\xC9tiquetage accessible manquant : associez un <label for="id"> non vide (ou d\xE9finissez aria-label / aria-labelledby) sur l'input (WCAG 4.1.2).`),this.checkAriaIdReferences(this.input,"aria-describedby",t,!0),this.input.hasAttribute("aria-errormessage")&&this.checkAriaIdReferences(this.input,"aria-errormessage",t,!0);let p=this.input.getAttribute("tabindex");if(p!==null){let c=Number.parseInt(p,10);Number.isFinite(c)&&c>0&&t.push(`Attribut tabindex="${p}" positif d\xE9tect\xE9 : \xE9vitez les tabindex > 0 qui perturbent l'ordre de tabulation naturel (WCAG 2.4.3).`)}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[]}onPasswordModeDetected(){}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.focusSelectTimerId!==null&&(clearTimeout(this.focusSelectTimerId),this.focusSelectTimerId=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.abortController.abort(),this.lastTrackedValue="",this.unhookValueProperty(),this.ghost&&(this.ghost.remove(),this.ghost=null),this.isWrapperCreated&&this.wrapper?(this.wasWrapperFallbackStyled&&(this.input.style.gridArea="",this.input.style.boxSizing=""),this.wrapper.parentElement?tt(this.wrapper.parentElement,this.input,this.wrapper):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.wasAlignSet&&!this.hadInitialDataAlign&&this.wrapper.removeAttribute("data-align"),this.wasAlignSet&&this.wrapper.classList.remove("align-left","align-right","align-center"),this.wrapper.classList.remove("is-complete","is-focused","mask-focus-only","has-selection","has-ghost","has-visible-ghost")))}};var st=new Set(["/","-",".",":"]),ft={9:{pattern:/[0-9]/},a:{pattern:/[a-zA-Z]/},A:{pattern:/[a-zA-Z]/,transform:g=>g.toUpperCase()},"*":{pattern:/[a-zA-Z0-9]/},"#":{pattern:/[a-zA-Z0-9]/,transform:g=>g.toUpperCase()}},N=class g{pattern;patterns=[];patternResolver=null;lastResolvedKey="";subEngines=[];activeEngine=null;placeholderChar;tokens;slots=[];fullMaskTemplate="";prefixSlotsCount=0;prefixString="";strict=!0;autoLowercase=!1;constructor(t,e={}){let i=e||{},n=String(i.placeholderChar||"_");this.placeholderChar=Array.from(n)[0]||"_";let s=Object.create(null);for(let[r,a]of Object.entries(ft))s[r]=a;if(i.tokens&&typeof i.tokens=="object")for(let[r,a]of Object.entries(i.tokens))r!=="__proto__"&&r!=="constructor"&&r!=="prototype"&&a&&(s[r]=a);this.tokens=s,this.strict=i.strict!==!1,this.autoLowercase=i.autoLowercase??!1,this.pattern="",this.compile(t)}static format(t,e,i={}){return!e||Array.isArray(e)&&e.length===0?t??"":new g(e,i||{}).format(t??"")}isDynamicPattern(){return this.patternResolver!==null}resolveForValue(t){if(!this.patternResolver)return!1;let e;try{e=this.patternResolver(String(t??"").slice(0,4096))}catch{return!1}let i,n;if(Array.isArray(e))i=e.slice(0,32).map(s=>String(s??"").slice(0,512)),n="A:"+i.join("\0");else if(typeof e=="string")i=e.slice(0,512),n="S:"+i;else return!1;return n===this.lastResolvedKey?!1:(this.lastResolvedKey=n,this.compileStatic(i),!0)}compile(t){return typeof t=="function"?(this.patternResolver=t,this.lastResolvedKey="",this.resolveForValue(""),this.slots):t!==void 0?(this.patternResolver=null,this.lastResolvedKey="",this.compileStatic(t)):this.patternResolver?(this.lastResolvedKey="",this.resolveForValue(""),this.slots):this.compileStatic(this.patterns.length>0?this.patterns:this.pattern)}compileStatic(t){if(Array.isArray(t)?(this.patterns=t.slice(0,32).map(n=>String(n??"").slice(0,512)),this.pattern=this.patterns[0]||""):(this.patterns=[],this.pattern=String(t??"").slice(0,512)),this.patterns.length>0)return this.subEngines=this.patterns.map(n=>new g(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 e="",i=!0;for(let n=0;n<this.pattern.length;n++){let s=this.pattern[n],r=!1;s==="\\"&&n+1<this.pattern.length&&(r=!0,n++,s=this.pattern[n]);let a=!r&&Object.hasOwn(this.tokens,s)?this.tokens[s]:void 0;if(a){i=!1;let o=a.placeholder?Array.from(String(a.placeholder))[0]||this.placeholderChar:this.placeholderChar;this.slots.push({char:s,isStatic:!1,isPrefix:!1,token:a,placeholder:o}),e+=o}else this.slots.push({char:s,isStatic:!0,isPrefix:i,placeholder:s}),e+=s}this.fullMaskTemplate=e,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(t){if(this.subEngines.length<=1)return this;let e=String(t??""),i=this.subEngines.filter(o=>{let l=o.getPrefix();return l.length>0&&e.toLowerCase().startsWith(l.trim().toLowerCase())}),n=i.length>0?i:this.subEngines,s=n.toSorted((o,l)=>l.getEditableCount()-o.getEditableCount())[0],a=(s?s.extractRaw(e):e).length;for(let o of n)if(o.getEditableCount()>=a)return this.activeEngine=o,o;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}getActiveEditableCount(){return this.subEngines.length>0?(this.activeEngine??this.subEngines[0]).getActiveEditableCount():this.activeEngine?this.activeEngine.getActiveEditableCount():this.slots.filter(t=>!t.isStatic).length}getMaxEditableCount(){return this.subEngines.length>0?Math.max(...this.subEngines.map(t=>t.getMaxEditableCount())):this.getActiveEditableCount()}getEditableCount(){return this.getMaxEditableCount()}isNumericOnly(){if(this.subEngines.length>0)return this.subEngines.every(i=>i.isNumericOnly());let e=(this.activeEngine?this.activeEngine.slots:this.slots).filter(i=>!i.isStatic);return e.length===0?!1:e.every(i=>i.char==="9"||i.token&&i.token.pattern.test("0")&&!i.token.pattern.test("a")&&!i.token.pattern.test("Z"))}setStrict(t){this.strict=t;for(let e of this.subEngines)e.setStrict(t)}setAutoLowercase(t){this.autoLowercase=t;for(let e of this.subEngines)e.setAutoLowercase(t)}isStrict(){return this.strict}normalizePastedValue(t){let e=String(t??"");if(!e)return e;if(this.resolveForValue(e),this.subEngines.length>0){let i=e.toLowerCase(),n=this.subEngines.filter(a=>{let o=a.getPrefix();return o.length>0&&i.startsWith(o.trim().toLowerCase())}),s=n.length>0?n:this.subEngines,r=null;for(let a of s){let o=a.tryNormalizeSegments(e);if(o.matched){if(o.exactSegmentCount)return o.normalized;r===null&&(r=o.normalized)}}return r!==null?r:e}return this.tryNormalizeSegments(e).normalized}tryNormalizeSegments(t){let e={matched:!1,normalized:t,exactSegmentCount:!1};if(!this.strict||this.slots.length===0||!t)return e;let i=t;if(this.prefixSlotsCount>0){let b=0;for(;b<t.length&&(t[b]===" "||t[b]===" ");)b++;let v=0;for(;b<t.length&&v<this.prefixSlotsCount;){let k=this.slots[v].char,w=t[b];if(w.toUpperCase()===k.toUpperCase())b++,v++;else if(k===" "&&w!==" ")v++;else break}v===this.prefixSlotsCount&&(i=t.slice(b))}if(!i)return e;let n=[],s=[],r=[],a="",o=!1;for(let b=this.prefixSlotsCount;b<this.slots.length;b++){let v=this.slots[b];v.isStatic?r.length>0?(n.push(r),r=[],a=v.char):a+=v.char:(a.length>0&&(s.push(a),a=""),r.push(v))}if(r.length>0?n.push(r):a.length>0&&(o=!0),o||n.length<2||s.length!==n.length-1)return e;let l=[];for(let b of s){let v=b.trim();if(v.length!==1||!st.has(v))return e;l.push(v)}let h=[],p=[],u=0;for(let b=0;b<i.length;b++){let v=i[b];st.has(v)&&(h.push(i.slice(u,b).trim()),p.push(v),u=b+1)}if(h.push(i.slice(u).trim()),p.length===0||p.length>l.length||h.length!==p.length+1||h.length>n.length||h.some(b=>b.length===0))return e;let c=p.every((b,v)=>b===l[v]),d=p.every(b=>b===p[0]);if(!c&&!d)return e;let y=h.length===n.length,f=[];for(let b=0;b<h.length;b++){let v=h[b],k=n[b];if(v.length>k.length)return e;if(k.every(S=>!!(S.token&&S.token.pattern.test("0")&&!S.token.pattern.test("a")&&!S.token.pattern.test("Z")))){let S=b<h.length-1,I=b===h.length-1&&y&&n.length<=3&&k.length===2,A=v.length<k.length&&(S||I),x=A?k.length-v.length:0;for(let L=0;L<v.length;L++){let D=v[L];if(D<"0"||D>"9"||!k[x+L].token.pattern.test(D))return e}f.push(A?"0".repeat(k.length-v.length)+v:v)}else{if(v.length!==k.length)return e;for(let S=0;S<v.length;S++)if(!k[S].token||!k[S].token.pattern.test(v[S]))return e;f.push(v)}}let m=this.prefixSlotsCount>0?this.prefixString:"";for(let b=0;b<f.length;b++)b>0&&(m+=s[b-1]),m+=f[b];return{matched:!0,normalized:m,exactSegmentCount:y}}extractRawForCurrentPattern(t){return this.extractRawInternal(t)}extractRaw(t){return this.resolveForValue(t),this.extractRawInternal(t)}extractRawInternal(t){if(this.subEngines.length>0){let a=this.selectEngine(t);if(a!==this)return a.extractRawInternal(t)}let e=Math.max(4096,this.slots.length*4),i=String(t??"").slice(0,e);if(!i)return"";let n="",s=0,r=0;if(this.prefixSlotsCount>0){for(;s<i.length&&(i[s]===" "||i[s]===" ");)s++;let a=0;for(;s<i.length&&a<this.prefixSlotsCount;){let o=this.slots[a].char,l=i[s];if(l.toUpperCase()===o.toUpperCase())s++,a++;else if(o===" "&&l!==" ")a++;else break}r=this.prefixSlotsCount}for(;s<i.length&&r<this.slots.length;){let a=this.slots[r],o=i[s];if(a.isStatic)o.toUpperCase()===a.char.toUpperCase()&&s++,r++;else if(a.token&&a.token.pattern.test(o)){let l=a.token.transform?a.token.transform(o):o;this.autoLowercase&&!a.token.transform&&(l=l.toLowerCase()),n+=l,s++,r++}else this.strict?s++:(n+=this.autoLowercase?o.toLowerCase():o,s++,r++)}if(!this.strict&&s<i.length){let a=i.slice(s);n+=this.autoLowercase?a.toLowerCase():a}return n}format(t){if(this.resolveForValue(t),this.subEngines.length>0){let a=this.selectEngine(t);if(a!==this)return a.format(t)}let e=Math.max(4096,this.slots.length*4),i=String(t??"").slice(0,e);if(!this.slots.length)return i;let n=this.extractRawInternal(i);if(n.length===0)return this.prefixString;let s="",r=0;for(let a=0;a<this.slots.length;a++){let o=this.slots[a];if(o.isStatic){let l=r<n.length,h=r===0&&!!o.isPrefix,p=r>0&&r===n.length;if(l||h||p)s+=o.char;else break}else if(r<n.length){let l=n[r],h=o.token?.transform?o.token.transform(l):l;this.autoLowercase&&!o.token?.transform&&(h=h.toLowerCase()),s+=h,r++}else break}if(!this.strict&&r<n.length){let a=n.substring(r);s+=this.autoLowercase?a.toLowerCase():a}return s}getRemainingMask(t){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getRemainingMask(t):this.fullMaskTemplate?t.length>=this.fullMaskTemplate.length?t:t+this.fullMaskTemplate.substring(t.length):""}mapCursorPosition(t,e,i){if(this.activeEngine&&this.activeEngine!==this)return this.activeEngine.mapCursorPosition(t,e,i);let n=this.prefixSlotsCount,s=String(t??""),r=String(i??"");if(e<=0||!r)return n;let o=this.extractRawInternal(s.slice(0,e)).length;if(o===0)return Math.max(n,Math.min(this.getNextEditablePosition(0),r.length));let l=0,h=r.length;for(let p=0;p<r.length&&p<this.slots.length;p++)if(!this.slots[p].isStatic&&(l++,l===o)){h=p+1;break}for(;h<r.length&&this.slots[h]&&this.slots[h].isStatic;)h++;return Math.max(n,Math.min(h,r.length))}isSeparatorAt(t){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.isSeparatorAt(t):t>=0&&t<this.slots.length?this.slots[t].isStatic:!1}getNextEditablePosition(t){if(this.activeEngine&&this.activeEngine!==this)return this.activeEngine.getNextEditablePosition(t);let e=Math.max(0,t);for(let i=e;i<this.slots.length;i++)if(!this.slots[i].isStatic)return i;return this.slots.length}getSlotAt(t){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getSlotAt(t):this.slots[t]}getSlots(){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getSlots():this.slots}};var P=class{stack=[];index=-1;maxDepth;constructor(t=50){this.maxDepth=t}push(t,e){let i=this.getCurrent();if(i&&i.raw===t){i.cursor=e;return}this.stack=this.stack.slice(0,this.index+1),this.stack.push({raw:t,cursor:e}),this.stack.length>this.maxDepth&&this.stack.shift(),this.index=this.stack.length-1}updateCurrentCursor(t){let e=this.getCurrent();e&&(e.cursor=t)}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 U=class{delegate;constructor(t){this.delegate=t}handleKeyDown(t){if(F(t))return;let e=this.delegate.getInput(),i=this.delegate.getEngine(),n=this.delegate.getHistory(),s=i.getPrefixLength(),r=e.selectionStart??0,a=e.selectionEnd??r;if((t.ctrlKey||t.metaKey)&&(t.key==="z"||t.key==="Z")&&!t.shiftKey){t.preventDefault(),this.delegate.undo();return}if((t.ctrlKey||t.metaKey)&&(t.key==="y"||t.key==="Y")||(t.ctrlKey||t.metaKey)&&t.shiftKey&&(t.key==="z"||t.key==="Z")){t.preventDefault(),this.delegate.redo();return}n.updateCurrentCursor(r);let o=t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey,l=a>r;if(o&&!l){let u=i.getSlots(),c=r<u.length&&u[r].isStatic&&u[r].char===t.key,d=-1;if(r>0&&r-1<u.length)if(u[r-1].isStatic&&u[r-1].char===t.key)d=r-1;else{let m=r-1;for(;m>=s&&u[m].isStatic;){if(u[m].char===t.key){d=m;break}m--}}if(c||d!==-1){t.preventDefault();let m=c?r:d,b=i.getNextEditablePosition(m+1);this.delegate.applyMask(e.value,b,!0);return}let f=-1;for(let m=r;m<u.length;m++)if(u[m].isStatic){u[m].char===t.key&&(f=m);break}if(f!==-1){t.preventDefault();let m=f-1;for(;m>=s&&!u[m].isStatic;)m--;m++;let b=f-m,v=e.value.slice(m,r);if(u.slice(m,f).every(S=>!!(S.token&&S.token.pattern.test("0")&&!S.token.pattern.test("a")&&!S.token.pattern.test("Z")))&&b>v.length&&v.length>0){let S=b-v.length,I="0".repeat(S)+v,A=e.value.slice(f),x=e.value.slice(0,m)+I+A,L=i.getNextEditablePosition(f+1);this.delegate.applyMask(x,L,!0);return}let w=i.getNextEditablePosition(f+1);this.delegate.applyMask(e.value,w,!0);return}}if(o&&i.isStrict()){let u=i.isDynamicPattern(),c=i.extractRaw(e.value),d=a>r?i.extractRawForCurrentPattern(e.value.slice(r,a)):"";if(u){let f=e.value.slice(0,r)+t.key+e.value.slice(a);i.resolveForValue(f)}let y=i.getMaxEditableCount();if(y>0&&y-(c.length-d.length)<=0){u&&i.resolveForValue(e.value),t.preventDefault();return}u&&i.resolveForValue(e.value)}if(a>r){if(t.key==="Backspace"||t.key==="Delete"){t.preventDefault();let u=e.value,c=u.slice(0,r)+u.slice(a);this.delegate.applyMask(c,Math.max(s,r));return}return}if(t.key==="ArrowLeft"&&!t.shiftKey&&r<=s){t.preventDefault(),e.setSelectionRange(s,s);return}if(t.key==="Home"&&s>0&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&!t.altKey){t.preventDefault(),e.setSelectionRange(s,s);return}if(t.key==="Backspace"&&r<=s){t.preventDefault(),e.setSelectionRange(s,s);return}if(t.key==="Delete"&&r<s){t.preventDefault(),e.setSelectionRange(s,s);return}if(t.key==="Backspace"&&(t.ctrlKey||t.altKey||t.metaKey)){if(t.preventDefault(),r<=s){e.setSelectionRange(s,s);return}let u=r-1;for(;u>=s&&i.isSeparatorAt(u);)u--;for(;u>=s&&!i.isSeparatorAt(u);)u--;let c=Math.max(s,u+1),d=e.value,y=d.slice(0,c)+d.slice(r);this.delegate.applyMask(y,c);return}if(t.key==="Delete"&&(t.ctrlKey||t.altKey||t.metaKey)){t.preventDefault();let u=e.value;if(r>=u.length)return;let c=r;for(;c<u.length&&i.isSeparatorAt(c);)c++;for(;c<u.length&&!i.isSeparatorAt(c);)c++;for(;c<u.length&&i.isSeparatorAt(c);)c++;let d=c,y=u.slice(0,r)+u.slice(d);this.delegate.applyMask(y,r);return}if(t.key==="Backspace"&&r>s){if(i.isSeparatorAt(r-1)){t.preventDefault();let u=r-1;for(;u>s&&i.isSeparatorAt(u-1);)u--;if(u>s){let c=e.value,d=c.slice(0,u-1)+c.slice(r);this.delegate.applyMask(d,u-1)}else this.delegate.applyMask("",s)}return}if(t.key==="Delete"&&r<e.value.length){if(i.isSeparatorAt(r)){t.preventDefault();let u=r;for(;u<e.value.length&&i.isSeparatorAt(u);)u++;if(u<e.value.length){let c=e.value,d=c.slice(0,u)+c.slice(u+1);this.delegate.applyMask(d,r)}}return}}handleKeyUp(t){let e=this.delegate.getInput(),i=this.delegate.getHistory();(t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="Home")&&!t.shiftKey&&this.delegate.enforceMinCursor(),i.updateCurrentCursor(e.selectionStart??0)}};var G=class extends E{engine;history;keyboard;isComposing=!1;isUndoingRedoing=!1;isMouseDown=!1;isApplyingMask=!1;lastValue="";lastInternalRemainingMask="";isNotifying=!1;hasPendingNotification=!1;onChangeNativeHandler=()=>{};wasInputModeInferred=!1;cutTimerId=null;pasteTimerId=null;resetTimerId=null;lastInputType="";constructor(t,e,i){let n=O(t,e,i),s=n.wrapper,r=n.input,a=n.options,o=s?.getAttribute("data-mask")||r?.getAttribute("data-mask"),l=a.mask||o||"";typeof l=="string"&&l.includes("|")&&(l=l.split("|").map(k=>k.trim()));let h=a.placeholderChar||s?.getAttribute("data-mask-placeholder")||r?.getAttribute("data-mask-placeholder")||"_",p=s?.hasAttribute("data-disabled")||r?.hasAttribute("data-disabled"),u=s?.getAttribute("data-mask-strict")||r?.getAttribute("data-mask-strict"),c=s?.getAttribute("data-mask-auto-lowercase")==="true"||r?.getAttribute("data-mask-auto-lowercase")==="true",d=s?.getAttribute("data-mask-infer-inputmode")??r?.getAttribute("data-mask-infer-inputmode"),y=a.inferInputMode??(d!==null?d!=="false":!0),{disabled:f,...m}=a,b=f!==void 0?f:p?!0:!l||Array.isArray(l)&&l.length===0,v={...m,mask:l,placeholderChar:h,strict:a.strict??(u!==null?u!=="false":!0),autoLowercase:a.autoLowercase??c??!1,disabled:b,resetHistoryOnMaskChange:a.resetHistoryOnMaskChange??!1,inferInputMode:y,onInput:a.onInput||a.oninput,onChange:a.onChange||a.onchange,onComplete:a.onComplete||a.oncomplete};super(s,r,v),this.history=new P,this.engine=new N(this.options.mask||"",{placeholderChar:this.options.placeholderChar,tokens:this.options.tokens,strict:this.options.strict,autoLowercase:this.options.autoLowercase}),this.syncInferredInputMode(),this.keyboard=new U({getInput:()=>this.input,getEngine:()=>this.engine,getHistory:()=>this.history,applyMask:(k,w,S)=>this.applyMask(k,w,S),undo:()=>this.undo(),redo:()=>this.redo(),enforceMinCursor:()=>this.enforceMinCursor()}),this.bindEvents(),this.lastValue=this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value,this.syncInitialValue(),this.runAuditWarning(this.options.audit)}getSpecificAuditWarnings(){let t=[],e=[],i=this.checkAriaIdReferences(this.input,"aria-describedby",e,!0),n=!!this.input.getAttribute("placeholder")?.trim(),s=!!this.input.getAttribute("aria-placeholder")?.trim();return!i&&!s&&!this.options.disabled&&(n?t.push("Indication du format attendu fragile : l'attribut placeholder seul dispara\xEEt \xE0 la saisie et est masqu\xE9 par le gabarit fant\xF4me ; utilisez aria-describedby ou aria-placeholder (WCAG 3.3.2)."):t.push("Indication du format attendu manquante : d\xE9finissez aria-describedby ou aria-placeholder pour informer les technologies d'assistance (WCAG 3.3.2).")),t}extractRawSnippet(t){return this.engine.extractRaw(t)}onPasswordModeDetected(){this.history.clear(),this.lastValue="",this.lastInternalRemainingMask="",this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask")}static format(t,e,i={}){return N.format(t,e,i)}onNativeValueSet(t){if(this.options.disabled)this.checkValueChange();else{let e=this.applyTransformInput(t,"programmatic","");this.applyMask(e,e.length)}}onDisabledChange(t){t?(this.wrapper.removeAttribute("data-mask"),this.wrapper.classList.remove("is-complete","has-selection"),this.clearGhost(),this.checkValueChange()):this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length),this.syncInferredInputMode()}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 e=this.input.selectionStart??this.input.value.length;this.applyMask(this.input.value,e)}},0)},this.onChangeNativeHandler=()=>{this.isDestroyed||this.checkValueChange()};let{signal:t}=this.abortController;this.input.addEventListener("beforeinput",this.onBeforeInput,{signal:t}),this.input.addEventListener("input",this.handleInput,{signal:t}),this.input.addEventListener("keydown",this.onKeyDown,{signal:t}),this.input.addEventListener("paste",this.onPaste,{signal:t}),this.input.addEventListener("focus",this.onFocus,{signal:t}),this.input.addEventListener("blur",this.onBlur,{signal:t}),this.input.addEventListener("click",this.onClick,{signal:t}),this.input.addEventListener("keyup",this.onKeyUp,{signal:t}),this.input.addEventListener("select",this.onSelect,{signal:t}),this.input.addEventListener("mousedown",this.onMouseDown,{signal:t}),window.addEventListener("mouseup",this.onMouseUp,{signal:t}),this.input.addEventListener("compositionstart",this.onCompositionStart,{signal:t}),this.input.addEventListener("compositionend",this.onCompositionEnd,{signal:t}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:t}),this.input.addEventListener("cut",this.onCutHandler,{signal:t}),this.input.addEventListener("change",this.onChangeNativeHandler,{signal:t}),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,{signal:t}))}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.wasInputModeInferred&&this.input.getAttribute("inputmode")==="numeric"&&this.input.removeAttribute("inputmode"),this.history.clear(),this.lastValue="",this.lastInternalRemainingMask="",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 i=typeof e=="boolean"?e:e&&typeof e=="object"&&e.strict!==void 0?e.strict:this.options.strict,n=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=i,this.engine.setStrict(i??!0),this.engine.compile(""),n&&this.history.clear(),this.setDisabled(!0),this.syncInferredInputMode();return}this.options.mask=t,this.options.strict=i,this.engine.setStrict(i??!0),this.engine.compile(t),n&&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===null&&(this.isSensitiveField()||typeof this.options.mask=="function")||e===this.lastInternalRemainingMask)return;let i=typeof this.options.mask=="function"?"":Array.isArray(this.options.mask)?this.options.mask.join("|"):this.options.mask||"";if(e===i)return;if(e){let n=e.includes("|")?e.split("|").map(s=>s.trim()):e;this.setMask(n)}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.setAutoLowercase(this.options.autoLowercase),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)}applyTransformInput(t,e,i){if(typeof this.options.transformInput!="function")return t;try{let n=this.options.transformInput(t,{source:e,inputType:i});if(typeof n=="string")return e==="paste"?R(n,4096):Y(n,4096)}catch{}return t}setValue(t){let e=t!=null?String(t):"";if(this.options.disabled){this.input.value=e,this.checkValueChange();return}let i=this.applyTransformInput(e,"programmatic","");this.applyMask(i,i.length)}getRawValue(){return this.engine.extractRaw(this.input.value)}isComplete(){if(this.options.disabled)return!0;let t=this.getRawValue(),e=this.engine.getActiveEditableCount();return e===0?!0:t.length>=e}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,i=t!==e;this.wrapper.classList.toggle("has-selection",i)}onBeforeInput(t){if(this.lastInputType=t.inputType||"",!this.options.disabled&&!this.isComposing&&this.engine.isStrict()&&!(t.inputType==="insertFromPaste"||t.inputType==="insertReplacementText")&&t.inputType&&t.inputType.startsWith("insert")){let e=this.input.value,i=this.engine.isDynamicPattern(),n=this.engine.extractRaw(e),s=this.input.selectionStart??0,r=this.input.selectionEnd??s,a=r>s?this.engine.extractRawForCurrentPattern(e.slice(s,r)):"";if(i){let l=e.slice(0,s)+(t.data??"")+e.slice(r);this.engine.resolveForValue(l)}let o=this.engine.getMaxEditableCount();if(o>0&&Math.max(0,o-(n.length-a.length))<=0){i&&this.engine.resolveForValue(e),t.preventDefault();return}i&&this.engine.resolveForValue(e)}}handleInput(t){if(this.isDispatchingNativeInput||this.isComposing)return;let e=t?.inputType||this.lastInputType||"";this.lastInputType="";let i=!!(this.options.onInput||this.options.oninput),n=this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value;if(i&&n!==this.lastValue&&this.checkValueChange(),this.options.disabled){this.checkValueChange();return}let s=this.input.value,r=this.input.selectionStart??s.length,a=this.applyTransformInput(s,"input",e),o=a!==s?r>=s.length?a.length:Math.min(r,a.length):r,l=this.history.getCurrent(),h=this.engine.extractRaw(a),p=this.engine.getMaxEditableCount();if(p>0&&this.engine.isStrict()&&l&&l.raw.length>=p&&h.length>p){this.applyMask(l.raw,l.cursor);return}this.applyMask(a,o),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 e=this.preparePastedText(this.getClipboardPlainText(t),4096),i=this.applyTransformInput(e,"paste","insertFromPaste");if(!i)return;let n=this.engine.getPrefixLength(),s=this.input.selectionStart??0,r=this.input.selectionEnd??s,a=this.input.value,o=this.getRawValue(),l=this.engine.getMaxEditableCount(),h=this.engine.getPrefix(),p=h.replace(/[\s.-]+/g,"").toUpperCase(),u=i.replace(/[\s.-]+/g,"").toUpperCase(),c=p.length>0&&u.startsWith(p),d=a.slice(0,Math.max(n,s)).replace(/[\s.-]+/g,"").toUpperCase(),y=d.length>=2&&u.startsWith(d),f=Math.max(n,s),m=Math.max(n,r);(c||y)&&(f=0,m=a.length);let b=Math.max(0,l-o.length);if(f!==m){let A=this.engine.extractRawForCurrentPattern(a.slice(f,m));b=Math.max(0,l-(o.length-A.length))}let v=this.engine.normalizePastedValue(i),k=this.engine.getActiveEditableCount(),w=k>0&&o.length>=k;if(this.engine.isStrict()&&(b<=0||s===r&&w)){let A=this.engine.extractRaw(v).length,x=this.engine.getMaxEditableCount();if(s===r&&x>0&&A===x&&(b<=0||A>b))f=0,m=a.length;else if(b<=0){this.engine.resolveForValue(a);return}else this.engine.resolveForValue(a)}let S,I;f===0&&m===a.length?(S=v,I=v.length):o.length===0&&f===n&&m===a.length?n>0&&v.toUpperCase().startsWith(h.toUpperCase())?(S=v,I=v.length):(S=a.slice(0,f)+v,I=S.length):(S=a.slice(0,f)+i+a.slice(m),I=f+i.length),this.applyMask(S,I),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(){if(this.wrapper.classList.remove("is-focused","has-selection"),this.isSensitiveField()){this.history.clear(),this.lastValue="",this.lastInternalRemainingMask="",this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask");return}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,i=this.input.selectionEnd??e;e===i&&e<t&&this.input.setSelectionRange(t,t)}updateGhost(t){if(!this.ghost)return;if(this.options.disabled||this.isSensitiveField()){this.clearGhost();return}let e=!t||t===this.engine.getPrefix();if(this.shouldHideGhostForPlaceholder(e)){this.clearGhost();return}let i=this.engine.getFullMaskTemplate(),n=i.length>t.length?i.substring(t.length):"",s=this.input.ownerDocument||document,r=s.createElement("span");r.className="mask-ghost-typed",r.textContent=t;let a=s.createElement("span");a.className="mask-ghost-remaining",a.textContent=n,this.setGhostContent(r,a),this.ghost.scrollLeft=this.input.scrollLeft}applyMask(t,e,i=!1){if(this.options.disabled||this.isApplyingMask)return;this.isApplyingMask=!0;let n="",s=!1;try{n=this.engine.format(t),this.engine.isDynamicPattern()&&this.syncInferredInputMode();let r=this.engine.getRemainingMask(n),a=this.isSensitiveField();this.setNativeValue(n),a?(this.lastInternalRemainingMask="",this.wrapper.removeAttribute("data-mask"),this.clearGhost()):(this.lastInternalRemainingMask=r,this.wrapper.setAttribute("data-mask",r),this.updateGhost(n));let o=this.engine.getPrefixLength(),l;if(i||this.isUndoingRedoing)l=Math.max(o,Math.min(e,n.length));else{let h=this.engine.mapCursorPosition(t,e,n);l=Math.max(o,h)}this.input.setSelectionRange(l,l),s=this.isComplete(),this.wrapper.classList.toggle("is-complete",s),a?(this.options.copyRaw=!1,this.history.clear()):this.isUndoingRedoing||this.history.push(this.getRawValue(),l)}finally{this.isApplyingMask=!1}this.checkValueChange()}syncInitialValue(){let t=this.isSensitiveField();if(this.options.disabled){this.wrapper.removeAttribute("data-mask"),this.clearGhost(),this.lastValue=t?this.computePasswordDigest(this.input.value):this.input.value,this.checkValueChange();return}this.syncGhostStyles();let e=this.input.value||"";if(e){let i=this.applyTransformInput(e,"programmatic","");this.applyMask(i,i.length)}else{let i=this.engine.getPrefixLength();if(i>0)this.applyMask("",i);else{if(t)this.lastInternalRemainingMask="",this.wrapper.removeAttribute("data-mask"),this.clearGhost();else{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){let e=this.isSensitiveField(),i=this.input.value;if(!((e?this.computePasswordDigest(i):i)===this.lastValue&&!t&&!this.hasPendingNotification)){if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let s=0,r=10;for(;((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)!==this.lastValue||this.hasPendingNotification||t)&&s<r;){s++,this.hasPendingNotification=!1,t=!1;let a=this.isSensitiveField(),o=this.input.value;this.lastValue=a?this.computePasswordDigest(o):o;let l=this.options.disabled?o:this.getRawValue(),h=this.options.disabled?0:this.engine.getActiveEditableCount(),p=this.isComplete(),u={value:o,rawValue:l,isComplete:p,totalSlots:h,filledSlots:this.options.disabled?o.length:l.length},c=!a,d=this.options.onInput||this.options.oninput;d&&d(o,u),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:c,detail:u})),this.dispatchNativeInput();let y=this.options.onChange||this.options.onchange;y&&y(u),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:c,detail:u}));let f=this.options.onComplete||this.options.oncomplete;p&&(f&&f(u),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:c,detail:u})))}}finally{this.isNotifying=!1}}}};var V=class g{options;constructor(t={}){let e=t.currency??"";!e&&t.unit&&(e=t.unit);let i=e==="$"||e==="\xA3"||e==="\xA5"?"prefix":"suffix",n=t.decimals!==void 0?Number(t.decimals):2,s=Number.isFinite(n)?Math.min(20,Math.max(0,Math.floor(n))):2;this.options={currency:String(e).slice(0,32),unit:String(t.unit??e).slice(0,32),currencyPosition:t.currencyPosition??i,decimals:s,decimalSeparator:String(t.decimalSeparator??",").slice(0,4)||",",thousandSeparator:String(t.thousandSeparator??"\xA0").slice(0,4),allowNegative:t.allowNegative??!1,min:t.min??-1/0,max:t.max??1/0}}normalizePastedValue(t){let e=R(t,512);if(!e)return"";let i=0,n=0,s=-1,r=-1;for(let a=0;a<e.length;a++){let o=e[a];o===","?(i++,s=a):o==="."&&(n++,r=a)}if(i>0&&n>0){let a=s>r?",":".";if((a===","?i:n)!==1)return e;let l=a===","?".":",";return e.split(l).join("").replace(a,this.options.decimalSeparator)}return i>=2&&n===0?e.split(",").join(""):n>=2&&i===0?e.split(".").join(""):e}parse(t){let e=String(t??"").slice(0,512).trim(),i=!1;this.options.allowNegative&&e.includes("-")&&(i=!0),this.options.currency&&(e=e.replace(new RegExp(this.escapeRegExp(this.options.currency),"g"),"")),this.options.thousandSeparator&&(e=e.replace(new RegExp(this.escapeRegExp(this.options.thousandSeparator),"g"),"")),e=e.replace(/[\s\u00A0]/g,"");let n=this.options.decimalSeparator,s=e.indexOf(n);s===-1&&(s=e.search(/[,.]/));let r="",a=null,o=!1;return s!==-1?(r=e.substring(0,s).replace(/\D/g,""),this.options.decimals>0&&(o=!0,a=e.substring(s+1).replace(/\D/g,"").slice(0,this.options.decimals))):r=e.replace(/\D/g,""),r.length>1&&(r=r.replace(/^0+/,"")||"0"),{isNegative:i,integerPart:r,decimalPart:a,hasDecimal:o}}format(t,e=t.length,i=!1){let n=String(t??"").slice(0,512),s=Math.max(0,Math.min(e,n.length));if(!n||n.trim()===""||n===this.options.currency.trim())return{formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0};let r=n.substring(0,s),a=r.replace(/\D/g,"").length,o=this.options.decimals>0&&/[,.]/.test(r),{isNegative:l,integerPart:h,decimalPart:p,hasDecimal:u}=this.parse(n),c=p,d=u;if(i&&this.options.decimals>0&&(h||p!==null)&&(d=!0,c===null?c="0".repeat(this.options.decimals):c.length<this.options.decimals&&(c=c+"0".repeat(this.options.decimals-c.length))),l&&!h&&!c&&!d&&this.options.allowNegative){let D="-",C=1;return this.options.currency&&(this.options.currencyPosition==="prefix"?(D=`${this.options.currency} -`,C=D.length):(D=`- ${this.options.currency}`,C=1)),{formatted:D,rawNumber:null,rawValue:"-",cursor:C,isValid:!0}}if(!h&&!c&&!d)return{formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0};let f=this.formatThousands(h||"0");d&&this.options.decimals>0&&(f+=this.options.decimalSeparator+(c??"")),l&&f!=="0"&&(f="-"+f);let m=f;this.options.currency&&(this.options.currencyPosition==="prefix"?m=`${this.options.currency} ${f}`:m=`${f} ${this.options.currency}`);let b=(l?"-":"")+(h||"0")+(p?"."+p:""),v=parseFloat(b);isNaN(v)&&(v=0);let k=v>=this.options.min&&v<=this.options.max,w=0;this.options.currency&&this.options.currencyPosition==="prefix"&&(w=this.options.currency.length+1);let S=0,I=!1,A=w;for(let D=w;D<m.length;D++){let C=m[D];if(C===this.options.currency.trim()[0]&&this.options.currencyPosition==="suffix")break;if(/\d/.test(C)?(S++,A=D+1):C===this.options.decimalSeparator&&(I=!0,A=D+1),o){if(I&&S>=a){w=D+1;break}}else if(S>=a){w=D+1;break}}a>0&&S<a&&A>w&&(w=A);let x=this.options.currency&&this.options.currencyPosition==="prefix"?this.options.currency.length+1:0,L=this.options.currency&&this.options.currencyPosition==="suffix"?Math.max(0,m.length-this.options.currency.length-1):m.length;return w=Math.max(x,Math.min(w,Math.max(x,L))),{formatted:m,rawNumber:v,rawValue:b,cursor:w,isValid:k}}static format(t,e={}){let i=new g(e),n=typeof t=="number"?t.toString():t;return i.format(n).formatted}formatThousands(t){let e=this.options.thousandSeparator;if(!e||t.length<=3)return t;let i=[],n=t.length;for(;n>0;){let s=Math.max(0,n-3);i.push(t.slice(s,n)),n=s}return i.reverse().join(e)}escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};var gt=10,W=class extends E{engine;history;isUndoingRedoing=!1;isApplying=!1;isComposing=!1;isNotifying=!1;hasPendingNotification=!1;lastValue="";wasInputModeInferred=!1;cutTimerId=null;resetTimerId=null;cursorTimerId=null;constructor(t,e,i){let n=O(t,e,i),s=n.wrapper,r=n.input,a=n.options,o=s?.getAttribute("data-mask-pad-decimals")==="true"||r?.getAttribute("data-mask-pad-decimals")==="true",l=r?.getAttribute("data-mask-align")||r?.getAttribute("data-align")||s?.getAttribute("data-mask-align")||s?.getAttribute("data-align"),h={align:a.align??l??"right",padDecimalsOnBlur:a.padDecimalsOnBlur??o??!1,...a};super(s,r,h),this.input.hasAttribute("inputmode")||(this.input.inputMode="decimal",this.wasInputModeInferred=!0),this.history=new P,this.engine=new V(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:"")}onPasswordModeDetected(){this.history.clear(),this.lastValue="",this.lastTrackedValue="",this.clearGhost()}static format(t,e={}){return V.format(t,e)}onNativeValueSet(t){if(this.options.disabled||this.isComposing){this.lastValue=this.isSensitiveField()?this.computePasswordDigest(t):t;return}this.applyAmount(t,t.length)}onDisabledChange(t){t?this.clearGhost():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.handlePaste=this.handlePaste.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 e=this.input.selectionStart??this.input.value.length;this.applyAmount(this.input.value,e)},0)};let{signal:t}=this.abortController;this.input.addEventListener("input",this.handleInput,{signal:t}),this.input.addEventListener("keydown",this.handleKeyDown,{signal:t}),this.input.addEventListener("paste",this.handlePaste,{signal:t}),this.input.addEventListener("blur",this.handleBlur,{signal:t}),this.input.addEventListener("focus",this.handleFocus,{signal:t}),this.input.addEventListener("click",this.handleClick,{signal:t}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:t}),this.input.addEventListener("cut",this.onCutHandler,{signal:t}),this.input.addEventListener("compositionstart",this.onCompositionStart,{signal:t}),this.input.addEventListener("compositionend",this.onCompositionEnd,{signal:t}),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,{signal:t}))}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)return;this.isApplying=!0;let i=null;try{i=this.engine.format(t,e),this.setNativeValue(i.formatted),this.input.setSelectionRange(i.cursor,i.cursor),this.isSensitiveField()?(this.options.copyRaw=!1,this.history.clear(),this.clearGhost()):(this.isUndoingRedoing||this.history.push(i.rawValue,i.cursor),this.updateGhost(i))}finally{this.isApplying=!1}i&&this.checkValueChange(i)}updateGhost(t){if(this.ghost){if(this.options.disabled||this.isSensitiveField()){this.clearGhost();return}if(!t.formatted){if(this.shouldHideGhostForPlaceholder(!0)){this.clearGhost();return}let e=this.options.currency?this.options.currencyPosition==="prefix"?`${this.options.currency} 0`:`0 ${this.options.currency}`:"0,00",n=(this.input.ownerDocument||document).createElement("span");n.className="mask-ghost-remaining",n.textContent=e,this.setGhostContent(n);return}this.clearGhost(),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)}handlePaste(t){if(this.options.disabled)return;t.preventDefault(),this.history.updateCurrentCursor(this.input.selectionStart??0);let e=this.preparePastedText(this.getClipboardPlainText(t),512);if(!e)return;let i=this.engine.normalizePastedValue(e),n=this.input.selectionStart??this.input.value.length,s=this.input.selectionEnd??n,r=this.input.value.slice(0,n)+i+this.input.value.slice(s);this.applyAmount(r,n+i.length)}handleKeyDown(t){if(!(this.options.disabled||F(t))){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,i=this.input.selectionEnd??0;if(e===i&&e>0){let n=this.input.value,s=n[e-1];if(s===this.engine.options.thousandSeparator||s===" "){t.preventDefault();let r=Math.max(0,e-2),a=n.slice(0,r)+n.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,i=this.input.selectionEnd??0;if(e===i&&e<this.input.value.length){let n=this.input.value,s=n[e];if(s===this.engine.options.thousandSeparator||s===" "){t.preventDefault();let r=n.slice(0,e)+n.slice(e+2);this.applyAmount(r,e);return}if(this.options.currency&&this.options.currencyPosition==="suffix"){let r=n.length-this.options.currency.length-1;if(e>=r){t.preventDefault();return}}}}(t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="Home"||t.key==="End")&&(this.cursorTimerId!==null&&clearTimeout(this.cursorTimerId),this.cursorTimerId=window.setTimeout(()=>{this.cursorTimerId=null,this.enforceCursorBounds()},0))}}enforceCursorBounds(){if(this.isDestroyed||!this.isFocused||K(this.input.ownerDocument)!==this.input||!this.input.value||this.options.disabled)return;let t=this.input.selectionStart??0,e=this.input.selectionEnd??0;if(t!==e)return;let i=this.input.value,n=this.options.currency;if(n){if(this.options.currencyPosition==="prefix"){let s=n.length+1;t<s&&this.input.setSelectionRange(s,s)}else if(this.options.currencyPosition==="suffix"){let s=Math.max(0,i.length-n.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.isSensitiveField()){this.history.clear(),this.lastValue="",this.lastTrackedValue="",this.clearGhost();return}if(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:!this.isSensitiveField(),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))}checkValueChange(t){if(!((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)===this.lastValue&&!this.hasPendingNotification)){if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let n=0,s=t;for(;((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)!==this.lastValue||this.hasPendingNotification)&&n<gt;){n++,this.hasPendingNotification=!1;let r=this.isSensitiveField(),a=this.input.value;this.lastValue=r?this.computePasswordDigest(a):a;let o=s??this.engine.format(a);s=void 0,this.notifyChange(o)}}finally{this.isNotifying=!1}}}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:!this.isSensitiveField(),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}getSpecificAuditWarnings(){let t=[],e=(this.options.currency||this.options.unit||"").trim();if(!e||this.options.disabled)return t;let i=[],n=this.checkAriaIdReferences(this.input,"aria-describedby",i,!0),s=!!this.input.getAttribute("aria-placeholder")?.trim();if(n||s)return t;let r=this.input.ownerDocument||document,a=typeof this.input.getRootNode=="function"?this.input.getRootNode():r,o=typeof ShadowRoot<"u"&&a instanceof ShadowRoot?a:r,l=this.input.getAttribute("aria-label")||"",h=this.input.getAttribute("aria-labelledby")?.trim();if(h)for(let y of h.split(/\s+/).filter(Boolean)){let f=typeof ShadowRoot<"u"&&a instanceof ShadowRoot?a.getElementById(y):r.getElementById(y);f?.textContent&&(l+=" "+f.textContent)}let p=this.input.closest("label");if(p?.textContent&&(l+=" "+p.textContent),this.input.id)try{let y=o.querySelector(`label[for="${q(this.input.id)}"]`);y?.textContent&&(l+=" "+y.textContent)}catch{}let u=l.toLowerCase(),c=e.toLowerCase();return u.includes(c)||c==="\u20AC"&&(u.includes("euro")||u.includes("eur"))||c==="$"&&(u.includes("dollar")||u.includes("usd"))||c==="\xA3"&&(u.includes("livre")||u.includes("pound")||u.includes("gbp"))||t.push(`Devise/unit\xE9 "${e}" non expos\xE9e aux technologies d'assistance quand le champ est vide (le fant\xF4me est aria-hidden="true") : mentionnez-la dans le <label>, aria-label ou aria-describedby (WCAG 3.3.2).`),t}setValue(t){let e=t!=null?String(t):"";this.options.disabled?(this.setNativeValue(e),this.lastValue=this.isSensitiveField()?this.computePasswordDigest(e):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.cursorTimerId!==null&&(clearTimeout(this.cursorTimerId),this.cursorTimerId=null),this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="decimal"&&this.input.removeAttribute("inputmode"),this.lastValue="",this.history.clear(),super.destroy())}};var B=class g{domains;tlds;suggestOnAt;defaultDomain=null;defaultTld="__";static DEFAULT_DOMAINS=["gmail.com","outlook.com","orange.fr","free.fr","sfr.fr","yahoo.com","hotmail.com","icloud.com","laposte.net","proton.me"];static DEFAULT_TLDS=["com","fr","net","org","eu","io","co","info","biz","me","tv","fi","be","ch","ca","uk","de","es","it"];constructor(t={}){let e=Array.isArray(t.domains)?t.domains.slice(0,500).map(i=>String(i??"").trim().slice(0,253)).filter(Boolean):[];this.domains=e.length>0?e:g.DEFAULT_DOMAINS,this.tlds=t.tlds&&t.tlds.length>0?t.tlds.slice(0,200).map(i=>String(i).trim().replace(/^\./,"").slice(0,32)).filter(Boolean):[...g.DEFAULT_TLDS],this.suggestOnAt=t.suggestOnAt??!0,this.setDefaultDomain(t.defaultDomain??null),this.setDefaultTld(t.defaultTld!==void 0?t.defaultTld:"__")}setDefaultDomain(t){t===!0?this.defaultDomain=this.domains.length>0?this.domains[0]:null:typeof t=="string"&&t.trim().length>0?this.defaultDomain=t.trim().replace(/^@/,"").slice(0,253)||null:this.defaultDomain=null}setDefaultTld(t){t===!0?this.defaultTld=this.tlds.length>0?this.tlds[0]:null:typeof t=="string"&&t.trim().length>0?this.defaultTld=t.trim().replace(/^\./,"").slice(0,32)||null:this.defaultTld=null}setTlds(t){this.tlds=t&&t.length>0?t.slice(0,200).map(e=>String(e).trim().replace(/^\./,"").slice(0,32)).filter(Boolean):[...g.DEFAULT_TLDS]}getMatchingTlds(t){let e=(t??"").toLowerCase();return e.length===0?[...this.tlds]:this.tlds.filter(i=>i.toLowerCase().startsWith(e)&&i.toLowerCase()!==e)}getMatchingDomains(t){let e=String(t??"").slice(0,512);if(!e.includes("@"))return this.defaultDomain?[this.defaultDomain]:[];let i=e.indexOf("@");if(e.indexOf("@",i+1)!==-1)return[];let n=e.substring(i+1);if(n.length===0)return this.suggestOnAt?[...this.domains]:[];let s=n.toLowerCase();return this.domains.filter(r=>r.toLowerCase().startsWith(s)&&r.toLowerCase()!==s)}getSuggestion(t,e=0){let i=String(t??"").slice(0,512);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("@"),s=i.substring(0,n),r=i.substring(n+1);if(i.indexOf("@",n+1)!==-1)return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let a=this.getMatchingDomains(t);if(a.length>0){let d=(e%a.length+a.length)%a.length,y=a[d],f=r.toLowerCase(),m=y.substring(f.length);return{full:`${s}@${y}`,remaining:m,matchedDomain:y,isHintOnly:!1}}if(r.length===0||r.startsWith("."))return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let o=r.toLowerCase();if(this.domains.some(d=>d.toLowerCase()===o))return{full:i,remaining:"",matchedDomain:r,isHintOnly:!1};let l=r.lastIndexOf(".");if(l===-1){if(!this.defaultTld)return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let d=this.defaultTld.includes("_"),y=`.${this.defaultTld}`,f=`${r}.${this.defaultTld}`;return{full:d?i:`${s}@${f}`,remaining:y,matchedDomain:d?null:f,isHintOnly:d}}let h=r.substring(0,l),p=r.substring(l+1);if(!h||h.endsWith("."))return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};if(p.length===0){if(this.defaultTld&&!this.defaultTld.includes("_")){let d=`${h}.${this.defaultTld}`;return{full:`${s}@${d}`,remaining:this.defaultTld,matchedDomain:d,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 u=p.toLowerCase();if(this.tlds.some(d=>d.toLowerCase()===u))return{full:i,remaining:"",matchedDomain:r,isHintOnly:!1};let c=this.getMatchingTlds(p);if(c.length>0){let d=(e%c.length+c.length)%c.length,y=c[d],f=y.substring(u.length),m=`${h}.${y}`;return{full:`${s}@${m}`,remaining:f,matchedDomain:m,isHintOnly:!1}}if(this.defaultTld&&this.defaultTld.includes("_")&&p.length<this.defaultTld.length){let d=this.defaultTld.substring(p.length);if(d.includes("_"))return{full:i,remaining:d,matchedDomain:null,isHintOnly:!0}}return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1}}};var mt=10,$=class extends E{engine;currentSuggestion={full:"",remaining:"",matchedDomain:null};currentSuggestionIndex=0;hadInitialAriaAutocomplete=!1;wasAriaAutocompleteSet=!1;isSuggestionDismissed=!1;isNotifying=!1;hasPendingNotification=!1;wasAutocorrectSet=!1;wasAutocapitalizeSet=!1;wasSpellcheckSet=!1;wasInputModeInferred=!1;isComposing=!1;lastNotifiedValue="";srStatusEl=null;srAnnounceTimerId=null;lastAnnouncedSuggestion="";cutTimerId=null;resetTimerId=null;constructor(t,e,i){let n=O(t,e,i),s=n.wrapper,r=n.input,a=n.options,o=s?.getAttribute("data-mask-cycle-suggestions")==="true"||r?.getAttribute("data-mask-cycle-suggestions")==="true",l=s?.getAttribute("data-mask-auto-lowercase")==="true"||r?.getAttribute("data-mask-auto-lowercase")==="true",h=s?.getAttribute("data-mask-aria-autocomplete")??r?.getAttribute("data-mask-aria-autocomplete"),p=a.setAriaAutocomplete??(h!==null?h!=="false":!0),u=s?.getAttribute("data-mask-tlds")??r?.getAttribute("data-mask-tlds"),c=a.tlds??(u?u.split(",").map(m=>m.trim()).filter(Boolean):void 0),d=s?.getAttribute("data-mask-default-tld")??r?.getAttribute("data-mask-default-tld"),y=a.defaultTld!==void 0?a.defaultTld:d!==null?d==="false"||d==="none"?null:d==="true"?!0:d:void 0,f={completeOnTab:!0,completeOnArrowRight:!0,completeOnEnter:!0,cycleSuggestions:a.cycleSuggestions??o??!1,autoLowercase:a.autoLowercase??l??!1,setAriaAutocomplete:p,...a,...c!==void 0?{tlds:c}:{},...y!==void 0?{defaultTld:y}:{}};super(s,r,f),this.input.hasAttribute("inputmode")||(this.input.inputMode="email",this.wasInputModeInferred=!0),this.input.hasAttribute("autocorrect")||(this.input.setAttribute("autocorrect","off"),this.wasAutocorrectSet=!0),this.input.hasAttribute("autocapitalize")||(this.input.setAttribute("autocapitalize","none"),this.wasAutocapitalizeSet=!0),this.input.hasAttribute("spellcheck")||(this.input.setAttribute("spellcheck","false"),this.wasSpellcheckSet=!0),this.hadInitialAriaAutocomplete=this.input.hasAttribute("aria-autocomplete"),this.syncAriaAutocomplete(),this.engine=new B(this.options),this.lastNotifiedValue=this.isSensitiveField()?"":this.input.value,this.bindEvents(),!this.options.disabled&&!this.isSensitiveField()&&this.updateSuggestion(),this.runAuditWarning(this.options.audit)}syncAriaAutocomplete(){let t=!!(this.options.setAriaAutocomplete&&!this.options.disabled&&!this.isSensitiveField()&&!this.isDestroyed);this.hadInitialAriaAutocomplete||(t?this.input.hasAttribute("aria-autocomplete")||(this.input.setAttribute("aria-autocomplete","inline"),this.wasAriaAutocompleteSet=!0):this.wasAriaAutocompleteSet&&(this.input.getAttribute("aria-autocomplete")==="inline"&&this.input.removeAttribute("aria-autocomplete"),this.wasAriaAutocompleteSet=!1));let e=this.input.ownerDocument||(typeof document<"u"?document:null),i=!!(e&&typeof e.ariaNotify=="function");t&&!i?this.ensureSrStatusEl():!t&&this.srStatusEl&&(this.srStatusEl.remove(),this.srStatusEl=null)}onPasswordModeDetected(){this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.lastNotifiedValue="",this.lastTrackedValue="",this.lastAnnouncedSuggestion="",this.currentSuggestion={full:"",remaining:"",matchedDomain:null},this.syncAriaAutocomplete(),this.clearGhost()}onNativeValueSet(t){this.options.disabled||this.isComposing||this.isSensitiveField()||(this.isSuggestionDismissed=!1,this.updateSuggestion())}onDisabledChange(t){this.syncAriaAutocomplete(),t||this.isSensitiveField()?(this.currentSuggestion={full:"",remaining:"",matchedDomain:null},this.clearGhost()):(this.isSuggestionDismissed=!1,this.updateSuggestion())}bindEvents(){this.handleInput=this.handleInput.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handlePaste=this.handlePaste.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.isSensitiveField())&&this.updateSuggestion()},0)};let{signal:t}=this.abortController;this.input.addEventListener("input",this.handleInput,{signal:t}),this.input.addEventListener("keydown",this.handleKeyDown,{signal:t}),this.input.addEventListener("paste",this.handlePaste,{signal:t}),this.input.addEventListener("blur",this.handleBlur,{signal:t}),this.input.addEventListener("focus",this.handleFocus,{signal:t}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:t}),this.input.addEventListener("cut",this.onCutHandler,{signal:t}),this.input.addEventListener("compositionstart",()=>{this.isComposing=!0},{signal:t}),this.input.addEventListener("compositionend",()=>{this.isComposing=!1,!this.isDestroyed&&!this.options.disabled&&!this.isSensitiveField()&&this.handleInput()},{signal:t}),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!(this.isDestroyed||this.options.disabled||this.isSensitiveField())&&this.updateSuggestion()},0)},this.input.form.addEventListener("reset",this.onFormResetHandler,{signal:t}))}ensureSrStatusEl(){if(this.srStatusEl&&this.wrapper.contains(this.srStatusEl))return this.srStatusEl;let t=this.input.ownerDocument||(typeof document<"u"?document:null);if(!t)return null;let e=t.createElement("span");return e.className="wulf-mask-sr-status",e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),this.wrapper.appendChild(e),this.srStatusEl=e,e}scheduleSuggestionAnnouncement(t=!1){if(this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),!this.options.setAriaAutocomplete||!this.isFocused||this.isDestroyed||this.isSensitiveField())return;let e=this.currentSuggestion;if(!e.remaining||e.isHintOnly){this.lastAnnouncedSuggestion="",this.srStatusEl&&(this.srStatusEl.textContent="");return}let i=e.full;if(i===this.lastAnnouncedSuggestion&&!t)return;let n=()=>{if(this.srAnnounceTimerId=null,this.isDestroyed||!this.isFocused||this.isSensitiveField())return;this.lastAnnouncedSuggestion=i;let r=this.input.ownerDocument||(typeof document<"u"?document:null);if(r&&typeof r.ariaNotify=="function")try{r.ariaNotify(i,{priority:"normal"});return}catch{}let a=this.ensureSrStatusEl();a&&(a.textContent=a.textContent===i?`${i}\xA0`:i)};t?n():this.srAnnounceTimerId=window.setTimeout(n,250)}updateSuggestion(t){if(this.options.disabled||this.isSensitiveField()){this.currentSuggestion={full:"",remaining:"",matchedDomain:null},this.clearGhost();return}let e=this.input.value;if(this.currentSuggestion=this.isSuggestionDismissed?{full:e,remaining:"",matchedDomain:null}:this.engine.getSuggestion(e,this.currentSuggestionIndex),!!this.ghost){if(this.shouldHideGhostForPlaceholder(e.length===0))this.clearGhost();else if(this.currentSuggestion.remaining){let i=this.input.ownerDocument||document,n=i.createElement("span");n.className="mask-ghost-typed",n.textContent=e;let s=i.createElement("span");s.className="mask-ghost-remaining",s.textContent=this.currentSuggestion.remaining,this.setGhostContent(n,s)}else this.clearGhost();this.ghost.scrollLeft=this.input.scrollLeft,t?.announce&&this.scheduleSuggestionAnnouncement(!!t.immediate),this.notifyValueChange()}}notifyValueChange(){if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let t=0;do{t++,this.hasPendingNotification=!1;let e=this.isSensitiveField(),i=!e,n=this.input.value,s=this.getDetail();this.options.onInput&&this.options.onInput(s),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:i,detail:s})),n!==this.lastNotifiedValue&&(this.lastNotifiedValue=e?"":n,this.dispatchNativeInput())}while(this.hasPendingNotification&&t<mt)}finally{this.isNotifying=!1}}handleInput(t){if(!this.isDispatchingNativeInput&&!(this.options.disabled||this.isSensitiveField())&&!(this.isComposing||t&&"isComposing"in t&&t.isComposing)){if(this.options.autoLowercase){let e=this.input.selectionStart??0,i=this.input.selectionEnd??e,n=this.input.value.toLowerCase();n!==this.input.value&&(this.setNativeValue(n),this.input.setSelectionRange(e,i))}this.isSuggestionDismissed=!1,this.currentSuggestionIndex=0,this.updateSuggestion({announce:!0,immediate:!1})}}handlePaste(t){if(this.options.disabled||this.isSensitiveField())return;let e=this.getClipboardPlainText(t),i=this.preparePastedText(e,512);if(i===e)return;t.preventDefault();let n=this.input.selectionStart??this.input.value.length,s=this.input.selectionEnd??n,r=this.input.value.slice(0,n),a=this.input.value.slice(s),o=r+i+a,l=this.options.autoLowercase?o.toLowerCase():o;if(typeof document<"u"&&K(this.input.ownerDocument)===this.input&&typeof document.execCommand=="function")try{if(document.execCommand("insertText",!1,i)&&this.input.value===l)return}catch{}this.setNativeValue(o);let h=n+i.length;this.input.setSelectionRange(h,h),this.handleInput()}handleKeyDown(t){if(this.options.disabled||this.isSensitiveField()||F(t)||t.shiftKey||t.ctrlKey||t.altKey||t.metaKey)return;let e=!!this.currentSuggestion.remaining&&!this.currentSuggestion.isHintOnly,n=(this.input.selectionStart??0)===this.input.value.length,s=this.input.value.length>0;if(t.key==="Escape"&&e){t.preventDefault(),this.isSuggestionDismissed=!0,this.currentSuggestion={full:this.input.value,remaining:"",matchedDomain:null},this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.lastAnnouncedSuggestion="",this.srStatusEl&&(this.srStatusEl.textContent=""),this.clearGhost();return}if(this.options.cycleSuggestions&&e&&s&&n){if(t.key==="ArrowDown"){t.preventDefault(),this.currentSuggestionIndex++,this.updateSuggestion({announce:!0,immediate:!0});return}if(t.key==="ArrowUp"){t.preventDefault(),this.currentSuggestionIndex--,this.updateSuggestion({announce:!0,immediate:!0});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&&n&&this.options.completeOnArrowRight){t.preventDefault(),this.acceptSuggestion();return}}acceptSuggestion(){if(!this.currentSuggestion.remaining||this.currentSuggestion.isHintOnly||this.options.disabled||this.isSensitiveField()||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();this.options.onChange&&this.options.onChange(e);let i=!this.isSensitiveField();return this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:i,detail:e})),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:i,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.isSuggestionDismissed=!1,this.syncGhostStyles(),this.updateSuggestion()}handleBlur(){if(this.wrapper.classList.remove("is-focused"),this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.lastAnnouncedSuggestion="",this.srStatusEl&&(this.srStatusEl.textContent=""),this.isSensitiveField()){this.lastNotifiedValue="",this.lastTrackedValue="",this.clearGhost();return}this.updateSuggestion();let t=this.getDetail();this.options.onChange&&this.options.onChange(t),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!this.isSensitiveField(),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(i=>i.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.isSuggestionDismissed=!1,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.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.srStatusEl&&(this.srStatusEl.remove(),this.srStatusEl=null),this.lastNotifiedValue="",this.lastAnnouncedSuggestion="",this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="email"&&this.input.removeAttribute("inputmode"),this.wasAriaAutocompleteSet&&this.input.getAttribute("aria-autocomplete")==="inline"&&this.input.removeAttribute("aria-autocomplete"),this.wasAutocorrectSet&&this.input.getAttribute("autocorrect")==="off"&&this.input.removeAttribute("autocorrect"),this.wasAutocapitalizeSet&&this.input.getAttribute("autocapitalize")==="none"&&this.input.removeAttribute("autocapitalize"),this.wasSpellcheckSet&&this.input.getAttribute("spellcheck")==="false"&&this.input.removeAttribute("spellcheck"),super.destroy())}};var _={iso:{format:"YYYY-MM-DD HH:mm:ss"},"iso-t":{format:"YYYY-MM-DD\\THH:mm:ss"},fr:{format:"DD/MM/YYYY HH:mm",placeholderTokens:{DD:"jj",MM:"mm",YYYY:"aaaa",HH:"hh",mm:"mm"}},"fr-sec":{format:"DD/MM/YYYY HH:mm:ss",placeholderTokens:{DD:"jj",MM:"mm",YYYY:"aaaa",HH:"hh",mm:"mm",ss:"ss"}},us:{format:"MM/DD/YYYY HH:mm"},"us-12h":{format:"MM/DD/YYYY hh:mm A"},uk:{format:"DD/MM/YYYY HH:mm"},no:{format:"DD/MM-YYYY HH:mm"},cz:{format:"DD. MM. YYYY HH:mm"},de:{format:"DD.MM.YYYY HH:mm"},jp:{format:"YYYY/MM/DD HH:mm"}},J={YYYY:"YYYY",MM:"MM",DD:"DD",HH:"HH",hh:"hh",mm:"mm",ss:"ss",A:"AM"},bt=[{token:"YYYY",length:4},{token:"MM",length:2},{token:"DD",length:2},{token:"HH",length:2},{token:"hh",length:2},{token:"mm",length:2},{token:"ss",length:2},{token:"A",length:2}],vt=128,z=512,yt=new Set(["/","-",".",":"," ","T","t"]),nt=new Set(["HH","hh","mm","ss","A"]);function T(g){return g>="0"&&g<="9"}function M(g){let t=0;for(let e=0;e<g.length;e++){let i=g.charCodeAt(e);if(i<48||i>57)return NaN;t=t*10+(i-48)}return g.length>0?t:NaN}function St(g,t,e){let i=Array.from(g||e),n=Array.from(e);for(;i.length<t;)i.push(n[i.length]||n[n.length-1]||"_");return i.slice(0,t).join("")}var H=class g{formatSpec="YYYY-MM-DD HH:mm";customPlaceholders={};slots=[];segments=[];fullTemplate="";prefixSlotsCount=0;prefixString="";editableCount=0;hasMeridiemFlag=!1;utcIndicator=" UTC";includeMilliseconds=!1;convertPastedOffset=!0;defaultTimeOnDateOnly=!1;minTs=null;maxTs=null;constructor(t={}){this.updateOptions(t)}static format(t,e={}){return new g(e).formatFromValue(t)}updateOptions(t={}){t.utcIndicator!==void 0&&(this.utcIndicator=t.utcIndicator===!1?!1:String(t.utcIndicator).slice(0,32)),t.includeMilliseconds!==void 0&&(this.includeMilliseconds=!!t.includeMilliseconds),t.convertPastedOffset!==void 0&&(this.convertPastedOffset=t.convertPastedOffset!==!1),t.defaultTimeOnDateOnly!==void 0&&(this.defaultTimeOnDateOnly=t.defaultTimeOnDateOnly),t.min!==void 0&&(this.minTs=this.normalizeBoundary(t.min)),t.max!==void 0&&(this.maxTs=this.normalizeBoundary(t.max)),t.placeholderTokens!==void 0&&(this.customPlaceholders=t.placeholderTokens||{}),(t.format!==void 0||this.slots.length===0)&&this.compile(t.format??this.formatSpec,t.placeholderTokens)}setFormat(t,e){e!==void 0&&(this.customPlaceholders=e),this.compile(t,this.customPlaceholders)}setUtcIndicator(t){this.utcIndicator=t===!1?!1:String(t).slice(0,32)}getUtcIndicator(){return this.utcIndicator}getFormat(){return this.formatSpec}getFullTemplate(){return this.fullTemplate}getGhostRemaining(t){let e=this.utcIndicator?this.utcIndicator:"";return t.length>=this.fullTemplate.length?e:this.fullTemplate.slice(t.length)+e}getPrefix(){return this.prefixString}getPrefixLength(){return this.prefixSlotsCount}getEditableCount(){return this.editableCount}hasMeridiem(){return this.hasMeridiemFlag}isNumericOnly(){return!this.hasMeridiemFlag}getSegments(){return this.segments}getSlots(){return this.slots}isSeparatorAt(t){return t>=0&&t<this.slots.length&&this.slots[t].isStatic}getNextEditablePosition(t){let e=Math.max(0,t);for(let i=e;i<this.slots.length;i++)if(!this.slots[i].isStatic)return i;return this.slots.length}compile(t,e){let i=String(t||"YYYY-MM-DD HH:mm").trim().slice(0,vt)||"YYYY-MM-DD HH:mm";this.formatSpec=i;let n=Object.hasOwn(_,i)?_[i]:null,s=n?n.format:i,r=Object.create(null);if(n?.placeholderTokens)for(let[p,u]of Object.entries(n.placeholderTokens))Object.hasOwn(J,p)&&typeof u=="string"&&(r[p]=u);let a=e!==void 0?e:this.customPlaceholders;if(a&&typeof a=="object")for(let[p,u]of Object.entries(a))Object.hasOwn(J,p)&&typeof u=="string"&&(r[p]=u);this.slots=[],this.segments=[],this.hasMeridiemFlag=!1;let o="",l=!0,h=0;for(;h<s.length;){let p=s[h];if(p==="\\"&&h+1<s.length){let c=s[h+1];this.slots.push({char:c,isStatic:!0,isPrefix:l,segmentIndex:-1,charIndexInSegment:-1,placeholder:c}),o+=c,h+=2;continue}let u=null;for(let c of bt)if(s.startsWith(c.token,h)){u=c;break}if(u){l=!1;let{token:c,length:d}=u;c==="A"&&(this.hasMeridiemFlag=!0);let y=r[c]??J[c],f=St(y,d,J[c]),m=Array.from(f),b=this.segments.length,v=this.slots.length;for(let k=0;k<d;k++)this.slots.push({char:c==="A"?"A":"9",isStatic:!1,isPrefix:!1,segmentIndex:b,charIndexInSegment:k,tokenKind:c,placeholder:m[k]||"_"});this.segments.push({kind:c,start:v,end:v+d,length:d,placeholder:f,followingSeparator:""}),o+=f,h+=c.length}else this.slots.push({char:p,isStatic:!0,isPrefix:l,segmentIndex:-1,charIndexInSegment:-1,placeholder:p}),o+=p,h++}this.fullTemplate=o,this.editableCount=this.slots.filter(p=>!p.isStatic).length,this.prefixSlotsCount=0,this.prefixString="";for(let p of this.slots)if(p.isPrefix)this.prefixSlotsCount++,this.prefixString+=p.char;else break;for(let p=0;p<this.segments.length;p++){let u=this.segments[p],c="";for(let d=u.end;d<this.slots.length&&this.slots[d].isStatic;d++)c+=this.slots[d].char;u.followingSeparator=c}}extractRaw(t,e=!1){let i=String(t??"").slice(0,z);if(!i||this.slots.length===0)return"";let n="",s=0,r=0;if(this.prefixSlotsCount>0){for(;s<i.length&&(i[s]===" "||i[s]===" ");)s++;let a=0;for(;s<i.length&&a<this.prefixSlotsCount;){let o=this.slots[a].char,l=i[s];if(l.toUpperCase()===o.toUpperCase())s++,a++;else if(o===" "&&l!==" ")a++;else break}r=this.prefixSlotsCount}for(;s<i.length&&r<this.slots.length;){let a=this.slots[r],o=i[s];if(a.isStatic){o.toUpperCase()===a.char.toUpperCase()&&s++,r++;continue}if(a.tokenKind==="A"){let l=o.toUpperCase();a.charIndexInSegment===0?l==="A"||l==="P"?(n+=l,s++,r++,(s<i.length?i[s].toUpperCase():"")==="M"?(n+="M",s++,r++):e&&(n+="M",r++)):s++:l==="M"?(n+="M",s++,r++):e?(n+="M",r++):s++;continue}T(o)?(n+=o,s++,r++):s++}return n}format(t,e=!1){if(this.slots.length===0)return String(t??"").slice(0,z);let i=this.extractRaw(t,e);if(i.length===0)return this.prefixString;let n="",s=0;for(let r=0;r<this.slots.length;r++){let a=this.slots[r];if(a.isStatic){let o=s<i.length,l=s===0&&a.isPrefix,h=s>0&&s===i.length;if(o||l||h)n+=a.char;else break}else if(s<i.length)n+=i[s],s++;else break}return n}analyze(t,e=!1){let i=this.extractRaw(t,e),n=this.formatFromCleanRaw(i),s=this.editableCount,r=i.length,a=s>0&&r>=s,o=this.extractSegmentValues(i),l=o.parts,h=null,p=null,u=null,c=!1;if(a&&o.allSegmentsPresent){let d=this.resolveHour24(o);if(d!==null){let y={year:l.year,month:l.month,day:l.day,hour:d,minute:l.minute??0,second:l.second??0},f=this.buildStrictUTCDate(y);if(f){let m=f.getTime(),b=this.minTs===null||m>=this.minTs,v=this.maxTs===null||m<=this.maxTs;b&&v&&(h=f,u=m,p=this.formatDateToISO(f),c=!0)}}}return{formatted:n,rawValue:p||"",isoString:p,date:h,timestamp:u,parts:l,isComplete:a,isValid:c,totalSlots:s,filledSlots:r}}mapCursorPosition(t,e,i){let n=this.prefixSlotsCount,s=String(t??""),r=String(i??"");if(e<=0||!r)return n;let o=this.extractRaw(s.slice(0,e),!1).length;if(o===0)return Math.max(n,Math.min(this.getNextEditablePosition(0),r.length));let l=0,h=r.length;for(let p=0;p<r.length&&p<this.slots.length;p++)if(!this.slots[p].isStatic&&(l++,l===o)){h=p+1;break}for(;h<r.length&&this.slots[h]&&this.slots[h].isStatic;)h++;return Math.max(n,Math.min(h,r.length))}tryHandleSeparatorKey(t,e,i){let n={handled:!1,formatted:t,cursor:e};if(!i||i.length!==1)return n;if(e<this.slots.length&&this.slots[e].isStatic&&this.separatorMatchesKey(this.slots[e].char,i)){let o=this.getNextEditablePosition(e+1),l=this.format(t);return{handled:!0,formatted:l,cursor:Math.min(o,l.length)}}if(e>this.prefixSlotsCount&&e-1<this.slots.length&&this.slots[e-1].isStatic){let o=e-1;for(;o>=this.prefixSlotsCount&&this.slots[o].isStatic;){if(this.separatorMatchesKey(this.slots[o].char,i)){let l=this.getNextEditablePosition(o+1),h=this.format(t);return{handled:!0,formatted:h,cursor:Math.min(l,h.length)}}o--}}let s=-1;for(let o=0;o<this.segments.length;o++){let l=this.segments[o];if(e>=l.start&&e<=l.end){s=o;break}}if(s===-1)return n;let r=this.segments[s];if(!r.followingSeparator||!this.followingSeparatorMatchesKey(r.followingSeparator,i))return n;let a=t.slice(r.start,Math.min(e,r.end)).replace(/\D/g,"");if(r.kind!=="YYYY"&&r.kind!=="A"&&a.length>0&&a.length<r.length){let o="0".repeat(r.length-a.length)+a,l=t.slice(Math.min(t.length,r.end)),h=t.slice(0,r.start)+o+r.followingSeparator+l,p=this.format(h),u=this.getNextEditablePosition(r.end);return{handled:!0,formatted:p,cursor:Math.min(u,p.length)}}if(e===r.end){let o=this.format(t),l=this.getNextEditablePosition(r.end);return{handled:!0,formatted:o,cursor:Math.min(l,o.length)}}return n}formatFromValue(t){if(t==null)return this.prefixString;if(t instanceof Date)return Number.isNaN(t.getTime())?this.prefixString:this.formatPartsToTemplate(this.dateToUTCParts(t));if(typeof t=="number"){if(!Number.isFinite(t))return this.prefixString;let n=new Date(t);return Number.isNaN(n.getTime())?this.prefixString:this.formatPartsToTemplate(this.dateToUTCParts(n))}let e=String(t).slice(0,z).trim();if(!e)return this.prefixString;let i=this.parsePasted(e);return i.matched?i.formatted:i.rejected?this.prefixString:this.format(e,!0)}formatFromNativeValue(t){let e=String(t??"").slice(0,z);if(!e)return this.prefixString;let i=e.trim();if(i.length>=16){let n=this.parseISO8601Linear(i);if(n&&!n.dateOnly){let s=this.parsePasted(i);if(s.matched)return s.formatted}}return this.format(e,!1)}parsePasted(t){let e={matched:!1,formatted:"",cursor:0},i={matched:!1,rejected:!0,formatted:"",cursor:0},n=String(t??"").slice(0,z).trim();if(!n||this.segments.length===0)return e;let s=n.length>=10&&T(n[0])&&T(n[1])&&T(n[2])&&T(n[3])&&n[4]==="-"&&T(n[5])&&T(n[6])&&n[7]==="-"&&T(n[8])&&T(n[9]),r=this.parseISO8601Linear(n);if(r){if(r.dateOnly)return this.formatDateOnlyMatch({year:r.year,month:r.month,day:r.day},i);if(r.offsetMinutes!==null&&r.offsetMinutes!==0&&!this.convertPastedOffset)return i;let a=this.buildStrictUTCDate({year:r.year,month:r.month,day:r.day,hour:r.hour,minute:r.minute,second:r.second});if(!a)return i;let o=a,l;if(r.offsetMinutes!==null&&r.offsetMinutes!==0){let p=a.getTime()-r.offsetMinutes*6e4;if(o=new Date(p),Number.isNaN(o.getTime()))return i;l={original:n,offsetMinutes:r.offsetMinutes,utcIso:this.formatDateToISO(o)}}let h=this.formatPartsToTemplate(this.dateToUTCParts(o));return{matched:!0,formatted:h,cursor:h.length,offsetConverted:l}}return s&&n.length>10&&(n[10]==="T"||n[10]==="t"||this.segments[0]?.kind!=="YYYY")?i:this.parseConfiguredFormatLinear(n)}formatLocal(t,e,i){if(!t||Number.isNaN(t.getTime()))return null;try{let n=i||{dateStyle:"short",timeStyle:"medium"};return new Intl.DateTimeFormat(e,n).format(t)}catch{return null}}normalizeBoundary(t){if(t==null)return null;if(t instanceof Date){let s=t.getTime();return Number.isNaN(s)?null:s}if(typeof t=="number")return Number.isFinite(t)?t:null;let e=String(t).slice(0,z).trim();if(!e)return null;let i=this.parseISO8601Linear(e);if(i){let s=this.buildStrictUTCDate({year:i.year,month:i.month,day:i.day,hour:i.hour,minute:i.minute,second:i.second});if(!s)return null;let r=i.offsetMinutes?i.offsetMinutes*6e4:0;return s.getTime()-r}return this.analyze(e,!0).timestamp}separatorMatchesKey(t,e){return t===e||(t==="T"||t==="t")&&(e==="T"||e==="t"||e===" ")}followingSeparatorMatchesKey(t,e){let i=!1;for(let n=0;n<t.length;n++)if(t[n]!==" "){i=!0;break}for(let n=0;n<t.length;n++){let s=t[n];if(!(i&&s===" ")&&this.separatorMatchesKey(s,e))return!0}return!1}formatFromCleanRaw(t){if(this.slots.length===0)return"";if(t.length===0)return this.prefixString;let e="",i=0;for(let n=0;n<this.slots.length;n++){let s=this.slots[n];if(s.isStatic){let r=i<t.length,a=i===0&&s.isPrefix,o=i>0&&i===t.length;if(r||a||o)e+=s.char;else break}else if(i<t.length)e+=t[i],i++;else break}return e}extractSegmentValues(t){let e={},i,n,s=0,r=!0;for(let a of this.segments){if(s+a.length>t.length){r=!1;break}let o=t.slice(s,s+a.length);switch(s+=a.length,a.kind){case"YYYY":e.year=M(o);break;case"MM":e.month=M(o);break;case"DD":e.day=M(o);break;case"HH":e.hour=M(o);break;case"hh":i=M(o);break;case"mm":e.minute=M(o);break;case"ss":e.second=M(o);break;case"A":o==="AM"||o==="PM"?n=o:r=!1;break}}if((e.year===void 0||e.month===void 0||e.day===void 0)&&(r=!1),e.hour===void 0&&i===void 0&&(r=!1),r&&i!==void 0){let a=this.resolveHour24({parts:e,hour12:i,meridiem:n});a!==null&&(e.hour=a)}return{parts:e,hour12:i,meridiem:n,allSegmentsPresent:r}}resolveHour24(t){if(t.hour12!==void 0){let e=t.hour12;return e<1||e>12||!t.meridiem?null:t.meridiem==="AM"?e===12?0:e:e===12?12:e+12}return t.parts.hour!==void 0&&t.parts.hour>=0&&t.parts.hour<=23?t.parts.hour:null}buildStrictUTCDate(t){let{year:e,month:i,day:n,hour:s,minute:r,second:a}=t;if(!Number.isInteger(e)||e<1||e>9999||!Number.isInteger(i)||i<1||i>12||!Number.isInteger(n)||n<1||n>31||!Number.isInteger(s)||s<0||s>23||!Number.isInteger(r)||r<0||r>59||!Number.isInteger(a)||a<0||a>59)return null;let o=new Date(0);return o.setUTCFullYear(e,i-1,n),o.setUTCHours(s,r,a,0),o.getUTCFullYear()!==e||o.getUTCMonth()!==i-1||o.getUTCDate()!==n||o.getUTCHours()!==s||o.getUTCMinutes()!==r||o.getUTCSeconds()!==a?null:o}dateToUTCParts(t){return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds()}}formatDateToISO(t){let e=String(t.getUTCFullYear()).padStart(4,"0"),i=String(t.getUTCMonth()+1).padStart(2,"0"),n=String(t.getUTCDate()).padStart(2,"0"),s=String(t.getUTCHours()).padStart(2,"0"),r=String(t.getUTCMinutes()).padStart(2,"0"),a=String(t.getUTCSeconds()).padStart(2,"0");if(this.includeMilliseconds){let o=String(t.getUTCMilliseconds()).padStart(3,"0");return`${e}-${i}-${n}T${s}:${r}:${a}.${o}Z`}return`${e}-${i}-${n}T${s}:${r}:${a}Z`}formatPartsToTemplate(t){let e="";for(let i of this.segments)switch(i.kind){case"YYYY":e+=String(t.year).padStart(4,"0").slice(-4);break;case"MM":e+=String(t.month).padStart(2,"0");break;case"DD":e+=String(t.day).padStart(2,"0");break;case"HH":e+=String(t.hour).padStart(2,"0");break;case"hh":{let n=t.hour%12===0?12:t.hour%12;e+=String(n).padStart(2,"0");break}case"mm":e+=String(t.minute).padStart(2,"0");break;case"ss":e+=String(t.second).padStart(2,"0");break;case"A":e+=t.hour>=12?"PM":"AM";break}return this.formatFromCleanRaw(e)}formatDateOnlyMatch(t,e){if(!this.buildStrictUTCDate({year:t.year,month:t.month,day:t.day,hour:0,minute:0,second:0}))return e;if(typeof this.defaultTimeOnDateOnly=="string"&&this.defaultTimeOnDateOnly.trim()){let r=this.parseDefaultTime(this.defaultTimeOnDateOnly.trim());if(r){let a=this.formatPartsToTemplate({...t,hour:r.hour,minute:r.minute,second:r.second});return{matched:!0,formatted:a,cursor:a.length}}}let n="";for(let r of this.segments){if(nt.has(r.kind))break;r.kind==="YYYY"?n+=String(t.year).padStart(4,"0"):r.kind==="MM"?n+=String(t.month).padStart(2,"0"):r.kind==="DD"&&(n+=String(t.day).padStart(2,"0"))}if(!n)return e;let s=this.formatFromCleanRaw(n);return{matched:!0,formatted:s,cursor:s.length}}parseDefaultTime(t){let e=t.split(":");if(e.length<2||e.length>3)return null;let i=M(e[0]),n=M(e[1]),s=e.length===3?M(e[2]):0;return Number.isNaN(i)||i<0||i>23||Number.isNaN(n)||n<0||n>59||Number.isNaN(s)||s<0||s>59?null:{hour:i,minute:n,second:s}}parseISO8601Linear(t){if(t.length<10)return null;for(let h of[0,1,2,3,5,6,8,9])if(!T(t[h]))return null;if(t[4]!=="-"||t[7]!=="-")return null;let e=M(t.slice(0,4)),i=M(t.slice(5,7)),n=M(t.slice(8,10));if(t.length===10)return{year:e,month:i,day:n,hour:0,minute:0,second:0,dateOnly:!0,offsetMinutes:null};let s=10;if(t[s]!=="T"&&t[s]!=="t"&&t[s]!==" "||(s++,s+5>t.length)||!T(t[s])||!T(t[s+1])||t[s+2]!==":"||!T(t[s+3])||!T(t[s+4]))return null;let r=M(t.slice(s,s+2)),a=M(t.slice(s+3,s+5));s+=5;let o=0;if(s<t.length&&t[s]===":"){if(s++,s+2>t.length||!T(t[s])||!T(t[s+1]))return null;o=M(t.slice(s,s+2)),s+=2}if(s<t.length&&t[s]==="."){s++;let h=s;for(;s<t.length&&T(t[s]);)s++;if(s===h)return null}let l=null;if(s<t.length){for(;s<t.length&&t[s]===" ";)s++;if(s<t.length){let h=t[s];if(h==="Z"||h==="z")l=0,s++;else if(h==="+"||h==="-"){let p=h==="-"?-1:1;if(s++,s+2>t.length||!T(t[s])||!T(t[s+1]))return null;let u=M(t.slice(s,s+2));s+=2;let c=0;if(s<t.length){if(t[s]===":"&&s++,s+2>t.length||!T(t[s])||!T(t[s+1]))return null;c=M(t.slice(s,s+2)),s+=2}if(u>14||c>59||u===14&&c!==0)return null;l=p*(u*60+c)}else if(t.slice(s).toUpperCase()==="UTC")l=0,s=t.length;else return null}}return s!==t.length?null:{year:e,month:i,day:n,hour:r,minute:a,second:o,dateOnly:!1,offsetMinutes:l}}parseConfiguredFormatLinear(t){let e={matched:!1,formatted:"",cursor:0},i=t;i.toUpperCase().endsWith(" UTC")?i=i.slice(0,-4).trim():i.length>2&&(i.endsWith("Z")||i.endsWith("z"))&&T(i[i.length-2])&&(i=i.slice(0,-1).trim()),this.prefixString&&i.toLowerCase().startsWith(this.prefixString.trim().toLowerCase())&&(i=i.slice(this.prefixString.trim().length).trim());let n=[],s=-1;for(let c=0;c<i.length;c++){let d=i[c];yt.has(d)?s!==-1&&(n.push(i.slice(s,c)),s=-1):s===-1&&(s=c)}if(s!==-1&&n.push(i.slice(s)),n.length===0||n.length>this.segments.length)return e;let r=0;for(let c of this.segments){if(nt.has(c.kind))break;r++}let a=[],o,l,h;for(let c=0;c<n.length;c++){let d=n[c],y=this.segments[c];if(y.kind==="A"){let f=d.toUpperCase();if(f==="AM"||f==="A")a.push("AM");else if(f==="PM"||f==="P")a.push("PM");else return e;continue}for(let f=0;f<d.length;f++)if(!T(d[f]))return e;if(y.kind==="YYYY"){if(d.length!==4)return e;o=M(d),a.push(d)}else{if(d.length<1||d.length>2)return e;let f=d.length===1?"0"+d:d,m=M(f);y.kind==="MM"&&(l=m),y.kind==="DD"&&(h=m),a.push(f)}}if(n.length===r&&o!==void 0&&l!==void 0&&h!==void 0)return this.formatDateOnlyMatch({year:o,month:l,day:h},e);let p=this.segments.length;if(n.length<p&&!(r>0&&n.length>=r+2&&this.segments[r+1]?.kind==="mm"))return e;let u=this.formatFromCleanRaw(a.join(""));return{matched:!0,formatted:u,cursor:u.length}}};var kt=10,j=class extends E{engine;history;isComposing=!1;isUndoingRedoing=!1;isMouseDown=!1;isApplying=!1;isNotifying=!1;hasPendingNotification=!1;lastValue="";lastValueLength=0;lastInputType="";inferredInputModeValue=null;wasAutocorrectSet=!1;wasAutocapitalizeSet=!1;wasSpellcheckSet=!1;cutTimerId=null;pasteTimerId=null;resetTimerId=null;constructor(t,e,i){let n=O(t,e,i),s=n.wrapper,r=n.input,a=n.options,o=s?.getAttribute("data-mask-format")||r?.getAttribute("data-mask-format")||void 0,l=s?.getAttribute("data-mask-utc-indicator")??r?.getAttribute("data-mask-utc-indicator"),h=s?.getAttribute("data-mask-infer-inputmode")??r?.getAttribute("data-mask-infer-inputmode"),p=a.utcIndicator!==void 0?a.utcIndicator:l!==null?l==="false"||l==="none"?!1:l:" UTC",u={...a,format:a.format??o??"YYYY-MM-DD HH:mm",utcIndicator:p,includeMilliseconds:a.includeMilliseconds??!1,convertPastedOffset:a.convertPastedOffset??!0,defaultTimeOnDateOnly:a.defaultTimeOnDateOnly??!1,inferInputMode:a.inferInputMode??(h!==null?h!=="false":!0),onInput:a.onInput||a.oninput,onChange:a.onChange||a.onchange,onComplete:a.onComplete||a.oncomplete};super(s,r,u),this.history=new P,this.engine=new H(this.options),this.input.hasAttribute("autocorrect")||(this.input.setAttribute("autocorrect","off"),this.wasAutocorrectSet=!0),this.input.hasAttribute("autocapitalize")||(this.input.setAttribute("autocapitalize","none"),this.wasAutocapitalizeSet=!0),this.input.hasAttribute("spellcheck")||(this.input.setAttribute("spellcheck","false"),this.wasSpellcheckSet=!0),this.syncInferredInputMode(),this.bindEvents(),this.lastValue=this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value,this.syncInitialValue(),this.runAuditWarning(this.options.audit)}static format(t,e={}){return H.format(t,e)}getSpecificAuditWarnings(){let t=[],e=[],i=this.checkAriaIdReferences(this.input,"aria-describedby",e,!0),n=!!this.input.getAttribute("placeholder")?.trim(),s=!!this.input.getAttribute("aria-placeholder")?.trim();return!i&&!s&&!this.options.disabled&&(n?t.push(`Indication du format UTC fragile : placeholder seul dispara\xEEt \xE0 la saisie et l'indicateur UTC fant\xF4me est aria-hidden="true" ; d\xE9finissez aria-describedby ou aria-placeholder (WCAG 3.3.2).`):t.push("Indication du format UTC attendu manquante : d\xE9finissez aria-describedby ou aria-placeholder pour informer les technologies d'assistance du format et du r\xE9f\xE9rentiel UTC (WCAG 3.3.2).")),t}extractRawSnippet(t){return t?t===this.input.value&&this.isValid()?this.getRawValue():this.engine.extractRaw(t,!1):""}onPasswordModeDetected(){this.history.clear(),this.lastValue="",this.lastValueLength=0,this.lastTrackedValue="",this.clearGhost()}onNativeValueSet(t){if(this.options.disabled)this.checkValueChange(!1);else{let e=this.engine.formatFromNativeValue(t);this.applyFormatted(e,e.length,!1)}}onDisabledChange(t){if(t)this.wrapper.classList.remove("is-complete","has-selection"),this.clearGhost(),this.checkValueChange(!1);else{let e=this.engine.formatFromValue(this.input.value);this.applyFormatted(e,this.input.selectionStart??e.length,!1)}this.syncInferredInputMode()}handleAttributeMutation(t){if(super.handleAttributeMutation(t),t==="data-mask-format"){let e=this.getAttr("data-mask-format");e&&e!==this.engine.getFormat()&&this.setFormat(e)}else if(t==="data-mask-utc-indicator"){let e=this.getAttr("data-mask-utc-indicator"),i=e===null||e==="false"||e==="none"?!1:e;this.setUtcIndicator(i)}else t==="placeholder"&&this.updateGhost(this.input.value)}bindEvents(){this.onBeforeInput=this.onBeforeInput.bind(this),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.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{if(this.cutTimerId=null,!this.isDestroyed)if(this.options.disabled)this.checkValueChange(!1);else{let i=this.input.selectionStart??this.input.value.length;this.applyFormatted(this.input.value,i,!1)}},0)};let t=()=>{this.isDestroyed||this.checkValueChange(!0,!0)},{signal:e}=this.abortController;this.input.addEventListener("beforeinput",this.onBeforeInput,{signal:e}),this.input.addEventListener("input",this.handleInput,{signal:e}),this.input.addEventListener("keydown",this.onKeyDown,{signal:e}),this.input.addEventListener("paste",this.onPaste,{signal:e}),this.input.addEventListener("focus",this.onFocus,{signal:e}),this.input.addEventListener("blur",this.onBlur,{signal:e}),this.input.addEventListener("click",this.onClick,{signal:e}),this.input.addEventListener("keyup",this.onKeyUp,{signal:e}),this.input.addEventListener("select",this.onSelect,{signal:e}),this.input.addEventListener("mousedown",this.onMouseDown,{signal:e}),window.addEventListener("mouseup",this.onMouseUp,{signal:e}),this.input.addEventListener("compositionstart",this.onCompositionStart,{signal:e}),this.input.addEventListener("compositionend",this.onCompositionEnd,{signal:e}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:e}),this.input.addEventListener("cut",this.onCutHandler,{signal:e}),this.input.addEventListener("change",t,{signal:e}),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(!1):this.syncInitialValue())},0)},this.input.form.addEventListener("reset",this.onFormResetHandler,{signal:e}))}syncInferredInputMode(){if(this.options.inferInputMode===!1)return;if(this.options.disabled){this.inferredInputModeValue&&this.input.getAttribute("inputmode")===this.inferredInputModeValue&&this.input.removeAttribute("inputmode"),this.inferredInputModeValue=null;return}let t=this.engine.isNumericOnly()?"numeric":"text",e=this.input.getAttribute("inputmode");(!e||this.inferredInputModeValue===e)&&(this.input.inputMode=t,this.inferredInputModeValue=t)}getDetail(){let t=this.engine.analyze(this.input.value,!1);return{...t,value:this.options.disabled?this.input.value:t.formatted}}getRawValue(){return this.options.disabled?this.input.value:this.getDetail().rawValue}getISOString(){return this.getDetail().isoString}getDate(){return this.getDetail().date}getTimestamp(){return this.getDetail().timestamp}getParts(){return this.getDetail().parts}getTemporalInstant(){let t=this.getTimestamp();if(t===null)return null;let e=globalThis.Temporal;if(e?.Instant&&typeof e.Instant.fromEpochMilliseconds=="function")try{return e.Instant.fromEpochMilliseconds(t)}catch{return null}return null}isComplete(){return this.options.disabled?!0:this.getDetail().isComplete}isValid(){return this.options.disabled?!0:this.getDetail().isValid}setValue(t){if(this.options.disabled){let i=t instanceof Date?Number.isNaN(t.getTime())?"":this.engine.formatDateToISO(t):t!=null?String(t):"";this.setNativeValue(i),this.checkValueChange(!1);return}let e=this.engine.formatFromValue(t);this.applyFormatted(e,e.length,!0)}setNow(){this.setValue(new Date)}formatLocal(t,e){return this.engine.formatLocal(this.getDate(),t,e)}setFormat(t,e){let i=this.getDate();if(this.options.format=t,e!==void 0&&(this.options.placeholderTokens=e),this.engine.setFormat(t,e),this.syncInferredInputMode(),this.options.disabled){this.clearGhost();return}if(i){let n=this.engine.formatFromValue(i);this.applyFormatted(n,n.length,!0)}else{let n=this.engine.format(this.input.value,!1);this.applyFormatted(n,Math.min(this.input.selectionStart??n.length,n.length),!1)}}setUtcIndicator(t){this.options.utcIndicator=t,this.engine.setUtcIndicator(t),this.updateGhost(this.input.value)}undo(){if(this.options.disabled)return;let t=this.history.undo();if(t){this.isUndoingRedoing=!0;try{this.applyFormatted(this.engine.format(t.raw,!1),t.cursor,!0)}finally{this.isUndoingRedoing=!1}}}redo(){if(this.options.disabled)return;let t=this.history.redo();if(t){this.isUndoingRedoing=!0;try{this.applyFormatted(this.engine.format(t.raw,!1),t.cursor,!0)}finally{this.isUndoingRedoing=!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.inferredInputModeValue&&this.input.getAttribute("inputmode")===this.inferredInputModeValue&&this.input.removeAttribute("inputmode"),this.wasAutocorrectSet&&this.input.removeAttribute("autocorrect"),this.wasAutocapitalizeSet&&this.input.removeAttribute("autocapitalize"),this.wasSpellcheckSet&&this.input.removeAttribute("spellcheck"),this.history.clear(),this.lastValue="",this.lastValueLength=0,super.destroy())}checkSelection(){if(this.options.disabled)return;let t=this.input.selectionStart??0,e=this.input.selectionEnd??t;this.wrapper.classList.toggle("has-selection",t!==e)}onBeforeInput(t){if(this.lastInputType=t.inputType||"",!(this.options.disabled||this.isComposing)&&!(t.inputType==="insertFromPaste"||t.inputType==="insertReplacementText")&&t.inputType&&t.inputType.startsWith("insert")){let e=this.engine.getEditableCount();if(e>0){let i=this.engine.extractRaw(this.input.value,!1),n=this.input.selectionStart??0,s=this.input.selectionEnd??n,r=Math.max(0,e-i.length);if(s>n){let a=this.engine.extractRaw(this.input.value.slice(n,s),!1);r=Math.max(0,e-(i.length-a.length))}r<=0&&t.preventDefault()}}}handleInput(t){if(this.isDispatchingNativeInput||this.isComposing)return;if(this.options.disabled){this.checkValueChange(!1);return}let e=t?.inputType||this.lastInputType||"";this.lastInputType="";let i=this.input.value,n=this.input.selectionStart??i.length,s=this.history.getCurrent(),r=this.engine.getEditableCount(),a=e.startsWith("delete")||!this.isSensitiveField()&&i.length<this.lastValueLength,o=this.engine.extractRaw(i,!1);if(r>0&&s&&s.raw.length>=r&&o.length>r){let p=this.engine.format(s.raw,!1);this.applyFormatted(p,s.cursor,!0);return}let l=i,h=!a;if(a&&this.engine.hasMeridiem()){for(let p of this.engine.getSegments())if(p.kind==="A"&&i.length>=p.start+1&&i.length<p.end){l=i.slice(0,p.start)+i.slice(p.start+1),h=!1;break}}this.applyFormatted(l,n,!1,h),this.checkSelection()}onKeyDown(t){if(this.options.disabled||F(t))return;let e=this.input.selectionStart??0,i=this.input.selectionEnd??e,n=this.engine.getPrefixLength();if((t.ctrlKey||t.metaKey)&&(t.key==="z"||t.key==="Z")&&!t.shiftKey){t.preventDefault(),this.undo();return}if((t.ctrlKey||t.metaKey)&&(t.key==="y"||t.key==="Y")||(t.ctrlKey||t.metaKey)&&t.shiftKey&&(t.key==="z"||t.key==="Z")){t.preventDefault(),this.redo();return}this.history.updateCurrentCursor(e);let s=t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey,r=i>e;if(s&&!r){let a=this.engine.tryHandleSeparatorKey(this.input.value,e,t.key);if(a.handled){t.preventDefault(),this.applyFormatted(a.formatted,a.cursor,!0);return}if(this.engine.hasMeridiem()){for(let l of this.engine.getSegments())if(l.kind==="A"&&e>=l.start&&e<=l.end){let h=t.key.toUpperCase();if(h==="A"||h==="P"){t.preventDefault();let p=h==="A"?"AM":"PM",u=this.input.value,c=u.slice(0,l.start)+p+u.slice(Math.min(u.length,l.end));this.applyFormatted(c,l.end,!0);return}}}let o=this.engine.getEditableCount();if(o>0&&this.engine.extractRaw(this.input.value,!1).length>=o){t.preventDefault();return}}if(r){if(t.key==="Backspace"||t.key==="Delete"){t.preventDefault();let a=this.input.value,o=a.slice(0,e)+a.slice(i);this.applyFormatted(o,Math.max(n,e),!1);return}return}if(t.key==="ArrowLeft"&&!t.shiftKey&&e<=n){t.preventDefault(),this.input.setSelectionRange(n,n);return}if(t.key==="Home"&&n>0&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&!t.altKey){t.preventDefault(),this.input.setSelectionRange(n,n);return}if(t.key==="Backspace"&&e<=n){t.preventDefault(),this.input.setSelectionRange(n,n);return}if(t.key==="Delete"&&e<n){t.preventDefault(),this.input.setSelectionRange(n,n);return}if(t.key==="Backspace"&&this.engine.hasMeridiem()){for(let a of this.engine.getSegments())if(a.kind==="A"&&e>a.start&&e<=a.end){t.preventDefault();let o=this.input.value,l=o.slice(0,a.start)+o.slice(Math.min(o.length,a.end));this.applyFormatted(l,a.start,!0);return}}if(t.key==="Backspace"&&(t.ctrlKey||t.altKey||t.metaKey)){if(t.preventDefault(),e<=n){this.input.setSelectionRange(n,n);return}let a=e-1;for(;a>=n&&this.engine.isSeparatorAt(a);)a--;for(;a>=n&&!this.engine.isSeparatorAt(a);)a--;let o=Math.max(n,a+1),l=this.input.value;this.applyFormatted(l.slice(0,o)+l.slice(e),o,!0);return}if(t.key==="Delete"&&(t.ctrlKey||t.altKey||t.metaKey)){t.preventDefault();let a=this.input.value;if(e>=a.length)return;let o=e;for(;o<a.length&&this.engine.isSeparatorAt(o);)o++;for(;o<a.length&&!this.engine.isSeparatorAt(o);)o++;for(;o<a.length&&this.engine.isSeparatorAt(o);)o++;this.applyFormatted(a.slice(0,e)+a.slice(o),e,!0);return}if(t.key==="Backspace"&&e>n&&this.engine.isSeparatorAt(e-1)){t.preventDefault();let a=e-1;for(;a>n&&this.engine.isSeparatorAt(a-1);)a--;if(a>n){let o=this.input.value;this.applyFormatted(o.slice(0,a-1)+o.slice(e),a-1,!1)}else this.applyFormatted("",n,!0);return}if(t.key==="Delete"&&e<this.input.value.length&&this.engine.isSeparatorAt(e)){t.preventDefault();let a=e;for(;a<this.input.value.length&&this.engine.isSeparatorAt(a);)a++;if(a<this.input.value.length){let o=this.input.value;this.applyFormatted(o.slice(0,a)+o.slice(a+1),e,!0)}}}onPaste(t){if(this.options.disabled){this.pasteTimerId!==null&&clearTimeout(this.pasteTimerId),this.pasteTimerId=window.setTimeout(()=>{this.pasteTimerId=null,this.isDestroyed||this.checkValueChange(!1)},0);return}t.preventDefault(),this.history.updateCurrentCursor(this.input.selectionStart??0);let e=this.preparePastedText(this.getClipboardPlainText(t),512);if(!e)return;let i=this.engine.getPrefixLength(),n=this.input.selectionStart??0,s=this.input.selectionEnd??n,r=this.input.value,a=this.engine.getEditableCount(),o=this.engine.extractRaw(r,!1);if(o.length===0||n<=i&&s>=r.length||n===s){let d=this.engine.parsePasted(e);if(d.matched){if(this.applyFormatted(d.formatted,d.cursor,!0),d.offsetConverted&&this.options.onOffsetConverted)try{this.options.onOffsetConverted(d.offsetConverted)}catch{}this.checkSelection();return}if(d.rejected)return}let h=Math.max(0,a-o.length);if(s>n){let d=this.engine.extractRaw(r.slice(n,s),!1);h=Math.max(0,a-(o.length-d.length))}if(h<=0)return;let p=Math.max(i,n),u=Math.max(i,s),c=r.slice(0,p)+e+r.slice(u);this.applyFormatted(c,p+e.length,!1,!0),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(){if(this.wrapper.classList.remove("is-focused","has-selection"),this.isSensitiveField()){this.onPasswordModeDetected();return}this.updateGhost(this.input.value),this.checkValueChange(!1,!0)}onClick(){this.options.disabled||this.enforceMinCursor(),this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onKeyUp(t){this.options.disabled||((t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="Home")&&!t.shiftKey&&this.enforceMinCursor(),this.history.updateCurrentCursor(this.input.selectionStart??0)),this.checkSelection()}onSelect(){this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onMouseDown(){this.isMouseDown=!0}onMouseUp(){this.isMouseDown=!1,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.applyFormatted(this.input.value,t,!1,!0),this.checkSelection()}enforceMinCursor(){let t=this.engine.getPrefixLength();if(t<=0)return;let e=this.input.selectionStart??0,i=this.input.selectionEnd??e;e===i&&e<t&&this.input.setSelectionRange(t,t)}updateGhost(t){if(!this.ghost)return;if(this.options.disabled||this.isSensitiveField()){this.clearGhost();return}let e=!t||t===this.engine.getPrefix();if(this.shouldHideGhostForPlaceholder(e)){this.clearGhost();return}let i=this.engine.getGhostRemaining(t),n=this.input.ownerDocument||document,s=n.createElement("span");s.className="mask-ghost-typed",s.textContent=t;let r=n.createElement("span");r.className="mask-ghost-remaining",r.textContent=i,this.setGhostContent(s,r),this.ghost.scrollLeft=this.input.scrollLeft}applyFormatted(t,e,i=!1,n=!1){if(!(this.options.disabled||this.isApplying)){this.isApplying=!0;try{let s=this.engine.format(t,n),r=this.isSensitiveField();this.setNativeValue(s),r?this.clearGhost():this.updateGhost(s);let a=this.engine.getPrefixLength(),o;i||this.isUndoingRedoing?o=Math.max(a,Math.min(e,s.length)):o=Math.max(a,this.engine.mapCursorPosition(t,e,s)),this.input.setSelectionRange(o,o);let l=this.engine.analyze(s,!1);this.wrapper.classList.toggle("is-complete",l.isComplete),r?(this.options.copyRaw=!1,this.lastValueLength=0,this.history.clear()):(this.lastValueLength=s.length,this.isUndoingRedoing||this.history.push(this.engine.extractRaw(s,!1),o))}finally{this.isApplying=!1}this.checkValueChange(!1)}}syncInitialValue(){let t=this.isSensitiveField();if(this.options.disabled){this.clearGhost(),this.lastValue=t?this.computePasswordDigest(this.input.value):this.input.value,this.lastValueLength=t?0:this.input.value.length,this.checkValueChange(!1);return}this.syncGhostStyles();let e=this.input.value||"";if(e){let i=this.engine.formatFromValue(e);this.applyFormatted(i,i.length,!0)}else{let i=this.engine.getPrefixLength();i>0?this.applyFormatted("",i,!0):(t?this.clearGhost():(this.history.push("",0),this.updateGhost("")),this.checkValueChange(!1))}}checkValueChange(t=!1,e=!1){let i=this.isSensitiveField(),n=this.input.value;if((i?this.computePasswordDigest(n):n)===this.lastValue&&!t&&!this.hasPendingNotification){if(e){let r=!i,a=this.getDetail(),o=this.options.onChange||this.options.onchange;o&&o(a),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:r,detail:a}))}return}if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let r=0;for(;((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)!==this.lastValue||this.hasPendingNotification||t)&&r<kt;){r++,this.hasPendingNotification=!1,t=!1;let a=this.isSensitiveField(),o=!a,l=this.input.value;this.lastValue=a?this.computePasswordDigest(l):l,this.lastValueLength=a?0:l.length;let h=this.getDetail(),p=this.options.onInput||this.options.oninput;if(p&&p(h),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:o,detail:h})),this.dispatchNativeInput(),e){let u=this.options.onChange||this.options.onchange;u&&u(h),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:o,detail:h}))}if(h.isComplete){let u=this.options.onComplete||this.options.oncomplete;u&&u(h),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:o,detail:h}))}}}finally{this.isNotifying=!1}}};var at={BaseInputMask:E,InputMask:G,MaskEngine:N,MaskHistory:P,MaskKeyboard:U,AmountEngine:V,InputAmountMask:W,EmailEngine:B,InputEmailMask:$,DateUTCEngine:H,DATE_UTC_PRESETS:_,InputDateUTCMask:j,sanitizePastedText:R,stripBidiAndInvisibles:Y},rt=it();rt&&(rt.Mask=at);var Tt=G;return pt(wt);})();
4
+ (${this.getAuditDisableHint()})`),e}checkAriaIdReferences(t,e,i,n=!1){let s=t.getAttribute(e)?.trim();if(!s)return!1;let r=t.ownerDocument||document,a=typeof t.getRootNode=="function"?t.getRootNode():r,o=s.split(/\s+/).filter(Boolean),l=o.map(p=>typeof ShadowRoot<"u"&&a instanceof ShadowRoot?a.getElementById(p):r.getElementById(p));return o.length>0&&l.every(p=>!!p)?n&&!l.some(u=>u?(u.textContent?.trim()||u.getAttribute("aria-label")?.trim()||"").length>0:!1)?(i.push(`Attribut ${e}="${s}" invalide : l'\xE9l\xE9ment cible ne contient aucun texte accessible.`),!1):!0:(i.push(`Attribut ${e}="${s}" invalide : l'\xE9l\xE9ment cible est introuvable dans le DOM.`),!1)}};var et=4096;function R(g,t=et){return U(g,t).replace(/[\u00A0\u202F\u2007]/g," ").replace(/[\u2013\u2014\u2212]/g,"-").trim()}var X=new Set(["left","right","center"]);function O(g,t,e){return t&&typeof t=="object"&&"tagName"in t&&t.tagName==="INPUT"?{wrapper:g||null,input:t,options:e||{}}:{wrapper:null,input:g,options:t&&typeof t=="object"&&!("tagName"in t)?t:{}}}var E=class extends Z{wrapper;input;options;ghost=null;isWrapperCreated=!1;wasWrapperFallbackStyled=!1;wasAlignSet=!1;hadInitialDataAlign=!1;isDestroyed=!1;isFocused=!1;isDispatchingNativeInput=!1;lastTrackedValue="";nativeValueDescriptor=null;onCutHandler=()=>{};onFormResetHandler;mutationObserver=null;resizeObserver=null;focusSelectTimerId=null;abortController=new AbortController;constructor(t,e,i){super();let{wrapper:n,input:s,options:r}=O(t,e,i);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",o=!!(r.createWrapper??a),l=n;if(!l&&o){let D=this.input.ownerDocument||document,C=D.createElement("span");C.className="wulf-mask-wrapper wulf-mask-wrapper--auto",this.input.parentNode&&this.input.parentNode.insertBefore(C,this.input),tt(C,this.input,null);let it=D.defaultView||(typeof window<"u"?window:null);(!C.isConnected||!it||it.getComputedStyle(C).display!=="inline-grid")&&(C.style.display="inline-grid",C.style.gridTemplateColumns="1fr",C.style.gridTemplateRows="1fr",C.style.verticalAlign="middle",C.style.boxSizing="border-box",C.style.position="relative",this.input.style.gridArea="1 / 1 / 2 / 2",this.input.style.boxSizing="border-box",this.wasWrapperFallbackStyled=!0),l=C,this.isWrapperCreated=!0}if(!l)throw new Error(`[${new.target.name||"InputMask"}] wrapper (HTMLElement) et input (HTMLInputElement) sont requis, ou activez l'option createWrapper: true.`);this.wrapper=l,this.normalizeInputType();let h=this.getAttr("data-mask-focus-only")==="true",p=this.hasAttr("data-disabled"),u=this.getAttr("data-mask-select-on-focus")==="true",c=this.getAttr("data-mask-copy-raw")==="true",d=this.getAttr("data-mask-sensitive")==="true",y=this.getAttr("data-mask-align")||this.getAttr("data-align"),f=y&&X.has(y)?y:null;this.hadInitialDataAlign=this.wrapper.hasAttribute("data-align");let m=this.getAttr("data-mask-audit"),{disabled:b,align:v,sensitive:k,...w}=r,S=v&&X.has(v)?v:void 0,I=b!==void 0?b:!!p,A=r.audit??(m!==null?m!=="false":!0),x=!!(k??d),L=this.isPasswordInput()||x;this.options={...w,createWrapper:o,showMaskOnFocus:r.showMaskOnFocus??h??!1,selectAllOnFocus:r.selectAllOnFocus??u??!1,copyRaw:L?!1:r.copyRaw??c??!1,sensitive:x,disabled:I,align:S??(f||void 0),emitNativeInput:r.emitNativeInput??!0,audit:A},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(){let{signal:t}=this.abortController;this.input.addEventListener("copy",this.onBaseCopy,{signal:t}),this.input.addEventListener("focus",this.onBaseFocus,{signal:t}),this.input.addEventListener("blur",this.onBaseBlur,{signal:t})}onBaseCopy=t=>{if(!this.options.copyRaw||this.options.disabled||this.isSensitiveField())return;let e=this.input.selectionStart??0,i=this.input.selectionEnd??e,n="";e!==i?n=this.extractRawSnippet(this.input.value.slice(e,i)):n=this.getRawValue(),n&&t.clipboardData&&(t.preventDefault(),t.clipboardData.setData("text/plain",n))};extractRawSnippet(t){return t}getClipboardPlainText(t){return t.clipboardData&&(t.clipboardData.getData("text")||t.clipboardData.getData("text/plain"))||""}preparePastedText(t,e=et){let i=R(t,e);if(typeof this.options.transformPaste!="function")return i;try{let n=this.options.transformPaste(i);if(typeof n=="string")return R(n,e)}catch{}return i}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&&Y(this.input.ownerDocument)===this.input&&this.input.select()},0))};onBaseBlur=()=>{this.isFocused=!1,this.isSensitiveField()&&(this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask"))};initMutationObserver(){if(typeof MutationObserver>"u")return;this.mutationObserver=new MutationObserver(e=>{for(let i of e)i.type==="attributes"&&i.attributeName&&this.handleAttributeMutation(i.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-sensitive","data-mask-pad-decimals","data-mask-auto-lowercase","data-mask-cycle-suggestions","data-mask-default-tld","data-mask-tlds","data-mask-format","data-mask-utc-indicator","data-disabled","data-mask-align","data-align","placeholder","type"]};this.mutationObserver.observe(this.wrapper,t),this.input!==this.wrapper&&this.mutationObserver.observe(this.input,t)}isPasswordInput(){return(this.input.type||"").toLowerCase()==="password"}isSensitiveField(){return this.isPasswordInput()||!!this.options.sensitive}computePasswordDigest(t){let e=2166136261;for(let i=0;i<t.length;i++)e^=t.charCodeAt(i),e=Math.imul(e,16777619);return`__pwd:${(e>>>0).toString(36)}:${t.length}`}setAlign(t){let e=t&&X.has(t)?t:null,i=e||void 0,n=this.wrapper.getAttribute("data-align"),s=e?this.wrapper.classList.contains(`align-${e}`):!this.wrapper.classList.contains("align-left")&&!this.wrapper.classList.contains("align-right")&&!this.wrapper.classList.contains("align-center");this.options.align===i&&n===e&&s||(this.options.align=i,this.wrapper.classList.remove("align-left","align-right","align-center"),e?(this.wrapper.classList.add(`align-${e}`),this.wasAlignSet=!0,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(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.isSensitiveField()?!1:this.getAttr("data-mask-copy-raw")==="true";else if(t==="data-mask-sensitive"){let e=this.getAttr("data-mask-sensitive")==="true";this.options.sensitive=e,this.isSensitiveField()&&(this.options.copyRaw=!1,this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask"),this.onPasswordModeDetected())}else if(t==="type")this.isSensitiveField()&&(this.options.copyRaw=!1,this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask"),this.onPasswordModeDetected());else if(t==="data-mask-align"||t==="data-align"){let e=this.getAttr("data-mask-align")||this.getAttr("data-align"),i=e&&X.has(e)?e:null;i!==(this.options.align??null)&&this.setAlign(i)}}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();let e=this.input.ownerDocument||document;this.ghost=e.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");let i=e.defaultView||(typeof window<"u"?window:null);(!this.wrapper.isConnected||!i||i.getComputedStyle(this.ghost).pointerEvents!=="none")&&(this.ghost.style.gridArea="1 / 1 / 2 / 2",this.ghost.style.pointerEvents="none"),this.syncGhostStyles(),typeof ResizeObserver<"u"&&(this.resizeObserver?.disconnect(),this.resizeObserver=new ResizeObserver(()=>{this.isDestroyed||this.syncGhostStyles()}),this.resizeObserver.observe(this.input));let n=e;n.fonts?.ready&&typeof n.fonts.ready.then=="function"&&n.fonts.ready.then(()=>{this.isDestroyed||this.syncGhostStyles()}).catch(()=>{})}setGhostContent(...t){if(this.ghost){if(typeof this.ghost.replaceChildren=="function")this.ghost.replaceChildren(...t);else{this.ghost.textContent="";for(let e of t)this.ghost.appendChild(typeof e=="string"?document.createTextNode(e):e)}this.wrapper.classList.toggle("has-visible-ghost",t.length>0)}}clearGhost(){this.setGhostContent()}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.wordSpacing=t.wordSpacing,this.ghost.style.textIndent=t.textIndent,this.ghost.style.fontKerning=t.fontKerning,this.ghost.style.fontVariantNumeric=t.fontVariantNumeric,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",i=t.textAlign;i==="right"?this.ghost.style.justifyContent="right":i==="left"?this.ghost.style.justifyContent="left":i==="center"?this.ghost.style.justifyContent="center":i==="end"?this.ghost.style.justifyContent=e?"left":"right":this.ghost.style.justifyContent=e?"right":"left"}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.isSensitiveField(),e=this.input._valueTracker;!t&&e&&typeof e.setValue=="function"&&e.setValue(this.lastTrackedValue),this.lastTrackedValue=t?"":this.input.value,this.input.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))}finally{this.isDispatchingNativeInput=!1}}}onScroll=()=>{this.ghost&&(this.ghost.scrollLeft=this.input.scrollLeft)};hookValueProperty(){try{let t=HTMLInputElement.prototype,e=Object.getOwnPropertyDescriptor(t,"value");if(!e||!e.set||!e.get)return;this.nativeValueDescriptor=e;let i=this;Object.defineProperty(this.input,"value",{get(){return e.get.call(this)},set(n){let s=String(n??"");e.set.call(this,s),!i.isDestroyed&&i.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}hasAccessibleLabelText(t){if(!t)return!1;if(t.getAttribute("aria-label")?.trim())return!0;let i=n=>{if(n.nodeType===3)return n.textContent||"";if(n.nodeType===1){let s=n,r=s.tagName;if(r==="INPUT"||r==="SELECT"||r==="TEXTAREA"||r==="BUTTON"||s.getAttribute("aria-hidden")==="true")return"";let a="";for(let o=0;o<s.childNodes.length;o++)a+=i(s.childNodes[o]);return a}return""};return i(t).trim().length>0}audit(){let t=[],e=this.input.ownerDocument||document,i=typeof this.input.getRootNode=="function"?this.input.getRootNode():e,n=typeof ShadowRoot<"u"&&i instanceof ShadowRoot?i:e,s=this.input.getAttribute("aria-label")?.trim(),r=this.checkAriaIdReferences(this.input,"aria-labelledby",t,!0),a=this.input.closest("label"),o=this.hasAccessibleLabelText(a),l=!!(this.input.labels&&Array.from(this.input.labels).some(c=>this.hasAccessibleLabelText(c))),h=!1;if(this.input.id)try{let c=n.querySelector(`label[for="${q(this.input.id)}"]`);h=this.hasAccessibleLabelText(c)}catch{h=!1}!s&&!r&&!o&&!l&&!h&&t.push(`\xC9tiquetage accessible manquant : associez un <label for="id"> non vide (ou d\xE9finissez aria-label / aria-labelledby) sur l'input (WCAG 4.1.2).`),this.checkAriaIdReferences(this.input,"aria-describedby",t,!0),this.input.hasAttribute("aria-errormessage")&&this.checkAriaIdReferences(this.input,"aria-errormessage",t,!0);let p=this.input.getAttribute("tabindex");if(p!==null){let c=Number.parseInt(p,10);Number.isFinite(c)&&c>0&&t.push(`Attribut tabindex="${p}" positif d\xE9tect\xE9 : \xE9vitez les tabindex > 0 qui perturbent l'ordre de tabulation naturel (WCAG 2.4.3).`)}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[]}onPasswordModeDetected(){}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.focusSelectTimerId!==null&&(clearTimeout(this.focusSelectTimerId),this.focusSelectTimerId=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.abortController.abort(),this.lastTrackedValue="",this.unhookValueProperty(),this.ghost&&(this.ghost.remove(),this.ghost=null),this.isWrapperCreated&&this.wrapper?(this.wasWrapperFallbackStyled&&(this.input.style.gridArea="",this.input.style.boxSizing=""),this.wrapper.parentElement?tt(this.wrapper.parentElement,this.input,this.wrapper):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.wasAlignSet&&!this.hadInitialDataAlign&&this.wrapper.removeAttribute("data-align"),this.wasAlignSet&&this.wrapper.classList.remove("align-left","align-right","align-center"),this.wrapper.classList.remove("is-complete","is-focused","mask-focus-only","has-selection","has-ghost","has-visible-ghost")))}};var nt=new Set(["/","-",".",":"]),ft={9:{pattern:/[0-9]/},a:{pattern:/[a-zA-Z]/},A:{pattern:/[a-zA-Z]/,transform:g=>g.toUpperCase()},"*":{pattern:/[a-zA-Z0-9]/},"#":{pattern:/[a-zA-Z0-9]/,transform:g=>g.toUpperCase()}},N=class g{pattern;patterns=[];patternResolver=null;lastResolvedKey="";subEngines=[];activeEngine=null;placeholderChar;tokens;slots=[];fullMaskTemplate="";prefixSlotsCount=0;prefixString="";strict=!0;autoLowercase=!1;constructor(t,e={}){let i=e||{},n=String(i.placeholderChar||"_");this.placeholderChar=Array.from(n)[0]||"_";let s=Object.create(null);for(let[r,a]of Object.entries(ft))s[r]=a;if(i.tokens&&typeof i.tokens=="object")for(let[r,a]of Object.entries(i.tokens))r!=="__proto__"&&r!=="constructor"&&r!=="prototype"&&a&&(s[r]=a);this.tokens=s,this.strict=i.strict!==!1,this.autoLowercase=i.autoLowercase??!1,this.pattern="",this.compile(t)}static format(t,e,i={}){return!e||Array.isArray(e)&&e.length===0?t??"":new g(e,i||{}).format(t??"")}isDynamicPattern(){return this.patternResolver!==null}resolveForValue(t){if(!this.patternResolver)return!1;let e;try{e=this.patternResolver(String(t??"").slice(0,4096))}catch{return!1}let i,n;if(Array.isArray(e))i=e.slice(0,32).map(s=>String(s??"").slice(0,512)),n="A:"+i.join("\0");else if(typeof e=="string")i=e.slice(0,512),n="S:"+i;else return!1;return n===this.lastResolvedKey?!1:(this.lastResolvedKey=n,this.compileStatic(i),!0)}compile(t){return typeof t=="function"?(this.patternResolver=t,this.lastResolvedKey="",this.resolveForValue(""),this.slots):t!==void 0?(this.patternResolver=null,this.lastResolvedKey="",this.compileStatic(t)):this.patternResolver?(this.lastResolvedKey="",this.resolveForValue(""),this.slots):this.compileStatic(this.patterns.length>0?this.patterns:this.pattern)}compileStatic(t){if(Array.isArray(t)?(this.patterns=t.slice(0,32).map(n=>String(n??"").slice(0,512)),this.pattern=this.patterns[0]||""):(this.patterns=[],this.pattern=String(t??"").slice(0,512)),this.patterns.length>0)return this.subEngines=this.patterns.map(n=>new g(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 e="",i=!0;for(let n=0;n<this.pattern.length;n++){let s=this.pattern[n],r=!1;s==="\\"&&n+1<this.pattern.length&&(r=!0,n++,s=this.pattern[n]);let a=!r&&Object.hasOwn(this.tokens,s)?this.tokens[s]:void 0;if(a){i=!1;let o=a.placeholder?Array.from(String(a.placeholder))[0]||this.placeholderChar:this.placeholderChar;this.slots.push({char:s,isStatic:!1,isPrefix:!1,token:a,placeholder:o}),e+=o}else this.slots.push({char:s,isStatic:!0,isPrefix:i,placeholder:s}),e+=s}this.fullMaskTemplate=e,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(t){if(this.subEngines.length<=1)return this;let e=String(t??""),i=this.subEngines.filter(o=>{let l=o.getPrefix();return l.length>0&&e.toLowerCase().startsWith(l.trim().toLowerCase())}),n=i.length>0?i:this.subEngines,s=n.toSorted((o,l)=>l.getEditableCount()-o.getEditableCount())[0],a=(s?s.extractRaw(e):e).length;for(let o of n)if(o.getEditableCount()>=a)return this.activeEngine=o,o;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}getActiveEditableCount(){return this.subEngines.length>0?(this.activeEngine??this.subEngines[0]).getActiveEditableCount():this.activeEngine?this.activeEngine.getActiveEditableCount():this.slots.filter(t=>!t.isStatic).length}getMaxEditableCount(){return this.subEngines.length>0?Math.max(...this.subEngines.map(t=>t.getMaxEditableCount())):this.getActiveEditableCount()}getEditableCount(){return this.getMaxEditableCount()}isNumericOnly(){if(this.subEngines.length>0)return this.subEngines.every(i=>i.isNumericOnly());let e=(this.activeEngine?this.activeEngine.slots:this.slots).filter(i=>!i.isStatic);return e.length===0?!1:e.every(i=>i.char==="9"||i.token&&i.token.pattern.test("0")&&!i.token.pattern.test("a")&&!i.token.pattern.test("Z"))}setStrict(t){this.strict=t;for(let e of this.subEngines)e.setStrict(t)}setAutoLowercase(t){this.autoLowercase=t;for(let e of this.subEngines)e.setAutoLowercase(t)}isStrict(){return this.strict}normalizePastedValue(t){let e=String(t??"");if(!e)return e;if(this.resolveForValue(e),this.subEngines.length>0){let i=e.toLowerCase(),n=this.subEngines.filter(a=>{let o=a.getPrefix();return o.length>0&&i.startsWith(o.trim().toLowerCase())}),s=n.length>0?n:this.subEngines,r=null;for(let a of s){let o=a.tryNormalizeSegments(e);if(o.matched){if(o.exactSegmentCount)return o.normalized;r===null&&(r=o.normalized)}}return r!==null?r:e}return this.tryNormalizeSegments(e).normalized}tryNormalizeSegments(t){let e={matched:!1,normalized:t,exactSegmentCount:!1};if(!this.strict||this.slots.length===0||!t)return e;let i=t;if(this.prefixSlotsCount>0){let b=0;for(;b<t.length&&(t[b]===" "||t[b]===" ");)b++;let v=0;for(;b<t.length&&v<this.prefixSlotsCount;){let k=this.slots[v].char,w=t[b];if(w.toUpperCase()===k.toUpperCase())b++,v++;else if(k===" "&&w!==" ")v++;else break}v===this.prefixSlotsCount&&(i=t.slice(b))}if(!i)return e;let n=[],s=[],r=[],a="",o=!1;for(let b=this.prefixSlotsCount;b<this.slots.length;b++){let v=this.slots[b];v.isStatic?r.length>0?(n.push(r),r=[],a=v.char):a+=v.char:(a.length>0&&(s.push(a),a=""),r.push(v))}if(r.length>0?n.push(r):a.length>0&&(o=!0),o||n.length<2||s.length!==n.length-1)return e;let l=[];for(let b of s){let v=b.trim();if(v.length!==1||!nt.has(v))return e;l.push(v)}let h=[],p=[],u=0;for(let b=0;b<i.length;b++){let v=i[b];nt.has(v)&&(h.push(i.slice(u,b).trim()),p.push(v),u=b+1)}if(h.push(i.slice(u).trim()),p.length===0||p.length>l.length||h.length!==p.length+1||h.length>n.length||h.some(b=>b.length===0))return e;let c=p.every((b,v)=>b===l[v]),d=p.every(b=>b===p[0]);if(!c&&!d)return e;let y=h.length===n.length,f=[];for(let b=0;b<h.length;b++){let v=h[b],k=n[b];if(v.length>k.length)return e;if(k.every(S=>!!(S.token&&S.token.pattern.test("0")&&!S.token.pattern.test("a")&&!S.token.pattern.test("Z")))){let S=b<h.length-1,I=b===h.length-1&&y&&n.length<=3&&k.length===2,A=v.length<k.length&&(S||I),x=A?k.length-v.length:0;for(let L=0;L<v.length;L++){let D=v[L];if(D<"0"||D>"9"||!k[x+L].token.pattern.test(D))return e}f.push(A?"0".repeat(k.length-v.length)+v:v)}else{if(v.length!==k.length)return e;for(let S=0;S<v.length;S++)if(!k[S].token||!k[S].token.pattern.test(v[S]))return e;f.push(v)}}let m=this.prefixSlotsCount>0?this.prefixString:"";for(let b=0;b<f.length;b++)b>0&&(m+=s[b-1]),m+=f[b];return{matched:!0,normalized:m,exactSegmentCount:y}}extractRawForCurrentPattern(t){return this.extractRawInternal(t)}extractRaw(t){return this.resolveForValue(t),this.extractRawInternal(t)}extractRawInternal(t){if(this.subEngines.length>0){let a=this.selectEngine(t);if(a!==this)return a.extractRawInternal(t)}let e=Math.max(4096,this.slots.length*4),i=String(t??"").slice(0,e);if(!i)return"";let n="",s=0,r=0;if(this.prefixSlotsCount>0){for(;s<i.length&&(i[s]===" "||i[s]===" ");)s++;let a=0;for(;s<i.length&&a<this.prefixSlotsCount;){let o=this.slots[a].char,l=i[s];if(l.toUpperCase()===o.toUpperCase())s++,a++;else if(o===" "&&l!==" ")a++;else break}r=this.prefixSlotsCount}for(;s<i.length&&r<this.slots.length;){let a=this.slots[r],o=i[s];if(a.isStatic)o.toUpperCase()===a.char.toUpperCase()&&s++,r++;else if(a.token&&a.token.pattern.test(o)){let l=a.token.transform?a.token.transform(o):o;this.autoLowercase&&!a.token.transform&&(l=l.toLowerCase()),n+=l,s++,r++}else this.strict?s++:(n+=this.autoLowercase?o.toLowerCase():o,s++,r++)}if(!this.strict&&s<i.length){let a=i.slice(s);n+=this.autoLowercase?a.toLowerCase():a}return n}format(t){if(this.resolveForValue(t),this.subEngines.length>0){let a=this.selectEngine(t);if(a!==this)return a.format(t)}let e=Math.max(4096,this.slots.length*4),i=String(t??"").slice(0,e);if(!this.slots.length)return i;let n=this.extractRawInternal(i);if(n.length===0)return this.prefixString;let s="",r=0;for(let a=0;a<this.slots.length;a++){let o=this.slots[a];if(o.isStatic){let l=r<n.length,h=r===0&&!!o.isPrefix,p=r>0&&r===n.length;if(l||h||p)s+=o.char;else break}else if(r<n.length){let l=n[r],h=o.token?.transform?o.token.transform(l):l;this.autoLowercase&&!o.token?.transform&&(h=h.toLowerCase()),s+=h,r++}else break}if(!this.strict&&r<n.length){let a=n.substring(r);s+=this.autoLowercase?a.toLowerCase():a}return s}getRemainingMask(t){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getRemainingMask(t):this.fullMaskTemplate?t.length>=this.fullMaskTemplate.length?t:t+this.fullMaskTemplate.substring(t.length):""}mapCursorPosition(t,e,i){if(this.activeEngine&&this.activeEngine!==this)return this.activeEngine.mapCursorPosition(t,e,i);let n=this.prefixSlotsCount,s=String(t??""),r=String(i??"");if(e<=0||!r)return n;let o=this.extractRawInternal(s.slice(0,e)).length;if(o===0)return Math.max(n,Math.min(this.getNextEditablePosition(0),r.length));let l=0,h=r.length;for(let p=0;p<r.length&&p<this.slots.length;p++)if(!this.slots[p].isStatic&&(l++,l===o)){h=p+1;break}for(;h<r.length&&this.slots[h]&&this.slots[h].isStatic;)h++;return Math.max(n,Math.min(h,r.length))}isSeparatorAt(t){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.isSeparatorAt(t):t>=0&&t<this.slots.length?this.slots[t].isStatic:!1}getNextEditablePosition(t){if(this.activeEngine&&this.activeEngine!==this)return this.activeEngine.getNextEditablePosition(t);let e=Math.max(0,t);for(let i=e;i<this.slots.length;i++)if(!this.slots[i].isStatic)return i;return this.slots.length}getSlotAt(t){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getSlotAt(t):this.slots[t]}getSlots(){return this.activeEngine&&this.activeEngine!==this?this.activeEngine.getSlots():this.slots}};var P=class{stack=[];index=-1;maxDepth;constructor(t=50){this.maxDepth=t}push(t,e){let i=this.getCurrent();if(i&&i.raw===t){i.cursor=e;return}this.stack=this.stack.slice(0,this.index+1),this.stack.push({raw:t,cursor:e}),this.stack.length>this.maxDepth&&this.stack.shift(),this.index=this.stack.length-1}updateCurrentCursor(t){let e=this.getCurrent();e&&(e.cursor=t)}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 B=class{delegate;constructor(t){this.delegate=t}handleKeyDown(t){if(F(t))return;let e=this.delegate.getInput(),i=this.delegate.getEngine(),n=this.delegate.getHistory(),s=i.getPrefixLength(),r=e.selectionStart??0,a=e.selectionEnd??r;if((t.ctrlKey||t.metaKey)&&(t.key==="z"||t.key==="Z")&&!t.shiftKey){t.preventDefault(),this.delegate.undo();return}if((t.ctrlKey||t.metaKey)&&(t.key==="y"||t.key==="Y")||(t.ctrlKey||t.metaKey)&&t.shiftKey&&(t.key==="z"||t.key==="Z")){t.preventDefault(),this.delegate.redo();return}n.updateCurrentCursor(r);let o=t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey,l=a>r;if(o&&!l){let u=i.getSlots(),c=r<u.length&&u[r].isStatic&&u[r].char===t.key,d=-1;if(r>0&&r-1<u.length)if(u[r-1].isStatic&&u[r-1].char===t.key)d=r-1;else{let m=r-1;for(;m>=s&&u[m].isStatic;){if(u[m].char===t.key){d=m;break}m--}}if(c||d!==-1){t.preventDefault();let m=c?r:d,b=i.getNextEditablePosition(m+1);this.delegate.applyMask(e.value,b,!0);return}let f=-1;for(let m=r;m<u.length;m++)if(u[m].isStatic){u[m].char===t.key&&(f=m);break}if(f!==-1){t.preventDefault();let m=f-1;for(;m>=s&&!u[m].isStatic;)m--;m++;let b=f-m,v=e.value.slice(m,r);if(u.slice(m,f).every(S=>!!(S.token&&S.token.pattern.test("0")&&!S.token.pattern.test("a")&&!S.token.pattern.test("Z")))&&b>v.length&&v.length>0){let S=b-v.length,I="0".repeat(S)+v,A=e.value.slice(f),x=e.value.slice(0,m)+I+A,L=i.getNextEditablePosition(f+1);this.delegate.applyMask(x,L,!0);return}let w=i.getNextEditablePosition(f+1);this.delegate.applyMask(e.value,w,!0);return}}if(o&&i.isStrict()){let u=i.isDynamicPattern(),c=i.extractRaw(e.value),d=a>r?i.extractRawForCurrentPattern(e.value.slice(r,a)):"";if(u){let f=e.value.slice(0,r)+t.key+e.value.slice(a);i.resolveForValue(f)}let y=i.getMaxEditableCount();if(y>0&&y-(c.length-d.length)<=0){u&&i.resolveForValue(e.value),t.preventDefault();return}u&&i.resolveForValue(e.value)}if(a>r){if(t.key==="Backspace"||t.key==="Delete"){t.preventDefault();let u=e.value,c=u.slice(0,r)+u.slice(a);this.delegate.applyMask(c,Math.max(s,r));return}return}if(t.key==="ArrowLeft"&&!t.shiftKey&&r<=s){t.preventDefault(),e.setSelectionRange(s,s);return}if(t.key==="Home"&&s>0&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&!t.altKey){t.preventDefault(),e.setSelectionRange(s,s);return}if(t.key==="Backspace"&&r<=s){t.preventDefault(),e.setSelectionRange(s,s);return}if(t.key==="Delete"&&r<s){t.preventDefault(),e.setSelectionRange(s,s);return}if(t.key==="Backspace"&&(t.ctrlKey||t.altKey||t.metaKey)){if(t.preventDefault(),r<=s){e.setSelectionRange(s,s);return}let u=r-1;for(;u>=s&&i.isSeparatorAt(u);)u--;for(;u>=s&&!i.isSeparatorAt(u);)u--;let c=Math.max(s,u+1),d=e.value,y=d.slice(0,c)+d.slice(r);this.delegate.applyMask(y,c);return}if(t.key==="Delete"&&(t.ctrlKey||t.altKey||t.metaKey)){t.preventDefault();let u=e.value;if(r>=u.length)return;let c=r;for(;c<u.length&&i.isSeparatorAt(c);)c++;for(;c<u.length&&!i.isSeparatorAt(c);)c++;for(;c<u.length&&i.isSeparatorAt(c);)c++;let d=c,y=u.slice(0,r)+u.slice(d);this.delegate.applyMask(y,r);return}if(t.key==="Backspace"&&r>s){if(i.isSeparatorAt(r-1)){t.preventDefault();let u=r-1;for(;u>s&&i.isSeparatorAt(u-1);)u--;if(u>s){let c=e.value,d=c.slice(0,u-1)+c.slice(r);this.delegate.applyMask(d,u-1)}else this.delegate.applyMask("",s)}return}if(t.key==="Delete"&&r<e.value.length){if(i.isSeparatorAt(r)){t.preventDefault();let u=r;for(;u<e.value.length&&i.isSeparatorAt(u);)u++;if(u<e.value.length){let c=e.value,d=c.slice(0,u)+c.slice(u+1);this.delegate.applyMask(d,r)}}return}}handleKeyUp(t){let e=this.delegate.getInput(),i=this.delegate.getHistory();(t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="Home")&&!t.shiftKey&&this.delegate.enforceMinCursor(),i.updateCurrentCursor(e.selectionStart??0)}};var G=class extends E{engine;history;keyboard;isComposing=!1;isUndoingRedoing=!1;isMouseDown=!1;isApplyingMask=!1;lastValue="";lastInternalRemainingMask="";isNotifying=!1;hasPendingNotification=!1;onChangeNativeHandler=()=>{};wasInputModeInferred=!1;cutTimerId=null;pasteTimerId=null;resetTimerId=null;lastInputType="";constructor(t,e,i){let n=O(t,e,i),s=n.wrapper,r=n.input,a=n.options,o=s?.getAttribute("data-mask")||r?.getAttribute("data-mask"),l=a.mask||o||"";typeof l=="string"&&l.includes("|")&&(l=l.split("|").map(k=>k.trim()));let h=a.placeholderChar||s?.getAttribute("data-mask-placeholder")||r?.getAttribute("data-mask-placeholder")||"_",p=s?.hasAttribute("data-disabled")||r?.hasAttribute("data-disabled"),u=s?.getAttribute("data-mask-strict")||r?.getAttribute("data-mask-strict"),c=s?.getAttribute("data-mask-auto-lowercase")==="true"||r?.getAttribute("data-mask-auto-lowercase")==="true",d=s?.getAttribute("data-mask-infer-inputmode")??r?.getAttribute("data-mask-infer-inputmode"),y=a.inferInputMode??(d!==null?d!=="false":!0),{disabled:f,...m}=a,b=f!==void 0?f:p?!0:!l||Array.isArray(l)&&l.length===0,v={...m,mask:l,placeholderChar:h,strict:a.strict??(u!==null?u!=="false":!0),autoLowercase:a.autoLowercase??c??!1,disabled:b,resetHistoryOnMaskChange:a.resetHistoryOnMaskChange??!1,inferInputMode:y,onInput:a.onInput||a.oninput,onChange:a.onChange||a.onchange,onComplete:a.onComplete||a.oncomplete};super(s,r,v),this.history=new P,this.engine=new N(this.options.mask||"",{placeholderChar:this.options.placeholderChar,tokens:this.options.tokens,strict:this.options.strict,autoLowercase:this.options.autoLowercase}),this.syncInferredInputMode(),this.keyboard=new B({getInput:()=>this.input,getEngine:()=>this.engine,getHistory:()=>this.history,applyMask:(k,w,S)=>this.applyMask(k,w,S),undo:()=>this.undo(),redo:()=>this.redo(),enforceMinCursor:()=>this.enforceMinCursor()}),this.bindEvents(),this.lastValue=this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value,this.syncInitialValue(),this.runAuditWarning(this.options.audit)}getSpecificAuditWarnings(){let t=[],e=[],i=this.checkAriaIdReferences(this.input,"aria-describedby",e,!0),n=!!this.input.getAttribute("placeholder")?.trim(),s=!!this.input.getAttribute("aria-placeholder")?.trim();return!i&&!s&&!this.options.disabled&&(n?t.push("Indication du format attendu fragile : l'attribut placeholder seul dispara\xEEt \xE0 la saisie et est masqu\xE9 par le gabarit fant\xF4me ; utilisez aria-describedby ou aria-placeholder (WCAG 3.3.2)."):t.push("Indication du format attendu manquante : d\xE9finissez aria-describedby ou aria-placeholder pour informer les technologies d'assistance (WCAG 3.3.2).")),t}extractRawSnippet(t){return this.engine.extractRaw(t)}onPasswordModeDetected(){this.history.clear(),this.lastValue="",this.lastInternalRemainingMask="",this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask")}static format(t,e,i={}){return N.format(t,e,i)}onNativeValueSet(t){if(this.options.disabled)this.checkValueChange();else{let e=this.applyTransformInput(t,"programmatic","");this.applyMask(e,e.length)}}onDisabledChange(t){t?(this.wrapper.removeAttribute("data-mask"),this.wrapper.classList.remove("is-complete","has-selection"),this.clearGhost(),this.checkValueChange()):this.applyMask(this.input.value,this.input.selectionStart??this.input.value.length),this.syncInferredInputMode()}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 e=this.input.selectionStart??this.input.value.length;this.applyMask(this.input.value,e)}},0)},this.onChangeNativeHandler=()=>{this.isDestroyed||this.checkValueChange()};let{signal:t}=this.abortController;this.input.addEventListener("beforeinput",this.onBeforeInput,{signal:t}),this.input.addEventListener("input",this.handleInput,{signal:t}),this.input.addEventListener("keydown",this.onKeyDown,{signal:t}),this.input.addEventListener("paste",this.onPaste,{signal:t}),this.input.addEventListener("focus",this.onFocus,{signal:t}),this.input.addEventListener("blur",this.onBlur,{signal:t}),this.input.addEventListener("click",this.onClick,{signal:t}),this.input.addEventListener("keyup",this.onKeyUp,{signal:t}),this.input.addEventListener("select",this.onSelect,{signal:t}),this.input.addEventListener("mousedown",this.onMouseDown,{signal:t}),window.addEventListener("mouseup",this.onMouseUp,{signal:t}),this.input.addEventListener("compositionstart",this.onCompositionStart,{signal:t}),this.input.addEventListener("compositionend",this.onCompositionEnd,{signal:t}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:t}),this.input.addEventListener("cut",this.onCutHandler,{signal:t}),this.input.addEventListener("change",this.onChangeNativeHandler,{signal:t}),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,{signal:t}))}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.wasInputModeInferred&&this.input.getAttribute("inputmode")==="numeric"&&this.input.removeAttribute("inputmode"),this.history.clear(),this.lastValue="",this.lastInternalRemainingMask="",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 i=typeof e=="boolean"?e:e&&typeof e=="object"&&e.strict!==void 0?e.strict:this.options.strict,n=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=i,this.engine.setStrict(i??!0),this.engine.compile(""),n&&this.history.clear(),this.setDisabled(!0),this.syncInferredInputMode();return}this.options.mask=t,this.options.strict=i,this.engine.setStrict(i??!0),this.engine.compile(t),n&&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===null&&(this.isSensitiveField()||typeof this.options.mask=="function")||e===this.lastInternalRemainingMask)return;let i=typeof this.options.mask=="function"?"":Array.isArray(this.options.mask)?this.options.mask.join("|"):this.options.mask||"";if(e===i)return;if(e){let n=e.includes("|")?e.split("|").map(s=>s.trim()):e;this.setMask(n)}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.setAutoLowercase(this.options.autoLowercase),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)}applyTransformInput(t,e,i){if(typeof this.options.transformInput!="function")return t;try{let n=this.options.transformInput(t,{source:e,inputType:i});if(typeof n=="string")return e==="paste"?R(n,4096):U(n,4096)}catch{}return t}setValue(t){let e=t!=null?String(t):"";if(this.options.disabled){this.input.value=e,this.checkValueChange();return}let i=this.applyTransformInput(e,"programmatic","");this.applyMask(i,i.length)}getRawValue(){return this.engine.extractRaw(this.input.value)}isComplete(){if(this.options.disabled)return!0;let t=this.getRawValue(),e=this.engine.getActiveEditableCount();return e===0?!0:t.length>=e}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,i=t!==e;this.wrapper.classList.toggle("has-selection",i)}onBeforeInput(t){if(this.lastInputType=t.inputType||"",!this.options.disabled&&!this.isComposing&&this.engine.isStrict()&&!(t.inputType==="insertFromPaste"||t.inputType==="insertReplacementText")&&t.inputType&&t.inputType.startsWith("insert")){let e=this.input.value,i=this.engine.isDynamicPattern(),n=this.engine.extractRaw(e),s=this.input.selectionStart??0,r=this.input.selectionEnd??s,a=r>s?this.engine.extractRawForCurrentPattern(e.slice(s,r)):"";if(i){let l=e.slice(0,s)+(t.data??"")+e.slice(r);this.engine.resolveForValue(l)}let o=this.engine.getMaxEditableCount();if(o>0&&Math.max(0,o-(n.length-a.length))<=0){i&&this.engine.resolveForValue(e),t.preventDefault();return}i&&this.engine.resolveForValue(e)}}handleInput(t){if(this.isDispatchingNativeInput||this.isComposing)return;let e=t?.inputType||this.lastInputType||"";this.lastInputType="";let i=!!(this.options.onInput||this.options.oninput),n=this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value;if(i&&n!==this.lastValue&&this.checkValueChange(),this.options.disabled){this.checkValueChange();return}let s=this.input.value,r=this.input.selectionStart??s.length,a=this.applyTransformInput(s,"input",e),o=a!==s?r>=s.length?a.length:Math.min(r,a.length):r,l=this.history.getCurrent(),h=this.engine.extractRaw(a),p=this.engine.getMaxEditableCount();if(p>0&&this.engine.isStrict()&&l&&l.raw.length>=p&&h.length>p){this.applyMask(l.raw,l.cursor);return}this.applyMask(a,o),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 e=this.preparePastedText(this.getClipboardPlainText(t),4096),i=this.applyTransformInput(e,"paste","insertFromPaste");if(!i)return;let n=this.engine.getPrefixLength(),s=this.input.selectionStart??0,r=this.input.selectionEnd??s,a=this.input.value,o=this.getRawValue(),l=this.engine.getMaxEditableCount(),h=this.engine.getPrefix(),p=h.replace(/[\s.-]+/g,"").toUpperCase(),u=i.replace(/[\s.-]+/g,"").toUpperCase(),c=p.length>0&&u.startsWith(p),d=a.slice(0,Math.max(n,s)).replace(/[\s.-]+/g,"").toUpperCase(),y=d.length>=2&&u.startsWith(d),f=Math.max(n,s),m=Math.max(n,r);(c||y)&&(f=0,m=a.length);let b=Math.max(0,l-o.length);if(f!==m){let A=this.engine.extractRawForCurrentPattern(a.slice(f,m));b=Math.max(0,l-(o.length-A.length))}let v=this.engine.normalizePastedValue(i),k=this.engine.getActiveEditableCount(),w=k>0&&o.length>=k;if(this.engine.isStrict()&&(b<=0||s===r&&w)){let A=this.engine.extractRaw(v).length,x=this.engine.getMaxEditableCount();if(s===r&&x>0&&A===x&&(b<=0||A>b))f=0,m=a.length;else if(b<=0){this.engine.resolveForValue(a);return}else this.engine.resolveForValue(a)}let S,I;f===0&&m===a.length?(S=v,I=v.length):o.length===0&&f===n&&m===a.length?n>0&&v.toUpperCase().startsWith(h.toUpperCase())?(S=v,I=v.length):(S=a.slice(0,f)+v,I=S.length):(S=a.slice(0,f)+i+a.slice(m),I=f+i.length),this.applyMask(S,I),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(){if(this.wrapper.classList.remove("is-focused","has-selection"),this.isSensitiveField()){this.history.clear(),this.lastValue="",this.lastInternalRemainingMask="",this.lastTrackedValue="",this.clearGhost(),this.wrapper.removeAttribute("data-mask");return}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,i=this.input.selectionEnd??e;e===i&&e<t&&this.input.setSelectionRange(t,t)}updateGhost(t){if(!this.ghost)return;if(this.options.disabled||this.isSensitiveField()){this.clearGhost();return}let e=!t||t===this.engine.getPrefix();if(this.shouldHideGhostForPlaceholder(e)){this.clearGhost();return}let i=this.engine.getFullMaskTemplate(),n=i.length>t.length?i.substring(t.length):"",s=this.input.ownerDocument||document,r=s.createElement("span");r.className="mask-ghost-typed",r.textContent=t;let a=s.createElement("span");a.className="mask-ghost-remaining",a.textContent=n,this.setGhostContent(r,a),this.ghost.scrollLeft=this.input.scrollLeft}applyMask(t,e,i=!1){if(this.options.disabled||this.isApplyingMask)return;this.isApplyingMask=!0;let n="",s=!1;try{n=this.engine.format(t),this.engine.isDynamicPattern()&&this.syncInferredInputMode();let r=this.engine.getRemainingMask(n),a=this.isSensitiveField();this.setNativeValue(n),a?(this.lastInternalRemainingMask="",this.wrapper.removeAttribute("data-mask"),this.clearGhost()):(this.lastInternalRemainingMask=r,this.wrapper.setAttribute("data-mask",r),this.updateGhost(n));let o=this.engine.getPrefixLength(),l;if(i||this.isUndoingRedoing)l=Math.max(o,Math.min(e,n.length));else{let h=this.engine.mapCursorPosition(t,e,n);l=Math.max(o,h)}this.input.setSelectionRange(l,l),s=this.isComplete(),this.wrapper.classList.toggle("is-complete",s),a?(this.options.copyRaw=!1,this.history.clear()):this.isUndoingRedoing||this.history.push(this.getRawValue(),l)}finally{this.isApplyingMask=!1}this.checkValueChange()}syncInitialValue(){let t=this.isSensitiveField();if(this.options.disabled){this.wrapper.removeAttribute("data-mask"),this.clearGhost(),this.lastValue=t?this.computePasswordDigest(this.input.value):this.input.value,this.checkValueChange();return}this.syncGhostStyles();let e=this.input.value||"";if(e){let i=this.applyTransformInput(e,"programmatic","");this.applyMask(i,i.length)}else{let i=this.engine.getPrefixLength();if(i>0)this.applyMask("",i);else{if(t)this.lastInternalRemainingMask="",this.wrapper.removeAttribute("data-mask"),this.clearGhost();else{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){let e=this.isSensitiveField(),i=this.input.value;if(!((e?this.computePasswordDigest(i):i)===this.lastValue&&!t&&!this.hasPendingNotification)){if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let s=0,r=10;for(;((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)!==this.lastValue||this.hasPendingNotification||t)&&s<r;){s++,this.hasPendingNotification=!1,t=!1;let a=this.isSensitiveField(),o=this.input.value;this.lastValue=a?this.computePasswordDigest(o):o;let l=this.options.disabled?o:this.getRawValue(),h=this.options.disabled?0:this.engine.getActiveEditableCount(),p=this.isComplete(),u={value:o,rawValue:l,isComplete:p,totalSlots:h,filledSlots:this.options.disabled?o.length:l.length},c=!a,d=this.options.onInput||this.options.oninput;d&&d(o,u),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:c,detail:u})),this.dispatchNativeInput();let y=this.options.onChange||this.options.onchange;y&&y(u),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:c,detail:u}));let f=this.options.onComplete||this.options.oncomplete;p&&(f&&f(u),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:c,detail:u})))}}finally{this.isNotifying=!1}}}};var V=class g{options;constructor(t={}){let e=t.currency??"";!e&&t.unit&&(e=t.unit);let i=e==="$"||e==="\xA3"||e==="\xA5"?"prefix":"suffix",n=t.decimals!==void 0?Number(t.decimals):2,s=Number.isFinite(n)?Math.min(20,Math.max(0,Math.floor(n))):2;this.options={currency:String(e).slice(0,32),unit:String(t.unit??e).slice(0,32),currencyPosition:t.currencyPosition??i,decimals:s,decimalSeparator:String(t.decimalSeparator??",").slice(0,4)||",",thousandSeparator:String(t.thousandSeparator??"\xA0").slice(0,4),allowNegative:t.allowNegative??!1,min:t.min??-1/0,max:t.max??1/0}}normalizePastedValue(t){let e=R(t,512);if(!e)return"";let i=0,n=0,s=-1,r=-1;for(let a=0;a<e.length;a++){let o=e[a];o===","?(i++,s=a):o==="."&&(n++,r=a)}if(i>0&&n>0){let a=s>r?",":".";if((a===","?i:n)!==1)return e;let l=a===","?".":",";return e.split(l).join("").replace(a,this.options.decimalSeparator)}return i>=2&&n===0?e.split(",").join(""):n>=2&&i===0?e.split(".").join(""):e}parse(t){let e=String(t??"").slice(0,512).trim(),i=!1;this.options.allowNegative&&e.includes("-")&&(i=!0),this.options.currency&&(e=e.replace(new RegExp(this.escapeRegExp(this.options.currency),"g"),"")),this.options.thousandSeparator&&(e=e.replace(new RegExp(this.escapeRegExp(this.options.thousandSeparator),"g"),"")),e=e.replace(/[\s\u00A0]/g,"");let n=this.options.decimalSeparator,s=e.indexOf(n);s===-1&&(s=e.search(/[,.]/));let r="",a=null,o=!1;return s!==-1?(r=e.substring(0,s).replace(/\D/g,""),this.options.decimals>0&&(o=!0,a=e.substring(s+1).replace(/\D/g,"").slice(0,this.options.decimals))):r=e.replace(/\D/g,""),r.length>1&&(r=r.replace(/^0+/,"")||"0"),{isNegative:i,integerPart:r,decimalPart:a,hasDecimal:o}}format(t,e=t.length,i=!1){let n=String(t??"").slice(0,512),s=Math.max(0,Math.min(e,n.length));if(!n||n.trim()===""||n===this.options.currency.trim())return{formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0};let r=n.substring(0,s),a=r.replace(/\D/g,"").length,o=this.options.decimals>0&&/[,.]/.test(r),{isNegative:l,integerPart:h,decimalPart:p,hasDecimal:u}=this.parse(n),c=p,d=u;if(i&&this.options.decimals>0&&(h||p!==null)&&(d=!0,c===null?c="0".repeat(this.options.decimals):c.length<this.options.decimals&&(c=c+"0".repeat(this.options.decimals-c.length))),l&&!h&&!c&&!d&&this.options.allowNegative){let D="-",C=1;return this.options.currency&&(this.options.currencyPosition==="prefix"?(D=`${this.options.currency} -`,C=D.length):(D=`- ${this.options.currency}`,C=1)),{formatted:D,rawNumber:null,rawValue:"-",cursor:C,isValid:!0}}if(!h&&!c&&!d)return{formatted:"",rawNumber:null,rawValue:"",cursor:0,isValid:!0};let f=this.formatThousands(h||"0");d&&this.options.decimals>0&&(f+=this.options.decimalSeparator+(c??"")),l&&f!=="0"&&(f="-"+f);let m=f;this.options.currency&&(this.options.currencyPosition==="prefix"?m=`${this.options.currency} ${f}`:m=`${f} ${this.options.currency}`);let b=(l?"-":"")+(h||"0")+(p?"."+p:""),v=parseFloat(b);isNaN(v)&&(v=0);let k=v>=this.options.min&&v<=this.options.max,w=0;this.options.currency&&this.options.currencyPosition==="prefix"&&(w=this.options.currency.length+1);let S=0,I=!1,A=w;for(let D=w;D<m.length;D++){let C=m[D];if(C===this.options.currency.trim()[0]&&this.options.currencyPosition==="suffix")break;if(/\d/.test(C)?(S++,A=D+1):C===this.options.decimalSeparator&&(I=!0,A=D+1),o){if(I&&S>=a){w=D+1;break}}else if(S>=a){w=D+1;break}}a>0&&S<a&&A>w&&(w=A);let x=this.options.currency&&this.options.currencyPosition==="prefix"?this.options.currency.length+1:0,L=this.options.currency&&this.options.currencyPosition==="suffix"?Math.max(0,m.length-this.options.currency.length-1):m.length;return w=Math.max(x,Math.min(w,Math.max(x,L))),{formatted:m,rawNumber:v,rawValue:b,cursor:w,isValid:k}}static format(t,e={}){let i=new g(e),n=typeof t=="number"?t.toString():t;return i.format(n).formatted}formatThousands(t){let e=this.options.thousandSeparator;if(!e||t.length<=3)return t;let i=[],n=t.length;for(;n>0;){let s=Math.max(0,n-3);i.push(t.slice(s,n)),n=s}return i.reverse().join(e)}escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}};var gt=10,W=class extends E{engine;history;isUndoingRedoing=!1;isApplying=!1;isComposing=!1;isNotifying=!1;hasPendingNotification=!1;lastValue="";wasInputModeInferred=!1;cutTimerId=null;resetTimerId=null;cursorTimerId=null;constructor(t,e,i){let n=O(t,e,i),s=n.wrapper,r=n.input,a=n.options,o=s?.getAttribute("data-mask-pad-decimals")==="true"||r?.getAttribute("data-mask-pad-decimals")==="true",l=r?.getAttribute("data-mask-align")||r?.getAttribute("data-align")||s?.getAttribute("data-mask-align")||s?.getAttribute("data-align"),h={align:a.align??l??"right",padDecimalsOnBlur:a.padDecimalsOnBlur??o??!1,...a};super(s,r,h),this.input.hasAttribute("inputmode")||(this.input.inputMode="decimal",this.wasInputModeInferred=!0),this.history=new P,this.engine=new V(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:"")}onPasswordModeDetected(){this.history.clear(),this.lastValue="",this.lastTrackedValue="",this.clearGhost()}static format(t,e={}){return V.format(t,e)}onNativeValueSet(t){if(this.options.disabled||this.isComposing){this.lastValue=this.isSensitiveField()?this.computePasswordDigest(t):t;return}this.applyAmount(t,t.length)}onDisabledChange(t){t?this.clearGhost():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.handlePaste=this.handlePaste.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 e=this.input.selectionStart??this.input.value.length;this.applyAmount(this.input.value,e)},0)};let{signal:t}=this.abortController;this.input.addEventListener("input",this.handleInput,{signal:t}),this.input.addEventListener("keydown",this.handleKeyDown,{signal:t}),this.input.addEventListener("paste",this.handlePaste,{signal:t}),this.input.addEventListener("blur",this.handleBlur,{signal:t}),this.input.addEventListener("focus",this.handleFocus,{signal:t}),this.input.addEventListener("click",this.handleClick,{signal:t}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:t}),this.input.addEventListener("cut",this.onCutHandler,{signal:t}),this.input.addEventListener("compositionstart",this.onCompositionStart,{signal:t}),this.input.addEventListener("compositionend",this.onCompositionEnd,{signal:t}),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,{signal:t}))}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)return;this.isApplying=!0;let i=null;try{i=this.engine.format(t,e),this.setNativeValue(i.formatted),this.input.setSelectionRange(i.cursor,i.cursor),this.isSensitiveField()?(this.options.copyRaw=!1,this.history.clear(),this.clearGhost()):(this.isUndoingRedoing||this.history.push(i.rawValue,i.cursor),this.updateGhost(i))}finally{this.isApplying=!1}i&&this.checkValueChange(i)}updateGhost(t){if(this.ghost){if(this.options.disabled||this.isSensitiveField()){this.clearGhost();return}if(!t.formatted){if(this.shouldHideGhostForPlaceholder(!0)){this.clearGhost();return}let e=this.options.currency?this.options.currencyPosition==="prefix"?`${this.options.currency} 0`:`0 ${this.options.currency}`:"0,00",n=(this.input.ownerDocument||document).createElement("span");n.className="mask-ghost-remaining",n.textContent=e,this.setGhostContent(n);return}this.clearGhost(),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)}handlePaste(t){if(this.options.disabled)return;t.preventDefault(),this.history.updateCurrentCursor(this.input.selectionStart??0);let e=this.preparePastedText(this.getClipboardPlainText(t),512);if(!e)return;let i=this.engine.normalizePastedValue(e),n=this.input.selectionStart??this.input.value.length,s=this.input.selectionEnd??n,r=this.input.value.slice(0,n)+i+this.input.value.slice(s);this.applyAmount(r,n+i.length)}handleKeyDown(t){if(!(this.options.disabled||F(t))){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,i=this.input.selectionEnd??0;if(e===i&&e>0){let n=this.input.value,s=n[e-1];if(s===this.engine.options.thousandSeparator||s===" "){t.preventDefault();let r=Math.max(0,e-2),a=n.slice(0,r)+n.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,i=this.input.selectionEnd??0;if(e===i&&e<this.input.value.length){let n=this.input.value,s=n[e];if(s===this.engine.options.thousandSeparator||s===" "){t.preventDefault();let r=n.slice(0,e)+n.slice(e+2);this.applyAmount(r,e);return}if(this.options.currency&&this.options.currencyPosition==="suffix"){let r=n.length-this.options.currency.length-1;if(e>=r){t.preventDefault();return}}}}(t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="Home"||t.key==="End")&&(this.cursorTimerId!==null&&clearTimeout(this.cursorTimerId),this.cursorTimerId=window.setTimeout(()=>{this.cursorTimerId=null,this.enforceCursorBounds()},0))}}enforceCursorBounds(){if(this.isDestroyed||!this.isFocused||Y(this.input.ownerDocument)!==this.input||!this.input.value||this.options.disabled)return;let t=this.input.selectionStart??0,e=this.input.selectionEnd??0;if(t!==e)return;let i=this.input.value,n=this.options.currency;if(n){if(this.options.currencyPosition==="prefix"){let s=n.length+1;t<s&&this.input.setSelectionRange(s,s)}else if(this.options.currencyPosition==="suffix"){let s=Math.max(0,i.length-n.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.isSensitiveField()){this.history.clear(),this.lastValue="",this.lastTrackedValue="",this.clearGhost();return}if(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:!this.isSensitiveField(),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))}checkValueChange(t){if(!((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)===this.lastValue&&!this.hasPendingNotification)){if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let n=0,s=t;for(;((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)!==this.lastValue||this.hasPendingNotification)&&n<gt;){n++,this.hasPendingNotification=!1;let r=this.isSensitiveField(),a=this.input.value;this.lastValue=r?this.computePasswordDigest(a):a;let o=s??this.engine.format(a);s=void 0,this.notifyChange(o)}}finally{this.isNotifying=!1}}}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:!this.isSensitiveField(),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}getSpecificAuditWarnings(){let t=[],e=(this.options.currency||this.options.unit||"").trim();if(!e||this.options.disabled)return t;let i=[],n=this.checkAriaIdReferences(this.input,"aria-describedby",i,!0),s=!!this.input.getAttribute("aria-placeholder")?.trim();if(n||s)return t;let r=this.input.ownerDocument||document,a=typeof this.input.getRootNode=="function"?this.input.getRootNode():r,o=typeof ShadowRoot<"u"&&a instanceof ShadowRoot?a:r,l=this.input.getAttribute("aria-label")||"",h=this.input.getAttribute("aria-labelledby")?.trim();if(h)for(let y of h.split(/\s+/).filter(Boolean)){let f=typeof ShadowRoot<"u"&&a instanceof ShadowRoot?a.getElementById(y):r.getElementById(y);f?.textContent&&(l+=" "+f.textContent)}let p=this.input.closest("label");if(p?.textContent&&(l+=" "+p.textContent),this.input.id)try{let y=o.querySelector(`label[for="${q(this.input.id)}"]`);y?.textContent&&(l+=" "+y.textContent)}catch{}let u=l.toLowerCase(),c=e.toLowerCase();return u.includes(c)||c==="\u20AC"&&(u.includes("euro")||u.includes("eur"))||c==="$"&&(u.includes("dollar")||u.includes("usd"))||c==="\xA3"&&(u.includes("livre")||u.includes("pound")||u.includes("gbp"))||t.push(`Devise/unit\xE9 "${e}" non expos\xE9e aux technologies d'assistance quand le champ est vide (le fant\xF4me est aria-hidden="true") : mentionnez-la dans le <label>, aria-label ou aria-describedby (WCAG 3.3.2).`),t}setValue(t){let e=t!=null?String(t):"";this.options.disabled?(this.setNativeValue(e),this.lastValue=this.isSensitiveField()?this.computePasswordDigest(e):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.cursorTimerId!==null&&(clearTimeout(this.cursorTimerId),this.cursorTimerId=null),this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="decimal"&&this.input.removeAttribute("inputmode"),this.lastValue="",this.history.clear(),super.destroy())}};var K=class g{domains;tlds;suggestOnAt;defaultDomain=null;defaultTld="__";static DEFAULT_DOMAINS=["gmail.com","outlook.com","orange.fr","free.fr","sfr.fr","yahoo.com","hotmail.com","icloud.com","laposte.net","proton.me"];static DEFAULT_TLDS=["com","fr","net","org","eu","io","co","info","biz","me","tv","fi","be","ch","ca","uk","de","es","it"];constructor(t={}){let e=Array.isArray(t.domains)?t.domains.slice(0,500).map(i=>String(i??"").trim().slice(0,253)).filter(Boolean):[];this.domains=e.length>0?e:g.DEFAULT_DOMAINS,this.tlds=t.tlds&&t.tlds.length>0?t.tlds.slice(0,200).map(i=>String(i).trim().replace(/^\./,"").slice(0,32)).filter(Boolean):[...g.DEFAULT_TLDS],this.suggestOnAt=t.suggestOnAt??!0,this.setDefaultDomain(t.defaultDomain??null),this.setDefaultTld(t.defaultTld!==void 0?t.defaultTld:"__")}setDefaultDomain(t){t===!0?this.defaultDomain=this.domains.length>0?this.domains[0]:null:typeof t=="string"&&t.trim().length>0?this.defaultDomain=t.trim().replace(/^@/,"").slice(0,253)||null:this.defaultDomain=null}setDefaultTld(t){t===!0?this.defaultTld=this.tlds.length>0?this.tlds[0]:null:typeof t=="string"&&t.trim().length>0?this.defaultTld=t.trim().replace(/^\./,"").slice(0,32)||null:this.defaultTld=null}setTlds(t){this.tlds=t&&t.length>0?t.slice(0,200).map(e=>String(e).trim().replace(/^\./,"").slice(0,32)).filter(Boolean):[...g.DEFAULT_TLDS]}getMatchingTlds(t){let e=(t??"").toLowerCase();return e.length===0?[...this.tlds]:this.tlds.filter(i=>i.toLowerCase().startsWith(e)&&i.toLowerCase()!==e)}getMatchingDomains(t){let e=String(t??"").slice(0,512);if(!e.includes("@"))return this.defaultDomain?[this.defaultDomain]:[];let i=e.indexOf("@");if(e.indexOf("@",i+1)!==-1)return[];let n=e.substring(i+1);if(n.length===0)return this.suggestOnAt?[...this.domains]:[];let s=n.toLowerCase();return this.domains.filter(r=>r.toLowerCase().startsWith(s)&&r.toLowerCase()!==s)}getSuggestion(t,e=0){let i=String(t??"").slice(0,512);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("@"),s=i.substring(0,n),r=i.substring(n+1);if(i.indexOf("@",n+1)!==-1)return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let a=this.getMatchingDomains(t);if(a.length>0){let d=(e%a.length+a.length)%a.length,y=a[d],f=r.toLowerCase(),m=y.substring(f.length);return{full:`${s}@${y}`,remaining:m,matchedDomain:y,isHintOnly:!1}}if(r.length===0||r.startsWith("."))return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let o=r.toLowerCase();if(this.domains.some(d=>d.toLowerCase()===o))return{full:i,remaining:"",matchedDomain:r,isHintOnly:!1};let l=r.lastIndexOf(".");if(l===-1){if(!this.defaultTld)return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};let d=this.defaultTld.includes("_"),y=`.${this.defaultTld}`,f=`${r}.${this.defaultTld}`;return{full:d?i:`${s}@${f}`,remaining:y,matchedDomain:d?null:f,isHintOnly:d}}let h=r.substring(0,l),p=r.substring(l+1);if(!h||h.endsWith("."))return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1};if(p.length===0){if(this.defaultTld&&!this.defaultTld.includes("_")){let d=`${h}.${this.defaultTld}`;return{full:`${s}@${d}`,remaining:this.defaultTld,matchedDomain:d,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 u=p.toLowerCase();if(this.tlds.some(d=>d.toLowerCase()===u))return{full:i,remaining:"",matchedDomain:r,isHintOnly:!1};let c=this.getMatchingTlds(p);if(c.length>0){let d=(e%c.length+c.length)%c.length,y=c[d],f=y.substring(u.length),m=`${h}.${y}`;return{full:`${s}@${m}`,remaining:f,matchedDomain:m,isHintOnly:!1}}if(this.defaultTld&&this.defaultTld.includes("_")&&p.length<this.defaultTld.length){let d=this.defaultTld.substring(p.length);if(d.includes("_"))return{full:i,remaining:d,matchedDomain:null,isHintOnly:!0}}return{full:i,remaining:"",matchedDomain:null,isHintOnly:!1}}};var mt=10,$=class extends E{engine;currentSuggestion={full:"",remaining:"",matchedDomain:null};currentSuggestionIndex=0;hadInitialAriaAutocomplete=!1;wasAriaAutocompleteSet=!1;isSuggestionDismissed=!1;isNotifying=!1;hasPendingNotification=!1;wasAutocorrectSet=!1;wasAutocapitalizeSet=!1;wasSpellcheckSet=!1;wasInputModeInferred=!1;isComposing=!1;lastNotifiedValue="";srStatusEl=null;srAnnounceTimerId=null;lastAnnouncedSuggestion="";cutTimerId=null;resetTimerId=null;constructor(t,e,i){let n=O(t,e,i),s=n.wrapper,r=n.input,a=n.options,o=s?.getAttribute("data-mask-cycle-suggestions")==="true"||r?.getAttribute("data-mask-cycle-suggestions")==="true",l=s?.getAttribute("data-mask-auto-lowercase")==="true"||r?.getAttribute("data-mask-auto-lowercase")==="true",h=s?.getAttribute("data-mask-aria-autocomplete")??r?.getAttribute("data-mask-aria-autocomplete"),p=a.setAriaAutocomplete??(h!==null?h!=="false":!0),u=s?.getAttribute("data-mask-tlds")??r?.getAttribute("data-mask-tlds"),c=a.tlds??(u?u.split(",").map(m=>m.trim()).filter(Boolean):void 0),d=s?.getAttribute("data-mask-default-tld")??r?.getAttribute("data-mask-default-tld"),y=a.defaultTld!==void 0?a.defaultTld:d!==null?d==="false"||d==="none"?null:d==="true"?!0:d:void 0,f={completeOnTab:!0,completeOnArrowRight:!0,completeOnEnter:!0,cycleSuggestions:a.cycleSuggestions??o??!1,autoLowercase:a.autoLowercase??l??!1,setAriaAutocomplete:p,...a,...c!==void 0?{tlds:c}:{},...y!==void 0?{defaultTld:y}:{}};super(s,r,f),this.input.hasAttribute("inputmode")||(this.input.inputMode="email",this.wasInputModeInferred=!0),this.input.hasAttribute("autocorrect")||(this.input.setAttribute("autocorrect","off"),this.wasAutocorrectSet=!0),this.input.hasAttribute("autocapitalize")||(this.input.setAttribute("autocapitalize","none"),this.wasAutocapitalizeSet=!0),this.input.hasAttribute("spellcheck")||(this.input.setAttribute("spellcheck","false"),this.wasSpellcheckSet=!0),this.hadInitialAriaAutocomplete=this.input.hasAttribute("aria-autocomplete"),this.syncAriaAutocomplete(),this.engine=new K(this.options),this.lastNotifiedValue=this.isSensitiveField()?"":this.input.value,this.bindEvents(),!this.options.disabled&&!this.isSensitiveField()&&this.updateSuggestion(),this.runAuditWarning(this.options.audit)}syncAriaAutocomplete(){let t=!!(this.options.setAriaAutocomplete&&!this.options.disabled&&!this.isSensitiveField()&&!this.isDestroyed);this.hadInitialAriaAutocomplete||(t?this.input.hasAttribute("aria-autocomplete")||(this.input.setAttribute("aria-autocomplete","inline"),this.wasAriaAutocompleteSet=!0):this.wasAriaAutocompleteSet&&(this.input.getAttribute("aria-autocomplete")==="inline"&&this.input.removeAttribute("aria-autocomplete"),this.wasAriaAutocompleteSet=!1));let e=this.input.ownerDocument||(typeof document<"u"?document:null),i=!!(e&&typeof e.ariaNotify=="function");t&&!i?this.ensureSrStatusEl():!t&&this.srStatusEl&&(this.srStatusEl.remove(),this.srStatusEl=null)}onPasswordModeDetected(){this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.lastNotifiedValue="",this.lastTrackedValue="",this.lastAnnouncedSuggestion="",this.currentSuggestion={full:"",remaining:"",matchedDomain:null},this.syncAriaAutocomplete(),this.clearGhost()}onNativeValueSet(t){this.options.disabled||this.isComposing||this.isSensitiveField()||(this.isSuggestionDismissed=!1,this.updateSuggestion())}onDisabledChange(t){this.syncAriaAutocomplete(),t||this.isSensitiveField()?(this.currentSuggestion={full:"",remaining:"",matchedDomain:null},this.clearGhost()):(this.isSuggestionDismissed=!1,this.updateSuggestion())}bindEvents(){this.handleInput=this.handleInput.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handlePaste=this.handlePaste.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.isSensitiveField())&&this.updateSuggestion()},0)};let{signal:t}=this.abortController;this.input.addEventListener("input",this.handleInput,{signal:t}),this.input.addEventListener("keydown",this.handleKeyDown,{signal:t}),this.input.addEventListener("paste",this.handlePaste,{signal:t}),this.input.addEventListener("blur",this.handleBlur,{signal:t}),this.input.addEventListener("focus",this.handleFocus,{signal:t}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:t}),this.input.addEventListener("cut",this.onCutHandler,{signal:t}),this.input.addEventListener("compositionstart",()=>{this.isComposing=!0},{signal:t}),this.input.addEventListener("compositionend",()=>{this.isComposing=!1,!this.isDestroyed&&!this.options.disabled&&!this.isSensitiveField()&&this.handleInput()},{signal:t}),this.input.form&&(this.onFormResetHandler=()=>{this.resetTimerId!==null&&clearTimeout(this.resetTimerId),this.resetTimerId=window.setTimeout(()=>{this.resetTimerId=null,!(this.isDestroyed||this.options.disabled||this.isSensitiveField())&&this.updateSuggestion()},0)},this.input.form.addEventListener("reset",this.onFormResetHandler,{signal:t}))}ensureSrStatusEl(){if(this.srStatusEl&&this.wrapper.contains(this.srStatusEl))return this.srStatusEl;let t=this.input.ownerDocument||(typeof document<"u"?document:null);if(!t)return null;let e=t.createElement("span");return e.className="wulf-mask-sr-status",e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),this.wrapper.appendChild(e),this.srStatusEl=e,e}scheduleSuggestionAnnouncement(t=!1){if(this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),!this.options.setAriaAutocomplete||!this.isFocused||this.isDestroyed||this.isSensitiveField())return;let e=this.currentSuggestion;if(!e.remaining||e.isHintOnly){this.lastAnnouncedSuggestion="",this.srStatusEl&&(this.srStatusEl.textContent="");return}let i=e.full;if(i===this.lastAnnouncedSuggestion&&!t)return;let n=()=>{if(this.srAnnounceTimerId=null,this.isDestroyed||!this.isFocused||this.isSensitiveField())return;this.lastAnnouncedSuggestion=i;let r=this.input.ownerDocument||(typeof document<"u"?document:null);if(r&&typeof r.ariaNotify=="function")try{r.ariaNotify(i,{priority:"normal"});return}catch{}let a=this.ensureSrStatusEl();a&&(a.textContent=a.textContent===i?`${i}\xA0`:i)};t?n():this.srAnnounceTimerId=window.setTimeout(n,250)}updateSuggestion(t){if(this.options.disabled||this.isSensitiveField()){this.currentSuggestion={full:"",remaining:"",matchedDomain:null},this.clearGhost();return}let e=this.input.value;if(this.currentSuggestion=this.isSuggestionDismissed?{full:e,remaining:"",matchedDomain:null}:this.engine.getSuggestion(e,this.currentSuggestionIndex),!!this.ghost){if(this.shouldHideGhostForPlaceholder(e.length===0))this.clearGhost();else if(this.currentSuggestion.remaining){let i=this.input.ownerDocument||document,n=i.createElement("span");n.className="mask-ghost-typed",n.textContent=e;let s=i.createElement("span");s.className="mask-ghost-remaining",s.textContent=this.currentSuggestion.remaining,this.setGhostContent(n,s)}else this.clearGhost();this.ghost.scrollLeft=this.input.scrollLeft,t?.announce&&this.scheduleSuggestionAnnouncement(!!t.immediate),this.notifyValueChange()}}notifyValueChange(){if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let t=0;do{t++,this.hasPendingNotification=!1;let e=this.isSensitiveField(),i=!e,n=this.input.value,s=this.getDetail();this.options.onInput&&this.options.onInput(s),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:i,detail:s})),n!==this.lastNotifiedValue&&(this.lastNotifiedValue=e?"":n,this.dispatchNativeInput())}while(this.hasPendingNotification&&t<mt)}finally{this.isNotifying=!1}}handleInput(t){if(!this.isDispatchingNativeInput&&!(this.options.disabled||this.isSensitiveField())&&!(this.isComposing||t&&"isComposing"in t&&t.isComposing)){if(this.options.autoLowercase){let e=this.input.selectionStart??0,i=this.input.selectionEnd??e,n=this.input.value.toLowerCase();n!==this.input.value&&(this.setNativeValue(n),this.input.setSelectionRange(e,i))}this.isSuggestionDismissed=!1,this.currentSuggestionIndex=0,this.updateSuggestion({announce:!0,immediate:!1})}}handlePaste(t){if(this.options.disabled||this.isSensitiveField())return;let e=this.getClipboardPlainText(t),i=this.preparePastedText(e,512);if(i===e)return;t.preventDefault();let n=this.input.selectionStart??this.input.value.length,s=this.input.selectionEnd??n,r=this.input.value.slice(0,n),a=this.input.value.slice(s),o=r+i+a,l=this.options.autoLowercase?o.toLowerCase():o;if(typeof document<"u"&&Y(this.input.ownerDocument)===this.input&&typeof document.execCommand=="function")try{if(document.execCommand("insertText",!1,i)&&this.input.value===l)return}catch{}this.setNativeValue(o);let h=n+i.length;this.input.setSelectionRange(h,h),this.handleInput()}handleKeyDown(t){if(this.options.disabled||this.isSensitiveField()||F(t)||t.shiftKey||t.ctrlKey||t.altKey||t.metaKey)return;let e=!!this.currentSuggestion.remaining&&!this.currentSuggestion.isHintOnly,n=(this.input.selectionStart??0)===this.input.value.length,s=this.input.value.length>0;if(t.key==="Escape"&&e){t.preventDefault(),this.isSuggestionDismissed=!0,this.currentSuggestion={full:this.input.value,remaining:"",matchedDomain:null},this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.lastAnnouncedSuggestion="",this.srStatusEl&&(this.srStatusEl.textContent=""),this.clearGhost();return}if(this.options.cycleSuggestions&&e&&s&&n){if(t.key==="ArrowDown"){t.preventDefault(),this.currentSuggestionIndex++,this.updateSuggestion({announce:!0,immediate:!0});return}if(t.key==="ArrowUp"){t.preventDefault(),this.currentSuggestionIndex--,this.updateSuggestion({announce:!0,immediate:!0});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&&n&&this.options.completeOnArrowRight){t.preventDefault(),this.acceptSuggestion();return}}acceptSuggestion(){if(!this.currentSuggestion.remaining||this.currentSuggestion.isHintOnly||this.options.disabled||this.isSensitiveField()||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();this.options.onChange&&this.options.onChange(e);let i=!this.isSensitiveField();return this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:i,detail:e})),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:i,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.isSuggestionDismissed=!1,this.syncGhostStyles(),this.updateSuggestion()}handleBlur(){if(this.wrapper.classList.remove("is-focused"),this.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.lastAnnouncedSuggestion="",this.srStatusEl&&(this.srStatusEl.textContent=""),this.isSensitiveField()){this.lastNotifiedValue="",this.lastTrackedValue="",this.clearGhost();return}this.updateSuggestion();let t=this.getDetail();this.options.onChange&&this.options.onChange(t),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:!this.isSensitiveField(),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(i=>i.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.isSuggestionDismissed=!1,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.srAnnounceTimerId!==null&&(clearTimeout(this.srAnnounceTimerId),this.srAnnounceTimerId=null),this.srStatusEl&&(this.srStatusEl.remove(),this.srStatusEl=null),this.lastNotifiedValue="",this.lastAnnouncedSuggestion="",this.wasInputModeInferred&&this.input.getAttribute("inputmode")==="email"&&this.input.removeAttribute("inputmode"),this.wasAriaAutocompleteSet&&this.input.getAttribute("aria-autocomplete")==="inline"&&this.input.removeAttribute("aria-autocomplete"),this.wasAutocorrectSet&&this.input.getAttribute("autocorrect")==="off"&&this.input.removeAttribute("autocorrect"),this.wasAutocapitalizeSet&&this.input.getAttribute("autocapitalize")==="none"&&this.input.removeAttribute("autocapitalize"),this.wasSpellcheckSet&&this.input.getAttribute("spellcheck")==="false"&&this.input.removeAttribute("spellcheck"),super.destroy())}};var _={iso:{format:"YYYY-MM-DD HH:mm:ss"},"iso-t":{format:"YYYY-MM-DD\\THH:mm:ss"},fr:{format:"DD/MM/YYYY HH:mm",placeholderTokens:{DD:"jj",MM:"mm",YYYY:"aaaa",HH:"hh",mm:"mm"}},"fr-sec":{format:"DD/MM/YYYY HH:mm:ss",placeholderTokens:{DD:"jj",MM:"mm",YYYY:"aaaa",HH:"hh",mm:"mm",ss:"ss"}},us:{format:"MM/DD/YYYY HH:mm"},"us-12h":{format:"MM/DD/YYYY hh:mm A"},uk:{format:"DD/MM/YYYY HH:mm"},no:{format:"DD/MM-YYYY HH:mm"},cz:{format:"DD. MM. YYYY HH:mm"},de:{format:"DD.MM.YYYY HH:mm"},jp:{format:"YYYY/MM/DD HH:mm"}},J={YYYY:"YYYY",MM:"MM",DD:"DD",HH:"HH",hh:"hh",mm:"mm",ss:"ss",A:"AM"},bt=[{token:"YYYY",length:4},{token:"MM",length:2},{token:"DD",length:2},{token:"HH",length:2},{token:"hh",length:2},{token:"mm",length:2},{token:"ss",length:2},{token:"A",length:2}],vt=128,z=512,yt=new Set(["/","-",".",":"," ","T","t"]),rt=new Set(["HH","hh","mm","ss","A"]);function T(g){return g>="0"&&g<="9"}function M(g){let t=0;for(let e=0;e<g.length;e++){let i=g.charCodeAt(e);if(i<48||i>57)return NaN;t=t*10+(i-48)}return g.length>0?t:NaN}function St(g,t,e){let i=Array.from(g||e),n=Array.from(e);for(;i.length<t;)i.push(n[i.length]||n[n.length-1]||"_");return i.slice(0,t).join("")}var H=class g{formatSpec="YYYY-MM-DD HH:mm";customPlaceholders={};slots=[];segments=[];fullTemplate="";prefixSlotsCount=0;prefixString="";editableCount=0;hasMeridiemFlag=!1;utcIndicator=" UTC";includeMilliseconds=!1;convertPastedOffset=!0;defaultTimeOnDateOnly=!1;minTs=null;maxTs=null;constructor(t={}){this.updateOptions(t)}static format(t,e={}){return new g(e).formatFromValue(t)}updateOptions(t={}){t.utcIndicator!==void 0&&(this.utcIndicator=t.utcIndicator===!1?!1:String(t.utcIndicator).slice(0,32)),t.includeMilliseconds!==void 0&&(this.includeMilliseconds=!!t.includeMilliseconds),t.convertPastedOffset!==void 0&&(this.convertPastedOffset=t.convertPastedOffset!==!1),t.defaultTimeOnDateOnly!==void 0&&(this.defaultTimeOnDateOnly=t.defaultTimeOnDateOnly),t.min!==void 0&&(this.minTs=this.normalizeBoundary(t.min)),t.max!==void 0&&(this.maxTs=this.normalizeBoundary(t.max)),t.placeholderTokens!==void 0&&(this.customPlaceholders=t.placeholderTokens||{}),(t.format!==void 0||this.slots.length===0)&&this.compile(t.format??this.formatSpec,t.placeholderTokens)}setFormat(t,e){e!==void 0&&(this.customPlaceholders=e),this.compile(t,this.customPlaceholders)}setUtcIndicator(t){this.utcIndicator=t===!1?!1:String(t).slice(0,32)}getUtcIndicator(){return this.utcIndicator}getFormat(){return this.formatSpec}getFullTemplate(){return this.fullTemplate}getGhostRemaining(t){let e=this.utcIndicator?this.utcIndicator:"";return t.length>=this.fullTemplate.length?e:this.fullTemplate.slice(t.length)+e}getPrefix(){return this.prefixString}getPrefixLength(){return this.prefixSlotsCount}getEditableCount(){return this.editableCount}hasMeridiem(){return this.hasMeridiemFlag}isNumericOnly(){return!this.hasMeridiemFlag}getSegments(){return this.segments}getSlots(){return this.slots}isSeparatorAt(t){return t>=0&&t<this.slots.length&&this.slots[t].isStatic}getNextEditablePosition(t){let e=Math.max(0,t);for(let i=e;i<this.slots.length;i++)if(!this.slots[i].isStatic)return i;return this.slots.length}compile(t,e){let i=String(t||"YYYY-MM-DD HH:mm").trim().slice(0,vt)||"YYYY-MM-DD HH:mm";this.formatSpec=i;let n=Object.hasOwn(_,i)?_[i]:null,s=n?n.format:i,r=Object.create(null);if(n?.placeholderTokens)for(let[p,u]of Object.entries(n.placeholderTokens))Object.hasOwn(J,p)&&typeof u=="string"&&(r[p]=u);let a=e!==void 0?e:this.customPlaceholders;if(a&&typeof a=="object")for(let[p,u]of Object.entries(a))Object.hasOwn(J,p)&&typeof u=="string"&&(r[p]=u);this.slots=[],this.segments=[],this.hasMeridiemFlag=!1;let o="",l=!0,h=0;for(;h<s.length;){let p=s[h];if(p==="\\"&&h+1<s.length){let c=s[h+1];this.slots.push({char:c,isStatic:!0,isPrefix:l,segmentIndex:-1,charIndexInSegment:-1,placeholder:c}),o+=c,h+=2;continue}let u=null;for(let c of bt)if(s.startsWith(c.token,h)){u=c;break}if(u){l=!1;let{token:c,length:d}=u;c==="A"&&(this.hasMeridiemFlag=!0);let y=r[c]??J[c],f=St(y,d,J[c]),m=Array.from(f),b=this.segments.length,v=this.slots.length;for(let k=0;k<d;k++)this.slots.push({char:c==="A"?"A":"9",isStatic:!1,isPrefix:!1,segmentIndex:b,charIndexInSegment:k,tokenKind:c,placeholder:m[k]||"_"});this.segments.push({kind:c,start:v,end:v+d,length:d,placeholder:f,followingSeparator:""}),o+=f,h+=c.length}else this.slots.push({char:p,isStatic:!0,isPrefix:l,segmentIndex:-1,charIndexInSegment:-1,placeholder:p}),o+=p,h++}this.fullTemplate=o,this.editableCount=this.slots.filter(p=>!p.isStatic).length,this.prefixSlotsCount=0,this.prefixString="";for(let p of this.slots)if(p.isPrefix)this.prefixSlotsCount++,this.prefixString+=p.char;else break;for(let p=0;p<this.segments.length;p++){let u=this.segments[p],c="";for(let d=u.end;d<this.slots.length&&this.slots[d].isStatic;d++)c+=this.slots[d].char;u.followingSeparator=c}}extractRaw(t,e=!1){let i=String(t??"").slice(0,z);if(!i||this.slots.length===0)return"";let n="",s=0,r=0;if(this.prefixSlotsCount>0){for(;s<i.length&&(i[s]===" "||i[s]===" ");)s++;let a=0;for(;s<i.length&&a<this.prefixSlotsCount;){let o=this.slots[a].char,l=i[s];if(l.toUpperCase()===o.toUpperCase())s++,a++;else if(o===" "&&l!==" ")a++;else break}r=this.prefixSlotsCount}for(;s<i.length&&r<this.slots.length;){let a=this.slots[r],o=i[s];if(a.isStatic){o.toUpperCase()===a.char.toUpperCase()&&s++,r++;continue}if(a.tokenKind==="A"){let l=o.toUpperCase();a.charIndexInSegment===0?l==="A"||l==="P"?(n+=l,s++,r++,(s<i.length?i[s].toUpperCase():"")==="M"?(n+="M",s++,r++):e&&(n+="M",r++)):s++:l==="M"?(n+="M",s++,r++):e?(n+="M",r++):s++;continue}T(o)?(n+=o,s++,r++):s++}return n}format(t,e=!1){if(this.slots.length===0)return String(t??"").slice(0,z);let i=this.extractRaw(t,e);if(i.length===0)return this.prefixString;let n="",s=0;for(let r=0;r<this.slots.length;r++){let a=this.slots[r];if(a.isStatic){let o=s<i.length,l=s===0&&a.isPrefix,h=s>0&&s===i.length;if(o||l||h)n+=a.char;else break}else if(s<i.length)n+=i[s],s++;else break}return n}analyze(t,e=!1){let i=this.extractRaw(t,e),n=this.formatFromCleanRaw(i),s=this.editableCount,r=i.length,a=s>0&&r>=s,o=this.extractSegmentValues(i),l=o.parts,h=null,p=null,u=null,c=!1;if(a&&o.allSegmentsPresent){let d=this.resolveHour24(o);if(d!==null){let y={year:l.year,month:l.month,day:l.day,hour:d,minute:l.minute??0,second:l.second??0},f=this.buildStrictUTCDate(y);if(f){let m=f.getTime(),b=this.minTs===null||m>=this.minTs,v=this.maxTs===null||m<=this.maxTs;b&&v&&(h=f,u=m,p=this.formatDateToISO(f),c=!0)}}}return{formatted:n,rawValue:p||"",isoString:p,date:h,timestamp:u,parts:l,isComplete:a,isValid:c,totalSlots:s,filledSlots:r}}mapCursorPosition(t,e,i){let n=this.prefixSlotsCount,s=String(t??""),r=String(i??"");if(e<=0||!r)return n;let o=this.extractRaw(s.slice(0,e),!1).length;if(o===0)return Math.max(n,Math.min(this.getNextEditablePosition(0),r.length));let l=0,h=r.length;for(let p=0;p<r.length&&p<this.slots.length;p++)if(!this.slots[p].isStatic&&(l++,l===o)){h=p+1;break}for(;h<r.length&&this.slots[h]&&this.slots[h].isStatic;)h++;return Math.max(n,Math.min(h,r.length))}tryHandleSeparatorKey(t,e,i){let n={handled:!1,formatted:t,cursor:e};if(!i||i.length!==1)return n;if(e<this.slots.length&&this.slots[e].isStatic&&this.separatorMatchesKey(this.slots[e].char,i)){let o=this.getNextEditablePosition(e+1),l=this.format(t);return{handled:!0,formatted:l,cursor:Math.min(o,l.length)}}if(e>this.prefixSlotsCount&&e-1<this.slots.length&&this.slots[e-1].isStatic){let o=e-1;for(;o>=this.prefixSlotsCount&&this.slots[o].isStatic;){if(this.separatorMatchesKey(this.slots[o].char,i)){let l=this.getNextEditablePosition(o+1),h=this.format(t);return{handled:!0,formatted:h,cursor:Math.min(l,h.length)}}o--}}let s=-1;for(let o=0;o<this.segments.length;o++){let l=this.segments[o];if(e>=l.start&&e<=l.end){s=o;break}}if(s===-1)return n;let r=this.segments[s];if(!r.followingSeparator||!this.followingSeparatorMatchesKey(r.followingSeparator,i))return n;let a=t.slice(r.start,Math.min(e,r.end)).replace(/\D/g,"");if(r.kind!=="YYYY"&&r.kind!=="A"&&a.length>0&&a.length<r.length){let o="0".repeat(r.length-a.length)+a,l=t.slice(Math.min(t.length,r.end)),h=t.slice(0,r.start)+o+r.followingSeparator+l,p=this.format(h),u=this.getNextEditablePosition(r.end);return{handled:!0,formatted:p,cursor:Math.min(u,p.length)}}if(e===r.end){let o=this.format(t),l=this.getNextEditablePosition(r.end);return{handled:!0,formatted:o,cursor:Math.min(l,o.length)}}return n}formatFromValue(t){if(t==null)return this.prefixString;if(t instanceof Date)return Number.isNaN(t.getTime())?this.prefixString:this.formatPartsToTemplate(this.dateToUTCParts(t));if(typeof t=="number"){if(!Number.isFinite(t))return this.prefixString;let n=new Date(t);return Number.isNaN(n.getTime())?this.prefixString:this.formatPartsToTemplate(this.dateToUTCParts(n))}let e=String(t).slice(0,z).trim();if(!e)return this.prefixString;let i=this.parsePasted(e);return i.matched?i.formatted:i.rejected?this.prefixString:this.format(e,!0)}formatFromNativeValue(t){let e=String(t??"").slice(0,z);if(!e)return this.prefixString;let i=e.trim();if(i.length>=16){let n=this.parseISO8601Linear(i);if(n&&!n.dateOnly){let s=this.parsePasted(i);if(s.matched)return s.formatted}}return this.format(e,!1)}parsePasted(t){let e={matched:!1,formatted:"",cursor:0},i={matched:!1,rejected:!0,formatted:"",cursor:0},n=String(t??"").slice(0,z).trim();if(!n||this.segments.length===0)return e;let s=n.length>=10&&T(n[0])&&T(n[1])&&T(n[2])&&T(n[3])&&n[4]==="-"&&T(n[5])&&T(n[6])&&n[7]==="-"&&T(n[8])&&T(n[9]),r=this.parseISO8601Linear(n);if(r){if(r.dateOnly)return this.formatDateOnlyMatch({year:r.year,month:r.month,day:r.day},i);if(r.offsetMinutes!==null&&r.offsetMinutes!==0&&!this.convertPastedOffset)return i;let a=this.buildStrictUTCDate({year:r.year,month:r.month,day:r.day,hour:r.hour,minute:r.minute,second:r.second});if(!a)return i;let o=a,l;if(r.offsetMinutes!==null&&r.offsetMinutes!==0){let p=a.getTime()-r.offsetMinutes*6e4;if(o=new Date(p),Number.isNaN(o.getTime()))return i;l={original:n,offsetMinutes:r.offsetMinutes,utcIso:this.formatDateToISO(o)}}let h=this.formatPartsToTemplate(this.dateToUTCParts(o));return{matched:!0,formatted:h,cursor:h.length,offsetConverted:l}}return s&&n.length>10&&(n[10]==="T"||n[10]==="t"||this.segments[0]?.kind!=="YYYY")?i:this.parseConfiguredFormatLinear(n)}formatLocal(t,e,i){if(!t||Number.isNaN(t.getTime()))return null;try{let n=i||{dateStyle:"short",timeStyle:"medium"};return new Intl.DateTimeFormat(e,n).format(t)}catch{return null}}normalizeBoundary(t){if(t==null)return null;if(t instanceof Date){let s=t.getTime();return Number.isNaN(s)?null:s}if(typeof t=="number")return Number.isFinite(t)?t:null;let e=String(t).slice(0,z).trim();if(!e)return null;let i=this.parseISO8601Linear(e);if(i){let s=this.buildStrictUTCDate({year:i.year,month:i.month,day:i.day,hour:i.hour,minute:i.minute,second:i.second});if(!s)return null;let r=i.offsetMinutes?i.offsetMinutes*6e4:0;return s.getTime()-r}return this.analyze(e,!0).timestamp}separatorMatchesKey(t,e){return t===e||(t==="T"||t==="t")&&(e==="T"||e==="t"||e===" ")}followingSeparatorMatchesKey(t,e){let i=!1;for(let n=0;n<t.length;n++)if(t[n]!==" "){i=!0;break}for(let n=0;n<t.length;n++){let s=t[n];if(!(i&&s===" ")&&this.separatorMatchesKey(s,e))return!0}return!1}formatFromCleanRaw(t){if(this.slots.length===0)return"";if(t.length===0)return this.prefixString;let e="",i=0;for(let n=0;n<this.slots.length;n++){let s=this.slots[n];if(s.isStatic){let r=i<t.length,a=i===0&&s.isPrefix,o=i>0&&i===t.length;if(r||a||o)e+=s.char;else break}else if(i<t.length)e+=t[i],i++;else break}return e}extractSegmentValues(t){let e={},i,n,s=0,r=!0;for(let a of this.segments){if(s+a.length>t.length){r=!1;break}let o=t.slice(s,s+a.length);switch(s+=a.length,a.kind){case"YYYY":e.year=M(o);break;case"MM":e.month=M(o);break;case"DD":e.day=M(o);break;case"HH":e.hour=M(o);break;case"hh":i=M(o);break;case"mm":e.minute=M(o);break;case"ss":e.second=M(o);break;case"A":o==="AM"||o==="PM"?n=o:r=!1;break}}if((e.year===void 0||e.month===void 0||e.day===void 0)&&(r=!1),e.hour===void 0&&i===void 0&&(r=!1),r&&i!==void 0){let a=this.resolveHour24({parts:e,hour12:i,meridiem:n});a!==null&&(e.hour=a)}return{parts:e,hour12:i,meridiem:n,allSegmentsPresent:r}}resolveHour24(t){if(t.hour12!==void 0){let e=t.hour12;return e<1||e>12||!t.meridiem?null:t.meridiem==="AM"?e===12?0:e:e===12?12:e+12}return t.parts.hour!==void 0&&t.parts.hour>=0&&t.parts.hour<=23?t.parts.hour:null}buildStrictUTCDate(t){let{year:e,month:i,day:n,hour:s,minute:r,second:a}=t;if(!Number.isInteger(e)||e<1||e>9999||!Number.isInteger(i)||i<1||i>12||!Number.isInteger(n)||n<1||n>31||!Number.isInteger(s)||s<0||s>23||!Number.isInteger(r)||r<0||r>59||!Number.isInteger(a)||a<0||a>59)return null;let o=new Date(0);return o.setUTCFullYear(e,i-1,n),o.setUTCHours(s,r,a,0),o.getUTCFullYear()!==e||o.getUTCMonth()!==i-1||o.getUTCDate()!==n||o.getUTCHours()!==s||o.getUTCMinutes()!==r||o.getUTCSeconds()!==a?null:o}dateToUTCParts(t){return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds()}}formatDateToISO(t){let e=String(t.getUTCFullYear()).padStart(4,"0"),i=String(t.getUTCMonth()+1).padStart(2,"0"),n=String(t.getUTCDate()).padStart(2,"0"),s=String(t.getUTCHours()).padStart(2,"0"),r=String(t.getUTCMinutes()).padStart(2,"0"),a=String(t.getUTCSeconds()).padStart(2,"0");if(this.includeMilliseconds){let o=String(t.getUTCMilliseconds()).padStart(3,"0");return`${e}-${i}-${n}T${s}:${r}:${a}.${o}Z`}return`${e}-${i}-${n}T${s}:${r}:${a}Z`}formatPartsToTemplate(t){let e="";for(let i of this.segments)switch(i.kind){case"YYYY":e+=String(t.year).padStart(4,"0").slice(-4);break;case"MM":e+=String(t.month).padStart(2,"0");break;case"DD":e+=String(t.day).padStart(2,"0");break;case"HH":e+=String(t.hour).padStart(2,"0");break;case"hh":{let n=t.hour%12===0?12:t.hour%12;e+=String(n).padStart(2,"0");break}case"mm":e+=String(t.minute).padStart(2,"0");break;case"ss":e+=String(t.second).padStart(2,"0");break;case"A":e+=t.hour>=12?"PM":"AM";break}return this.formatFromCleanRaw(e)}formatDateOnlyMatch(t,e){if(!this.buildStrictUTCDate({year:t.year,month:t.month,day:t.day,hour:0,minute:0,second:0}))return e;if(typeof this.defaultTimeOnDateOnly=="string"&&this.defaultTimeOnDateOnly.trim()){let r=this.parseDefaultTime(this.defaultTimeOnDateOnly.trim());if(r){let a=this.formatPartsToTemplate({...t,hour:r.hour,minute:r.minute,second:r.second});return{matched:!0,formatted:a,cursor:a.length}}}let n="";for(let r of this.segments){if(rt.has(r.kind))break;r.kind==="YYYY"?n+=String(t.year).padStart(4,"0"):r.kind==="MM"?n+=String(t.month).padStart(2,"0"):r.kind==="DD"&&(n+=String(t.day).padStart(2,"0"))}if(!n)return e;let s=this.formatFromCleanRaw(n);return{matched:!0,formatted:s,cursor:s.length}}parseDefaultTime(t){let e=t.split(":");if(e.length<2||e.length>3)return null;let i=M(e[0]),n=M(e[1]),s=e.length===3?M(e[2]):0;return Number.isNaN(i)||i<0||i>23||Number.isNaN(n)||n<0||n>59||Number.isNaN(s)||s<0||s>59?null:{hour:i,minute:n,second:s}}parseISO8601Linear(t){if(t.length<10)return null;for(let h of[0,1,2,3,5,6,8,9])if(!T(t[h]))return null;if(t[4]!=="-"||t[7]!=="-")return null;let e=M(t.slice(0,4)),i=M(t.slice(5,7)),n=M(t.slice(8,10));if(t.length===10)return{year:e,month:i,day:n,hour:0,minute:0,second:0,dateOnly:!0,offsetMinutes:null};let s=10;if(t[s]!=="T"&&t[s]!=="t"&&t[s]!==" "||(s++,s+5>t.length)||!T(t[s])||!T(t[s+1])||t[s+2]!==":"||!T(t[s+3])||!T(t[s+4]))return null;let r=M(t.slice(s,s+2)),a=M(t.slice(s+3,s+5));s+=5;let o=0;if(s<t.length&&t[s]===":"){if(s++,s+2>t.length||!T(t[s])||!T(t[s+1]))return null;o=M(t.slice(s,s+2)),s+=2}if(s<t.length&&t[s]==="."){s++;let h=s;for(;s<t.length&&T(t[s]);)s++;if(s===h)return null}let l=null;if(s<t.length){for(;s<t.length&&t[s]===" ";)s++;if(s<t.length){let h=t[s];if(h==="Z"||h==="z")l=0,s++;else if(h==="+"||h==="-"){let p=h==="-"?-1:1;if(s++,s+2>t.length||!T(t[s])||!T(t[s+1]))return null;let u=M(t.slice(s,s+2));s+=2;let c=0;if(s<t.length){if(t[s]===":"&&s++,s+2>t.length||!T(t[s])||!T(t[s+1]))return null;c=M(t.slice(s,s+2)),s+=2}if(u>14||c>59||u===14&&c!==0)return null;l=p*(u*60+c)}else if(t.slice(s).toUpperCase()==="UTC")l=0,s=t.length;else return null}}return s!==t.length?null:{year:e,month:i,day:n,hour:r,minute:a,second:o,dateOnly:!1,offsetMinutes:l}}parseConfiguredFormatLinear(t){let e={matched:!1,formatted:"",cursor:0},i=t;i.toUpperCase().endsWith(" UTC")?i=i.slice(0,-4).trim():i.length>2&&(i.endsWith("Z")||i.endsWith("z"))&&T(i[i.length-2])&&(i=i.slice(0,-1).trim()),this.prefixString&&i.toLowerCase().startsWith(this.prefixString.trim().toLowerCase())&&(i=i.slice(this.prefixString.trim().length).trim());let n=[],s=-1;for(let c=0;c<i.length;c++){let d=i[c];yt.has(d)?s!==-1&&(n.push(i.slice(s,c)),s=-1):s===-1&&(s=c)}if(s!==-1&&n.push(i.slice(s)),n.length===0||n.length>this.segments.length)return e;let r=0;for(let c of this.segments){if(rt.has(c.kind))break;r++}let a=[],o,l,h;for(let c=0;c<n.length;c++){let d=n[c],y=this.segments[c];if(y.kind==="A"){let f=d.toUpperCase();if(f==="AM"||f==="A")a.push("AM");else if(f==="PM"||f==="P")a.push("PM");else return e;continue}for(let f=0;f<d.length;f++)if(!T(d[f]))return e;if(y.kind==="YYYY"){if(d.length!==4)return e;o=M(d),a.push(d)}else{if(d.length<1||d.length>2)return e;let f=d.length===1?"0"+d:d,m=M(f);y.kind==="MM"&&(l=m),y.kind==="DD"&&(h=m),a.push(f)}}if(n.length===r&&o!==void 0&&l!==void 0&&h!==void 0)return this.formatDateOnlyMatch({year:o,month:l,day:h},e);let p=this.segments.length;if(n.length<p&&!(r>0&&n.length>=r+2&&this.segments[r+1]?.kind==="mm"))return e;let u=this.formatFromCleanRaw(a.join(""));return{matched:!0,formatted:u,cursor:u.length}}};var kt=10,j=class extends E{engine;history;isComposing=!1;isUndoingRedoing=!1;isMouseDown=!1;isApplying=!1;isNotifying=!1;hasPendingNotification=!1;lastValue="";lastValueLength=0;lastInputType="";inferredInputModeValue=null;wasAutocorrectSet=!1;wasAutocapitalizeSet=!1;wasSpellcheckSet=!1;cutTimerId=null;pasteTimerId=null;resetTimerId=null;constructor(t,e,i){let n=O(t,e,i),s=n.wrapper,r=n.input,a=n.options,o=s?.getAttribute("data-mask-format")||r?.getAttribute("data-mask-format")||void 0,l=s?.getAttribute("data-mask-utc-indicator")??r?.getAttribute("data-mask-utc-indicator"),h=s?.getAttribute("data-mask-infer-inputmode")??r?.getAttribute("data-mask-infer-inputmode"),p=a.utcIndicator!==void 0?a.utcIndicator:l!==null?l==="false"||l==="none"?!1:l:" UTC",u={...a,format:a.format??o??"YYYY-MM-DD HH:mm",utcIndicator:p,includeMilliseconds:a.includeMilliseconds??!1,convertPastedOffset:a.convertPastedOffset??!0,defaultTimeOnDateOnly:a.defaultTimeOnDateOnly??!1,inferInputMode:a.inferInputMode??(h!==null?h!=="false":!0),onInput:a.onInput||a.oninput,onChange:a.onChange||a.onchange,onComplete:a.onComplete||a.oncomplete};super(s,r,u),this.history=new P,this.engine=new H(this.options),this.input.hasAttribute("autocorrect")||(this.input.setAttribute("autocorrect","off"),this.wasAutocorrectSet=!0),this.input.hasAttribute("autocapitalize")||(this.input.setAttribute("autocapitalize","none"),this.wasAutocapitalizeSet=!0),this.input.hasAttribute("spellcheck")||(this.input.setAttribute("spellcheck","false"),this.wasSpellcheckSet=!0),this.syncInferredInputMode(),this.bindEvents(),this.lastValue=this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value,this.syncInitialValue(),this.runAuditWarning(this.options.audit)}static format(t,e={}){return H.format(t,e)}getSpecificAuditWarnings(){let t=[],e=[],i=this.checkAriaIdReferences(this.input,"aria-describedby",e,!0),n=!!this.input.getAttribute("placeholder")?.trim(),s=!!this.input.getAttribute("aria-placeholder")?.trim();return!i&&!s&&!this.options.disabled&&(n?t.push(`Indication du format UTC fragile : placeholder seul dispara\xEEt \xE0 la saisie et l'indicateur UTC fant\xF4me est aria-hidden="true" ; d\xE9finissez aria-describedby ou aria-placeholder (WCAG 3.3.2).`):t.push("Indication du format UTC attendu manquante : d\xE9finissez aria-describedby ou aria-placeholder pour informer les technologies d'assistance du format et du r\xE9f\xE9rentiel UTC (WCAG 3.3.2).")),t}extractRawSnippet(t){return t?t===this.input.value&&this.isValid()?this.getRawValue():this.engine.extractRaw(t,!1):""}onPasswordModeDetected(){this.history.clear(),this.lastValue="",this.lastValueLength=0,this.lastTrackedValue="",this.clearGhost()}onNativeValueSet(t){if(this.options.disabled)this.checkValueChange(!1);else{let e=this.engine.formatFromNativeValue(t);this.applyFormatted(e,e.length,!1)}}onDisabledChange(t){if(t)this.wrapper.classList.remove("is-complete","has-selection"),this.clearGhost(),this.checkValueChange(!1);else{let e=this.engine.formatFromValue(this.input.value);this.applyFormatted(e,this.input.selectionStart??e.length,!1)}this.syncInferredInputMode()}handleAttributeMutation(t){if(super.handleAttributeMutation(t),t==="data-mask-format"){let e=this.getAttr("data-mask-format");e&&e!==this.engine.getFormat()&&this.setFormat(e)}else if(t==="data-mask-utc-indicator"){let e=this.getAttr("data-mask-utc-indicator"),i=e===null||e==="false"||e==="none"?!1:e;this.setUtcIndicator(i)}else t==="placeholder"&&this.updateGhost(this.input.value)}bindEvents(){this.onBeforeInput=this.onBeforeInput.bind(this),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.onCutHandler=()=>{this.cutTimerId!==null&&clearTimeout(this.cutTimerId),this.cutTimerId=window.setTimeout(()=>{if(this.cutTimerId=null,!this.isDestroyed)if(this.options.disabled)this.checkValueChange(!1);else{let i=this.input.selectionStart??this.input.value.length;this.applyFormatted(this.input.value,i,!1)}},0)};let t=()=>{this.isDestroyed||this.checkValueChange(!0,!0)},{signal:e}=this.abortController;this.input.addEventListener("beforeinput",this.onBeforeInput,{signal:e}),this.input.addEventListener("input",this.handleInput,{signal:e}),this.input.addEventListener("keydown",this.onKeyDown,{signal:e}),this.input.addEventListener("paste",this.onPaste,{signal:e}),this.input.addEventListener("focus",this.onFocus,{signal:e}),this.input.addEventListener("blur",this.onBlur,{signal:e}),this.input.addEventListener("click",this.onClick,{signal:e}),this.input.addEventListener("keyup",this.onKeyUp,{signal:e}),this.input.addEventListener("select",this.onSelect,{signal:e}),this.input.addEventListener("mousedown",this.onMouseDown,{signal:e}),window.addEventListener("mouseup",this.onMouseUp,{signal:e}),this.input.addEventListener("compositionstart",this.onCompositionStart,{signal:e}),this.input.addEventListener("compositionend",this.onCompositionEnd,{signal:e}),this.input.addEventListener("scroll",this.onScroll,{passive:!0,signal:e}),this.input.addEventListener("cut",this.onCutHandler,{signal:e}),this.input.addEventListener("change",t,{signal:e}),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(!1):this.syncInitialValue())},0)},this.input.form.addEventListener("reset",this.onFormResetHandler,{signal:e}))}syncInferredInputMode(){if(this.options.inferInputMode===!1)return;if(this.options.disabled){this.inferredInputModeValue&&this.input.getAttribute("inputmode")===this.inferredInputModeValue&&this.input.removeAttribute("inputmode"),this.inferredInputModeValue=null;return}let t=this.engine.isNumericOnly()?"numeric":"text",e=this.input.getAttribute("inputmode");(!e||this.inferredInputModeValue===e)&&(this.input.inputMode=t,this.inferredInputModeValue=t)}getDetail(){let t=this.engine.analyze(this.input.value,!1);return{...t,value:this.options.disabled?this.input.value:t.formatted}}getRawValue(){return this.options.disabled?this.input.value:this.getDetail().rawValue}getISOString(){return this.getDetail().isoString}getDate(){return this.getDetail().date}getTimestamp(){return this.getDetail().timestamp}getParts(){return this.getDetail().parts}getTemporalInstant(){let t=this.getTimestamp();if(t===null)return null;let e=globalThis.Temporal;if(e?.Instant&&typeof e.Instant.fromEpochMilliseconds=="function")try{return e.Instant.fromEpochMilliseconds(t)}catch{return null}return null}isComplete(){return this.options.disabled?!0:this.getDetail().isComplete}isValid(){return this.options.disabled?!0:this.getDetail().isValid}setValue(t){if(this.options.disabled){let i=t instanceof Date?Number.isNaN(t.getTime())?"":this.engine.formatDateToISO(t):t!=null?String(t):"";this.setNativeValue(i),this.checkValueChange(!1);return}let e=this.engine.formatFromValue(t);this.applyFormatted(e,e.length,!0)}setNow(){this.setValue(new Date)}formatLocal(t,e){return this.engine.formatLocal(this.getDate(),t,e)}setFormat(t,e){let i=this.getDate();if(this.options.format=t,e!==void 0&&(this.options.placeholderTokens=e),this.engine.setFormat(t,e),this.syncInferredInputMode(),this.options.disabled){this.clearGhost();return}if(i){let n=this.engine.formatFromValue(i);this.applyFormatted(n,n.length,!0)}else{let n=this.engine.format(this.input.value,!1);this.applyFormatted(n,Math.min(this.input.selectionStart??n.length,n.length),!1)}}setUtcIndicator(t){this.options.utcIndicator=t,this.engine.setUtcIndicator(t),this.updateGhost(this.input.value)}undo(){if(this.options.disabled)return;let t=this.history.undo();if(t){this.isUndoingRedoing=!0;try{this.applyFormatted(this.engine.format(t.raw,!1),t.cursor,!0)}finally{this.isUndoingRedoing=!1}}}redo(){if(this.options.disabled)return;let t=this.history.redo();if(t){this.isUndoingRedoing=!0;try{this.applyFormatted(this.engine.format(t.raw,!1),t.cursor,!0)}finally{this.isUndoingRedoing=!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.inferredInputModeValue&&this.input.getAttribute("inputmode")===this.inferredInputModeValue&&this.input.removeAttribute("inputmode"),this.wasAutocorrectSet&&this.input.removeAttribute("autocorrect"),this.wasAutocapitalizeSet&&this.input.removeAttribute("autocapitalize"),this.wasSpellcheckSet&&this.input.removeAttribute("spellcheck"),this.history.clear(),this.lastValue="",this.lastValueLength=0,super.destroy())}checkSelection(){if(this.options.disabled)return;let t=this.input.selectionStart??0,e=this.input.selectionEnd??t;this.wrapper.classList.toggle("has-selection",t!==e)}onBeforeInput(t){if(this.lastInputType=t.inputType||"",!(this.options.disabled||this.isComposing)&&!(t.inputType==="insertFromPaste"||t.inputType==="insertReplacementText")&&t.inputType&&t.inputType.startsWith("insert")){let e=this.engine.getEditableCount();if(e>0){let i=this.engine.extractRaw(this.input.value,!1),n=this.input.selectionStart??0,s=this.input.selectionEnd??n,r=Math.max(0,e-i.length);if(s>n){let a=this.engine.extractRaw(this.input.value.slice(n,s),!1);r=Math.max(0,e-(i.length-a.length))}r<=0&&t.preventDefault()}}}handleInput(t){if(this.isDispatchingNativeInput||this.isComposing)return;if(this.options.disabled){this.checkValueChange(!1);return}let e=t?.inputType||this.lastInputType||"";this.lastInputType="";let i=this.input.value,n=this.input.selectionStart??i.length,s=this.history.getCurrent(),r=this.engine.getEditableCount(),a=e.startsWith("delete")||!this.isSensitiveField()&&i.length<this.lastValueLength,o=this.engine.extractRaw(i,!1);if(r>0&&s&&s.raw.length>=r&&o.length>r){let p=this.engine.format(s.raw,!1);this.applyFormatted(p,s.cursor,!0);return}let l=i,h=!a;if(a&&this.engine.hasMeridiem()){for(let p of this.engine.getSegments())if(p.kind==="A"&&i.length>=p.start+1&&i.length<p.end){l=i.slice(0,p.start)+i.slice(p.start+1),h=!1;break}}this.applyFormatted(l,n,!1,h),this.checkSelection()}onKeyDown(t){if(this.options.disabled||F(t))return;let e=this.input.selectionStart??0,i=this.input.selectionEnd??e,n=this.engine.getPrefixLength();if((t.ctrlKey||t.metaKey)&&(t.key==="z"||t.key==="Z")&&!t.shiftKey){t.preventDefault(),this.undo();return}if((t.ctrlKey||t.metaKey)&&(t.key==="y"||t.key==="Y")||(t.ctrlKey||t.metaKey)&&t.shiftKey&&(t.key==="z"||t.key==="Z")){t.preventDefault(),this.redo();return}this.history.updateCurrentCursor(e);let s=t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey,r=i>e;if(s&&!r){let a=this.engine.tryHandleSeparatorKey(this.input.value,e,t.key);if(a.handled){t.preventDefault(),this.applyFormatted(a.formatted,a.cursor,!0);return}if(this.engine.hasMeridiem()){for(let l of this.engine.getSegments())if(l.kind==="A"&&e>=l.start&&e<=l.end){let h=t.key.toUpperCase();if(h==="A"||h==="P"){t.preventDefault();let p=h==="A"?"AM":"PM",u=this.input.value,c=u.slice(0,l.start)+p+u.slice(Math.min(u.length,l.end));this.applyFormatted(c,l.end,!0);return}}}let o=this.engine.getEditableCount();if(o>0&&this.engine.extractRaw(this.input.value,!1).length>=o){t.preventDefault();return}}if(r){if(t.key==="Backspace"||t.key==="Delete"){t.preventDefault();let a=this.input.value,o=a.slice(0,e)+a.slice(i);this.applyFormatted(o,Math.max(n,e),!1);return}return}if(t.key==="ArrowLeft"&&!t.shiftKey&&e<=n){t.preventDefault(),this.input.setSelectionRange(n,n);return}if(t.key==="Home"&&n>0&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&!t.altKey){t.preventDefault(),this.input.setSelectionRange(n,n);return}if(t.key==="Backspace"&&e<=n){t.preventDefault(),this.input.setSelectionRange(n,n);return}if(t.key==="Delete"&&e<n){t.preventDefault(),this.input.setSelectionRange(n,n);return}if(t.key==="Backspace"&&this.engine.hasMeridiem()){for(let a of this.engine.getSegments())if(a.kind==="A"&&e>a.start&&e<=a.end){t.preventDefault();let o=this.input.value,l=o.slice(0,a.start)+o.slice(Math.min(o.length,a.end));this.applyFormatted(l,a.start,!0);return}}if(t.key==="Backspace"&&(t.ctrlKey||t.altKey||t.metaKey)){if(t.preventDefault(),e<=n){this.input.setSelectionRange(n,n);return}let a=e-1;for(;a>=n&&this.engine.isSeparatorAt(a);)a--;for(;a>=n&&!this.engine.isSeparatorAt(a);)a--;let o=Math.max(n,a+1),l=this.input.value;this.applyFormatted(l.slice(0,o)+l.slice(e),o,!0);return}if(t.key==="Delete"&&(t.ctrlKey||t.altKey||t.metaKey)){t.preventDefault();let a=this.input.value;if(e>=a.length)return;let o=e;for(;o<a.length&&this.engine.isSeparatorAt(o);)o++;for(;o<a.length&&!this.engine.isSeparatorAt(o);)o++;for(;o<a.length&&this.engine.isSeparatorAt(o);)o++;this.applyFormatted(a.slice(0,e)+a.slice(o),e,!0);return}if(t.key==="Backspace"&&e>n&&this.engine.isSeparatorAt(e-1)){t.preventDefault();let a=e-1;for(;a>n&&this.engine.isSeparatorAt(a-1);)a--;if(a>n){let o=this.input.value;this.applyFormatted(o.slice(0,a-1)+o.slice(e),a-1,!1)}else this.applyFormatted("",n,!0);return}if(t.key==="Delete"&&e<this.input.value.length&&this.engine.isSeparatorAt(e)){t.preventDefault();let a=e;for(;a<this.input.value.length&&this.engine.isSeparatorAt(a);)a++;if(a<this.input.value.length){let o=this.input.value;this.applyFormatted(o.slice(0,a)+o.slice(a+1),e,!0)}}}onPaste(t){if(this.options.disabled){this.pasteTimerId!==null&&clearTimeout(this.pasteTimerId),this.pasteTimerId=window.setTimeout(()=>{this.pasteTimerId=null,this.isDestroyed||this.checkValueChange(!1)},0);return}t.preventDefault(),this.history.updateCurrentCursor(this.input.selectionStart??0);let e=this.preparePastedText(this.getClipboardPlainText(t),512);if(!e)return;let i=this.engine.getPrefixLength(),n=this.input.selectionStart??0,s=this.input.selectionEnd??n,r=this.input.value,a=this.engine.getEditableCount(),o=this.engine.extractRaw(r,!1);if(o.length===0||n<=i&&s>=r.length||n===s){let d=this.engine.parsePasted(e);if(d.matched){if(this.applyFormatted(d.formatted,d.cursor,!0),d.offsetConverted&&this.options.onOffsetConverted)try{this.options.onOffsetConverted(d.offsetConverted)}catch{}this.checkSelection();return}if(d.rejected)return}let h=Math.max(0,a-o.length);if(s>n){let d=this.engine.extractRaw(r.slice(n,s),!1);h=Math.max(0,a-(o.length-d.length))}if(h<=0)return;let p=Math.max(i,n),u=Math.max(i,s),c=r.slice(0,p)+e+r.slice(u);this.applyFormatted(c,p+e.length,!1,!0),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(){if(this.wrapper.classList.remove("is-focused","has-selection"),this.isSensitiveField()){this.onPasswordModeDetected();return}this.updateGhost(this.input.value),this.checkValueChange(!1,!0)}onClick(){this.options.disabled||this.enforceMinCursor(),this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onKeyUp(t){this.options.disabled||((t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="Home")&&!t.shiftKey&&this.enforceMinCursor(),this.history.updateCurrentCursor(this.input.selectionStart??0)),this.checkSelection()}onSelect(){this.history.updateCurrentCursor(this.input.selectionStart??0),this.checkSelection()}onMouseDown(){this.isMouseDown=!0}onMouseUp(){this.isMouseDown=!1,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.applyFormatted(this.input.value,t,!1,!0),this.checkSelection()}enforceMinCursor(){let t=this.engine.getPrefixLength();if(t<=0)return;let e=this.input.selectionStart??0,i=this.input.selectionEnd??e;e===i&&e<t&&this.input.setSelectionRange(t,t)}updateGhost(t){if(!this.ghost)return;if(this.options.disabled||this.isSensitiveField()){this.clearGhost();return}let e=!t||t===this.engine.getPrefix();if(this.shouldHideGhostForPlaceholder(e)){this.clearGhost();return}let i=this.engine.getGhostRemaining(t),n=this.input.ownerDocument||document,s=n.createElement("span");s.className="mask-ghost-typed",s.textContent=t;let r=n.createElement("span");r.className="mask-ghost-remaining",r.textContent=i,this.setGhostContent(s,r),this.ghost.scrollLeft=this.input.scrollLeft}applyFormatted(t,e,i=!1,n=!1){if(!(this.options.disabled||this.isApplying)){this.isApplying=!0;try{let s=this.engine.format(t,n),r=this.isSensitiveField();this.setNativeValue(s),r?this.clearGhost():this.updateGhost(s);let a=this.engine.getPrefixLength(),o;i||this.isUndoingRedoing?o=Math.max(a,Math.min(e,s.length)):o=Math.max(a,this.engine.mapCursorPosition(t,e,s)),this.input.setSelectionRange(o,o);let l=this.engine.analyze(s,!1);this.wrapper.classList.toggle("is-complete",l.isComplete),r?(this.options.copyRaw=!1,this.lastValueLength=0,this.history.clear()):(this.lastValueLength=s.length,this.isUndoingRedoing||this.history.push(this.engine.extractRaw(s,!1),o))}finally{this.isApplying=!1}this.checkValueChange(!1)}}syncInitialValue(){let t=this.isSensitiveField();if(this.options.disabled){this.clearGhost(),this.lastValue=t?this.computePasswordDigest(this.input.value):this.input.value,this.lastValueLength=t?0:this.input.value.length,this.checkValueChange(!1);return}this.syncGhostStyles();let e=this.input.value||"";if(e){let i=this.engine.formatFromValue(e);this.applyFormatted(i,i.length,!0)}else{let i=this.engine.getPrefixLength();i>0?this.applyFormatted("",i,!0):(t?this.clearGhost():(this.history.push("",0),this.updateGhost("")),this.checkValueChange(!1))}}checkValueChange(t=!1,e=!1){let i=this.isSensitiveField(),n=this.input.value;if((i?this.computePasswordDigest(n):n)===this.lastValue&&!t&&!this.hasPendingNotification){if(e){let r=!i,a=this.getDetail(),o=this.options.onChange||this.options.onchange;o&&o(a),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:r,detail:a}))}return}if(this.isNotifying){this.hasPendingNotification=!0;return}this.isNotifying=!0;try{let r=0;for(;((this.isSensitiveField()?this.computePasswordDigest(this.input.value):this.input.value)!==this.lastValue||this.hasPendingNotification||t)&&r<kt;){r++,this.hasPendingNotification=!1,t=!1;let a=this.isSensitiveField(),o=!a,l=this.input.value;this.lastValue=a?this.computePasswordDigest(l):l,this.lastValueLength=a?0:l.length;let h=this.getDetail(),p=this.options.onInput||this.options.oninput;if(p&&p(h),this.input.dispatchEvent(new CustomEvent("mask:input",{bubbles:o,detail:h})),this.dispatchNativeInput(),e){let u=this.options.onChange||this.options.onchange;u&&u(h),this.input.dispatchEvent(new CustomEvent("mask:change",{bubbles:o,detail:h}))}if(h.isComplete){let u=this.options.onComplete||this.options.oncomplete;u&&u(h),this.input.dispatchEvent(new CustomEvent("mask:complete",{bubbles:o,detail:h}))}}}finally{this.isNotifying=!1}}};var ot={BaseInputMask:E,InputMask:G,MaskEngine:N,MaskHistory:P,MaskKeyboard:B,AmountEngine:V,InputAmountMask:W,EmailEngine:K,InputEmailMask:$,DateUTCEngine:H,DATE_UTC_PRESETS:_,InputDateUTCMask:j,sanitizePastedText:R,stripBidiAndInvisibles:U},at=st();at&&(at.Mask=ot);var Tt=G;return dt(wt);})();
5
5
  if (typeof window !== "undefined") { var __w = window.Wulf; if (!__w || typeof __w !== "object" || (typeof Node !== "undefined" && __w instanceof Node) || (typeof HTMLCollection !== "undefined" && __w instanceof HTMLCollection)) { __w = {}; window.Wulf = __w; } if (typeof __WulfIIFE !== "undefined" && __WulfIIFE) { for (var k in __WulfIIFE) { if (Object.hasOwn(__WulfIIFE, k) && k !== "__proto__" && k !== "constructor" && k !== "prototype" && __w[k] === undefined) { try { Object.defineProperty(__w, k, { value: __WulfIIFE[k], writable: true, configurable: true, enumerable: true }); } catch (_) { try { __w[k] = __WulfIIFE[k]; } catch (__) {} } } } } }
6
6
  //# sourceMappingURL=mask.global.min.js.map