reslib 2.1.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/auth/errors.d.ts +4 -0
- package/build/auth/errors.js +5 -0
- package/build/auth/index.d.ts +65 -1963
- package/build/auth/index.js +2 -2
- package/build/auth/types.d.ts +42 -0
- package/build/countries/index.js +1 -1
- package/build/currency/index.js +1 -1
- package/build/currency/session.js +1 -1
- package/build/exception/index.js +2 -2
- package/build/i18n/index.js +1 -1
- package/build/inputFormatter/index.js +1 -1
- package/build/logger/index.js +1 -1
- package/build/resources/index.d.ts +5 -5
- package/build/resources/index.js +3 -3
- package/build/session/index.js +1 -1
- package/build/utils/date/dateHelper.js +1 -1
- package/build/utils/date/index.js +1 -1
- package/build/utils/index.js +1 -1
- package/build/utils/json.d.ts +13 -6
- package/build/utils/json.js +1 -1
- package/build/utils/numbers.js +1 -1
- package/build/validator/index.js +3 -3
- package/build/validator/rules/array.js +2 -2
- package/build/validator/rules/boolean.js +2 -2
- package/build/validator/rules/date.js +2 -2
- package/build/validator/rules/default.js +2 -2
- package/build/validator/rules/enum.d.ts +5 -5
- package/build/validator/rules/enum.js +2 -2
- package/build/validator/rules/file.js +2 -2
- package/build/validator/rules/format.d.ts +1 -1
- package/build/validator/rules/format.js +3 -3
- package/build/validator/rules/ifRule.d.ts +76 -0
- package/build/validator/rules/ifRule.js +5 -0
- package/build/validator/rules/index.d.ts +1 -0
- package/build/validator/rules/index.js +3 -3
- package/build/validator/rules/multiRules.js +2 -2
- package/build/validator/rules/numeric.js +2 -2
- package/build/validator/rules/object.js +2 -2
- package/build/validator/rules/string.js +2 -2
- package/build/validator/rules/target.js +2 -2
- package/build/validator/rulesMarkers.d.ts +1 -0
- package/build/validator/rulesMarkers.js +1 -1
- package/build/validator/types.d.ts +399 -48
- package/build/validator/validator.d.ts +425 -5
- package/build/validator/validator.js +2 -2
- package/package.json +1 -3
package/build/utils/numbers.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
%{failedRulesErrors}`,oneOf:`The field %{fieldName} must match at least one of the following validation rules:
|
|
3
3
|
%{failedRulesErrors}`,allOf:`The field %{fieldName} must match all of the following validation rules:
|
|
4
4
|
%{failedRulesErrors}`,validateNested:`The field %{fieldName} must be a valid nested object. Errors:
|
|
5
|
-
%{nestedErrors}`,validateNestedInvalidType:"The field %{fieldName} must be an object, but received %{receivedType}",dateAfter:"This field must be after %{date}",dateBefore:"This field must be before %{date}",dateBetween:"This field must be between %{startDate} and %{endDate}",dateEquals:"This field must be equal to %{date}",futureDate:"This field must be a date in the future",pastDate:"This field must be a date in the past",file:"This field must be a valid file",fileSize:"This field must not exceed %{maxSize} bytes",fileType:"This field must be one of the following types: %{allowedTypes}",image:"This field must be a valid image file",fileExtension:"This field must have one of the following extensions: %{allowedExtensions}",minFileSize:"This field must be at least %{minSize} bytes",uuid:"This field must be a valid UUID",json:"This field must be valid JSON",base64:"This field must be valid Base64 encoded data",hexColor:"This field must be a valid hexadecimal color code",creditCard:"This field must be a valid credit card number",ip:"This field must be a valid IP address (version %{version})",macAddress:"This field must be a valid MAC address",matches:"This field must match the pattern %{pattern}",mongoId:"This field must be a valid MongoDB ObjectId",hexadecimal:"This field must be a valid hexadecimal value",object:"This field must be an object",isObject:"This field must be an object",invalidBulkData:"Invalid bulk data: an array is required",bulkValidationFailed:{one:"Bulk validation failed: 1 of %{totalCount} items failed",other:"Bulk validation failed: %{failureCount} of %{totalCount} items failed"},bulkValidationAllFailed:{one:"Validation failed for the single item",other:"All %{totalCount} items failed validation"},bulkValidationPartialFailure:"%{failureCount} items failed validation",separators:{multiple:", ",single:", "},nestedErrors:{separator:"; ",prefix:"",suffix:""},tests:{entity:{name:"Name",id:"Id",email:"Email",aString:"A String",url:"Url",note:"Note",createdAt:"Created At",updatedAt:"Updated At"}}};var Ze={auth:fe,currencies:ge,countries:ye,dates:pe,resources:be,validator:De};function X(a){return !!(a==null||typeof a=="undefined"||typeof a=="string"&&a===""||Array.isArray(a)&&!a.length)}function D(a){return typeof a=="number"&&!isNaN(a)&&isFinite(a)}function K(a){return !a||typeof a!="object"?false:a instanceof Date?true:typeof a.getTime!="function"?false:!(Object.prototype.toString.call(a)!=="[object Date]"||isNaN(a.getTime()))}var c=class c{static parseString(e,t){if(m(e)&&m(t))try{let i=w__default.default(e,t,!0);if(i.isValid())return {date:i.toDate(),matchedFormat:t,isValid:!0}}catch(i){}try{if(Array.isArray(t)&&(t!=null&&t.length))for(let i of t){let r=he(e,i);if(r)return r}for(let i of c.DATE_FORMATS){let r=he(e,i);if(r)return r}return {date:null,matchedFormat:null,isValid:!1,error:"Unable to parse date string with any known format"}}catch(i){return {date:null,matchedFormat:null,isValid:false,error:i instanceof Error?i.message:"Unknown error occurred while parsing date"}}}static toIsoString(e){let t=e?c.parseDate(e):new Date;return t?t.toISOString():""}static isoStringToDate(e){return new Date(e)}static parseDate(e,t){if(c.isDateObj(e))return e;if(!m(t)){let i=c.parseString(e);return i!=null&&i.isValid?i.date:null}if(X(e))return null;try{let i=w__default.default(e,t,!0);if(i!=null&&i.isValid())return i.toDate()}catch(i){console.error(i," parsing date with moment : ",e," format is : ",t);}return null}static toSQLDateTimeFormat(e){if(!c.isDateObj(e))return "";let t=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),n=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0");return `${t}-${i}-${r} ${n}:${o}:${l}`}static getI18n(e){return I.isI18nInstance(e)?e:I.getInstance()}static getDefaultDateTimeFormat(e){return u(this.getI18n(e).get("dates.defaultDateTimeFormat"),"YYYY-MM-DD HH:mm")}static getDefaultDateFormat(e){return u(this.getI18n(e).get("dates.defaultDateFormat"),"YYYY-MM-DD")}static toSQLDateFormat(e){if(!c.isDateObj(e))return "";let t=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${i}-${r}`}static toSQLTimeFormat(e){if(!c.isDateObj(e))return "";let t=String(e.getHours()).padStart(2,"0"),i=String(e.getMinutes()).padStart(2,"0"),r=String(e.getSeconds()).padStart(2,"0");return `${t}:${i}:${r}`}static getDefaultTimeFormat(e){return u(this.getI18n(e).get("dates.defaultTimeFormat"),"HH:mm")}static isValidDate(e,t){if(e==null||typeof e=="boolean")return false;if(c.isDateObj(e))return true;if(D(e)){let r=new Date(e);return r&&!isNaN(r.getTime())}if(m(e))return !!c.parseDate(e,t);if(e!=null&&e.toString&&(e==null?void 0:e.toString())==parseInt(e).toString())return false;let i=new Date(e);return c.isDateObj(i)}static addToDate(e,t,i){if(D(e)||(e=0),X(t)&&(t=new Date),c.isValidDate(t)&&m(t)&&(t=new Date(t)),c.isValidDate(t)||(t=m(t)?new Date(t):new Date),m(i)&&typeof t["set"+i]=="function"&&typeof t["get"+i]=="function"){let r="set"+i,n="get"+i;t=new Date(t[r](t[n]()+e));}return t}static addDays(e,t){return c.addToDate(e,t,"Date")}static addMilliseconds(e,t){return D(e)||(e=0),c.isDateObj(t)||(t=new Date),t=t||new Date,new Date(t.getTime()+e)}static addSeconds(e,t){return D(e)||(e=0),c.addMilliseconds(e*1e3,t)}static addMinutes(e,t){return D(e)||(e=0),c.addMilliseconds(e*6e4,t)}static addHours(e,t){return D(e)||(e=0),c.addMilliseconds(e*36e5,t)}static addMonths(e,t,i){return c.addToDate(e,t,"Month")}static addWeeks(e,t){return e=(D(e)?e:0)*7,c.addToDate(e,t,"Date")}static addYears(e,t){D(e)||(e=0);let i=new Date(c.addToDate(0,t)),r=i.getFullYear();return r+e<0?e=0:e+=r,i.setFullYear(e),new Date(i)}static formatDate(e,t){try{let i=w__default.default(e);if(i.isValid())return i.format(u(t,c.getDefaultDateTimeFormat()))}catch(i){}return u(c.isValidDate(e)?e==null?void 0:e.toString():"")}static getUTCDateTimeDetails(e){let t=e?w__default.default.utc(e):w__default.default.utc();return {year:t.year(),day:t.day(),month:t.month(),monthString:t.format("MM"),hours:t.hours(),date:t.date(),minutes:t.minutes(),seconds:t.seconds(),monthName:t.format("MMMM"),dayName:t.format("dddd"),dayNameShort:t.format("ddd")}}};c.DATE_FORMATS=["YYYY-MM-DD","YYYY-MM-DDTHH:mm:ss","YYYY-MM-DDTHH:mm:ssZ","YYYY-MM-DDTHH:mm:ss.SSSZ","YYYY-MM-DDTHH:mm:ss[Z]","YYYY-MM-DDTHH:mm:ss.SSS[Z]","YYYY-MM-DDTHH:mm:ss.SSSZ ","YYYY-MM-DDTHH:mm:ss.SSS","YYYY-MM-DD HH:mm:ss","YYYY-MM-DD HH:mm:ss.SSSZ","YYYY-MM-DDTHH:mm:ss.SSS[Z]","YYYY-MM-DD HH:mm:ssZ","YYYY-MM-DD HH:mmZ","MM/DD/YYYY","MM-DD-YYYY","MM.DD.YYYY","MM/DD/YY","MMMM DD, YYYY","MMM DD, YYYY","DD/MM/YYYY","DD-MM-YYYY","DD.MM.YYYY","DD/MM/YY","DD MMMM YYYY","DD MMM YYYY","HH:mm:ss.SSSZ","HH:mm:ssZ","HH:mmZ","YYYYMMDD","YYYYMMDDTHHMM","YYYYMMDDTHHMMSS","HH:mm:ss","HH:mm","hh:mm A","h:mm A","HH:mm:ss.SSS","YYYY-DDD","YYYY-Www","YYYY-Www-D","YYYY/MM/DD","YYYY.MM.DD","MMM D, YYYY","MMMM D, YYYY","D MMM YYYY","D MMMM YYYY","MMM D YYYY","ddd, DD MMM YYYY HH:mm:ss ZZ","ddd, DD MMM YYYY HH:mm:ss","dddd, MMMM D, YYYY","dddd, D MMMM YYYY","hh:mm:ss A","H:mm:ss","YYYY-[W]WW","YYYY-[W]WW-E","YYYY-MM-DDTHH:mm:ss.SSS","DD-MM-YYYY HH:mm:ss","YYYY/MM/DD HH:mm:ss","YYYY.MM.DD HH:mm:ss","DD/MM/YYYY HH:mm:ss","MMM D YYYY, h:mm a","MMMM D YYYY, h:mm a","h:mm A MMM D, YYYY","MMMM D, YYYY","YY-MM-DD","DD-MM-YY","MM/DD/YY","MMM DD, YY","D MMM YY","D MMMM YY","YYYY MMM D","YYYY-MM-DD HH:mm","YYYY-MM-DD HH:mm:ss.SSS"],c.SQL_DATE_FORMAT="YYYY-MM-DD",c.SQL_DATE_TIME_FORMAT="YYYY-MM-DD HH:mm:ss",c.SQL_TIME_FORMAT="HH:mm:ss",c.getCurrentMonthDaysRange=e=>{let t=c.isValidDate(e)?new Date(e):new Date().resetHours2Minutes2Seconds(),i=new Date(t.getFullYear(),t.getMonth(),1),r=new Date(t.getFullYear(),t.getMonth()+1,0);return {first:i,last:r}},c.getPreviousWeekDaysRange=e=>{let t=c.isValidDate(e)?new Date(e):new Date().resetHours2Minutes2Seconds(),i=new Date(t.getTime()-3600*24*7*1e3),r=new Date(i),n=i.getDay(),o=i.getDate()-n+(n===0?-6:1),l=new Date(i.setDate(o)),s=new Date(r.setDate(o+6));return {first:l,last:s}},c.getCurrentWeekDaysRange=e=>{let t=c.isValidDate(e)?new Date(e):new Date().resetHours2Minutes2Seconds(),i=t.getDay(),r=t.getDate()-i+(i==0?-6:1),n=new Date(t),o=new Date(t.setDate(r));return n.setDate(n.getDate()+6),{first:o,last:n}},c.isDateObj=K;var b=c,he=(a,e)=>{let t=w__default.default(a,e,true);try{if(t.isValid()&&t.format(e)===a||w__default.default.utc(t,!0).format(e)===a)return {date:t.toDate(),matchedFormat:e,isValid:!0}}catch(i){}return null};Date.prototype.toSQLDateTimeFormat=function(){return b.toSQLDateTimeFormat(this)};Date.prototype.toSQLDateFormat=function(){return b.toSQLDateFormat(this)};Date.prototype.toSQLTimeFormat=function(){return b.toSQLTimeFormat(this)};Date.prototype.resetHours=function(){return this.setHours(0),this};Date.prototype.resetMinutes=function(){return this.setMinutes(0),this};Date.prototype.resetSeconds=function(){return this.setSeconds(0),this};Date.prototype.resetMilliseconds=function(){return this.setMilliseconds(0),this};Date.prototype.resetHours2Minutes2Seconds=function(){return this.setHours(0),this.setMinutes(0),this.setSeconds(0),this.setMilliseconds(0),this};Date.prototype.toFormat=function(a){return b.formatDate(this,a)};Date.prototype.addYears=function(a){return b.addYears(a,this)};Date.prototype.addMonths=function(a){return b.addMonths(a,this)};Date.prototype.addMinutes=function(a){return b.addMinutes(a,this)};Date.prototype.addSeconds=function(a){return b.addSeconds(a,this)};Date.prototype.addDays=function(a){return b.addDays(a,this)};Date.prototype.addWeeks=function(a){return b.addWeeks(a,this)};Date.prototype.addHours=function(a){return b.addHours(a,this)};var N=class N{static get logger(){let e=Reflect.getMetadata(N.loggerMetaData,N);return Ce(e)&&(this._logger=e),this._logger?this._logger:console}static set logger(e){Ce(e)&&Reflect.defineMetadata(N.loggerMetaData,e,N);}static _log(e,...t){let i=N.logger;e=u(e),e&&typeof i[e]=="function"?i[e](N.getDateTimeString(),...t):console.log("Logger level not found : [",e,"]",...t);}static getDateTimeString(){let{day:e,year:t,hours:i,minutes:r,seconds:n,dayNameShort:o,monthName:l}=b.getUTCDateTimeDetails(),s=e<10?"0"+e:e,d=i<10?"0"+i:i,y=r<10?"0"+r:r,g=n<10?"0"+n:n;return "["+[o,s,l,t].join(" ")+" "+[d,y,g].join(":")+"]"}static log(...e){this._log("log",...e);}static info(...e){this._log("info",...e);}static debug(...e){this._log("debug",...e);}static warn(...e){this._log("warn",...e);}static error(...e){this._log("error",...e);}};N.loggerMetaData=Symbol("logger-meta-data");var H=N,Ce=a=>{if(!a)return false;try{return ["warn","info","error"].every(e=>typeof a[e]=="function")}catch(e){return false}};function We(a){return typeof a=="boolean"||!a||typeof a=="number"||typeof a=="string"||typeof a=="symbol"?false:Object(a).constructor===Promise||a.constructor&&(a.constructor.name==="Promise"||a.constructor.name==="AsyncFunction")||a instanceof Promise||typeof(a==null?void 0:a.then)=="function"&&typeof(a==null?void 0:a.catch)=="function"&&typeof(a==null?void 0:a.finally)=="function"?true:a&&typeof a.constructor=="function"&&Function.prototype.toString.call(a.constructor).replace(/\(.*\)/,"()")===Function.prototype.toString.call(Function).replace("Function","Promise").replace(/\(.*\)/,"()")}function Me(a){return a&&Object.prototype.toString.call(a)==="[object Promise]"?true:We(a)}function Se(){return typeof window!="undefined"&&(window==null?void 0:window.document)!==void 0&&typeof document!="undefined"&&typeof navigator!="undefined"}var $=()=>{var a;try{if(typeof process!="undefined"&&(process!=null&&process.versions)&&((a=process==null?void 0:process.versions)!=null&&a.node)||typeof global=="object"&&(global==null?void 0:global.toString.call(global))==="[object global]")return !0}catch(e){}return false},je=()=>{var a,e;return !!(typeof window!="undefined"&&window&&typeof(window==null?void 0:window.process)=="object"&&((a=window==null?void 0:window.process)==null?void 0:a.type)==="renderer"||typeof process!="undefined"&&typeof(process==null?void 0:process.versions)=="object"&&((e=process.versions)!=null&&e.electron)||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&String(navigator==null?void 0:navigator.userAgent).toLowerCase().indexOf("electron")>=0)},ze=()=>{if(typeof document!="undefined"&&document)try{return document.createEvent("TouchEvent"),!0}catch(a){try{return "ontouchstart"in window||"onmsgesturechange"in window}catch(e){}}return false},Je=()=>typeof window=="undefined"&&typeof process!="undefined",Ne=()=>!!(typeof window!="undefined"&&typeof window=="object"&&window),Qe=()=>{if(!Se()||typeof navigator!="object"||!navigator||typeof navigator.userAgent!="string")return false;let a=navigator.userAgent.toLowerCase();return /android/i.test(a)},qe=()=>{var a;return !Ne()||!(window!=null&&window.ReactNativeWebView)?false:typeof((a=window==null?void 0:window.ReactNativeWebView)==null?void 0:a.postMessage)=="function"},Xe=()=>$()&&process.platform==="darwin",_e=()=>$()&&process.platform==="win32",ea=()=>$()&&process.platform==="linux",Te={isWeb:Se,isLinux:ea,isDarwin:Xe,isWin32:_e,isNode:$,isElectron:je,isTouchDevice:ze,isServerSide:Je,isClientSide:Ne,isAndroidMobileBrowser:Qe,isReactNativeWebview:qe};var O=class a{static decycle(e,t=[]){if(typeof e=="function")return;if(!e||typeof e!="object")return e;if(t.includes(e))return null;let i=t.concat([e]);return Array.isArray(e)?e.map(r=>a.decycle(r,i)):Object.fromEntries(Object.entries(e).map(([r,n])=>[r,a.decycle(n,i)]))}static stringify(e,t=false){return typeof e=="string"?e:JSON.stringify(t!==false?a.decycle(e):e)}static isJSON(e){if(typeof e!="string")return false;let t=e.trim();if(t.length===0)return false;let i=t[0];if(i!=="{"&&i!=="[")return false;try{let r=JSON.parse(t);return r!==null&&typeof r=="object"}catch(r){return false}}static parse(e,t){if(typeof e=="string")try{e=JSON.parse(e,t);}catch(i){return e}if(e&&typeof e=="object")for(let i in e){let r=e[i];a.isJSON(r)&&(e[i]=a.parse(r,t));}return e}};var Y=class Y{static get storage(){var t;let e=Reflect.getMetadata(Y.sessionStorageMetaData,Y);if(_(e)&&(this._storage=e),this._storage)return this._storage;if(Te.isClientSide()&&typeof window!="undefined"&&window.localStorage&&((t=window.localStorage)!=null&&t.getItem))this._storage={get:i=>window.localStorage.getItem(i),set:(i,r)=>window.localStorage.setItem(i,r),remove:i=>window.localStorage.removeItem(i),removeAll:()=>window.localStorage.clear()};else {let i={};this._storage={get:r=>i[r],set:(r,n)=>i[r]=n,remove:r=>{delete i[r];},removeAll:()=>i={}};}return this._storage}static set storage(e){_(e)&&Reflect.defineMetadata(Y.sessionStorageMetaData,e,Y);}static get keyNamespace(){return m(this._keyNamespace)?this._keyNamespace:""}static set keyNamespace(e){m(e)&&(this._keyNamespace=e.trim().replace(/\s+/g,"-"));}static sanitizeKey(e){if(!e||!m(e))return "";e=e.trim().replace(/\s+/g,"-");let t=this.keyNamespace;return t?`${t}-${e}`:e}};Y.sessionStorageMetaData=Symbol("sessionStorage"),Y._keyNamespace=void 0;var M=Y;function Z(a){return M.sanitizeKey(a)}var ve=(a,e)=>(a=a&&O.stringify(a,e),a==null&&(a=""),a),Pe=a=>{if(Me(a))return new Promise((e,t)=>{a.then(i=>{e(O.parse(i));}).catch(i=>{t(i);});});if(a!=null)return O.parse(a)},aa=a=>{if(a=Z(a),M.storage&&a&&typeof a=="string"){let e=M.storage.get(a);return Pe(e)}},ta=a=>{if(a=Z(a),M.storage&&a&&typeof a=="string")return M.storage.remove(a)},ia=()=>{if(M.storage)return M.storage.removeAll()},_=a=>{if(!a)return false;try{return ["get","set","remove","removeAll"].every(e=>typeof a[e]=="function")}catch(e){return false}},T={get:aa,set:(a,e,t=true)=>(a=Z(a),M.storage.set(a,ve(e,t))),remove:ta,handleGetValue:Pe,sanitizeKey:Z,handleSetValue:ve,isValidStorage:_,Manager:M,removeAll:ia};function k(a){return a==null||typeof a=="string"||typeof a=="number"||typeof a=="boolean"}function x(a){if(a instanceof RegExp)return true;if(!a||typeof a!="object"||!Object.prototype.toString.call(a).includes("RegExp"))return false;try{return new RegExp(a),!0}catch(e){return false}}function ee(a){return typeof window!="object"||!window||typeof document=="undefined"||typeof HTMLElement=="undefined"||!HTMLElement?false:a===document?true:"HTMLElement"in window?!!a&&a instanceof HTMLElement:!!a&&typeof a=="object"&&a.nodeType===1&&!!a.nodeName}function f(a){if(a===null||typeof a!="object"||ee(a)||K(a)||x(a)||k(a))return false;let e=Object.getPrototypeOf(a);if(e===null)return true;let t=e.constructor;if(typeof t!="function")return false;if(t===Object)return true;let i=t.prototype;return typeof i!="object"?false:i===Object.prototype?true:typeof e.hasOwnProperty=="function"&&Object.prototype.hasOwnProperty.call(e,"isPrototypeOf")&&typeof e.isPrototypeOf=="function"}function ae(a){if(Array.isArray(a)){let i=[];for(var e=0;e<a.length;e++)i[e]=ae(a[e]);return i}else if(f(a)&&a){let i={};for(var t in a)a.hasOwnProperty(t)&&(i[t]=ae(a[t]));return i}else return a}Object.getSize=function(a,e=false){if(!a||typeof a!="object")return 0;if(Array.isArray(a))return a.length;typeof e!="boolean"&&(e=false);let t=0;for(let i in a)if(Object.prototype.hasOwnProperty.call(a,i)&&(t++,e===true))return t;return t};function B(a,...e){let t=Array.isArray(a),i=f(a);(a==null||!t&&!i)&&(a={});for(let r=0;r<e.length;r++){let n=e[r];if(n==null)continue;let o=f(n),l=Array.isArray(n);if(!(!o&&!l)){if(t){l&&Ye(a,n);continue}else if(l)continue;for(let s in n){let d=n[s];if(d==null)continue;if(d===n){a[s]=a;continue}let y=a[s],g=Array.isArray(y),p=Array.isArray(d);if(g){p?Ye(a[s],d):a[s]=d;continue}else if(!f(y)){a[s]=d;continue}if(p||!f(d)){a[s]=d;continue}a[s]=B({},y,d);}}}return a}var Ye=(a,e)=>{let t=e.length,i=0;for(let r=0;r<a.length;r++){let n=a[r],o=e[r];if(r<t){let l=Array.isArray(n),s=Array.isArray(o),d=f(n),y=f(o);l&&s||d&&y?(a[i]=B(l?[]:{},n,o),i++):o!=null?(a[i]=o,i++):n!=null&&(a[i]=n,i++);}}for(let r=a.length;r<t;r++)e[r]!==void 0&&e[r]!==null&&a.push(e[r]);return a};function j(a,e){return W(a,"",{},e)}function W(a,e="",t={},i){if(t=f(t)?t:{},k(a)||K(a)||x(a)||Array.isArray(a)&&(i!=null&&i.skipArrays))return e&&(t[e]=a),t;if(typeof a=="function"||typeof a=="object"&&!f(a)&&!ra(a))return t;if(a instanceof Map||a instanceof WeakMap)return Array.from(a.entries()).forEach(([r,n])=>{let o=e?`${e}[${String(r)}]`:String(r);W(n,o,t,i);}),t;if(Array.isArray(a)||a instanceof Set||a instanceof WeakSet)return (Array.isArray(a)?a:Array.from(a)).forEach((n,o)=>{let l=e?`${e}[${o}]`:String(o);W(n,l,t,i);}),t;if(f(a))for(let r in a){if(!Object.prototype.hasOwnProperty.call(a,r))continue;let n=a[r],o=e?e.endsWith("]")?`${e}.${r}`:`${e}.${r}`:r;W(n,o,t,i);}return t}function ra(a){return Array.isArray(a)||a instanceof Set||a instanceof Map||a instanceof WeakMap||a instanceof WeakSet}function na(a){return Object.entries(a)}Object.typedEntries=na;Object.flatten=j;Object.clone=ae;function G(a,e){if(a==null)return "";if(typeof a=="string")return a;if((typeof a=="number"||typeof a=="object"&&a instanceof Number)&&typeof a.formatNumber=="function")return a.formatNumber();if(a instanceof Date||typeof a=="object"&&a!==null&&a.constructor===Date)return typeof a.toFormat=="function"?a.toFormat():a.toISOString();if(a instanceof Error)return `Error: ${a.message}`;if(x(a))return a.toString();if(k(a))return String(a);if(Array.isArray(a))return JSON.stringify(a);if(typeof a=="object"&&a!==null){if(typeof a.toString=="function"&&a.toString!==Object.prototype.toString)return a.toString();if(typeof a.toString=="function"){let t=a.toString();if(t!=="[object Object]")return t}return JSON.stringify(a)}return typeof(a==null?void 0:a.toString)=="function"?a.toString():String(a)}function Ae(a,e,t){let i=(t==null?void 0:t.valueFormatter)||G,r=u(a);if(!f(e)||!e)return r;let n=(t==null?void 0:t.tagRegex)||/%\{([^}]+)\}/g,o=new Set,l,s=u(a);for(;(l=n.exec(s))!==null;){let d=l[1];d!==void 0&&o.add(d);}return o.forEach(d=>{if(t!=null&&t.tagRegex){let C=new RegExp(t.tagRegex.source,t.tagRegex.flags);[...s.matchAll(C)].forEach(F=>{let R=F[0];if(!F[1])return;let V=F[1],J=Object.prototype.hasOwnProperty.call(e,V)?e[V]:void 0,xe=J===void 0?"":(()=>{try{return i(J,V,G)}catch(fa){return G(J)}})(),Ge=R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");r=r.replace(new RegExp(Ge,"g"),xe);});return}let y=`%{${d}}`,g=Object.prototype.hasOwnProperty.call(e,d)?e[d]:void 0,p=g===void 0?"":(()=>{try{return i(g,d,G)}catch(C){return G(g)}})(),P=y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");r=r.replace(new RegExp(P,"g"),p);}),r}var h=class h{constructor(e={},t={}){this.locale="en";this._locales=["en"];this._fallbackLocale="en";this._translations={};this.namespaceResolvers={};this._namespacesLoaded={};this._hasDefaultTranslations=false;m(t.locale)&&(this.locale=t.locale),m(t.fallbackLocale)&&(this._fallbackLocale=t.fallbackLocale),typeof t.interpolate=="function"&&(this.interpolateFunc=t.interpolate),this._hasDefaultTranslations||(this.registerTranslations(q),this._hasDefaultTranslations=true),e&&this.registerTranslations(e),this.loadNamespaces();}static[Symbol.hasInstance](e){return this.isI18nInstance(e)}static isI18nInstance(e){return !e||typeof e!="object"?false:e.constructor&&e.constructor.name==="I18n"?true:typeof e.getLocale=="function"&&typeof e.translate=="function"&&typeof e.translateClass=="function"&&typeof e.registerTranslations=="function"&&typeof e.loadNamespace=="function"&&typeof e.registerNamespaceResolver=="function"}static getInstance(e){if(!h.instance){let t=h.getLocaleFromSession(),i=Object.assign({locale:t||"en"},e);h.instance=new h({},i);}return h.instance}static createInstance(e={},t={}){return new h(e,t)}static flattenObject(e){return f(e)?j(e):e}static getLocaleFromSession(){let e=T.get("i18n.locale");return m(e)?e:void 0}static registerMomentLocale(e,t){return m(e)&&f(t)&&Array.isArray(t.months)&&(this.momentLocales[e]=B({},this.momentLocales[e],t)),this.momentLocales}static getClassTanslationKeys(e){return ue(e,Re)}translate(e,t){var o;t=t||{};let i=u(t==null?void 0:t.locale,this.getLocale()),r=Array.isArray(e)?e:[e],n;for(let l of r){if(!m(l))continue;let s=this.lookup(l,i);if(s===void 0&&i!==this._fallbackLocale&&(s=this.lookup(l,this._fallbackLocale)),s!==void 0){n=s;break}}if(n===void 0)return t.defaultValue!==void 0?t.defaultValue:this.missingTranslation(e,t);if(typeof t.count=="number"&&f(n)){let l=t.count,s="other";l===0&&n.zero!==void 0?s="zero":l===1&&n.one!==void 0&&(s="one"),n[s]!==void 0?n=n[s]:n.other&&(n=n.other);}return typeof n=="string"&&(D(t.count)&&!t.countStr&&(t.countStr=typeof((o=t.count)==null?void 0:o.formatNumber)=="function"?t.count.formatNumber():t.count.toString()),n=this.performInterpolation(n,t)),n}t(e,t){return this.translate(e,t)}has(e,t){let i=t||this.getLocale(),r=Array.isArray(e)?e:[e];for(let n of r)if(this.lookup(n,i)!==void 0)return true;return false}getLocale(){return this.locale}setLocale(e,t=false){return Q(this,null,function*(){return this.locale===e&&t!==true&&this._namespacesLoaded[e]?this.locale:(yield this.loadNamespaces(e),this.locale=e,this.isDefaultInstance()&&h.setLocaleToSession(e),this.setMomentLocale(e),this.locale)})}setLocales(e){return this._locales=Array.isArray(e)?e:["en"],this._locales.includes("en")||this._locales.push("en"),this.getLocales()}getLocales(){let e=Object.keys(this._translations),t=Array.isArray(this._locales)?this._locales:["en"],i=[...e,...t.filter(r=>!e.includes(r))];return Array.from(new Set(i))}hasLocale(e){return m(e)&&this.getLocales().includes(e)}isDefaultInstance(){return this===h.instance}registerTranslations(e){return this._translations=B({},this._translations,e),this._translations}getTranslations(e){return m(e)?this._translations[e]||{}:this._translations}registerNamespaceResolver(e,t){if(!m(e)||typeof t!="function"){console.warn("Invalid arguments for registerNamespaceResolver.");return}this.namespaceResolvers[e]=t;}loadNamespace(e,t,i=true){return !m(e)||!this.namespaceResolvers[e]?Promise.reject(new Error(`Invalid namespace or resolver for namespace "${e}".`)):(t=u(t,this.getLocale()),m(t)?this.namespaceResolvers[e](t).then(r=>{let n={};return n[t]=Object.assign({},r),f(r)&&i!==false&&this.registerTranslations(n),n}):Promise.reject(new Error(`Locale is not set. Cannot load namespace "${e}".`)))}loadNamespaces(e,t=true){return Q(this,null,function*(){e=u(e,this.getLocale());let i=[],r={};for(let o in this.namespaceResolvers)Object.prototype.hasOwnProperty.call(this.namespaceResolvers,o)&&i.push(this.namespaceResolvers[o](e).then(l=>{B(r,l);}));yield Promise.all(i);let n={};return n[e]=r,t!==false&&this.registerTranslations(n),this._namespacesLoaded[e]=true,n})}get(e,t){t=u(t,this.getLocale());let i=(m(e)?e.trim().split("."):Array.isArray(e)?e:[]).filter(m);if(!i.length)return;let r=this.getTranslations(t);for(let n of i)if(f(r))r=r[n];else return;return r}translateClass(e,t){let i=h.getClassTanslationKeys(e);for(let r in i)m(i[r])&&(i[r]=this.translate(i[r],t));return i}translateObject(e,t){if(!f(e))return {};let i={};for(let r in e){let n=e[r];m(n)&&(i[r]=this.translate(n,t));}return i}applyTranslations(e){try{let t=Object.getOwnPropertyNames(e);for(let i of t){let r=Reflect.getMetadata(Re,e,i);if(r)try{e[i]=this.translate(r);}catch(n){H.error(n," resolving translation for key : ",r," on object : ",e);}}}catch(t){H.error(t," resolving translations for object : ",e);}}missingTranslation(e,t){let i=u(Array.isArray(e)?e.filter(m)[0]:u(e));return typeof this.missingPlaceholder=="function"?this.missingPlaceholder(this,i,u(t==null?void 0:t.defaultValue),t):i}lookup(e,t){let i=this._translations[t];if(!i)return;if(Object.prototype.hasOwnProperty.call(i,e))return i[e];let r=e.split("."),n=i;for(let o of r)if(f(n)&&Object.prototype.hasOwnProperty.call(n,o))n=n[o];else return;return n}performInterpolation(e,t){let i=j(t);return this.interpolateFunc?this.interpolateFunc(this,e,t):this.defaultInterpolator(e,i)}defaultInterpolator(e,t){return Ae(e,t,{tagRegex:/%\{([^}]+)\}/g})}static setLocaleToSession(e){T.set("i18n.locale",e);}getMomentLocale(e){return h.momentLocales[e]}setMomentLocale(e){try{return w__default.default.updateLocale(e,this.getMomentLocale(e)),!0}catch(t){console.error(t," setting moment locale : ",e);}return false}};h.momentLocales={};var I=h,Le=I.getInstance();var Re=Symbol("TRANSLATION_KEY");var v=a=>a&&typeof a=="object"&&!Array.isArray(a)&&a.name&&typeof a.name=="string"&&a.symbol&&typeof a.symbol=="string";var we="%v %s",te=a=>{let e=T.get("currencyFormat");return e&&typeof e=="string"&&e.includes("%v")?e:a!==false?we:""};function Fe(a){return a=a&&typeof a=="string"?a.trim():"",T.set("currencyFormat",a)}var sa=a=>{if(!v(a)){let t=typeof a=="object"&&a&&!Array.isArray(a)?u(a.code,a.name):typeof a=="string"?a:void 0;t&&(t=t.trim().toUpperCase()),t&&v(S[t])?a=S[t]:typeof a=="string"&&(t=a.trim().toUpperCase(),v(S[t])&&(a=S[t]));}let e=Object.assign({},a);if(!e.format){let t=te();t&&(e.format=t);}return e.format&&Fe(e.format),T.set("appConfigCurrency",e),e},la=()=>{var r,n,o,l;let a=Object.assign({},T.get("appConfigCurrency")),e=T.get("currencyCode");if(m(e)&&v(S[e.trim().toUpperCase()])&&(a=L(L({},S[e.trim().toUpperCase()]),a)),!m(a==null?void 0:a.format)){let s=te(false);m(s)&&s.includes("%v")&&(a.format=s);}let i=S["USD"];return L(L({symbol:i.symbol,format:(r=i.format)!=null?r:"%v %s",decimalSeparator:(n=i.decimalSeparator)!=null?n:".",thousandSeparator:(o=i.thousandSeparator)!=null?o:",",decimalDigits:(l=i.decimalDigits)!=null?l:0},Object.assign({},Le.get("currencies"))),a)},A={getFormat:te,setFormat:Fe,setCurrency:sa,getCurrency:la,defaultCurrencyFormat:we};var da=a=>a&&typeof a=="object";function re(a){let e=Object.assign({},A.getCurrency());if(a&&da(a))for(let t in a)Object.prototype.hasOwnProperty.call(a,t)&&a[t]!==void 0&&(e[t]=a[t]);if(m(e.format)){let t=Be(e.format);t.format&&(e.format=t.format),typeof t.decimalDigits=="number"&&(e.decimalDigits=t.decimalDigits);}return e}function ne(a,e){return a=typeof a=="number"?a:0,e=typeof e=="number"?e:0,a=Math.round(Math.abs(a)),isNaN(a)?e:a}function ma(a){let e=A.getCurrency(),t=(e==null?void 0:e.format).toLowerCase();return typeof a=="string"&&(a=a.toLowerCase()),(typeof a!="string"||!a.match("%v"))&&(a=t),{pos:a,neg:a.replace("-","").replace("%v","-%v"),zero:a}}var z=(a,e)=>{let t=A.getCurrency();if(a=a||0,typeof a=="number")return a;e=e||t.decimalSeparator;let i=new RegExp("[^0-9-"+e+"]","g"),r=parseFloat((""+a).replace(/\((?=\d+)(.*)\)/,"-$1").replace(i,"").replace(e,"."));return isNaN(r)?0:r},ie=(a,e)=>{let t=A.getCurrency();e=ne(e,t.decimalDigits);let r=String(a).replace(/[^\d.-]/g,"");if(r.length>15&&!r.includes("."))return r+"."+"0".repeat(e);try{let n=Number(r);if(isNaN(n))return "NaN";let o=+(n+"e"+e);return (+(Math.round(o)+"e-"+e)).toFixed(e)}catch(n){return "NaN"}},Ie=(a,e,t,i)=>{var g;a=z(a);let r=v(e)?e:A.getCurrency();typeof e=="number"&&(r.decimalDigits=e),typeof r.decimalDigits!="number"&&(r.decimalDigits=(g=String(a).split(".")[1])==null?void 0:g.length),t!==void 0&&(r.thousandSeparator=t),i!==void 0&&(r.decimalSeparator=i);let n=re(r),o=ne(n.decimalDigits),l=a<0?"-":"",s=parseInt(ie(Math.abs(a||0),o),10)+"",d=s.length>3?s.length%3:0,y="";if(o){let p=String(parseFloat(ie(Math.abs(a),o))||0);p.includes(".")&&(y=u(p.split(".")[1]).trim());}return l+(d?s.substring(0,d)+n.thousandSeparator:"")+s.substring(d).replace(/(\d{3})(?=\d)/g,"$1"+n.thousandSeparator)+(o&&y?n.decimalSeparator+y:"")},Oe=(a,e,t,i,r,n)=>{a=z(a);let o=v(e)?e:A.getCurrency();e!==void 0&&typeof e=="string"&&(o.symbol=e),t!==void 0&&(o.decimalDigits=t),i!==void 0&&(o.thousandSeparator=i),r!==void 0&&(o.decimalSeparator=r),m(n)&&(o.format=n);let l=re(o),s=ma(l.format),d=u(a>0?s.pos:a<0?s.neg:s.zero),y=u(l.symbol),g=d.replace(y&&"%s",y),p=Ie(Math.abs(a),ne(l.decimalDigits),l.thousandSeparator,l.decimalSeparator),P=g.replace("%v",p);return me(L({},l),{formattedValue:g,formattedNumber:p,symbol:l.symbol,usedFormat:d,result:P})},ca=(a,e,t,i,r,n)=>Oe(a,e,t,i,r,n).result,Be=a=>{a=u(a).trim();let e={};if(a){let t=/(\.)(\#{0,9}\s*$)/,i=a.match(t);Array.isArray(i)&&i.length===3&&(e.decimalDigits=u(i[2]).trim().length),a=a.replace(t,"");}return e.format=a,e},E={parse:z,session:A,formatMoney:ca,currencies:S,isCurrency:v,formatNumber:Ie,formatMoneyAsObject:Oe,unformat:z,toFixed:ie,prepareOptions:re,parseFormat:Be};var{currencies:Ee}=E;Number.prototype.countDecimals=function(){let a=String(this.toString()).match(/\.(\d+)/);return a?a[1].length:0};Number.prototype.formatNumber=function(a,e,t){return E.formatNumber(this.valueOf(),a,e,t)};Number.prototype.formatMoney=function(a,e,t,i,r){return E.formatMoney(this.valueOf(),a,e,t,i,r)};var ua=(a,e,t,i)=>{var F;if(a===null||typeof a!="number"||isNaN(a))return {result:"",format:"",suffix:"",formattedValue:"",minAbreviationDecimalDigits:0,value:NaN};if(!isFinite(a)){let R=a>0?"\u221E":"-\u221E";return {result:R,value:a,format:"",suffix:"",formattedValue:R,minAbreviationDecimalDigits:0}}let r=Math.abs(a)<1e3,n=[{value:1e12,suffix:"T"},{value:1e9,suffix:"B"},{value:1e6,suffix:"M"},{value:1e3,suffix:"K"},{value:1,suffix:""}],o=a.countDecimals?a.countDecimals():Math.floor(a)===a?0:((F=a.toString().split(".")[1])==null?void 0:F.length)||0,l=n.find(R=>Math.abs(a)>=R.value)||n[n.length-1],s=r?a:a/(l.value===1?1:l.value),d=l.suffix,y=ya(s,5);if(a===0)return {result:"0",value:0,format:"",suffix:"",formattedValue:"0",minAbreviationDecimalDigits:0};let p=D(e)&&e>0?e:l.value===1?Math.min(o,5):Math.max(y,0),P=s.toFixed(p);t=u(t),i=u(i,".");let C=P.toString().split(".");return C[0]=C[0].replace(/\B(?=(\d{3})+(?!\d))/g,t),p>0&&C.length===1?C.push("0".repeat(p)):p>0&&C.length>1&&C[1].length<p&&(C[1]=C[1].padEnd(p,"0")),P=C.join(i),{result:P+d,value:a,format:d,suffix:d,formattedValue:P,minAbreviationDecimalDigits:y}};function ya(a,e){let t=Math.abs(a);if(Number.isInteger(t))return 0;let i=t.toString().split(".")[1]||"",r=0;for(;r<i.length&&i[r]==="0";)r++;return t<1&&r>0?Math.min(r+e,i.length):Math.min(e,i.length)}var Ke=(a,e,t,i)=>ua(a,e,t,i).result;Number.prototype.abreviate2FormatNumber=function(a,e,t){return Ke(this.valueOf(),a,e,t)};var He=(a,e,t,i,r,n)=>{if(!D(a))return "";let s=E.formatMoneyAsObject(a,e,t,i,r,n),{formattedValue:o}=s,l=ce(s,["formattedValue"]);return o.replace("%v",Ke(a,l.decimalDigits,l.thousandSeparator,l.decimalSeparator))};Number.prototype.abreviate2FormatMoney=function(a,e,t,i,r){return He(this.valueOf(),a,e,t,i,r)};function ni(...a){for(let e of a)if(D(e)&&e!==0)return e;return 0}Object.keys(Ee).forEach(a=>{let e=a,t=Ee[e],i=`format${e}`,r=`abreviate2Format${e}`;Number.prototype[i]=function(n,o,l,s){return E.formatMoney(this.valueOf(),t,n,o,l,s)},Number.prototype[r]=function(n,o,l,s){return He(this.valueOf(),t,n,o,l,s)};});exports._abreviateNumber=ua;exports.abreviate2FormatMoney=He;exports.abreviateNumber=Ke;exports.defaultNumber=ni;
|
|
5
|
+
%{nestedErrors}`,validateNestedInvalidType:"The field %{fieldName} must be an object, but received %{receivedType}",dateAfter:"This field must be after %{date}",dateBefore:"This field must be before %{date}",dateBetween:"This field must be between %{startDate} and %{endDate}",dateEquals:"This field must be equal to %{date}",futureDate:"This field must be a date in the future",pastDate:"This field must be a date in the past",file:"This field must be a valid file",fileSize:"This field must not exceed %{maxSize} bytes",fileType:"This field must be one of the following types: %{allowedTypes}",image:"This field must be a valid image file",fileExtension:"This field must have one of the following extensions: %{allowedExtensions}",minFileSize:"This field must be at least %{minSize} bytes",uuid:"This field must be a valid UUID",json:"This field must be valid JSON",base64:"This field must be valid Base64 encoded data",hexColor:"This field must be a valid hexadecimal color code",creditCard:"This field must be a valid credit card number",ip:"This field must be a valid IP address (version %{version})",macAddress:"This field must be a valid MAC address",matches:"This field must match the pattern %{pattern}",mongoId:"This field must be a valid MongoDB ObjectId",hexadecimal:"This field must be a valid hexadecimal value",object:"This field must be an object",isObject:"This field must be an object",invalidBulkData:"Invalid bulk data: an array is required",bulkValidationFailed:{one:"Bulk validation failed: 1 of %{totalCount} items failed",other:"Bulk validation failed: %{failureCount} of %{totalCount} items failed"},bulkValidationAllFailed:{one:"Validation failed for the single item",other:"All %{totalCount} items failed validation"},bulkValidationPartialFailure:"%{failureCount} items failed validation",separators:{multiple:", ",single:", "},nestedErrors:{separator:"; ",prefix:"",suffix:""},tests:{entity:{name:"Name",id:"Id",email:"Email",aString:"A String",url:"Url",note:"Note",createdAt:"Created At",updatedAt:"Updated At"}}};var Ze={auth:fe,currencies:ge,countries:ye,dates:pe,resources:be,validator:De};function X(a){return !!(a==null||typeof a=="undefined"||typeof a=="string"&&a===""||Array.isArray(a)&&!a.length)}function D(a){return typeof a=="number"&&!isNaN(a)&&isFinite(a)}function K(a){return !a||typeof a!="object"?false:a instanceof Date?true:typeof a.getTime!="function"?false:!(Object.prototype.toString.call(a)!=="[object Date]"||isNaN(a.getTime()))}var c=class c{static parseString(e,t){if(m(e)&&m(t))try{let i=w__default.default(e,t,!0);if(i.isValid())return {date:i.toDate(),matchedFormat:t,isValid:!0}}catch(i){}try{if(Array.isArray(t)&&(t!=null&&t.length))for(let i of t){let r=he(e,i);if(r)return r}for(let i of c.DATE_FORMATS){let r=he(e,i);if(r)return r}return {date:null,matchedFormat:null,isValid:!1,error:"Unable to parse date string with any known format"}}catch(i){return {date:null,matchedFormat:null,isValid:false,error:i instanceof Error?i.message:"Unknown error occurred while parsing date"}}}static toIsoString(e){let t=e?c.parseDate(e):new Date;return t?t.toISOString():""}static isoStringToDate(e){return new Date(e)}static parseDate(e,t){if(c.isDateObj(e))return e;if(!m(t)){let i=c.parseString(e);return i!=null&&i.isValid?i.date:null}if(X(e))return null;try{let i=w__default.default(e,t,!0);if(i!=null&&i.isValid())return i.toDate()}catch(i){console.error(i," parsing date with moment : ",e," format is : ",t);}return null}static toSQLDateTimeFormat(e){if(!c.isDateObj(e))return "";let t=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),n=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0");return `${t}-${i}-${r} ${n}:${o}:${l}`}static getI18n(e){return I.isI18nInstance(e)?e:I.getInstance()}static getDefaultDateTimeFormat(e){return u(this.getI18n(e).get("dates.defaultDateTimeFormat"),"YYYY-MM-DD HH:mm")}static getDefaultDateFormat(e){return u(this.getI18n(e).get("dates.defaultDateFormat"),"YYYY-MM-DD")}static toSQLDateFormat(e){if(!c.isDateObj(e))return "";let t=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${i}-${r}`}static toSQLTimeFormat(e){if(!c.isDateObj(e))return "";let t=String(e.getHours()).padStart(2,"0"),i=String(e.getMinutes()).padStart(2,"0"),r=String(e.getSeconds()).padStart(2,"0");return `${t}:${i}:${r}`}static getDefaultTimeFormat(e){return u(this.getI18n(e).get("dates.defaultTimeFormat"),"HH:mm")}static isValidDate(e,t){if(e==null||typeof e=="boolean")return false;if(c.isDateObj(e))return true;if(D(e)){let r=new Date(e);return r&&!isNaN(r.getTime())}if(m(e))return !!c.parseDate(e,t);if(e!=null&&e.toString&&(e==null?void 0:e.toString())==parseInt(e).toString())return false;let i=new Date(e);return c.isDateObj(i)}static addToDate(e,t,i){if(D(e)||(e=0),X(t)&&(t=new Date),c.isValidDate(t)&&m(t)&&(t=new Date(t)),c.isValidDate(t)||(t=m(t)?new Date(t):new Date),m(i)&&typeof t["set"+i]=="function"&&typeof t["get"+i]=="function"){let r="set"+i,n="get"+i;t=new Date(t[r](t[n]()+e));}return t}static addDays(e,t){return c.addToDate(e,t,"Date")}static addMilliseconds(e,t){return D(e)||(e=0),c.isDateObj(t)||(t=new Date),t=t||new Date,new Date(t.getTime()+e)}static addSeconds(e,t){return D(e)||(e=0),c.addMilliseconds(e*1e3,t)}static addMinutes(e,t){return D(e)||(e=0),c.addMilliseconds(e*6e4,t)}static addHours(e,t){return D(e)||(e=0),c.addMilliseconds(e*36e5,t)}static addMonths(e,t,i){return c.addToDate(e,t,"Month")}static addWeeks(e,t){return e=(D(e)?e:0)*7,c.addToDate(e,t,"Date")}static addYears(e,t){D(e)||(e=0);let i=new Date(c.addToDate(0,t)),r=i.getFullYear();return r+e<0?e=0:e+=r,i.setFullYear(e),new Date(i)}static formatDate(e,t){try{let i=w__default.default(e);if(i.isValid())return i.format(u(t,c.getDefaultDateTimeFormat()))}catch(i){}return u(c.isValidDate(e)?e==null?void 0:e.toString():"")}static getUTCDateTimeDetails(e){let t=e?w__default.default.utc(e):w__default.default.utc();return {year:t.year(),day:t.day(),month:t.month(),monthString:t.format("MM"),hours:t.hours(),date:t.date(),minutes:t.minutes(),seconds:t.seconds(),monthName:t.format("MMMM"),dayName:t.format("dddd"),dayNameShort:t.format("ddd")}}};c.DATE_FORMATS=["YYYY-MM-DD","YYYY-MM-DDTHH:mm:ss","YYYY-MM-DDTHH:mm:ssZ","YYYY-MM-DDTHH:mm:ss.SSSZ","YYYY-MM-DDTHH:mm:ss[Z]","YYYY-MM-DDTHH:mm:ss.SSS[Z]","YYYY-MM-DDTHH:mm:ss.SSSZ ","YYYY-MM-DDTHH:mm:ss.SSS","YYYY-MM-DD HH:mm:ss","YYYY-MM-DD HH:mm:ss.SSSZ","YYYY-MM-DDTHH:mm:ss.SSS[Z]","YYYY-MM-DD HH:mm:ssZ","YYYY-MM-DD HH:mmZ","MM/DD/YYYY","MM-DD-YYYY","MM.DD.YYYY","MM/DD/YY","MMMM DD, YYYY","MMM DD, YYYY","DD/MM/YYYY","DD-MM-YYYY","DD.MM.YYYY","DD/MM/YY","DD MMMM YYYY","DD MMM YYYY","HH:mm:ss.SSSZ","HH:mm:ssZ","HH:mmZ","YYYYMMDD","YYYYMMDDTHHMM","YYYYMMDDTHHMMSS","HH:mm:ss","HH:mm","hh:mm A","h:mm A","HH:mm:ss.SSS","YYYY-DDD","YYYY-Www","YYYY-Www-D","YYYY/MM/DD","YYYY.MM.DD","MMM D, YYYY","MMMM D, YYYY","D MMM YYYY","D MMMM YYYY","MMM D YYYY","ddd, DD MMM YYYY HH:mm:ss ZZ","ddd, DD MMM YYYY HH:mm:ss","dddd, MMMM D, YYYY","dddd, D MMMM YYYY","hh:mm:ss A","H:mm:ss","YYYY-[W]WW","YYYY-[W]WW-E","YYYY-MM-DDTHH:mm:ss.SSS","DD-MM-YYYY HH:mm:ss","YYYY/MM/DD HH:mm:ss","YYYY.MM.DD HH:mm:ss","DD/MM/YYYY HH:mm:ss","MMM D YYYY, h:mm a","MMMM D YYYY, h:mm a","h:mm A MMM D, YYYY","MMMM D, YYYY","YY-MM-DD","DD-MM-YY","MM/DD/YY","MMM DD, YY","D MMM YY","D MMMM YY","YYYY MMM D","YYYY-MM-DD HH:mm","YYYY-MM-DD HH:mm:ss.SSS"],c.SQL_DATE_FORMAT="YYYY-MM-DD",c.SQL_DATE_TIME_FORMAT="YYYY-MM-DD HH:mm:ss",c.SQL_TIME_FORMAT="HH:mm:ss",c.getCurrentMonthDaysRange=e=>{let t=c.isValidDate(e)?new Date(e):new Date().resetHours2Minutes2Seconds(),i=new Date(t.getFullYear(),t.getMonth(),1),r=new Date(t.getFullYear(),t.getMonth()+1,0);return {first:i,last:r}},c.getPreviousWeekDaysRange=e=>{let t=c.isValidDate(e)?new Date(e):new Date().resetHours2Minutes2Seconds(),i=new Date(t.getTime()-3600*24*7*1e3),r=new Date(i),n=i.getDay(),o=i.getDate()-n+(n===0?-6:1),l=new Date(i.setDate(o)),s=new Date(r.setDate(o+6));return {first:l,last:s}},c.getCurrentWeekDaysRange=e=>{let t=c.isValidDate(e)?new Date(e):new Date().resetHours2Minutes2Seconds(),i=t.getDay(),r=t.getDate()-i+(i==0?-6:1),n=new Date(t),o=new Date(t.setDate(r));return n.setDate(n.getDate()+6),{first:o,last:n}},c.isDateObj=K;var b=c,he=(a,e)=>{let t=w__default.default(a,e,true);try{if(t.isValid()&&t.format(e)===a||w__default.default.utc(t,!0).format(e)===a)return {date:t.toDate(),matchedFormat:e,isValid:!0}}catch(i){}return null};Date.prototype.toSQLDateTimeFormat=function(){return b.toSQLDateTimeFormat(this)};Date.prototype.toSQLDateFormat=function(){return b.toSQLDateFormat(this)};Date.prototype.toSQLTimeFormat=function(){return b.toSQLTimeFormat(this)};Date.prototype.resetHours=function(){return this.setHours(0),this};Date.prototype.resetMinutes=function(){return this.setMinutes(0),this};Date.prototype.resetSeconds=function(){return this.setSeconds(0),this};Date.prototype.resetMilliseconds=function(){return this.setMilliseconds(0),this};Date.prototype.resetHours2Minutes2Seconds=function(){return this.setHours(0),this.setMinutes(0),this.setSeconds(0),this.setMilliseconds(0),this};Date.prototype.toFormat=function(a){return b.formatDate(this,a)};Date.prototype.addYears=function(a){return b.addYears(a,this)};Date.prototype.addMonths=function(a){return b.addMonths(a,this)};Date.prototype.addMinutes=function(a){return b.addMinutes(a,this)};Date.prototype.addSeconds=function(a){return b.addSeconds(a,this)};Date.prototype.addDays=function(a){return b.addDays(a,this)};Date.prototype.addWeeks=function(a){return b.addWeeks(a,this)};Date.prototype.addHours=function(a){return b.addHours(a,this)};var N=class N{static get logger(){let e=Reflect.getMetadata(N.loggerMetaData,N);return Ce(e)&&(this._logger=e),this._logger?this._logger:console}static set logger(e){Ce(e)&&Reflect.defineMetadata(N.loggerMetaData,e,N);}static _log(e,...t){let i=N.logger;e=u(e),e&&typeof i[e]=="function"?i[e](N.getDateTimeString(),...t):console.log("Logger level not found : [",e,"]",...t);}static getDateTimeString(){let{day:e,year:t,hours:i,minutes:r,seconds:n,dayNameShort:o,monthName:l}=b.getUTCDateTimeDetails(),s=e<10?"0"+e:e,d=i<10?"0"+i:i,y=r<10?"0"+r:r,g=n<10?"0"+n:n;return "["+[o,s,l,t].join(" ")+" "+[d,y,g].join(":")+"]"}static log(...e){this._log("log",...e);}static info(...e){this._log("info",...e);}static debug(...e){this._log("debug",...e);}static warn(...e){this._log("warn",...e);}static error(...e){this._log("error",...e);}};N.loggerMetaData=Symbol("logger-meta-data");var H=N,Ce=a=>{if(!a)return false;try{return ["warn","info","error"].every(e=>typeof a[e]=="function")}catch(e){return false}};function We(a){return typeof a=="boolean"||!a||typeof a=="number"||typeof a=="string"||typeof a=="symbol"?false:Object(a).constructor===Promise||a.constructor&&(a.constructor.name==="Promise"||a.constructor.name==="AsyncFunction")||a instanceof Promise||typeof(a==null?void 0:a.then)=="function"&&typeof(a==null?void 0:a.catch)=="function"&&typeof(a==null?void 0:a.finally)=="function"?true:a&&typeof a.constructor=="function"&&Function.prototype.toString.call(a.constructor).replace(/\(.*\)/,"()")===Function.prototype.toString.call(Function).replace("Function","Promise").replace(/\(.*\)/,"()")}function Me(a){return a&&Object.prototype.toString.call(a)==="[object Promise]"?true:We(a)}function Se(){return typeof window!="undefined"&&(window==null?void 0:window.document)!==void 0&&typeof document!="undefined"&&typeof navigator!="undefined"}var $=()=>{var a;try{if(typeof process!="undefined"&&(process!=null&&process.versions)&&((a=process==null?void 0:process.versions)!=null&&a.node)||typeof global=="object"&&(global==null?void 0:global.toString.call(global))==="[object global]")return !0}catch(e){}return false},je=()=>{var a,e;return !!(typeof window!="undefined"&&window&&typeof(window==null?void 0:window.process)=="object"&&((a=window==null?void 0:window.process)==null?void 0:a.type)==="renderer"||typeof process!="undefined"&&typeof(process==null?void 0:process.versions)=="object"&&((e=process.versions)!=null&&e.electron)||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&String(navigator==null?void 0:navigator.userAgent).toLowerCase().indexOf("electron")>=0)},ze=()=>{if(typeof document!="undefined"&&document)try{return document.createEvent("TouchEvent"),!0}catch(a){try{return "ontouchstart"in window||"onmsgesturechange"in window}catch(e){}}return false},Je=()=>typeof window=="undefined"&&typeof process!="undefined",Ne=()=>!!(typeof window!="undefined"&&typeof window=="object"&&window),Qe=()=>{if(!Se()||typeof navigator!="object"||!navigator||typeof navigator.userAgent!="string")return false;let a=navigator.userAgent.toLowerCase();return /android/i.test(a)},qe=()=>{var a;return !Ne()||!(window!=null&&window.ReactNativeWebView)?false:typeof((a=window==null?void 0:window.ReactNativeWebView)==null?void 0:a.postMessage)=="function"},Xe=()=>$()&&process.platform==="darwin",_e=()=>$()&&process.platform==="win32",ea=()=>$()&&process.platform==="linux",Te={isWeb:Se,isLinux:ea,isDarwin:Xe,isWin32:_e,isNode:$,isElectron:je,isTouchDevice:ze,isServerSide:Je,isClientSide:Ne,isAndroidMobileBrowser:Qe,isReactNativeWebview:qe};var O=class a{static decycle(e,t=[]){if(typeof e=="function")return;if(!e||typeof e!="object")return e;if(t.includes(e))return null;let i=t.concat([e]);return Array.isArray(e)?e.map(r=>a.decycle(r,i)):Object.fromEntries(Object.entries(e).map(([r,n])=>[r,a.decycle(n,i)]))}static stringify(e,t=false,i,r){return typeof e=="string"?e:JSON.stringify(t!==false?a.decycle(e):e,i,r)}static isJSON(e){if(typeof e!="string")return false;let t=e.trim();if(t.length===0)return false;let i=t[0];if(i!=="{"&&i!=="[")return false;try{let r=JSON.parse(t);return r!==null&&typeof r=="object"}catch(r){return false}}static parse(e,t){if(typeof e=="string")try{e=JSON.parse(e,t);}catch(i){return e}if(e&&typeof e=="object")for(let i in e){let r=e[i];a.isJSON(r)&&(e[i]=a.parse(r,t));}return e}};var Y=class Y{static get storage(){var t;let e=Reflect.getMetadata(Y.sessionStorageMetaData,Y);if(_(e)&&(this._storage=e),this._storage)return this._storage;if(Te.isClientSide()&&typeof window!="undefined"&&window.localStorage&&((t=window.localStorage)!=null&&t.getItem))this._storage={get:i=>window.localStorage.getItem(i),set:(i,r)=>window.localStorage.setItem(i,r),remove:i=>window.localStorage.removeItem(i),removeAll:()=>window.localStorage.clear()};else {let i={};this._storage={get:r=>i[r],set:(r,n)=>i[r]=n,remove:r=>{delete i[r];},removeAll:()=>i={}};}return this._storage}static set storage(e){_(e)&&Reflect.defineMetadata(Y.sessionStorageMetaData,e,Y);}static get keyNamespace(){return m(this._keyNamespace)?this._keyNamespace:""}static set keyNamespace(e){m(e)&&(this._keyNamespace=e.trim().replace(/\s+/g,"-"));}static sanitizeKey(e){if(!e||!m(e))return "";e=e.trim().replace(/\s+/g,"-");let t=this.keyNamespace;return t?`${t}-${e}`:e}};Y.sessionStorageMetaData=Symbol("sessionStorage"),Y._keyNamespace=void 0;var M=Y;function Z(a){return M.sanitizeKey(a)}var ve=(a,e)=>(a=a&&O.stringify(a,e),a==null&&(a=""),a),Pe=a=>{if(Me(a))return new Promise((e,t)=>{a.then(i=>{e(O.parse(i));}).catch(i=>{t(i);});});if(a!=null)return O.parse(a)},aa=a=>{if(a=Z(a),M.storage&&a&&typeof a=="string"){let e=M.storage.get(a);return Pe(e)}},ta=a=>{if(a=Z(a),M.storage&&a&&typeof a=="string")return M.storage.remove(a)},ia=()=>{if(M.storage)return M.storage.removeAll()},_=a=>{if(!a)return false;try{return ["get","set","remove","removeAll"].every(e=>typeof a[e]=="function")}catch(e){return false}},T={get:aa,set:(a,e,t=true)=>(a=Z(a),M.storage.set(a,ve(e,t))),remove:ta,handleGetValue:Pe,sanitizeKey:Z,handleSetValue:ve,isValidStorage:_,Manager:M,removeAll:ia};function k(a){return a==null||typeof a=="string"||typeof a=="number"||typeof a=="boolean"}function x(a){if(a instanceof RegExp)return true;if(!a||typeof a!="object"||!Object.prototype.toString.call(a).includes("RegExp"))return false;try{return new RegExp(a),!0}catch(e){return false}}function ee(a){return typeof window!="object"||!window||typeof document=="undefined"||typeof HTMLElement=="undefined"||!HTMLElement?false:a===document?true:"HTMLElement"in window?!!a&&a instanceof HTMLElement:!!a&&typeof a=="object"&&a.nodeType===1&&!!a.nodeName}function f(a){if(a===null||typeof a!="object"||ee(a)||K(a)||x(a)||k(a))return false;let e=Object.getPrototypeOf(a);if(e===null)return true;let t=e.constructor;if(typeof t!="function")return false;if(t===Object)return true;let i=t.prototype;return typeof i!="object"?false:i===Object.prototype?true:typeof e.hasOwnProperty=="function"&&Object.prototype.hasOwnProperty.call(e,"isPrototypeOf")&&typeof e.isPrototypeOf=="function"}function ae(a){if(Array.isArray(a)){let i=[];for(var e=0;e<a.length;e++)i[e]=ae(a[e]);return i}else if(f(a)&&a){let i={};for(var t in a)a.hasOwnProperty(t)&&(i[t]=ae(a[t]));return i}else return a}Object.getSize=function(a,e=false){if(!a||typeof a!="object")return 0;if(Array.isArray(a))return a.length;typeof e!="boolean"&&(e=false);let t=0;for(let i in a)if(Object.prototype.hasOwnProperty.call(a,i)&&(t++,e===true))return t;return t};function B(a,...e){let t=Array.isArray(a),i=f(a);(a==null||!t&&!i)&&(a={});for(let r=0;r<e.length;r++){let n=e[r];if(n==null)continue;let o=f(n),l=Array.isArray(n);if(!(!o&&!l)){if(t){l&&Ye(a,n);continue}else if(l)continue;for(let s in n){let d=n[s];if(d==null)continue;if(d===n){a[s]=a;continue}let y=a[s],g=Array.isArray(y),p=Array.isArray(d);if(g){p?Ye(a[s],d):a[s]=d;continue}else if(!f(y)){a[s]=d;continue}if(p||!f(d)){a[s]=d;continue}a[s]=B({},y,d);}}}return a}var Ye=(a,e)=>{let t=e.length,i=0;for(let r=0;r<a.length;r++){let n=a[r],o=e[r];if(r<t){let l=Array.isArray(n),s=Array.isArray(o),d=f(n),y=f(o);l&&s||d&&y?(a[i]=B(l?[]:{},n,o),i++):o!=null?(a[i]=o,i++):n!=null&&(a[i]=n,i++);}}for(let r=a.length;r<t;r++)e[r]!==void 0&&e[r]!==null&&a.push(e[r]);return a};function j(a,e){return W(a,"",{},e)}function W(a,e="",t={},i){if(t=f(t)?t:{},k(a)||K(a)||x(a)||Array.isArray(a)&&(i!=null&&i.skipArrays))return e&&(t[e]=a),t;if(typeof a=="function"||typeof a=="object"&&!f(a)&&!ra(a))return t;if(a instanceof Map||a instanceof WeakMap)return Array.from(a.entries()).forEach(([r,n])=>{let o=e?`${e}[${String(r)}]`:String(r);W(n,o,t,i);}),t;if(Array.isArray(a)||a instanceof Set||a instanceof WeakSet)return (Array.isArray(a)?a:Array.from(a)).forEach((n,o)=>{let l=e?`${e}[${o}]`:String(o);W(n,l,t,i);}),t;if(f(a))for(let r in a){if(!Object.prototype.hasOwnProperty.call(a,r))continue;let n=a[r],o=e?e.endsWith("]")?`${e}.${r}`:`${e}.${r}`:r;W(n,o,t,i);}return t}function ra(a){return Array.isArray(a)||a instanceof Set||a instanceof Map||a instanceof WeakMap||a instanceof WeakSet}function na(a){return Object.entries(a)}Object.typedEntries=na;Object.flatten=j;Object.clone=ae;function G(a,e){if(a==null)return "";if(typeof a=="string")return a;if((typeof a=="number"||typeof a=="object"&&a instanceof Number)&&typeof a.formatNumber=="function")return a.formatNumber();if(a instanceof Date||typeof a=="object"&&a!==null&&a.constructor===Date)return typeof a.toFormat=="function"?a.toFormat():a.toISOString();if(a instanceof Error)return `Error: ${a.message}`;if(x(a))return a.toString();if(k(a))return String(a);if(Array.isArray(a))return JSON.stringify(a);if(typeof a=="object"&&a!==null){if(typeof a.toString=="function"&&a.toString!==Object.prototype.toString)return a.toString();if(typeof a.toString=="function"){let t=a.toString();if(t!=="[object Object]")return t}return JSON.stringify(a)}return typeof(a==null?void 0:a.toString)=="function"?a.toString():String(a)}function Ae(a,e,t){let i=(t==null?void 0:t.valueFormatter)||G,r=u(a);if(!f(e)||!e)return r;let n=(t==null?void 0:t.tagRegex)||/%\{([^}]+)\}/g,o=new Set,l,s=u(a);for(;(l=n.exec(s))!==null;){let d=l[1];d!==void 0&&o.add(d);}return o.forEach(d=>{if(t!=null&&t.tagRegex){let C=new RegExp(t.tagRegex.source,t.tagRegex.flags);[...s.matchAll(C)].forEach(F=>{let R=F[0];if(!F[1])return;let V=F[1],J=Object.prototype.hasOwnProperty.call(e,V)?e[V]:void 0,xe=J===void 0?"":(()=>{try{return i(J,V,G)}catch(fa){return G(J)}})(),Ge=R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");r=r.replace(new RegExp(Ge,"g"),xe);});return}let y=`%{${d}}`,g=Object.prototype.hasOwnProperty.call(e,d)?e[d]:void 0,p=g===void 0?"":(()=>{try{return i(g,d,G)}catch(C){return G(g)}})(),P=y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");r=r.replace(new RegExp(P,"g"),p);}),r}var h=class h{constructor(e={},t={}){this.locale="en";this._locales=["en"];this._fallbackLocale="en";this._translations={};this.namespaceResolvers={};this._namespacesLoaded={};this._hasDefaultTranslations=false;m(t.locale)&&(this.locale=t.locale),m(t.fallbackLocale)&&(this._fallbackLocale=t.fallbackLocale),typeof t.interpolate=="function"&&(this.interpolateFunc=t.interpolate),this._hasDefaultTranslations||(this.registerTranslations(q),this._hasDefaultTranslations=true),e&&this.registerTranslations(e),this.loadNamespaces();}static[Symbol.hasInstance](e){return this.isI18nInstance(e)}static isI18nInstance(e){return !e||typeof e!="object"?false:e.constructor&&e.constructor.name==="I18n"?true:typeof e.getLocale=="function"&&typeof e.translate=="function"&&typeof e.translateClass=="function"&&typeof e.registerTranslations=="function"&&typeof e.loadNamespace=="function"&&typeof e.registerNamespaceResolver=="function"}static getInstance(e){if(!h.instance){let t=h.getLocaleFromSession(),i=Object.assign({locale:t||"en"},e);h.instance=new h({},i);}return h.instance}static createInstance(e={},t={}){return new h(e,t)}static flattenObject(e){return f(e)?j(e):e}static getLocaleFromSession(){let e=T.get("i18n.locale");return m(e)?e:void 0}static registerMomentLocale(e,t){return m(e)&&f(t)&&Array.isArray(t.months)&&(this.momentLocales[e]=B({},this.momentLocales[e],t)),this.momentLocales}static getClassTanslationKeys(e){return ue(e,Re)}translate(e,t){var o;t=t||{};let i=u(t==null?void 0:t.locale,this.getLocale()),r=Array.isArray(e)?e:[e],n;for(let l of r){if(!m(l))continue;let s=this.lookup(l,i);if(s===void 0&&i!==this._fallbackLocale&&(s=this.lookup(l,this._fallbackLocale)),s!==void 0){n=s;break}}if(n===void 0)return t.defaultValue!==void 0?t.defaultValue:this.missingTranslation(e,t);if(typeof t.count=="number"&&f(n)){let l=t.count,s="other";l===0&&n.zero!==void 0?s="zero":l===1&&n.one!==void 0&&(s="one"),n[s]!==void 0?n=n[s]:n.other&&(n=n.other);}return typeof n=="string"&&(D(t.count)&&!t.countStr&&(t.countStr=typeof((o=t.count)==null?void 0:o.formatNumber)=="function"?t.count.formatNumber():t.count.toString()),n=this.performInterpolation(n,t)),n}t(e,t){return this.translate(e,t)}has(e,t){let i=t||this.getLocale(),r=Array.isArray(e)?e:[e];for(let n of r)if(this.lookup(n,i)!==void 0)return true;return false}getLocale(){return this.locale}setLocale(e,t=false){return Q(this,null,function*(){return this.locale===e&&t!==true&&this._namespacesLoaded[e]?this.locale:(yield this.loadNamespaces(e),this.locale=e,this.isDefaultInstance()&&h.setLocaleToSession(e),this.setMomentLocale(e),this.locale)})}setLocales(e){return this._locales=Array.isArray(e)?e:["en"],this._locales.includes("en")||this._locales.push("en"),this.getLocales()}getLocales(){let e=Object.keys(this._translations),t=Array.isArray(this._locales)?this._locales:["en"],i=[...e,...t.filter(r=>!e.includes(r))];return Array.from(new Set(i))}hasLocale(e){return m(e)&&this.getLocales().includes(e)}isDefaultInstance(){return this===h.instance}registerTranslations(e){return this._translations=B({},this._translations,e),this._translations}getTranslations(e){return m(e)?this._translations[e]||{}:this._translations}registerNamespaceResolver(e,t){if(!m(e)||typeof t!="function"){console.warn("Invalid arguments for registerNamespaceResolver.");return}this.namespaceResolvers[e]=t;}loadNamespace(e,t,i=true){return !m(e)||!this.namespaceResolvers[e]?Promise.reject(new Error(`Invalid namespace or resolver for namespace "${e}".`)):(t=u(t,this.getLocale()),m(t)?this.namespaceResolvers[e](t).then(r=>{let n={};return n[t]=Object.assign({},r),f(r)&&i!==false&&this.registerTranslations(n),n}):Promise.reject(new Error(`Locale is not set. Cannot load namespace "${e}".`)))}loadNamespaces(e,t=true){return Q(this,null,function*(){e=u(e,this.getLocale());let i=[],r={};for(let o in this.namespaceResolvers)Object.prototype.hasOwnProperty.call(this.namespaceResolvers,o)&&i.push(this.namespaceResolvers[o](e).then(l=>{B(r,l);}));yield Promise.all(i);let n={};return n[e]=r,t!==false&&this.registerTranslations(n),this._namespacesLoaded[e]=true,n})}get(e,t){t=u(t,this.getLocale());let i=(m(e)?e.trim().split("."):Array.isArray(e)?e:[]).filter(m);if(!i.length)return;let r=this.getTranslations(t);for(let n of i)if(f(r))r=r[n];else return;return r}translateClass(e,t){let i=h.getClassTanslationKeys(e);for(let r in i)m(i[r])&&(i[r]=this.translate(i[r],t));return i}translateObject(e,t){if(!f(e))return {};let i={};for(let r in e){let n=e[r];m(n)&&(i[r]=this.translate(n,t));}return i}applyTranslations(e){try{let t=Object.getOwnPropertyNames(e);for(let i of t){let r=Reflect.getMetadata(Re,e,i);if(r)try{e[i]=this.translate(r);}catch(n){H.error(n," resolving translation for key : ",r," on object : ",e);}}}catch(t){H.error(t," resolving translations for object : ",e);}}missingTranslation(e,t){let i=u(Array.isArray(e)?e.filter(m)[0]:u(e));return typeof this.missingPlaceholder=="function"?this.missingPlaceholder(this,i,u(t==null?void 0:t.defaultValue),t):i}lookup(e,t){let i=this._translations[t];if(!i)return;if(Object.prototype.hasOwnProperty.call(i,e))return i[e];let r=e.split("."),n=i;for(let o of r)if(f(n)&&Object.prototype.hasOwnProperty.call(n,o))n=n[o];else return;return n}performInterpolation(e,t){let i=j(t);return this.interpolateFunc?this.interpolateFunc(this,e,t):this.defaultInterpolator(e,i)}defaultInterpolator(e,t){return Ae(e,t,{tagRegex:/%\{([^}]+)\}/g})}static setLocaleToSession(e){T.set("i18n.locale",e);}getMomentLocale(e){return h.momentLocales[e]}setMomentLocale(e){try{return w__default.default.updateLocale(e,this.getMomentLocale(e)),!0}catch(t){console.error(t," setting moment locale : ",e);}return false}};h.momentLocales={};var I=h,Le=I.getInstance();var Re=Symbol("TRANSLATION_KEY");var v=a=>a&&typeof a=="object"&&!Array.isArray(a)&&a.name&&typeof a.name=="string"&&a.symbol&&typeof a.symbol=="string";var we="%v %s",te=a=>{let e=T.get("currencyFormat");return e&&typeof e=="string"&&e.includes("%v")?e:a!==false?we:""};function Fe(a){return a=a&&typeof a=="string"?a.trim():"",T.set("currencyFormat",a)}var sa=a=>{if(!v(a)){let t=typeof a=="object"&&a&&!Array.isArray(a)?u(a.code,a.name):typeof a=="string"?a:void 0;t&&(t=t.trim().toUpperCase()),t&&v(S[t])?a=S[t]:typeof a=="string"&&(t=a.trim().toUpperCase(),v(S[t])&&(a=S[t]));}let e=Object.assign({},a);if(!e.format){let t=te();t&&(e.format=t);}return e.format&&Fe(e.format),T.set("appConfigCurrency",e),e},la=()=>{var r,n,o,l;let a=Object.assign({},T.get("appConfigCurrency")),e=T.get("currencyCode");if(m(e)&&v(S[e.trim().toUpperCase()])&&(a=L(L({},S[e.trim().toUpperCase()]),a)),!m(a==null?void 0:a.format)){let s=te(false);m(s)&&s.includes("%v")&&(a.format=s);}let i=S["USD"];return L(L({symbol:i.symbol,format:(r=i.format)!=null?r:"%v %s",decimalSeparator:(n=i.decimalSeparator)!=null?n:".",thousandSeparator:(o=i.thousandSeparator)!=null?o:",",decimalDigits:(l=i.decimalDigits)!=null?l:0},Object.assign({},Le.get("currencies"))),a)},A={getFormat:te,setFormat:Fe,setCurrency:sa,getCurrency:la,defaultCurrencyFormat:we};var da=a=>a&&typeof a=="object";function re(a){let e=Object.assign({},A.getCurrency());if(a&&da(a))for(let t in a)Object.prototype.hasOwnProperty.call(a,t)&&a[t]!==void 0&&(e[t]=a[t]);if(m(e.format)){let t=Be(e.format);t.format&&(e.format=t.format),typeof t.decimalDigits=="number"&&(e.decimalDigits=t.decimalDigits);}return e}function ne(a,e){return a=typeof a=="number"?a:0,e=typeof e=="number"?e:0,a=Math.round(Math.abs(a)),isNaN(a)?e:a}function ma(a){let e=A.getCurrency(),t=(e==null?void 0:e.format).toLowerCase();return typeof a=="string"&&(a=a.toLowerCase()),(typeof a!="string"||!a.match("%v"))&&(a=t),{pos:a,neg:a.replace("-","").replace("%v","-%v"),zero:a}}var z=(a,e)=>{let t=A.getCurrency();if(a=a||0,typeof a=="number")return a;e=e||t.decimalSeparator;let i=new RegExp("[^0-9-"+e+"]","g"),r=parseFloat((""+a).replace(/\((?=\d+)(.*)\)/,"-$1").replace(i,"").replace(e,"."));return isNaN(r)?0:r},ie=(a,e)=>{let t=A.getCurrency();e=ne(e,t.decimalDigits);let r=String(a).replace(/[^\d.-]/g,"");if(r.length>15&&!r.includes("."))return r+"."+"0".repeat(e);try{let n=Number(r);if(isNaN(n))return "NaN";let o=+(n+"e"+e);return (+(Math.round(o)+"e-"+e)).toFixed(e)}catch(n){return "NaN"}},Ie=(a,e,t,i)=>{var g;a=z(a);let r=v(e)?e:A.getCurrency();typeof e=="number"&&(r.decimalDigits=e),typeof r.decimalDigits!="number"&&(r.decimalDigits=(g=String(a).split(".")[1])==null?void 0:g.length),t!==void 0&&(r.thousandSeparator=t),i!==void 0&&(r.decimalSeparator=i);let n=re(r),o=ne(n.decimalDigits),l=a<0?"-":"",s=parseInt(ie(Math.abs(a||0),o),10)+"",d=s.length>3?s.length%3:0,y="";if(o){let p=String(parseFloat(ie(Math.abs(a),o))||0);p.includes(".")&&(y=u(p.split(".")[1]).trim());}return l+(d?s.substring(0,d)+n.thousandSeparator:"")+s.substring(d).replace(/(\d{3})(?=\d)/g,"$1"+n.thousandSeparator)+(o&&y?n.decimalSeparator+y:"")},Oe=(a,e,t,i,r,n)=>{a=z(a);let o=v(e)?e:A.getCurrency();e!==void 0&&typeof e=="string"&&(o.symbol=e),t!==void 0&&(o.decimalDigits=t),i!==void 0&&(o.thousandSeparator=i),r!==void 0&&(o.decimalSeparator=r),m(n)&&(o.format=n);let l=re(o),s=ma(l.format),d=u(a>0?s.pos:a<0?s.neg:s.zero),y=u(l.symbol),g=d.replace(y&&"%s",y),p=Ie(Math.abs(a),ne(l.decimalDigits),l.thousandSeparator,l.decimalSeparator),P=g.replace("%v",p);return me(L({},l),{formattedValue:g,formattedNumber:p,symbol:l.symbol,usedFormat:d,result:P})},ca=(a,e,t,i,r,n)=>Oe(a,e,t,i,r,n).result,Be=a=>{a=u(a).trim();let e={};if(a){let t=/(\.)(\#{0,9}\s*$)/,i=a.match(t);Array.isArray(i)&&i.length===3&&(e.decimalDigits=u(i[2]).trim().length),a=a.replace(t,"");}return e.format=a,e},E={parse:z,session:A,formatMoney:ca,currencies:S,isCurrency:v,formatNumber:Ie,formatMoneyAsObject:Oe,unformat:z,toFixed:ie,prepareOptions:re,parseFormat:Be};var{currencies:Ee}=E;Number.prototype.countDecimals=function(){let a=String(this.toString()).match(/\.(\d+)/);return a?a[1].length:0};Number.prototype.formatNumber=function(a,e,t){return E.formatNumber(this.valueOf(),a,e,t)};Number.prototype.formatMoney=function(a,e,t,i,r){return E.formatMoney(this.valueOf(),a,e,t,i,r)};var ua=(a,e,t,i)=>{var F;if(a===null||typeof a!="number"||isNaN(a))return {result:"",format:"",suffix:"",formattedValue:"",minAbreviationDecimalDigits:0,value:NaN};if(!isFinite(a)){let R=a>0?"\u221E":"-\u221E";return {result:R,value:a,format:"",suffix:"",formattedValue:R,minAbreviationDecimalDigits:0}}let r=Math.abs(a)<1e3,n=[{value:1e12,suffix:"T"},{value:1e9,suffix:"B"},{value:1e6,suffix:"M"},{value:1e3,suffix:"K"},{value:1,suffix:""}],o=a.countDecimals?a.countDecimals():Math.floor(a)===a?0:((F=a.toString().split(".")[1])==null?void 0:F.length)||0,l=n.find(R=>Math.abs(a)>=R.value)||n[n.length-1],s=r?a:a/(l.value===1?1:l.value),d=l.suffix,y=ya(s,5);if(a===0)return {result:"0",value:0,format:"",suffix:"",formattedValue:"0",minAbreviationDecimalDigits:0};let p=D(e)&&e>0?e:l.value===1?Math.min(o,5):Math.max(y,0),P=s.toFixed(p);t=u(t),i=u(i,".");let C=P.toString().split(".");return C[0]=C[0].replace(/\B(?=(\d{3})+(?!\d))/g,t),p>0&&C.length===1?C.push("0".repeat(p)):p>0&&C.length>1&&C[1].length<p&&(C[1]=C[1].padEnd(p,"0")),P=C.join(i),{result:P+d,value:a,format:d,suffix:d,formattedValue:P,minAbreviationDecimalDigits:y}};function ya(a,e){let t=Math.abs(a);if(Number.isInteger(t))return 0;let i=t.toString().split(".")[1]||"",r=0;for(;r<i.length&&i[r]==="0";)r++;return t<1&&r>0?Math.min(r+e,i.length):Math.min(e,i.length)}var Ke=(a,e,t,i)=>ua(a,e,t,i).result;Number.prototype.abreviate2FormatNumber=function(a,e,t){return Ke(this.valueOf(),a,e,t)};var He=(a,e,t,i,r,n)=>{if(!D(a))return "";let s=E.formatMoneyAsObject(a,e,t,i,r,n),{formattedValue:o}=s,l=ce(s,["formattedValue"]);return o.replace("%v",Ke(a,l.decimalDigits,l.thousandSeparator,l.decimalSeparator))};Number.prototype.abreviate2FormatMoney=function(a,e,t,i,r){return He(this.valueOf(),a,e,t,i,r)};function ni(...a){for(let e of a)if(D(e)&&e!==0)return e;return 0}Object.keys(Ee).forEach(a=>{let e=a,t=Ee[e],i=`format${e}`,r=`abreviate2Format${e}`;Number.prototype[i]=function(n,o,l,s){return E.formatMoney(this.valueOf(),t,n,o,l,s)},Number.prototype[r]=function(n,o,l,s){return He(this.valueOf(),t,n,o,l,s)};});exports._abreviateNumber=ua;exports.abreviate2FormatMoney=He;exports.abreviateNumber=Ke;exports.defaultNumber=ni;
|