@mcurros2/microm 1.1.346-0 → 1.1.348-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.
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +33 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +256 -233
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8213,21 +8213,14 @@ const $668f11abf87847cd$export$ba3020ddd81a17c8 = /*#__PURE__*/ (0, $b4te3$react
|
|
|
8213
8213
|
|
|
8214
8214
|
parcelRegister("6i1ou", function(module, exports) {
|
|
8215
8215
|
|
|
8216
|
-
$parcel$export(module.exports, "ImageEditorDefaultProps", function () { return (parcelRequire("1F7Wv")).ImageEditorDefaultProps; });
|
|
8217
|
-
$parcel$export(module.exports, "BrowserImageProcessingDefaults", function () { return (parcelRequire("gA0XD")).BrowserImageProcessingDefaults; });
|
|
8218
|
-
|
|
8219
8216
|
var $cWSrD = parcelRequire("cWSrD");
|
|
8220
8217
|
|
|
8221
8218
|
var $lTrOu = parcelRequire("lTrOu");
|
|
8222
8219
|
|
|
8223
8220
|
var $iOCNL = parcelRequire("iOCNL");
|
|
8224
8221
|
|
|
8225
|
-
var $1F7Wv = parcelRequire("1F7Wv");
|
|
8226
|
-
|
|
8227
8222
|
var $iSj3y = parcelRequire("iSj3y");
|
|
8228
8223
|
|
|
8229
|
-
var $gA0XD = parcelRequire("gA0XD");
|
|
8230
|
-
|
|
8231
8224
|
var $j2uWU = parcelRequire("j2uWU");
|
|
8232
8225
|
|
|
8233
8226
|
var $3Utni = parcelRequire("3Utni");
|
|
@@ -8263,7 +8256,7 @@ const $5f012337a51d6c2c$export$aedbc77784ab0a6a = {
|
|
|
8263
8256
|
function $5f012337a51d6c2c$var$FilesUploadFormContent({ uploadAPI: uploadAPI, uploaderProps: uploaderProps, onDelete: onDelete, onOK: onOK, helpMessage: helpMessage, okLabel: okLabel, showOKButton: showOKButton }) {
|
|
8264
8257
|
const theme = (0, $b4te3$mantinecore.useMantineTheme)();
|
|
8265
8258
|
const uploadState = (0, $4eryA.useFileUploadSnapshot)(uploadAPI);
|
|
8266
|
-
const handleOK = ()=>onOK?.(uploadState.fileProcessID, uploadState.
|
|
8259
|
+
const handleOK = ()=>onOK?.(uploadState.fileProcessID, uploadState.files);
|
|
8267
8260
|
return /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$reactjsxruntime.Fragment), {
|
|
8268
8261
|
children: [
|
|
8269
8262
|
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Card), {
|
|
@@ -8383,12 +8376,12 @@ var $3HRFn = parcelRequire("3HRFn");
|
|
|
8383
8376
|
var $3Zdna = parcelRequire("3Zdna");
|
|
8384
8377
|
var $k7qj2 = parcelRequire("k7qj2");
|
|
8385
8378
|
|
|
8379
|
+
var $dE75A = parcelRequire("dE75A");
|
|
8380
|
+
|
|
8386
8381
|
var $iOCNL = parcelRequire("iOCNL");
|
|
8387
8382
|
|
|
8388
8383
|
var $iSj3y = parcelRequire("iSj3y");
|
|
8389
8384
|
|
|
8390
|
-
var $gA0XD = parcelRequire("gA0XD");
|
|
8391
|
-
|
|
8392
8385
|
var $j2uWU = parcelRequire("j2uWU");
|
|
8393
8386
|
|
|
8394
8387
|
var $4eryA = parcelRequire("4eryA");
|
|
@@ -8477,7 +8470,7 @@ function $fee2cc872d564b4b$export$1a5cb5295a7d2749(props) {
|
|
|
8477
8470
|
const fileType = (0, $iOCNL.getFileType)(report.file_name);
|
|
8478
8471
|
const successful = report.done && !report.errorMessage && !report.cancelled;
|
|
8479
8472
|
const inProgress = !report.done && !report.cancelled;
|
|
8480
|
-
const canEditCurrentImage = canEditImage(report) && (0, $
|
|
8473
|
+
const canEditCurrentImage = canEditImage(report) && (0, $dE75A.isSupportedImageFile)(report.file_name) && !!report.vc_fileguid && !!report.documentURL && parentFormAPI?.formMode !== 'view' && !disabled;
|
|
8481
8474
|
return /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Card), {
|
|
8482
8475
|
bg: theme.colorScheme === 'dark' ? theme.colors.dark[8] : theme.colors.gray[3],
|
|
8483
8476
|
w: "15rem",
|
|
@@ -8705,58 +8698,19 @@ function $fee2cc872d564b4b$export$1a5cb5295a7d2749(props) {
|
|
|
8705
8698
|
}
|
|
8706
8699
|
|
|
8707
8700
|
});
|
|
8708
|
-
parcelRegister("
|
|
8709
|
-
|
|
8710
|
-
$parcel$export(module.exports, "getFileType", function () { return $c187ed0d526f8731$export$284e6e76ba5e79b9; });
|
|
8711
|
-
|
|
8712
|
-
const $c187ed0d526f8731$export$284e6e76ba5e79b9 = (file_name)=>{
|
|
8713
|
-
const file_type = (0, ($parcel$interopDefault($b4te3$mime))).getType(file_name);
|
|
8714
|
-
if (file_type && file_type.match('image.*')) return 'image';
|
|
8715
|
-
else if (file_type === 'application/pdf') return 'pdf';
|
|
8716
|
-
return 'other';
|
|
8717
|
-
};
|
|
8718
|
-
|
|
8719
|
-
});
|
|
8720
|
-
|
|
8721
|
-
parcelRegister("iSj3y", function(module, exports) {
|
|
8722
|
-
|
|
8723
|
-
$parcel$export(module.exports, "ImagePreview", function () { return $603e714f57b4cb36$export$4a96334d5925dbf2; });
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
function $603e714f57b4cb36$export$4a96334d5925dbf2({ documentURL: documentURL, onClose: onClose, closeText: closeText }) {
|
|
8727
|
-
return /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Stack), {
|
|
8728
|
-
children: [
|
|
8729
|
-
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Image), {
|
|
8730
|
-
height: "70vh",
|
|
8731
|
-
fit: "contain",
|
|
8732
|
-
src: documentURL
|
|
8733
|
-
}),
|
|
8734
|
-
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Group), {
|
|
8735
|
-
position: "right",
|
|
8736
|
-
children: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Button), {
|
|
8737
|
-
onClick: onClose,
|
|
8738
|
-
children: closeText
|
|
8739
|
-
})
|
|
8740
|
-
})
|
|
8741
|
-
]
|
|
8742
|
-
});
|
|
8743
|
-
}
|
|
8744
|
-
|
|
8745
|
-
});
|
|
8746
|
-
|
|
8747
|
-
parcelRegister("gA0XD", function(module, exports) {
|
|
8701
|
+
parcelRegister("dE75A", function(module, exports) {
|
|
8748
8702
|
|
|
8749
|
-
$parcel$export(module.exports, "BrowserImageProcessingDefaults", function () { return $
|
|
8750
|
-
$parcel$export(module.exports, "resolveImageProcessingOptions", function () { return $
|
|
8751
|
-
$parcel$export(module.exports, "getSupportedImageMimeType", function () { return $
|
|
8752
|
-
$parcel$export(module.exports, "isSupportedImageFile", function () { return $
|
|
8753
|
-
$parcel$export(module.exports, "getImageOutputSettings", function () { return $
|
|
8754
|
-
$parcel$export(module.exports, "canvasToProcessedFile", function () { return $
|
|
8755
|
-
$parcel$export(module.exports, "processImageFileAutomatically", function () { return $
|
|
8703
|
+
$parcel$export(module.exports, "BrowserImageProcessingDefaults", function () { return $3ddd22e26e485745$export$27066e84443e2c97; });
|
|
8704
|
+
$parcel$export(module.exports, "resolveImageProcessingOptions", function () { return $3ddd22e26e485745$export$650630072ef79469; });
|
|
8705
|
+
$parcel$export(module.exports, "getSupportedImageMimeType", function () { return $3ddd22e26e485745$export$6930cd38a73bb046; });
|
|
8706
|
+
$parcel$export(module.exports, "isSupportedImageFile", function () { return $3ddd22e26e485745$export$4edff0bce7d9001f; });
|
|
8707
|
+
$parcel$export(module.exports, "getImageOutputSettings", function () { return $3ddd22e26e485745$export$61fea7b5f848a128; });
|
|
8708
|
+
$parcel$export(module.exports, "canvasToProcessedFile", function () { return $3ddd22e26e485745$export$29aea9dd1a694579; });
|
|
8709
|
+
$parcel$export(module.exports, "processImageFileAutomatically", function () { return $3ddd22e26e485745$export$371de4640788f48b; });
|
|
8756
8710
|
|
|
8757
8711
|
|
|
8758
|
-
var $
|
|
8759
|
-
const $
|
|
8712
|
+
var $e1adW = parcelRequire("e1adW");
|
|
8713
|
+
const $3ddd22e26e485745$export$27066e84443e2c97 = {
|
|
8760
8714
|
exifOrientation: true,
|
|
8761
8715
|
crop: false,
|
|
8762
8716
|
resize: false,
|
|
@@ -8765,87 +8719,87 @@ const $638bf8e8b373a128$export$27066e84443e2c97 = {
|
|
|
8765
8719
|
outputFormat: undefined,
|
|
8766
8720
|
jpegBackgroundColor: '#ffffff'
|
|
8767
8721
|
};
|
|
8768
|
-
const $
|
|
8722
|
+
const $3ddd22e26e485745$var$cropDefaults = {
|
|
8769
8723
|
aspectRatio: 1
|
|
8770
8724
|
};
|
|
8771
|
-
const $
|
|
8725
|
+
const $3ddd22e26e485745$var$resizeDefaults = {
|
|
8772
8726
|
maxWidth: 512,
|
|
8773
8727
|
maxHeight: 512,
|
|
8774
8728
|
allowUpscale: false
|
|
8775
8729
|
};
|
|
8776
|
-
const $
|
|
8730
|
+
const $3ddd22e26e485745$var$manualRotationDefaults = {
|
|
8777
8731
|
stepDegrees: 90
|
|
8778
8732
|
};
|
|
8779
|
-
const $
|
|
8780
|
-
const $
|
|
8781
|
-
const $
|
|
8782
|
-
const $
|
|
8783
|
-
$
|
|
8784
|
-
$
|
|
8785
|
-
$
|
|
8733
|
+
const $3ddd22e26e485745$var$jpegMimeType = (0, ($parcel$interopDefault($b4te3$mime))).getType('jpg');
|
|
8734
|
+
const $3ddd22e26e485745$var$pngMimeType = (0, ($parcel$interopDefault($b4te3$mime))).getType('png');
|
|
8735
|
+
const $3ddd22e26e485745$var$webpMimeType = (0, ($parcel$interopDefault($b4te3$mime))).getType('webp');
|
|
8736
|
+
const $3ddd22e26e485745$var$supportedFormats = new Set([
|
|
8737
|
+
$3ddd22e26e485745$var$jpegMimeType,
|
|
8738
|
+
$3ddd22e26e485745$var$pngMimeType,
|
|
8739
|
+
$3ddd22e26e485745$var$webpMimeType
|
|
8786
8740
|
]);
|
|
8787
|
-
const $
|
|
8741
|
+
const $3ddd22e26e485745$var$compressionDefaults = {
|
|
8788
8742
|
thresholdBytes: 1024 ** 2,
|
|
8789
8743
|
quality: 0.82,
|
|
8790
|
-
fallbackFormat: $
|
|
8744
|
+
fallbackFormat: $3ddd22e26e485745$var$webpMimeType
|
|
8791
8745
|
};
|
|
8792
|
-
function $
|
|
8746
|
+
function $3ddd22e26e485745$var$resolveFeature(value, defaults) {
|
|
8793
8747
|
if (!value) return false;
|
|
8794
8748
|
return value === true ? defaults : {
|
|
8795
8749
|
...defaults,
|
|
8796
8750
|
...value
|
|
8797
8751
|
};
|
|
8798
8752
|
}
|
|
8799
|
-
function $
|
|
8753
|
+
function $3ddd22e26e485745$export$650630072ef79469(options) {
|
|
8800
8754
|
return {
|
|
8801
|
-
exifOrientation: options?.exifOrientation ?? $
|
|
8802
|
-
crop: $
|
|
8803
|
-
resize: $
|
|
8804
|
-
manualRotation: $
|
|
8805
|
-
compression: $
|
|
8755
|
+
exifOrientation: options?.exifOrientation ?? $3ddd22e26e485745$export$27066e84443e2c97.exifOrientation,
|
|
8756
|
+
crop: $3ddd22e26e485745$var$resolveFeature(options?.crop, $3ddd22e26e485745$var$cropDefaults),
|
|
8757
|
+
resize: $3ddd22e26e485745$var$resolveFeature(options?.resize, $3ddd22e26e485745$var$resizeDefaults),
|
|
8758
|
+
manualRotation: $3ddd22e26e485745$var$resolveFeature(options?.manualRotation, $3ddd22e26e485745$var$manualRotationDefaults),
|
|
8759
|
+
compression: $3ddd22e26e485745$var$resolveFeature(options?.compression, $3ddd22e26e485745$var$compressionDefaults),
|
|
8806
8760
|
outputFormat: options?.outputFormat,
|
|
8807
|
-
jpegBackgroundColor: options?.jpegBackgroundColor ?? $
|
|
8761
|
+
jpegBackgroundColor: options?.jpegBackgroundColor ?? $3ddd22e26e485745$export$27066e84443e2c97.jpegBackgroundColor
|
|
8808
8762
|
};
|
|
8809
8763
|
}
|
|
8810
|
-
function $
|
|
8764
|
+
function $3ddd22e26e485745$var$normalizeImageFormat(type) {
|
|
8811
8765
|
if (!type) return undefined;
|
|
8812
8766
|
const normalizedType = type.toLowerCase();
|
|
8813
|
-
if ($
|
|
8767
|
+
if ($3ddd22e26e485745$var$supportedFormats.has(normalizedType)) return normalizedType;
|
|
8814
8768
|
const typeFromExtension = (0, ($parcel$interopDefault($b4te3$mime))).getType(normalizedType);
|
|
8815
|
-
if (typeFromExtension && $
|
|
8769
|
+
if (typeFromExtension && $3ddd22e26e485745$var$supportedFormats.has(typeFromExtension)) return typeFromExtension;
|
|
8816
8770
|
const extension = (0, ($parcel$interopDefault($b4te3$mime))).getExtension(normalizedType);
|
|
8817
8771
|
const canonicalType = extension ? (0, ($parcel$interopDefault($b4te3$mime))).getType(extension) : null;
|
|
8818
|
-
return canonicalType && $
|
|
8772
|
+
return canonicalType && $3ddd22e26e485745$var$supportedFormats.has(canonicalType) ? canonicalType : undefined;
|
|
8819
8773
|
}
|
|
8820
|
-
function $
|
|
8821
|
-
return $
|
|
8774
|
+
function $3ddd22e26e485745$export$6930cd38a73bb046(fileName, declaredType) {
|
|
8775
|
+
return $3ddd22e26e485745$var$normalizeImageFormat(declaredType) ?? $3ddd22e26e485745$var$normalizeImageFormat((0, ($parcel$interopDefault($b4te3$mime))).getType(fileName));
|
|
8822
8776
|
}
|
|
8823
|
-
function $
|
|
8824
|
-
return $
|
|
8777
|
+
function $3ddd22e26e485745$export$4edff0bce7d9001f(fileName, declaredType) {
|
|
8778
|
+
return $3ddd22e26e485745$export$6930cd38a73bb046(fileName, declaredType) !== undefined;
|
|
8825
8779
|
}
|
|
8826
|
-
function $
|
|
8827
|
-
const sourceFormat = $
|
|
8780
|
+
function $3ddd22e26e485745$export$61fea7b5f848a128(file, options) {
|
|
8781
|
+
const sourceFormat = $3ddd22e26e485745$export$6930cd38a73bb046(file.name, file.type);
|
|
8828
8782
|
if (!sourceFormat) throw new Error(`The image format "${file.type || 'unknown'}" cannot be processed in the browser.`);
|
|
8829
8783
|
const shouldCompress = options.compression !== false && file.size > options.compression.thresholdBytes;
|
|
8830
|
-
const requestedOutputFormat = options.outputFormat ?? (shouldCompress && sourceFormat === $
|
|
8831
|
-
const outputFormat = $
|
|
8784
|
+
const requestedOutputFormat = options.outputFormat ?? (shouldCompress && sourceFormat === $3ddd22e26e485745$var$pngMimeType && options.compression !== false ? options.compression.fallbackFormat : sourceFormat);
|
|
8785
|
+
const outputFormat = $3ddd22e26e485745$var$normalizeImageFormat(requestedOutputFormat);
|
|
8832
8786
|
if (!outputFormat) throw new Error(`The image format "${requestedOutputFormat || 'unknown'}" cannot be encoded in the browser.`);
|
|
8833
8787
|
return {
|
|
8834
8788
|
sourceFormat: sourceFormat,
|
|
8835
8789
|
outputFormat: outputFormat,
|
|
8836
8790
|
shouldCompress: shouldCompress,
|
|
8837
|
-
quality: shouldCompress && options.compression !== false && (outputFormat === $
|
|
8791
|
+
quality: shouldCompress && options.compression !== false && (outputFormat === $3ddd22e26e485745$var$jpegMimeType || outputFormat === $3ddd22e26e485745$var$webpMimeType) ? options.compression.quality : undefined
|
|
8838
8792
|
};
|
|
8839
8793
|
}
|
|
8840
|
-
function $
|
|
8794
|
+
function $3ddd22e26e485745$var$replaceFileExtension(fileName, format) {
|
|
8841
8795
|
const baseName = fileName.replace(/\.[^/.]+$/, '') || 'avatar';
|
|
8842
8796
|
const extension = (0, ($parcel$interopDefault($b4te3$mime))).getExtension(format);
|
|
8843
8797
|
if (!extension) throw new Error(`No file extension is registered for ${format}.`);
|
|
8844
8798
|
return `${baseName}.${extension}`;
|
|
8845
8799
|
}
|
|
8846
|
-
async function $
|
|
8847
|
-
const { outputFormat: outputFormat, quality: quality } = $
|
|
8848
|
-
if (outputFormat === $
|
|
8800
|
+
async function $3ddd22e26e485745$export$29aea9dd1a694579(canvas, source, options) {
|
|
8801
|
+
const { outputFormat: outputFormat, quality: quality } = $3ddd22e26e485745$export$61fea7b5f848a128(source, options);
|
|
8802
|
+
if (outputFormat === $3ddd22e26e485745$var$jpegMimeType) {
|
|
8849
8803
|
const flattenedCanvas = document.createElement('canvas');
|
|
8850
8804
|
flattenedCanvas.width = canvas.width;
|
|
8851
8805
|
flattenedCanvas.height = canvas.height;
|
|
@@ -8856,16 +8810,16 @@ async function $638bf8e8b373a128$export$29aea9dd1a694579(canvas, source, options
|
|
|
8856
8810
|
context.drawImage(canvas, 0, 0);
|
|
8857
8811
|
canvas = flattenedCanvas;
|
|
8858
8812
|
}
|
|
8859
|
-
const blob = await (0, $
|
|
8813
|
+
const blob = await (0, $e1adW.canvasToBlob)(canvas, outputFormat, quality);
|
|
8860
8814
|
if (blob.type !== outputFormat) throw new Error(`The browser does not support ${outputFormat} image encoding.`);
|
|
8861
8815
|
return new File([
|
|
8862
8816
|
blob
|
|
8863
|
-
], $
|
|
8817
|
+
], $3ddd22e26e485745$var$replaceFileExtension(source.name, outputFormat), {
|
|
8864
8818
|
type: outputFormat,
|
|
8865
8819
|
lastModified: Date.now()
|
|
8866
8820
|
});
|
|
8867
8821
|
}
|
|
8868
|
-
function $
|
|
8822
|
+
function $3ddd22e26e485745$var$getExifOrientation(buffer) {
|
|
8869
8823
|
const view = new DataView(buffer);
|
|
8870
8824
|
if (view.byteLength < 4 || view.getUint16(0, false) !== 0xffd8) return 1;
|
|
8871
8825
|
let offset = 2;
|
|
@@ -8892,18 +8846,18 @@ function $638bf8e8b373a128$var$getExifOrientation(buffer) {
|
|
|
8892
8846
|
}
|
|
8893
8847
|
return 1;
|
|
8894
8848
|
}
|
|
8895
|
-
async function $
|
|
8896
|
-
if (!$
|
|
8849
|
+
async function $3ddd22e26e485745$export$371de4640788f48b(file, options) {
|
|
8850
|
+
if (!$3ddd22e26e485745$export$6930cd38a73bb046(file.name, file.type)) {
|
|
8897
8851
|
const requiresPixelProcessing = options.resize !== false || options.compression !== false || !!options.outputFormat;
|
|
8898
8852
|
if (!requiresPixelProcessing) return file;
|
|
8899
8853
|
}
|
|
8900
|
-
const settings = $
|
|
8901
|
-
const exifOrientation = settings.sourceFormat === $
|
|
8854
|
+
const settings = $3ddd22e26e485745$export$61fea7b5f848a128(file, options);
|
|
8855
|
+
const exifOrientation = settings.sourceFormat === $3ddd22e26e485745$var$jpegMimeType && options.exifOrientation ? $3ddd22e26e485745$var$getExifOrientation(await file.arrayBuffer()) : 1;
|
|
8902
8856
|
const formatChanges = settings.outputFormat !== settings.sourceFormat;
|
|
8903
8857
|
if (options.resize === false && !settings.shouldCompress && !formatChanges && exifOrientation === 1) return file;
|
|
8904
|
-
const image = await (0, $
|
|
8858
|
+
const image = await (0, $e1adW.loadDecodedImage)(file, options.exifOrientation);
|
|
8905
8859
|
try {
|
|
8906
|
-
const { width: originalWidth, height: originalHeight } = (0, $
|
|
8860
|
+
const { width: originalWidth, height: originalHeight } = (0, $e1adW.getDecodedImageSize)(image);
|
|
8907
8861
|
const resize = options.resize;
|
|
8908
8862
|
const scale = resize === false ? 1 : Math.min(resize.maxWidth / originalWidth, resize.maxHeight / originalHeight, resize.allowUpscale ? Number.POSITIVE_INFINITY : 1);
|
|
8909
8863
|
if (scale === 1 && !settings.shouldCompress && !formatChanges && exifOrientation === 1) return file;
|
|
@@ -8915,20 +8869,20 @@ async function $638bf8e8b373a128$export$371de4640788f48b(file, options) {
|
|
|
8915
8869
|
context.imageSmoothingEnabled = true;
|
|
8916
8870
|
context.imageSmoothingQuality = 'high';
|
|
8917
8871
|
context.drawImage(image, 0, 0, canvas.width, canvas.height);
|
|
8918
|
-
return await $
|
|
8872
|
+
return await $3ddd22e26e485745$export$29aea9dd1a694579(canvas, file, options);
|
|
8919
8873
|
} finally{
|
|
8920
|
-
(0, $
|
|
8874
|
+
(0, $e1adW.closeDecodedImage)(image);
|
|
8921
8875
|
}
|
|
8922
8876
|
}
|
|
8923
8877
|
|
|
8924
8878
|
});
|
|
8925
|
-
parcelRegister("
|
|
8879
|
+
parcelRegister("e1adW", function(module, exports) {
|
|
8926
8880
|
|
|
8927
|
-
$parcel$export(module.exports, "getDecodedImageSize", function () { return $
|
|
8928
|
-
$parcel$export(module.exports, "loadDecodedImage", function () { return $
|
|
8929
|
-
$parcel$export(module.exports, "closeDecodedImage", function () { return $
|
|
8930
|
-
$parcel$export(module.exports, "canvasToBlob", function () { return $
|
|
8931
|
-
function $
|
|
8881
|
+
$parcel$export(module.exports, "getDecodedImageSize", function () { return $5e5f3ffb14aaa9fd$export$15554d811073fc35; });
|
|
8882
|
+
$parcel$export(module.exports, "loadDecodedImage", function () { return $5e5f3ffb14aaa9fd$export$202f95fe2ccc6f07; });
|
|
8883
|
+
$parcel$export(module.exports, "closeDecodedImage", function () { return $5e5f3ffb14aaa9fd$export$c24ef9cf8379fa80; });
|
|
8884
|
+
$parcel$export(module.exports, "canvasToBlob", function () { return $5e5f3ffb14aaa9fd$export$403d539f215df596; });
|
|
8885
|
+
function $5e5f3ffb14aaa9fd$export$15554d811073fc35(image) {
|
|
8932
8886
|
return image instanceof ImageBitmap ? {
|
|
8933
8887
|
width: image.width,
|
|
8934
8888
|
height: image.height
|
|
@@ -8937,7 +8891,7 @@ function $b50652978a5bda46$export$15554d811073fc35(image) {
|
|
|
8937
8891
|
height: image.naturalHeight
|
|
8938
8892
|
};
|
|
8939
8893
|
}
|
|
8940
|
-
async function $
|
|
8894
|
+
async function $5e5f3ffb14aaa9fd$export$202f95fe2ccc6f07(file, respectExifOrientation) {
|
|
8941
8895
|
if ('createImageBitmap' in window) return await createImageBitmap(file, {
|
|
8942
8896
|
imageOrientation: respectExifOrientation ? 'from-image' : 'none'
|
|
8943
8897
|
});
|
|
@@ -8953,10 +8907,10 @@ async function $b50652978a5bda46$export$202f95fe2ccc6f07(file, respectExifOrient
|
|
|
8953
8907
|
URL.revokeObjectURL(source);
|
|
8954
8908
|
}
|
|
8955
8909
|
}
|
|
8956
|
-
function $
|
|
8910
|
+
function $5e5f3ffb14aaa9fd$export$c24ef9cf8379fa80(image) {
|
|
8957
8911
|
if (image instanceof ImageBitmap) image.close();
|
|
8958
8912
|
}
|
|
8959
|
-
async function $
|
|
8913
|
+
async function $5e5f3ffb14aaa9fd$export$403d539f215df596(canvas, type, quality) {
|
|
8960
8914
|
return await new Promise((resolve, reject)=>{
|
|
8961
8915
|
canvas.toBlob((result)=>result ? resolve(result) : reject(new Error('The browser could not encode the image.')), type, quality);
|
|
8962
8916
|
});
|
|
@@ -8965,6 +8919,45 @@ async function $b50652978a5bda46$export$403d539f215df596(canvas, type, quality)
|
|
|
8965
8919
|
});
|
|
8966
8920
|
|
|
8967
8921
|
|
|
8922
|
+
parcelRegister("iOCNL", function(module, exports) {
|
|
8923
|
+
|
|
8924
|
+
$parcel$export(module.exports, "getFileType", function () { return $c187ed0d526f8731$export$284e6e76ba5e79b9; });
|
|
8925
|
+
|
|
8926
|
+
const $c187ed0d526f8731$export$284e6e76ba5e79b9 = (file_name)=>{
|
|
8927
|
+
const file_type = (0, ($parcel$interopDefault($b4te3$mime))).getType(file_name);
|
|
8928
|
+
if (file_type && file_type.match('image.*')) return 'image';
|
|
8929
|
+
else if (file_type === 'application/pdf') return 'pdf';
|
|
8930
|
+
return 'other';
|
|
8931
|
+
};
|
|
8932
|
+
|
|
8933
|
+
});
|
|
8934
|
+
|
|
8935
|
+
parcelRegister("iSj3y", function(module, exports) {
|
|
8936
|
+
|
|
8937
|
+
$parcel$export(module.exports, "ImagePreview", function () { return $603e714f57b4cb36$export$4a96334d5925dbf2; });
|
|
8938
|
+
|
|
8939
|
+
|
|
8940
|
+
function $603e714f57b4cb36$export$4a96334d5925dbf2({ documentURL: documentURL, onClose: onClose, closeText: closeText }) {
|
|
8941
|
+
return /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Stack), {
|
|
8942
|
+
children: [
|
|
8943
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Image), {
|
|
8944
|
+
height: "70vh",
|
|
8945
|
+
fit: "contain",
|
|
8946
|
+
src: documentURL
|
|
8947
|
+
}),
|
|
8948
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Group), {
|
|
8949
|
+
position: "right",
|
|
8950
|
+
children: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Button), {
|
|
8951
|
+
onClick: onClose,
|
|
8952
|
+
children: closeText
|
|
8953
|
+
})
|
|
8954
|
+
})
|
|
8955
|
+
]
|
|
8956
|
+
});
|
|
8957
|
+
}
|
|
8958
|
+
|
|
8959
|
+
});
|
|
8960
|
+
|
|
8968
8961
|
parcelRegister("j2uWU", function(module, exports) {
|
|
8969
8962
|
|
|
8970
8963
|
$parcel$export(module.exports, "PDFPreviewDefaultProps", function () { return $4ef7141c1ad3b3da$export$c21dc030e4b1e5e7; });
|
|
@@ -9024,10 +9017,10 @@ parcelRequire("2eyXi");
|
|
|
9024
9017
|
var $7T941 = parcelRequire("7T941");
|
|
9025
9018
|
parcelRequire("7xGLy");
|
|
9026
9019
|
var $k7qj2 = parcelRequire("k7qj2");
|
|
9020
|
+
parcelRequire("lH146");
|
|
9021
|
+
var $j7GoP = parcelRequire("j7GoP");
|
|
9027
9022
|
|
|
9028
|
-
var $
|
|
9029
|
-
|
|
9030
|
-
var $gA0XD = parcelRequire("gA0XD");
|
|
9023
|
+
var $dE75A = parcelRequire("dE75A");
|
|
9031
9024
|
function $ad822dbf504c78b4$export$dd17d8b0fb64bebb(uploadAPI) {
|
|
9032
9025
|
return (0, $b4te3$react.useSyncExternalStore)(uploadAPI.subscribe, uploadAPI.getSnapshot, uploadAPI.getSnapshot);
|
|
9033
9026
|
}
|
|
@@ -9099,7 +9092,7 @@ const $ad822dbf504c78b4$var$createStatusID = (file)=>{
|
|
|
9099
9092
|
return `${file.name}-${file.size}-${randomPart}`;
|
|
9100
9093
|
};
|
|
9101
9094
|
function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
|
|
9102
|
-
const { client: client, maxIndividualFileSize: maxIndividualFileSize, maxTotalFilesSize: maxTotalFilesSize, maxFilesCount: maxFilesCount, youCanUploadAMaximumOfText: youCanUploadAMaximumOfText, filesText: filesText, exceedMaximumIndividualSizeText: exceedMaximumIndividualSizeText, unspecifiedErrorWhenUploadingFileText: unspecifiedErrorWhenUploadingFileText, totalUploadExceedsMaximumSizeText: totalUploadExceedsMaximumSizeText, fileProcessColumn: fileProcessColumn, onCancel: onCancel, editor: editor, imageProcessing: imageProcessing, imageEditorTitle: imageEditorTitle, imageEditorProps: imageEditorProps, imageEditorModalProps: imageEditorModalProps, onValidateFile: onValidateFile, onProcessFile: onProcessFile, onBeforeUpload: onBeforeUpload, onBeforeReplace: onBeforeReplace, onUploadComplete: onUploadComplete, thumbnailMaxSize: thumbnailMaxSize, thumbnailQuality: thumbnailQuality, loadFilesOnMount: loadFilesOnMount } = (0, $b4te3$mantinecore.useComponentDefaultProps)('useFileUpload', $ad822dbf504c78b4$export$b54531e9f4f81a9, props);
|
|
9095
|
+
const { client: client, maxIndividualFileSize: maxIndividualFileSize, maxTotalFilesSize: maxTotalFilesSize, maxFilesCount: maxFilesCount, youCanUploadAMaximumOfText: youCanUploadAMaximumOfText, filesText: filesText, exceedMaximumIndividualSizeText: exceedMaximumIndividualSizeText, unspecifiedErrorWhenUploadingFileText: unspecifiedErrorWhenUploadingFileText, totalUploadExceedsMaximumSizeText: totalUploadExceedsMaximumSizeText, fileProcessColumn: fileProcessColumn, onCancel: onCancel, editor: editor, imageProcessing: imageProcessing, imageEditorTitle: imageEditorTitle, imageEditorProps: imageEditorProps, imageEditorModalProps: imageEditorModalProps, onValidateFile: onValidateFile, onProcessFile: onProcessFile, onBeforeUpload: onBeforeUpload, onBeforeReplace: onBeforeReplace, onUploadComplete: onUploadComplete, onDeleteComplete: onDeleteComplete, thumbnailMaxSize: thumbnailMaxSize, thumbnailQuality: thumbnailQuality, loadFilesOnMount: loadFilesOnMount } = (0, $b4te3$mantinecore.useComponentDefaultProps)('useFileUpload', $ad822dbf504c78b4$export$b54531e9f4f81a9, props);
|
|
9103
9096
|
const [filesByID, setFilesByID] = (0, $b4te3$react.useState)({});
|
|
9104
9097
|
const [operation, setOperation] = (0, $b4te3$react.useState)('idle');
|
|
9105
9098
|
const [errorNotification, setErrorNotification] = (0, $b4te3$react.useState)();
|
|
@@ -9110,7 +9103,7 @@ function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
|
|
|
9110
9103
|
const files = (0, $b4te3$react.useMemo)(()=>Object.values(filesByID), [
|
|
9111
9104
|
filesByID
|
|
9112
9105
|
]);
|
|
9113
|
-
const processingOptions = (0, $b4te3$react.useMemo)(()=>(0, $
|
|
9106
|
+
const processingOptions = (0, $b4te3$react.useMemo)(()=>(0, $dE75A.resolveImageProcessingOptions)(editor ? {
|
|
9114
9107
|
...imageProcessing,
|
|
9115
9108
|
crop: imageProcessing?.crop ?? true,
|
|
9116
9109
|
manualRotation: imageProcessing?.manualRotation ?? true
|
|
@@ -9222,7 +9215,7 @@ function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
|
|
|
9222
9215
|
(0, $b4te3$react.useEffect)(()=>()=>activeControllerRef.current?.abort(), []);
|
|
9223
9216
|
const openImageEditor = (0, $b4te3$react.useCallback)(async (file)=>{
|
|
9224
9217
|
if (!editor) return null;
|
|
9225
|
-
(0, $
|
|
9218
|
+
(0, $dE75A.getImageOutputSettings)(file, processingOptions);
|
|
9226
9219
|
return await new Promise(async (resolveEditor)=>{
|
|
9227
9220
|
let settled = false;
|
|
9228
9221
|
const settle = async (result)=>{
|
|
@@ -9232,7 +9225,7 @@ function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
|
|
|
9232
9225
|
resolveEditor(result);
|
|
9233
9226
|
};
|
|
9234
9227
|
await modals.open({
|
|
9235
|
-
content: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $
|
|
9228
|
+
content: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $j7GoP.ImageEditor), {
|
|
9236
9229
|
sourceFile: file,
|
|
9237
9230
|
options: processingOptions,
|
|
9238
9231
|
...imageEditorProps,
|
|
@@ -9267,7 +9260,7 @@ function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
|
|
|
9267
9260
|
const processSelectedFile = (0, $b4te3$react.useCallback)(async (file)=>{
|
|
9268
9261
|
if (onProcessFile) return await onProcessFile(file);
|
|
9269
9262
|
if (editor) return await openImageEditor(file);
|
|
9270
|
-
if (imageProcessing) return await (0, $
|
|
9263
|
+
if (imageProcessing) return await (0, $dE75A.processImageFileAutomatically)(file, processingOptions);
|
|
9271
9264
|
return file;
|
|
9272
9265
|
}, [
|
|
9273
9266
|
editor,
|
|
@@ -9464,7 +9457,9 @@ function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
|
|
|
9464
9457
|
};
|
|
9465
9458
|
try {
|
|
9466
9459
|
setErrorNotification(undefined);
|
|
9467
|
-
|
|
9460
|
+
const result = await deleteStoredFile(fileGUID, controller.signal);
|
|
9461
|
+
if (!result.Failed) await onDeleteComplete?.(fileGUID);
|
|
9462
|
+
return result;
|
|
9468
9463
|
} catch (error) {
|
|
9469
9464
|
if (!(error instanceof Error && error.name === 'AbortError')) setErrorNotification(error instanceof Error ? error.message : String(error));
|
|
9470
9465
|
return {
|
|
@@ -9476,7 +9471,8 @@ function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
|
|
|
9476
9471
|
}, [
|
|
9477
9472
|
beginOperation,
|
|
9478
9473
|
deleteStoredFile,
|
|
9479
|
-
finishOperation
|
|
9474
|
+
finishOperation,
|
|
9475
|
+
onDeleteComplete
|
|
9480
9476
|
]);
|
|
9481
9477
|
const findFile = (0, $b4te3$react.useCallback)((file)=>{
|
|
9482
9478
|
if (typeof file !== 'string') return file;
|
|
@@ -9486,7 +9482,7 @@ function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
|
|
|
9486
9482
|
]);
|
|
9487
9483
|
const canEditImage = (0, $b4te3$react.useCallback)((file)=>{
|
|
9488
9484
|
const report = findFile(file);
|
|
9489
|
-
return editor === true && !!report?.vc_fileguid && !!report.documentURL && (0, $
|
|
9485
|
+
return editor === true && !!report?.vc_fileguid && !!report.documentURL && (0, $dE75A.isSupportedImageFile)(report.file_name);
|
|
9490
9486
|
}, [
|
|
9491
9487
|
editor,
|
|
9492
9488
|
findFile
|
|
@@ -9597,7 +9593,7 @@ function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
|
|
|
9597
9593
|
setCancelledNotification(false);
|
|
9598
9594
|
if (onBeforeReplace && !await onBeforeReplace(currentFile)) return null;
|
|
9599
9595
|
const blob = await client.downloadBlob(currentFile.documentURL, controller.signal);
|
|
9600
|
-
const imageType = (0, $
|
|
9596
|
+
const imageType = (0, $dE75A.getSupportedImageMimeType)(currentFile.file_name, blob.type);
|
|
9601
9597
|
if (!imageType) throw new Error(`The image format "${blob.type || currentFile.file_name}" cannot be processed in the browser.`);
|
|
9602
9598
|
const sourceFile = new File([
|
|
9603
9599
|
blob
|
|
@@ -9658,7 +9654,6 @@ function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
|
|
|
9658
9654
|
const loadingNotification = operation === 'loading' || operation === 'deleting';
|
|
9659
9655
|
const snapshot = (0, $b4te3$react.useMemo)(()=>({
|
|
9660
9656
|
files: files,
|
|
9661
|
-
uploadProgress: filesByID,
|
|
9662
9657
|
fileProcessID: fileProcessColumn.value,
|
|
9663
9658
|
maxFilesCount: maxFilesCount,
|
|
9664
9659
|
maxIndividualFileSize: maxIndividualFileSize,
|
|
@@ -9675,7 +9670,6 @@ function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
|
|
|
9675
9670
|
errorNotification,
|
|
9676
9671
|
fileProcessColumn.value,
|
|
9677
9672
|
files,
|
|
9678
|
-
filesByID,
|
|
9679
9673
|
loadingNotification,
|
|
9680
9674
|
maxFilesCount,
|
|
9681
9675
|
maxIndividualFileSize,
|
|
@@ -9828,28 +9822,26 @@ class $64be87195ead800e$export$395654958f48e66a extends (0, $5Sq1V.EntityDefinit
|
|
|
9828
9822
|
});
|
|
9829
9823
|
|
|
9830
9824
|
|
|
9831
|
-
parcelRegister("
|
|
9832
|
-
|
|
9833
|
-
$parcel$export(module.exports, "ImageEditorDefaultProps", function () { return $35745da8be2e2bdc$export$6e31a2501ac1134a; });
|
|
9834
|
-
$parcel$export(module.exports, "ImageEditor", function () { return $35745da8be2e2bdc$export$d0486c7a5136628; });
|
|
9835
|
-
|
|
9825
|
+
parcelRegister("lH146", function(module, exports) {
|
|
9836
9826
|
|
|
9827
|
+
var $6Y72C = parcelRequire("6Y72C");
|
|
9837
9828
|
|
|
9829
|
+
var $j7GoP = parcelRequire("j7GoP");
|
|
9838
9830
|
|
|
9831
|
+
var $dE75A = parcelRequire("dE75A");
|
|
9832
|
+
$parcel$exportWildcard(module.exports, $6Y72C);
|
|
9833
|
+
$parcel$exportWildcard(module.exports, $j7GoP);
|
|
9834
|
+
$parcel$exportWildcard(module.exports, $dE75A);
|
|
9839
9835
|
|
|
9836
|
+
});
|
|
9837
|
+
parcelRegister("6Y72C", function(module, exports) {
|
|
9840
9838
|
|
|
9839
|
+
$parcel$export(module.exports, "FullImagePreview", function () { return $e55e08cc93e76d70$export$f8f702a2376d5f22; });
|
|
9841
9840
|
|
|
9842
9841
|
|
|
9843
|
-
var $ctgDl = parcelRequire("ctgDl");
|
|
9844
9842
|
|
|
9845
|
-
var $
|
|
9846
|
-
|
|
9847
|
-
saveLabel: 'Save',
|
|
9848
|
-
cancelLabel: 'Cancel',
|
|
9849
|
-
rotateClockwiseLabel: 'Rotate clockwise',
|
|
9850
|
-
rotateCounterClockwiseLabel: 'Rotate counter-clockwise'
|
|
9851
|
-
};
|
|
9852
|
-
const $35745da8be2e2bdc$var$FullImagePreview = ({ source: source, rotation: rotation, label: label })=>{
|
|
9843
|
+
var $g81NG = parcelRequire("g81NG");
|
|
9844
|
+
function $e55e08cc93e76d70$export$f8f702a2376d5f22({ source: source, rotation: rotation, label: label }) {
|
|
9853
9845
|
const canvasRef = (0, $b4te3$react.useRef)(null);
|
|
9854
9846
|
(0, $b4te3$react.useEffect)(()=>{
|
|
9855
9847
|
const canvas = canvasRef.current;
|
|
@@ -9862,7 +9854,7 @@ const $35745da8be2e2bdc$var$FullImagePreview = ({ source: source, rotation: rota
|
|
|
9862
9854
|
canvas.height = Math.max(1, Math.round(height * pixelRatio));
|
|
9863
9855
|
const context = canvas.getContext('2d');
|
|
9864
9856
|
if (!context) return;
|
|
9865
|
-
const rotatedSize = (0, $
|
|
9857
|
+
const rotatedSize = (0, $g81NG.getRotatedSize)(source.width, source.height, rotation);
|
|
9866
9858
|
const scale = Math.min(width / rotatedSize.width, height / rotatedSize.height);
|
|
9867
9859
|
context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
|
|
9868
9860
|
context.fillStyle = '#0f0e13';
|
|
@@ -9890,9 +9882,112 @@ const $35745da8be2e2bdc$var$FullImagePreview = ({ source: source, rotation: rota
|
|
|
9890
9882
|
role: "img",
|
|
9891
9883
|
"aria-label": label
|
|
9892
9884
|
});
|
|
9885
|
+
}
|
|
9886
|
+
|
|
9887
|
+
});
|
|
9888
|
+
parcelRegister("g81NG", function(module, exports) {
|
|
9889
|
+
|
|
9890
|
+
$parcel$export(module.exports, "prepareEditorImage", function () { return $c890495ca7130bcb$export$59c0f42ade3efe7c; });
|
|
9891
|
+
$parcel$export(module.exports, "getRotatedSize", function () { return $c890495ca7130bcb$export$3e19c164e30ba0f3; });
|
|
9892
|
+
$parcel$export(module.exports, "renderEditedImage", function () { return $c890495ca7130bcb$export$3a1182d2c0aceae2; });
|
|
9893
|
+
|
|
9894
|
+
|
|
9895
|
+
var $e1adW = parcelRequire("e1adW");
|
|
9896
|
+
async function $c890495ca7130bcb$export$59c0f42ade3efe7c(file, respectExifOrientation) {
|
|
9897
|
+
const image = await (0, $e1adW.loadDecodedImage)(file, respectExifOrientation);
|
|
9898
|
+
try {
|
|
9899
|
+
const { width: width, height: height } = (0, $e1adW.getDecodedImageSize)(image);
|
|
9900
|
+
const canvas = document.createElement('canvas');
|
|
9901
|
+
canvas.width = width;
|
|
9902
|
+
canvas.height = height;
|
|
9903
|
+
const context = canvas.getContext('2d');
|
|
9904
|
+
if (!context) throw new Error('The browser could not create an image canvas.');
|
|
9905
|
+
context.drawImage(image, 0, 0);
|
|
9906
|
+
const preview = await (0, $e1adW.canvasToBlob)(canvas, (0, ($parcel$interopDefault($b4te3$mime))).getType('png'));
|
|
9907
|
+
return {
|
|
9908
|
+
canvas: canvas,
|
|
9909
|
+
previewURL: URL.createObjectURL(preview)
|
|
9910
|
+
};
|
|
9911
|
+
} finally{
|
|
9912
|
+
(0, $e1adW.closeDecodedImage)(image);
|
|
9913
|
+
}
|
|
9914
|
+
}
|
|
9915
|
+
function $c890495ca7130bcb$export$3e19c164e30ba0f3(width, height, rotation) {
|
|
9916
|
+
const radians = rotation * Math.PI / 180;
|
|
9917
|
+
return {
|
|
9918
|
+
width: Math.max(1, Math.round(Math.abs(Math.cos(radians) * width) + Math.abs(Math.sin(radians) * height))),
|
|
9919
|
+
height: Math.max(1, Math.round(Math.abs(Math.sin(radians) * width) + Math.abs(Math.cos(radians) * height)))
|
|
9920
|
+
};
|
|
9921
|
+
}
|
|
9922
|
+
function $c890495ca7130bcb$var$getCropArea(canvas, crop) {
|
|
9923
|
+
if (!crop) return {
|
|
9924
|
+
x: 0,
|
|
9925
|
+
y: 0,
|
|
9926
|
+
width: canvas.width,
|
|
9927
|
+
height: canvas.height
|
|
9928
|
+
};
|
|
9929
|
+
const x = Math.max(0, Math.min(canvas.width - 1, Math.round(crop.x)));
|
|
9930
|
+
const y = Math.max(0, Math.min(canvas.height - 1, Math.round(crop.y)));
|
|
9931
|
+
return {
|
|
9932
|
+
x: x,
|
|
9933
|
+
y: y,
|
|
9934
|
+
width: Math.max(1, Math.min(canvas.width - x, Math.round(crop.width))),
|
|
9935
|
+
height: Math.max(1, Math.min(canvas.height - y, Math.round(crop.height)))
|
|
9936
|
+
};
|
|
9937
|
+
}
|
|
9938
|
+
function $c890495ca7130bcb$export$3a1182d2c0aceae2(source, crop, rotation, options) {
|
|
9939
|
+
const rotatedSize = $c890495ca7130bcb$export$3e19c164e30ba0f3(source.width, source.height, rotation);
|
|
9940
|
+
const rotatedCanvas = document.createElement('canvas');
|
|
9941
|
+
rotatedCanvas.width = rotatedSize.width;
|
|
9942
|
+
rotatedCanvas.height = rotatedSize.height;
|
|
9943
|
+
const rotatedContext = rotatedCanvas.getContext('2d');
|
|
9944
|
+
if (!rotatedContext) throw new Error('The browser could not create an image canvas.');
|
|
9945
|
+
rotatedContext.translate(rotatedCanvas.width / 2, rotatedCanvas.height / 2);
|
|
9946
|
+
rotatedContext.rotate(rotation * Math.PI / 180);
|
|
9947
|
+
rotatedContext.drawImage(source, -source.width / 2, -source.height / 2);
|
|
9948
|
+
const cropArea = $c890495ca7130bcb$var$getCropArea(rotatedCanvas, crop);
|
|
9949
|
+
const resize = options.resize;
|
|
9950
|
+
const requestedScale = resize === false ? 1 : Math.min(resize.maxWidth / cropArea.width, resize.maxHeight / cropArea.height);
|
|
9951
|
+
const scale = resize === false || resize.allowUpscale ? requestedScale : Math.min(1, requestedScale);
|
|
9952
|
+
const output = document.createElement('canvas');
|
|
9953
|
+
output.width = Math.max(1, Math.round(cropArea.width * scale));
|
|
9954
|
+
output.height = Math.max(1, Math.round(cropArea.height * scale));
|
|
9955
|
+
const outputContext = output.getContext('2d');
|
|
9956
|
+
if (!outputContext) throw new Error('The browser could not create an image canvas.');
|
|
9957
|
+
outputContext.imageSmoothingEnabled = true;
|
|
9958
|
+
outputContext.imageSmoothingQuality = 'high';
|
|
9959
|
+
outputContext.drawImage(rotatedCanvas, cropArea.x, cropArea.y, cropArea.width, cropArea.height, 0, 0, output.width, output.height);
|
|
9960
|
+
return output;
|
|
9961
|
+
}
|
|
9962
|
+
|
|
9963
|
+
});
|
|
9964
|
+
|
|
9965
|
+
|
|
9966
|
+
parcelRegister("j7GoP", function(module, exports) {
|
|
9967
|
+
|
|
9968
|
+
$parcel$export(module.exports, "ImageEditorDefaultProps", function () { return $0cac5edaa1a7f2eb$export$6e31a2501ac1134a; });
|
|
9969
|
+
$parcel$export(module.exports, "ImageEditor", function () { return $0cac5edaa1a7f2eb$export$d0486c7a5136628; });
|
|
9970
|
+
|
|
9971
|
+
|
|
9972
|
+
|
|
9973
|
+
|
|
9974
|
+
|
|
9975
|
+
|
|
9976
|
+
|
|
9977
|
+
|
|
9978
|
+
var $6Y72C = parcelRequire("6Y72C");
|
|
9979
|
+
|
|
9980
|
+
var $g81NG = parcelRequire("g81NG");
|
|
9981
|
+
|
|
9982
|
+
var $dE75A = parcelRequire("dE75A");
|
|
9983
|
+
const $0cac5edaa1a7f2eb$export$6e31a2501ac1134a = {
|
|
9984
|
+
saveLabel: 'Save',
|
|
9985
|
+
cancelLabel: 'Cancel',
|
|
9986
|
+
rotateClockwiseLabel: 'Rotate clockwise',
|
|
9987
|
+
rotateCounterClockwiseLabel: 'Rotate counter-clockwise'
|
|
9893
9988
|
};
|
|
9894
|
-
const $
|
|
9895
|
-
const { sourceFile: sourceFile, options: options, onSave: onSave, onCancel: onCancel, saveLabel: saveLabel, cancelLabel: cancelLabel, rotateClockwiseLabel: rotateClockwiseLabel, rotateCounterClockwiseLabel: rotateCounterClockwiseLabel } = (0, $b4te3$mantinecore.useComponentDefaultProps)('ImageEditor', $
|
|
9989
|
+
const $0cac5edaa1a7f2eb$export$d0486c7a5136628 = (props)=>{
|
|
9990
|
+
const { sourceFile: sourceFile, options: options, onSave: onSave, onCancel: onCancel, saveLabel: saveLabel, cancelLabel: cancelLabel, rotateClockwiseLabel: rotateClockwiseLabel, rotateCounterClockwiseLabel: rotateCounterClockwiseLabel } = (0, $b4te3$mantinecore.useComponentDefaultProps)('ImageEditor', $0cac5edaa1a7f2eb$export$6e31a2501ac1134a, props);
|
|
9896
9991
|
const [preparedImage, setPreparedImage] = (0, $b4te3$react.useState)();
|
|
9897
9992
|
const [crop, setCrop] = (0, $b4te3$react.useState)({
|
|
9898
9993
|
x: 0,
|
|
@@ -9920,7 +10015,7 @@ const $35745da8be2e2bdc$export$d0486c7a5136628 = (props)=>{
|
|
|
9920
10015
|
setReady(false);
|
|
9921
10016
|
setSaving(false);
|
|
9922
10017
|
setError(undefined);
|
|
9923
|
-
(0, $
|
|
10018
|
+
(0, $g81NG.prepareEditorImage)(sourceFile, options.exifOrientation).then((result)=>{
|
|
9924
10019
|
prepared = result;
|
|
9925
10020
|
if (disposed) {
|
|
9926
10021
|
URL.revokeObjectURL(result.previewURL);
|
|
@@ -9956,8 +10051,8 @@ const $35745da8be2e2bdc$export$d0486c7a5136628 = (props)=>{
|
|
|
9956
10051
|
setSaving(true);
|
|
9957
10052
|
setError(undefined);
|
|
9958
10053
|
try {
|
|
9959
|
-
const canvas = (0, $
|
|
9960
|
-
const file = await (0, $
|
|
10054
|
+
const canvas = (0, $g81NG.renderEditedImage)(preparedImage.canvas, cropEnabled ? croppedAreaPixels : undefined, rotationDegrees, options);
|
|
10055
|
+
const file = await (0, $dE75A.canvasToProcessedFile)(canvas, sourceFile, options);
|
|
9961
10056
|
await onSave(file);
|
|
9962
10057
|
} catch (e) {
|
|
9963
10058
|
setError(e instanceof Error ? e.message : String(e));
|
|
@@ -10030,7 +10125,7 @@ const $35745da8be2e2bdc$export$d0486c7a5136628 = (props)=>{
|
|
|
10030
10125
|
}
|
|
10031
10126
|
})
|
|
10032
10127
|
}),
|
|
10033
|
-
preparedImage && !cropEnabled && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)($
|
|
10128
|
+
preparedImage && !cropEnabled && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $6Y72C.FullImagePreview), {
|
|
10034
10129
|
source: preparedImage.canvas,
|
|
10035
10130
|
rotation: rotationDegrees,
|
|
10036
10131
|
label: sourceFile.name
|
|
@@ -10070,82 +10165,6 @@ const $35745da8be2e2bdc$export$d0486c7a5136628 = (props)=>{
|
|
|
10070
10165
|
};
|
|
10071
10166
|
|
|
10072
10167
|
});
|
|
10073
|
-
parcelRegister("ctgDl", function(module, exports) {
|
|
10074
|
-
|
|
10075
|
-
$parcel$export(module.exports, "prepareEditorImage", function () { return $bb1020f7e16aab90$export$59c0f42ade3efe7c; });
|
|
10076
|
-
$parcel$export(module.exports, "getRotatedSize", function () { return $bb1020f7e16aab90$export$3e19c164e30ba0f3; });
|
|
10077
|
-
$parcel$export(module.exports, "renderEditedImage", function () { return $bb1020f7e16aab90$export$3a1182d2c0aceae2; });
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
var $48GRA = parcelRequire("48GRA");
|
|
10081
|
-
async function $bb1020f7e16aab90$export$59c0f42ade3efe7c(file, respectExifOrientation) {
|
|
10082
|
-
const image = await (0, $48GRA.loadDecodedImage)(file, respectExifOrientation);
|
|
10083
|
-
try {
|
|
10084
|
-
const { width: width, height: height } = (0, $48GRA.getDecodedImageSize)(image);
|
|
10085
|
-
const canvas = document.createElement('canvas');
|
|
10086
|
-
canvas.width = width;
|
|
10087
|
-
canvas.height = height;
|
|
10088
|
-
const context = canvas.getContext('2d');
|
|
10089
|
-
if (!context) throw new Error('The browser could not create an image canvas.');
|
|
10090
|
-
context.drawImage(image, 0, 0);
|
|
10091
|
-
const preview = await (0, $48GRA.canvasToBlob)(canvas, (0, ($parcel$interopDefault($b4te3$mime))).getType('png'));
|
|
10092
|
-
return {
|
|
10093
|
-
canvas: canvas,
|
|
10094
|
-
previewURL: URL.createObjectURL(preview)
|
|
10095
|
-
};
|
|
10096
|
-
} finally{
|
|
10097
|
-
(0, $48GRA.closeDecodedImage)(image);
|
|
10098
|
-
}
|
|
10099
|
-
}
|
|
10100
|
-
function $bb1020f7e16aab90$export$3e19c164e30ba0f3(width, height, rotation) {
|
|
10101
|
-
const radians = rotation * Math.PI / 180;
|
|
10102
|
-
return {
|
|
10103
|
-
width: Math.max(1, Math.round(Math.abs(Math.cos(radians) * width) + Math.abs(Math.sin(radians) * height))),
|
|
10104
|
-
height: Math.max(1, Math.round(Math.abs(Math.sin(radians) * width) + Math.abs(Math.cos(radians) * height)))
|
|
10105
|
-
};
|
|
10106
|
-
}
|
|
10107
|
-
function $bb1020f7e16aab90$var$getCropArea(canvas, crop) {
|
|
10108
|
-
if (!crop) return {
|
|
10109
|
-
x: 0,
|
|
10110
|
-
y: 0,
|
|
10111
|
-
width: canvas.width,
|
|
10112
|
-
height: canvas.height
|
|
10113
|
-
};
|
|
10114
|
-
const x = Math.max(0, Math.min(canvas.width - 1, Math.round(crop.x)));
|
|
10115
|
-
const y = Math.max(0, Math.min(canvas.height - 1, Math.round(crop.y)));
|
|
10116
|
-
return {
|
|
10117
|
-
x: x,
|
|
10118
|
-
y: y,
|
|
10119
|
-
width: Math.max(1, Math.min(canvas.width - x, Math.round(crop.width))),
|
|
10120
|
-
height: Math.max(1, Math.min(canvas.height - y, Math.round(crop.height)))
|
|
10121
|
-
};
|
|
10122
|
-
}
|
|
10123
|
-
function $bb1020f7e16aab90$export$3a1182d2c0aceae2(source, crop, rotation, options) {
|
|
10124
|
-
const rotatedSize = $bb1020f7e16aab90$export$3e19c164e30ba0f3(source.width, source.height, rotation);
|
|
10125
|
-
const rotatedCanvas = document.createElement('canvas');
|
|
10126
|
-
rotatedCanvas.width = rotatedSize.width;
|
|
10127
|
-
rotatedCanvas.height = rotatedSize.height;
|
|
10128
|
-
const rotatedContext = rotatedCanvas.getContext('2d');
|
|
10129
|
-
if (!rotatedContext) throw new Error('The browser could not create an image canvas.');
|
|
10130
|
-
rotatedContext.translate(rotatedCanvas.width / 2, rotatedCanvas.height / 2);
|
|
10131
|
-
rotatedContext.rotate(rotation * Math.PI / 180);
|
|
10132
|
-
rotatedContext.drawImage(source, -source.width / 2, -source.height / 2);
|
|
10133
|
-
const cropArea = $bb1020f7e16aab90$var$getCropArea(rotatedCanvas, crop);
|
|
10134
|
-
const resize = options.resize;
|
|
10135
|
-
const requestedScale = resize === false ? 1 : Math.min(resize.maxWidth / cropArea.width, resize.maxHeight / cropArea.height);
|
|
10136
|
-
const scale = resize === false || resize.allowUpscale ? requestedScale : Math.min(1, requestedScale);
|
|
10137
|
-
const output = document.createElement('canvas');
|
|
10138
|
-
output.width = Math.max(1, Math.round(cropArea.width * scale));
|
|
10139
|
-
output.height = Math.max(1, Math.round(cropArea.height * scale));
|
|
10140
|
-
const outputContext = output.getContext('2d');
|
|
10141
|
-
if (!outputContext) throw new Error('The browser could not create an image canvas.');
|
|
10142
|
-
outputContext.imageSmoothingEnabled = true;
|
|
10143
|
-
outputContext.imageSmoothingQuality = 'high';
|
|
10144
|
-
outputContext.drawImage(rotatedCanvas, cropArea.x, cropArea.y, cropArea.width, cropArea.height, 0, 0, output.width, output.height);
|
|
10145
|
-
return output;
|
|
10146
|
-
}
|
|
10147
|
-
|
|
10148
|
-
});
|
|
10149
10168
|
|
|
10150
10169
|
|
|
10151
10170
|
|
|
@@ -10177,10 +10196,10 @@ function $892d39cbb4228264$export$9c6ff20038615530() {
|
|
|
10177
10196
|
...props
|
|
10178
10197
|
};
|
|
10179
10198
|
buttonResult.current = 'Quit';
|
|
10180
|
-
const handleOK = async (fileprocess_id,
|
|
10199
|
+
const handleOK = async (fileprocess_id, files)=>{
|
|
10181
10200
|
buttonResult.current = 'OK';
|
|
10182
10201
|
await modals.close();
|
|
10183
|
-
if (onOK) await onOK(fileprocess_id,
|
|
10202
|
+
if (onOK) await onOK(fileprocess_id, files);
|
|
10184
10203
|
};
|
|
10185
10204
|
const handleCancel = async ()=>{
|
|
10186
10205
|
buttonResult.current = 'Cancel';
|
|
@@ -10199,7 +10218,7 @@ function $892d39cbb4228264$export$9c6ff20038615530() {
|
|
|
10199
10218
|
uploadAPI: uploadAPI,
|
|
10200
10219
|
uploaderProps: uploaderProps,
|
|
10201
10220
|
client: client,
|
|
10202
|
-
onOK: async (fileprocess_id,
|
|
10221
|
+
onOK: async (fileprocess_id, files)=>await handleOK(fileprocess_id, files),
|
|
10203
10222
|
onCancel: ()=>handleCancel(),
|
|
10204
10223
|
showOKButton: true,
|
|
10205
10224
|
...filesUploadFormProps
|
|
@@ -40141,6 +40160,8 @@ var $gdPjD = parcelRequire("gdPjD");
|
|
|
40141
40160
|
|
|
40142
40161
|
var $6i1ou = parcelRequire("6i1ou");
|
|
40143
40162
|
|
|
40163
|
+
var $lH146 = parcelRequire("lH146");
|
|
40164
|
+
|
|
40144
40165
|
var $jg7sD = parcelRequire("jg7sD");
|
|
40145
40166
|
|
|
40146
40167
|
var $lB56X = parcelRequire("lB56X");
|
|
@@ -40179,6 +40200,7 @@ $parcel$exportWildcard(module.exports, $hMHMl);
|
|
|
40179
40200
|
$parcel$exportWildcard(module.exports, $iTpjT);
|
|
40180
40201
|
$parcel$exportWildcard(module.exports, $gdPjD);
|
|
40181
40202
|
$parcel$exportWildcard(module.exports, $6i1ou);
|
|
40203
|
+
$parcel$exportWildcard(module.exports, $lH146);
|
|
40182
40204
|
$parcel$exportWildcard(module.exports, $jg7sD);
|
|
40183
40205
|
$parcel$exportWildcard(module.exports, $lB56X);
|
|
40184
40206
|
$parcel$exportWildcard(module.exports, $ccjva);
|
|
@@ -42161,7 +42183,7 @@ const $8cba51256aebea2d$export$9e8d6341d22c7058 = {
|
|
|
42161
42183
|
}
|
|
42162
42184
|
};
|
|
42163
42185
|
function $8cba51256aebea2d$export$a2bc9feb52ac7227(props) {
|
|
42164
|
-
const { client: client, fileProcessColumn: fileProcessColumn, labels: suppliedLabels, initialImageURL: initialImageURL, parentFormAPI: parentFormAPI, fileGUIDColumn: fileGUIDColumn, maxFileSize: maxFileSize, editor: editor, imageProcessing: imageProcessing } = (0, $b4te3$mantinecore.useComponentDefaultProps)('AvatarUploader', $8cba51256aebea2d$export$9e8d6341d22c7058, props);
|
|
42186
|
+
const { client: client, fileProcessColumn: fileProcessColumn, labels: suppliedLabels, initialImageURL: initialImageURL, parentFormAPI: parentFormAPI, fileGUIDColumn: fileGUIDColumn, maxFileSize: maxFileSize, editor: editor, imageProcessing: imageProcessing, onDeleteComplete: onDeleteComplete } = (0, $b4te3$mantinecore.useComponentDefaultProps)('AvatarUploader', $8cba51256aebea2d$export$9e8d6341d22c7058, props);
|
|
42165
42187
|
const labels = (0, $b4te3$react.useMemo)(()=>({
|
|
42166
42188
|
...$8cba51256aebea2d$var$AvatarUploaderDefaultLabels,
|
|
42167
42189
|
...suppliedLabels
|
|
@@ -42254,7 +42276,8 @@ function $8cba51256aebea2d$export$a2bc9feb52ac7227(props) {
|
|
|
42254
42276
|
withCloseButton: false
|
|
42255
42277
|
},
|
|
42256
42278
|
onBeforeReplace: async ()=>await confirmReplacement(),
|
|
42257
|
-
onUploadComplete: commitUploadedFile
|
|
42279
|
+
onUploadComplete: commitUploadedFile,
|
|
42280
|
+
onDeleteComplete: onDeleteComplete
|
|
42258
42281
|
});
|
|
42259
42282
|
const selectedGUID = fileGUIDColumn.value || undefined;
|
|
42260
42283
|
const currentFile = uploadAPI.files.find((file)=>file.vc_fileguid === selectedGUID);
|