decord/source/modules/interaction_components/validateComponent.tsx

159 lines
6.9 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 7835
// Function ID: 62540
2026-07-20 16:05:17 +00:00
// Name: validateSelect
2026-07-25 08:10:48 +00:00
// Dependencies: [1882, 4354, 1212, 44, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-25 08:10:48 +00:00
// Module 7835 (validateSelect)
2026-07-20 16:05:17 +00:00
function validateSelect(type, type2, modal) {
let length;
let maxValues;
let minValues;
let values;
values = type2;
({ minValues, maxValues } = type);
if (null == type2) {
{
2026-07-25 08:10:48 +00:00
let obj = require(4354) /* _createForOfIteratorHelperLoose */;
2026-07-20 16:05:17 +00:00
obj = { minValues, required: tmp };
let stringResult = null;
if (!obj.canSelectBeEmpty(obj, modal)) {
2026-07-23 10:11:24 +00:00
const intl = require(1212) /* getSystemLocale */.intl;
stringResult = intl.string(require(1212) /* getSystemLocale */.t.eJEUvD);
2026-07-20 16:05:17 +00:00
}
const tmp5 = stringResult;
}
return tmp5;
2026-07-25 08:10:48 +00:00
} else if (values.type === require(1882) /* PermissionOverwriteType */.ComponentType.STRING_SELECT) {
2026-07-20 16:05:17 +00:00
({ values, length } = values);
} else {
length = values.selectedOptions.length;
}
}
2026-07-23 10:11:24 +00:00
const result = require("getSystemLocale").fileFinishedImporting("modules/interaction_components/validateComponent.tsx");
2026-07-20 16:05:17 +00:00
export default function validateComponent(type, type2, modal) {
let maxLength;
let maxValues;
let maxValues2;
let minLength;
let minValues;
let minValues2;
let required;
if (null != type2) {
2026-07-23 10:11:24 +00:00
importDefault(44)(type2.type === type.type, "component type matches state");
2026-07-20 16:05:17 +00:00
}
type = type.type;
2026-07-25 08:10:48 +00:00
if (require(1882) /* PermissionOverwriteType */.ComponentType.BUTTON === type) {
2026-07-20 16:05:17 +00:00
return null;
} else {
2026-07-25 08:10:48 +00:00
if (require(1882) /* PermissionOverwriteType */.ComponentType.STRING_SELECT !== type) {
if (require(1882) /* PermissionOverwriteType */.ComponentType.USER_SELECT !== type) {
if (require(1882) /* PermissionOverwriteType */.ComponentType.ROLE_SELECT !== type) {
if (require(1882) /* PermissionOverwriteType */.ComponentType.MENTIONABLE_SELECT !== type) {
if (require(1882) /* PermissionOverwriteType */.ComponentType.CHANNEL_SELECT !== type) {
if (require(1882) /* PermissionOverwriteType */.ComponentType.TEXT_INPUT === type) {
2026-07-20 16:05:17 +00:00
({ minLength, maxLength, required } = type);
if (null != type2) {
if (0 !== type2.value.length) {
if (type2.value.length < minLength) {
2026-07-23 10:11:24 +00:00
const intl8 = require(1212) /* getSystemLocale */.intl;
2026-07-20 16:05:17 +00:00
let obj = { min: minLength, max: maxLength };
2026-07-23 10:11:24 +00:00
let formatToPlainStringResult = intl8.formatToPlainString(require(1212) /* getSystemLocale */.t.ONSqYd, obj);
2026-07-20 16:05:17 +00:00
} else {
formatToPlainStringResult = null;
}
}
return formatToPlainStringResult;
}
let stringResult = null;
if (required) {
2026-07-23 10:11:24 +00:00
const intl9 = require(1212) /* getSystemLocale */.intl;
stringResult = intl9.string(require(1212) /* getSystemLocale */.t.eJEUvD);
2026-07-20 16:05:17 +00:00
}
formatToPlainStringResult = stringResult;
2026-07-25 08:10:48 +00:00
} else if (require(1882) /* PermissionOverwriteType */.ComponentType.FILE_UPLOAD === type) {
2026-07-20 16:05:17 +00:00
({ minValues: minValues2, maxValues: maxValues2 } = type);
let length;
if (null != type2) {
length = type2.uploadIds.length;
}
let num8 = 0;
if (null != length) {
num8 = length;
}
if (0 === num8) {
let stringResult1 = null;
if (type.required) {
2026-07-23 10:11:24 +00:00
const intl7 = require(1212) /* getSystemLocale */.intl;
stringResult1 = intl7.string(require(1212) /* getSystemLocale */.t.eJEUvD);
2026-07-20 16:05:17 +00:00
}
let formatToPlainStringResult1 = stringResult1;
} else if (num8 < minValues2) {
2026-07-23 10:11:24 +00:00
const intl6 = require(1212) /* getSystemLocale */.intl;
2026-07-20 16:05:17 +00:00
obj = { minValues: minValues2 };
2026-07-23 10:11:24 +00:00
formatToPlainStringResult1 = intl6.formatToPlainString(require(1212) /* getSystemLocale */.t.pmAt62, obj);
2026-07-20 16:05:17 +00:00
} else {
formatToPlainStringResult1 = null;
if (num8 > maxValues2) {
2026-07-23 10:11:24 +00:00
const intl5 = require(1212) /* getSystemLocale */.intl;
2026-07-20 16:05:17 +00:00
const obj1 = { maxValues: maxValues2 };
2026-07-23 10:11:24 +00:00
formatToPlainStringResult1 = intl5.formatToPlainString(require(1212) /* getSystemLocale */.t.dy6viJ, obj1);
2026-07-20 16:05:17 +00:00
}
}
return formatToPlainStringResult1;
2026-07-25 08:10:48 +00:00
} else if (require(1882) /* PermissionOverwriteType */.ComponentType.RADIO_GROUP === type) {
2026-07-20 16:05:17 +00:00
if (null == type2) {
let stringResult2 = null;
if (tmp18) {
2026-07-23 10:11:24 +00:00
const intl4 = require(1212) /* getSystemLocale */.intl;
stringResult2 = intl4.string(require(1212) /* getSystemLocale */.t.eJEUvD);
2026-07-20 16:05:17 +00:00
}
} else {
stringResult2 = null;
}
return stringResult2;
2026-07-25 08:10:48 +00:00
} else if (require(1882) /* PermissionOverwriteType */.ComponentType.CHECKBOX_GROUP === type) {
2026-07-20 16:05:17 +00:00
({ minValues, maxValues } = type);
let length1;
if (null != type2) {
length1 = type2.values.length;
}
let num3 = 0;
if (null != length1) {
num3 = length1;
}
if (0 === num3) {
let stringResult3 = null;
if (type.required) {
2026-07-23 10:11:24 +00:00
const intl3 = require(1212) /* getSystemLocale */.intl;
stringResult3 = intl3.string(require(1212) /* getSystemLocale */.t.eJEUvD);
2026-07-20 16:05:17 +00:00
}
let formatToPlainStringResult2 = stringResult3;
} else if (num3 < minValues) {
2026-07-23 10:11:24 +00:00
const intl2 = require(1212) /* getSystemLocale */.intl;
2026-07-20 16:05:17 +00:00
const obj2 = { count: minValues };
2026-07-23 10:11:24 +00:00
formatToPlainStringResult2 = intl2.formatToPlainString(require(1212) /* getSystemLocale */.t.Jmwzdx, obj2);
2026-07-20 16:05:17 +00:00
} else {
formatToPlainStringResult2 = null;
if (num3 > maxValues) {
2026-07-23 10:11:24 +00:00
const intl = require(1212) /* getSystemLocale */.intl;
2026-07-20 16:05:17 +00:00
obj = { count: maxValues };
2026-07-23 10:11:24 +00:00
formatToPlainStringResult2 = intl.formatToPlainString(require(1212) /* getSystemLocale */.t.LDvfRP, obj);
2026-07-20 16:05:17 +00:00
}
}
return formatToPlainStringResult2;
2026-07-25 08:10:48 +00:00
} else if (require(1882) /* PermissionOverwriteType */.ComponentType.CHECKBOX === type) {
2026-07-20 16:05:17 +00:00
return null;
} else {
2026-07-23 10:11:24 +00:00
importDefault(44)(false, "missing validator for this component");
2026-07-20 16:05:17 +00:00
}
}
}
}
}
}
return validateSelect(type, type2, modal);
}
};