"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.__ΩEmailAddress = exports.EMAIL_REGEX = exports.__ΩNonEmptyTrimmedString = exports.__ΩTrimmedString = exports.__ΩValidDate = exports.__ΩOnUpdate = exports.__ΩDateString = exports.__ΩMethodKeys = exports.__ΩMethodsOf = exports.__ΩVoidFunction = exports.__ΩArrowFunctionNoArgs = exports.__ΩArrowFunction = exports.__ΩObjectKeysMatching = exports.__ΩRequireFields = exports.__ΩSerializable = exports.__ΩNestedKVObject = exports.__ΩKVObject = exports.__ΩStrictBool = exports.__ΩPrimitive = exports.__ΩDefinedPrimitive = exports.__ΩConcretePrimitive = void 0;
const tslib_1 = require("tslib");
const __ΩRecord = ['K', 'T', 'Record', 'l\'e#"Rb!b"Pde"!N#!w#y'];
function __assignType(fn, args) {
    fn.__type = args;
    return fn;
}
/*@ts-ignore*/
var { __ΩTypeAnnotation } = require('@deepkit/core');
/*@ts-ignore*/
var { __ΩPattern, __ΩDatabaseField, __ΩValidate, __ΩMinLength } = require('@deepkit/type');
const type_1 = require("@deepkit/type");
tslib_1.__exportStar(require("./phone"), exports);
const __ΩConcretePrimitive = ['ConcretePrimitive', 'P&\')Jw!y'];
exports.__ΩConcretePrimitive = __ΩConcretePrimitive;
const __ΩDefinedPrimitive = [() => __ΩConcretePrimitive, 'DefinedPrimitive', 'Pn!,Jw"y'];
exports.__ΩDefinedPrimitive = __ΩDefinedPrimitive;
const __ΩPrimitive = [() => __ΩDefinedPrimitive, 'Primitive', 'Pn!-Jw"y'];
exports.__ΩPrimitive = __ΩPrimitive;
const __ΩStrictBool = [true, false, 'StrictBool', 'P.!."Jw#y'];
exports.__ΩStrictBool = __ΩStrictBool;
const __ΩKVObject = ['T', () => __ΩRecord, 'KVObject', '"c!&e!!o"#w#y'];
exports.__ΩKVObject = __ΩKVObject;
const __ΩNestedKVObject = ['T', () => __ΩKVObject, () => __ΩKVObject, 'NestedKVObject', '"c!Pe"!e"!Fe"!o#"Jo""w$y'];
exports.__ΩNestedKVObject = __ΩNestedKVObject;
const __ΩSerializable = [() => __ΩConcretePrimitive, 'T', () => __ΩNestedKVObject, () => __ΩNestedKVObject, 'Serializable', 'n!c"Pe"!e"!Fe"!o#"e"!o$"FJw%y'];
exports.__ΩSerializable = __ΩSerializable;
const __ΩRequireFields = ['T', 'K', 'RequireFields', 'l+e$!e"!fRb!b"Pe"!Pde#"N##Kw#y'];
exports.__ΩRequireFields = __ΩRequireFields;
const __ΩObjectKeysMatching = ['O', 'V', 'ObjectKeysMatching', 'lWe$!Re(!R!RPe#!e(!e\'!fqk\'+QRPde&"p-RPe$!e#!fe$"qk#>QRb!b"Pde"!gNF!e!!gfw#y'];
exports.__ΩObjectKeysMatching = __ΩObjectKeysMatching;
const __ΩArrowFunction = ['args', '', 'ArrowFunction', 'P"@2!"/"w#y'];
exports.__ΩArrowFunction = __ΩArrowFunction;
const __ΩArrowFunctionNoArgs = ['', 'ArrowFunctionNoArgs', 'P"/!w"y'];
exports.__ΩArrowFunctionNoArgs = __ΩArrowFunctionNoArgs;
const __ΩVoidFunction = ['', 'VoidFunction', 'P$/!w"y'];
exports.__ΩVoidFunction = __ΩVoidFunction;
const __ΩIfAny = ['T', 'Y', 'N', 0, 1, 'IfAny', 'l+e#"Re##Rb!b"b#P.$P.%e#!Kqk#\'Qw&y'];
const __ΩDefinitelyFunction = ['T', () => __ΩIfAny, 'args', '', 'DefinitelyFunction', 'l;e$!R!RPe#!P"@2#"/$qk#\'QRb!e!!!Pde"!p)o"$w%y'];
const __ΩMethodsOf = ['T', () => __ΩDefinitelyFunction, 'MethodsOf', 'lL!Re\'!RPe#!!qk#%QRPe$!e#!fPde%!e$!fo""p)GRb!Pde"!gt4!w#y'];
exports.__ΩMethodsOf = __ΩMethodsOf;
const __ΩMethodKeys = ['T', () => __ΩMethodsOf, 'MethodKeys', 'b!e!!o""gw#y'];
exports.__ΩMethodKeys = __ΩMethodKeys;
const _dateStringPattern = /^\d{4}-\d{2}-\d{2}$/;
const __ΩDateString = [() => __ΩPattern, () => _dateStringPattern, () => __ΩDatabaseField, "DATE", 'type', () => __ΩTypeAnnotation, "dksf:type", "date", 'DateString', 'P&i"o!"P.$4%Mo#".\'.(o&#Kw)y'];
exports.__ΩDateString = __ΩDateString;
const __ΩOnUpdate = ['T', () => __ΩTypeAnnotation, "dksf:onUpdate", 'OnUpdate', 'b!.#e!!o"#w$y'];
exports.__ΩOnUpdate = __ΩOnUpdate;
const __ΩValidDate = [() => __ΩValidate, () => _validateDate, 'ValidDate', 'PTi"o!"Kw#y'];
exports.__ΩValidDate = __ΩValidDate;
function _validateDate(value) {
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    if (!(value instanceof Date) || isNaN(value)) {
        return new type_1.ValidatorError('invalidDate', 'The date invalid.');
    }
}
_validateDate.__type = ['value', '_validateDate', 'P#2!"/"'];
const __ΩTrimmedString = [() => __ΩTypeAnnotation, "dksf:trim", 'TrimmedString', 'P&."o!"Kw#y'];
exports.__ΩTrimmedString = __ΩTrimmedString;
const __ΩNonEmptyTrimmedString = [() => __ΩTrimmedString, () => __ΩMinLength, 1, 'NonEmptyTrimmedString', 'Pn!.#o""Kw$y'];
exports.__ΩNonEmptyTrimmedString = __ΩNonEmptyTrimmedString;
type_1.serializer.deserializeRegistry.addDecorator(__assignType(t => type_1.typeAnnotation.getType(t, 'dksf:trim') !== undefined, ['t', '', 'P"2!"/"']), __assignType((_type, state) => {
    state.addSetter(`${state.accessor}.trim()`);
}, ['_type', 'state', '', 'P"2!"2""/#']));
// email
// DK's doesn't do a full FQDN w/TLD check
// https://github.com/deepkit/deepkit-framework/pull/558
exports.EMAIL_REGEX = /^[a-z0-9_+.-]+@[a-z0-9-.]+\.[a-z]+$/i;
const __ΩEmailAddress = [() => __ΩPattern, () => exports.EMAIL_REGEX, 'EmailAddress', 'P&i"o!"Kw#y'];
exports.__ΩEmailAddress = __ΩEmailAddress;
//# sourceMappingURL=index.js.map