@social-mail/social-mail-client 1.2.589 → 1.2.590

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.
@@ -24045,47 +24045,78 @@ System.register(["tslib"], function (_export, _context) {
24045
24045
 
24046
24046
  AmdLoader.instance.setup("@social-mail/social-mail-client/dist/common/Modules");
24047
24047
 
24048
- System.register(["tslib", "../../common/Modules"], function (_export, _context) {
24048
+ System.register(["tslib", "../../common/Modules", "@web-atoms/core/dist/web/services/PopupService", "@web-atoms/core/dist/core/XNode"], function (_export, _context) {
24049
24049
  "use strict";
24050
24050
 
24051
- var __awaiter, Modules, FFService;
24051
+ var __awaiter, Modules, PopupWindow, XNode, FFConverterWindow, FFService;
24052
24052
  _export("default", void 0);
24053
24053
  return {
24054
24054
  setters: [function (_tslib) {
24055
24055
  __awaiter = _tslib.__awaiter;
24056
24056
  }, function (_commonModules) {
24057
24057
  Modules = _commonModules.default;
24058
+ }, function (_webAtomsCoreDistWebServicesPopupService) {
24059
+ PopupWindow = _webAtomsCoreDistWebServicesPopupService.PopupWindow;
24060
+ }, function (_webAtomsCoreDistCoreXNode) {
24061
+ XNode = _webAtomsCoreDistCoreXNode.default;
24058
24062
  }],
24059
24063
  execute: function () {
24064
+ FFConverterWindow = class FFConverterWindow extends PopupWindow {
24065
+ init() {
24066
+ var _a;
24067
+ return __awaiter(this, void 0, void 0, function* () {
24068
+ const targetFile = this.parameters;
24069
+ this.renderer = XNode.create("div", null, XNode.create("div", null, "Initializing video converter ... "));
24070
+ try {
24071
+ const {
24072
+ FFmpeg
24073
+ } = yield Modules.import("/social-mail/ffmpeg/ffmpeg/index.js");
24074
+ const {
24075
+ fetchFile,
24076
+ toBlobURL
24077
+ } = yield Modules.import("/social-mail/ffmpeg/util/index.js");
24078
+ const baseURL = '/social-mail/ffmpeg/core-mt';
24079
+ const ffmpeg = new FFmpeg();
24080
+ ffmpeg.on("log", ({
24081
+ message
24082
+ }) => console.log(message));
24083
+ ffmpeg.on("error", ({
24084
+ message
24085
+ }) => console.error(message));
24086
+ yield ffmpeg.load({
24087
+ coreURL: `${baseURL}/ffmpeg-core.js`,
24088
+ wasmURL: `${baseURL}/ffmpeg-core.wasm`,
24089
+ workerURL: `${baseURL}/ffmpeg-core.worker.js`
24090
+ });
24091
+ const outputName = targetFile.name + ".webm";
24092
+ yield ffmpeg.writeFile(targetFile.name, yield fetchFile(targetFile));
24093
+ this.renderer = XNode.create("div", null, XNode.create("div", null, "Converting video ... "), XNode.create("progress", {
24094
+ min: "0",
24095
+ max: "1"
24096
+ }));
24097
+ const progressElement = this.element.querySelector("progress");
24098
+ ffmpeg.on("progress", ({
24099
+ progress,
24100
+ time
24101
+ }) => progressElement.value = progress);
24102
+ yield ffmpeg.exec(["-i", targetFile.name, "-fflags", "+genpts", "-preset", "ultrafast", "-crf", "23", outputName]);
24103
+ this.renderer = XNode.create("div", null, XNode.create("div", null, "Conversion successful."));
24104
+ const buffer = yield ffmpeg.readFile(outputName);
24105
+ this.close(new File([buffer.buffer], outputName, {
24106
+ type: "video/webm"
24107
+ }));
24108
+ } catch (error) {
24109
+ this.title = "Failed";
24110
+ this.renderer = XNode.create("div", null, XNode.create("pre", null, (_a = error.stack) !== null && _a !== void 0 ? _a : error));
24111
+ }
24112
+ });
24113
+ }
24114
+ };
24060
24115
  _export("default", FFService = class FFService {
24061
24116
  static convert(targetFile) {
24062
24117
  return __awaiter(this, void 0, void 0, function* () {
24063
- const {
24064
- FFmpeg
24065
- } = yield Modules.import("/social-mail/ffmpeg/ffmpeg/index.js");
24066
- const {
24067
- fetchFile,
24068
- toBlobURL
24069
- } = yield Modules.import("/social-mail/ffmpeg/util/index.js");
24070
- const baseURL = '/social-mail/ffmpeg/core-mt';
24071
- const ffmpeg = new FFmpeg();
24072
- ffmpeg.on("log", ({
24073
- message
24074
- }) => console.log(message));
24075
- ffmpeg.on("error", ({
24076
- message
24077
- }) => console.error(message));
24078
- yield ffmpeg.load({
24079
- coreURL: `${baseURL}/ffmpeg-core.js`,
24080
- wasmURL: `${baseURL}/ffmpeg-core.wasm`,
24081
- workerURL: `${baseURL}/ffmpeg-core.worker.js`
24082
- });
24083
- const outputName = targetFile.name + ".webm";
24084
- yield ffmpeg.writeFile(targetFile.name, yield fetchFile(targetFile));
24085
- yield ffmpeg.exec(["-i", targetFile.name, "-fflags", "+genpts", "-preset", "ultrafast", "-crf", "23", outputName]);
24086
- const buffer = yield ffmpeg.readFile(outputName);
24087
- return new File([buffer.buffer], outputName, {
24088
- type: "video/webm"
24118
+ return FFConverterWindow.showModal({
24119
+ parameters: targetFile
24089
24120
  });
24090
24121
  });
24091
24122
  }