decord/source/modules/application_commands/native/ApplicationCommandValidationUtils.tsx
2026-07-22 07:54:56 +00:00

120 lines
3.5 KiB
TypeScript

// Module ID: 11270
// Function ID: 87705
// Name: _createForOfIteratorHelperLoose
// Dependencies: []
// Exports: getFirstInvalidOption
// Module 11270 (_createForOfIteratorHelperLoose)
function _createForOfIteratorHelperLoose(@@iterator) {
let _createForOfIteratorHelperLoose = Symbol_iterator;
@@iterator = "undefined" !== typeof Symbol;
if (Symbol_iterator) {
const _Symbol = Symbol;
@@iterator = Symbol_iterator[Symbol.iterator];
}
if (!Symbol_iterator) {
@@iterator = Symbol_iterator[Symbol.iterator];
}
if (Symbol_iterator) {
const iter = Symbol_iterator.call(Symbol_iterator);
const next = iter.next;
return next.bind(iter);
} else {
const _Array = Array;
let tmp = Symbol_iterator;
if (!Array.isArray(Symbol_iterator)) {
let tmp2;
if (Symbol_iterator) {
if ("string" === typeof Symbol_iterator) {
tmp2 = _arrayLikeToArray(Symbol_iterator, undefined);
} else {
const toString = {}.toString;
const substr = toString.call(Symbol_iterator).slice(8, -1);
let name = substr;
if (tmp3) {
name = Symbol_iterator.constructor.name;
}
if ("Map" !== name) {
if ("Set" !== name) {
if ("Arguments" === name) {
let arr = _arrayLikeToArray(Symbol_iterator, undefined);
} else {
const obj = /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/;
}
}
tmp2 = arr;
}
const _Array2 = Array;
arr = Array.from(Symbol_iterator);
const callResult = toString.call(Symbol_iterator);
const tmp3 = "Object" === substr && Symbol_iterator.constructor;
}
}
tmp = tmp2;
if (!tmp2) {
const _TypeError = TypeError;
const typeError = new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
throw typeError;
}
}
if (tmp) {
_createForOfIteratorHelperLoose = tmp;
}
const _arrayLikeToArray = 0;
return () => {
if (closure_1 >= tmp.length) {
let obj = { done: true };
} else {
obj = { done: false };
closure_1 = tmp3 + 1;
obj.value = tmp[+closure_1];
}
return obj;
};
}
}
function _arrayLikeToArray(arg0, arg1) {
let length;
if (tmp) {
length = arg0.length;
}
const ArrayResult = Array(length);
for (let num = 0; num < length; num = num + 1) {
ArrayResult[num] = arg0[num];
}
return ArrayResult;
}
const _module = require(dependencyMap[0]);
const result = _module.fileFinishedImporting("modules/application_commands/native/ApplicationCommandValidationUtils.tsx");
export const getFirstInvalidOption = function getFirstInvalidOption(activeCommand, first3) {
let value;
const options = activeCommand.options;
if (null == options) {
return null;
} else {
const tmp2 = _createForOfIteratorHelperLoose(options);
const iter = tmp2();
let iter2 = iter;
if (!iter.done) {
while (true) {
value = iter2.value;
let tmp3 = first3[value.name];
if (value.required) {
if (null == tmp3) {
break;
}
}
if (null != tmp3) {
if (!tmp3.success) {
return value;
}
}
let iter3 = tmp2();
iter2 = iter3;
}
return value;
}
return null;
}
};