import {J,c9 as qn,c as tS,aV as ut,jJ as at,aZ as Dt,nH as ko,gP as Ee,hh as ti,cp as Mi,gQ as Se,gR as Y,c5 as bD,ad as ce,eV as Be,eW as Mi$1,gS as Z,by as it,L as w,jM as gr,zF as zt,zG as ti$1,f as QT,dd as kn,cb as Dn,de as Cn,cc as Fn,dV as yn,cB as Kt,nN as Mo,hn as ei,gX as Ji,a0 as ks,a3 as Py,a2 as Uu,cE as py,T as P_,a4 as Sy,ch as My,A as Iw,bu as dy,eU as aM,gU as T$,gY as C$,bv as Vy,bw as y_,bx as v_,gZ as jy,cA as Qi,gF as ay,gG as vc,e5 as Gu,e6 as zu,bz as f_,bk as i_,bm as Bp,bo as $p}from'./main-WUGO6e7n.js';function ge(a,c){if(a&1){let t=i_();ks(0,"TimesIcon",5),Py("click",function(){Bp(t);let e=f_(2);return $p(e.clear())}),Uu();}a&2&&(Sy("styleClass","p-inputmask-clear-icon"),My("data-pc-section","clearIcon"));}function ke(a,c){}function Ce(a,c){a&1&&py(0,ke,0,0,"ng-template");}function ve(a,c){if(a&1){let t=i_();ks(0,"span",6),Py("click",function(){Bp(t);let e=f_(2);return $p(e.clear())}),py(1,Ce,1,0,null,7),Uu();}if(a&2){let t=f_(2);My("data-pc-section","clearIcon"),Iw(),Sy("ngTemplateOutlet",t.clearIconTemplate||t._clearIconTemplate);}}function _e(a,c){if(a&1&&(Gu(0),py(1,ge,1,2,"TimesIcon",3)(2,ve,2,2,"span",4),zu()),a&2){let t=f_();Iw(),Sy("ngIf",!t.clearIconTemplate&&!t._clearIconTemplate),Iw(),Sy("ngIf",t.clearIconTemplate||t._clearIconTemplate);}}var fe,me,ye,be,ne,we,se,He,Ie=J(()=>{qn();qn();tS();tS();ut();at();Dt();ko();Ee();ti();Mi();Se();fe=["clearicon"],me=["input"];ye=({dt:a})=>`
p-inputmask {
    position: relative;
}

.p-inputmask-clear-icon {
    position: absolute;
    top: 50%;
    margin-top: -0.5rem;
    cursor: pointer;
    inset-inline-end: ${a("form.field.padding.x")};
    color: ${a("form.field.icon.color")};
}

p-inputMask.ng-invalid.ng-dirty > .p-inputtext,
p-input-mask.ng-invalid.ng-dirty > .p-inputtext,
p-inputmask.ng-invalid.ng-dirty > .p-inputtext {
    border-color: ${a("inputtext.invalid.border.color")};
}

p-inputMask.ng-invalid.ng-dirty > .p-inputtext:enabled:focus,
p-input-mask.ng-invalid.ng-dirty > .p-inputtext:enabled:focus,
p-inputmask.ng-invalid.ng-dirty > .p-inputtext:enabled:focus {
    border-color: ${a("inputtext.focus.border.color")};
}

p-inputMask.ng-invalid.ng-dirty > .p-inputtext::placeholder,
p-input-mask.ng-invalid.ng-dirty > .p-inputtext::placeholder,
p-inputmask.ng-invalid.ng-dirty > .p-inputtext::placeholder {
    color: ${a("inputtext.invalid.placeholder.color")};
}
`,be={root:({instance:a})=>({"p-inputmask":!0,"p-filled":a.variant?a.variant==="filled":a.config.inputStyle()==="filled"})},ne=(()=>{class a extends Y{name="inputmask";theme=ye;classes=be;static \u0275fac=(()=>{let t;return function(e){return (t||(t=bD(a)))(e||a)}})();static \u0275prov=ce({token:a,factory:a.\u0275fac})}return a})(),we={provide:Be,useExisting:Mi$1(()=>se),multi:!0},se=(()=>{class a extends Z{type="text";slotChar="_";autoClear=!0;showClear=!1;style;inputId;styleClass;placeholder;size;maxlength;tabindex;title;variant;ariaLabel;ariaLabelledBy;ariaRequired;disabled;readonly;unmask;name;required;characterPattern="[A-Za-z]";autofocus;set autoFocus(t){this.autofocus=t,console.log("autoFocus is deprecated. Use autofocus property instead.");}autocomplete;keepBuffer=!1;get mask(){return this._mask}set mask(t){this._mask=t,this.initMask(),this.writeValue(""),this.onModelChange(this.value);}onComplete=new it;onFocus=new it;onBlur=new it;onInput=new it;onKeydown=new it;onClear=new it;clearIconTemplate;templates;inputViewChild;value;_mask;onModelChange=()=>{};onModelTouched=()=>{};input;filled;defs;tests;partialPosition;firstNonMaskPos;lastRequiredNonMaskPos;len;oldVal;buffer;defaultBuffer;focusText;caretTimeoutId;androidChrome=!0;focused;get inputClass(){return this._componentStyle.classes.root({instance:this})}_componentStyle=w(ne);ngOnInit(){if(super.ngOnInit(),gr(this.platformId)){let t=navigator.userAgent;this.androidChrome=/chrome/i.test(t)&&/android/i.test(t);}this.initMask();}_clearIconTemplate;ngAfterContentInit(){this.templates.forEach(t=>{t.getType()==="clearicon"&&(this._clearIconTemplate=t.template);});}initMask(){this.tests=[],this.partialPosition=this.mask.length,this.len=this.mask.length,this.firstNonMaskPos=null,this.defs={9:"[0-9]",a:this.characterPattern,"*":`${this.characterPattern}|[0-9]`};let t=this.mask.split("");for(let i=0;i<t.length;i++){let e=t[i];e=="?"?(this.len--,this.partialPosition=i):this.defs[e]?(this.tests.push(new RegExp(this.defs[e])),this.firstNonMaskPos===null&&(this.firstNonMaskPos=this.tests.length-1),i<this.partialPosition&&(this.lastRequiredNonMaskPos=this.tests.length-1)):this.tests.push(null);}this.buffer=[];for(let i=0;i<t.length;i++){let e=t[i];e!="?"&&(this.defs[e]?this.buffer.push(this.getPlaceholder(i)):this.buffer.push(e));}this.defaultBuffer=this.buffer.join("");}writeValue(t){this.value=t,this.inputViewChild&&this.inputViewChild.nativeElement&&(this.value==null||this.value==null?this.inputViewChild.nativeElement.value="":this.inputViewChild.nativeElement.value=this.value,this.checkVal(),this.focusText=this.inputViewChild.nativeElement.value,this.updateFilledState());}registerOnChange(t){this.onModelChange=t;}registerOnTouched(t){this.onModelTouched=t;}setDisabledState(t){this.disabled=t,this.cd.markForCheck();}caret(t,i){let e,n,s;if(!(!this.inputViewChild?.nativeElement.offsetParent||this.inputViewChild.nativeElement!==this.inputViewChild.nativeElement.ownerDocument.activeElement))if(typeof t=="number")n=t,s=typeof i=="number"?i:n,this.inputViewChild.nativeElement.setSelectionRange?this.inputViewChild.nativeElement.setSelectionRange(n,s):this.inputViewChild.nativeElement.createTextRange&&(e=this.inputViewChild.nativeElement.createTextRange(),e.collapse(!0),e.moveEnd("character",s),e.moveStart("character",n),e.select());else return this.inputViewChild.nativeElement.setSelectionRange?(n=this.inputViewChild.nativeElement.selectionStart,s=this.inputViewChild.nativeElement.selectionEnd):this.document&&this.document.selection.createRange&&(e=this.document.createRange(),n=0-e.duplicate().moveStart("character",-1e5),s=n+e.text.length),{begin:n,end:s}}isCompleted(){let t;for(let i=this.firstNonMaskPos;i<=this.lastRequiredNonMaskPos;i++)if(this.tests[i]&&this.buffer[i]===this.getPlaceholder(i))return !1;return !0}getPlaceholder(t){return t<this.slotChar.length?this.slotChar.charAt(t):this.slotChar.charAt(0)}seekNext(t){for(;++t<this.len&&!this.tests[t];);return t}seekPrev(t){for(;--t>=0&&!this.tests[t];);return t}shiftL(t,i){let e,n;if(!(t<0)){for(e=t,n=this.seekNext(i);e<this.len;e++)if(this.tests[e]){if(n<this.len&&this.tests[e].test(this.buffer[n]))this.buffer[e]=this.buffer[n],this.buffer[n]=this.getPlaceholder(n);else break;n=this.seekNext(n);}this.writeBuffer(),this.caret(Math.max(this.firstNonMaskPos,t));}}shiftR(t){let i,e,n,s;for(i=t,e=this.getPlaceholder(t);i<this.len;i++)if(this.tests[i])if(n=this.seekNext(i),s=this.buffer[i],this.buffer[i]=e,n<this.len&&this.tests[n].test(s))e=s;else break}handleAndroidInput(t){var i=this.inputViewChild?.nativeElement.value,e=this.caret();if(this.oldVal&&this.oldVal.length&&this.oldVal.length>i.length){for(this.checkVal(!0);e.begin>0&&!this.tests[e.begin-1];)e.begin--;if(e.begin===0)for(;e.begin<this.firstNonMaskPos&&!this.tests[e.begin];)e.begin++;setTimeout(()=>{this.caret(e.begin,e.begin),this.updateModel(t),this.isCompleted()&&this.onComplete.emit();},0);}else {for(this.checkVal(!0);e.begin<this.len&&!this.tests[e.begin];)e.begin++;setTimeout(()=>{this.caret(e.begin,e.begin),this.updateModel(t),this.isCompleted()&&this.onComplete.emit();},0);}}onInputBlur(t){if(this.focused=!1,this.onModelTouched(),this.keepBuffer||this.checkVal(),this.updateFilledState(),this.onBlur.emit(t),this.inputViewChild?.nativeElement.value!=this.focusText||this.inputViewChild?.nativeElement.value!=this.value){this.updateModel(t);let i=this.document.createEvent("HTMLEvents");i.initEvent("change",!0,!1),this.inputViewChild?.nativeElement.dispatchEvent(i);}}onInputKeydown(t){if(this.readonly)return;let i=t.which||t.keyCode,e,n,s,l;gr(this.platformId)&&(l=/iphone/i.test(zt())),this.oldVal=this.inputViewChild?.nativeElement.value,this.onKeydown.emit(t),i===8||i===46||l&&i===127?(e=this.caret(),n=e.begin,s=e.end,s-n===0&&(n=i!==46?this.seekPrev(n):s=this.seekNext(n-1),s=i===46?this.seekNext(s):s),this.clearBuffer(n,s),this.keepBuffer?this.shiftL(n,s-2):this.shiftL(n,s-1),this.updateModel(t),this.onInput.emit(t),t.preventDefault()):i===13?(this.onInputBlur(t),this.updateModel(t)):i===27&&(this.inputViewChild.nativeElement.value=this.focusText,this.caret(0,this.checkVal()),this.updateModel(t),t.preventDefault());}onKeyPress(t){if(!this.readonly){var i=t.which||t.keyCode,e=this.caret(),n,s,l,T;t.ctrlKey||t.altKey||t.metaKey||i<32||i>34&&i<41||(i&&i!==13&&(e.end-e.begin!==0&&(this.clearBuffer(e.begin,e.end),this.shiftL(e.begin,e.end-1)),n=this.seekNext(e.begin-1),n<this.len&&(s=String.fromCharCode(i),this.tests[n].test(s)&&(this.shiftR(n),this.buffer[n]=s,this.writeBuffer(),l=this.seekNext(n),ti$1()&&/android/i.test(zt())?setTimeout(()=>{this.caret(l);},0):this.caret(l),e.begin<=this.lastRequiredNonMaskPos&&(T=this.isCompleted()),this.onInput.emit(t))),t.preventDefault()),this.updateModel(t),this.updateFilledState(),T&&this.onComplete.emit());}}clearBuffer(t,i){if(!this.keepBuffer){let e;for(e=t;e<i&&e<this.len;e++)this.tests[e]&&(this.buffer[e]=this.getPlaceholder(e));}}writeBuffer(){this.inputViewChild.nativeElement.value=this.buffer.join("");}checkVal(t){let i=this.inputViewChild?.nativeElement.value,e=-1,n,s,l;for(n=0,l=0;n<this.len;n++)if(this.tests[n]){for(this.buffer[n]=this.getPlaceholder(n);l++<i.length;)if(s=i.charAt(l-1),this.tests[n].test(s)){this.keepBuffer||(this.buffer[n]=s),e=n;break}if(l>i.length){this.clearBuffer(n+1,this.len);break}}else this.buffer[n]===i.charAt(l)&&l++,n<this.partialPosition&&(e=n);return t?this.writeBuffer():e+1<this.partialPosition?this.autoClear||this.buffer.join("")===this.defaultBuffer?(this.inputViewChild?.nativeElement.value&&(this.inputViewChild.nativeElement.value=""),this.clearBuffer(0,this.len)):this.writeBuffer():(this.writeBuffer(),this.inputViewChild.nativeElement.value=this.inputViewChild?.nativeElement.value.substring(0,e+1)),this.partialPosition?n:this.firstNonMaskPos}onInputFocus(t){if(this.readonly)return;this.focused=!0,clearTimeout(this.caretTimeoutId);let i;this.focusText=this.inputViewChild?.nativeElement.value,i=this.keepBuffer?this.inputViewChild?.nativeElement.value.length:this.checkVal(),this.caretTimeoutId=setTimeout(()=>{this.inputViewChild?.nativeElement===this.inputViewChild?.nativeElement.ownerDocument.activeElement&&(this.writeBuffer(),i==this.mask?.replace("?","").length?this.caret(0,i):this.caret(i));},10),this.onFocus.emit(t);}onInputChange(t){this.androidChrome?this.handleAndroidInput(t):this.handleInputChange(t),this.onInput.emit(t);}handleInputChange(t){this.readonly||setTimeout(()=>{var i=this.checkVal(!0);this.caret(i),this.updateModel(t),this.isCompleted()&&this.onComplete.emit();},0);}getUnmaskedValue(){let t=[];for(let i=0;i<this.buffer.length;i++){let e=this.buffer[i];this.tests[i]&&e!=this.getPlaceholder(i)&&t.push(e);}return t.join("")}updateModel(t){let i=this.unmask?this.getUnmaskedValue():t.target.value;(i!==null||i!==void 0)&&(this.value=i,this.onModelChange(this.value));}updateFilledState(){this.filled=this.inputViewChild?.nativeElement&&this.inputViewChild.nativeElement.value!="",this.cd.markForCheck();}focus(){this.inputViewChild?.nativeElement.focus();}clear(){this.inputViewChild.nativeElement.value="",this.value=null,this.onModelChange(this.value),this.onClear.emit();}static \u0275fac=(()=>{let t;return function(e){return (t||(t=bD(a)))(e||a)}})();static \u0275cmp=QT({type:a,selectors:[["p-inputmask"],["p-inputMask"],["p-input-mask"]],contentQueries:function(i,e,n){if(i&1&&jy(n,fe,4)(n,Qi,4),i&2){let s;y_(s=v_())&&(e.clearIconTemplate=s.first),y_(s=v_())&&(e.templates=s);}},viewQuery:function(i,e){if(i&1&&Vy(me,7),i&2){let n;y_(n=v_())&&(e.inputViewChild=n.first);}},inputs:{type:"type",slotChar:"slotChar",autoClear:[2,"autoClear","autoClear",T$],showClear:[2,"showClear","showClear",T$],style:"style",inputId:"inputId",styleClass:"styleClass",placeholder:"placeholder",size:"size",maxlength:[2,"maxlength","maxlength",C$],tabindex:"tabindex",title:"title",variant:"variant",ariaLabel:"ariaLabel",ariaLabelledBy:"ariaLabelledBy",ariaRequired:[2,"ariaRequired","ariaRequired",T$],disabled:[2,"disabled","disabled",T$],readonly:[2,"readonly","readonly",T$],unmask:[2,"unmask","unmask",T$],name:"name",required:[2,"required","required",T$],characterPattern:"characterPattern",autofocus:[2,"autofocus","autofocus",T$],autoFocus:[2,"autoFocus","autoFocus",T$],autocomplete:"autocomplete",keepBuffer:[2,"keepBuffer","keepBuffer",T$],mask:"mask"},outputs:{onComplete:"onComplete",onFocus:"onFocus",onBlur:"onBlur",onInput:"onInput",onKeydown:"onKeydown",onClear:"onClear"},features:[aM([we,ne]),dy],decls:3,vars:24,consts:[["input",""],["pInputText","",3,"focus","blur","keydown","keypress","input","paste","ngClass","ngStyle","pSize","disabled","readonly","variant","pAutoFocus"],[4,"ngIf"],[3,"styleClass","click",4,"ngIf"],["class","p-inputmask-clear-icon",3,"click",4,"ngIf"],[3,"click","styleClass"],[1,"p-inputmask-clear-icon",3,"click"],[4,"ngTemplateOutlet"]],template:function(i,e){i&1&&(ks(0,"input",1,0),Py("focus",function(s){return e.onInputFocus(s)})("blur",function(s){return e.onInputBlur(s)})("keydown",function(s){return e.onInputKeydown(s)})("keypress",function(s){return e.onKeyPress(s)})("input",function(s){return e.onInputChange(s)})("paste",function(s){return e.handleInputChange(s)}),Uu(),py(2,_e,3,2,"ng-container",2)),i&2&&(P_(e.styleClass),Sy("ngClass",e.inputClass)("ngStyle",e.style)("pSize",e.size)("disabled",e.disabled)("readonly",e.readonly)("variant",e.variant)("pAutoFocus",e.autofocus),My("id",e.inputId)("type",e.type)("name",e.name)("placeholder",e.placeholder)("title",e.title)("autocomplete",e.autocomplete)("maxlength",e.maxlength)("tabindex",e.tabindex)("aria-label",e.ariaLabel)("aria-labelledBy",e.ariaLabelledBy)("aria-required",e.ariaRequired)("required",e.required)("data-pc-name","inputmask")("data-pc-section","root"),Iw(2),Sy("ngIf",e.value!=null&&e.filled&&e.showClear&&!e.disabled));},dependencies:[kn,Dn,Cn,Fn,yn,Kt,Mo,ei,Ji],encapsulation:2})}return a})(),He=(()=>{class a{static \u0275fac=function(i){return new(i||a)};static \u0275mod=ay({type:a});static \u0275inj=vc({imports:[se,Ji,Ji]})}return a})();});export{He as H,Ie as I,se as s};