import{B,E as Y,P as te,S as ie,U as k,V as ne,X as se,aa as ae,ea as le,fa as re}from"./chunk-MX3KDVP3.js";import{a as X}from"./chunk-5ZTU7T2J.js";import{$ as R,Bc as H,Da as c,Hb as I,Jb as d,Mb as O,Mc as p,Mg as ee,Na as U,Nb as Q,Ng as M,Oa as F,Ob as y,Pb as E,Sa as K,Ta as q,Ua as m,Xb as g,Y as x,Yc as G,Z as S,Zc as Z,_ as A,_c as J,ba as v,cb as L,fd as W,ga as w,ha as _,hd as T,ia as D,kc as z,mb as u,na as f,nb as C,ob as b,sa as P,tb as j,ub as $,zb as V}from"./chunk-OTZZLUAJ.js";import{i as h}from"./chunk-XYZYVFXE.js";var pe=["clearicon"],fe=["input"];function de(l,a){if(l&1){let r=V();D(),C(0,"svg",5),I("click",function(){w(r);let t=d(2);return _(t.clear())}),b()}if(l&2){let r=d(2);g(r.cx("clearIcon")),u("pBind",r.ptm("clearIcon"))}}function ce(l,a){}function me(l,a){l&1&&m(0,ce,0,0,"ng-template")}function ge(l,a){if(l&1){let r=V();C(0,"span",6),I("click",function(){w(r);let t=d(2);return _(t.clear())}),m(1,me,1,0,null,7),b()}if(l&2){let r=d(2);g(r.cx("clearIcon")),u("pBind",r.ptm("clearIcon")),c(),u("ngTemplateOutlet",r.clearIconTemplate||r._clearIconTemplate)}}function ke(l,a){if(l&1&&(j(0),m(1,de,1,3,"svg",3)(2,ge,2,4,"span",4),$()),l&2){let r=d();c(),u("ngIf",!r.clearIconTemplate&&!r._clearIconTemplate),c(),u("ngIf",r.clearIconTemplate||r._clearIconTemplate)}}var ve=`
    /* For PrimeNG */
    p-inputmask {
        position: relative;
    }

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

    p-inputMask:has(.p-inputtext-fluid),
    p-input-mask:has(.p-inputtext-fluid),
    p-inputmask:has(.p-inputtext-fluid) {
        width: 100%;
    }

    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: dt('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: dt('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: dt('inputtext.invalid.placeholder.color');
    }
`,Ce={root:({instance:l})=>["p-inputmask p-component p-inputwrapper",{"p-variant-filled":l.$variant()==="filled"}],clearIcon:"p-inputmask-clear-icon"},oe=(()=>{let a=class a extends te{name="inputmask";style=ve;classes=Ce};h(a,"\u0275fac",(()=>{let i;return function(e){return(i||(i=P(a)))(e||a)}})()),h(a,"\u0275prov",S({token:a,factory:a.\u0275fac}));let l=a;return l})();var he=new R("INPUTMASK_INSTANCE");var be={provide:X,useExisting:x(()=>ue),multi:!0},ue=(()=>{let a=class a extends le{componentName="InputMask";_componentStyle=v(oe);$pcInputMask=v(he,{optional:!0,skipSelf:!0})??void 0;bindDirectiveInstance=v(k,{self:!0});onAfterViewChecked(){this.bindDirectiveInstance.setAttrs(this.ptms(["root","host"]))}ptmParams=H(()=>({context:{filled:this.$variant()==="filled"}}));type="text";slotChar="_";autoClear=!0;showClear=!1;style;inputId;styleClass;placeholder;tabindex;title;ariaLabel;ariaLabelledBy;ariaRequired;readonly;unmask;characterPattern="[A-Za-z]";autofocus;autocomplete;keepBuffer=!1;get mask(){return this._mask}set mask(i){this._mask=i,this.initMask(),this.writeValue(""),this.onModelChange(this.value)}onComplete=new f;onFocus=new f;onBlur=new f;onInput=new f;onKeydown=new f;onClear=new f;clearIconTemplate;templates;inputViewChild;value;_mask;input;defs;tests;partialPosition;firstNonMaskPos;lastRequiredNonMaskPos;len;oldVal;buffer;defaultBuffer;focusText;caretTimeoutId;androidChrome=!0;focused;onInit(){if(T(this.platformId)){let i=navigator.userAgent;this.androidChrome=/chrome/i.test(i)&&/android/i.test(i)}this.initMask()}_clearIconTemplate;onAfterContentInit(){this.templates.forEach(i=>{i.getType()==="clearicon"&&(this._clearIconTemplate=i.template)})}initMask(){if(!this.mask)return;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 i=this.mask.split("");for(let t=0;t<i.length;t++){let e=i[t];e=="?"?(this.len--,this.partialPosition=t):this.defs[e]?(this.tests.push(new RegExp(this.defs[e])),this.firstNonMaskPos===null&&(this.firstNonMaskPos=this.tests.length-1),t<this.partialPosition&&(this.lastRequiredNonMaskPos=this.tests.length-1)):this.tests.push(null)}this.buffer=[];for(let t=0;t<i.length;t++){let e=i[t];e!="?"&&(this.defs[e]?this.buffer.push(this.getPlaceholder(t)):this.buffer.push(e))}this.defaultBuffer=this.buffer.join("")}caret(i,t){let e,n,s;if(!(!this.inputViewChild?.nativeElement.offsetParent||this.inputViewChild.nativeElement!==this.inputViewChild.nativeElement.ownerDocument.activeElement))if(typeof i=="number")n=i,s=typeof t=="number"?t: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 i;for(let t=this.firstNonMaskPos;t<=this.lastRequiredNonMaskPos;t++)if(this.tests[t]&&this.buffer[t]===this.getPlaceholder(t))return!1;return!0}getPlaceholder(i){return i<this.slotChar.length?this.slotChar.charAt(i):this.slotChar.charAt(0)}seekNext(i){for(;++i<this.len&&!this.tests[i];);return i}seekPrev(i){for(;--i>=0&&!this.tests[i];);return i}shiftL(i,t){let e,n;if(!(i<0)){for(e=i,n=this.seekNext(t);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,i))}}shiftR(i){let t,e,n,s;for(t=i,e=this.getPlaceholder(i);t<this.len;t++)if(this.tests[t])if(n=this.seekNext(t),s=this.buffer[t],this.buffer[t]=e,n<this.len&&this.tests[n].test(s))e=s;else break}handleAndroidInput(i){var t=this.inputViewChild?.nativeElement.value,e=this.caret();if(this.oldVal&&this.oldVal.length&&this.oldVal.length>t.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(i),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(i),this.isCompleted()&&this.onComplete.emit()},0)}}onInputBlur(i){if(this.focused=!1,this.onModelTouched(),this.keepBuffer||this.checkVal(),this.onBlur.emit(i),this.modelValue()!=this.focusText||this.modelValue()!=this.value){this.updateModel(i);let t=this.document.createEvent("HTMLEvents");t.initEvent("change",!0,!1),this.inputViewChild?.nativeElement.dispatchEvent(t)}}onInputKeydown(i){if(this.readonly)return;let t=i.which||i.keyCode,e,n,s,o;T(this.platformId)&&(o=/iphone/i.test(B())),this.oldVal=this.inputViewChild?.nativeElement.value,this.onKeydown.emit(i),t===8||t===46||o&&t===127?(e=this.caret(),n=e.begin,s=e.end,s-n===0&&(n=t!==46?this.seekPrev(n):s=this.seekNext(n-1),s=t===46?this.seekNext(s):s),this.clearBuffer(n,s),this.keepBuffer?this.shiftL(n,s-2):this.shiftL(n,s-1),this.updateModel(i),this.onInput.emit(i),i.preventDefault()):t===13?(this.onInputBlur(i),this.updateModel(i)):t===27&&(this.inputViewChild.nativeElement.value=this.focusText,this.caret(0,this.checkVal()),this.updateModel(i),i.preventDefault())}onKeyPress(i){if(!this.readonly){var t=i.which||i.keyCode,e=this.caret(),n,s,o,N;i.ctrlKey||i.altKey||i.metaKey||t<32||t>34&&t<41||(t&&t!==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(t),this.tests[n].test(s)&&(this.shiftR(n),this.buffer[n]=s,this.writeBuffer(),o=this.seekNext(n),Y()&&/android/i.test(B())?setTimeout(()=>{this.caret(o)},0):this.caret(o),e.begin<=this.lastRequiredNonMaskPos&&(N=this.isCompleted()),this.onInput.emit(i))),i.preventDefault()),this.updateModel(i),N&&this.onComplete.emit())}}clearBuffer(i,t){if(!this.keepBuffer){let e;for(e=i;e<t&&e<this.len;e++)this.tests[e]&&(this.buffer[e]=this.getPlaceholder(e))}}writeBuffer(){this.buffer&&this.inputViewChild?.nativeElement&&(this.inputViewChild.nativeElement.value=this.buffer.join(""))}checkVal(i){let t=this.inputViewChild?.nativeElement.value,e=-1,n,s,o;for(n=0,o=0;n<this.len;n++)if(this.tests[n]){for(this.buffer[n]=this.getPlaceholder(n);o++<t.length;)if(s=t.charAt(o-1),this.tests[n].test(s)){this.keepBuffer||(this.buffer[n]=s),e=n;break}if(o>t.length){this.clearBuffer(n+1,this.len);break}}else this.buffer[n]===t.charAt(o)&&o++,n<this.partialPosition&&(e=n);return i?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(i){if(this.readonly)return;this.focused=!0,clearTimeout(this.caretTimeoutId);let t;this.focusText=this.inputViewChild?.nativeElement.value,t=this.keepBuffer?this.inputViewChild?.nativeElement.value.length:this.checkVal(),this.caretTimeoutId=setTimeout(()=>{this.inputViewChild?.nativeElement===this.inputViewChild?.nativeElement.ownerDocument.activeElement&&(this.writeBuffer(),t==this.mask?.replace("?","").length?this.caret(0,t):this.caret(t))},10),this.onFocus.emit(i)}onInputChange(i){this.androidChrome?this.handleAndroidInput(i):this.handleInputChange(i),this.onInput.emit(i)}handleInputChange(i){this.readonly||setTimeout(()=>{var t=this.checkVal(!0);this.caret(t),this.updateModel(i),this.isCompleted()&&this.onComplete.emit()},0)}getUnmaskedValue(){let i=[];for(let t=0;t<this.buffer.length;t++){let e=this.buffer[t];this.tests[t]&&e!=this.getPlaceholder(t)&&i.push(e)}return i.join("")}updateModel(i){let t=i.target;if(!t)return;let e=this.unmask?this.getUnmaskedValue():t.value;e!=null&&(this.value=e,this.writeModelValue(this.value),this.onModelChange(this.value))}focus(){this.inputViewChild?.nativeElement.focus()}clear(){this.inputViewChild.nativeElement.value="",this.value=null,this.onModelChange(this.value),this.onClear.emit()}writeControlValue(i,t){this.value=i,t(this.value),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.cd.markForCheck()}};h(a,"\u0275fac",(()=>{let i;return function(e){return(i||(i=P(a)))(e||a)}})()),h(a,"\u0275cmp",U({type:a,selectors:[["p-inputmask"],["p-inputMask"],["p-input-mask"]],contentQueries:function(t,e,n){if(t&1&&O(n,pe,4)(n,ee,4),t&2){let s;y(s=E())&&(e.clearIconTemplate=s.first),y(s=E())&&(e.templates=s)}},viewQuery:function(t,e){if(t&1&&Q(fe,7),t&2){let n;y(n=E())&&(e.inputViewChild=n.first)}},hostVars:2,hostBindings:function(t,e){t&2&&g(e.cx("root"))},inputs:{type:"type",slotChar:"slotChar",autoClear:[2,"autoClear","autoClear",p],showClear:[2,"showClear","showClear",p],style:"style",inputId:"inputId",styleClass:"styleClass",placeholder:"placeholder",tabindex:"tabindex",title:"title",ariaLabel:"ariaLabel",ariaLabelledBy:"ariaLabelledBy",ariaRequired:[2,"ariaRequired","ariaRequired",p],readonly:[2,"readonly","readonly",p],unmask:[2,"unmask","unmask",p],characterPattern:"characterPattern",autofocus:[2,"autofocus","autofocus",p],autocomplete:"autocomplete",keepBuffer:[2,"keepBuffer","keepBuffer",p],mask:"mask"},outputs:{onComplete:"onComplete",onFocus:"onFocus",onBlur:"onBlur",onInput:"onInput",onKeydown:"onKeydown",onClear:"onClear"},features:[z([be,oe,{provide:he,useExisting:a},{provide:ie,useExisting:a}]),K([k]),q],decls:3,vars:27,consts:[["input",""],["pInputText","",3,"focus","blur","keydown","keypress","input","paste","pt","unstyled","invalid","ngStyle","pSize","variant","pAutoFocus","fluid"],[4,"ngIf"],["data-p-icon","times",3,"class","pBind","click",4,"ngIf"],[3,"class","pBind","click",4,"ngIf"],["data-p-icon","times",3,"click","pBind"],[3,"click","pBind"],[4,"ngTemplateOutlet"]],template:function(t,e){t&1&&(C(0,"input",1,0),I("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)}),b(),m(2,ke,3,2,"ng-container",2)),t&2&&(g(e.styleClass),u("pt",e.ptm("pcInputText",e.ptmParams()))("unstyled",e.unstyled())("invalid",e.invalid())("ngStyle",e.style)("pSize",e.size())("variant",e.$variant())("pAutoFocus",e.autofocus)("fluid",e.hasFluid),L("id",e.inputId)("type",e.type)("name",e.name())("placeholder",e.placeholder)("title",e.title)("size",e.inputSize())("autocomplete",e.autocomplete)("maxlength",e.maxlength())("minlength",e.minlength())("tabindex",e.tabindex)("aria-label",e.ariaLabel)("aria-labelledBy",e.ariaLabelledBy)("aria-required",e.ariaRequired)("required",e.required()?"":void 0)("readonly",e.readonly?"":void 0)("disabled",e.$disabled()?"":void 0),c(2),u("ngIf",e.value!=null&&e.$filled()&&e.showClear&&!e.$disabled()))},dependencies:[W,G,J,Z,re,ae,se,M,ne,k],encapsulation:2,changeDetection:0}));let l=a;return l})(),et=(()=>{let a=class a{};h(a,"\u0275fac",function(t){return new(t||a)}),h(a,"\u0275mod",F({type:a})),h(a,"\u0275inj",A({imports:[ue,M,M]}));let l=a;return l})();export{ue as a,et as b};
/**i18n:4caeb8e7a09648a9cf35d6229af8a685b503a6e2123779e5b0c4fb7602981338*/
//# sourceMappingURL=chunk-NRUVTQT6.js.map
