decord/beta/source/modules/vibegrations/native/vibegrationsProjectActions.tsx
github-actions e7a050048e chore: update source for beta 347.7
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4943.js (118.4 MB)
2026-09-21 19:31:18 +00:00

355 lines
13 KiB
TypeScript

// Module ID: 16951
// Function ID: 16952
// Name: vibegrationsProjectActions
// Dependencies: [5, 13364, 9307, 2052, 16945, 4457, 5116, 1119, 3682, 15414, 10150, 11860, 7199, 16952, 4706, 15804, 16954, 15365, 9398, 4700, 7436, 4903, 10925, 4458, 4704, 7624, 4715, 9308, 2]
// Exports: vibegrationsProjectActions
// Module 16951 (vibegrationsProjectActions)
import util from "util" /* 1119 */;
import _modDef3682 from "module_3682" /* 3682 */;
import ToastUtils from "ToastUtils" /* 4457 */;
import ToastActionCreatorsDefault from "ToastActionCreators" /* 4458 */;
import CopyIcon from "CopyIcon" /* 4704 */;
import ChannelUtils from "ChannelUtils" /* 4903 */;
import ClipboardUtils from "ClipboardUtils" /* 7436 */;
import VibegrationsArchivePicker from "VibegrationsArchivePicker" /* 16945 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
require = fn;
let closure_9 = async function _importIntoProject(arg0, value) {
if (c5 === 2) {
c5 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
const obj3 = { value, done: true };
return obj3;
} else {
return { value: "IconComponent", done: null };
}
} else {
try {
c5 = 2;
if (0 === c4) {
if (arg0 === 1) {
c5 = 3;
throw value;
} else if (arg0 === 2) {
c5 = 3;
const obj4 = { value, done: true };
return obj4;
} else {
closure_3 = tmp5;
closure_2 = tmp2;
closure_130_0 = id;
closure_130_1 = closure_1;
closure_130_2 = undefined;
closure_130_3 = undefined;
closure_130_4 = undefined;
c4 = 1;
c5 = 1;
const obj5 = { value: VibegrationsArchivePicker.pickVibegrationsArchive(), done: false };
return obj5;
}
} else if (arg0 === 1) {
c5 = 3;
throw value;
} else if (arg0 === 2) {
c5 = 3;
const obj7 = { value, done: true };
return obj7;
} else {
closure_130_2 = value;
if (null == closure_130_2) {
c5 = 3;
} else {
closure_130_4 = closure_131_0(closure_131_2[4]).describeVibegrationsArchiveRejection(closure_130_2);
if (null != closure_130_4) {
closure_131_0(closure_131_2[5]).presentError(closure_130_4);
const obj = closure_131_0(closure_131_2[5]);
}
const obj10 = closure_131_0(closure_131_2[4]);
}
const obj8 = { key: "VibegrationsImportOverwrite", title: null, content: null, confirmText: null, onConfirm: null };
let intl = closure_131_0(closure_131_2[7]).intl;
const obj9 = { name: closure_130_0.name };
obj8.title = intl.formatToPlainString(closure_131_1(closure_131_2[8]).XYZqZK, obj9);
let intl2 = closure_131_0(closure_131_2[7]).intl;
obj8.content = intl2.string(closure_131_1(closure_131_2[8])["6syXoH"]);
const intl3 = closure_131_0(closure_131_2[7]).intl;
obj8.confirmText = intl3.string(closure_131_1(closure_131_2[8]).pgFuyr);
closure_130_3 = closure_131_3(async () => {
if (closure_2_1 != null) {
closure_2_1();
}
const intl2 = tmp3(1119).intl;
await tmp3(16945).sendVibegrationsArchiveImport(id.id, closure_2_2, intl2.string(v2(3682).C7GU2r));
if (1 === tmp7) {
dependencyMap = 0;
const intl = tmp3(1119).intl;
tmp3(4457).presentError(intl.string(v2(3682)["02GpNr"]));
c3 = 3;
tmp3(4457);
} else if (arg0 === 1) {
c3 = 3;
throw arg1;
} else if (arg0 !== 2) {
dependencyMap = 0;
}
return arg1;
});
obj8.onConfirm = function() {
const self = this;
const apply = closure_1_3.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
};
closure_131_0(closure_131_2[6]).showConfirmModal(obj8);
const obj2 = closure_131_0(closure_131_2[6]);
}
} catch (tmp33) {
c5 = tmp;
throw tmp33;
}
}
};
const VibegrationsConnectionStore = fn(13364);
({ ensureConnection: closure_4, sendUserMessage: hasOwnProperty } = VibegrationsConnectionStore);
const VibegrationsProjectStore = fn(9307);
({ canRemixProject: metroRequire, isProjectOwner: closure_7 } = VibegrationsProjectStore);
const StaticChannelRoute = fn(2052).StaticChannelRoute;
const size = fn(2);
const result = size.fileFinishedImporting("modules/vibegrations/native/vibegrationsProjectActions.tsx");
export const vibegrationsProjectActions = function vibegrationsProjectActions(project) {
project = project.project;
({ guildId: importDefault, openChat: dependencyMap, onOpenSettings, onConnectTool, onVersionHistory, onRestorePoints, onRefresh, onClose, preview } = project);
const tmp = closure_7(project);
const items1 = [];
if (null != onRefresh) {
let obj = { label: null, IconComponent: null, action: null };
let intl = project(1119).intl;
obj.label = intl.string(_modDef3682.xKexN1);
obj.IconComponent = project(15414).RefreshIcon;
obj.action = onRefresh;
items1.push(obj);
}
if (null != onClose) {
let obj2 = { label: null, IconComponent: null, action: null };
let intl2 = project(1119).intl;
obj2.label = intl2.string(_modDef3682.Ea0Wrr);
obj2.IconComponent = project(10150).DoorExitIcon;
obj2.action = onClose;
items1.push(obj2);
}
if (null != preview) {
const items = preview.items;
function _loop(iter) {
closure_0 = iter;
const obj = { label: iter.label, IconComponent: null, action: null };
if ("refresh" === iter.kind) {
let KeyIcon = project(11860).RetryIcon;
} else {
KeyIcon = project(7199).KeyIcon;
}
obj.IconComponent = KeyIcon;
obj.action = function action() {
return preview.onPress(closure_0);
};
items1.push(obj);
}
const iter = items[Symbol.iterator]();
while (iter !== undefined) {
let _loopResult = _loop(iter.next());
continue;
}
}
if (closure_6(project)) {
let obj3 = { label: null, IconComponent: null, action: null };
let intl3 = project(1119).intl;
obj3.label = intl3.string(_modDef3682.vPI794);
obj3.IconComponent = project(16952).RemixIcon;
obj3.action = project.onRemix;
items1.push(obj3);
}
let obj4 = { label: null, IconComponent: null, action: null };
const intl4 = project(1119).intl;
obj4.label = intl4.string(_modDef3682["7iamDC"]);
obj4.IconComponent = project(4706).DownloadIcon;
obj4.action = function action() {
if (dependencyMap != null) {
tmp();
}
React4(project.id);
const intl = util.intl;
hasOwnProperty(project.id, intl.string(_modDef3682["2ejwtJ"]));
};
items1.push(obj4);
if (tmp) {
let obj5 = { label: null, IconComponent: null, action: null };
const intl5 = tmp18(1119).intl;
obj5.label = intl5.string(tmp20(3682).lf8HqE);
obj5.IconComponent = tmp18(15804).FileUpIcon;
obj5.action = function action() {
(function importIntoProject() {
const self = this;
const apply = closure_1_9.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
})(project, dependencyMap).catch(() => {
const intl = project(1119).intl;
project(4457).presentError(intl.string(closure_1_1(3682)["02GpNr"]));
});
};
items1.push(obj5);
}
if (null != onConnectTool) {
let obj6 = { label: null, IconComponent: null, action: null };
const intl6 = tmp18(1119).intl;
obj6.label = intl6.string(tmp20(3682)["3qelzD"]);
obj6.IconComponent = tmp18(16954).LinkPlusIcon;
obj6.action = onConnectTool;
items1.push(obj6);
}
if (null != onVersionHistory) {
const obj7 = { label: null, IconComponent: null, action: null };
const intl7 = tmp18(1119).intl;
obj7.label = intl7.string(tmp20(3682).jAWwzi);
obj7.IconComponent = tmp18(15365).UndoIcon;
obj7.action = onVersionHistory;
items1.push(obj7);
}
if (null != onRestorePoints) {
const obj8 = { label: null, IconComponent: null, action: null };
const intl8 = tmp18(1119).intl;
obj8.label = intl8.string(tmp20(3682).FRjicO);
obj8.IconComponent = tmp18(9398).ServerIcon;
obj8.action = onRestorePoints;
items1.push(obj8);
}
const obj9 = { label: null, IconComponent: null, action: null };
const intl9 = tmp18(1119).intl;
obj9.label = intl9.string(project(1119).t.WqhZss);
obj9.IconComponent = project(4700).LinkIcon;
obj9.action = function action() {
const obj = ClipboardUtils;
obj.copy(ChannelUtils.getChannelPermalink(importDefault, StaticChannelRoute.VIBEGRATIONS, project.id));
ToastUtils.presentLinkCopied();
};
items1.push(obj9);
const obj10 = { label: null, IconComponent: null, action: null };
const intl10 = tmp18(1119).intl;
obj10.label = intl10.string(_modDef3682.b4TqpT);
obj10.IconComponent = project(10925).IdIcon;
obj10.action = function action() {
ClipboardUtils.copy(project.id);
const obj3 = { key: "VIBEGRATIONS_PROJECT_ID_COPIED", content: null, IconComponent: null };
const intl = util.intl;
obj3.content = intl.string(_modDef3682.WOKsTg);
obj3.IconComponent = CopyIcon.CopyIcon;
ToastActionCreatorsDefault.open(obj3);
};
items1.push(obj10);
let tmp28 = tmp;
if (tmp) {
tmp28 = null != onOpenSettings;
}
if (tmp28) {
const obj11 = { label: null, IconComponent: null, action: null };
const intl11 = tmp18(1119).intl;
obj11.label = intl11.string(tmp20(3682)["xhcY+n"]);
obj11.IconComponent = tmp18(7624).SettingsIcon;
obj11.action = onOpenSettings;
items1.push(obj11);
}
if (tmp) {
const obj12 = { label: null, IconComponent: null, destructive: true, action: null };
const intl12 = tmp18(1119).intl;
obj12.label = intl12.string(tmp18(1119).t.oyYWHE);
obj12.IconComponent = tmp18(4715).TrashIcon;
obj12.action = function action() {
let obj2 = { key: "VibegrationsProjectDelete", title: null, content: null, confirmText: null, onConfirm: null };
let intl = project(1119).intl;
obj2.title = intl.formatToPlainString(_modDef3682.ZokHVz, { name: project.name });
const intl2 = project(1119).intl;
obj2.content = intl2.string(_modDef3682.NmF939);
const intl3 = project(1119).intl;
obj2.confirmText = intl3.string(project(1119).t.oyYWHE);
project = preview(function*(arg0, value) {
if (c2 === 2) {
c2 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
const obj2 = { value, done: true };
return obj2;
} else {
return { value: "IconComponent", done: null };
}
} else {
try {
c2 = 2;
if (0 === c1) {
if (arg0 === 1) {
c2 = 3;
throw value;
} else if (arg0 === 2) {
c2 = 3;
const obj4 = { value, done: true };
return obj4;
} else {
c1 = 1;
c2 = 1;
const obj5 = { value: tmp4(9308).deleteProject(tmp4.id), done: false };
return obj5;
}
} else if (arg0 === 1) {
c2 = 3;
throw value;
} else if (arg0 === 2) {
c2 = 3;
const obj6 = { value, done: true };
return obj6;
} else {
if (!value.ok) {
const intl = tmp4(1119).intl;
tmp4(4457).presentError(intl.string(_modDef3682.tqKZCi));
const obj = tmp4(4457);
}
c2 = 3;
return { value: "IconComponent", done: null };
}
} catch (tmp16) {
c2 = tmp;
throw tmp16;
}
}
});
obj2.onConfirm = function onConfirm() {
const self = this;
const apply = closure_0.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
};
project(5116).showConfirmModal(obj2);
};
items1.push(obj12);
}
return items1;
};