import{a as de,d as ce,f as me,i as fe,k as ge}from"./chunk-WPYN5NP7.js";import{C as le,a as x,g as ae,n as re}from"./chunk-2UGJU7DR.js";import{$b as B,Bb as k,Cb as b,Ef as A,Fc as P,Gf as pe,Ha as v,Hb as R,Hc as te,Ib as W,Jb as T,Kb as E,Lc as ie,Mc as ne,Ra as K,Sa as M,Ta as Q,Tc as se,Uc as O,Vb as H,Wa as U,Wb as Z,X as w,Xb as J,Y as q,Ya as _,Z as L,aa as y,bc as X,db as I,eb as h,ha as d,ia as c,ib as z,la as F,nb as g,ob as C,og as he,pa as f,pg as S,qb as $,rb as G,rc as Y,sa as j,sc as o,ta as m,tb as V,tc as ee,ve as oe,we as ue}from"./chunk-EWB56PWF.js";import{i as p}from"./chunk-2T7OYDCL.js";var _e=["clearicon"],be=["input"];function we(a,r){if(a&1){let u=V();g(0,"TimesIcon",5),k("click",function(){d(u);let i=b(2);return c(i.clear())}),C()}a&2&&(h("styleClass","p-inputmask-clear-icon"),I("data-pc-section","clearIcon"))}function ye(a,r){}function Me(a,r){a&1&&_(0,ye,0,0,"ng-template")}function Ie(a,r){if(a&1){let u=V();g(0,"span",6),k("click",function(){d(u);let i=b(2);return c(i.clear())}),_(1,Me,1,0,null,7),C()}if(a&2){let u=b(2);I("data-pc-section","clearIcon"),v(),h("ngTemplateOutlet",u.clearIconTemplate||u._clearIconTemplate)}}function Ve(a,r){if(a&1&&($(0),_(1,we,1,2,"TimesIcon",3)(2,Ie,2,2,"span",4),G()),a&2){let u=b();v(),h("ngIf",!u.clearIconTemplate&&!u._clearIconTemplate),v(),h("ngIf",u.clearIconTemplate||u._clearIconTemplate)}}var Te=({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")};
}
`,Ee={root:({instance:a})=>({"p-inputmask":!0,"p-filled":a.variant?a.variant==="filled":a.config.inputStyle()==="filled"})},Ce=(()=>{let r=class r extends de{name="inputmask";theme=Te;classes=Ee};p(r,"\u0275fac",(()=>{let t;return function(e){return(t||(t=F(r)))(e||r)}})()),p(r,"\u0275prov",q({token:r,factory:r.\u0275fac}));let a=r;return a})();var Be={provide:x,useExisting:w(()=>N),multi:!0},N=(()=>{let r=class r extends ce{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 f;onFocus=new f;onBlur=new f;onInput=new f;onKeydown=new f;onClear=new f;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=y(Ce);ngOnInit(){if(super.ngOnInit(),O(this.platformId)){let t=navigator.userAgent;this.androidChrome=/chrome/i.test(t)&&/android/i.test(t)}this.initMask()}_clearIconTemplate;ngAfterContentInit(){this.templates.forEach(t=>{switch(t.getType()){case"clearicon":this._clearIconTemplate=t.template;break}})}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;O(this.platformId)&&(l=/iphone/i.test(A())),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,D;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),pe()&&/android/i.test(A())?setTimeout(()=>{this.caret(l)},0):this.caret(l),e.begin<=this.lastRequiredNonMaskPos&&(D=this.isCompleted()),this.onInput.emit(t))),t.preventDefault()),this.updateModel(t),this.updateFilledState(),D&&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()}};p(r,"\u0275fac",(()=>{let t;return function(e){return(t||(t=F(r)))(e||r)}})()),p(r,"\u0275cmp",M({type:r,selectors:[["p-inputmask"],["p-inputMask"],["p-input-mask"]],contentQueries:function(i,e,n){if(i&1&&(R(n,_e,4),R(n,he,4)),i&2){let s;T(s=E())&&(e.clearIconTemplate=s.first),T(s=E())&&(e.templates=s)}},viewQuery:function(i,e){if(i&1&&W(be,7),i&2){let n;T(n=E())&&(e.inputViewChild=n.first)}},inputs:{type:"type",slotChar:"slotChar",autoClear:[2,"autoClear","autoClear",o],showClear:[2,"showClear","showClear",o],style:"style",inputId:"inputId",styleClass:"styleClass",placeholder:"placeholder",size:"size",maxlength:[2,"maxlength","maxlength",ee],tabindex:"tabindex",title:"title",variant:"variant",ariaLabel:"ariaLabel",ariaLabelledBy:"ariaLabelledBy",ariaRequired:[2,"ariaRequired","ariaRequired",o],disabled:[2,"disabled","disabled",o],readonly:[2,"readonly","readonly",o],unmask:[2,"unmask","unmask",o],name:"name",required:[2,"required","required",o],characterPattern:"characterPattern",autofocus:[2,"autofocus","autofocus",o],autoFocus:[2,"autoFocus","autoFocus",o],autocomplete:"autocomplete",keepBuffer:[2,"keepBuffer","keepBuffer",o],mask:"mask"},outputs:{onComplete:"onComplete",onFocus:"onFocus",onBlur:"onBlur",onInput:"onInput",onKeydown:"onKeydown",onClear:"onClear"},features:[B([Be,Ce]),U],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){if(i&1){let n=V();g(0,"input",1,0),k("focus",function(l){return d(n),c(e.onInputFocus(l))})("blur",function(l){return d(n),c(e.onInputBlur(l))})("keydown",function(l){return d(n),c(e.onInputKeydown(l))})("keypress",function(l){return d(n),c(e.onKeyPress(l))})("input",function(l){return d(n),c(e.onInputChange(l))})("paste",function(l){return d(n),c(e.handleInputChange(l))}),C(),_(2,Ve,3,2,"ng-container",2)}i&2&&(z(e.styleClass),h("ngClass",e.inputClass)("ngStyle",e.style)("pSize",e.size)("disabled",e.disabled)("readonly",e.readonly)("variant",e.variant)("pAutoFocus",e.autofocus),I("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"),v(2),h("ngIf",e.value!=null&&e.filled&&e.showClear&&!e.disabled))},dependencies:[se,P,te,ne,ie,ge,fe,me,S],encapsulation:2,changeDetection:0}));let a=r;return a})(),ke=(()=>{let r=class r{};p(r,"\u0275fac",function(i){return new(i||r)}),p(r,"\u0275mod",Q({type:r})),p(r,"\u0275inj",L({imports:[N,S,S]}));let a=r;return a})();var xe=a=>({"with-border":a}),ot=(()=>{let r=class r{changeDetector=y(Y);maxTimestamp=m(void 0);timestamp=K(void 0);disabled=m(!1,{transform:o});enableBorder=m(!1,{transform:o});inputName=m(void 0);mask=m("99:99:99");formatter=m(t=>ue({seconds:t,format:"full",symbol:":"}));parser=m(t=>oe(t));inputBlur=j();timestampString;ngOnInit(){this.writeValue(this.timestamp()||0)}propagateChange=t=>{};writeValue(t){this.timestamp.set(t),this.timestampString=this.formatter()(this.timestamp())}registerOnChange(t){this.propagateChange=t}registerOnTouched(){}onModelChange(){this.timestamp.set(this.parser()(this.timestampString)),this.propagateChange(this.timestamp())}onBlur(){let t=this.maxTimestamp();t&&this.timestamp()>t&&(this.writeValue(t),this.changeDetector.detectChanges(),this.propagateChange(this.timestamp())),this.inputBlur.emit()}};p(r,"\u0275fac",function(i){return new(i||r)}),p(r,"\u0275cmp",M({type:r,selectors:[["my-timestamp-input"]],inputs:{maxTimestamp:[1,"maxTimestamp"],timestamp:[1,"timestamp"],disabled:[1,"disabled"],enableBorder:[1,"enableBorder"],inputName:[1,"inputName"],mask:[1,"mask"],formatter:[1,"formatter"],parser:[1,"parser"]},outputs:{timestamp:"timestampChange",inputBlur:"inputBlur"},features:[B([{provide:x,useExisting:w(()=>r),multi:!0}])],decls:1,vars:7,consts:[["slotChar","0",3,"ngModelChange","onBlur","disabled","ngModel","ngClass","mask","inputId"]],template:function(i,e){i&1&&(g(0,"p-inputMask",0),J("ngModelChange",function(s){return Z(e.timestampString,s)||(e.timestampString=s),s}),k("onBlur",function(){return e.onBlur()})("ngModelChange",function(){return e.onModelChange()}),C()),i&2&&(h("disabled",e.disabled()),H("ngModel",e.timestampString),h("ngClass",X(5,xe,e.enableBorder()))("mask",e.mask())("inputId",e.inputName()))},dependencies:[ke,N,le,ae,re,P],styles:[`p-inputmask.with-border[_ngcontent-%COMP%]{--input-border-color: var(--bg-secondary-500)}p-inputmask[_ngcontent-%COMP%]     input{text-align:center;font-size:16px;padding:var(--input-y-padding) var(--input-x-padding);width:100%;max-width:100%;color:var(--input-fg);background-color:var(--input-bg);border:var(--input-border-width) solid var(--input-border-color);border-radius:var(--input-border-radius);line-height:24px}p-inputmask[_ngcontent-%COMP%]     input::placeholder{color:var(--input-placeholder);font-size:14px}p-inputmask[_ngcontent-%COMP%]     input[readonly]{color:var(--fg-300)}p-inputmask[_ngcontent-%COMP%]     input:focus, p-inputmask[_ngcontent-%COMP%]     input:focus-visible{box-shadow:0 0 0 .2rem var(--fg-100);outline:0}p-inputmask[_ngcontent-%COMP%]     input[disabled]{color:var(--fg-300);opacity:.8}@media screen and (max-width: calc(100% + 40px)){p-inputmask[_ngcontent-%COMP%]     input{width:100%}}p-inputmask[_ngcontent-%COMP%]     input:focus-within, p-inputmask[_ngcontent-%COMP%]     input:focus{box-shadow:0 0 0 .2rem var(--fg-100)}p-inputmask[_ngcontent-%COMP%]     input:disabled{background:var(--bg);opacity:.5}
/*# sourceMappingURL=timestamp-input.component-TGBVRUAE.css.map */`]}));let a=r;return a})();export{ot as a};
/**i18n:85d030b7fdd36d163c6d41dcef9178681a6baa573eb199e8b12fe27dbb057a98*/
//# sourceMappingURL=chunk-HQOODZGX.js.map
