@multiplatform.one/platform 9.17.0 → 10.1.0

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.
Files changed (106) hide show
  1. package/dist/cjs/config/config.cjs +63 -76
  2. package/dist/cjs/config/config.native.cjs +150 -0
  3. package/dist/cjs/config/config.storybook-expo.cjs +64 -73
  4. package/dist/cjs/config/config.storybook-expo.native.cjs +144 -0
  5. package/dist/cjs/config/devOrigin.cjs +23 -25
  6. package/dist/cjs/config/devOrigin.native.cjs +43 -0
  7. package/dist/cjs/config/devOriginSource.cjs +15 -21
  8. package/dist/cjs/config/devOriginSource.native.cjs +40 -0
  9. package/dist/cjs/config/index.cjs +14 -18
  10. package/dist/cjs/config/index.native.cjs +31 -0
  11. package/dist/cjs/config/runtimeConfig.cjs +63 -65
  12. package/dist/cjs/config/runtimeConfig.native.cjs +108 -0
  13. package/dist/cjs/config/types.cjs +9 -11
  14. package/dist/cjs/config/types.native.cjs +18 -0
  15. package/dist/cjs/file/index.cjs +15 -17
  16. package/dist/cjs/file/index.native.cjs +30 -0
  17. package/dist/cjs/file/saveFile.cjs +24 -34
  18. package/dist/cjs/file/saveFile.native.cjs +127 -0
  19. package/dist/cjs/file/types.cjs +39 -41
  20. package/dist/cjs/file/types.native.cjs +174 -0
  21. package/dist/cjs/helpers.cjs +38 -42
  22. package/dist/cjs/helpers.native.cjs +67 -0
  23. package/dist/cjs/index.cjs +35 -60
  24. package/dist/cjs/index.gnome.cjs +71 -96
  25. package/dist/cjs/index.gnome.native.cjs +110 -0
  26. package/dist/cjs/index.native.cjs +60 -0
  27. package/dist/cjs/platform/index.android.cjs +34 -0
  28. package/dist/cjs/platform/index.android.js +36 -0
  29. package/dist/cjs/platform/index.android.js.map +1 -0
  30. package/dist/cjs/platform/index.cjs +28 -32
  31. package/dist/cjs/platform/index.gnome.cjs +34 -45
  32. package/dist/cjs/platform/index.gnome.native.cjs +50 -0
  33. package/dist/cjs/platform/index.ios.cjs +34 -0
  34. package/dist/cjs/platform/index.ios.js +36 -0
  35. package/dist/cjs/platform/index.ios.js.map +1 -0
  36. package/dist/cjs/platform/index.native.cjs +58 -0
  37. package/dist/cjs/platform/index.tauri.cjs +30 -36
  38. package/dist/cjs/platform/index.tauri.native.cjs +49 -0
  39. package/dist/cjs/platform/platformBase.cjs +75 -63
  40. package/dist/cjs/platform/platformBase.native.cjs +129 -0
  41. package/dist/cjs/types.cjs +9 -11
  42. package/dist/cjs/types.native.cjs +18 -0
  43. package/dist/cjs/utils/clipboard.cjs +20 -24
  44. package/dist/cjs/utils/clipboard.native.cjs +34 -0
  45. package/dist/cjs/utils/cookie.cjs +30 -37
  46. package/dist/cjs/utils/cookie.native.cjs +40 -0
  47. package/dist/cjs/utils/downloadFile.cjs +30 -32
  48. package/dist/cjs/utils/downloadFile.native.cjs +34 -0
  49. package/dist/cjs/utils/lifecycle.cjs +34 -36
  50. package/dist/cjs/utils/lifecycle.native.cjs +62 -0
  51. package/dist/cjs/utils/openUrl.cjs +15 -19
  52. package/dist/cjs/utils/openUrl.native.cjs +29 -0
  53. package/dist/esm/config/config.mjs +52 -59
  54. package/dist/esm/config/config.mjs.map +1 -1
  55. package/dist/esm/config/config.storybook-expo.mjs +50 -48
  56. package/dist/esm/config/config.storybook-expo.mjs.map +1 -1
  57. package/dist/esm/config/devOrigin.mjs +10 -8
  58. package/dist/esm/config/devOrigin.mjs.map +1 -1
  59. package/dist/esm/config/devOriginSource.mjs +2 -3
  60. package/dist/esm/config/devOriginSource.mjs.map +1 -1
  61. package/dist/esm/config/index.mjs +8 -3
  62. package/dist/esm/config/index.mjs.map +1 -1
  63. package/dist/esm/config/runtimeConfig.mjs +43 -42
  64. package/dist/esm/config/runtimeConfig.mjs.map +1 -1
  65. package/dist/esm/config/types.mjs +0 -2
  66. package/dist/esm/file/index.mjs +2 -2
  67. package/dist/esm/file/saveFile.mjs +12 -16
  68. package/dist/esm/file/saveFile.mjs.map +1 -1
  69. package/dist/esm/file/types.mjs +25 -24
  70. package/dist/esm/file/types.mjs.map +1 -1
  71. package/dist/esm/helpers.mjs +23 -23
  72. package/dist/esm/helpers.mjs.map +1 -1
  73. package/dist/esm/index.gnome.mjs +24 -45
  74. package/dist/esm/index.gnome.mjs.map +1 -1
  75. package/dist/esm/index.mjs +21 -33
  76. package/dist/esm/index.mjs.map +1 -1
  77. package/dist/esm/platform/index.android.js +13 -0
  78. package/dist/esm/platform/index.android.js.map +1 -0
  79. package/dist/esm/platform/index.gnome.mjs +22 -27
  80. package/dist/esm/platform/index.gnome.mjs.map +1 -1
  81. package/dist/esm/platform/index.ios.js +13 -0
  82. package/dist/esm/platform/index.ios.js.map +1 -0
  83. package/dist/esm/platform/index.mjs +16 -14
  84. package/dist/esm/platform/index.mjs.map +1 -1
  85. package/dist/esm/platform/index.tauri.mjs +19 -19
  86. package/dist/esm/platform/index.tauri.mjs.map +1 -1
  87. package/dist/esm/platform/platformBase.mjs +62 -46
  88. package/dist/esm/platform/platformBase.mjs.map +1 -1
  89. package/dist/esm/types.mjs +0 -2
  90. package/dist/esm/utils/clipboard.mjs +7 -6
  91. package/dist/esm/utils/clipboard.mjs.map +1 -1
  92. package/dist/esm/utils/cookie.mjs +15 -19
  93. package/dist/esm/utils/cookie.mjs.map +1 -1
  94. package/dist/esm/utils/downloadFile.mjs +16 -15
  95. package/dist/esm/utils/downloadFile.mjs.map +1 -1
  96. package/dist/esm/utils/lifecycle.mjs +17 -16
  97. package/dist/esm/utils/lifecycle.mjs.map +1 -1
  98. package/dist/esm/utils/openUrl.mjs +2 -1
  99. package/dist/esm/utils/openUrl.mjs.map +1 -1
  100. package/package.json +8 -8
  101. package/src/file/saveFile.native.ts +1 -1
  102. package/src/platform/index.tauri.ts +1 -1
  103. package/src/platform/platformBase.ts +1 -1
  104. package/dist/esm/config/types.mjs.map +0 -1
  105. package/dist/esm/file/index.mjs.map +0 -1
  106. package/dist/esm/types.mjs.map +0 -1
@@ -3,45 +3,35 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
10
  };
11
11
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
19
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
21
  var saveFile_exports = {};
24
- __export(saveFile_exports, {
25
- saveFile: () => saveFile
26
- });
22
+ __export(saveFile_exports, { saveFile: () => saveFile });
27
23
  module.exports = __toCommonJS(saveFile_exports);
28
24
  var import_downloadFile = require("../utils/downloadFile.cjs");
29
25
  var import_types = require("./types.cjs");
30
26
  async function saveFile(options) {
31
- const input = (0, import_types.prepareFileSave)(options);
32
- if (typeof document === "undefined" || !document.body || typeof Blob === "undefined" || typeof URL === "undefined" || typeof URL.createObjectURL !== "function" || typeof URL.revokeObjectURL !== "function" || !("download" in document.createElement("a"))) {
33
- throw new import_types.FileSaveError("unavailable", "Browser file downloads are unavailable.");
34
- }
35
- try {
36
- (0, import_downloadFile.downloadBlob)(new Blob([input.bytes], {
37
- type: input.mimeType
38
- }), input.filename);
39
- } catch (cause) {
40
- throw new import_types.FileSaveError("write-failed", "The browser download could not be requested.", {
41
- cause
42
- });
43
- }
44
- return {
45
- status: "download-requested"
46
- };
47
- }
27
+ const input = (0, import_types.prepareFileSave)(options);
28
+ if (typeof document === "undefined" || !document.body || typeof Blob === "undefined" || typeof URL === "undefined" || typeof URL.createObjectURL !== "function" || typeof URL.revokeObjectURL !== "function" || !("download" in document.createElement("a"))) {
29
+ throw new import_types.FileSaveError("unavailable", "Browser file downloads are unavailable.");
30
+ }
31
+ try {
32
+ (0, import_downloadFile.downloadBlob)(new Blob([input.bytes], { type: input.mimeType }), input.filename);
33
+ } catch (cause) {
34
+ throw new import_types.FileSaveError("write-failed", "The browser download could not be requested.", { cause });
35
+ }
36
+ return { status: "download-requested" };
37
+ }
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: () => from[key],
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
25
+ value: mod,
26
+ enumerable: true
27
+ }) : target, mod));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var saveFile_native_exports = {};
30
+ __export(saveFile_native_exports, { saveFile: () => saveFile });
31
+ module.exports = __toCommonJS(saveFile_native_exports);
32
+ var import_platform = require("../platform");
33
+ var import_types = require("./types.native.js");
34
+ var busy = false;
35
+ async function saveFile(options) {
36
+ var input = (0, import_types.prepareFileSave)(options);
37
+ if (!import_platform.platform.isIos && !import_platform.platform.isAndroid) {
38
+ throw new import_types.FileSaveError("unavailable", "Directory file saving is unavailable on this platform.");
39
+ }
40
+ if (busy) throw new import_types.FileSaveError("busy", "Another file save is in progress.");
41
+ busy = true;
42
+ try {
43
+ var fileSystem;
44
+ try {
45
+ var _fileSystem_Directory;
46
+ fileSystem = await import("expo-file-system");
47
+ if (typeof ((_fileSystem_Directory = fileSystem.Directory) === null || _fileSystem_Directory === void 0 ? void 0 : _fileSystem_Directory.pickDirectoryAsync) !== "function") {
48
+ throw new Error("The native FileSystem directory picker is unavailable.");
49
+ }
50
+ } catch (cause) {
51
+ throw new import_types.FileSaveError("unavailable", "This native build cannot save files to a directory.", { cause });
52
+ }
53
+ var directory;
54
+ try {
55
+ directory = await fileSystem.Directory.pickDirectoryAsync();
56
+ var scheme = import_platform.platform.isAndroid ? "content://" : "file://";
57
+ if (!directory.uri.startsWith(scheme) || directory.uri.length <= scheme.length) {
58
+ throw new Error("The picker returned an unsupported directory URI.");
59
+ }
60
+ } catch (cause) {
61
+ if (typeof cause === "object" && cause !== null && "code" in cause && (cause.code === "ERR_PICKER_CANCELLED" || cause.code === "ERR_FILE_PICKING_CANCELLED")) {
62
+ return {
63
+ status: "not-saved",
64
+ reason: "cancelled-or-refused"
65
+ };
66
+ }
67
+ throw new import_types.FileSaveError("picker-failed", "A writable directory could not be selected.", { cause });
68
+ }
69
+ var file;
70
+ try {
71
+ var name = import_platform.platform.isIos ? freeName(input.filename, takenNames(directory)) : input.filename;
72
+ file = directory.createFile(name, input.nativeMimeType);
73
+ var uri = file.uri;
74
+ var filename = import_platform.platform.isIos && uri.startsWith("file://") ? { filename: lastSegment(uri) || name } : {};
75
+ await file.write(input.bytes);
76
+ return {
77
+ status: "written",
78
+ uri,
79
+ requestedFilename: input.filename,
80
+ ...filename,
81
+ byteLength: input.bytes.byteLength
82
+ };
83
+ } catch (cause) {
84
+ var cleanupError;
85
+ try {
86
+ file === null || file === void 0 ? void 0 : file.delete();
87
+ } catch (error) {
88
+ cleanupError = error;
89
+ }
90
+ throw new import_types.FileSaveError("write-failed", "The file could not be written.", {
91
+ cause,
92
+ cleanupError
93
+ });
94
+ }
95
+ } finally {
96
+ busy = false;
97
+ }
98
+ }
99
+ function lastSegment(uri) {
100
+ var _uri_split_findLast;
101
+ var segment = (_uri_split_findLast = uri.split("/").findLast(Boolean)) !== null && _uri_split_findLast !== void 0 ? _uri_split_findLast : "";
102
+ try {
103
+ return decodeURIComponent(segment);
104
+ } catch (unused) {
105
+ return segment;
106
+ }
107
+ }
108
+ function takenNames(directory) {
109
+ try {
110
+ return new Set(directory.list().map(function(entry) {
111
+ return lastSegment(entry.uri);
112
+ }));
113
+ } catch (unused) {
114
+ return /* @__PURE__ */ new Set();
115
+ }
116
+ }
117
+ function freeName(requested, taken) {
118
+ if (!taken.has(requested)) return requested;
119
+ var dot = requested.lastIndexOf(".");
120
+ var stem = dot > 0 ? requested.slice(0, dot) : requested;
121
+ var extension = dot > 0 ? requested.slice(dot) : "";
122
+ for (var copy = 2; copy < 1e3; copy++) {
123
+ var candidate = `${stem} ${copy}${extension}`;
124
+ if (!taken.has(candidate)) return candidate;
125
+ }
126
+ return requested;
127
+ }
@@ -3,54 +3,52 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
10
  };
11
11
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
19
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
21
  var types_exports = {};
24
22
  __export(types_exports, {
25
- FileSaveError: () => FileSaveError,
26
- prepareFileSave: () => prepareFileSave
23
+ FileSaveError: () => FileSaveError,
24
+ prepareFileSave: () => prepareFileSave
27
25
  });
28
26
  module.exports = __toCommonJS(types_exports);
29
- class FileSaveError extends Error {
30
- code;
31
- cleanupError;
32
- constructor(code, message, options) {
33
- super(message, options);
34
- this.name = "FileSaveError";
35
- this.code = code;
36
- this.cleanupError = options?.cleanupError;
37
- }
38
- }
27
+ var FileSaveError = class extends Error {
28
+ code;
29
+ cleanupError;
30
+ constructor(code, message, options) {
31
+ super(message, options);
32
+ this.name = "FileSaveError";
33
+ this.code = code;
34
+ this.cleanupError = options?.cleanupError;
35
+ }
36
+ };
39
37
  function hasControlCharacters(value) {
40
- return Array.from(value).some(character => character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127);
38
+ return Array.from(value).some((character) => character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127);
41
39
  }
42
40
  function prepareFileSave(options) {
43
- if (!options || !(options.bytes instanceof Uint8Array) || typeof options.filename !== "string" || !options.filename.trim() || options.filename === "." || options.filename === ".." || /[/\\]/.test(options.filename) || hasControlCharacters(options.filename) || typeof options.mimeType !== "string" || hasControlCharacters(options.mimeType)) {
44
- throw new FileSaveError("invalid-input", "Provide bytes, a single filename and a MIME type.");
45
- }
46
- const nativeMimeType = options.mimeType.split(";", 1)[0].trim();
47
- if (!/^[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]+$/.test(nativeMimeType)) {
48
- throw new FileSaveError("invalid-input", "Provide a MIME type with a type and subtype.");
49
- }
50
- return {
51
- bytes: Uint8Array.from(options.bytes),
52
- filename: options.filename,
53
- mimeType: options.mimeType,
54
- nativeMimeType
55
- };
56
- }
41
+ if (!options || !(options.bytes instanceof Uint8Array) || typeof options.filename !== "string" || !options.filename.trim() || options.filename === "." || options.filename === ".." || /[/\\]/.test(options.filename) || hasControlCharacters(options.filename) || typeof options.mimeType !== "string" || hasControlCharacters(options.mimeType)) {
42
+ throw new FileSaveError("invalid-input", "Provide bytes, a single filename and a MIME type.");
43
+ }
44
+ const nativeMimeType = options.mimeType.split(";", 1)[0].trim();
45
+ if (!/^[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]+$/.test(nativeMimeType)) {
46
+ throw new FileSaveError("invalid-input", "Provide a MIME type with a type and subtype.");
47
+ }
48
+ return {
49
+ bytes: Uint8Array.from(options.bytes),
50
+ filename: options.filename,
51
+ mimeType: options.mimeType,
52
+ nativeMimeType
53
+ };
54
+ }
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var types_exports = {};
24
+ __export(types_exports, {
25
+ FileSaveError: () => FileSaveError,
26
+ prepareFileSave: () => prepareFileSave
27
+ });
28
+ module.exports = __toCommonJS(types_exports);
29
+ function _assert_this_initialized(self) {
30
+ if (self === void 0) {
31
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
32
+ }
33
+ return self;
34
+ }
35
+ function _call_super(_this, derived, args) {
36
+ derived = _get_prototype_of(derived);
37
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
38
+ }
39
+ function _class_call_check(instance, Constructor) {
40
+ if (!(instance instanceof Constructor)) {
41
+ throw new TypeError("Cannot call a class as a function");
42
+ }
43
+ }
44
+ function _construct(Parent, args, Class) {
45
+ if (_is_native_reflect_construct()) {
46
+ _construct = Reflect.construct;
47
+ } else {
48
+ _construct = function construct(Parent2, args2, Class2) {
49
+ var a = [null];
50
+ a.push.apply(a, args2);
51
+ var Constructor = Function.bind.apply(Parent2, a);
52
+ var instance = new Constructor();
53
+ if (Class2) _set_prototype_of(instance, Class2.prototype);
54
+ return instance;
55
+ };
56
+ }
57
+ return _construct.apply(null, arguments);
58
+ }
59
+ function _define_property(obj, key, value) {
60
+ if (key in obj) {
61
+ Object.defineProperty(obj, key, {
62
+ value,
63
+ enumerable: true,
64
+ configurable: true,
65
+ writable: true
66
+ });
67
+ } else {
68
+ obj[key] = value;
69
+ }
70
+ return obj;
71
+ }
72
+ function _get_prototype_of(o) {
73
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o2) {
74
+ return o2.__proto__ || Object.getPrototypeOf(o2);
75
+ };
76
+ return _get_prototype_of(o);
77
+ }
78
+ function _inherits(subClass, superClass) {
79
+ if (typeof superClass !== "function" && superClass !== null) {
80
+ throw new TypeError("Super expression must either be null or a function");
81
+ }
82
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: {
83
+ value: subClass,
84
+ writable: true,
85
+ configurable: true
86
+ } });
87
+ if (superClass) _set_prototype_of(subClass, superClass);
88
+ }
89
+ function _is_native_function(fn) {
90
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
91
+ }
92
+ function _possible_constructor_return(self, call) {
93
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
94
+ return call;
95
+ }
96
+ return _assert_this_initialized(self);
97
+ }
98
+ function _set_prototype_of(o, p) {
99
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o2, p2) {
100
+ o2.__proto__ = p2;
101
+ return o2;
102
+ };
103
+ return _set_prototype_of(o, p);
104
+ }
105
+ function _type_of(obj) {
106
+ "@swc/helpers - typeof";
107
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
108
+ }
109
+ function _wrap_native_super(Class) {
110
+ var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
111
+ _wrap_native_super = function wrapNativeSuper(Class2) {
112
+ if (Class2 === null || !_is_native_function(Class2)) return Class2;
113
+ if (typeof Class2 !== "function") {
114
+ throw new TypeError("Super expression must either be null or a function");
115
+ }
116
+ if (typeof _cache !== "undefined") {
117
+ if (_cache.has(Class2)) return _cache.get(Class2);
118
+ _cache.set(Class2, Wrapper);
119
+ }
120
+ function Wrapper() {
121
+ return _construct(Class2, arguments, _get_prototype_of(this).constructor);
122
+ }
123
+ Wrapper.prototype = Object.create(Class2.prototype, { constructor: {
124
+ value: Wrapper,
125
+ enumerable: false,
126
+ writable: true,
127
+ configurable: true
128
+ } });
129
+ return _set_prototype_of(Wrapper, Class2);
130
+ };
131
+ return _wrap_native_super(Class);
132
+ }
133
+ function _is_native_reflect_construct() {
134
+ try {
135
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
136
+ } catch (_) {}
137
+ return (_is_native_reflect_construct = function() {
138
+ return !!result;
139
+ })();
140
+ }
141
+ var FileSaveError = /* @__PURE__ */ (function(Error1) {
142
+ "use strict";
143
+ _inherits(FileSaveError2, Error1);
144
+ function FileSaveError2(code, message, options) {
145
+ _class_call_check(this, FileSaveError2);
146
+ var _this;
147
+ _this = _call_super(this, FileSaveError2, [message, options]), _define_property(_this, "code", void 0), _define_property(_this, "cleanupError", void 0);
148
+ _this.name = "FileSaveError";
149
+ _this.code = code;
150
+ _this.cleanupError = options === null || options === void 0 ? void 0 : options.cleanupError;
151
+ return _this;
152
+ }
153
+ return FileSaveError2;
154
+ })(_wrap_native_super(Error));
155
+ function hasControlCharacters(value) {
156
+ return Array.from(value).some(function(character) {
157
+ return character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127;
158
+ });
159
+ }
160
+ function prepareFileSave(options) {
161
+ if (!options || !(options.bytes instanceof Uint8Array) || typeof options.filename !== "string" || !options.filename.trim() || options.filename === "." || options.filename === ".." || /[/\\]/.test(options.filename) || hasControlCharacters(options.filename) || typeof options.mimeType !== "string" || hasControlCharacters(options.mimeType)) {
162
+ throw new FileSaveError("invalid-input", "Provide bytes, a single filename and a MIME type.");
163
+ }
164
+ var nativeMimeType = options.mimeType.split(";", 1)[0].trim();
165
+ if (!/^[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]+$/.test(nativeMimeType)) {
166
+ throw new FileSaveError("invalid-input", "Provide a MIME type with a type and subtype.");
167
+ }
168
+ return {
169
+ bytes: Uint8Array.from(options.bytes),
170
+ filename: options.filename,
171
+ mimeType: options.mimeType,
172
+ nativeMimeType
173
+ };
174
+ }
@@ -3,29 +3,27 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
10
  };
11
11
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
19
  };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
21
  var helpers_exports = {};
24
22
  __export(helpers_exports, {
25
- createWithLayout: () => createWithLayout,
26
- fastUnique: () => fastUnique,
27
- isDev: () => isDev,
28
- isText: () => isText
23
+ createWithLayout: () => createWithLayout,
24
+ fastUnique: () => fastUnique,
25
+ isDev: () => isDev,
26
+ isText: () => isText
29
27
  });
30
28
  module.exports = __toCommonJS(helpers_exports);
31
29
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -33,33 +31,31 @@ const isPerformanceNow = typeof performance !== "undefined" && performance.now;
33
31
  const date = isPerformanceNow ? performance : Date;
34
32
  let _previousUnique;
35
33
  function fastUnique() {
36
- let unique = date.now();
37
- while (unique === _previousUnique) {
38
- unique = date.now();
39
- }
40
- _previousUnique = unique;
41
- if (isPerformanceNow) return Date.now() + unique.toString();
42
- return unique.toString();
34
+ let unique = date.now();
35
+ while (unique === _previousUnique) {
36
+ unique = date.now();
37
+ }
38
+ _previousUnique = unique;
39
+ if (isPerformanceNow) return Date.now() + unique.toString();
40
+ return unique.toString();
43
41
  }
44
42
  function isText(children) {
45
- if (Array.isArray(children)) {
46
- return children.length > 1 && typeof children[0] === "string" && "_owner" in children[1] && "_store" in children[1] && "key" in children[1] && "props" in children[1] && "ref" in children[1] && "type" in children[1];
47
- }
48
- return typeof children === "string";
43
+ if (Array.isArray(children)) {
44
+ return children.length > 1 && typeof children[0] === "string" && "_owner" in children[1] && "_store" in children[1] && "key" in children[1] && "props" in children[1] && "ref" in children[1] && "type" in children[1];
45
+ }
46
+ return typeof children === "string";
49
47
  }
50
48
  function createWithLayout(Layout, extraLayouts = [], layoutProps) {
51
- return Component => {
52
- return flattenLayouts(props => /* @__PURE__ */(0, import_jsx_runtime.jsx)(Layout, {
53
- ...layoutProps,
54
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(Component, {
55
- ...props
56
- })
57
- }), extraLayouts);
58
- };
49
+ return ((Component) => {
50
+ return flattenLayouts((props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Layout, {
51
+ ...layoutProps,
52
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...props })
53
+ }), extraLayouts);
54
+ });
59
55
  }
60
- function flattenLayouts(layout, [...layouts]) {
61
- const currentLayout = layouts.pop();
62
- if (!currentLayout) return layout;
63
- return flattenLayouts(currentLayout(layout), layouts);
56
+ function flattenLayouts(layout, [ ...layouts]) {
57
+ const currentLayout = layouts.pop();
58
+ if (!currentLayout) return layout;
59
+ return flattenLayouts(currentLayout(layout), layouts);
64
60
  }
65
- const isDev = process.env.NODE_ENV === "development" || typeof __DEV__ !== "undefined" && __DEV__;
61
+ const isDev = process.env.NODE_ENV === "development" || typeof __DEV__ !== "undefined" && __DEV__;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+ var helpers_exports = {};
24
+ __export(helpers_exports, {
25
+ createWithLayout: () => createWithLayout,
26
+ fastUnique: () => fastUnique,
27
+ isDev: () => isDev,
28
+ isText: () => isText
29
+ });
30
+ module.exports = __toCommonJS(helpers_exports);
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
+ var isPerformanceNow = typeof performance !== "undefined" && performance.now;
33
+ var date = isPerformanceNow ? performance : Date;
34
+ var _previousUnique;
35
+ function fastUnique() {
36
+ var unique = date.now();
37
+ while (unique === _previousUnique) {
38
+ unique = date.now();
39
+ }
40
+ _previousUnique = unique;
41
+ if (isPerformanceNow) return Date.now() + unique.toString();
42
+ return unique.toString();
43
+ }
44
+ function isText(children) {
45
+ if (Array.isArray(children)) {
46
+ return children.length > 1 && typeof children[0] === "string" && "_owner" in children[1] && "_store" in children[1] && "key" in children[1] && "props" in children[1] && "ref" in children[1] && "type" in children[1];
47
+ }
48
+ return typeof children === "string";
49
+ }
50
+ function createWithLayout(Layout) {
51
+ var extraLayouts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], layoutProps = arguments.length > 2 ? arguments[2] : void 0;
52
+ return function(Component) {
53
+ return flattenLayouts(function(props) {
54
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Layout, {
55
+ ...layoutProps,
56
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...props })
57
+ });
58
+ }, extraLayouts);
59
+ };
60
+ }
61
+ function flattenLayouts(layout, param) {
62
+ var [ ...layouts] = param;
63
+ var currentLayout = layouts.pop();
64
+ if (!currentLayout) return layout;
65
+ return flattenLayouts(currentLayout(layout), layouts);
66
+ }
67
+ var isDev = process.env.NODE_ENV === "development" || typeof __DEV__ !== "undefined" && __DEV__;