1import{a as Te}from"./chunk-DBDCXSIX.js";import{a as Ie}from"./chunk-7F5QZ2WZ.js";import{ma as Ee,na as Ne}from"./chunk-CMAA65ZX.js";import{b as we}from"./chunk-5EI2LJU6.js";import{Ia as Ce,Ja as ve,La as xe,Ma as be}from"./chunk-O3SHBMLD.js";import{a as ye,d as Me}from"./chunk-JGAQJZZ3.js";import{Aa as he,Ba as le,Da as ce,Db as _e,Ea as oe,Fa as ue,Jc as g,Kc as ee,La as pe,Ma as J,Md as te,Na as U,Qa as me,Sb as Q,Vc as ke,Wb as B,Wc as Se,Xa as fe,Xc as $,Ya as X,cc as Y,f as ne,hc as f,ic as m,jc as ge,nc as V,pa as q,qc as d,sa as j,sc as F,tb as de,va as x,wb as P}from"./chunk-6OTMHPV4.js";import{a as N,b as se,d as re,j as ae}from"./chunk-3EYC4JTX.js";var z=new j("ngx-mask config"),Oe=new j("new ngx-mask config"),Pe=new j("initial ngx-mask config"),je={suffix:"",prefix:"",thousandSeparator:" ",decimalMarker:[".",","],clearIfNotMatch:!1,showTemplate:!1,showMaskTyped:!1,placeHolderCharacter:"_",dropSpecialCharacters:!0,hiddenInput:void 0,shownMaskExpression:"",separatorLimit:"",allowNegativeNumbers:!1,validation:!0,specialCharacters:["-","/","(",")",".",":"," ","+",",","@","[","]",'"',"'"],leadZeroDateTime:!1,apm:!1,leadZero:!1,keepCharacterPositions:!1,triggerOnMaskChange:!1,inputTransformFn:h=>h,outputTransformFn:h=>h,maskFilled:new X,patterns:{0:{pattern:new RegExp("\\d")},9:{pattern:new RegExp("\\d"),optional:!0},X:{pattern:new RegExp("\\d"),symbol:"*"},A:{pattern:new RegExp("[a-zA-Z0-9]")},S:{pattern:new RegExp("[a-zA-Z]")},U:{pattern:new RegExp("[A-Z]")},L:{pattern:new RegExp("[a-z]")},d:{pattern:new RegExp("\\d")},m:{pattern:new RegExp("\\d")},M:{pattern:new RegExp("\\d")},H:{pattern:new RegExp("\\d")},h:{pattern:new RegExp("\\d")},s:{pattern:new RegExp("\\d")}}},We=["Hh:m0:s0","Hh:m0","m0:s0"],ze=["percent","Hh","s0","m0","separator","d0/M0/0000","d0/M0","d0","M0"],Ke=(()=>{class h{constructor(){this._config=x(z),this.dropSpecialCharacters=this._config.dropSpecialCharacters,this.hiddenInput=this._config.hiddenInput,this.clearIfNotMatch=this._config.clearIfNotMatch,this.specialCharacters=this._config.specialCharacters,this.patterns=this._config.patterns,this.prefix=this._config.prefix,this.suffix=this._config.suffix,this.thousandSeparator=this._config.thousandSeparator,this.decimalMarker=this._config.decimalMarker,this.showMaskTyped=this._config.showMaskTyped,this.placeHolderCharacter=this._config.placeHolderCharacter,this.validation=this._config.validation,this.separatorLimit=this._config.separatorLimit,this.allowNegativeNumbers=this._config.allowNegativeNumbers,this.leadZeroDateTime=this._config.leadZeroDateTime,this.leadZero=this._config.leadZero,this.apm=this._config.apm,this.inputTransformFn=this._config.inputTransformFn,this.outputTransformFn=this._config.outputTransformFn,this.keepCharacterPositions=this._config.keepCharacterPositions,this._shift=new Set,this.plusOnePosition=!1,this.maskExpression="",this.actualValue="",this.showKeepCharacterExp="",this.shownMaskExpression="",this.deletedSpecialCharacter=!1,this._formatWithSeparators=(e,t,i,s)=>{let a=[],o="";if(Array.isArray(i)){let k=new RegExp(i.map(p=>"[\\^$.|?*+()".indexOf(p)>=0?`\\${p}`:p).join("|"));a=e.split(k),o=e.match(k)?.[0]??""}else a=e.split(i),o=i;let r=a.length>1?`${o}${a[1]}`:"",n=a[0]??"",l=this.separatorLimit.replace(/\s/g,"");l&&+l&&(n[0]==="-"?n=`-${n.slice(1,n.length).slice(0,l.length)}`:n=n.slice(0,l.length));let v=/(\d+)(\d{3})/;for(;t&&v.test(n);)n=n.replace(v,"$1"+t+"$2");return s===void 0?n+r:s===0?n:n+r.substring(0,s+1)},this.percentage=e=>{let t=e.replace(",","."),i=Number(t);return!isNaN(i)&&i>=0&&i<=100},this.getPrecision=e=>{let t=e.split(".");return t.length>1?Number(t[t.length-1]):1/0},this.checkAndRemoveSuffix=e=>{for(let t=this.suffix?.length-1;t>=0;t--){let i=this.suffix.substring(t,this.suffix?.length);if(e.includes(i)&&t!==this.suffix?.length-1&&(t-1<0||!e.includes(this.suffix.substring(t-1,this.suffix?.length))))return e.replace(i,"")}return e},this.checkInputPrecision=(e,t,i)=>{if(t<1/0){if(Array.isArray(i)){let r=i.find(n=>n!==this.thousandSeparator);i=r||i[0]}let s=new RegExp(this._charToRegExpExpression(i)+`\\d{${t}}.*$`),a=e.match(s),o=(a&&a[0]?.length)??0;if(o-1>t){let r=o-1-t;e=e.substring(0,e.length-r)}t===0&&this._compareOrIncludes(e[e.length-1],i,this.thousandSeparator)&&(e=e.substring(0,e.length-1))}return e}}applyMaskWithPattern(e,t){let[i,s]=t;return this.customPattern=s,this.applyMask(e,i)}applyMask(e,t,i=0,s=!1,a=!1,o=()=>{}){if(!t||typeof e!="string")return"";let r=0,n="",l=!1,v=!1,k=1,p=!1;e.slice(0,this.prefix.length)===this.prefix&&(e=e.slice(this.prefix.length,e.length)),this.suffix&&e?.length>0&&(e=this.checkAndRemoveSuffix(e)),e==="("&&this.prefix&&(e="");let _=e.toString().split("");
1if(this.allowNegativeNumbers&&e.slice(r,r+1)==="-"&&(n+=e.slice(r,r+1)),t==="IP"){let u=e.split(".");this.ipError=this._validIP(u),t="099.099.099.099"}let b=[];for(let u=0;u<e.length;u++)e[u]?.match("\\d")&&b.push(e[u]??"");if(t==="CPF_CNPJ"&&(this.cpfCnpjError=b.length!==11&&b.length!==14,b.length>11?t="00.000.000/0000-00":t="000.000.000-00"),t.startsWith("percent")){if(e.match("[a-z]|[A-Z]")||e.match(/[-!$%^&*()_+|~=`{}\[\]:";'<>?,\/.]/)&&!a){e=this._stripToDecimal(e);let y=this.getPrecision(t);e=this.checkInputPrecision(e,y,this.decimalMarker)}let u=typeof this.decimalMarker=="string"?this.decimalMarker:".";if(e.indexOf(u)>0&&!this.percentage(e.substring(0,e.indexOf(u)))){let y=e.substring(0,e.indexOf(u)-1);this.allowNegativeNumbers&&e.slice(r,r+1)==="-"&&!a&&(y=e.substring(0,e.indexOf(u))),e=`${y}${e.substring(e.indexOf(u),e.length)}`}let c="";this.allowNegativeNumbers&&e.slice(r,r+1)==="-"?c=e.slice(r+1,r+e.length):c=e,this.percentage(c)?n=this._splitPercentZero(e):n=this._splitPercentZero(e.substring(0,e.length-1))}else if(t.startsWith("separator")){(e.match("[w\u0430-\u044F\u0410-\u042F]")||e.match("[\u0401\u0451\u0410-\u044F]")||e.match("[a-z]|[A-Z]")||e.match(/[-@#!$%\\^&*()_£¬'+|~=`{}\]:";<>.?/]/)||e.match("[^A-Za-z0-9,]"))&&(e=this._stripToDecimal(e));let u=this.getPrecision(t),c=Array.isArray(this.decimalMarker)?".":this.decimalMarker;u===0?e=this.allowNegativeNumbers?e.length>2&&e[0]==="-"&&e[1]==="0"&&e[2]!==this.thousandSeparator&&e[2]!==","&&e[2]!=="."?"-"+e.slice(2,e.length):e[0]==="0"&&e.length>1&&e[1]!==this.thousandSeparator&&e[1]!==","&&e[1]!=="."?e.slice(1,e.length):e:e.length>1&&e[0]==="0"&&e[1]!==this.thousandSeparator&&e[1]!==","&&e[1]!=="."?e.slice(1,e.length):e:(e[0]===c&&e.length>1&&(e="0"+e.slice(0,e.length+1),this.plusOnePosition=!0),e[0]==="0"&&e[1]!==c&&e[1]!==this.thousandSeparator&&(e=e.length>1?e.slice(0,1)+c+e.slice(1,e.length+1):e,this.plusOnePosition=!0),this.allowNegativeNumbers&&e[0]==="-"&&(e[1]===c||e[1]==="0")&&(e=e[1]===c&&e.length>2?e.slice(0,1)+"0"+e.slice(1,e.length):e[1]==="0"&&e.length>2&&e[2]!==c?e.slice(0,2)+c+e.slice(2,e.length):e,this.plusOnePosition=!0)),a&&(e[0]==="0"&&e[1]===this.decimalMarker&&(e[i]==="0"||e[i]===this.decimalMarker)&&(e=e.slice(2,e.length)),e[0]==="-"&&e[1]==="0"&&e[2]===this.decimalMarker&&(e[i]==="0"||e[i]===this.decimalMarker)&&(e="-"+e.slice(3,e.length)),e=this._compareOrIncludes(e[e.length-1],this.decimalMarker,this.thousandSeparator)?e.slice(0,e.length-1):e);let y=this._charToRegExpExpression(this.thousandSeparator),S='@#!$%^&*()_+|~=`{}\\[\\]:\\s,\\.";<>?\\/'.replace(y,"");if(Array.isArray(this.decimalMarker))for(let w of this.decimalMarker)S=S.replace(this._charToRegExpExpression(w),"");else S=S.replace(this._charToRegExpExpression(this.decimalMarker),"");let E=new RegExp("["+S+"]");e.match(E)&&(e=e.substring(0,e.length-1)),e=this.checkInputPrecision(e,u,this.decimalMarker);let M=e.replace(new RegExp(y,"g"),"");n=this._formatWithSeparators(M,this.thousandSeparator,this.decimalMarker,u);let H=n.indexOf(",")-e.indexOf(","),C=n.length-e.length;if(C>0&&n[i]!==this.thousandSeparator){v=!0;let w=0;do this._shift.add(i+w),w++;while(w<C)}else n[i-1]===this.decimalMarker||C===-4||C===-3||n[i]===","?(this._shift.clear(),this._shift.add(i-1)):H!==0&&i>0&&!(n.indexOf(",")>=i&&i>3)||!(n.indexOf(".")>=i&&i>3)&&C<=0?(this._shift.clear(),v=!0,k=C,i+=C,this._shift.add(i)):this._shift.clear()}else for(let u=0,c=_[0];u<_.length&&r!==t.length;u++,c=_[u]??""){let y="*"in this.patterns;if(this._checkSymbolMask(c,t[r]??"")&&t[r+1]==="?")n+=c,r+=2;else if(t[r+1]==="*"&&l&&this._checkSymbolMask(c,t[r+2]??""))n+=c,r+=3,l=!1;else if(this._checkSymbolMask(c,t[r]??"")&&t[r+1]==="*"&&!y)n+=c,l=!0;else if(t[r+1]==="?"&&this._checkSymbolMask(c,t[r+2]??""))n+=c,r+=3;else if(this._checkSymbolMask(c,t[r]??"")){if(t[r]==="H"&&(this.apm?Number(c)>9:Number(c)>2)){i=this.leadZeroDateTime?i:i+1,r+=1,this._shiftStep(t,r,_.length),u--,this.leadZeroDateTime&&(n+="0");continue}if(t[r]==="h"&&(this.apm?n.length===1&&Number(n)>1||n==="1"&&Number(c)>2||e.slice(r-1,r).length===1&&Number(e.slice(r-1,r))>2||e.slice(r-1,r)==="1"&&Number(c)>2:n==="2"&&Number(c)>3||(n.slice(r-2,r)==="2"||n.slice(r-3,r)==="2"||n.slice(r-4,r)==="2"||n.slice(r-1,r)==="2")&&Number(c)>3&&r>10)){i=i+1,r+=1,u--;continue}if((t[r]==="m"||t[r]==="s")&&Number(c)>5){i=this.leadZeroDateTime?i:i+1,r+=1,this._shiftStep(t,r,_.length),u--,this.leadZeroDateTime&&(n+="0");continue}let S=31,E=e[r],M=e[r+1],H=e[r+2],C=e[r-1],w=e[r-2],De=e[r-3],O=e.slice(r-3,r-1),L=e.slice(r-1,r+1),Z=e.slice(r,r+2),K=e.slice(r-2,r);
1if(t[r]==="d"){let ie=t.slice(0,2)==="M0",G=t.slice(0,2)==="M0"&&this.specialCharacters.includes(w);if(Number(c)>3&&this.leadZeroDateTime||!ie&&(Number(Z)>S||Number(L)>S||this.specialCharacters.includes(M))||(G?Number(L)>S||!this.specialCharacters.includes(E)&&this.specialCharacters.includes(H)||this.specialCharacters.includes(E):Number(Z)>S||this.specialCharacters.includes(M))){i=this.leadZeroDateTime?i:i+1,r+=1,this._shiftStep(t,r,_.length),u--,this.leadZeroDateTime&&(n+="0");continue}}if(t[r]==="M"){let G=r===0&&(Number(c)>2||Number(Z)>12||this.specialCharacters.includes(M)),He=t.slice(r+2,r+3),Fe=O.includes(He)&&(this.specialCharacters.includes(w)&&Number(L)>12&&!this.specialCharacters.includes(E)||this.specialCharacters.includes(E)||this.specialCharacters.includes(De)&&Number(K)>12&&!this.specialCharacters.includes(C)||this.specialCharacters.includes(C)),$e=Number(O)<=S&&!this.specialCharacters.includes(O)&&this.specialCharacters.includes(C)&&(Number(Z)>12||this.specialCharacters.includes(M)),Re=Number(Z)>12&&r===5||this.specialCharacters.includes(M)&&r===5,Ze=Number(O)>S&&!this.specialCharacters.includes(O)&&!this.specialCharacters.includes(K)&&Number(K)>12,Be=Number(O)<=S&&!this.specialCharacters.includes(O)&&!this.specialCharacters.includes(C)&&Number(L)>12;if(Number(c)>1&&this.leadZeroDateTime||G||Fe||Be||Ze||$e||Re&&!this.leadZeroDateTime){i=this.leadZeroDateTime?i:i+1,r+=1,this._shiftStep(t,r,_.length),u--,this.leadZeroDateTime&&(n+="0");continue}}n+=c,r++}else c===" "&&t[r]===" "||c==="/"&&t[r]==="/"?(n+=c,r++):this.specialCharacters.indexOf(t[r]??"")!==-1?(n+=t[r],r++,this._shiftStep(t,r,_.length),u--):t[r]==="9"&&this.showMaskTyped?this._shiftStep(t,r,_.length):this.patterns[t[r]??""]&&this.patterns[t[r]??""]?.optional?(_[r]&&t!=="099.099.099.099"&&t!=="000.000.000-00"&&t!=="00.000.000/0000-00"&&!t.match(/^9+\.0+$/)&&!this.patterns[t[r]??""]?.optional&&(n+=_[r]),t.includes("9*")&&t.includes("0*")&&r++,r++,u--):this.maskExpression[r+1]==="*"&&this._findSpecialChar(this.maskExpression[r+2]??"")&&this._findSpecialChar(c)===this.maskExpression[r+2]&&l||this.maskExpression[r+1]==="?"&&this._findSpecialChar(this.maskExpression[r+2]??"")&&this._findSpecialChar(c)===this.maskExpression[r+2]&&l?(r+=3,n+=c):this.showMaskTyped&&this.specialCharacters.indexOf(c)<0&&c!==this.placeHolderCharacter&&this.placeHolderCharacter.length===1&&(p=!0)}n.length+1===t.length&&this.specialCharacters.indexOf(t[t.length-1]??"")!==-1&&(n+=t[t.length-1]);let T=i+1;for(;this._shift.has(T);)k++,T++;let I=s&&!t.startsWith("separator")?r:this._shift.has(i)?k:0;p&&I--,o(I,v),k<0&&this._shift.clear();let R=!1;a&&(R=_.every(u=>this.specialCharacters.includes(u)));let D=`${this.prefix}${R?"":n}${this.showMaskTyped?"":this.suffix}`;if(n.length===0&&(D=this.dropSpecialCharacters?`${n}`:`${this.prefix}${n}`),n.includes("-")&&this.prefix&&this.allowNegativeNumbers){if(a&&n==="-")return"";D=`-${this.prefix}${n.split("-").join("")}${this.suffix}`}return D}_findDropSpecialChar(e){return Array.isArray(this.dropSpecialCharacters)?this.dropSpecialCharacters.find(t=>t===e):this._findSpecialChar(e)}_findSpecialChar(e){return this.specialCharacters.find(t=>t===e)}_checkSymbolMask(e,t){return this.patterns=this.customPattern?this.customPattern:this.patterns,(this.patterns[t]?.pattern&&this.patterns[t]?.pattern.test(e))??!1}_stripToDecimal(e){return e.split("").filter((t,i)=>{let s=typeof this.decimalMarker=="string"?t===this.decimalMarker:this.decimalMarker.includes(t);return t.match("^-?\\d")||t===this.thousandSeparator||s||t==="-"&&i===0&&this.allowNegativeNumbers}).join("")}_charToRegExpExpression(e){return e&&(e===" "?"\\s":"[\\^$.|?*+()".indexOf(e)>=0?`\\${e}`:e)}_shiftStep(e,t,i){let s=/[*?]/g.test(e.slice(0,t))?i:t;this._shift.add(s+this.prefix.length||0)}_compareOrIncludes(e,t,i){return Array.isArray(t)?t.filter(s=>s!==i).includes(e):e===t}_validIP(e){return!(e.length===4&&!e.some((t,i)=>e.length!==i+1?t===""||Number(t)>255:t===""||Number(t.substring(0,3))>255))}_splitPercentZero(e){let t=typeof this.decimalMarker=="string"?e.indexOf(this.decimalMarker):e.indexOf(".");if(t===-1){let i=parseInt(e,10);return isNaN(i)?"":i.toString()}else{let i=parseInt(e.substring(0,t),10),s=e.substring(t+1),a=isNaN(i)?"":i.toString(),o=typeof this.decimalMarker=="string"?this.decimalMarker:".";return a===""?"":a+o+s}}static{this.\u0275fac=function(t){return new(t||h)}}static{this.\u0275prov=q({token:h,factory:h.\u0275fac})}}return h})(),W=(()=>{class h extends Ke{constructor(){super(...arguments),this.isNumberValue=!1,this.maskIsShown="",this.selStart=null,this.selEnd=null,this.writingValue=!1,this.maskChanged=!1,this._maskExpressionArray=[],this.triggerOnMaskChange=!1,this._previousValue="",this._currentValue="",this._emitValue=!1,this.onChange=e=>{},this._elementRef=x(fe,{optional:!0}),this.document=x(te),this._config=x(z),this._renderer=x(_e,{optional:!0})}applyMask(e,t,i=0,s=!1,a=!1,o=()=>{}){if(!t)return e!==this.actualValue?this.actualValue:e;if(this.maskIsShown=this.showMaskTyped?this.showMaskInInput():"",this.maskExpression==="IP"&&this.showMaskTyped&&(this.maskIsShown=this.showMaskInInput(e||"#")),this.maskExpression==="CPF_CNPJ"&&this.showMaskTyped&&(this.maskIsShown=this.showMaskInInput(e||"#")),!e&&this.showMaskTyped)return this.formControlResult(this.prefix),this.prefix+this.maskIsShown+this.suffix;let r=e&&typeof this.selStart=="number"?e[this.selStart]??"":"",n="";if(this.hiddenInput!==void 0&&!this.writingValue){let p=e&&e.length===1?e.split(""):this.actualValue.split("");typeof this.selStart=="object"&&typeof this.selEnd=="object"?(this.selStart=Number(this.selStart),this.selEnd=Number(this.selEnd)):e!==""&&p.length?typeof this.selStart=="number"&&typeof this.selEnd=="number"&&(e.length>p.length?p.splice(this.selStart,0,r):e.length<p.length&&(p.length-e.length===1?a?p.splice(this.selStart-1,1):p.splice(e.length-1,1):p.splice(this.selStart,this.selEnd-this.selStart))):p=[],this.showMaskTyped&&(this.hiddenInput||(e=this.removeMask(e))),n=this.actualValue.length&&p.length<=e.length?this.shiftTypedSymbol
1s(p.join("")):e}if(s&&(this.hiddenInput||!this.hiddenInput)&&(n=e),a&&this.specialCharacters.indexOf(this.maskExpression[i]??"")!==-1&&this.showMaskTyped&&(n=this._currentValue),this.deletedSpecialCharacter&&i&&(this.specialCharacters.includes(this.actualValue.slice(i,i+1))?i=i+1:t.slice(i-1,i+1)!=="M0"&&(i=i-2),this.deletedSpecialCharacter=!1),this.showMaskTyped&&this.placeHolderCharacter.length===1&&!this.leadZeroDateTime&&(e=this.removeMask(e)),this.maskChanged?n=e:n=n&&n.length?n:e,this.showMaskTyped&&this.keepCharacterPositions&&this.actualValue&&!s){let p=this.dropSpecialCharacters?this.removeMask(this.actualValue):this.actualValue;return this.formControlResult(p),this.actualValue?this.actualValue:this.prefix+this.maskIsShown+this.suffix}let l=super.applyMask(n,t,i,s,a,o);if(this.actualValue=this.getActualValue(l),this.thousandSeparator==="."&&this.decimalMarker==="."&&(this.decimalMarker=","),this.maskExpression.startsWith("separator")&&this.dropSpecialCharacters===!0&&(this.specialCharacters=this.specialCharacters.filter(p=>!this._compareOrIncludes(p,this.decimalMarker,this.thousandSeparator))),(l||l==="")&&(this._previousValue=this._currentValue,this._currentValue=l,this._emitValue=this._previousValue!==this._currentValue||this.maskChanged||this._previousValue===this._currentValue&&s),this._emitValue&&this.formControlResult(l),!this.showMaskTyped||this.showMaskTyped&&this.hiddenInput)return this.hiddenInput?a?this.hideInput(l,this.maskExpression):this.hideInput(l,this.maskExpression)+this.maskIsShown.slice(l.length):l;let v=l.length,k=this.prefix+this.maskIsShown+this.suffix;if(this.maskExpression.includes("H")){let p=this._numberSkipedSymbols(l);return l+k.slice(v+p)}else if(this.maskExpression==="IP"||this.maskExpression==="CPF_CNPJ")return l+k;return l+k.slice(v)}_numberSkipedSymbols(e){let t=/(^|\D)(\d\D)/g,i=t.exec(e),s=0;for(;i!=null;)s+=1,i=t.exec(e);return s}applyValueChanges(e,t,i,s=()=>{}){let a=this._elementRef?.nativeElement;a&&(a.value=this.applyMask(a.value,this.maskExpression,e,t,i,s),a!==this._getActiveElement()&&this.clearIfNotMatchFn())}hideInput(e,t){return e.split("").map((i,s)=>this.patterns&&this.patterns[t[s]??""]&&this.patterns[t[s]??""]?.symbol?this.patterns[t[s]??""]?.symbol:i).join("")}getActualValue(e){let t=e.split("").filter((i,s)=>{let a=this.maskExpression[s]??"";return this._checkSymbolMask(i,a)||this.specialCharacters.includes(a)&&i===a});return t.join("")===e?t.join(""):e}shiftTypedSymbols(e){let t="";return(e&&e.split("").map((s,a)=>
1{if(this.specialCharacters.includes(e[a+1]??"")&&e[a+1]!==this.maskExpression[a+1])return t=s,e[a+1];if(t.length){let o=t;return t="",o}return s})||[]).join("")}numberToString(e){return!e&&e!==0||this.maskExpression.startsWith("separator")&&(this.leadZero||!this.dropSpecialCharacters)||this.maskExpression.startsWith("separator")&&this.separatorLimit.length>14&&String(e).length>14?String(e):Number(e).toLocaleString("fullwide",{useGrouping:!1,maximumFractionDigits:20}).replace("/-/","-")}showMaskInInput(e){if(this.showMaskTyped&&this.shownMaskExpression){if(this.maskExpression.length!==this.shownMaskExpression.length)throw new Error("Mask expression must match mask placeholder length");return this.shownMaskExpression}else if(this.showMaskTyped){if(e){if(this.maskExpression==="IP")return this._checkForIp(e);if(this.maskExpression==="CPF_CNPJ")return this._checkForCpfCnpj(e)}return this.placeHolderCharacter.length===this.maskExpression.length?this.placeHolderCharacter:this.maskExpression.replace(/\w/g,this.placeHolderCharacter)}return""}clearIfNotMatchFn(){let e=this._elementRef?.nativeElement;e&&this.clearIfNotMatch&&this.prefix.length+this.maskExpression.length+this.suffix.length!==e.value.replace(this.placeHolderCharacter,"").length&&(this.formElementProperty=["value",""],this.applyMask("",this.maskExpression))}set formElementProperty([e,t]){!this._renderer||!this._elementRef||Promise.resolve().then(()=>this._renderer?.setProperty(this._elementRef?.nativeElement,e,t))}checkDropSpecialCharAmount(e){return e.split("").filter(i=>this._findDropSpecialChar(i)).length}removeMask(e){return this._removeMask(this._removeSuffix(this._removePrefix(e)),this.specialCharacters.concat("_").concat(this.placeHolderCharacter))}_checkForIp(e){if(e==="#")return`${this.placeHolderCharacter}.${this.placeHolderCharacter}.${this.placeHolderCharacter}.${this.placeHolderCharacter}`;let t=[];for(let i=0;i<e.length;i++){let s=e[i]??"";s&&s.match("\\d")&&t.push(s)}return t.length<=3?`${this.placeHolderCharacter}.${this.placeHolderCharacter}.${this.placeHolderCharacter}`:t.length>3&&t.length<=6?`${this.placeHolderCharacter}.${this.placeHolderCharacter}`:t.length>6&&t.length<=9?this.placeHolderCharacter:(t.length>9&&t.length<=12,"")}_checkForCpfCnpj(e){let t=`${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}-${this.placeHolderCharacter}${this.placeHolderCharacter}`,i=`${this.placeHolderCharacter}${this.placeHolderCharacter}.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}/${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}-${this.placeHolderCharacter}${this.placeHolderCharacter}`;if(e==="#")return t;let s=[];for(let a=0;a<e.length;a++){let o=e[a]??"";o&&o.match("\\d")&&s.push(o)}return s.length<=3?t.slice(s.length,t.length):s.length>3&&s.length<=6?t.slice(s.length+1,t.length):s.length>6&&s.length<=9?t.slice(s.length+2,t.length):s.length>9&&s.length<11?t.slice(s.length+3,t.length):s.length===11?"":s.length===12?e.length===17?i.slice(16,i.length):i.slice(15,i.length):s.length>12&&s.length<=14?i.slice(s.length+4,i.length):""}_getActiveElement(e=this.document){let t=e?.activeElement?.shadowRoot;return t?.activeElement?this._getActiveElement(t):e.activeElement}formControlResult(e){if(this.writingValue||!this.triggerOnMaskChange&&this.maskChanged){this.maskChanged&&this.onChange(this.outputTransformFn(this._toNumber(this._checkSymbols(this._removeSuffix(this._removePrefix(e)))))),this.maskChanged=!1;return}Array.isArray(this.dropSpecialCharacters)?this.onChange(this.outputTransformFn(this._toNumber(this._checkSymbols(this._removeMask(this._removeSuffix(this._removePrefix(e)),this.dropSpecialCharacters))))):this.dropSpecialCharacters||!this.dropSpecialCharacters&&this.prefix===e?this.onChange(this.outputTransformFn(this._toNumber(this._checkSymbol
1s(this._removeSuffix(this._removePrefix(e)))))):this.onChange(this.outputTransformFn(this._toNumber(e)))}_toNumber(e){if(!this.isNumberValue||e===""||this.maskExpression.startsWith("separator")&&(this.leadZero||!this.dropSpecialCharacters))return e;if(String(e).length>16&&this.separatorLimit.length>14)return String(e);let t=Number(e);if(this.maskExpression.startsWith("separator")&&Number.isNaN(t)){let i=String(e).replace(",",".");return Number(i)}return Number.isNaN(t)?e:t}_removeMask(e,t){return this.maskExpression.startsWith("percent")&&e.includes(".")?e:e&&e.replace(this._regExpForRemove(t),"")}_removePrefix(e){return this.prefix?e&&e.replace(this.prefix,""):e}_removeSuffix(e){return this.suffix?e&&e.replace(this.suffix,""):e}_retrieveSeparatorValue(e){let t=Array.isArray(this.dropSpecialCharacters)?this.specialCharacters.filter(i=>this.dropSpecialCharacters.includes(i)):this.specialCharacters;return!this.deletedSpecialCharacter&&this._checkPatternForSpace()&&e.includes(" ")&&this.maskExpression.includes("*")&&(t=t.filter(i=>i!==" ")),this._removeMask(e,t)}_regExpForRemove(e){return new RegExp(e.map(t=>`\\${t}`).join("|"),"gi")}_replaceDecimalMarkerToDot(e){let t=Array.isArray(this.decimalMarker)?this.decimalMarker:[this.decimalMarker];return e.replace(this._regExpForRemove(t),".")}_checkSymbols(e){if(e==="")return e;this.maskExpression.startsWith("percent")&&this.decimalMarker===","&&(e=e.replace(",","."));let t=this._retrieveSeparatorPrecision(this.maskExpression),i=this._replaceDecimalMarkerToDot(this._retrieveSeparatorValue(e));return this.isNumberValue&&t?e===this.decimalMarker?null:this.separatorLimit.length>14?String(i):this._checkPrecision(this.maskExpression,i):i}_checkPatternForSpace(){for(let e in this.patterns)if(this.patterns[e]&&this.patterns[e]?.hasOwnProperty("pattern")){let t=this.patterns[e]?.pattern.toString(),i=this.patterns[e]?.pattern;if(t?.includes(" ")&&i?.test(this.maskExpression))return!0}return!1}_retrieveSeparatorPrecision(e){let t=e.match(new RegExp("^separator\\.([^d]*)"));return t?Number(t[1]):null}_checkPrecision(e,t){let i=e.slice(10,11);return e.indexOf("2")>0||this.leadZero&&Number(i)>1?(this.decimalMarker===","&&this.leadZero&&(t=t.replace(",",".")),this.leadZero?Number(t).toFixed(Number(i)):Number(t).toFixed(2)):this.numberToString(t)}_repeatPatternSymbols(e){return e.match(/{[0-9]+}/)&&e.split("").reduce((t,i,s)=>{if(this._start=i==="{"?s:this._start,i!=="}")return this._findSpecialChar(i)?t+i:t;this._end=s;let a=Number(e.slice(this._start+1,this._end)),o=new Array(a+1).join(e[this._start-1]);if(e.slice(0,this._start).length>1&&e.includes("S")){let r=e.slice(0,this._start-1);return r.includes("{")?t+o:r+t+o}else return t+o},"")||e}currentLocaleDecimalMarker(){return 1.1.toLocaleString().substring(1,2)}static{this.\u0275fac=(()=>{let e;return function(i){return(e||(e=me(h)))(i||h)}})()}static{this.\u0275prov=q({token:h,factory:h.\u0275fac})}}return h})();function Ge(){let h=x(Pe),A=x(Oe);return A instanceof Function?N(N({},h),A()):N(N({},h),A)}function qe(h){return[{provide:Oe,useValue:h},{provide:Pe,useValue:je},{provide:z,useFactory:Ge},W]}function ct(h){return ue(qe(h))}var ot=(()=>{class h{constructor(){this.maskExpression="",this.specialCharacters=[],this.patterns={},this.prefix="",this.suffix="",this.thousandSeparator=" ",this.decimalMarker=".",this.dropSpecialCharacters=null,this.hiddenInput=null,this.showMaskTyped=null,this.placeHolderCharacter=null,this.shownMaskExpression=null,this.showTemplate=null,this.clearIfNotMatch=null,this.validation=null,this.separatorLimit=null,this.allowNegativeNumbers=null,this.leadZeroDateTime=null,this.leadZero=null,this.triggerOnMaskChange=null,this.apm=null,this.inputTransformFn=null,this.outputTransformFn=null,this.keepCharacterPositions=null,this.maskFilled=new X,this._maskValue="",this._position=null,this._maskExpressionArray=[],this._justPasted=!1,this._isFocused=!1,this._isComposing=!1,this.document=x(te),this._maskService=x(W,{self:!0}),this._config=x(z),this.onChange=e=>{},this.onTouch=()=>{}}ngOnChanges(e){let{maskExpression:t,specialCharacters:i,patterns:s,prefix:a,suffix:o,thousandSeparator:r,decimalMarker:n,dropSpecialCharacters:l,hiddenInput:v,showMaskTyped:k,placeHolderCharacter:p,shownMaskExpression:_,showTemplate:b,clearIfNotMatch:T,validation:I,separatorLimit:R,allowNegativeNumbers:D,leadZeroDateTime:u,leadZero:c,triggerOnMaskChange:y,apm:S,inputTransformFn:E,outputTransformFn:M,keepCharacterPositions:H}=e;if(t&&(t.currentValue!==t.previousValue&&!t.firstChange&&(this._maskService.maskChanged=!0),t.currentValue&&t.currentValue.split("||").length>1?(this._maskExpressionArray=t.currentValue.split("||").sort((C,w)=>C.length-w.length),this._setMask()):(this._maskExpressionArray=[],this._maskValue=t.currentValue||"",this._maskService.maskExpression=this._maskValue)),i){if(!i.currentValue||!Array.isArray(i.currentValue))return;this._maskService.specialCharacters=i.currentValue||[]}D&&(this._maskService.allowNegativeNumbers=D.currentValue,this._maskService.allowNegativeNumbers&&(this._maskService.specialCharacters=this._maskService.specialCharacters.filter(C=>C!=="-"))),s&&s.currentValue&&(this._maskService.patterns=s.currentValue),S&&S.currentValue&&(this._maskService.apm=S.currentValue),a&&(this._maskService.prefix=a.currentValue),o&&(this._maskService.suffix=o.currentValue),r&&(this._maskService.thousandSeparator=r.currentValue),n&&(this._maskService.decimalMarker=n.currentValue),l&&(this._maskService.dropSpecialCharacters=l.currentValue),v&&(this._maskService.hiddenInput=v.currentValue),k&&(this._maskService.showMaskTyped=k.currentValue,k.previousValue===!1&&k.currentValue===!0&&this._isFocused&&requestAnimationFrame(()=>
1{this._maskService._elementRef?.nativeElement.click()})),p&&(this._maskService.placeHolderCharacter=p.currentValue),_&&(this._maskService.shownMaskExpression=_.currentValue),b&&(this._maskService.showTemplate=b.currentValue),T&&(this._maskService.clearIfNotMatch=T.currentValue),I&&(this._maskService.validation=I.currentValue),R&&(this._maskService.separatorLimit=R.currentValue),u&&(this._maskService.leadZeroDateTime=u.currentValue),c&&(this._maskService.leadZero=c.currentValue),y&&(this._maskService.triggerOnMaskChange=y.currentValue),E&&(this._maskService.inputTransformFn=E.currentValue),M&&(this._maskService.outputTransformFn=M.currentValue),H&&(this._maskService.keepCharacterPositions=H.currentValue),this._applyMask()}validate({value:e}){if(!this._maskService.validation||!this._maskValue)return null;if(this._maskService.ipError)return this._createValidationError(e);if(this._maskService.cpfCnpjError)return this._createValidationError(e);if(this._maskValue.startsWith("separator")||ze.includes(this._maskValue)||this._maskService.clearIfNotMatch)return null;if(We.includes(this._maskValue))return this._validateTime(e);if(e&&e.toString().length>=1){let t=0;if(this._maskValue.startsWith("percent"))return null;for(let i in this._maskService.patterns)if(this._maskService.patterns[i]?.optional){if(this._maskValue.indexOf(i)!==this._maskValue.lastIndexOf(i)){let s=this._maskValue.split("").filter(a=>a===i).join("");t+=s.length}else this._maskValue.indexOf(i)!==-1&&t++;if(this._maskValue.indexOf(i)!==-1&&e.toString().length>=this._maskValue.indexOf(i)||t===this._maskValue.length)return null}if(this._maskValue.indexOf("{")===1&&e.toString().length===this._maskValue.length+Number((this._maskValue.split("{")[1]??"").split("}")[0])-4)return null;if(this._maskValue.indexOf("*")>1&&e.toString().length<this._maskValue.indexOf("*")||this._maskValue.indexOf("?")>1&&e.toString().length<this._maskValue.indexOf("?")||this._maskValue.indexOf("{")===1)return this._createValidationError(e);if(this._maskValue.indexOf("*")===-1||this._maskValue.indexOf("?")===-1){e=typeof e=="number"?String(e):e;let i=this._maskValue.split("*"),s=this._maskService.dropSpecialCharacters?this._maskValue.length-this._maskService.checkDropSpecialCharAmount(this._maskValue)-t:this.prefix?this._maskValue.length+this.prefix.length-t:this._maskValue.length-t;if(i.length===1&&e.toString().length<s)return this._createValidationError(e);if(i.length>1){let a=i[i.length-1];if(a&&this._maskService.specialCharacters.includes(a[0])&&String(e).includes(a[0]??"")&&!this.dropSpecialCharacters){let o=e.split(a[0]);return o[o.length-1].length===a.length-1?null:this._createValidationError(e)}else return(a&&!this._maskService.specialCharacters.includes(a[0])||!a||this._maskService.dropSpecialCharacters)&&e.length>=s-1?null:this._createValidationError(e)}}if(this._maskValue.indexOf("*")===1||this._maskValue.indexOf("?")===1)return null}return e&&this.maskFilled.emit(),null}onPaste(){this._justPasted=!0}onFocus(){this._isFocused=!0}onModelChange(e){(e===""||e===null||e===void 0)&&this._maskService.actualValue&&(this._maskService.actualValue=this._maskService.getActualValue(""))}onInput(e){if(this._isComposing)return;let t=e.target,i=this._maskService.inputTransformFn(t.value);if(t.type!=="number")if(typeof i=="string"||typeof i=="number"){if(t.value=i.toString(),this._inputValue=t.value,this._setMask(),!this._maskValue){this.onChange(t.value);return}let s=t.selectionStart===1?t.selectionStart+this._maskService.prefix.length:t.selectionStart;if(this.showMaskTyped&&this.keepCharacterPositions&&this._maskService.placeHolderCharacter.length===1){let n=t.value.slice(s-1,s),l=this.prefix.length,v=this._maskService._checkSymbolMask(n,this._maskService.maskExpression[s-1-l]??""),k=this._maskService._checkSymbolMask(n,this._maskService.maskExpression[s+1-l]??""),p=this._maskService.selStart===this._maskService.selEnd,_=Number(this._maskService.selStart)-l,b=Number(this._maskService.selEnd)-l;if(this._code==="Backspace"){if(!p)this._maskService.selStart===l?this._maskService.actualValue=this.prefix+this._maskService.maskIsShown.slice(0,b)+this._inputValue.split(this.prefix).join(""):this._maskService.selStart===this._maskService.maskIsShown.length+l?this._maskService.actualValue=this._inputValue+this._maskService.maskIsShown.slice(_,b):this._maskService.actualValue=this.prefix+this._inputValue.split(this.prefix).join("").slice(0,_)+this._maskService.maskIsShown.slice(_,b)+this._maskService.actualValue.slice(b+l,this._maskService.maskIsShown.length+l)+this.suffix;else if(!this._maskService.specialCharacters.includes(this._maskService.maskExpression.slice(s-this.prefix.length,s+1-this.prefix.length))&&p)if(_===1&&this.prefix)this._maskService.actualValue=this.prefix+this._maskService.placeHolderCharacter+t.value.split(this.prefix).join("").split(this.suffix
1).join("")+this.suffix,s=s-1;else{let T=t.value.substring(0,s),I=t.value.substring(s);this._maskService.actualValue=T+this._maskService.placeHolderCharacter+I}}this._code!=="Backspace"&&(!v&&!k&&p?s=Number(t.selectionStart)-1:this._maskService.specialCharacters.includes(t.value.slice(s,s+1))&&k&&!this._maskService.specialCharacters.includes(t.value.slice(s+1,s+2))?(this._maskService.actualValue=t.value.slice(0,s-1)+t.value.slice(s,s+1)+n+t.value.slice(s+2),s=s+1):v?t.value.length===1&&s===1?this._maskService.actualValue=this.prefix+n+this._maskService.maskIsShown.slice(1,this._maskService.maskIsShown.length)+this.suffix:this._maskService.actualValue=t.value.slice(0,s-1)+n+t.value.slice(s+1).split(this.suffix).join("")+this.suffix:this.prefix&&t.value.length===1&&s-l===1&&this._maskService._checkSymbolMask(t.value,this._maskService.maskExpression[s-1-l]??"")&&(this._maskService.actualValue=this.prefix+t.value+this._maskService.maskIsShown.slice(1,this._maskService.maskIsShown.length)+this.suffix))}let a=0,o=!1;if(this._code==="Delete"&&(this._maskService.deletedSpecialCharacter=!0),this._inputValue.length>=this._maskService.maskExpression.length-1&&this._code!=="Backspace"&&this._maskService.maskExpression==="d0/M0/0000"&&s<10){let n=this._inputValue.slice(s-1,s);t.value=this._inputValue.slice(0,s-1)+n+this._inputValue.slice(s+1)}if(this._maskService.maskExpression==="d0/M0/0000"&&this.leadZeroDateTime&&(s<3&&Number(t.value)>31&&Number(t.value)<40||s===5&&Number(t.value.slice(3,5))>12)&&(s=s+2),this._maskService.maskExpression==="Hh:m0:s0"&&this.apm&&(this._justPasted&&t.value.slice(0,2)==="00"&&(t.value=t.value.slice(1,2)+t.value.slice(2,t.value.length)),t.value=t.value==="00"?"0":t.value),this._maskService.applyValueChanges(s,this._justPasted,this._code==="Backspace"||this._code==="Delete",(n,l)=>{this._justPasted=!1,a=n,o=l}),this._getActiveElement()!==t)return;this._maskService.plusOnePosition&&(s=s+1,this._maskService.plusOnePosition=!1),this._maskExpressionArray.length&&(this._code==="Backspace"?s=this.specialCharacters.includes(this._inputValue.slice(s-1,s))?s-1:s:s=t.selectionStart===1?t.selectionStart+this._maskService.prefix.length:t.selectionStart),this._position=this._position===1&&this._inputValue.length===1?null:this._position;let r=this._position?this._inputValue.length+s+a:s+(this._code==="Backspace"&&!o?0:a);r>this._getActualInputLength()&&(r=t.value===this._maskService.decimalMarker&&t.value.length===1?this._getActualInputLength()+1:this._getActualInputLength()),r<0&&(r=0),t.setSelectionRange(r,r),this._position=null}else console.warn("Ngx-mask writeValue work with string | number, your current value:",typeof i);else{if(!this._maskValue){this.onChange(t.value);return}this._maskService.applyValueChanges(t.value.length,this._justPasted,this._code==="Backspace"||this._code==="Delete")}}onCompositionStart(){this._isComposing=!0}onCompositionEnd(e){this._isComposing=!1,this._justPasted=!0,this.onInput(e)}onBlur(e){if(this._maskValue){let t=e.target;if(this.leadZero&&t.value.length>0&&typeof this.decimalMarker=="string"){let i=this._maskService.maskExpression,s=Number(this._maskService.maskExpression.slice(i.length-1,i.length));if(s>1){t.value=this.suffix?t.value.split(this.suffix).join(""):t.value;let a=t.value.split(this.decimalMarker)[1];t.value=t.value.includes(this.decimalMarker)?t.value+"0".repeat(s-a.length)+this.suffix:t.value+this.decimalMarker+"0".repeat(s)+this.suffix,this._maskService.actualValue=t.value}}this._maskService.clearIfNotMatchFn()}this._isFocused=!1,this.onTouch()}onClick(e){if(!this._maskValue)return;let t=e.target,i=0,s=0;t!==null&&t.selectionStart!==null&&t.selectionStart===t.selectionEnd&&t.selectionStart>this._maskService.prefix.length&&e.keyCode!==38&&this._maskService.showMaskTyped&&!this.keepCharacterPositions&&(this._maskService.maskIsShown=this._maskService.showMaskInInput(),t.setSelectionRange&&this._maskService.prefix+this._maskService.maskIsShown===t.value?(t.focus(),t.setSelectionRange(i,s)):t.selectionStart>this._maskService.actualValue.length&&t.setSelectionRange(this._maskService.actualValue.length,this._maskService.actualValue.length));let a=t&&(t.value===this._maskService.prefix?this._maskService.prefix+this._maskService.maskIsShown:t.value);if(t&&t.value!==a&&(t.value=a),t&&t.type!=="number"&&(t.selectionStart||t.selectionEnd)<=this._maskService.prefix.length){t.selectionStart=this._maskService.prefix.length;return}t&&t.selectionEnd>this._getActualInputLength()&&(t.selectionEnd=this._getActualInputLength())}onKeyDown(e){if(!this._maskValue)return;if(this._isComposing){e.key==="Enter"&&this.onCompositionEnd(e);return}this._code=e.code?e.code:e.key;let t=e.target;if(this._inputValue=t.value,this._setMask(),t.type!=="number"){if(e.key==="ArrowUp"&&e.preventDefault(),e.key==="ArrowLeft"||e.key==="Backspace"||e.key==="Delete"){if(e.key==="Backspace"&&t.value.length===0&&(t.selectionStart=t.selectionEnd),e.key==="Backspace"&&t.selectionStart!==0){if(this.specialCharacters=this.specialCharacters?.length?this.specialCharacters:this._config.specialCharacters,this.prefix.length>1&&t.selectionStart<=this.prefix.length)t.setSelectionRange(this.prefix.length,t.selectionEnd);else if(this._inputValue.length!==t.selectionStart&&t.selectionStart!==1)for(;this.specialCharacters.includes((this._inputValue[t.selectionStart-1]??"").toString())&&
1(this.prefix.length>=1&&t.selectionStart>this.prefix.length||this.prefix.length===0);)t.setSelectionRange(t.selectionStart-1,t.selectionEnd)}this.checkSelectionOnDeletion(t),this._maskService.prefix.length&&t.selectionStart<=this._maskService.prefix.length&&t.selectionEnd<=this._maskService.prefix.length&&e.preventDefault();let i=t.selectionStart;e.key==="Backspace"&&!t.readOnly&&i===0&&t.selectionEnd===t.value.length&&t.value.length!==0&&(this._position=this._maskService.prefix?this._maskService.prefix.length:0,this._maskService.applyMask(this._maskService.prefix,this._maskService.maskExpression,this._position))}this.suffix&&this.suffix.length>1&&this._inputValue.length-this.suffix.length<t.selectionStart?t.setSelectionRange(this._inputValue.length-this.suffix.length,this._inputValue.length):(e.code==="KeyA"&&e.ctrlKey||e.code==="KeyA"&&e.metaKey)&&(t.setSelectionRange(0,this._getActualInputLength()),e.preventDefault()),this._maskService.selStart=t.selectionStart,this._maskService.selEnd=t.selectionEnd}}writeValue(e){return ae(this,null,function*(){if(typeof e=="object"&&e!==null&&"value"in e&&("disable"in e&&this.setDisabledState(!!e.disable),e=e.value),e!==null&&(e=this.inputTransformFn?this.inputTransformFn(e):e),typeof e=="string"||typeof e=="number"||e===null||e===void 0){(e==null||e==="")&&(this._maskService._currentValue="",this._maskService._previousValue="");let t=e;if(typeof t=="number"||this._maskValue.startsWith("separator")){t=String(t);let i=this._maskService.currentLocaleDecimalMarker();Array.isArray(this._maskService.decimalMarker)||(t=this._maskService.decimalMarker!==i?t.replace(i,this._maskService.decimalMarker):t),this._maskService.leadZero&&t&&this.maskExpression&&this.dropSpecialCharacters!==!1&&(t=this._maskService._checkPrecision(this._maskService.maskExpression,t)),this._maskService.decimalMarker===","&&(t=t.toString().replace(".",",")),this.maskExpression?.startsWith("separator")&&this.leadZero&&requestAnimationFrame(()=>{this._maskService.applyMask(t?.toString()??"",this._maskService.maskExpression)}),this._maskService.isNumberValue=!0}typeof t!="string"&&(t=""),this._inputValue=t,this._setMask(),t&&this._maskService.maskExpression||this._maskService.maskExpression&&(this._maskService.prefix||this._maskService.showMaskTyped)?(typeof this.inputTransformFn!="function"&&(this._maskService.writingValue=!0),this._maskService.formElementProperty=["value",this._maskService.applyMask(t,this._maskService.maskExpression)],typeof this.inputTransformFn!="function"&&(this._maskService.writingValue=!1)):this._maskService.formElementProperty=["value",t],this._inputValue=t}else console.warn("Ngx-mask writeValue work with string | number, your current value:",typeof e)})}registerOnChange(e){this._maskService.onChange=this.onChange=e}registerOnTouched(e){this.onTouch=e}_getActiveElement(e=this.document){let t=e?.activeElement?.shadowRoot;return t?.activeElement?this._getActiveElement(t):e.activeElement}checkSelectionOnDeletion(e){e.selectionStart=Math.min(Math.max(this.prefix.length,e.selectionStart),this._inputValue.length-this.suffix.length),e.selectionEnd=Math.min(Math.max(this.prefix.length,e.selectionEnd),this._inputValue.length-this.suffix.length)}setDisabledState(e){this._maskService.formElementProperty=["disabled",e]}_applyMask(){this._maskService.maskExpression=this._maskService._repeatPatternSymbols(this._maskValue||""),this._maskService.formElementProperty=["value",this._maskService.applyMask(this._inputValue,this._maskService.maskExpression)]}_validateTime(e){let t=this._maskValue.split("").filter(i=>i!==":").length;return e&&(+(e[e.length-1]??-1)==0&&e.length<t||e.length<=t-2)?this._createValidationError(e):null}_getActualInputLength(){return this._maskService.actualValue.length||this._maskService.actualValue.length+this._maskService.prefix.length}_createValidationError(e){return{mask:{requiredMask:this._maskValue,actualValue:e}}}_setMask(){this._maskExpressionArray.some(e=>{if(e.split("").some(i=>this._maskService.specialCharacters.includes(i))&&this._inputValue&&!e.includes("S")||e.includes("{")){let i=this._maskService.removeMask(this._inputValue)?.length<=this._maskService.removeMask(e)?.length;if(i)return this._maskValue=this.maskExpression=this._maskService.maskExpression=e.includes("{")?this._maskService._repeatPatternSymbols(e):e,i;{let s=this._maskExpressionArray[this._maskExpressionArray.length-1]??"";this._maskValue=this.maskExpression=this._maskService.maskExpression=s.includes("{")?this._maskService._repeatPatternSymbols(s):s}}else{let i=this._maskService.removeMask(this._inputValue)?.split("").every((s,a)=>{let o=e.charAt(a);return this._maskService._checkSymbolMask(s,o)});if(i)return this._maskValue=this.maskExpression=this._maskService.maskExpression=e,i}})}static{this.\u0275fac=function(t){return new(t||h)}}static{this.\u0275dir=ce({type:h,selectors:[["input","mask",""],["textarea","mask",""]],hostBindings:function(t,i){t&1&&d("paste",function(){return i.onPaste()})("focus",function(a){return i.onFocus(a)})("ngModelChange",function(a){return i.onModelChange(a)})("input",function(a){return i.onInput(a)})("compositionstart",function(a){return i.onCompositionStart(a)})("compositionend",function(a){return i.onCompositionEnd(a)})("blur",function(a){return i.onBlur(a)})("click",function(a){return i.onClick(a)})("keydown",function(a){return i.onKeyDown(a)})},inputs:{maskExpression:[he.None,"mask","maskExpression"],specialCharacters:"specialCharacters",patterns:"patterns",prefix:"prefix",suffix:"suffix",thous
1andSeparator:"thousandSeparator",decimalMarker:"decimalMarker",dropSpecialCharacters:"dropSpecialCharacters",hiddenInput:"hiddenInput",showMaskTyped:"showMaskTyped",placeHolderCharacter:"placeHolderCharacter",shownMaskExpression:"shownMaskExpression",showTemplate:"showTemplate",clearIfNotMatch:"clearIfNotMatch",validation:"validation",separatorLimit:"separatorLimit",allowNegativeNumbers:"allowNegativeNumbers",leadZeroDateTime:"leadZeroDateTime",leadZero:"leadZero",triggerOnMaskChange:"triggerOnMaskChange",apm:"apm",inputTransformFn:"inputTransformFn",outputTransformFn:"outputTransformFn",keepCharacterPositions:"keepCharacterPositions"},outputs:{maskFilled:"maskFilled"},exportAs:["mask","ngxMask"],standalone:!0,features:[ke([{provide:ye,useExisting:h,multi:!0},{provide:Me,useExisting:h,multi:!0},W]),pe]})}}return h})(),ut=(()=>{class h{constructor(){this.defaultOptions={},this._maskService=x(W),this._maskExpressionArray=[],this.mask=""}transform(e,t,a={}){var o=a,{patterns:i}=o,s=re(o,["patterns"]);let r=se(N(N({maskExpression:t},this.defaultOptions),s),{patterns:N(N({},this._maskService.patterns),i)});if(Object.entries(r).forEach(([n,l])=>{this._maskService[n]=l}),t.includes("||"))return t.split("||").length>1?(this._maskExpressionArray=t.split("||").sort((n,l)=>n.length-l.length),this._setMask(e),this._maskService.applyMask(`${e}`,this.mask)):(this._maskExpressionArray=[],this._maskService.applyMask(`${e}`,this.mask));if(t.includes("{"))return this._maskService.applyMask(`${e}`,this._maskService._repeatPatternSymbols(t));if(t.startsWith("separator")){s.decimalMarker&&(this._maskService.decimalMarker=s.decimalMarker),s.thousandSeparator&&(this._maskService.thousandSeparator=s.thousandSeparator),s.leadZero&&(this._maskService.leadZero=s.leadZero),e=String(e);let n=this._maskService.currentLocaleDecimalMarker();Array.isArray(this._maskService.decimalMarker)||(e=this._maskService.decimalMarker!==n?e.replace(n,this._maskService.decimalMarker):e),this._maskService.leadZero&&e&&this._maskService.dropSpecialCharacters!==!1&&(e=this._maskService._checkPrecision(t,e)),this._maskService.decimalMarker===","&&(e=e.toString().replace(".",",")),this._maskService.isNumberValue=!0}return e==null?this._maskService.applyMask("",t):this._maskService.applyMask(`${e}`,t)}_setMask(e){this._maskExpressionArray.length>0&&this._maskExpressionArray.some(t=>{let i=this._maskService.removeMask(e)?.length<=this._maskService.removeMask(t)?.length;if(e&&i)return this.mask=t,i;{let s=this._maskExpressionArray[this._maskExpressionArray.length-1]??"";this.mask=s}})}static{this.\u0275fac=function(t){return new(t||h)}}static{this.\u0275pipe=oe({name:"mask",type:h,pure:!0,standalone:!0})}}return h})();var Je=()=>["fas","xmark"],Ue=()=>({style:"primary",name:"main"}),Ae=()=>["fas","plus"],Xe=()=>({style:"modal",name:"main"});function Qe(h,A){if(h&1){let e=V();f(0,"app-common-button-v4",17),d("clickEvent",function(){J(e);let i=F(2);return U(i.addValue())}),m()}if(h&2){let e=F(2);B("type",$(4,Ue))("disabled",!e.valueExist)("isAddIcon",!0)("icon",$(5,Ae))}}function Ye(h,A){if(h&1){let e=V();f(0,"app-common-button-v35",17),d("clickEvent",function(){J(e);let i=F(2);return U(i.addValue())}),m()}if(h&2){let e=F(2);B("type",$(4,Xe))("disabled",!e.valueExist)("isAddIcon",!0)("icon",$(5,Ae))}}function Ve(h,A){if(h&1&&(f(0,"div",15),Q(1,Qe,1,6,"app-common-button-v4",16)(2,Ye,1,6),m()),h&2){let e=F();P(),Y(1,e.dialogData.isV4?1:2)}}var bt=(()=>{class h{constructor(){this.dialogRef=x(Ce),this.dialogData=x(ve),this.input="",this.result="",this.valueExist=!1,this.showAddAmountButton=!1,this.outputDigitsCount=11,this.calculatedValue$=new ne,this.subscriptions=[],this.operators={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"^":(e,t)=>e**t,"%":(e,t)=>e%t}}ngOnInit(){this.subscriptions.push(this.calculatedValue$.subscribe(e=>{e===""?this.valueExist=!1:this.valueExist=!0})),this.showAddAmountButton=!!this.dialogData.addAmountButton,this.outputDigitsCount=this.dialogData.outputDigitsCount||this.outputDigitsCount}pressNum(e){if(e==="."&&this.input===""||e==="."&&this.input!==""&&this.getLastOperand().lastIndexOf(".")>=0)return;if(e==="0"){if(this.input==="")return;let i=this.input[this.input.length-1];
1if(i==="/"||i==="*"||i==="-"||i==="+")return}let t=this.input=this.input+e;e!=="."&&this.isNum(t)&&this.calculatedValue$.next(t),this.calcAnswer()}getLastOperand(){let e;return e=this.input.toString().lastIndexOf("+"),this.input.toString().lastIndexOf("-")>e&&(e=this.input.lastIndexOf("-")),this.input.toString().lastIndexOf("*")>e&&(e=this.input.lastIndexOf("*")),this.input.toString().lastIndexOf("/")>e&&(e=this.input.lastIndexOf("/")),this.input.substr(e+1)}pressOperator(e){if((typeof this.input=="string"?this.input:String(this.input)).trim()==="")return;let i=this.input[this.input.length-1];i==="/"||i==="*"||i==="-"||i==="+"||i==="."||(this.input+=e)}clear(){this.input!==""&&(this.input=this.input.substr(0,this.input.length-1),this.calculatedValue$.next(this.input))}allClear(){this.result="",this.input="",this.calculatedValue$.next(this.input)}calcAnswer(){let e=this.input,t=e[e.length-1];t==="."&&(e=e.substr(0,e.length-1)),t=e[e.length-1],(t==="/"||t==="*"||t==="-"||t==="+"||t===".")&&(e=e.substr(0,e.length-1));let i=this.calculate(e);this.result=String(i)}isNum(e){return!isNaN(Number(e))}getAnswer(){let e=this.input[this.input.length-1];!this.input||e==="."||(this.calcAnswer(),this.input=this.result,this.isNum(this.input)&&this.calculatedValue$.next(this.input),this.input==="0"&&(this.input=""),this.valueExist=!0)}calculate(e){let t=this.tokenize(e),i=[],s=[];for(let a of t)if(this.isNumber(a))i.push(parseFloat(a));else if(a==="(")s.push(a);else if(a===")"){for(;s.length&&s[s.length-1]!=="(";)this.applyOperator(i,s.pop());s.pop()}else if(this.isOperator(a)){for(;s.length;)this.applyOperator(i,s.pop());s.push(a)}for(;s.length;)this.applyOperator(i,s.pop());if(i.length!==1||typeof i[0]!="number")throw new Error("Invalid expression");return i[0]}tokenize(e){return e.match(/(\d+\.?\d*|\+|-|\*|\/|\^|%|\(|\))/g)||[]}isNumber(e){return!isNaN(parseFloat(e))}isOperator(e){return e in this.operators}applyOperator(e,t){if(e.length<2)throw new Error("Invalid expression: not enough operands");let i=e.pop(),s=e.pop();e.push(this.operators[t](s,i))}addValue(){this.calcAnswer(),this.input=this.result,this.isNum(this.input)&&this.calculatedValue$.next(this.input),this.dialogRef.close(this.formatCalculatorOutput(this.input)),this.input==="0"&&(this.input=""),this.valueExist=!0}formatCalculatorOutput(e){let t=Number(e);if(Math.abs(t)<1e-6||Math.abs(t)>=1e21){let a=t.toLocaleString();a=a.replace(/\.?0+(?=\.|$)|,/g,""),e=a}let[i,s]=e.split(".");if(i.length>=this.outputDigitsCount)return i.slice(0,this.outputDigitsCount);if(s){let a=this.outputDigitsCount-i.length-1;return`${i}.${s.slice(0,a)}`}return i}onKeyDown(e){let t=e.key.toLowerCase();e.preventDefault(),t==="c"||t==="backspace"?this.allClear():t===","||t==="."?this.pressNum("."):isNaN(parseInt(t))?t==="enter"?this.getAnswer():this.isOperator(t)&&this.pressOperator(t):this.pressNum(t)}ngOnDestroy(){this.subscriptions.forEach(e=>{e.unsubscribe()})}static{this.\u0275fac=function(t){return new(t||h)}}static{this.\u0275cmp=le({type:h,selectors:[["app-calculator"]],hostBindings:function(t,i){t&1&&d("keydown",function(a){return i.onKeyDown(a)},!1,de)},standalone:!0,features:[Se],decls:52,vars:6,consts:[["cdkDrag","","cdkDragRootElement",".cdk-overlay-pane","cdkDragHandle","",1,"calculator__wrapper"],[3,"mat-dialog-close"],[1,"text-secondary-text-color","cursor-pointer",3,"icon"],[1,"container-fluid"],[1,"calculator_body"],[1,"calc_header"],[1,"calc_display","max-h-[43px]","overflow-y-hidden"],["type","text",1,""],[1,"calc_result","max-h-[50px]","overflow-y-hidden"],[1,"calc_button_row"],["type","button",1,"clearBtn",3,"click"],["type","button",1,"normalBtn","arth_btn",3,"click"],[1,"calc_button_row","keys"],["type","button",1,"normalBtn",3,"click"],["type","button",1,"equalBtn",3,"click"],["mat-dialog-actions","",1,"add_btn__wrapper"],["text","Add to Amount",3,"type","disabled","isAddIcon","icon"],["text","Add to Amount",3,"clickEvent","type","disabled","isAddIcon","icon"]],template:function(t,i){t&1&&(f(0,"div",0)(1,"div",1),ge(2,"fa-icon",2),m(),f(3,"div",3)(4,"div",4)(5,"div",5)(6,"div",6)(7,"div",7),g(8),m()(),f(9,"div",8)(10,"div",7),g(11),m()()(),f(12,"div",9)(13,"button",10),d("click",function(){return i.allClear()}),g(14,"AC"),m(),f(15,"button",11),d("click",function(){return i.pressOperator("/")}),g(16," / "),m()(),f(17,"div",12)(18,"button",13),d("click",function(){return i.pressNum("7")}),g(19," 7 "),m(),f(20,"button",13),d("click",function(){return i.pressNum("8")}),g(21," 8 "),m(),f(22,"button",13),d("click",function(){return i.pressNum("9")}),g(23," 9 "),m(),f(24,"button",11),d("click",function(){return i.pressOperator("*")}),g(25," X "),m()(),f(26,"div",12)(27,"button",13),d("click",function(){return i.pressNum("4")}),g(28," 4 "),m(),f(29,"button",13),d("click",function(){return i.pressNum("5")}),g(30," 5 "),m(),f(31,"button",13),d("click",function(){return i.pressNum("6")}),g(32," 6 "),m(),f(33,"button",11),d("click",function(){return i.pressOperator("-")}
1),g(34," - "),m()(),f(35,"div",12)(36,"button",13),d("click",function(){return i.pressNum("1")}),g(37," 1 "),m(),f(38,"button",13),d("click",function(){return i.pressNum("2")}),g(39," 2 "),m(),f(40,"button",13),d("click",function(){return i.pressNum("3")}),g(41," 3 "),m(),f(42,"button",11),d("click",function(){return i.pressOperator("+")}),g(43," + "),m()(),f(44,"div",9)(45,"button",13),d("click",function(){return i.pressNum(".")}),g(46," . "),m(),f(47,"button",13),d("click",function(){return i.pressNum("0")}),g(48," 0 "),m(),f(49,"button",14),d("click",function(){return i.getAnswer()}),g(50,"="),m()()(),Q(51,Ve,3,1,"div",15),m()()),t&2&&(P(),B("mat-dialog-close",!1),P(),B("icon",$(5,Je)),P(6),ee(i.input),P(3),ee(i.result),P(40),Y(51,i.showAddAmountButton?51:-1))},dependencies:[Ne,Ee,xe,we,be,Te,Ie],styles:[".add_btn__wrapper[_ngcontent-%COMP%]{margin-top:1em;display:flex;justify-content:flex-end;padding-bottom:15px;margin-right:4px;cursor:all-scroll}.add_btn__wrapper[_ngcontent-%COMP%] .add_btn[_ngcontent-%COMP%]{display:flex;align-items:center;gap:3px}.add_btn__wrapper[_ngcontent-%COMP%] .add_btn[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{width:12px;height:12px;fill:var(--main-theme-variable)}.add_btn__wrapper[_ngcontent-%COMP%] .disableBtn[_ngcontent-%COMP%]{pointer-events:none;opacity:.8}.close_btn[_ngcontent-%COMP%]{position:absolute;left:13px;top:12px;width:11px;height:11px;cursor:pointer;z-index:99}.close_btn[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{fill:var(--semi-gray-color)}.calculator__wrapper[_ngcontent-%COMP%]{position:relative;margin:-24px -24px 0;padding:15px 14px 0}.calc_header[_ngcontent-%COMP%] .calc_display[_ngcontent-%COMP%]{font-size:24px;line-height:26px;font-weight:500;font-family:var(--muli);color:var(--common-font-color);text-align:right;height:43px;cursor:all-scroll}.calc_header[_ngcontent-%COMP%] .calc_result[_ngcontent-%COMP%]{padding:0 13px!important;width:100%;margin:0;padding:0;border:none;text-align:right;font-size:33px;height:50px;line-height:50px;text-transform:uppercase;cursor:all-scroll;background:transparent;font-size:40px;color:var(--common-font-color);font-family:var(--semi-font)}.calc_button_row[_ngcontent-%COMP%]{display:flex;justify-content:flex-start}.calc_button_row[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{height:55px;margin:3px;border:none;overflow:hidden;box-sizing:border-box;background:#cecece78;padding:0;text-align:center;font-size:18px;line-height:55px;font-weight:500;border-radius:10px;cursor:pointer;outline:none!important}.calc_button_row[_ngcontent-%COMP%] button.normalBtn[_ngcontent-%COMP%]{width:59px;background:var(--numbers-background-color);color:var(--common-font-color);font-family:var(--semi-font)}.calc_button_row[_ngcontent-%COMP%] button.equalBtn[_ngcontent-%COMP%]{flex-grow:1;background-color:var(--equals-button-background-color)}.calc_button_row[_ngcontent-%COMP%] button.clearBtn[_ngcontent-%COMP%]{flex-grow:1;color:var(--clear-button-font-color);background-color:var(--clear-button-background-color)}.calc_button_row[_ngcontent-%COMP%] button.arth_btn[_ngcontent-%COMP%]{background-color:var(--operations-button-background-color)}"]})}}return h})();export{qe as a,ct as b,ot as c,ut as d,bt as e};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.